comparison Main.lua @ 16:9f314ea42267

Added recording of disenchanting, milling, and prospecting.
author James D. Callahan III <jcallahan@curse.com>
date Thu, 03 May 2012 13:35:39 -0500
parents 62b0fb4281cd
children 632623625cd1
comparison
equal deleted inserted replaced
15:62b0fb4281cd 16:9f314ea42267
274 return _moneyMatch(money, re_gold) * 10000 + _moneyMatch(money, re_silver) * 100 + _moneyMatch(money, re_copper) 274 return _moneyMatch(money, re_gold) * 10000 + _moneyMatch(money, re_silver) * 100 + _moneyMatch(money, re_copper)
275 end 275 end
276 276
277 277
278 local LOOT_VERIFY_FUNCS = { 278 local LOOT_VERIFY_FUNCS = {
279 [AF.ITEM] = function()
280 local locked_item_id
281
282 for bag_index = 0, _G.NUM_BAG_FRAMES do
283 for slot_index = 1, _G.GetContainerNumSlots(bag_index) do
284 local _, _, is_locked = _G.GetContainerItemInfo(bag_index, slot_index)
285
286 if is_locked then
287 locked_item_id = ItemLinkToID(_G.GetContainerItemLink(bag_index, slot_index))
288 end
289 end
290 end
291
292 if not locked_item_id or (action_data.item_id and action_data.item_id ~= locked_item_id) then
293 return false
294 end
295 action_data.item_id = locked_item_id
296 return true
297 end,
279 [AF.NPC] = function() 298 [AF.NPC] = function()
280 if _G.IsFishingLoot() or not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then 299 if _G.IsFishingLoot() or not _G.UnitExists("target") or _G.UnitIsFriend("player", "target") or _G.UnitIsPlayer("target") or _G.UnitPlayerControlled("target") then
281 return false 300 return false
282 end 301 end
283 local unit_type, id_num = WDP:ParseGUID(_G.UnitGUID("target")) 302 local unit_type, id_num = WDP:ParseGUID(_G.UnitGUID("target"))
287 [AF.OBJECT] = true, 306 [AF.OBJECT] = true,
288 } 307 }
289 308
290 309
291 local LOOT_UPDATE_FUNCS = { 310 local LOOT_UPDATE_FUNCS = {
311 [AF.ITEM] = function()
312 local item = UnitEntry("items", action_data.item_id)
313 local loot_type = action_data.loot_type or "drops"
314 item[loot_type] = item[loot_type] or {}
315
316 for index = 1, #action_data.drops do
317 table.insert(item[loot_type], action_data.drops[index])
318 end
319 end,
292 [AF.NPC] = function() 320 [AF.NPC] = function()
293 local npc = UnitEntry("npcs", action_data.id_num) 321 local npc = UnitEntry("npcs", action_data.id_num)
294 322
295 if not npc then 323 if not npc then
296 return 324 return
563 tt_unit_name = target_name 591 tt_unit_name = target_name
564 tt_unit_id = "target" 592 tt_unit_id = "target"
565 end 593 end
566 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label] 594 local spell_flags = private.SPELL_FLAGS_BY_LABEL[spell_label]
567 595
568 if not tt_item_name and not tt_unit_name then 596 if tt_unit_name and not tt_item_name then
597 if bit.band(spell_flags, AF.NPC) == AF.NPC then
598 if not tt_unit_id or tt_unit_name ~= target_name then
599 return
600 end
601 action_data.type = AF.NPC
602 action_data.loot_type = spell_label:lower()
603 end
604 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then
605 action_data.type = AF.ITEM
606 action_data.loot_type = spell_label:lower()
607
608 if tt_item_name and tt_item_name == target_name then
609 action_data.item_id = ItemLinkToID(tt_item_link)
610 elseif target_name and target_name ~= "" then
611 local _, target_item_link = _G.GetItemInfo(target_name)
612 action_data.item_id = ItemLinkToID(target_item_link)
613 end
614 elseif not tt_item_name and not tt_unit_name then
569 if target_name == "" then 615 if target_name == "" then
570 return 616 return
571 end 617 end
572 618
573 local zone_name, x, y, map_level, instance_type = CurrentLocationData() 619 local zone_name, x, y, map_level, instance_type = CurrentLocationData()
585 action_data.zone = zone_name 631 action_data.zone = zone_name
586 action_data.identifier = identifier 632 action_data.identifier = identifier
587 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then 633 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
588 print("Found spell flagged for ZONE") 634 print("Found spell flagged for ZONE")
589 end 635 end
590 elseif tt_unit_name and not tt_item_name then
591 if bit.band(spell_flags, AF.NPC) == AF.NPC then
592 if not tt_unit_id or tt_unit_name ~= target_name then
593 return
594 end
595 action_data.type = AF.NPC
596 action_data.loot_type = spell_label:lower()
597 end
598 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then
599 print("Found spell flagged for ITEM")
600 else 636 else
601 print(("%s: We have an issue with types and flags."), event_name) 637 print(("%s: We have an issue with types and flags."), event_name)
602 end 638 end
603 639
604 print(("%s: '%s', '%s', '%s', '%s', '%s'"):format(event_name, unit_id, spell_name, spell_rank, target_name, spell_line)) 640 print(("%s: '%s', '%s', '%s', '%s', '%s'"):format(event_name, unit_id, spell_name, spell_rank, target_name, spell_line))