comparison Main.lua @ 9:796bf179557a

Actually record currency drops.
author James D. Callahan III <jcallahan@curse.com>
date Mon, 30 Apr 2012 15:42:28 -0500
parents 1b4111ac80c6
children 94bc939c2ca6
comparison
equal deleted inserted replaced
8:1b4111ac80c6 9:796bf179557a
39 local EVENT_MAPPING = { 39 local EVENT_MAPPING = {
40 LOOT_OPENED = true, 40 LOOT_OPENED = true,
41 MERCHANT_SHOW = "UpdateMerchantItems", 41 MERCHANT_SHOW = "UpdateMerchantItems",
42 MERCHANT_UPDATE = "UpdateMerchantItems", 42 MERCHANT_UPDATE = "UpdateMerchantItems",
43 PLAYER_TARGET_CHANGED = true, 43 PLAYER_TARGET_CHANGED = true,
44 QUEST_COMPLETE = true,
45 QUEST_DETAIL = true,
46 QUEST_LOG_UPDATE = true,
47 QUEST_PROGRESS = true,
44 UNIT_QUEST_LOG_CHANGED = true, 48 UNIT_QUEST_LOG_CHANGED = true,
45 UNIT_SPELLCAST_FAILED = "HandleSpellFailure", 49 UNIT_SPELLCAST_FAILED = "HandleSpellFailure",
46 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", 50 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure",
47 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", 51 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure",
48 UNIT_SPELLCAST_SENT = true, 52 UNIT_SPELLCAST_SENT = true,
276 280
277 local loot_registry = {} 281 local loot_registry = {}
278 action_data.drops = {} 282 action_data.drops = {}
279 283
280 for loot_slot = 1, _G.GetNumLootItems() do 284 for loot_slot = 1, _G.GetNumLootItems() do
281 local texture, item, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot) 285 local icon_texture, item_text, quantity, quality, locked = _G.GetLootSlotInfo(loot_slot)
282 286
283 if _G.LootSlotIsItem(loot_slot) then 287 if _G.LootSlotIsItem(loot_slot) then
284 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot)) 288 local item_id = ItemLinkToID(_G.GetLootSlotLink(loot_slot))
285 loot_registry[item_id] = (loot_registry[item_id]) or 0 + quantity 289 loot_registry[item_id] = (loot_registry[item_id]) or 0 + quantity
286 elseif _G.LootSlotIsCoin(loot_slot) then 290 elseif _G.LootSlotIsCoin(loot_slot) then
287 table.insert(action_data.drops, ("money:%d"):format(_toCopper(item))) 291 table.insert(action_data.drops, ("money:%d"):format(_toCopper(item_text)))
288 elseif _G.LootSlotIsCurrency(loot_slot) then 292 elseif _G.LootSlotIsCurrency(loot_slot) then
293 table.insert(action_data.drops, ("currency:%d:%s"):format(quantity, icon_texture:match("[^\\]+$"):lower()))
289 end 294 end
290 end 295 end
291 296
292 for item_id, quantity in pairs(loot_registry) do 297 for item_id, quantity in pairs(loot_registry) do
293 table.insert(action_data.drops, ("%d:%d"):format(item_id, quantity)) 298 table.insert(action_data.drops, ("%d:%d"):format(item_id, quantity))
439 end 444 end
440 end 445 end
441 end 446 end
442 447
443 448
449 function WDP:QUEST_COMPLETE()
450 end
451
452
453 function WDP:QUEST_DETAIL()
454 end
455
456
444 function WDP:QUEST_LOG_UPDATE() 457 function WDP:QUEST_LOG_UPDATE()
445 self:UnregisterEvent("QUEST_LOG_UPDATE") 458 self:UnregisterEvent("QUEST_LOG_UPDATE")
446 end 459 end
447 460
461
462 function WDP:QUEST_PROGRESS()
463 end
448 464
449 function WDP:UNIT_QUEST_LOG_CHANGED(event, unit_id) 465 function WDP:UNIT_QUEST_LOG_CHANGED(event, unit_id)
450 if unit_id ~= "player" then 466 if unit_id ~= "player" then
451 return 467 return
452 end 468 end