Mercurial > wow > breuesk
changeset 87:6035541e47dd
Memorize the master looter
author | John@Yosemite-PC |
---|---|
date | Sun, 15 Apr 2012 15:19:50 -0400 |
parents | 22b37c800bc4 |
children | f844309a0e35 |
files | Looting.lua |
diffstat | 1 files changed, 35 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Looting.lua Sun Apr 15 14:42:14 2012 -0400 +++ b/Looting.lua Sun Apr 15 15:19:50 2012 -0400 @@ -153,17 +153,49 @@ end, } + +masterLooter = nil +masterLooterIsMe = false + +function UpdateML() + local lootmethod, masterlooterPartyID, masterlooterRaidID = _G.GetLootMethod() + print("lm",lootmethod) + if lootmethod == "master" then + local oldMasterLooter + oldMasterLooter = masterLooter + masterLooterIsMe = false + if masterlooterPartyID and masterlooterPartyID > 0 then + masterLooter = _G.UnitName("party"..masterlooterPartyID) + elseif masterlooterRaidID and masterlooterRaidID > 0 then + masterLooter = _G.UnitName("raid"..masterlooterRaidID) + else + masterLooter = _G.UnitName("player") + masterLooterIsMe = true + end + print("master looter is", masterLooter) + + if masterLooter ~= oldMasterLooter then + statelistener:StateEvent() -- todo: this isn't how to fire an event! + end + else + masterLooter = nil + masterLooterIsMe = false + end +end + function InitializeLooting() event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) event:RegisterEvent("LOOT_CLOSED",LootClosed) event:RegisterEvent("LOOT_OPENED",LootOpened) - -- todo: what are these event:RegisterEvent("LOOT_SLOT_CLEARED",function(_,index) InitiateLSClear(index) end) - event:RegisterEvent("LOOT_SLOT_CHANGED",function() print("LSChanged") end) + --event:RegisterEvent("LOOT_SLOT_CHANGED",function() print("LSChanged") end) RegisterListenerStateChange(statelistener) statelistener:StateEvent() + + UpdateML() + event:RegisterEvent("PARTY_LOOT_METHOD_CHANGED",UpdateML) end - +