Commit 3b0cd500 authored by Darth Predator's avatar Darth Predator

Time for some corruption. Cthulhu Fhtagn!

parent b0f9dae7
......@@ -53,6 +53,15 @@ P["sle"] = {
["xOffset"] = 0,
["yOffset"] = 0,
},
["corruption"] = {
["xOffset"] = 0,
["yOffset"] = 0,
["font"] = "PT Sans Narrow",
["fontSize"] = 15,
["fontStyle"] = "OUTLINE",
["valueColor"] = false,
["style"] = "TOTAL",
},
["background"] = {
["selectedBG"] = "Space",
["customTexture"] = "",
......
......@@ -187,6 +187,7 @@ L["Glow Offset"] = true
L["Categories"] = true
L["Decimals"] = true
L["Show stats with decimals."] = true
L["Corruption / Resist"] = true
--AFK
L["You Are Away From Keyboard for"] = true
......
......@@ -188,6 +188,7 @@ L["Glow Offset"] = true
L["Categories"] = true
L["Decimals"] = true
L["Show stats with decimals."] = true
L["Corruption / Resist"] = true
--AFK
L["You Are Away From Keyboard for"] = "Du bist nicht an der Tastatur für"
......
......@@ -187,6 +187,7 @@ L["Glow Offset"] = true
L["Categories"] = true
L["Decimals"] = true
L["Show stats with decimals."] = true
L["Corruption / Resist"] = true
--AFK
L["You Are Away From Keyboard for"] = "다음 시간 동안 자리를 비우고 계십니다. "
......
......@@ -187,6 +187,7 @@ L["Glow Offset"] = "Отступ свечения"
L["Categories"] = "Категории"
L["Decimals"] = "Десятичные доли"
L["Show stats with decimals."] = "От ображать характеристики с десятичными долями."
L["Corruption / Resist"] = "Порча / Резист"
--AFK
L["You Are Away From Keyboard for"] = "Вы отошли на"
......
......@@ -374,6 +374,7 @@ end
function Armory:UpdateCharacterInfo()
if E.db.sle.armory.character.enable then M:UpdatePageInfo(_G["CharacterFrame"], "Character") end
if not E.db.general.itemLevel.displayCharacterInfo then M:ClearPageInfo(_G["CharacterFrame"], "Character") end
CA:UpdateCorruptionLevel()
end
function Armory:ToggleItemLevelInfo(setupCharacterPage)
......@@ -390,9 +391,18 @@ function Armory:CheckOptions(which)
return true
end
function Armory:HandleCorruption()
local CorruptionIcon = _G["CharacterFrame"].SLE_Corruption
CorruptionIcon:ClearAllPoints()
if E.db.sle.armory.character.enable or E.db.sle.armory.stats.enable then
CorruptionIcon:SetPoint("LEFT", _G["PaperDollSidebarTab3"], "RIGHT", -4, -8)
else
CorruptionIcon:SetPoint("RIGHT", _G["CharacterStatsPane"].ItemLevelFrame, "RIGHT", 29, -8)
end
end
function Armory:Initialize()
if not Armory:CheckOptions() then return end
--May be usefull later
Armory.ScanTT = CreateFrame("GameTooltip", "SLE_Armory_ScanTT", nil, "GameTooltipTemplate")
......
......@@ -161,6 +161,32 @@ function CA:BuildLayout()
_G["CharacterLevelText"]:SetParent(_G["CharacterFrame"])
end
end)
--<<Corruption>>--
_G["CharacterFrame"].SLE_Corruption = CreateFrame("Frame", "SLE_CharacterCorruptionButton", _G["CharacterFrame"])
_G["CharacterFrame"].SLE_Corruption:SetSize(60, 100)
_G["CharacterFrame"].SLE_Corruption:SetPoint("RIGHT", _G["CharacterStatsPane"].ItemLevelFrame, "RIGHT", 29, -8) --Default for blizz corruption
_G["CharacterFrame"].SLE_Corruption:SetScript("OnEnter", CharacterFrameCorruption_OnEnter)
_G["CharacterFrame"].SLE_Corruption:SetScript("OnLeave", CharacterFrameCorruption_OnLeave)
_G["CharacterFrame"].SLE_Corruption:SetScript("OnEvent", CharacterFrameCorruption_OnEvent)
--deal with the events
_G["CharacterFrame"].SLE_Corruption:RegisterEvent("COMBAT_RATING_UPDATE");
_G["CharacterFrame"].SLE_Corruption:RegisterEvent("PLAYER_ENTERING_WORLD");
_G["CharacterFrame"].SLE_Corruption:RegisterEvent("SPELL_TEXT_UPDATE");
_G["CharacterStatsPane"].ItemLevelFrame.Corruption:UnregisterEvent("COMBAT_RATING_UPDATE");
_G["CharacterStatsPane"].ItemLevelFrame.Corruption:UnregisterEvent("PLAYER_ENTERING_WORLD");
_G["CharacterStatsPane"].ItemLevelFrame.Corruption:UnregisterEvent("SPELL_TEXT_UPDATE");
_G["CharacterStatsPane"].ItemLevelFrame.Corruption:SetScript("OnEvent", nil)
_G["CharacterStatsPane"].ItemLevelFrame.Corruption:Hide()
_G["CharacterFrame"].SLE_Corruption.Eye = _G["CharacterFrame"].SLE_Corruption:CreateTexture(nil, "OVERLAY")
_G["CharacterFrame"].SLE_Corruption.Eye:SetInside()
_G["CharacterFrame"].SLE_Corruption.Eye:SetAtlas("Nzoth-charactersheet-icon")
_G["CharacterFrame"].SLE_Corruption.Level = _G["CharacterFrame"].SLE_Corruption:CreateFontString(nil, "OVERLAY")
_G["CharacterFrame"].SLE_Corruption.Level:SetPoint("CENTER", _G["CharacterFrame"].SLE_Corruption, "CENTER", 1 + E.db.sle.armory.character.corruption.xOffset, 8 + E.db.sle.armory.character.corruption.yOffset)
end
function CA:Calculate_Durability(which, Slot)
......@@ -247,6 +273,28 @@ function CA:ElvOverlayToggle() --Toggle dat Overlay
end
end
function CA:UpdateCorruptionText()
local fontIlvl, sizeIlvl, outlineIlvl = E.db.sle.armory.character.corruption.font, E.db.sle.armory.character.corruption.fontSize, E.db.sle.armory.character.corruption.fontStyle
_G["CharacterFrame"].SLE_Corruption.Level:FontTemplate(E.LSM:Fetch('font', fontIlvl), sizeIlvl, outlineIlvl)
_G["CharacterFrame"].SLE_Corruption.Level:SetPoint("CENTER", _G["CharacterFrame"].SLE_Corruption, "CENTER", 1 + E.db.sle.armory.character.corruption.xOffset, 8 + E.db.sle.armory.character.corruption.yOffset)
end
function CA:UpdateCorruptionLevel()
local corruption = GetCorruption();
local corruptionResistance = GetCorruptionResistance();
local totalCorruption = math.max(corruption - corruptionResistance, 0);
local isColor = E.db.sle.armory.character.corruption.valueColor
if E.db.sle.armory.character.corruption.style == "TOTAL" then
local CorColor = isColor and (totalCorruption > 0 and "ff0000" or "00ff00") or "ffffff"
_G["CharacterFrame"].SLE_Corruption.Level:SetText("|cff"..CorColor..totalCorruption.."|r")
elseif E.db.sle.armory.character.corruption.style == "COR-RES" then
_G["CharacterFrame"].SLE_Corruption.Level:SetText("|cff"..(isColor and "ff0000" or "ffffff")..corruption.."|r / |cff"..(isColor and "00ff00" or "ffffff")..corruptionResistance.."|r")
elseif E.db.sle.armory.character.corruption.style == "Hide" then
_G["CharacterFrame"].SLE_Corruption.Level:SetText("")
end
end
function CA:Enable()
-- Setting frame
_G["CharacterFrame"]:SetHeight(444)
......@@ -299,13 +347,13 @@ function CA:Disable()
_G["CharacterFrame"]:SetHeight(424)
_G["CharacterFrame"]:SetWidth(_G["PaperDollFrame"]:IsShown() and _G["CharacterFrame"].Expanded and CHARACTERFRAME_EXPANDED_WIDTH or PANEL_DEFAULT_WIDTH)
_G["CharacterFrameInsetRight"]:SetPoint(T.unpack(DefaultPosition.InsetDefaultPoint))
-- Move rightside equipment slots to default position
_G["CharacterHandsSlot"]:SetPoint('TOPRIGHT', _G["CharacterFrameInset"], 'TOPRIGHT', -4, -2)
-- Move bottom equipment slots to default position
_G["CharacterMainHandSlot"]:SetPoint('BOTTOMLEFT', _G["PaperDollItemsFrame"], 'BOTTOMLEFT', 130, 16)
-- Model Frame
_G["CharacterModelFrame"]:ClearAllPoints()
_G["CharacterModelFrame"]:Size(231, 320)
......@@ -315,7 +363,7 @@ function CA:Disable()
_G["CharacterModelFrame"].BackgroundBotLeft:Show()
_G["CharacterModelFrame"].BackgroundBotRight:Show()
_G["CharacterModelFrame"].backdrop:Show()
CA:Update_Durability() --Required for elements update
for i, SlotName in T.pairs(Armory.Constants.GearList) do
local Slot = _G["Character"..SlotName]
......@@ -341,6 +389,9 @@ function CA:ToggleArmory()
else
CA:Disable()
end
CA:UpdateCorruptionText()
Armory:HandleCorruption()
for i, SlotName in T.pairs(Armory.Constants.AzeriteSlot) do PaperDollItemSlotButton_Update(_G["Character"..SlotName]) end
end
......
......@@ -333,6 +333,7 @@ function SA:ToggleArmory()
if not E.db.general.itemLevel.displayCharacterInfo then
_G["CharacterFrame"].ItemLevelText:SetText('')
end
Armory:HandleCorruption()
end
--Replacing broken Blizz function and adding some decimals
......
......@@ -124,6 +124,8 @@ local MiscellaneousCurrency = {
1717, --7th Legion Commendation
1716, --Honorbound Commendation
1721, -- Prismatic Manapearl
1719, --Corrupted Memento
1755, --Coalescing Visions
}
local HordeColor = RAID_CLASS_COLORS["DEATHKNIGHT"]
......
......@@ -270,6 +270,71 @@ local function configTable()
},
}
},
corruption = {
type = 'group',
name = T.GetSpellInfo(172),
order = 16,
get = function(info) return E.db.sle.armory.character[(info[#info - 1])][(info[#info])] end,
set = function(info, value) E.db.sle.armory.character[(info[#info - 1])][(info[#info])] = value; CA:UpdateCorruptionText(); CA:UpdateCorruptionLevel() end,
disabled = function() return E.db.general.itemLevel.displayCharacterInfo == false end,
args = {
valueColor = {
type = 'toggle',
name = L["Value Color"],
order = 1,
},
style = {
type = 'select',
name = L["Text Format"],
order = 2,
values = {
["TOTAL"] = TOTAL,
["COR-RES"] = L["Corruption / Resist"],
["Hide"] = HIDE,
},
},
space = {
order = 3,
type = "description",
name = "",
},
xOffset = {
type = 'range',
name = L["X-Offset"],
order = 10,
min = -10, max = 70, step = 1,
},
yOffset = {
type = 'range',
name = L["Y-Offset"],
order = 11,
min = -40, max = 40, step = 1,
},
space2 = {
order = 15,
type = "description",
name = "",
},
font = {
type = 'select', dialogControl = 'LSM30_Font',
name = L["Font"],
order = 20,
values = function() return AceGUIWidgetLSMlists and AceGUIWidgetLSMlists.font or {} end,
},
fontSize = {
type = 'range',
name = L["Font Size"],
order = 21,
min = 6, max = 32, step = 1,
},
fontStyle = {
type = 'select',
name = L["Font Outline"],
order = 22,
values = FontStyleList,
},
}
},
background = {
type = 'group',
name = L["Backdrop"],
......
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