Commit 2e3ca891 authored by Simpy's avatar Simpy 🐹

12.12

parents 35e891b8 b922e1df
......@@ -291,12 +291,9 @@ function E:UpdateCooldownOverride(module)
cd.text:FontTemplate(cd.customFont, cd.customFontSize, cd.customFontOutline)
elseif parent.CooldownOverride == 'auras' then
-- parent.auraType defined in `A:UpdateHeader` and `A:CreateIcon`
local font = LSM:Fetch('font', db.font)
if font and parent.auraType then
local fontSize = db[parent.auraType] and db[parent.auraType].durationFontSize
if fontSize then
cd.text:FontTemplate(font , fontSize, db.fontOutline)
end
local fontDB = parent.auraType and db[parent.auraType]
if fontDB and fontDB.timeFont then
cd.text:FontTemplate(LSM:Fetch('font', fontDB.timeFont), fontDB.timeFontSize, fontDB.timeFontOutline)
end
end
......
......@@ -564,6 +564,7 @@ do
name = 'ElvUI NamePlates'
},
'TidyPlates',
'TidyPlates_ThreatPlates',
'Healers-Have-To-Die',
'Kui_Nameplates',
'Plater',
......@@ -1022,16 +1023,6 @@ do -- BFA Convert, deprecated..
end
end
--Convert old 'Buffs and Debuffs' font size option to individual options
if E.db.auras.fontSize then
local fontSize = E.db.auras.fontSize
E.db.auras.buffs.countFontSize = fontSize
E.db.auras.buffs.durationFontSize = fontSize
E.db.auras.debuffs.countFontSize = fontSize
E.db.auras.debuffs.durationFontSize = fontSize
E.db.auras.fontSize = nil
end
--Remove stale font settings from Cooldown system for top auras
if E.db.auras.cooldown.fonts then
E.db.auras.cooldown.fonts = nil
......
## Interface: 90001
## Author: Elv, Simpy
## Version: 12.11
## Version: 12.12
## Title: |cff1784d1ElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB
......
......@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
local MAJOR_VERSION = "LibActionButton-1.0-ElvUI"
local MINOR_VERSION = 21 -- the real minor version is 79
local MINOR_VERSION = 22 -- the real minor version is 79
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
local lib, oldversion = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION)
......@@ -1120,9 +1120,12 @@ function Update(self, fromUpdateConfig)
-- Update icon and hotkey
local texture = self:GetTexture()
-- Cooldown desaturate can control saturation, we don't want to override it here
local allowSaturation = not self.saturationLocked and not self.LevelLinkLockIcon:IsShown()
-- Zone ability button handling
self.zoneAbilityDisabled = false
if not self.saturationLocked then
if allowSaturation then
self.icon:SetDesaturated(false)
end
if self._state_type == "action" then
......@@ -1133,7 +1136,8 @@ function Update(self, fromUpdateConfig)
if name == abilityName then
texture = GetLastZoneAbilitySpellTexture()
self.zoneAbilityDisabled = true
if not self.saturationLocked then
if allowSaturation then
self.icon:SetDesaturated(true)
end
end
......@@ -1207,37 +1211,37 @@ function UpdateButtonState(self)
end
function UpdateUsable(self)
local isLevelLinkLocked
if not WoWClassic and self._state_type == "action" then
isLevelLinkLocked = C_LevelLink.IsActionLocked(self._state_action)
if not self.icon:IsDesaturated() then
self.icon:SetDesaturated(isLevelLinkLocked)
end
if self.LevelLinkLockIcon then
self.LevelLinkLockIcon:SetShown(isLevelLinkLocked)
end
end
if self.config.useColoring then
if self.config.outOfRangeColoring == "button" and self.outOfRange then
if isLevelLinkLocked then
self.icon:SetVertexColor(unpack(self.config.colors.notUsable))
elseif self.config.outOfRangeColoring == "button" and self.outOfRange then
self.icon:SetVertexColor(unpack(self.config.colors.range))
else
local isUsable, notEnoughMana = self:IsUsable()
if isUsable then
self.icon:SetVertexColor(unpack(self.config.colors.usable))
--self.NormalTexture:SetVertexColor(1.0, 1.0, 1.0)
elseif notEnoughMana then
self.icon:SetVertexColor(unpack(self.config.colors.mana))
--self.NormalTexture:SetVertexColor(0.5, 0.5, 1.0)
else
self.icon:SetVertexColor(unpack(self.config.colors.notUsable))
--self.NormalTexture:SetVertexColor(1.0, 1.0, 1.0)
end
end
else
self.icon:SetVertexColor(unpack(self.config.colors.usable))
end
if not WoWClassic and self._state_type == "action" then
local isLevelLinkLocked = C_LevelLink.IsActionLocked(self._state_action)
if not self.icon:IsDesaturated() then
self.icon:SetDesaturated(isLevelLinkLocked)
end
if self.LevelLinkLockIcon then
self.LevelLinkLockIcon:SetShown(isLevelLinkLocked)
end
end
lib.callbacks:Fire("OnButtonUsable", self)
end
......
......@@ -30,6 +30,7 @@ L["Adjust the UI Scale to fit your screen, press the autoscale button to set the
L["AFK"] = "AFK"
L["All keybindings cleared for |cff00ff00%s|r."] = "Alle Tastaturbelegungen gelöscht für |cff00ff00%s|r."
L["Alliance: "] = "Allianz: "
L["Allow Sharing"] = "Teilen erlauben"
L["Alpha Key"] = true --No need to translate
L["Already Running.. Bailing Out!"] = "Bereits ausgeführt.. Warte ab!"
L["Alternative Power"] = "Alternative Energie"
......@@ -95,6 +96,7 @@ L["copperabbrev"] = "|cffeda55fc|r"
L["Count"] = "Zähler"
L["Current Difficulties:"] = "Derzeitiger Schwierigkeitsgrad:"
L["Current Level:"] = "Derzeitiges Level:"
L["Custom Font"] = "Benutzerdefinierte Schrift"
L["CVars Set"] = "CVars gesetzt"
L["CVars"] = "CVars"
L["Dark"] = "Dunkel"
......@@ -256,6 +258,7 @@ L["Preview"] = "Vorschau"
L["Profile download complete from %s, but the profile %s already exists. Change the name or else it will overwrite the existing profile."] = "Profil komplett heruntergeladen von %s, allerdings ist das Profil %s bereits vorhanden. Ändere den Namen oder das bereits existierende Profil wird überschrieben."
L["Profile download complete from %s, would you like to load the profile %s now?"] = "Profil komplett heruntergeladen von %s, möchtest du das Profil %s nun laden?"
L["Profile request sent. Waiting for response from player."] = "Profil Anfrage gesendet. Warte auf die Antwort des Spielers."
L["Profiles"] = "Profile"
L["Profit:"] = "Gewinn:"
L["Purchase Bags"] = "Taschen kaufen"
L["Purchase"] = "Kaufen"
......@@ -325,9 +328,9 @@ L["This part of the installation process sets up your chat windows names, positi
L["This part of the installation process sets up your World of Warcraft default options it is recommended you should do this step for everything to behave properly."] = "Dieser Installationsprozess richtet alle wichtigen Cvars deines World of Warcrafts ein, um eine problemlose Nutzung zu ermöglichen."
L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."] = "Diese Einstellungen haben einen Konflikt mit einem Ankerpunkt, wo '%s' an sich selbst angehaftet sein soll. Bitte kontrolliere deine Ankerpunkte. Einstellung '%s' angehaftet an '%s'."
L["This will change the layout of your unitframes and actionbars."] = "Dies wird das Layout der Einheitenfenster und Aktionsleisten ändern."
L["To list all available ElvUI commands, type in chat /ehelp"] = true
L["To quickly move around certain elements of the UI, type /moveui"] = true
L["To setup chat colors, chat channels and chat font size, right-click the chat tab name."] = true
L["To list all available ElvUI commands, type in chat /ehelp"] = "Für eine liste aller verfügbaren ElvUI befehle, tippe /ehelp"
L["To quickly move around certain elements of the UI, type /moveui"] = "Um schnell verschiedene Interface Elemente zu verschieben, tippe /moveui"
L["To setup chat colors, chat channels and chat font size, right-click the chat tab name."] = "Um Chat Farben, Chat Channels und die Chat Schriftgröße zu ändern, rechts-klicke den Chat Tab Namen."
L["Toggle Bags"] = "Taschen umschalten"
L["Toggle Chat Frame"] = "Chatfenster an-/ausschalten"
L["Toggle Configuration"] = "Konfiguration an-/ausschalten"
......@@ -357,13 +360,13 @@ L["yells"] = "schreien"
L["Yes, Keep Changes!"] = "Ja, Änderungen behalten!"
L["You are now finished with the installation process. If you are in need of technical support please visit us at http://www.tukui.org."] = "Du hast den Installationsprozess abgeschlossen. Solltest du technische Hilfe benötigen, besuche uns auf http://www.tukui.org."
L["You are using CPU Profiling. This causes decreased performance. Do you want to disable it or continue?"] = "Du benutzt CPU Profiling. Dieses verringert deine Performance. Willst du es deaktivieren oder fortfahren."
L["You can access the copy chat and chat menu functions by left/right clicking on the icon in the top right corner of the chat panel."] = true
L["You can access the microbar by using middle mouse button on the minimap. You can also enable the MicroBar in the actionbar settings."] = true
L["You can access the copy chat and chat menu functions by left/right clicking on the icon in the top right corner of the chat panel."] = "Du kannst auf die Kopierfunktion und das Chat Menü zugreifen, indem du links/rechts-klickst auf das Icon in der oberen rechten Ecke vom Chat."
L["You can access the microbar by using middle mouse button on the minimap. You can also enable the MicroBar in the actionbar settings."] = "Du kannst auf das Mikromenü zugreifen indem du mit der mittleren Maustaste auf die Minikarte klickst. Du kannst auch die Mikromenü Bar in den Aktionsleisten Optionen anschalten."
L["You can always change fonts and colors of any element of ElvUI from the in-game configuration."] = "Du kannst jederzeit in der Ingame-Konfiguration Schriften und Farben von jedem Element des Interfaces ändern."
L["You can enter the keybind mode by typing /kb"] = true
L["You can enter the keybind mode by typing /kb"] = "Du kannst den Tastenbelegungsmodus starten indem du /kb in den chat tippst"
L["You can now choose what layout you wish to use based on your combat role."] = "Du kannst nun auf Basis deiner Rolle im Kampf ein Layout wählen."
L["You can quickly change your displayed DataTexts by mousing over them while holding ALT."] = true
L["You can see someones average item level inside the tooltip by holding shift and mousing over them."] = true
L["You can quickly change your displayed DataTexts by mousing over them while holding ALT."] = "Du kannst deine Infotexte schnell ändern, indem du mit der Maus über sie fährst und ALT gedrückt hälst."
L["You can see someones average item level inside the tooltip by holding shift and mousing over them."] = "Du kannst das durchschnitts Itemlevel anderer Spieler im Tooltip sehen, wenn du Shift gedrückt hälst und mit der Maus über sie fährst."
L["You don't have enough money to repair."] = "Du hast nicht genügend Gold für die Reparatur."
L["You don't have permission to mark targets."] = "Du hast keine Rechte ein Ziel zu markieren."
L["You have imported settings which may require a UI reload to take effect. Reload now?"] = "Du hast Einstellungen importiert die wahrscheinlich ein Neuladen des UI erfordern. Jetzt neu laden?"
......
......@@ -219,12 +219,12 @@ function AB:HandleButton(bar, button, index, lastButton, lastColumnButton)
end
end
function AB:TrimIcon(button)
function AB:TrimIcon(button, masque)
if not button.icon then return end
local db = button.db
local left, right, top, bottom = unpack(db and db.customCoords or E.TexCoords)
if db and not db.keepSizeRatio then
local left, right, top, bottom = unpack(button.db and button.db.customCoords or E.TexCoords)
local changeRatio = button.db and not button.db.keepSizeRatio
if changeRatio then
local width, height = button:GetSize()
local ratio = width / height
if ratio > 1 then
......@@ -238,7 +238,10 @@ function AB:TrimIcon(button)
end
end
-- always when masque is off, otherwise only when keepSizeRatio is off
if not masque or changeRatio then
button.icon:SetTexCoord(left, right, top, bottom)
end
end
function AB:GetGrowth(point)
......@@ -353,7 +356,7 @@ function AB:PositionAndSizeBar(barName)
-- masque retrims them all so we have to too
for btn in pairs(AB.handledbuttons) do
AB:TrimIcon(btn)
AB:TrimIcon(btn, true)
end
end
end
......@@ -610,6 +613,7 @@ function AB:StyleButton(button, noBackdrop, useMasque, ignoreNormal)
local normal = _G[name..'NormalTexture']
local normal2 = button:GetNormalTexture()
local db = button:GetParent().db
local color = AB.db.fontColor
local countPosition = AB.db.countTextPosition or 'BOTTOMRIGHT'
local countXOffset = AB.db.countTextXOffset or 0
......@@ -625,8 +629,15 @@ function AB:StyleButton(button, noBackdrop, useMasque, ignoreNormal)
if count then
count:ClearAllPoints()
if db and db.customCountFont then
count:Point(db.countTextPosition, db.countTextXOffset, db.countTextYOffset)
count:FontTemplate(LSM:Fetch('font', db.countFont), db.countFontSize, db.countFontOutline)
else
count:Point(countPosition, countXOffset, countYOffset)
count:FontTemplate(LSM:Fetch('font', AB.db.font), AB.db.fontSize, AB.db.fontOutline)
end
count:SetTextColor(color.r, color.g, color.b)
end
......@@ -668,7 +679,12 @@ function AB:StyleButton(button, noBackdrop, useMasque, ignoreNormal)
end
if AB.db.hotkeytext or AB.db.useRangeColorText then
if db and db.customHotkeyFont then
hotkey:FontTemplate(LSM:Fetch('font', db.hotkeyFont), db.hotkeyFontSize, db.hotkeyFontOutline)
else
hotkey:FontTemplate(LSM:Fetch('font', AB.db.font), AB.db.fontSize, AB.db.fontOutline)
end
if button.config and (button.config.outOfRangeColoring ~= 'hotkey') then
button.HotKey:SetTextColor(color.r, color.g, color.b)
end
......@@ -1051,9 +1067,10 @@ function AB:FixKeybindText(button)
local hotkey = _G[button:GetName()..'HotKey']
local text = hotkey:GetText()
local hotkeyPosition = E.db.actionbar.hotkeyTextPosition or 'TOPRIGHT'
local hotkeyXOffset = E.db.actionbar.hotkeyTextXOffset or 0
local hotkeyYOffset = E.db.actionbar.hotkeyTextYOffset or -3
local db = button:GetParent().db
local hotkeyPosition = db and db.customHotkeyFont and db.hotkeyTextPosition or E.db.actionbar.hotkeyTextPosition or 'TOPRIGHT'
local hotkeyXOffset = db and db.customHotkeyFont and db.hotkeyTextXOffset or E.db.actionbar.hotkeyTextXOffset or 0
local hotkeyYOffset = db and db.customHotkeyFont and db.hotkeyTextYOffset or E.db.actionbar.hotkeyTextYOffset or -3
local justify = 'RIGHT'
if hotkeyPosition == 'TOPLEFT' or hotkeyPosition == 'BOTTOMLEFT' then
......@@ -1231,6 +1248,11 @@ function AB:ToggleCooldownOptions()
end
function AB:SetButtonDesaturation(button, duration)
if button.LevelLinkLockIcon:IsShown() then
button.saturationLocked = nil
return
end
if AB.db.desaturateOnCooldown and (duration and duration > 1.5) then
button.icon:SetDesaturated(true)
button.saturationLocked = true
......
......@@ -169,7 +169,7 @@ function AB:PositionAndSizeBarPet()
MasqueGroup:ReSkin()
for _, btn in ipairs(bar.buttons) do
AB:TrimIcon(btn)
AB:TrimIcon(btn, true)
end
end
end
......
......@@ -190,7 +190,7 @@ function AB:PositionAndSizeBarShapeShift()
MasqueGroup:ReSkin()
for _, btn in ipairs(bar.buttons) do
AB:TrimIcon(btn)
AB:TrimIcon(btn, true)
end
end
end
......
......@@ -114,8 +114,10 @@ function A:CreateIcon(button)
button.texture:SetTexCoord(unpack(E.TexCoords))
button.count = button:CreateFontString(nil, 'OVERLAY')
button.count:FontTemplate()
button.text = button:CreateFontString(nil, 'OVERLAY')
button.text:FontTemplate()
button.highlight = button:CreateTexture(nil, 'HIGHLIGHT')
button.highlight:SetColorTexture(1, 1, 1, .45)
......
......@@ -328,7 +328,7 @@ do --this can save some main file locals
['Imsospicy-Cenarius'] = itsSimpy, -- [Horde] Mage
['Imsonutty-Cenarius'] = itsSimpy, -- [Horde] Hunter
['Imsotasty-Cenarius'] = itsSimpy, -- [Horde] Monk
['Imsogooey-Cenarius'] = itsSimpy, -- [Horde] Warlock
['Imsosaucy-Cenarius'] = itsSimpy, -- [Horde] Warlock
['Imsodrippy-Cenarius'] = itsSimpy, -- [Horde] Rogue
['Bunne-CenarionCircle'] = itsSimpy, -- [RP] Warrior
['Loppie-CenarionCircle'] = itsSimpy, -- [RP] Monk
......
......@@ -4,14 +4,12 @@ local oUF = E.oUF
local _G = _G
local pairs, ipairs, ceil, floor, tonumber = pairs, ipairs, ceil, floor, tonumber
local strmatch, strlower, strfind = strmatch, strlower, strfind
local wipe, strmatch, strlower, strfind = wipe, strmatch, strlower, strfind
local GetLocale = GetLocale
local IsInInstance = IsInInstance
local UnitIsPlayer = UnitIsPlayer
local GetQuestLogSpecialItemInfo = GetQuestLogSpecialItemInfo
local C_QuestLog_GetTitleForQuestID = C_QuestLog.GetTitleForQuestID
local C_QuestLog_GetLogIndexForQuestID = C_QuestLog.GetLogIndexForQuestID
local C_QuestLog_GetTitleForLogIndex = C_QuestLog.GetTitleForLogIndex
local C_QuestLog_GetNumQuestLogEntries = C_QuestLog.GetNumQuestLogEntries
local C_QuestLog_GetQuestIDForLogIndex = C_QuestLog.GetQuestIDForLogIndex
......@@ -114,7 +112,7 @@ local function GetQuests(unitID)
local count, percent = CheckTextForQuest(text)
-- this line comes from one line up in the tooltip
local activeQuest = NP.QuestIcons.activeQuests[text]
local activeQuest = questIcons.activeQuests[text]
if activeQuest then activeID = activeQuest end
if count then
......@@ -129,19 +127,19 @@ local function GetQuests(unitID)
else
local lowerText = strlower(text)
-- check chat type first
for _, listText in ipairs(questTypes.CHAT) do
-- check kill type first
for _, listText in ipairs(questTypes.KILL) do
if strfind(lowerText, listText, nil, true) then
type = 'CHAT'
type = 'KILL'
break
end
end
-- check kill type if chat type doesn't exist
-- check chat type if kill type doesn't exist
if not type then
for _, listText in ipairs(questTypes.KILL) do
for _, listText in ipairs(questTypes.CHAT) do
if strfind(lowerText, listText, nil, true) then
type = 'KILL'
type = 'CHAT'
break
end
end
......@@ -293,8 +291,10 @@ local frame = CreateFrame('Frame')
frame:RegisterEvent('QUEST_ACCEPTED')
frame:RegisterEvent('QUEST_REMOVED')
frame:RegisterEvent('PLAYER_ENTERING_WORLD')
frame:SetScript('OnEvent', function(self, event, questID)
if event == 'PLAYER_ENTERING_WORLD' then
frame:SetScript('OnEvent', function(self, event)
wipe(questIcons.indexByID)
wipe(questIcons.activeQuests)
for i = 1, C_QuestLog_GetNumQuestLogEntries() do
local id = C_QuestLog_GetQuestIDForLogIndex(i)
if id and id > 0 then
......@@ -305,27 +305,8 @@ frame:SetScript('OnEvent', function(self, event, questID)
end
end
if event == 'PLAYER_ENTERING_WORLD' then
self:UnregisterEvent(event)
elseif event == 'QUEST_ACCEPTED' then
if questID and questID > 0 then
local index = C_QuestLog_GetLogIndexForQuestID(questID)
if index and index > 0 then
questIcons.indexByID[questID] = index
local title = C_QuestLog_GetTitleForQuestID(questID)
if title then questIcons.activeQuests[title] = questID end
end
end
elseif event == 'QUEST_REMOVED' then
if not questID then return end
questIcons.indexByID[questID] = nil
for title, id in pairs(questIcons.activeQuests) do
if id == questID then
questIcons.activeQuests[title] = nil
break
end
end
end
end)
......
......@@ -2,7 +2,7 @@ local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, Private
local S = E:GetModule('Skins')
local _G = _G
local gsub, pairs, ipairs, select, unpack, strfind = gsub, pairs, ipairs, select, unpack, strfind
local gsub, pairs, ipairs, select, unpack, strmatch, strfind = gsub, pairs, ipairs, select, unpack, strmatch, strfind
local C_QuestLog_GetNextWaypointText = C_QuestLog.GetNextWaypointText
local C_QuestLog_GetSelectedQuest = C_QuestLog.GetSelectedQuest
......@@ -17,6 +17,21 @@ local GetNumQuestLogRewardSpells = GetNumQuestLogRewardSpells
local GetNumRewardSpells = GetNumRewardSpells
local hooksecurefunc = hooksecurefunc
local sealFrameTextColor = {
['480404'] = 'c20606',
['042c54'] = '1c86ee',
}
function S:QuestInfoSealFrameText(text)
if text and text ~= '' then
local colorStr, rawText = strmatch(text, '|c[fF][fF](%x%x%x%x%x%x)(.-)|r')
if colorStr and rawText then
colorStr = sealFrameTextColor[colorStr] or '99ccff'
self:SetFormattedText('|cff%s%s|r', colorStr, rawText)
end
end
end
local function HandleReward(frame)
if not frame then return end
......@@ -407,6 +422,7 @@ function S:BlizzardQuestFrames()
hooksecurefunc('QuestFrame_SetTitleTextColor', S.QuestFrame_SetTitleTextColor)
hooksecurefunc('QuestFrame_SetTextColor', S.QuestFrame_SetTextColor)
hooksecurefunc('QuestInfo_ShowRequiredMoney', S.QuestInfo_ShowRequiredMoney)
hooksecurefunc(_G.QuestInfoSealFrame.Text, 'SetText', S.QuestInfoSealFrameText)
_G.QuestFrameDetailPanel.SealMaterialBG:SetAlpha(0)
_G.QuestFrameRewardPanel.SealMaterialBG:SetAlpha(0)
......
......@@ -151,6 +151,9 @@ function UF:Configure_Castbar(frame)
castbar.Text:Point('LEFT', castbar, 'LEFT', db.xOffsetText, db.yOffsetText)
castbar.Time:Point('RIGHT', castbar, 'RIGHT', db.xOffsetTime, db.yOffsetTime)
castbar.Text:Width(castbar.Text:GetStringWidth())
castbar.Time:Width(castbar.Time:GetStringWidth())
--Icon
if db.icon then
castbar.Icon = castbar.ButtonIcon
......@@ -252,8 +255,13 @@ function UF:Configure_Castbar(frame)
end
end
if db.customColor and db.customColor.enable then
castbar.custom_backdrop = db.customColor.useCustomBackdrop and db.customColor.colorBackdrop
UF:ToggleTransparentStatusBar(db.customColor.transparent, castbar, castbar.bg, nil, db.customColor.invertColors)
else
castbar.custom_backdrop = UF.db.colors.customcastbarbackdrop and UF.db.colors.castbar_backdrop
UF:ToggleTransparentStatusBar(UF.db.colors.transparentCastbar, castbar, castbar.bg, nil, UF.db.colors.invertCastbar)
end
if castbar.Holder.mover then
if db.overlayOnFrame ~= 'None' or not db.enable then
......@@ -365,9 +373,38 @@ function UF:GetTalentTicks(info)
return selected and info.ticks
end
function UF:GetInterruptColor(db, unit)
local colors = ElvUF.colors
local customColor = db and db.castbar and db.castbar.customColor
local custom, r, g, b = customColor and customColor.enable and customColor
if custom then
r, g, b = customColor.color.r, customColor.color.g, customColor.color.b
else
r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
end
if self.notInterruptible and unit ~= 'player' and UnitCanAttack('player', unit) then
if custom and custom.colorNoInterrupt then
r, g, b = custom.colorNoInterrupt.r, custom.colorNoInterrupt.g, custom.colorNoInterrupt.b
else
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
end
elseif ((custom and custom.useClassColor) or (not custom and UF.db.colors.castClassColor)) and UnitIsPlayer(unit) then
local _, Class = UnitClass(unit)
local t = Class and colors.class[Class]
if t then r, g, b = t[1], t[2], t[3] end
elseif (custom and custom.useReactionColor) or (not custom and UF.db.colors.castReactionColor) then
local Reaction = UnitReaction(unit, 'player')
local t = Reaction and colors.reaction[Reaction]
if t then r, g, b = t[1], t[2], t[3] end
end
return r, g, b
end
function UF:PostCastStart(unit)
local db = self:GetParent().db
if not db or not db.castbar then return; end
if not db or not db.castbar then return end
if unit == 'vehicle' then unit = 'player' end
......@@ -433,25 +470,11 @@ function UF:PostCastStart(unit)
end
end
local colors = ElvUF.colors
local r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
if self.notInterruptible and unit ~= 'player' and UnitCanAttack('player', unit) then
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
elseif UF.db.colors.castClassColor and UnitIsPlayer(unit) then
local _, Class = UnitClass(unit)
local t = Class and ElvUF.colors.class[Class]
if t then r, g, b = t[1], t[2], t[3] end
elseif UF.db.colors.castReactionColor then
local Reaction = UnitReaction(unit, 'player')
local t = Reaction and ElvUF.colors.reaction[Reaction]
if t then r, g, b = t[1], t[2], t[3] end
end
if self.SafeZone then
self.SafeZone:Show()
end
self:SetStatusBarColor(r, g, b)
self:SetStatusBarColor(UF.GetInterruptColor(self, db, unit))
end
function UF:PostCastStop(unit)
......@@ -462,7 +485,11 @@ function UF:PostCastStop(unit)
end
function UF:PostCastFail()
self:SetStatusBarColor(UF.db.colors.castInterruptedColor.r, UF.db.colors.castInterruptedColor.g, UF.db.colors.castInterruptedColor.b)
local db = self:GetParent().db
local customColor = db and db.castbar and db.castbar.customColor
local color = (customColor and customColor.enable and customColor.colorInterrupted) or UF.db.colors.castInterruptedColor
self:SetStatusBarColor(color.r, color.g, color.b)
if self.SafeZone then
self.SafeZone:Hide()
end
......@@ -471,20 +498,8 @@ end
function UF:PostCastInterruptible(unit)
if unit == 'vehicle' or unit == 'player' then return end
local colors = ElvUF.colors
local r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
if self.notInterruptible and UnitCanAttack('player', unit) then
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
elseif UF.db.colors.castClassColor and UnitIsPlayer(unit) then
local _, Class = UnitClass(unit)
local t = Class and ElvUF.colors.class[Class]
if t then r, g, b = t[1], t[2], t[3] end
elseif UF.db.colors.castReactionColor then
local Reaction = UnitReaction(unit, 'player')
local t = Reaction and ElvUF.colors.reaction[Reaction]
if t then r, g, b = t[1], t[2], t[3] end
end
local db = self:GetParent().db
if not db or not db.castbar then return end
self:SetStatusBarColor(r, g, b)