Skip to content

Commit

Permalink
Allow changing colors of Stat Summary (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Sep 21, 2022
1 parent 854b909 commit 4de2b16
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 134 deletions.
189 changes: 103 additions & 86 deletions RatingBuster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -433,33 +433,19 @@ local options = {
type = 'toggle',
name = L["Show stat summary"],
desc = L["Show stat summary in tooltips"],
order = 1,
},
ignore = {
type = 'group',
name = L["Ignore settings"],
desc = L["Ignore stuff when calculating the stat summary"],
args = {
sumIgnoreUnused = {
type = 'toggle',
name = L["Ignore unused items types"],
desc = L["Show stat summary only for highest level armor type and items you can use with uncommon quality and up"],
},
sumIgnoreEquipped = {
type = 'toggle',
name = L["Ignore equipped items"],
desc = L["Hide stat summary for equipped items"],
},
sumIgnoreEnchant = {
type = 'toggle',
name = L["Ignore enchants"],
desc = L["Ignore enchants on items when calculating the stat summary"],
},
sumIgnoreGems = {
type = 'toggle',
name = L["Ignore gems"],
desc = L["Ignore gems on items when calculating the stat summary"],
},
},
calcSum = {
type = 'toggle',
name = L["Calculate stat sum"],
desc = L["Calculate the total stats for the item"],
order = 2,
},
calcDiff = {
type = 'toggle',
name = L["Calculate stat diff"],
desc = L["Calculate the stat difference for the item and equipped items"],
order = 3,
},
sumDiffStyle = {
type = 'select',
Expand All @@ -469,53 +455,93 @@ local options = {
["comp"] = "Compare",
["main"] = "Main"
},
},
space = {
type = 'group',
name = L["Add empty line"],
desc = L["Add a empty line before or after stat summary"],
args = {
sumBlankLine = {
type = 'toggle',
name = L["Add before summary"],
desc = L["Add a empty line before stat summary"],
},
sumBlankLineAfter = {
type = 'toggle',
name = L["Add after summary"],
desc = L["Add a empty line after stat summary"],
},
},
order = 4,
},
sumShowIcon = {
type = 'toggle',
name = L["Show icon"],
desc = L["Show the sigma icon before summary listing"],
order = 5,
},
sumShowTitle = {
type = 'toggle',
name = L["Show title text"],
desc = L["Show the title text before summary listing"],
order = 6,
},
showZeroValueStat = {
type = 'toggle',
name = L["Show zero value stats"],
desc = L["Show zero value stats in summary for consistancy"],
},
calcSum = {
type = 'toggle',
name = L["Calculate stat sum"],
desc = L["Calculate the total stats for the item"],
},
calcDiff = {
type = 'toggle',
name = L["Calculate stat diff"],
desc = L["Calculate the stat difference for the item and equipped items"],
order = 7,
},
sumSortAlpha = {
type = 'toggle',
name = L["Sort StatSummary alphabetically"],
desc = L["Enable to sort StatSummary alphabetically, disable to sort according to stat type(basic, physical, spell, tank)"],
order = 8,
},
space = {
type = 'group',
name = L["Add empty line"],
inline = true,
args = {
sumBlankLine = {
type = 'toggle',
name = L["Add before summary"],
desc = L["Add a empty line before stat summary"],
order = 10,
},
sumBlankLineAfter = {
type = 'toggle',
name = L["Add after summary"],
desc = L["Add a empty line after stat summary"],
order = 11,
},
},
},
sumStatColor = {
type = 'color',
name = L["Change text color"],
desc = L["Changes the color of added text"],
get = getColor,
set = setColor,
order = 13,
},
sumValueColor = {
type = 'color',
name = L["Change number color"],
desc = L["Changes the color of added text"],
get = getColor,
set = setColor,
order = 14,
},
ignore = {
type = 'group',
name = L["Ignore settings"],
desc = L["Ignore stuff when calculating the stat summary"],
args = {
sumIgnoreUnused = {
type = 'toggle',
name = L["Ignore unused items types"],
desc = L["Show stat summary only for highest level armor type and items you can use with uncommon quality and up"],
},
sumIgnoreEquipped = {
type = 'toggle',
name = L["Ignore equipped items"],
desc = L["Hide stat summary for equipped items"],
},
sumIgnoreEnchant = {
type = 'toggle',
name = L["Ignore enchants"],
desc = L["Ignore enchants on items when calculating the stat summary"],
},
sumIgnoreGems = {
type = 'toggle',
name = L["Ignore gems"],
desc = L["Ignore gems on items when calculating the stat summary"],
},
},
},
basic = {
type = 'group',
Expand Down Expand Up @@ -1005,6 +1031,8 @@ local defaults = {
sumIgnoreGems = false,
sumBlankLine = true,
sumBlankLineAfter = false,
sumStatColor = CreateColor(NORMAL_FONT_COLOR:GetRGBA()),
sumValueColor = CreateColor(NORMAL_FONT_COLOR:GetRGBA()),
sumShowIcon = true,
sumShowTitle = true,
sumDiffStyle = "main",
Expand Down Expand Up @@ -3150,6 +3178,26 @@ function sumSortAlphaComp(a, b)
return a[1] < b[1]
end

local function WriteSummary(tooltip, output)
if globalDB.sumBlankLine then
tooltip:AddLine(" ")
end
if globalDB.sumShowTitle then
tooltip:AddLine(HIGHLIGHT_FONT_COLOR_CODE..L["Stat Summary"]..FONT_COLOR_CODE_CLOSE)
if globalDB.sumShowIcon then
tooltip:AddTexture("Interface\\AddOns\\RatingBuster\\images\\Sigma")
end
end
local statR, statG, statB = globalDB.sumStatColor:GetRGB()
local valueR, valueG, valueB = globalDB.sumValueColor:GetRGB()
for _, o in ipairs(output) do
tooltip:AddDoubleLine(o[1], o[2], statR, statG, statB, valueR, valueG, valueB)
end
if globalDB.sumBlankLineAfter then
tooltip:AddLine(" ")
end
end

function RatingBuster:StatSummary(tooltip, name, link)
-- Hide stat summary for equipped items
if globalDB.sumIgnoreEquipped and IsEquippedItem(link) then return end
Expand Down Expand Up @@ -3249,22 +3297,7 @@ function RatingBuster:StatSummary(tooltip, name, link)
-- Check Cache
if cache[id] and cache[id].numLines == numLines then
if table.maxn(cache[id]) == 0 then return end
-- Write Tooltip
if globalDB.sumBlankLine then
tooltip:AddLine(" ")
end
if globalDB.sumShowTitle then
tooltip:AddLine(HIGHLIGHT_FONT_COLOR_CODE..L["Stat Summary"]..FONT_COLOR_CODE_CLOSE)
if globalDB.sumShowIcon then
tooltip:AddTexture("Interface\\AddOns\\RatingBuster\\images\\Sigma")
end
end
for _, o in ipairs(cache[id]) do
tooltip:AddDoubleLine(o[1], o[2])
end
if globalDB.sumBlankLineAfter then
tooltip:AddLine(" ")
end
WriteSummary(tooltip, cache[id])
return
end

Expand Down Expand Up @@ -3538,23 +3571,7 @@ function RatingBuster:StatSummary(tooltip, name, link)
-- Write cache
cache[id] = output
if table.maxn(output) == 0 then return end
-------------------
-- Write Tooltip --
if globalDB.sumBlankLine then
tooltip:AddLine(" ")
end
if globalDB.sumShowTitle then
tooltip:AddLine(HIGHLIGHT_FONT_COLOR_CODE..L["Stat Summary"]..FONT_COLOR_CODE_CLOSE)
if globalDB.sumShowIcon then
tooltip:AddTexture("Interface\\AddOns\\RatingBuster\\images\\Sigma")
end
end
for _, o in ipairs(output) do
tooltip:AddDoubleLine(o[1], o[2])
end
if globalDB.sumBlankLineAfter then
tooltip:AddLine(" ")
end
WriteSummary(tooltip, output)
end


Expand Down
7 changes: 1 addition & 6 deletions locales/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ L["Set the level used in calculations (0 = your level)"] = "Legt den Level der z
-- /rb color
L["Change text color"] = "Ändere Textfarbe"
L["Changes the color of added text"] = "Ändert die Textfarbe des hinzugefügten Textes"
-- /rb color pick
L["Pick color"] = "Wähle Farbe"
L["Pick a color"] = "Wähle eine Farbe"
-- /rb color enable
L["Enable color"] = "Farbe aktivieren"
L["Enable colored text"] = "Aktiviert gefärbten Text"
L["Change number color"] = true
-- /rb rating
L["Rating"] = "Bewertung"
L["Options for Rating display"] = "Optionen für die Bewertungsanzeige"
Expand Down
7 changes: 1 addition & 6 deletions locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ L["Set the level used in calculations (0 = your level)"] = true
-- /rb color
L["Change text color"] = true
L["Changes the color of added text"] = true
-- /rb color pick
L["Pick color"] = true
L["Pick a color"] = true
-- /rb color enable
L["Enable color"] = true
L["Enable colored text"] = true
L["Change number color"] = true
-- /rb rating
L["Rating"] = true
L["Options for Rating display"] = true
Expand Down
7 changes: 1 addition & 6 deletions locales/esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ L["Set the level used in calculations (0 = your level)"] = "Establece el nivel u
-- /rb color
L["Change text color"] = "Cambiar color texto"
L["Changes the color of added text"] = "Cambia el color del texto anadido"
-- /rb color pick
L["Pick color"] = "Coge color"
L["Pick a color"] = "Coge un color"
-- /rb color enable
L["Enable color"] = "Habilitar color"
L["Enable colored text"] = "Habilitar texto coloreado"
L["Change number color"] = true
-- /rb rating
L["Rating"] = "Calificacion"
L["Options for Rating display"] = "Opciones de visualizacion"
Expand Down
7 changes: 1 addition & 6 deletions locales/frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ L["Set the level used in calculations (0 = your level)"] = "Définis le niveau u
-- /rb color
L["Change text color"] = "Couleur du texte"
L["Changes the color of added text"] = "Change la couleur du texte ajouté."
-- /rb color pick
L["Pick color"] = "Choix de la couleur"
L["Pick a color"] = "Choisissez une couleur"
-- /rb color enable
L["Enable color"] = "Activer la couleur"
L["Enable colored text"] = "Active le texte coloré"
L["Change number color"] = true
-- /rb rating
L["Rating"] = "Détail des scores"
L["Options for Rating display"] = "Sélectionne les différents bonus liés aux scores à inclure dans les info-bulles des objets."
Expand Down
7 changes: 1 addition & 6 deletions locales/koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ L["Set the level used in calculations (0 = your level)"] = "계산에 적용할
-- /rb color
L["Change text color"] = "글자 색상 변경"
L["Changes the color of added text"] = "추가된 글자의 색상을 변경합니다."
-- /rb color pick
L["Pick color"] = "색상 선택"
L["Pick a color"] = "색상을 선택합니다."
-- /rb color enable
L["Enable color"] = "색상 사용"
L["Enable colored text"] = "글자에 색상을 사용합니다."
L["Change number color"] = true
-- /rb rating
L["Rating"] = "평점"
L["Options for Rating display"] = "평점 표시에 대한 설정입니다."
Expand Down
7 changes: 1 addition & 6 deletions locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@ end
-- /rb rating color
L["Change Text Color"] = "Изменить цвет текста"
L["Changes the color of added text"] = "Изменить цвет добавляемого текста"
-- /rb rating color pick
L["Pick Color"] = "Выбрать цвет"
L["Pick a color"] = "Выбрать цвет"
-- /rb rating color enable
L["Enable Color"] = "Включить цвет текста"
L["Enable colored text"] = "Включить цвет текста"
L["Change number color"] = true
---------------------------------------------------------------------------
-- /rb stat
L["Stat Breakdown"] = "Настройки статов"
Expand Down
7 changes: 1 addition & 6 deletions locales/zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ L["Set the level used in calculations (0 = your level)"] = "设定换算等级 (
-- /rb color
L["Change text color"] = "设定文字颜色"
L["Changes the color of added text"] = "设定RB所增加的文字的颜色"
-- /rb color pick
L["Pick color"] = "挑选颜色"
L["Pick a color"] = "挑选颜色"
-- /rb color enable
L["Enable color"] = "启用文字颜色"
L["Enable colored text"] = "启用文字颜色"
L["Change number color"] = true
-- /rb rating
L["Rating"] = "属性等级"
L["Options for Rating display"] = "设定属性等级显示"
Expand Down
7 changes: 1 addition & 6 deletions locales/zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ L["Set the level used in calculations (0 = your level)"] = "設定換算等級 (
-- /rb color
L["Change text color"] = "設定文字顏色"
L["Changes the color of added text"] = "設定 RB 所增加的文字的顏色"
-- /rb color pick
L["Pick color"] = "挑選顏色"
L["Pick a color"] = "挑選顏色"
-- /rb color enable
L["Enable color"] = "啟用文字顏色"
L["Enable colored text"] = "啟用文字顏色"
L["Change number color"] = true
-- /rb rating
L["Rating"] = "屬性等級"
L["Options for Rating display"] = "設定屬性等級顯示"
Expand Down

0 comments on commit 4de2b16

Please sign in to comment.