Mercurial > wow > ouroloot
changeset 67:c01875b275ca
Do not use UnitName on other people during RAID_ROSTER_UPDATE, as they may be a weed (thank you Calvieri for unknowingly eating a lifegiving seed and exposing this bug). Be more informative to the user about errors during load. Do not try to run other files if a load-time error happens, as it only generates cascading noise.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Tue, 08 May 2012 02:41:23 +0000 |
parents | 43913e02a1ef |
children | 3bed6d51e077 |
files | Ouro_Loot.toc abbreviations.lua bossmods.lua core.lua gui.lua text_tabs.lua verbage.lua |
diffstat | 7 files changed, 84 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/Ouro_Loot.toc Fri Apr 27 10:11:56 2012 +0000 +++ b/Ouro_Loot.toc Tue May 08 02:41:23 2012 +0000 @@ -6,6 +6,7 @@ ## SavedVariables: OuroLootSV, OuroLootSV_saved, OuroLootSV_opts, OuroLootSV_hist, OuroLootSV_log ## OptionalDeps: Ace3, DBM-Core, lib-st, LibFarmbuyer, tekDebug ## LoadManagers: AddonLoader +# Do not use /loot in this list, Blizzard's ChatTypeInfo gets confused: ## X-LoadOn-Slash: /ouroloot ## X-LoadOn-InterfaceOptions: Ouro Loot ## X-LoadOn-Raid: true
--- a/abbreviations.lua Fri Apr 27 10:11:56 2012 +0000 +++ b/abbreviations.lua Tue May 08 02:41:23 2012 +0000 @@ -1,4 +1,37 @@ +--[==[ +If you want to change these to something else, like in-jokes for your guild, +write a small addon like this: + + Interface/AddOns/YourMod/YourMod.toc: + ================================= + ## Interface: xxxxx + ## Title: Ouro Loot For My Guild + * ## RequiredDeps: Ouro_Loot + * ## LoadOnDemand: 1 + * ## LoadWith: Ouro_Loot + + main.lua + ================================= + +Lines with * are crucial. Then replace specific entries like this: + + Interface/AddOns/YourMod/main.lua: + ================================= + local ouroloot = LibStub("AceAddon-3.0"):GetAddon("Ouro Loot") + + ouroloot.instance_abbrev["The Bastion of Twilight"] = + [[Steve Said He'd /gquit If We Make Him Go Here Ever Again]] + + ouroloot.boss_abbrev["Omnotron Defense System"] = + [[Jim Will Facetank The Slimes Now]] + ================================= + +This lets you update Ouro Loot with a new version (overwriting this file) +without losing any of your changes. +]==] + local addon = select(2,...) +if addon.NOLOAD then return end addon.instance_abbrev = { -------- Cata
--- a/bossmods.lua Fri Apr 27 10:11:56 2012 +0000 +++ b/bossmods.lua Tue May 08 02:41:23 2012 +0000 @@ -1,4 +1,5 @@ local addon = select(2,...) +if addon.NOLOAD then return end --[==[ Here's the control flow:
--- a/core.lua Fri Apr 27 10:11:56 2012 +0000 +++ b/core.lua Tue May 08 02:41:23 2012 +0000 @@ -245,6 +245,38 @@ addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Ouro Loot", "AceTimer-3.0", "AceComm-3.0", "AceConsole-3.0", "AceEvent-3.0") +-- if given, MSG should be a complete-ish sentence +function addon:load_assert (cond, msg, ...) + if cond then + return cond, msg, ... + end + msg = msg or "load-time assertion failed!" + self.NOLOAD = msg + self:Printf([[|cffff1010ERROR:|r <|cff00ff00%s|r> Ouro Loot cannot finish loading. You will need to type |cff30adff%s|r once these problems are resolved, and try again.]], msg, _G.SLASH_RELOAD1) + SLASH_ACECONSOLE_OUROLOOT1 = nil + SLASH_ACECONSOLE_OUROLOOT2 = nil + _G.error (msg, --[[level=]]2) +end + +-- Seriously? ORLY? +-- YARLY. Go ahead and guess what was involved in tracking this down. If +-- more such effects are added in the future, the "id==xxxxx" will need to +-- change into a probe of a table of known-problematic IDs. +for i = 1, 40 do -- BUFF_MAX_DISPLAY==32, enh + local id = select(11,UnitAura('player', i, 'HELPFUL')) + if id == 88715 then + -- What I really want to do is pause until the thing is clicked off, + -- then continue with the rest of the file. No can do. Could also + -- just set some hooks and then re-OnInit/OnEnable after the aura + -- expires, but that's a hassle. GAH. Punt. + local text = UnitAura('player', i, 'HELPFUL') + text = ([[Cannot initialize while |cff71d5ff|Hspell:88715|h[%s]|h|cff00ff00 is active!]]): + format(text) + addon:load_assert(nil,text) + return -- were this C code running through lint, I'd put NOTREACHED + end +end + ------ Globals local g_loot = nil @@ -453,6 +485,9 @@ ------ Ace3 framework stuff function addon:OnInitialize() + if self.author_debug then + _G.OL = self + end _log = OuroLootSV_log -- VARIABLES_LOADED has fired by this point; test if we're doing something like @@ -507,9 +542,9 @@ -- get item filter table if needed if opts.itemfilter == nil then - opts.itemfilter = addon.default_itemfilter + opts.itemfilter = self.default_itemfilter end - addon.default_itemfilter = nil + self.default_itemfilter = nil self:RegisterChatCommand("ouroloot", "OnSlash") if opts.register_slashloot then @@ -519,7 +554,7 @@ end self.history_all = self.history_all or OuroLootSV_hist or {} - local r = assert(GetRealmName()) + local r = self:load_assert (GetRealmName(), "how the freak does GetRealmName() fail?") self.history_all[r] = self:_prep_new_history_category (self.history_all[r], r) self.history = self.history_all[r] if (not InCombatLockdown()) and OuroLootSV_hist and @@ -599,6 +634,7 @@ _init(self) self.dprint('flow', "version strings:", revision_large, self.status_text) + self.load_assert = nil self.OnInitialize = nil -- free up ALL the things! end @@ -823,9 +859,9 @@ end do - local IsInInstance, UnitName, UnitIsConnected, UnitClass, UnitRace, UnitSex, + local IsInInstance, UnitIsConnected, UnitClass, UnitRace, UnitSex, UnitLevel, UnitInRaid, UnitIsVisible, GetGuildInfo, GetRaidRosterInfo = - IsInInstance, UnitName, UnitIsConnected, UnitClass, UnitRace, UnitSex, + IsInInstance, UnitIsConnected, UnitClass, UnitRace, UnitSex, UnitLevel, UnitInRaid, UnitIsVisible, GetGuildInfo, GetRaidRosterInfo local time, difftime = time, difftime local R_ACTIVE, R_OFFLINE, R_LEFT = 1, 2, 3 @@ -863,21 +899,16 @@ redo = false for i = 1, GetNumRaidMembers() do local unit = 'raid'..i - local name = UnitName(unit) + -- We grab a bunch of return values here, but only pay attention to + -- them under specific circumstances. + local name, connected, subgroup, level, class, _ + name, _, subgroup, level, _, class, connected = GetRaidRosterInfo(i) -- No, that's not my typo, it really is "uknownbeing" in Blizzard's code. if name and name ~= UNKNOWN and name ~= UNKNOWNOBJECT and name ~= UKNOWNBEING then if not g_loot.raiders[name] then g_loot.raiders[name] = { needinfo=true } end local r = g_loot.raiders[name] - -- We grab a bunch of return values here, but only pay attention to - -- them under specific circumstances. - local grri_name, connected, subgroup, level, class, _ - grri_name, _, subgroup, level, _, class, connected = GetRaidRosterInfo(i) - if name ~= grri_name then - error("UnitName ("..tostring(name)..") =/= grri_name (".. - tostring(grri_name)..") of same raidindex ("..i..")") - end r.subgroup = subgroup if r.needinfo and UnitIsVisible(unit) then r.needinfo = nil @@ -1500,7 +1531,6 @@ self:RegisterComm(self.identTg, "OnCommReceivedNocache") if self.author_debug then - _G.OL = self _G.Oloot = g_loot end end
--- a/gui.lua Fri Apr 27 10:11:56 2012 +0000 +++ b/gui.lua Tue May 08 02:41:23 2012 +0000 @@ -1,4 +1,5 @@ local addon = select(2,...) +if addon.NOLOAD then return end --[[ Purely the AceGUI-related routines, and the subroutines needed for support. @@ -1960,6 +1961,7 @@ -- try to get everything to update, rebuild, refresh... ugh, no self.display:Hide() end + if self.NOLOAD then return end -- don't even try -- This probably causes taint... hm. local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME