Mercurial > wow > ouroloot
comparison text_tabs.lua @ 56:fcc0d0ff5832
- instance_tag() also returns max instance size as a plain number, adjust
call sites
- clean up .raiders table, add some new fields, use copies of this instead
of a single string
- make sure datarev field is properly updated when it's already present
- avoid multiple GetRaidRosterInfo loops scattered throughout the addon,
instead just traverse the .raiders list, regularly updated
- make the 'loot' and 'boss' broadcasts versioned. Handle receiving older.
- new format for plaintext attendance output
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Fri, 13 Apr 2012 04:28:46 +0000 |
parents | ac57a4342812 |
children | 45d2b153c2df |
comparison
equal
deleted
inserted
replaced
55:ac57a4342812 | 56:fcc0d0ff5832 |
---|---|
135 end | 135 end |
136 | 136 |
137 addon:register_text_generator ("forum", [[Forum Markup]], [[BBcode ready for Ouroboros forums]], forum, forum_specials) | 137 addon:register_text_generator ("forum", [[Forum Markup]], [[BBcode ready for Ouroboros forums]], forum, forum_specials) |
138 | 138 |
139 | 139 |
140 local ingroups, outgroups = {}, {} | |
141 local function do_attendance (raidertable, max_group_number) | |
142 local tins, wipe, tsort, tconcat = | |
143 table.insert, table.wipe, table.sort, table.concat | |
144 | |
145 -- Assumption: everybody is packed into the first N groups. | |
146 if raidertable then for name,info in pairs(raidertable) do | |
147 if info.online ~= 3 then -- 3 == left the raid | |
148 if info.subgroup <= max_group_number then | |
149 tins (ingroups, name) | |
150 else | |
151 tins (outgroups, name) | |
152 end | |
153 end | |
154 end end | |
155 if #ingroups > 0 then | |
156 tsort(ingroups) | |
157 else | |
158 ingroups[1] = [[Nobody recorded as inside the instance.]] | |
159 end | |
160 if #outgroups > 0 then | |
161 tsort(outgroups) | |
162 else | |
163 outgroups[1] = [[Nobody recorded as outside the instance.]] | |
164 end | |
165 local i,o = tconcat(ingroups,", "), tconcat(outgroups,", ") | |
166 wipe(ingroups) | |
167 wipe(outgroups) | |
168 return i,o | |
169 end | |
170 | |
171 local saved_g_loot_pointer | |
140 local function att (_, loot, last_printed, _, cache) | 172 local function att (_, loot, last_printed, _, cache) |
173 saved_g_loot_pointer = loot | |
141 for i = last_printed+1, #loot do | 174 for i = last_printed+1, #loot do |
142 local e = loot[i] | 175 local e = loot[i] |
143 | 176 |
144 if e.kind == 'boss' and e.reason == 'kill' then | 177 if e.kind == 'boss' and e.reason == 'kill' then |
145 cache[#cache+1] = ("\n%s -- %s\n%s"):format(e.instance, e.bossname, e.raiderlist or '<none recorded>') | 178 -- This could, concievably, be different on a per-boss basis |
179 -- (e.g., "we're dropping to 10-man for the PvP boss") | |
180 local i,o = do_attendance (e.raidersnap, e.maxsize / MEMBERS_PER_RAID_GROUP) | |
181 | |
182 cache[#cache+1] = ("\n%s -- %s\n[+] %s\n[-] %s\n"):format(e.instance, | |
183 e.bossname, i, o) | |
146 | 184 |
147 elseif e.kind == 'time' then | 185 elseif e.kind == 'time' then |
148 cache[#cache+1] = e.startday.text | 186 cache[#cache+1] = e.startday.text |
149 | 187 |
150 end | 188 end |
155 local function att_specials (_, editbox, container, mkbutton) | 193 local function att_specials (_, editbox, container, mkbutton) |
156 local w = mkbutton("Take Attendance", | 194 local w = mkbutton("Take Attendance", |
157 [[Take attendance now (will continue to take attendance on each boss kill).]]) | 195 [[Take attendance now (will continue to take attendance on each boss kill).]]) |
158 w:SetFullWidth(true) | 196 w:SetFullWidth(true) |
159 w:SetCallback("OnClick", function(_w) | 197 w:SetCallback("OnClick", function(_w) |
160 local raiders = {} | 198 local instance, maxsize = addon.instance_tag() |
161 for i = 1, GetNumRaidMembers() do | 199 local i,o = do_attendance (saved_g_loot_pointer.raiders, maxsize / MEMBERS_PER_RAID_GROUP) |
162 table.insert(raiders, (GetRaidRosterInfo(i))) | |
163 end | |
164 table.sort(raiders) | |
165 local h, m = GetGameTime() | 200 local h, m = GetGameTime() |
166 local additional = ("Attendance at %.2d:%.2d:\n%s"):format(h,m,table.concat(raiders, ", ")) | 201 |
202 local additional = ("Attendance for %s at %.2d:%.2d:\n[+] %s\n[-] %s"):format(instance, h, m, i, o) | |
167 editbox:SetText(editbox:GetText() .. '\n' .. additional) | 203 editbox:SetText(editbox:GetText() .. '\n' .. additional) |
168 end) | 204 end) |
169 container:AddChild(w) | 205 container:AddChild(w) |
170 end | 206 end |
171 | 207 |