diff 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
line wrap: on
line diff
--- a/Main.lua	Wed Sep 19 09:29:56 2012 -0500
+++ b/Main.lua	Thu Sep 20 14:14:24 2012 -0500
@@ -31,7 +31,7 @@
 -----------------------------------------------------------------------
 -- Local constants.
 -----------------------------------------------------------------------
-local DB_VERSION = 6
+local DB_VERSION = 7
 
 
 local DATABASE_DEFAULTS = {
@@ -85,7 +85,9 @@
     UNIT_SPELLCAST_SENT = true,
     UNIT_SPELLCAST_SUCCEEDED = true,
     VOID_STORAGE_OPEN = true,
-    ZONE_CHANGED = true,
+    ZONE_CHANGED = "SetCurrentAreaID",
+    ZONE_CHANGED_INDOORS = "SetCurrentAreaID",
+    ZONE_CHANGED_NEW_AREA = "SetCurrentAreaID",
 }
 
 
@@ -534,7 +536,7 @@
 end -- do-block
 
 
-local function SetCurrentAreaID()
+function WDP:SetCurrentAreaID(event_name)
     local map_area_id = _G.GetCurrentMapAreaID()
     _G.SetMapToCurrentZone()
 
@@ -591,7 +593,7 @@
         local _, item_link = _G.GetItemInfo(identifier)
         HandleItemUse(item_link)
     end)
-    SetCurrentAreaID()
+    self:SetCurrentAreaID("OnEnable")
 
     _G.hooksecurefunc("SetBlacklistMap", UpdateBlacklistMaps)
     _G.hooksecurefunc("ClearBlacklistMap", UpdateBlacklistMaps)
@@ -1728,11 +1730,6 @@
 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"))