Skip to content

Commit 727a30e

Browse files
author
m00nyONE
committed
add LGB as non optional dependency and remove legacy features after U46
1 parent 02dfa94 commit 727a30e

File tree

3 files changed

+19
-41
lines changed

3 files changed

+19
-41
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2024.03.14 - @m00nyONE
2+
- add LibGroupBroadcast as dependency
3+
- LibDataShare will still work with map pings until U46 arrives and then auto switch to compatibility mode for everyone!
4+
- this is to avoid incompatibilities between players who have LGB installed and those who do not
5+
16
## 2024.02.10 - @m00nyONE
27
- introducing compatibility layer to LibGroupBroadcast
38
- fix handler bleeding to global

LibDataShare.lua

+12-40
Original file line numberDiff line numberDiff line change
@@ -475,37 +475,7 @@ end
475475

476476
--------------------------------------------------------------------------
477477

478-
local function OnPlayerActivated()
479-
-- EOL detection
480-
481-
if ApiVersion >= 101046 then
482-
if WorldName ~= "PTS" then
483-
zo_callLater(function()
484-
d("|cFF00FFWarning: 'LibDataShare' is now disabled due to API restrictions in Update 46. The MapPing API only allows one ping every 10 seconds, and this library is no longer functional. Please uninstall it to avoid seeing this message.|r")
485-
end, 5000)
486-
487-
-- remove functionality of the addon completely by overwriting all functions of the Library
488-
MapHandler.QueueData = function() end
489-
MapHandler.SendData = function() end
490-
lib.PrepareMap = function() return false end
491-
lib.IsEnabled = function() return false end
492-
lib.GetMapPing = function() return 0, 0 end
493-
lib.SetMapPing = function() end
494-
lib.ResolveConflicts = function() end
495-
OnMapPing = function() end
496-
MapStateChange = function() end
497-
498-
return -- exit Initialize function here to not load the OnPlayerActivated function
499-
end
500-
501-
502-
-- set the ping rate to every 10seconds because of API changes in U46
503-
PING_RATE = 10200
504-
zo_callLater(function()
505-
d("|cFF00FFImportant: Please remove 'LibDataShare' from your add-ons! The MapPing API has been rate-limited in Update 46, allowing only one ping every 10 seconds. Continuing to use this library may result in being kicked from the server.|r")
506-
end, 5000)
507-
end
508-
478+
local function Legacy_MapPing_OnPlayerActivated()
509479
-- Unregister map ping handler.
510480
EM:UnregisterForEvent(NAME, EVENT_MAP_PING)
511481

@@ -529,18 +499,20 @@ local function OnPlayerActivated()
529499
end
530500

531501
local function Initialize()
532-
if not LGB then
533-
-- run without compatibility layer
534-
EM:RegisterForEvent(NAME, EVENT_PLAYER_ACTIVATED, OnPlayerActivated)
502+
503+
if ApiVersion >= 101046 then
504+
-- create compatibility layer
505+
DeclareLGBProtocols()
506+
overwriteLibFunctions()
507+
overwriteMapHandlerFunctions()
508+
registerSendQueuedMessages()
509+
d("LibDataShare compatibility mode initiated")
510+
535511
return
536512
end
537513

538-
-- create compatibility layer
539-
DeclareLGBProtocols()
540-
overwriteLibFunctions()
541-
overwriteMapHandlerFunctions()
542-
registerSendQueuedMessages()
543-
d("LibDataShare compatibility mode initiated")
514+
-- run without compatibility layer
515+
EM:RegisterForEvent(NAME, EVENT_PLAYER_ACTIVATED, Legacy_MapPing_OnPlayerActivated)
544516

545517
end
546518

LibDataShare.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
## Version: dev
1010
## AddOnVersion: 99999999
1111
## APIVersion: 101044 101045
12-
## OptionalDependsOn: LibMapPing RaidNotifier BanditsUserInterface FoundryTacticalCombat TaosGroupTools POC LibGroupSocket LibGroupBroadcast
12+
## OptionalDependsOn: LibMapPing RaidNotifier BanditsUserInterface FoundryTacticalCombat TaosGroupTools POC LibGroupSocket
13+
## DependsOn: LibGroupBroadcast>=88
1314
## IsLibrary: true
1415
## Description: Deprecated Library for sharing small amounts of data between group members. Originally created for HodorReflexes. Please use LibGroupBroadcast after U45 instead of this Library.
1516

0 commit comments

Comments
 (0)