Mercurial > wow > ouroloot
diff core.lua @ 149:df0ca8ed1aff
Be smarter when joining a raid. Add some more flow-control debug printing.
Given (A) joining a raid, which triggers a delayed addon load, and seeing the
"what to do next" popup, and (B) restoring previous data which contains only
a raid roster or generated text, fix the interaction in which the activation
from (B) overrides the user's choice in (A)'s popup.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Thu, 08 Jan 2015 15:22:27 -0500 |
parents | 113dd7c86222 |
children | 63bda09d88fe |
line wrap: on
line diff
--- a/core.lua Wed Jan 07 17:37:43 2015 -0500 +++ b/core.lua Thu Jan 08 15:22:27 2015 -0500 @@ -1469,8 +1469,7 @@ -- event registration from onload, joined a raid, maybe show popup self.dprint('flow', "RRU check:", self.popped, opts.popup_on_join) if (not self.popped) and opts.popup_on_join then - self.popped = StaticPopup_Show "OUROL_REMIND" - self.popped.data = self + self.popped = StaticPopup_Show("OUROL_REMIND",nil,nil,self) return end elseif event == "Activate" then @@ -1882,9 +1881,9 @@ elseif cmd:find("^thre") then self:SetThreshold(arg) - elseif cmd == "on" then self:Activate(arg) + elseif cmd == "on" then self:Activate("cmdon",arg) elseif cmd == "off" then self:Deactivate() - elseif cmd == "broadcast" or cmd == "bcast" then self:Activate(nil,true) + elseif cmd == "broadcast" or cmd == "bcast" then self:Activate("cmdbcast",nil,true) elseif cmd == "toggle" then if self.display then @@ -1972,8 +1971,8 @@ ------ On/off -- Both of these need to be (effectively) idempotent. -function addon:Activate (opt_threshold, opt_bcast_only) - self.dprint('flow', ":Activate is running") +function addon:Activate (whence, opt_threshold, opt_bcast_only) + self.dprint('flow', ":Activate called from", whence) self:RegisterEvent("GROUP_ROSTER_UPDATE") self:RegisterEvent("PLAYER_ENTERING_WORLD", function() self:ScheduleTimer("GROUP_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end) @@ -2021,6 +2020,7 @@ self.enabled and "tracking" or "only broadcasting", self.thresholds[self.threshold]) self:broadcast('revcheck',version_large) + self.dprint('flow', ":Activate from", whence, "finished") end -- Note: running '/ouroloot off' will also avoid the popup reminder when @@ -2409,9 +2409,12 @@ end self.DO_ITEMID_FIX = dofix or nil _do_loot_metas() - self:ScheduleTimer("Activate", 12, opts.threshold) -- FIXME printed could be too large if entries were deleted, how much do we care? self.sharder = opts.autoshard + if self.popped then + -- Actual loot got restored, potentially re-activate. + self:ScheduleTimer("Activate", 12, "_init-restore", opts.threshold) + end else g_loot = {} end @@ -4001,7 +4004,7 @@ local bcast_on = addon.format_hypertext ([[the red pill]], '|cffff4040', function (self) if not self.rebroadcast then - self:Activate(nil,true) + self:Activate("bcast-respond",nil,true) end self:broadcast('bcast_responder') end)