Mercurial > wow > breuesk
comparison Looting.lua @ 89:b89558d3e833
Master looter detection. Starting to filter certain actions to only the ML.
author | John@Yosemite-PC |
---|---|
date | Mon, 16 Apr 2012 07:06:19 -0400 |
parents | 6035541e47dd |
children | 0cd1d46e7b66 |
comparison
equal
deleted
inserted
replaced
88:f844309a0e35 | 89:b89558d3e833 |
---|---|
48 print("item: rarity: ",rarity) | 48 print("item: rarity: ",rarity) |
49 local link = _G.GetLootSlotLink(i) | 49 local link = _G.GetLootSlotLink(i) |
50 if link and rarity >= threshold then | 50 if link and rarity >= threshold then |
51 table.insert(items,{link=link,mlid=i}) | 51 table.insert(items,{link=link,mlid=i}) |
52 print("Item: ", link, i) | 52 print("Item: ", link, i) |
53 isMasterLootEvent = true | |
53 end | 54 end |
54 end | 55 end |
55 if not isMasterLootEvent then return end | 56 if not isMasterLootEvent then return end |
56 | 57 |
57 print("Let's get started SKing") | 58 print("Let's get started SKing") |
58 -- todo: check that I am ML and that I'm an admin! | 59 -- todo: check that I am ML and that I'm an admin! |
59 | 60 |
60 InitiateBeginLoot(items,stateactivelist) | 61 if masterLooterIsMe and admin then |
61 | 62 InitiateBeginLoot(items,stateactivelist) |
62 local chan -- todo: idiom | 63 |
63 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end | 64 local chan -- todo: idiom |
64 _G.SendChatMessage("The following items are available -",chan) | 65 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end |
65 for i,v in pairs(items) do | 66 _G.SendChatMessage("The following items are available -",chan) |
66 _G.SendChatMessage(v.link,chan) | 67 for i,v in pairs(items) do |
68 _G.SendChatMessage(v.link,chan) | |
69 end | |
67 end | 70 end |
68 end | 71 end |
69 | 72 |
70 function FreeLoot(item,person) | 73 function FreeLoot(item,person) |
71 PrintTable(item) | 74 PrintTable(item) |
127 func(person) | 130 func(person) |
128 end | 131 end |
129 end | 132 end |
130 end | 133 end |
131 | 134 |
132 if state == "bidding" and admin then -- todo: should only be ML | 135 if state == "bidding" and admin and masterLooterIsMe then |
133 message = _G.strtrim(message) | 136 message = _G.strtrim(message) |
134 message = _G.strlower(message) | 137 message = _G.strlower(message) |
135 if message == "bid" then | 138 if message == "bid" then |
136 senderAction(InitiateBid) | 139 senderAction(InitiateBid) |
137 elseif message == "retract" then | 140 elseif message == "retract" then |
157 masterLooter = nil | 160 masterLooter = nil |
158 masterLooterIsMe = false | 161 masterLooterIsMe = false |
159 | 162 |
160 function UpdateML() | 163 function UpdateML() |
161 local lootmethod, masterlooterPartyID, masterlooterRaidID = _G.GetLootMethod() | 164 local lootmethod, masterlooterPartyID, masterlooterRaidID = _G.GetLootMethod() |
162 print("lm",lootmethod) | |
163 if lootmethod == "master" then | 165 if lootmethod == "master" then |
164 local oldMasterLooter | 166 local oldMasterLooter |
165 oldMasterLooter = masterLooter | 167 oldMasterLooter = masterLooter |
166 masterLooterIsMe = false | 168 masterLooterIsMe = false |
167 if masterlooterPartyID and masterlooterPartyID > 0 then | 169 if masterlooterPartyID and masterlooterPartyID > 0 then |
170 masterLooter = _G.UnitName("raid"..masterlooterRaidID) | 172 masterLooter = _G.UnitName("raid"..masterlooterRaidID) |
171 else | 173 else |
172 masterLooter = _G.UnitName("player") | 174 masterLooter = _G.UnitName("player") |
173 masterLooterIsMe = true | 175 masterLooterIsMe = true |
174 end | 176 end |
175 print("master looter is", masterLooter) | |
176 | 177 |
177 if masterLooter ~= oldMasterLooter then | 178 if masterLooter ~= oldMasterLooter then |
178 statelistener:StateEvent() -- todo: this isn't how to fire an event! | 179 statelistener:StateEvent() -- todo: this isn't how to fire an event! |
180 | |
181 if not masterLooterIsMe then | |
182 Comm:RequestCatchup() | |
183 end | |
179 end | 184 end |
180 else | 185 else |
181 masterLooter = nil | 186 masterLooter = nil |
182 masterLooterIsMe = false | 187 masterLooterIsMe = false |
183 end | 188 end |