Commit 7cd961a3 authored by Darth Predator's avatar Darth Predator
Browse files

Azerite bar hook

parent d5e15203
......@@ -138,7 +138,7 @@ P["sle"] = {
["color"] = {r = 1, g = 1, b = 0},
},
},
--Datbars
--Databars
["databars"] = {
["exp"] = {
["longtext"] = false,
......@@ -169,7 +169,7 @@ P["sle"] = {
["awardStyle"] = "STYLE1",
},
},
["artifact"] = {
["azerite"] = {
["longtext"] = false,
["chatfilter"] = {
["enable"] = false,
......@@ -345,6 +345,12 @@ P["sle"] = {
["quest"] = false,
["enable"] = false,
},
["orderhall"] = {
["autoOrder"] = {
["enable"] = false,
["autoEquip"] = false,
},
},
},
--LFR options
["lfr"] = {
......@@ -585,12 +591,7 @@ P["sle"] = {
["visibleRange"] = 60,
},
--Order Halls
["orderhall"] = {
["autoOrder"] = {
["enable"] = false,
["autoEquip"] = false,
},
},
--Quests
["quests"] = {
["visibility"] = {
......
......@@ -340,8 +340,8 @@ L["Change the style of experience gain messages."] = true
L["Experience Style"] = true
L["Full List"] = true
L["Show all factions affected by the latest reputation change. When disabled only first (in alphabetical order) affected faction will be shown."] = true
L["Full value on Artifact Bar"] = true
L["Changes the way text is shown on artifact bar."] = true
L["Full value on Azerite Bar"] = true
L["Changes the way text is shown on azerite bar."] = true
L["Full value on Honor Bar"] = true
L["Changes the way text is shown on honor bar."] = true
L["Chat Filters"] = true
......
......@@ -331,8 +331,8 @@ L["Change the style of experience gain messages."] = "Ändert den Stil der Erfah
L["Experience Style"] = "Erfahrungs Stil"
L["Full List"] = "Volle Liste"
L["Show all factions affected by the latest reputation change. When disabled only first (in alphabetical order) affected faction will be shown."] = "Zeigt alle Fraktion bei denen sich zuletzt der Ruf verändert hat. Wenn deaktiviert werden nur die ersten (in alphabetischer Reihenfolge) Fraktionen angezeigt bei denen sich was geändert hat."
L["Full value on Artifact Bar"] = "Voller Wert auf Artefaktleiste"
L["Changes the way text is shown on artifact bar."] = "Ändert wie der Text auf der Artefaktleiste angezeigt wird."
L["Full value on Azerite Bar"] = true
L["Changes the way text is shown on azerite bar."] = true
L["Full value on Honor Bar"] = "Voller Wert auf der Ehrenleiste"
L["Changes the way text is shown on honor bar."] = "Ändert wie der Text auf der Ehrenleiste angezeigt wird."
L["Chat Filters"] = "Chatfilter"
......
......@@ -328,8 +328,8 @@ L["Change the style of experience gain messages."] = "Изменяет стил
L["Experience Style"] = "Стиль опыта"
L["Full List"] = "Полный список"
L["Show all factions affected by the latest reputation change. When disabled only first (in alphabetical order) affected faction will be shown."] = "Показывать все фракции, затронутые последним изменеием репутации. При отключении будет показываться только первая (в алфавитном порядке) фракция."
L["Full value on Artifact Bar"] = "Полное значение силы артефакта"
L["Changes the way text is shown on artifact bar."] = "Изменяет отображение значения силы артефакта на полосе."
L["Full value on Azerite Bar"] = "Полное значение азерита"
L["Changes the way text is shown on azerite bar."] = "Изменяет отображение значения силы артефакта (азерита) на полосе."
L["Full value on Honor Bar"] = "Полное значение чести"
L["Changes the way text is shown on honor bar."] = "Изменяет отображение количества чести на полосе."
L["Chat Filters"] = "Фильтры чата"
......
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local DB = SLE:GetModule("DataBars")
--Cache global variables
--Lua functions
local floor = floor
local format = string.format
--WoW API / Variables
local C_AzeriteItem_GetAzeriteItemXPInfo = C_AzeriteItem.GetAzeriteItemXPInfo
local C_AzeriteItem_GetPowerLevel = C_AzeriteItem.GetPowerLevel
local function UpdateAzerite(self, event, unit)
if not E.db.sle.databars.azerite.longtext then return end
if (event == "UNIT_INVENTORY_CHANGED" and unit ~= "player") then
return
end
local bar = self.azeriteBar
if azeriteItemLocation and (not self.db.azerite.hideInCombat or not T.InCombatLockdown()) then
local text = ''
local xp, totalLevelXP = C_AzeriteItem_GetAzeriteItemXPInfo(azeriteItemLocation)
local xpToNextLevel = totalLevelXP - xp
local currentLevel = C_AzeriteItem_GetPowerLevel(azeriteItemLocation)
local textFormat = self.db.azerite.textFormat
if textFormat == 'PERCENT' then
text = format('%s%% [%s]', floor(xp / totalLevelXP * 100), currentLevel)
elseif textFormat == 'CURMAX' then
text = format('%s - %s [%s]', xp, totalLevelXP, currentLevel)
elseif textFormat == 'CURPERC' then
text = format('%s - %s%% [%s]', xp, floor(xp /totalLevelXP * 100), currentLevel)
elseif textFormat == 'CUR' then
text = format('%s [%s]', xp, currentLevel)
elseif textFormat == 'REM' then
text = format('%s [%s]', xpToNextLevel, currentLevel)
elseif textFormat == 'CURREM' then
text = format('%s - %s [%s]', xp, xpToNextLevel, currentLevel)
elseif textFormat == 'CURPERCREM' then
text = format('%s - %s%% (%s) [%s]', xp, floor(xp / totalLevelXP * 100), xpToNextLevel, currentLevel)
end
bar.text:SetText(text)
end
end
function DB:AzeriteInit()
-- DB:PopulateExpPatterns()
hooksecurefunc(E:GetModule('DataBars'), "UpdateAzerite", UpdateAzerite)
end
\ No newline at end of file
......@@ -34,7 +34,7 @@ function DB:Initialize()
DB:ExpInit()
DB:RepInit()
DB:ArtInit()
DB:AzeriteInit()
DB:HonorInit()
DB:ForUpdateAll()
......
......@@ -3,4 +3,5 @@
<Script file='exp.lua'/>
<Script file='rep.lua'/>
<Script file='honor.lua'/>
<Script file='azerite.lua'/>
</Ui>
\ No newline at end of file
......@@ -167,7 +167,7 @@ local function configTable()
},
},
honor = {
order = 4,
order = 3,
type = "group",
name = HONOR,
args = {
......@@ -244,6 +244,84 @@ local function configTable()
},
},
},
azerite = {
order = 4,
type = "group",
name = L["Azerite Bar"],
args = {
goElv = {
order = 1,
type = 'execute',
name = "ElvUI: "..L["Azerite Bar"],
func = function() SLE.ACD:SelectGroup("ElvUI", "databars", "azerite") end,
},
longtext = {
order = 2,
type = "toggle",
name = L["Full value on Azerite Bar"],
desc = L["Changes the way text is shown on azerite bar."],
get = function(info) return E.db.sle.databars.honor.longtext end,
set = function(info, value) E.db.sle.databars.honor.longtext = value; EDB:UpdateAzerite() end,
},
--[[chatfilters = {
order = 3,
type = "group",
guiInline = true,
name = L["Chat Filters"],
get = function(info) return E.db.sle.databars.honor.chatfilter[ info[#info] ] end,
set = function(info, value) E.db.sle.databars.honor.chatfilter[ info[#info] ] = value; end,
args = {
enable = {
order = 1,
type = "toggle",
name = L["Enable"],
desc = L["Change the style of honor gain messages."],
set = function(info, value) E.db.sle.databars.honor.chatfilter[ info[#info] ] = value; DB:RegisterFilters() end,
},
iconsize = {
order = 2,
type = "range",
name = L["Icon Size"],
disabled = function() return not E.db.sle.databars.honor.chatfilter.enable end,
min = 8, max = 32, step = 1,
},
spacer = {order = 3, type = "description", name = ""},
style = {
order = 4,
type = "select",
name = L["Honor Style"],
disabled = function() return not E.db.sle.databars.honor.chatfilter.enable end,
values = {
["STYLE1"] = T.format(DB.Honor.Styles["STYLE1"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE2"] = T.format(DB.Honor.Styles["STYLE2"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE3"] = T.format(DB.Honor.Styles["STYLE3"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE4"] = T.format(DB.Honor.Styles["STYLE4"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE5"] = T.format(DB.Honor.Styles["STYLE5"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE6"] = T.format(DB.Honor.Styles["STYLE6"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE7"] = T.format(DB.Honor.Styles["STYLE7"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE8"] = T.format(DB.Honor.Styles["STYLE8"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
["STYLE9"] = T.format(DB.Honor.Styles["STYLE9"], E.myname, RANK, "3.45", DB.Honor.Icon, 12),
},
},
awardStyle = {
order = 5,
type = "select",
name = L["Award Style"],
desc = L["Defines the style of changed string. Colored parts will be shown with your selected value color in chat."],
disabled = function() return not E.db.sle.databars.honor.chatfilter.enable end,
values = {
["STYLE1"] = T.format(DB.Honor.AwardStyles["STYLE1"], "3.45", DB.Honor.Icon, 12),
["STYLE2"] = T.format(DB.Honor.AwardStyles["STYLE2"], "3.45", DB.Honor.Icon, 12),
["STYLE3"] = T.format(DB.Honor.AwardStyles["STYLE3"], "3.45", DB.Honor.Icon, 12),
["STYLE4"] = T.format(DB.Honor.AwardStyles["STYLE4"], "3.45", DB.Honor.Icon, 12),
["STYLE5"] = T.format(DB.Honor.AwardStyles["STYLE5"], "3.45", DB.Honor.Icon, 12),
["STYLE6"] = T.format(DB.Honor.AwardStyles["STYLE6"], "3.45", DB.Honor.Icon, 12),
},
},
},
},]]
},
},
},
}
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment