Skip to content

Commit

Permalink
almost completely rewritten the code for Pin generation.
Browse files Browse the repository at this point in the history
now the AddOn grabs almost any Dungeon and Raid locations DIRECTLY from the Game, this should prevent from adding EVERY NEW instance to the Database manually. *yey*
there are still some "special"  cases like "The Eternal Palace" or "Tazavesh, the Veiled Market" what i can not fix right now (maybe later?)

fixed settings databse (again... sorry)
added "Kaz Algar" Special-Dungeons -> another 2 Dungeons with a special behavor

if i've missed some "special" Dungeons or Raids that are not Visible... please send me a Bugreport at GitHub what Dungeon or Raid it is, thanks!

known bugs:
 - TomTom gets wrong coordinates from some "new" Dungeon at Kaz Algar, need to check this later why?!
  • Loading branch information
fuba82 committed Aug 14, 2024
1 parent db203f4 commit 71f0668
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 1,489 deletions.
47 changes: 26 additions & 21 deletions IPAConfig.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
local addonName, IPA = ...

_G["InstancePortalsAdv"] = IPA
IPA.DefaultSettings = {
options = {
pinsOnContinentMap = true,
useWaypointsContient = true,
useWaypointsZone = true,
useTomTomZone = false,
useTomTomContinent = false,
},
version = 4,
}

local eventFrame = CreateFrame("FRAME")
eventFrame:RegisterEvent("PLAYER_LOGIN")

local SettingsRegistered = false

function IPA:CreateSettings()
function CreateSettings()
if SettingsRegistered then return end

IPASettings = IPASettings and IPASettings.options and IPASettings or IPA.DefaultSettings
Expand All @@ -24,42 +33,39 @@ function IPA:CreateSettings()
-- pinsOnContinentMap
do
local name = "Pins on Continent Map"
local variable = addonName.."_pinsOnContinentMap"
local tooltip = "Enable or Disable Dungeon Entrance Pins on the Continent Map"
local variableTbl = IPASettings["options"]
local variableKey = "pinsOnContinentMap"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true

local setting = Settings.RegisterAddOnSetting(categoryMain, variable, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
setting:SetValueChangedCallback(OnSettingChanged)
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end

-- useWaypointsZone
do
local name = "Waypoints on Zone Map"
local variable = addonName.."_useWaypointsZone"
local tooltip = "Enable or Disable Waypoint Feature on Zone Maps\n\n|r|cffff0000Warning!|r\nThis will also disable the \"native\" Waypoint function added in TWW!"
local variableTbl = IPASettings["options"]
local variableKey = "useWaypointsZone"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true

local setting = Settings.RegisterAddOnSetting(categoryMain, variable, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
setting:SetValueChangedCallback(OnSettingChanged)
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end

-- useWaypointsContient
do
local name = "Waypoints on Continent Map"
local variable = addonName.."_useWaypointsContient"
local tooltip = "Enable or Disable the Feature to add a Waypoint when click on a Dungeon Entrace Pin on the Contient Map"
local variableTbl = IPASettings["options"]
local variableKey = "useWaypointsContient"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true

local setting = Settings.RegisterAddOnSetting(categoryMain, variable, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
setting:SetValueChangedCallback(OnSettingChanged)
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end

Expand All @@ -68,45 +74,44 @@ function IPA:CreateSettings()
-- useTomTomZone
do
local name = "Use TomTom for Zone Map"
local variable = addonName.."_useTomTomZone"
local tooltip = "Enable or Disable TomTom as Waypoint System for Zone Map\n\n\Enabled: Use TomTom\nDisabled: Use Native"
local variableTbl = IPASettings["options"]
local variableKey = "useTomTomZone"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or false

local setting = Settings.RegisterAddOnSetting(categoryMain, variable, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
setting:SetValueChangedCallback(OnSettingChanged)
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end

-- useTomTomContinent
do
local name = "Use TomTom for Continent Map"
local variable = addonName.."_useTomTomContinent"
local tooltip = "Enable or Disable TomTom as Waypoint System for Continent Map\n\n\Enabled: Use TomTom\nDisabled: Use Native"
local variableTbl = IPASettings["options"]
local variableKey = "useTomTomContinent"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or false

local setting = Settings.RegisterAddOnSetting(categoryMain, variable, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
setting:SetValueChangedCallback(OnSettingChanged)
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
end

-- debug
--[[
do
local name = "Debug Mode"
local variable = addonName.."_debug"
local tooltip = "Enable or Disable Dubug Mode\n\n\|r|cffff0000Warning!|r\nThis can overload your Chat!"
local variableTbl = IPASettings["options"]
local variableKey = "debug"
local defaultValue = IPA.DefaultSettings["options"][variableKey] or true
local setting = Settings.RegisterAddOnSetting(categoryMain, variable, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
setting:SetValueChangedCallback(OnSettingChanged)
local setting = Settings.RegisterAddOnSetting(categoryMain, addonName.."_"..variableKey, variableKey, variableTbl, Settings.VarType.Boolean, name, defaultValue)
Settings.SetOnValueChangedCallback(variableKey, OnSettingChanged)
Settings.CreateCheckbox(categoryMain, setting, tooltip)
end
]]

Settings.RegisterAddOnCategory(categoryMain)

Expand All @@ -122,6 +127,6 @@ end
eventFrame:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_LOGIN" then
-- Create Settings on "PLAYER_LOGIN" because of TomTom Support (TomTom needs to be loaded first)
IPA:CreateSettings()
CreateSettings()
end
end)
Loading

0 comments on commit 71f0668

Please sign in to comment.