remove temp folder structure

This commit is contained in:
Crum
2018-02-19 21:03:21 -06:00
parent 85a2a5bcf7
commit 611f11aff9
408 changed files with 0 additions and 0 deletions
+500
View File
@@ -0,0 +1,500 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local AB = E:NewModule("ActionBars", "AceHook-3.0", "AceEvent-3.0");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local _G = _G
local gsub, split = string.gsub, string.split
local ceil = math.ceil
local mod = math.mod
--WoW API / Variables
local CreateFrame = CreateFrame
local UIFrameFadeIn = UIFrameFadeIn
local UIFrameFadeOut = UIFrameFadeOut
E.ActionBars = AB
AB["handledBars"] = {}
AB["handledButtons"] = {}
AB["barDefaults"] = {
["bar1"] = {
["name"] = "Action",
["position"] = "BOTTOM,ElvUIParent,BOTTOM,0,4",
},
["bar2"] = {
["name"] = "MultiBarBottomRight",
["position"] = "BOTTOM,ElvUI_Bar1,TOP,0,2"
},
["bar3"] = {
["name"] = "MultiBarRight",
["position"] = "LEFT,ElvUI_Bar1,RIGHT,4,0"
},
["bar4"] = {
["name"] = "MultiBarLeft",
["position"] = "RIGHT,ElvUIParent,RIGHT,-4,0"
},
["bar5"] = {
["name"] = "MultiBarBottomLeft",
["position"] = "RIGHT,ElvUI_Bar1,LEFT,-4,0"
}
}
function AB:PositionAndSizeBar(barName)
local buttonSpacing = E:Scale(self.db[barName].buttonspacing)
local backdropSpacing = E:Scale((self.db[barName].backdropSpacing or self.db[barName].buttonspacing))
local buttonsPerRow = self.db[barName].buttonsPerRow
local numButtons = self.db[barName].buttons
local size = E:Scale(self.db[barName].buttonsize)
local point = self.db[barName].point
local numColumns = ceil(numButtons / buttonsPerRow)
local widthMult = self.db[barName].widthMult
local heightMult = self.db[barName].heightMult
local bar = self["handledBars"][barName]
bar.db = self.db[barName]
if numButtons < buttonsPerRow then
buttonsPerRow = numButtons
end
if numColumns < 1 then
numColumns = 1
end
if self.db[barName].backdrop then
bar.backdrop:Show()
else
bar.backdrop:Hide()
widthMult = 1
heightMult = 1
end
local barWidth = (size * (buttonsPerRow * widthMult)) + ((buttonSpacing * (buttonsPerRow - 1)) * widthMult) + (buttonSpacing * (widthMult-1)) + ((self.db[barName].backdrop and (E.Border + backdropSpacing) or E.Spacing)*2)
local barHeight = (size * (numColumns * heightMult)) + ((buttonSpacing * (numColumns - 1)) * heightMult) + (buttonSpacing * (heightMult-1)) + ((self.db[barName].backdrop and (E.Border + backdropSpacing) or E.Spacing)*2)
bar:SetWidth(barWidth)
bar:SetHeight(barHeight)
bar.mouseover = self.db[barName].mouseover
local horizontalGrowth, verticalGrowth
if point == "TOPLEFT" or point == "TOPRIGHT" then
verticalGrowth = "DOWN"
else
verticalGrowth = "UP"
end
if point == "BOTTOMLEFT" or point == "TOPLEFT" then
horizontalGrowth = "RIGHT"
else
horizontalGrowth = "LEFT"
end
if self.db[barName].mouseover then
bar:SetAlpha(0)
else
bar:SetAlpha(self.db[barName].alpha)
end
local button, lastButton, lastColumnButton, x, y
local firstButtonSpacing = (self.db[barName].backdrop and (E.Border + backdropSpacing) or E.Spacing)
for i = 1, NUM_ACTIONBAR_BUTTONS do
button = bar.buttons[i]
lastButton = bar.buttons[i-1]
lastColumnButton = bar.buttons[i-buttonsPerRow]
button:ClearAllPoints()
button:SetParent(bar)
button:SetWidth(size)
button:SetHeight(size)
ActionButton_ShowGrid(button)
if i == 1 then
if point == "BOTTOMLEFT" then
x, y = firstButtonSpacing, firstButtonSpacing
elseif point == "TOPRIGHT" then
x, y = -firstButtonSpacing, -firstButtonSpacing
elseif point == "TOPLEFT" then
x, y = firstButtonSpacing, -firstButtonSpacing
else
x, y = -firstButtonSpacing, firstButtonSpacing
end
button:SetPoint(point, bar, point, x, y)
elseif mod((i - 1), buttonsPerRow) == 0 then
x = 0
y = -buttonSpacing
local buttonPoint, anchorPoint = "TOP", "BOTTOM"
if verticalGrowth == "UP" then
y = buttonSpacing
buttonPoint = "BOTTOM"
anchorPoint = "TOP"
end
button:SetPoint(buttonPoint, lastColumnButton, anchorPoint, x, y)
else
x = buttonSpacing
y = 0
local buttonPoint, anchorPoint = "LEFT", "RIGHT"
if horizontalGrowth == "LEFT" then
x = -buttonSpacing
buttonPoint = "RIGHT"
anchorPoint = "LEFT"
end
button:SetPoint(buttonPoint, lastButton, anchorPoint, x, y)
end
if i > numButtons then
button:SetScale(0.000001)
button:SetAlpha(0)
else
button:SetScale(1)
button:SetAlpha(1)
end
if self.db[barName].mouseover then
button:SetAlpha(0)
else
button:SetAlpha(self.db[barName].alpha)
end
end
if self.db[barName].enabled or not bar.initialized then
if not self.db[barName].mouseover then
bar:SetAlpha(self.db[barName].alpha)
end
bar:Show()
if not bar.initialized then
bar.initialized = true
self:PositionAndSizeBar(barName)
return
end
else
bar:Hide()
end
E:SetMoverSnapOffset("ElvAB_"..bar.id, bar.db.buttonspacing / 2)
end
function AB:CreateBar(id)
local bar = CreateFrame("Button", "ElvUI_Bar"..id, E.UIParent)
local point, anchor, attachTo, x, y = split(",", self["barDefaults"]["bar"..id].position)
bar:SetPoint(point, anchor, attachTo, x, y)
bar.id = id
E:CreateBackdrop(bar, "Default")
bar:SetFrameStrata("LOW")
local offset = E.Spacing
bar.backdrop:SetPoint("TOPLEFT", bar, "TOPLEFT", offset, -offset)
bar.backdrop:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -offset, offset)
bar.buttons = {}
self:HookScript(bar, "OnEnter", "Bar_OnEnter")
self:HookScript(bar, "OnLeave", "Bar_OnLeave")
if id == 1 then
bar.actionButtons = {}
bar.bonusButtons = {}
local button
for i = 1, NUM_ACTIONBAR_BUTTONS do
button = _G["ActionButton"..i]
button:SetParent(bar)
bar.actionButtons[i] = button
self:HookScript(button, "OnEnter", "Button_OnEnter")
self:HookScript(button, "OnLeave", "Button_OnLeave")
button = _G["BonusActionButton"..i]
button:SetParent(bar)
bar.bonusButtons[i] = button
self:HookScript(button, "OnEnter", "Button_OnEnter")
self:HookScript(button, "OnLeave", "Button_OnLeave")
end
bar.buttons = bar.actionButtons
bar:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
bar:SetScript("OnEvent", function()
if GetBonusBarOffset() > 0 then
bar.lastBonusBar = GetBonusBarOffset()
for i = 1, NUM_ACTIONBAR_BUTTONS do
bar.buttons[i]:SetParent(E.HiddenFrame)
end
bar.buttons = bar.bonusButtons
else
for i = 1, NUM_ACTIONBAR_BUTTONS do
bar.buttons[i]:SetParent(E.HiddenFrame)
end
bar.buttons = bar.actionButtons
end
AB:PositionAndSizeBar("bar1")
end)
else
for i = 1, NUM_ACTIONBAR_BUTTONS do
local button = _G[self["barDefaults"]["bar"..id].name.."Button"..i]
bar.buttons[i] = button
self:HookScript(button, "OnEnter", "Button_OnEnter")
self:HookScript(button, "OnLeave", "Button_OnLeave")
end
end
self["handledBars"]["bar"..id] = bar
self:PositionAndSizeBar("bar"..id)
E:CreateMover(bar, "ElvAB_"..id, L["Bar "]..id, nil, nil, nil,"ALL,ACTIONBARS")
return bar
end
function AB:UpdateButtonSettings()
for button, _ in pairs(self["handledButtons"]) do
if button then
self:StyleButton(button, button.noBackdrop)
else
self["handledButtons"][button] = nil
end
end
for i = 1, 5 do
self:PositionAndSizeBar("bar"..i)
end
--self:PositionAndSizeBarPet()
--self:PositionAndSizeBarShapeShift()
end
function AB:StyleButton(button, noBackdrop)
local name = button:GetName()
local icon = _G[name.."Icon"]
local count = _G[name.."Count"]
local flash = _G[name.."Flash"]
local hotkey = _G[name.."HotKey"]
local border = _G[name.."Border"]
local macroName = _G[name.."Name"]
local normal = _G[name.."NormalTexture"]
local normal2 = button:GetNormalTexture()
local buttonCooldown = _G[name.."Cooldown"]
local color = self.db.fontColor
if flash then flash:SetTexture(nil) end
if normal then normal:SetTexture(nil) normal:Hide() normal:SetAlpha(0) end
if normal2 then normal2:SetTexture(nil) normal2:Hide() normal2:SetAlpha(0) end
if border then E:Kill(border) end
if not button.noBackdrop then
button.noBackdrop = noBackdrop
end
if count then
count:ClearAllPoints()
count:SetPoint("BOTTOMRIGHT", 0, 2)
E:FontTemplate(count, LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
count:SetTextColor(color.r, color.g, color.b)
end
if macroName then
if self.db.macrotext then
macroName:Show()
E:FontTemplate(macroName, LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
macroName:ClearAllPoints()
E:Point(macroName, "BOTTOM", 2, 2)
macroName:SetJustifyH("CENTER")
else
macroName:Hide()
end
end
if not button.noBackdrop and not button.backdrop then
E:CreateBackdrop(button, "Default", true)
button.backdrop:SetAllPoints()
end
if icon then
icon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(icon)
end
if self.db.hotkeytext then
E:FontTemplate(hotkey, LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
hotkey:SetTextColor(color.r, color.g, color.b)
end
self:FixKeybindText(button)
E:StyleButton(button)
if(not self.handledButtons[button]) then
E:RegisterCooldown(buttonCooldown)
self.handledButtons[button] = true
end
end
function AB:Bar_OnEnter()
if this.mouseover then
UIFrameFadeIn(this, 0.2, this:GetAlpha(), this.db.alpha)
end
end
function AB:Bar_OnLeave()
if this.mouseover then
UIFrameFadeOut(this, 0.2, this:GetAlpha(), 0)
end
end
function AB:Button_OnEnter()
local bar = (this:GetParent() == BonusActionBarFrame or this:GetParent() == MainMenuBarArtFrame) and ElvUI_Bar1 or this:GetParent()
if bar.mouseover then
UIFrameFadeIn(bar, 0.2, bar:GetAlpha(), bar.db.alpha)
end
end
function AB:Button_OnLeave()
local bar = (this:GetParent() == BonusActionBarFrame or this:GetParent() == MainMenuBarArtFrame) and ElvUI_Bar1 or this:GetParent()
if bar.mouseover then
UIFrameFadeOut(bar, 0.2, bar:GetAlpha(), 0)
end
end
function AB:DisableBlizzard()
MainMenuBar:EnableMouse(false)
PetActionBarFrame:EnableMouse(false)
ShapeshiftBarFrame:EnableMouse(false)
local elements = {
MainMenuBar,
MainMenuBarArtFrame,
MainMenuExpBar,
BonusActionBarFrame,
PetActionBarFrame,
ReputationWatchBar,
ShapeshiftBarFrame,
ShapeshiftBarLeft,
ShapeshiftBarMiddle,
ShapeshiftBarRight,
}
for _, element in pairs(elements) do
if element:GetObjectType() == "Frame" then
element:UnregisterAllEvents()
if element == MainMenuBarArtFrame then
element:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
end
end
if element ~= MainMenuBar then
element:Hide()
end
element:SetAlpha(0)
end
elements = nil
local uiManagedFrames = {
"MultiBarLeft",
"MultiBarRight",
"MultiBarBottomLeft",
"MultiBarBottomRight",
"ShapeshiftBarFrame",
"PETACTIONBAR_YPOS",
}
for _, frame in pairs(uiManagedFrames) do
UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
end
uiManagedFrames = nil
end
function AB:FixKeybindText(button)
local hotkey = _G[button:GetName().."HotKey"]
local text = hotkey:GetText()
if text then
text = gsub(text, "SHIFT%-", L["KEY_SHIFT"])
text = gsub(text, "ALT%-", L["KEY_ALT"])
text = gsub(text, "CTRL%-", L["KEY_CTRL"])
text = gsub(text, "BUTTON", L["KEY_MOUSEBUTTON"])
text = gsub(text, "MOUSEWHEELUP", L["KEY_MOUSEWHEELUP"])
text = gsub(text, "MOUSEWHEELDOWN", L["KEY_MOUSEWHEELDOWN"])
text = gsub(text, "NUMPAD", L["KEY_NUMPAD"])
text = gsub(text, "PAGEUP", L["KEY_PAGEUP"])
text = gsub(text, "PAGEDOWN", L["KEY_PAGEDOWN"])
text = gsub(text, "SPACE", L["KEY_SPACE"])
text = gsub(text, "INSERT", L["KEY_INSERT"])
text = gsub(text, "HOME", L["KEY_HOME"])
text = gsub(text, "DELETE", L["KEY_DELETE"])
text = gsub(text, "NMULTIPLY", "*")
text = gsub(text, "NMINUS", "N-")
text = gsub(text, "NPLUS", "N+")
if hotkey:GetText() == _G["RANGE_INDICATOR"] then
hotkey:SetText("")
else
hotkey:SetText(text)
end
end
if self.db.hotkeytext == true then
hotkey:Show()
else
hotkey:Hide()
end
hotkey:ClearAllPoints()
hotkey:SetPoint("TOPRIGHT", 0, -3)
end
function AB:ActionButton_Update()
self:StyleButton(this)
end
function AB:ActionButton_GetPagedID(button)
if button.isBonus and CURRENT_ACTIONBAR_PAGE == 1 then
local offset = GetBonusBarOffset()
if offset == 0 and ElvUI_Bar1 and ElvUI_Bar1.lastBonusBar then
offset = ElvUI_Bar1.lastBonusBar
end
return button:GetID() + ((NUM_ACTIONBAR_PAGES + offset - 1) * NUM_ACTIONBAR_BUTTONS)
end
local parentName = button:GetParent():GetName()
if parentName == "ElvUI_Bar5" then
return button:GetID() + ((BOTTOMLEFT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
elseif parentName == "ElvUI_Bar2" then
return button:GetID() + ((BOTTOMRIGHT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
elseif parentName == "ElvUI_Bar4" then
return button:GetID() + ((LEFT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
elseif parentName == "ElvUI_Bar3" then
return button:GetID() + ((RIGHT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
else
return button:GetID() + ((CURRENT_ACTIONBAR_PAGE - 1) * NUM_ACTIONBAR_BUTTONS)
end
end
function AB:Initialize()
self.db = E.db.actionbar
if E.private.actionbar.enable ~= true then return end
self:DisableBlizzard()
self:SetupMicroBar()
for i = 1, 5 do
self:CreateBar(i)
end
self:UpdateButtonSettings()
--self:LoadKeyBinder()
self:SecureHook("ActionButton_Update")
self:RawHook("ActionButton_GetPagedID")
-- self:SecureHook("PetActionBar_Update", "UpdatePet")
end
local function InitializeCallback()
AB:Initialize()
end
E:RegisterModule(AB:GetName(), InitializeCallback)
+187
View File
@@ -0,0 +1,187 @@
--[[
tullaRange
Adds out of range coloring to action buttons
Derived from RedRange with negligable improvements to CPU usage
--]]
local E, L, V, P, G = unpack(ElvUI)
local _G = _G
local UPDATE_DELAY = 0.1
local ActionHasRange = ActionHasRange
local IsActionInRange = IsActionInRange
local IsUsableAction = IsUsableAction
local HasAction = HasAction
local tullaRange = CreateFrame("Frame", "tullaRange", UIParent)
function tullaRange:Load()
self:SetScript("OnUpdate", self.OnUpdate)
self:SetScript("OnHide", self.OnHide)
self:SetScript("OnEvent", self.OnEvent)
self.elapsed = 0
self:RegisterEvent("PLAYER_LOGIN")
end
function tullaRange:OnEvent()
local action = this[event]
if action then
action(this, event)
end
end
function tullaRange:OnUpdate()
if this.elapsed < UPDATE_DELAY then
this.elapsed = this.elapsed + arg1
else
this:Update()
end
end
function tullaRange:OnHide()
this.elapsed = 0
end
function tullaRange:PLAYER_LOGIN()
if not TULLARANGE_COLORS then
self:LoadDefaults()
end
self.colors = TULLARANGE_COLORS
self.buttonsToUpdate = {}
hooksecurefunc("ActionButton_OnUpdate", self.RegisterButton)
hooksecurefunc("ActionButton_UpdateUsable", self.OnUpdateButtonUsable)
hooksecurefunc("ActionButton_Update", self.OnButtonUpdate)
end
function tullaRange:Update()
self:UpdateButtons(self.elapsed)
self.elapsed = 0
end
function tullaRange:ForceColorUpdate()
for button in pairs(self.buttonsToUpdate) do
tullaRange.OnUpdateButtonUsable(button)
end
end
function tullaRange:UpdateShown()
if next(self.buttonsToUpdate) then
self:Show()
else
self:Hide()
end
end
function tullaRange:UpdateButtons(elapsed)
if not next(self.buttonsToUpdate) then
self:Hide()
return
end
for button in pairs(self.buttonsToUpdate) do
self:UpdateButton(button, elapsed)
end
end
function tullaRange:UpdateButton(button, elapsed)
tullaRange:UpdateButtonUsable(button)
end
function tullaRange:UpdateButtonStatus()
local action = ActionButton_GetPagedID(this)
if not(this:IsVisible() and action and HasAction(action) and ActionHasRange(action)) then
self.buttonsToUpdate[this] = nil
else
self.buttonsToUpdate[this] = true
end
self:UpdateShown()
end
function tullaRange.RegisterButton()
this:SetScript("OnShow", tullaRange.OnButtonShow)
this:SetScript("OnHide", tullaRange.OnButtonHide)
this:SetScript("OnUpdate", nil)
tullaRange:UpdateButtonStatus(this)
end
function tullaRange.OnButtonShow()
tullaRange:UpdateButtonStatus(this)
end
function tullaRange.OnButtonHide()
tullaRange:UpdateButtonStatus(this)
end
function tullaRange:OnUpdateButtonUsable()
this.tullaRangeColor = nil
tullaRange:UpdateButtonUsable(this)
end
function tullaRange.OnButtonUpdate()
tullaRange:UpdateButtonStatus(this)
end
function tullaRange:UpdateButtonUsable(button)
local action = ActionButton_GetPagedID(button)
local isUsable, notEnoughMana = IsUsableAction(action)
if isUsable then
if IsActionInRange(action) == 0 then
tullaRange.SetButtonColor(button, "OOR")
else
tullaRange.SetButtonColor(button, "NORMAL")
end
elseif notEnoughMana then
tullaRange.SetButtonColor(button, "OOM")
else
tullaRange.SetButtonColor(button, "UNUSABLE")
end
end
function tullaRange.SetButtonColor(button, colorType)
if button.tullaRangeColor ~= colorType then
button.tullaRangeColor = colorType
local r, g, b = tullaRange:GetColor(colorType)
local icon = _G[button:GetName() .. "Icon"]
icon:SetVertexColor(r, g, b)
end
end
function tullaRange:LoadDefaults()
TULLARANGE_COLORS = {
["OOR"] = E:GetColorTable(E.db.actionbar.noRangeColor),
["OOM"] = E:GetColorTable(E.db.actionbar.noPowerColor),
["NORMAL"] = E:GetColorTable(E.db.actionbar.usableColor),
["UNUSABLE"] = E:GetColorTable(E.db.actionbar.notUsableColor)
};
end
function tullaRange:Reset()
self:LoadDefaults()
self.colors = TULLARANGE_COLORS
self:ForceColorUpdate()
end
function tullaRange:SetColor(index, r, g, b)
local color = self.colors[index]
color[1] = r
color[2] = g
color[3] = b
self:ForceColorUpdate()
end
function tullaRange:GetColor(index)
local color = self.colors[index]
return color[1], color[2], color[3]
end
tullaRange:Load()
@@ -0,0 +1,8 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="ActionBars.lua"/>
<Script file="Microbar.lua"/>
<Script file="BarPet.lua"/>
<Script file="ButtonColoring.lua"/>
<Script file="BarShapeShift.lua"/>
<Script file="Bind.lua"/>
</Ui>
+126
View File
@@ -0,0 +1,126 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local AB = E:GetModule("ActionBars");
--Cache global variables
--Lua functions
local _G = _G
local getn = table.getn
local mod = math.mod
--WoW API / Variables
local CreateFrame = CreateFrame
local microBar = CreateFrame("Frame", "microBar", E.UIParent)
microBar:SetFrameStrata("BACKGROUND")
local MICRO_BUTTONS = {
"CharacterMicroButton",
"SpellbookMicroButton",
"TalentMicroButton",
"QuestLogMicroButton",
"SocialsMicroButton",
"WorldMapMicroButton",
"MainMenuMicroButton",
"HelpMicroButton"
}
local function Button_OnEnter()
if AB.db.microbar.mouseover then
UIFrameFadeIn(microBar, .2, microBar:GetAlpha(), AB.db.microbar.alpha)
end
end
local function Button_OnLeave()
if AB.db.microbar.mouseover then
UIFrameFadeOut(microBar, .2, microBar:GetAlpha(), 0)
end
end
function AB:HandleMicroButton(button)
local pushed = button:GetPushedTexture()
local normal = button:GetNormalTexture()
local disabled = button:GetDisabledTexture()
button:SetParent(microBar)
button:Show()
button:SetAlpha(self.db.microbar.alpha)
E:Kill(button:GetHighlightTexture())
HookScript(button, "OnEnter", Button_OnEnter)
HookScript(button, "OnLeave", Button_OnLeave)
local f = CreateFrame("Frame", nil, button)
f:SetFrameLevel(1)
f:SetPoint("BOTTOMLEFT", button, "BOTTOMLEFT", 2, 0)
f:SetPoint("TOPRIGHT", button, "TOPRIGHT", -2, -28)
E:SetTemplate(f, "Default", true)
button.backdrop = f
pushed:SetTexCoord(0.17, 0.87, 0.5, 0.908)
E:SetInside(pushed, f)
normal:SetTexCoord(0.17, 0.87, 0.5, 0.908)
E:SetInside(normal, f)
if disabled then
disabled:SetTexCoord(0.17, 0.87, 0.5, 0.908)
E:SetInside(disabled, f)
end
end
function AB:UpdateMicroPositionDimensions()
if not microBar then return end
local numRows = 1
local button, prevButton, lastColumnButton
for i = 1, getn(MICRO_BUTTONS) do
button = _G[MICRO_BUTTONS[i]]
prevButton = _G[MICRO_BUTTONS[i-1]] or microBar
lastColumnButton = _G[MICRO_BUTTONS[i-self.db.microbar.buttonsPerRow]]
button:ClearAllPoints()
if prevButton == microBar then
button:SetPoint("TOPLEFT", prevButton, "TOPLEFT", -2 + E.Border, 28 - E.Border)
elseif mod((i - 1), self.db.microbar.buttonsPerRow) == 0 then
button:SetPoint("TOP", lastColumnButton, "BOTTOM", 0, 28 - self.db.microbar.yOffset)
numRows = numRows + 1
else
button:SetPoint("LEFT", prevButton, "RIGHT", - 4 + self.db.microbar.xOffset, 0)
end
end
if self.db.microbar.mouseover then
microBar:SetAlpha(0)
else
microBar:SetAlpha(self.db.microbar.alpha)
end
microBar:SetWidth(((CharacterMicroButton:GetWidth() - 4) * self.db.microbar.buttonsPerRow) + (self.db.microbar.xOffset * (self.db.microbar.buttonsPerRow - 1)) + E.Border * 2)
microBar:SetHeight(((CharacterMicroButton:GetHeight() - 28) * numRows) + (self.db.microbar.yOffset * (numRows - 1)) + E.Border * 2)
if self.db.microbar.enabled then
microBar:Show()
if microBar.mover then
E:EnableMover(microBar.mover:GetName())
end
else
microBar:Hide()
if microBar.mover then
E:DisableMover(microBar.mover:GetName())
end
end
end
function AB:SetupMicroBar()
microBar:SetPoint("TOPLEFT", 4, -48)
for i = 1, getn(MICRO_BUTTONS) do
self:HandleMicroButton(_G[MICRO_BUTTONS[i]])
end
E:SetInside(MicroButtonPortrait, CharacterMicroButton.backdrop)
self:UpdateMicroPositionDimensions()
E:CreateMover(microBar, "MicrobarMover", L["Micro Bar"], nil, nil, nil, "ALL,ACTIONBARS")
end
+502
View File
@@ -0,0 +1,502 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local A = E:NewModule("Auras", "AceEvent-3.0");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local GetTime = GetTime
local _G = _G
local unpack, select, pairs, ipairs = unpack, select, pairs, ipairs
local floor, min, max, huge = math.floor, math.min, math.max, math.huge
local format = string.format
local wipe, tinsert, tsort, tremove = table.wipe, table.insert, table.sort, table.remove
--WoW API / Variables
local CreateFrame = CreateFrame
local UnitAura = UnitAura
local CancelItemTempEnchantment = CancelItemTempEnchantment
local CancelUnitBuff = CancelUnitBuff
local GetInventoryItemQuality = GetInventoryItemQuality
local GetItemQualityColor = GetItemQualityColor
local GetWeaponEnchantInfo = GetWeaponEnchantInfo
local GetInventoryItemTexture = GetInventoryItemTexture
local DIRECTION_TO_POINT = {
DOWN_RIGHT = "TOPLEFT",
DOWN_LEFT = "TOPRIGHT",
UP_RIGHT = "BOTTOMLEFT",
UP_LEFT = "BOTTOMRIGHT",
RIGHT_DOWN = "TOPLEFT",
RIGHT_UP = "BOTTOMLEFT",
LEFT_DOWN = "TOPRIGHT",
LEFT_UP = "BOTTOMRIGHT"
}
local DIRECTION_TO_HORIZONTAL_SPACING_MULTIPLIER = {
DOWN_RIGHT = 1,
DOWN_LEFT = -1,
UP_RIGHT = 1,
UP_LEFT = -1,
RIGHT_DOWN = 1,
RIGHT_UP = 1,
LEFT_DOWN = -1,
LEFT_UP = -1
}
local DIRECTION_TO_VERTICAL_SPACING_MULTIPLIER = {
DOWN_RIGHT = -1,
DOWN_LEFT = -1,
UP_RIGHT = 1,
UP_LEFT = 1,
RIGHT_DOWN = -1,
RIGHT_UP = 1,
LEFT_DOWN = -1,
LEFT_UP = 1
}
local IS_HORIZONTAL_GROWTH = {
RIGHT_DOWN = true,
RIGHT_UP = true,
LEFT_DOWN = true,
LEFT_UP = true
}
function A:UpdateTime(elapsed)
if self.offset then
local expiration = select(self.offset, GetWeaponEnchantInfo())
if expiration then
self.timeLeft = expiration / 1e3
else
self.timeLeft = 0
end
else
self.timeLeft = GetPlayerBuffTimeLeft(self.index)
end
if self.nextUpdate > 0 then
self.nextUpdate = not self.offset and self.nextUpdate - elapsed or 1
return
end
local timerValue, formatID
timerValue, formatID, self.nextUpdate = E:GetTimeInfo(self.timeLeft, A.db.fadeThreshold)
self.time:SetText(format("%s%s|r", E.TimeColors[formatID], format(E.TimeFormats[formatID][2], timerValue)))
if self.timeLeft > E.db.auras.fadeThreshold then
-- E:StopFlash(self)
else
-- E:Flash(self, 1)
end
end
local function UpdateTooltip()
if this.offset then
GameTooltip:SetInventoryItem("player", this.offset == 2 and 16 or 17)
else
GameTooltip:SetPlayerBuff(this.index)
end
end
local function OnEnter()
if not this:IsVisible() then return end
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT", -5, -5)
this:UpdateTooltip()
end
local function OnLeave()
GameTooltip:Hide()
end
local function OnClick()
if this.index and this.index > 0 then
CancelPlayerBuff(this.index)
end
end
function A:CreateIcon(button)
local font = LSM:Fetch("font", self.db.font)
button:RegisterForClicks("RightButtonUp")
button.texture = button:CreateTexture(nil, "BORDER")
E:SetInside(button.texture)
button.texture:SetTexCoord(unpack(E.TexCoords))
button.count = button:CreateFontString(nil, "ARTWORK")
button.count:SetPoint("BOTTOMRIGHT", -1 + self.db.countXOffset, 1 + self.db.countYOffset)
E:FontTemplate(button.count, font, self.db.fontSize, self.db.fontOutline)
button.time = button:CreateFontString(nil, "ARTWORK")
button.time:SetPoint("TOP", button, "BOTTOM", 1 + self.db.timeXOffset, 0 + self.db.timeYOffset)
E:FontTemplate(button.time, font, self.db.fontSize, self.db.fontOutline)
button.highlight = button:CreateTexture(nil, "HIGHLIGHT")
button.highlight:SetTexture(1, 1, 1, 0.45)
E:SetInside(button.highlight)
button.UpdateTooltip = UpdateTooltip
button:SetScript("OnEnter", OnEnter)
button:SetScript("OnLeave", OnLeave)
button:SetScript("OnClick", OnClick)
E:SetTemplate(button, "Default")
end
local enchantableSlots = {
[1] = 16,
[2] = 17
}
local buttons = {}
function A:ConfigureAuras(header, auraTable, weaponPosition)
local headerName = header:GetName()
local db = self.db.debuffs
if header.filter == "HELPFUL" then
db = self.db.buffs
end
local size = db.size
local point = DIRECTION_TO_POINT[db.growthDirection]
local xOffset = 0
local yOffset = 0
local wrapXOffset = 0
local wrapYOffset = 0
local wrapAfter = db.wrapAfter
local maxWraps = db.maxWraps
local minWidth = 0
local minHeight = 0
if IS_HORIZONTAL_GROWTH[db.growthDirection] then
minWidth = ((wrapAfter == 1 and 0 or db.horizontalSpacing) + size) * wrapAfter
minHeight = (db.verticalSpacing + size) * maxWraps
xOffset = DIRECTION_TO_HORIZONTAL_SPACING_MULTIPLIER[db.growthDirection] * (db.horizontalSpacing + size)
yOffset = 0
wrapXOffset = 0
wrapYOffset = DIRECTION_TO_VERTICAL_SPACING_MULTIPLIER[db.growthDirection] * (db.verticalSpacing + size)
else
minWidth = (db.horizontalSpacing + size) * maxWraps
minHeight = ((wrapAfter == 1 and 0 or db.verticalSpacing) + size) * wrapAfter
xOffset = 0
yOffset = DIRECTION_TO_VERTICAL_SPACING_MULTIPLIER[db.growthDirection] * (db.verticalSpacing + size)
wrapXOffset = DIRECTION_TO_HORIZONTAL_SPACING_MULTIPLIER[db.growthDirection] * (db.horizontalSpacing + size)
wrapYOffset = 0
end
wipe(buttons)
local button
local numWeapon = 0
if weaponPosition then
local hasMainHandEnchant, mainHandExpiration, _, hasOffHandEnchant, offHandExpiration = GetWeaponEnchantInfo()
for weapon = 2, 1, -1 do
button = _G["ElvUIPlayerBuffsTempEnchant"..weapon]
if select(weapon, hasMainHandEnchant, hasOffHandEnchant) then
numWeapon = numWeapon + 1
if not button then
button = CreateFrame("Button", "$parentTempEnchant"..weapon, header)
self:CreateIcon(button)
end
if button then
if button:IsShown() then button:Hide() end
local index = enchantableSlots[weapon]
local quality = GetInventoryItemQuality("player", index)
button.texture:SetTexture(GetInventoryItemTexture("player", index))
if quality then
button:SetBackdropBorderColor(GetItemQualityColor(quality))
end
local expirationTime = select(weapon, mainHandExpiration, offHandExpiration)
if expirationTime then
button.offset = select(weapon, 2, 5)
button:SetScript("OnUpdate", function() self.UpdateTime(this, arg1) end)
button.nextUpdate = -1
A.UpdateTime(button, 0)
else
button.timeLeft = nil
button.offset = nil
button:SetScript("OnUpdate", nil)
button.time:SetText("")
end
buttons[weapon] = button
end
else
if button and type(button.Hide) == "function" then
button.offset = nil
button:Hide()
end
end
end
end
for i = 1, getn(auraTable) do
button = _G[headerName.."AuraButton"..i]
if button then
if button:IsShown() then button:Hide() end
else
button = CreateFrame("Button", "$parentAuraButton"..i, header)
self:CreateIcon(button)
end
local buffInfo = auraTable[i]
button.index = buffInfo.index
if buffInfo.expires and buffInfo.expires > 0 then
local timeLeft = buffInfo.expires
if not button.timeLeft then
button.timeLeft = timeLeft
button:SetScript("OnUpdate", function() self.UpdateTime(this, arg1) end)
else
button.timeLeft = timeLeft
end
button.nextUpdate = -1
self.UpdateTime(button, 0)
else
button.timeLeft = nil
button.time:SetText("")
button:SetScript("OnUpdate", nil)
end
if buffInfo.count > 1 then
button.count:SetText(buffInfo.count)
else
button.count:SetText("")
end
if buffInfo.filter == "HARMFUL" then
local color = DebuffTypeColor[buffInfo.dispelType or ""]
button:SetBackdropBorderColor(color.r, color.g, color.b)
else
button:SetBackdropBorderColor(unpack(E.media.bordercolor))
end
button.texture:SetTexture(buffInfo.icon)
buttons[i+numWeapon] = button
end
local display = getn(buttons)
if wrapAfter and maxWraps then
display = min(display, wrapAfter * maxWraps)
end
local left, right, top, bottom = huge, -huge, -huge, huge
for index = 1, display do
button = buttons[index]
local tick, cycle = floor(mod((index - 1), wrapAfter)), floor((index - 1) / wrapAfter)
button:ClearAllPoints()
button:SetPoint(point, header, cycle * wrapXOffset + tick * xOffset, cycle * wrapYOffset + tick * yOffset)
button:SetWidth(size)
button:SetHeight(size)
if button.time then
local font = LSM:Fetch("font", self.db.font)
button.time:ClearAllPoints()
button.time:SetPoint("TOP", button, "BOTTOM", 1 + self.db.timeXOffset, 0 + self.db.timeYOffset)
E:FontTemplate(button.time, font, self.db.fontSize, self.db.fontOutline)
button.count:ClearAllPoints()
button.count:SetPoint("BOTTOMRIGHT", -1 + self.db.countXOffset, 0 + self.db.countYOffset)
E:FontTemplate(button.count, font, self.db.fontSize, self.db.fontOutline)
end
button:Show()
left = min(left, button:GetLeft() or huge)
right = max(right, button:GetRight() or -huge)
top = max(top, button:GetTop() or -huge)
bottom = min(bottom, button:GetBottom() or huge)
end
local deadIndex = (getn(auraTable) + numWeapon) + 1
button = _G[headerName.."AuraButton"..deadIndex]
while button do
if button:IsShown() then button:Hide() end
deadIndex = deadIndex + 1
button = _G[headerName.."AuraButton"..deadIndex]
end
if display >= 1 then
header:SetWidth(max(right - left, minWidth))
header:SetHeight(max(top - bottom, minHeight))
else
header:SetWidth(minWidth)
header:SetHeight(minHeight)
end
end
local freshTable
local releaseTable
do
local tableReserve = {}
freshTable = function ()
local t = next(tableReserve) or {}
tableReserve[t] = nil
return t
end
releaseTable = function (t)
tableReserve[t] = wipe(t)
end
end
local function sortFactory(key, separateOwn, reverse)
if separateOwn ~= 0 then
if reverse then
return function(a, b)
if a.filter == b.filter then
local ownA, ownB = a.caster == "player", b.caster == "player"
if ownA ~= ownB then
return ownA == (separateOwn > 0)
end
return a[key] > b[key]
else
return a.filter < b.filter
end
end;
else
return function(a, b)
if a.filter == b.filter then
local ownA, ownB = a.caster == "player", b.caster == "player"
if ownA ~= ownB then
return ownA == (separateOwn > 0)
end
return a[key] < b[key]
else
return a.filter < b.filter
end
end;
end
else
if reverse then
return function(a, b)
if a.filter == b.filter then
return a[key] > b[key]
else
return a.filter < b.filter
end
end;
else
return function(a, b)
if a.filter == b.filter then
return a[key] < b[key]
else
return a.filter < b.filter
end
end;
end
end
end
local sorters = {}
for _, key in ipairs{"index", "expires"} do
local label = string.upper(key)
sorters[label] = {}
for bool in pairs{[true] = true, [false] = false} do
sorters[label][bool] = {}
for sep = -1, 1 do
sorters[label][bool][sep] = sortFactory(key, sep, bool)
end
end
end
sorters.TIME = sorters.EXPIRES
local sortingTable = {}
function A:UpdateHeader(header)
local filter = header.filter
local db = self.db.debuffs
wipe(sortingTable)
local weaponPosition
if filter == "HELPFUL" then
db = self.db.buffs
weaponPosition = 1
end
for i = 0, 23 do
local aura, _ = freshTable()
aura.index, aura.untilCancelled = GetPlayerBuff(i, filter)
if aura.index < 0 then
releaseTable(aura)
else
aura.icon, aura.count, aura.dispelType, aura.expires = GetPlayerBuffTexture(aura.index), GetPlayerBuffApplications(aura.index), GetPlayerBuffDispelType(aura.index), GetPlayerBuffTimeLeft(aura.index)
aura.filter = filter
sortingTable[i+1] = aura
end
end
local sortMethod = (sorters[db.sortMethod] or sorters["INDEX"])[db.sortDir == "-"][db.seperateOwn]
tsort(sortingTable, sortMethod)
self:ConfigureAuras(header, sortingTable, weaponPosition)
while sortingTable[1] do
releaseTable(wipe(sortingTable))
end
end
function A:CreateAuraHeader(filter)
local name = "ElvUIPlayerDebuffs"
if filter == "HELPFUL" then
name = "ElvUIPlayerBuffs"
end
local header = CreateFrame("Frame", name, UIParent)
header:SetClampedToScreen(true)
header.filter = filter
header:RegisterEvent("PLAYER_AURAS_CHANGED")
header:SetScript("OnEvent", function()
A:UpdateHeader(this)
end)
self:UpdateHeader(header)
return header
end
function A:Initialize()
if self.db then return end
if E.private.auras.disableBlizzard then
E:Kill(BuffFrame)
E:Kill(TemporaryEnchantFrame)
end
if not E.private.auras.enable then return end
self.db = E.db.auras
self.BuffFrame = self:CreateAuraHeader("HELPFUL")
self.BuffFrame:SetPoint("TOPRIGHT", MMHolder, "TOPLEFT", -(6 + E.Border), -E.Border - E.Spacing)
E:CreateMover(self.BuffFrame, "BuffsMover", L["Player Buffs"])
self.BuffFrame.GetUpdateWeaponEnchant = function(self)
local hasMainHandEnchant, _, _, hasOffHandEnchant = GetWeaponEnchantInfo()
if hasMainHandEnchant and not self.hasMainHandEnchant then
self.hasMainHandEnchant = true
return true
elseif hasOffHandEnchant and not self.hasOffHandEnchant then
self.hasOffHandEnchant = true
return true
elseif self.hasMainHandEnchant and not hasMainHandEnchant then
self.hasMainHandEnchant = false
return true
elseif self.hasOffHandEnchant and not hasOffHandEnchant then
self.hasOffHandEnchant = false
return true
end
end
self.BuffFrame:SetScript("OnUpdate", function()
if this:GetUpdateWeaponEnchant() then A:UpdateHeader(this) end
end)
self.DebuffFrame = self:CreateAuraHeader("HARMFUL")
self.DebuffFrame:SetPoint("BOTTOMRIGHT", MMHolder, "BOTTOMLEFT", -(6 + E.Border), E.Border + E.Spacing)
E:CreateMover(self.DebuffFrame, "DebuffsMover", L["Player Debuffs"])
end
local function InitializeCallback()
A:Initialize()
end
E:RegisterModule(A:GetName(), InitializeCallback)
+3
View File
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Auras.lua"/>
</Ui>
+168
View File
@@ -0,0 +1,168 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Bags");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local tinsert = table.insert
--WoW API / Variables
local CreateFrame = CreateFrame
local NUM_BAG_FRAMES = NUM_BAG_FRAMES
local TOTAL_BAGS = NUM_BAG_FRAMES + 2
local ElvUIKeyRing = CreateFrame("CheckButton", "ElvUIKeyRingButton", UIParent, "ItemButtonTemplate")
ElvUIKeyRing:RegisterForClicks("anyUp")
E:StripTextures(ElvUIKeyRing)
ElvUIKeyRing:SetScript("OnClick", function() if CursorHasItem() then PutKeyInKeyRing() else ToggleKeyRing() end end)
ElvUIKeyRing:SetScript("OnReceiveDrag", function() if CursorHasItem() then PutKeyInKeyRing() end end)
ElvUIKeyRing:SetScript("OnEnter", function() GameTooltip:SetOwner(this, "ANCHOR_LEFT") local color = HIGHLIGHT_FONT_COLOR GameTooltip:SetText(KEYRING, color.r, color.g, color.b) GameTooltip:AddLine() end)
ElvUIKeyRing:SetScript("OnLeave", function() GameTooltip:Hide() end)
_G[ElvUIKeyRing:GetName().."IconTexture"]:SetTexture("Interface\\ContainerFrame\\KeyRing-Bag-Icon")
_G[ElvUIKeyRing:GetName().."IconTexture"]:SetTexCoord(unpack(E.TexCoords))
local function OnEnter()
if not E.db.bags.bagBar.mouseover then return end
UIFrameFadeIn(ElvUIBags, 0.2, ElvUIBags:GetAlpha(), 1)
end
local function OnLeave()
if not E.db.bags.bagBar.mouseover then return end
UIFrameFadeOut(ElvUIBags, 0.2, ElvUIBags:GetAlpha(), 0)
end
function B:SkinBag(bag)
local icon = _G[bag:GetName().."IconTexture"]
bag.oldTex = icon:GetTexture()
E:StripTextures(bag)
E:CreateBackdrop(bag, "Default", true)
bag.backdrop:SetAllPoints()
E:StyleButton(bag, true)
icon:SetTexture(bag.oldTex)
icon:Show()
E:SetInside(icon)
icon:SetTexCoord(unpack(E.TexCoords))
end
function B:SizeAndPositionBagBar()
if not ElvUIBags then return end
local buttonSpacing = E.db.bags.bagBar.spacing
local backdropSpacing = E.db.bags.bagBar.backdropSpacing
local bagBarSize = E.db.bags.bagBar.size
local showBackdrop = E.db.bags.bagBar.showBackdrop
local growthDirection = E.db.bags.bagBar.growthDirection
local sortDirection = E.db.bags.bagBar.sortDirection
if E.db.bags.bagBar.mouseover then
ElvUIBags:SetAlpha(0)
else
ElvUIBags:SetAlpha(1)
end
if showBackdrop then
ElvUIBags.backdrop:Show()
else
ElvUIBags.backdrop:Hide()
end
ElvUIKeyRingButton:SetWidth(bagBarSize)
ElvUIKeyRingButton:SetHeight(bagBarSize)
ElvUIKeyRingButton:ClearAllPoints()
for i = 1, getn(ElvUIBags.buttons) do
local button = ElvUIBags.buttons[i]
local prevButton = ElvUIBags.buttons[i-1]
button:SetWidth(E.db.bags.bagBar.size)
button:SetHeight(E.db.bags.bagBar.size)
button:ClearAllPoints()
if growthDirection == "HORIZONTAL" and sortDirection == "ASCENDING" then
if i == 1 then
button:SetPoint("LEFT", ElvUIBags, "LEFT", (showBackdrop and (backdropSpacing + E.Border) or 0), 0)
elseif prevButton then
button:SetPoint("LEFT", prevButton, "RIGHT", buttonSpacing, 0)
end
elseif growthDirection == "VERTICAL" and sortDirection == "ASCENDING" then
if i == 1 then
button:SetPoint("TOP", ElvUIBags, "TOP", 0, -(showBackdrop and (backdropSpacing + E.Border) or 0))
elseif prevButton then
button:SetPoint("TOP", prevButton, "BOTTOM", 0, -buttonSpacing)
end
elseif growthDirection == "HORIZONTAL" and sortDirection == "DESCENDING" then
if i == 1 then
button:SetPoint("RIGHT", ElvUIBags, "RIGHT", -(showBackdrop and (backdropSpacing + E.Border) or 0), 0)
elseif prevButton then
button:SetPoint("RIGHT", prevButton, "LEFT", -buttonSpacing, 0)
end
else
if i == 1 then
button:SetPoint("BOTTOM", ElvUIBags, "BOTTOM", 0, (showBackdrop and (backdropSpacing + E.Border) or 0))
elseif prevButton then
button:SetPoint("BOTTOM", prevButton, "TOP", 0, buttonSpacing)
end
end
end
if growthDirection == "HORIZONTAL" then
ElvUIBags:SetWidth(bagBarSize*(TOTAL_BAGS) + buttonSpacing*(TOTAL_BAGS-1) + ((showBackdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2))
ElvUIBags:SetHeight(bagBarSize + ((showBackdrop and (E.Border + backdropSpacing) or E.Spacing)*2))
else
ElvUIBags:SetHeight(bagBarSize*(TOTAL_BAGS) + buttonSpacing*(TOTAL_BAGS-1) + ((showBackdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2))
ElvUIBags:SetWidth(bagBarSize + ((showBackdrop and (E.Border + backdropSpacing) or E.Spacing)*2))
end
end
function B:LoadBagBar()
if not E.private.bags.bagBar then return end
local ElvUIBags = CreateFrame("Frame", "ElvUIBags", E.UIParent)
ElvUIBags:SetPoint("TOPRIGHT", RightChatPanel, "TOPLEFT", -4, 0)
ElvUIBags.buttons = {}
E:CreateBackdrop(ElvUIBags)
ElvUIBags.backdrop:SetAllPoints()
ElvUIBags:EnableMouse(true)
ElvUIBags:SetScript("OnEnter", OnEnter)
ElvUIBags:SetScript("OnLeave", OnLeave)
MainMenuBarBackpackButton:SetParent(ElvUIBags)
MainMenuBarBackpackButton.SetParent = E.dummy
MainMenuBarBackpackButton:ClearAllPoints()
E:FontTemplate(MainMenuBarBackpackButtonCount, nil, 10)
MainMenuBarBackpackButtonCount:ClearAllPoints()
MainMenuBarBackpackButtonCount:SetPoint("BOTTOMRIGHT", MainMenuBarBackpackButton, "BOTTOMRIGHT", -1, 4)
MainMenuBarBackpackButton:Show()
MainMenuBarBackpackButton:SetAlpha(1)
HookScript(MainMenuBarBackpackButton, "OnEnter", OnEnter)
HookScript(MainMenuBarBackpackButton, "OnLeave", OnLeave)
tinsert(ElvUIBags.buttons, MainMenuBarBackpackButton)
self:SkinBag(MainMenuBarBackpackButton)
for i = 0, NUM_BAG_FRAMES - 1 do
local b = _G["CharacterBag"..i.."Slot"]
b:SetParent(ElvUIBags)
b.SetParent = E.dummy
b:Show()
b:SetAlpha(1)
HookScript(b, "OnEnter", OnEnter)
HookScript(b, "OnLeave", OnLeave)
self:SkinBag(b)
tinsert(ElvUIBags.buttons, b)
end
E:SetTemplate(ElvUIKeyRingButton)
E:StyleButton(ElvUIKeyRingButton, true)
E:SetInside(_G[ElvUIKeyRingButton:GetName().."IconTexture"])
ElvUIKeyRingButton:SetParent(ElvUIBags)
ElvUIKeyRingButton.SetParent = E.dummy
HookScript(ElvUIKeyRingButton, "OnEnter", OnEnter)
HookScript(ElvUIKeyRingButton, "OnLeave", OnLeave)
tinsert(ElvUIBags.buttons, ElvUIKeyRingButton)
self:SizeAndPositionBagBar()
E:CreateMover(ElvUIBags, "BagsMover", L["Bags"])
end
File diff suppressed because it is too large Load Diff
+5
View File
@@ -0,0 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Bags.lua"/>
<Script file="BagBar.lua"/>
<Script file="Sort.lua"/>
</Ui>
+813
View File
@@ -0,0 +1,813 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Bags");
local Search = LibStub("LibItemSearch-1.2");
--Cache global variables
--Lua functions
local ipairs, pairs, tonumber, select, unpack = ipairs, pairs, tonumber, select, unpack
local tinsert, tremove, tsort, twipe = table.insert, table.remove, table.sort, table.wipe
local floor, mod = math.floor, math.mod
local band = bit.band
local match, gmatch, find = string.match, string.gmatch, string.find
--WoW API / Variables
local GetTime = GetTime
local GetItemInfo = GetItemInfo
local GetAuctionItemClasses = GetAuctionItemClasses
local GetAuctionItemSubClasses = GetAuctionItemSubClasses
local GetContainerItemInfo = GetContainerItemInfo
local GetContainerItemLink = GetContainerItemLink
local PickupContainerItem = PickupContainerItem
local SplitContainerItem = SplitContainerItem
local GetContainerNumSlots = GetContainerNumSlots
local GetContainerNumFreeSlots = GetContainerNumFreeSlots
local ContainerIDToInventoryID = ContainerIDToInventoryID
local GetInventoryItemLink = GetInventoryItemLink
local CursorHasItem = CursorHasItem
local ARMOR = ARMOR
local bankBags = {BANK_CONTAINER}
local MAX_MOVE_TIME = 1.25
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do
tinsert(bankBags, i)
end
local playerBags = {}
for i = 0, NUM_BAG_SLOTS do
tinsert(playerBags, i)
end
local allBags = {}
for _, i in ipairs(playerBags) do
tinsert(allBags, i)
end
for _, i in ipairs(bankBags) do
tinsert(allBags, i)
end
local coreGroups = {
bank = bankBags,
bags = playerBags,
all = allBags,
}
local bagCache = {}
local bagIDs = {}
local bagQualities = {}
local bagStacks = {}
local bagMaxStacks = {}
local bagGroups = {}
local initialOrder = {}
local itemTypes, itemSubTypes
local bagSorted, bagLocked = {}, {}
local bagRole
local moves = {}
local targetItems = {}
local sourceUsed = {}
local targetSlots = {}
local specialtyBags = {}
local emptySlots = {}
local moveRetries = 0
local lastItemID, currentItemID, lockStop, lastDestination, lastMove
local moveTracker = {}
local inventorySlots = {
INVTYPE_AMMO = 0,
INVTYPE_HEAD = 1,
INVTYPE_NECK = 2,
INVTYPE_SHOULDER = 3,
INVTYPE_BODY = 4,
INVTYPE_CHEST = 5,
INVTYPE_ROBE = 5,
INVTYPE_WAIST = 6,
INVTYPE_LEGS = 7,
INVTYPE_FEET = 8,
INVTYPE_WRIST = 9,
INVTYPE_HAND = 10,
INVTYPE_FINGER = 11,
INVTYPE_TRINKET = 12,
INVTYPE_CLOAK = 13,
INVTYPE_WEAPON = 14,
INVTYPE_SHIELD = 15,
INVTYPE_2HWEAPON = 16,
INVTYPE_WEAPONMAINHAND = 18,
INVTYPE_WEAPONOFFHAND = 19,
INVTYPE_HOLDABLE = 20,
INVTYPE_RANGED = 21,
INVTYPE_THROWN = 22,
INVTYPE_RANGEDRIGHT = 23,
INVTYPE_RELIC = 24,
INVTYPE_TABARD = 25,
}
local safe = {
[BANK_CONTAINER] = true,
[0] = true
}
local frame = CreateFrame("Frame")
local t, WAIT_TIME = 0, 0.05
frame:SetScript("OnUpdate", function(_, elapsed)
t = t + (elapsed or 0.01)
if t > WAIT_TIME then
t = 0
B:DoMoves()
end
end)
frame:Hide()
B.SortUpdateTimer = frame
local function BuildSortOrder()
itemTypes = {}
itemSubTypes = {}
for i, iType in ipairs({GetAuctionItemClasses()}) do
itemTypes[iType] = i
itemSubTypes[iType] = {}
for ii, isType in ipairs({GetAuctionItemSubClasses(i)}) do
itemSubTypes[iType][isType] = ii
end
end
end
local function UpdateLocation(from, to)
if (bagIDs[from] == bagIDs[to]) and (bagStacks[to] < bagMaxStacks[to]) then
local stackSize = bagMaxStacks[to]
if (bagStacks[to] + bagStacks[from]) > stackSize then
bagStacks[from] = bagStacks[from] - (stackSize - bagStacks[to])
bagStacks[to] = stackSize
else
bagStacks[to] = bagStacks[to] + bagStacks[from]
bagStacks[from] = nil
bagIDs[from] = nil
bagQualities[from] = nil
bagMaxStacks[from] = nil
end
else
bagIDs[from], bagIDs[to] = bagIDs[to], bagIDs[from]
bagQualities[from], bagQualities[to] = bagQualities[to], bagQualities[from]
bagStacks[from], bagStacks[to] = bagStacks[to], bagStacks[from]
bagMaxStacks[from], bagMaxStacks[to] = bagMaxStacks[to], bagMaxStacks[from]
end
end
local function PrimarySort(a, b)
local aName, _, _, aLvl, _, _, _, _, _, _, aPrice = GetItemInfo(bagIDs[a])
local bName, _, _, bLvl, _, _, _, _, _, _, bPrice = GetItemInfo(bagIDs[b])
if aLvl ~= bLvl and aLvl and bLvl then
return aLvl > bLvl
end
if aPrice ~= bPrice and aPrice and bPrice then
return aPrice > bPrice
end
if aName and bName then
return aName < bName
end
end
local function DefaultSort(a, b)
local aID = bagIDs[a]
local bID = bagIDs[b]
if (not aID) or (not bID) then return aID end
local aOrder, bOrder = initialOrder[a], initialOrder[b]
if aID == bID then
local aCount = bagStacks[a]
local bCount = bagStacks[b]
if aCount and bCount and aCount == bCount then
return aOrder < bOrder
elseif aCount and bCount then
return aCount < bCount
end
end
local _, _, aRarity, _, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID)
local _, _, bRarity, _, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID)
aRarity = bagQualities[a]
bRarity = bagQualities[b]
if aRarity ~= bRarity and aRarity and bRarity then
return aRarity > bRarity
end
if itemTypes[aType] ~= itemTypes[bType] then
return (itemTypes[aType] or 99) < (itemTypes[bType] or 99)
end
if aType == ARMOR then
local aEquipLoc = inventorySlots[aEquipLoc] or -1
local bEquipLoc = inventorySlots[bEquipLoc] or -1
if aEquipLoc == bEquipLoc then
return PrimarySort(a, b)
end
if aEquipLoc and bEquipLoc then
return aEquipLoc < bEquipLoc
end
end
if aSubType == bSubType then
return PrimarySort(a, b)
end
return ((itemSubTypes[aType] or {})[aSubType] or 99) < ((itemSubTypes[bType] or {})[bSubType] or 99)
end
local function ReverseSort(a, b)
return DefaultSort(b, a)
end
local function UpdateSorted(source, destination)
for i, bs in pairs(bagSorted) do
if bs == source then
bagSorted[i] = destination
elseif bs == destination then
bagSorted[i] = source
end
end
end
local function ShouldMove(source, destination)
if destination == source then return end
if not bagIDs[source] then return end
if bagIDs[source] == bagIDs[destination] and bagStacks[source] == bagStacks[destination] then return end
return true
end
local function IterateForwards(bagList, i)
i = i + 1
local step = 1
for _, bag in ipairs(bagList) do
local slots = B:GetNumSlots(bag, bagRole)
if i > slots + step then
step = step + slots
else
for slot = 1, slots do
if step == i then
return i, bag, slot
end
step = step + 1
end
end
end
bagRole = nil
end
local function IterateBackwards(bagList, i)
i = i + 1
local step = 1
for ii = getn(bagList), 1, -1 do
local bag = bagList[ii]
local slots = B:GetNumSlots(bag, bagRole)
if i > slots + step then
step = step + slots
else
for slot = slots, 1, -1 do
if step == i then
return i, bag, slot
end
step = step + 1
end
end
end
bagRole = nil
end
function B.IterateBags(bagList, reverse, role)
bagRole = role
return (reverse and IterateBackwards or IterateForwards), bagList, 0
end
function B:GetItemID(bag, slot)
local link = self:GetItemLink(bag, slot)
return link and tonumber(match(link, "item:(%d+)"))
end
function B:GetItemInfo(bag, slot)
return GetContainerItemInfo(bag, slot)
end
function B:GetItemLink(bag, slot)
return GetContainerItemLink(bag, slot)
end
function B:PickupItem(bag, slot)
return PickupContainerItem(bag, slot)
end
function B:SplitItem(bag, slot, amount)
return SplitContainerItem(bag, slot, amount)
end
function B:GetNumSlots(bag, role)
if bag then
return GetContainerNumSlots(bag);
end
return 0
end
local function ConvertLinkToID(link)
if not link then return end
if tonumber(match(link, "item:(%d+)")) then
return tonumber(match(link, "item:(%d+)"))
end
end
local function DefaultCanMove()
return true
end
function B:Encode_BagSlot(bag, slot)
return (bag*100) + slot
end
function B:Decode_BagSlot(int)
return floor(int/100), mod(int, 100)
end
function B:IsPartial(bag, slot)
local bagSlot = B:Encode_BagSlot(bag, slot)
return ((bagMaxStacks[bagSlot] or 0) - (bagStacks[bagSlot] or 0)) > 0
end
function B:EncodeMove(source, target)
return (source * 10000) + target
end
function B:DecodeMove(move)
local s = floor(move/10000)
local t = mod(move,10000)
s = (t>9000) and (s+1) or s
t = (t>9000) and (t-10000) or t
return s, t
end
function B:AddMove(source, destination)
UpdateLocation(source, destination)
tinsert(moves, 1, B:EncodeMove(source, destination))
end
function B:ScanBags()
for _, bag, slot in B.IterateBags(allBags) do
local bagSlot = B:Encode_BagSlot(bag, slot)
local itemID = ConvertLinkToID(B:GetItemLink(bag, slot))
if itemID then
bagMaxStacks[bagSlot] = select(7, GetItemInfo(itemID))
bagIDs[bagSlot] = itemID
bagQualities[bagSlot] = select(3, GetItemInfo(itemID))
bagStacks[bagSlot] = select(2, B:GetItemInfo(bag, slot))
end
end
end
-- TEMPORARY MAYBE UNTIL ALTERNATIVE FIX
function B:GetItemFamily(bagType)
local itemSubType = select(6, GetItemInfo(match(bagType, "item:(%d+)")))
if strupper(itemSubType) == "BAG" then
return 0
elseif strupper(itemSubType) == "QUIVER" then
return 1
elseif strupper(itemSubType) == "KEYRING" then
return -2
else
return nil
end
end
function B:IsSpecialtyBag(bagID)
if safe[bagID] then return false end
local inventorySlot = ContainerIDToInventoryID(bagID)
if not inventorySlot then return false end
local bag = GetInventoryItemLink("player", inventorySlot)
if not bag then return false end
local family = B:GetItemFamily(bag)
if family == 0 or family == nil then return false end
return family
end
function B:CanItemGoInBag(bag, slot, targetBag)
local item = bagIDs[B:Encode_BagSlot(bag, slot)]
local itemFamily = B:GetItemFamily(item)
if itemFamily and itemFamily > 0 then
local equipSlot = select(7, GetItemInfo(item))
if equipSlot == "INVTYPE_BAG" then
itemFamily = 1
end
end
local bagFamily = select(2, GetContainerNumFreeSlots(targetBag))
if itemFamily then
return (bagFamily == 0) or band(itemFamily, bagFamily) > 0
else
return false
end
end
function B.Compress(...)
for i = 1, getn(arg) do
local bags = arg[i]
B.Stack(bags, bags, B.IsPartial)
end
end
function B.Stack(sourceBags, targetBags, canMove)
if not canMove then canMove = DefaultCanMove end
for _, bag, slot in B.IterateBags(targetBags, nil, "deposit") do
local bagSlot = B:Encode_BagSlot(bag, slot)
local itemID = bagIDs[bagSlot]
if itemID and (bagStacks[bagSlot] ~= bagMaxStacks[bagSlot]) then
targetItems[itemID] = (targetItems[itemID] or 0) + 1
tinsert(targetSlots, bagSlot)
end
end
for _, bag, slot in B.IterateBags(sourceBags, true, "withdraw") do
local sourceSlot = B:Encode_BagSlot(bag, slot)
local itemID = bagIDs[sourceSlot]
if itemID and targetItems[itemID] and canMove(itemID, bag, slot) then
for i = getn(targetSlots), 1, -1 do
local targetedSlot = targetSlots[i]
if bagIDs[sourceSlot] and bagIDs[targetedSlot] == itemID and targetedSlot ~= sourceSlot and not (bagStacks[targetedSlot] == bagMaxStacks[targetedSlot]) and not sourceUsed[targetedSlot] then
B:AddMove(sourceSlot, targetedSlot)
sourceUsed[sourceSlot] = true
if bagStacks[targetedSlot] == bagMaxStacks[targetedSlot] then
targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil
end
if bagStacks[sourceSlot] == 0 then
targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil
break
end
if not targetItems[itemID] then break end
end
end
end
end
twipe(targetItems)
twipe(targetSlots)
twipe(sourceUsed)
end
local blackListedSlots = {}
local blackList = {}
local blackListQueries = {}
local function buildBlacklist(...)
for entry in pairs(arg) do
local itemName = GetItemInfo(entry)
if itemName then
blackList[itemName] = true
elseif entry ~= "" then
if find(entry, "%[") and find(entry, "%]") then
entry = match(entry, "%[(.*)%]")
end
blackListQueries[getn(blackListQueries)+1] = entry
end
end
end
function B.Sort(bags, sorter, invertDirection)
if not sorter then sorter = invertDirection and ReverseSort or DefaultSort end
if not itemTypes then BuildSortOrder() end
twipe(blackList)
twipe(blackListQueries)
twipe(blackListedSlots)
buildBlacklist(B.db.ignoredItems)
buildBlacklist(E.global.bags.ignoredItems)
for i, bag, slot in B.IterateBags(bags, nil, "both") do
local bagSlot = B:Encode_BagSlot(bag, slot)
local link = B:GetItemLink(bag, slot)
if link then
if blackList[GetItemInfo(link)] then
blackListedSlots[bagSlot] = true
end
if not blackListedSlots[bagSlot] then
for _, itemsearchquery in pairs(blackListQueries) do
local success, result = pcall(Search.Matches, Search, link, itemsearchquery)
if success and result then
blackListedSlots[bagSlot] = blackListedSlots[bagSlot] or result
break
end
end
end
end
if not blackListedSlots[bagSlot] then
initialOrder[bagSlot] = i
tinsert(bagSorted, bagSlot)
end
end
tsort(bagSorted, sorter)
local passNeeded = true
while passNeeded do
passNeeded = false
local i = 1
for _, bag, slot in B.IterateBags(bags, nil, "both") do
local destination = B:Encode_BagSlot(bag, slot)
local source = bagSorted[i]
if not blackListedSlots[destination] then
if ShouldMove(source, destination) then
if not (bagLocked[source] or bagLocked[destination]) then
B:AddMove(source, destination)
UpdateSorted(source, destination)
bagLocked[source] = true
bagLocked[destination] = true
else
passNeeded = true
end
end
i = i + 1
end
end
twipe(bagLocked)
end
twipe(bagSorted)
twipe(initialOrder)
end
function B.FillBags(from, to)
B.Stack(from, to)
for _, bag in ipairs(to) do
if B:IsSpecialtyBag(bag) then
tinsert(specialtyBags, bag)
end
end
if getn(specialtyBags) > 0 then
B:Fill(from, specialtyBags)
end
B.Fill(from, to)
twipe(specialtyBags)
end
function B.Fill(sourceBags, targetBags, reverse, canMove)
if not canMove then canMove = DefaultCanMove end
twipe(blackList)
twipe(blackListedSlots)
buildBlacklist(B.db.ignoredItems)
buildBlacklist(E.global.bags.ignoredItems)
for _, bag, slot in B.IterateBags(targetBags, reverse, "deposit") do
local bagSlot = B:Encode_BagSlot(bag, slot)
if not bagIDs[bagSlot] then
tinsert(emptySlots, bagSlot)
end
end
for _, bag, slot in B.IterateBags(sourceBags, not reverse, "withdraw") do
if getn(emptySlots) == 0 then break end
local bagSlot = B:Encode_BagSlot(bag, slot)
local targetBag = B:Decode_BagSlot(emptySlots[1])
local link = B:GetItemLink(bag, slot)
if link and blackList[GetItemInfo(link)] then
blackListedSlots[bagSlot] = true
end
if bagIDs[bagSlot] and B:CanItemGoInBag(bag, slot, targetBag) and canMove(bagIDs[bagSlot], bag, slot) and not blackListedSlots[bagSlot] then
B:AddMove(bagSlot, tremove(emptySlots, 1))
end
end
twipe(emptySlots)
end
function B.SortBags(...)
for i = 1, getn(arg) do
local bags = arg[i]
for i, slotNum in ipairs(bags) do
local bagType = B:IsSpecialtyBag(slotNum)
if bagType == false then bagType = "Normal" end
if not bagCache[bagType] then bagCache[bagType] = {} end
bagCache[bagType][i] = slotNum
end
for bagType, sortedBags in pairs(bagCache) do
if bagType ~= "Normal" then
B.Stack(sortedBags, sortedBags, B.IsPartial)
B.Stack(bagCache["Normal"], sortedBags)
B.Fill(bagCache["Normal"], sortedBags, B.db.sortInverted)
B.Sort(sortedBags, nil, B.db.sortInverted)
twipe(sortedBags)
end
end
if bagCache["Normal"] then
B.Stack(bagCache["Normal"], bagCache["Normal"], B.IsPartial)
B.Sort(bagCache["Normal"], nil, B.db.sortInverted)
twipe(bagCache["Normal"])
end
twipe(bagCache)
twipe(bagGroups)
end
end
function B:StartStacking()
twipe(bagMaxStacks)
twipe(bagStacks)
twipe(bagIDs)
twipe(bagQualities)
twipe(moveTracker)
if getn(moves) > 0 then
self.SortUpdateTimer:Show()
else
B:StopStacking()
end
end
function B:StopStacking(message)
twipe(moves)
twipe(moveTracker)
moveRetries, lastItemID, currentItemID, lockStop, lastDestination, lastMove = 0, nil, nil, nil, nil, nil
self.SortUpdateTimer:Hide()
if message then
E:Print(message)
end
end
function B:DoMove(move)
if CursorHasItem() then
return false, "cursorhasitem"
end
local source, target = B:DecodeMove(move)
local sourceBag, sourceSlot = B:Decode_BagSlot(source)
local targetBag, targetSlot = B:Decode_BagSlot(target)
local _, sourceCount, sourceLocked = B:GetItemInfo(sourceBag, sourceSlot)
local _, targetCount, targetLocked = B:GetItemInfo(targetBag, targetSlot)
if sourceLocked or targetLocked then
return false, "source/target_locked"
end
local sourceItemID = self:GetItemID(sourceBag, sourceSlot)
local targetItemID = self:GetItemID(targetBag, targetSlot)
if not sourceItemID then
if moveTracker[source] then
return false, "move incomplete"
else
return B:StopStacking(L["Confused.. Try Again!"])
end
end
local stackSize = select(7, GetItemInfo(sourceItemID))
if (sourceItemID == targetItemID) and (targetCount ~= stackSize) and ((targetCount + sourceCount) > stackSize) then
B:SplitItem(sourceBag, sourceSlot, stackSize - targetCount)
else
B:PickupItem(sourceBag, sourceSlot)
end
if CursorHasItem() then
B:PickupItem(targetBag, targetSlot)
end
return true, sourceItemID, source, targetItemID, target
end
function B:DoMoves()
if CursorHasItem() and currentItemID then
if lastItemID ~= currentItemID then
return B:StopStacking(L["Confused.. Try Again!"])
end
if moveRetries < 100 then
local targetBag, targetSlot = self:Decode_BagSlot(lastDestination)
local _, _, targetLocked = self:GetItemInfo(targetBag, targetSlot)
if not targetLocked then
self:PickupItem(targetBag, targetSlot)
WAIT_TIME = 0.1
lockStop = GetTime()
moveRetries = moveRetries + 1
return
end
end
end
if lockStop then
for slot, itemID in pairs(moveTracker) do
local actualItemID = self:GetItemID(self:Decode_BagSlot(slot))
if actualItemID ~= itemID then
WAIT_TIME = 0.1
if (GetTime() - lockStop) > MAX_MOVE_TIME then
if lastMove and moveRetries < 100 then
local success, moveID, moveSource, targetID, moveTarget = self:DoMove(lastMove)
WAIT_TIME = 0.1
if not success then
lockStop = GetTime()
moveRetries = moveRetries + 1
return
end
moveTracker[moveSource] = targetID
moveTracker[moveTarget] = moveID
lastDestination = moveTarget
lastMove = moves[i]
lastItemID = moveID
tremove(moves, i)
return
end
B:StopStacking()
return
end
return --give processing time to happen
end
moveTracker[slot] = nil
end
end
lastItemID, lockStop, lastDestination, lastMove = nil, nil, nil, nil
twipe(moveTracker)
local success, moveID, targetID, moveSource, moveTarget
if getn(moves) > 0 then
for i = getn(moves), 1, -1 do
success, moveID, moveSource, targetID, moveTarget = B:DoMove(moves[i])
if not success then
WAIT_TIME = 0.1
lockStop = GetTime()
return
end
moveTracker[moveSource] = targetID
moveTracker[moveTarget] = moveID
lastDestination = moveTarget
lastMove = moves[i]
lastItemID = moveID
tremove(moves, i)
if moves[i-1] then
WAIT_TIME = 0
return
end
end
end
B:StopStacking()
end
function B:GetGroup(id)
if match(id, "^[-%d,]+$") then
local bags = {}
for b in gmatch(id, "-?%d+") do
tinsert(bags, tonumber(b))
end
return bags
end
return coreGroups[id]
end
function B:CommandDecorator(func, groupsDefaults)
return function(groups)
if self.SortUpdateTimer:IsShown() then
E:Print(L["Already Running.. Bailing Out!"])
B:StopStacking()
return
end
twipe(bagGroups)
if not groups or getn(groups) == 0 then
groups = groupsDefaults
end
for bags in gmatch(groups or "", "[^%s]+") do
bags = B:GetGroup(bags)
if bags then
tinsert(bagGroups, bags)
end
end
B:ScanBags()
if func(unpack(bagGroups)) == false then
return
end
twipe(bagGroups)
B:StartStacking()
end
end
+83
View File
@@ -0,0 +1,83 @@
local E, L, DF = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Blizzard");
--Cache global variables
--Lua functions
local _G = _G
local pairs = pairs
--WoW API / Variables
local NUM_GROUP_LOOT_FRAMES = NUM_GROUP_LOOT_FRAMES
local AlertFrameHolder = CreateFrame("Frame", "AlertFrameHolder", E.UIParent)
AlertFrameHolder:SetWidth(250)
AlertFrameHolder:SetHeight(20)
AlertFrameHolder:SetPoint("TOP", E.UIParent, "TOP", 0, -18)
function E:PostAlertMove()
local position = "TOP"
local _, y = AlertFrameMover:GetCenter()
local screenHeight = E.UIParent:GetTop()
if y > (screenHeight / 2) then
position = "TOP"
AlertFrameMover:SetText(AlertFrameMover.textString .. " [Grow Down]")
else
position = "BOTTOM"
AlertFrameMover:SetText(AlertFrameMover.textString .. " [Grow Up]")
end
local rollBars = E:GetModule("Misc").RollBars
if E.private.general.lootRoll then
local lastframe, lastShownFrame
for i, frame in pairs(rollBars) do
frame:ClearAllPoints()
if i ~= 1 then
if position == "TOP" then
frame:SetPoint("TOP", lastframe, "BOTTOM", 0, -4)
else
frame:SetPoint("BOTTOM", lastframe, "TOP", 0, 4)
end
else
if position == "TOP" then
frame:SetPoint("TOP", AlertFrameHolder, "BOTTOM", 0, -4)
else
frame:SetPoint("BOTTOM", AlertFrameHolder, "TOP", 0, 4)
end
end
lastframe = frame
if frame:IsShown() then
lastShownFrame = frame
end
end
elseif E.private.skins.blizzard.enable and E.private.skins.blizzard.lootRoll then
local lastframe, lastShownFrame
for i = 1, NUM_GROUP_LOOT_FRAMES do
local frame = _G["GroupLootFrame" .. i]
if frame then
frame:ClearAllPoints()
if i ~= 1 then
if position == "TOP" then
frame:SetPoint("TOP", lastframe, "BOTTOM", 0, -4)
else
frame:SetPoint("BOTTOM", lastframe, "TOP", 0, 4)
end
else
if position == "TOP" then
frame:SetPoint("TOP", AlertFrameHolder, "BOTTOM", 0, -4)
else
frame:SetPoint("BOTTOM", AlertFrameHolder, "TOP", 0, 4)
end
end
lastframe = frame
if frame:IsShown() then
lastShownFrame = frame
end
end
end
end
end
function B:AlertMovers()
E:CreateMover(AlertFrameHolder, "AlertFrameMover", L["Loot / Alert Frames"], nil, nil, E.PostAlertMove)
end
+81
View File
@@ -0,0 +1,81 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:NewModule("Blizzard", "AceEvent-3.0", "AceHook-3.0");
local GetNumQuestChoices = GetNumQuestChoices
local GetNumQuestLogChoices = GetNumQuestLogChoices
local GetQuestLogRewardHonor = GetQuestLogRewardHonor
local GetQuestLogRewardMoney = GetQuestLogRewardMoney
local GetQuestLogRewardSpell = GetQuestLogRewardSpell
local GetRewardHonor = GetRewardHonor
local GetRewardMoney = GetRewardMoney
local GetRewardSpell = GetRewardSpell
E.Blizzard = B
function B:Initialize()
self:AlertMovers()
self:EnhanceColorPicker()
-- self:KillBlizzard()
self:PositionCaptureBar()
self:PositionDurabilityFrame()
self:PositionGMFrames()
self:MoveWatchFrame()
--[[self:RawHook("CombatConfig_Colorize_Update", function()
if not CHATCONFIG_SELECTED_FILTER_SETTINGS then return end
self.hooks.CombatConfig_Colorize_Update()
end, true)
hooksecurefunc("QuestFrameItems_Update", function(questState)
local spacerFrame, money, honor, numQuestRewards, numQuestChoices, numQuestSpellRewards
if questState == "QuestLog" then
spacerFrame = QuestLogSpacerFrame
money, honor, numQuestRewards, numQuestChoices, numQuestSpellRewards = GetQuestLogRewardMoney(), GetQuestLogRewardHonor(), GetNumQuestLogRewards(), GetNumQuestLogChoices(), GetQuestLogRewardSpell()
else
spacerFrame = QuestSpacerFrame
money, honor, numQuestRewards, numQuestChoices, numQuestSpellRewards = GetRewardMoney(), GetRewardHonor(), GetNumQuestRewards(), GetNumQuestChoices(), GetRewardSpell()
end
if money == 0 and honor > 0 and (numQuestRewards > 0 or numQuestChoices > 0 or numQuestSpellRewards) then
numQuestSpellRewards = numQuestSpellRewards and 1 or 0
local rewardsCount = numQuestRewards + numQuestChoices + numQuestSpellRewards
local honorFrame = _G[questState.."HonorFrame"]
if numQuestRewards > 0 then
honorFrame:ClearAllPoints()
honorFrame:SetPoint("TOPLEFT", questState.."Item"..rewardsCount, "BOTTOMLEFT", 3, 0)
QuestFrame_SetAsLastShown(questState.."HonorFrame", spacerFrame)
else
local questItemReceiveText = _G[questState.."ItemReceiveText"]
honorFrame:ClearAllPoints()
honorFrame:SetPoint("TOPLEFT", questItemReceiveText, "BOTTOMLEFT", 0, -5)
if numQuestSpellRewards > 0 then
questItemReceiveText:SetText(REWARD_ITEMS)
questItemReceiveText:SetPoint("TOPLEFT", questState.."Item"..rewardsCount, "BOTTOMLEFT", 3, 15)
elseif numQuestChoices > 0 then
questItemReceiveText:SetText(REWARD_ITEMS)
local index = numQuestChoices
if mod(index, 2) == 0 then
index = index - 1
end
questItemReceiveText:SetPoint("TOPLEFT", questState.."Item"..index, "BOTTOMLEFT", 3, 15)
else
questItemReceiveText:SetText(REWARD_ITEMS_ONLY)
questItemReceiveText:SetPoint("TOPLEFT", questState.."RewardTitleText", "BOTTOMLEFT", 3, 15)
end
QuestFrame_SetAsLastShown(questItemReceiveText, spacerFrame)
end
end
end)--]]
end
local function InitializeCallback()
B:Initialize()
end
E:RegisterModule(B:GetName(), InitializeCallback)
+66
View File
@@ -0,0 +1,66 @@
local E, L, DF = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Blizzard");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local pvpHolder = CreateFrame("Frame", "PvPHolder", E.UIParent)
function B:WorldStateAlwaysUpFrame_Update()
local captureBar
for i = 1, NUM_EXTENDED_UI_FRAMES do
captureBar = _G["WorldStateCaptureBar" .. i]
if captureBar and captureBar:IsShown() then
captureBar:ClearAllPoints()
captureBar:SetPoint("TOP", WorldStateAlwaysUpFrame, "BOTTOM", 0, -80)
end
end
WorldStateAlwaysUpFrame:ClearAllPoints()
WorldStateAlwaysUpFrame:SetPoint("CENTER", pvpHolder, "CENTER", 0, 10)
if AlwaysUpFrame1 then
AlwaysUpFrame1:ClearAllPoints()
AlwaysUpFrame1:SetPoint("CENTER", WorldStateAlwaysUpFrame, "CENTER", 0, 0)
end
if AlwaysUpFrame2 then
AlwaysUpFrame2:SetPoint("TOP", AlwaysUpFrame1, "BOTTOM", 0, -5)
end
local offset = 0
for i = 1, NUM_ALWAYS_UP_UI_FRAMES do
local frameText = _G["AlwaysUpFrame"..i.."Text"]
local frameIcon = _G["AlwaysUpFrame"..i.."Icon"]
local frameIcon2 = _G["AlwaysUpFrame"..i.."DynamicIconButton"]
frameText:ClearAllPoints()
frameText:SetPoint("CENTER", WorldStateAlwaysUpFrame, "CENTER", 0, offset)
frameText:SetJustifyH("CENTER")
frameIcon:ClearAllPoints()
frameIcon:SetPoint("CENTER", frameText, "LEFT", -7, -9)
frameIcon:SetWidth(38)
frameIcon:SetHeight(38)
frameIcon2:ClearAllPoints()
frameIcon2:SetPoint("LEFT", frameText, "RIGHT", 5, 0)
frameIcon2:SetWidth(38)
frameIcon2:SetHeight(38)
offset = offset - 25
end
end
function B:PositionCaptureBar()
self:SecureHook("WorldStateAlwaysUpFrame_Update")
pvpHolder:SetWidth(30)
pvpHolder:SetHeight(70)
pvpHolder:SetPoint("TOP", E.UIParent, "TOP", 0, -4)
E:CreateMover(pvpHolder, "PvPMover", L["PvP"], nil, nil, nil, "ALL")
end
+298
View File
@@ -0,0 +1,298 @@
--[[
Credit to Jaslm, most of this code is his from the addon ColorPickerPlus
]]
local E, L, DF = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Blizzard");
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local tonumber, collectgarbage = tonumber, collectgarbage
local floor = math.floor
local format = string.format
--WoW API / Variables
local CreateFrame = CreateFrame
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local CLASS, DEFAULTS = CLASS, DEFAULTS
local colorBuffer = {}
local editingText
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local function UpdateAlphaText()
local a = OpacitySliderFrame:GetValue()
a = (1 - a) * 100
a = floor(a +.05)
ColorPPBoxA:SetText(format("%d", a))
end
local function UpdateColorTexts(r, g, b)
if not r then r, g, b = ColorPickerFrame:GetColorRGB() end
r = r*255
g = g*255
b = b*255
ColorPPBoxR:SetText(format("%d", r))
ColorPPBoxG:SetText(format("%d", g))
ColorPPBoxB:SetText(format("%d", b))
ColorPPBoxH:SetText(format("%.2x%.2x%.2x", r, g, b))
end
function B:EnhanceColorPicker()
if IsAddOnLoaded("ColorPickerPlus") then return end
ColorPickerFrame:SetClampedToScreen(true)
--Skin the default frame, move default buttons into place
E:SetTemplate(ColorPickerFrame, "Transparent")
ColorPickerFrameHeader:SetTexture("")
ColorPickerFrameHeader:ClearAllPoints()
ColorPickerFrameHeader:SetPoint("TOP", ColorPickerFrame, 0, 0)
S:HandleButton(ColorPickerOkayButton)
S:HandleButton(ColorPickerCancelButton)
ColorPickerCancelButton:ClearAllPoints()
ColorPickerOkayButton:ClearAllPoints()
ColorPickerCancelButton:SetPoint("BOTTOMRIGHT", ColorPickerFrame, "BOTTOMRIGHT", -6, 6)
ColorPickerCancelButton:SetPoint("BOTTOMLEFT", ColorPickerFrame, "BOTTOM", 0, 6)
ColorPickerOkayButton:SetPoint("BOTTOMLEFT", ColorPickerFrame,"BOTTOMLEFT", 6,6)
ColorPickerOkayButton:SetPoint("RIGHT", ColorPickerCancelButton,"LEFT", -4,0)
S:HandleSliderFrame(OpacitySliderFrame)
HookScript(ColorPickerFrame, "OnShow", function()
-- get color that will be replaced
local r, g, b = ColorPickerFrame:GetColorRGB()
ColorPPOldColorSwatch:SetTexture(r, g, b)
-- show/hide the alpha box
if ColorPickerFrame.hasOpacity then
ColorPPBoxA:Show()
ColorPPBoxLabelA:Show()
ColorPPBoxH:SetScript("OnTabPressed", function() ColorPPBoxA:SetFocus() end)
UpdateAlphaText()
this:SetWidth(405)
else
ColorPPBoxA:Hide()
ColorPPBoxLabelA:Hide()
ColorPPBoxH:SetScript("OnTabPressed", function() ColorPPBoxR:SetFocus() end)
this:SetWidth(345)
end
end)
--Memory Fix, Colorpicker will call the self.func() 100x per second, causing fps/memory issues,
--this little script will make you have to press ok for you to notice any changes.
ColorPickerFrame:SetScript("OnColorSelect", function(_, r, g, b)
ColorSwatch:SetTexture(r, g, b)
if not editingText then
UpdateColorTexts(r, g, b)
end
end)
HookScript(ColorPickerOkayButton, "OnClick", function()
collectgarbage() --Couldn't hurt to do this, this button usually executes a lot of code.
end)
HookScript(OpacitySliderFrame, "OnValueChanged", function()
if not editingText then
UpdateAlphaText()
end
end)
-- make the Color Picker dialog a bit taller, to make room for edit boxes
ColorPickerFrame:SetHeight(ColorPickerFrame:GetHeight() + 40)
-- move the Color Swatch
ColorSwatch:ClearAllPoints()
ColorSwatch:SetPoint("TOPLEFT", ColorPickerFrame, "TOPLEFT", 215, -45)
-- add Color Swatch for original color
local t = ColorPickerFrame:CreateTexture("ColorPPOldColorSwatch")
local w, h = ColorSwatch:GetWidth(), ColorSwatch:GetHeight()
t:SetWidth(w*0.75)
t:SetHeight(h*0.75)
t:SetTexture(0,0,0)
-- OldColorSwatch to appear beneath ColorSwatch
t:SetDrawLayer("BORDER")
t:SetPoint("BOTTOMLEFT", "ColorSwatch", "TOPRIGHT", -(w/2), -(h/3))
-- add Color Swatch for the copied color
t = ColorPickerFrame:CreateTexture("ColorPPCopyColorSwatch")
t:SetWidth(w)
t:SetHeight(h)
t:SetTexture(0,0,0)
t:Hide()
-- add copy button to the ColorPickerFrame
local b = CreateFrame("Button", "ColorPPCopy", ColorPickerFrame, "UIPanelButtonTemplate")
S:HandleButton(b)
b:SetText(L["Copy"])
b:SetWidth(60)
b:SetHeight(22)
b:SetPoint("TOPLEFT", "ColorSwatch", "BOTTOMLEFT", 0, -5)
-- copy color into buffer on button click
b:SetScript("OnClick", function()
-- copy current dialog colors into buffer
colorBuffer.r, colorBuffer.g, colorBuffer.b = ColorPickerFrame:GetColorRGB()
-- enable Paste button and display copied color into swatch
ColorPPPaste:Enable()
ColorPPCopyColorSwatch:SetTexture(colorBuffer.r, colorBuffer.g, colorBuffer.b)
ColorPPCopyColorSwatch:Show()
if ColorPickerFrame.hasOpacity then
colorBuffer.a = OpacitySliderFrame:GetValue()
else
colorBuffer.a = nil
end
end)
--class color button
b = CreateFrame("Button", "ColorPPClass", ColorPickerFrame, "UIPanelButtonTemplate")
b:SetText(CLASS)
S:HandleButton(b)
b:SetWidth(80)
b:SetHeight(22)
b:SetPoint("TOP", "ColorPPCopy", "BOTTOMRIGHT", 0, -7)
b:SetScript("OnClick", function()
local color = E.myclass == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
ColorPickerFrame:SetColorRGB(color.r, color.g, color.b)
ColorSwatch:SetTexture(color.r, color.g, color.b)
if ColorPickerFrame.hasOpacity then
OpacitySliderFrame:SetValue(0)
end
end)
-- add paste button to the ColorPickerFrame
b = CreateFrame("Button", "ColorPPPaste", ColorPickerFrame, "UIPanelButtonTemplate")
b:SetText(L["Paste"])
S:HandleButton(b)
b:SetWidth(60)
b:SetHeight(22)
b:SetPoint("TOPLEFT", "ColorPPCopy", "TOPRIGHT", 2, 0)
b:Disable() -- enable when something has been copied
-- paste color on button click, updating frame components
b:SetScript("OnClick", function()
ColorPickerFrame:SetColorRGB(colorBuffer.r, colorBuffer.g, colorBuffer.b)
ColorSwatch:SetTexture(colorBuffer.r, colorBuffer.g, colorBuffer.b)
if ColorPickerFrame.hasOpacity then
if colorBuffer.a then --color copied had an alpha value
OpacitySliderFrame:SetValue(colorBuffer.a)
end
end
end)
-- add defaults button to the ColorPickerFrame
b = CreateFrame("Button", "ColorPPDefault", ColorPickerFrame, "UIPanelButtonTemplate")
b:SetText(DEFAULTS)
S:HandleButton(b)
b:SetWidth(80)
b:SetHeight(22)
b:SetPoint("TOPLEFT", "ColorPPClass", "BOTTOMLEFT", 0, -7)
b:Disable() -- enable when something has been copied
b:SetScript("OnHide", function()
this.colors = nil
end)
b:SetScript("OnShow", function()
if this.colors then
this:Enable()
else
this:Disable()
end
end)
-- paste color on button click, updating frame components
b:SetScript("OnClick", function()
local colorBuffer = this.colors
ColorPickerFrame:SetColorRGB(colorBuffer.r, colorBuffer.g, colorBuffer.b)
ColorSwatch:SetTexture(colorBuffer.r, colorBuffer.g, colorBuffer.b)
if ColorPickerFrame.hasOpacity then
if colorBuffer.a then
OpacitySliderFrame:SetValue(colorBuffer.a)
end
end
end)
-- position Color Swatch for copy color
ColorPPCopyColorSwatch:SetPoint("BOTTOM", "ColorPPPaste", "TOP", 0, 10)
-- move the Opacity Slider Frame to align with bottom of Copy ColorSwatch
OpacitySliderFrame:ClearAllPoints()
OpacitySliderFrame:SetPoint("BOTTOM", "ColorPPDefault", "BOTTOM", 0, 0)
OpacitySliderFrame:SetPoint("RIGHT", "ColorPickerFrame", "RIGHT", -35, 18)
-- set up edit box frames and interior label and text areas
local boxes = { "R", "G", "B", "H", "A" }
for i = 1, getn(boxes) do
local rgb = boxes[i]
local box = CreateFrame("EditBox", "ColorPPBox"..rgb, ColorPickerFrame, "InputBoxTemplate")
S:HandleEditBox(box)
box:SetID(i)
box:SetFrameStrata("DIALOG")
box:SetAutoFocus(false)
box:SetTextInsets(0,14,0,0)
box:SetJustifyH("CENTER")
box:SetHeight(24)
if i == 4 then
-- Hex entry box
box:SetMaxLetters(6)
box:SetWidth(56)
box:SetNumeric(false)
else
box:SetMaxLetters(3)
box:SetWidth(40)
box:SetNumeric(true)
end
box:SetPoint("TOP", "ColorPickerWheel", "BOTTOM", 0, -15)
-- label
local label = box:CreateFontString("ColorPPBoxLabel"..rgb, "ARTWORK", "GameFontNormalSmall")
label:SetTextColor(1, 1, 1)
label:SetPoint("RIGHT", "ColorPPBox"..rgb, "LEFT", -5, 0)
if i == 4 then
label:SetText("#")
else
label:SetText(rgb)
end
-- set up scripts to handle event appropriately
if i == 5 then
box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateAlphaText() end)
box:SetScript("OnEnterPressed", function() this:ClearFocus() UpdateAlphaText() end)
else
box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateColorTexts() end)
box:SetScript("OnEnterPressed", function() this:ClearFocus() UpdateColorTexts() end)
end
box:SetScript("OnEditFocusGained", function() this:HighlightText() end)
box:SetScript("OnEditFocusLost", function() this:HighlightText(0,0) end)
box:SetScript("OnTextSet", function() this:ClearFocus() end)
box:Show()
end
-- finish up with placement
ColorPPBoxA:SetPoint("RIGHT", "OpacitySliderFrame", "RIGHT", 10, 0)
ColorPPBoxH:SetPoint("RIGHT", "ColorPPDefault", "RIGHT", -10, 0)
ColorPPBoxB:SetPoint("RIGHT", "ColorPPDefault", "LEFT", -40, 0)
ColorPPBoxG:SetPoint("RIGHT", "ColorPPBoxB", "LEFT", -25, 0)
ColorPPBoxR:SetPoint("RIGHT", "ColorPPBoxG", "LEFT", -25, 0)
-- define the order of tab cursor movement
ColorPPBoxR:SetScript("OnTabPressed", function() ColorPPBoxG:SetFocus() end)
ColorPPBoxG:SetScript("OnTabPressed", function() ColorPPBoxB:SetFocus() end)
ColorPPBoxB:SetScript("OnTabPressed", function() ColorPPBoxH:SetFocus() end)
ColorPPBoxA:SetScript("OnTabPressed", function() ColorPPBoxR:SetFocus() end)
-- make the color picker movable.
local mover = CreateFrame("Frame", nil, ColorPickerFrame)
mover:SetPoint("TOPLEFT", ColorPickerFrame, "TOP", -60, 0)
mover:SetPoint("BOTTOMRIGHT", ColorPickerFrame, "TOP", 60, -15)
mover:EnableMouse(true)
mover:SetScript("OnMouseDown", function() ColorPickerFrame:StartMoving() end)
mover:SetScript("OnMouseUp", function() ColorPickerFrame:StopMovingOrSizing() end)
ColorPickerFrame:SetUserPlaced(true)
ColorPickerFrame:EnableKeyboard(false)
end
+21
View File
@@ -0,0 +1,21 @@
local E, L, DF = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Blizzard");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
function B:PositionDurabilityFrame()
DurabilityFrame:SetFrameStrata("HIGH")
local function SetPosition(self, _, parent)
if parent == "MinimapCluster" or parent == _G["MinimapCluster"] then
self:ClearAllPoints()
self:SetPoint("RIGHT", Minimap, "RIGHT")
self:SetScale(0.6)
end
end
hooksecurefunc(DurabilityFrame, "SetPoint", SetPosition)
end
+13
View File
@@ -0,0 +1,13 @@
local E, L, DF = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Blizzard");
--Cache global variables
--Lua functions
--WoW API / Variables
function B:PositionGMFrames()
TicketStatusFrame:ClearAllPoints()
TicketStatusFrame:SetPoint("TOPLEFT", E.UIParent, "TOPLEFT", 250, -5)
E:CreateMover(TicketStatusFrame, "GMMover", L["GM Ticket Frame"])
end
+9
View File
@@ -0,0 +1,9 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Blizzard.lua"/>
<Script file="AlertFrame.lua"/>
<Script file="ColorPicker.lua"/>
<Script file="WatchFrame.lua"/>
<Script file="GM.lua"/>
<Script file="Durablity.lua"/>
<Script file="CaptureBar.lua"/>
</Ui>
+42
View File
@@ -0,0 +1,42 @@
local E, L, DF = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Blizzard");
--Cache global variables
--Lua functions
local min = math.min
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local GetScreenWidth = GetScreenWidth
local GetScreenHeight = GetScreenHeight
local WatchFrameHolder = CreateFrame("Frame", "WatchFrameHolder", E.UIParent)
WatchFrameHolder:SetWidth(150)
WatchFrameHolder:SetHeight(22)
WatchFrameHolder:SetPoint("TOPRIGHT", E.UIParent, "TOPRIGHT", -135, -300)
function B:SetWatchFrameHeight()
local top = QuestWatchFrame:GetTop() or 0
local screenHeight = GetScreenHeight()
local gapFromTop = screenHeight - top
local maxHeight = screenHeight - gapFromTop
local watchFrameHeight = min(maxHeight, E.db.general.watchFrameHeight)
QuestWatchFrame:SetHeight(watchFrameHeight)
end
function B:MoveWatchFrame()
E:CreateMover(WatchFrameHolder, "WatchFrameMover", L["Watch Frame"])
WatchFrameHolder:SetAllPoints(WatchFrameMover)
QuestWatchFrame:ClearAllPoints()
QuestWatchFrame:SetPoint("TOP", WatchFrameHolder, "TOP")
B:SetWatchFrameHeight()
QuestWatchFrame:SetClampedToScreen(false)
hooksecurefunc(QuestWatchFrame, "SetPoint", function(_, _, parent)
if parent ~= WatchFrameHolder then
QuestWatchFrame:ClearAllPoints()
QuestWatchFrame:SetPoint("TOP", WatchFrameHolder, "TOP")
end
end)
end
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Chat.lua"/>
</Ui>
+66
View File
@@ -0,0 +1,66 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:NewModule("DataBars", "AceEvent-3.0");
E.DataBars = mod
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local UIFrameFadeOut = UIFrameFadeOut
function mod:OnLeave()
if (this == ElvUI_ExperienceBar and mod.db.experience.mouseover) or (this == ElvUI_ReputationBar and mod.db.reputation.mouseover) then
UIFrameFadeOut(this, 1, this:GetAlpha(), 0)
end
GameTooltip:Hide()
end
function mod:CreateBar(name, onEnter, onClick, ...)
local bar = CreateFrame("Button", name, E.UIParent)
bar:SetPoint(unpack(arg))
bar:SetScript("OnEnter", onEnter)
bar:SetScript("OnLeave", mod.OnLeave)
bar:SetScript("OnClick", onClick)
bar:SetFrameStrata("LOW")
E:SetTemplate(bar, "Transparent")
bar:Hide()
bar.statusBar = CreateFrame("StatusBar", nil, bar)
E:SetInside(bar.statusBar)
bar.statusBar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(bar.statusBar)
bar.text = bar.statusBar:CreateFontString(nil, "OVERLAY")
E:FontTemplate(bar.text)
bar.text:SetPoint("CENTER", 0, 0)
return bar
end
function mod:UpdateDataBarDimensions()
self:UpdateExperienceDimensions()
self:UpdateReputationDimensions()
end
function mod:PLAYER_LEVEL_UP(level, level2)
print(level, level2)
local maxLevel = 60
if (level ~= maxLevel or not self.db.experience.hideAtMaxLevel) and self.db.experience.enable then
self:UpdateExperience("PLAYER_LEVEL_UP", level)
else
self.expBar:Hide()
end
end
function mod:Initialize()
self.db = E.db.databars
self:LoadExperienceBar()
self:LoadReputationBar()
self:RegisterEvent("PLAYER_LEVEL_UP")
end
local function InitializeCallback()
mod:Initialize()
end
E:RegisterModule(mod:GetName(), InitializeCallback)
+166
View File
@@ -0,0 +1,166 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("DataBars");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local _G = _G
local format = format
local min = min
--WoW API / Variables
local GetPetExperience, UnitXP, UnitXPMax = GetPetExperience, UnitXP, UnitXPMax
local UnitLevel = UnitLevel
local GetXPExhaustion = GetXPExhaustion
function mod:GetXP(unit)
if unit == "pet" then
return GetPetExperience()
else
return UnitXP(unit), UnitXPMax(unit)
end
end
function mod:UpdateExperience(event)
if not mod.db.experience.enable then return end
local bar = self.expBar
local hideXP = (UnitLevel("player") == 60 and self.db.experience.hideAtMaxLevel)
if hideXP then
E:DisableMover(self.expBar.mover:GetName())
bar:Hide()
elseif not hideXP then
E:EnableMover(self.expBar.mover:GetName())
bar:Show()
local cur, max = self:GetXP("player")
if max <= 0 then max = 1 end
bar.statusBar:SetMinMaxValues(0, max)
bar.statusBar:SetValue(cur - 1 >= 0 and cur - 1 or 0)
bar.statusBar:SetValue(cur)
local rested = GetXPExhaustion()
local text = ""
local textFormat = self.db.experience.textFormat
if rested and rested > 0 then
bar.rested:SetMinMaxValues(0, max)
bar.rested:SetValue(min(cur + rested, max))
if textFormat == "PERCENT" then
text = format("%d%% R:%d%%", cur / max * 100, rested / max * 100)
elseif textFormat == "CURMAX" then
text = format("%s - %s R:%s", E:ShortValue(cur), E:ShortValue(max), E:ShortValue(rested))
elseif textFormat == "CURPERC" then
text = format("%s - %d%% R:%s [%d%%]", E:ShortValue(cur), cur / max * 100, E:ShortValue(rested), rested / max * 100)
elseif textFormat == "CUR" then
text = format("%s R:%s", E:ShortValue(cur), E:ShortValue(rested))
elseif textFormat == "REM" then
text = format("%s R:%s", E:ShortValue(max - cur), E:ShortValue(rested))
elseif textFormat == "CURREM" then
text = format("%s - %s R:%s", E:ShortValue(cur), E:ShortValue(max - cur), E:ShortValue(rested))
elseif textFormat == "CURPERCREM" then
text = format("%s - %d%% (%s) R:%s", E:ShortValue(cur), cur / max * 100, E:ShortValue(max - cur), E:ShortValue(rested))
end
else
bar.rested:SetMinMaxValues(0, 1)
bar.rested:SetValue(0)
if textFormat == "PERCENT" then
text = format("%d%%", cur / max * 100)
elseif textFormat == "CURMAX" then
text = format("%s - %s", E:ShortValue(cur), E:ShortValue(max))
elseif textFormat == "CURPERC" then
text = format("%s - %d%%", E:ShortValue(cur), cur / max * 100)
elseif textFormat == "CUR" then
text = format("%s", E:ShortValue(cur))
elseif textFormat == "REM" then
text = format("%s", E:ShortValue(max - cur))
elseif textFormat == "CURREM" then
text = format("%s - %s", E:ShortValue(cur), E:ShortValue(max - cur))
elseif textFormat == "CURPERCREM" then
text = format("%s - %d%% (%s)", E:ShortValue(cur), cur / max * 100, E:ShortValue(max - cur))
end
end
bar.text:SetText(text)
end
end
function mod:ExperienceBar_OnEnter()
if mod.db.experience.mouseover then
UIFrameFadeIn(this, 0.4, this:GetAlpha(), 1)
end
GameTooltip:ClearLines()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR", 0, -4)
local cur, max = mod:GetXP("player")
local rested = GetXPExhaustion()
GameTooltip:AddLine(L["Experience"])
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine(L["XP:"], format(" %d / %d (%d%%)", cur, max, cur/max * 100), 1, 1, 1)
GameTooltip:AddDoubleLine(L["Remaining:"], format(" %d (%d%% - %d "..L["Bars"]..")", max - cur, (max - cur) / max * 100, 20 * (max - cur) / max), 1, 1, 1)
if rested then
GameTooltip:AddDoubleLine(L["Rested:"], format("+%d (%d%%)", rested, rested / max * 100), 1, 1, 1)
end
GameTooltip:Show()
end
function mod:ExperienceBar_OnClick()
end
function mod:UpdateExperienceDimensions()
self.expBar:SetWidth(self.db.experience.width)
self.expBar:SetHeight(self.db.experience.height)
E:FontTemplate(self.expBar.text, LSM:Fetch("font", self.db.experience.font), self.db.experience.textSize, self.db.experience.fontOutline)
self.expBar.rested:SetOrientation(self.db.experience.orientation)
self.expBar.statusBar:SetOrientation(self.db.experience.orientation)
if self.db.experience.mouseover then
self.expBar:SetAlpha(0)
else
self.expBar:SetAlpha(1)
end
end
function mod:EnableDisable_ExperienceBar()
local maxLevel = 60
if (UnitLevel("player") ~= maxLevel or not self.db.experience.hideAtMaxLevel) and self.db.experience.enable then
self:RegisterEvent("PLAYER_XP_UPDATE", "UpdateExperience")
self:RegisterEvent("DISABLE_XP_GAIN", "UpdateExperience")
self:RegisterEvent("ENABLE_XP_GAIN", "UpdateExperience")
self:RegisterEvent("UPDATE_EXHAUSTION", "UpdateExperience")
self:UnregisterEvent("UPDATE_EXPANSION_LEVEL")
self:UpdateExperience()
E:EnableMover(self.expBar.mover:GetName())
else
self:UnregisterEvent("PLAYER_XP_UPDATE")
self:UnregisterEvent("DISABLE_XP_GAIN")
self:UnregisterEvent("ENABLE_XP_GAIN")
self:UnregisterEvent("UPDATE_EXHAUSTION")
self:RegisterEvent("UPDATE_EXPANSION_LEVEL", "EnableDisable_ExperienceBar")
self.expBar:Hide()
E:DisableMover(self.expBar.mover:GetName())
end
end
function mod:LoadExperienceBar()
self.expBar = self:CreateBar("ElvUI_ExperienceBar", self.ExperienceBar_OnEnter, self.ExperienceBar_OnClick, "LEFT", LeftChatPanel, "RIGHT", -E.Border + E.Spacing*3, 0)
self.expBar.statusBar:SetStatusBarColor(0, 0.4, 1, .8)
self.expBar.rested = CreateFrame("StatusBar", nil, self.expBar)
E:SetInside(self.expBar.rested)
self.expBar.rested:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(self.expBar.rested)
self.expBar.rested:SetStatusBarColor(1, 0, 1, 0.2)
self:UpdateExperienceDimensions()
E:CreateMover(self.expBar, "ExperienceBarMover", L["Experience Bar"])
self:EnableDisable_ExperienceBar()
end
+5
View File
@@ -0,0 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="DataBars.lua"/>
<Script file="Experience.lua"/>
<Script file="Reputation.lua"/>
</Ui>
+132
View File
@@ -0,0 +1,132 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("DataBars");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local _G = _G
local format = format
--WoW API / Variables
local GetWatchedFactionInfo, GetNumFactions, GetFactionInfo = GetWatchedFactionInfo, GetNumFactions, GetFactionInfo
local InCombatLockdown = InCombatLockdown
local FACTION_BAR_COLORS = FACTION_BAR_COLORS
local REPUTATION, STANDING = REPUTATION, STANDING
local backupColor = FACTION_BAR_COLORS[1]
local FactionStandingLabelUnknown = UNKNOWN
function mod:UpdateReputation(event)
if not mod.db.reputation.enable then return end
local bar = self.repBar
local ID, standingLabel
local name, reaction, min, max, value = GetWatchedFactionInfo()
local numFactions = GetNumFactions()
if not name then
bar:Hide()
elseif name then
bar:Show()
local text = ""
local textFormat = self.db.reputation.textFormat
local color = FACTION_BAR_COLORS[reaction] or backupColor
bar.statusBar:SetStatusBarColor(color.r, color.g, color.b)
bar.statusBar:SetMinMaxValues(min, max)
bar.statusBar:SetValue(value)
for i = 1, numFactions do
local factionName, _, standingID = GetFactionInfo(i)
if factionName == name then
ID = standingID;
end
end
if ID then
standingLabel = _G["FACTION_STANDING_LABEL"..ID]
else
standingLabel = FactionStandingLabelUnknown
end
--Prevent a division by zero
local maxMinDiff = max - min
if maxMinDiff == 0 then
maxMinDiff = 1
end
if textFormat == "PERCENT" then
text = format("%s: %d%% [%s]", name, ((value - min) / maxMinDiff * 100), standingLabel)
elseif textFormat == "CURMAX" then
text = format("%s: %s - %s [%s]", name, E:ShortValue(value - min), E:ShortValue(max - min), standingLabel)
elseif textFormat == "CURPERC" then
text = format("%s: %s - %d%% [%s]", name, E:ShortValue(value - min), ((value - min) / maxMinDiff * 100), standingLabel)
elseif textFormat == "CUR" then
text = format("%s: %s [%s]", name, E:ShortValue(value - min), standingLabel)
elseif textFormat == "REM" then
text = format("%s: %s [%s]", name, E:ShortValue((max - min) - (value-min)), standingLabel)
elseif textFormat == "CURREM" then
text = format("%s: %s - %s [%s]", name, E:ShortValue(value - min), E:ShortValue((max - min) - (value-min)), standingLabel)
elseif textFormat == "CURPERCREM" then
text = format("%s: %s - %d%% (%s) [%s]", name, E:ShortValue(value - min), ((value - min) / maxMinDiff * 100), E:ShortValue((max - min) - (value-min)), standingLabel)
end
bar.text:SetText(text)
end
end
function mod:ReputationBar_OnEnter()
if mod.db.reputation.mouseover then
UIFrameFadeIn(this, 0.4, this:GetAlpha(), 1)
end
GameTooltip:ClearLines()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR", 0, -4)
local name, reaction, min, max, value = GetWatchedFactionInfo()
if name then
GameTooltip:AddLine(name)
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine(STANDING..":", _G["FACTION_STANDING_LABEL"..reaction], 1, 1, 1)
GameTooltip:AddDoubleLine(REPUTATION..":", format("%d / %d (%d%%)", value - min, max - min, (value - min) / ((max - min == 0) and max or (max - min)) * 100), 1, 1, 1)
end
GameTooltip:Show()
end
function mod:ReputationBar_OnClick()
ToggleCharacter("ReputationFrame");
end
function mod:UpdateReputationDimensions()
self.repBar:SetWidth(self.db.reputation.width)
self.repBar:SetHeight(self.db.reputation.height)
self.repBar.statusBar:SetOrientation(self.db.reputation.orientation)
E:FontTemplate(self.repBar.text, LSM:Fetch("font", self.db.reputation.font), self.db.reputation.textSize, self.db.reputation.fontOutline)
if self.db.reputation.mouseover then
self.repBar:SetAlpha(0)
else
self.repBar:SetAlpha(1)
end
end
function mod:EnableDisable_ReputationBar()
if self.db.reputation.enable then
self:RegisterEvent("UPDATE_FACTION", "UpdateReputation")
self:UpdateReputation()
E:EnableMover(self.repBar.mover:GetName())
else
self:UnregisterEvent("UPDATE_FACTION")
self.repBar:Hide()
E:DisableMover(self.repBar.mover:GetName())
end
end
function mod:LoadReputationBar()
self.repBar = self:CreateBar("ElvUI_ReputationBar", self.ReputationBar_OnEnter, self.ReputationBar_OnClick, "RIGHT", RightChatPanel, "LEFT", E.Border - E.Spacing*3, 0)
E:RegisterStatusBar(self.repBar.statusBar)
self:UpdateReputationDimensions()
E:CreateMover(self.repBar, "ReputationBarMover", L["Reputation Bar"])
self:EnableDisable_ReputationBar()
end
+70
View File
@@ -0,0 +1,70 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local format = string.format
local join = string.join
--WoW API / Variables
local UnitArmor = UnitArmor
local UnitLevel = UnitLevel
local ARMOR = ARMOR
local lastPanel
local chanceString = "%.2f%%"
local displayString = ""
local _, effectiveArmor
local function GetArmorReduction(armor, attackerLevel)
local levelModifier = attackerLevel
if levelModifier > 59 then
levelModifier = levelModifier + (4.5 * (levelModifier - 59))
end
local temp = 0.1 * armor/(8.5 * levelModifier + 40)
temp = temp/(1 + temp)
if temp > 0.75 then return 75 end
if temp < 0 then return 0 end
return temp*100
end
local function OnEvent(self)
_, effectiveArmor = UnitArmor("player")
self.text:SetText(format(displayString, ARMOR, effectiveArmor))
lastPanel = self
end
local function OnEnter(self)
DT:SetupTooltip(self)
DT.tooltip:AddLine(L["Mitigation By Level: "])
DT.tooltip:AddLine(" ")
local playerLevel = UnitLevel("player") + 3
for i = 1, 4 do
local armorReduction = GetArmorReduction(effectiveArmor, playerLevel)
DT.tooltip:AddDoubleLine(playerLevel, format(chanceString, armorReduction), 1, 1, 1)
playerLevel = playerLevel - 1
end
local targetLevel = UnitLevel("target")
if targetLevel and targetLevel > 0 and (targetLevel > playerLevel + 3 or targetLevel < playerLevel) then
local armorReduction = GetArmorReduction(effectiveArmor, targetLevel)
DT.tooltip:AddDoubleLine(targetLevel, format(chanceString, armorReduction), 1, 1, 1)
end
DT.tooltip:Show()
end
local function ValueColorUpdate(hex)
displayString = join("", "%s: ", hex, "%d|r")
if lastPanel ~= nil then
OnEvent(lastPanel)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Armor", {"UNIT_RESISTANCES"}, OnEvent, nil, nil, OnEnter, nil, ARMOR)
+66
View File
@@ -0,0 +1,66 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local max = math.max
local format, join, sub = string.format, string.join, string.sub
--WoW API / Variables
local UnitAttackPower = UnitAttackPower
local UnitRangedAttackPower = UnitRangedAttackPower
local ATTACK_POWER_COLON = ATTACK_POWER_COLON
local ATTACK_POWER_MAGIC_NUMBER = ATTACK_POWER_MAGIC_NUMBER
local MELEE_ATTACK_POWER = MELEE_ATTACK_POWER
local MELEE_ATTACK_POWER_TOOLTIP = MELEE_ATTACK_POWER_TOOLTIP
local RANGED_ATTACK_POWER = RANGED_ATTACK_POWER
local RANGED_ATTACK_POWER_TOOLTIP = RANGED_ATTACK_POWER_TOOLTIP
local ATTACK_POWER_TOOLTIP = ATTACK_POWER_TOOLTIP
local ATTACK_POWER = sub(ATTACK_POWER_COLON, 1, -2)
local base, posBuff, negBuff, effective, Rbase, RposBuff, RnegBuff, Reffective, pwr
local displayNumberString = ""
local lastPanel
local function OnEvent(self)
if(E.myclass == "HUNTER") then
Rbase, RposBuff, RnegBuff = UnitRangedAttackPower("player")
Reffective = Rbase + RposBuff + RnegBuff
pwr = Reffective
else
base, posBuff, negBuff = UnitAttackPower("player")
effective = base + posBuff + negBuff
pwr = effective
end
self.text:SetText(format(displayNumberString, ATTACK_POWER, pwr))
lastPanel = self
end
local function OnEnter(self)
DT:SetupTooltip(self)
if(E.myclass == "HUNTER") then
DT.tooltip:AddDoubleLine(RANGED_ATTACK_POWER, pwr, 1, 1, 1)
local line = format(RANGED_ATTACK_POWER_TOOLTIP, max((pwr), 0) / ATTACK_POWER_MAGIC_NUMBER)
DT.tooltip:AddLine(line, nil, nil, nil, true)
else
DT.tooltip:AddDoubleLine(MELEE_ATTACK_POWER, pwr, 1, 1, 1)
DT.tooltip:AddLine(format(MELEE_ATTACK_POWER_TOOLTIP, max((base + posBuff + negBuff), 0) / ATTACK_POWER_MAGIC_NUMBER), nil, nil, nil, true)
end
DT.tooltip:Show()
end
local function ValueColorUpdate(hex)
displayNumberString = join("", "%s: ", hex, "%d|r")
if(lastPanel ~= nil) then
OnEvent(lastPanel)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Attack Power", {"UNIT_ATTACK_POWER", "UNIT_RANGED_ATTACK_POWER"}, OnEvent, nil, nil, OnEnter, nil, ATTACK_POWER_TOOLTIP)
+124
View File
@@ -0,0 +1,124 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local format, join = string.format, string.join
local abs = math.abs
--WoW API / Variables
local GetInventorySlotInfo = GetInventorySlotInfo
local GetInventoryItemID = GetInventoryItemID
local GetItemInfo = GetItemInfo
local UnitLevel = UnitLevel
local GetDodgeChance = GetDodgeChance
local GetParryChance = GetParryChance
local GetBlockChance = GetBlockChance
local GetBonusBarOffset = GetBonusBarOffset
local BOSS = BOSS
local DODGE_CHANCE = DODGE_CHANCE
local PARRY_CHANCE = PARRY_CHANCE
local BLOCK_CHANCE = BLOCK_CHANCE
DEFENSE = "Defense";
DODGE_CHANCE = "Dodge Chance";
PARRY_CHANCE = "Parry Chance";
BLOCK_CHANCE = "Block Chance";
local displayString, lastPanel
local targetlv, playerlv
local baseMissChance, levelDifference, dodge, parry, block, avoidance, unhittable
local chanceString = "%.2f%%"
local AVD_DECAY_RATE = 0.2
local function IsWearingShield()
local slotID = GetInventorySlotInfo("SecondaryHandSlot")
local itemID = nil
if itemID then
return select(9, GetItemInfo(itemID))
end
end
local function OnEvent(self)
targetlv, playerlv = UnitLevel("target"), UnitLevel("player")
baseMissChance = E.myrace == "NightElf" and 7 or 5
if targetlv == -1 then
levelDifference = 3
elseif targetlv > playerlv then
levelDifference = (targetlv - playerlv)
elseif targetlv < playerlv and targetlv > 0 then
levelDifference = (targetlv - playerlv)
else
levelDifference = 0
end
if levelDifference >= 0 then
dodge = (GetDodgeChance() - levelDifference * AVD_DECAY_RATE)
parry = (GetParryChance() - levelDifference * AVD_DECAY_RATE)
block = (GetBlockChance() - levelDifference * AVD_DECAY_RATE)
baseMissChance = (baseMissChance - levelDifference * AVD_DECAY_RATE)
else
dodge = (GetDodgeChance() + abs(levelDifference * AVD_DECAY_RATE))
parry = (GetParryChance() + abs(levelDifference * AVD_DECAY_RATE))
block = (GetBlockChance() + abs(levelDifference * AVD_DECAY_RATE))
baseMissChance = (baseMissChance+ abs(levelDifference * AVD_DECAY_RATE))
end
if dodge <= 0 then dodge = 0 end
if parry <= 0 then parry = 0 end
if block <= 0 then block = 0 end
if E.myclass == "DRUID" and GetBonusBarOffset() == 3 then
parry = 0
end
if IsWearingShield() ~= "INVTYPE_SHIELD" then
block = 0
end
avoidance = (dodge + parry + block + baseMissChance)
unhittable = avoidance - 102.4
self.text:SetText(format(displayString, DEFENSE, avoidance))
lastPanel = self
end
local function OnEnter(self)
DT:SetupTooltip(self)
if targetlv > 1 then
DT.tooltip:AddDoubleLine(L["Avoidance Breakdown"], join("", " (", L["lvl"], " ", targetlv, ")"))
elseif targetlv == -1 then
DT.tooltip:AddDoubleLine(L["Avoidance Breakdown"], join("", " (", BOSS, ")"))
else
DT.tooltip:AddDoubleLine(L["Avoidance Breakdown"], join("", " (", L["lvl"], " ", playerlv, ")"))
end
DT.tooltip:AddLine(" ")
DT.tooltip:AddDoubleLine(DODGE_CHANCE, format(chanceString, dodge), 1, 1, 1)
DT.tooltip:AddDoubleLine(PARRY_CHANCE, format(chanceString, parry), 1, 1, 1)
DT.tooltip:AddDoubleLine(BLOCK_CHANCE, format(chanceString, block), 1, 1, 1)
DT.tooltip:AddDoubleLine(L["Miss Chance"], format(chanceString, baseMissChance), 1, 1, 1)
DT.tooltip:AddLine(" ")
if unhittable > 0 then
DT.tooltip:AddDoubleLine(L["Unhittable:"], "+" .. format(chanceString, unhittable), 1, 1, 1, 0, 1, 0)
else
DT.tooltip:AddDoubleLine(L["Unhittable:"], format(chanceString, unhittable), 1, 1, 1, 1, 0, 0)
end
DT.tooltip:Show()
end
local function ValueColorUpdate(hex)
displayString = join("", "%s: ", hex, "%.2f%%|r")
if lastPanel ~= nil then
OnEvent(lastPanel)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Avoidance", {"COMBAT_RATING_UPDATE", "PLAYER_TARGET_CHANGED"}, OnEvent, nil, nil, OnEnter, nil, L["Avoidance Breakdown"])
+322
View File
@@ -0,0 +1,322 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:NewModule("DataTexts", "AceTimer-3.0", "AceHook-3.0", "AceEvent-3.0");
local LDB = LibStub:GetLibrary("LibDataBroker-1.1");
local LSM = LibStub("LibSharedMedia-3.0");
local TT = E:GetModule("Tooltip");
local pairs, type, error = pairs, type, error
local len = string.len
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
local IsInInstance = IsInInstance
function DT:Initialize()
E.DataTexts = DT
self.tooltip = CreateFrame("GameTooltip", "DatatextTooltip", E.UIParent, "GameTooltipTemplate")
DatatextTooltipTextLeft1:SetFontObject(GameTooltipText)
DatatextTooltipTextRight1:SetFontObject(GameTooltipText)
TT:HookScript(self.tooltip, "OnShow", "SetStyle")
self:RegisterLDB()
LDB.RegisterCallback(E, "LibDataBroker_DataObjectCreated", DT.SetupObjectLDB)
self:LoadDataTexts()
self:RegisterEvent("PLAYER_ENTERING_WORLD")
end
DT.RegisteredPanels = {}
DT.RegisteredDataTexts = {}
DT.PointLocation = {
[1] = "middle",
[2] = "left",
[3] = "right"
}
local hasEnteredWorld = false
function DT:PLAYER_ENTERING_WORLD()
hasEnteredWorld = true
self:LoadDataTexts()
end
local function LoadDataTextsDelayed()
E.Delay(0.5, function() DT:LoadDataTexts() end)
end
local hex = "|cffFFFFFF"
function DT:SetupObjectLDB(name, obj)
local curFrame = nil
local function OnEnter()
DT:SetupTooltip(this)
if obj.OnTooltipShow then
obj.OnTooltipShow(DT.tooltip)
end
if obj.OnEnter then
obj.OnEnter(this)
end
DT.tooltip:Show()
end
local function OnLeave()
if obj.OnLeave then
obj.OnLeave(this)
end
DT.tooltip:Hide()
end
local function OnClick(self, button)
if obj.OnClick then
obj.OnClick(self, button)
end
end
local function textUpdate(_, name, _, value)
if value == nil or (len(value) >= 3) or value == "n/a" or name == value then
curFrame.text:SetText(value ~= "n/a" and value or name)
else
curFrame.text:SetText(format("%s: %s%s|r", name, hex, value))
end
end
local function OnEvent(self)
curFrame = self
LDB:RegisterCallback("LibDataBroker_AttributeChanged_"..name.."_text", textUpdate)
LDB:RegisterCallback("LibDataBroker_AttributeChanged_"..name.."_value", textUpdate)
LDB.callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_text", name, nil, obj.text, obj)
end
DT:RegisterDatatext(name, {"PLAYER_ENTER_WORLD"}, OnEvent, nil, OnClick, OnEnter, OnLeave)
if DT.PanelLayoutOptions then
DT:PanelLayoutOptions()
end
if hasEnteredWorld then
LoadDataTextsDelayed()
end
end
function DT:RegisterLDB()
for name, obj in LDB:DataObjectIterator() do
self:SetupObjectLDB(name, obj)
end
end
local function ValueColorUpdate(newHex)
hex = newHex
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
function DT:GetDataPanelPoint(panel, i, numPoints)
if(numPoints == 1) then
return "CENTER", panel, "CENTER"
else
if(i == 1) then
return "CENTER", panel, "CENTER"
elseif(i == 2) then
return "RIGHT", panel.dataPanels["middle"], "LEFT", -4, 0
elseif(i == 3) then
return "LEFT", panel.dataPanels["middle"], "RIGHT", 4, 0
end
end
end
function DT:UpdateAllDimensions()
for _, panel in pairs(DT.RegisteredPanels) do
local width = (panel:GetWidth() / panel.numPoints) - 4
local height = panel:GetHeight() - 4
for i = 1, panel.numPoints do
local pointIndex = DT.PointLocation[i]
panel.dataPanels[pointIndex]:SetWidth(width)
panel.dataPanels[pointIndex]:SetHeight(height)
panel.dataPanels[pointIndex]:SetPoint(DT:GetDataPanelPoint(panel, i, panel.numPoints))
end
end
end
function DT:Data_OnLeave()
DT.tooltip:Hide()
end
function DT:SetupTooltip(panel)
local parent = panel:GetParent()
self.tooltip:Hide()
self.tooltip:SetOwner(parent, parent.anchor, parent.xOff, parent.yOff)
self.tooltip:ClearLines()
GameTooltip:Hide()
end
function DT:RegisterPanel(panel, numPoints, anchor, xOff, yOff)
DT.RegisteredPanels[panel:GetName()] = panel
panel.dataPanels = {}
panel.numPoints = numPoints
panel.xOff = xOff
panel.yOff = yOff
panel.anchor = anchor
for i = 1, numPoints do
local pointIndex = DT.PointLocation[i]
if not panel.dataPanels[pointIndex] then
panel.dataPanels[pointIndex] = CreateFrame("Button", panel:GetName().."DataText"..i, panel)
panel.dataPanels[pointIndex]:RegisterForClicks("LeftButtonUp", "RightButtonUp")
panel.dataPanels[pointIndex].text = panel.dataPanels[pointIndex]:CreateFontString(nil, "OVERLAY")
panel.dataPanels[pointIndex].text:SetAllPoints()
E:FontTemplate(panel.dataPanels[pointIndex].text)
panel.dataPanels[pointIndex].text:SetJustifyH("CENTER")
panel.dataPanels[pointIndex].text:SetJustifyV("MIDDLE")
end
panel.dataPanels[pointIndex]:SetPoint(DT:GetDataPanelPoint(panel, i, numPoints))
end
panel:SetScript("OnSizeChanged", DT.UpdateAllDimensions)
DT.UpdateAllDimensions(panel)
end
function DT:AssignPanelToDataText(panel, data)
panel.name = ""
if data["name"] then
panel.name = data["name"]
end
if data["events"] then
for _, event in pairs(data["events"]) do
-- random error 132
if event == "PLAYER_ENTERING_WORLD" then
event = "PLAYER_LOGIN"
end
panel:RegisterEvent(event)
end
end
if data["eventFunc"] then
panel:SetScript("OnEvent", function()
data["eventFunc"](this, event)
end)
data["eventFunc"](panel, "ELVUI_FORCE_RUN")
end
if data["onUpdate"] then
panel:SetScript("OnUpdate", function()
data["onUpdate"](this, arg1)
end)
data["onUpdate"](panel, 20000)
end
if data["onClick"] then
panel:SetScript("OnClick", function()
data["onClick"](this, arg1)
end)
end
if data["onEnter"] then
panel:SetScript("OnEnter", function()
data["onEnter"](this)
end)
end
if data["onLeave"] then
panel:SetScript("OnLeave", function()
data["onLeave"](this)
end)
else
panel:SetScript("OnLeave", DT.Data_OnLeave)
end
end
function DT:LoadDataTexts()
self.db = E.db.datatexts
LDB:UnregisterAllCallbacks(self)
local inInstance, instanceType = IsInInstance()
local fontTemplate = LSM:Fetch("font", self.db.font)
for panelName, panel in pairs(DT.RegisteredPanels) do
for i = 1, panel.numPoints do
local pointIndex = DT.PointLocation[i]
panel.dataPanels[pointIndex]:UnregisterAllEvents()
panel.dataPanels[pointIndex]:SetScript("OnUpdate", nil)
panel.dataPanels[pointIndex]:SetScript("OnEnter", nil)
panel.dataPanels[pointIndex]:SetScript("OnLeave", nil)
panel.dataPanels[pointIndex]:SetScript("OnClick", nil)
E:FontTemplate(panel.dataPanels[pointIndex].text, fontTemplate, self.db.fontSize, self.db.fontOutline)
panel.dataPanels[pointIndex].text:SetText(nil)
panel.dataPanels[pointIndex].pointIndex = pointIndex
if (panelName == "LeftChatDataPanel" or panelName == "RightChatDataPanel") and (inInstance and (instanceType == "pvp")) and not DT.ForceHideBGStats and E.db.datatexts.battleground then
panel.dataPanels[pointIndex]:RegisterEvent("UPDATE_BATTLEFIELD_SCORE")
panel.dataPanels[pointIndex]:RegisterEvent("PLAYER_REGEN_ENABLED")
panel.dataPanels[pointIndex]:SetScript("OnEvent", DT.UPDATE_BATTLEFIELD_SCORE)
panel.dataPanels[pointIndex]:SetScript("OnEnter", DT.BattlegroundStats)
panel.dataPanels[pointIndex]:SetScript("OnLeave", DT.Data_OnLeave)
panel.dataPanels[pointIndex]:SetScript("OnClick", DT.HideBattlegroundTexts)
DT.UPDATE_BATTLEFIELD_SCORE(panel.dataPanels[pointIndex])
else
for name, data in pairs(DT.RegisteredDataTexts) do
for option, value in pairs(self.db.panels) do
if value and type(value) == "table" then
if option == panelName and self.db.panels[option][pointIndex] and self.db.panels[option][pointIndex] == name then
DT:AssignPanelToDataText(panel.dataPanels[pointIndex], data)
end
elseif value and type(value) == "string" and value == name then
if self.db.panels[option] == name and option == panelName then
DT:AssignPanelToDataText(panel.dataPanels[pointIndex], data)
end
end
end
end
end
end
end
if DT.ForceHideBGStats then
DT.ForceHideBGStats = nil
end
end
function DT:RegisterDatatext(name, events, eventFunc, updateFunc, clickFunc, onEnterFunc, onLeaveFunc, localizedName)
if name then
DT.RegisteredDataTexts[name] = {}
else
error("Cannot register datatext no name was provided.")
end
DT.RegisteredDataTexts[name]["name"] = name
if type(events) ~= "table" and events ~= nil then
error("Events must be registered as a table.")
else
DT.RegisteredDataTexts[name]["events"] = events
DT.RegisteredDataTexts[name]["eventFunc"] = eventFunc
end
if updateFunc and type(updateFunc) == "function" then
DT.RegisteredDataTexts[name]["onUpdate"] = updateFunc
end
if clickFunc and type(clickFunc) == "function" then
DT.RegisteredDataTexts[name]["onClick"] = clickFunc
end
if onEnterFunc and type(onEnterFunc) == "function" then
DT.RegisteredDataTexts[name]["onEnter"] = onEnterFunc
end
if onLeaveFunc and type(onLeaveFunc) == "function" then
DT.RegisteredDataTexts[name]["onLeave"] = onLeaveFunc
end
if localizedName and type(localizedName) == "string" then
DT.RegisteredDataTexts[name]["localizedName"] = localizedName
end
end
local function InitializeCallback()
DT:Initialize()
end
E:RegisterModule(DT:GetName(), InitializeCallback)
+102
View File
@@ -0,0 +1,102 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local _G = _G
local pairs = pairs
local format, join, upper = string.format, string.join, string.upper
--WoW API / Variables
local GetInventoryItemDurability = GetInventoryItemDurability
local GetInventoryItemTexture = GetInventoryItemTexture
local GetInventorySlotInfo = GetInventorySlotInfo
local ToggleCharacter = ToggleCharacter
local DURABILITY_TEMPLATE = string.gsub(DURABILITY_TEMPLATE, "%%d / %%d", "(%%d+) / (%%d+)")
local DURABILITY = "Durability" -- Neel ElvUI locale
local displayString = ""
local tooltipString = "%d%%"
local totalDurability = 0
local current, max, lastPanel
local invDurability = {}
local slots = {
"RangedSlot",
"SecondaryHandSlot",
"MainHandSlot",
"FeetSlot",
"LegsSlot",
"HandsSlot",
"WristSlot",
"WaistSlot",
"ChestSlot",
"ShoulderSlot",
"HeadSlot"
}
local scan
local function GetInventoryItemDurability(slot)
if not GetInventoryItemTexture("player", slot) then return nil, nil end
if not scan then
scan = CreateFrame("GameTooltip", "DurabilityScan", nil, "ShoppingTooltipTemplate")
scan:SetOwner(UIParent, "ANCHOR_NONE")
end
scan:ClearLines()
scan:SetInventoryItem("player", slot)
for i = 4, scan:NumLines() do
local text = _G[scan:GetName().."TextLeft"..i]:GetText()
for durability, max in string.gfind(text, DURABILITY_TEMPLATE) do
return tonumber(durability), tonumber(max)
end
end
end
local function OnEvent(self, t)
lastPanel = self
totalDurability = 100
for _, value in pairs(slots) do
local slot = GetInventorySlotInfo(value)
current, max = GetInventoryItemDurability(slot)
if current then
current, max = GetInventoryItemDurability(slot)
invDurability[value] = (current / max) * 100
if ((current / max) * 100) < totalDurability then
totalDurability = (current / max) * 100
end
end
end
self.text:SetText(format(displayString, totalDurability))
end
local function OnClick()
ToggleCharacter("PaperDollFrame")
end
local function OnEnter(self)
DT:SetupTooltip(self)
for slot, durability in pairs(invDurability) do
DT.tooltip:AddDoubleLine(_G[upper(slot)], format(tooltipString, durability), 1, 1, 1, E:ColorGradient(durability * 0.01, 1, 0, 0, 1, 1, 0, 0, 1, 0))
end
DT.tooltip:Show()
end
local function ValueColorUpdate(hex)
displayString = join("", DURABILITY, ": ", hex, "%d%%|r")
if lastPanel ~= nil then
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Durability", {"PLAYER_ENTERING_WORLD", "UPDATE_INVENTORY_ALERTS", "MERCHANT_SHOW"}, OnEvent, nil, OnClick, OnEnter, nil, DURABILITY)
+200
View File
@@ -0,0 +1,200 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local type, pairs = type, pairs
local sort, wipe = table.sort, wipe
local format, find, join, gsub = string.format, string.find, string.join, string.gsub
--WoW API / Variables
local UnitIsAFK = UnitIsAFK
local UnitIsDND = UnitIsDND
local SendChatMessage = SendChatMessage
local InviteUnit = InviteUnit
local SetItemRef = SetItemRef
local GetFriendInfo = GetFriendInfo
local GetNumFriends = GetNumFriends
local GetQuestDifficultyColor = GetQuestDifficultyColor
local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local ToggleFriendsFrame = ToggleFriendsFrame
local L_EasyMenu = L_EasyMenu
local AFK = AFK
local DND = DND
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local LOCALIZED_CLASS_NAMES_FEMALE = LOCALIZED_CLASS_NAMES_FEMALE
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local function GetNumberFriends()
local numFriends = GetNumFriends()
local onlineFriends = 0
local _, online
for i = 1, numFriends do
_, _, _, _, online = GetFriendInfo(i)
if online then
onlineFriends = onlineFriends + 1
end
end
return numFriends, onlineFriends
end
local menuFrame = CreateFrame("Frame", "FriendDatatextRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate")
local menuList = {
{text = OPTIONS_MENU, isTitle = true, notCheckable = true},
{text = INVITE, hasArrow = true, notCheckable = true},
{text = CHAT_MSG_WHISPER_INFORM, hasArrow = true, notCheckable = true},
{text = PLAYER_STATUS, hasArrow = true, notCheckable = true,
menuList = {
{text = "|cff2BC226" .. AVAILABLE .. "|r", notCheckable = true, func = function() end},
{text = "|cffE7E716" .. CHAT_MSG_AFK .. "|r", notCheckable = true, func = function() end},
{text = "|cffFF0000" .. CHAT_MSG_DND .. "|r", notCheckable = true, func = function() end}
}
}
}
local function inviteClick(name)
menuFrame:Hide()
if(type(name) ~= "number") then
InviteUnit(name)
end
end
local function whisperClick(name)
menuFrame:Hide()
SetItemRef("player:" .. name, format("|Hplayer:%1$s|h[%1$s]|h", name), "LeftButton")
end
local lastPanel
local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r"
local levelNameClassString = "|cff%02x%02x%02x%d|r %s%s"
local worldOfWarcraftString = WORLD_OF_WARCRAFT
local totalOnlineString = join("", GUILD_ONLINE_LABEL, ": %s/%s")
local tthead = {r = 0.4, g = 0.78, b = 1}
local activezone, inactivezone = {r = 0.3, g = 1.0, b = 0.3}, {r = 0.65, g = 0.65, b = 0.65}
local displayString = ""
local groupedTable = {"|cffaaaaaa*|r", ""}
local friendTable = {}
local friendOnline, friendOffline = gsub(ERR_FRIEND_ONLINE_SS, "\124Hplayer:%%s\124h%[%%s%]\124h", ""), gsub(ERR_FRIEND_OFFLINE_S, "%%s", "")
local dataValid = false
local function SortAlphabeticName(a, b)
if(a[1] and b[1]) then
return a[1] < b[1]
end
end
local function BuildFriendTable(total)
wipe(friendTable)
local name, level, class, area, connected, status, note
for i = 1, total do
name, level, class, area, connected, status, note = GetFriendInfo(i)
if status == CHAT_FLAG_AFK then
status = "|cffFFFFFF[|r|cffFF0000" .. L["AFK"] .. "|r|cffFFFFFF]|r"
elseif status == CHAT_FLAG_DND then
status = "|cffFFFFFF[|r|cffFF0000" .. L["DND"] .. "|r|cffFFFFFF]|r"
end
if(connected) then
for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if(class == v) then class = k end end
for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if(class == v) then class = k end end
friendTable[i] = {name, level, class, area, connected, status, note}
end
end
sort(friendTable, SortAlphabeticName)
end
local function OnEvent(self, event, ...)
local _, onlineFriends = GetNumberFriends()
if event == "CHAT_MSG_SYSTEM" then
local message = arg1
if not (find(message, friendOnline) or find(message, friendOffline)) then return end
end
dataValid = false
self.text:SetText(format(displayString, L["Friends"], onlineFriends))
lastPanel = self
end
local function OnClick(_, btn)
DT.tooltip:Hide()
if btn == "RightButton" then
local menuCountWhispers = 0
local menuCountInvites = 0
local classc, levelc, info
menuList[2].menuList = {}
menuList[3].menuList = {}
if getn(friendTable) > 0 then
for i = 1, getn(friendTable) do
info = friendTable[i]
if (info[5]) then
menuCountInvites = menuCountInvites + 1
menuCountWhispers = menuCountWhispers + 1
classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[3]], GetQuestDifficultyColor(info[2])
classc = classc or GetQuestDifficultyColor(info[2])
menuList[2].menuList[menuCountInvites] = {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[2],classc.r*255,classc.g*255,classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = inviteClick}
menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[2],classc.r*255,classc.g*255,classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = whisperClick}
end
end
end
L_EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2)
else
ToggleFriendsFrame(1)
end
end
local function OnEnter(self)
DT:SetupTooltip(self)
local numberOfFriends, onlineFriends = GetNumberFriends()
if onlineFriends == 0 then return end
if not dataValid then
if numberOfFriends > 0 then BuildFriendTable(numberOfFriends) end
dataValid = true
end
local zonec, classc, levelc, info
DT.tooltip:AddDoubleLine(L["Friends List"], format(totalOnlineString, onlineFriends, numberOfFriends), tthead.r, tthead.g, tthead.b, tthead.r, tthead.g, tthead.b)
if onlineFriends > 0 then
DT.tooltip:AddLine(" ")
DT.tooltip:AddLine(worldOfWarcraftString)
for i = 1, getn(friendTable) do
info = friendTable[i]
if info[5] then
if(GetRealZoneText() == info[4]) then zonec = activezone else zonec = inactivezone end
classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[3]], GetQuestDifficultyColor(info[2])
classc = classc or GetQuestDifficultyColor(info[2])
DT.tooltip:AddDoubleLine(format(levelNameClassString, levelc.r*255,levelc.g*255,levelc.b*255, info[2], info[1], " " .. info[6]), info[4], classc.r,classc.g,classc.b, zonec.r,zonec.g,zonec.b)
end
end
end
DT.tooltip:Show()
end
local function ValueColorUpdate(hex)
displayString = join("", "%s: ", hex, "%d|r")
if lastPanel ~= nil then
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Friends", {"PLAYER_LOGIN", "FRIENDLIST_UPDATE", "CHAT_MSG_SYSTEM"}, OnEvent, nil, OnClick, OnEnter, nil, L["Friends"])
+81
View File
@@ -0,0 +1,81 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local pairs = pairs
local join = string.join
--WoW API / Variables
local GetMoney = GetMoney
local IsShiftKeyDown = IsShiftKeyDown
local Profit = 0
local Spent = 0
local resetInfoFormatter = join("", "|cffaaaaaa", L["Reset Data: Hold Shift + Right Click"], "|r")
local function OnEvent(self)
local NewMoney = GetMoney()
ElvDB = ElvDB or {}
ElvDB["gold"] = ElvDB["gold"] or {}
ElvDB["gold"][E.myrealm] = ElvDB["gold"][E.myrealm] or {}
ElvDB["gold"][E.myrealm][E.myname] = ElvDB["gold"][E.myrealm][E.myname] or NewMoney
local OldMoney = ElvDB["gold"][E.myrealm][E.myname] or NewMoney
local Change = NewMoney - OldMoney
if OldMoney > NewMoney then
Spent = Spent - Change
else
Profit = Profit + Change
end
self.text:SetText(E:FormatMoney(NewMoney, E.db.datatexts.goldFormat or "BLIZZARD"))
ElvDB["gold"][E.myrealm][E.myname] = NewMoney
end
local function OnClick(self, btn)
if btn == "RightButton" and IsShiftKeyDown() then
ElvDB.gold = nil
OnEvent(self)
DT.tooltip:Hide()
else
OpenAllBags()
end
end
local function OnEnter(self)
DT:SetupTooltip(self)
local style = E.db.datatexts.goldFormat or "BLIZZARD"
DT.tooltip:AddLine(L["Session:"])
DT.tooltip:AddDoubleLine(L["Earned:"], E:FormatMoney(Profit, style), 1, 1, 1, 1, 1, 1)
DT.tooltip:AddDoubleLine(L["Spent:"], E:FormatMoney(Spent, style), 1, 1, 1, 1, 1, 1)
if Profit < Spent then
DT.tooltip:AddDoubleLine(L["Deficit:"], E:FormatMoney(Profit-Spent, style), 1, 0, 0, 1, 1, 1)
elseif (Profit - Spent) > 0 then
DT.tooltip:AddDoubleLine(L["Profit:"], E:FormatMoney(Profit-Spent, style), 0, 1, 0, 1, 1, 1)
end
DT.tooltip:AddLine(" ")
local totalGold = 0;
DT.tooltip:AddLine(L["Character: "])
for k, _ in pairs(ElvDB["gold"][E.myrealm]) do
if ElvDB["gold"][E.myrealm][k] then
DT.tooltip:AddDoubleLine(k, E:FormatMoney(ElvDB["gold"][E.myrealm][k], style), 1, 1, 1, 1, 1, 1)
totalGold = totalGold + ElvDB["gold"][E.myrealm][k]
end
end
DT.tooltip:AddLine(" ")
DT.tooltip:AddLine(L["Server: "])
DT.tooltip:AddDoubleLine(L["Total: "], E:FormatMoney(totalGold, style), 1, 1, 1, 1, 1, 1)
DT.tooltip:AddLine(" ")
DT.tooltip:AddLine(resetInfoFormatter)
DT.tooltip:Show()
end
DT:RegisterDatatext("Gold", {"PLAYER_ENTERING_WORLD", "PLAYER_MONEY", "SEND_MAIL_MONEY_CHANGED", "SEND_MAIL_COD_CHANGED", "PLAYER_TRADE_MONEY", "TRADE_MONEY_CHANGED"}, OnEvent, nil, OnClick, OnEnter, nil, L["Gold"])
+243
View File
@@ -0,0 +1,243 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local unpack = unpack
local format, join = string.format, string.join
local sort, wipe = table.sort, wipe
--WoW API / Variables
local EasyMenu = EasyMenu
local GetGuildInfo = GetGuildInfo
local GetGuildRosterInfo = GetGuildRosterInfo
local GetGuildRosterMOTD = GetGuildRosterMOTD
local GetMouseFocus = GetMouseFocus
local GetNumGuildMembers = GetNumGuildMembers
local GetQuestDifficultyColor = GetQuestDifficultyColor
local GetRealZoneText = GetRealZoneText
local GuildRoster = GuildRoster
local InviteUnit = InviteUnit
local IsInGuild = IsInGuild
local IsShiftKeyDown = IsShiftKeyDown
local LoadAddOn = LoadAddOn
local SetItemRef = SetItemRef
local ToggleFriendsFrame = ToggleFriendsFrame
local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local MOTD_COLON = MOTD_COLON
local FRIENDS_LIST_ONLINE = "FRIENDS_LIST_ONLINE"
local tthead, ttsubh, ttoff = {r=0.4, g=0.78, b=1}, {r=0.75, g=0.9, b=1}, {r=.3,g=1,b=.3}
local activezone, inactivezone = {r=0.3, g=1.0, b=0.3}, {r=0.65, g=0.65, b=0.65}
local displayString = ""
local noGuildString = ""
local guildInfoString = "%s"
local guildInfoString2 = join("", GUILD, ": %d/%d")
local guildMotDString = "%s |cffaaaaaa |cffffffff%s"
local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r %s"
local levelNameStatusString = "|cff%02x%02x%02x%d|r %s "
local nameRankString = "%s |cff999999-|cffffffff %s"
local moreMembersOnlineString = join("", "+ %d ", FRIENDS_LIST_ONLINE, "...")
local noteString = join("", "|cff999999 ", LABEL_NOTE, ":|r %s")
local officerNoteString = join("", "|cff999999 ", GUILD_RANK1_DESC, ":|r %s")
local guildTable, guildMotD = {}, ""
local lastPanel
local function SortGuildTable(shift)
sort(guildTable, function(a, b)
if a and b then
if shift then
return a[9] < b[9]
else
return a[1] < b[1]
end
end
end)
end
local function BuildGuildTable()
wipe(guildTable)
local _, name, rank, level, zone, note, officernote, connected, status, class
local totalMembers = GetNumGuildMembers()
for i = 1, totalMembers do
name, rank, _, level, class, zone, note, officernote, connected, status = GetGuildRosterInfo(i)
if connected then
guildTable[getn(guildTable) + 1] = {name, rank, level, zone, note, officernote, connected, status, string.upper(class)}
end
end
end
local function UpdateGuildMessage()
guildMotD = GetGuildRosterMOTD()
end
local eventHandlers = {
["CHAT_MSG_SYSTEM"] = function()
GuildRoster()
end,
-- when we enter the world and guildframe is not available then
-- load guild frame, update guild message and guild xp
["PLAYER_ENTERING_WORLD"] = function()
if IsInGuild() then
GuildRoster()
end
end,
-- Guild Roster updated, so rebuild the guild table
["GUILD_ROSTER_UPDATE"] = function(self)
GuildRoster()
BuildGuildTable()
UpdateGuildMessage()
if GetMouseFocus() == self then
self:GetScript("OnEnter")(self, nil, true)
end
end,
["PLAYER_GUILD_UPDATE"] = function()
GuildRoster()
end,
-- our guild message of the day changed
["GUILD_MOTD"] = function(_, arg1)
guildMotD = arg1
end,
["ELVUI_FORCE_RUN"] = E.noop,
["ELVUI_COLOR_UPDATE"] = E.noop,
}
local function OnEvent(self, event, ...)
lastPanel = self
if IsInGuild() then
eventHandlers[event](self, unpack(arg))
self.text:SetText(format(displayString, getn(guildTable)))
else
self.text:SetText(noGuildString)
end
end
local menuFrame = CreateFrame("Frame", "GuildDatatTextRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate")
local menuList = {
{ text = OPTIONS_MENU, isTitle = true, notCheckable = true},
{ text = INVITE, hasArrow = true, notCheckable = true,},
{ text = CHAT_MSG_WHISPER_INFORM, hasArrow = true, notCheckable=true,}
}
local function inviteClick(_, playerName)
menuFrame:Hide()
InviteUnit(playerName)
end
local function whisperClick(_, playerName)
menuFrame:Hide()
SetItemRef("player:"..playerName, ("|Hplayer:%1$s|h[%1$s]|h"):format(playerName), "LeftButton")
end
local function OnClick(_, btn)
if btn == "RightButton" and IsInGuild() then
DT.tooltip:Hide()
local classc, levelc, grouped, info
local menuCountWhispers = 0
local menuCountInvites = 0
menuList[2].menuList = {}
menuList[3].menuList = {}
for i = 1, getn(guildTable) do
info = guildTable[i]
if info[7] and info[1] ~= E.myname then
classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[9]], GetQuestDifficultyColor(info[3])
--if UnitInParty(info[1]) or UnitInRaid(info[1]) then
-- grouped = "|cffaaaaaa*|r"
--elseif not info[11] then
menuCountInvites = menuCountInvites + 1
grouped = ""
menuList[2].menuList[menuCountInvites] = {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[3], classc.r*255,classc.g*255,classc.b*255, info[1], ""), arg1 = info[1],notCheckable=true, func = inviteClick}
--end
menuCountWhispers = menuCountWhispers + 1
if not grouped then grouped = "" end
menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[3], classc.r*255,classc.g*255,classc.b*255, info[1], grouped), arg1 = info[1],notCheckable=true, func = whisperClick}
end
end
L_EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2)
else
ToggleFriendsFrame(3)
end
end
local function OnEnter(self, _, noUpdate)
if not IsInGuild() then return end
DT:SetupTooltip(self)
local online, total = 0, GetNumGuildMembers(true)
for i = 0, total do
local _, _, _, _, _, _, _, _, _, status = GetGuildRosterInfo(i)
if status then
online = online + 1
end
end
if getn(guildTable) == 0 then BuildGuildTable() end
SortGuildTable(IsShiftKeyDown())
local guildName, guildRank = GetGuildInfo("player")
if guildName and guildRank then
DT.tooltip:AddDoubleLine(format(guildInfoString, guildName), format(guildInfoString2, online, total),tthead.r,tthead.g,tthead.b,tthead.r,tthead.g,tthead.b)
DT.tooltip:AddLine(guildRank, unpack(tthead))
end
if guildMotD ~= "" then
DT.tooltip:AddLine(" ")
DT.tooltip:AddLine(format(guildMotDString, GUILD_MOTD_LABEL, guildMotD), ttsubh.r, ttsubh.g, ttsubh.b, 1)
end
local zonec, classc, levelc, info
local shown = 0
DT.tooltip:AddLine(" ")
for i = 1, getn(guildTable) do
-- if more then 30 guild members are online, we don't Show any more, but inform user there are more
if 30 - shown <= 1 then
if online - 30 > 1 then DT.tooltip:AddLine(format(moreMembersOnlineString, online - 30), ttsubh.r, ttsubh.g, ttsubh.b) end
break
end
info = guildTable[i]
if GetRealZoneText() == info[4] then zonec = activezone else zonec = inactivezone end
classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[9]], GetQuestDifficultyColor(info[3])
if IsShiftKeyDown() then
DT.tooltip:AddDoubleLine(format(nameRankString, info[1], info[2]), info[4], classc.r, classc.g, classc.b, zonec.r, zonec.g, zonec.b)
if info[5] ~= "" then DT.tooltip:AddLine(format(noteString, info[5]), ttsubh.r, ttsubh.g, ttsubh.b, 1) end
if info[6] ~= "" then DT.tooltip:AddLine(format(officerNoteString, info[6]), ttoff.r, ttoff.g, ttoff.b, 1) end
else
DT.tooltip:AddDoubleLine(format(levelNameStatusString, levelc.r*255, levelc.g*255, levelc.b*255, info[3], info[1], info[4]), info[4], classc.r,classc.g,classc.b, zonec.r,zonec.g,zonec.b)
end
shown = shown + 1
end
DT.tooltip:Show()
if not noUpdate then
GuildRoster()
end
end
local function ValueColorUpdate(hex)
displayString = join("", GUILD, ": ", hex, "%d|r")
noGuildString = join("", hex, L["No Guild"])
if lastPanel ~= nil then
OnEvent(lastPanel, "ELVUI_COLOR_UPDATE")
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Guild", {"PLAYER_ENTERING_WORLD", "CHAT_MSG_SYSTEM", "GUILD_ROSTER_UPDATE", "PLAYER_GUILD_UPDATE", "GUILD_MOTD"}, OnEvent, nil, OnClick, OnEnter, nil, GUILD)
@@ -0,0 +1,12 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="DataTexts.lua"/>
<Script file="Armor.lua"/>
<Script file="AttackPower.lua"/>
<Script file="Avoidance.lua"/>
<Script file="Durability.lua"/>
<Script file="Friends.lua"/>
<Script file="Gold.lua"/>
<Script file="Guild.lua"/>
<Script file="System.lua"/>
<Script file="Time.lua"/>
</Ui>
+92
View File
@@ -0,0 +1,92 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local collectgarbage = collectgarbage
local floor = math.floor
local format = string.format
local gcinfo = gcinfo
--WoW API / Variables
local GetNetStats = GetNetStats
local GetFramerate = GetFramerate
local int = 6
local statusColors = {
"|cff0CD809",
"|cffE8DA0F",
"|cffFF9000",
"|cffD80909"
}
local enteredFrame = false
local homeLatencyString = "%d ms"
local kiloByteString = "%d kb"
local megaByteString = "%.2f mb"
local function formatMem(memory)
local mult = 10 ^ 1
if(memory > 999) then
local mem = ((memory / 1024) * mult) / mult
return format(megaByteString, mem)
else
local mem = (memory * mult) / mult
return format(kiloByteString, mem)
end
end
local function ToggleGameMenuFrame()
if GameMenuFrame:IsShown() then
PlaySound("igMainMenuQuit")
HideUIPanel(GameMenuFrame)
else
PlaySound("igMainMenuOpen")
ShowUIPanel(GameMenuFrame)
end
end
local function OnClick(_, btn)
if btn == "RightButton" then
collectgarbage()
elseif btn == "LeftButton" then
ToggleGameMenuFrame()
end
end
local function OnEnter(self)
enteredFrame = true
DT:SetupTooltip(self)
local totalMemory = gcinfo()
local _, _, latency = GetNetStats()
DT.tooltip:AddDoubleLine(L["Home Latency:"], format(homeLatencyString, latency), 0.69, 0.31, 0.31, 0.84, 0.75, 0.65)
DT.tooltip:AddDoubleLine(L["Total Memory:"], formatMem(totalMemory), 0.69, 0.31, 0.31, 0.84, 0.75, 0.65)
DT.tooltip:Show()
end
local function OnLeave()
enteredFrame = false
DT.tooltip:Hide()
end
local function OnUpdate(self, t)
int = int - t
if int < 0 then
local framerate = floor(GetFramerate())
local _, _, latency = GetNetStats()
self.text:SetText(format("FPS: %s%d|r MS: %s%d|r",
statusColors[framerate >= 30 and 1 or (framerate >= 20 and framerate < 30) and 2 or (framerate >= 10 and framerate < 20) and 3 or 4],
framerate,
statusColors[latency < 150 and 1 or (latency >= 150 and latency < 300) and 2 or (latency >= 300 and latency < 500) and 3 or 4],
latency))
int = 1
if enteredFrame then
OnEnter(this)
end
end
end
DT:RegisterDatatext("System", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave, L["System"])
+77
View File
@@ -0,0 +1,77 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local time = time
local format, join = string.format, string.join
--WoW API / Variables
local GetGameTime = GetGameTime
local GetNumSavedInstances = GetNumSavedInstances
local GetSavedInstanceInfo = GetSavedInstanceInfo
local SecondsToTime = SecondsToTime
local TIMEMANAGER_TOOLTIP_REALMTIME = "Realm time:"
local timeDisplayFormat = ""
local dateDisplayFormat = ""
local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d")
local lockoutInfoFormatNoEnc = "%s%s |cffaaaaaa(%s)"
local difficultyInfo = {"N", "N", "H", "H"}
local lockoutColorExtended, lockoutColorNormal = {r = 0.3, g = 1, b = 0.3}, {r = .8, g = .8, b = .8}
local function OnLeave()
DT.tooltip:Hide()
end
local function OnEnter(self)
DT:SetupTooltip(self)
local name, _, reset, difficultyId, locked, extended, isRaid, maxPlayers
local oneraid, lockoutColor
for i = 1, GetNumSavedInstances() do
name, _, reset, difficultyId, locked, extended, _, isRaid, maxPlayers = GetSavedInstanceInfo(i)
if isRaid and (locked or extended) and name then
if not oneraid then
DT.tooltip:AddLine(L["Saved Raid(s)"])
DT.tooltip:AddLine(" ")
oneraid = true
end
if extended then
lockoutColor = lockoutColorExtended
else
lockoutColor = lockoutColorNormal
end
DT.tooltip:AddDoubleLine(format(lockoutInfoFormatNoEnc, maxPlayers, difficultyInfo[difficultyId], name), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b)
end
end
DT.tooltip:AddDoubleLine(TIMEMANAGER_TOOLTIP_REALMTIME, format(europeDisplayFormat_nocolor, GetGameTime()), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
DT.tooltip:Show()
end
local lastPanel
local int = 5
local function OnUpdate(self, t)
int = int - t
if int > 0 then return end
self.text:SetText(gsub(gsub(BetterDate(E.db.datatexts.timeFormat.." "..E.db.datatexts.dateFormat, time()), ":", timeDisplayFormat), "%s", dateDisplayFormat))
lastPanel = self
int = 1
end
local function ValueColorUpdate(hex)
timeDisplayFormat = join("", hex, ":|r")
dateDisplayFormat = join("", hex, " ")
if lastPanel ~= nil then
OnUpdate(lastPanel, 20000)
end
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Time", nil, nil, OnUpdate, nil, OnEnter, OnLeave)
+15
View File
@@ -0,0 +1,15 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Include file="NamePlates\Load_NamePlates.xml"/>
<Include file="Tooltip\Load_Tooltip.xml"/>
<Include file="DataTexts\Load_DataTexts.xml"/>
<Include file="ActionBars\Load_ActionBars.xml"/>
<Include file="UnitFrames\Load_UnitFrames.xml"/>
<Include file="Maps\Load_Maps.xml"/>
<Include file="Auras\Load_Auras.xml"/>
<Include file="Chat\Load_Chat.xml"/>
<Include file="Bags\Load_Bags.xml"/>
<Include file="Misc\Load_Misc.xml"/>
<Include file="Skins\Load_Skins.xml"/>
<Include file="Blizzard\Load_Blizzard.xml"/>
<Include file="DataBars\Load_DataBars.xml"/>
</Ui>
+4
View File
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Minimap.lua"/>
<Script file="WorldMap.lua"/>
</Ui>
+379
View File
@@ -0,0 +1,379 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:NewModule("Minimap", "AceEvent-3.0");
E.Minimap = M
--Cache global variables
--Lua functions
local _G = _G
local strsub = strsub
--WoW API / Variables
local CreateFrame = CreateFrame
local ToggleCharacter = ToggleCharacter
local ToggleFrame = ToggleFrame
local ToggleAchievementFrame = ToggleAchievementFrame
local ToggleFriendsFrame = ToggleFriendsFrame
local IsAddOnLoaded = IsAddOnLoaded
local ToggleHelpFrame = ToggleHelpFrame
local GetZonePVPInfo = GetZonePVPInfo
local IsShiftKeyDown = IsShiftKeyDown
local ToggleDropDownMenu = ToggleDropDownMenu
local Minimap_OnClick = Minimap_OnClick
local GetMinimapZoneText = GetMinimapZoneText
local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate")
local menuList = {
{text = CHARACTER_BUTTON,
func = function() ToggleCharacter("PaperDollFrame") end},
{text = SPELLBOOK_ABILITIES_BUTTON,
func = function() ToggleFrame(SpellBookFrame) end},
{text = TALENTS_BUTTON,
func = ToggleTalentFrame},
{text = QUESTLOG_BUTTON,
func = function() ToggleFrame(QuestLogFrame) end},
{text = SOCIAL_BUTTON,
func = function() ToggleFriendsFrame(1) end},
{text = L["Farm Mode"],
func = FarmMode},
{text = BATTLEFIELD_MINIMAP,
func = ToggleBattlefieldMinimap},
{text = HELPFRAME_HOME_ISSUE3_HEADER,
func = function() ToggleCharacter("HonorFrame") end},
{text = HELP_BUTTON,
func = ToggleHelpFrame}
}
function GetMinimapShape()
return "SQUARE"
end
function M:GetLocTextColor()
local pvpType = GetZonePVPInfo()
if(pvpType == "sanctuary") then
return 0.035, 0.58, 0.84
elseif(pvpType == "arena") then
return 0.84, 0.03, 0.03
elseif(pvpType == "friendly") then
return 0.05, 0.85, 0.03
elseif(pvpType == "hostile") then
return 0.84, 0.03, 0.03
elseif(pvpType == "contested") then
return 0.9, 0.85, 0.05
else
return 0.84, 0.03, 0.03
end
end
function M:Minimap_OnMouseUp(btn)
local position = this:GetPoint()
if arg1 == "MiddleButton" or (arg1 == "RightButton" and IsShiftKeyDown()) then
if position then
L_EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2)
else
L_EasyMenu(menuList, menuFrame, "cursor", -160, 0, "MENU", 2)
end
else
Minimap_OnClick(this)
end
end
function M:Minimap_OnMouseWheel()
if arg1 > 0 then
_G.MinimapZoomIn:Click()
elseif arg1 < 0 then
_G.MinimapZoomOut:Click()
end
end
function M:Update_ZoneText()
if E.db.general.minimap.locationText == "HIDE" or not E.private.general.minimap.enable then return end
Minimap.location:SetText(strsub(GetMinimapZoneText(),1,46))
Minimap.location:SetTextColor(self:GetLocTextColor())
E:FontTemplate(Minimap.location, E.LSM:Fetch("font", E.db.general.minimap.locationFont), E.db.general.minimap.locationFontSize, E.db.general.minimap.locationFontOutline)
end
function M:PLAYER_REGEN_ENABLED()
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
self:UpdateSettings()
end
local isResetting
local function ResetZoom()
Minimap:SetZoom(0)
MinimapZoomIn:Enable()
MinimapZoomOut:Disable()
isResetting = false
end
local function SetupZoomReset()
if(E.db.general.minimap.resetZoom.enable and not isResetting) then
isResetting = true
E:Delay(E.db.general.minimap.resetZoom.time, ResetZoom)
end
end
hooksecurefunc(Minimap, "SetZoom", SetupZoomReset)
function M:UpdateSettings()
E.MinimapSize = E.private.general.minimap.enable and E.db.general.minimap.size or Minimap:GetWidth() + 10
E.MinimapWidth = E.MinimapSize
E.MinimapHeight = E.MinimapSize
if E.private.general.minimap.enable then
Minimap:SetScale(E.MinimapSize / 140)
end
if(LeftMiniPanel and RightMiniPanel) then
if(E.db.datatexts.minimapPanels and E.private.general.minimap.enable) then
LeftMiniPanel:Show()
RightMiniPanel:Show()
else
LeftMiniPanel:Hide()
RightMiniPanel:Hide()
end
end
if(BottomMiniPanel) then
if(E.db.datatexts.minimapBottom and E.private.general.minimap.enable) then
BottomMiniPanel:Show()
else
BottomMiniPanel:Hide()
end
end
if(BottomLeftMiniPanel) then
if(E.db.datatexts.minimapBottomLeft and E.private.general.minimap.enable) then
BottomLeftMiniPanel:Show()
else
BottomLeftMiniPanel:Hide()
end
end
if(BottomRightMiniPanel) then
if(E.db.datatexts.minimapBottomRight and E.private.general.minimap.enable) then
BottomRightMiniPanel:Show()
else
BottomRightMiniPanel:Hide()
end
end
if(TopMiniPanel) then
if(E.db.datatexts.minimapTop and E.private.general.minimap.enable) then
TopMiniPanel:Show()
else
TopMiniPanel:Hide()
end
end
if(TopLeftMiniPanel) then
if(E.db.datatexts.minimapTopLeft and E.private.general.minimap.enable) then
TopLeftMiniPanel:Show()
else
TopLeftMiniPanel:Hide()
end
end
if(TopRightMiniPanel) then
if(E.db.datatexts.minimapTopRight and E.private.general.minimap.enable) then
TopRightMiniPanel:Show()
else
TopRightMiniPanel:Hide()
end
end
if MMHolder then
MMHolder:SetWidth(E.MinimapWidth + E.Border + E.Spacing*3)
if E.db.datatexts.minimapPanels then
MMHolder:SetHeight(E.MinimapHeight + (LeftMiniPanel and (LeftMiniPanel:GetHeight() + E.Border) or 24) + E.Spacing*3)
else
MMHolder:SetHeight(E.MinimapHeight + E.Border + E.Spacing*3)
end
end
if Minimap.location then
Minimap.location:SetWidth(E.MinimapSize)
if(E.db.general.minimap.locationText ~= "SHOW" or not E.private.general.minimap.enable) then
Minimap.location:Hide()
else
Minimap.location:Show()
end
end
if MinimapMover then
MinimapMover:SetWidth(MMHolder:GetWidth())
MinimapMover:SetHeight(MMHolder:GetHeight())
end
if GameTimeFrame then
if E.private.general.minimap.hideCalendar then
GameTimeFrame:Hide()
else
local pos = E.db.general.minimap.icons.calendar.position or "TOPRIGHT"
local scale = E.db.general.minimap.icons.calendar.scale or 1
GameTimeFrame:ClearAllPoints()
GameTimeFrame:SetPoint(pos, Minimap, pos, E.db.general.minimap.icons.calendar.xOffset or 0, E.db.general.minimap.icons.calendar.yOffset or 0)
GameTimeFrame:SetScale(scale)
GameTimeFrame:Show()
end
end
if MiniMapMailFrame then
local pos = E.db.general.minimap.icons.mail.position or "TOPRIGHT"
local scale = E.db.general.minimap.icons.mail.scale or 1
MiniMapMailFrame:ClearAllPoints()
MiniMapMailFrame:SetPoint(pos, Minimap, pos, E.db.general.minimap.icons.mail.xOffset or 3, E.db.general.minimap.icons.mail.yOffset or 4)
MiniMapMailFrame:SetScale(scale)
end
if MiniMapBattlefieldFrame then
local pos = E.db.general.minimap.icons.battlefield.position or "BOTTOMRIGHT"
local scale = E.db.general.minimap.icons.battlefield.scale or 1
MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetPoint(pos, Minimap, pos, E.db.general.minimap.icons.battlefield.xOffset or 3, E.db.general.minimap.icons.battlefield.yOffset or 0)
MiniMapBattlefieldFrame:SetScale(scale)
end
if MiniMapInstanceDifficulty then
local pos = E.db.general.minimap.icons.difficulty.position or "TOPLEFT"
local scale = E.db.general.minimap.icons.difficulty.scale or 1
local x = E.db.general.minimap.icons.difficulty.xOffset or 0
local y = E.db.general.minimap.icons.difficulty.yOffset or 0
MiniMapInstanceDifficulty:ClearAllPoints()
MiniMapInstanceDifficulty:SetPoint(pos, Minimap, pos, x, y)
MiniMapInstanceDifficulty:SetScale(scale)
end
end
local function MinimapPostDrag()
MinimapCluster:ClearAllPoints()
MinimapCluster:SetAllPoints(Minimap)
MinimapBackdrop:ClearAllPoints()
MinimapBackdrop:SetAllPoints(Minimap)
end
function M:Initialize()
E:SetTemplate(menuFrame, "Transparent", true)
self:UpdateSettings()
if not E.private.general.minimap.enable then
Minimap:SetMaskTexture("Textures\\MinimapMask")
return
end
local mmholder = CreateFrame("Frame", "MMHolder", UIParent)
mmholder:SetPoint("TOPRIGHT", E.UIParent, "TOPRIGHT", -3, -3)
mmholder:SetWidth(E.MinimapWidth + 29)
mmholder:SetHeight(E.MinimapHeight + 53)
Minimap:ClearAllPoints()
Minimap:SetPoint("TOPRIGHT", mmholder, "TOPRIGHT", -E.Border, -E.Border)
Minimap:SetMaskTexture("Interface\\ChatFrame\\ChatFrameBackground")
Minimap.backdrop = CreateFrame("Frame", nil, UIParent)
E:SetOutside(Minimap.backdrop, Minimap)
Minimap.backdrop:SetFrameStrata(Minimap:GetFrameStrata())
Minimap.backdrop:SetFrameLevel(Minimap:GetFrameLevel() - 1)
E:SetTemplate(Minimap.backdrop, "Default")
HookScript(Minimap, "OnEnter", function()
if E.db.general.minimap.locationText ~= "MOUSEOVER" or not E.private.general.minimap.enable then
return
end
this.location:Show()
end)
HookScript(Minimap, "OnLeave", function()
if E.db.general.minimap.locationText ~= "MOUSEOVER" or not E.private.general.minimap.enable then
return
end
this.location:Hide()
end)
Minimap.location = Minimap:CreateFontString(nil, "OVERLAY")
E:FontTemplate(Minimap.location, nil, nil, "OUTLINE")
Minimap.location:SetPoint("TOP", Minimap, "TOP", 0, -2)
Minimap.location:SetJustifyH("CENTER")
Minimap.location:SetJustifyV("MIDDLE")
if E.db.general.minimap.locationText ~= "SHOW" or not E.private.general.minimap.enable then
Minimap.location:Hide()
end
MinimapBorder:Hide()
MinimapBorderTop:Hide()
MinimapToggleButton:Hide()
MinimapZoomIn:Hide()
MinimapZoomOut:Hide()
MinimapZoneTextButton:Hide()
MiniMapMailBorder:Hide()
MiniMapMailIcon:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\mail")
MiniMapBattlefieldBorder:Hide()
E:CreateMover(MMHolder, "MinimapMover", L["Minimap"], nil, nil, MinimapPostDrag)
Minimap:EnableMouseWheel(true)
Minimap:SetScript("OnMouseWheel", M.Minimap_OnMouseWheel)
Minimap:SetScript("OnMouseUp", M.Minimap_OnMouseUp)
self:RegisterEvent("ZONE_CHANGED_NEW_AREA", "Update_ZoneText")
self:RegisterEvent("ZONE_CHANGED", "Update_ZoneText")
self:RegisterEvent("ZONE_CHANGED_INDOORS", "Update_ZoneText")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "Update_ZoneText")
local fm = CreateFrame("Minimap", "FarmModeMap", E.UIParent)
fm:SetWidth(E.db.farmSize)
fm:SetHeight(E.db.farmSize)
fm:SetPoint("TOP", E.UIParent, "TOP", 0, -120)
fm:SetClampedToScreen(true)
E:CreateBackdrop(fm, "Default")
fm:EnableMouseWheel(true)
fm:SetScript("OnMouseWheel", M.Minimap_OnMouseWheel)
fm:SetScript("OnMouseUp", M.Minimap_OnMouseUp)
fm:RegisterForDrag("LeftButton", "RightButton")
fm:SetMovable(true)
fm:SetScript("OnDragStart", function() this:StartMoving() end)
fm:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
fm:Hide()
FarmModeMap:SetScript("OnShow", function()
if(BuffsMover and not E:HasMoverBeenMoved("BuffsMover")) then
BuffsMover:ClearAllPoints()
BuffsMover:SetPoint("TOPRIGHT", E.UIParent, "TOPRIGHT", -3, -3)
end
if(DebuffsMover and not E:HasMoverBeenMoved("DebuffsMover")) then
DebuffsMover:ClearAllPoints()
DebuffsMover:SetPoint("TOPRIGHT", ElvUIPlayerBuffs, "BOTTOMRIGHT", 0, -3)
end
MinimapCluster:ClearAllPoints()
MinimapCluster:SetAllPoints(FarmModeMap)
end)
FarmModeMap:SetScript("OnHide", function()
if(BuffsMover and not E:HasMoverBeenMoved("BuffsMover")) then
E:ResetMovers(L["Player Buffs"])
end
if(DebuffsMover and not E:HasMoverBeenMoved("DebuffsMover")) then
E:ResetMovers(L["Player Debuffs"])
end
MinimapCluster:ClearAllPoints()
MinimapCluster:SetAllPoints(Minimap)
end)
HookScript(UIParent, "OnShow", function()
if not FarmModeMap.enabled then
FarmModeMap:Hide()
end
end)
end
local function InitializeCallback()
M:Initialize()
end
E:RegisterInitialModule(M:GetName(), InitializeCallback)
+113
View File
@@ -0,0 +1,113 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:NewModule("WorldMap", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
E.WorldMap = M
--Cache global variables
--Lua functions
local format = string.format
--WoW API / Variables
local CreateFrame = CreateFrame
local GetPlayerMapPosition = GetPlayerMapPosition
local GetCursorPosition = GetCursorPosition
local PLAYER = PLAYER
local INVERTED_POINTS = {
["TOPLEFT"] = "BOTTOMLEFT",
["TOPRIGHT"] = "BOTTOMRIGHT",
["BOTTOMLEFT"] = "TOPLEFT",
["BOTTOMRIGHT"] = "TOPRIGHT",
["TOP"] = "BOTTOM",
["BOTTOM"] = "TOP"
}
function M:UpdateCoords()
if not WorldMapFrame:IsShown() then return end
local x, y = GetPlayerMapPosition("player")
x = x and E:Round(100 * x, 2) or 0
y = y and E:Round(100 * y, 2) or 0
if x ~= 0 and y ~= 0 then
CoordsHolder.playerCoords:SetText(PLAYER..": "..format("%.2f, %.2f", x, y))
else
CoordsHolder.playerCoords:SetText("")
end
local scale = WorldMapDetailFrame:GetEffectiveScale()
local width = WorldMapDetailFrame:GetWidth()
local height = WorldMapDetailFrame:GetHeight()
local centerX, centerY = WorldMapDetailFrame:GetCenter()
local x, y = GetCursorPosition()
local adjustedX = (x / scale - (centerX - (width / 2))) / width
local adjustedY = (centerY + (height / 2) - y / scale) / height
if adjustedX >= 0 and adjustedY >= 0 and adjustedX <= 1 and adjustedY <= 1 then
adjustedX = E:Round(100 * adjustedX, 2)
adjustedY = E:Round(100 * adjustedY, 2)
CoordsHolder.mouseCoords:SetText(L["Mouse"]..": "..format("%.2f, %.2f", adjustedX, adjustedY))
else
CoordsHolder.mouseCoords:SetText("")
end
end
function M:PositionCoords()
local db = E.global.general.WorldMapCoordinates
local position = db.position
local xOffset = db.xOffset
local yOffset = db.yOffset
local x, y = 5, 5
if position == "BOTTOMRIGHT" or position == "TOPRIGHT" then x = -5 end
if position == "TOPLEFT" or position == "TOP" or position == "TOPRIGHT" then y = -5 end
CoordsHolder.playerCoords:ClearAllPoints()
CoordsHolder.playerCoords:SetPoint(position, WorldMapDetailFrame, position, x + xOffset, y + yOffset)
CoordsHolder.mouseCoords:ClearAllPoints()
CoordsHolder.mouseCoords:SetPoint(position, CoordsHolder.playerCoords, INVERTED_POINTS[position], 0, y)
end
function M:Initialize()
if E.global.general.WorldMapCoordinates.enable then
local coordsHolder = CreateFrame("Frame", "CoordsHolder", WorldMapFrame)
coordsHolder:SetFrameStrata(WorldMapDetailFrame:GetFrameStrata())
coordsHolder.playerCoords = coordsHolder:CreateFontString(nil, "OVERLAY")
coordsHolder.mouseCoords = coordsHolder:CreateFontString(nil, "OVERLAY")
coordsHolder.playerCoords:SetTextColor(1, 1 ,0)
coordsHolder.mouseCoords:SetTextColor(1, 1 ,0)
coordsHolder.playerCoords:SetFontObject(NumberFontNormal)
coordsHolder.mouseCoords:SetFontObject(NumberFontNormal)
coordsHolder.playerCoords:SetPoint("BOTTOMLEFT", WorldMapDetailFrame, "BOTTOMLEFT", 5, 5)
coordsHolder.playerCoords:SetText(PLAYER..": 0, 0")
coordsHolder.mouseCoords:SetPoint("BOTTOMLEFT", coordsHolder.playerCoords, "TOPLEFT", 0, 5)
coordsHolder.mouseCoords:SetText("MOUSE_LABEL"..": 0, 0")
coordsHolder:SetScript("OnUpdate", self.UpdateCoords)
self:PositionCoords()
end
if E.global.general.smallerWorldMap then
BlackoutWorld:SetTexture(nil)
WorldMapFrame:SetParent(E.UIParent)
WorldMapFrame:SetScale(1)
WorldMapFrame:EnableKeyboard(false)
WorldMapFrame:EnableMouse(false)
WorldMapFrame:SetToplevel()
UIPanelWindows["WorldMapFrame"] = {area = "center", pushable = 0, whileDead = 1}
HookScript(DropDownList1, "OnShow", function()
if DropDownList1:GetScale() ~= UIParent:GetScale() then
DropDownList1:SetScale(UIParent:GetScale())
end
end)
WorldMapTooltip:SetFrameLevel(WorldMapPositioningGuide:GetFrameLevel() + 110)
end
end
local function InitializeCallback()
M:Initialize()
end
E:RegisterInitialModule(M:GetName(), InitializeCallback)
+330
View File
@@ -0,0 +1,330 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local AFK = E:NewModule("AFK", "AceEvent-3.0", "AceTimer-3.0");
-- local CH = E:GetModule("Chat")
--Cache global variables
--Lua functions
local _G = _G
local GetTime = GetTime
local floor = math.floor
--WoW API / Variables
local CinematicFrame = CinematicFrame
local CreateFrame = CreateFrame
local GetBattlefieldStatus = GetBattlefieldStatus
local GetGuildInfo = GetGuildInfo
local GetScreenHeight = GetScreenHeight
local GetScreenWidth = GetScreenWidth
local UnitAffectingCombat = UnitAffectingCombat
local IsInGuild = IsInGuild
local IsShiftKeyDown = IsShiftKeyDown
local Screenshot = Screenshot
local SetCVar = SetCVar
local UnitFactionGroup = UnitFactionGroup
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local MAX_BATTLEFIELD_QUEUES = MAX_BATTLEFIELD_QUEUES
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local AFK_SPEED = 7.35
local ignoreKeys = {
LALT = true,
LSHIFT = true,
RSHIFT = true
}
local printKeys = {
["PRINTSCREEN"] = true,
}
if IsMacClient() then
printKeys[_G["KEY_PRINTSCREEN_MAC"]] = true
end
function AFK:UpdateTimer()
local time = GetTime() - self.startTime
self.AFKMode.bottom.time:SetText(format("%02d:%02d", floor(time / 60), time - floor(time / 60) * 60))
end
local function StopAnimation(self)
self:SetSequenceTime(0, 0)
self:SetScript("OnUpdate", nil)
self:SetScript("OnAnimFinished", nil)
end
local function UpdateAnimation(...)
this.animTime = this.animTime + (arg1 * 1000)
this:SetSequenceTime(67, this.animTime)
if this.animTime >= 3000 then
StopAnimation(this)
end
end
local function OnAnimFinished(self)
if self.animTime > 500 then
StopAnimation(self)
end
end
local recountVis
local function RecountVisability(save)
if Recount and Recount.db and Recount.db.profile then
if save then
recountVis = Recount.db.profile.MainWindowVis
else
Recount.db.profile.MainWindowVis = recountVis
RecountDB.profiles[Recount.db.keys.profile].MainWindowVis = recountVis
end
end
end
local LRC
local function RockConfigFix()
if not LRC then
LRC = LibStub("LibRockConfig-1.0", true)
end
if LRC then
if LRC.base and LRC.base:IsShown() then
LRC.base.addonChooser:Select(LRC.base.addonChooser.value)
end
end
end
function AFK:SetAFK(status)
if status and not self.isAFK then
if InspectFrame then
InspectPaperDollFrame:Hide()
end
RecountVisability(true)
UIParent:Hide()
self.AFKMode:Show()
RecountVisability()
E.global.afkEnabled = true
E.global.afkCameraSpeedYaw = GetCVar("cameraYawMoveSpeed")
E.global.afkCameraSpeedPitch = GetCVar("cameraPitchMoveSpeed")
MoveViewLeftStart()
SetCVar("cameraYawMoveSpeed", AFK_SPEED)
SetCVar("cameraPitchMoveSpeed", E.global.afkCameraSpeedPitch)
if IsInGuild() then
local guildName, guildRankName = GetGuildInfo("player")
self.AFKMode.bottom.guild:SetText(format("%s - %s", guildName, guildRankName))
else
self.AFKMode.bottom.guild:SetText(L["No Guild"])
end
self.startTime = GetTime()
self.timer = self:ScheduleRepeatingTimer("UpdateTimer", 1)
self.AFKMode.chat:RegisterEvent("CHAT_MSG_WHISPER")
self.AFKMode.chat:RegisterEvent("CHAT_MSG_GUILD")
self.AFKMode.bottom.model:SetModelScale(1)
self.AFKMode.bottom.model:RefreshUnit()
self.AFKMode.bottom.model:SetModelScale(0.8)
self.AFKMode.bottom.model.animTime = 0
self.AFKMode.bottom.model:SetScript("OnUpdate", UpdateAnimation)
self.AFKMode.bottom.model:SetScript("OnAnimFinished", OnAnimFinished)
self.isAFK = true
elseif not status and self.isAFK then
self.AFKMode:Hide()
UIParent:Show()
E.global.afkEnabled = nil
SetCVar("cameraYawMoveSpeed", E.global.afkCameraSpeedYaw)
SetCVar("cameraPitchMoveSpeed", E.global.afkCameraSpeedPitch)
MoveViewLeftStop()
self:CancelTimer(self.timer)
self.AFKMode.bottom.time:SetText("00:00")
self.AFKMode.chat:UnregisterAllEvents()
self.AFKMode.chat:Clear()
self.isAFK = false
RockConfigFix()
end
end
function AFK:OnEvent(event, ...)
if event == "PLAYER_REGEN_DISABLED" or event == "UPDATE_BATTLEFIELD_STATUS" then
if event == "UPDATE_BATTLEFIELD_STATUS" then
local status, _, instanceID
for i = 1, MAX_BATTLEFIELD_QUEUES do
status, _, instanceID = GetBattlefieldStatus(i)
if instanceID ~= 0 then
status = status
end
end
local status = status
if status == "confirm" then
self:SetAFK(false)
end
else
self:SetAFK(false)
end
if event == "PLAYER_REGEN_DISABLED" then
self:RegisterEvent("PLAYER_REGEN_ENABLED", "OnEvent")
end
return
end
if event == "PLAYER_REGEN_ENABLED" then
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
end
if not E.db.general.afk then return end
if UnitAffectingCombat("player") or CinematicFrame:IsShown() then return end
-- if UnitCastingInfo("player") ~= nil then
-- --Don't activate afk if player is crafting stuff, check back in 30 seconds
-- self:ScheduleTimer("OnEvent", 30)
-- return
-- end
if arg1 == format(MARKED_AFK_MESSAGE, DEFAULT_AFK_MESSAGE) then
self:SetAFK(true)
elseif arg1 == CLEARED_AFK then
self:SetAFK(false)
end
end
function AFK:Toggle()
if E.db.general.afk then
self:RegisterEvent("CHAT_MSG_SYSTEM", "OnEvent")
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "OnEvent")
self:RegisterEvent("PLAYER_REGEN_DISABLED", "OnEvent")
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS", "OnEvent")
SetCVar("autoClearAFK", "1")
else
self:UnregisterEvent("CHAT_MSG_SYSTEM")
self:UnregisterEvent("PLAYER_FLAGS_CHANGED")
self:UnregisterEvent("PLAYER_REGEN_DISABLED")
self:UnregisterEvent("UPDATE_BATTLEFIELD_STATUS")
self:CancelAllTimers()
end
end
local function OnKeyDown(_, key)
if ignoreKeys[key] then return end
if printKeys[key] then
Screenshot()
else
AFK:SetAFK(false)
AFK:ScheduleTimer("OnEvent", 60)
end
end
local function Chat_OnMouseWheel(self, delta)
if delta == 1 and IsShiftKeyDown() then
self:ScrollToTop()
elseif delta == -1 and IsShiftKeyDown() then
self:ScrollToBottom()
elseif delta == -1 then
self:ScrollDown()
else
self:ScrollUp()
end
end
function AFK:Initialize()
if E.global.afkEnabled then
SetCVar("cameraYawMoveSpeed", E.global.afkCameraSpeedYaw)
SetCVar("cameraPitchMoveSpeed", E.global.afkCameraSpeedPitch)
E.global.afkEnabled = nil
end
local _, class = UnitClass("player")
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
self.AFKMode = CreateFrame("Frame", "ElvUIAFKFrame")
self.AFKMode:SetFrameLevel(1)
self.AFKMode:SetScale(UIParent:GetScale())
self.AFKMode:SetAllPoints(UIParent)
self.AFKMode:Hide()
self.AFKMode:EnableKeyboard(true)
self.AFKMode:SetScript("OnKeyDown", OnKeyDown)
self.AFKMode.chat = CreateFrame("ScrollingMessageFrame", "AFKChat", self.AFKMode)
self.AFKMode.chat:SetWidth(500)
self.AFKMode.chat:SetHeight(200)
self.AFKMode.chat:SetPoint("TOPLEFT", self.AFKMode, "TOPLEFT", 4, -3)
E:FontTemplate(self.AFKMode.chat)
self.AFKMode.chat:SetJustifyH("LEFT")
self.AFKMode.chat:SetMaxLines(500)
self.AFKMode.chat:EnableMouseWheel(true)
self.AFKMode.chat:SetFading(false)
self.AFKMode.chat:SetMovable(true)
self.AFKMode.chat:EnableMouse(true)
self.AFKMode.chat:SetClampedToScreen(true)
-- self.AFKMode.chat:SetClampRectInsets(-4, 3, 3, -4)
self.AFKMode.chat:RegisterForDrag("LeftButton")
self.AFKMode.chat:SetScript("OnDragStart", self.AFKMode.chat.StartMoving)
self.AFKMode.chat:SetScript("OnDragStop", self.AFKMode.chat.StopMovingOrSizing)
self.AFKMode.chat:SetScript("OnMouseWheel", Chat_OnMouseWheel)
-- self.AFKMode.chat:SetScript("OnEvent", CH.ChatFrame_OnEvent)
self.AFKMode.bottom = CreateFrame("Frame", nil, self.AFKMode)
self.AFKMode.bottom:SetFrameLevel(0)
E:SetTemplate(self.AFKMode.bottom, "Transparent")
self.AFKMode.bottom:SetPoint("BOTTOM", self.AFKMode, "BOTTOM", 0, -E.Border)
self.AFKMode.bottom:SetWidth(GetScreenWidth() + (E.Border*2))
self.AFKMode.bottom:SetHeight(GetScreenHeight() * 0.1)
self.AFKMode.bottom.logo = self.AFKMode:CreateTexture(nil, "OVERLAY")
self.AFKMode.bottom.logo:SetWidth(320)
self.AFKMode.bottom.logo:SetHeight(150)
self.AFKMode.bottom.logo:SetPoint("CENTER", self.AFKMode.bottom, "CENTER", 0, 50)
self.AFKMode.bottom.logo:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\logo")
local factionGroup = UnitFactionGroup("player")
self.AFKMode.bottom.faction = self.AFKMode.bottom:CreateTexture(nil, "OVERLAY")
self.AFKMode.bottom.faction:SetPoint("BOTTOMLEFT", self.AFKMode.bottom, "BOTTOMLEFT", -20, -16)
self.AFKMode.bottom.faction:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\"..factionGroup.."-Logo")
self.AFKMode.bottom.faction:SetWidth(140)
self.AFKMode.bottom.faction:SetHeight(140)
self.AFKMode.bottom.name = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
E:FontTemplate(self.AFKMode.bottom.name, nil, 20)
self.AFKMode.bottom.name:SetText(format("%s - %s", E.myname, E.myrealm))
self.AFKMode.bottom.name:SetPoint("TOPLEFT", self.AFKMode.bottom.faction, "TOPRIGHT", -10, -28)
self.AFKMode.bottom.name:SetTextColor(classColor.r, classColor.g, classColor.b)
self.AFKMode.bottom.guild = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
E:FontTemplate(self.AFKMode.bottom.guild, nil, 20)
self.AFKMode.bottom.guild:SetText(L["No Guild"])
self.AFKMode.bottom.guild:SetPoint("TOPLEFT", self.AFKMode.bottom.name, "BOTTOMLEFT", 0, -6)
self.AFKMode.bottom.guild:SetTextColor(0.7, 0.7, 0.7)
self.AFKMode.bottom.time = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
E:FontTemplate(self.AFKMode.bottom.time, nil, 20)
self.AFKMode.bottom.time:SetText("00:00")
self.AFKMode.bottom.time:SetPoint("TOPLEFT", self.AFKMode.bottom.guild, "BOTTOMLEFT", 0, -6)
self.AFKMode.bottom.time:SetTextColor(0.7, 0.7, 0.7)
self.AFKMode.bottom.model = CreateFrame("PlayerModel", "ElvUIAFKPlayerModel", self.AFKMode.bottom)
self.AFKMode.bottom.model:SetPoint("BOTTOMRIGHT", self.AFKMode.bottom, "BOTTOMRIGHT", 120, -100)
self.AFKMode.bottom.model:SetWidth(800)
self.AFKMode.bottom.model:SetHeight(800)
self.AFKMode.bottom.model:SetFacing(6)
self.AFKMode.bottom.model:SetUnit("player")
self:Toggle()
end
local function InitializeCallback()
AFK:Initialize()
end
E:RegisterModule(AFK:GetName(), InitializeCallback)
+203
View File
@@ -0,0 +1,203 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
local CH = E:GetModule("Chat");
local CC = E:GetModule("ClassCache");
--Cache global variables
--Lua functions
local select, unpack, type = select, unpack, type
local format, gsub, match, gmatch = string.format, string.gsub, string.match, string.gmatch
local strlower = strlower
--WoW API / Variables
local CreateFrame = CreateFrame
function M:UpdateBubbleBorder()
if not this.text then return end
if E.private.general.chatBubbles == "backdrop" then
if E.PixelMode then
this:SetBackdropBorderColor(this.text:GetTextColor())
else
local r, g, b = this.text:GetTextColor()
this.bordertop:SetTexture(r, g, b)
this.borderbottom:SetTexture(r, g, b)
this.borderleft:SetTexture(r, g, b)
this.borderright:SetTexture(r, g, b)
end
end
if E.private.chat.enable and E.private.general.classCache and E.private.general.classColorMentionsSpeech then
local classColorTable, isFirstWord, rebuiltString, lowerCaseWord, tempWord, wordMatch, classMatch
local text = this.text:GetText()
if text and match(text, "%s-[^%s]+%s*") then
for word in gmatch(text, "%s-[^%s]+%s*") do
tempWord = gsub(word, "^[%s%p]-([^%s%p]+)([%-]?[^%s%p]-)[%s%p]*$","%1%2")
lowerCaseWord = strlower(tempWord)
classMatch = CC:GetCacheTable()[E.myrealm][tempWord]
wordMatch = classMatch and lowerCaseWord
if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then
classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch]
word = gsub(word, gsub(tempWord, "%-","%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord))
end
if not isFirstWord then
rebuiltString = word
isFirstWord = true
else
rebuiltString = format("%s%s", rebuiltString, word)
end
end
if rebuiltString ~= nil then
this.text:SetText(rebuiltString)
end
end
end
end
function M:SkinBubble(frame)
local mult = E.mult * UIParent:GetScale()
for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
if region:GetObjectType() == "Texture" then
region:SetTexture(nil)
elseif region:GetObjectType() == "FontString" then
frame.text = region
end
end
if frame.text then
if E.private.general.chatBubbles == "backdrop" then
if E.PixelMode then
E:SetTemplate(frame, "Transparent", true)
frame:SetBackdropColor(unpack(E.media.backdropfadecolor))
frame:SetBackdropBorderColor(0, 0, 0)
else
frame:SetBackdrop(nil)
end
local r, g, b = frame.text:GetTextColor()
if not E.PixelMode then
if not frame.backdrop then
frame.backdrop = frame:CreateTexture(nil, "BACKGROUND")
frame.backdrop:SetAllPoints(frame)
frame.backdrop:SetTexture(unpack(E.media.backdropfadecolor))
frame.bordertop = frame:CreateTexture(nil, "OVERLAY")
frame.bordertop:SetPoint("TOPLEFT", frame, "TOPLEFT", -mult*2, mult*2)
frame.bordertop:SetPoint("TOPRIGHT", frame, "TOPRIGHT", mult*2, mult*2)
frame.bordertop:SetHeight(mult)
frame.bordertop:SetTexture(r, g, b)
frame.bordertop.backdrop = frame:CreateTexture(nil, "BORDER")
frame.bordertop.backdrop:SetPoint("TOPLEFT", frame.bordertop, "TOPLEFT", -mult, mult)
frame.bordertop.backdrop:SetPoint("TOPRIGHT", frame.bordertop, "TOPRIGHT", mult, mult)
frame.bordertop.backdrop:SetHeight(mult * 3)
frame.bordertop.backdrop:SetTexture(0, 0, 0)
frame.borderbottom = frame:CreateTexture(nil, "OVERLAY")
frame.borderbottom:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", -mult*2, -mult*2)
frame.borderbottom:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", mult*2, -mult*2)
frame.borderbottom:SetHeight(mult)
frame.borderbottom:SetTexture(r, g, b)
frame.borderbottom.backdrop = frame:CreateTexture(nil, "BORDER")
frame.borderbottom.backdrop:SetPoint("BOTTOMLEFT", frame.borderbottom, "BOTTOMLEFT", -mult, -mult)
frame.borderbottom.backdrop:SetPoint("BOTTOMRIGHT", frame.borderbottom, "BOTTOMRIGHT", mult, -mult)
frame.borderbottom.backdrop:SetHeight(mult * 3)
frame.borderbottom.backdrop:SetTexture(0, 0, 0)
frame.borderleft = frame:CreateTexture(nil, "OVERLAY")
frame.borderleft:SetPoint("TOPLEFT", frame, "TOPLEFT", -mult*2, mult*2)
frame.borderleft:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", mult*2, -mult*2)
frame.borderleft:SetWidth(mult)
frame.borderleft:SetTexture(r, g, b)
frame.borderleft.backdrop = frame:CreateTexture(nil, "BORDER")
frame.borderleft.backdrop:SetPoint("TOPLEFT", frame.borderleft, "TOPLEFT", -mult, mult)
frame.borderleft.backdrop:SetPoint("BOTTOMLEFT", frame.borderleft, "BOTTOMLEFT", -mult, -mult)
frame.borderleft.backdrop:SetWidth(mult * 3)
frame.borderleft.backdrop:SetTexture(0, 0, 0)
frame.borderright = frame:CreateTexture(nil, "OVERLAY")
frame.borderright:SetPoint("TOPRIGHT", frame, "TOPRIGHT", mult*2, mult*2)
frame.borderright:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -mult*2, -mult*2)
frame.borderright:SetWidth(mult)
frame.borderright:SetTexture(r, g, b)
frame.borderright.backdrop = frame:CreateTexture(nil, "BORDER")
frame.borderright.backdrop:SetPoint("TOPRIGHT", frame.borderright, "TOPRIGHT", mult, mult)
frame.borderright.backdrop:SetPoint("BOTTOMRIGHT", frame.borderright, "BOTTOMRIGHT", mult, -mult)
frame.borderright.backdrop:SetWidth(mult * 3)
frame.borderright.backdrop:SetTexture(0, 0, 0)
end
else
frame:SetBackdropColor(unpack(E.media.backdropfadecolor))
frame:SetBackdropBorderColor(r, g, b)
end
E:FontTemplate(frame.text, E.LSM:Fetch("font", E.private.general.chatBubbleFont), E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
elseif E.private.general.chatBubbles == "backdrop_noborder" then
frame:SetBackdrop(nil)
if not frame.backdrop then
frame.backdrop = frame:CreateTexture(nil, "ARTWORK")
E:SetInside(frame.backdrop, frame, 4, 4)
frame.backdrop:SetTexture(unpack(E.media.backdropfadecolor))
end
E:FontTemplate(frame.text, E.LSM:Fetch("font", E.private.general.chatBubbleFont), E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
frame:SetClampedToScreen(false)
elseif E.private.general.chatBubbles == "nobackdrop" then
frame:SetBackdrop(nil)
E:FontTemplate(frame.text, E.LSM:Fetch("font", E.private.general.chatBubbleFont), E.private.general.chatBubbleFontSize, E.private.general.chatBubbleFontOutline)
frame:SetClampedToScreen(false)
end
end
HookScript(frame, "OnShow", M.UpdateBubbleBorder)
frame:SetFrameStrata("DIALOG")
M.UpdateBubbleBorder(frame)
frame.isBubblePowered = true
end
function M:IsChatBubble(frame)
for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
if region.GetTexture and region:GetTexture() and type(region:GetTexture() == "string" and strlower(region:GetTexture()) == [[interface\tooltips\chatbubble-background]]) then return true end
end
return false
end
local numChildren = 0
function M:LoadChatBubbles()
if E.private.general.bubbles == false then
E.private.general.chatBubbles = "disabled"
E.private.general.bubbles = nil
end
if E.private.general.chatBubbles == "disabled" then return end
local frame = CreateFrame("Frame")
frame.lastupdate = -2
frame:SetScript("OnUpdate", function()
this.lastupdate = this.lastupdate + arg1
if this.lastupdate < .1 then return end
this.lastupdate = 0
local count = WorldFrame:GetNumChildren()
if count ~= numChildren then
for i = numChildren + 1, count do
local frame = select(i, WorldFrame:GetChildren())
if frame.GetObjectType and frame:GetObjectType() == "Frame" and M:IsChatBubble(frame) then
M:SkinBubble(frame)
end
end
numChildren = count
end
end)
end
+8
View File
@@ -0,0 +1,8 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Misc.lua"/>
<Script file="AFK.lua"/>
<Script file="ChatBubbles.lua"/>
<Script file="Loot.lua"/>
<Script file="LootRoll.lua"/>
<Script file="RaidMarker.lua"/>
</Ui>
+328
View File
@@ -0,0 +1,328 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
--Cache global variables
--Lua functions
local max = math.max
local tinsert = table.insert
local unpack, pairs = unpack, pairs
--WoW API / Variables
local CloseLoot = CloseLoot
local CursorOnUpdate = CursorOnUpdate
local CursorUpdate = CursorUpdate
local GetCVar = GetCVar
local GetCursorPosition = GetCursorPosition
local GetLootSlotInfo = GetLootSlotInfo
local GetLootSlotLink = GetLootSlotLink
local GetNumLootItems = GetNumLootItems
local GiveMasterLoot = GiveMasterLoot
local IsFishingLoot = IsFishingLoot
local LootSlot = LootSlot
local LootSlotIsCoin = LootSlotIsCoin
local LootSlotIsItem = LootSlotIsItem
local ResetCursor = ResetCursor
local UnitIsDead = UnitIsDead
local UnitIsFriend = UnitIsFriend
local UnitName = UnitName
local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
local LOOT = LOOT
-- Credit Haste
local lootFrame, lootFrameHolder
local iconSize = 30
local sq, ss, sn
local OnEnter = function()
local slot = this:GetID()
if(LootSlotIsItem(slot)) then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetLootItem(slot)
CursorUpdate(this)
end
this.drop:Show()
this.drop:SetVertexColor(1, 1, 0)
end
local OnLeave = function()
if this.quality and (this.quality > 1) then
local color = ITEM_QUALITY_COLORS[this.quality]
this.drop:SetVertexColor(color.r, color.g, color.b)
else
this.drop:Hide()
end
GameTooltip:Hide()
ResetCursor()
end
local OnClick = function()
LootFrame.selectedQuality = this.quality
LootFrame.selectedItemName = this.name:GetText()
LootFrame.selectedSlot = this:GetID()
LootFrame.selectedLootButton = this:GetName()
StaticPopup_Hide("CONFIRM_LOOT_DISTRIBUTION")
ss = this:GetID()
sq = this.quality
sn = this.name:GetText()
--LootSlot(ss)
end
local OnShow = function()
if(GameTooltip:IsOwned(this)) then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:SetLootItem(this:GetID())
CursorOnUpdate(this)
end
end
local function anchorSlots(self)
local shownSlots = 0
for i = 1, getn(self.slots) do
local frame = self.slots[i]
if(frame:IsShown()) then
shownSlots = shownSlots + 1
frame:SetPoint("TOP", lootFrame, 4, (-8 + iconSize) - (shownSlots * iconSize))
end
end
self:SetHeight(max(shownSlots * iconSize + 16, 20))
end
local function createSlot(id)
local frame = CreateFrame("LootButton", "ElvLootSlot"..id, lootFrame)
frame:SetPoint("LEFT", 8, 0)
frame:SetPoint("RIGHT", -8, 0)
frame:SetHeight(iconSize - 2)
frame:SetID(id)
frame:SetScript("OnEnter", OnEnter)
frame:SetScript("OnLeave", OnLeave)
frame:SetScript("OnClick", OnClick)
frame:SetScript("OnShow", OnShow)
local iconFrame = CreateFrame("Frame", nil, frame)
iconFrame:SetWidth(iconSize - 2)
iconFrame:SetHeight(iconSize - 2)
iconFrame:SetPoint("RIGHT", frame)
E:SetTemplate(iconFrame, "Default")
frame.iconFrame = iconFrame
E["frames"][iconFrame] = nil
local icon = iconFrame:CreateTexture(nil, "ARTWORK")
icon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(icon)
frame.icon = icon
local count = iconFrame:CreateFontString(nil, "OVERLAY")
count:SetJustifyH("RIGHT")
count:SetPoint("BOTTOMRIGHT", iconFrame, -2, 2)
E:FontTemplate(count, nil, nil, "OUTLINE")
count:SetText(1)
frame.count = count
local name = frame:CreateFontString(nil, "OVERLAY")
name:SetJustifyH("LEFT")
name:SetPoint("LEFT", frame)
name:SetPoint("RIGHT", icon, "LEFT")
name:SetNonSpaceWrap(true)
E:FontTemplate(name, nil, nil, "OUTLINE")
frame.name = name
local drop = frame:CreateTexture(nil, "ARTWORK")
drop:SetTexture("Interface\\QuestFrame\\UI-QuestLogTitleHighlight")
drop:SetPoint("LEFT", icon, "RIGHT", 0, 0)
drop:SetPoint("RIGHT", frame)
drop:SetAllPoints(frame)
drop:SetAlpha(.3)
frame.drop = drop
lootFrame.slots[id] = frame
return frame
end
function M:LOOT_SLOT_CLEARED()
if not lootFrame:IsShown() then return end
lootFrame.slots[arg1]:Hide()
anchorSlots(lootFrame)
end
function M:LOOT_CLOSED()
StaticPopup_Hide("LOOT_BIND")
lootFrame:Hide()
for _, v in pairs(lootFrame.slots) do
v:Hide()
end
end
function M:OPEN_MASTER_LOOT_LIST()
ToggleDropDownMenu(1, nil, GroupLootDropDown, lootFrame.slots[ss], 0, 0)
end
function M:UPDATE_MASTER_LOOT_LIST()
UIDropDownMenu_Refresh(GroupLootDropDown)
end
function M:LOOT_OPENED(_, autoLoot)
lootFrame:Show()
if(not lootFrame:IsShown()) then
CloseLoot(autoLoot == 0)
end
local items = GetNumLootItems()
if(IsFishingLoot()) then
lootFrame.title:SetText(L["Fishy Loot"])
elseif(not UnitIsFriend("player", "target") and UnitIsDead("target")) then
lootFrame.title:SetText(UnitName("target"))
else
lootFrame.title:SetText(LOOT)
end
-- Blizzard uses strings here
if E.private.general.lootUnderMouse then
local x, y = GetCursorPosition()
x = x / lootFrame:GetEffectiveScale()
y = y / lootFrame:GetEffectiveScale()
lootFrame:ClearAllPoints()
lootFrame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x - 40, y + 20)
lootFrame:GetCenter()
lootFrame:Raise()
else
lootFrame:ClearAllPoints()
lootFrame:SetPoint("TOPLEFT", lootFrameHolder, "TOPLEFT")
end
local m, w, t = 0, 0, lootFrame.title:GetStringWidth()
if(items > 0) then
for i = 1, items do
local slot = lootFrame.slots[i] or createSlot(i)
local texture, item, quantity, quality = GetLootSlotInfo(i)
local color = ITEM_QUALITY_COLORS[quality]
if(LootSlotIsCoin(i)) then
item = item:gsub("\n", ", ")
end
if quantity and (quantity > 1) then
slot.count:SetText(quantity)
slot.count:Show()
else
slot.count:Hide()
end
if quality and (quality > 1) then
slot.drop:SetVertexColor(color.r, color.g, color.b)
slot.drop:Show()
else
slot.drop:Hide()
end
slot.quality = quality
slot.name:SetText(item)
if color then
slot.name:SetTextColor(color.r, color.g, color.b)
end
slot.icon:SetTexture(texture)
if quality then
m = max(m, quality)
end
w = max(w, slot.name:GetStringWidth())
slot:SetID(i)
slot:SetSlot(i)
slot:Enable()
slot:Show()
end
else
local slot = lootFrame.slots[1] or createSlot(1)
local color = ITEM_QUALITY_COLORS[0]
slot.name:SetText(L["Empty Slot"])
if color then
slot.name:SetTextColor(color.r, color.g, color.b)
end
slot.icon:SetTexture[[Interface\Icons\INV_Misc_Herb_AncientLichen]]
items = 1
w = max(w, slot.name:GetStringWidth())
slot.count:Hide()
slot.drop:Hide()
slot:Disable()
slot:Show()
end
anchorSlots(lootFrame)
w = w + 60
t = t + 5
local color = ITEM_QUALITY_COLORS[m]
lootFrame:SetBackdropBorderColor(color.r, color.g, color.b, .8)
lootFrame:SetWidth(max(w, t))
end
function M:LoadLoot()
if not E.private.general.loot then return end
lootFrameHolder = CreateFrame("Frame", "ElvLootFrameHolder", E.UIParent)
lootFrameHolder:SetPoint("TOPLEFT", 36, -195)
lootFrameHolder:SetWidth(150)
lootFrameHolder:SetHeight(22)
lootFrame = CreateFrame("Button", "ElvLootFrame", lootFrameHolder)
lootFrame:SetClampedToScreen(true)
lootFrame:SetPoint("TOPLEFT", 0, 0)
lootFrame:SetWidth(256)
lootFrame:SetHeight(64)
E:SetTemplate(lootFrame, "Transparent")
lootFrame:SetFrameStrata("FULLSCREEN")
lootFrame:SetToplevel(true)
lootFrame.title = lootFrame:CreateFontString(nil, "OVERLAY")
E:FontTemplate(lootFrame.title, nil, nil, "OUTLINE")
lootFrame.title:SetPoint("BOTTOMLEFT", lootFrame, "TOPLEFT", 0, 1)
lootFrame.slots = {}
lootFrame:SetScript("OnHide", function()
StaticPopup_Hide("CONFIRM_LOOT_DISTRIBUTION")
CloseLoot()
end)
E["frames"][lootFrame] = nil
self:RegisterEvent("LOOT_OPENED")
self:RegisterEvent("LOOT_SLOT_CLEARED")
self:RegisterEvent("LOOT_CLOSED")
self:RegisterEvent("OPEN_MASTER_LOOT_LIST")
self:RegisterEvent("UPDATE_MASTER_LOOT_LIST")
E:CreateMover(lootFrameHolder, "LootFrameMover", L["Loot Frame"])
-- Fuzz
LootFrame:UnregisterAllEvents()
ElvLootFrame:Hide() -- May need another fix. Frame shows without.
tinsert(UISpecialFrames, "ElvLootFrame")
function _G.GroupLootDropDown_GiveLoot()
if(sq >= MASTER_LOOT_THREHOLD) then
local dialog = StaticPopup_Show("CONFIRM_LOOT_DISTRIBUTION", ITEM_QUALITY_COLORS[sq].hex..sn..FONT_COLOR_CODE_CLOSE, this:GetText())
if (dialog) then
dialog.data = this.value
end
else
GiveMasterLoot(ss, this.value)
end
CloseDropDownMenus()
end
E.PopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].OnAccept = function(data)
GiveMasterLoot(ss, data)
end
StaticPopupDialogs["CONFIRM_LOOT_DISTRIBUTION"].preferredIndex = 3
end
+323
View File
@@ -0,0 +1,323 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
--Cache global variables
--Lua functions
local find = string.find
local pairs, unpack, ipairs, next, tonumber = pairs, unpack, ipairs, next, tonumber
local tinsert = table.insert
--WoW API / Variables
local CursorOnUpdate = CursorOnUpdate
local DressUpItemLink = DressUpItemLink
local GetLootRollItemInfo = GetLootRollItemInfo
local GetLootRollItemLink = GetLootRollItemLink
local GetLootRollTimeLeft = GetLootRollTimeLeft
local IsModifiedClick = IsModifiedClick
local IsShiftKeyDown = IsShiftKeyDown
local ResetCursor = ResetCursor
local RollOnLoot = RollOnLoot
local ShowInspectCursor = ShowInspectCursor
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local pos = "TOP"
local cancelled_rolls = {}
local FRAME_WIDTH, FRAME_HEIGHT = 328, 28
M.RollBars = {}
local locale = GetLocale()
local rollpairs = locale == "deDE" and {
["(.*) würfelt nicht für: (.+|r)$"] = "pass",
["(.*) hat für (.+) 'Gier' ausgewählt"] = "greed",
["(.*) hat für (.+) 'Bedarf' ausgewählt"] = "need",
} or locale == "frFR" and {
["(.*) a passé pour : (.+)"] = "pass",
["(.*) a choisi Cupidité pour : (.+)"] = "greed",
["(.*) a choisi Besoin pour : (.+)"] = "need",
} or locale == "zhTW" and {
["(.*)放棄了:(.+)"] = "pass",
["(.*)選擇了貪婪:(.+)"] = "greed",
["(.*)選擇了需求:(.+)"] = "need",
} or locale == "ruRU" and {
["(.*) отказывается от предмета (.+)%."] = "pass",
["Разыгрывается: (.+)%. (.*): \"Не откажусь\""] = "greed",
["Разыгрывается: (.+)%. (.*): \"Мне это нужно\""] = "need",
} or locale == "koKR" and {
["(.*)님이 주사위 굴리기를 포기했습니다: (.+)"] = "pass",
["(.*)님이 차비를 선택했습니다: (.+)"] = "greed",
["(.*)님이 입찰을 선택했습니다: (.+)"] = "need",
} or locale == "esES" and {
["^(.*) pasó de: (.+|r)$"] = "pass",
["(.*) eligió Codicia para: (.+)"] = "greed",
["(.*) eligió Necesidad para: (.+)"] = "need",
} or locale == "esMX" and {
["^(.*) pasó de: (.+|r)$"] = "pass",
["(.*) eligió Codicia para: (.+)"] = "greed",
["(.*) eligió Necesidad para: (.+)"] = "need",
} or {
["^(.*) passed on: (.+|r)$"] = "pass",
["(.*) has selected Greed for: (.+)"] = "greed",
["(.*) has selected Need for: (.+)"] = "need",
}
local function ClickRoll(frame)
RollOnLoot(frame.parent.rollID, frame.rolltype)
end
local function HideTip() GameTooltip:Hide() end
local function HideTip2() GameTooltip:Hide() ResetCursor() end
local rolltypes = {"need", "greed", [0] = "pass"}
local function SetTip(frame)
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
GameTooltip:SetText(frame.tiptext)
if(frame:IsEnabled() == 0) then
GameTooltip:AddLine("|cffff3333"..L["Can't Roll"])
end
for name, tbl in pairs(frame.parent.rolls) do
if(tbl[1] == rolltypes[frame.rolltype] and tbl[2]) then
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[tbl[2]] or RAID_CLASS_COLORS[tbl[2]]
GameTooltip:AddLine(name, classColor.r, classColor.g, classColor.b)
end
end
GameTooltip:Show()
end
local function SetItemTip(frame)
if(not frame.link) then return end
GameTooltip:SetOwner(frame, "ANCHOR_TOPLEFT")
GameTooltip:SetHyperlink(frame.link)
if(IsShiftKeyDown()) then
GameTooltip_ShowCompareItem()
end
if(IsModifiedClick("DRESSUP")) then
ShowInspectCursor()
else
ResetCursor()
end
end
local function ItemOnUpdate(self)
if(IsShiftKeyDown()) then
GameTooltip_ShowCompareItem()
end
CursorOnUpdate(self)
end
local function LootClick(frame)
if(IsControlKeyDown()) then
DressUpItemLink(frame.link)
elseif(IsShiftKeyDown()) then
ChatEdit_InsertLink(frame.link)
end
end
local function OnEvent(frame, _, rollID)
cancelled_rolls[rollID] = true
if(frame.rollID ~= rollID) then return end
frame.rollID = nil
frame.time = nil
frame:Hide()
end
local function StatusUpdate(frame)
if(not frame.parent.rollID) then return end
local t = GetLootRollTimeLeft(frame.parent.rollID)
local perc = t / frame.parent.time
frame.spark:Point("CENTER", frame, "LEFT", perc * frame:GetWidth(), 0)
frame:SetValue(t)
if(t > 1000000000) then
frame:GetParent():Hide()
end
end
local function CreateRollButton(parent, ntex, ptex, htex, rolltype, tiptext)
local f = CreateFrame("Button", nil, parent)
E:Point(f, unpack(args))
f:Size(FRAME_HEIGHT - 4)
f:SetNormalTexture(ntex)
if(ptex) then f:SetPushedTexture(ptex) end
f:SetHighlightTexture(htex)
f.rolltype = rolltype
f.parent = parent
f.tiptext = tiptext
f:SetScript("OnEnter", SetTip)
f:SetScript("OnLeave", HideTip)
f:SetScript("OnClick", ClickRoll)
local txt = f:CreateFontString(nil, nil)
txt:FontTemplate(nil, nil, "OUTLINE")
txt:Point("CENTER", 0, rolltype == 2 and 1 or rolltype == 0 and -1.2 or 0)
return f, txt
end
function M:CreateRollFrame()
local frame = CreateFrame("Frame", nil, E.UIParent)
frame:Size(FRAME_WIDTH, FRAME_HEIGHT)
frame:SetTemplate("Default")
frame:SetScript("OnEvent", OnEvent)
frame:RegisterEvent("CANCEL_LOOT_ROLL")
frame:Hide()
local button = CreateFrame("Button", nil, frame)
button:Point("RIGHT", frame, "LEFT", -(E.Spacing*3), 0)
button:Size(FRAME_HEIGHT - (E.Border * 2))
button:CreateBackdrop("Default")
button:SetScript("OnEnter", SetItemTip)
button:SetScript("OnLeave", HideTip2)
button:SetScript("OnUpdate", ItemOnUpdate)
button:SetScript("OnClick", LootClick)
frame.button = button
button.icon = button:CreateTexture(nil, "OVERLAY")
button.icon:SetAllPoints()
button.icon:SetTexCoord(unpack(E.TexCoords))
local tfade = frame:CreateTexture(nil, "BORDER")
tfade:Point("TOPLEFT", frame, "TOPLEFT", 4, 0)
tfade:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 0)
tfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground")
tfade:SetBlendMode("ADD")
tfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .1, .1, .1, 0)
local status = CreateFrame("StatusBar", nil, frame)
status:SetInside()
status:SetScript("OnUpdate", StatusUpdate)
status:SetFrameLevel(status:GetFrameLevel() - 1)
status:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(status)
status:SetStatusBarColor(.8, .8, .8, .9)
status.parent = frame
frame.status = status
status.bg = status:CreateTexture(nil, "BACKGROUND")
status.bg:SetAlpha(0.1)
status.bg:SetAllPoints()
local spark = frame:CreateTexture(nil, "OVERLAY")
spark:Size(14, FRAME_HEIGHT)
spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
spark:SetBlendMode("ADD")
status.spark = spark
local need, needtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Dice-Up", "Interface\\Buttons\\UI-GroupLoot-Dice-Highlight", "Interface\\Buttons\\UI-GroupLoot-Dice-Down", 1, NEED, "LEFT", frame.button, "RIGHT", 5, -1)
local greed, greedtext = CreateRollButton(frame, "Interface\\Buttons\\UI-GroupLoot-Coin-Up", "Interface\\Buttons\\UI-GroupLoot-Coin-Highlight", "Interface\\Buttons\\UI-GroupLoot-Coin-Down", 2, GREED, "LEFT", need, "RIGHT", 0, -1)
local pass, passtext = CreateRollButton(frame, "Interface\\AddOns\\ElvUI\\media\\textures\\UI-GroupLoot-Pass-Up", nil, "Interface\\AddOns\\ElvUI\\media\\textures\\UI-GroupLoot-Pass-Down", 0, PASS, "LEFT", greed, "RIGHT", 0, 2)
frame.needbutt, frame.greedbutt = need, greed
frame.need, frame.greed, frame.pass = needtext, greedtext, passtext
local bind = frame:CreateFontString()
bind:Point("LEFT", pass, "RIGHT", 3, 1)
bind:FontTemplate(nil, nil, "OUTLINE")
frame.fsbind = bind
local loot = frame:CreateFontString(nil, "ARTWORK")
loot:FontTemplate(nil, nil, "OUTLINE")
loot:Point("LEFT", bind, "RIGHT", 0, 0)
loot:Point("RIGHT", frame, "RIGHT", -5, 0)
loot:Size(200, 10)
loot:SetJustifyH("LEFT")
frame.fsloot = loot
frame.rolls = {}
return frame
end
local function GetFrame()
for _, f in ipairs(M.RollBars) do
if(not f.rollID) then
return f
end
end
local f = M:CreateRollFrame()
if(pos == "TOP") then
f:Point("TOP", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "BOTTOM", 0, -4)
else
f:Point("BOTTOM", next(M.RollBars) and M.RollBars[getn(M.RollBars)] or AlertFrameHolder, "TOP", 0, 4)
end
tinsert(M.RollBars, f)
return f
end
function M:START_LOOT_ROLL(_, rollID, time)
if(cancelled_rolls[rollID]) then return end
local f = GetFrame()
f.rollID = rollID
f.time = time
for i in pairs(f.rolls) do f.rolls[i] = nil end
f.need:SetText(0)
f.greed:SetText(0)
f.pass:SetText(0)
local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(rollID)
f.button.icon:SetTexture(texture)
f.button.link = GetLootRollItemLink(rollID)
f.needbutt:Enable()
f.greedbutt:Enable()
SetDesaturation(f.needbutt:GetNormalTexture())
SetDesaturation(f.greedbutt:GetNormalTexture())
f.needbutt:SetAlpha(1)
f.greedbutt:SetAlpha(1)
f.fsbind:SetText(bindOnPickUp and "BoP" or "BoE")
f.fsbind:SetVertexColor(bindOnPickUp and 1 or .3, bindOnPickUp and .3 or 1, bindOnPickUp and .1 or .3)
local color = ITEM_QUALITY_COLORS[quality]
f.fsloot:SetText(name)
f.status:SetStatusBarColor(color.r, color.g, color.b, .7)
f.status.bg:SetTexture(color.r, color.g, color.b)
f.status:SetMinMaxValues(0, time)
f.status:SetValue(time)
f:SetPoint("CENTER", WorldFrame, "CENTER")
f:Show()
if(E.db.general.autoRoll and UnitLevel("player") == MAX_PLAYER_LEVEL and quality == 2 and not bindOnPickUp) then
RollOnLoot(rollID, 2)
end
end
function M:ParseRollChoice(msg)
if not msg then return end
for i, v in pairs(rollpairs) do
local _, _, playername, itemname = find(msg, i)
if(locale == "ruRU" and (v == "greed" or v == "need")) then
local temp = playername
playername = itemname
itemname = temp
end
if(playername and itemname and playername ~= "Everyone") then return playername, itemname, v end
end
end
function M:CHAT_MSG_LOOT(_, msg)
local playername, itemname, rolltype = self:ParseRollChoice(msg)
if(playername and itemname and rolltype) then
local class = select(2, UnitClass(playername))
for _, f in ipairs(M.RollBars) do
if(f.rollID and f.button.link == itemname and not f.rolls[playername]) then
f.rolls[playername] = { rolltype, class }
f[rolltype]:SetText(tonumber(f[rolltype]:GetText()) + 1)
return
end
end
end
end
function M:LoadLootRoll()
if(not E.private.general.lootRoll) then return end
self:RegisterEvent("CHAT_MSG_LOOT")
self:RegisterEvent("START_LOOT_ROLL")
UIParent:UnregisterEvent("START_LOOT_ROLL")
UIParent:UnregisterEvent("CANCEL_LOOT_ROLL")
end
+194
View File
@@ -0,0 +1,194 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:NewModule("Misc", "AceEvent-3.0", "AceTimer-3.0");
E.Misc = M
--Cache global variables
--Lua functions
local format, gsub = string.format, string.gsub
--WoW API / Variables
local CanMerchantRepair = CanMerchantRepair
local GetFriendInfo = GetFriendInfo
local GetGuildRosterInfo = GetGuildRosterInfo
local GetNumFriends = GetNumFriends
local GetNumGuildMembers = GetNumGuildMembers
local GetNumPartyMembers = GetNumPartyMembers
local GetNumRaidMembers = GetNumRaidMembers
local GetPartyMember = GetPartyMember
local GetRepairAllCost = GetRepairAllCost
local GuildRoster = GuildRoster
local IsInGuild = IsInGuild
local IsInInstance = IsInInstance
local IsShiftKeyDown = IsShiftKeyDown
local RepairAllItems = RepairAllItems
local UninviteUnit = UninviteUnit
local UnitInRaid = UnitInRaid
local UnitName = UnitName
local UIErrorsFrame = UIErrorsFrame
local MAX_PARTY_MEMBERS = MAX_PARTY_MEMBERS
local interruptMsg = INTERRUPTED.." %s's \124cff71d5ff\124Hspell:%d\124h[%s]\124h\124r!"
function M:ErrorFrameToggle(event)
if not E.db.general.hideErrorFrame then return end
if event == "PLAYER_REGEN_DISABLED" then
UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
else
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
end
end
function M:COMBAT_LOG_EVENT_UNFILTERED(_, _, event, _, sourceName, _, _, destName, _, _, _, _, spellID, spellName)
if E.db.general.interruptAnnounce == "NONE" then return end
if not (event == "SPELL_INTERRUPT" and sourceName == UnitName("player")) then return end
local party = GetNumPartyMembers()
if E.db.general.interruptAnnounce == "SAY" then
if party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), "SAY")
end
elseif E.db.general.interruptAnnounce == "EMOTE" then
if party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), "EMOTE")
end
else
local raid = GetNumRaidMembers()
local _, instanceType = IsInInstance()
local battleground = instanceType == "pvp"
if E.db.general.interruptAnnounce == "PARTY" then
if party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "PARTY")
end
elseif E.db.general.interruptAnnounce == "RAID" then
if raid > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "RAID")
elseif party > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "PARTY")
end
elseif E.db.general.interruptAnnounce == "RAID_ONLY" then
if raid > 0 then
SendChatMessage(format(interruptMsg, destName, spellID, spellName), battleground and "BATTLEGROUND" or "RAID")
end
end
end
end
function M:MERCHANT_SHOW()
if E.db.general.vendorGrays then
E:GetModule("Bags"):VendorGrays(nil, true)
end
local autoRepair = E.db.general.autoRepair
if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end
local cost, possible = GetRepairAllCost()
if cost > 0 then
if possible then
RepairAllItems(autoRepair == "PLAYER")
E:Print(L["Your items have been repaired for: "]..E:FormatMoney(cost, "BLIZZARD"))
else
E:Print(L["You don't have enough money to repair."])
end
end
end
function M:DisbandRaidGroup()
if UnitInRaid("player") then
for i = 1, GetNumRaidMembers() do
local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i)
if online and name ~= E.myname then
UninviteUnit(name)
end
end
else
for i = MAX_PARTY_MEMBERS, 1, -1 do
if GetPartyMember(i) then
UninviteUnit(UnitName("party"..i))
end
end
end
LeaveParty()
end
function M:PVPMessageEnhancement(_, msg)
if not E.db.general.enhancedPvpMessages then return end
local _, instanceType = IsInInstance()
if instanceType == "pvp" or instanceType == "arena" then
RaidNotice_AddMessage(RaidBossEmoteFrame, msg, ChatTypeInfo["RAID_BOSS_EMOTE"])
end
end
local hideStatic = false
function M:AutoInvite(event, leaderName)
if not E.db.general.autoAcceptInvite then return end
if event == "PARTY_INVITE_REQUEST" then
if GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 then return end
hideStatic = true
-- Update Guild and Friendlist
local numFriends = GetNumFriends()
if numFriends > 0 then ShowFriends() end
if IsInGuild() then GuildRoster() end
local inGroup = false
for friendIndex = 1, numFriends do
local friendName = gsub(GetFriendInfo(friendIndex), "-.*", "")
if friendName == leaderName then
AcceptGroup()
inGroup = true
break
end
end
if not inGroup then
for guildIndex = 1, GetNumGuildMembers(true) do
local guildMemberName = gsub(GetGuildRosterInfo(guildIndex), "-.*", "")
if guildMemberName == leaderName then
AcceptGroup()
inGroup = true
break
end
end
end
elseif event == "PARTY_MEMBERS_CHANGED" and hideStatic == true then
StaticPopup_Hide("PARTY_INVITE")
hideStatic = false
end
end
function M:ForceCVars()
if E.private.general.loot then
if E.private.general.lootUnderMouse then
E:DisableMover("LootFrameMover")
else
E:EnableMover("LootFrameMover")
end
end
end
function M:Initialize()
self:LoadRaidMarker()
self:LoadLoot()
self:LoadLootRoll()
self:LoadChatBubbles()
self:RegisterEvent("MERCHANT_SHOW")
self:RegisterEvent("PLAYER_REGEN_DISABLED", "ErrorFrameToggle")
self:RegisterEvent("PLAYER_REGEN_ENABLED", "ErrorFrameToggle")
-- self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_HORDE", "PVPMessageEnhancement")
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE", "PVPMessageEnhancement")
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL", "PVPMessageEnhancement")
self:RegisterEvent("PARTY_INVITE_REQUEST", "AutoInvite")
self:RegisterEvent("PARTY_MEMBERS_CHANGED", "AutoInvite")
self:RegisterEvent("CVAR_UPDATE", "ForceCVars")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "ForceCVars")
end
local function InitializeCallback()
M:Initialize()
end
E:RegisterModule(M:GetName(), InitializeCallback)
+107
View File
@@ -0,0 +1,107 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("Misc");
--Cache global variables
--Lua functions
local sin, cos, pi = math.sin, math.cos, math.pi
--WoW API / Variables
local CreateFrame = CreateFrame
local GetNumPartyMembers = GetNumPartyMembers
local UnitInRaid = UnitInRaid
local UnitIsPartyLeader = UnitIsPartyLeader
local UnitExists, UnitIsDead = UnitExists, UnitIsDead
local GetCursorPosition = GetCursorPosition
local PlaySound = PlaySound
local SetRaidTarget = SetRaidTarget
local SetRaidTargetIconTexture = SetRaidTargetIconTexture
local UIErrorsFrame = UIErrorsFrame
local ButtonIsDown
function M:RaidMarkCanMark()
if not self.RaidMarkFrame then return false end
if GetNumPartyMembers() > 0 then
if UnitIsPartyLeader("player") or UnitInRaid("player") and not UnitIsPartyLeader("player") then
return true
else
UIErrorsFrame:AddMessage(L["You don't have permission to mark targets."], 1.0, 0.1, 0.1, 1.0)
return false
end
else
return true
end
end
function M:RaidMarkShowIcons()
if not UnitExists("target") or UnitIsDead("target") then
return
end
local x, y = GetCursorPosition()
local scale = E.UIParent:GetEffectiveScale()
self.RaidMarkFrame:SetPoint("CENTER", E.UIParent, "BOTTOMLEFT", x / scale, y / scale)
self.RaidMarkFrame:Show()
end
function RaidMark_HotkeyPressed(keystate)
ButtonIsDown = keystate == "down" and M:RaidMarkCanMark()
if ButtonIsDown and M.RaidMarkFrame then
M:RaidMarkShowIcons()
elseif M.RaidMarkFrame then
M.RaidMarkFrame:Hide()
end
end
function M:RaidMark_OnEvent()
if ButtonIsDown and self.RaidMarkFrame then
self:RaidMarkShowIcons()
end
end
M:RegisterEvent("PLAYER_TARGET_CHANGED", "RaidMark_OnEvent")
function M:RaidMarkButton_OnEnter()
this.Texture:ClearAllPoints()
this.Texture:SetPoint("TOPLEFT", -10, 10)
this.Texture:SetPoint("BOTTOMRIGHT", 10, -10)
end
function M:RaidMarkButton_OnLeave()
this.Texture:SetAllPoints()
end
function M:RaidMarkButton_OnClick(button)
PlaySound("UChatScrollButton")
SetRaidTarget("target", button ~= "RightButton" and this:GetID() or 0)
this:GetParent():Hide()
end
function M:LoadRaidMarker()
local marker = CreateFrame("Frame", nil, E.UIParent)
marker:EnableMouse(true)
marker:SetWidth(100)
marker:SetHeight(100)
marker:SetFrameStrata("DIALOG")
for i = 1, 8 do
local button = CreateFrame("Button", "RaidMarkIconButton" .. i, marker)
button:SetWidth(40)
button:SetHeight(40)
button:SetID(i)
button.Texture = button:CreateTexture(button:GetName() .. "NormalTexture", "ARTWORK")
button.Texture:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
button.Texture:SetAllPoints()
SetRaidTargetIconTexture(button.Texture, i)
button:RegisterForClicks("LeftbuttonUp","RightbuttonUp")
button:SetScript("OnClick", M.RaidMarkButton_OnClick)
button:SetScript("OnEnter", M.RaidMarkButton_OnEnter)
button:SetScript("OnLeave", M.RaidMarkButton_OnLeave)
if i == 8 then
button:SetPoint("CENTER", 0, 0)
else
local angle = pi / 0.7 * i
button:SetPoint("CENTER", sin(angle) * 60, cos(angle) * 60)
end
end
M.RaidMarkFrame = marker
end
+544
View File
@@ -0,0 +1,544 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
local select, unpack, pairs = select, unpack, pairs
local tonumber = tonumber
local band = bit.band
local gsub = string.gsub
local tinsert, tremove, wipe = table.insert, table.remove, table.wipe
local CreateFrame = CreateFrame
local UnitAura = UnitAura
local UnitGUID = UnitGUID
local GetSpellTexture = GetSpellTexture
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local AURA_TYPE_BUFF = AURA_TYPE_BUFF
local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
local RaidIconBit = {
["STAR"] = "0x00100000",
["CIRCLE"] = "0x00200000",
["DIAMOND"] = "0x00400000",
["TRIANGLE"] = "0x00800000",
["MOON"] = "0x01000000",
["SQUARE"] = "0x02000000",
["CROSS"] = "0x04000000",
["SKULL"] = "0x08000000"
}
local RaidIconIndex = {
"STAR",
"CIRCLE",
"DIAMOND",
"TRIANGLE",
"MOON",
"SQUARE",
"CROSS",
"SKULL"
}
local ByRaidIcon = {}
local ByName = {}
local auraCache = {}
local buffCache = {}
local debuffCache = {}
local auraList = {}
local auraSpellID = {}
local auraName = {}
local auraExpiration = {}
local auraStacks = {}
local auraCaster = {}
local auraDuration = {}
local auraTexture = {}
local auraType = {}
local cachedAuraDurations = {}
local TimeColors = {
[0] = "|cffeeeeee",
[1] = "|cffeeeeee",
[2] = "|cffeeeeee",
[3] = "|cffFFEE00",
[4] = "|cfffe0000"
}
local AURA_UPDATE_INTERVAL = 0.1
local PolledHideIn
do
local Framelist = {}
local Watcherframe = CreateFrame("Frame")
local WatcherframeActive = false
local timeToUpdate = 0
local function CheckFramelist()
local curTime = GetTime()
if curTime < timeToUpdate then return end
local framecount = 0
timeToUpdate = curTime + AURA_UPDATE_INTERVAL
for frame, expiration in pairs(Framelist) do
if expiration < curTime then
frame:Hide()
Framelist[frame] = nil
else
if frame.Poll then frame:Poll(expiration) end
framecount = framecount + 1
end
end
if framecount == 0 then Watcherframe:SetScript("OnUpdate", nil); WatcherframeActive = false end
end
function PolledHideIn(frame, expiration)
if expiration == 0 then
frame:Hide()
Framelist[frame] = nil
else
Framelist[frame] = expiration
frame:Show()
if not WatcherframeActive then
Watcherframe:SetScript("OnUpdate", CheckFramelist)
WatcherframeActive = true
end
end
end
end
local function GetSpellDuration(spellID)
if spellID then return cachedAuraDurations[spellID] end
end
local function SetSpellDuration(spellID, duration)
if spellID then cachedAuraDurations[spellID] = duration end
end
local function UpdateAuraTime(frame, expiration)
local timeleft = expiration - GetTime()
local timervalue, formatid = E:GetTimeInfo(timeleft, 4)
local timeFormat = E.TimeFormats[3][2]
if timervalue < 4 then
timeFormat = E.TimeFormats[4][2]
end
frame.timeLeft:SetFormattedText(("%s%s|r"):format(TimeColors[formatid], timeFormat), timervalue)
end
local function RemoveAuraInstance(guid, spellID, caster)
if guid and spellID and auraList[guid] then
local instanceID = tostring(guid)..tostring(spellID)..(tostring(caster or "UNKNOWN_CASTER"))
local auraID = spellID..(tostring(caster or "UNKNOWN_CASTER"))
if auraList[guid][auraID] then
auraSpellID[instanceID] = nil
auraName[instanceID] = nil
auraExpiration[instanceID] = nil
auraStacks[instanceID] = nil
auraCaster[instanceID] = nil
auraDuration[instanceID] = nil
auraTexture[instanceID] = nil
auraType[instanceID] = nil
auraList[guid][auraID] = nil
end
end
end
local function GetAuraList(guid)
if guid and auraList[guid] then return auraList[guid] end
end
local function GetAuraInstance(guid, auraID)
if guid and auraID then
local instanceID = guid..auraID
local spellID, name, expiration, stacks, caster, duration, texture, type
spellID = auraSpellID[instanceID]
name = auraName[instanceID]
expiration = auraExpiration[instanceID]
stacks = auraStacks[instanceID]
caster = auraCaster[instanceID]
duration = auraDuration[instanceID]
texture = auraTexture[instanceID]
type = auraType[instanceID]
return spellID, name, expiration, stacks, caster, duration, texture, type
end
end
local function SetAuraInstance(guid, name, spellID, expiration, stacks, caster, duration, texture, type)
if guid and spellID and caster and texture then
local auraID = spellID..(tostring(caster or "UNKNOWN_CASTER"))
local instanceID = guid..auraID
auraList[guid] = auraList[guid] or {}
auraList[guid][auraID] = instanceID
auraSpellID[instanceID] = spellID
auraName[instanceID] = name
auraExpiration[instanceID] = expiration
auraStacks[instanceID] = stacks
auraCaster[instanceID] = caster
auraDuration[instanceID] = duration
auraTexture[instanceID] = texture
auraType[instanceID] = type
end
end
local function WipeAuraList(guid)
if guid and auraList[guid] then
local unitAuraList = auraList[guid]
for auraID, instanceID in pairs(unitAuraList) do
auraSpellID[instanceID] = nil
auraName[instanceID] = nil
auraExpiration[instanceID] = nil
auraStacks[instanceID] = nil
auraCaster[instanceID] = nil
auraDuration[instanceID] = nil
auraTexture[instanceID] = nil
auraType[instanceID] = nil
unitAuraList[auraID] = nil
end
end
end
function mod:CleanAuraLists()
local currentTime = GetTime()
for guid, instanceList in pairs(auraList) do
local auraCount = 0
for auraID, instanceID in pairs(instanceList) do
local expiration = auraExpiration[instanceID]
if expiration and expiration < currentTime then
auraList[guid][auraID] = nil
auraSpellID[instanceID] = nil
auraName[instanceID] = nil
auraExpiration[instanceID] = nil
auraStacks[instanceID] = nil
auraCaster[instanceID] = nil
auraDuration[instanceID] = nil
auraTexture[instanceID] = nil
auraType[instanceID] = nil
else
auraCount = auraCount + 1
end
end
if auraCount == 0 then
auraList[guid] = nil
end
end
end
function mod:SetAura(aura, icon, count, expirationTime)
aura.icon:SetTexture(icon)
if count > 1 then
aura.count:SetText(count)
else
aura.count:SetText("")
end
aura:Show()
PolledHideIn(aura, expirationTime)
end
function mod:HideAuraIcons(auras)
for i = 1, getn(auras.icons) do
PolledHideIn(auras.icons[i], 0)
end
end
local currentAura = {}
function mod:UpdateElement_Auras(frame)
if not frame.HealthBar:IsShown() then return end
local guid = frame.guid
if not guid then
if RAID_CLASS_COLORS[frame.UnitClass] then
local name = gsub(frame.oldName:GetText(), "%s%(%*%)","")
guid = ByName[name]
elseif frame.RaidIcon:IsShown() then
guid = ByRaidIcon[frame.RaidIconType]
end
if guid then
frame.guid = guid
else
return
end
end
local hasDebuffs = false
local hasBuffs = false
local numDebuff = 0
local numBuff = 0
local aurasOnUnit = GetAuraList(guid)
debuffCache = wipe(debuffCache)
buffCache = wipe(buffCache)
if aurasOnUnit then
local numAuras = 0
local aura
for instanceid in pairs(aurasOnUnit) do
numAuras = (numDebuff + numBuff) + 1
aura = wipe(currentAura[numAuras] or {})
aura.spellID, aura.name, aura.expirationTime, aura.count, aura.caster, aura.duration, aura.icon, aura.type = GetAuraInstance(guid, instanceid)
local filter = false
local db = self.db.units[frame.UnitType].buffs.filters
if aura.type == AURA_TYPE_DEBUFF then
db = self.db.units[frame.UnitType].debuffs.filters
end
if db.personal and aura.caster == UnitGUID("player") then
filter = true
end
local trackFilter = E.global["unitframe"]["aurafilters"][db.filter]
if db.filter and trackFilter then
local spell = trackFilter.spells[tonumber(aura.spellID)] or trackFilter.spells[aura.name]
if trackFilter.type == "Whitelist" then
if spell and spell.enable then
filter = true
end
elseif trackFilter.type == "Blacklist" and spell and spell.enable then
filter = false
end
end
if filter ~= true then
numAuras = numAuras - 1
RemoveAuraInstance(guid, aura.spellID, aura.caster)
wipe(aura)
end
if tonumber(aura.spellID) then
aura.unit = frame.unit
if aura.expirationTime > GetTime() then
if aura.type == "BUFF" then
numBuff = numBuff + 1
buffCache[numBuff] = aura
else
numDebuff = numDebuff + 1
debuffCache[numDebuff] = aura
end
end
end
end
wipe(currentAura)
end
local frameNum = 1
local maxAuras = getn(frame.Debuffs.icons)
local maxDuration = self.db.units[frame.UnitType].debuffs.filters.maxDuration
self:HideAuraIcons(frame.Debuffs)
if numDebuff > 0 and self.db.units[frame.UnitType].debuffs.enable then
for index = 1, getn(debuffCache) do
if frameNum > maxAuras then break end
local debuff = debuffCache[index]
if debuff.spellID and debuff.expirationTime and debuff.duration <= maxDuration then
self:SetAura(frame.Debuffs.icons[frameNum], debuff.icon, debuff.count, debuff.expirationTime)
frameNum = frameNum + 1
hasDebuffs = true
end
end
end
frameNum = 1
maxAuras = getn(frame.Buffs.icons)
maxDuration = self.db.units[frame.UnitType].buffs.filters.maxDuration
self:HideAuraIcons(frame.Buffs)
if numBuff > 0 and self.db.units[frame.UnitType].buffs.enable then
for index = 1, getn(buffCache) do
if frameNum > maxAuras then break end
local buff = buffCache[index]
if buff.spellID and buff.expirationTime and buff.duration <= maxDuration then
self:SetAura(frame.Buffs.icons[frameNum], buff.icon, buff.count, buff.expirationTime)
frameNum = frameNum + 1
hasBuffs = true
end
end
end
debuffCache = wipe(debuffCache)
buffCache = wipe(buffCache)
local TopLevel = frame.HealthBar
local TopOffset = ((self.db.units[frame.UnitType].showName and select(2, frame.Name:GetFont()) + 5) or 0)
if hasDebuffs then
TopOffset = TopOffset + 3
frame.Debuffs:SetPoint("BOTTOMLEFT", TopLevel, "TOPLEFT", 0, TopOffset)
frame.Debuffs:SetPoint("BOTTOMRIGHT", TopLevel, "TOPRIGHT", 0, TopOffset)
TopLevel = frame.Debuffs
TopOffset = 3
end
if hasBuffs then
if not hasDebuffs then
TopOffset = TopOffset + 3
end
frame.Buffs:SetPoint("BOTTOMLEFT", TopLevel, "TOPLEFT", 0, TopOffset)
frame.Buffs:SetPoint("BOTTOMRIGHT", TopLevel, "TOPRIGHT", 0, TopOffset)
TopLevel = frame.Buffs
TopOffset = 3
end
if frame.TopLevelFrame ~= TopLevel then
frame.TopLevelFrame = TopLevel
frame.TopOffset = TopOffset
end
end
function mod:UpdateElement_AurasByUnitID(unit)
--[[local guid = UnitGUID(unit)
WipeAuraList(guid)
local index = 1
local name, _, texture, count, _, duration, expirationTime, unitCaster, _, _, spellID = UnitAura(unit, index, "HARMFUL")
while name do
SetSpellDuration(spellID, duration)
SetAuraInstance(guid, name, spellID, expirationTime, count, UnitGUID(unitCaster or ""), duration, texture, AURA_TYPE_DEBUFF)
index = index + 1
name , _, texture, count, _, duration, expirationTime, unitCaster, _, _, spellID = UnitAura(unit, index, "HARMFUL")
end
index = 1
local name, _, texture, count, _, duration, expirationTime, unitCaster, _, _, spellID = UnitAura(unit, index, "HELPFUL")
while name do
SetSpellDuration(spellID, duration)
SetAuraInstance(guid, name, spellID, expirationTime, count, UnitGUID(unitCaster or ""), duration, texture, AURA_TYPE_BUFF)
index = index + 1
name, _, texture, count, _, duration, expirationTime, unitCaster, _, _, spellID = UnitAura(unit, index, "HELPFUL")
end
local raidIcon, name
if UnitPlayerControlled(unit) then name = UnitName(unit) end
raidIcon = RaidIconIndex[GetRaidTargetIndex(unit) or ""]
if raidIcon then ByRaidIcon[raidIcon] = guid end
local frame = self:SearchForFrame(guid, raidIcon, name)
if frame then
self:UpdateElement_Auras(frame)
end]]
end
function mod:COMBAT_LOG_EVENT_UNFILTERED(_, _, event, sourceGUID, _, _, destGUID, destName, destFlags, ...)
if destGUID == UnitGUID("target") then return end
--if band(destFlags, COMBATLOG_OBJECT_REACTION_FRIENDLY) ~= 0 then then return
if not (event == "SPELL_AURA_APPLIED" or event == "SPELL_AURA_REFRESH" or event == "SPELL_AURA_APPLIED_DOSE" or event == "SPELL_AURA_REMOVED_DOSE" or event == "SPELL_AURA_BROKEN" or event == "SPELL_AURA_BROKEN_SPELL" or event == "SPELL_AURA_REMOVED") then return end
--local spellID, spellName, _, auraType, stackCount = ...
if event == "SPELL_AURA_APPLIED" or event == "SPELL_AURA_REFRESH" then
local duration = GetSpellDuration(spellID)
local texture = GetSpellTexture(spellID)
SetAuraInstance(destGUID, spellName, spellID, GetTime() + (duration or 0), 1, sourceGUID, duration, texture, auraType)
elseif event == "SPELL_AURA_APPLIED_DOSE" or event == "SPELL_AURA_REMOVED_DOSE" then
local duration = GetSpellDuration(spellID)
local texture = GetSpellTexture(spellID)
SetAuraInstance(destGUID, spellName, spellID, GetTime() + (duration or 0), stackCount, sourceGUID, duration, texture, auraType)
elseif event == "SPELL_AURA_BROKEN" or event == "SPELL_AURA_BROKEN_SPELL" or event == "SPELL_AURA_REMOVED" then
RemoveAuraInstance(destGUID, spellID, sourceGUID)
end
local name, raidIcon
if band(destFlags, COMBATLOG_OBJECT_CONTROL_PLAYER) > 0 then
local rawName = strsplit("-", destName)
ByName[rawName] = destGUID
name = rawName
end
for iconName, bitmask in pairs(RaidIconBit) do
if band(destFlags, bitmask) > 0 then
ByRaidIcon[iconName] = destGUID
raidIcon = iconName
break
end
end
local frame = self:SearchForFrame(destGUID, raidIcon, name)
if frame then
self:UpdateElement_Auras(frame)
end
end
function mod:CreateAuraIcon(parent)
local aura = CreateFrame("Frame", nil, parent)
self:StyleFrame(aura, true)
aura.icon = aura:CreateTexture(nil, "OVERLAY")
aura.icon:SetAllPoints()
aura.icon:SetTexCoord(unpack(E.TexCoords))
aura.timeLeft = aura:CreateFontString(nil, "OVERLAY")
aura.timeLeft:SetPoint("TOPLEFT", 2, 2)
aura.timeLeft:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
aura.count = aura:CreateFontString(nil, "OVERLAY")
aura.count:SetPoint("BOTTOMRIGHT", 0, 0)
aura.count:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
aura.Poll = parent.PollFunction
return aura
end
function mod:Auras_SizeChanged(width)
local numAuras = getn(self.icons)
for i = 1, numAuras do
self.icons[i]:SetWidth(((width - numAuras) / numAuras) - (E.private.general.pixelPerfect and 0 or 3))
self.icons[i]:SetHeight((self.db.baseHeight or 18) * (self:GetParent().HealthBar.currentScale or 1))
end
self:SetHeight((self.db.baseHeight or 18) * (self:GetParent().HealthBar.currentScale or 1))
end
function mod:UpdateAuraIcons(auras)
local maxAuras = auras.db.numAuras
local numCurrentAuras = getn(auras.icons)
if(numCurrentAuras > maxAuras) then
for i = maxAuras, numCurrentAuras do
tinsert(auraCache, auras.icons[i])
auras.icons[i]:Hide()
auras.icons[i] = nil
end
end
if(numCurrentAuras ~= maxAuras) then
self.Auras_SizeChanged(auras, auras:GetWidth(), auras:GetHeight())
end
for i = 1, maxAuras do
auras.icons[i] = auras.icons[i] or tremove(auraCache) or mod:CreateAuraIcon(auras)
auras.icons[i]:SetParent(auras)
auras.icons[i]:ClearAllPoints()
auras.icons[i]:Hide()
auras.icons[i]:SetHeight(auras.db.baseHeight or 18)
if(auras.side == "LEFT") then
if(i == 1) then
auras.icons[i]:SetPoint("BOTTOMLEFT", auras, "BOTTOMLEFT")
else
auras.icons[i]:SetPoint("LEFT", auras.icons[i-1], "RIGHT", E.Border + E.Spacing*3, 0)
end
else
if(i == 1) then
auras.icons[i]:SetPoint("BOTTOMRIGHT", auras, "BOTTOMRIGHT")
else
auras.icons[i]:SetPoint("RIGHT", auras.icons[i-1], "LEFT", -(E.Border + E.Spacing*3), 0)
end
end
end
end
function mod:ConstructElement_Auras(frame, side)
local auras = CreateFrame("Frame", nil, frame)
auras:SetScript("OnSizeChanged", mod.Auras_SizeChanged)
auras:SetHeight(18)
auras.side = side
auras.PollFunction = UpdateAuraTime
auras.icons = {}
return auras
end
@@ -0,0 +1,247 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
local select, unpack = select, unpack
local CreateFrame = CreateFrame
local GetTime = GetTime
local UnitCastingInfo = UnitCastingInfo
local UnitChannelInfo = UnitChannelInfo
local FAILED = FAILED
local INTERRUPTED = INTERRUPTED
function mod:UpdateElement_CastBarOnUpdate(elapsed)
if self.casting then
self.value = self.value + elapsed
if self.value >= self.maxValue then
self:SetValue(self.maxValue)
self:Hide()
return
end
self:SetValue(self.value)
if self.castTimeFormat == "CURRENT" then
self.Time:SetFormattedText("%.1f", self.value)
elseif self.castTimeFormat == "CURRENT_MAX" then
self.Time:SetFormattedText("%.1f / %.1f", self.value, self.maxValue)
else --REMAINING
self.Time:SetFormattedText("%.1f", (self.maxValue - self.value))
end
if self.Spark then
local sparkPosition = (self.value / self.maxValue) * self:GetWidth()
self.Spark:SetPoint("CENTER", self, "LEFT", sparkPosition, 0)
end
elseif self.channeling then
self.value = self.value - elapsed
if self.value <= 0 then
self:Hide()
return
end
self:SetValue(self.value)
if self.channelTimeFormat == "CURRENT" then
self.Time:SetFormattedText("%.1f", (self.maxValue - self.value))
elseif self.channelTimeFormat == "CURRENT_MAX" then
self.Time:SetFormattedText("%.1f / %.1f", (self.maxValue - self.value), self.maxValue)
else --REMAINING
self.Time:SetFormattedText("%.1f", self.value)
end
elseif self.holdTime > 0 then
self.holdTime = self.holdTime - elapsed
else
self:Hide()
end
end
function mod:UpdateElement_Cast(frame, event, unit, ...)
if self.db.units[frame.UnitType].castbar.enable ~= true then return end
if frame.unit ~= unit then return end
if event == "UNIT_SPELLCAST_START" then
local name, _, _, texture, startTime, endTime = UnitCastingInfo(unit)
if not name then
frame.CastBar:Hide()
return
end
if frame.CastBar.Spark then
frame.CastBar.Spark:Show()
end
frame.CastBar.Name:SetText(name)
frame.CastBar.value = (GetTime() - (startTime / 1000))
frame.CastBar.maxValue = (endTime - startTime) / 1000
frame.CastBar:SetMinMaxValues(0, frame.CastBar.maxValue)
frame.CastBar:SetValue(frame.CastBar.value)
if frame.CastBar.Icon then
frame.CastBar.Icon.texture:SetTexture(texture)
end
frame.CastBar.casting = true
frame.CastBar.channeling = nil
frame.CastBar.holdTime = 0
frame.CastBar:Show()
elseif event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_CHANNEL_STOP" then
if not frame.CastBar:IsVisible() then
frame.CastBar:Hide()
end
if (frame.CastBar.casting and event == "UNIT_SPELLCAST_STOP") or
(frame.CastBar.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP") then
if frame.CastBar.Spark then
frame.CastBar.Spark:Hide()
end
frame.CastBar:SetValue(frame.CastBar.maxValue)
if event == "UNIT_SPELLCAST_STOP" then
frame.CastBar.casting = nil
else
frame.CastBar.channeling = nil
end
frame.CastBar:Hide()
end
elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" then
if frame.CastBar:IsShown() then
frame.CastBar:SetValue(frame.CastBar.maxValue)
if frame.CastBar.Spark then
frame.CastBar.Spark:Hide()
end
if event == "UNIT_SPELLCAST_FAILED" then
frame.CastBar.Name:SetText(FAILED)
else
frame.CastBar.Name:SetText(INTERRUPTED)
end
frame.CastBar.casting = nil
frame.CastBar.channeling = nil
frame.CastBar.holdTime = self.db.units[frame.UnitType].castbar.timeToHold --How long the castbar should stay visible after being interrupted, in seconds
end
elseif event == "UNIT_SPELLCAST_DELAYED" then
if frame:IsShown() then
local name, _, _, _, startTime, endTime = UnitCastingInfo(unit)
if not name then
-- if there is no name, there is no bar
frame.CastBar:Hide()
return
end
frame.CastBar.Name:SetText(name)
frame.CastBar.value = (GetTime() - (startTime / 1000))
frame.CastBar.maxValue = (endTime - startTime) / 1000
frame.CastBar:SetMinMaxValues(0, frame.CastBar.maxValue)
if not frame.CastBar.casting then
if frame.CastBar.Spark then
frame.CastBar.Spark:Show()
end
frame.CastBar.casting = true
frame.CastBar.channeling = nil
end
end
elseif event == "UNIT_SPELLCAST_CHANNEL_START" then
local name, _, _, texture, startTime, endTime = UnitChannelInfo(unit)
if not name then
frame.CastBar:Hide()
return
end
frame.CastBar.Name:SetText(name)
frame.CastBar.value = (endTime / 1000) - GetTime()
frame.CastBar.maxValue = (endTime - startTime) / 1000
frame.CastBar:SetMinMaxValues(0, frame.CastBar.maxValue)
frame.CastBar:SetValue(frame.CastBar.value)
frame.CastBar.holdTime = 0
if frame.CastBar.Icon then
frame.CastBar.Icon.texture:SetTexture(texture)
end
if frame.CastBar.Spark then
frame.CastBar.Spark:Hide()
end
frame.CastBar.casting = nil
frame.CastBar.channeling = true
frame.CastBar:Show()
elseif event == "UNIT_SPELLCAST_CHANNEL_UPDATE" then
if frame.CastBar:IsShown() then
local name, _, _, _, startTime, endTime = UnitChannelInfo(unit)
if not name then
frame.CastBar:Hide()
return
end
frame.CastBar.Name:SetText(name)
frame.CastBar.value = ((endTime / 1000) - GetTime())
frame.CastBar.maxValue = (endTime - startTime) / 1000
frame.CastBar:SetMinMaxValues(0, frame.CastBar.maxValue)
frame.CastBar:SetValue(frame.CastBar.value)
end
end
end
function mod:ConfigureElement_CastBar(frame)
local castBar = frame.CastBar
castBar:ClearAllPoints()
castBar:SetPoint("TOPLEFT", frame.HealthBar, "BOTTOMLEFT", 0, -self.db.units[frame.UnitType].castbar.offset)
castBar:SetPoint("TOPRIGHT", frame.HealthBar, "BOTTOMRIGHT", 0, -self.db.units[frame.UnitType].castbar.offset)
castBar:SetHeight(self.db.units[frame.UnitType].castbar.height)
castBar.Icon:SetPoint("TOPLEFT", frame.HealthBar, "TOPRIGHT", self.db.units[frame.UnitType].castbar.offset, 0);
castBar.Icon:SetPoint("BOTTOMLEFT", castBar, "BOTTOMRIGHT", self.db.units[frame.UnitType].castbar.offset, 0);
castBar.Icon:SetWidth(self.db.units[frame.UnitType].castbar.height + self.db.units[frame.UnitType].healthbar.height + self.db.units[frame.UnitType].castbar.offset)
castBar.Time:SetPoint("TOPRIGHT", castBar, "BOTTOMRIGHT", 0, -E.Border*3)
castBar.Name:SetPoint("TOPLEFT", castBar, "BOTTOMLEFT", 0, -E.Border*3)
castBar.Name:SetPoint("TOPRIGHT", castBar.Time, "TOPLEFT")
castBar.Name:SetJustifyH("LEFT")
castBar.Name:SetJustifyV("TOP")
castBar.Name:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
castBar.Time:SetJustifyH("RIGHT")
castBar.Time:SetJustifyV("TOP")
castBar.Time:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
if self.db.units[frame.UnitType].castbar.hideSpellName then
castBar.Name:Hide()
else
castBar.Name:Show()
end
if self.db.units[frame.UnitType].castbar.hideTime then
castBar.Time:Hide()
else
castBar.Time:Show()
end
castBar:SetStatusBarTexture(LSM:Fetch("statusbar", self.db.statusbar))
castBar:SetStatusBarColor(self.db.castColor.r, self.db.castColor.g, self.db.castColor.b)
castBar.castTimeFormat = self.db.units[frame.UnitType].castbar.castTimeFormat
castBar.channelTimeFormat = self.db.units[frame.UnitType].castbar.channelTimeFormat
end
function mod:ConstructElement_CastBar(parent)
local frame = CreateFrame("StatusBar", "$parentCastBar", parent)
self:StyleFrame(frame)
--frame:SetScript("OnUpdate", mod.UpdateElement_CastBarOnUpdate)
frame.Icon = CreateFrame("Frame", nil, frame)
frame.Icon.texture = frame.Icon:CreateTexture(nil, "BORDER")
frame.Icon.texture:SetAllPoints()
frame.Icon.texture:SetTexCoord(unpack(E.TexCoords))
self:StyleFrame(frame.Icon)
frame.Name = frame:CreateFontString(nil, "OVERLAY")
frame.Time = frame:CreateFontString(nil, "OVERLAY")
frame.Spark = frame:CreateTexture(nil, "OVERLAY")
frame.Spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
frame.Spark:SetBlendMode("ADD")
--frame.Spark:SetSize(15, 15)
frame:Hide()
return frame
end
@@ -0,0 +1,67 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local ComboColors = {
[1] = {0.69, 0.31, 0.31},
[2] = {0.69, 0.31, 0.31},
[3] = {0.65, 0.63, 0.35},
[4] = {0.65, 0.63, 0.35},
[5] = {0.33, 0.59, 0.33}
}
local GetComboPoints = GetComboPoints
local MAX_COMBO_POINTS = MAX_COMBO_POINTS
function mod:UpdateElement_CPoints(frame)
if not self.db.comboPoints then return end
if frame.UnitType == "FRIENDLY_PLAYER" or frame.UnitType == "FRIENDLY_NPC" then return end
local numPoints
if UnitExists("target") and frame.isTarget then
numPoints = GetComboPoints("player", "target")
end
if numPoints and numPoints > 0 then
frame.CPoints:Show()
for i = 1, MAX_COMBO_POINTS do
if i <= numPoints then
frame.CPoints[i]:Show()
else
frame.CPoints[i]:Hide()
end
end
else
frame.CPoints:Hide()
end
end
function mod:ConfigureElement_CPoints(frame)
if self.db.comboPoints and not frame.CPoints:IsShown() then
frame.CPoints:Show()
elseif frame.CPoints:IsShown() then
frame.CPoints:Hide()
end
end
function mod:ConstructElement_CPoints(parent)
local frame = CreateFrame("Frame", nil, parent.HealthBar)
frame:SetPoint("CENTER", parent.HealthBar, "BOTTOM")
frame:SetWidth(68)
frame:SetHeight(1)
frame:Hide()
for i = 1, MAX_COMBO_POINTS do
frame[i] = frame:CreateTexture(nil, "OVERLAY")
frame[i]:SetTexture([[Interface\AddOns\ElvUI\media\textures\bubbleTex.tga]])
frame[i]:SetWidth(12)
frame[i]:SetHeight(12)
frame[i]:SetVertexColor(unpack(ComboColors[i]))
if i == 1 then
frame[i]:SetPoint("LEFT", frame, "TOPLEFT")
else
frame[i]:SetPoint("LEFT", frame[i-1], "RIGHT", 2, 0)
end
end
return frame
end
@@ -0,0 +1,56 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
local CreateFrame = CreateFrame
function mod:UpdateElement_Glow(frame)
if not frame.HealthBar:IsShown() then return end
local r, g, b, shouldShow
if frame.isTarget and self.db.useTargetGlow then
r, g, b = 1, 1, 1
shouldShow = true
else
local health = frame.oldHealthBar:GetValue()
local _, maxHealth = frame.oldHealthBar:GetMinMaxValues()
local perc = health / maxHealth
if perc <= self.db.lowHealthThreshold then
if perc <= self.db.lowHealthThreshold / 2 then
r, g, b = 1, 0, 0
else
r, g, b = 1, 1, 0
end
shouldShow = true
end
end
if shouldShow then
frame.Glow:Show()
if r ~= frame.Glow.r or g ~= frame.Glow.g or b ~= frame.Glow.b then
frame.Glow:SetBackdropBorderColor(r, g, b)
frame.Glow.r, frame.Glow.g, frame.Glow.b = r, g, b
end
elseif frame.Glow:IsShown() then
frame.Glow:Hide()
end
end
function mod:ConfigureElement_Glow(frame)
end
function mod:ConstructElement_Glow(frame)
local f = CreateFrame("Frame", nil, frame)
f:SetFrameLevel(frame.HealthBar:GetFrameLevel() - 1)
E:SetOutside(f, frame.HealthBar, 3, 3)
f:SetBackdrop({
edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(3),
insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}
})
f:SetScale(E.PixelMode and 1.5 or 2)
f:Hide()
return f
end
@@ -0,0 +1,28 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
function mod:UpdateElement_HealerIcon(frame)
local icon = frame.HealerIcon
icon:ClearAllPoints()
if frame.HealthBar:IsShown() then
icon:SetPoint("RIGHT", frame.HealthBar, "LEFT", -6, 0)
else
icon:SetPoint("BOTTOM", frame.Name, "TOP", 0, 3)
end
if self.Healers[frame.UnitName] and frame.UnitType == "ENEMY_PLAYER" then
icon:Show()
else
icon:Hide()
end
end
function mod:ConstructElement_HealerIcon(frame)
local texture = frame:CreateTexture(nil, "OVERLAY")
texture:SetPoint("RIGHT", frame.HealthBar, "LEFT", -6, 0)
texture:SetWidth(40)
texture:SetHeight(40)
texture:SetTexture([[Interface\AddOns\ElvUI\media\textures\healer.tga]])
texture:Hide()
return texture
end
@@ -0,0 +1,180 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
--local LMH = LibStub("LibMobHealth-4.0")
local tonumber = tonumber
local GetInstanceDifficulty = GetInstanceDifficulty
local UnitLevel = UnitLevel
function mod:UpdateElement_HealthOnValueChanged()
local frame = this:GetParent().UnitFrame
if not frame.UnitType then return end -- Bugs
mod:UpdateElement_Health(frame)
mod:UpdateElement_HealthColor(frame)
mod:UpdateElement_Glow(frame)
end
function mod:UpdateElement_HealthColor(frame)
if(not frame.HealthBar:IsShown()) then return end
local r, g, b
local scale = 1
local class = frame.UnitClass
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
local useClassColor = mod.db.units[frame.UnitType].healthbar.useClassColor
if classColor and ((frame.UnitType == "FRIENDLY_PLAYER" and useClassColor and E.private.general.classCache) or (frame.UnitType == "ENEMY_PLAYER" and useClassColor and E.private.general.classCache)) then
r, g, b = classColor.r, classColor.g, classColor.b
elseif frame.UnitReaction == 1 then
r, g, b = mod.db.reactions.tapped.r, mod.db.reactions.tapped.g, mod.db.reactions.tapped.b
else
local status = mod:UnitDetailedThreatSituation(frame)
if status then
if status == 3 then
if E.Role == "Tank" then
r, g, b = mod.db.threat.goodColor.r, mod.db.threat.goodColor.g, mod.db.threat.goodColor.b
scale = mod.db.threat.goodScale
else
r, g, b = mod.db.threat.badColor.r, mod.db.threat.badColor.g, mod.db.threat.badColor.b
scale = mod.db.threat.badScale
end
elseif status == 2 then
if E.Role == "Tank" then
r, g, b = mod.db.threat.badTransition.r, mod.db.threat.badTransition.g, mod.db.threat.badTransition.b
else
r, g, b = mod.db.threat.goodTransition.r, mod.db.threat.goodTransition.g, mod.db.threat.goodTransition.b
end
scale = 1
elseif status == 1 then
if E.Role == "Tank" then
r, g, b = mod.db.threat.goodTransition.r, mod.db.threat.goodTransition.g, mod.db.threat.goodTransition.b
else
r, g, b = mod.db.threat.badTransition.r, mod.db.threat.badTransition.g, mod.db.threat.badTransition.b
end
scale = 1
else
if E.Role == "Tank" then
r, g, b = mod.db.threat.badColor.r, mod.db.threat.badColor.g, mod.db.threat.badColor.b
scale = mod.db.threat.badScale
else
r, g, b = mod.db.threat.goodColor.r, mod.db.threat.goodColor.g, mod.db.threat.goodColor.b
scale = mod.db.threat.goodScale
end
end
end
if (not status) or (status and not mod.db.threat.useThreatColor) then
local reactionType = frame.UnitReaction
if reactionType == 4 then
r, g, b = mod.db.reactions.neutral.r, mod.db.reactions.neutral.g, mod.db.reactions.neutral.b
elseif reactionType > 4 then
if frame.UnitType == "FRIENDLY_PLAYER" then
r, g, b = mod.db.reactions.friendlyPlayer.r, mod.db.reactions.friendlyPlayer.g, mod.db.reactions.friendlyPlayer.b
else
r, g, b = mod.db.reactions.good.r, mod.db.reactions.good.g, mod.db.reactions.good.b
end
else
r, g, b = mod.db.reactions.bad.r, mod.db.reactions.bad.g, mod.db.reactions.bad.b
end
end
end
if r ~= frame.HealthBar.r or g ~= frame.HealthBar.g or b ~= frame.HealthBar.b then
if not frame.CustomColor then
frame.HealthBar:SetStatusBarColor(r, g, b)
frame.HealthBar.r, frame.HealthBar.g, frame.HealthBar.b = r, g, b
else
local CustomColor = frame.CustomColor
frame.HealthBar:SetStatusBarColor(CustomColor.r, CustomColor.g, CustomColor.b)
frame.HealthBar.r, frame.HealthBar.g, frame.HealthBar.b = CustomColor.r, CustomColor.g, CustomColor.b
end
end
if (not frame.isTarget or not mod.db.useTargetScale) and not frame.CustomScale then
frame.ThreatScale = scale
mod:SetFrameScale(frame, scale)
end
end
function mod:UpdateElement_Health(frame)
local health = frame.oldHealthBar:GetValue()
local _, maxHealth = frame.oldHealthBar:GetMinMaxValues()
frame.HealthBar:SetMinMaxValues(0, maxHealth)
frame.HealthBar:SetValue(health)
if self.db.units[frame.UnitType].healthbar.text.enable then
if maxHealth ~= 100 then
frame.HealthBar.text:SetText(E:GetFormattedText(self.db.units[frame.UnitType].healthbar.text.format, health, maxHealth))
else
local newMaxHealth
if frame.unit == "target" then
--health, maxHealth = LMH:GetUnitHealth("target")
else
local level = self:UnitLevel(frame)
if level == "??" then
level = UnitLevel("player") + 3
end
if frame.UnitType == "FRIENDLY_PLAYER" or frame.UnitType == "ENEMY_PLAYER" then
-- newMaxHealth = LMH:GetMaxHP(frame.UnitName, tonumber(level), "pc")
elseif frame.UnitType == "FRIENDLY_NPC" or frame.UnitType == "ENEMY_NPC" then
-- newMaxHealth = LMH:GetMaxHP(frame.UnitName, tonumber(level), "npc", GetInstanceDifficulty())
else
-- newMaxHealth = LMH:GetMaxHP(frame.UnitName, tonumber(level))
end
if newMaxHealth then
health = newMaxHealth / 100 * health
maxHealth = newMaxHealth
end
end
frame.HealthBar.text:SetText(E:GetFormattedText(self.db.units[frame.UnitType].healthbar.text.format, health, maxHealth))
end
else
frame.HealthBar.text:SetText("")
end
end
function mod:ConfigureElement_HealthBar(frame, configuring)
local healthBar = frame.HealthBar
healthBar:SetPoint("TOP", frame, "CENTER", 0, self.db.units[frame.UnitType].castbar.height + 3)
if frame.isTarget and self.db.useTargetScale then
healthBar:SetHeight(self.db.units[frame.UnitType].healthbar.height * ((frame.CustomScale and frame.CustomScale * self.db.targetScale) or self.db.targetScale))
healthBar:SetWidth(self.db.units[frame.UnitType].healthbar.width * ((frame.CustomScale and frame.CustomScale * self.db.targetScale) or self.db.targetScale))
else
healthBar:SetHeight((frame.CustomScale and frame.CustomScale * self.db.units[frame.UnitType].healthbar.height) or self.db.units[frame.UnitType].healthbar.height)
healthBar:SetWidth((frame.CustomScale and frame.CustomScale * self.db.units[frame.UnitType].healthbar.width) or self.db.units[frame.UnitType].healthbar.width)
end
healthBar:SetStatusBarTexture(LSM:Fetch("statusbar", self.db.statusbar), "BORDER")
if(not configuring) and (self.db.units[frame.UnitType].healthbar.enable or frame.isTarget) then
healthBar:Show()
end
healthBar.text:SetAllPoints(healthBar)
healthBar.text:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
end
function mod:ConstructElement_HealthBar(parent)
local frame = CreateFrame("StatusBar", nil, parent)
self:StyleFrame(frame)
frame:SetFrameLevel(parent:GetFrameLevel())
frame.text = frame:CreateFontString(nil, "OVERLAY")
frame.scale = CreateAnimationGroup(frame)
frame.scale.width = frame.scale:CreateAnimation("Width")
frame.scale.width:SetDuration(0.2)
frame.scale.height = frame.scale:CreateAnimation("Height")
frame.scale.height:SetDuration(0.2)
frame:Hide()
return frame
end
@@ -0,0 +1,37 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
local format = format
function mod:UpdateElement_Level(frame)
if not self.db.units[frame.UnitType].showLevel then return end
local level, r, g, b = self:UnitLevel(frame)
if self.db.units[frame.UnitType].healthbar.enable or frame.isTarget then
frame.Level:SetText(level)
else
frame.Level:SetText(format(" [%s]", level))
end
frame.Level:SetTextColor(r, g, b)
end
function mod:ConfigureElement_Level(frame)
local level = frame.Level
level:ClearAllPoints()
if self.db.units[frame.UnitType].healthbar.enable or frame.isTarget then
level:SetJustifyH("RIGHT")
level:SetPoint("BOTTOMRIGHT", frame.HealthBar, "TOPRIGHT", 0, E.Border*2)
else
level:SetPoint("LEFT", frame.Name, "RIGHT")
level:SetJustifyH("LEFT")
end
level:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
end
function mod:ConstructElement_Level(frame)
return frame:CreateFontString(nil, "OVERLAY")
end
@@ -0,0 +1,11 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Auras.lua"/>
<Script file="CastBar.lua"/>
<Script file="ComboPoints.lua"/>
<Script file="Glow.lua"/>
<Script file="HealthBar.lua"/>
<Script file="Level.lua"/>
<Script file="Name.lua"/>
<Script file="RaidIcon.lua"/>
<Script file="HealerIcon.lua"/>
</Ui>
@@ -0,0 +1,63 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
local LSM = LibStub("LibSharedMedia-3.0")
function mod:UpdateElement_Name(frame)
if not self.db.units[frame.UnitType].showName then return end
frame.Name:SetText(frame.UnitName)
local useClassColor = self.db.units[frame.UnitType].name and self.db.units[frame.UnitType].name.useClassColor
if useClassColor and (frame.UnitType == "FRIENDLY_PLAYER" or frame.UnitType == "ENEMY_PLAYER") then
local class = frame.UnitClass
local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
if class and color then
frame.Name:SetTextColor(color.r, color.g, color.b)
else
frame.Name:SetTextColor(self.db.reactions.friendlyPlayer.r, self.db.reactions.friendlyPlayer.g, self.db.reactions.friendlyPlayer.b)
end
elseif not self.db.units[frame.UnitType].healthbar.enable and not frame.isTarget then
local reactionType = frame.UnitReaction
local r, g, b
if reactionType == 4 then
r, g, b = self.db.reactions.neutral.r, self.db.reactions.neutral.g, self.db.reactions.neutral.b
elseif reactionType > 4 then
if frame.UnitType == "FRIENDLY_PLAYER" then
r, g, b = mod.db.reactions.friendlyPlayer.r, mod.db.reactions.friendlyPlayer.g, mod.db.reactions.friendlyPlayer.b
else
r, g, b = mod.db.reactions.good.r, mod.db.reactions.good.g, mod.db.reactions.good.b
end
else
r, g, b = self.db.reactions.bad.r, self.db.reactions.bad.g, self.db.reactions.bad.b
end
frame.Name:SetTextColor(r, g, b)
else
frame.Name:SetTextColor(1, 1, 1)
end
end
function mod:ConfigureElement_Name(frame)
local name = frame.Name
name:SetJustifyH("LEFT")
name:SetJustifyV("BOTTOM")
name:ClearAllPoints()
if self.db.units[frame.UnitType].healthbar.enable or frame.isTarget then
name:SetJustifyH("LEFT")
name:SetPoint("BOTTOMLEFT", frame.HealthBar, "TOPLEFT", 0, E.Border*2)
name:SetPoint("BOTTOMRIGHT", frame.Level, "BOTTOMLEFT")
else
name:SetJustifyH("CENTER")
name:SetPoint("BOTTOM", frame, "CENTER", 0, 0)
end
name:SetFont(LSM:Fetch("font", self.db.font), self.db.fontSize, self.db.fontOutline)
end
function mod:ConstructElement_Name(frame)
local name = frame:CreateFontString(nil, "OVERLAY")
return name
end
@@ -0,0 +1,12 @@
local E, L, V, P, G = unpack(ElvUI)
local mod = E:GetModule("NamePlates")
function mod:UpdateElement_RaidIcon(frame)
local icon = frame.RaidIcon
icon:ClearAllPoints()
if frame.HealthBar:IsShown() then
icon:SetPoint("RIGHT", frame.HealthBar, "LEFT", -6, 0)
else
icon:SetPoint("BOTTOM", frame.Name, "TOP", 0, 3)
end
end
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="NamePlates.lua"/>
<Include file="Elements\Load_Elements.xml"/>
</Ui>
+758
View File
@@ -0,0 +1,758 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:NewModule("NamePlates", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
local CC = E:GetModule("ClassCache");
--Cache global variables
--Lua functions
local _G = _G
local pairs, tonumber = pairs, tonumber
local select = select
local gsub, match, split = string.gsub, string.match, string.split
local twipe = table.wipe
--WoW API / Variables
local CreateFrame = CreateFrame
local GetBattlefieldScore = GetBattlefieldScore
local GetNumBattlefieldScores = GetNumBattlefieldScores
local UnitClass = UnitClass
local UnitExists = UnitExists
local UnitGUID = UnitGUID
local SetCVar = SetCVar
local WorldFrame = WorldFrame
local WorldGetNumChildren, WorldGetChildren = WorldFrame.GetNumChildren, WorldFrame.GetChildren
local numChildren = 0
local isTarget = false
local BORDER = "Interface\\Tooltips\\Nameplate-Border"
local FSPAT = "^%s*$"
local queryList = {}
local RaidIconCoordinate = {
[0] = {[0] = "STAR", [0.25] = "MOON"},
[0.25] = {[0] = "CIRCLE", [0.25] = "SQUARE"},
[0.5] = {[0] = "DIAMOND", [0.25] = "CROSS"},
[0.75] = {[0] = "TRIANGLE", [0.25] = "SKULL"}
}
local healClasses = {
["DRUID"] = true,
["HUNTER"] = false,
["MAGE"] = false,
["PALADIN"] = true,
["PRIEST"] = true,
["ROGUE"] = false,
["SHAMAN"] = true,
["WARLOCK"] = false,
["WARRIOR"] = false
}
mod.CreatedPlates = {}
mod.VisiblePlates = {}
mod.Healers = {}
function mod:CheckFilter(frame)
--[[local db = E.global.nameplates["filter"][frame.UnitName]
if db and db.enable then
if db.hide then
frame:Hide()
return
else
if not frame:IsShown() then
frame:Show()
end
if db.customColor then
frame.CustomColor = db.color
frame.HealthBar:SetStatusBarColor(db.color.r, db.color.g, db.color.b)
else
frame.CustomColor = nil
end
if db.customScale and db.customScale ~= 1 then
frame.CustomScale = db.customScale
else
frame.CustomScale = nil
end
end
elseif not frame:IsShown() then
frame:Show()
end]]
return true
end
function mod:CheckBGHealers()
local name, class, damageDone, healingDone, _
for i = 1, GetNumBattlefieldScores() do
name, _, _, _, _, _, _, _, _, class, damageDone, healingDone = GetBattlefieldScore(i)
if name and class and healClasses[class] then
name = match(name, "(.+)%-.+") or name
if name and healingDone > (damageDone * 2) then
self.Healers[name] = true
elseif name and self.Healers[name] then
self.Healers[name] = nil
end
end
end
end
function mod:SetFrameScale(frame, scale)
if frame.HealthBar.currentScale ~= scale then
if frame.HealthBar.scale:IsPlaying() then
frame.HealthBar.scale:Stop()
end
frame.HealthBar.scale.width:SetChange(self.db.units[frame.UnitType].healthbar.width * scale)
frame.HealthBar.scale.height:SetChange(self.db.units[frame.UnitType].healthbar.height * scale)
frame.HealthBar.scale:Play()
frame.HealthBar.currentScale = scale
end
end
function mod:SetTargetFrame(frame)
if isTarget then return end
local targetExists = UnitExists("target") == 1
if targetExists and frame:GetParent():IsShown() and frame:GetParent():GetAlpha() == 1 then
if self.db.useTargetScale then
self:SetFrameScale(frame, (frame.CustomScale and frame.CustomScale * self.db.targetScale) or self.db.targetScale)
end
frame.isTarget = true
frame.unit = "target"
-- frame.guid = UnitGUID("target")
if self.db.units[frame.UnitType].healthbar.enable ~= true then
frame.Name:ClearAllPoints()
frame.Level:ClearAllPoints()
frame.HealthBar.r, frame.HealthBar.g, frame.HealthBar.b = nil, nil, nil
self:ConfigureElement_HealthBar(frame)
self:ConfigureElement_CastBar(frame)
self:ConfigureElement_Glow(frame)
self:ConfigureElement_Level(frame)
self:ConfigureElement_Name(frame)
self:UpdateElement_All(frame, true)
end
--[[if UnitCastingInfo("target") then
frame:GetScript("OnEvent")(frame, "UNIT_SPELLCAST_START", "target")
elseif UnitChannelInfo("target") then
frame:GetScript("OnEvent")(frame, "UNIT_SPELLCAST_CHANNEL_START", "target")
end]]
frame:SetAlpha(1)
mod:UpdateElement_AurasByUnitID("target")
elseif frame.isTarget then
if self.db.useTargetScale then
self:SetFrameScale(frame, frame.CustomScale or frame.ThreatScale or 1)
end
frame.isTarget = nil
frame.unit = nil
-- frame.guid = nil
if self.db.units[frame.UnitType].healthbar.enable ~= true then
self:UpdateAllFrame(frame)
end
if targetExists then
frame:SetAlpha(self.db.nonTargetTransparency)
else
frame:SetAlpha(1)
end
else
if targetExists then
frame:SetAlpha(self.db.nonTargetTransparency)
else
frame:SetAlpha(1)
end
end
mod:UpdateElement_HealthColor(frame)
mod:UpdateElement_Glow(frame)
mod:UpdateElement_CPoints(frame)
return frame.isTarget
end
function mod:GetNumVisiblePlates()
local i = 0
for _ in pairs(mod.VisiblePlates) do
i = i + 1
end
return i
end
function mod:StyleFrame(parent, noBackdrop, point)
point = point or parent
local noscalemult = E.mult * UIParent:GetScale()
if point.bordertop then return end
if not noBackdrop then
point.backdrop = parent:CreateTexture(nil, "BACKGROUND")
point.backdrop:SetAllPoints(point)
point.backdrop:SetTexture(unpack(E["media"].backdropfadecolor))
end
if E.PixelMode then
point.bordertop = parent:CreateTexture()
point.bordertop:SetPoint("TOPLEFT", point, "TOPLEFT", -noscalemult, noscalemult)
point.bordertop:SetPoint("TOPRIGHT", point, "TOPRIGHT", noscalemult, noscalemult)
point.bordertop:SetHeight(noscalemult)
point.bordertop:SetTexture(unpack(E["media"].bordercolor))
point.borderbottom = parent:CreateTexture()
point.borderbottom:SetPoint("BOTTOMLEFT", point, "BOTTOMLEFT", -noscalemult, -noscalemult)
point.borderbottom:SetPoint("BOTTOMRIGHT", point, "BOTTOMRIGHT", noscalemult, -noscalemult)
point.borderbottom:SetHeight(noscalemult)
point.borderbottom:SetTexture(unpack(E["media"].bordercolor))
point.borderleft = parent:CreateTexture()
point.borderleft:SetPoint("TOPLEFT", point, "TOPLEFT", -noscalemult, noscalemult)
point.borderleft:SetPoint("BOTTOMLEFT", point, "BOTTOMLEFT", noscalemult, -noscalemult)
point.borderleft:SetWidth(noscalemult)
point.borderleft:SetTexture(unpack(E["media"].bordercolor))
point.borderright = parent:CreateTexture()
point.borderright:SetPoint("TOPRIGHT", point, "TOPRIGHT", noscalemult, noscalemult)
point.borderright:SetPoint("BOTTOMRIGHT", point, "BOTTOMRIGHT", -noscalemult, -noscalemult)
point.borderright:SetWidth(noscalemult)
point.borderright:SetTexture(unpack(E["media"].bordercolor))
else
point.bordertop = parent:CreateTexture(nil, "OVERLAY")
point.bordertop:SetPoint("TOPLEFT", point, "TOPLEFT", -noscalemult, noscalemult*2)
point.bordertop:SetPoint("TOPRIGHT", point, "TOPRIGHT", noscalemult, noscalemult*2)
point.bordertop:SetHeight(noscalemult)
point.bordertop:SetTexture(unpack(E.media.bordercolor))
point.bordertop.backdrop = parent:CreateTexture()
point.bordertop.backdrop:SetPoint("TOPLEFT", point.bordertop, "TOPLEFT", noscalemult, noscalemult)
point.bordertop.backdrop:SetPoint("TOPRIGHT", point.bordertop, "TOPRIGHT", -noscalemult, noscalemult)
point.bordertop.backdrop:SetHeight(noscalemult * 3)
point.bordertop.backdrop:SetTexture(0, 0, 0)
point.borderbottom = parent:CreateTexture(nil, "OVERLAY")
point.borderbottom:SetPoint("BOTTOMLEFT", point, "BOTTOMLEFT", -noscalemult, -noscalemult*2)
point.borderbottom:SetPoint("BOTTOMRIGHT", point, "BOTTOMRIGHT", noscalemult, -noscalemult*2)
point.borderbottom:SetHeight(noscalemult)
point.borderbottom:SetTexture(unpack(E.media.bordercolor))
point.borderbottom.backdrop = parent:CreateTexture()
point.borderbottom.backdrop:SetPoint("BOTTOMLEFT", point.borderbottom, "BOTTOMLEFT", noscalemult, -noscalemult)
point.borderbottom.backdrop:SetPoint("BOTTOMRIGHT", point.borderbottom, "BOTTOMRIGHT", -noscalemult, -noscalemult)
point.borderbottom.backdrop:SetHeight(noscalemult * 3)
point.borderbottom.backdrop:SetTexture(0, 0, 0)
point.borderleft = parent:CreateTexture(nil, "OVERLAY")
point.borderleft:SetPoint("TOPLEFT", point, "TOPLEFT", -noscalemult*2, noscalemult*2)
point.borderleft:SetPoint("BOTTOMLEFT", point, "BOTTOMLEFT", noscalemult*2, -noscalemult*2)
point.borderleft:SetWidth(noscalemult)
point.borderleft:SetTexture(unpack(E.media.bordercolor))
point.borderleft.backdrop = parent:CreateTexture()
point.borderleft.backdrop:SetPoint("TOPLEFT", point.borderleft, "TOPLEFT", -noscalemult, noscalemult)
point.borderleft.backdrop:SetPoint("BOTTOMLEFT", point.borderleft, "BOTTOMLEFT", -noscalemult, -noscalemult)
point.borderleft.backdrop:SetWidth(noscalemult * 3)
point.borderleft.backdrop:SetTexture(0, 0, 0)
point.borderright = parent:CreateTexture(nil, "OVERLAY")
point.borderright:SetPoint("TOPRIGHT", point, "TOPRIGHT", noscalemult*2, noscalemult*2)
point.borderright:SetPoint("BOTTOMRIGHT", point, "BOTTOMRIGHT", -noscalemult*2, -noscalemult*2)
point.borderright:SetWidth(noscalemult)
point.borderright:SetTexture(unpack(E.media.bordercolor))
point.borderright.backdrop = parent:CreateTexture()
point.borderright.backdrop:SetPoint("TOPRIGHT", point.borderright, "TOPRIGHT", noscalemult, noscalemult)
point.borderright.backdrop:SetPoint("BOTTOMRIGHT", point.borderright, "BOTTOMRIGHT", noscalemult, -noscalemult)
point.borderright.backdrop:SetWidth(noscalemult * 3)
point.borderright.backdrop:SetTexture(0, 0, 0)
end
end
function mod:RoundColors(r, g, b)
return floor(r*100+.5) / 100, floor(g*100+.5) / 100, floor(b*100+.5) / 100
end
function mod:UnitClass(name, type)
--[[if E.private.general.classCache then
if type == "FRIENDLY_PLAYER" then
local _, class = UnitClass(name)
if class then
return class
else
local name, realm = split("-", name)
return CC:GetClassByName(name, realm)
end
end
else
if type == "FRIENDLY_PLAYER" then
return select(2, UnitClass(name))
end
end--]]
end
function mod:UnitDetailedThreatSituation(frame)
return false
end
function mod:UnitLevel(frame)
local level, boss = frame.oldLevel:GetObjectType() == "FontString" and tonumber(frame.oldLevel:GetText()) or false, frame.BossIcon:IsShown()
if boss or not level then
return "??", 0.9, 0, 0
else
return level, frame.oldLevel:GetTextColor()
end
end
function mod:GetUnitInfo(frame)
if UnitExists("target") == 1 and frame:GetParent():IsShown() and frame:GetParent():GetAlpha() == 1 then
if UnitIsPlayer("target") then
if UnitIsEnemy("target", "player") then
return 2, "ENEMY_PLAYER"
else
return 5, "FRIENDLY_PLAYER"
end
else
if UnitIsEnemy("target", "player") then
return 2, "ENEMY_NPC"
elseif UnitReaction("target", "player") == 4 then
return 4, "ENEMY_NPC"
else
return 5, "FRIENDLY_NPC"
end
end
end
local r, g, b = mod:RoundColors(frame.oldHealthBar:GetStatusBarColor())
if r == 1 and g == 0 and b == 0 then
return 2, "ENEMY_NPC"
elseif r == 0 and g == 0 and b == 1 then
return 5, "FRIENDLY_PLAYER"
elseif r == 0 and g == 1 and b == 0 then
return 5, "FRIENDLY_NPC"
elseif r == 1 and g == 1 and b == 0 then
return 4, "ENEMY_NPC"
end
end
function mod:OnShow(self)
isTarget = false
self:SetWidth(0.01)
self:SetHeight(0.01)
mod.VisiblePlates[self.UnitFrame] = true
self.UnitFrame.UnitName = gsub(self.UnitFrame.oldName:GetText(), FSPAT, "")
local unitReaction, unitType = mod:GetUnitInfo(self.UnitFrame)
self.UnitFrame.UnitType = unitType
self.UnitFrame.UnitClass = mod:UnitClass(self.UnitFrame.oldName:GetText(), unitType)
self.UnitFrame.UnitReaction = unitReaction
if not self.UnitFrame.UnitClass then
queryList[self.UnitFrame.UnitName] = self.UnitFrame
end
if unitType == "ENEMY_NPC" and self.UnitFrame.UnitClass then
unitType = "ENEMY_PLAYER"
self.UnitFrame.UnitType = unitType
end
if not mod:CheckFilter(self.UnitFrame) then return end
if unitType == "ENEMY_PLAYER" then
mod:UpdateElement_HealerIcon(self.UnitFrame)
end
self.UnitFrame.Level:ClearAllPoints()
self.UnitFrame.Name:ClearAllPoints()
mod:ConfigureElement_HealthBar(self.UnitFrame)
if mod.db.units[unitType].healthbar.enable then
mod:ConfigureElement_CastBar(self.UnitFrame)
mod:ConfigureElement_Glow(self.UnitFrame)
if mod.db.units[unitType].buffs.enable then
self.UnitFrame.Buffs.db = mod.db.units[unitType].buffs
mod:UpdateAuraIcons(self.UnitFrame.Buffs)
end
if mod.db.units[unitType].debuffs.enable then
self.UnitFrame.Debuffs.db = mod.db.units[unitType].debuffs
mod:UpdateAuraIcons(self.UnitFrame.Debuffs)
end
end
if mod.db.units[unitType].healthbar.enable then
mod:ConfigureElement_Name(self.UnitFrame)
mod:ConfigureElement_Level(self.UnitFrame)
else
mod:ConfigureElement_Level(self.UnitFrame)
mod:ConfigureElement_Name(self.UnitFrame)
end
--[[if(mod.db.units[unitType].castbar.enable) then
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_START")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_STOP")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_FAILED")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
self.UnitFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
end]]
mod:UpdateElement_All(self.UnitFrame)
self.UnitFrame:Show()
end
function mod:OnHide(self)
--local self = this
mod.VisiblePlates[self.UnitFrame] = nil
self.UnitFrame.unit = nil
mod:HideAuraIcons(self.UnitFrame.Buffs)
mod:HideAuraIcons(self.UnitFrame.Debuffs)
self.UnitFrame.Glow.r, self.UnitFrame.Glow.g, self.UnitFrame.Glow.b = nil, nil, nil
self.UnitFrame.Glow:Hide()
self.UnitFrame.HealthBar.r, self.UnitFrame.HealthBar.g, self.UnitFrame.HealthBar.b = nil, nil, nil
self.UnitFrame.HealthBar:Hide()
--self.UnitFrame.CastBar:Hide()
self.UnitFrame.Level:ClearAllPoints()
self.UnitFrame.Level:SetText("")
self.UnitFrame.Name:ClearAllPoints()
self.UnitFrame.Name:SetText("")
self.UnitFrame.CPoints:Hide()
self.UnitFrame:Hide()
self.UnitFrame.isTarget = nil
self.UnitFrame.displayedUnit = nil
self.ThreatData = nil
self.UnitFrame.UnitName = nil
self.UnitFrame.UnitType = nil
self.UnitFrame.ThreatScale = nil
self.UnitFrame.ThreatReaction = nil
self.UnitFrame.guid = nil
self.UnitFrame.RaidIconType = nil
self.UnitFrame.CustomColor = nil
self.UnitFrame.CustomScale = nil
end
function mod:UpdateAllFrame(frame)
mod:OnHide(frame:GetParent())
mod:OnShow(frame:GetParent())
end
function mod:ConfigureAll()
if E.private.nameplates.enable ~= true then return end
self:ForEachPlate("UpdateAllFrame")
self:UpdateCVars()
end
function mod:ForEachPlate(functionToRun, ...)
for frame in pairs(self.CreatedPlates) do
if frame and frame.UnitFrame then
self[functionToRun](self, frame.UnitFrame, unpack(arg))
end
end
end
function mod:UpdateElement_All(frame, noTargetFrame)
if self.db.units[frame.UnitType].healthbar.enable or frame.isTarget then
self:UpdateElement_Health(frame)
self:UpdateElement_HealthColor(frame)
self:UpdateElement_Auras(frame)
end
self:UpdateElement_RaidIcon(frame)
self:UpdateElement_HealerIcon(frame)
self:UpdateElement_Name(frame)
self:UpdateElement_Level(frame)
if not noTargetFrame then
mod:ScheduleTimer("ForEachPlate", 0.25, 1, "SetTargetFrame")
end
end
function mod:OnCreated(frame)
isTarget = false
local HealthBar, CastBar = frame:GetChildren()
local Border, Highlight, Name, Level, BossIcon, RaidIcon = frame:GetRegions()
frame.UnitFrame = CreateFrame("Button", nil, frame)
frame.UnitFrame:SetWidth(100)
frame.UnitFrame:SetHeight(20)
frame.UnitFrame:SetPoint("CENTER", 0, 0)
frame.UnitFrame:SetScript("OnEvent", self.OnEvent)
frame.UnitFrame:SetScript("OnClick", function()
frame:Click()
end)
frame.UnitFrame.HealthBar = self:ConstructElement_HealthBar(frame.UnitFrame)
frame.UnitFrame.CastBar = self:ConstructElement_CastBar(frame.UnitFrame)
frame.UnitFrame.Level = self:ConstructElement_Level(frame.UnitFrame)
frame.UnitFrame.Name = self:ConstructElement_Name(frame.UnitFrame)
frame.UnitFrame.Glow = self:ConstructElement_Glow(frame.UnitFrame)
frame.UnitFrame.Buffs = self:ConstructElement_Auras(frame.UnitFrame, "LEFT")
frame.UnitFrame.Debuffs = self:ConstructElement_Auras(frame.UnitFrame, "RIGHT")
frame.UnitFrame.HealerIcon = self:ConstructElement_HealerIcon(frame.UnitFrame)
frame.UnitFrame.CPoints = self:ConstructElement_CPoints(frame.UnitFrame)
--self:QueueObject(CastBarBorder)
--self:QueueObject(CastBarIcon)
self:QueueObject(HealthBar)
--self:QueueObject(CastBar)
self:QueueObject(Level)
self:QueueObject(Name)
self:QueueObject(Border)
self:QueueObject(Highlight)
--CastBar:Kill()
--CastBarIcon:SetParent(E.HiddenFrame)
BossIcon:SetAlpha(0)
frame.UnitFrame.oldHealthBar = HealthBar
frame.UnitFrame.oldCastBar = CastBar
--frame.UnitFrame.oldCastBar.Icon = CastBarIcon
frame.UnitFrame.oldName = Name
frame.UnitFrame.oldHighlight = Highlight
frame.UnitFrame.oldLevel = Level
RaidIcon:SetParent(frame.UnitFrame)
frame.UnitFrame.RaidIcon = RaidIcon
frame.UnitFrame.BossIcon = BossIcon
self:OnShow(frame)
HookScript(frame, "OnShow", function() self:OnShow(this) end)
HookScript(frame, "OnHide", function() self:OnHide(this) end)
HookScript(HealthBar, "OnValueChanged", self.UpdateElement_HealthOnValueChanged)
self.CreatedPlates[frame] = true
self.VisiblePlates[frame.UnitFrame] = true
end
function mod:OnEvent(event, unit, ...)
if not self.unit then return end
mod:UpdateElement_Cast(self, event, unit, unpack(arg))
end
function mod:QueueObject(object)
local objectType = object:GetObjectType()
if objectType == "Texture" then
object:SetTexture("")
object:SetTexCoord(0, 0, 0, 0)
elseif objectType == "FontString" then
object:SetWidth(0.001)
elseif objectType == "StatusBar" then
object:SetStatusBarTexture("")
end
object:Hide()
end
function mod:OnUpdate(elapsed)
local count = WorldGetNumChildren(WorldFrame)
if count ~= numChildren then
for i = numChildren + 1, count do
local frame = select(i, WorldGetChildren(WorldFrame))
local region = frame:GetRegions()
if(not mod.CreatedPlates[frame] and region and region:GetObjectType() == "Texture" and region:GetTexture() == BORDER) then
mod:OnCreated(frame)
end
end
numChildren = count
end
local i = 0
for frame in pairs(mod.VisiblePlates) do
i = i + 1
local getTarget = mod:SetTargetFrame(frame)
if not getTarget then
frame:GetParent():SetAlpha(1)
end
if i == mod:GetNumVisiblePlates() then
isTarget = true
end
end
end
function mod:CheckRaidIcon(frame)
if frame.RaidIcon:IsShown() then
local ux, uy = frame.RaidIcon:GetTexCoord()
frame.RaidIconType = RaidIconCoordinate[ux][uy]
else
frame.RaidIconType = nil
end
end
function mod:SearchNameplateByGUID(guid)
for frame in pairs(self.VisiblePlates) do
if frame and frame:IsShown() and frame.guid == guid then
return frame
end
end
end
function mod:SearchNameplateByName(sourceName)
if not sourceName then return end
local SearchFor = strsplit("-", sourceName)
for frame in pairs(self.VisiblePlates) do
if frame and frame:IsShown() and frame.UnitName == SearchFor and RAID_CLASS_COLORS[frame.UnitClass] then
return frame
end
end
end
function mod:SearchNameplateByIconName(raidIcon)
for frame in pairs(self.VisiblePlates) do
self:CheckRaidIcon(frame)
if frame and frame:IsShown() and frame.RaidIcon:IsShown() and (frame.RaidIconType == raidIcon) then
return frame
end
end
end
function mod:SearchForFrame(guid, raidIcon, name)
local frame
if guid then frame = self:SearchNameplateByGUID(guid) end
if (not frame) and name then frame = self:SearchNameplateByName(name) end
if (not frame) and raidIcon then frame = self:SearchNameplateByIconName(raidIcon) end
return frame
end
function mod:UpdateCVars()
-- SetCVar("showVKeyCastbar", "1")
-- SetCVar("nameplateAllowOverlap", self.db.motionType == "STACKED" and "0" or "1")
end
local function CopySettings(from, to)
for setting, value in pairs(from) do
if type(value) == "table" then
CopySettings(from[setting], to[setting])
else
if to[setting] ~= nil then
to[setting] = from[setting]
end
end
end
end
function mod:ResetSettings(unit)
CopySettings(P.nameplates.units[unit], self.db.units[unit])
end
function mod:CopySettings(from, to)
if from == to then return end
CopySettings(self.db.units[from], self.db.units[to])
end
function mod:PLAYER_ENTERING_WORLD()
self:CleanAuraLists()
twipe(self.Healers)
local inInstance, instanceType = IsInInstance()
if inInstance and instanceType == "pvp" and self.db.units.ENEMY_PLAYER.markHealers then
self.CheckHealerTimer = self:ScheduleRepeatingTimer("CheckBGHealers", 3)
self:CheckBGHealers()
else
if self.CheckHealerTimer then
self:CancelTimer(self.CheckHealerTimer)
self.CheckHealerTimer = nil
end
end
end
function mod:PLAYER_TARGET_CHANGED()
isTarget = false
end
function mod:UNIT_AURA(_, unit)
if unit == "target" then
self:UpdateElement_AurasByUnitID("target")
end
end
function mod:PLAYER_COMBO_POINTS()
self:ForEachPlate("UpdateElement_CPoints")
end
function mod:PLAYER_REGEN_DISABLED()
if self.db.showFriendlyCombat == "TOGGLE_ON" then
ShowFriendNameplates();
elseif self.db.showFriendlyCombat == "TOGGLE_OFF" then
HideFriendNameplates();
end
if self.db.showEnemyCombat == "TOGGLE_ON" then
ShowNameplates();
elseif self.db.showEnemyCombat == "TOGGLE_OFF" then
HideNameplates();
end
end
function mod:PLAYER_REGEN_ENABLED()
self:CleanAuraLists()
if self.db.showFriendlyCombat == "TOGGLE_ON" then
HideFriendNameplates();
elseif self.db.showFriendlyCombat == "TOGGLE_OFF" then
ShowFriendNameplates();
end
if self.db.showEnemyCombat == "TOGGLE_ON" then
HideNameplates();
elseif self.db.showEnemyCombat == "TOGGLE_OFF" then
ShowNameplates();
end
end
function mod:ClassCacheQueryResult(_, name, class)
if queryList[name] then
local frame = queryList[name]
if frame.UnitType then
if frame.UnitType == "ENEMY_NPC" then
frame.UnitType = "ENEMY_PLAYER"
end
frame.UnitClass = class
if self.db.units[frame.UnitType].healthbar.enable then
self:UpdateElement_HealthColor(frame)
end
self:UpdateElement_Name(frame)
end
queryList[name] = nil
end
end
function mod:Initialize()
self.db = E.db["nameplates"]
if E.private["nameplates"].enable ~= true then return end
self:UpdateCVars()
self.Frame = CreateFrame("Frame"):SetScript("OnUpdate", self.OnUpdate)
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
--self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
--self:RegisterEvent("UNIT_AURA")
--self:RegisterEvent("PLAYER_COMBO_POINTS")
self:RegisterMessage("ClassCacheQueryResult")
E.NamePlates = self
end
local function InitializeCallback()
mod:Initialize()
end
E:RegisterModule(mod:GetName(), InitializeCallback)
+429
View File
@@ -0,0 +1,429 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local pairs = pairs
--WoW API / Variables
local CreateFrame = CreateFrame
local RegisterAsWidget, RegisterAsContainer
local function SetModifiedBackdrop()
if this.backdrop then this = this.backdrop end
this:SetBackdropBorderColor(unpack(E["media"].rgbvaluecolor))
end
local function SetOriginalBackdrop()
if this.backdrop then this = this.backdrop end
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
local function SkinScrollBar(frame, thumbTrim)
if _G[frame:GetName().."BG"] then _G[frame:GetName().."BG"]:SetTexture(nil) end
if _G[frame:GetName().."Track"] then _G[frame:GetName().."Track"]:SetTexture(nil) end
if _G[frame:GetName().."Top"] then
_G[frame:GetName().."Top"]:SetTexture(nil)
_G[frame:GetName().."Bottom"]:SetTexture(nil)
_G[frame:GetName().."Middle"]:SetTexture(nil)
end
if _G[frame:GetName().."ScrollUpButton"] and _G[frame:GetName().."ScrollDownButton"] then
E:StripTextures(_G[frame:GetName().."ScrollUpButton"])
if not _G[frame:GetName().."ScrollUpButton"].icon then
S:HandleNextPrevButton(_G[frame:GetName().."ScrollUpButton"])
S:SquareButton_SetIcon(_G[frame:GetName().."ScrollUpButton"], "UP")
_G[frame:GetName().."ScrollUpButton"]:SetWidth(_G[frame:GetName().."ScrollUpButton"]:GetWidth() + 7)
_G[frame:GetName().."ScrollUpButton"]:SetHeight(_G[frame:GetName().."ScrollUpButton"]:GetHeight() + 7)
end
E:StripTextures(_G[frame:GetName().."ScrollDownButton"])
if not _G[frame:GetName().."ScrollDownButton"].icon then
S:HandleNextPrevButton(_G[frame:GetName().."ScrollDownButton"])
S:SquareButton_SetIcon(_G[frame:GetName().."ScrollDownButton"], "DOWN")
_G[frame:GetName().."ScrollDownButton"]:SetWidth(_G[frame:GetName().."ScrollDownButton"]:GetWidth() + 7)
_G[frame:GetName().."ScrollDownButton"]:SetHeight(_G[frame:GetName().."ScrollDownButton"]:GetHeight() + 7)
end
if not frame.trackbg then
frame.trackbg = CreateFrame("Frame", nil, frame)
frame.trackbg:SetPoint("TOPLEFT", _G[frame:GetName().."ScrollUpButton"], "BOTTOMLEFT", 0, -1)
frame.trackbg:SetPoint("BOTTOMRIGHT", _G[frame:GetName().."ScrollDownButton"], "TOPRIGHT", 0, 1)
E:SetTemplate(frame.trackbg, "Transparent")
end
if frame:GetThumbTexture() then
if not thumbTrim then thumbTrim = 3 end
frame:GetThumbTexture():SetTexture(nil)
frame:GetThumbTexture():SetHeight(24)
if not frame.thumbbg then
frame.thumbbg = CreateFrame("Frame", nil, frame)
frame.thumbbg:SetPoint("TOPLEFT", frame:GetThumbTexture(), "TOPLEFT", 2, -thumbTrim)
frame.thumbbg:SetPoint("TOPLEFT", frame:GetThumbTexture(), "TOPLEFT", 2, -thumbTrim)
frame.thumbbg:SetPoint("BOTTOMRIGHT", frame:GetThumbTexture(), "BOTTOMRIGHT", -2, thumbTrim)
E:SetTemplate(frame.thumbbg, "Default", true, true)
frame.thumbbg:SetBackdropColor(0.3, 0.3, 0.3)
if frame.trackbg then
frame.thumbbg:SetFrameLevel(frame.trackbg:GetFrameLevel() + 1)
end
end
end
end
end
local function SkinButton(f, strip, noTemplate)
local name = f:GetName()
if(name) then
local left = _G[name.."Left"]
local middle = _G[name.."Middle"]
local right = _G[name.."Right"]
if(left) then E:Kill(left) end
if(middle) then E:Kill(middle) end
if(right) then E:Kill(right) end
end
if(f.Left) then E:Kill(f.Left) end
if(f.Middle) then E:Kill(f.Middle) end
if(f.Right) then E:Kill(f.Right) end
if f.SetNormalTexture then f:SetNormalTexture("") end
if f.SetHighlightTexture then f:SetHighlightTexture("") end
if f.SetPushedTexture then f:SetPushedTexture("") end
if f.SetDisabledTexture then f:SetDisabledTexture("") end
if strip then E:StripTextures(f) end
if not f.template and not noTemplate then
E:SetTemplate(f, "Default", true)
end
HookScript(f, "OnEnter", SetModifiedBackdrop)
HookScript(f, "OnLeave", SetOriginalBackdrop)
end
function S:SkinAce3()
local AceGUI = LibStub("AceGUI-3.0", true)
if not AceGUI then return end
local oldRegisterAsWidget = AceGUI.RegisterAsWidget
RegisterAsWidget = function(self, widget)
if not E.private.skins.ace3.enable then
return oldRegisterAsWidget(self, widget)
end
local TYPE = widget.type
if TYPE == "MultiLineEditBox" then
local frame = widget.frame
if not widget.scrollBG.template then
E:SetTemplate(widget.scrollBG, "Default")
end
SkinButton(widget.button)
SkinScrollBar(widget.scrollBar)
widget.scrollBar:SetPoint("RIGHT", frame, "RIGHT", 0 -4)
widget.scrollBG:SetPoint("TOPRIGHT", widget.scrollBar, "TOPLEFT", -2, 19)
widget.scrollBG:SetPoint("BOTTOMLEFT", widget.button, "TOPLEFT")
widget.scrollFrame:SetPoint("BOTTOMRIGHT", widget.scrollBG, "BOTTOMRIGHT", -4, 8)
elseif TYPE == "CheckBox" then
E:Kill(widget.checkbg)
E:Kill(widget.highlight)
if not widget.skinnedCheckBG then
widget.skinnedCheckBG = CreateFrame("Frame", nil, widget.frame)
E:SetTemplate(widget.skinnedCheckBG, "Default")
widget.skinnedCheckBG:SetPoint("TOPLEFT", widget.checkbg, "TOPLEFT", 4, -4)
widget.skinnedCheckBG:SetPoint("BOTTOMRIGHT", widget.checkbg, "BOTTOMRIGHT", -4, 4)
end
widget.check:SetParent(widget.skinnedCheckBG)
elseif TYPE == "Dropdown" then
local frame = widget.dropdown
local button = widget.button
local text = widget.text
E:StripTextures(frame)
button:ClearAllPoints()
button:SetPoint("RIGHT", frame, "RIGHT", -20, 0)
S:HandleNextPrevButton(button, true)
if not frame.backdrop then
E:CreateBackdrop(frame, "Default")
frame.backdrop:SetPoint("TOPLEFT", 20, -2)
frame.backdrop:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
end
button:SetParent(frame.backdrop)
text:SetParent(frame.backdrop)
HookScript(button, "OnClick", function()
local dropdown = this.obj.pullout
if dropdown.frame then
E:SetTemplate(dropdown.frame, "Default", true)
if dropdown.slider then
E:SetTemplate(dropdown.slider, "Default")
dropdown.slider:SetPoint("TOPRIGHT", dropdown.frame, "TOPRIGHT", -10, -10)
dropdown.slider:SetPoint("BOTTOMRIGHT", dropdown.frame, "BOTTOMRIGHT", -10, 10)
if dropdown.slider:GetThumbTexture() then
dropdown.slider:SetThumbTexture(E["media"].blankTex)
dropdown.slider:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
-- dropdown.slider:GetThumbTexture():Size(10, 12)
dropdown.slider:GetThumbTexture():SetWidth(10)
dropdown.slider:GetThumbTexture():SetHeight(12)
end
end
end
end)
elseif TYPE == "LSM30_Font" or TYPE == "LSM30_Sound" or TYPE == "LSM30_Border" or TYPE == "LSM30_Background" or TYPE == "LSM30_Statusbar" then
local frame = widget.frame
local button = frame.dropButton
local text = frame.text
E:StripTextures(frame)
S:HandleNextPrevButton(button, true)
frame.text:ClearAllPoints()
frame.text:SetPoint("RIGHT", button, "LEFT", -2, 0)
button:ClearAllPoints()
button:SetPoint("RIGHT", frame, "RIGHT", -10, -6)
if not frame.backdrop then
E:CreateBackdrop(frame, "Default")
if TYPE == "LSM30_Font" then
frame.backdrop:SetPoint("TOPLEFT", 20, -17)
elseif TYPE == "LSM30_Sound" then
frame.backdrop:SetPoint("TOPLEFT", 20, -17)
widget.soundbutton:SetParent(frame.backdrop)
widget.soundbutton:ClearAllPoints()
widget.soundbutton:SetPoint("LEFT", frame.backdrop, "LEFT", 2, 0)
elseif TYPE == "LSM30_Statusbar" then
frame.backdrop:SetPoint("TOPLEFT", 20, -17)
widget.bar:SetParent(frame.backdrop)
E:SetInside(widget.bar)
elseif TYPE == "LSM30_Border" or TYPE == "LSM30_Background" then
frame.backdrop:SetPoint("TOPLEFT", 42, -16)
end
frame.backdrop:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
end
button:SetParent(frame.backdrop)
text:SetParent(frame.backdrop)
HookScript(button, "OnClick", function()
local dropdown = this.obj.dropdown
if dropdown then
E:SetTemplate(dropdown, "Default", true)
if dropdown.slider then
E:SetTemplate(dropdown.slider, "Transparent")
dropdown.slider:SetPoint("TOPRIGHT", dropdown, "TOPRIGHT", -10, -10)
dropdown.slider:SetPoint("BOTTOMRIGHT", dropdown, "BOTTOMRIGHT", -10, 10)
if dropdown.slider:GetThumbTexture() then
dropdown.slider:SetThumbTexture(E["media"].blankTex)
dropdown.slider:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
-- dropdown.slider:GetThumbTexture():Size(10, 12)
dropdown.slider:GetThumbTexture():SetWidth(10)
dropdown.slider:GetThumbTexture():SetHeight(12)
end
end
if TYPE == "LSM30_Sound" then
local frame = this.obj.frame
local width = frame:GetWidth()
dropdown:SetPoint("TOPLEFT", frame, "BOTTOMLEFT")
dropdown:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 30, 0)
end
end
end)
elseif TYPE == "EditBox" then
local frame = widget.editbox
local button = widget.button
E:Kill(_G[frame:GetName().."Left"])
E:Kill(_G[frame:GetName().."Middle"])
E:Kill(_G[frame:GetName().."Right"])
frame:SetHeight(17)
E:CreateBackdrop(frame, "Default")
frame.backdrop:SetPoint("TOPLEFT", -2, 0)
frame.backdrop:SetPoint("BOTTOMRIGHT", 2, 0)
frame.backdrop:SetParent(widget.frame)
frame:SetParent(frame.backdrop)
SkinButton(button)
elseif TYPE == "Button" then
local frame = widget.frame
SkinButton(frame, nil, true)
E:StripTextures(frame)
E:CreateBackdrop(frame, "Default", true)
E:SetInside(frame.backdrop)
widget.text:SetParent(frame.backdrop)
elseif TYPE == "Button-ElvUI" then
local frame = widget.frame
SkinButton(frame, nil, true)
E:StripTextures(frame)
E:CreateBackdrop(frame, "Default", true)
E:SetInside(frame.backdrop)
widget.text:SetParent(frame.backdrop)
elseif TYPE == "Keybinding" then
local button = widget.button
local msgframe = widget.msgframe
local msg = widget.msgframe.msg
SkinButton(button)
E:StripTextures(msgframe)
E:CreateBackdrop(msgframe, "Default", true)
E:SetInside(msgframe.backdrop)
msgframe:SetToplevel(true)
msg:ClearAllPoints()
msg:SetPoint("LEFT", 10, 0)
msg:SetPoint("RIGHT", -10, 0)
msg:SetJustifyV("MIDDLE")
msg:SetWidth(msg:GetWidth() + 10)
elseif TYPE == "Slider" then
local frame = widget.slider
local editbox = widget.editbox
local lowtext = widget.lowtext
local hightext = widget.hightext
local HEIGHT = 12
E:StripTextures(frame)
E:SetTemplate(frame, "Default")
frame:SetHeight(HEIGHT)
frame:SetThumbTexture(E["media"].blankTex)
frame:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
-- frame:GetThumbTexture():Size(HEIGHT-2,HEIGHT+2)
frame:GetThumbTexture():SetWidth(HEIGHT-2)
frame:GetThumbTexture():SetHeight(HEIGHT+2)
E:SetTemplate(editbox, "Default")
editbox:SetHeight(15)
editbox:SetPoint("TOP", frame, "BOTTOM", 0, -1)
lowtext:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 2, -2)
hightext:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", -2, -2)
--[[elseif TYPE == "ColorPicker" then
local frame = widget.frame
local colorSwatch = widget.colorSwatch
]]
end
return oldRegisterAsWidget(self, widget)
end
AceGUI.RegisterAsWidget = RegisterAsWidget
local oldRegisterAsContainer = AceGUI.RegisterAsContainer
RegisterAsContainer = function(self, widget)
if not E.private.skins.ace3.enable then
return oldRegisterAsContainer(self, widget)
end
local TYPE = widget.type
if TYPE == "ScrollFrame" then
local frame = widget.scrollbar
SkinScrollBar(frame)
elseif TYPE == "InlineGroup" or TYPE == "TreeGroup" or TYPE == "TabGroup-ElvUI" or TYPE == "Frame" or TYPE == "DropdownGroup" or TYPE == "Window" then
local frame = widget.content:GetParent()
if TYPE == "Frame" then
E:StripTextures(frame)
if(not E.GUIFrame) then
E.GUIFrame = frame
end
for _, child in ipairs({frame:GetChildren()}) do
if child:GetObjectType() == "Button" and child:GetText() then
SkinButton(child)
else
E:StripTextures(child)
end
end
--[[for i=1, frame:GetNumChildren() do
local child = select(i, frame:GetChildren())
if child:GetObjectType() == "Button" and child:GetText() then
SkinButton(child)
else
E:StripTextures(child)
end
end]]
elseif TYPE == "Window" then
E:StripTextures(frame)
S:HandleCloseButton(frame.obj.closebutton)
end
E:SetTemplate(frame, "Transparent")
if widget.treeframe then
E:SetTemplate(widget.treeframe, "Transparent")
frame:SetPoint("TOPLEFT", widget.treeframe, "TOPRIGHT", 1, 0)
local oldCreateButton = widget.CreateButton
widget.CreateButton = function(self)
local button = oldCreateButton(self)
E:StripTextures(button.toggle)
button.toggle.SetNormalTexture = E.noop
button.toggle.SetPushedTexture = E.noop
button.toggleText = button.toggle:CreateFontString(nil, "OVERLAY")
E:FontTemplate(button.toggleText, nil, 19)
button.toggleText:SetPoint("CENTER", 0, 0)
button.toggleText:SetText("+")
return button
end
local oldRefreshTree = widget.RefreshTree
widget.RefreshTree = function(self, scrollToSelection)
oldRefreshTree(self, scrollToSelection)
if not self.tree then return end
local status = self.status or self.localstatus
local groupstatus = status.groups
local lines = self.lines
local buttons = self.buttons
for i, line in pairs(lines) do
local button = buttons[i]
if groupstatus[line.uniquevalue] and button then
button.toggleText:SetText("-")
elseif button then
button.toggleText:SetText("+")
end
end
end
end
if TYPE == "TabGroup-ElvUI" then
local oldCreateTab = widget.CreateTab
widget.CreateTab = function(self, id)
local tab = oldCreateTab(self, id)
E:StripTextures(tab)
tab.backdrop = CreateFrame("Frame", nil, tab)
E:SetTemplate(tab.backdrop, "Transparent")
tab.backdrop:SetFrameLevel(tab:GetFrameLevel() - 1)
tab.backdrop:SetPoint("TOPLEFT", 10, -3)
tab.backdrop:SetPoint("BOTTOMRIGHT", -10, 0)
return tab
end
end
if widget.scrollbar then
SkinScrollBar(widget.scrollbar)
end
elseif TYPE == "SimpleGroup" then
local frame = widget.content:GetParent()
E:SetTemplate(frame, "Transparent", nil, true) --ignore border updates
frame:SetBackdropBorderColor(0,0,0,0) --Make border completely transparent
end
return oldRegisterAsContainer(self, widget)
end
AceGUI.RegisterAsContainer = RegisterAsContainer
end
local function attemptSkin()
local AceGUI = LibStub("AceGUI-3.0", true)
if AceGUI and (AceGUI.RegisterAsContainer ~= RegisterAsContainer or AceGUI.RegisterAsWidget ~= RegisterAsWidget) then
S:SkinAce3()
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", attemptSkin)
S:AddCallback("Ace3", attemptSkin)
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Ace3.lua"/>
</Ui>
@@ -0,0 +1,340 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local pairs = pairs
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.auctionhouse ~= true then return end
E:StripTextures(AuctionFrame, true)
E:CreateBackdrop(AuctionFrame, "Transparent")
AuctionFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
AuctionFrame.backdrop:SetPoint("BOTTOMRIGHT", 0, 4)
E:StripTextures(BrowseFilterScrollFrame)
E:StripTextures(BrowseScrollFrame)
E:StripTextures(AuctionsScrollFrame)
E:StripTextures(BidScrollFrame)
S:HandleDropDownBox(BrowseDropDown)
S:HandleScrollBar(BrowseFilterScrollFrameScrollBar)
S:HandleScrollBar(BrowseScrollFrameScrollBar)
S:HandleScrollBar(AuctionsScrollFrameScrollBar)
S:HandleCloseButton(AuctionFrameCloseButton)
-- DressUpFrame
E:StripTextures(AuctionDressUpFrame)
E:CreateBackdrop(AuctionDressUpFrame, "Default")
SetAuctionDressUpBackground()
AuctionDressUpBackgroundTop:SetDesaturated(true)
AuctionDressUpBackgroundBot:SetDesaturated(true)
E:SetOutside(AuctionDressUpFrame.backdrop, AuctionDressUpBackgroundTop, nil, nil, AuctionDressUpBackgroundBot)
S:HandleRotateButton(AuctionDressUpModelRotateLeftButton)
AuctionDressUpModelRotateLeftButton:SetPoint("TOPLEFT", AuctionDressUpFrame, 8, -17)
S:HandleRotateButton(AuctionDressUpModelRotateRightButton)
AuctionDressUpModelRotateRightButton:SetPoint("TOPLEFT", AuctionDressUpModelRotateLeftButton, "TOPRIGHT", 3, 0)
S:HandleButton(AuctionDressUpFrameResetButton)
S:HandleCloseButton(AuctionDressUpFrameCloseButton, AuctionDressUpFrame.backdrop)
local buttons = {
"BrowseBidButton",
"BidBidButton",
"BrowseBuyoutButton",
"BidBuyoutButton",
"BrowseCloseButton",
"BidCloseButton",
"BrowseSearchButton",
"AuctionsCloseButton",
"AuctionsCancelAuctionButton",
"AuctionsCreateAuctionButton",
}
for _, button in pairs(buttons) do
S:HandleButton(_G[button])
end
--Fix Button Positions
AuctionsCloseButton:SetPoint("BOTTOMRIGHT", AuctionFrameAuctions, "BOTTOMRIGHT", 66, 14)
AuctionsCancelAuctionButton:SetPoint("RIGHT", AuctionsCloseButton, "LEFT", -4, 0)
BidBuyoutButton:SetPoint("RIGHT", BidCloseButton, "LEFT", -4, 0)
BidBidButton:SetPoint("RIGHT", BidBuyoutButton, "LEFT", -4, 0)
BrowseBuyoutButton:SetPoint("RIGHT", BrowseCloseButton, "LEFT", -4, 0)
BrowseBidButton:SetPoint("RIGHT", BrowseBuyoutButton, "LEFT", -4, 0)
AuctionsCreateAuctionButton:SetPoint("BOTTOMLEFT", 18, 44)
BrowseSearchButton:ClearAllPoints()
BrowseSearchButton:SetPoint("TOPRIGHT", AuctionFrameBrowse, "TOPRIGHT", 25, -30)
S:HandleNextPrevButton(BrowseNextPageButton)
BrowseNextPageButton:ClearAllPoints()
BrowseNextPageButton:SetPoint("BOTTOMLEFT", BrowseSearchButton, "BOTTOMRIGHT", 10, -27)
S:HandleNextPrevButton(BrowsePrevPageButton)
BrowsePrevPageButton:ClearAllPoints()
BrowsePrevPageButton:SetPoint("BOTTOMRIGHT", BrowseSearchButton, "BOTTOMLEFT", -10, -27)
E:StripTextures(AuctionsItemButton)
E:SetTemplate(AuctionsItemButton, "Default", true)
E:StyleButton(AuctionsItemButton, false, true)
HookScript(AuctionsItemButton, "OnEvent", function()
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
if event == "NEW_AUCTION_UPDATE" and this:GetNormalTexture() then
this:GetNormalTexture():SetTexCoord(unpack(E.TexCoords))
E:SetInside(this:GetNormalTexture())
end
local itemName = GetAuctionSellItemInfo()
if itemName then
local _, itemString = GetItemInfoByName(itemName)
local _, _, quality = GetItemInfo(itemString, "item:(%d+)")
if quality then
AuctionsItemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
AuctionsItemButtonName:SetTextColor(GetItemQualityColor(quality))
else
AuctionsItemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end)
local sorttabs = {
"BrowseQualitySort",
"BrowseLevelSort",
"BrowseDurationSort",
"BrowseHighBidderSort",
"BrowseCurrentBidSort",
"BidQualitySort",
"BidLevelSort",
"BidDurationSort",
"BidBuyoutSort",
"BidStatusSort",
"BidBidSort",
"AuctionsQualitySort",
"AuctionsDurationSort",
"AuctionsHighBidderSort",
"AuctionsBidSort",
}
for _, sorttab in pairs(sorttabs) do
E:Kill(_G[sorttab.."Left"])
E:Kill(_G[sorttab.."Middle"])
E:Kill(_G[sorttab.."Right"])
E:StyleButton(_G[sorttab])
end
for i = 1, 3 do
S:HandleTab(_G["AuctionFrameTab"..i])
end
AuctionFrameTab1:ClearAllPoints()
AuctionFrameTab1:SetPoint("BOTTOMLEFT", AuctionFrame, "BOTTOMLEFT", 25, -26)
AuctionFrameTab1.SetPoint = E.noop
for i = 1, NUM_FILTERS_TO_DISPLAY do
local tab = _G["AuctionFilterButton"..i]
E:StripTextures(tab)
E:StyleButton(tab)
end
local editboxs = {
"BrowseName",
"BrowseMinLevel",
"BrowseMaxLevel",
"BrowseBidPriceGold",
"BrowseBidPriceSilver",
"BrowseBidPriceCopper",
"BidBidPriceGold",
"BidBidPriceSilver",
"BidBidPriceCopper",
"StartPriceGold",
"StartPriceSilver",
"StartPriceCopper",
"BuyoutPriceGold",
"BuyoutPriceSilver",
"BuyoutPriceCopper"
}
for _, editbox in pairs(editboxs) do
S:HandleEditBox(_G[editbox])
_G[editbox]:SetTextInsets(1, 1, -1, 1)
end
BrowseBidPrice:SetPoint("BOTTOM", -15, 18)
BrowseBidText:SetPoint("BOTTOMRIGHT", AuctionFrameBrowse, "BOTTOM", -116, 21)
BrowseMinLevel:SetWidth(32)
BrowseLevelHyphen:SetPoint("LEFT", BrowseMinLevel, "RIGHT", -7, 1)
BrowseMaxLevel:SetPoint("LEFT", BrowseMinLevel, "RIGHT", 8, 0)
BrowseMaxLevel:SetWidth(32)
BrowseLevelText:SetPoint("BOTTOMLEFT", AuctionFrameBrowse, "TOPLEFT", 195, -48)
BrowseName:SetWidth(164)
BrowseName:SetPoint("TOPLEFT", AuctionFrameBrowse, "TOPLEFT", 20, -54)
BrowseNameText:SetPoint("TOPLEFT", BrowseName, "TOPLEFT", 0, 16)
S:HandleCheckBox(IsUsableCheckButton)
IsUsableCheckButton:ClearAllPoints()
IsUsableCheckButton:SetPoint("RIGHT", BrowseIsUsableText, "LEFT", 2, 0)
BrowseIsUsableText:SetPoint("TOPLEFT", 440, -40)
S:HandleCheckBox(ShowOnPlayerCheckButton)
ShowOnPlayerCheckButton:ClearAllPoints()
ShowOnPlayerCheckButton:SetPoint("RIGHT", BrowseShowOnCharacterText, "LEFT", 2, 0)
BrowseShowOnCharacterText:SetPoint("TOPLEFT", 440, -60)
for i = 1, NUM_BROWSE_TO_DISPLAY do
local button = _G["BrowseButton"..i]
local icon = _G["BrowseButton"..i.."Item"]
local name = _G["BrowseButton"..i.."Name"]
local texture = _G["BrowseButton"..i.."ItemIconTexture"]
if texture then
texture:SetTexCoord(unpack(E.TexCoords))
E:SetInside(texture)
end
if icon then
E:StyleButton(icon)
icon:GetNormalTexture():SetTexture("")
E:SetTemplate(icon, "Default")
hooksecurefunc(name, "SetVertexColor", function(_, r, g, b)
if r and g and b then
icon:SetBackdropBorderColor(r, g, b)
end
end)
hooksecurefunc(name, "Hide", function(_, r, g, b)
icon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end)
end
E:StripTextures(button)
E:StyleButton(button, false, true)
_G["BrowseButton"..i.."Highlight"] = button:GetHighlightTexture()
button:GetHighlightTexture():ClearAllPoints()
button:GetHighlightTexture():SetPoint("TOPLEFT", icon, "TOPRIGHT", 2, 0)
button:GetHighlightTexture():SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 5)
-- button:GetPushedTexture():SetAllPoints(button:GetHighlightTexture())
end
for i = 1, NUM_AUCTIONS_TO_DISPLAY do
local button = _G["AuctionsButton"..i]
local icon = _G["AuctionsButton"..i.."Item"]
local name = _G["AuctionsButton"..i.."Name"]
local texture = _G["AuctionsButton"..i.."ItemIconTexture"]
if texture then
texture:SetTexCoord(unpack(E.TexCoords))
E:SetInside(texture)
end
if icon then
E:StyleButton(icon)
icon:GetNormalTexture():SetTexture("")
E:SetTemplate(icon, "Default")
hooksecurefunc(name, "SetVertexColor", function(_, r, g, b)
if r and g and b then
icon:SetBackdropBorderColor(r, g, b)
end
end)
hooksecurefunc(name, "Hide", function(_, r, g, b)
icon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end)
end
E:StripTextures(button)
E:StyleButton(button, false, true)
_G["AuctionsButton"..i.."Highlight"] = button:GetHighlightTexture()
button:GetHighlightTexture():ClearAllPoints()
button:GetHighlightTexture():SetPoint("TOPLEFT", icon, "TOPRIGHT", 2, 0)
button:GetHighlightTexture():SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 5)
-- button:GetPushedTexture():SetAllPoints(button:GetHighlightTexture())
end
for i = 1, NUM_BIDS_TO_DISPLAY do
local button = _G["BidButton"..i]
local icon = _G["BidButton"..i.."Item"]
local name = _G["BidButton"..i.."Name"]
local texture = _G["BidButton"..i.."ItemIconTexture"]
if texture then
texture:SetTexCoord(unpack(E.TexCoords))
E:SetInside(texture)
end
if icon then
E:StyleButton(icon)
icon:GetNormalTexture():SetTexture("")
E:SetTemplate(icon, "Default")
hooksecurefunc(name, "SetVertexColor", function(_, r, g, b)
if r and g and b then
icon:SetBackdropBorderColor(r, g, b)
end
end)
hooksecurefunc(name, "Hide", function(_, r, g, b)
icon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end)
end
E:StripTextures(button)
E:StyleButton(button, false, true)
_G["BidButton"..i.."Highlight"] = button:GetHighlightTexture()
button:GetHighlightTexture():ClearAllPoints()
button:GetHighlightTexture():SetPoint("TOPLEFT", icon, "TOPRIGHT", 2, 0)
button:GetHighlightTexture():SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 5)
-- button:GetPushedTexture():SetAllPoints(button:GetHighlightTexture())
end
--Custom Backdrops
AuctionFrameBrowse.bg1 = CreateFrame("Frame", nil, AuctionFrameBrowse)
E:SetTemplate(AuctionFrameBrowse.bg1, "Default")
AuctionFrameBrowse.bg1:SetPoint("TOPLEFT", 20, -103)
AuctionFrameBrowse.bg1:SetPoint("BOTTOMRIGHT", -575, 40)
BrowseNoResultsText:SetParent(AuctionFrameBrowse.bg1)
BrowseSearchCountText:SetParent(AuctionFrameBrowse.bg1)
AuctionFrameBrowse.bg1:SetFrameLevel(AuctionFrameBrowse.bg1:GetFrameLevel() - 1)
AuctionFrameBrowse.bg2 = CreateFrame("Frame", nil, AuctionFrameBrowse)
E:SetTemplate(AuctionFrameBrowse.bg2, "Default")
AuctionFrameBrowse.bg2:SetPoint("TOPLEFT", AuctionFrameBrowse.bg1, "TOPRIGHT", 4, 0)
AuctionFrameBrowse.bg2:SetPoint("BOTTOMRIGHT", AuctionFrame, "BOTTOMRIGHT", -8, 40)
AuctionFrameBrowse.bg2:SetFrameLevel(AuctionFrameBrowse.bg2:GetFrameLevel() - 1)
AuctionFrameBid.bg = CreateFrame("Frame", nil, AuctionFrameBid)
E:SetTemplate(AuctionFrameBid.bg, "Default")
AuctionFrameBid.bg:SetPoint("TOPLEFT", 20, -72)
AuctionFrameBid.bg:SetPoint("BOTTOMRIGHT", 66, 40)
AuctionFrameBid.bg:SetFrameLevel(AuctionFrameBid.bg:GetFrameLevel() - 1)
AuctionFrameAuctions.bg1 = CreateFrame("Frame", nil, AuctionFrameAuctions)
E:SetTemplate(AuctionFrameAuctions.bg1, "Default")
AuctionFrameAuctions.bg1:SetPoint("TOPLEFT", 15, -72)
AuctionFrameAuctions.bg1:SetPoint("BOTTOMRIGHT", -545, 40)
AuctionFrameAuctions.bg1:SetFrameLevel(AuctionFrameAuctions.bg1:GetFrameLevel() - 1)
AuctionFrameAuctions.bg2 = CreateFrame("Frame", nil, AuctionFrameAuctions)
E:SetTemplate(AuctionFrameAuctions.bg2, "Default")
AuctionFrameAuctions.bg2:SetPoint("TOPLEFT", AuctionFrameAuctions.bg1, "TOPRIGHT", 3, 0)
AuctionFrameAuctions.bg2:SetPoint("BOTTOMRIGHT", AuctionFrame, -8, 40)
AuctionFrameAuctions.bg2:SetFrameLevel(AuctionFrameAuctions.bg2:GetFrameLevel() - 1)
end
S:AddCallbackForAddon("Blizzard_AuctionUI", "AuctionHouse", LoadSkin)
+80
View File
@@ -0,0 +1,80 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local split = string.split
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.bgscore ~= true then return end
E:CreateBackdrop(WorldStateScoreFrame, "Transparent")
WorldStateScoreFrame.backdrop:SetPoint("TOPLEFT", 10, -15)
WorldStateScoreFrame.backdrop:SetPoint("BOTTOMRIGHT", -113, 67)
E:StripTextures(WorldStateScoreFrame)
E:StripTextures(WorldStateScoreScrollFrame)
S:HandleScrollBar(WorldStateScoreScrollFrameScrollBar)
local tab
for i = 1, 3 do
tab = _G["WorldStateScoreFrameTab"..i]
S:HandleTab(tab)
_G["WorldStateScoreFrameTab"..i.."Text"]:SetPoint("CENTER", 0, 2)
end
S:HandleButton(WorldStateScoreFrameLeaveButton)
S:HandleCloseButton(WorldStateScoreFrameCloseButton)
E:StyleButton(WorldStateScoreFrameKB)
E:StyleButton(WorldStateScoreFrameDeaths)
E:StyleButton(WorldStateScoreFrameHK)
E:StyleButton(WorldStateScoreFrameHonorGained)
E:StyleButton(WorldStateScoreFrameName)
for i = 1, 5 do
E:StyleButton(_G["WorldStateScoreColumn"..i])
end
hooksecurefunc("WorldStateScoreFrame_Update", function()
local offset = FauxScrollFrame_GetOffset(WorldStateScoreScrollFrame)
for i = 1, MAX_WORLDSTATE_SCORE_BUTTONS do
local index = offset + i
local name, _, _, _, _, faction = GetBattlefieldScore(index)
if name then
local n, r = split("-", name, 2)
local myName = UnitName("player")
if name == myName then
n = "> "..n.." <"
end
if r then
local color
if faction == 1 then
color = "|cff00adf0"
else
color = "|cffff1919"
end
r = color..r.."|r"
n = n.."|cffffffff - |r"..r
end
local classTextColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classToken] or RAID_CLASS_COLORS[classToken]
_G["WorldStateScoreButton"..i.."NameText"]:SetText(n)
_G["WorldStateScoreButton"..i.."NameText"]:SetTextColor(classTextColor.r, classTextColor.g, classTextColor.b)
end
end
end)
end
S:AddCallback("WorldStateScore", LoadSkin)
+149
View File
@@ -0,0 +1,149 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local match = string.match
--WoW API / Variables
local GetItemQualityColor = GetItemQualityColor
local GetContainerItemLink = GetContainerItemLink
local BANK_CONTAINER = BANK_CONTAINER
local NUM_CONTAINER_FRAMES = NUM_CONTAINER_FRAMES
function S:ContainerFrame_Update()
local id = this:GetID()
local name = this:GetName()
local _, itemButton, itemLink, quality
for i = 1, this.size, 1 do
itemButton = _G[name.."Item"..i]
itemLink = GetContainerItemLink(id, itemButton:GetID())
if itemLink then
_, _, quality = GetItemInfo(match(itemLink, "item:(%d+)"))
if quality then
itemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
else
itemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
else
itemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
function S:BankFrameItemButton_OnUpdate()
if not this.isBag then
local itemLink = GetContainerItemLink(BANK_CONTAINER, this:GetID())
if itemLink then
local _, _, quality = GetItemInfo(match(itemLink, "item:(%d+)"))
if quality then
this:SetBackdropBorderColor(GetItemQualityColor(quality))
else
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
else
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
local function LoadSkin()
if not E.private.skins.blizzard.enable and E.private.skins.blizzard.bags and not E.private.bags.enable then return end
-- ContainerFrame
local containerFrame, containerFrameClose
for i = 1, NUM_CONTAINER_FRAMES, 1 do
containerFrame = _G["ContainerFrame"..i]
containerFrameClose = _G["ContainerFrame"..i.."CloseButton"]
E:StripTextures(containerFrame, true)
E:CreateBackdrop(containerFrame, "Transparent")
containerFrame.backdrop:SetPoint("TOPLEFT", 9, -4)
containerFrame.backdrop:SetPoint("BOTTOMRIGHT", -4, 2)
S:HandleCloseButton(containerFrameClose)
S:SecureHookScript(containerFrame, "OnShow", "ContainerFrame_Update")
local itemButton, itemButtonIcon
for k = 1, MAX_CONTAINER_ITEMS, 1 do
itemButton = _G["ContainerFrame"..i.."Item"..k]
itemButtonIcon = _G["ContainerFrame"..i.."Item"..k.."IconTexture"]
itemButtonCooldown = _G["ContainerFrame"..i.."Item"..k.."Cooldown"]
itemButton:SetNormalTexture("")
E:SetTemplate(itemButton, "Default", true)
E:StyleButton(itemButton)
E:SetInside(itemButtonIcon)
itemButtonIcon:SetTexCoord(unpack(E.TexCoords))
if itemButtonCooldown then
E:RegisterCooldown(itemButtonCooldown)
end
end
end
S:SecureHook("ContainerFrame_Update")
-- BankFrame
E:CreateBackdrop(BankFrame, "Transparent")
BankFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
BankFrame.backdrop:SetPoint("BOTTOMRIGHT", -26, 93)
E:StripTextures(BankFrame, true)
S:HandleCloseButton(BankCloseButton)
local button, buttonIcon
for i = 1, NUM_BANKGENERIC_SLOTS, 1 do
button = _G["BankFrameItem"..i]
buttonIcon = _G["BankFrameItem"..i.."IconTexture"]
button:SetNormalTexture("")
E:SetTemplate(button, "Default", true)
E:StyleButton(button)
E:SetInside(buttonIcon)
buttonIcon:SetTexCoord(unpack(E.TexCoords))
end
BankFrame.itemBackdrop = CreateFrame("Frame", "BankFrameItemBackdrop", BankFrame)
E:SetTemplate(BankFrame.itemBackdrop, "Default")
BankFrame.itemBackdrop:SetPoint("TOPLEFT", BankFrameItem1, "TOPLEFT", -6, 6)
BankFrame.itemBackdrop:SetPoint("BOTTOMRIGHT", BankFrameItem24, "BOTTOMRIGHT", 6, -6)
BankFrame.itemBackdrop:SetFrameLevel(BankFrame:GetFrameLevel())
for i = 1, NUM_BANKBAGSLOTS, 1 do
button = _G["BankFrameBag"..i]
buttonIcon = _G["BankFrameBag"..i.."IconTexture"]
button:SetNormalTexture("")
E:SetTemplate(button, "Default", true)
E:StyleButton(button)
E:SetInside(buttonIcon)
buttonIcon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(_G["BankFrameBag"..i.."HighlightFrameTexture"])
_G["BankFrameBag"..i.."HighlightFrameTexture"]:SetTexture(unpack(E["media"].rgbvaluecolor), 0.3)
end
BankFrame.bagBackdrop = CreateFrame("Frame", "BankFrameBagBackdrop", BankFrame)
E:SetTemplate(BankFrame.bagBackdrop, "Default")
BankFrame.bagBackdrop:SetPoint("TOPLEFT", BankFrameBag1, "TOPLEFT", -6, 6)
BankFrame.bagBackdrop:SetPoint("BOTTOMRIGHT", BankFrameBag6, "BOTTOMRIGHT", 6, -6)
BankFrame.bagBackdrop:SetFrameLevel(BankFrame:GetFrameLevel())
S:HandleButton(BankFramePurchaseButton)
S:SecureHook("BankFrameItemButton_OnUpdate")
end
S:AddCallback("SkinBags", LoadSkin)
@@ -0,0 +1,30 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.battlefield ~= true then return end
E:StripTextures(BattlefieldFrame)
E:CreateBackdrop(BattlefieldFrame, "Transparent")
BattlefieldFrame.backdrop:SetPoint("TOPLEFT", 11, -12)
BattlefieldFrame.backdrop:SetPoint("BOTTOMRIGHT", -34, 74)
E:StripTextures(BattlefieldListScrollFrame)
S:HandleScrollBar(BattlefieldListScrollFrameScrollBar)
BattlefieldFrameZoneDescription:SetTextColor(1, 1, 1)
S:HandleButton(BattlefieldFrameCancelButton)
S:HandleButton(BattlefieldFrameJoinButton)
S:HandleButton(BattlefieldFrameGroupJoinButton)
S:HandleCloseButton(BattlefieldFrameCloseButton)
end
S:AddCallback("Battlefield", LoadSkin)
+39
View File
@@ -0,0 +1,39 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.binding ~= true then return end
E:StripTextures(KeyBindingFrame)
E:CreateBackdrop(KeyBindingFrame, "Transparent")
KeyBindingFrame.backdrop:SetPoint("TOPLEFT", 2, 0)
KeyBindingFrame.backdrop:SetPoint("BOTTOMRIGHT", -42, 12)
local bindingKey1, bindingKey2
for i = 1, KEY_BINDINGS_DISPLAYED do
bindingKey1 = _G["KeyBindingFrameBinding"..i.."Key1Button"]
bindingKey2 = _G["KeyBindingFrameBinding"..i.."Key2Button"]
S:HandleButton(bindingKey1)
S:HandleButton(bindingKey2)
bindingKey2:SetPoint("LEFT", bindingKey1, "RIGHT", 1, 0)
end
S:HandleScrollBar(KeyBindingFrameScrollFrameScrollBar)
S:HandleCheckBox(KeyBindingFrameCharacterButton)
S:HandleButton(KeyBindingFrameDefaultButton)
S:HandleButton(KeyBindingFrameCancelButton)
S:HandleButton(KeyBindingFrameOkayButton)
KeyBindingFrameOkayButton:SetPoint("RIGHT", KeyBindingFrameCancelButton, "LEFT", -3, 0)
S:HandleButton(KeyBindingFrameUnbindButton)
KeyBindingFrameUnbindButton:SetPoint("RIGHT", KeyBindingFrameOkayButton, "LEFT", -3, 0)
end
S:AddCallbackForAddon("Blizzard_BindingUI", "Binding", LoadSkin)
+333
View File
@@ -0,0 +1,333 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local pairs = pairs
local find, getn = string.find, table.getn
--WoW API / Variables
local GetInventoryItemTexture = GetInventoryItemTexture
local GetInventoryItemQuality = GetInventoryItemQuality
local GetNumFactions = GetNumFactions
local FauxScrollFrame_GetOffset = FauxScrollFrame_GetOffset
local NUM_FACTIONS_DISPLAYED = NUM_FACTIONS_DISPLAYED
local CHARACTERFRAME_SUBFRAMES = CHARACTERFRAME_SUBFRAMES
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.character ~= true then return end
-- Character Frame
E:StripTextures(CharacterFrame, true)
E:CreateBackdrop(CharacterFrame, "Transparent")
CharacterFrame.backdrop:SetPoint("TOPLEFT", 11, -12)
CharacterFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 76)
S:HandleCloseButton(CharacterFrameCloseButton)
for i = 1, getn(CHARACTERFRAME_SUBFRAMES) do
local tab = _G["CharacterFrameTab"..i]
S:HandleTab(tab)
end
E:StripTextures(PaperDollFrame)
S:HandleRotateButton(CharacterModelFrameRotateLeftButton)
CharacterModelFrameRotateLeftButton:SetPoint("TOPLEFT", 3, -3)
S:HandleRotateButton(CharacterModelFrameRotateRightButton)
CharacterModelFrameRotateRightButton:SetPoint("TOPLEFT", CharacterModelFrameRotateLeftButton, "TOPRIGHT", 3, 0)
E:StripTextures(CharacterAttributesFrame)
local function HandleResistanceFrame(frameName)
for i = 1, 5 do
local frame = _G[frameName..i]
frame:SetWidth(24)
frame:SetHeight(24)
local icon, text = _G[frameName..i]:GetRegions()
E:SetInside(icon)
icon:SetDrawLayer("ARTWORK")
text:SetDrawLayer("OVERLAY")
E:SetTemplate(frame, "Default")
if i ~= 1 then
frame:ClearAllPoints()
frame:SetPoint("TOP", _G[frameName..i-1], "BOTTOM", 0, -(E.Border + E.Spacing))
end
end
end
HandleResistanceFrame("MagicResFrame")
MagicResFrame1:GetRegions():SetTexCoord(0.21875, 0.8125, 0.25, 0.32421875) --Arcane
MagicResFrame2:GetRegions():SetTexCoord(0.21875, 0.8125, 0.0234375, 0.09765625) --Fire
MagicResFrame3:GetRegions():SetTexCoord(0.21875, 0.8125, 0.13671875, 0.2109375) --Nature
MagicResFrame4:GetRegions():SetTexCoord(0.21875, 0.8125, 0.36328125, 0.4375) --Frost
MagicResFrame5:GetRegions():SetTexCoord(0.21875, 0.8125, 0.4765625, 0.55078125) --Shadow
local slots = {"HeadSlot", "NeckSlot", "ShoulderSlot", "BackSlot", "ChestSlot", "ShirtSlot", "TabardSlot", "WristSlot",
"HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", "Finger0Slot", "Finger1Slot", "Trinket0Slot", "Trinket1Slot",
"MainHandSlot", "SecondaryHandSlot", "RangedSlot", "AmmoSlot"
}
for _, slot in pairs(slots) do
local icon = _G["Character"..slot.."IconTexture"]
local cooldown = _G["Character"..slot.."Cooldown"]
slot = _G["Character"..slot]
E:StripTextures(slot)
E:StyleButton(slot, false)
E:SetTemplate(slot, "Default", true, true)
icon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(icon)
slot:SetFrameLevel(PaperDollFrame:GetFrameLevel() + 2)
if cooldown then
E:RegisterCooldown(cooldown)
end
end
hooksecurefunc("PaperDollItemSlotButton_Update", function(cooldownOnly)
if cooldownOnly then return end
local textureName = GetInventoryItemTexture("player", this:GetID())
if textureName then
local rarity = GetInventoryItemQuality("player", this:GetID())
this:SetBackdropBorderColor(GetItemQualityColor(rarity))
else
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end)
E:StripTextures(ReputationFrame)
for i = 1, NUM_FACTIONS_DISPLAYED do
local factionBar = _G["ReputationBar"..i]
local factionHeader = _G["ReputationHeader"..i]
local factionName = _G["ReputationBar"..i.."FactionName"]
local factionAtWarCheck = _G["ReputationBar"..i.."AtWarCheck"]
E:StripTextures(factionBar)
E:CreateBackdrop(factionBar, "Default")
factionBar:SetStatusBarTexture(E.media.normTex)
factionBar:SetWidth(108)
factionBar:SetHeight(13)
E:RegisterStatusBar(factionBar)
if i == 1 then
factionBar:SetPoint("TOPLEFT", 190, -86)
end
factionName:SetPoint("LEFT", factionBar, "LEFT", -150, 0)
factionName:SetWidth(140)
factionName.SetWidth = E.noop
E:StripTextures(factionAtWarCheck)
factionAtWarCheck:SetPoint("LEFT", factionBar, "RIGHT", 0, 0)
factionAtWarCheck.Icon = factionAtWarCheck:CreateTexture(nil, "OVERLAY")
factionAtWarCheck.Icon:SetPoint("LEFT", 6, -8)
factionAtWarCheck.Icon:SetWidth(32)
factionAtWarCheck.Icon:SetHeight(32)
factionAtWarCheck.Icon:SetTexture("Interface\\Buttons\\UI-CheckBox-SwordCheck")
E:StripTextures(factionHeader)
factionHeader:SetNormalTexture(nil)
factionHeader.SetNormalTexture = E.noop
factionHeader:SetPoint("TOPLEFT", factionBar, "TOPLEFT", -175, 0)
factionHeader.Text = factionHeader:CreateFontString(nil, "OVERLAY")
E:FontTemplate(factionHeader.Text, nil, 22)
factionHeader.Text:SetPoint("LEFT", 3, 0)
factionHeader.Text:SetText("+")
end
-- PetPaperDollFrame
E:StripTextures(PetPaperDollFrame)
S:HandleButton(PetPaperDollCloseButton)
S:HandleRotateButton(PetModelFrameRotateLeftButton)
PetModelFrameRotateLeftButton:ClearAllPoints()
PetModelFrameRotateLeftButton:SetPoint("TOPLEFT", 3, -3)
S:HandleRotateButton(PetModelFrameRotateRightButton)
PetModelFrameRotateRightButton:ClearAllPoints()
PetModelFrameRotateRightButton:SetPoint("TOPLEFT", PetModelFrameRotateLeftButton, "TOPRIGHT", 3, 0)
E:StripTextures(PetAttributesFrame)
E:CreateBackdrop(PetResistanceFrame, "Default")
E:SetOutside(PetResistanceFrame.backdrop, PetMagicResFrame1, nil, nil, PetMagicResFrame5)
for i = 1, 5 do
local frame = _G["PetMagicResFrame"..i]
frame:SetWidth(24)
frame:SetHeight(24)
end
PetMagicResFrame1:GetRegions():SetTexCoord(0.21875, 0.78125, 0.25, 0.3203125)
PetMagicResFrame2:GetRegions():SetTexCoord(0.21875, 0.78125, 0.0234375, 0.09375)
PetMagicResFrame3:GetRegions():SetTexCoord(0.21875, 0.78125, 0.13671875, 0.20703125)
PetMagicResFrame4:GetRegions():SetTexCoord(0.21875, 0.78125, 0.36328125, 0.43359375)
PetMagicResFrame5:GetRegions():SetTexCoord(0.21875, 0.78125, 0.4765625, 0.546875)
E:StripTextures(PetPaperDollFrameExpBar)
PetPaperDollFrameExpBar:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(PetPaperDollFrameExpBar)
E:CreateBackdrop(PetPaperDollFrameExpBar, "Default")
local function updHappiness()
local happiness = GetPetHappiness()
local _, isHunterPet = HasPetUI()
if not happiness or not isHunterPet then
return
end
local texture = this:GetRegions()
if happiness == 1 then
texture:SetTexCoord(0.41, 0.53, 0.06, 0.30)
elseif happiness == 2 then
texture:SetTexCoord(0.22, 0.345, 0.06, 0.30)
elseif happiness == 3 then
texture:SetTexCoord(0.04, 0.15, 0.06, 0.30)
end
end
PetPaperDollPetInfo:SetPoint("TOPLEFT", PetModelFrameRotateLeftButton, "BOTTOMLEFT", 9, -3)
PetPaperDollPetInfo:GetRegions():SetTexCoord(0.04, 0.15, 0.06, 0.30)
PetPaperDollPetInfo:SetFrameLevel(PetModelFrame:GetFrameLevel() + 2)
E:CreateBackdrop(PetPaperDollPetInfo, "Default")
PetPaperDollPetInfo:SetWidth(24)
PetPaperDollPetInfo:SetHeight(24)
PetPaperDollPetInfo:RegisterEvent("UNIT_HAPPINESS")
PetPaperDollPetInfo:SetScript("OnEvent", updHappiness)
PetPaperDollPetInfo:SetScript("OnShow", updHappiness)
-- Reputation Frame
hooksecurefunc("ReputationFrame_Update", function()
local numFactions = GetNumFactions()
local factionIndex, factionHeader
local factionOffset = FauxScrollFrame_GetOffset(ReputationListScrollFrame)
for i = 1, NUM_FACTIONS_DISPLAYED, 1 do
factionHeader = _G["ReputationHeader"..i]
factionIndex = factionOffset + i
if factionIndex <= numFactions then
if factionHeader.isCollapsed then
factionHeader.Text:SetText("+")
else
factionHeader.Text:SetText("-")
end
end
end
end)
E:StripTextures(ReputationListScrollFrame)
S:HandleScrollBar(ReputationListScrollFrameScrollBar)
E:StripTextures(ReputationDetailFrame)
E:SetTemplate(ReputationDetailFrame, "Transparent")
ReputationDetailFrame:SetPoint("TOPLEFT", ReputationFrame, "TOPRIGHT", -31, -12)
S:HandleCloseButton(ReputationDetailCloseButton)
ReputationDetailCloseButton:SetPoint("TOPRIGHT", 2, 2)
S:HandleCheckBox(ReputationDetailAtWarCheckBox)
S:HandleCheckBox(ReputationDetailInactiveCheckBox)
S:HandleCheckBox(ReputationDetailMainScreenCheckBox)
-- Skill Frame
E:StripTextures(SkillFrame)
SkillFrameExpandButtonFrame:DisableDrawLayer("BACKGROUND")
SkillFrameCollapseAllButton:SetPoint("LEFT", SkillFrameExpandTabLeft, "RIGHT", -40, -3)
SkillFrameCollapseAllButton:SetNormalTexture("")
SkillFrameCollapseAllButton.SetNormalTexture = E.noop
SkillFrameCollapseAllButton:SetHighlightTexture(nil)
SkillFrameCollapseAllButton.Text = SkillFrameCollapseAllButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(SkillFrameCollapseAllButton.Text, nil, 22)
SkillFrameCollapseAllButton.Text:SetPoint("CENTER", -10, 0)
SkillFrameCollapseAllButton.Text:SetText("+")
hooksecurefunc(SkillFrameCollapseAllButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
else
self.Text:SetText("+")
end
end)
S:HandleButton(SkillFrameCancelButton)
for i = 1, SKILLS_TO_DISPLAY do
local bar = _G["SkillRankFrame"..i]
bar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(bar)
E:CreateBackdrop(bar, "Default")
E:StripTextures(_G["SkillRankFrame"..i.."Border"])
_G["SkillRankFrame"..i.."Background"]:SetTexture(nil)
local label = _G["SkillTypeLabel"..i]
label:SetNormalTexture("")
label.SetNormalTexture = E.noop
label:SetHighlightTexture(nil)
label.Text = label:CreateFontString(nil, "OVERLAY")
E:FontTemplate(label.Text, nil, 22)
label.Text:SetPoint("LEFT", 3, 0)
label.Text:SetText("+")
hooksecurefunc(label, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
else
self.Text:SetText("+")
end
end)
end
E:StripTextures(SkillListScrollFrame)
S:HandleScrollBar(SkillListScrollFrameScrollBar)
E:StripTextures(SkillDetailScrollFrame)
S:HandleScrollBar(SkillDetailScrollFrameScrollBar)
E:StripTextures(SkillDetailStatusBar)
SkillDetailStatusBar:SetParent(SkillDetailScrollFrame)
E:CreateBackdrop(SkillDetailStatusBar, "Default")
SkillDetailStatusBar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(SkillDetailStatusBar)
E:StripTextures(SkillDetailStatusBarUnlearnButton)
SkillDetailStatusBarUnlearnButton:SetPoint("LEFT", SkillDetailStatusBarBorder, "RIGHT", -2, -5)
SkillDetailStatusBarUnlearnButton:SetWidth(36)
SkillDetailStatusBarUnlearnButton:SetHeight(36)
SkillDetailStatusBarUnlearnButton.Icon = SkillDetailStatusBarUnlearnButton:CreateTexture(nil, "OVERLAY")
SkillDetailStatusBarUnlearnButton.Icon:SetPoint("LEFT", 7, 5)
SkillDetailStatusBarUnlearnButton.Icon:SetWidth(18)
SkillDetailStatusBarUnlearnButton.Icon:SetHeight(18)
SkillDetailStatusBarUnlearnButton.Icon:SetTexture("Interface\\Buttons\\UI-GroupLoot-Pass-Up")
-- Honor Frame
hooksecurefunc("HonorFrame_Update", function()
E:StripTextures(HonorFrame)
HonorFrameProgressBar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(HonorFrameProgressBar)
end)
end
S:AddCallback("Character", LoadSkin)
+165
View File
@@ -0,0 +1,165 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local find, match, split = string.find, string.match, string.split
--WoW API / Variables
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local GetCraftReagentInfo = GetCraftReagentInfo
local GetCraftItemLink = GetCraftItemLink
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or not E.private.skins.blizzard.craft ~= true then return end
E:StripTextures(CraftFrame, true)
E:CreateBackdrop(CraftFrame, "Transparent")
CraftFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
CraftFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 74)
E:StripTextures(CraftRankFrameBorder)
CraftRankFrame:SetWidth(322)
CraftRankFrame:SetHeight(16)
CraftRankFrame:ClearAllPoints()
CraftRankFrame:SetPoint("TOP", -10, -45)
E:CreateBackdrop(CraftRankFrame)
CraftRankFrame:SetStatusBarTexture(E["media"].normTex)
CraftRankFrame:SetStatusBarColor(0.13, 0.35, 0.80)
E:RegisterStatusBar(CraftRankFrame)
E:StripTextures(CraftExpandButtonFrame)
E:StripTextures(CraftDetailScrollChildFrame)
E:StripTextures(CraftListScrollFrame)
S:HandleScrollBar(CraftListScrollFrameScrollBar)
E:StripTextures(CraftDetailScrollFrame)
S:HandleScrollBar(CraftDetailScrollFrameScrollBar)
E:StripTextures(CraftIcon)
S:HandleButton(CraftCreateButton)
S:HandleButton(CraftCancelButton)
S:HandleCloseButton(CraftFrameCloseButton)
for i = 1, MAX_CRAFT_REAGENTS do
local reagent = _G["CraftReagent"..i]
local icon = _G["CraftReagent"..i.."IconTexture"]
local count = _G["CraftReagent"..i.."Count"]
local nameFrame = _G["CraftReagent"..i.."NameFrame"]
icon:SetTexCoord(unpack(E.TexCoords))
icon:SetDrawLayer("OVERLAY")
icon.backdrop = CreateFrame("Frame", nil, reagent)
icon.backdrop:SetFrameLevel(reagent:GetFrameLevel() - 1)
E:SetTemplate(icon.backdrop, "Default")
E:SetOutside(icon.backdrop, icon)
icon:SetParent(icon.backdrop)
count:SetParent(icon.backdrop)
count:SetDrawLayer("OVERLAY")
E:Kill(nameFrame)
end
hooksecurefunc("CraftFrame_SetSelection", function(id)
E:SetTemplate(CraftIcon, "Default", true)
E:StyleButton(CraftIcon, nil, true)
if CraftIcon:GetNormalTexture() then
CraftIcon:GetNormalTexture():SetTexCoord(unpack(E.TexCoords))
E:SetInside(CraftIcon:GetNormalTexture())
end
CraftIcon:SetWidth(40)
CraftIcon:SetHeight(40)
CraftIcon:SetPoint("TOPLEFT", 4, -3)
CraftRequirements:SetTextColor(1, 0.80, 0.10)
local skillLink = GetCraftItemLink(id)
if skillLink then
local _, _, quality = GetItemInfo(match(skillLink, "enchant:(%d+)"))
if quality then
CraftIcon:SetBackdropBorderColor(GetItemQualityColor(quality))
CraftName:SetTextColor(GetItemQualityColor(quality))
else
CraftIcon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
CraftName:SetTextColor(1, 1, 1)
end
end
local numReagents = GetCraftNumReagents(id)
for i = 1, numReagents, 1 do
local icon = _G["CraftReagent"..i.."IconTexture"]
local name = _G["CraftReagent"..i.."Name"]
local _, _, reagentCount, playerReagentCount = GetCraftReagentInfo(id, i)
local reagentLink = GetCraftReagentItemLink(id, i)
if reagentLink then
local _, _, quality = GetItemInfo(match(reagentLink, "item:(%d+)"))
if quality then
icon.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
if playerReagentCount < reagentCount then
name:SetTextColor(0.5, 0.5, 0.5)
else
name:SetTextColor(GetItemQualityColor(quality))
end
else
icon.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
end)
for i = 1, CRAFTS_DISPLAYED do
local craftButton = _G["Craft"..i]
craftButton:SetNormalTexture("")
craftButton.SetNormalTexture = E.noop
_G["Craft"..i.."Highlight"]:SetTexture("")
_G["Craft"..i.."Highlight"].SetTexture = E.noop
craftButton.Text = craftButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(craftButton.Text, nil, 22)
craftButton.Text:SetPoint("LEFT", 3, 0)
craftButton.Text:SetText("+")
hooksecurefunc(craftButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
elseif find(texture, "PlusButton") then
self.Text:SetText("+")
else
self.Text:SetText("")
end
end)
end
CraftCollapseAllButton:SetNormalTexture("")
CraftCollapseAllButton.SetNormalTexture = E.noop
CraftCollapseAllButton:SetHighlightTexture("")
CraftCollapseAllButton.SetHighlightTexture = E.noop
CraftCollapseAllButton:SetDisabledTexture("")
CraftCollapseAllButton.SetDisabledTexture = E.noop
CraftCollapseAllButton.Text = CraftCollapseAllButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(CraftCollapseAllButton.Text, nil, 22)
CraftCollapseAllButton.Text:SetPoint("LEFT", 3, 0)
CraftCollapseAllButton.Text:SetText("+")
hooksecurefunc(CraftCollapseAllButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
else
self.Text:SetText("+")
end
end)
end
S:AddCallbackForAddon("Blizzard_CraftUI", "Craft", LoadSkin)
+71
View File
@@ -0,0 +1,71 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local getn = table.getn
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.debug ~= true then return end
-- ScriptErrorsFrame:SetParent(E.UIParent)
ScriptErrorsFrame:SetScale(UIParent:GetScale())
E:SetTemplate(ScriptErrorsFrame, "Transparent")
S:HandleScrollBar(ScriptErrorsFrameScrollFrameScrollBar)
S:HandleCloseButton(ScriptErrorsFrameClose)
E:FontTemplate(ScriptErrorsFrameScrollFrameText, nil, 13)
E:CreateBackdrop(ScriptErrorsFrameScrollFrame, "Default")
ScriptErrorsFrameScrollFrame:SetFrameLevel(ScriptErrorsFrameScrollFrame:GetFrameLevel() + 2)
E:SetTemplate(EventTraceFrame, "Transparent")
S:HandleSliderFrame(EventTraceFrameScroll)
local texs = {
"TopLeft",
"TopRight",
"Top",
"BottomLeft",
"BottomRight",
"Bottom",
"Left",
"Right",
"TitleBG",
"DialogBG",
}
for i = 1, getn(texs) do
_G["ScriptErrorsFrame"..texs[i]]:SetTexture(nil)
_G["EventTraceFrame"..texs[i]]:SetTexture(nil)
end
S:HandleButton(ScriptErrorsFrame.reload)
S:HandleNextPrevButton(ScriptErrorsFrame.previous)
S:HandleNextPrevButton(ScriptErrorsFrame.next)
S:HandleButton(ScriptErrorsFrame.close)
S:HandleButton(ScriptErrorsFrame.close)
ScriptErrorsFrame.reload:SetPoint("BOTTOMLEFT", 12, 8)
ScriptErrorsFrame.previous:SetPoint("BOTTOM", ScriptErrorsFrame, "BOTTOM", -50, 7)
ScriptErrorsFrame.next:SetPoint("BOTTOM", ScriptErrorsFrame, "BOTTOM", 50, 7)
ScriptErrorsFrame.close:SetPoint("BOTTOMRIGHT", -12, 8)
local noscalemult = E.mult * GetCVar("uiScale")
HookScript(FrameStackTooltip, "OnShow", function()
E:SetTemplate(this, "Transparent")
this:SetBackdropColor(unpack(E["media"].backdropfadecolor))
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end)
HookScript(EventTraceTooltip, "OnShow", function()
E:SetTemplate(this, "Transparent")
end)
S:HandleCloseButton(EventTraceFrameCloseButton)
end
S:AddCallbackForAddon("!DebugTools", "SkinDebugTools", LoadSkin)
@@ -0,0 +1,43 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
--WoW API / Variables
local SetDressUpBackground = SetDressUpBackground
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.dressingroom ~= true then return end
E:StripTextures(DressUpFrame)
E:CreateBackdrop(DressUpFrame, "Transparent")
DressUpFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
DressUpFrame.backdrop:SetPoint("BOTTOMRIGHT", -33, 73)
E:Kill(DressUpFramePortrait)
SetDressUpBackground()
DressUpBackgroundTopLeft:SetDesaturated(true)
DressUpBackgroundTopRight:SetDesaturated(true)
DressUpBackgroundBotLeft:SetDesaturated(true)
DressUpBackgroundBotRight:SetDesaturated(true)
DressUpFrameDescriptionText:SetPoint("CENTER", DressUpFrameTitleText, "BOTTOM", -5, -22)
S:HandleCloseButton(DressUpFrameCloseButton)
S:HandleRotateButton(DressUpModelRotateLeftButton)
DressUpModelRotateLeftButton:SetPoint("TOPLEFT", DressUpFrame, 25, -79)
S:HandleRotateButton(DressUpModelRotateRightButton)
DressUpModelRotateRightButton:SetPoint("TOPLEFT", DressUpModelRotateLeftButton, "TOPRIGHT", 3, 0)
S:HandleButton(DressUpFrameCancelButton)
DressUpFrameCancelButton:SetPoint("CENTER", DressUpFrame, "TOPLEFT", 306, -423)
S:HandleButton(DressUpFrameResetButton)
DressUpFrameResetButton:SetPoint("RIGHT", DressUpFrameCancelButton, "LEFT", -3, 0)
E:CreateBackdrop(DressUpModel, "Default")
E:SetOutside(DressUpModel.backdrop, DressUpBackgroundTopLeft, nil, nil, DressUpModel)
end
S:AddCallback("DressingRoom", LoadSkin)
+434
View File
@@ -0,0 +1,434 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local upper = string.upper
--WoW API / Variables
local GetWhoInfo = GetWhoInfo
local GetGuildRosterInfo = GetGuildRosterInfo
local GUILDMEMBERS_TO_DISPLAY = GUILDMEMBERS_TO_DISPLAY
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
local hooksecurefunc = hooksecurefunc
function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.friends ~= true then return end
-- Friends Frame
E:StripTextures(FriendsFrame, true)
E:CreateBackdrop(FriendsFrame, "Transparent")
FriendsFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
FriendsFrame.backdrop:SetPoint("BOTTOMRIGHT", -33, 76)
S:HandleCloseButton(FriendsFrameCloseButton)
for i = 1, 4 do
S:HandleTab(_G["FriendsFrameTab"..i])
end
-- Friends List Frame
for i = 1, 2 do
local tab = _G["FriendsFrameToggleTab"..i]
E:StripTextures(tab)
E:CreateBackdrop(tab, "Default", true)
tab.backdrop:SetPoint("TOPLEFT", 3, -7)
tab.backdrop:SetPoint("BOTTOMRIGHT", -2, -1)
tab:SetScript("OnEnter", S.SetModifiedBackdrop)
tab:SetScript("OnLeave", S.SetOriginalBackdrop)
end
local r, g, b = 0.8, 0.8, 0.8
local function StyleButton(f, scale)
f:SetHighlightTexture(nil)
local width, height = (f:GetWidth() * (scale or 0.5)), f:GetHeight()
local leftGrad = f:CreateTexture(nil, "HIGHLIGHT")
leftGrad:SetWidth(width)
leftGrad:SetHeight(height)
leftGrad:SetPoint("LEFT", f, "CENTER")
leftGrad:SetTexture(E.media.blankTex)
leftGrad:SetGradientAlpha("Horizontal", r, g, b, 0.35, r, g, b, 0)
local rightGrad = f:CreateTexture(nil, "HIGHLIGHT")
rightGrad:SetWidth(width)
rightGrad:SetHeight(height)
rightGrad:SetPoint("RIGHT", f, "CENTER")
rightGrad:SetTexture(E.media.blankTex)
rightGrad:SetGradientAlpha("Horizontal", r, g, b, 0, r, g, b, 0.35)
end
for i = 1, 10 do
StyleButton(_G["FriendsFrameFriendButton"..i], 0.6)
end
E:StripTextures(FriendsFrameFriendsScrollFrame)
S:HandleScrollBar(FriendsFrameFriendsScrollFrameScrollBar)
S:HandleButton(FriendsFrameAddFriendButton)
FriendsFrameAddFriendButton:SetPoint("BOTTOMLEFT", 17, 102)
S:HandleButton(FriendsFrameSendMessageButton)
S:HandleButton(FriendsFrameRemoveFriendButton)
FriendsFrameRemoveFriendButton:SetPoint("TOP", FriendsFrameAddFriendButton, "BOTTOM", 0, -2)
S:HandleButton(FriendsFrameGroupInviteButton)
FriendsFrameGroupInviteButton:SetPoint("TOP", FriendsFrameSendMessageButton, "BOTTOM", 0, -2)
-- Ignore List Frame
for i = 1, 2 do
local tab = _G["IgnoreFrameToggleTab"..i]
E:StripTextures(tab)
E:CreateBackdrop(tab, "Default", true)
tab.backdrop:SetPoint("TOPLEFT", 3, -7)
tab.backdrop:SetPoint("BOTTOMRIGHT", -2, -1)
tab:SetScript("OnEnter", function() S:SetModifiedBackdrop(this) end)
tab:SetScript("OnLeave", function() S:SetOriginalBackdrop(this) end)
end
S:HandleButton(FriendsFrameIgnorePlayerButton)
S:HandleButton(FriendsFrameStopIgnoreButton)
for i = 1, 20 do
StyleButton(_G["FriendsFrameIgnoreButton"..i])
end
-- Who Frame
WhoFrameColumnHeader3:ClearAllPoints()
WhoFrameColumnHeader3:SetPoint("TOPLEFT", 20, -70)
WhoFrameColumnHeader4:ClearAllPoints()
WhoFrameColumnHeader4:SetPoint("LEFT", WhoFrameColumnHeader3, "RIGHT", -2, -0)
WhoFrameColumnHeader4:SetWidth(48)
WhoFrameColumnHeader1:ClearAllPoints()
WhoFrameColumnHeader1:SetPoint("LEFT", WhoFrameColumnHeader4, "RIGHT", -2, -0)
WhoFrameColumnHeader1:SetWidth(105)
WhoFrameColumnHeader2:ClearAllPoints()
WhoFrameColumnHeader2:SetPoint("LEFT", WhoFrameColumnHeader1, "RIGHT", -2, -0)
for i = 1, 4 do
E:StripTextures(_G["WhoFrameColumnHeader"..i])
E:StyleButton(_G["WhoFrameColumnHeader"..i], nil, true)
end
S:HandleDropDownBox(WhoFrameDropDown)
for i = 1, 17 do
local button = _G["WhoFrameButton"..i]
local level = _G["WhoFrameButton"..i.."Level"]
local name = _G["WhoFrameButton"..i.."Name"]
button.icon = button:CreateTexture("$parentIcon", "ARTWORK")
button.icon:SetPoint("LEFT", 45, 0)
button.icon:SetWidth(15)
button.icon:SetHeight(15)
button.icon:SetTexture("Interface\\AddOns\\ElvUI\\Media\\Textures\\Icons-Classes")
E:CreateBackdrop(button, "Default", true)
button.backdrop:SetAllPoints(button.icon)
StyleButton(button)
level:ClearAllPoints()
level:SetPoint("TOPLEFT", 12, -2)
name:SetWidth(100)
name:SetHeight(14)
name:ClearAllPoints()
name:SetPoint("LEFT", 85, 0)
_G["WhoFrameButton"..i.."Class"]:Hide()
end
E:StripTextures(WhoListScrollFrame)
S:HandleScrollBar(WhoListScrollFrameScrollBar)
S:HandleEditBox(WhoFrameEditBox)
WhoFrameEditBox:SetPoint("BOTTOMLEFT", 17, 108)
WhoFrameEditBox:SetWidth(338)
WhoFrameEditBox:SetHeight(18)
S:HandleButton(WhoFrameWhoButton)
WhoFrameWhoButton:ClearAllPoints()
WhoFrameWhoButton:SetPoint("BOTTOMLEFT", 16, 82)
S:HandleButton(WhoFrameAddFriendButton)
WhoFrameAddFriendButton:SetPoint("LEFT", WhoFrameWhoButton, "RIGHT", 3, 0)
WhoFrameAddFriendButton:SetPoint("RIGHT", WhoFrameGroupInviteButton, "LEFT", -3, 0)
S:HandleButton(WhoFrameGroupInviteButton)
hooksecurefunc("WhoList_Update", function()
local whoOffset = FauxScrollFrame_GetOffset(WhoListScrollFrame)
local playerZone = GetRealZoneText()
local playerGuild = GetGuildInfo("player")
local playerRace = UnitRace("player")
for i = 1, WHOS_TO_DISPLAY, 1 do
local index = whoOffset + i
local button = _G["WhoFrameButton"..i]
local nameText = _G["WhoFrameButton"..i.."Name"]
local levelText = _G["WhoFrameButton"..i.."Level"]
local classText = _G["WhoFrameButton"..i.."Class"]
local variableText = _G["WhoFrameButton"..i.."Variable"]
local _, guild, level, race, class, zone = GetWhoInfo(index)
if class == UNKNOWN then return end
if class then
class = strupper(class)
end
local classTextColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
local levelTextColor = GetQuestDifficultyColor(level)
if class then
button.icon:Show()
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[class]))
nameText:SetTextColor(classTextColor.r, classTextColor.g, classTextColor.b)
levelText:SetTextColor(levelTextColor.r, levelTextColor.g, levelTextColor.b)
if zone == playerZone then
zone = "|cff00ff00"..zone
end
if guild == playerGuild then
guild = "|cff00ff00"..guild
end
if race == playerRace then
race = "|cff00ff00"..race
end
local columnTable = {zone, guild, race}
variableText:SetText(columnTable[UIDropDownMenu_GetSelectedID(WhoFrameDropDown)])
else
button.icon:Hide()
end
end
end)
-- Guild Frame
GuildFrameColumnHeader3:ClearAllPoints()
GuildFrameColumnHeader3:SetPoint("TOPLEFT", 20, -70)
GuildFrameColumnHeader4:ClearAllPoints()
GuildFrameColumnHeader4:SetPoint("LEFT", GuildFrameColumnHeader3, "RIGHT", -2, -0)
GuildFrameColumnHeader4:SetWidth(48)
GuildFrameColumnHeader1:ClearAllPoints()
GuildFrameColumnHeader1:SetPoint("LEFT", GuildFrameColumnHeader4, "RIGHT", -2, -0)
GuildFrameColumnHeader1:SetWidth(105)
GuildFrameColumnHeader2:ClearAllPoints()
GuildFrameColumnHeader2:SetPoint("LEFT", GuildFrameColumnHeader1, "RIGHT", -2, -0)
GuildFrameColumnHeader2:SetWidth(127)
for i = 1, GUILDMEMBERS_TO_DISPLAY do
local button = _G["GuildFrameButton"..i]
StyleButton(button)
StyleButton(_G["GuildFrameGuildStatusButton"..i])
button.icon = button:CreateTexture("$parentIcon", "ARTWORK")
button.icon:SetPoint("LEFT", 48, -3)
button.icon:SetWidth(15)
button.icon:SetHeight(15)
button.icon:SetTexture("Interface\\AddOns\\ElvUI\\Media\\Textures\\Icons-Classes")
E:CreateBackdrop(button, "Default", true)
button.backdrop:SetAllPoints(button.icon)
_G["GuildFrameButton"..i.."Level"]:ClearAllPoints()
_G["GuildFrameButton"..i.."Level"]:SetPoint("TOPLEFT", 10, -3)
_G["GuildFrameButton"..i.."Name"]:SetWidth(100)
_G["GuildFrameButton"..i.."Name"]:SetHeight(14)
_G["GuildFrameButton"..i.."Name"]:ClearAllPoints()
_G["GuildFrameButton"..i.."Name"]:SetPoint("LEFT", 85, -3)
_G["GuildFrameButton"..i.."Class"]:Hide()
end
hooksecurefunc("GuildStatus_Update", function()
if FriendsFrame.playerStatusFrame then
for i = 1, GUILDMEMBERS_TO_DISPLAY, 1 do
local button = _G["GuildFrameButton"..i]
local _, _, _, level, class, _, _, _, online = GetGuildRosterInfo(button.guildIndex)
if class == UNKNOWN then return end
if class then
class = upper(class)
end
if class then
if online then
classTextColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
levelTextColor = GetQuestDifficultyColor(level)
buttonText = _G["GuildFrameButton"..i.."Name"]
buttonText:SetTextColor(classTextColor.r, classTextColor.g, classTextColor.b)
buttonText = _G["GuildFrameButton"..i.."Level"]
buttonText:SetTextColor(levelTextColor.r, levelTextColor.g, levelTextColor.b)
end
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[class]))
end
end
else
local classFileName
for i = 1, GUILDMEMBERS_TO_DISPLAY, 1 do
button = _G["GuildFrameGuildStatusButton"..i]
_, _, _, _, class, _, _, _, online = GetGuildRosterInfo(button.guildIndex)
if class == UNKNOWN then return end
if class then
class = upper(class)
end
if class then
if online then
classTextColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
_G["GuildFrameGuildStatusButton"..i.."Name"]:SetTextColor(classTextColor.r, classTextColor.g, classTextColor.b)
_G["GuildFrameGuildStatusButton"..i.."Online"]:SetTextColor(1.0, 1.0, 1.0)
end
end
end
end
end)
E:StripTextures(GuildFrameLFGFrame)
E:SetTemplate(GuildFrameLFGFrame, "Transparent")
S:HandleCheckBox(GuildFrameLFGButton)
for i = 1, 4 do
E:StripTextures(_G["GuildFrameColumnHeader"..i])
E:StyleButton(_G["GuildFrameColumnHeader"..i], nil, true)
E:StripTextures(_G["GuildFrameGuildStatusColumnHeader"..i])
E:StyleButton(_G["GuildFrameGuildStatusColumnHeader"..i], nil, true)
end
E:StripTextures(GuildListScrollFrame)
S:HandleScrollBar(GuildListScrollFrameScrollBar)
S:HandleNextPrevButton(GuildFrameGuildListToggleButton)
S:HandleButton(GuildFrameGuildInformationButton)
S:HandleButton(GuildFrameAddMemberButton)
S:HandleButton(GuildFrameControlButton)
-- Member Detail Frame
E:StripTextures(GuildMemberDetailFrame)
E:CreateBackdrop(GuildMemberDetailFrame, "Transparent")
GuildMemberDetailFrame:SetPoint("TOPLEFT", GuildFrame, "TOPRIGHT", -31, -13)
S:HandleCloseButton(GuildMemberDetailCloseButton)
GuildMemberDetailCloseButton:SetPoint("TOPRIGHT", 2, 2)
S:HandleButton(GuildFrameControlButton)
S:HandleButton(GuildMemberRemoveButton)
GuildMemberRemoveButton:SetPoint("BOTTOMLEFT", 8, 7)
S:HandleButton(GuildMemberGroupInviteButton)
GuildMemberGroupInviteButton:SetPoint("LEFT", GuildMemberRemoveButton, "RIGHT", 3, 0)
S:HandleNextPrevButton(GuildFramePromoteButton, true)
S:HandleNextPrevButton(GuildFrameDemoteButton, true)
GuildFrameDemoteButton:SetPoint("LEFT", GuildFramePromoteButton, "RIGHT", 2, 0)
E:SetTemplate(GuildMemberNoteBackground, "Default")
E:SetTemplate(GuildMemberOfficerNoteBackground, "Default")
-- Info Frame
E:StripTextures(GuildInfoFrame)
E:CreateBackdrop(GuildInfoFrame, "Transparent")
GuildInfoFrame.backdrop:SetPoint("TOPLEFT", 3, -6)
GuildInfoFrame.backdrop:SetPoint("BOTTOMRIGHT", -2, 3)
E:SetTemplate(GuildInfoTextBackground, "Default")
S:HandleScrollBar(GuildInfoFrameScrollFrameScrollBar)
S:HandleCloseButton(GuildInfoCloseButton)
S:HandleButton(GuildInfoSaveButton)
GuildInfoSaveButton:SetPoint("BOTTOMLEFT", 8, 11)
S:HandleButton(GuildInfoCancelButton)
GuildInfoCancelButton:SetPoint("LEFT", GuildInfoSaveButton, "RIGHT", 3, 0)
-- Control Frame
E:StripTextures(GuildControlPopupFrame)
E:CreateBackdrop(GuildControlPopupFrame, "Transparent")
GuildControlPopupFrame.backdrop:SetPoint("TOPLEFT", 3, -6)
GuildControlPopupFrame.backdrop:SetPoint("BOTTOMRIGHT", -27, 27)
S:HandleDropDownBox(GuildControlPopupFrameDropDown, 185)
GuildControlPopupFrameDropDownButton:SetWidth(16)
GuildControlPopupFrameDropDownButton:SetHeight(16)
local function SkinPlusMinus(f, minus)
f:SetNormalTexture("")
f.SetNormalTexture = E.noop
f:SetPushedTexture("")
f.SetPushedTexture = E.noop
f:SetHighlightTexture("")
f.SetHighlightTexture = E.noop
f:SetDisabledTexture("")
f.SetDisabledTexture = E.noop
f.Text = f:CreateFontString(nil, "OVERLAY")
E:FontTemplate(f.Text, nil, 22)
f.Text:SetPoint("LEFT", 5, 0)
if minus then
f.Text:SetText("-")
else
f.Text:SetText("+")
end
end
GuildControlPopupFrameAddRankButton:SetPoint("LEFT", GuildControlPopupFrameDropDown, "RIGHT", -8, 3)
SkinPlusMinus(GuildControlPopupFrameAddRankButton)
SkinPlusMinus(GuildControlPopupFrameRemoveRankButton, true)
S:HandleEditBox(GuildControlPopupFrameEditBox)
GuildControlPopupFrameEditBox.backdrop:SetPoint("TOPLEFT", 0, -5)
GuildControlPopupFrameEditBox.backdrop:SetPoint("BOTTOMRIGHT", 0, 5)
for i = 1, 17 do
local Checkbox = _G["GuildControlPopupFrameCheckbox"..i]
if Checkbox then
S:HandleCheckBox(Checkbox)
end
end
S:HandleButton(GuildControlPopupAcceptButton)
S:HandleButton(GuildControlPopupFrameCancelButton)
-- Raid Frame
S:HandleButton(RaidFrameConvertToRaidButton)
S:HandleButton(RaidFrameRaidInfoButton)
-- Raid Info Frame
E:StripTextures(RaidInfoFrame, true)
E:SetTemplate(RaidInfoFrame, "Transparent")
HookScript(RaidInfoFrame, "OnShow", function()
if GetNumRaidMembers() > 0 then
RaidInfoFrame:SetPoint("TOPLEFT", RaidFrame, "TOPRIGHT", -14, -12)
else
RaidInfoFrame:SetPoint("TOPLEFT", RaidFrame, "TOPRIGHT", -34, -12)
end
end)
S:HandleCloseButton(RaidInfoCloseButton, RaidInfoFrame)
E:StripTextures(RaidInfoScrollFrame)
S:HandleScrollBar(RaidInfoScrollFrameScrollBar)
end
S:AddCallback("Friends", LoadSkin)
+58
View File
@@ -0,0 +1,58 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.gossip ~= true then return end
-- ItemTextFrame
E:StripTextures(ItemTextFrame, true)
E:StripTextures(ItemTextScrollFrame)
S:HandleScrollBar(ItemTextScrollFrameScrollBar)
E:CreateBackdrop(ItemTextFrame, "Transparent")
ItemTextFrame.backdrop:SetPoint("TOPLEFT", 13, -13)
ItemTextFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 74)
S:HandleNextPrevButton(ItemTextPrevPageButton)
S:HandleNextPrevButton(ItemTextNextPageButton)
ItemTextPrevPageButton:ClearAllPoints()
ItemTextNextPageButton:ClearAllPoints()
ItemTextPrevPageButton:SetPoint("TOPLEFT", ItemTextFrame, "TOPLEFT", 30, -50)
ItemTextNextPageButton:SetPoint("TOPRIGHT", ItemTextFrame, "TOPRIGHT", -48, -50)
S:HandleCloseButton(ItemTextCloseButton)
ItemTextPageText:SetTextColor(1, 1, 1)
ItemTextPageText.SetTextColor = E.noop
-- GossipFrame
E:StripTextures(GossipFrameGreetingPanel)
S:HandleScrollBar(GossipGreetingScrollFrameScrollBar, 5)
E:Kill(GossipFramePortrait)
E:CreateBackdrop(GossipFrame, "Transparent")
GossipFrame.backdrop:SetPoint("TOPLEFT", 15, -19)
GossipFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 67)
S:HandleButton(GossipFrameGreetingGoodbyeButton)
GossipFrameGreetingGoodbyeButton:SetPoint("BOTTOMRIGHT", GossipFrame, -34, 71)
S:HandleCloseButton(GossipFrameCloseButton)
GossipGreetingText:SetTextColor(1, 1, 1)
for i = 1, NUMGOSSIPBUTTONS do
local button = _G["GossipTitleButton"..i]
button:SetTextColor(1, 1, 1)
end
end
S:AddCallback("Gossip", LoadSkin)
+30
View File
@@ -0,0 +1,30 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.greeting ~= true then return end
E:StripTextures(QuestFrameGreetingPanel)
E:Kill(QuestGreetingFrameHorizontalBreak)
S:HandleScrollBar(QuestGreetingScrollFrameScrollBar)
S:HandleButton(QuestFrameGreetingGoodbyeButton, true)
GreetingText:SetTextColor(1, 1, 1)
CurrentQuestsText:SetTextColor(1, 1, 0)
AvailableQuestsText:SetTextColor(1, 1, 0)
for i = 1, MAX_NUM_QUESTS do
local button = _G["QuestTitleButton"..i]
button:SetTextColor(1, 1, 0)
end
end
S:AddCallback("Greeting", LoadSkin)
@@ -0,0 +1,35 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.guildregistrar ~= true then return end
E:StripTextures(GuildRegistrarFrame, true)
E:CreateBackdrop(GuildRegistrarFrame, "Transparent")
GuildRegistrarFrame.backdrop:SetPoint("TOPLEFT", 12, -17)
GuildRegistrarFrame.backdrop:SetPoint("BOTTOMRIGHT", -28, 65)
E:StripTextures(GuildRegistrarGreetingFrame)
S:HandleButton(GuildRegistrarFrameGoodbyeButton)
S:HandleButton(GuildRegistrarFrameCancelButton)
S:HandleButton(GuildRegistrarFramePurchaseButton)
S:HandleCloseButton(GuildRegistrarFrameCloseButton)
S:HandleEditBox(GuildRegistrarFrameEditBox)
GuildRegistrarFrameEditBox:DisableDrawLayer("BACKGROUND")
GuildRegistrarFrameEditBox:SetHeight(20)
for i = 1, 2 do
_G["GuildRegistrarButton"..i]:GetFontString():SetTextColor(1, 1, 1)
end
GuildRegistrarPurchaseText:SetTextColor(1, 1, 1)
AvailableServicesText:SetTextColor(1, 1, 0)
end
S:AddCallback("GuildRegistrar", LoadSkin)
+72
View File
@@ -0,0 +1,72 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local getn = table.getn
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.help ~= true then return end
local helpFrameButtons = {
"GeneralBack",
"GeneralButton",
"GeneralButton2",
"GeneralCancel",
"GMBack",
"GMCancel",
"HarassmentBack",
"HarassmentCancel",
"HomeIssues",
"HomeCancel",
"OpenTicketSubmit",
"OpenTicketCancel",
"PhysicalHarassmentButton",
"VerbalHarassmentButton",
}
E:StripTextures(HelpFrame)
E:CreateBackdrop(HelpFrame, "Transparent")
HelpFrame.backdrop:SetPoint("TOPLEFT", 6, -2)
HelpFrame.backdrop:SetPoint("BOTTOMRIGHT", -45, 14)
S:HandleCloseButton(HelpFrameCloseButton)
HelpFrameCloseButton:SetPoint("TOPRIGHT", -42, 0)
for i = 1, getn(helpFrameButtons) do
local helpButton = _G["HelpFrame"..helpFrameButtons[i]]
S:HandleButton(helpButton)
end
-- hide header textures and move text/buttons.
local BlizzardHeader = {
"KnowledgeBaseFrame"
}
for i = 1, getn(BlizzardHeader) do
local title = _G[BlizzardHeader[i].."Header"]
if title then
title:SetTexture("")
title:ClearAllPoints()
if title == _G["GameMenuFrameHeader"] then
title:SetPoint("TOP", GameMenuFrame, 0, 0)
else
title:SetPoint("TOP", BlizzardHeader[i], -22, -8)
end
end
end
E:StripTextures(HelpFrameOpenTicketDivider)
S:HandleScrollBar(HelpFrameOpenTicketScrollFrame)
S:HandleScrollBar(HelpFrameOpenTicketScrollFrameScrollBar)
HelpFrameOpenTicketSubmit:SetPoint("RIGHT", HelpFrameOpenTicketCancel, "LEFT", -2, 0)
E:Kill(HelpFrameHarassmentDivider)
E:Kill(HelpFrameHarassmentDivider2)
end
S:AddCallback("Help", LoadSkin)
+99
View File
@@ -0,0 +1,99 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local pairs = pairs
local find, match, split = string.find, string.match, string.split
--WoW API / Variables
local GetInventoryItemLink = GetInventoryItemLink
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if not E.private.skins.blizzard.enable or not E.private.skins.blizzard.inspect then return end
E:StripTextures(InspectFrame, true)
E:CreateBackdrop(InspectFrame, "Transparent")
InspectFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
InspectFrame.backdrop:SetPoint("BOTTOMRIGHT", -31, 75)
S:HandleCloseButton(InspectFrameCloseButton)
for i = 1, 2 do
S:HandleTab(_G["InspectFrameTab"..i])
end
E:StripTextures(InspectPaperDollFrame)
local slots = {
"HeadSlot",
"NeckSlot",
"ShoulderSlot",
"BackSlot",
"ChestSlot",
"ShirtSlot",
"TabardSlot",
"WristSlot",
"HandsSlot",
"WaistSlot",
"LegsSlot",
"FeetSlot",
"Finger0Slot",
"Finger1Slot",
"Trinket0Slot",
"Trinket1Slot",
"MainHandSlot",
"SecondaryHandSlot",
"RangedSlot"
}
for _, slot in pairs(slots) do
local icon = _G["Inspect"..slot.."IconTexture"]
local slot = _G["Inspect"..slot]
E:StripTextures(slot)
E:StyleButton(slot, false)
E:SetTemplate(slot, "Default", true)
icon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(icon)
end
hooksecurefunc("InspectPaperDollItemSlotButton_Update", function(button)
if button.hasItem then
local itemLink = GetInventoryItemLink(InspectFrame.unit, button:GetID())
if itemLink then
local _, _, quality = GetItemInfo(match(itemLink, "item:(%d+)"))
if not quality then
E:Delay(0.1, function()
if InspectFrame.unit then
InspectPaperDollItemSlotButton_Update(button)
end
end)
return
elseif quality then
button:SetBackdropBorderColor(GetItemQualityColor(quality))
return
end
end
end
button:SetBackdropBorderColor(unpack(E.media.bordercolor))
end)
S:HandleRotateButton(InspectModelRotateLeftButton)
InspectModelRotateLeftButton:SetPoint("TOPLEFT", 3, -3)
S:HandleRotateButton(InspectModelRotateRightButton)
InspectModelRotateRightButton:SetPoint("TOPLEFT", InspectModelRotateLeftButton, "TOPRIGHT", 3, 0)
E:StripTextures(InspectHonorFrame)
InspectHonorFrameProgressBar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(InspectHonorFrameProgressBar)
end
S:AddCallbackForAddon("Blizzard_InspectUI", "Inspect", LoadSkin)
@@ -0,0 +1,38 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="AuctionHouse.lua"/>
<Script file="Battlefield.lua"/>
<Script file="Bags.lua"/>
<Script file="BGScore.lua"/>
<Script file="Binding.lua"/>
<Script file="Character.lua"/>
<Script file="Craft.lua"/>
<Script file="Debug.lua"/>
<Script file="DressingRoom.lua"/>
<Script file="Friends.lua"/>
<Script file="Gossip.lua"/>
<Script file="Greeting.lua"/>
<Script file="GuildRegistrar.lua"/>
<Script file="Help.lua"/>
<Script file="Inspect.lua"/>
<Script file="Loot.lua"/>
<Script file="Macro.lua"/>
<Script file="Mail.lua"/>
<Script file="Merchant.lua"/>
<Script file="MirrorTimers.lua"/>
<Script file="Misc.lua"/>
<Script file="Petition.lua"/>
<Script file="Quest.lua"/>
<Script file="QuestTimers.lua"/>
<Script file="Raid.lua"/>
<Script file="SpellBook.lua"/>
<Script file="Stable.lua"/>
<Script file="Tabard.lua"/>
<Script file="Talent.lua"/>
<Script file="Taxi.lua"/>
<Script file="Tooltip.lua"/>
<Script file="Trade.lua"/>
<Script file="TradeSkill.lua"/>
<Script file="Trainer.lua"/>
<Script file="Tutorial.lua"/>
<Script file="WorldMap.lua"/>
</Ui>
+142
View File
@@ -0,0 +1,142 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local match = string.match
--WoW API / Variables
local UnitName = UnitName
local IsFishingLoot = IsFishingLoot
local GetLootRollItemInfo = GetLootRollItemInfo
local GetItemQualityColor = GetItemQualityColor
local LOOTFRAME_NUMBUTTONS = LOOTFRAME_NUMBUTTONS
local NUM_GROUP_LOOT_FRAMES = NUM_GROUP_LOOT_FRAMES
local LOOT = LOOT
local function LoadSkin()
if E.private.general.loot then return end
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.loot ~= true then return end
E:StripTextures(LootFrame)
E:CreateBackdrop(LootFrame, "Transparent")
LootFrame.backdrop:SetPoint("TOPLEFT", 13, -14)
LootFrame.backdrop:SetPoint("BOTTOMRIGHT", -68, 5)
LootFramePortraitOverlay:SetParent(E.HiddenFrame)
S:HandleCloseButton(LootCloseButton)
--[[for i = 1, LootFrame:GetNumRegions() do
local region = select(i, LootFrame:GetRegions())
if region:GetObjectType() == "FontString" then
if region:GetText() == ITEMS then
LootFrame.Title = region
end
end
end]]
--[[LootFrame.Title:ClearAllPoints()
LootFrame.Title:SetPoint("TOPLEFT", LootFrame.backdrop, "TOPLEFT", 4, -4)
LootFrame.Title:SetJustifyH("LEFT")]]
S:HandleNextPrevButton(LootFrameDownButton)
S:HandleNextPrevButton(LootFrameUpButton)
S:SquareButton_SetIcon(LootFrameUpButton, "UP")
S:SquareButton_SetIcon(LootFrameDownButton, "DOWN")
LootFrameDownButton:ClearAllPoints()
LootFrameDownButton:SetPoint("RIGHT", LootFrameNext, "RIGHT", 32, 0)
LootFramePrev:SetPoint("BOTTOMLEFT", 57, 22)
hooksecurefunc("LootFrame_Update", function()
local numLootItems = LootFrame.numLootItems
local numLootToShow = LOOTFRAME_NUMBUTTONS
if numLootItems > LOOTFRAME_NUMBUTTONS then
numLootToShow = numLootToShow - 1
end
for i = 1, LOOTFRAME_NUMBUTTONS do
local slot = (((LootFrame.page - 1) * numLootToShow) + i)
local lootButton = _G["LootButton"..i]
local lootButtonIcon = _G["LootButton"..i.."IconTexture"]
S:HandleItemButton(lootButton, true)
if slot <= numLootItems then
local itemLink = GetLootSlotLink(slot)
if itemLink then
local _, _, quality = GetItemInfo(match(itemLink, "item:(%d+)"))
if quality then
lootButton.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
else
lootButton.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
else
lootButton.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
end)
--[[HookScript(LootFrame, "OnShow", function()
if IsFishingLoot() then
this.Title:SetText(L["Fishy Loot"])
elseif not UnitIsFriend("player", "target") and UnitIsDead("target") then
this.Title:SetText(UnitName("target"))
else
this.Title:SetText(LOOT)
end
end)--]]
end
local function LoadRollSkin()
if E.private.general.lootRoll then return end
if not E.private.skins.blizzard.enable or not E.private.skins.blizzard.lootRoll then return end
local function OnShow(self)
E:SetTemplate(self, "Transparent")
local cornerTexture = _G[self:GetName().."Corner"]
cornerTexture:SetTexture()
local iconFrame = _G[self:GetName().."IconFrame"]
local _, _, _, quality = GetLootRollItemInfo(self.rollID)
iconFrame:SetBackdropBorderColor(GetItemQualityColor(quality))
end
for i = 1, NUM_GROUP_LOOT_FRAMES do
local frame = _G["GroupLootFrame"..i]
frame:SetParent(UIParent)
E:StripTextures(frame)
local frameName = frame:GetName()
local iconFrame = _G[frameName.."IconFrame"]
E:SetTemplate(iconFrame, "Default")
local icon = _G[frameName.."IconFrameIcon"]
E:SetInside(icon)
icon:SetTexCoord(unpack(E.TexCoords))
local statusBar = _G[frameName.."Timer"]
E:StripTextures(statusBar)
E:CreateBackdrop(statusBar, "Default")
statusBar:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(statusBar)
local decoration = _G[frameName.."Decoration"]
decoration:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Gold-Dragon")
decoration:SetWidth(130)
decoration:SetHeight(130)
decoration:SetPoint("TOPLEFT", -37, 20)
local pass = _G[frameName.."PassButton"]
S:HandleCloseButton(pass, frame)
HookScript(_G["GroupLootFrame"..i], "OnShow", OnShow)
end
end
S:AddCallback("Loot", LoadSkin)
S:AddCallback("LootRoll", LoadRollSkin)
+100
View File
@@ -0,0 +1,100 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local getn = table.getn
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.macro ~= true then return end
E:StripTextures(MacroFrame)
E:CreateBackdrop(MacroFrame, "Transparent")
MacroFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
MacroFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 71)
MacroFrame.bg = CreateFrame("Frame", nil, MacroFrame)
E:SetTemplate(MacroFrame.bg, "Transparent", true)
MacroFrame.bg:SetPoint("TOPLEFT", MacroButton1, -10, 10)
MacroFrame.bg:SetPoint("BOTTOMRIGHT", MacroButton18, 10, -10)
E:StripTextures(MacroFrameTextBackground)
E:CreateBackdrop(MacroFrameTextBackground, "Default")
MacroFrameTextBackground.backdrop:SetPoint("TOPLEFT", 6, -3)
MacroFrameTextBackground.backdrop:SetPoint("BOTTOMRIGHT", -2, 3)
local Buttons = {
"MacroFrameTab1",
"MacroFrameTab2",
"MacroDeleteButton",
"MacroNewButton",
"MacroExitButton",
"MacroEditButton",
"MacroPopupOkayButton",
"MacroPopupCancelButton"
}
for i = 1, getn(Buttons) do
E:StripTextures(_G[Buttons[i]])
S:HandleButton(_G[Buttons[i]])
end
for i = 1, 2 do
local tab = _G["MacroFrameTab"..i]
tab:SetHeight(22)
end
MacroFrameTab1:SetPoint("TOPLEFT", MacroFrame, "TOPLEFT", 85, -39)
MacroFrameTab2:SetPoint("LEFT", MacroFrameTab1, "RIGHT", 4, 0)
S:HandleCloseButton(MacroFrameCloseButton)
S:HandleScrollBar(MacroFrameScrollFrameScrollBar)
S:HandleScrollBar(MacroPopupScrollFrameScrollBar)
MacroEditButton:ClearAllPoints()
MacroEditButton:SetPoint("BOTTOMLEFT", MacroFrameSelectedMacroButton, "BOTTOMRIGHT", 10, 0)
MacroFrameSelectedMacroName:SetPoint("TOPLEFT", MacroFrameSelectedMacroBackground, "TOPRIGHT", -4, -10)
E:StripTextures(MacroFrameSelectedMacroButton)
E:SetTemplate(MacroFrameSelectedMacroButton, "Transparent")
E:StyleButton(MacroFrameSelectedMacroButton, true)
MacroFrameSelectedMacroButton:GetNormalTexture():SetTexture(nil)
MacroFrameSelectedMacroButtonIcon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(MacroFrameSelectedMacroButtonIcon)
MacroFrameCharLimitText:ClearAllPoints()
MacroFrameCharLimitText:SetPoint("BOTTOM", MacroFrameTextBackground, 0, -9)
for i = 1, MAX_MACROS do
local Button = _G["MacroButton"..i]
local ButtonIcon = _G["MacroButton"..i.."Icon"]
if Button then
E:StripTextures(Button)
E:SetTemplate(Button, "Default", true)
E:StyleButton(Button, nil, true)
end
if ButtonIcon then
ButtonIcon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(ButtonIcon)
end
end
S:HandleIconSelectionFrame(MacroPopupFrame, NUM_MACRO_ICONS_SHOWN, "MacroPopupButton", "MacroPopup")
E:CreateBackdrop(MacroPopupScrollFrame, "Transparent")
MacroPopupScrollFrame.backdrop:SetPoint("TOPLEFT", 51, 2)
MacroPopupScrollFrame.backdrop:SetPoint("BOTTOMRIGHT", 0, 4)
MacroPopupFrame:SetPoint("TOPLEFT", MacroFrame, "TOPRIGHT", -41, 1)
end
S:AddCallbackForAddon("Blizzard_MacroUI", "Macro", LoadSkin)
+229
View File
@@ -0,0 +1,229 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
--WoW API / Variables
local GetInboxItem = GetInboxItem
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local GetSendMailItem = GetSendMailItem
local hooksecurefunc = hooksecurefunc
local INBOXITEMS_TO_DISPLAY = INBOXITEMS_TO_DISPLAY
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.mail ~= true then return end
-- Inbox Frame
E:StripTextures(MailFrame, true)
E:CreateBackdrop(MailFrame, "Transparent")
MailFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
MailFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 74)
for i = 1, INBOXITEMS_TO_DISPLAY do
local mail = _G["MailItem"..i]
local button = _G["MailItem"..i.."Button"]
local icon = _G["MailItem"..i.."ButtonIcon"]
E:StripTextures(mail)
E:CreateBackdrop(mail, "Default")
mail.backdrop:SetPoint("TOPLEFT", 2, 1)
mail.backdrop:SetPoint("BOTTOMRIGHT", -2, 2)
E:StripTextures(button)
E:SetTemplate(button, "Default", true)
E:StyleButton(button)
icon:SetTexCoord(unpack(E.TexCoords))
E:SetInside(icon)
end
hooksecurefunc("InboxFrame_Update", function()
local numItems = GetInboxNumItems()
local index = ((InboxFrame.pageNum - 1) * INBOXITEMS_TO_DISPLAY) + 1
for i = 1, INBOXITEMS_TO_DISPLAY do
if index <= numItems then
local packageIcon, _, _, _, _, _, _, _, _, _, _, _, isGM = GetInboxHeaderInfo(index)
local button = _G["MailItem"..i.."Button"]
button:SetBackdropBorderColor(unpack(E["media"].bordercolor))
if packageIcon and not isGM then
local itemName = GetInboxItem(index)
if itemName then
local _, itemString = GetItemInfoByName(itemName)
local _, _, quality = GetItemInfo(itemString, "item:(%d+)")
if quality then
button:SetBackdropBorderColor(GetItemQualityColor(quality))
else
button:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
elseif isGM then
button:SetBackdropBorderColor(0, 0.56, 0.94)
end
end
index = index + 1
end
end)
S:HandleNextPrevButton(InboxPrevPageButton)
S:HandleNextPrevButton(InboxNextPageButton)
S:HandleCloseButton(InboxCloseButton)
for i = 1, 2 do
local tab = _G["MailFrameTab"..i]
E:StripTextures(tab)
S:HandleTab(tab)
end
-- Send Mail Frame
E:StripTextures(SendMailFrame)
E:StripTextures(SendMailScrollFrame, true)
E:SetTemplate(SendMailScrollFrame, "Default")
hooksecurefunc("SendMailFrame_Update", function()
if not SendMailPackageButton.skinned then
E:StripTextures(SendMailPackageButton)
E:SetTemplate(SendMailPackageButton, "Default", true)
E:StyleButton(SendMailPackageButton, nil, true)
SendMailPackageButton.skinned = true
end
local itemName = GetSendMailItem()
if itemName then
local _, _, _, quality = GetSendMailItem()
if quality then
SendMailPackageButton:SetBackdropBorderColor(GetItemQualityColor(quality))
else
SendMailPackageButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
SendMailPackageButton:GetNormalTexture():SetTexCoord(unpack(E.TexCoords))
E:SetInside(SendMailPackageButton:GetNormalTexture())
else
SendMailPackageButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end)
SendMailBodyEditBox:SetTextColor(1, 1, 1)
S:HandleScrollBar(SendMailScrollFrameScrollBar)
S:HandleEditBox(SendMailNameEditBox)
SendMailNameEditBox.backdrop:SetPoint("BOTTOMRIGHT", 2, 0)
SendMailNameEditBox:SetPoint("TOPLEFT", 79, -46)
S:HandleEditBox(SendMailSubjectEditBox)
SendMailSubjectEditBox.backdrop:SetPoint("BOTTOMRIGHT", 2, 0)
S:HandleEditBox(SendMailMoneyGold)
S:HandleEditBox(SendMailMoneySilver)
S:HandleEditBox(SendMailMoneyCopper)
S:HandleButton(SendMailMailButton)
SendMailMailButton:SetPoint("RIGHT", SendMailCancelButton, "LEFT", -2, 0)
S:HandleButton(SendMailCancelButton)
SendMailCancelButton:SetPoint("BOTTOMRIGHT", -45, 80)
SendMailMoneyFrame:SetPoint("BOTTOMLEFT", 170, 84)
-- Open Mail Frame
E:StripTextures(OpenMailFrame, true)
E:CreateBackdrop(OpenMailFrame, "Transparent")
OpenMailFrame.backdrop:SetPoint("TOPLEFT", 12, -12)
OpenMailFrame.backdrop:SetPoint("BOTTOMRIGHT", -34, 74)
E:StripTextures(OpenMailPackageButton)
E:StyleButton(OpenMailPackageButton)
E:SetTemplate(OpenMailPackageButton, "Default", true)
for _, region in ipairs({OpenMailPackageButton:GetRegions()}) do
if region:GetObjectType() == "Texture" then
region:SetTexCoord(unpack(E.TexCoords))
E:SetInside(region)
end
end
--[[for i = 1, OpenMailPackageButton:GetNumRegions() do
local region = select(i, OpenMailPackageButton:GetRegions())
if region:GetObjectType() == "Texture" then
region:SetTexCoord(unpack(E.TexCoords))
E:SetInside(region)
end
end]]
hooksecurefunc("OpenMail_Update", function()
local index = InboxFrame.openMailID
if not index then return end
local _, stationeryIcon, _, _, _, _, _, hasItem = GetInboxHeaderInfo(index)
if hasItem then
local itemName = GetInboxItem(index)
if itemName then
local _, itemString = GetItemInfoByName(itemName)
local _, _, quality = GetItemInfo(itemString, "item:(%d+)")
if quality then
OpenMailPackageButton:SetBackdropBorderColor(GetItemQualityColor(quality))
else
OpenMailPackageButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
OpenMailPackageButton:GetNormalTexture():SetTexCoord(unpack(E.TexCoords))
E:SetInside(OpenMailPackageButton:GetNormalTexture())
else
OpenMailPackageButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end)
S:HandleCloseButton(OpenMailCloseButton)
S:HandleButton(OpenMailReplyButton)
OpenMailReplyButton:SetPoint("RIGHT", OpenMailDeleteButton, "LEFT", -2, 0)
S:HandleButton(OpenMailDeleteButton)
OpenMailDeleteButton:SetPoint("RIGHT", OpenMailCancelButton, "LEFT", -2, 0)
S:HandleButton(OpenMailCancelButton)
E:StripTextures(OpenMailScrollFrame, true)
E:SetTemplate(OpenMailScrollFrame, "Default")
S:HandleScrollBar(OpenMailScrollFrameScrollBar)
OpenMailBodyText:SetTextColor(1, 1, 1)
InvoiceTextFontNormal:SetTextColor(1, 1, 1)
OpenMailInvoiceBuyMode:SetTextColor(1, 0.80, 0.10)
E:Kill(OpenMailArithmeticLine)
E:StripTextures(OpenMailLetterButton)
E:SetTemplate(OpenMailLetterButton, "Default", true)
E:StyleButton(OpenMailLetterButton)
OpenMailLetterButtonIconTexture:SetTexCoord(unpack(E.TexCoords))
OpenMailLetterButtonIconTexture:SetDrawLayer("ARTWORK")
E:SetInside(OpenMailLetterButtonIconTexture)
OpenMailLetterButtonCount:SetDrawLayer("OVERLAY")
E:StripTextures(OpenMailMoneyButton)
E:SetTemplate(OpenMailMoneyButton, "Default", true)
E:StyleButton(OpenMailMoneyButton)
OpenMailMoneyButtonIconTexture:SetTexCoord(unpack(E.TexCoords))
OpenMailMoneyButtonIconTexture:SetDrawLayer("ARTWORK")
E:SetInside(OpenMailMoneyButtonIconTexture)
OpenMailMoneyButtonCount:SetDrawLayer("OVERLAY")
end
S:AddCallback("Mail", LoadSkin)
+151
View File
@@ -0,0 +1,151 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local match, split = string.match, string.split
--WoW API / Variables
local GetBuybackItemInfo = GetBuybackItemInfo
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local GetMerchantItemLink = GetMerchantItemLink
local GetItemLinkByName = GetItemLinkByName
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.merchant ~= true then return end
E:StripTextures(MerchantFrame, true)
E:CreateBackdrop(MerchantFrame, "Transparent")
MerchantFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
MerchantFrame.backdrop:SetPoint("BOTTOMRIGHT", -28, 60)
S:HandleCloseButton(MerchantFrameCloseButton, MerchantFrame.backdrop)
for i = 1, 12 do
local item = _G["MerchantItem"..i]
local itemButton = _G["MerchantItem"..i.."ItemButton"]
local iconTexture = _G["MerchantItem"..i.."ItemButtonIconTexture"]
local altCurrencyTex1 = _G["MerchantItem"..i.."AltCurrencyFrameItem1Texture"]
local altCurrencyTex2 = _G["MerchantItem"..i.."AltCurrencyFrameItem2Texture"]
E:StripTextures(item, true)
E:CreateBackdrop(item, "Default")
E:StripTextures(itemButton)
E:StyleButton(itemButton)
E:SetTemplate(itemButton, "Default", true)
itemButton:SetPoint("TOPLEFT", item, "TOPLEFT", 4, -4)
iconTexture:SetTexCoord(unpack(E.TexCoords))
E:SetInside(iconTexture)
_G["MerchantItem"..i.."MoneyFrame"]:ClearAllPoints()
_G["MerchantItem"..i.."MoneyFrame"]:SetPoint("BOTTOMLEFT", itemButton, "BOTTOMRIGHT", 3, 0)
end
S:HandleNextPrevButton(MerchantNextPageButton)
S:HandleNextPrevButton(MerchantPrevPageButton)
E:StyleButton(MerchantRepairItemButton)
E:SetTemplate(MerchantRepairItemButton, "Default", true)
for _, region in ipairs({MerchantRepairItemButton:GetRegions()}) do
if region:GetObjectType() == "Texture" then
region:SetTexCoord(0.04, 0.24, 0.06, 0.5)
E:SetInside(region)
end
end
--[[for i = 1, MerchantRepairItemButton:GetNumRegions() do
local region = select(i, MerchantRepairItemButton:GetRegions())
if region:GetObjectType() == "Texture" then
region:SetTexCoord(0.04, 0.24, 0.06, 0.5)
E:SetInside(region)
end
end--]]
E:StyleButton(MerchantRepairAllButton)
E:SetTemplate(MerchantRepairAllButton, "Default", true)
MerchantRepairAllIcon:SetTexCoord(0.34, 0.1, 0.34, 0.535, 0.535, 0.1, 0.535, 0.535)
E:SetInside(MerchantRepairAllIcon)
E:StripTextures(MerchantBuyBackItem, true)
E:CreateBackdrop(MerchantBuyBackItem, "Transparent")
MerchantBuyBackItem.backdrop:SetPoint("TOPLEFT", -6, 6)
MerchantBuyBackItem.backdrop:SetPoint("BOTTOMRIGHT", 6, -6)
E:StripTextures(MerchantBuyBackItemItemButton)
E:StyleButton(MerchantBuyBackItemItemButton)
E:SetTemplate(MerchantBuyBackItemItemButton, "Default", true)
MerchantBuyBackItemItemButtonIconTexture:SetTexCoord(unpack(E.TexCoords))
E:SetInside(MerchantBuyBackItemItemButtonIconTexture)
for i = 1, 2 do
S:HandleTab(_G["MerchantFrameTab"..i])
end
hooksecurefunc("MerchantFrame_UpdateMerchantInfo", function()
local numMerchantItems = GetMerchantNumItems()
for i = 1, MERCHANT_ITEMS_PER_PAGE do
local index = (((MerchantFrame.page - 1) * MERCHANT_ITEMS_PER_PAGE) + i)
local itemButton = _G["MerchantItem"..i.."ItemButton"]
local itemName = _G["MerchantItem"..i.."Name"]
if index <= numMerchantItems then
local itemLink = GetMerchantItemLink(index)
if itemLink then
local _, _, quality = GetItemInfo(match(itemLink, "item:(%d+)"))
if quality then
itemName:SetTextColor(GetItemQualityColor(quality))
itemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
else
itemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
else
itemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
HookScript(MerchantBuyBackItemItemButton, "OnEvent", function()
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end)
local buybackName = GetBuybackItemInfo(GetNumBuybackItems())
if buybackName then
local _, _, quality = GetItemInfoByName(buybackName)
if quality then
MerchantBuyBackItemName:SetTextColor(GetItemQualityColor(quality))
MerchantBuyBackItemItemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
else
MerchantBuyBackItemItemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
end)
hooksecurefunc("MerchantFrame_UpdateBuybackInfo", function()
local numBuybackItems = GetNumBuybackItems()
for i = 1, BUYBACK_ITEMS_PER_PAGE do
local itemButton = _G["MerchantItem"..i.."ItemButton"]
local itemName = _G["MerchantItem"..i.."Name"]
if i <= numBuybackItems then
local buybackName = GetBuybackItemInfo(i)
if buybackName then
local _, _, quality = GetItemInfoByName(buybackName)
if quality then
itemName:SetTextColor(GetItemQualityColor(quality))
itemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
else
itemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
end
end)
end
S:AddCallback("Merchant", LoadSkin)
@@ -0,0 +1,62 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local floor, format = math.floor, string.format
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.mirrorTimers ~= true then return end
hooksecurefunc("MirrorTimerFrame_OnUpdate", function(frame, elapsed)
if frame.paused then
return
end
if frame.timeSinceUpdate >= 0.3 then
local minutes = frame.value / 60
local seconds = frame.value - floor(frame.value / 60) * 60
local text = frame.label:GetText()
if frame.value > 0 then
frame.TimerText:SetText(format("%s (%d:%02d)", text, minutes, seconds))
else
frame.TimerText:SetText(format("%s (0:00)", text))
end
frame.timeSinceUpdate = 0
else
frame.timeSinceUpdate = frame.timeSinceUpdate + elapsed
end
end)
for i = 1, MIRRORTIMER_NUMTIMERS do
local mirrorTimer = _G["MirrorTimer"..i]
local statusBar = _G["MirrorTimer"..i.."StatusBar"]
local text = _G["MirrorTimer"..i.."Text"]
E:StripTextures(mirrorTimer)
mirrorTimer:SetWidth(222)
mirrorTimer:SetHeight(18)
mirrorTimer.label = text
statusBar:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(statusBar)
E:CreateBackdrop(statusBar)
statusBar:SetWidth(222)
statusBar:SetHeight(18)
text:Hide()
local TimerText = mirrorTimer:CreateFontString(nil, "OVERLAY")
E:FontTemplate(TimerText)
TimerText:SetPoint("CENTER", statusBar, "CENTER", 0, 0)
mirrorTimer.TimerText = TimerText
mirrorTimer.timeSinceUpdate = 0.3
E:CreateMover(mirrorTimer, "MirrorTimer"..i.."Mover", L["MirrorTimer"]..i, nil, nil, nil, "ALL,SOLO")
end
end
S:AddCallback("MirrorTimers", LoadSkin)
+456
View File
@@ -0,0 +1,456 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local find, getn = string.find, table.getn
--WoW API / Variables
local IsAddOnLoaded = IsAddOnLoaded
local UnitIsUnit = UnitIsUnit
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.misc ~= true then return end
-- Blizzard frame we want to reskin
local skins = {
"GameMenuFrame",
"UIOptionsFrame",
"OptionsFrame",
"OptionsFrameDisplay",
"OptionsFrameBrightness",
"OptionsFrameWorldAppearance",
"OptionsFramePixelShaders",
"OptionsFrameMiscellaneous",
"SoundOptionsFrame",
"TicketStatusFrame",
"StackSplitFrame"
}
for i = 1, getn(skins) do
E:SetTemplate(_G[skins[i]], "Transparent")
end
-- ChatMenus
local ChatMenus = {
"ChatMenu",
"EmoteMenu",
"LanguageMenu",
"VoiceMacroMenu",
}
for i = 1, getn(ChatMenus) do
if _G[ChatMenus[i]] == _G["ChatMenu"] then
HookScript(_G[ChatMenus[i]], "OnShow", function()
E:SetTemplate(this, "Transparent", true)
this:SetBackdropColor(unpack(E["media"].backdropfadecolor))
this:ClearAllPoints()
this:SetPoint("BOTTOMLEFT", ChatFrame1, "TOPLEFT", 0, 35)
end)
else
HookScript(_G[ChatMenus[i]], "OnShow", function()
E:SetTemplate(this, "Transparent", true)
this:SetBackdropColor(unpack(E["media"].backdropfadecolor))
end)
end
end
local function StyleButton(f)
local width, height = (f:GetWidth() * .54), f:GetHeight()
local left = f:CreateTexture(nil, "HIGHLIGHT")
left:SetWidth(width)
left:SetHeight(height)
left:SetPoint("LEFT", f, "CENTER")
left:SetTexture(1, 1, 1, 0.3)
left:SetHeight(16)
local right = f:CreateTexture(nil, "HIGHLIGHT")
right:SetWidth(width)
right:SetHeight(height)
right:SetPoint("RIGHT", f, "CENTER")
right:SetTexture(1, 1, 1, 0.3)
right:SetHeight(16)
end
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
StyleButton(_G["ChatMenuButton"..i])
StyleButton(_G["EmoteMenuButton"..i])
StyleButton(_G["LanguageMenuButton"..i])
StyleButton(_G["VoiceMacroMenuButton"..i])
end
-- UIDropDownMenu
hooksecurefunc("UIDropDownMenu_Initialize", function()
for i = 1, UIDROPDOWNMENU_MAXLEVELS do
local buttonBackdrop = _G["DropDownList"..i.."Backdrop"]
local buttonBackdropMenu = _G["DropDownList"..i.."MenuBackdrop"]
E:SetTemplate(buttonBackdrop, "Transparent")
E:SetTemplate(buttonBackdropMenu, "Transparent")
for j = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G["DropDownList"..i.."Button"..j]
local buttonHighlight = _G["DropDownList"..i.."Button"..j.."Highlight"]
button:SetFrameLevel(buttonBackdrop:GetFrameLevel() + 1)
buttonHighlight:SetTexture(1, 1, 1, 0.3)
buttonHighlight:SetAllPoints(button)
if i == 1 then
buttonHighlight:SetPoint("TOPLEFT", button, "TOPLEFT", -8, 0)
buttonHighlight:SetPoint("TOPRIGHT", button, "TOPRIGHT", -8, 0)
else
buttonHighlight:SetPoint("TOPLEFT", button, "TOPLEFT", -4, 0)
buttonHighlight:SetPoint("TOPRIGHT", button, "TOPRIGHT", -4, 0)
end
end
end
end)
-- L_UIDropDownMenu
hooksecurefunc("L_UIDropDownMenu_Initialize", function()
for i = 1, 2 do
local buttonBackdrop = _G["L_DropDownList"..i.."Backdrop"]
local buttonBackdropMenu = _G["L_DropDownList"..i.."MenuBackdrop"]
E:SetTemplate(buttonBackdrop, "Transparent")
E:SetTemplate(buttonBackdropMenu, "Transparent")
if i == 2 then
buttonBackdropMenu:SetPoint("TOPRIGHT", -4, 0)
end
for j = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G["L_DropDownList"..i.."Button"..j]
local buttonHighlight = _G["L_DropDownList"..i.."Button"..j.."Highlight"]
button:SetFrameLevel(buttonBackdrop:GetFrameLevel() + 1)
buttonHighlight:SetTexture(1, 1, 1, 0.3)
buttonHighlight:SetAllPoints(button)
if i == 2 then
buttonHighlight:SetPoint("TOPLEFT", button, "TOPLEFT", -8, 0)
buttonHighlight:SetPoint("TOPRIGHT", button, "TOPRIGHT", 0, 0)
end
end
end
end)
-- Kill the nVidia logo
local _, _, nVidiaLogo = OptionsFrame:GetRegions()
if nVidiaLogo:GetObjectType() == "Texture" then
E:Kill(nVidiaLogo)
end
-- Static Popups
for i = 1, STATICPOPUP_NUMDIALOGS do
local staticPopup = _G["StaticPopup"..i]
local itemFrameBox = _G["StaticPopup"..i.."EditBox"]
local closeButton = _G["StaticPopup"..i.."CloseButton"]
local wideBox = _G["StaticPopup"..i.."WideEditBox"]
E:SetTemplate(staticPopup, "Transparent")
itemFrameBox:DisableDrawLayer("BACKGROUND")
S:HandleEditBox(itemFrameBox)
itemFrameBox.backdrop:SetPoint("TOPLEFT", -2, -4)
itemFrameBox.backdrop:SetPoint("BOTTOMRIGHT", 2, 4)
E:StripTextures(closeButton)
S:HandleCloseButton(closeButton)
local _, _, _, _, _, _, _, region = wideBox:GetRegions()
if region then
region:Hide()
end
--select(8, wideBox:GetRegions()):Hide()
S:HandleEditBox(wideBox)
wideBox:SetHeight(22)
for j = 1, 2 do
S:HandleButton(_G["StaticPopup"..i.."Button"..j])
end
end
-- reskin all esc/menu buttons
local BlizzardMenuButtons = {
"Options",
"SoundOptions",
"UIOptions",
"Keybindings",
"Macros",
"Logout",
"Quit",
"Continue",
}
for i = 1, getn(BlizzardMenuButtons) do
local ElvuiMenuButtons = _G["GameMenuButton"..BlizzardMenuButtons[i]]
if ElvuiMenuButtons then
S:HandleButton(ElvuiMenuButtons)
end
end
-- hide header textures and move text/buttons.
local BlizzardHeader = {
"GameMenuFrame",
"SoundOptionsFrame",
"OptionsFrame",
}
for i = 1, getn(BlizzardHeader) do
local title = _G[BlizzardHeader[i].."Header"]
if title then
title:SetTexture("")
title:ClearAllPoints()
if title == _G["GameMenuFrameHeader"] then
title:SetPoint("TOP", GameMenuFrame, 0, 7)
else
title:SetPoint("TOP", BlizzardHeader[i], 0, 0)
end
end
end
-- here we reskin all "normal" buttons
local BlizzardButtons = {
"OptionsFrameOkay",
"OptionsFrameCancel",
"OptionsFrameDefaults",
"SoundOptionsFrameOkay",
"SoundOptionsFrameCancel",
"SoundOptionsFrameDefaults",
"UIOptionsFrameDefaults",
"UIOptionsFrameOkay",
"UIOptionsFrameCancel",
"StackSplitOkayButton",
"StackSplitCancelButton",
"RolePollPopupAcceptButton"
}
for i = 1, getn(BlizzardButtons) do
local ElvuiButtons = _G[BlizzardButtons[i]]
if ElvuiButtons then
S:HandleButton(ElvuiButtons)
end
end
-- if a button position is not really where we want, we move it here
OptionsFrameCancel:ClearAllPoints()
OptionsFrameCancel:SetPoint("BOTTOMLEFT",OptionsFrame,"BOTTOMRIGHT",-105,15)
OptionsFrameOkay:ClearAllPoints()
OptionsFrameOkay:SetPoint("RIGHT",OptionsFrameCancel,"LEFT",-4,0)
SoundOptionsFrameOkay:ClearAllPoints()
SoundOptionsFrameOkay:SetPoint("RIGHT",SoundOptionsFrameCancel,"LEFT",-4,0)
UIOptionsFrameOkay:ClearAllPoints()
UIOptionsFrameOkay:SetPoint("RIGHT",UIOptionsFrameCancel,"LEFT", -4,0)
-- others
ZoneTextFrame:ClearAllPoints()
ZoneTextFrame:SetPoint("TOP", UIParent, 0, -128)
E:StripTextures(CoinPickupFrame)
E:SetTemplate(CoinPickupFrame, "Transparent")
S:HandleButton(CoinPickupOkayButton)
S:HandleButton(CoinPickupCancelButton)
-- Stack Split Frame
StackSplitFrame:GetRegions():Hide()
StackSplitFrame.bg1 = CreateFrame("Frame", nil, StackSplitFrame)
E:SetTemplate(StackSplitFrame.bg1, "Transparent")
StackSplitFrame.bg1:SetPoint("TOPLEFT", 10, -15)
StackSplitFrame.bg1:SetPoint("BOTTOMRIGHT", -10, 55)
StackSplitFrame.bg1:SetFrameLevel(StackSplitFrame.bg1:GetFrameLevel() - 1)
-- Declension frame
if GetLocale() == "ruRU" then
DeclensionFrame:SetTemplate("Transparent")
S:HandleNextPrevButton(DeclensionFrameSetPrev)
S:HandleNextPrevButton(DeclensionFrameSetNext)
S:HandleButton(DeclensionFrameOkayButton)
S:HandleButton(DeclensionFrameCancelButton)
for i = 1, RUSSIAN_DECLENSION_PATTERNS do
local editBox = _G["DeclensionFrameDeclension"..i.."Edit"]
if editBox then
E:StripTextures(editBox)
S:HandleEditBox(editBox)
end
end
end
if GetLocale() == "koKR" then
S:HandleButton(GameMenuButtonRatings)
RatingMenuFrame:SetTemplate("Transparent")
RatingMenuFrameHeader:Kill()
S:HandleButton(RatingMenuButtonOkay)
end
E:StripTextures(OpacityFrame)
E:SetTemplate(OpacityFrame, "Transparent")
S:HandleSliderFrame(OpacityFrameSlider)
-- Interface Options
UIOptionsFrame:SetParent(E.UIParent)
UIOptionsFrame:EnableMouse(false)
hooksecurefunc("UIOptionsFrame_Load", function()
E:StripTextures(UIOptionsFrame)
end)
local UIOptions = {
"BasicOptions",
"BasicOptionsGeneral",
"BasicOptionsDisplay",
"BasicOptionsCamera",
"BasicOptionsHelp",
"AdvancedOptions",
"AdvancedOptionsActionBars",
"AdvancedOptionsChat",
"AdvancedOptionsRaid",
"AdvancedOptionsCombatText",
}
for i = 1, getn(UIOptions) do
local options = _G[UIOptions[i]]
E:SetTemplate(options, "Transparent")
end
BasicOptions.backdrop = CreateFrame("Frame", nil, BasicOptions)
BasicOptions.backdrop:SetPoint("TOPLEFT", BasicOptionsGeneral, -20, 35)
BasicOptions.backdrop:SetPoint("BOTTOMRIGHT", BasicOptionsHelp, 20, -130)
E:SetTemplate(BasicOptions.backdrop, "Transparent")
AdvancedOptions.backdrop = CreateFrame("Frame", nil, AdvancedOptions)
AdvancedOptions.backdrop:SetPoint("TOPLEFT", BasicOptionsGeneral, -20, 35)
AdvancedOptions.backdrop:SetPoint("BOTTOMRIGHT", BasicOptionsHelp, 20, -130)
E:SetTemplate(AdvancedOptions.backdrop, "Transparent")
for i = 1, 2 do
local tab = _G["UIOptionsFrameTab"..i]
E:StripTextures(tab, true)
E:CreateBackdrop(tab, "Transparent")
tab:SetFrameLevel(tab:GetParent():GetFrameLevel() + 2)
tab.backdrop:SetFrameLevel(tab:GetParent():GetFrameLevel() + 1)
tab.backdrop:SetPoint("TOPLEFT", 5, E.PixelMode and -14 or -16)
tab.backdrop:SetPoint("BOTTOMRIGHT", -5, E.PixelMode and -4 or -6)
tab:SetScript("OnClick", function()
PanelTemplates_Tab_OnClick(UIOptionsFrame)
if AdvancedOptions:IsShown() then
BasicOptions:Show()
AdvancedOptions:Hide()
else
BasicOptions:Hide()
AdvancedOptions:Show()
end
PlaySound("igCharacterInfoTab")
end)
HookScript(tab, "OnEnter", S.SetModifiedBackdrop)
HookScript(tab, "OnLeave", S.SetOriginalBackdrop)
end
for _, child in ipairs({UIOptionsFrame:GetChildren()}) do
if child.GetPushedTexture and child:GetPushedTexture() and not child:GetName() then
child:SetFrameLevel(UIOptionsFrame:GetFrameLevel() + 2)
S:HandleCloseButton(child, UIOptionsFrame.backdrop)
end
end
--[[for i = 1, UIOptionsFrame:GetNumChildren() do
local child = select(i, UIOptionsFrame:GetChildren())
if child.GetPushedTexture and child:GetPushedTexture() and not child:GetName() then
child:SetFrameLevel(UIOptionsFrame:GetFrameLevel() + 2)
S:HandleCloseButton(child, UIOptionsFrame.backdrop)
end
end--]]
OptionsFrameDefaults:ClearAllPoints()
OptionsFrameDefaults:SetPoint("TOPLEFT", OptionsFrame, "BOTTOMLEFT", 15, 36)
S:HandleButton(UIOptionsFrameResetTutorials)
SoundOptionsFrameCheckButton1:SetPoint("TOPLEFT", "SoundOptionsFrame", "TOPLEFT", 16, -15)
-- Interface Options Frame Dropdown
local interfacedropdown ={
"CombatTextDropDown",
"TargetofTargetDropDown",
"CameraDropDown",
"ClickCameraDropDown"
}
for i = 1, getn(interfacedropdown) do
local idropdown = _G["UIOptionsFrame"..interfacedropdown[i]]
if idropdown then
S:HandleDropDownBox(idropdown)
end
end
-- Video Options Frame Dropdown
local optiondropdown = {
"OptionsFrameResolutionDropDown",
"OptionsFrameRefreshDropDown",
"OptionsFrameMultiSampleDropDown",
"SoundOptionsOutputDropDown",
}
for i = 1, getn(optiondropdown) do
local odropdown = _G[optiondropdown[i]]
if odropdown then
S:HandleDropDownBox(odropdown, i == 3 and 195 or 165)
end
end
-- Interface Options Checkboxes
for index, value in UIOptionsFrameCheckButtons do
local UIOptionsFrameCheckBox = _G["UIOptionsFrameCheckButton"..value.index]
if UIOptionsFrameCheckBox then
S:HandleCheckBox(UIOptionsFrameCheckBox)
end
end
-- Video Options Checkboxes
for index, value in OptionsFrameCheckButtons do
local OptionsFrameCheckButton = _G["OptionsFrameCheckButton"..value.index]
if OptionsFrameCheckButton then
S:HandleCheckBox(OptionsFrameCheckButton)
end
end
-- Sound Options Checkboxes
for index, value in SoundOptionsFrameCheckButtons do
local SoundOptionsFrameCheckButton = _G["SoundOptionsFrameCheckButton"..value.index]
if SoundOptionsFrameCheckButton then
S:HandleCheckBox(SoundOptionsFrameCheckButton)
end
end
-- Interface Options Sliders
for i, v in UIOptionsFrameSliders do
S:HandleSliderFrame(_G["UIOptionsFrameSlider"..i])
end
-- Video Options Sliders
for i, v in OptionsFrameSliders do
S:HandleSliderFrame(_G["OptionsFrameSlider"..i])
end
-- Sound Options Sliders
for i, v in SoundOptionsFrameSliders do
S:HandleSliderFrame(_G["SoundOptionsFrameSlider"..i])
end
end
S:AddCallback("SkinMisc", LoadSkin)
+39
View File
@@ -0,0 +1,39 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.petition ~= true then return end
E:StripTextures(PetitionFrame, true)
E:CreateBackdrop(PetitionFrame, "Transparent")
PetitionFrame.backdrop:SetPoint("TOPLEFT", 12, -17)
PetitionFrame.backdrop:SetPoint("BOTTOMRIGHT", -28, 65)
S:HandleButton(PetitionFrameSignButton)
S:HandleButton(PetitionFrameRequestButton)
S:HandleButton(PetitionFrameRenameButton)
S:HandleButton(PetitionFrameCancelButton)
S:HandleCloseButton(PetitionFrameCloseButton)
PetitionFrameCharterTitle:SetTextColor(1, 1, 0)
PetitionFrameCharterName:SetTextColor(1, 1, 1)
PetitionFrameMasterTitle:SetTextColor(1, 1, 0)
PetitionFrameMasterName:SetTextColor(1, 1, 1)
PetitionFrameMemberTitle:SetTextColor(1, 1, 0)
for i = 1, 9 do
_G["PetitionFrameMemberName"..i]:SetTextColor(1, 1, 1)
end
PetitionFrameInstructions:SetTextColor(1, 1, 1)
PetitionFrameRenameButton:SetPoint("LEFT", PetitionFrameRequestButton, "RIGHT", 3, 0)
PetitionFrameRenameButton:SetPoint("RIGHT", PetitionFrameCancelButton, "LEFT", -3, 0)
end
S:AddCallback("Petition", LoadSkin)
+439
View File
@@ -0,0 +1,439 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local pairs = pairs
local unpack = unpack
local find, format, match, split = string.find, string.format, string.match, string.split
--WoW API / Variables
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.quest ~= true then return end
local QuestStrip = {
"QuestFrame",
"QuestLogFrame",
"EmptyQuestLogFrame",
"QuestFrameDetailPanel",
"QuestDetailScrollFrame",
"QuestDetailScrollChildFrame",
"QuestRewardScrollFrame",
"QuestRewardScrollChildFrame",
"QuestFrameProgressPanel",
"QuestFrameRewardPanel",
"QuestFrameRewardPanel"
}
for _, object in pairs(QuestStrip) do
E:StripTextures(_G[object], true)
end
local QuestButtons = {
"QuestLogFrameAbandonButton",
"QuestFrameExitButton",
"QuestFramePushQuestButton",
"QuestFrameCompleteButton",
"QuestFrameGoodbyeButton",
"QuestFrameCompleteQuestButton",
"QuestFrameCancelButton",
"QuestFrameGreetingGoodbyeButton",
"QuestFrameAcceptButton",
"QuestFrameDeclineButton"
}
for _, button in pairs(QuestButtons) do
E:StripTextures(_G[button])
S:HandleButton(_G[button])
end
for i = 1, MAX_NUM_ITEMS do
local item = _G["QuestLogItem"..i]
local icon = _G["QuestLogItem"..i.."IconTexture"]
local count = _G["QuestLogItem"..i.."Count"]
E:StripTextures(item)
E:SetTemplate(item, "Default")
E:StyleButton(item)
item:SetWidth(item:GetWidth() - 4)
item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY")
icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border)
S:HandleIcon(icon)
count:SetParent(item.backdrop)
count:SetDrawLayer("OVERLAY")
end
for i = 1, 6 do
local item = _G["QuestDetailItem"..i]
local icon = _G["QuestDetailItem"..i.."IconTexture"]
local count = _G["QuestDetailItem"..i.."Count"]
E:StripTextures(item)
E:SetTemplate(item, "Default")
E:StyleButton(item)
item:SetWidth(item:GetWidth() - 4)
item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY")
icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border)
S:HandleIcon(icon)
count:SetParent(item.backdrop)
count:SetDrawLayer("OVERLAY")
end
for i = 1, 6 do
local item = _G["QuestRewardItem"..i]
local icon = _G["QuestRewardItem"..i.."IconTexture"]
local count = _G["QuestRewardItem"..i.."Count"]
E:StripTextures(item)
E:SetTemplate(item, "Default")
E:StyleButton(item)
item:SetWidth(item:GetWidth() - 4)
item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY")
icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border)
S:HandleIcon(icon)
count:SetParent(item.backdrop)
count:SetDrawLayer("OVERLAY")
end
local function QuestQualityColors(frame, text, quality, link)
if link and not quality then
_, _, quality = GetItemInfo(match(link, "item:(%d+)"))
end
if quality then
if frame then
frame:SetBackdropBorderColor(GetItemQualityColor(quality))
frame.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
end
text:SetTextColor(GetItemQualityColor(quality))
else
if frame then
frame:SetBackdropBorderColor(unpack(E["media"].bordercolor))
frame.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
text:SetTextColor(1, 1, 1)
end
end
E:StripTextures(QuestRewardItemHighlight)
E:SetTemplate(QuestRewardItemHighlight, "Default", nil, true)
QuestRewardItemHighlight:SetBackdropBorderColor(1, 1, 0)
QuestRewardItemHighlight:SetBackdropColor(0, 0, 0, 0)
QuestRewardItemHighlight:SetWidth(142)
QuestRewardItemHighlight:SetHeight(40)
hooksecurefunc("QuestRewardItem_OnClick", function()
QuestRewardItemHighlight:ClearAllPoints();
E:SetOutside(QuestRewardItemHighlight, this:GetName() .. "IconTexture")
_G[this:GetName() .. "Name"]:SetTextColor(1, 1, 0)
for i = 1, MAX_NUM_ITEMS do
local questItem = _G["QuestRewardItem"..i]
local questName = _G["QuestRewardItem"..i.."Name"]
local link = questItem.type and GetQuestItemLink(questItem.type, questItem:GetID())
if questItem ~= this then
QuestQualityColors(nil, questName, nil, link)
end
end
end)
local function QuestObjectiveTextColor()
local numObjectives = GetNumQuestLeaderBoards()
local objective
local _, type, finished;
local numVisibleObjectives = 0
for i = 1, numObjectives do
_, type, finished = GetQuestLogLeaderBoard(i)
if type ~= "spell" then
numVisibleObjectives = numVisibleObjectives + 1
objective = _G["QuestLogObjective"..numVisibleObjectives]
if finished then
objective:SetTextColor(1, 0.80, 0.10)
else
objective:SetTextColor(0.6, 0.6, 0.6)
end
end
end
end
hooksecurefunc("QuestLog_UpdateQuestDetails", function()
local requiredMoney = GetQuestLogRequiredMoney()
if requiredMoney > 0 then
if requiredMoney > GetMoney() then
QuestLogRequiredMoneyText:SetTextColor(0.6, 0.6, 0.6)
else
QuestLogRequiredMoneyText:SetTextColor(1, 0.80, 0.10)
end
end
end)
hooksecurefunc("QuestFrameItems_Update", function(questState)
local titleTextColor = {1, 0.80, 0.10}
local textColor = {1, 1, 1}
QuestDetailObjectiveTitleText:SetTextColor(unpack(titleTextColor))
QuestDetailRewardTitleText:SetTextColor(unpack(titleTextColor))
QuestLogDescriptionTitle:SetTextColor(unpack(titleTextColor))
QuestLogQuestTitle:SetTextColor(unpack(titleTextColor))
QuestLogTitleText:SetTextColor(unpack(titleTextColor))
QuestLogRewardTitleText:SetTextColor(unpack(titleTextColor))
QuestRewardRewardTitleText:SetTextColor(unpack(titleTextColor))
QuestRewardTitleText:SetTextColor(unpack(titleTextColor))
QuestTitleText:SetTextColor(unpack(titleTextColor))
QuestTitleFont:SetTextColor(unpack(titleTextColor))
QuestTitleFont:SetFont("Fonts\\MORPHEUS.TTF", E.db.general.fontSize + 6)
QuestTitleFont.SetFont = E.noop
QuestDescription:SetTextColor(unpack(textColor))
QuestDetailItemReceiveText:SetTextColor(unpack(textColor))
QuestDetailSpellLearnText:SetTextColor(unpack(textColor))
QuestDetailItemChooseText:SetTextColor(unpack(textColor))
QuestFont:SetTextColor(unpack(textColor))
QuestFontNormalSmall:SetTextColor(unpack(textColor))
QuestLogObjectivesText:SetTextColor(unpack(textColor))
QuestLogQuestDescription:SetTextColor(unpack(textColor))
QuestLogItemChooseText:SetTextColor(unpack(textColor))
QuestLogItemReceiveText:SetTextColor(unpack(textColor))
QuestLogSpellLearnText:SetTextColor(unpack(textColor))
QuestObjectiveText:SetTextColor(unpack(textColor))
QuestRewardItemChooseText:SetTextColor(unpack(textColor))
QuestRewardItemReceiveText:SetTextColor(unpack(textColor))
QuestRewardSpellLearnText:SetTextColor(unpack(textColor))
QuestRewardText:SetTextColor(unpack(textColor))
QuestObjectiveTextColor()
local numQuestRewards, numQuestChoices
if questState == "QuestLog" then
numQuestRewards, numQuestChoices = GetNumQuestLogRewards(), GetNumQuestLogChoices()
else
numQuestRewards, numQuestChoices = GetNumQuestRewards(), GetNumQuestChoices()
end
local rewardsCount = numQuestChoices + numQuestRewards
if rewardsCount > 0 then
local questItem, itemName, link
local questItemName = questState.."Item"
for i = 1, rewardsCount do
questItem = _G[questItemName..i]
itemName = _G[questItemName..i.."Name"]
link = questItem.type and (questState == "QuestLog" and GetQuestLogItemLink or GetQuestItemLink)(questItem.type, questItem:GetID())
QuestQualityColors(questItem, itemName, nil, link)
end
end
end)
QuestLogTimerText:SetTextColor(1, 1, 1)
HookScript(QuestFrameGreetingPanel, "OnShow", function()
GreetingText:SetTextColor(1, 0.80, 0.10)
CurrentQuestsText:SetTextColor(1, 1, 1)
AvailableQuestsText:SetTextColor(1, 1, 1)
end)
E:CreateBackdrop(QuestFrame, "Transparent")
QuestFrame.backdrop:SetPoint("TOPLEFT", 15, -19)
QuestFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 67)
E:CreateBackdrop(QuestLogFrame, "Transparent")
QuestLogFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
QuestLogFrame.backdrop:SetPoint("BOTTOMRIGHT", -1, 8)
E:StripTextures(QuestLogListScrollFrame)
E:CreateBackdrop(QuestLogListScrollFrame, "Default", true)
QuestLogListScrollFrame:SetWidth(334)
E:StripTextures(QuestLogDetailScrollFrame)
E:CreateBackdrop(QuestLogDetailScrollFrame, "Default", true)
QuestLogDetailScrollFrame:SetWidth(334)
QuestLogDetailScrollFrame:SetHeight(296)
QuestLogDetailScrollFrame:ClearAllPoints()
QuestLogDetailScrollFrame:SetPoint("TOPRIGHT", QuestLogListScrollFrame, "BOTTOMRIGHT", 0, -6)
QuestLogNoQuestsText:ClearAllPoints()
QuestLogNoQuestsText:SetPoint("CENTER", EmptyQuestLogFrame, "CENTER", -45, 65)
QuestLogFrameAbandonButton:SetPoint("BOTTOMLEFT", 18, 15)
QuestLogFrameAbandonButton:SetWidth(126)
QuestFramePushQuestButton:ClearAllPoints()
QuestFramePushQuestButton:SetPoint("BOTTOM", QuestFrame, "BOTTOM", 18, 15)
QuestFramePushQuestButton:SetWidth(118)
QuestFrameExitButton:SetPoint("BOTTOMRIGHT", -8, 15)
QuestFrameExitButton:SetWidth(100)
S:HandleScrollBar(QuestLogDetailScrollFrameScrollBar)
S:HandleScrollBar(QuestDetailScrollFrameScrollBar)
S:HandleScrollBar(QuestLogListScrollFrameScrollBar)
S:HandleScrollBar(QuestProgressScrollFrameScrollBar)
S:HandleScrollBar(QuestRewardScrollFrameScrollBar)
S:HandleCloseButton(QuestFrameCloseButton)
S:HandleCloseButton(QuestLogFrameCloseButton)
QuestLogFrameCloseButton:ClearAllPoints()
QuestLogFrameCloseButton:SetPoint("TOPRIGHT", 2, -9)
QuestLogTrack:Hide()
local QuestTrack = CreateFrame("Button", "QuestTrack", QuestLogFrame, "UIPanelButtonTemplate")
S:HandleButton(QuestTrack)
QuestTrack:SetText(TRACK_QUEST)
QuestTrack:SetPoint("TOP", QuestLogFrame, "TOP", -64, -42)
QuestTrack:SetWidth(110)
QuestTrack:SetHeight(21)
HookScript(QuestTrack, "OnClick", function()
if IsQuestWatched(GetQuestLogSelection()) then
RemoveQuestWatch(GetQuestLogSelection())
QuestWatch_Update()
else
if GetNumQuestLeaderBoards(GetQuestLogSelection()) == 0 then
UIErrorsFrame:AddMessage(QUEST_WATCH_NO_OBJECTIVES, 1.0, 0.1, 0.1, 1.0)
return
end
if GetNumQuestWatches() >= MAX_WATCHABLE_QUESTS then
UIErrorsFrame:AddMessage(format(QUEST_WATCH_TOO_MANY, MAX_WATCHABLE_QUESTS), 1.0, 0.1, 0.1, 1.0)
return
end
AddQuestWatch(GetQuestLogSelection())
QuestLog_Update()
QuestWatch_Update()
end
QuestLog_Update()
end)
hooksecurefunc("QuestLog_Update", function()
local numEntries = GetNumQuestLogEntries()
if numEntries == 0 then
QuestTrack:Disable()
else
QuestTrack:Enable()
end
if EmptyQuestLogFrame:IsVisible() then
QuestLogListScrollFrame:Hide()
else
QuestLogListScrollFrame:Show()
end
end)
for i = 1, 6 do
local item = _G["QuestProgressItem"..i]
local icon = _G["QuestProgressItem"..i.."IconTexture"]
local count = _G["QuestProgressItem"..i.."Count"]
E:StripTextures(item)
E:SetTemplate(item, "Default")
E:StyleButton(item)
item:SetWidth(item:GetWidth() - 4)
item:SetFrameLevel(item:GetFrameLevel() + 2)
icon:SetDrawLayer("OVERLAY")
icon:SetWidth(icon:GetWidth() -(E.Spacing*2))
icon:SetHeight(icon:GetHeight() -(E.Spacing*2))
icon:SetPoint("TOPLEFT", E.Border, -E.Border)
S:HandleIcon(icon)
count:SetParent(item.backdrop)
count:SetDrawLayer("OVERLAY")
end
hooksecurefunc("QuestFrameProgressItems_Update", function()
QuestProgressTitleText:SetTextColor(1, 0.80, 0.10)
QuestProgressText:SetTextColor(1, 1, 1)
QuestProgressRequiredItemsText:SetTextColor(1, 0.80, 0.10)
if GetQuestMoneyToGet() > GetMoney() then
QuestProgressRequiredMoneyText:SetTextColor(0.6, 0.6, 0.6)
else
QuestProgressRequiredMoneyText:SetTextColor(1, 0.80, 0.10)
end
for i = 1, MAX_REQUIRED_ITEMS do
local item = _G["QuestProgressItem"..i]
local name = _G["QuestProgressItem"..i.."Name"]
local link = item.type and GetQuestItemLink(item.type, item:GetID())
QuestQualityColors(item, name, nil, link)
end
end)
for i = 1, QUESTS_DISPLAYED do
local questLogTitle = _G["QuestLogTitle"..i]
questLogTitle:SetNormalTexture("")
questLogTitle.SetNormalTexture = E.noop
_G["QuestLogTitle"..i.."Highlight"]:SetTexture("")
_G["QuestLogTitle"..i.."Highlight"].SetTexture = E.noop
questLogTitle.Text = questLogTitle:CreateFontString(nil, "OVERLAY")
E:FontTemplate(questLogTitle.Text, nil, 22)
questLogTitle.Text:SetPoint("LEFT", 3, 0)
questLogTitle.Text:SetText("+")
hooksecurefunc(questLogTitle, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
elseif find(texture, "PlusButton") then
self.Text:SetText("+")
else
self.Text:SetText("")
end
end)
end
E:StripTextures(QuestLogCollapseAllButton)
QuestLogCollapseAllButton:SetNormalTexture("")
QuestLogCollapseAllButton.SetNormalTexture = E.noop
QuestLogCollapseAllButton:SetHighlightTexture("")
QuestLogCollapseAllButton.SetHighlightTexture = E.noop
QuestLogCollapseAllButton:SetDisabledTexture("")
QuestLogCollapseAllButton.SetDisabledTexture = E.noop
QuestLogCollapseAllButton:SetPoint("TOPLEFT", -45, 7)
QuestLogCollapseAllButton.Text = QuestLogCollapseAllButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(QuestLogCollapseAllButton.Text, nil, 22)
QuestLogCollapseAllButton.Text:SetPoint("LEFT", 3, 0)
QuestLogCollapseAllButton.Text:SetText("+")
hooksecurefunc(QuestLogCollapseAllButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
else
self.Text:SetText("+")
end
end)
end
S:AddCallback("Quest", LoadSkin)
@@ -0,0 +1,35 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.questtimers ~= true then return end
E:StripTextures(QuestTimerFrame)
E:SetTemplate(QuestTimerFrame, "Transparent")
QuestTimerHeader:SetPoint("TOP", 1, 8)
E:CreateMover(QuestTimerFrame, "QuestTimerFrameMover", QUEST_TIMERS)
QuestTimerFrame:ClearAllPoints()
QuestTimerFrame:SetAllPoints(QuestTimerFrameMover)
local QuestTimerFrameHolder = CreateFrame("Frame", "QuestTimerFrameHolder", E.UIParent)
QuestTimerFrameHolder:SetWidth(150)
QuestTimerFrameHolder:SetHeight(22)
QuestTimerFrameHolder:SetPoint("TOP", QuestTimerFrameMover, "TOP")
hooksecurefunc(QuestTimerFrame, "SetPoint", function(_, _, parent)
if parent ~= QuestTimerFrameHolder then
QuestTimerFrame:ClearAllPoints()
QuestTimerFrame:SetPoint("TOP", QuestTimerFrameHolder, "TOP")
end
end)
end
S:AddCallback("QuestTimer", LoadSkin)
+107
View File
@@ -0,0 +1,107 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local pairs = pairs
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.raid ~= true then return end
-- RaidFrame
local StripAllTextures = {
"RaidGroup1",
"RaidGroup2",
"RaidGroup3",
"RaidGroup4",
"RaidGroup5",
"RaidGroup6",
"RaidGroup7",
"RaidGroup8"
}
for _, object in pairs(StripAllTextures) do
if _G[object] then
E:StripTextures(_G[object])
end
end
S:HandleButton(RaidFrameAddMemberButton)
S:HandleButton(RaidFrameReadyCheckButton)
S:HandleButton(RaidFrameRaidInfoButton)
for i = 1, NUM_RAID_GROUPS*5 do
S:HandleButton(_G["RaidGroupButton"..i], true)
end
for i = 1, 8 do
for j = 1, 5 do
E:StripTextures(_G["RaidGroup"..i.."Slot"..j])
E:SetTemplate(_G["RaidGroup"..i.."Slot"..j], "Transparent")
end
end
local function skinPulloutFrames()
for i = 1, NUM_RAID_PULLOUT_FRAMES do
local rp = _G["RaidPullout"..i]
if not rp.backdrop then
_G["RaidPullout"..i.."MenuBackdrop"]:SetBackdrop(nil)
E:CreateBackdrop(rp, "Transparent")
rp.backdrop:SetPoint("TOPLEFT", 9, -17)
rp.backdrop:SetPoint("BOTTOMRIGHT", -7, 10)
end
end
end
hooksecurefunc("RaidPullout_GetFrame", function()
skinPulloutFrames()
end)
--[[hooksecurefunc("RaidPullout_Update", function(pullOutFrame)
local pfName = pullOutFrame:GetName()
for i = 1, pullOutFrame.numPulloutButtons do
local pfBName = pfName.."Button"..i
local pfBObj = _G[pfBName]
if not pfBObj.backdrop then
for _, v in pairs{"HealthBar", "ManaBar", "Target", "TargetTarget"} do
local sBar = pfBName..v
E:StripTextures(_G[sBar])
_G[sBar]:SetStatusBarTexture(E["media"].normTex)
end
_G[pfBName.."ManaBar"]:SetPoint("TOP", "$parentHealthBar", "BOTTOM", 0, 0)
_G[pfBName.."Target"]:SetPoint("TOP", "$parentManaBar", "BOTTOM", 0, -1)
E:CreateBackdrop(pfBObj, "Default")
pfBObj.backdrop:SetPoint("TOPLEFT", E.PixelMode and 0 or -1, -(E.PixelMode and 10 or 9))
pfBObj.backdrop:SetPoint("BOTTOMRIGHT", E.PixelMode and 0 or 1, E.PixelMode and 1 or 0)
end
if not _G[pfBName.."TargetTargetFrame"].backdrop then
E:StripTextures(_G[pfBName.."TargetTargetFrame"])
E:CreateBackdrop(_G[pfBName.."TargetTargetFrame"], "Default")
_G[pfBName.."TargetTargetFrame"].backdrop:SetPoint("TOPLEFT", E.PixelMode and 10 or 9, -(E.PixelMode and 15 or 14))
_G[pfBName.."TargetTargetFrame"].backdrop:SetPoint("BOTTOMRIGHT", -(E.PixelMode and 10 or 9), E.PixelMode and 8 or 7)
end
end
end)]]
-- ReadyCheckFrame
E:StripTextures(ReadyCheckFrame)
E:SetTemplate(ReadyCheckFrame, "Transparent")
E:Kill(ReadyCheckPortrait)
S:HandleButton(ReadyCheckFrameYesButton)
S:HandleButton(ReadyCheckFrameNoButton)
ReadyCheckFrameYesButton:SetPoint("RIGHT", ReadyCheckFrame, "CENTER", -1, 0)
ReadyCheckFrameNoButton:SetPoint("LEFT", ReadyCheckFrameYesButton, "RIGHT", 3, 0)
ReadyCheckFrameText:SetPoint("TOP", ReadyCheckFrame, "TOP", 0, -18)
end
S:AddCallbackForAddon("Blizzard_RaidUI", "RaidUI", LoadSkin)
@@ -0,0 +1,70 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.spellbook ~= true then return end
E:StripTextures(SpellBookFrame, true)
E:CreateBackdrop(SpellBookFrame, "Transparent")
SpellBookFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
SpellBookFrame.backdrop:SetPoint("BOTTOMRIGHT", -31, 75)
for i = 1, 3 do
local tab = _G["SpellBookFrameTabButton"..i]
tab:GetNormalTexture():SetTexture("")
tab:GetDisabledTexture():SetTexture("")
S:HandleTab(tab)
tab.backdrop:SetPoint("TOPLEFT", 14, E.PixelMode and -17 or -19)
tab.backdrop:SetPoint("BOTTOMRIGHT", -14, 19)
end
S:HandleNextPrevButton(SpellBookPrevPageButton)
S:HandleNextPrevButton(SpellBookNextPageButton)
S:HandleCloseButton(SpellBookCloseButton)
for i = 1, SPELLS_PER_PAGE do
local button = _G["SpellButton"..i]
E:StripTextures(button)
_G["SpellButton"..i.."AutoCastable"]:SetTexture("Interface\\Buttons\\UI-AutoCastableOverlay")
E:SetOutside(_G["SpellButton"..i.."AutoCastable"], button, 16, 16)
E:CreateBackdrop(button, "Default", true)
_G["SpellButton"..i.."IconTexture"]:SetTexCoord(unpack(E.TexCoords))
E:RegisterCooldown(_G["SpellButton"..i.."Cooldown"])
end
hooksecurefunc("SpellButton_UpdateButton", function()
local name = this:GetName()
_G[name.."SpellName"]:SetTextColor(1, 0.80, 0.10)
_G[name.."SubSpellName"]:SetTextColor(1, 1, 1)
_G[name.."Highlight"]:SetTexture(1, 1, 1, 0.3)
end)
for i = 1, MAX_SKILLLINE_TABS do
local tab = _G["SpellBookSkillLineTab"..i]
E:StripTextures(tab)
E:StyleButton(tab, nil, true)
E:SetTemplate(tab, "Default", true)
E:SetInside(tab:GetNormalTexture())
tab:GetNormalTexture():SetTexCoord(unpack(E.TexCoords))
end
SpellBookPageText:SetTextColor(1, 1, 1)
end
S:AddCallback("SpellBook", LoadSkin)
+58
View File
@@ -0,0 +1,58 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local GetPetHappiness = GetPetHappiness
local HasPetUI = HasPetUI
local hooksecurefunc = hooksecurefunc
local UnitExists = UnitExists
function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.stable ~= true then return end
E:StripTextures(PetStableFrame)
E:Kill(PetStableFramePortrait)
E:CreateBackdrop(PetStableFrame, "Transparent")
PetStableFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
PetStableFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 71)
S:HandleButton(PetStablePurchaseButton)
S:HandleCloseButton(PetStableFrameCloseButton)
S:HandleRotateButton(PetStableModelRotateRightButton)
S:HandleRotateButton(PetStableModelRotateLeftButton)
S:HandleItemButton(_G["PetStableCurrentPet"], true)
_G["PetStableCurrentPetIconTexture"]:SetDrawLayer("OVERLAY")
for i = 1, NUM_PET_STABLE_SLOTS do
S:HandleItemButton(_G["PetStableStabledPet"..i], true)
_G["PetStableStabledPet"..i.."IconTexture"]:SetDrawLayer("OVERLAY")
end
PetStablePetInfo:GetRegions():SetTexCoord(0.04, 0.15, 0.06, 0.30)
PetStablePetInfo:SetFrameLevel(PetModelFrame:GetFrameLevel() + 2)
E:CreateBackdrop(PetStablePetInfo, "Default")
PetStablePetInfo:SetWidth(24)
PetStablePetInfo:SetHeight(24)
hooksecurefunc("PetStable_Update", function()
local happiness = GetPetHappiness()
local hasPetUI, isHunterPet = HasPetUI()
if UnitExists("pet") and hasPetUI and not isHunterPet then
return
end
local texture = PetStablePetInfo:GetRegions()
if happiness == 1 then
texture:SetTexCoord(0.41, 0.53, 0.06, 0.30)
elseif happiness == 2 then
texture:SetTexCoord(0.22, 0.345, 0.06, 0.30)
elseif happiness == 3 then
texture:SetTexCoord(0.04, 0.15, 0.06, 0.30)
end
end)
end
S:AddCallback("Stable", LoadSkin)
+57
View File
@@ -0,0 +1,57 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.tabard ~= true then return end
E:StripTextures(TabardFrame)
E:Kill(TabardFramePortrait)
E:CreateBackdrop(TabardFrame, "Transparent")
TabardFrame.backdrop:SetPoint("TOPLEFT", 10, -12)
TabardFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 74)
E:CreateBackdrop(TabardModel, "Default")
S:HandleButton(TabardFrameCancelButton)
S:HandleButton(TabardFrameAcceptButton)
S:HandleCloseButton(TabardFrameCloseButton)
S:HandleRotateButton(TabardCharacterModelRotateLeftButton)
S:HandleRotateButton(TabardCharacterModelRotateRightButton)
E:StripTextures(TabardFrameCostFrame)
E:StripTextures(TabardFrameCustomizationFrame)
for i = 1, 5 do
local custom = "TabardFrameCustomization"..i
E:StripTextures(_G[custom])
S:HandleNextPrevButton(_G[custom.."LeftButton"])
S:HandleNextPrevButton(_G[custom.."RightButton"])
if(i > 1) then
_G[custom]:ClearAllPoints()
_G[custom]:SetPoint("TOP", _G["TabardFrameCustomization"..i-1], "BOTTOM", 0, -6)
else
local point, anchor, point2, x, y = _G[custom]:GetPoint()
_G[custom]:SetPoint(point, anchor, point2, x, y+4)
end
end
TabardCharacterModelRotateLeftButton:SetPoint("BOTTOMLEFT", 4, 4)
TabardCharacterModelRotateRightButton:SetPoint("TOPLEFT", TabardCharacterModelRotateLeftButton, "TOPRIGHT", 4, 0)
hooksecurefunc(TabardCharacterModelRotateLeftButton, "SetPoint", function(self, point, _, _, xOffset, yOffset)
if point ~= "BOTTOMLEFT" or xOffset ~= 4 or yOffset ~= 4 then
self:SetPoint("BOTTOMLEFT", 4, 4)
end
end)
hooksecurefunc(TabardCharacterModelRotateRightButton, "SetPoint", function(self, point, _, _, xOffset, yOffset)
if point ~= "TOPLEFT" or xOffset ~= 4 or yOffset ~= 0 then
self:SetPoint("TOPLEFT", TabardCharacterModelRotateLeftButton, "TOPRIGHT", 4, 0)
end
end)
end
S:AddCallback("Tabard", LoadSkin)
+58
View File
@@ -0,0 +1,58 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.talent ~= true then return end
E:StripTextures(TalentFrame)
E:CreateBackdrop(TalentFrame, "Transparent")
TalentFrame.backdrop:SetPoint("TOPLEFT", 13, -12)
TalentFrame.backdrop:SetPoint("BOTTOMRIGHT", -31, 76)
TalentFramePortrait:Hide()
S:HandleCloseButton(TalentFrameCloseButton)
E:Kill(TalentFrameCancelButton)
for i = 1, 5 do
S:HandleTab(_G["TalentFrameTab"..i])
end
E:StripTextures(TalentFrameScrollFrame)
E:CreateBackdrop(TalentFrameScrollFrame, "Default")
TalentFrameScrollFrame.backdrop:SetPoint("TOPLEFT", -1, 2)
TalentFrameScrollFrame.backdrop:SetPoint("BOTTOMRIGHT", 6, -2)
S:HandleScrollBar(TalentFrameScrollFrameScrollBar)
TalentFrameScrollFrameScrollBar:SetPoint("TOPLEFT", TalentFrameScrollFrame, "TOPRIGHT", 10, -16)
TalentFrameSpentPoints:SetPoint("TOP", 0, -42)
TalentFrameTalentPointsText:SetPoint("BOTTOMRIGHT", TalentFrame, "BOTTOMLEFT", 220, 84)
for i = 1, MAX_NUM_TALENTS do
local talent = _G["TalentFrameTalent"..i]
local icon = _G["TalentFrameTalent"..i.."IconTexture"]
local rank = _G["TalentFrameTalent"..i.."Rank"]
if talent then
E:StripTextures(talent)
E:SetTemplate(talent, "Default")
E:StyleButton(talent)
E:SetInside(icon)
icon:SetTexCoord(unpack(E.TexCoords))
icon:SetDrawLayer("ARTWORK")
rank:SetFont(E.LSM:Fetch("font", E.db["general"].font), 12, "OUTLINE")
end
end
end
S:AddCallbackForAddon("Blizzard_TalentUI", "Talent", LoadSkin)
+20
View File
@@ -0,0 +1,20 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.taxi ~= true then return end
E:CreateBackdrop(TaxiFrame, "Transparent")
TaxiFrame.backdrop:SetPoint("TOPLEFT", 11, -12)
TaxiFrame.backdrop:SetPoint("BOTTOMRIGHT", -34, 75)
E:StripTextures(TaxiFrame)
E:Kill(TaxiPortrait)
S:HandleCloseButton(TaxiCloseButton)
E:CreateBackdrop(TaxiRouteMap, "Default")
end
S:AddCallback("Taxi", LoadSkin)
+51
View File
@@ -0,0 +1,51 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
local TT = E:GetModule("Tooltip");
--Cache global variables
--Lua functions
local _G = _G
local pairs = pairs
--WoW API / Variables
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.tooltip ~= true then return end
S:HandleCloseButton(ItemRefCloseButton)
local GameTooltip = _G["GameTooltip"]
local GameTooltipStatusBar = _G["GameTooltipStatusBar"]
local tooltips = {
GameTooltip,
ItemRefTooltip,
ItemRefShoppingTooltip1,
ItemRefShoppingTooltip2,
ItemRefShoppingTooltip3,
AutoCompleteBox,
FriendsTooltip,
ConsolidatedBuffsTooltip,
ShoppingTooltip1,
ShoppingTooltip2,
ShoppingTooltip3,
WorldMapTooltip,
WorldMapCompareTooltip1,
WorldMapCompareTooltip2,
WorldMapCompareTooltip3
}
for _, tt in pairs(tooltips) do
TT:SecureHookScript(tt, "OnShow", "SetStyle")
end
GameTooltipStatusBar:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(GameTooltipStatusBar)
E:CreateBackdrop(GameTooltipStatusBar, "Transparent")
GameTooltipStatusBar:ClearAllPoints()
GameTooltipStatusBar:SetPoint("TOPLEFT", GameTooltip, "BOTTOMLEFT", E.Border, -(E.Spacing * 3))
GameTooltipStatusBar:SetPoint("TOPRIGHT", GameTooltip, "BOTTOMRIGHT", -E.Border, -(E.Spacing * 3))
TT:SecureHookScript(GameTooltip, "OnSizeChanged", "CheckBackdropColor")
TT:SecureHookScript(GameTooltip, "OnUpdate", "CheckBackdropColor")
TT:RegisterEvent("CURSOR_UPDATE", "CheckBackdropColor")
end
S:AddCallback("SkinTooltip", LoadSkin)
+125
View File
@@ -0,0 +1,125 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
--WoW API / Variables
local GetItemQualityColor = GetItemQualityColor
local GetTradePlayerItemInfo = GetTradePlayerItemInfo
local GetTradeTargetItemInfo = GetTradeTargetItemInfo
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.trade ~= true then return end
E:StripTextures(TradeFrame, true)
TradeFrame:SetWidth(400)
E:CreateBackdrop(TradeFrame, "Transparent")
TradeFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
TradeFrame.backdrop:SetPoint("BOTTOMRIGHT", -28, 48)
S:HandleCloseButton(TradeFrameCloseButton, TradeFrame.backdrop)
S:HandleEditBox(TradePlayerInputMoneyFrameGold)
S:HandleEditBox(TradePlayerInputMoneyFrameSilver)
S:HandleEditBox(TradePlayerInputMoneyFrameCopper)
for i = 1, MAX_TRADE_ITEMS do
local player = _G["TradePlayerItem"..i]
local recipient = _G["TradeRecipientItem"..i]
local playerButton = _G["TradePlayerItem"..i.."ItemButton"]
local playerButtonIcon = _G["TradePlayerItem"..i.."ItemButtonIconTexture"]
local recipientButton = _G["TradeRecipientItem"..i.."ItemButton"]
local recipientButtonIcon = _G["TradeRecipientItem"..i.."ItemButtonIconTexture"]
local playerNameFrame = _G["TradePlayerItem"..i.."NameFrame"]
local recipientNameFrame = _G["TradeRecipientItem"..i.."NameFrame"]
E:StripTextures(player)
E:StripTextures(recipient)
E:StripTextures(playerButton)
E:StyleButton(playerButton)
E:SetTemplate(playerButton, "Default", true)
E:SetInside(playerButtonIcon)
playerButtonIcon:SetTexCoord(unpack(E.TexCoords))
E:StripTextures(recipientButton)
E:StyleButton(recipientButton)
E:SetTemplate(recipientButton, "Default", true)
E:SetInside(recipientButtonIcon)
recipientButtonIcon:SetTexCoord(unpack(E.TexCoords))
playerButton.bg = CreateFrame("Frame", nil, playerButton)
E:SetTemplate(playerButton.bg, "Default")
playerButton.bg:SetPoint("TOPLEFT", playerButton, "TOPRIGHT", 4, 0)
playerButton.bg:SetPoint("BOTTOMRIGHT", playerNameFrame, "BOTTOMRIGHT", -5, 14)
playerButton.bg:SetFrameLevel(playerButton:GetFrameLevel() - 4)
recipientButton.bg = CreateFrame("Frame", nil, recipientButton)
E:SetTemplate(recipientButton.bg, "Default")
recipientButton.bg:SetPoint("TOPLEFT", recipientButton, "TOPRIGHT", 4, 0)
recipientButton.bg:SetPoint("BOTTOMRIGHT", recipientNameFrame, "BOTTOMRIGHT", -5, 14)
recipientButton.bg:SetFrameLevel(recipientButton:GetFrameLevel() - 4)
end
TradePlayerItem1:SetPoint("TOPLEFT", 24, -104)
TradeHighlightPlayerTop:SetTexture(0, 1, 0, 0.2)
TradeHighlightPlayerBottom:SetTexture(0, 1, 0, 0.2)
TradeHighlightPlayerMiddle:SetTexture(0, 1, 0, 0.2)
TradeHighlightPlayerEnchantTop:SetTexture(0, 1, 0, 0.2)
TradeHighlightPlayerEnchantBottom:SetTexture(0, 1, 0, 0.2)
TradeHighlightPlayerEnchantMiddle:SetTexture(0, 1, 0, 0.2)
TradeHighlightRecipientTop:SetTexture(0, 1, 0, 0.2)
TradeHighlightRecipientBottom:SetTexture(0, 1, 0, 0.2)
TradeHighlightRecipientMiddle:SetTexture(0, 1, 0, 0.2)
TradeHighlightRecipientEnchantTop:SetTexture(0, 1, 0, 0.2)
TradeHighlightRecipientEnchantBottom:SetTexture(0, 1, 0, 0.2)
TradeHighlightRecipientEnchantMiddle:SetTexture(0, 1, 0, 0.2)
S:HandleButton(TradeFrameTradeButton)
TradeFrameTradeButton:SetPoint("BOTTOMRIGHT", -120, 55)
S:HandleButton(TradeFrameCancelButton)
hooksecurefunc("TradeFrame_UpdatePlayerItem", function(id)
local tradeItemButton = _G["TradePlayerItem"..id.."ItemButton"]
local tradeItemName = _G["TradePlayerItem"..id.."Name"]
local name = GetTradePlayerItemInfo(id)
if name then
local _, _, _, quality = GetTradePlayerItemInfo(id)
tradeItemName:SetTextColor(GetItemQualityColor(quality))
if quality then
tradeItemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
end
else
tradeItemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end)
hooksecurefunc("TradeFrame_UpdateTargetItem", function(id)
local tradeItemButton = _G["TradeRecipientItem"..id.."ItemButton"]
local tradeItemName = _G["TradeRecipientItem"..id.."Name"]
local name = GetTradeTargetItemInfo(id)
if name then
local _, _, _, quality = GetTradeTargetItemInfo(id)
tradeItemName:SetTextColor(GetItemQualityColor(quality))
if quality then
tradeItemButton:SetBackdropBorderColor(GetItemQualityColor(quality))
end
else
tradeItemButton:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end)
end
S:AddCallback("Trade", LoadSkin)
+182
View File
@@ -0,0 +1,182 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local find, match, split = string.find, string.match, string.split
--WoW API / Variables
local GetItemInfo = GetItemInfo
local GetItemQualityColor = GetItemQualityColor
local GetTradeSkillItemLink = GetTradeSkillItemLink
local GetTradeSkillReagentInfo = GetTradeSkillReagentInfo
local GetTradeSkillReagentItemLink = GetTradeSkillReagentItemLink
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.tradeskill ~= true then return end
E:StripTextures(TradeSkillFrame, true)
E:CreateBackdrop(TradeSkillFrame, "Transparent")
TradeSkillFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
TradeSkillFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 74)
E:StripTextures(TradeSkillRankFrameBorder)
TradeSkillRankFrame:SetWidth(322)
TradeSkillRankFrame:SetHeight(16)
TradeSkillRankFrame:ClearAllPoints()
TradeSkillRankFrame:SetPoint("TOP", -10, -45)
E:CreateBackdrop(TradeSkillRankFrame)
TradeSkillRankFrame:SetStatusBarTexture(E["media"].normTex)
TradeSkillRankFrame:SetStatusBarColor(0.13, 0.35, 0.80)
E:RegisterStatusBar(TradeSkillRankFrame)
E:StripTextures(TradeSkillExpandButtonFrame)
TradeSkillCollapseAllButton:SetNormalTexture("")
TradeSkillCollapseAllButton.SetNormalTexture = E.noop
TradeSkillCollapseAllButton:SetHighlightTexture("")
TradeSkillCollapseAllButton.SetHighlightTexture = E.noop
TradeSkillCollapseAllButton:SetDisabledTexture("")
TradeSkillCollapseAllButton.SetDisabledTexture = E.noop
TradeSkillCollapseAllButton.Text = TradeSkillCollapseAllButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(TradeSkillCollapseAllButton.Text, nil, 22)
TradeSkillCollapseAllButton.Text:SetPoint("LEFT", 3, 0)
TradeSkillCollapseAllButton.Text:SetText("+")
hooksecurefunc(TradeSkillCollapseAllButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
else
self.Text:SetText("+")
end
end)
S:HandleDropDownBox(TradeSkillInvSlotDropDown, 140)
TradeSkillSubClassDropDown:ClearAllPoints()
TradeSkillInvSlotDropDown:SetPoint("TOPRIGHT", TradeSkillFrame, "TOPRIGHT", -32, -68)
S:HandleDropDownBox(TradeSkillSubClassDropDown, 140)
TradeSkillSubClassDropDown:ClearAllPoints()
TradeSkillSubClassDropDown:SetPoint("RIGHT", TradeSkillInvSlotDropDown, "RIGHT", -120, 0)
TradeSkillFrameTitleText:ClearAllPoints()
TradeSkillFrameTitleText:SetPoint("TOP", TradeSkillFrame, "TOP", 0, -18)
for i = 1, TRADE_SKILLS_DISPLAYED do
local skillButton = _G["TradeSkillSkill"..i]
skillButton:SetNormalTexture("")
skillButton.SetNormalTexture = E.noop
_G["TradeSkillSkill"..i.."Highlight"]:SetTexture("")
_G["TradeSkillSkill"..i.."Highlight"].SetTexture = E.noop
skillButton.Text = skillButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(skillButton.Text, nil, 22)
skillButton.Text:SetPoint("LEFT", 3, 0)
skillButton.Text:SetText("+")
hooksecurefunc(skillButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
elseif find(texture, "PlusButton") then
self.Text:SetText("+")
else
self.Text:SetText("")
end
end)
end
E:StripTextures(TradeSkillDetailScrollFrame)
E:StripTextures(TradeSkillListScrollFrame)
E:StripTextures(TradeSkillDetailScrollChildFrame)
S:HandleScrollBar(TradeSkillListScrollFrameScrollBar)
S:HandleScrollBar(TradeSkillDetailScrollFrameScrollBar)
E:StyleButton(TradeSkillSkillIcon, nil, true)
E:SetTemplate(TradeSkillSkillIcon, "Default")
for i = 1, MAX_TRADE_SKILL_REAGENTS do
local reagent = _G["TradeSkillReagent"..i]
local icon = _G["TradeSkillReagent"..i.."IconTexture"]
local count = _G["TradeSkillReagent"..i.."Count"]
local nameFrame = _G["TradeSkillReagent"..i.."NameFrame"]
icon:SetTexCoord(unpack(E.TexCoords))
icon:SetDrawLayer("OVERLAY")
icon.backdrop = CreateFrame("Frame", nil, reagent)
icon.backdrop:SetFrameLevel(reagent:GetFrameLevel() - 1)
E:SetTemplate(icon.backdrop, "Default")
E:SetOutside(icon.backdrop, icon)
icon:SetParent(icon.backdrop)
count:SetParent(icon.backdrop)
count:SetDrawLayer("OVERLAY")
E:Kill(nameFrame)
end
S:HandleButton(TradeSkillCancelButton)
S:HandleButton(TradeSkillCreateButton)
S:HandleButton(TradeSkillCreateAllButton)
S:HandleNextPrevButton(TradeSkillDecrementButton)
TradeSkillInputBox:SetHeight(16)
S:HandleEditBox(TradeSkillInputBox)
S:HandleNextPrevButton(TradeSkillIncrementButton)
S:HandleCloseButton(TradeSkillFrameCloseButton)
hooksecurefunc("TradeSkillFrame_SetSelection", function(id)
E:SetTemplate(TradeSkillSkillIcon, "Default", true)
E:StyleButton(TradeSkillSkillIcon, nil, true)
if TradeSkillSkillIcon:GetNormalTexture() then
TradeSkillSkillIcon:GetNormalTexture():SetTexCoord(unpack(E.TexCoords))
E:SetInside(TradeSkillSkillIcon:GetNormalTexture())
end
TradeSkillSkillIcon:SetWidth(40)
TradeSkillSkillIcon:SetHeight(40)
TradeSkillSkillIcon:SetPoint("TOPLEFT", 2, -3)
local skillLink = GetTradeSkillItemLink(id)
if skillLink then
local _, _, quality = GetItemInfo(match(skillLink, "item:(%d+)"))
if quality then
TradeSkillSkillIcon:SetBackdropBorderColor(GetItemQualityColor(quality))
TradeSkillSkillName:SetTextColor(GetItemQualityColor(quality))
else
TradeSkillSkillIcon:SetBackdropBorderColor(unpack(E["media"].bordercolor))
TradeSkillSkillName:SetTextColor(1, 1, 1)
end
end
local numReagents = GetTradeSkillNumReagents(id)
for i = 1, numReagents, 1 do
local _, _, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i)
local reagentLink = GetTradeSkillReagentItemLink(id, i)
local icon = _G["TradeSkillReagent"..i.."IconTexture"]
local name = _G["TradeSkillReagent"..i.."Name"]
if reagentLink then
local _, _, quality = GetItemInfo(match(reagentLink, "item:(%d+)"))
if quality then
icon.backdrop:SetBackdropBorderColor(GetItemQualityColor(quality))
if playerReagentCount < reagentCount then
name:SetTextColor(0.5, 0.5, 0.5)
else
name:SetTextColor(GetItemQualityColor(quality))
end
else
icon.backdrop:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
end
end
end)
end
S:AddCallbackForAddon("Blizzard_TradeSkillUI", "TradeSkill", LoadSkin)
+94
View File
@@ -0,0 +1,94 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local find = string.find
--WoW API / Variables
local hooksecurefunc = hooksecurefunc
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.trainer ~= true then return end
E:CreateBackdrop(ClassTrainerFrame, "Transparent")
ClassTrainerFrame.backdrop:SetPoint("TOPLEFT", 10, -11)
ClassTrainerFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 74)
E:StripTextures(ClassTrainerFrame, true)
E:StripTextures(ClassTrainerExpandButtonFrame)
S:HandleDropDownBox(ClassTrainerFrameFilterDropDown)
ClassTrainerFrameFilterDropDown:SetPoint("TOPRIGHT", -40, -64)
E:StripTextures(ClassTrainerListScrollFrame)
S:HandleScrollBar(ClassTrainerListScrollFrameScrollBar)
E:StripTextures(ClassTrainerDetailScrollFrame)
S:HandleScrollBar(ClassTrainerDetailScrollFrameScrollBar)
E:StripTextures(ClassTrainerSkillIcon)
S:HandleButton(ClassTrainerTrainButton)
S:HandleButton(ClassTrainerCancelButton)
S:HandleCloseButton(ClassTrainerFrameCloseButton)
hooksecurefunc("ClassTrainer_SetSelection", function()
local skillIcon = ClassTrainerSkillIcon:GetNormalTexture()
if skillIcon then
E:SetInside(skillIcon)
skillIcon:SetTexCoord(unpack(E.TexCoords))
E:SetTemplate(ClassTrainerSkillIcon, "Default")
end
end)
for i = 1, CLASS_TRAINER_SKILLS_DISPLAYED do
local skillButton = _G["ClassTrainerSkill"..i]
skillButton:SetNormalTexture("")
skillButton.SetNormalTexture = E.noop
_G["ClassTrainerSkill"..i.."Highlight"]:SetTexture("")
_G["ClassTrainerSkill"..i.."Highlight"].SetTexture = E.noop
skillButton.Text = skillButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(skillButton.Text, nil, 22)
skillButton.Text:SetPoint("LEFT", 3, 0)
skillButton.Text:SetText("+")
hooksecurefunc(skillButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
elseif find(texture, "PlusButton") then
self.Text:SetText("+")
else
self.Text:SetText("")
end
end)
end
ClassTrainerCollapseAllButton:SetNormalTexture("")
ClassTrainerCollapseAllButton.SetNormalTexture = E.noop
ClassTrainerCollapseAllButton:SetHighlightTexture("")
ClassTrainerCollapseAllButton.SetHighlightTexture = E.noop
ClassTrainerCollapseAllButton:SetDisabledTexture("")
ClassTrainerCollapseAllButton.SetDisabledTexture = E.noop
ClassTrainerCollapseAllButton.Text = ClassTrainerCollapseAllButton:CreateFontString(nil, "OVERLAY")
E:FontTemplate(ClassTrainerCollapseAllButton.Text, nil, 22)
ClassTrainerCollapseAllButton.Text:SetPoint("LEFT", 3, 0)
ClassTrainerCollapseAllButton.Text:SetText("+")
hooksecurefunc(ClassTrainerCollapseAllButton, "SetNormalTexture", function(self, texture)
if find(texture, "MinusButton") then
self.Text:SetText("-")
else
self.Text:SetText("+")
end
end)
end
S:AddCallbackForAddon("Blizzard_TrainerUI", "Trainer", LoadSkin)
+33
View File
@@ -0,0 +1,33 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local MAX_TUTORIAL_ALERTS = MAX_TUTORIAL_ALERTS
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.tutorial ~= true then return end
for i = 1, MAX_TUTORIAL_ALERTS do
local button = _G["TutorialFrameAlertButton"..i]
local icon = button:GetNormalTexture()
button:SetWidth(35)
button:SetHeight(45)
E:SetTemplate(button, "Default", true)
E:StyleButton(button, nil, true)
E:SetInside(icon)
icon:SetTexCoord(0.09, 0.40, 0.11, 0.56)
end
E:SetTemplate(TutorialFrame, "Transparent")
S:HandleCheckBox(TutorialFrameCheckButton)
S:HandleButton(TutorialFrameOkayButton)
end
S:AddCallback("Tutorial", LoadSkin)
+23
View File
@@ -0,0 +1,23 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule("Skins");
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.worldmap ~= true then return end
E:StripTextures(WorldMapFrame)
E:CreateBackdrop(WorldMapPositioningGuide, "Transparent")
S:HandleDropDownBox(WorldMapContinentDropDown, 170)
S:HandleDropDownBox(WorldMapZoneDropDown, 170)
WorldMapZoneDropDown:SetPoint("LEFT", WorldMapContinentDropDown, "RIGHT", -24, 0)
WorldMapZoomOutButton:SetPoint("LEFT", WorldMapZoneDropDown, "RIGHT", -4, 3)
S:HandleButton(WorldMapZoomOutButton)
S:HandleCloseButton(WorldMapFrameCloseButton)
E:CreateBackdrop(WorldMapDetailFrame, "Default")
end
S:AddCallback("SkinWorldMap", LoadSkin)
+5
View File
@@ -0,0 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Skins.lua"/>
<Include file="Addons\Load_Addons.xml"/>
<Include file="Blizzard\Load_Blizzard.xml"/>
</Ui>
+602
View File
@@ -0,0 +1,602 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:NewModule("Skins", "AceHook-3.0", "AceEvent-3.0");
--Cache global variables
--Lua functions
local _G = _G
local unpack, assert, pairs, ipairs, type, pcall = unpack, assert, pairs, ipairs, type, pcall
local tinsert, wipe = table.insert, table.wipe
local find, gfind, lower = string.find, string.gfind, string.lower
--WoW API / Variables
local CreateFrame = CreateFrame
local SetDesaturation = SetDesaturation
local hooksecurefunc = hooksecurefunc
local IsAddOnLoaded = IsAddOnLoaded
local GetCVarBool = GetCVarBool
E.Skins = S
S.addonsToLoad = {}
S.nonAddonsToLoad = {}
S.allowBypass = {}
S.addonCallbacks = {}
S.nonAddonCallbacks = {["CallPriority"] = {}}
S.SQUARE_BUTTON_TEXCOORDS = {
["UP"] = { 0.45312500, 0.64062500, 0.01562500, 0.20312500};
["DOWN"] = { 0.45312500, 0.64062500, 0.20312500, 0.01562500};
["LEFT"] = { 0.23437500, 0.42187500, 0.01562500, 0.20312500};
["RIGHT"] = { 0.42187500, 0.23437500, 0.01562500, 0.20312500};
["DELETE"] = { 0.01562500, 0.20312500, 0.01562500, 0.20312500}
}
function S:SquareButton_SetIcon(self, name)
local coords = S.SQUARE_BUTTON_TEXCOORDS[strupper(name)]
if coords then
self.icon:SetTexCoord(coords[1], coords[2], coords[3], coords[4])
end
end
function S:SetModifiedBackdrop()
if this.backdrop then this = this.backdrop end
this:SetBackdropBorderColor(unpack(E["media"].rgbvaluecolor))
end
function S:SetOriginalBackdrop()
if this.backdrop then this = this.backdrop end
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
function S:HandleButton(f, strip)
local name = f:GetName()
if name then
local left = _G[name .."Left"]
local middle = _G[name .."Middle"]
local right = _G[name .."Right"]
if left then E:Kill(left) end
if middle then E:Kill(middle) end
if right then E:Kill(right) end
end
if f.Left then E:Kill(f.Left) end
if f.Middle then E:Kill(f.Middle) end
if f.Right then E:Kill(f.Right) end
if f.SetNormalTexture then f:SetNormalTexture("") end
if f.SetHighlightTexture then f:SetHighlightTexture("") end
if f.SetPushedTexture then f:SetPushedTexture("") end
if f.SetDisabledTexture then f:SetDisabledTexture("") end
if strip then E:StripTextures(f) end
E:SetTemplate(f, "Default", true)
HookScript(f, "OnEnter", S.SetModifiedBackdrop)
HookScript(f, "OnLeave", S.SetOriginalBackdrop)
end
function S:HandleScrollBar(frame, thumbTrim)
local name = frame:GetName()
if _G[name.."BG"] then _G[name.."BG"]:SetTexture(nil) end
if _G[name.."Track"] then _G[name.."Track"]:SetTexture(nil) end
if _G[name.."Top"] then _G[name.."Top"]:SetTexture(nil) end
if _G[name.."Bottom"] then _G[name.."Bottom"]:SetTexture(nil) end
if _G[name.."Middle"] then _G[name.."Middle"]:SetTexture(nil) end
if _G[name.."ScrollUpButton"] and _G[name.."ScrollDownButton"] then
E:StripTextures(_G[name.."ScrollUpButton"])
if not _G[name.."ScrollUpButton"].icon then
S:HandleNextPrevButton(_G[name.."ScrollUpButton"])
S:SquareButton_SetIcon(_G[name.."ScrollUpButton"], "UP")
_G[name.."ScrollUpButton"]:SetWidth(_G[name.."ScrollUpButton"]:GetWidth() + 7)
_G[name.."ScrollUpButton"]:SetHeight(_G[name.."ScrollUpButton"]:GetHeight() + 7)
end
E:StripTextures(_G[name .."ScrollDownButton"])
if not _G[name.."ScrollDownButton"].icon then
S:HandleNextPrevButton(_G[name.."ScrollDownButton"])
S:SquareButton_SetIcon(_G[name.."ScrollDownButton"], "DOWN")
_G[name.."ScrollDownButton"]:SetWidth(_G[name.."ScrollDownButton"]:GetWidth() + 7)
_G[name.."ScrollDownButton"]:SetHeight(_G[name.."ScrollDownButton"]:GetHeight() + 7)
end
if not frame.trackbg then
frame.trackbg = CreateFrame("Frame", nil, frame)
frame.trackbg:SetPoint("TOPLEFT", _G[name .."ScrollUpButton"], "BOTTOMLEFT", 0, -1)
frame.trackbg:SetPoint("BOTTOMRIGHT", _G[name .."ScrollDownButton"], "TOPRIGHT", 0, 1)
E:SetTemplate(frame.trackbg, "Transparent")
end
if frame:GetThumbTexture() then
if not thumbTrim then thumbTrim = 3 end
frame:GetThumbTexture():SetTexture(nil)
if not frame.thumbbg then
frame.thumbbg = CreateFrame("Frame", nil, frame)
frame:GetThumbTexture():SetHeight(24)
frame.thumbbg:SetPoint("TOPLEFT", frame:GetThumbTexture(), "TOPLEFT", 1, -thumbTrim)
frame.thumbbg:SetPoint("BOTTOMRIGHT", frame:GetThumbTexture(), "BOTTOMRIGHT", -1, thumbTrim)
E:SetTemplate(frame.thumbbg, "Default", true, true)
frame.thumbbg:SetBackdropColor(0.6, 0.6, 0.6)
if frame.trackbg then
frame.thumbbg:SetFrameLevel(frame.trackbg:GetFrameLevel() + 1)
end
end
end
end
end
local tabs = {
"LeftDisabled",
"MiddleDisabled",
"RightDisabled",
"Left",
"Middle",
"Right"
}
function S:HandleTab(tab)
local name = tab:GetName()
for _, object in pairs(tabs) do
local tex = _G[name..object]
if tex then
tex:SetTexture(nil)
end
end
if tab.GetHighlightTexture and tab:GetHighlightTexture() then
tab:GetHighlightTexture():SetTexture(nil)
else
E:StripTextures(tab)
end
tab.backdrop = CreateFrame("Frame", nil, tab)
E:SetTemplate(tab.backdrop, "Default")
tab.backdrop:SetFrameLevel(tab:GetFrameLevel() - 1)
tab.backdrop:SetPoint("TOPLEFT", 10, E.PixelMode and -1 or -3)
tab.backdrop:SetPoint("BOTTOMRIGHT", -10, 3)
end
function S:HandleNextPrevButton(btn, buttonOverride)
local inverseDirection = btn:GetName() and (find(lower(btn:GetName()), "left") or find(lower(btn:GetName()), "prev") or find(lower(btn:GetName()), "decrement") or find(lower(btn:GetName()), "promote"))
E:StripTextures(btn)
btn:SetNormalTexture(nil)
btn:SetPushedTexture(nil)
btn:SetHighlightTexture(nil)
btn:SetDisabledTexture(nil)
if not btn.icon then
btn.icon = btn:CreateTexture(nil, "ARTWORK")
btn.icon:SetWidth(13)
btn.icon:SetHeight(13)
btn.icon:SetPoint("CENTER", 0, 0)
btn.icon:SetTexture("Interface\\AddOns\\ElvUI\\Media\\Textures\\SquareButtonTextures.blp")
btn.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
btn:SetScript("OnMouseDown", function()
if btn:IsEnabled() == 1 then
this.icon:SetPoint("CENTER", -1, -1)
end
end)
btn:SetScript("OnMouseUp", function()
this.icon:SetPoint("CENTER", 0, 0)
end)
hooksecurefunc(btn, "Disable", function(self)
SetDesaturation(self.icon, true)
self.icon:SetAlpha(0.5)
end)
hooksecurefunc(btn, "Enable", function(self)
SetDesaturation(self.icon, false)
self.icon:SetAlpha(1.0)
end)
if btn:IsEnabled() == 0 then
SetDesaturation(btn.icon, true)
btn.icon:SetAlpha(0.5)
end
end
if buttonOverride then
if inverseDirection then
S:SquareButton_SetIcon(btn, "UP")
else
S:SquareButton_SetIcon(btn, "DOWN")
end
else
if inverseDirection then
S:SquareButton_SetIcon(btn, "LEFT")
else
S:SquareButton_SetIcon(btn, "RIGHT")
end
end
S:HandleButton(btn)
btn:SetWidth(btn:GetWidth() - 7)
btn:SetHeight(btn:GetHeight() - 7)
end
function S:HandleRotateButton(btn)
E:SetTemplate(btn, "Default")
btn:SetWidth(btn:GetWidth() - 14)
btn:SetHeight(btn:GetHeight() - 14)
btn:GetNormalTexture():SetTexCoord(0.27, 0.73, 0.27, 0.68)
btn:GetPushedTexture():SetTexCoord(0.27, 0.73, 0.27, 0.68)
btn:GetHighlightTexture():SetTexture(1, 1, 1, 0.3)
E:SetInside(btn:GetNormalTexture())
btn:GetPushedTexture():SetAllPoints(btn:GetNormalTexture())
btn:GetHighlightTexture():SetAllPoints(btn:GetNormalTexture())
end
function S:HandleEditBox(frame)
if not frame then return end
E:CreateBackdrop(frame, "Default")
frame.backdrop:SetFrameLevel(frame:GetFrameLevel())
if frame:GetName() then
if _G[frame:GetName() .."Left"] then E:Kill(_G[frame:GetName() .."Left"]) end
if _G[frame:GetName() .."Middle"] then E:Kill(_G[frame:GetName() .."Middle"]) end
if _G[frame:GetName() .."Right"] then E:Kill(_G[frame:GetName() .."Right"]) end
if _G[frame:GetName() .."Mid"] then E:Kill(_G[frame:GetName() .."Mid"]) end
if gfind(frame:GetName(), "Silver") or gfind(frame:GetName(), "Copper") then
frame.backdrop:SetPoint("BOTTOMRIGHT", -12, -2)
end
end
end
function S:HandleDropDownBox(frame, width)
local button = _G[frame:GetName().."Button"]
if not button then return end
if not width then width = 155 end
E:StripTextures(frame)
frame:SetWidth(width)
if _G[frame:GetName().."Text"] then
_G[frame:GetName().."Text"]:ClearAllPoints()
_G[frame:GetName().."Text"]:SetPoint("RIGHT", button, "LEFT", -2, 0)
end
if button then
button:ClearAllPoints()
button:SetPoint("RIGHT", frame, "RIGHT", -10, 3)
self:HandleNextPrevButton(button, true)
end
E:CreateBackdrop(frame, "Default")
frame.backdrop:SetPoint("TOPLEFT", 20, -2)
frame.backdrop:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
frame.backdrop:SetFrameLevel(frame:GetFrameLevel())
end
function S:HandleCheckBox(frame, noBackdrop)
frame:SetNormalTexture(nil)
frame:SetPushedTexture(nil)
frame:SetHighlightTexture(nil)
frame:SetDisabledTexture(nil)
if noBackdrop then
E:SetTemplate(frame, "Default")
frame:SetWidth(16)
frame:SetHeight(16)
else
E:CreateBackdrop(frame, "Default")
E:SetInside(frame.backdrop, nil, 4, 4)
frame.backdrop:SetFrameLevel(frame:GetFrameLevel())
end
end
function S:HandleIcon(icon, parent)
parent = parent or icon:GetParent()
icon:SetTexCoord(unpack(E.TexCoords))
E:CreateBackdrop(parent, "Default")
icon:SetParent(parent.backdrop)
E:SetOutside(parent.backdrop, icon)
end
function S:HandleItemButton(b, shrinkIcon)
if b.isSkinned then return end
local icon = b.icon or b.IconTexture or b.iconTexture
local texture
if b:GetName() and _G[b:GetName() .."IconTexture"] then
icon = _G[b:GetName() .."IconTexture"]
elseif b:GetName() and _G[b:GetName() .."Icon"] then
icon = _G[b:GetName() .."Icon"]
end
if icon and icon:GetTexture() then
texture = icon:GetTexture()
end
E:StripTextures(b)
E:CreateBackdrop(b, "Default", true)
E:StyleButton(b)
if icon then
icon:SetTexCoord(unpack(E.TexCoords))
if shrinkIcon then
b.backdrop:SetAllPoints()
E:SetInside(icon, b)
else
E:SetOutside(b.backdrop, icon)
end
icon:SetParent(b.backdrop)
if texture then
icon:SetTexture(texture)
end
end
b.isSkinned = true
end
function S:HandleCloseButton(f, point, text)
E:StripTextures(f)
if f:GetNormalTexture() then f:SetNormalTexture("") f.SetNormalTexture = E.noop end
if f:GetPushedTexture() then f:SetPushedTexture("") f.SetPushedTexture = E.noop end
if not f.backdrop then
E:CreateBackdrop(f, "Default", true)
f.backdrop:SetPoint("TOPLEFT", 7, -8)
f.backdrop:SetPoint("BOTTOMRIGHT", -8, 8)
HookScript(f, "OnEnter", function() S:SetModifiedBackdrop(this) end)
HookScript(f, "OnLeave", function() S:SetOriginalBackdrop(this) end)
end
if not text then text = "x" end
if not f.text then
f.text = f:CreateFontString(nil, "OVERLAY")
f.text:SetFont([[Interface\AddOns\ElvUI\Media\Fonts\PT_Sans_Narrow.ttf]], 16, "OUTLINE")
f.text:SetText(text)
f.text:SetJustifyH("CENTER")
f.text:SetPoint("CENTER", f, "CENTER", -1, 1)
end
if point then
f:SetPoint("TOPRIGHT", point, "TOPRIGHT", 2, 2)
end
end
function S:HandleSliderFrame(frame)
local orientation = frame:GetOrientation()
local SIZE = 12
E:StripTextures(frame)
E:CreateBackdrop(frame, "Default")
frame.backdrop:SetAllPoints()
hooksecurefunc(frame, "SetBackdrop", function(_, backdrop)
if backdrop ~= nil then
frame:SetBackdrop(nil)
end
end)
frame:SetThumbTexture(E["media"].blankTex)
frame:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
frame:GetThumbTexture():SetWidth(SIZE-2)
frame:GetThumbTexture():SetHeight(SIZE-2)
if orientation == "VERTICAL" then
frame:SetWidth(SIZE)
else
frame:SetHeight(SIZE)
for _, region in ipairs({frame:GetRegions()}) do
if region and region:GetObjectType() == "FontString" then
local point, anchor, anchorPoint, x, y = region:GetPoint()
if find(anchorPoint, "BOTTOM") then
region:SetPoint(point, anchor, anchorPoint, x, y - 4)
end
end
end
--[[for i = 1, frame:GetNumRegions() do
local region = select(i, frame:GetRegions())
if region and region:GetObjectType() == "FontString" then
local point, anchor, anchorPoint, x, y = region:GetPoint()
if anchorPoint:find("BOTTOM") then
region:SetPoint(point, anchor, anchorPoint, x, y - 4)
end
end
end]]
end
end
function S:HandleIconSelectionFrame(frame, numIcons, buttonNameTemplate, frameNameOverride)
assert(frame, "HandleIconSelectionFrame: frame argument missing")
assert(numIcons and type(numIcons) == "number", "HandleIconSelectionFrame: numIcons argument missing or not a number")
assert(buttonNameTemplate and type(buttonNameTemplate) == "string", "HandleIconSelectionFrame: buttonNameTemplate argument missing or not a string")
local frameName = frameNameOverride or frame:GetName() --We need override in case Blizzard fucks up the naming (guild bank)
local scrollFrame = _G[frameName.."ScrollFrame"]
local editBox = _G[frameName.."EditBox"]
local okayButton = _G[frameName.."OkayButton"] or _G[frameName.."Okay"]
local cancelButton = _G[frameName.."CancelButton"] or _G[frameName.."Cancel"]
E:StripTextures(frame)
E:StripTextures(scrollFrame)
editBox:DisableDrawLayer("BACKGROUND") --Removes textures around it
E:CreateBackdrop(frame, "Transparent")
frame.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT", 10, -12)
frame.backdrop:SetPoint("BOTTOMRIGHT", cancelButton, "BOTTOMRIGHT", 5, -5)
S:HandleButton(okayButton)
S:HandleButton(cancelButton)
S:HandleEditBox(editBox)
for i = 1, numIcons do
local button = _G[buttonNameTemplate..i]
local icon = _G[button:GetName().."Icon"]
E:StripTextures(button)
E:SetTemplate(button, "Default")
E:StyleButton(button, nil, true)
E:SetInside(icon)
icon:SetTexCoord(unpack(E.TexCoords))
end
end
function S:ADDON_LOADED()
if self.allowBypass[arg1] then
if self.addonsToLoad[arg1] then
--Load addons using the old deprecated register method
self.addonsToLoad[arg1]()
self.addonsToLoad[arg1] = nil
elseif self.addonCallbacks[arg1] then
--Fire events to the skins that rely on this addon
for index, event in ipairs(self.addonCallbacks[arg1]["CallPriority"]) do
self.addonCallbacks[arg1][event] = nil
self.addonCallbacks[arg1]["CallPriority"][index] = nil
E.callbacks:Fire(event)
end
end
return
end
if not E.initialized then return end
if self.addonsToLoad[arg1] then
self.addonsToLoad[arg1]()
self.addonsToLoad[arg1] = nil
elseif self.addonCallbacks[arg1] then
for index, event in ipairs(self.addonCallbacks[arg1]["CallPriority"]) do
self.addonCallbacks[arg1][event] = nil
self.addonCallbacks[arg1]["CallPriority"][index] = nil
E.callbacks:Fire(event)
end
end
end
--Old deprecated register function. Keep it for the time being for any plugins that may need it.
function S:RegisterSkin(name, loadFunc, forceLoad, bypass)
if bypass then
self.allowBypass[name] = true
end
if forceLoad then
loadFunc()
self.addonsToLoad[name] = nil
elseif name == "ElvUI" then
tinsert(self.nonAddonsToLoad, loadFunc)
else
self.addonsToLoad[name] = loadFunc
end
end
--Add callback for skin that relies on another addon.
--These events will be fired when the addon is loaded.
function S:AddCallbackForAddon(addonName, eventName, loadFunc, forceLoad, bypass)
if not addonName or type(addonName) ~= "string" then
E:Print("Invalid argument #1 to S:AddCallbackForAddon (string expected)")
return
elseif not eventName or type(eventName) ~= "string" then
E:Print("Invalid argument #2 to S:AddCallbackForAddon (string expected)")
return
elseif not loadFunc or type(loadFunc) ~= "function" then
E:Print("Invalid argument #3 to S:AddCallbackForAddon (function expected)")
return
end
if bypass then
self.allowBypass[addonName] = true
end
--Create an event registry for this addon, so that we can fire multiple events when this addon is loaded
if not self.addonCallbacks[addonName] then
self.addonCallbacks[addonName] = {["CallPriority"] = {}}
end
if self.addonCallbacks[addonName][eventName] or E.ModuleCallbacks[eventName] or E.InitialModuleCallbacks[eventName] then
--Don't allow a registered callback to be overwritten
E:Print("Invalid argument #2 to S:AddCallbackForAddon (event name:", eventName, "is already registered, please use a unique event name)")
return
end
--Register loadFunc to be called when event is fired
E.RegisterCallback(E, eventName, loadFunc)
if forceLoad then
E.callbacks:Fire(eventName)
else
--Insert eventName in this addons' registry
self.addonCallbacks[addonName][eventName] = true
self.addonCallbacks[addonName]["CallPriority"][getn(self.addonCallbacks[addonName]["CallPriority"]) + 1] = eventName
end
end
--Add callback for skin that does not rely on a another addon.
--These events will be fired when the Skins module is initialized.
function S:AddCallback(eventName, loadFunc)
if not eventName or type(eventName) ~= "string" then
E:Print("Invalid argument #1 to S:AddCallback (string expected)")
return
elseif not loadFunc or type(loadFunc) ~= "function" then
E:Print("Invalid argument #2 to S:AddCallback (function expected)")
return
end
if self.nonAddonCallbacks[eventName] or E.ModuleCallbacks[eventName] or E.InitialModuleCallbacks[eventName] then
--Don't allow a registered callback to be overwritten
E:Print("Invalid argument #1 to S:AddCallback (event name:", eventName, "is already registered, please use a unique event name)")
return
end
--Add event name to registry
self.nonAddonCallbacks[eventName] = true
self.nonAddonCallbacks["CallPriority"][getn(self.nonAddonCallbacks["CallPriority"]) + 1] = eventName
--Register loadFunc to be called when event is fired
E.RegisterCallback(E, eventName, loadFunc)
end
function S:Initialize()
self.db = E.private.skins
--Fire events for Blizzard addons that are already loaded
for addon in pairs(self.addonCallbacks) do
if IsAddOnLoaded(addon) then
for index, event in ipairs(self.addonCallbacks[addon]["CallPriority"]) do
self.addonCallbacks[addon][event] = nil
self.addonCallbacks[addon]["CallPriority"][index] = nil
E.callbacks:Fire(event)
end
end
end
--Fire event for all skins that doesn't rely on a Blizzard addon
for index, event in ipairs(self.nonAddonCallbacks["CallPriority"]) do
self.nonAddonCallbacks[event] = nil
self.nonAddonCallbacks["CallPriority"][index] = nil
E.callbacks:Fire(event)
end
--Old deprecated load functions. We keep this for the time being in case plugins make use of it.
for addon, loadFunc in pairs(self.addonsToLoad) do
if IsAddOnLoaded(addon) then
self.addonsToLoad[addon] = nil
local _, catch = pcall(loadFunc)
if catch and GetCVarBool("ShowErrors") == "1" then
ScriptErrorsFrame_OnError(catch, false)
end
end
end
for _, loadFunc in pairs(self.nonAddonsToLoad) do
local _, catch = pcall(loadFunc)
if catch and GetCVarBool("ShowErrors") == "1" then
ScriptErrorsFrame_OnError(catch, false)
end
end
wipe(self.nonAddonsToLoad)
end
S:RegisterEvent("ADDON_LOADED")
local function InitializeCallback()
S:Initialize()
end
E:RegisterModule(S:GetName(), InitializeCallback)
+3
View File
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Tooltip.lua"/>
</Ui>

Some files were not shown because too many files have changed in this diff Show More