vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local LootUpdate = {}; |
2 | |||
3 | function LootCounter_OnLoad() |
||
4 | this:RegisterEvent("CHAT_MSG_LOOT"); |
||
5 | this:RegisterEvent("BAG_UPDATE"); |
||
6 | end |
||
7 | |||
8 | function LootCounter_OnEvent(event) |
||
9 | if event == "CHAT_MSG_LOOT" and (string.find(arg1,"You receive loot") or string.find(arg1,"Ihr bekommt Beute") or string.find(arg1,"Vous recevez")) then |
||
10 | table.insert(LootUpdate,{msg = arg1, cnt = 0}); |
||
11 | elseif table.getn(LootUpdate) ~= 0 then |
||
12 | for bagcnt = 0, 4 do |
||
13 | slots = GetContainerNumSlots(bagcnt); |
||
14 | for slotcnt = 1, slots do |
||
15 | if GetContainerItemLink(bagcnt, slotcnt) then |
||
16 | local item, rar; |
||
17 | for a,b,c,d in string.gfind(GetContainerItemLink(bagcnt, slotcnt), "(%d+):(%d+):(%d+):(%d+)") do |
||
18 | item = "item:"..a..":"..b..":"..c..":"..d; |
||
19 | end |
||
20 | item,_,rar = GetItemInfo(item); |
||
21 | for j = 1, table.getn(LootUpdate) do |
||
22 | if string.find(LootUpdate[j].msg, item) then |
||
23 | local _,count = GetContainerItemInfo(bagcnt, slotcnt); |
||
24 | LootUpdate[j].cnt = LootUpdate[j].cnt + count; |
||
25 | LootUpdate[j].msg = item; |
||
26 | LootUpdate[j].rar = rar; |
||
27 | end |
||
28 | end |
||
29 | end |
||
30 | end |
||
31 | end |
||
32 | for j = 1, table.getn(LootUpdate) do |
||
33 | if ITEM_QUALITY_COLORS[LootUpdate[j].rar] then |
||
34 | SCT:DisplayCustomEvent("[Loot: "..LootUpdate[j].msg.." "..LootUpdate[j].cnt.."]",ITEM_QUALITY_COLORS[LootUpdate[j].rar]); |
||
35 | end |
||
36 | end |
||
37 | LootUpdate = {}; |
||
38 | end |
||
39 | end |