comparison Main.lua @ 129:e0550c57972d 1.0.10

Listen for ZONE_CHANGED_NEW_AREA and ZONE_CHANGED_INDOORS for location updates.
author James D. Callahan III <jcallahan@curse.com>
date Thu, 20 Sep 2012 14:14:24 -0500
parents b06147ded0bc
children 35da36cc87f0
comparison
equal deleted inserted replaced
128:b06147ded0bc 129:e0550c57972d
29 29
30 30
31 ----------------------------------------------------------------------- 31 -----------------------------------------------------------------------
32 -- Local constants. 32 -- Local constants.
33 ----------------------------------------------------------------------- 33 -----------------------------------------------------------------------
34 local DB_VERSION = 6 34 local DB_VERSION = 7
35 35
36 36
37 local DATABASE_DEFAULTS = { 37 local DATABASE_DEFAULTS = {
38 char = {}, 38 char = {},
39 global = { 39 global = {
83 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", 83 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure",
84 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", 84 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure",
85 UNIT_SPELLCAST_SENT = true, 85 UNIT_SPELLCAST_SENT = true,
86 UNIT_SPELLCAST_SUCCEEDED = true, 86 UNIT_SPELLCAST_SUCCEEDED = true,
87 VOID_STORAGE_OPEN = true, 87 VOID_STORAGE_OPEN = true,
88 ZONE_CHANGED = true, 88 ZONE_CHANGED = "SetCurrentAreaID",
89 ZONE_CHANGED_INDOORS = "SetCurrentAreaID",
90 ZONE_CHANGED_NEW_AREA = "SetCurrentAreaID",
89 } 91 }
90 92
91 93
92 local OBJECT_ID_ANVIL = 192628 94 local OBJECT_ID_ANVIL = 192628
93 local OBJECT_ID_FORGE = 1685 95 local OBJECT_ID_FORGE = 1685
532 return text 534 return text
533 end 535 end
534 end -- do-block 536 end -- do-block
535 537
536 538
537 local function SetCurrentAreaID() 539 function WDP:SetCurrentAreaID(event_name)
538 local map_area_id = _G.GetCurrentMapAreaID() 540 local map_area_id = _G.GetCurrentMapAreaID()
539 _G.SetMapToCurrentZone() 541 _G.SetMapToCurrentZone()
540 542
541 current_area_id = _G.GetCurrentMapAreaID() 543 current_area_id = _G.GetCurrentMapAreaID()
542 _G.SetMapByID(map_area_id) 544 _G.SetMapByID(map_area_id)
589 return 591 return
590 end 592 end
591 local _, item_link = _G.GetItemInfo(identifier) 593 local _, item_link = _G.GetItemInfo(identifier)
592 HandleItemUse(item_link) 594 HandleItemUse(item_link)
593 end) 595 end)
594 SetCurrentAreaID() 596 self:SetCurrentAreaID("OnEnable")
595 597
596 _G.hooksecurefunc("SetBlacklistMap", UpdateBlacklistMaps) 598 _G.hooksecurefunc("SetBlacklistMap", UpdateBlacklistMaps)
597 _G.hooksecurefunc("ClearBlacklistMap", UpdateBlacklistMaps) 599 _G.hooksecurefunc("ClearBlacklistMap", UpdateBlacklistMaps)
598 600
599 UpdateBlacklistMaps() 601 UpdateBlacklistMaps()
1726 table.wipe(current_action) 1728 table.wipe(current_action)
1727 end 1729 end
1728 end 1730 end
1729 1731
1730 1732
1731 function WDP:ZONE_CHANGED(event_name)
1732 SetCurrentAreaID()
1733 end
1734
1735
1736 do 1733 do
1737 local function SetUnitField(field, required_type) 1734 local function SetUnitField(field, required_type)
1738 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) 1735 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))
1739 1736
1740 if not unit_idnum or (required_type and unit_type ~= required_type) then 1737 if not unit_idnum or (required_type and unit_type ~= required_type) then