comparison Main.lua @ 126:f0c0819058b4 1.0.9

Bump DB version to 6. Change method of determining current area ID in order to play nice with the World Map.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 18 Sep 2012 14:48:43 -0500
parents 8669b4c43278
children b06147ded0bc
comparison
equal deleted inserted replaced
125:790769fc6a76 126:f0c0819058b4
29 29
30 30
31 ----------------------------------------------------------------------- 31 -----------------------------------------------------------------------
32 -- Local constants. 32 -- Local constants.
33 ----------------------------------------------------------------------- 33 -----------------------------------------------------------------------
34 local DB_VERSION = 5 34 local DB_VERSION = 6
35 35
36 36
37 local DATABASE_DEFAULTS = { 37 local DATABASE_DEFAULTS = {
38 global = { 38 global = {
39 items = {}, 39 items = {},
82 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure", 82 UNIT_SPELLCAST_FAILED_QUIET = "HandleSpellFailure",
83 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure", 83 UNIT_SPELLCAST_INTERRUPTED = "HandleSpellFailure",
84 UNIT_SPELLCAST_SENT = true, 84 UNIT_SPELLCAST_SENT = true,
85 UNIT_SPELLCAST_SUCCEEDED = true, 85 UNIT_SPELLCAST_SUCCEEDED = true,
86 VOID_STORAGE_OPEN = true, 86 VOID_STORAGE_OPEN = true,
87 ZONE_CHANGED = true,
87 } 88 }
88 89
89 90
90 local OBJECT_ID_ANVIL = 192628 91 local OBJECT_ID_ANVIL = 192628
91 local OBJECT_ID_FORGE = 1685 92 local OBJECT_ID_FORGE = 1685
122 local languages_known = {} 123 local languages_known = {}
123 local name_to_id_map = {} 124 local name_to_id_map = {}
124 local reputation_npc_id 125 local reputation_npc_id
125 local target_location_timer_handle 126 local target_location_timer_handle
126 local current_target_id 127 local current_target_id
128 local current_area_id
127 129
128 ----------------------------------------------------------------------- 130 -----------------------------------------------------------------------
129 -- Data for our current action. Including possible values as a reference. 131 -- Data for our current action. Including possible values as a reference.
130 ----------------------------------------------------------------------- 132 -----------------------------------------------------------------------
131 local current_action = { 133 local current_action = {
222 return npc 224 return npc
223 end 225 end
224 226
225 227
226 local function CurrentLocationData() 228 local function CurrentLocationData()
227 _G.SetMapToCurrentZone()
228
229 local map_level = _G.GetCurrentMapDungeonLevel() or 0 229 local map_level = _G.GetCurrentMapDungeonLevel() or 0
230 local x, y = _G.GetPlayerMapPosition("player") 230 local x, y = _G.GetPlayerMapPosition("player")
231 231
232 x = x or 0 232 x = x or 0
233 y = y or 0 233 y = y or 0
256 end 256 end
257 257
258 if y % 2 ~= 0 then 258 if y % 2 ~= 0 then
259 y = y + 1 259 y = y + 1
260 end 260 end
261 return _G.GetRealZoneText(), _G.GetCurrentMapAreaID(), x, y, map_level, InstanceDifficultyToken() 261 return _G.GetRealZoneText(), current_area_id, x, y, map_level, InstanceDifficultyToken()
262 end 262 end
263 263
264 264
265 local function ItemLinkToID(item_link) 265 local function ItemLinkToID(item_link)
266 if not item_link then 266 if not item_link then
511 return text 511 return text
512 end 512 end
513 end -- do-block 513 end -- do-block
514 514
515 515
516 local function SetCurrentAreaID()
517 local map_area_id = _G.GetCurrentMapAreaID()
518 _G.SetMapToCurrentZone()
519
520 current_area_id = _G.GetCurrentMapAreaID()
521 _G.SetMapByID(map_area_id)
522 end
523
524
516 ----------------------------------------------------------------------- 525 -----------------------------------------------------------------------
517 -- Methods. 526 -- Methods.
518 ----------------------------------------------------------------------- 527 -----------------------------------------------------------------------
519 function WDP:OnInitialize() 528 function WDP:OnInitialize()
520 db = LibStub("AceDB-3.0"):New("WoWDBProfilerData", DATABASE_DEFAULTS, "Default").global 529 db = LibStub("AceDB-3.0"):New("WoWDBProfilerData", DATABASE_DEFAULTS, "Default").global
557 return 566 return
558 end 567 end
559 local _, item_link = _G.GetItemInfo(identifier) 568 local _, item_link = _G.GetItemInfo(identifier)
560 HandleItemUse(item_link) 569 HandleItemUse(item_link)
561 end) 570 end)
571
572 SetCurrentAreaID()
562 end 573 end
563 574
564 575
565 local function RecordDurability(item_id, durability) 576 local function RecordDurability(item_id, durability)
566 if not durability or durability <= 0 then 577 if not durability or durability <= 0 then
1689 table.wipe(current_action) 1700 table.wipe(current_action)
1690 end 1701 end
1691 end 1702 end
1692 1703
1693 1704
1705 function WDP:ZONE_CHANGED(event_name)
1706 SetCurrentAreaID()
1707 end
1708
1709
1694 do 1710 do
1695 local function SetUnitField(field, required_type) 1711 local function SetUnitField(field, required_type)
1696 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc")) 1712 local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))
1697 1713
1698 if not unit_idnum or (required_type and unit_type ~= required_type) then 1714 if not unit_idnum or (required_type and unit_type ~= required_type) then