Mercurial > wow > ouroloot
changeset 61:99ab21f0755f
Fix major breakage in attendance snapshotting.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Thu, 19 Apr 2012 00:52:37 +0000 |
parents | 45d2b153c2df |
children | d5fe3482db67 |
files | core.lua text_tabs.lua |
diffstat | 2 files changed, 85 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/core.lua Tue Apr 17 20:51:36 2012 +0000 +++ b/core.lua Thu Apr 19 00:52:37 2012 +0000 @@ -3,63 +3,64 @@ --[==[ g_loot's numeric indices are loot entries (including titles, separators, etc); its named indices are: -- forum saved text from forum markup window, default nil -- attend saved text from raid attendence window, default nil -- printed.FOO last loot index formatted into text window FOO, default 0 -- raiders accumulating raid roster data as we see raid members; indexed +- forum saved text from forum markup window, default nil +- attend saved text from raid attendence window, default nil +- printed.FOO last loot index formatted into text window FOO, default 0 +- raiders accumulating raid roster data as we see raid members; indexed by player name with subtable fields: -- class capitalized English codename ("WARRIOR", "DEATHKNIGHT", etc) -- subgroup 1-8 -- race English codename ("BloodElf", etc) -- sex 1 = unknown/error, 2 = male, 3 = female -- level can be 0 if player was offline at the time -- guild guild name, or missing if unguilded -- online 1 = online, 2 = offline, 3 = no longer in raid +- class capitalized English codename ("WARRIOR", "DEATHKNIGHT", etc) +- subgroup 1-8 +- race English codename ("BloodElf", etc) +- sex 1 = unknown/error, 2 = male, 3 = female +- level can be 0 if player was offline at the time +- guild guild name, or missing if unguilded +- online 1 = online, 2 = offline, 3 = no longer in raid [both of these next two fields use time_t values:] -- join time player joined the raid (or first time we've seen them) -- leave time player left the raid (or time we've left the raid) +- join time player joined the raid (or first time we've seen them) +- leave time player left the raid (or time we've left the raid, if + 'online' is not 3) Common g_loot entry indices: -- kind time/boss/loot -- hour 0-23, on the *physical instance server*, not the realm server -- minute 0-59, ditto -- stamp time_t on the local computer -- cols graphical display data; cleared when logging out +- kind time/boss/loot +- hour 0-23, on the *physical instance server*, not the realm server +- minute 0-59, ditto +- stamp time_t on the local computer +- cols graphical display data; cleared when logging out Time specific g_loot indices: -- startday table with month/day/year/text fields from makedate() +- startday table with month/day/year/text fields from makedate() text is always "dd Month yyyy" Boss specific g_loot indices: -- bossname name of boss/encounter; +- bossname name of boss/encounter; may be changed if "snarky boss names" option is enabled -- reason wipe/kill ("pull" does not generate an entry) -- instance name of instance, including size and difficulty -- maxsize 5/10/25, presumably also 15 and 40 could show up; can be - 0 if we're outside an instance and the player inside has - an older version -- duration in seconds; may be missing (only present if local) -- raidersnap copy of g_loot.raiders at the time of the boss event +- reason wipe/kill ("pull" does not generate an entry) +- instance name of instance, including size and difficulty +- maxsize max raid size: 5/10/25, presumably also 15 and 40 could show + up; can be 0 if we're outside an instance and the player + inside has an older version +- duration in seconds; may be missing (only present if local) +- raidersnap copy of g_loot.raiders at the time of the boss event Loot specific g_loot indices: -- person recipient -- person_class class of recipient if available; may be missing; +- person recipient +- person_class class of recipient if available; may be missing; will be classID-style (e.g., DEATHKNIGHT) -- itemname not including square brackets -- id itemID as number -- itemlink full clickable link -- itexture icon path (e.g., Interface\Icons\INV_Misc_Rune_01) -- quality ITEM_QUALITY_* number -- disposition offspec/gvault/shard; missing otherwise; can be set from +- itemname not including square brackets +- id itemID as number +- itemlink full clickable link +- itexture icon path (e.g., Interface\Icons\INV_Misc_Rune_01) +- quality ITEM_QUALITY_* number +- disposition offspec/gvault/shard; missing otherwise; can be set from the extratext field -- count e.g., "x3"; missing otherwise; can be set/removed from +- count e.g., "x3"; missing otherwise; can be set/removed from extratext; triggers only for a stack of items, not "the boss dropped double axes today" -- is_heroic true if item is heroic; missing otherwise -- cache_miss if GetItemInfo failed; SHOULD be missing (changes other fields) -- bcast_from if rebroadcast from another player; missing otherwise -- extratext text in Note column, including disposition and rebroadcasting -- extratext_byhand true if text edited by player directly; missing otherwise +- is_heroic true if item is heroic; missing otherwise +- cache_miss if GetItemInfo failed; SHOULD be missing (changes other fields) +- bcast_from if rebroadcast from another player; missing otherwise +- extratext text in Note column, including disposition and rebroadcasting +- extratext_byhand true if text edited by player directly; missing otherwise Functions arranged like this, with these lables (for jumping to). As a @@ -268,6 +269,7 @@ -- warning for other users. The downside is that additional decimal places -- in the Version field for bugfixes (e.g., "2.16.4.1") imposes a high-water -- mark, as subsequent shorter strings ("2.16.5", "2.17") will never be larger. +-- Will need to redo this so it's not quite so dumb. do local r = 0 for d in addon.revision:gmatch("%d+") do @@ -342,6 +344,7 @@ -- Returns an instance name or abbreviation, followed by the raid size local function instance_tag() + -- possibly redo this with the new GetRaidDifficulty function local name, typeof, diffcode, diffstr, _, perbossheroic, isdynamic = GetInstanceInfo() local t, r name = addon.instance_abbrev[name] or name @@ -554,6 +557,16 @@ end stored_datarev = 16 end + if stored_datarev == 16 then + self:Print("Transitioning saved data format to 17..."); dirty = true + for i,e in ipairs(OuroLootSV) do + if e.kind == 'boss' then -- brown paper bag bugs + e.raidersnap = e.raidersnap or {} + e.maxsize = e.maxsize or 0 + end + end + stored_datarev = 17 + end if dirty then self:Print("Saved data has been massaged into shape.") end end @@ -811,7 +824,10 @@ -- them under specific circumstances. local grri_name, connected, subgroup, level, class, _ grri_name, _, subgroup, level, _, class, connected = GetRaidRosterInfo(i) - assert(name==grri_name, "UnitName =/= grri_name of same raidindex") + 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 @@ -901,8 +917,11 @@ -- entry already if addon.latest_instance then return end addon.latest_instance = instance_tag() + local ss, max = addon:snapshot_raid() addon:_mark_boss_kill (addon._addLootEntry{ - kind='boss',reason='kill',bossname=[[trash]],instance=addon.latest_instance,duration=0 + kind='boss', reason='kill', bossname=[[trash]], + instance=addon.latest_instance, duration=0, + raidersnap=ss, maxsize=max }) end @@ -1433,6 +1452,22 @@ end end +-- Raid roster snapshots +do + function addon:snapshot_raid (only_inraid_p) + local ss = CopyTable(g_loot.raiders) + local instance,maxsize = instance_tag() + if only_inraid_p then + for name,info in next, ss do + if info.online == 3 then + ss[name] = nil + end + end + end + return ss, maxsize, instance, time() + end +end + -- Tie-in with Deadly Boss Mods (or other such addons) do local candidates = {} @@ -1510,7 +1545,7 @@ reason = reason, instance = intag, duration = duration, -- deliberately may be nil - raidersnap = CopyTable(g_loot.raiders), + raidersnap = self:snapshot_raid(), maxsize = maxsize, } tinsert(candidates,c)
--- a/text_tabs.lua Tue Apr 17 20:51:36 2012 +0000 +++ b/text_tabs.lua Thu Apr 19 00:52:37 2012 +0000 @@ -96,7 +96,7 @@ end end - return true + return #cache > 0 end local function forum_specials (_,_, container, mkbutton) @@ -168,9 +168,7 @@ return i,o end -local saved_g_loot_pointer local function att (_, loot, last_printed, _, cache) - saved_g_loot_pointer = loot for i = last_printed+1, #loot do local e = loot[i] @@ -187,7 +185,7 @@ end end - return true + return #cache > 0 end local function att_specials (_, editbox, container, mkbutton) @@ -195,11 +193,12 @@ [[Take attendance now (will continue to take attendance on each boss kill).]]) w:SetFullWidth(true) w:SetCallback("OnClick", function(_w) - local instance, maxsize = addon.instance_tag() - local i,o = do_attendance (saved_g_loot_pointer.raiders, maxsize / MEMBERS_PER_RAID_GROUP) + local ss,max,instance = addon:snapshot_raid (--[[inraid=]]true) + local i,o = do_attendance (ss, max / MEMBERS_PER_RAID_GROUP) local h, m = GetGameTime() - local additional = ("Attendance for %s at %.2d:%.2d:\n{+} %s\n{-} %s"):format(instance, h, m, i, o) + local additional = ("Attendance for %s at %.2d:%.2d:\n{+} %s\n{-} %s"): + format(instance, h, m, i, o) editbox:SetText(editbox:GetText() .. '\n' .. additional) end) container:AddChild(w)