Mercurial > wow > ouroloot
comparison 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 |
comparison
equal
deleted
inserted
replaced
148:113dd7c86222 | 149:df0ca8ed1aff |
---|---|
1467 -- hot code path, be careful | 1467 -- hot code path, be careful |
1468 | 1468 |
1469 -- event registration from onload, joined a raid, maybe show popup | 1469 -- event registration from onload, joined a raid, maybe show popup |
1470 self.dprint('flow', "RRU check:", self.popped, opts.popup_on_join) | 1470 self.dprint('flow', "RRU check:", self.popped, opts.popup_on_join) |
1471 if (not self.popped) and opts.popup_on_join then | 1471 if (not self.popped) and opts.popup_on_join then |
1472 self.popped = StaticPopup_Show "OUROL_REMIND" | 1472 self.popped = StaticPopup_Show("OUROL_REMIND",nil,nil,self) |
1473 self.popped.data = self | |
1474 return | 1473 return |
1475 end | 1474 end |
1476 elseif event == "Activate" then | 1475 elseif event == "Activate" then |
1477 -- dispatched from Activate | 1476 -- dispatched from Activate |
1478 if opts.history_suppress_LFR | 1477 if opts.history_suppress_LFR |
1880 end | 1879 end |
1881 | 1880 |
1882 elseif cmd:find("^thre") then | 1881 elseif cmd:find("^thre") then |
1883 self:SetThreshold(arg) | 1882 self:SetThreshold(arg) |
1884 | 1883 |
1885 elseif cmd == "on" then self:Activate(arg) | 1884 elseif cmd == "on" then self:Activate("cmdon",arg) |
1886 elseif cmd == "off" then self:Deactivate() | 1885 elseif cmd == "off" then self:Deactivate() |
1887 elseif cmd == "broadcast" or cmd == "bcast" then self:Activate(nil,true) | 1886 elseif cmd == "broadcast" or cmd == "bcast" then self:Activate("cmdbcast",nil,true) |
1888 | 1887 |
1889 elseif cmd == "toggle" then | 1888 elseif cmd == "toggle" then |
1890 if self.display then | 1889 if self.display then |
1891 self.display:Hide() | 1890 self.display:Hide() |
1892 else | 1891 else |
1970 end | 1969 end |
1971 | 1970 |
1972 | 1971 |
1973 ------ On/off | 1972 ------ On/off |
1974 -- Both of these need to be (effectively) idempotent. | 1973 -- Both of these need to be (effectively) idempotent. |
1975 function addon:Activate (opt_threshold, opt_bcast_only) | 1974 function addon:Activate (whence, opt_threshold, opt_bcast_only) |
1976 self.dprint('flow', ":Activate is running") | 1975 self.dprint('flow', ":Activate called from", whence) |
1977 self:RegisterEvent("GROUP_ROSTER_UPDATE") | 1976 self:RegisterEvent("GROUP_ROSTER_UPDATE") |
1978 self:RegisterEvent("PLAYER_ENTERING_WORLD", | 1977 self:RegisterEvent("PLAYER_ENTERING_WORLD", |
1979 function() self:ScheduleTimer("GROUP_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end) | 1978 function() self:ScheduleTimer("GROUP_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end) |
1980 self.popped = true | 1979 self.popped = true |
1981 if self.DO_ITEMID_FIX then | 1980 if self.DO_ITEMID_FIX then |
2019 self:Fire ('Activate', self.enabled, self.rebroadcast, self.threshold) | 2018 self:Fire ('Activate', self.enabled, self.rebroadcast, self.threshold) |
2020 self:Print("Now %s; threshold currently %s.", | 2019 self:Print("Now %s; threshold currently %s.", |
2021 self.enabled and "tracking" or "only broadcasting", | 2020 self.enabled and "tracking" or "only broadcasting", |
2022 self.thresholds[self.threshold]) | 2021 self.thresholds[self.threshold]) |
2023 self:broadcast('revcheck',version_large) | 2022 self:broadcast('revcheck',version_large) |
2023 self.dprint('flow', ":Activate from", whence, "finished") | |
2024 end | 2024 end |
2025 | 2025 |
2026 -- Note: running '/ouroloot off' will also avoid the popup reminder when | 2026 -- Note: running '/ouroloot off' will also avoid the popup reminder when |
2027 -- joining a raid, but will not change the saved option setting. | 2027 -- joining a raid, but will not change the saved option setting. |
2028 function addon:Deactivate() | 2028 function addon:Deactivate() |
2407 e.cache_miss = (e.cache_miss or missing_data) or nil | 2407 e.cache_miss = (e.cache_miss or missing_data) or nil |
2408 dofix = dofix or e.cache_miss | 2408 dofix = dofix or e.cache_miss |
2409 end | 2409 end |
2410 self.DO_ITEMID_FIX = dofix or nil | 2410 self.DO_ITEMID_FIX = dofix or nil |
2411 _do_loot_metas() | 2411 _do_loot_metas() |
2412 self:ScheduleTimer("Activate", 12, opts.threshold) | |
2413 -- FIXME printed could be too large if entries were deleted, how much do we care? | 2412 -- FIXME printed could be too large if entries were deleted, how much do we care? |
2414 self.sharder = opts.autoshard | 2413 self.sharder = opts.autoshard |
2414 if self.popped then | |
2415 -- Actual loot got restored, potentially re-activate. | |
2416 self:ScheduleTimer("Activate", 12, "_init-restore", opts.threshold) | |
2417 end | |
2415 else | 2418 else |
2416 g_loot = {} | 2419 g_loot = {} |
2417 end | 2420 end |
2418 if type(g_loot.raiders) ~= 'table' then | 2421 if type(g_loot.raiders) ~= 'table' then |
2419 g_loot.raiders = {} | 2422 g_loot.raiders = {} |
3999 OCR_funcs['17boss'] = OCR_funcs['16boss'] | 4002 OCR_funcs['17boss'] = OCR_funcs['16boss'] |
4000 | 4003 |
4001 local bcast_on = addon.format_hypertext ([[the red pill]], '|cffff4040', | 4004 local bcast_on = addon.format_hypertext ([[the red pill]], '|cffff4040', |
4002 function (self) | 4005 function (self) |
4003 if not self.rebroadcast then | 4006 if not self.rebroadcast then |
4004 self:Activate(nil,true) | 4007 self:Activate("bcast-respond",nil,true) |
4005 end | 4008 end |
4006 self:broadcast('bcast_responder') | 4009 self:broadcast('bcast_responder') |
4007 end) | 4010 end) |
4008 local waferthin = addon.format_hypertext ([[the blue pill]], '|cff0070dd', | 4011 local waferthin = addon.format_hypertext ([[the blue pill]], '|cff0070dd', |
4009 function (self) | 4012 function (self) |