Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
WorldMap: Added 'All' and 'None' buttons to select or unselect all maps
Browse files Browse the repository at this point in the history
  • Loading branch information
hizuro committed Jun 19, 2024
1 parent d822665 commit 6cac388
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
7 changes: 3 additions & 4 deletions BetaHotfixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ frame:SetScript("OnEvent",function(self,event,...)
end
elseif event=="PLAYER_LOGIN" then
for modName,modData in pairs(ns.modules) do
if modData.on_toggle and modData.options and modData.defaults then
for k,v in pairs(modData.defaults)do
modData.on_toggle(k);
end
print(modName)
if modData[event] then
modData[event]()
end
end
end
Expand Down
56 changes: 33 additions & 23 deletions modules/worldmap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local replaceTextures,replaceTaxiNodes = {},{};

local C_Map_GetMapArtLayerTextures_Orig = C_Map.GetMapArtLayerTextures;
local function C_Map_GetMapArtLayerTextures_Replacement(mapID,layerIndex)
if BetaHotfixDB["greentexture-uiMapId-"..mapID] then
if BetaHotfixDB.modules[modName]["greentexture-uiMapId-"..mapID] then
local data = ns.WorldMapData(mapID,layerIndex);
ns.print("hooked","C_Map.GetMapArtLayerTextures",mapID,layerIndex,data);
if data then
Expand Down Expand Up @@ -91,30 +91,24 @@ end
--C_TaxiMap.GetTaxiNodesForMap = C_TaxiMap_GetTaxiNodesForMap_Replacement

local function opt(info,value)
local modName = info[#info];
local key = info[#info];
if value~=nil then
BetaHotfixDB.worldmap[modName] = value;
BetaHotfixDB.modules[modName][key] = value;
return;
end
return BetaHotfixDB.worldmap[modName];
return BetaHotfixDB.modules[modName][key];
end

local function flagIt(info)
local key = info[#info];
if key=="flagAll" then
local args = module.options.hotfix.worldmap.args
ns.debug(key)
for k in pairs(args)do
if k:match("greentexture-uiMapId-%d") then
print(k)
end
end
elseif key=="flagNone" then
ns.debug(key)
local args = module.options.hotfix.worldmap.args
for k in pairs(args)do
if k:match("greentexture-uiMapId-%d") then
end
if not (key=="flagAll" or key=="flagNone") then return end

local args = module.options.hotfix.worldmap.args
local state = key=="flagAll";

for k in pairs(args)do
if k:match("greentexture%-uiMapId%-%d") then
BetaHotfixDB.modules[modName][k] = state;
end
end
end
Expand All @@ -136,14 +130,17 @@ module = {
worldmap = {
type="group", order=3, inline=true,
name=C(WORLD_MAP,"ffeedd00"),
get = opt,
set = opt,
func = flagIt,
args = {
info = {
type = "description", order = 0, fontSize="large",
name = L.WorldMapEmpty
},

flagAll = { type = "execute", name = ALL, order=1, func = flagIt, hidden = true },
flagNone = { type = "execute", name = NONE, order=2, func = flagIt, hidden = true },
flagAll = { type = "execute", name = ALL, order=1, hidden = true },
flagNone = { type = "execute", name = NONE, order=2, hidden = true },
line = { type = "header", name = "", order = 3},
-- filled by function
}
},
Expand Down Expand Up @@ -201,8 +198,8 @@ function module.on_addoptions()
count=count+1;
end
args.info.hidden = count~=0
--args.flagAll.hidden = count==0
--args.flagNone.hidden = count==0
args.flagAll.hidden = count==0
args.flagNone.hidden = count==0
else
module.options.hotfix.worldmap.disabled = true;
end
Expand All @@ -229,6 +226,19 @@ function module.on_addoptions()
--end
end

function module.PLAYER_LOGIN()
if not BetaHotfixDB.modules[modName] then
BetaHotfixDB.modules[modName] = {}
end
for k,v in pairs(BetaHotfixDB)do
if tostring(k):match("%-uiMapId%-") then
print("wfboiknwtbowqntboqeinrgoiqnergoiqnergoiqnrgoinerqb")
BetaHotfixDB.modules[modName][k] = v;
BetaHotfixDB[k] = nil
end
end
end

function module.on_toggle(optName,showDisabled)
local label;
local key,id = optName:match("^(.*)%-uiMapId%-(%d+)$");
Expand Down

0 comments on commit 6cac388

Please sign in to comment.