comparison core.lua @ 80:f01d8d1b8f82

First combat after a boss kill clears the "latest boss name", so that subsequent trash loot gets a forced "trash" kill entry. (This may need to have a timer inserted.)
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 14 Jun 2012 04:48:13 +0000
parents 0235a1695b83
children 0f6355bcfe68
comparison
equal deleted inserted replaced
79:0235a1695b83 80:f01d8d1b8f82
1177 -- screens while soloing and in regular groups. Take care. 1177 -- screens while soloing and in regular groups. Take care.
1178 self.dprint('flow', "GetNumRaidMembers == 0") 1178 self.dprint('flow', "GetNumRaidMembers == 0")
1179 if self.enabled and not self.debug.notraid then 1179 if self.enabled and not self.debug.notraid then
1180 self.dprint('flow', "enabled, leaving raid") 1180 self.dprint('flow', "enabled, leaving raid")
1181 self.popped = nil 1181 self.popped = nil
1182 self:Deactivate() -- self:UnregisterEvent("CHAT_MSG_LOOT") 1182 self:Deactivate()
1183 self:CheckRoster(--[[leaving raid]]true) 1183 self:CheckRoster(--[[leaving raid]]true)
1184 end 1184 end
1185 return 1185 return
1186 end 1186 end
1187 1187
1244 local count = 0 1244 local count = 0
1245 function counter() count = count + 1; return count; end 1245 function counter() count = count + 1; return count; end
1246 end 1246 end
1247 1247
1248 local function maybe_trash_kill_entry() 1248 local function maybe_trash_kill_entry()
1249 -- this is set on various boss interactions, so we've got a kill/wipe 1249 -- This field is set on various boss interactions, so we've got a
1250 -- entry already -- XXX maybe clear it after a delay, so that loot 1250 -- kill/wipe entry already.
1251 -- from trash after a boss isn't grouped with that boss?
1252 if addon.latest_instance then return end 1251 if addon.latest_instance then return end
1253 --addon.latest_instance = instance_tag()
1254 local ss, max, inst = addon:snapshot_raid() 1252 local ss, max, inst = addon:snapshot_raid()
1255 addon.latest_instance = inst 1253 addon.latest_instance = inst
1256 addon:_mark_boss_kill (addon._addBossEntry{ 1254 addon:_mark_boss_kill (addon._addBossEntry{
1257 kind='boss', reason='kill', bossname=[[trash]], 1255 kind='boss', reason='kill', bossname=[[trash]],
1258 instance=addon.latest_instance, duration=0, 1256 instance=addon.latest_instance, duration=0,
1420 --pprint("older", "testing signature will be", signature) 1418 --pprint("older", "testing signature will be", signature)
1421 seenit = recent_loot:test(signature) 1419 seenit = recent_loot:test(signature)
1422 end 1420 end
1423 1421
1424 if seenit then 1422 if seenit then
1425 self.dprint('cache', "remote", prefix, "<", signature, 1423 self.dprint('loot', "remote", prefix, "<", signature,
1426 "> already in cache, skipping from", from) 1424 "> already in cache, skipping from", from)
1427 break 1425 break
1428 end 1426 end
1429 1427
1430 -- There is some redundancy in all this, in the interests of ease-of-coding 1428 -- There is some redundancy in all this, in the interests of ease-of-coding
1472 self.dprint('loot', "manual", looti) 1470 self.dprint('loot', "manual", looti)
1473 else 1471 else
1474 recent_loot:add(signature) 1472 recent_loot:add(signature)
1475 candidates[signature] = i 1473 candidates[signature] = i
1476 tinsert (candidates, signature) 1474 tinsert (candidates, signature)
1477 self.dprint('cache', prefix, "<", signature, 1475 self.dprint('loot', prefix, "<", signature,
1478 "> added to cache as candidate", #candidates) 1476 "> added to cache as candidate", #candidates)
1479 end 1477 end
1480 break 1478 break
1481 end 1479 end
1482 self.dprint('loot',"<<"..prefix, "out") 1480 self.dprint('loot',"<<"..prefix, "out")
1538 local r,i,n = ... 1536 local r,i,n = ...
1539 return _do_loot(self, true, r, --[[unique=]]nil, i, 1537 return _do_loot(self, true, r, --[[unique=]]nil, i,
1540 --[[count=]]nil, --[[from=]]nil, n) 1538 --[[count=]]nil, --[[from=]]nil, n)
1541 end 1539 end
1542 end 1540 end
1541 end
1542
1543 -- This only triggers on entering combat after a registered boss kill.
1544 -- Clearing this field forces subsequent trash kills to generate an entry
1545 -- via maybe_trash_kill_entry.
1546 -- (Possibly what is wanted is to start a 3 or 5 minute timer, and *then*
1547 -- look for the next combat?)
1548 function addon:PLAYER_REGEN_DISABLED()
1549 self:UnregisterEvent ("PLAYER_REGEN_DISABLED")
1550 self.latest_instance = nil
1543 end 1551 end
1544 1552
1545 1553
1546 ------ Slash command handler 1554 ------ Slash command handler
1547 -- Thought about breaking this up into a table-driven dispatcher. But 1555 -- Thought about breaking this up into a table-driven dispatcher. But
1647 if not quiet_p then self:Print("Threshold now set to %s.", self.thresholds[q]) end 1655 if not quiet_p then self:Print("Threshold now set to %s.", self.thresholds[q]) end
1648 end 1656 end
1649 1657
1650 1658
1651 ------ On/off 1659 ------ On/off
1660 -- Both of these need to be (effectively) idempotent.
1652 function addon:Activate (opt_threshold, opt_bcast_only) 1661 function addon:Activate (opt_threshold, opt_bcast_only)
1653 self.dprint('flow', ":Activate is running") 1662 self.dprint('flow', ":Activate is running")
1654 self:RegisterEvent("RAID_ROSTER_UPDATE") 1663 self:RegisterEvent("RAID_ROSTER_UPDATE")
1655 self:RegisterEvent("PLAYER_ENTERING_WORLD", 1664 self:RegisterEvent("PLAYER_ENTERING_WORLD",
1656 function() self:ScheduleTimer("RAID_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end) 1665 function() self:ScheduleTimer("RAID_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end)
1680 self.enabled = not opt_bcast_only 1689 self.enabled = not opt_bcast_only
1681 g_seeing_oldsigs = nil 1690 g_seeing_oldsigs = nil
1682 if opt_threshold then 1691 if opt_threshold then
1683 self:SetThreshold (opt_threshold, --[[quiet_p=]]true) 1692 self:SetThreshold (opt_threshold, --[[quiet_p=]]true)
1684 end 1693 end
1685 self:Print("Ouro Raid Loot is %s. Threshold currently %s.", 1694 self:Print("Now %s; threshold currently %s.",
1686 self.enabled and "tracking" or "only broadcasting", 1695 self.enabled and "tracking" or "only broadcasting",
1687 self.thresholds[self.threshold]) 1696 self.thresholds[self.threshold])
1688 self:broadcast('revcheck',revision_large) 1697 self:broadcast('revcheck',revision_large)
1689 end 1698 end
1690 1699
1694 self.enabled = false 1703 self.enabled = false
1695 self.rebroadcast = false 1704 self.rebroadcast = false
1696 self:UnregisterEvent("RAID_ROSTER_UPDATE") 1705 self:UnregisterEvent("RAID_ROSTER_UPDATE")
1697 self:UnregisterEvent("PLAYER_ENTERING_WORLD") 1706 self:UnregisterEvent("PLAYER_ENTERING_WORLD")
1698 self:UnregisterEvent("CHAT_MSG_LOOT") 1707 self:UnregisterEvent("CHAT_MSG_LOOT")
1699 self:Print("Ouro Raid Loot deactivated.") 1708 self:Print("Deactivated.")
1700 end 1709 end
1701 1710
1702 function addon:Clear(verbose_p) 1711 function addon:Clear(verbose_p)
1703 local repopup, st 1712 local repopup, st
1704 if self.display then 1713 if self.display then
1789 end 1798 end
1790 end 1799 end
1791 1800
1792 function _notify_about_remote (sender, index, from_whom, olddisp) 1801 function _notify_about_remote (sender, index, from_whom, olddisp)
1793 local e = g_loot[index] 1802 local e = g_loot[index]
1803 if not e then
1804 -- how did this happen?
1805 return
1806 end
1794 local from_color, from_text, to_color, to_text 1807 local from_color, from_text, to_color, to_text
1795 if from_whom then 1808 if from_whom then
1796 -- FIXME need to return previous name/class from reassign_loot 1809 -- FIXME need to return previous name/class from reassign_loot
1797 1810
1798 else 1811 else
1955 self.dprint('flow', "restoring", #g_loot, "entries") 1968 self.dprint('flow', "restoring", #g_loot, "entries")
1956 self:ScheduleTimer("Activate", 12, opts.threshold) 1969 self:ScheduleTimer("Activate", 12, opts.threshold)
1957 -- FIXME printed could be too large if entries were deleted, how much do we care? 1970 -- FIXME printed could be too large if entries were deleted, how much do we care?
1958 self.sharder = opts.autoshard 1971 self.sharder = opts.autoshard
1959 else 1972 else
1960 g_loot = { printed = {}, raiders = {} } 1973 --g_loot = { printed = {}, raiders = {} }
1974 g_loot = {}
1975 end
1976 if type(g_loot.raiders) ~= 'table' then
1977 g_loot.raiders = {}
1978 end
1979 if type(g_loot.printed) ~= 'table' then
1980 g_loot.printed = {}
1961 end 1981 end
1962 1982
1963 self.threshold = opts.threshold or self.threshold -- in the case of restoring but not tracking 1983 self.threshold = opts.threshold or self.threshold -- in the case of restoring but not tracking
1964 self:gui_init (g_loot, g_uniques) 1984 self:gui_init (g_loot, g_uniques)
1965 opts.autoshard = nil 1985 opts.autoshard = nil
2035 bossi = addon._adjustBossOrder (bossi, g_boss_signpost) or bossi 2055 bossi = addon._adjustBossOrder (bossi, g_boss_signpost) or bossi
2036 g_boss_signpost = nil 2056 g_boss_signpost = nil
2037 addon.latest_instance = boss.instance 2057 addon.latest_instance = boss.instance
2038 addon.dprint('loot', "added boss entry", bossi) 2058 addon.dprint('loot', "added boss entry", bossi)
2039 if boss.reason == 'kill' then 2059 if boss.reason == 'kill' then
2060 addon:RegisterEvent ("PLAYER_REGEN_DISABLED")
2040 addon:_mark_boss_kill (bossi) 2061 addon:_mark_boss_kill (bossi)
2041 if opts.chatty_on_kill then 2062 if opts.chatty_on_kill then
2042 addon:Print("Registered kill for '%s' in %s!", boss.bossname, boss.instance) 2063 addon:Print("Registered kill for '%s' in %s!", boss.bossname, boss.instance)
2043 end 2064 end
2044 end 2065 end
3023 else 3044 else
3024 return -- silently ignore future cases from future clients 3045 return -- silently ignore future cases from future clients
3025 end 3046 end
3026 3047
3027 if self.debug.loot then 3048 if self.debug.loot then
3028 local m = ("Re-mark index %d(pre-unique %s) with id %d from '%s' to '%s'."): 3049 local m = ("Re-mark index %d (pre-unique %s) with id %d from '%s' to '%s'."):
3029 format(index, unique, id, tostring(olddisp), tostring(newdisp)) 3050 format(index, unique, id, tostring(olddisp), tostring(newdisp))
3030 self.dprint('loot', m) 3051 self.dprint('loot', m)
3031 if sender == my_name then 3052 if sender == my_name then
3032 self.dprint('loot',"(Returning early from debug mode's double self-mark.)") 3053 self.dprint('loot',"(Returning early from debug mode's double self-mark.)")
3033 return index 3054 return index