Classic Territory Colors
This commit is contained in:
parent
3329ac83ec
commit
7c6933fca5
|
|
@ -0,0 +1,156 @@
|
||||||
|
local territoryByMapID = {
|
||||||
|
-- Classic Kalimdor and Eastern Kingdoms UI map IDs.
|
||||||
|
[1411] = "Horde", -- Durotar
|
||||||
|
[1412] = "Horde", -- Mulgore
|
||||||
|
[1413] = "Horde", -- The Barrens
|
||||||
|
[1416] = "Contested", -- Alterac Mountains
|
||||||
|
[1417] = "Contested", -- Arathi Highlands
|
||||||
|
[1418] = "Contested", -- Badlands
|
||||||
|
[1419] = "Contested", -- Blasted Lands
|
||||||
|
[1420] = "Horde", -- Tirisfal Glades
|
||||||
|
[1421] = "Horde", -- Silverpine Forest
|
||||||
|
[1422] = "Contested", -- Western Plaguelands
|
||||||
|
[1423] = "Contested", -- Eastern Plaguelands
|
||||||
|
[1424] = "Contested", -- Hillsbrad Foothills
|
||||||
|
[1425] = "Contested", -- The Hinterlands
|
||||||
|
[1426] = "Alliance", -- Dun Morogh
|
||||||
|
[1427] = "Contested", -- Searing Gorge
|
||||||
|
[1428] = "Contested", -- Burning Steppes
|
||||||
|
[1429] = "Alliance", -- Elwynn Forest
|
||||||
|
[1430] = "Contested", -- Deadwind Pass
|
||||||
|
[1431] = "Contested", -- Duskwood
|
||||||
|
[1432] = "Alliance", -- Loch Modan
|
||||||
|
[1433] = "Contested", -- Redridge Mountains
|
||||||
|
[1434] = "Contested", -- Stranglethorn Vale
|
||||||
|
[1435] = "Contested", -- Swamp of Sorrows
|
||||||
|
[1436] = "Alliance", -- Westfall
|
||||||
|
[1437] = "Contested", -- Wetlands
|
||||||
|
[1438] = "Alliance", -- Teldrassil
|
||||||
|
[1439] = "Alliance", -- Darkshore
|
||||||
|
[1440] = "Contested", -- Ashenvale
|
||||||
|
[1441] = "Contested", -- Thousand Needles
|
||||||
|
[1442] = "Contested", -- Stonetalon Mountains
|
||||||
|
[1443] = "Contested", -- Desolace
|
||||||
|
[1444] = "Contested", -- Feralas
|
||||||
|
[1445] = "Contested", -- Dustwallow Marsh
|
||||||
|
[1446] = "Contested", -- Tanaris
|
||||||
|
[1447] = "Contested", -- Azshara
|
||||||
|
[1448] = "Contested", -- Felwood
|
||||||
|
[1449] = "Contested", -- Un'Goro Crater
|
||||||
|
[1450] = "Contested", -- Moonglade
|
||||||
|
[1451] = "Contested", -- Silithus
|
||||||
|
[1452] = "Contested", -- Winterspring
|
||||||
|
[1453] = "Alliance", -- Stormwind City
|
||||||
|
[1454] = "Horde", -- Orgrimmar
|
||||||
|
[1455] = "Alliance", -- Ironforge
|
||||||
|
[1456] = "Horde", -- Thunder Bluff
|
||||||
|
[1457] = "Alliance", -- Darnassus
|
||||||
|
[1458] = "Horde", -- Undercity
|
||||||
|
-- Outdoor zones added by Forever (UiMap 1.60.1.69977).
|
||||||
|
[2482] = "Contested", -- Mount Hyjal
|
||||||
|
[2521] = "Contested", -- Zephras Isle
|
||||||
|
[2548] = "Contested", -- Riverglades
|
||||||
|
[2652] = "Contested", -- Shen'dralas
|
||||||
|
[2665] = "Contested", -- Zephras Isle alternate map
|
||||||
|
}
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
friendly = { 0.1, 1, 0.1 },
|
||||||
|
contested = { 1, 0.7, 0 },
|
||||||
|
hostile = { 1, 0.1, 0.1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
local playerFaction
|
||||||
|
local installed = false
|
||||||
|
|
||||||
|
local function GetTerritoryColor(mapID)
|
||||||
|
local territory = territoryByMapID[mapID]
|
||||||
|
if not territory then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if territory == "Contested" then
|
||||||
|
return colors.contested
|
||||||
|
end
|
||||||
|
return colors[territory == playerFaction and "friendly" or "hostile"]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function UpdateMapNavBar(navBar)
|
||||||
|
for _, button in ipairs(navBar.navList or {}) do
|
||||||
|
if button.data and button.data.id and button.text then
|
||||||
|
if not button.ClassicTerritoryDefaultColor then
|
||||||
|
button.ClassicTerritoryDefaultColor = { button.text:GetTextColor() }
|
||||||
|
end
|
||||||
|
local color = GetTerritoryColor(button.data.id) or button.ClassicTerritoryDefaultColor
|
||||||
|
button.text:SetTextColor(color[1], color[2], color[3], color[4] or 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function UpdateHoveredRegion(label)
|
||||||
|
local map = label.dataProvider and label.dataProvider:GetMap()
|
||||||
|
if not (map and map:IsCanvasMouseFocus()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local areaNameType = MAP_AREA_LABEL_TYPE and MAP_AREA_LABEL_TYPE.AREA_NAME
|
||||||
|
local labels = label.labelInfoByType
|
||||||
|
if not (areaNameType and labels and labels[areaNameType] and labels[areaNameType].name) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Other labels, such as points of interest, take priority over a region name.
|
||||||
|
for labelType, info in pairs(labels) do
|
||||||
|
if labelType > areaNameType and info.name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local x, y = map:GetNormalizedCursorPosition()
|
||||||
|
if not (x and y) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local mapInfo = C_Map.GetMapInfoAtPosition(map:GetMapID(), x, y)
|
||||||
|
local color = mapInfo and GetTerritoryColor(mapInfo.mapID)
|
||||||
|
if color then
|
||||||
|
label.Name:SetVertexColor(color[1], color[2], color[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function Install()
|
||||||
|
if installed or not (WorldMapFrame and WorldMapFrame.NavBar and WorldMapFrame.dataProviders) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local areaLabel
|
||||||
|
for provider in pairs(WorldMapFrame.dataProviders) do
|
||||||
|
if provider.Label and provider.Label.labelInfoByType and provider.Label.EvaluateLabels then
|
||||||
|
areaLabel = provider.Label
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not areaLabel then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
playerFaction = UnitFactionGroup("player")
|
||||||
|
if playerFaction ~= "Alliance" and playerFaction ~= "Horde" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
hooksecurefunc(areaLabel, "EvaluateLabels", UpdateHoveredRegion)
|
||||||
|
hooksecurefunc(WorldMapFrame.NavBar, "Refresh", UpdateMapNavBar)
|
||||||
|
installed = true
|
||||||
|
UpdateMapNavBar(WorldMapFrame.NavBar)
|
||||||
|
end
|
||||||
|
|
||||||
|
local events = CreateFrame("Frame")
|
||||||
|
events:RegisterEvent("ADDON_LOADED")
|
||||||
|
events:RegisterEvent("PLAYER_LOGIN")
|
||||||
|
events:SetScript("OnEvent", function()
|
||||||
|
Install()
|
||||||
|
if installed then
|
||||||
|
events:UnregisterAllEvents()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
Install()
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
## Interface: 16001
|
||||||
|
## AllowLoadGameType: camelot
|
||||||
|
## Title: Classic Territory Colors
|
||||||
|
## Notes: Restores friendly, contested, and hostile colors to world map region names.
|
||||||
|
## Author: Local
|
||||||
|
## Version: 1.2
|
||||||
|
|
||||||
|
ClassicTerritoryColors.lua
|
||||||
|
|
@ -204,10 +204,16 @@ function SetGuard:OnEvent(event)
|
||||||
merchantOpen = false
|
merchantOpen = false
|
||||||
end
|
end
|
||||||
|
|
||||||
self:QueueUpdate(event == "PLAYER_LOGIN" or event == "EQUIPMENT_SETS_CHANGED")
|
local rebuildSets = event == "PLAYER_LOGIN"
|
||||||
|
or event == "PLAYER_ENTERING_WORLD"
|
||||||
|
or event == "EQUIPMENT_SETS_CHANGED"
|
||||||
|
or event == "BAG_UPDATE_DELAYED"
|
||||||
|
or event == "MERCHANT_SHOW"
|
||||||
|
self:QueueUpdate(rebuildSets)
|
||||||
end
|
end
|
||||||
|
|
||||||
SetGuard:RegisterEvent("PLAYER_LOGIN")
|
SetGuard:RegisterEvent("PLAYER_LOGIN")
|
||||||
|
SetGuard:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
SetGuard:RegisterEvent("EQUIPMENT_SETS_CHANGED")
|
SetGuard:RegisterEvent("EQUIPMENT_SETS_CHANGED")
|
||||||
SetGuard:RegisterEvent("BAG_UPDATE_DELAYED")
|
SetGuard:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||||
SetGuard:RegisterEvent("MERCHANT_SHOW")
|
SetGuard:RegisterEvent("MERCHANT_SHOW")
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
## Interface: 11508
|
## Interface: 16001
|
||||||
## Title: Set Guard
|
## Title: Set Guard
|
||||||
## Notes: Marks bag items saved in equipment sets and dims them at merchants.
|
## Notes: Marks bag items saved in equipment sets and dims them at merchants.
|
||||||
## Author: Local
|
## Author: Local
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue