Mercurial > wow > breuesk
changeset 82:db7e4ee34dce
Lots of support for mobs with multiple loots
author | John@Yosemite-PC |
---|---|
date | Fri, 13 Apr 2012 23:14:03 -0400 |
parents | 62805e6b46c5 |
children | ef4f6dc262ea |
files | Gui.lua Looting.lua State.lua |
diffstat | 3 files changed, 29 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui.lua Fri Apr 13 22:09:17 2012 -0400 +++ b/Gui.lua Fri Apr 13 23:14:03 2012 -0400 @@ -215,7 +215,7 @@ ["Redraw"]= function(self) self.data = {} for i,v in pairs(stateitemlist) do - local entry = {value=i, text=v.link, link=v.link, mlid=v.mlid} + local entry = {value=i, text=v.link, link=v.link, mlid=v.mlid, disabled=v.disabled} table.insert(self.data,entry) end if self.widget then
--- a/Looting.lua Fri Apr 13 22:09:17 2012 -0400 +++ b/Looting.lua Fri Apr 13 23:14:03 2012 -0400 @@ -41,9 +41,13 @@ _G.LootSlot(i) end local items = {} + local threshold = _G.GetLootThreshold() + print("threshold: ", threshold) for i = 1,n do + local _,_,_,rarity,_ = _G.GetLootSlotInfo(i) + print("item: rarity: ",rarity) local link = _G.GetLootSlotLink(i) - if link then + if link and rarity >= threshold then table.insert(items,{link=link,mlid=i}) print("Item: ", link, i) end @@ -156,7 +160,7 @@ event:RegisterEvent("LOOT_OPENED",LootOpened) -- todo: what are these - event:RegisterEvent("LOOT_SLOT_CLEARED",function() print("LSCleared") end) + event:RegisterEvent("LOOT_SLOT_CLEARED",function(_,index) InitiateLSClear(index) end) event:RegisterEvent("LOOT_SLOT_CHANGED",function() print("LSChanged") end) RegisterListenerStateChange(statelistener)
--- a/State.lua Fri Apr 13 22:09:17 2012 -0400 +++ b/State.lua Fri Apr 13 23:14:03 2012 -0400 @@ -357,6 +357,25 @@ Comm:SendStateChange("IR",person,roll) end end + +local function LootSlotCleared(packet) + local index = unpack(packet) + if state == "looting" or state == "bidding" then + for i,v in pairs(stateitemlist) do + if v.mlid == index then + v.disabled = true + print("DISABLING") + AlertItemListListeners() + return + end + end + end +end +function InitiateLSClear(index) + if state == "looting" or state == "bidding" then + Comm:SendStateChange("SC",index) + end +end function DispatchState(packet) local state = table.remove(packet,1) print("Dispatching", state) @@ -376,8 +395,10 @@ ActivateList(packet) elseif state == "IR" then RollRequest(packet) + elseif state == "SC" then + LootSlotCleared(packet) else -- todo ... - + _G.error("Cannot dispatch message of type:",state) end end