Compare with Previous | Blame | View Log
local oldGetString = GetString
local oldVars = WORLD_MAP_FILTERS.SetSavedVars
local oldPVEPinSet
local oldPVPPinSet
local EsoheadMarkersFilters = { ["mining"] = "Ore",
["clothing"] = "Clothing Material",
["rune"] = "Runestone",
["alchemy"] = "Alchemy Ingredient",
["wood"] = "Wood",
["chest"] = "Chest",
["skyshard"] = "Uncollected Skyshards",
["found_skyshard"] = "Collected Skyshards",
["r"] = "Red",
["g"] = "Green",
["b"] = "Blue",
["w"] = "White"}
local order = {"skyshard","found_skyshard","chest","mining","clothing","rune","alchemy","wood"}
-- the filter checkboxes display the localization string, retrieved by this function
-- since there is no API to the filters, I had to hack a bit, to display my own strings :)
function GetString( stringVariablePrefix, contextId )
if stringVariablePrefix == "SI_MAPFILTER" and EsoheadMarkersFilters[contextId] then
return EsoheadMarkersFilters[contextId]
else
return oldGetString( stringVariablePrefix, contextId )
end
end
-- setsavedVars initializes the filter controlls for pve and pvp map type
-- after this function is called WORLD_MAP_FILTERS.pvePanel are initialized and can be manipulated
WORLD_MAP_FILTERS.SetSavedVars = function( self, savedVars )
oldVars( self, savedVars)
oldPVEPinSet = self.pvePanel.SetPinFilter
oldPVPPinSet = self.pvpPanel.SetPinFilter
a = true
for _, pinType in ipairs(order) do
local pin = pinType
if #pin > 2 then
self.pvePanel.AddPinFilterCheckBox( self.pvePanel, pin, function() EHM.MapPins:RefreshPins( pin ) end)
if pin ~= "skyshard" and pin ~= "found_skyshard" then
self.pvePanel.AddPinFilterComboBox( self.pvePanel, pin.."color", function() EHM.MapPins:RefreshPins( pin ) end, "SI_MAPFILTER", "r", "g", "b", "w" )
end
self.pvpPanel.AddPinFilterCheckBox( self.pvpPanel, pin, function() EHM.MapPins:RefreshPins( pin ) end)
end
end
--[[
self.pvePanel.SetPinFilter = function( self, mapPinGroup, checked )
oldPVEPinSet( self, mapPinGroup, checked )
MapPins:enablePins( mapPinGroup, checked )
end
self.pvpPanel.SetPinFilter = function( self, mapPinGroup, checked )
oldPVPPinSet( self, mapPinGroup, checked )
MapPins:enablePins( mapPinGroup, checked )
end
]]--
end
function EHMInitializeFilters()
for pinType, _ in pairs(EsoheadMarkersFilters) do
local pin = pinType
if #pin > 2 then
if not WORLD_MAP_FILTERS.pvePanel:GetPinFilter(pin.."color") then
WORLD_MAP_FILTERS.pvePanel:SetPinFilter(pin.."color", "w")
end
end
end
end
local oldData = ZO_MapPin.SetData
ZO_MapPin.SetData = function( self, pinTypeId, pinTag)
local back, value
for pinType, _ in pairs(EsoheadMarkersFilters) do
if pinTypeId == _G[pinType] then
value = ZO_WorldMap_GetFilterValue(pinType.."color")
back = GetControl(self.m_Control, "Background")
if value == "r" then
back:SetColor(1,0.1,0.1,1)
elseif value == "g" then
back:SetColor(0.1,1,0.1,1)
elseif value == "b" then
back:SetColor(0.2,0.2,1,1)
else
back:SetColor(1,1,1,1)
end
end
end
oldData(self, pinTypeId, pinTag)
end