Mercurial > wow > ouroloot
comparison core.lua @ 69:8442272a8418
- Make sure popup dialogs are on top of Ace3's widgets.
- Minor code reorganization. Safety hook for future boss-entry code.
- Avoid same bug from a couple revs ago when adding manual boss kills.
- Ask players about snapshot data when manually entering boss kills.
- Blizzard rearranged the button order in 3-entry popups some time ago
and I failed to adapt the code until now.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Fri, 11 May 2012 03:08:12 +0000 |
| parents | 3bed6d51e077 |
| children | cdee65c1bd8c |
comparison
equal
deleted
inserted
replaced
| 68:3bed6d51e077 | 69:8442272a8418 |
|---|---|
| 38 - instance name of instance, including size and difficulty | 38 - instance name of instance, including size and difficulty |
| 39 - maxsize max raid size: 5/10/25, presumably also 15 and 40 could show | 39 - maxsize max raid size: 5/10/25, presumably also 15 and 40 could show |
| 40 up; can be 0 if we're outside an instance and the player | 40 up; can be 0 if we're outside an instance and the player |
| 41 inside has an older version | 41 inside has an older version |
| 42 - duration in seconds; may be missing (only present if local) | 42 - duration in seconds; may be missing (only present if local) |
| 43 - raidersnap copy of g_loot.raiders at the time of the boss event | 43 - raidersnap copy of g_loot.raiders at the time of the boss event; may be |
| 44 empty for manual snapshots the player didn't want included | |
| 45 (not necessarily an "error" if this is missing entirely) | |
| 44 | 46 |
| 45 Loot specific g_loot indices: | 47 Loot specific g_loot indices: |
| 46 - person recipient | 48 - person recipient |
| 47 - person_class class of recipient if available; may be missing; | 49 - person_class class of recipient if available; may be missing; |
| 48 will be classID-style (e.g., DEATHKNIGHT) | 50 will be classID-style (e.g., DEATHKNIGHT) |
| 105 OuroLootSV_log = {} | 107 OuroLootSV_log = {} |
| 106 | 108 |
| 107 | 109 |
| 108 ------ Constants | 110 ------ Constants |
| 109 local option_defaults = { | 111 local option_defaults = { |
| 110 ['datarev'] = 18, -- cheating, this isn't actually an option | 112 ['datarev'] = 19, -- cheating, this isn't actually an option |
| 111 ['popup_on_join'] = true, | 113 ['popup_on_join'] = true, |
| 112 ['register_slashloot'] = true, | 114 ['register_slashloot'] = true, |
| 113 ['scroll_to_bottom'] = true, | 115 ['scroll_to_bottom'] = true, |
| 114 ['chatty_on_kill'] = false, | 116 ['chatty_on_kill'] = false, |
| 115 ['no_tracking_wipes'] = false, | 117 ['no_tracking_wipes'] = false, |
| 614 -- Could try detecting any previous LFR loot here, but... gah | 616 -- Could try detecting any previous LFR loot here, but... gah |
| 615 end | 617 end |
| 616 end | 618 end |
| 617 end | 619 end |
| 618 | 620 |
| 621 bumpers[18] = bumpers[16] | |
| 622 -- In the not-very-many days between 16 and 19, I managed to break | |
| 623 -- the exact same data in the exact same way. At least they're | |
| 624 -- not actually running the same loop twice... probably... sigh. | |
| 625 | |
| 619 --[===[ | 626 --[===[ |
| 620 local real = bumpers | 627 local real = bumpers |
| 621 bumpers = newproxy(true) | 628 bumpers = newproxy(true) |
| 622 local mt = getmetatable(bumpers) | 629 local mt = getmetatable(bumpers) |
| 623 mt.__index = real | 630 mt.__index = real |
| 995 do | 1002 do |
| 996 local function maybe_trash_kill_entry() | 1003 local function maybe_trash_kill_entry() |
| 997 -- this is set on various boss interactions, so we've got a kill/wipe | 1004 -- this is set on various boss interactions, so we've got a kill/wipe |
| 998 -- entry already | 1005 -- entry already |
| 999 if addon.latest_instance then return end | 1006 if addon.latest_instance then return end |
| 1000 addon.latest_instance = instance_tag() | 1007 --addon.latest_instance = instance_tag() |
| 1001 local ss, max = addon:snapshot_raid() | 1008 local ss, max, inst = addon:snapshot_raid() |
| 1002 addon:_mark_boss_kill (addon._addLootEntry{ | 1009 addon.latest_instance = inst |
| 1010 addon:_mark_boss_kill (addon._addBossEntry{ | |
| 1003 kind='boss', reason='kill', bossname=[[trash]], | 1011 kind='boss', reason='kill', bossname=[[trash]], |
| 1004 instance=addon.latest_instance, duration=0, | 1012 instance=addon.latest_instance, duration=0, |
| 1005 raidersnap=ss, maxsize=max | 1013 raidersnap=ss, maxsize=max |
| 1006 }) | 1014 }) |
| 1007 end | 1015 end |
| 1202 else | 1210 else |
| 1203 return self:BuildMainDisplay() | 1211 return self:BuildMainDisplay() |
| 1204 end | 1212 end |
| 1205 | 1213 |
| 1206 elseif cmd == "fake" then -- maybe comment this out for real users | 1214 elseif cmd == "fake" then -- maybe comment this out for real users |
| 1207 self:_mark_boss_kill (self._addLootEntry{ | 1215 self:_mark_boss_kill (self._addBossEntry{ |
| 1208 kind='boss',reason='kill',bossname="Baron Steamroller",instance=instance_tag(),duration=0 | 1216 kind='boss',reason='kill',bossname="Baron Steamroller",duration=0 |
| 1209 }) | 1217 }) |
| 1210 self:CHAT_MSG_LOOT ('manual', my_name, 54797) | 1218 self:CHAT_MSG_LOOT ('manual', my_name, 54797) |
| 1211 if self.display then | 1219 if self.display then |
| 1212 self:redisplay() | 1220 self:redisplay() |
| 1213 end | 1221 end |
| 1579 addon.dprint('loot', "fixup found boss candidate", i, "duration", c.duration) | 1587 addon.dprint('loot', "fixup found boss candidate", i, "duration", c.duration) |
| 1580 break | 1588 break |
| 1581 end | 1589 end |
| 1582 end | 1590 end |
| 1583 end | 1591 end |
| 1584 bossi = addon._addLootEntry(boss) | 1592 bossi = addon._addBossEntry(boss) |
| 1585 -- addon. | 1593 -- addon. |
| 1586 bossi = addon._adjustBossOrder (bossi, g_boss_signpost) or bossi | 1594 bossi = addon._adjustBossOrder (bossi, g_boss_signpost) or bossi |
| 1587 g_boss_signpost = nil | 1595 g_boss_signpost = nil |
| 1588 addon.latest_instance = boss.instance | 1596 addon.latest_instance = boss.instance |
| 1589 addon.dprint('loot', "added boss entry", bossi) | 1597 addon.dprint('loot', "added boss entry", bossi) |
| 1655 self.loot_clean = index-1 | 1663 self.loot_clean = index-1 |
| 1656 end | 1664 end |
| 1657 local attempts = 1 | 1665 local attempts = 1 |
| 1658 local first | 1666 local first |
| 1659 | 1667 |
| 1668 -- Maybe redo this to only collapse *contiguous* wipes...? | |
| 1660 local i,d = 1,g_loot[1] | 1669 local i,d = 1,g_loot[1] |
| 1661 while d ~= e do | 1670 while d ~= e do |
| 1662 if d.bossname and | 1671 if d.bossname and |
| 1663 d.bossname == e.bossname and | 1672 d.bossname == e.bossname and |
| 1664 d.instance == e.instance and | 1673 d.instance == e.instance and |
| 1816 e.minute = m | 1825 e.minute = m |
| 1817 e.stamp = time_t --localuptime | 1826 e.stamp = time_t --localuptime |
| 1818 local index = #g_loot + 1 | 1827 local index = #g_loot + 1 |
| 1819 g_loot[index] = e | 1828 g_loot[index] = e |
| 1820 return index | 1829 return index |
| 1830 end | |
| 1831 | |
| 1832 -- Safety wrapper only. | |
| 1833 -- XXX Maybe pprint something here. | |
| 1834 function addon._addBossEntry (e) | |
| 1835 local ret = addon._addLootEntry(e) | |
| 1836 assert(e.kind=='boss') | |
| 1837 local needSize = e.maxsize == nil | |
| 1838 local needSnap = e.raidersnap == nil | |
| 1839 local needInst = e.instance == nil | |
| 1840 if needSize or needSnap then | |
| 1841 local ss, max, inst = addon:snapshot_raid() | |
| 1842 if needSize then e.maxsize = max end | |
| 1843 if needSnap then e.raidersnap = ss end | |
| 1844 if needInst then e.instance = inst end | |
| 1845 end | |
| 1846 return ret | |
| 1821 end | 1847 end |
| 1822 | 1848 |
| 1823 -- Problem: (1) boss kill happens, (2) fast looting happens, (3) boss | 1849 -- Problem: (1) boss kill happens, (2) fast looting happens, (3) boss |
| 1824 -- cache cleanup fires. Result: loot shows up before boss kill entry. | 1850 -- cache cleanup fires. Result: loot shows up before boss kill entry. |
| 1825 -- Solution: We need to shuffle the boss entry above any of the loot | 1851 -- Solution: We need to shuffle the boss entry above any of the loot |
