Mercurial > wow > wowdb-profiler
comparison Main.lua @ 25:e681130c2144
Record successful Mind Control casts on NPCs.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Wed, 16 May 2012 12:13:56 -0500 |
parents | 7cc6ca206c00 |
children | 565af5d2002a |
comparison
equal
deleted
inserted
replaced
24:7cc6ca206c00 | 25:e681130c2144 |
---|---|
42 COMBAT_TEXT_UPDATE = true, | 42 COMBAT_TEXT_UPDATE = true, |
43 LOOT_CLOSED = true, | 43 LOOT_CLOSED = true, |
44 LOOT_OPENED = true, | 44 LOOT_OPENED = true, |
45 MERCHANT_SHOW = "UpdateMerchantItems", | 45 MERCHANT_SHOW = "UpdateMerchantItems", |
46 MERCHANT_UPDATE = "UpdateMerchantItems", | 46 MERCHANT_UPDATE = "UpdateMerchantItems", |
47 PET_BAR_UPDATE = true, | |
47 PLAYER_TARGET_CHANGED = true, | 48 PLAYER_TARGET_CHANGED = true, |
48 QUEST_COMPLETE = true, | 49 QUEST_COMPLETE = true, |
49 QUEST_DETAIL = true, | 50 QUEST_DETAIL = true, |
50 QUEST_LOG_UPDATE = true, | 51 QUEST_LOG_UPDATE = true, |
51 UNIT_QUEST_LOG_CHANGED = true, | 52 UNIT_QUEST_LOG_CHANGED = true, |
205 | 206 |
206 if current_line:GetText() == _G.ITEM_OPENABLE then | 207 if current_line:GetText() == _G.ITEM_OPENABLE then |
207 table.wipe(action_data) | 208 table.wipe(action_data) |
208 action_data.type = AF.ITEM | 209 action_data.type = AF.ITEM |
209 action_data.item_id = item_id | 210 action_data.item_id = item_id |
210 action_data.loot_type = "contains" | 211 action_data.label = "contains" |
211 break | 212 break |
212 end | 213 end |
213 end | 214 end |
214 end | 215 end |
215 | 216 |
457 action_data.id_num = id_num | 458 action_data.id_num = id_num |
458 return true | 459 return true |
459 end, | 460 end, |
460 [AF.OBJECT] = true, | 461 [AF.OBJECT] = true, |
461 [AF.ZONE] = function() | 462 [AF.ZONE] = function() |
462 return action_data.loot_type and _G.IsFishingLoot() | 463 return action_data.label and _G.IsFishingLoot() |
463 end, | 464 end, |
464 } | 465 } |
465 | 466 |
466 | 467 |
467 local function GenericLootUpdate(data_type) | 468 local function GenericLootUpdate(data_type) |
468 local entry = DBEntry(data_type, action_data.id_num) | 469 local entry = DBEntry(data_type, action_data.id_num) |
469 | 470 |
470 if not entry then | 471 if not entry then |
471 return | 472 return |
472 end | 473 end |
473 local loot_type = action_data.loot_type or "drops" | 474 local loot_type = action_data.label or "drops" |
474 entry[loot_type] = entry[loot_type] or {} | 475 entry[loot_type] = entry[loot_type] or {} |
475 | 476 |
476 for index = 1, #action_data.loot_list do | 477 for index = 1, #action_data.loot_list do |
477 table.insert(entry[loot_type], action_data.loot_list[index]) | 478 table.insert(entry[loot_type], action_data.loot_list[index]) |
478 end | 479 end |
480 | 481 |
481 | 482 |
482 local LOOT_UPDATE_FUNCS = { | 483 local LOOT_UPDATE_FUNCS = { |
483 [AF.ITEM] = function() | 484 [AF.ITEM] = function() |
484 local item = DBEntry("items", action_data.item_id) | 485 local item = DBEntry("items", action_data.item_id) |
485 local loot_type = action_data.loot_type or "drops" | 486 local loot_type = action_data.label or "drops" |
486 item[loot_type] = item[loot_type] or {} | 487 item[loot_type] = item[loot_type] or {} |
487 | 488 |
488 for index = 1, #action_data.loot_list do | 489 for index = 1, #action_data.loot_list do |
489 table.insert(item[loot_type], action_data.loot_list[index]) | 490 table.insert(item[loot_type], action_data.loot_list[index]) |
490 end | 491 end |
494 end, | 495 end, |
495 [AF.OBJECT] = function() | 496 [AF.OBJECT] = function() |
496 GenericLootUpdate("objects") | 497 GenericLootUpdate("objects") |
497 end, | 498 end, |
498 [AF.ZONE] = function() | 499 [AF.ZONE] = function() |
499 local loot_type = action_data.loot_type or "drops" | 500 local loot_type = action_data.label or "drops" |
500 local zone = DBEntry("zones", action_data.zone) | 501 local zone = DBEntry("zones", action_data.zone) |
501 zone[loot_type] = zone[loot_type] or {} | 502 zone[loot_type] = zone[loot_type] or {} |
502 | 503 |
503 local location_data = ("%s:%s:%s:%s"):format(action_data.instance_token, action_data.map_level, action_data.x, action_data.y) | 504 local location_data = ("%s:%s:%s:%s"):format(action_data.instance_token, action_data.map_level, action_data.x, action_data.y) |
504 local loot_data = zone[loot_type][location_data] | 505 local loot_data = zone[loot_type][location_data] |
660 merchant.can_repair = true | 661 merchant.can_repair = true |
661 end | 662 end |
662 end | 663 end |
663 | 664 |
664 | 665 |
666 function WDP:PET_BAR_UPDATE() | |
667 if not action_data.label or not action_data.label == "mind_control" then | |
668 return | |
669 end | |
670 local unit_type, unit_idnum = self:ParseGUID(_G.UnitGUID("pet")) | |
671 | |
672 if unit_type ~= private.UNIT_TYPES.NPC or not unit_idnum then | |
673 return | |
674 end | |
675 DBEntry("npcs", unit_idnum).mind_control = true | |
676 table.wipe(action_data) | |
677 end | |
678 | |
679 | |
665 do | 680 do |
666 local GENDER_NAMES = { | 681 local GENDER_NAMES = { |
667 "UNKNOWN", | 682 "UNKNOWN", |
668 "MALE", | 683 "MALE", |
669 "FEMALE", | 684 "FEMALE", |
823 if bit.band(spell_flags, AF.NPC) == AF.NPC then | 838 if bit.band(spell_flags, AF.NPC) == AF.NPC then |
824 if not tt_unit_id or tt_unit_name ~= target_name then | 839 if not tt_unit_id or tt_unit_name ~= target_name then |
825 return | 840 return |
826 end | 841 end |
827 action_data.type = AF.NPC | 842 action_data.type = AF.NPC |
828 action_data.loot_type = spell_label:lower() | 843 action_data.label = spell_label:lower() |
844 action_data.unit_name = tt_unit_name | |
829 end | 845 end |
830 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then | 846 elseif bit.band(spell_flags, AF.ITEM) == AF.ITEM then |
831 action_data.type = AF.ITEM | 847 action_data.type = AF.ITEM |
832 action_data.loot_type = spell_label:lower() | 848 action_data.label = spell_label:lower() |
833 | 849 |
834 if tt_item_name and tt_item_name == target_name then | 850 if tt_item_name and tt_item_name == target_name then |
835 action_data.item_id = ItemLinkToID(tt_item_link) | 851 action_data.item_id = ItemLinkToID(tt_item_link) |
836 elseif target_name and target_name ~= "" then | 852 elseif target_name and target_name ~= "" then |
837 local _, target_item_link = _G.GetItemInfo(target_name) | 853 local _, target_item_link = _G.GetItemInfo(target_name) |
856 | 872 |
857 action_data.type = AF.OBJECT | 873 action_data.type = AF.OBJECT |
858 action_data.identifier = identifier | 874 action_data.identifier = identifier |
859 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then | 875 elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then |
860 action_data.type = AF.ZONE | 876 action_data.type = AF.ZONE |
861 action_data.loot_type = spell_label:lower() | 877 action_data.label = spell_label:lower() |
862 end | 878 end |
863 end | 879 end |
864 | 880 |
865 -- print(("%s: '%s', '%s', '%s', '%s', '%s'"):format(event_name, unit_id, spell_name, spell_rank, target_name, spell_line)) | 881 -- print(("%s: '%s', '%s', '%s', '%s', '%s'"):format(event_name, unit_id, spell_name, spell_rank, target_name, spell_line)) |
866 private.tracked_line = spell_line | 882 private.tracked_line = spell_line |