Skip to content

Commit

Permalink
Properly saves settings per-character; repositioned Freehold
Browse files Browse the repository at this point in the history
  • Loading branch information
steventroughtonsmith committed Sep 4, 2018
1 parent 1719080 commit e895a4e
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
30 changes: 25 additions & 5 deletions IPCore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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";
Expand All @@ -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";
Expand Down
5 changes: 3 additions & 2 deletions IPInstancePortalPinTemplate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion IPPinDB.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion InstancePortals.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion InstancePortals.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<OnLoad>
tinsert(UISpecialFrames, "InstancePortalUI")
InstancePortalUI_OnLoad(self)
</OnLoad>
</OnLoad>
<OnEvent>
InstancePortalUI_OnEvent(event, arg1)
</OnEvent>
</Scripts>
</Frame>

Expand Down

0 comments on commit e895a4e

Please sign in to comment.