# HG changeset patch # User James D. Callahan III # Date 1347997723 18000 # Node ID f0c0819058b41d45ee477fc21f14054f39b1494c # Parent 790769fc6a76c7525e4c64332ff81cf5f6f5ba83 Bump DB version to 6. Change method of determining current area ID in order to play nice with the World Map. diff -r 790769fc6a76 -r f0c0819058b4 Main.lua --- a/Main.lua Mon Sep 17 16:02:08 2012 -0500 +++ b/Main.lua Tue Sep 18 14:48:43 2012 -0500 @@ -31,7 +31,7 @@ ----------------------------------------------------------------------- -- Local constants. ----------------------------------------------------------------------- -local DB_VERSION = 5 +local DB_VERSION = 6 local DATABASE_DEFAULTS = { @@ -84,6 +84,7 @@ UNIT_SPELLCAST_SENT = true, UNIT_SPELLCAST_SUCCEEDED = true, VOID_STORAGE_OPEN = true, + ZONE_CHANGED = true, } @@ -124,6 +125,7 @@ local reputation_npc_id local target_location_timer_handle local current_target_id +local current_area_id ----------------------------------------------------------------------- -- Data for our current action. Including possible values as a reference. @@ -224,8 +226,6 @@ local function CurrentLocationData() - _G.SetMapToCurrentZone() - local map_level = _G.GetCurrentMapDungeonLevel() or 0 local x, y = _G.GetPlayerMapPosition("player") @@ -258,7 +258,7 @@ if y % 2 ~= 0 then y = y + 1 end - return _G.GetRealZoneText(), _G.GetCurrentMapAreaID(), x, y, map_level, InstanceDifficultyToken() + return _G.GetRealZoneText(), current_area_id, x, y, map_level, InstanceDifficultyToken() end @@ -513,6 +513,15 @@ end -- do-block +local function SetCurrentAreaID() + local map_area_id = _G.GetCurrentMapAreaID() + _G.SetMapToCurrentZone() + + current_area_id = _G.GetCurrentMapAreaID() + _G.SetMapByID(map_area_id) +end + + ----------------------------------------------------------------------- -- Methods. ----------------------------------------------------------------------- @@ -559,6 +568,8 @@ local _, item_link = _G.GetItemInfo(identifier) HandleItemUse(item_link) end) + + SetCurrentAreaID() end @@ -1691,6 +1702,11 @@ end +function WDP:ZONE_CHANGED(event_name) + SetCurrentAreaID() +end + + do local function SetUnitField(field, required_type) local unit_type, unit_idnum = ParseGUID(_G.UnitGUID("npc"))