From 23828bbbb71b669772964a99b089217903171e96 Mon Sep 17 00:00:00 2001 From: funkydude Date: Tue, 22 May 2018 03:22:38 +0100 Subject: [PATCH] Coordinates: You can now configure how fast the display updates (default 1). The lower the value the more memory/CPU will be used but the faster the display will refresh. This is important as asking the game for coordinate data is a lot more expensive in BfA. --- Coordinates.lua | 38 +++++++++++++++++++++++++++++++------- localization/deDE.lua | 3 +++ localization/enUS.lua | 2 ++ localization/esES.lua | 3 +++ localization/frFR.lua | 3 +++ localization/itIT.lua | 3 +++ localization/koKR.lua | 3 +++ localization/ptBR.lua | 3 +++ localization/ruRU.lua | 3 +++ localization/zhCN.lua | 3 +++ localization/zhTW.lua | 3 +++ 11 files changed, 60 insertions(+), 7 deletions(-) diff --git a/Coordinates.lua b/Coordinates.lua index 0b887b3..819d7c4 100644 --- a/Coordinates.lua +++ b/Coordinates.lua @@ -45,6 +45,22 @@ local options = { mod.db.locked = v end, }, + updateRate = { + type = "range", + name = L.updateRate, + desc = L.updateRateDesc, + order = 2.1, + width = "full", + min = 0.1, + max = 1, + step = 0.1, + get = function() + return mod.db.updateRate + end, + set = function(info, v) + mod.db.updateRate = v + end + }, fontColor = { type = "color", name = L["Font Color"], @@ -157,9 +173,14 @@ function mod:OnInitialize(profile) locked = false, fontColor = {}, enabled = false, + updateRate = 1, } end self.db = profile.coordinates + -- XXX temp 7.3.5 + if not profile.coordinates.updateRate then + profile.coordinates.updateRate = 1 + end end function mod:OnEnable() @@ -207,19 +228,22 @@ function mod:CreateFrame() local CTimerAfter = C_Timer.After if not GetBestMapForUnit then -- XXX 8.0 local function updateCoords() - CTimerAfter(0.1, updateCoords) + CTimerAfter(mod.db.updateRate, updateCoords) local x, y = GetPlayerMapPosition"player" coordsText:SetFormattedText("%.1f, %.1f", x and x*100 or 0, y and y*100 or 0) end updateCoords() else local function updateCoords() - CTimerAfter(0.5, updateCoords) - local tbl = GetPlayerMapPosition(GetBestMapForUnit("player"), "player") - if tbl then - coordsText:SetFormattedText("%.1f, %.1f", tbl.x*100, tbl.y*100) - else - coordsText:SetText("00.0, 00.0") + CTimerAfter(mod.db.updateRate, updateCoords) + local uiMapID = GetBestMapForUnit"player" + if uiMapID then + local tbl = GetPlayerMapPosition(uiMapID, "player") + if tbl then + coordsText:SetFormattedText("%.1f, %.1f", tbl.x*100, tbl.y*100) + else + coordsText:SetText("00.0, 00.0") + end end end updateCoords() diff --git a/localization/deDE.lua b/localization/deDE.lua index 246f673..f71f44c 100644 --- a/localization/deDE.lua +++ b/localization/deDE.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "Zonentext" L["Zoom In Button"] = "Heranzoom-Knopf" L["Zoom Out Button"] = "Herauszoom-Knopf" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/enUS.lua b/localization/enUS.lua index 3c1e1f2..f2e25f1 100644 --- a/localization/enUS.lua +++ b/localization/enUS.lua @@ -119,6 +119,8 @@ L["Lock Coordinates"] = "Lock Coordinates" L["Font Size"] = "Font Size" L["Font Color"] = "Font Color" L["Reset Position"] = "Reset Position" +L.updateRate = "Update Rate (seconds)" +L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." -- ./Fader.lua L["Enable Minimap Fader"] = "Enable Minimap Fader" diff --git a/localization/esES.lua b/localization/esES.lua index a074329..799d9d6 100644 --- a/localization/esES.lua +++ b/localization/esES.lua @@ -171,3 +171,6 @@ L["Width"] = "Ancho" -- L["Zone Text"] = "Zone Text" L["Zoom In Button"] = "Botón de Acercar Zoom" L["Zoom Out Button"] = "Botón de Alejar Zoom" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/frFR.lua b/localization/frFR.lua index 2c09e0f..c31e554 100644 --- a/localization/frFR.lua +++ b/localization/frFR.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "Zone de Texte" L["Zoom In Button"] = "Boutton Zoom Interieur" L["Zoom Out Button"] = "Boutton Zoom Exterieur" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/itIT.lua b/localization/itIT.lua index 2cc2d80..6121425 100644 --- a/localization/itIT.lua +++ b/localization/itIT.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "Testo Zona" L["Zoom In Button"] = "Zoom d'Ingrandimento" L["Zoom Out Button"] = "Pulsante Zoom d'Ingrandimento" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/koKR.lua b/localization/koKR.lua index 90f8e4c..6c3b6b7 100644 --- a/localization/koKR.lua +++ b/localization/koKR.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "지역 글자" -- Needs review L["Zoom In Button"] = "축소 버튼" -- Needs review L["Zoom Out Button"] = "확대 버튼" -- Needs review + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/ptBR.lua b/localization/ptBR.lua index 101929e..39cb1d9 100644 --- a/localization/ptBR.lua +++ b/localization/ptBR.lua @@ -171,3 +171,6 @@ L["Width"] = "Largura" L["Zone Text"] = "Texto da Zona" -- Needs review L["Zoom In Button"] = "Botão aumentar o Zoom" L["Zoom Out Button"] = "Botão diminuir o Zoom" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/ruRU.lua b/localization/ruRU.lua index 9b5d803..20bae0b 100644 --- a/localization/ruRU.lua +++ b/localization/ruRU.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "Текст игровой зоны" -- Needs review L["Zoom In Button"] = "кнопку приближения" -- Needs review L["Zoom Out Button"] = "кнопку отдаления" -- Needs review + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/zhCN.lua b/localization/zhCN.lua index de8594d..5002d98 100644 --- a/localization/zhCN.lua +++ b/localization/zhCN.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "地区文本" L["Zoom In Button"] = "放大按钮" L["Zoom Out Button"] = "缩小按钮" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data." diff --git a/localization/zhTW.lua b/localization/zhTW.lua index 9a2ee6f..b308bd0 100644 --- a/localization/zhTW.lua +++ b/localization/zhTW.lua @@ -171,3 +171,6 @@ L["You can set a background and edge file for the minimap like you would with an L["Zone Text"] = "地區文字" L["Zoom In Button"] = "放大按鈕" L["Zoom Out Button"] = "縮小按鈕" + +--L.updateRate = "Update Rate (seconds)" +--L.updateRateDesc = "The lower the value, the faster the coordinates will update, but the more memory and CPU will be consumed due to asking the game for fresh coordinate data."