0.1.164: wiederholbare Brett-Quests nach Abschluss entfernen; Abmelde-Meldung beim Ausloggen (Brett, Beasts-Sync)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
Lacustat
2026-10-29 01:02:58 +01:00
co-authored by Claude Sonnet 5.5
parent 80c1ba83f2
commit 8bda1edb92
2 changed files with 48 additions and 1 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
## Notes: Archive of wild beasts: where they live, what they eat, what taming teaches. Learns while you play, with export and import.
## Notes-deDE: Archiv wilder Tiere: wo sie leben, was sie fressen, was das Zähmen lehrt. Lernt beim Spielen, mit Export und Import.
## Author: Lacustat
## Version: 0.1.163
## Version: 0.1.164
## Dependencies: Freewood-OctoWoW-Core, Freewood-OctoWoW-Pet
## OptionalDeps: Freewood-OctoWoW-BeastsData, Freewood-OctoWoW-Codex
+47
View File
@@ -1151,9 +1151,55 @@ function Sync:OnAddonMessage(prefix, text, channel, sender)
end
return
end
if type(text) == "string" and text:sub(1, 2) == "G|" then
self:HandleBye(sender)
return
end
self:HandleMessage(channel, sender, text)
end
-- Ein Spieler meldet sich ab: ihm nichts mehr senden, Warteschlange fuer ihn leeren
function Sync:HandleBye(sender)
local name = KeyOf(sender)
if not name or IsSelf(sender) then return end
state.peers[name] = nil
state.sessions[name] = nil
state.served[name] = nil
local q = state.queue
for i = #q, 1, -1 do
local item = q[i]
if not item.bn then
local who = tostring(item.text or ""):match("^%a|([^|]+)|")
if who and KeyOf(who) == name then table.remove(q, i) end
end
end
end
-- Beim Ausloggen/Beenden "Tschuess" in den Kanal (an der Warteschlange vorbei)
function Sync:SayBye()
if not self.started or not self:AnyEnabled() then return end
local dist, target = self:Distribution("global")
if dist then Raw(dist, target, "G|") end
state.queue = {}
end
local byeHooked = false
local function InstallByeHooks()
if byeHooked then return end
byeHooked = true
if _G.hooksecurefunc then
for _, fn in ipairs({ "Logout", "Quit" }) do
if type(_G[fn]) == "function" then pcall(hooksecurefunc, fn, function() Sync:SayBye() end) end
end
end
for _, ev in ipairs({ "PLAYER_QUITING", "PLAYER_CAMPING", "PLAYER_LOGOUT" }) do
pcall(FW.RegisterEvent, FW, ev, function() Sync:SayBye() end, Sync)
end
pcall(FW.RegisterEvent, FW, "CANCEL_LOGOUT", function()
if Sync.started then C_Timer.After(2, function() Sync:SendHello() end) end
end, Sync)
end
-- Nachricht eines Battle.net-Freundes
function Sync:OnBNMessage(prefix, text, _, senderID)
if prefix ~= PREFIX then
@@ -1205,6 +1251,7 @@ function Sync:Start()
FW:RegisterEvent("GROUP_ROSTER_UPDATE", self.OnGroupChanged, self)
FW:RegisterEvent("BN_CHAT_MSG_ADDON", self.OnBNMessage, self)
FW:RegisterEvent("BN_FRIEND_ACCOUNT_ONLINE", self.OnFriendOnline, self)
InstallByeHooks()
FW:On("BEASTS_UPDATED", function(_, id)
if id then
Sync:QueueAnnounce(id)