This commit is contained in:
Crum
2019-01-02 21:01:02 -06:00
parent 27312ac249
commit c57fccf201
3 changed files with 94 additions and 87 deletions
+27 -22
View File
@@ -2,25 +2,30 @@ local LSM = LibStub("LibSharedMedia-3.0")
if LSM == nil then return end
LSM:Register("statusbar", "ElvUI Gloss", "Interface\\AddOns\\ElvUI\\Media\\Textures\\normTex.tga")
LSM:Register("statusbar", "ElvUI Norm", "Interface\\AddOns\\ElvUI\\Media\\Textures\\normTex2.tga")
LSM:Register("statusbar", "Minimalist", "Interface\\AddOns\\ElvUI\\Media\\Textures\\Minimalist.tga")
LSM:Register("statusbar", "ElvUI Blank", "Interface\\BUTTONS\\WHITE8X8")
LSM:Register("background", "ElvUI Blank", "Interface\\BUTTONS\\WHITE8X8")
LSM:Register("border", "ElvUI GlowBorder", "Interface\\AddOns\\ElvUI\\Media\\Textures\\glowTex.tga")
LSM:Register("font", "Continuum Medium", "Interface\\AddOns\\ElvUI\\Media\\Fonts\\Continuum_Medium.ttf")
LSM:Register("font", "Die Die Die!", "Interface\\AddOns\\ElvUI\\Media\\Fonts\\DieDieDie.ttf", LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("font", "Action Man", "Interface\\AddOns\\ElvUI\\Media\\Fonts\\Action_Man.ttf")
LSM:Register("font", "Expressway", "Interface\\AddOns\\ElvUI\\Media\\Fonts\\Expressway.ttf", LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("font", "PT Sans Narrow", "Interface\\AddOns\\ElvUI\\Media\\Fonts\\PT_Sans_Narrow.ttf", LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("font", "Homespun", "Interface\\AddOns\\ElvUI\\Media\\Fonts\\Homespun.ttf",LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("sound", "ElvUI Aska", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\sndIncMsg.ogg")
LSM:Register("sound", "Awww Crap", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\awwcrap.ogg")
LSM:Register("sound", "BBQ Ass", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\bbqass.ogg")
LSM:Register("sound", "Big Yankie Devil", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\yankiebangbang.ogg")
LSM:Register("sound", "Dumb Shit", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\dumbshit.ogg")
LSM:Register("sound", "Mama Weekends", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\mamaweekends.ogg")
LSM:Register("sound", "Runaway Fast", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\runfast.ogg")
LSM:Register("sound", "Stop Running", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\stoprunningslimball.ogg")
LSM:Register("sound", "Warning", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\warning.ogg")
LSM:Register("sound", "Whisper Alert", "Interface\\AddOns\\ElvUI\\Media\\Sounds\\whisper.ogg")
LSM:Register("statusbar", "ElvUI Gloss", [[Interface\AddOns\ElvUI\media\textures\normTex]])
LSM:Register("statusbar", "ElvUI Norm", [[Interface\AddOns\ElvUI\media\textures\normTex2]])
LSM:Register("statusbar", "Minimalist", [[Interface\AddOns\ElvUI\media\textures\Minimalist]])
LSM:Register("statusbar", "ElvUI Blank", [[Interface\BUTTONS\WHITE8X8]])
LSM:Register("statusbar", "Melli", [[Interface\AddOns\ElvUI\media\textures\melli]])
LSM:Register("background", "ElvUI Blank", [[Interface\BUTTONS\WHITE8X8]])
LSM:Register("border", "ElvUI GlowBorder", [[Interface\AddOns\ElvUI\media\textures\glowTex]])
LSM:Register("font", "Continuum Medium", [[Interface\AddOns\ElvUI\media\fonts\Continuum_Medium.ttf]])
LSM:Register("font", "Die Die Die!", [[Interface\AddOns\ElvUI\media\fonts\DieDieDie.ttf]])
LSM:Register("font", "Action Man", [[Interface\AddOns\ElvUI\media\fonts\Action_Man.ttf]])
LSM:Register("font", "Expressway", [[Interface\AddOns\ElvUI\media\fonts\Expressway.ttf]], LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("font", "PT Sans Narrow", [[Interface\AddOns\ElvUI\media\fonts\PT_Sans_Narrow.ttf]], LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("font", "Homespun", [[Interface\AddOns\ElvUI\media\fonts\Homespun.ttf]], LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western)
LSM:Register("sound", "ElvUI Aska", [[Interface\AddOns\ElvUI\media\sounds\sndIncMsg.ogg]])
LSM:Register("sound", "Awww Crap", [[Interface\AddOns\ElvUI\media\sounds\awwcrap.ogg]])
LSM:Register("sound", "BBQ Ass", [[Interface\AddOns\ElvUI\media\sounds\bbqass.ogg]])
LSM:Register("sound", "Big Yankie Devil", [[Interface\AddOns\ElvUI\media\sounds\yankiebangbang.ogg]])
LSM:Register("sound", "Dumb Shit", [[Interface\AddOns\ElvUI\media\sounds\dumbshit.ogg]])
LSM:Register("sound", "Mama Weekends", [[Interface\AddOns\ElvUI\media\sounds\mamaweekends.ogg]])
LSM:Register("sound", "Runaway Fast", [[Interface\AddOns\ElvUI\media\sounds\runfast.ogg]])
LSM:Register("sound", "Stop Running", [[Interface\AddOns\ElvUI\media\sounds\stoprunningslimball.ogg]])
LSM:Register("sound", "Warning", [[Interface\AddOns\ElvUI\media\sounds\warning.ogg]])
LSM:Register("sound", "Whisper Alert", [[Interface\AddOns\ElvUI\media\sounds\whisper.ogg]])
+65 -63
View File
@@ -19,66 +19,61 @@ local NUM_PET_ACTION_SLOTS = NUM_PET_ACTION_SLOTS
local bar = CreateFrame("Frame", "ElvUI_BarPet", E.UIParent)
bar:SetFrameStrata("LOW")
function AB:UpdatePet(event)
function AB:UpdatePet()
if ((event == "UNIT_FLAGS" or event == "UNIT_AURA") and arg1 ~= "pet") then return end
if (event == "UNIT_PET" and arg1 ~= "player") then return end
local petActionButton, petActionIcon, petAutoCastableTexture, petAutoCastShine
local petActionsUsable = GetPetActionsUsable()
for i = 1, NUM_PET_ACTION_SLOTS do
local buttonName = "PetActionButton" .. i
petActionButton = _G[buttonName]
petActionIcon = _G[buttonName .. "Icon"]
petAutoCastableTexture = _G[buttonName .. "AutoCastable"]
petAutoCastShine = _G[buttonName .. "AutoCast"]
local buttonName = "PetActionButton"..i
local button = _G[buttonName]
local icon = _G[buttonName.."Icon"]
local autoCast = _G[buttonName.."AutoCastable"]
local shine = _G[buttonName.."AutoCast"]
local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i)
if not isToken then
petActionIcon:SetTexture(texture)
petActionButton.tooltipName = name
icon:SetTexture(texture)
button.tooltipName = name
else
petActionIcon:SetTexture(_G[texture])
petActionButton.tooltipName = _G[name]
icon:SetTexture(_G[texture])
button.tooltipName = _G[name]
end
petActionButton.isToken = isToken
petActionButton.tooltipSubtext = subtext
button.isToken = isToken
button.tooltipSubtext = subtext
if isActive and name ~= "PET_ACTION_FOLLOW" then
petActionButton:SetChecked(1)
if isActive --[[and name ~= "PET_ACTION_FOLLOW"]] then
button:SetChecked(true)
else
petActionButton:SetChecked(0)
button:SetChecked(false)
end
if autoCastAllowed then
petAutoCastableTexture:Show()
autoCast:Show()
else
petAutoCastableTexture:Hide()
autoCast:Hide()
end
if autoCastEnabled then
petAutoCastShine:Show()
shine:Show()
else
petAutoCastShine:Hide()
shine:Hide()
end
petActionButton:SetAlpha(1)
if texture then
if petActionsUsable then
SetDesaturation(petActionIcon, nil)
if GetPetActionsUsable() then
SetDesaturation(icon, nil)
else
SetDesaturation(petActionIcon, 1)
SetDesaturation(icon, 1)
end
petActionIcon:Show()
icon:Show()
else
petActionIcon:Hide()
icon:Hide()
end
if not PetHasActionBar() and texture and name ~= "PET_ACTION_FOLLOW" then
SetDesaturation(petActionIcon, 1)
petActionButton:SetChecked(0)
if not PetHasActionBar() and texture --[[and name ~= "PET_ACTION_FOLLOW"]] then
SetDesaturation(icon, 1)
button:SetChecked(false)
end
end
@@ -90,17 +85,19 @@ function AB:UpdatePet(event)
end
function AB:PositionAndSizeBarPet()
local buttonSpacing = E:Scale(self.db["barPet"].buttonspacing)
local backdropSpacing = E:Scale((self.db["barPet"].backdropSpacing or self.db["barPet"].buttonspacing))
local buttonsPerRow = self.db["barPet"].buttonsPerRow
local numButtons = self.db["barPet"].buttons
local size = E:Scale(self.db["barPet"].buttonsize)
local point = self.db["barPet"].point
local buttonSpacing = E:Scale(self.db.barPet.buttonspacing)
local backdropSpacing = E:Scale((self.db.barPet.backdropSpacing or self.db.barPet.buttonspacing))
local buttonsPerRow = self.db.barPet.buttonsPerRow
local numButtons = self.db.barPet.buttons
local size = E:Scale(self.db.barPet.buttonsize)
local autoCastSize = (size / 2) - (size / 7.5)
local point = self.db.barPet.point
local numColumns = ceil(numButtons / buttonsPerRow)
local widthMult = self.db["barPet"].widthMult
local heightMult = self.db["barPet"].heightMult
local widthMult = self.db.barPet.widthMult
local heightMult = self.db.barPet.heightMult
bar.db = self.db["barPet"]
bar.db = self.db.barPet
bar.db.position = nil --Depreciated
if numButtons < buttonsPerRow then
buttonsPerRow = numButtons
@@ -110,24 +107,23 @@ function AB:PositionAndSizeBarPet()
numColumns = 1
end
if self.db["barPet"].backdrop then
if self.db.barPet.backdrop == true then
bar.backdrop:Show()
else
bar.backdrop:Hide()
--Set size multipliers to 1 when backdrop is disabled
widthMult = 1
heightMult = 1
end
local barWidth = (size * (buttonsPerRow * widthMult)) + ((buttonSpacing * (buttonsPerRow - 1)) * widthMult) + (buttonSpacing * (widthMult-1)) + (backdropSpacing*2) + ((self.db["barPet"].backdrop and E.Border or E.Spacing)*2)
local barHeight = (size * (numColumns * heightMult)) + ((buttonSpacing * (numColumns - 1)) * heightMult) + (buttonSpacing * (heightMult-1)) + (backdropSpacing*2) + ((self.db["barPet"].backdrop and E.Border or E.Spacing)*2)
E:Size(bar, barWidth, barHeight)
local barWidth = (size * (buttonsPerRow * widthMult)) + ((buttonSpacing * (buttonsPerRow - 1)) * widthMult) + (buttonSpacing * (widthMult-1)) + ((self.db.barPet.backdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)
local barHeight = (size * (numColumns * heightMult)) + ((buttonSpacing * (numColumns - 1)) * heightMult) + (buttonSpacing * (heightMult-1)) + ((self.db.barPet.backdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)
bar:SetWidth(barWidth)
bar:SetHeight(barHeight)
E:Size(bar.mover, bar:GetWidth(), bar:GetHeight())
if self.db["barPet"].enabled then
if self.db.barPet.enabled then
bar:SetScale(1)
bar:SetAlpha(self.db["barPet"].alpha)
bar:SetAlpha(bar.db.alpha)
E:EnableMover(bar.mover:GetName())
else
bar:SetScale(0.0001)
@@ -148,31 +144,33 @@ function AB:PositionAndSizeBarPet()
horizontalGrowth = "LEFT"
end
bar.mouseover = self.db["barPet"].mouseover
bar.mouseover = self.db.barPet.mouseover
if bar.mouseover then
bar:SetAlpha(0)
else
bar:SetAlpha(self.db["barPet"].alpha)
bar:SetAlpha(bar.db.alpha)
end
if self.db["barPet"].inheritGlobalFade then
if self.db.barPet.inheritGlobalFade then
bar:SetParent(self.fadeParent)
else
bar:SetParent(E.UIParent)
end
local button, lastButton, lastColumnButton
local firstButtonSpacing = (self.db["barPet"].backdrop and (E.Border + backdropSpacing) or E.Spacing)
local button, lastButton, lastColumnButton, autoCast, shine
local firstButtonSpacing = (self.db.barPet.backdrop == true and (E.Border + backdropSpacing) or E.Spacing)
for i = 1, NUM_PET_ACTION_SLOTS do
button = _G["PetActionButton"..i]
lastButton = _G["PetActionButton"..i - 1]
autoCast = _G["PetActionButton"..i.."AutoCastable"]
shine = _G["PetActionButton"..i.."AutoCast"]
lastColumnButton = _G["PetActionButton"..i - buttonsPerRow]
button:SetParent(bar)
button:ClearAllPoints()
E:Size(button, size)
_G[button:GetName().."Cooldown"]:SetModelScale(size / 40)
E:SetOutside(autoCast, button, autoCastSize, autoCastSize)
--shine:SetInside(button)
button:Show()
if i == 1 then
@@ -216,21 +214,25 @@ function AB:PositionAndSizeBarPet()
button:SetAlpha(0)
else
button:SetScale(1)
button:SetAlpha(1)
button:SetAlpha(bar.db.alpha)
end
self:StyleButton(button)
end
--Fix issue with mover not updating size when bar is hidden
bar:GetScript("OnSizeChanged")(bar)
end
function AB:UpdatePetBindings()
local color = self.db.fontColor
for i = 1, NUM_PET_ACTION_SLOTS do
if self.db.hotkeytext then
local key = GetBindingKey("BONUSACTIONBUTTON"..i)
_G["PetActionButton"..i.."HotKey"]:Show()
_G["PetActionButton"..i.."HotKey"]:SetText(key)
_G["PetActionButton"..i.."HotKey"]:SetTextColor(color.r, color.g, color.b)
self:FixKeybindText(_G["PetActionButton"..i])
else
_G["PetActionButton"..i.."HotKey"]:Hide()
@@ -241,7 +243,8 @@ end
function AB:CreateBarPet()
E:CreateBackdrop(bar, "Default")
bar.backdrop:SetAllPoints()
if self.db["bar4"].enabled then
bar:EnableMouse(true)
if self.db.bar4.enabled then
E:Point(bar, "RIGHT", ElvUI_Bar4, "LEFT", -4, 0)
else
E:Point(bar, "RIGHT", E.UIParent, "RIGHT", -4, 0)
@@ -252,10 +255,9 @@ function AB:CreateBarPet()
self:HookScript(bar, "OnEnter", "Bar_OnEnter")
self:HookScript(bar, "OnLeave", "Bar_OnLeave")
for i = 1, NUM_PET_ACTION_SLOTS do
self:HookScript(_G["PetActionButton" .. i], "OnEnter", "Button_OnEnter")
self:HookScript(_G["PetActionButton" .. i], "OnLeave", "Button_OnLeave")
self:HookScript(_G["PetActionButton"..i], "OnEnter", "Button_OnEnter")
self:HookScript(_G["PetActionButton"..i], "OnLeave", "Button_OnLeave")
end
self:RegisterEvent("SPELLS_CHANGED", "UpdatePet")
+1 -1
View File
@@ -13,7 +13,7 @@ local twipe = table.wipe
local CreateFrame = CreateFrame
local GetBattlefieldScore = GetBattlefieldScore
local GetNumBattlefieldScores = GetNumBattlefieldScores
--local UnitClass = UnitClass
local UnitClass = UnitClass
local UnitExists = UnitExists
--local SetCVar = SetCVar
local WorldFrame = WorldFrame