mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
update numberPrefixStyle and add decimalLength
This commit is contained in:
@@ -5,39 +5,62 @@ local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, Profi
|
|||||||
local select, unpack, assert, tonumber, type, pairs = select, unpack, assert, tonumber, type, pairs
|
local select, unpack, assert, tonumber, type, pairs = select, unpack, assert, tonumber, type, pairs
|
||||||
local getn, tinsert, tremove = table.getn, tinsert, tremove
|
local getn, tinsert, tremove = table.getn, tinsert, tremove
|
||||||
local abs, ceil, floor, modf, mod = math.abs, math.ceil, math.floor, math.modf, math.mod
|
local abs, ceil, floor, modf, mod = math.abs, math.ceil, math.floor, math.modf, math.mod
|
||||||
local format, byte, len, sub, upper, split, utf8sub = string.format, string.byte, string.len, string.sub, string.upper, string.split, string.utf8sub
|
local find, format, byte, len, sub, gsub, upper, split, utf8sub = string.find, string.format, string.byte, string.len, string.sub, string.gsub, string.upper, string.split, string.utf8sub
|
||||||
--WoW API / Variables
|
--WoW API / Variables
|
||||||
local GetScreenWidth, GetScreenHeight = GetScreenWidth, GetScreenHeight
|
local GetScreenWidth, GetScreenHeight = GetScreenWidth, GetScreenHeight
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
|
|
||||||
|
--Return short value of a number
|
||||||
|
local shortValueDec
|
||||||
function E:ShortValue(v)
|
function E:ShortValue(v)
|
||||||
|
shortValueDec = format("%%.%df", E.db.general.decimalLength or 1)
|
||||||
if E.db.general.numberPrefixStyle == "METRIC" then
|
if E.db.general.numberPrefixStyle == "METRIC" then
|
||||||
if abs(v) >= 1e9 then
|
if abs(v) >= 1e9 then
|
||||||
return format("%.1fG", v / 1e9)
|
return format(shortValueDec.."G", v / 1e9)
|
||||||
elseif abs(v) >= 1e6 then
|
elseif abs(v) >= 1e6 then
|
||||||
return format("%.1fM", v / 1e6)
|
return format(shortValueDec.."M", v / 1e6)
|
||||||
elseif abs(v) >= 1e3 then
|
elseif abs(v) >= 1e3 then
|
||||||
return format("%.1fk", v / 1e3)
|
return format(shortValueDec.."k", v / 1e3)
|
||||||
else
|
else
|
||||||
return format("%d", v)
|
return format("%s", v)
|
||||||
end
|
end
|
||||||
elseif E.db.general.numberPrefixStyle == "CHINESE" then
|
elseif E.db.general.numberPrefixStyle == "CHINESE" then
|
||||||
if abs(v) >= 1e8 then
|
if abs(v) >= 1e8 then
|
||||||
return format("%.1fY", v / 1e8)
|
return format(shortValueDec.."Y", v / 1e8)
|
||||||
elseif(abs(v) >= 1e4) then
|
elseif abs(v) >= 1e4 then
|
||||||
return format("%.1fW", v / 1e4)
|
return format(shortValueDec.."W", v / 1e4)
|
||||||
else
|
else
|
||||||
return format("%d", v)
|
return format("%s", v)
|
||||||
|
end
|
||||||
|
elseif E.db.general.numberPrefixStyle == "KOREAN" then
|
||||||
|
if abs(v) >= 1e8 then
|
||||||
|
return format(shortValueDec.."억", v / 1e8)
|
||||||
|
elseif abs(v) >= 1e4 then
|
||||||
|
return format(shortValueDec.."만", v / 1e4)
|
||||||
|
elseif abs(v) >= 1e3 then
|
||||||
|
return format(shortValueDec.."천", v / 1e3)
|
||||||
|
else
|
||||||
|
return format("%s", v)
|
||||||
|
end
|
||||||
|
elseif E.db.general.numberPrefixStyle == "GERMAN" then
|
||||||
|
if abs(v) >= 1e9 then
|
||||||
|
return format(shortValueDec.."Mrd", v / 1e9)
|
||||||
|
elseif abs(v) >= 1e6 then
|
||||||
|
return format(shortValueDec.."Mio", v / 1e6)
|
||||||
|
elseif abs(v) >= 1e3 then
|
||||||
|
return format(shortValueDec.."Tsd", v / 1e3)
|
||||||
|
else
|
||||||
|
return format("%s", v)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if abs(v) >= 1e9 then
|
if abs(v) >= 1e9 then
|
||||||
return format("%.1fB", v / 1e9)
|
return format(shortValueDec.."B", v / 1e9)
|
||||||
elseif abs(v) >= 1e6 then
|
elseif abs(v) >= 1e6 then
|
||||||
return format("%.1fM", v / 1e6)
|
return format(shortValueDec.."M", v / 1e6)
|
||||||
elseif abs(v) >= 1e3 then
|
elseif abs(v) >= 1e3 then
|
||||||
return format("%.1fK", v / 1e3)
|
return format(shortValueDec.."K", v / 1e3)
|
||||||
else
|
else
|
||||||
return format("%d", v)
|
return format("%s", v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -168,6 +191,8 @@ function E:GetXYOffset(position, override)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local styles = {
|
local styles = {
|
||||||
|
-- keep percents in this table with `PERCENT` in the key, and `%.1f%%` in the value somewhere.
|
||||||
|
-- we use these two things to follow our setting for decimal length. they need to be EXACT.
|
||||||
["CURRENT"] = "%s",
|
["CURRENT"] = "%s",
|
||||||
["CURRENT_MAX"] = "%s - %s",
|
["CURRENT_MAX"] = "%s - %s",
|
||||||
["CURRENT_PERCENT"] = "%s - %.1f%%",
|
["CURRENT_PERCENT"] = "%s - %.1f%%",
|
||||||
@@ -183,28 +208,26 @@ function E:GetFormattedText(style, min, max)
|
|||||||
|
|
||||||
if max == 0 then max = 1 end
|
if max == 0 then max = 1 end
|
||||||
|
|
||||||
local useStyle = styles[style]
|
gftDec = E.db.general.decimalLength or 1
|
||||||
|
if gftDec ~= 1 and find(style, "PERCENT") then
|
||||||
|
gftUseStyle = gsub(styles[style], "%%%.1f%%%%", "%%."..gftDec.."f%%%%")
|
||||||
|
else
|
||||||
|
gftUseStyle = styles[style]
|
||||||
|
end
|
||||||
|
|
||||||
if style == "DEFICIT" then
|
if style == "DEFICIT" then
|
||||||
local deficit = max - min
|
gftDeficit = max - min
|
||||||
if deficit <= 0 then
|
return ((gftDeficit > 0) and format(gftUseStyle, E:ShortValue(gftDeficit))) or ""
|
||||||
return ""
|
|
||||||
else
|
|
||||||
return format(useStyle, E:ShortValue(deficit))
|
|
||||||
end
|
|
||||||
elseif style == "PERCENT" then
|
elseif style == "PERCENT" then
|
||||||
local s = format(useStyle, min / max * 100)
|
return format(gftUseStyle, min / max * 100)
|
||||||
return s
|
|
||||||
elseif style == "CURRENT" or ((style == "CURRENT_MAX" or style == "CURRENT_MAX_PERCENT" or style == "CURRENT_PERCENT") and min == max) then
|
elseif style == "CURRENT" or ((style == "CURRENT_MAX" or style == "CURRENT_MAX_PERCENT" or style == "CURRENT_PERCENT") and min == max) then
|
||||||
return format(styles["CURRENT"], E:ShortValue(min))
|
return format(styles["CURRENT"], E:ShortValue(min))
|
||||||
elseif style == "CURRENT_MAX" then
|
elseif style == "CURRENT_MAX" then
|
||||||
return format(useStyle, E:ShortValue(min), E:ShortValue(max))
|
return format(gftUseStyle, E:ShortValue(min), E:ShortValue(max))
|
||||||
elseif style == "CURRENT_PERCENT" then
|
elseif style == "CURRENT_PERCENT" then
|
||||||
local s = format(useStyle, E:ShortValue(min), min / max * 100)
|
return format(gftUseStyle, E:ShortValue(min), min / max * 100)
|
||||||
return s
|
|
||||||
elseif style == "CURRENT_MAX_PERCENT" then
|
elseif style == "CURRENT_MAX_PERCENT" then
|
||||||
local s = format(useStyle, E:ShortValue(min), E:ShortValue(max), min / max * 100)
|
return format(gftUseStyle, E:ShortValue(min), E:ShortValue(max), min / max * 100)
|
||||||
return s
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ P["general"] = {
|
|||||||
["afk"] = true,
|
["afk"] = true,
|
||||||
["enhancedPvpMessages"] = true,
|
["enhancedPvpMessages"] = true,
|
||||||
["numberPrefixStyle"] = "ENGLISH",
|
["numberPrefixStyle"] = "ENGLISH",
|
||||||
|
["decimalLength"] = 1,
|
||||||
|
|
||||||
["fontSize"] = 12,
|
["fontSize"] = 12,
|
||||||
["font"] = "PT Sans Narrow",
|
["font"] = "PT Sans Narrow",
|
||||||
|
|
||||||
|
|||||||
@@ -193,11 +193,22 @@ E.Options.args.general = {
|
|||||||
get = function(info) return E.db.general.numberPrefixStyle; end,
|
get = function(info) return E.db.general.numberPrefixStyle; end,
|
||||||
set = function(info, value) E.db.general.numberPrefixStyle = value; E:StaticPopup_Show("CONFIG_RL"); end,
|
set = function(info, value) E.db.general.numberPrefixStyle = value; E:StaticPopup_Show("CONFIG_RL"); end,
|
||||||
values = {
|
values = {
|
||||||
["METRIC"] = "k, M, G",
|
["METRIC"] = "Metric (k, M, G)",
|
||||||
["ENGLISH"] = "K, M, B",
|
["ENGLISH"] = "English (K, M, B)",
|
||||||
["CHINESE"] = "W, Y"
|
["CHINESE"] = "Chinese (W, Y)",
|
||||||
|
["KOREAN"] = "Korean (천, 만, 억)",
|
||||||
|
["GERMAN"] = "German (Tsd, Mio, Mrd)"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
decimalLength = {
|
||||||
|
order = 22,
|
||||||
|
type = "range",
|
||||||
|
name = L["Decimal Length"],
|
||||||
|
desc = L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."],
|
||||||
|
min = 0, max = 4, step = 1,
|
||||||
|
get = function(info) return E.db.general.decimalLength end,
|
||||||
|
set = function(info, value) E.db.general.decimalLength = value; E:StaticPopup_Show("GLOBAL_RL") end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
media = {
|
media = {
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "当访问商人
|
|||||||
L["Bottom Panel"] = "底部面板"
|
L["Bottom Panel"] = "底部面板"
|
||||||
L["Chat Bubbles Style"] = "聊天气泡样式"
|
L["Chat Bubbles Style"] = "聊天气泡样式"
|
||||||
L["Chat Bubbles"] = "聊天气泡"
|
L["Chat Bubbles"] = "聊天气泡"
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = "控制像姓名版和团队框架中各数值的小数位数"
|
||||||
|
L["Decimal Length"] = "小数位数"
|
||||||
L["Direction the bar moves on gains/losses"] = "条增加/减少时的方向"
|
L["Direction the bar moves on gains/losses"] = "条增加/减少时的方向"
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "显示跨越屏幕底部的面板,仅仅是用于装饰."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "显示跨越屏幕底部的面板,仅仅是用于装饰."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "显示跨越屏幕顶部的面板,仅仅是用于装饰."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "显示跨越屏幕顶部的面板,仅仅是用于装饰."
|
||||||
|
|||||||
@@ -378,6 +378,8 @@ L["Automatically vendor gray items when visiting a vendor."] = true;
|
|||||||
L["Bottom Panel"] = true;
|
L["Bottom Panel"] = true;
|
||||||
L["Chat Bubbles Style"] = true;
|
L["Chat Bubbles Style"] = true;
|
||||||
L["Chat Bubbles"] = true;
|
L["Chat Bubbles"] = true;
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = true;
|
L["Direction the bar moves on gains/losses"] = true;
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = true;
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = true;
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = true;
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = true;
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "Vendre automatiq
|
|||||||
L["Bottom Panel"] = "Bandeau en bas"
|
L["Bottom Panel"] = "Bandeau en bas"
|
||||||
L["Chat Bubbles Style"] = "Style des bulles de discussion"
|
L["Chat Bubbles Style"] = "Style des bulles de discussion"
|
||||||
L["Chat Bubbles"] = "Bulles de discussion"
|
L["Chat Bubbles"] = "Bulles de discussion"
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = "Direction que prend la barre quand gain / perte"
|
L["Direction the bar moves on gains/losses"] = "Direction que prend la barre quand gain / perte"
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Affiche un bandeau au bas de l'écran. Option purement cosmétique."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Affiche un bandeau au bas de l'écran. Option purement cosmétique."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Affiche un bandeau en haut de l'écran. Option purement cosmétique."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Affiche un bandeau en haut de l'écran. Option purement cosmétique."
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "Automatischer Ve
|
|||||||
L["Bottom Panel"] = "Untere Leiste"
|
L["Bottom Panel"] = "Untere Leiste"
|
||||||
L["Chat Bubbles Style"] = "Sprechblasen Stil"
|
L["Chat Bubbles Style"] = "Sprechblasen Stil"
|
||||||
L["Chat Bubbles"] = "Sprechblasen"
|
L["Chat Bubbles"] = "Sprechblasen"
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = "Kontrolliert die Anzahl der Dezimalstellen in den Werten auf den Namensplaketten und Einheitenfenstern."
|
||||||
|
L["Decimal Length"] = "Dezimalstellen"
|
||||||
L["Direction the bar moves on gains/losses"] = "Richtung in die der Balken wächst/sinkt"
|
L["Direction the bar moves on gains/losses"] = "Richtung in die der Balken wächst/sinkt"
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Zeige eine Leiste am unterem Bildschirmrand. Das ist rein kosmetisch."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Zeige eine Leiste am unterem Bildschirmrand. Das ist rein kosmetisch."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Zeige eine Leiste am oberen Bildschirmrand. Das ist rein kosmetisch."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Zeige eine Leiste am oberen Bildschirmrand. Das ist rein kosmetisch."
|
||||||
|
|||||||
@@ -437,6 +437,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "상점이 열리
|
|||||||
L["Bottom Panel"] = "하단 패널 표시"
|
L["Bottom Panel"] = "하단 패널 표시"
|
||||||
L["Chat Bubbles Style"] = "말풍선 디자인"
|
L["Chat Bubbles Style"] = "말풍선 디자인"
|
||||||
L["Chat Bubbles"] = true;
|
L["Chat Bubbles"] = true;
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = "바의 증감방향을 결정합니다."
|
L["Direction the bar moves on gains/losses"] = "바의 증감방향을 결정합니다."
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "화면 하단에 꾸미기 용도의 바를 생성합니다."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "화면 하단에 꾸미기 용도의 바를 생성합니다."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "화면 상단에 꾸미기 용도의 바를 생성합니다."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "화면 상단에 꾸미기 용도의 바를 생성합니다."
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "Vender itens cin
|
|||||||
L["Bottom Panel"] = "Painel Infeior"
|
L["Bottom Panel"] = "Painel Infeior"
|
||||||
L["Chat Bubbles Style"] = "Estilo dos Balões de Fala"
|
L["Chat Bubbles Style"] = "Estilo dos Balões de Fala"
|
||||||
L["Chat Bubbles"] = true;
|
L["Chat Bubbles"] = true;
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = true;
|
L["Direction the bar moves on gains/losses"] = true;
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Mostra um painel na parte inferior da tela. Apenas para efeito cosmético."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Mostra um painel na parte inferior da tela. Apenas para efeito cosmético."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Mostra um painel na parte superior da tela. Apenas para efeito cosmético."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Mostra um painel na parte superior da tela. Apenas para efeito cosmético."
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "Автомати
|
|||||||
L["Bottom Panel"] = "Нижняя панель"
|
L["Bottom Panel"] = "Нижняя панель"
|
||||||
L["Chat Bubbles Style"] = "Стиль облачков сообщений"
|
L["Chat Bubbles Style"] = "Стиль облачков сообщений"
|
||||||
L["Chat Bubbles"] = "Облачка сообщений"
|
L["Chat Bubbles"] = "Облачка сообщений"
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = "направление заполнения полосы"
|
L["Direction the bar moves on gains/losses"] = "направление заполнения полосы"
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Отображать панель на нижней границе экрана. Это косметический элемент."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Отображать панель на нижней границе экрана. Это косметический элемент."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Отображать панель на верхней границе экрана. Это косметический элемент."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Отображать панель на верхней границе экрана. Это косметический элемент."
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "Vender automáti
|
|||||||
L["Bottom Panel"] = "Panel Inferior"
|
L["Bottom Panel"] = "Panel Inferior"
|
||||||
L["Chat Bubbles Style"] = true;
|
L["Chat Bubbles Style"] = true;
|
||||||
L["Chat Bubbles"] = true;
|
L["Chat Bubbles"] = true;
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = true;
|
L["Direction the bar moves on gains/losses"] = true;
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Despliega un panel a través de la parte inferior de la pantalla. Es es sólo algo cosmético."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "Despliega un panel a través de la parte inferior de la pantalla. Es es sólo algo cosmético."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Despliega un panel a través de la parte superior de la pantalla. Es es sólo algo cosmético."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "Despliega un panel a través de la parte superior de la pantalla. Es es sólo algo cosmético."
|
||||||
|
|||||||
@@ -389,6 +389,8 @@ L["Automatically vendor gray items when visiting a vendor."] = "當訪問商人
|
|||||||
L["Bottom Panel"] = "底部面板"
|
L["Bottom Panel"] = "底部面板"
|
||||||
L["Chat Bubbles Style"] = "聊天氣泡樣式"
|
L["Chat Bubbles Style"] = "聊天氣泡樣式"
|
||||||
L["Chat Bubbles"] = "聊天氣泡"
|
L["Chat Bubbles"] = "聊天氣泡"
|
||||||
|
L["Controls the amount of decimals used in values displayed on elements like NamePlates and UnitFrames."] = true
|
||||||
|
L["Decimal Length"] = true
|
||||||
L["Direction the bar moves on gains/losses"] = true;
|
L["Direction the bar moves on gains/losses"] = true;
|
||||||
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "顯示跨越螢幕底部的面板,僅僅是用于裝飾."
|
L["Display a panel across the bottom of the screen. This is for cosmetic only."] = "顯示跨越螢幕底部的面板,僅僅是用于裝飾."
|
||||||
L["Display a panel across the top of the screen. This is for cosmetic only."] = "顯示跨越螢幕頂部的面板,僅僅是用于裝飾."
|
L["Display a panel across the top of the screen. This is for cosmetic only."] = "顯示跨越螢幕頂部的面板,僅僅是用于裝飾."
|
||||||
|
|||||||
Reference in New Issue
Block a user