diff --git a/IPCore.lua b/IPCore.lua index 27a727f..993c892 100755 --- a/IPCore.lua +++ b/IPCore.lua @@ -4,20 +4,40 @@ function InstancePortalUI_OnLoad(self) LoadAddOn("Blizzard_WorldMap") self:RegisterEvent("ADDON_LOADED") - RegisterCVar("IPUITrackInstancePortals", "1") - RegisterCVar("IPUITrackInstancePortalsOnContinents", "1") - IPUIPrintDebug("InstancePortalUI_OnLoad()") WorldMapFrame:AddDataProvider(CreateFromMixins(IPInstancePortalMapDataProviderMixin)); hooksecurefunc("ToggleDropDownMenu", IPUIDropDownInit) end +function InstancePortalUI_OnEvent(event, arg1) + if event == "ADDON_LOADED" then + if IPUITrackInstancePortals == nil then + IPUIPrintDebug("IPUISetDefaults()") + IPUITrackInstancePortals = true + IPUITrackInstancePortalsOnContinents = true + end + + IPUIPrintDebug("ADDON_LOADED()") + + RegisterCVar("IPUITrackInstancePortals", IPUITrackInstancePortals) + RegisterCVar("IPUITrackInstancePortalsOnContinents", IPUITrackInstancePortalsOnContinents) + end +end + function IPUIDropDownInit(_, _, dropDownFrame, _, _, _, _, clickedButton) local trackingOptionsFrame = WorldMapFrame.overlayFrames[2] local trackingOptionsMenu = trackingOptionsFrame.DropDown + IPUIPrintDebug("IPUIDropDownInit") + local function OnSelection(button) + if button.value == "IPUITrackInstancePortals" then + IPUITrackInstancePortals = button.checked + else + IPUITrackInstancePortalsOnContinents = button.checked + end + SetCVar(button.value, button.checked and "1" or "0", "INSTANCE_PORTAL_REFRESH"); end @@ -37,7 +57,7 @@ function IPUIDropDownInit(_, _, dropDownFrame, _, _, _, _, clickedButton) info.notCheckable = nil; info.text = "Show on Zone Map"; --BATTLEFIELD_MINIMAP info.isNotRadio = true; - info.checked = GetCVarBool("IPUITrackInstancePortals"); + info.checked = IPUITrackInstancePortals; info.func = OnSelection; info.keepShownOnClick = true; info.value = "IPUITrackInstancePortals"; @@ -48,7 +68,7 @@ function IPUIDropDownInit(_, _, dropDownFrame, _, _, _, _, clickedButton) info.notCheckable = nil; info.text = "Show on Continent Map"; --WORLD_MAP info.isNotRadio = true; - info.checked = GetCVarBool("IPUITrackInstancePortalsOnContinents"); + info.checked = IPUITrackInstancePortalsOnContinents; info.func = OnSelection; info.keepShownOnClick = true; info.value = "IPUITrackInstancePortalsOnContinents"; diff --git a/IPInstancePortalPinTemplate.lua b/IPInstancePortalPinTemplate.lua index 0b331d1..7eb2c53 100755 --- a/IPInstancePortalPinTemplate.lua +++ b/IPInstancePortalPinTemplate.lua @@ -23,9 +23,10 @@ end function IPInstancePortalMapDataProviderMixin:RefreshAllData(fromOnShow) self:RemoveAllData(); + IPUIPrintDebug("IPInstancePortalMapDataProviderMixin:RefreshAllData") - local trackOnZones = GetCVarBool("IPUITrackInstancePortals") - local trackOnContinents = GetCVarBool("IPUITrackInstancePortalsOnContinents") + local trackOnZones = IPUITrackInstancePortals + local trackOnContinents = IPUITrackInstancePortalsOnContinents local mapID = self:GetMap():GetMapID(); IPUIPrintDebug("Map ID = "..mapID) diff --git a/IPPinDB.lua b/IPPinDB.lua index 80013f7..98415f4 100644 --- a/IPPinDB.lua +++ b/IPPinDB.lua @@ -483,7 +483,7 @@ IPUIPinDB = { [876]={ --[[ Kul Tiras ]]-- {60, 51, {1023}, "Alliance"}, --Siege of Boralus (Alliance) {68, 66, {1023}, "Horde"}, --Siege of Boralus (Horde) - {63, 84, {1001}, "FactionSpecific"}, --Freehold + {67.16, 80.46, {1001}, "FactionSpecific"}, --Freehold {77, 62, {1002}, "FactionSpecific"}, --Tol Dagor {30, 55, {1021}, "FactionSpecific"}, --Waycrest Manor {65, 14, {1036}, "FactionSpecific"}, --Shrine of the Storm diff --git a/InstancePortals.toc b/InstancePortals.toc index 510ee82..f29d2b5 100755 --- a/InstancePortals.toc +++ b/InstancePortals.toc @@ -1,8 +1,9 @@ ## Interface: 80000 ## X-Min-Interface: 80000 -## Version: 17 +## Version: 19 ## Title: Instance Portals ## Notes: Displays dungeon & raid portals on the world map +## SavedVariablesPerCharacter: IPUITrackInstancePortals IPUITrackInstancePortalsOnContinents IPPinDB.lua IPInstanceDB.lua diff --git a/InstancePortals.xml b/InstancePortals.xml index e625799..5d30a62 100755 --- a/InstancePortals.xml +++ b/InstancePortals.xml @@ -9,7 +9,10 @@ tinsert(UISpecialFrames, "InstancePortalUI") InstancePortalUI_OnLoad(self) - + + + InstancePortalUI_OnEvent(event, arg1) +