Mercurial > wow > wowdb-profiler
comparison Main.lua @ 90:2f8390cf1bd1
Denote if an NPC is an Auctioneer, Banker, Battlemaster, Arcane Reforger, Innkeeper, Transmogrifier, or provides Void Storage.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Tue, 28 Aug 2012 10:30:10 -0500 |
parents | 09b6773252ad |
children | 63287a0a0a2e |
comparison
equal
deleted
inserted
replaced
89:09b6773252ad | 90:2f8390cf1bd1 |
---|---|
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 local EVENT_MAPPING = { | 51 local EVENT_MAPPING = { |
52 AUCTION_HOUSE_SHOW = true, | |
53 BANKFRAME_OPENED = true, | |
54 BATTLEFIELDS_SHOW = true, | |
52 BLACK_MARKET_ITEM_UPDATE = true, | 55 BLACK_MARKET_ITEM_UPDATE = true, |
53 CHAT_MSG_LOOT = true, | 56 CHAT_MSG_LOOT = true, |
54 CHAT_MSG_SYSTEM = true, | 57 CHAT_MSG_SYSTEM = true, |
55 COMBAT_LOG_EVENT_UNFILTERED = true, | 58 COMBAT_LOG_EVENT_UNFILTERED = true, |
56 COMBAT_TEXT_UPDATE = true, | 59 COMBAT_TEXT_UPDATE = true, |
60 FORGE_MASTER_OPENED = true, | |
61 GOSSIP_SHOW = true, | |
57 ITEM_TEXT_BEGIN = true, | 62 ITEM_TEXT_BEGIN = true, |
58 LOOT_OPENED = true, | 63 LOOT_OPENED = true, |
59 MAIL_SHOW = true, | 64 MAIL_SHOW = true, |
60 MERCHANT_SHOW = "UpdateMerchantItems", | 65 MERCHANT_SHOW = "UpdateMerchantItems", |
61 MERCHANT_UPDATE = "UpdateMerchantItems", | 66 MERCHANT_UPDATE = "UpdateMerchantItems", |
64 QUEST_COMPLETE = true, | 69 QUEST_COMPLETE = true, |
65 QUEST_DETAIL = true, | 70 QUEST_DETAIL = true, |
66 QUEST_LOG_UPDATE = true, | 71 QUEST_LOG_UPDATE = true, |
67 TAXIMAP_OPENED = true, | 72 TAXIMAP_OPENED = true, |
68 TRAINER_SHOW = true, | 73 TRAINER_SHOW = true, |
74 TRANSMOGRIFY_OPEN = true, | |
69 UNIT_QUEST_LOG_CHANGED = true, | 75 UNIT_QUEST_LOG_CHANGED = true, |
70 UNIT_SPELLCAST_FAILED = "HandleSpellFailure", | 76 UNIT_SPELLCAST_FAILED = "HandleSpellFailure", |
71 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", | 77 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", |
72 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", | 78 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", |
73 UNIT_SPELLCAST_SENT = true, | 79 UNIT_SPELLCAST_SENT = true, |
74 UNIT_SPELLCAST_SUCCEEDED = true, | 80 UNIT_SPELLCAST_SUCCEEDED = true, |
81 VOID_STORAGE_OPEN = true, | |
75 } | 82 } |
76 | 83 |
77 | 84 |
78 local AF = private.ACTION_TYPE_FLAGS | 85 local AF = private.ACTION_TYPE_FLAGS |
79 | 86 |
567 | 574 |
568 | 575 |
569 ----------------------------------------------------------------------- | 576 ----------------------------------------------------------------------- |
570 -- Event handlers. | 577 -- Event handlers. |
571 ----------------------------------------------------------------------- | 578 ----------------------------------------------------------------------- |
572 function WDP:BLACK_MARKET_ITEM_UPDATE(event) | 579 function WDP:BLACK_MARKET_ITEM_UPDATE(event_name) |
573 local num_items = _G.C_BlackMarket.GetNumItems() | 580 local num_items = _G.C_BlackMarket.GetNumItems() |
574 | 581 |
575 for index = 1, num_items do | 582 for index = 1, num_items do |
576 local name, texture, quantity, item_type, is_usable, level, level_type, seller_name, min_bid, min_increment, current_bid, has_high_bid, num_bids, time_left, item_link, market_id = _G.C_BlackMarket.GetItemInfoByIndex(index); | 583 local name, texture, quantity, item_type, is_usable, level, level_type, seller_name, min_bid, min_increment, current_bid, has_high_bid, num_bids, time_left, item_link, market_id = _G.C_BlackMarket.GetItemInfoByIndex(index); |
577 | 584 |
1304 end | 1311 end |
1305 self:RegisterEvent("QUEST_LOG_UPDATE") | 1312 self:RegisterEvent("QUEST_LOG_UPDATE") |
1306 end | 1313 end |
1307 | 1314 |
1308 | 1315 |
1309 function WDP:TAXIMAP_OPENED(event_name) | |
1310 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) | |
1311 local npc = NPCEntry(unit_idnum) | |
1312 | |
1313 if not npc then | |
1314 return | |
1315 end | |
1316 npc.flight_master = true | |
1317 end | |
1318 | |
1319 | |
1320 function WDP:TRAINER_SHOW() | 1316 function WDP:TRAINER_SHOW() |
1321 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) | 1317 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("target")) |
1322 local npc = NPCEntry(unit_idnum) | 1318 local npc = NPCEntry(unit_idnum) |
1323 | 1319 |
1324 if not npc then | 1320 if not npc then |
1446 if spell_name:match("^Harvest.+") then | 1442 if spell_name:match("^Harvest.+") then |
1447 reputation_npc_id = current_target_id | 1443 reputation_npc_id = current_target_id |
1448 end | 1444 end |
1449 end | 1445 end |
1450 | 1446 |
1447 | |
1451 function WDP:HandleSpellFailure(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) | 1448 function WDP:HandleSpellFailure(event_name, unit_id, spell_name, spell_rank, spell_line, spell_id) |
1452 if unit_id ~= "player" then | 1449 if unit_id ~= "player" then |
1453 return | 1450 return |
1454 end | 1451 end |
1455 | 1452 |
1456 if private.tracked_line == spell_line then | 1453 if private.tracked_line == spell_line then |
1457 private.tracked_line = nil | 1454 private.tracked_line = nil |
1458 end | 1455 end |
1459 end | 1456 end |
1457 | |
1458 | |
1459 do | |
1460 local function SetUnitField(field, required_type) | |
1461 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) | |
1462 | |
1463 if not unit_idnum or (required_type and unit_type ~= required_type) then | |
1464 return | |
1465 end | |
1466 | |
1467 if unit_type == private.UNIT_TYPES.NPC then | |
1468 NPCEntry(unit_idnum)[field] = true | |
1469 elseif unit_type == private.UNIT_TYPES.OBJECT then | |
1470 DBEntry("objects", unit_idnum)[field] = true | |
1471 end | |
1472 end | |
1473 | |
1474 | |
1475 function WDP:AUCTION_HOUSE_SHOW(event_name) | |
1476 SetUnitField("auctioneer", private.UNIT_TYPES.NPC) | |
1477 end | |
1478 | |
1479 | |
1480 function WDP:BANKFRAME_OPENED(event_name) | |
1481 SetUnitField("banker", private.UNIT_TYPES.NPC) | |
1482 end | |
1483 | |
1484 | |
1485 function WDP:BATTLEFIELDS_SHOW(event_name) | |
1486 SetUnitField("battlemaster", private.UNIT_TYPES.NPC) | |
1487 end | |
1488 | |
1489 | |
1490 function WDP:FORGE_MASTER_OPENED() | |
1491 SetUnitField("arcane_reforger", private.UNIT_TYPES.NPC) | |
1492 end | |
1493 | |
1494 | |
1495 function WDP:GOSSIP_SHOW() | |
1496 local gossip_options = { _G.GetGossipOptions() } | |
1497 | |
1498 for index = 2, #gossip_options, 2 do | |
1499 if gossip_options[index] == "binder" then | |
1500 SetUnitField("innkeeper", private.UNIT_TYPES.NPC) | |
1501 return | |
1502 end | |
1503 end | |
1504 end | |
1505 | |
1506 | |
1507 function WDP:TAXIMAP_OPENED(event_name) | |
1508 SetUnitField("flight_master", private.UNIT_TYPES.NPC) | |
1509 end | |
1510 | |
1511 | |
1512 function WDP:TRANSMOGRIFY_OPEN(event_name) | |
1513 SetUnitField("transmogrifier", private.UNIT_TYPES.NPC) | |
1514 end | |
1515 | |
1516 | |
1517 function WDP:VOID_STORAGE_OPEN(event_name) | |
1518 SetUnitField("void_storage", private.UNIT_TYPES.NPC) | |
1519 end | |
1520 end -- do-block |