Skip to content

Commit

Permalink
minimap: add options for zone and coordinate visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bhhandley authored and shagu committed Dec 30, 2024
1 parent 0e84077 commit 50e0e33
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 27 deletions.
19 changes: 18 additions & 1 deletion api/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("appearance", "bags", "bagrowlength", "10")
pfUI:UpdateConfig("appearance", "bags", "bankrowlength", "10")
pfUI:UpdateConfig("appearance", "minimap", "size", "140")
pfUI:UpdateConfig("appearance", "minimap", "mouseoverzone", "0")
pfUI:UpdateConfig("appearance", "minimap", "zonetext", "off")
pfUI:UpdateConfig("appearance", "minimap", "coordstext", "mouseover")
pfUI:UpdateConfig("appearance", "minimap", "coordsloc", "bottomleft")
pfUI:UpdateConfig("appearance", "minimap", "tracking_size", "16")
pfUI:UpdateConfig("appearance", "minimap", "tracking_pulse", "1")
Expand Down Expand Up @@ -1186,5 +1187,21 @@ function pfUI:MigrateConfig()
end
end

-- migrate minimap zone and coords changes
if checkversion(5, 4, 11) then
if pfUI_config.appearance.minimap.mouseoverzone and not pfUI_config.appearance.minimap.zonetext then
pfUI_config.appearance.minimap.zonetext = (pfUI_config.appearance.minimap.mouseoverzone == "0") and "off" or "mouseover"
pfUI_config.appearance.minimap.mouseoverzone = nil
end
if pfUI_config.appearance.minimap.coordsloc and not pfUI_config.appearance.minimap.coordstext then
if pfUI_config.appearance.minimap.coordsloc == "off" then
pfUI_config.appearance.minimap.coordsloc = "bottomleft"
pfUI_config.appearance.minimap.coordstext = "off"
else
pfUI_config.appearance.minimap.coordstext = "mouseover"
end
end
end

pfUI_config.version = pfUI.version.string
end
2 changes: 1 addition & 1 deletion env/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ local modern = {
["texture"] = "Interface\\AddOns\\pfUI\\img\\bar_gradient",
},
["minimap"] = {
["coordsloc"] = "topleft",
["coordsloc"] = "bottomleft",
},
["border"] = {
["color"] = "0.1,0.1,0.1,1",
Expand Down
3 changes: 2 additions & 1 deletion env/translations_deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["deDE"] = {
["Cooldown Text Size"] = nil,
["Cooldown Text Time Threshold"] = nil,
["Coordinates Location"] = nil,
["Coordinates On Minimap"] = nil,
["Count"] = nil,
["Create Profile"] = nil,
["Ctrl-Click"] = nil,
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["deDE"] = {
["Enable URL Detection"] = nil,
["Enable Vertical Health Bar"] = nil,
["Enable Weapon Buff Display"] = nil,
["Enable Zone Text On Minimap Mouseover"] = nil,
["Encode"] = nil,
["Ended"] = nil,
["Energy Color"] = nil,
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["deDE"] = {
["Zone Name"] = nil,
["Zoom & Fade"] = nil,
["Zoom Target Nameplate"] = nil,
["Zone Text On Minimap"] = nil,
}
4 changes: 3 additions & 1 deletion env/translations_enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["enUS"] = {
["Cooldown Text Size"] = nil,
["Cooldown Text Time Threshold"] = nil,
["Coordinates Location"] = nil,
["Coordinates On Minimap"] = nil,
["Count"] = nil,
["Create Profile"] = nil,
["Ctrl-Click"] = nil,
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["enUS"] = {
["Enable URL Detection"] = nil,
["Enable Vertical Health Bar"] = nil,
["Enable Weapon Buff Display"] = nil,
["Enable Zone Text On Minimap Mouseover"] = nil,
["Encode"] = nil,
["Ended"] = nil,
["Energy Color"] = nil,
Expand Down Expand Up @@ -471,6 +471,7 @@ pfUI_translation["enUS"] = {
["Monochrome"] = nil,
["Mouse Button 4"] = nil,
["Mouse Button 5"] = nil,
["Mouseover"] = nil,
["Mousewheel Scroll Speed"] = nil,
["ms"] = nil,
["N/A"] = nil,
Expand Down Expand Up @@ -803,6 +804,7 @@ pfUI_translation["enUS"] = {
["Your items have been repaired for"] = nil,
["Your vendor trash has been sold and you earned"] = nil,
["Zone Name"] = nil,
["Zone Text On Minimap"] = nil,
["Zoom & Fade"] = nil,
["Zoom Target Nameplate"] = nil,
}
3 changes: 2 additions & 1 deletion env/translations_esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["esES"] = {
["Cooldown Text Size"] = "Tamaño del texto del tiempo de reutilización",
["Cooldown Text Time Threshold"] = "Umbral del texto del tiempo de reutilización",
["Coordinates Location"] = "Coordenadas de localización",
["Coordinates On Minimap"] = "Coordenadas en el minimapa",
["Count"] = "Recuento",
["Create Profile"] = "Crear perfil",
["Ctrl-Click"] = "Ctrl-Clic",
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["esES"] = {
["Enable URL Detection"] = "Detectar URLs",
["Enable Vertical Health Bar"] = "Mostrar la salud en vertical",
["Enable Weapon Buff Display"] = "Mostrar los beneficios de armas",
["Enable Zone Text On Minimap Mouseover"] = "Mostrar texto de la zona al pasar el puntero por el minimapa",
["Encode"] = "Codificar",
["Ended"] = "Terminado",
["Energy Color"] = "Color de energía",
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["esES"] = {
["Zone Name"] = "Nombre de la zona",
["Zoom & Fade"] = "Acercar y desvanecer",
["Zoom Target Nameplate"] = "Acercar la placa identificativa del objetivo",
["Zone Text On Minimap"] = "Texto del área en el minimapa",
}
3 changes: 2 additions & 1 deletion env/translations_frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["frFR"] = {
["Cooldown Text Size"] = nil,
["Cooldown Text Time Threshold"] = "Seuil du texte des temps de recharge",
["Coordinates Location"] = "Coordonnées Emplacement",
["Coordinates On Minimap"] = "Coordonnées sur la mini-carte",
["Count"] = "Compter",
["Create Profile"] = "Créer un profil",
["Ctrl-Click"] = "Ctrl-Clique",
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["frFR"] = {
["Enable URL Detection"] = "Activer la détection des adresses URL",
["Enable Vertical Health Bar"] = "Activer la barre de vie verticale",
["Enable Weapon Buff Display"] = "Activer L'affichage de l'Amélioration d'arme",
["Enable Zone Text On Minimap Mouseover"] = "Activer l'affichage du nom de zone au survol de la minicarte",
["Encode"] = "Encoder",
["Ended"] = "Terminé",
["Energy Color"] = "Couleur de l'energie",
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["frFR"] = {
["Zone Name"] = "Nom de la zone",
["Zoom & Fade"] = "Zoom et fondu",
["Zoom Target Nameplate"] = "Zoom la cible des barres de vie flottantes",
["Zone Text On Minimap"] = "Texte de zone sur la mini-carte",
}
3 changes: 2 additions & 1 deletion env/translations_koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["koKR"] = {
["Cooldown Text Size"] = nil,
["Cooldown Text Time Threshold"] = "재사용 대기시간 텍스트 임계 값",
["Coordinates Location"] = nil,
["Coordinates On Minimap"] = "미니맵의 좌표",
["Count"] = "카운트",
["Create Profile"] = "프로파일 생성",
["Ctrl-Click"] = nil,
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["koKR"] = {
["Enable URL Detection"] = "URL 감시 사용",
["Enable Vertical Health Bar"] = nil,
["Enable Weapon Buff Display"] = nil,
["Enable Zone Text On Minimap Mouseover"] = "미니맵 마우스 오버시 지역보기 사용",
["Encode"] = nil,
["Ended"] = nil,
["Energy Color"] = nil,
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["koKR"] = {
["Zone Name"] = "지역 이름",
["Zoom & Fade"] = nil,
["Zoom Target Nameplate"] = nil,
["Zone Text On Minimap"] = "미니맵의 지역 텍스트",
}
3 changes: 2 additions & 1 deletion env/translations_ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["ruRU"] = {
["Cooldown Text Size"] = "Размер текста восстановления",
["Cooldown Text Time Threshold"] = "Порог текста восстановления",
["Coordinates Location"] = "Расположение координат",
["Coordinates On Minimap"] = "Координаты на миникарте",
["Count"] = "Счет",
["Create Profile"] = "Создать профиль",
["Ctrl-Click"] = "Ctrl+нажатие",
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["ruRU"] = {
["Enable URL Detection"] = "Включить обнаружение URL ссылок",
["Enable Vertical Health Bar"] = "Включить вертикальную панель здоровья",
["Enable Weapon Buff Display"] = "Включить отображение баффов оружия",
["Enable Zone Text On Minimap Mouseover"] = "Включить текст зоны на миникарте при наведении мыши",
["Encode"] = "Кодировать",
["Ended"] = "Окончание",
["Energy Color"] = "Цвет энергии",
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["ruRU"] = {
["Zone Name"] = "Название зоны",
["Zoom & Fade"] = "Увеличение и затухание",
["Zoom Target Nameplate"] = "Увеличить индикатор здоровья цели",
["Zone Text On Minimap"] = "Текст зоны на мини-карте",
}
3 changes: 2 additions & 1 deletion env/translations_zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["zhCN"] = {
["Cooldown Text Size"] = "技能冷却文字大小",
["Cooldown Text Time Threshold"] = "技能冷却时间文字临界值",
["Coordinates Location"] = "坐标位置",
["Coordinates On Minimap"] = "小地图上的坐标",
["Count"] = "计数器",
["Create Profile"] = "新建配置",
["Ctrl-Click"] = "CTRL点击",
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["zhCN"] = {
["Enable URL Detection"] = "启用超链接检测",
["Enable Vertical Health Bar"] = "血条以垂直方式掉血",
["Enable Weapon Buff Display"] = "启用武器Buff显示",
["Enable Zone Text On Minimap Mouseover"] = "鼠标悬停时显示区域名称",
["Encode"] = "编码",
["Ended"] = "结束",
["Energy Color"] = "能量值颜色",
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["zhCN"] = {
["Zone Name"] = "区域名称",
["Zoom & Fade"] = "变焦 & 渐隐",
["Zoom Target Nameplate"] = "放大目标姓名板",
["Zone Text On Minimap"] = "小地图上的区域名称",
}
3 changes: 2 additions & 1 deletion env/translations_zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pfUI_translation["zhTW"] = {
["Cooldown Text Size"] = nil,
["Cooldown Text Time Threshold"] = "技能冷卻時間文字臨界值",
["Coordinates Location"] = "座標位置",
["Coordinates On Minimap"] = "小地圖上的座標",
["Count"] = "計數器",
["Create Profile"] = "新建配置",
["Ctrl-Click"] = "CTRL點擊",
Expand Down Expand Up @@ -291,7 +292,6 @@ pfUI_translation["zhTW"] = {
["Enable URL Detection"] = "啟用超連結檢測",
["Enable Vertical Health Bar"] = "血條以垂直方式掉血",
["Enable Weapon Buff Display"] = "啟用武器Buff顯示",
["Enable Zone Text On Minimap Mouseover"] = "滑鼠懸停時顯示區功能變數名稱稱",
["Encode"] = "編碼",
["Ended"] = nil,
["Energy Color"] = nil,
Expand Down Expand Up @@ -805,4 +805,5 @@ pfUI_translation["zhTW"] = {
["Zone Name"] = "區功能變數名稱稱",
["Zoom & Fade"] = nil,
["Zoom Target Nameplate"] = "目標姓名版縮放",
["Zone Text On Minimap"] = "小地圖上的區域文本",
}
14 changes: 12 additions & 2 deletions modules/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,16 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
"topright:" .. T["Top Right"],
"bottomleft:" .. T["Bottom Left"],
"bottomright:" .. T["Bottom Right"],
"off:" .. T["Disabled"]
},
["minimap_cords_visibility"] = {
"mouseover:" .. T["Mouseover"],
"on:" .. T["Enable"],
"off:" .. T["Disable"]
},
["minimap_zone_visibility"] = {
"mouseover:" .. T["Mouseover"],
"on:" .. T["Enable"],
"off:" .. T["Disable"]
},
["positions"] = {
"TOPLEFT:" .. T["Top Left"],
Expand Down Expand Up @@ -1858,7 +1867,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()

CreateGUIEntry(T["Minimap"], T["Minimap"], function()
CreateConfig(U["minimap"], T["Minimap Size (|cffffaaaaExperimental|r)"], C.appearance.minimap, "size")
CreateConfig(nil, T["Enable Zone Text On Minimap Mouseover"], C.appearance.minimap, "mouseoverzone", "checkbox")
CreateConfig(nil, T["Zone Text On Minimap"], C.appearance.minimap, "zonetext", "dropdown", pfUI.gui.dropdowns.minimap_zone_visibility)
CreateConfig(nil, T["Coordinates On Minimap"], C.appearance.minimap, "coordstext", "dropdown", pfUI.gui.dropdowns.minimap_cords_visibility)
CreateConfig(nil, T["Coordinates Location"], C.appearance.minimap, "coordsloc", "dropdown", pfUI.gui.dropdowns.minimap_cords_position)
CreateConfig(nil, T["Show PvP Icon"], C.unitframes.player, "showPVPMinimap", "checkbox")
CreateConfig(nil, T["Show Inactive Tracking"], C.appearance.minimap, "tracking_pulse", "checkbox")
Expand Down
48 changes: 33 additions & 15 deletions modules/minimap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pfUI:RegisterModule("minimap", "vanilla:tbc", function ()
pfUI.minimapCoordinates = CreateFrame("Frame", "pfMinimapCoord", pfUI.minimap)
pfUI.minimapCoordinates:SetScript("OnUpdate", function()
-- update coords every 0.1 seconds
if ( this.tick or .1) > GetTime() then return else this.tick = GetTime() + .1 end
if C.appearance.minimap.coordstext ~= "off" and ( this.tick or .1) > GetTime() then return else this.tick = GetTime() + .1 end

this.posX, this.posY = GetPlayerMapPosition("player")
if this.posX ~= 0 and this.posY ~= 0 then
Expand Down Expand Up @@ -152,28 +152,27 @@ pfUI:RegisterModule("minimap", "vanilla:tbc", function ()
pfUI.minimapCoordinates.text:SetJustifyH("LEFT")
end

pfUI.minimapCoordinates:Hide()
if C.appearance.minimap.coordstext ~= "on" then
pfUI.minimapCoordinates:Hide()
else
pfUI.minimapCoordinates:Show()
end

-- Create zone text frame in top center of minimap
pfUI.minimapZone = CreateFrame("Frame", "pfMinimapZone", pfUI.minimap)
pfUI.minimapZone:RegisterEvent("MINIMAP_ZONE_CHANGED")
pfUI.minimapZone:RegisterEvent("PLAYER_ENTERING_WORLD")
pfUI.minimapZone:SetPoint("TOP", 0, -3)
pfUI.minimapZone:SetHeight(C.global.font_size + 2)
pfUI.minimapZone:SetWidth(Minimap:GetWidth())
pfUI.minimapZone.text = pfUI.minimapZone:CreateFontString("minimapZoneText", "LOW", "GameFontNormal")
pfUI.minimapZone.text:SetFont(pfUI.font_default, C.global.font_size + 2, "OUTLINE")
pfUI.minimapZone.text:SetAllPoints(pfUI.minimapZone)
pfUI.minimapZone.text:SetJustifyH("CENTER")
pfUI.minimapZone:Hide()

-- Minimap hover event
-- Update and toggle showing of coordinates and zone text on mouse enter/leave
Minimap:SetScript("OnEnter", function()
SetMapToCurrentZone()
if C.appearance.minimap.coordsloc ~= "off" then
pfUI.minimapCoordinates:Show()
end

if C.appearance.minimap.mouseoverzone == "1" then
pfUI.minimapZone:SetScript("OnEvent", function()
if C.appearance.minimap.coordstext ~= "off" then
SetMapToCurrentZone()
local pvp, _, arena = GetZonePVPInfo()
if arena then
pfUI.minimapZone.text:SetTextColor(1.0, 0.1, 0.1)
Expand All @@ -186,14 +185,33 @@ pfUI:RegisterModule("minimap", "vanilla:tbc", function ()
else
pfUI.minimapZone.text:SetTextColor(1, 1, 1, 1)
end

pfUI.minimapZone.text:SetText(GetMinimapZoneText())
end
end)

if C.appearance.minimap.zonetext ~= "on" then
pfUI.minimapZone:Hide()
else
pfUI.minimapZone:Show()
end

-- Minimap hover event
-- Update and toggle showing of coordinates and zone text on mouse enter/leave
Minimap:SetScript("OnEnter", function()
if C.appearance.minimap.coordstext ~= "off" then
pfUI.minimapCoordinates:Show()
end
if C.appearance.minimap.zonetext ~= "off" then
pfUI.minimapZone:Show()
end
end)
Minimap:SetScript("OnLeave", function()
pfUI.minimapCoordinates:Hide()
pfUI.minimapZone:Hide()
if C.appearance.minimap.coordstext ~= "on" then
pfUI.minimapCoordinates:Hide()
end
if C.appearance.minimap.zonetext ~= "on" then
pfUI.minimapZone:Hide()
end
end)

pfUI.minimap.pvpicon = CreateFrame("Frame", nil, pfUI.minimap)
Expand Down

0 comments on commit 50e0e33

Please sign in to comment.