Merge branch 'auras-work' into dev

This commit is contained in:
Crum
2018-06-11 21:07:53 -05:00
76 changed files with 4189 additions and 2006 deletions
+29 -7
View File
@@ -10,17 +10,19 @@ local unpack = unpack
local find, format, gsub, lower, match, upper = string.find, string.format, string.gsub, string.lower, string.match, string.upper
local getn = table.getn
--WoW API
local GetInventoryItemTexture = GetInventoryItemTexture
local GetItemInfo = GetItemInfo
local GetQuestGreenRange = GetQuestGreenRange
local GetRealZoneText = GetRealZoneText
local IsInInstance = IsInInstance
local UnitBuff = UnitBuff
local UnitDebuff = UnitDebuff
--local UnitBuff = UnitBuff
--local UnitDebuff = UnitDebuff
local UnitLevel = UnitLevel
--WoW Variables
local DUNGEON_DIFFICULTY1 = DUNGEON_DIFFICULTY1
local TIMEMANAGER_AM = gsub(TIME_TWELVEHOURAM, "^.-(%w+)$", "%1")
local TIMEMANAGER_PM = gsub(TIME_TWELVEHOURPM, "^.-(%w+)$", "%1")
local DURABILITY_TEMPLATE = gsub(DURABILITY_TEMPLATE, "%%d / %%d", "(%%d+) / (%%d+)")
--Libs
local LBC = LibStub("LibBabble-Class-3.0"):GetLookupTable()
local LBZ = LibStub("LibBabble-Zone-3.0"):GetLookupTable()
@@ -145,11 +147,11 @@ function UnitAura(unit, i, filter)
end
if not filter or match(filter, "(HELPFUL)") then
local name, rank, aura, count, duration, maxDuration = UnitBuff(unit, i, filter)
return name, rank, aura, count, nil, duration or 0, maxDuration or 0
local texture, count = UnitBuff(unit, i, filter)
return texture, count
else
local name, rank, aura, count, dType, duration, maxDuration = UnitDebuff(unit, i, filter)
return name, rank, aura, count, dType, duration or 0, maxDuration or 0
local texture, count, dType = UnitDebuff(unit, i, filter)
return texture, count, dType
end
end
@@ -271,7 +273,7 @@ function GetPlayerFacing()
local obj = Minimap
for i = 1, obj:GetNumChildren() do
local child = select(i, obj:GetChildren())
if child and child.GetModel and child:GetModel() == "interface\\minimap\\minimaparrow.m2" then
if child and child.GetModel and child:GetModel() == "Interface\\Minimap\\MinimapArrow" then
arrow = child
break
end
@@ -472,4 +474,24 @@ function GetItemCount(itemName)
end
return count
end
local scan
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
+26
View File
@@ -0,0 +1,26 @@
--[[
Classy.lua
A wrapper for defining classes that inherit from widgets
--]]
local Classy = LibStub:NewLibrary('Classy-1.0', 0)
if not Classy then return end
function Classy:New(frameType, parentClass)
local class = CreateFrame(frameType)
class.mt = {__index = class}
if parentClass then
class = setmetatable(class, {__index = parentClass})
class.super = function(self, method, ...)
parentClass[method](self, unpack(arg))
end
end
class.Bind = function(self, obj)
return setmetatable(obj, self.mt)
end
return class
end
+268
View File
@@ -0,0 +1,268 @@
if not LibStub then return end
local SD = LibStub:GetLibrary('StateDriver-1.0')
if not SD then return end
local Parser = SD:New('Parser')
local IsMounted = IsMounted
local IsStealthed = IsStealthed
local GetShapeshiftForm = GetShapeshiftForm
local _G = getfenv(0)
local function IsInShapeshiftForm(index)
return GetShapeshiftForm() == tonumber(index)
end
function Parser:Initialize()
self.casting = nil
self.channel_spell = nil
self.channeling = nil
self:RegisterEvent('PLAYER_ENTERING_WORLD')
self:RegisterEvent('SPELLCAST_START')
self:RegisterEvent('SPELLCAST_CHANNEL_START')
self:RegisterEvent('SPELLCAST_STOP')
self:RegisterEvent('SPELLCAST_CHANNEL_STOP')
-- self:SetScript('OnEvent', function() self[event](self) end)
end
local _CastSpellByName
local Hooked_CastSpellByName = function(spell, unit)
if spell then
self.channel_spell = spell
_CastSpellByName(spell, unit)
end
end
local HOOKED = false
function Parser:PLAYER_ENTERING_WORLD()
if not HOOKED then
_CastSpellByName = CastSpellByName
CastSpellByName = Hooked_CastSpellByName
HOOKED = true
end
end
function Parser:SPELLCAST_START()
self.casting = arg1
end
function Parser:SPELLCAST_CHANNEL_START()
self.channeling = true
end
function Parser:SPELLCAST_STOP()
self.casting = false
end
function Parser:SPELLCAST_CHANNEL_STOP()
self.channel_spell = nil
self.channeling = false
end
local conditions_map, casting, existence, hostility
do
local function IsChanneling(dependency)
return dependency and dependency == Parser.channeling or Parser.channeling
end
local function IsCasting(dependency)
return dependency and dependency == Parser.casting or Parser.casting
end
local function IsMouseOverUnit()
local is_mouseover = false
is_mouseover = UnitName('mouseover') and 'mouseover'
local frame = GetMouseFocus()
if frame and frame.GetAttribute then
is_mouseover = is_mouseover or frame:GetAttribute('unit')
end
is_mouseover = is_mouseover or frame and frame.unit
return is_mouseover
end
local function modifierCondition(dependency)
dependency = dependency == 'ctrl' and 'control' or dependency
local modifier = string.gsub(dependency, "^%l", string.upper)
return _G['Is' .. modifier .. 'KeyDown']()
end
-- Rename dependent?
casting = {
['channeling'] = IsChanneling,
['nochanneling'] = function(dependency)
return not IsChanneling(dependency)
end,
['casting'] = IsCasting,
['nocasting'] = function(dependency)
return not IsCasting(dependency)
end,
['group'] = function(dependency)
local in_raid = UnitInRaid('player')
-- Player is apparently always in a party... Party Rock Anthem, GO!
local in_party = UnitInParty('party1')
if dependency then
if dependency == 'raid' then
return in_raid
else
return in_party
end
else
return in_raid or in_party
end
end,
['nogroup'] = function(dependency)
local in_raid = UnitInRaid('player')
local in_party = UnitInParty('party1')
if dependency then
if dependency == 'raid' then
return not in_raid
else
return not in_party
end
else
return (not in_raid) and (not in_party)
end
end,
['mod'] = modifierCondition,
['modifier'] = modifierCondition,
['form'] = IsInShapeshiftForm,
['stance'] = IsInShapeshiftForm
}
existence = {
['exists'] = UnitExists,
['noexists'] = function(unit)
return not UnitExists(unit)
end,
['dead'] = function(unit)
return UnitIsDead(unit) and not UnitAura(unit, 'Feign Death')
end,
['nodead'] = function(unit)
return not (UnitIsDead(unit) and not UnitAura(unit, 'Feign Death'))
end,
}
hostility = {
['harm'] = function(unit_one, unit_two)
return UnitExists(unit_two) and (not UnitIsFriend(unit_one, unit_two))
end,
['nohelp'] = function(unit_one, unit_two)
return UnitExists(unit_two) and (not UnitIsFriend(unit_one, unit_two))
end,
['help'] = UnitIsFriend,
['noharm'] = UnitIsFriend
}
conditions_map = {
-- Targets
['mouseover'] = IsMouseOverUnit,
['pet'] = HasPetUI,
['nopet'] = function() return not HasPetUI() end,
['party'] = UnitInParty,
['raid'] = UnitInRaid,
['combat'] = UnitAffectingCombat,
['mounted'] = IsMounted,
-- ['indoors'] = IsIndoors,
-- ['outdoors'] = IsOutdoors,
['stealth'] = IsStealthed,
-- ['swimming'] = IsSwimming,
['bonusbar'] = function(bar_id)
return false
end,
}
for k, v in next, casting do conditions_map[k] = v end
for k, v in next, existence do conditions_map[k] = v end
for k, v in next, hostility do conditions_map[k] = v end
end
function CmdOptionParse(command)
-- /action [conditions]
local action, conditions
-- Accumulating condition
local acc_condition
-- Condition-mapped function and dependency argument
local func, dependency
-- [@target]
local target, is_cond_target
if not string.find(command, ';') then
command = command .. ' ;'
end
-- Iterate condition cases
for _, cases in { string.split(';', command) } do
conditions, action = string.match(cases, '%[([^%]]+)%]%s*(.+)')
-- Does the action have any conditions?
if conditions then
conditions = { string.split(',', conditions) }
acc_condition = true
target = nil
for _, cond in conditions do
cond = string.trim(cond)
cond, dependency = string.split(':', cond)
-- Is the current condition a target command? Usually the first
-- condition is
is_cond_target =
string.match(cond, '@(.*)') or
string.match(cond, 'target=(.*)')
-- Mouseover has a special condition, since unitframes don't
-- utilise the mouseover unit, in which case it's mapped to
-- player, target, partyN etc.
func = conditions_map[is_cond_target or cond]
if is_cond_target then
target = func and func() or is_cond_target
else
local res
if hostility[cond] then
res = func and func('player', target or 'target')
elseif existence[cond] then
res = func and func(target or 'target')
elseif cond == 'combat' then
res = func and func('player')
elseif casting[cond] then
res = func and func(dependency)
else
res = func and func()
end
acc_condition = acc_condition and res
end
end
-- Are all conditions met? Then perform that action
if acc_condition then
return string.trim(action), target
end
else
local cases = string.trim(cases)
return cases
end
end
end
SecureCmdOptionParse = CmdOptionParse
Parser:Initialize()
+513
View File
@@ -0,0 +1,513 @@
--[[
Name: StateDriver-1.0
Revision: $Rev: 107 $
Maintainers: martinjlowm
Website: https://github.com/martinjlowm/StateDriver/
Dependencies: Classy-1.0
License: None
]]
if not LibStub then return end
local SD = LibStub:NewLibrary('StateDriver-1.0', 0)
if not SD then return end
local Classy = LibStub('Classy-1.0')
local _G = getfenv(0)
function SD:New(name, parent)
self[name] = Classy:New('Frame', parent)
return self[name]
end
local function GetAttribute(self, prefix, name, suffix)
local attributes = self.__state_driver.attributes
local value
if not name and not suffix then
name = prefix
else
value = attributes[prefix .. name .. suffix]
value = value or attributes['*' .. name .. suffix]
value = value or attributes[prefix .. name .. '*']
value = value or attributes['*' .. name .. '*']
end
return value or attributes[name]
end
local function SetAttribute(self, attr, value)
local old_value = self.__state_driver.attributes[attr]
self.__state_driver.attributes[attr] = value
local func = self.__state_driver.handlers['OnAttributeChanged']
if func and type(func) == 'function' and value ~= old_value then
func(self, attr, value)
end
end
-- Figure out where to place this
local function initPlayerDrop()
UnitPopup_ShowMenu(PlayerFrameDropDown, "SELF", "player")
if not (UnitInRaid("player") or GetNumPartyMembers() > 0) or UnitIsPartyLeader("player") and PlayerFrameDropDown.init and not CanShowResetInstances() then
UIDropDownMenu_AddButton({text = RESET_INSTANCES, func = ResetInstances, notCheckable = 1}, 1)
PlayerFrameDropDown.init = nil
end
end
local ACTIONS = {}
ACTIONS.target = function(self, unit, button)
if unit then
if unit == 'none' then
ClearTarget();
elseif ( SpellIsTargeting() ) then
SpellTargetUnit(unit);
elseif ( CursorHasItem() ) then
DropItemOnUnit(unit);
else
TargetUnit(unit);
end
end
end
ACTIONS.togglemenu = function(self, unit, button)
if UnitIsUnit(unit, 'player') then
UIDropDownMenu_Initialize(PlayerFrameDropDown, initPlayerDrop, 'MENU')
PlayerFrameDropDown.init = true
ToggleDropDownMenu(1, nil, PlayerFrameDropDown, 'cursor')
elseif unit == 'pet' then
ToggleDropDownMenu(1, nil, PetFrameDropDown, 'cursor')
elseif unit == 'target' then
ToggleDropDownMenu(1, nil, TargetFrameDropDown, 'cursor')
elseif string.sub(unit, 1, 5) == 'party' then
ToggleDropDownMenu(1, nil, _G['PartyMemberFrame' .. string.sub(unit,6) .. 'DropDown'], 'cursor')
elseif string.sub(unit, 1, 4) == 'raid' then
HideDropDownMenu(1)
local menuFrame = FriendsDropDown
menuFrame.displayMode = 'MENU'
menuFrame.id = string.sub(this.unit,5)
menuFrame.unit = unit
menuFrame.name = UnitName(this.unit)
menuFrame.initialize = function()
UnitPopup_ShowMenu(getglobal(UIDROPDOWNMENU_OPEN_MENU), "PARTY", self.unit, self.name, self.id)
end
ToggleDropDownMenu(1, nil, FriendsDropDown, 'cursor')
end
end
ACTIONS.macro = function(self, unit, button)
local macro_text = self:GetAttribute('macrotext')
local spell, unit = SecureCmdOptionParse(macro_text)
CastSpellByName(spell, unit)
end
ACTIONS.spell = function(self, unit, button)
local spell = self:GetAttribute('spell')
CastSpellByName(spell)
end
ACTIONS.pet = function(self, unit, button)
local index = self:GetAttribute('pet')
CastPetAction(index, unit)
end
ACTIONS.func = function(self, unit, button)
local func = SlashCmdList[self:GetAttribute('func')]
if not func then
error(string.format('Slash command `%s` does not exist in SlashCmdList'))
return
end
func()
end
local link_pattern = '%[([^%]]+)%]'
local function CmdItemParse(item)
local slot = tonumber(item)
if slot then
return nil, nil, slot
end
local link, name
for bag = 0, 4 do
for slot = 1, GetContainerNumSlots(bag) do
link = GetContainerItemLink(bag, slot)
if link then
name = string.match(link, link_pattern)
if name and name == item then
return name, bag, slot
end
end
end
end
end
ACTIONS.item = function(self, unit, button)
local item = self:GetAttribute('item')
if item then
local name, bag, slot = CmdItemParse(item)
UseItem(name, bag, slot)
end
end
function UseItem(name, bag, slot)
if bag then
UseContainerItem(bag, slot)
elseif slot then
UseInventoryItem(slot)
end
end
ACTIONS.assign = function(self, unit, button)
local macro_text = self:GetAttribute('assign')
local symbol, unit = SecureCmdOptionParse(macro_text)
SetRaidTargetIcon(unit, symbol)
end
function Button_GetModifierPrefix(frame)
local prefix = ''
prefix = IsShiftKeyDown() and 'shift-' .. prefix or prefix
prefix = IsControlKeyDown() and 'ctrl-' .. prefix or prefix
return IsAltKeyDown() and 'alt-' .. prefix or prefix
end
function Button_GetButtonSuffix(button)
if button == 'LeftButton' then
return '1'
elseif button == 'RightButton' then
return '2'
elseif button == 'MiddleButton' then
return '3'
end
return '';
end
function Button_GetModifiedAttribute(frame, name, button, prefix, suffix)
if not prefix then
prefix = Button_GetModifierPrefix(frame)
end
if not suffix then
suffix = Button_GetButtonSuffix(button)
end
return frame:GetAttribute(prefix, name, suffix)
end
local function OnClick(self, button)
if not self.GetAttribute then return end
local unit = self:GetAttribute('unit')
local action_type = Button_GetModifiedAttribute(self, 'type', button)
if action_type then
local handler = ACTIONS[action_type]
if handler and type(handler) == 'function' then
handler(self, unit, button)
end
end
end
local function SetScript(self, handler, func)
if self.__state_driver.handlers[handler] then
if self:HasScript(handler) and handler == 'OnClick' then
self.__state_driver._SetScript(self, handler, function(...)
OnClick(this, arg1)
func()
end)
else
self.__state_driver.handlers[handler] = func
end
else
self.__state_driver._SetScript(self, handler, func)
end
end
local _CreateFrame = CreateFrame
function CreateFrame(...)
local frame = _CreateFrame(unpack(arg))
-- State Driver environment
frame.__state_driver = {}
frame.__state_driver._SetScript = frame.SetScript
frame.SetScript = SetScript
frame.__state_driver.attributes = {}
frame.__state_driver.handlers = {
['OnAttributeChanged'] = true,
['OnClick'] = true
}
frame.GetAttribute = GetAttribute
frame.SetAttribute = SetAttribute
if frame:HasScript('OnClick') and not frame:GetScript('OnClick') then
frame:SetScript('OnClick', NOOP)
end
return frame
end
local function Execute(frame, func)
end
local function WrapScript(frame, func)
end
local function UnwrapScript(frame, func)
end
local function ChildUpdate(frame, attr_snippet, value)
local children = { frame:GetChildren() }
local childUpdate
for _, child in next, children do
if child.GetAttribute then
childUpdate = child:GetAttribute('_childupdate-' .. attr_snippet)
if childUpdate then
childUpdate(child, value)
else
childUpdate = child:GetAttribute('_childupdate')
if childUpdate then
childUpdate(child, value)
end
end
ChildUpdate(child, attr_snippet, value)
end
end
end
--
-- SecureStateDriverManager
-- Automatically sets states based on macro options for state driver frames
-- Also handled showing/hiding frames based on unit existence (code originally by Tem)
--
-- Register a frame attribute to be set automatically with changes in game state
function RegisterAttributeDriver(frame, attribute, values)
frame.Execute = Execute
frame.WrapScript = WrapScript
frame.UnwrapScript = UnwrapScript
frame.ChildUpdate = ChildUpdate
if attribute and values and string.sub(attribute, 1, 1) ~= '_' then
Manager:SetAttribute('setframe', frame)
Manager:SetAttribute('setstate', attribute .. ' ' .. values)
end
end
-- Unregister a frame from the state driver manager.
function UnregisterAttributeDriver(frame, attribute)
if attribute then
Manager:SetAttribute('setframe', frame)
Manager:SetAttribute('setstate', attribute)
else
Manager:SetAttribute('delframe', frame)
end
end
-- Bridge functions for compatibility
function RegisterStateDriver(frame, state, values)
return RegisterAttributeDriver(frame, 'state-' .. state, values)
end
function UnregisterStateDriver(frame, state)
return UnregisterAttributeDriver(frame, 'state-' .. state)
end
-- Register a frame to be notified when a unit's existence changes, the
-- unit is obtained from the frame's attributes. If asState is true then
-- notification is via the 'state-unitexists' attribute with values
-- true and false. Otherwise it's via :Show() and :Hide()
function RegisterUnitWatch(frame, asState)
if asState then
Manager:SetAttribute('addwatchstate', frame)
else
Manager:SetAttribute('addwatch', frame)
end
end
-- Unregister a frame from the unit existence monitor.
function UnregisterUnitWatch(frame)
SecureStateDriverManager:SetAttribute('removewatch', frame)
end
--
-- Private implementation
--
local secureAttributeDrivers = {}
local unitExistsWatchers = {}
local unitExistsCache = setmetatable(
{},
{ __index = function(t,k)
local v = UnitExists(k) or false
t[k] = v
return v
end
})
local STATE_DRIVER_UPDATE_THROTTLE = 0.1
local timer = 0
local wipe = table.wipe
-- Check to see if a frame is registered
function UnitWatchRegistered(frame)
return not (unitExistsWatchers[frame] == nil)
end
local function SecureStateDriverManager_UpdateUnitWatch(frame, doState)
-- Not really so secure, eh?
local unit = frame:GetAttribute('unit')
local exists = (unit and unitExistsCache[unit])
if doState then
local attr = exists or false
if frame:GetAttribute('state-unitexists') ~= attr then
frame:SetAttribute('state-unitexists', attr)
end
else
if exists then
frame:Show()
frame:SetAttribute('statehidden', nil)
else
frame:Hide()
frame:SetAttribute('statehidden', true)
end
end
end
local pairs = pairs
-- consolidate duplicated code for footprint and maintainability
local function resolveDriver(frame, attribute, values)
local newValue = SecureCmdOptionParse(values)
if attribute == 'state-visibility' then
if newValue == 'show' then
frame:Show()
frame:SetAttribute('statehidden', nil)
elseif newValue == 'hide' then
frame:Hide()
frame:SetAttribute('statehidden', true)
end
elseif newValue then
if newValue == 'nil' then
newValue = nil
else
newValue = tonumber(newValue) or newValue
end
local oldValue = frame:GetAttribute(attribute)
if newValue ~= oldValue then
frame:SetAttribute(attribute, newValue)
local onState = frame:GetAttribute('_on' .. attribute)
if onState then
onState(frame, attribute, newValue)
end
end
end
end
local function OnUpdate()
local self, elapsed = this, arg1
timer = timer - elapsed
if timer <= 0 then
timer = STATE_DRIVER_UPDATE_THROTTLE
-- Handle state driver updates
for frame, drivers in next, secureAttributeDrivers do
for attribute, values in next, drivers do
resolveDriver(frame, attribute, values)
end
end
-- Handle unit existence changes
wipe(unitExistsCache)
for k in next, unitExistsCache do
unitExistsCache[k] = nil
end
for frame, doState in next, unitExistsWatchers do
SecureStateDriverManager_UpdateUnitWatch(frame, doState)
end
end
end
local function OnEvent()
local self, event = this, arg1
timer = 0
end
local function OnAttributeChanged(self, name, value)
if not value then
return
end
if name == 'setframe' then
if not secureAttributeDrivers[value] then
secureAttributeDrivers[value] = {}
end
SecureStateDriverManager:Show()
elseif name == 'delframe' then
secureAttributeDrivers[value] = nil
elseif name == 'setstate' then
local frame = self:GetAttribute('setframe')
local attribute, values = string.match(value, '^(%S+)%s*(.*)$')
if values == '' then
secureAttributeDrivers[frame][attribute] = nil
else
secureAttributeDrivers[frame][attribute] = values
resolveDriver(frame, attribute, values)
end
-- Two frames registering with identical setstate fails unless the value
-- is reset afterwards
self:SetAttribute('setstate', nil)
elseif name == 'addwatch' or name == 'addwatchstate' then
local doState = (name == 'addwatchstate')
unitExistsWatchers[value] = doState
SecureStateDriverManager:Show()
SecureStateDriverManager_UpdateUnitWatch(value, doState)
elseif name == 'removewatch' then
unitExistsWatchers[value] = nil
elseif name == 'updatetime' then
STATE_DRIVER_UPDATE_THROTTLE = value
end
end
Manager = SD:New('Manager')
Manager:SetScript('OnUpdate', OnUpdate)
Manager:SetScript('OnEvent', OnEvent)
Manager:SetScript('OnAttributeChanged', OnAttributeChanged)
-- Events that trigger early rescans
Manager:RegisterEvent('MODIFIER_STATE_CHANGED')
Manager:RegisterEvent('ACTIONBAR_PAGE_CHANGED')
Manager:RegisterEvent('UPDATE_BONUS_ACTIONBAR')
Manager:RegisterEvent('PLAYER_ENTERING_WORLD')
Manager:RegisterEvent('UPDATE_SHAPESHIFT_FORM')
Manager:RegisterEvent('UPDATE_STEALTH')
Manager:RegisterEvent('PLAYER_TARGET_CHANGED')
Manager:RegisterEvent('PLAYER_FOCUS_CHANGED')
Manager:RegisterEvent('PLAYER_REGEN_DISABLED')
Manager:RegisterEvent('PLAYER_REGEN_ENABLED')
Manager:RegisterEvent('UNIT_PET')
Manager:RegisterEvent('GROUP_ROSTER_UPDATE')
-- Deliberately ignoring mouseover and others' target changes because they change so much
_G['SecureStateDriverManager'] = Manager
+2 -1
View File
@@ -6,6 +6,7 @@ local Sticky = LibStub("LibSimpleSticky-1.0");
local _G = _G
local type, unpack, pairs = type, unpack, pairs
local format, split, find = string.format, string.split, string.find
local tinsert = table.insert
--WoW API / Variables
local CreateFrame = CreateFrame
@@ -72,7 +73,7 @@ local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, sh
end
E.CreatedMovers[name].mover = f
E["snapBars"][getn(E["snapBars"]) + 1] = f
tinsert(E["snapBars"], f)
local fs = f:CreateFontString(nil, "OVERLAY")
E:FontTemplate(fs)
+11 -21
View File
@@ -25,25 +25,21 @@ E.PopupDialogs["ELVUI_UPDATE_AVAILABLE"] = {
OnShow = function()
this.editBox:SetAutoFocus(false)
this.editBox.width = this.editBox:GetWidth()
this.editBox:SetWidth(220)
E:Width(this.editBox, 220)
this.editBox:SetText("https://github.com/ElvUI-Vanilla/ElvUI")
this.editBox:HighlightText()
-- ChatEdit_FocusActiveWindow()
end,
OnHide = function()
this.editBox:SetWidth(this.editBox.width or 50)
E:Width(this.editBox, this.editBox.width or 50)
this.editBox.width = nil
end,
hideOnEscape = 1,
button1 = OKAY,
button2 = CLOSE, -- Temporary until further fix
OnAccept = E.noop,
EditBoxOnEnterPressed = function()
-- ChatEdit_FocusActiveWindow()
this:GetParent():Hide()
end,
EditBoxOnEscapePressed = function()
-- ChatEdit_FocusActiveWindow()
this:GetParent():Hide()
end,
EditBoxOnTextChanged = function()
@@ -52,7 +48,6 @@ E.PopupDialogs["ELVUI_UPDATE_AVAILABLE"] = {
end
this:HighlightText()
this:ClearFocus()
-- ChatEdit_FocusActiveWindow()
end,
OnEditFocusGained = function()
this:HighlightText()
@@ -63,7 +58,6 @@ E.PopupDialogs["ELVUI_UPDATE_AVAILABLE"] = {
E.PopupDialogs["CLIQUE_ADVERT"] = {
text = L["Using the healer layout it is highly recommended you download the addon Clique if you wish to have the click-to-heal function."],
button1 = YES,
button2 = CLOSE, -- Temporary until further fix
OnAccept = E.noop,
showAlert = 1
}
@@ -127,7 +121,6 @@ E.PopupDialogs["INCOMPATIBLE_ADDON"] = {
E.PopupDialogs["PIXELPERFECT_CHANGED"] = {
text = L["You have changed the Thin Border Theme option. You will have to complete the installation process to remove any graphical bugs."],
button1 = ACCEPT,
button2 = CLOSE, -- Temporary until further fix
OnAccept = E.noop,
timeout = 0,
whileDead = 1,
@@ -137,7 +130,6 @@ E.PopupDialogs["PIXELPERFECT_CHANGED"] = {
E.PopupDialogs["CONFIGAURA_SET"] = {
text = L["Because of the mass confusion caused by the new aura system I've implemented a new step to the installation process. This is optional. If you like how your auras are setup go to the last step and click finished to not be prompted again. If for some reason you are prompted repeatedly please restart your game."],
button1 = ACCEPT,
button2 = CLOSE, -- Temporary until further fix
OnAccept = E.noop,
timeout = 0,
whileDead = 1,
@@ -235,7 +227,6 @@ E.PopupDialogs["BUY_BANK_SLOT"] = {
E.PopupDialogs["CANNOT_BUY_BANK_SLOT"] = {
text = L["Can't buy anymore slots!"],
button1 = ACCEPT,
button2 = CLOSE, -- Temporary until further fix
timeout = 0,
whileDead = 1
}
@@ -243,7 +234,6 @@ E.PopupDialogs["CANNOT_BUY_BANK_SLOT"] = {
E.PopupDialogs["NO_BANK_BAGS"] = {
text = L["You must purchase a bank slot first!"],
button1 = ACCEPT,
button2 = CLOSE, -- Temporary until further fix
timeout = 0,
whileDead = 1
}
@@ -262,7 +252,6 @@ E.PopupDialogs["RESETUI_CHECK"] = {
E.PopupDialogs["HARLEM_SHAKE"] = {
text = L["ElvUI needs to perform database optimizations please be patient."],
button1 = OKAY,
button2 = CLOSE, -- Temporary until further fix
OnAccept = function()
if E.isMassiveShaking then
E:StopHarlemShake()
@@ -278,7 +267,6 @@ E.PopupDialogs["HARLEM_SHAKE"] = {
E.PopupDialogs["HELLO_KITTY"] = {
text = L["ElvUI needs to perform database optimizations please be patient."],
button1 = OKAY,
button2 = CLOSE, -- Temporary until further fix
OnAccept = function()
E:SetupHelloKitty()
end,
@@ -645,7 +633,7 @@ function E:StaticPopup_Resize(dialog, which)
end
if width > maxWidthSoFar then
dialog:SetWidth(width)
E:Width(dialog, width)
dialog.maxWidthSoFar = width
end
@@ -657,7 +645,7 @@ function E:StaticPopup_Resize(dialog, which)
end
if height > maxHeightSoFar then
dialog:SetHeight(height)
E:Height(dialog, height)
dialog.maxHeightSoFar = height
end
end
@@ -773,9 +761,9 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
end
editBox:SetText("")
if info.editBoxWidth then
editBox:SetWidth(info.editBoxWidth)
E:Width(editBox, info.editBoxWidth)
else
editBox:SetWidth(130)
E:Width(editBox, 130)
end
else
editBox:Hide()
@@ -804,7 +792,9 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
tinsert(tempButtonLocs, button2)
for i = getn(tempButtonLocs), 1, -1 do
tempButtonLocs[i]:SetText(info["button"..i])
if info["button"..i] then
tempButtonLocs[i]:SetText(info["button"..i])
end
tempButtonLocs[i]:Hide()
tempButtonLocs[i]:ClearAllPoints()
if not (info["button"..i] and (not info["DisplayButton"..i] or info["DisplayButton"..i](dialog))) then
@@ -827,9 +817,9 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
local width = tempButtonLocs[i]:GetTextWidth()
if width > 110 then
tempButtonLocs[i]:SetWidth(width + 20)
E:Width(tempButtonLocs[i], width + 20)
else
tempButtonLocs[i]:SetWidth(120)
E:Width(tempButtonLocs[i], 120)
end
tempButtonLocs[i]:Enable()
tempButtonLocs[i]:Show()
+5 -4
View File
@@ -15,7 +15,6 @@ local GetActiveTalentGroup = GetActiveTalentGroup
local GetCVar = GetCVar
local GetFunctionCPUUsage = GetFunctionCPUUsage
local GetTalentTabInfo = GetTalentTabInfo
local InCombatLockdown = InCombatLockdown
local IsAddOnLoaded = IsAddOnLoaded
local IsInInstance, GetNumPartyMembers, GetNumRaidMembers = IsInInstance, GetNumPartyMembers, GetNumRaidMembers
local RequestBattlefieldScoreData = RequestBattlefieldScoreData
@@ -28,6 +27,8 @@ local RAID_CLASS_COLORS = RAID_CLASS_COLORS
_, E.myclass = UnitClass("player") -- Constants
_, E.myrace = UnitRace("player")
_, E.myfaction = UnitFactionGroup("player")
-- The E.myfaction may error when in GM mode
E.myfaction = E.myfaction or "Others"
E.myname = UnitName("player")
E.version = GetAddOnMetadata("ElvUI", "Version")
E.myrealm = GetRealmName()
@@ -425,9 +426,9 @@ end
E.UIParent = CreateFrame("Frame", "ElvUIParent", UIParent)
E.UIParent:SetFrameLevel(UIParent:GetFrameLevel())
E.UIParent:SetPoint("CENTER", UIParent, "CENTER")
E.UIParent:SetHeight(UIParent:GetHeight())
E.UIParent:SetWidth(UIParent:GetWidth())
E["snapBars"][table.getn(E["snapBars"]) + 1] = E.UIParent
E.UIParent:SetHeight(GetScreenHeight())
E.UIParent:SetWidth(GetScreenWidth())
tinsert(E["snapBars"], E.UIParent)
E.HiddenFrame = CreateFrame("Frame")
E.HiddenFrame:Hide()
+2 -14
View File
@@ -558,7 +558,7 @@ function E:SetupLayout(layout, noDataReset)
E.db.unitframe.units.arena.castbar.width = 200
end
if(layout == "dpsCaster" or layout == "healer" or (layout == "dpsMelee" and E.myclass == "HUNTER")) then
if layout == "dpsCaster" or layout == "healer" or (layout == "dpsMelee" and E.myclass == "HUNTER") then
if not E.db.movers then E.db.movers = {} end
E.db.unitframe.units.player.castbar.width = E.PixelMode and 406 or 436
E.db.unitframe.units.player.castbar.height = 28
@@ -664,18 +664,6 @@ local function SetupAuras(style)
UF:Configure_AuraBars(frame)
end
frame = UF["focus"]
E:CopyTable(E.db.unitframe.units.focus.buffs, P.unitframe.units.focus.buffs)
E:CopyTable(E.db.unitframe.units.focus.debuffs, P.unitframe.units.focus.debuffs)
E:CopyTable(E.db.unitframe.units.focus.aurabar, P.unitframe.units.focus.aurabar)
E.db.unitframe.units.focus.smartAuraDisplay = P.unitframe.units.focus.smartAuraDisplay
if frame then
UF:Configure_Auras(frame, "Buffs")
UF:Configure_Auras(frame, "Debuffs")
UF:Configure_AuraBars(frame)
end
if not style then
E.db.unitframe.units.player.buffs.enable = true
E.db.unitframe.units.player.buffs.attachTo = "FRAME"
@@ -690,7 +678,7 @@ local function SetupAuras(style)
E:GetModule("UnitFrames"):CreateAndUpdateUF("target")
end
if(InstallStepComplete) then
if InstallStepComplete then
InstallStepComplete.message = L["Auras Set"]
InstallStepComplete:Show()
end
+47 -47
View File
@@ -16,7 +16,7 @@ local byte = string.byte
local LibBase64 = LibStub:NewLibrary("LibBase64-1.0", 1)
if not LibBase64 then
return
return
end
local _chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
@@ -25,12 +25,12 @@ local byteToNum = {}
local numToChar = {}
for i = 1, strlen(_chars) do
charTable[i] = sub(_chars, i, i)
charTable[i] = sub(_chars, i, i)
end
for i = 1, getn(charTable) do
numToChar[i - 1] = sub(_chars, i, i)
byteToNum[byte(_chars, i)] = i - 1
numToChar[i - 1] = sub(_chars, i, i)
byteToNum[byte(_chars, i)] = i - 1
end
_chars = nil
@@ -45,10 +45,10 @@ local plus_byte = byte("+")
local slash_byte = byte("/")
local equals_byte = byte("=")
local whitespace = {
[byte(" ")] = true,
[byte("\t")] = true,
[byte("\n")] = true,
[byte("\r")] = true,
[byte(" ")] = true,
[byte("\t")] = true,
[byte("\n")] = true,
[byte("\r")] = true,
}
local t = {}
@@ -60,27 +60,27 @@ local t = {}
-- @usage LibBase64.Encode("Hello, how are you doing today?") == "SGVsbG8sIGhvdyBhcmUgeW91IGRvaW5nIHRvZGF5Pw=="
-- @return a Base64-encoded string
function LibBase64:Encode(text, maxLineLength, lineEnding)
if type(text) ~= "string" then
error(format("Bad argument #1 to `Encode'. Expected %q, got %q", "string", type(text)), 2)
end
if type(text) ~= "string" then
error(format("Bad argument #1 to `Encode'. Expected %q, got %q", "string", type(text)), 2)
end
if maxLineLength == nil then
-- do nothing
elseif type(maxLineLength) ~= "number" then
error(format("Bad argument #2 to `Encode'. Expected %q or %q, got %q", "number", "nil", type(maxLineLength)), 2)
elseif modf(maxLineLength, 4) ~= 0 then
error(format("Bad argument #2 to `Encode'. Expected a multiple of 4, got %s", maxLineLength), 2)
elseif maxLineLength <= 0 then
error(format("Bad argument #2 to `Encode'. Expected a number > 0, got %s", maxLineLength), 2)
end
if maxLineLength == nil then
-- do nothing
elseif type(maxLineLength) ~= "number" then
error(format("Bad argument #2 to `Encode'. Expected %q or %q, got %q", "number", "nil", type(maxLineLength)), 2)
elseif modf(maxLineLength, 4) ~= 0 then
error(format("Bad argument #2 to `Encode'. Expected a multiple of 4, got %s", maxLineLength), 2)
elseif maxLineLength <= 0 then
error(format("Bad argument #2 to `Encode'. Expected a number > 0, got %s", maxLineLength), 2)
end
if lineEnding == nil then
lineEnding = "\r\n"
elseif type(lineEnding) ~= "string" then
error(format("Bad argument #3 to `Encode'. Expected %q, got %q", "string", type(lineEnding)), 2)
end
if lineEnding == nil then
lineEnding = "\r\n"
elseif type(lineEnding) ~= "string" then
error(format("Bad argument #3 to `Encode'. Expected %q, got %q", "string", type(lineEnding)), 2)
end
local currentLength = 0
local currentLength = 0
for i = 1, getn(text), 3 do
local a, b, c = byte(text, i, i+2)
@@ -116,7 +116,7 @@ function LibBase64:Encode(text, maxLineLength, lineEnding)
currentLength = currentLength + 4
if maxLineLength and modf(currentLength, maxLineLength) == 0 then
t[getn(t)+1] = lineEnding
t[getn(t)+1] = lineEnding
end
end
@@ -136,29 +136,29 @@ local t2 = {}
-- @usage LibBase64.Encode("SGVsbG8sIGhvdyBhcmUgeW91IGRvaW5nIHRvZGF5Pw==") == "Hello, how are you doing today?"
-- @return a bytestring
function LibBase64:Decode(text)
if type(text) ~= "string" then
error(format("Bad argument #1 to `Decode'. Expected %q, got %q", "string", type(text)), 2)
end
if type(text) ~= "string" then
error(format("Bad argument #1 to `Decode'. Expected %q, got %q", "string", type(text)), 2)
end
for i = 1, getn(text) do
local byte = byte(text, i)
if whitespace[byte] or byte == equals_byte then
-- do nothing
else
local num = byteToNum[byte]
if not num then
for i = 1, getn(t2) do
t2[k] = nil
end
for i = 1, getn(text) do
local byte = byte(text, i)
if whitespace[byte] or byte == equals_byte then
-- do nothing
else
local num = byteToNum[byte]
if not num then
for i = 1, getn(t2) do
t2[k] = nil
end
error(format("Bad argument #1 to `Decode'. Received an invalid char: %q", sub(text, i, i)), 2)
end
t2[getn(t2)+1] = num
end
end
error(format("Bad argument #1 to `Decode'. Received an invalid char: %q", sub(text, i, i)), 2)
end
t2[getn(t2)+1] = num
end
end
for i = 1, getn(t2), 4 do
local a, b, c, d = t2[i], t2[i+1], t2[i+2], t2[i+3]
for i = 1, getn(t2), 4 do
local a, b, c, d = t2[i], t2[i+1], t2[i+2], t2[i+3]
local nilNum = 0
if not c then
+5 -5
View File
@@ -137,7 +137,7 @@ function LibCompress:TableToString(t)
if t == nil then return nil end
if type(t)=="string" then return t end
local cache={}
local function sub_mod(t)
local function sub_mod(t)
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
@@ -153,8 +153,8 @@ function LibCompress:TableToString(t)
else
table_insert(cache, tostring(t))
end
end
sub_mod(t)
end
sub_mod(t)
return table_concat(cache, ",") -- ? maybe use a different delimiter
end
@@ -784,10 +784,10 @@ function LibCompress:Compress(data)
n = compression_methods[method](self, data)
nTable = {}
for i = 1, strlen(n) do
nTable[i] = string.sub(n, i, i)
nTable[i] = string.sub(n, i, i)
end
for i = 1, strlen(result) do
rTable[i] = string.sub(result, i, i)
rTable[i] = string.sub(result, i, i)
end
if getn(nTable) < getn(rTable) then
result = nTable
@@ -39,7 +39,7 @@ end
function Lib:MatchAll(search)
for phrase in gmatch(self:Clean(search), '[^&]+') do
if not self:MatchAny(phrase) then
return
return
end
end
@@ -49,7 +49,7 @@ end
function Lib:MatchAny(search)
for phrase in gmatch(search, '[^|]+') do
if self:Match(phrase) then
return true
return true
end
end
end
@@ -161,10 +161,10 @@ local escapes = {
}
local function CleanString(str)
for k, v in pairs(escapes) do
str = string.gsub(str, k, v)
end
return str
for k, v in pairs(escapes) do
str = string.gsub(str, k, v)
end
return str
end
Lib.Filters.tipPhrases = {
@@ -203,9 +203,9 @@ Lib.Filters.tipPhrases = {
cache = setmetatable({}, {__index = function(t, k) local v = {} t[k] = v return v end}),
keywords = {
[lower(ITEM_SOULBOUND)] = ITEM_BIND_ON_PICKUP,
["bound"] = ITEM_BIND_ON_PICKUP,
["bop"] = ITEM_BIND_ON_PICKUP,
[lower(ITEM_SOULBOUND)] = ITEM_BIND_ON_PICKUP,
["bound"] = ITEM_BIND_ON_PICKUP,
["bop"] = ITEM_BIND_ON_PICKUP,
["boe"] = ITEM_BIND_ON_EQUIP,
["bou"] = ITEM_BIND_ON_USE
}
@@ -24,6 +24,8 @@ local StickyFrames, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not StickyFrames then return end
local ipairs = ipairs
--[[---------------------------------------------------------------------------------
Class declaration, along with a temporary table to hold any existing OnUpdate
scripts.
@@ -134,8 +136,7 @@ function StickyFrames:GetUpdateFunc(frame, frameList, xoffset, yoffset, left, to
frame:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x+xoffset, y+yoffset)
StickyFrames.sticky[frame] = nil
for i = 1, table.getn(frameList) do
local v = frameList[i]
for i, v in ipairs(frameList) do
if frame ~= v and frame ~= v:GetParent() and not IsShiftKeyDown() and v:IsVisible() then
if self:SnapFrame(frame, v, left, top, right, bottom) then
StickyFrames.sticky[frame] = v
@@ -232,8 +232,8 @@ function L_UIDropDownMenu_CreateFrames(level, index)
newList:SetWidth(180)
newList:SetHeight(10)
--Allow closing with escape
tinsert(UIMenus, "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS)
--Allow closing with escape
tinsert(UIMenus, "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS)
for i=L_UIDROPDOWNMENU_MINBUTTONS+1, L_UIDROPDOWNMENU_MAXBUTTONS do
local newButton = CreateFrame("Button", "L_DropDownList"..L_UIDROPDOWNMENU_MAXLEVELS.."Button"..i, newList, "L_UIDropDownMenuButtonTemplate");
@@ -292,9 +292,9 @@ function L_UIDropDownMenu_AddButton(info, level)
local index = listFrame and (listFrame.numButtons + 1) or 1;
local width;
--UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
--UIDropDownMenuDelegate:SetAttribute("createframes-index", index);
--UIDropDownMenuDelegate:SetAttribute("createframes", true);
UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
UIDropDownMenuDelegate:SetAttribute("createframes-index", index);
UIDropDownMenuDelegate:SetAttribute("createframes", true);
listFrame = listFrame or _G["L_DropDownList"..level];
local listFrameName = listFrame:GetName();
@@ -789,9 +789,9 @@ function L_ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset,
level = 1;
end
--UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
--UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
--UIDropDownMenuDelegate:SetAttribute("createframes", true);
UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
UIDropDownMenuDelegate:SetAttribute("createframes", true);
L_UIDROPDOWNMENU_MENU_LEVEL = level;
L_UIDROPDOWNMENU_MENU_VALUE = value;
local listFrame = _G["L_DropDownList"..level];
+64 -64
View File
@@ -139,9 +139,9 @@ local queue_quiet = {
lib['WHOLIB_FLAG_ALWAYS_CALLBACK'] = 1
function lib:Reset()
self.Queue = {[1]={}, [2]={}, [3]={}}
self.Cache = {}
self.CacheQueue = {}
self.Queue = {[1]={}, [2]={}, [3]={}}
self.Cache = {}
self.CacheQueue = {}
end
function lib.Who(defhandler, query, opts)
@@ -169,10 +169,10 @@ function lib.UserInfo(defhandler, name, opts)
local self, args, usage = lib, {}, 'UserInfo(name, [opts])'
local now = time()
name = self:CheckArgument(usage, 'name', 'string', name)
if strlen(name) == 0 then return end
name = self:CheckArgument(usage, 'name', 'string', name)
if strlen(name) == 0 then return end
if string.find(name, "%-") then --[[dbg("ignoring xrealm: "..name)]] return end
if string.find(name, "%-") then --[[dbg("ignoring xrealm: "..name)]] return end
args.name = self:CapitalizeInitial(name)
opts = self:CheckArgument(usage, 'opts', 'table', opts, {})
@@ -218,27 +218,27 @@ function lib.UserInfo(defhandler, name, opts)
return nil
end
if (GetLocale() == "ruRU") then -- in ruRU with n- not show information about player in WIM addon
if args.name and strlen(args.name) > 0 then
local query = 'и-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
if args.name and strlen(args.name) > 0 then
local query = 'и-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
else
if args.name and strlen(args.name) > 0 then
local query = 'n-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
if args.name and strlen(args.name) > 0 then
local query = 'n-"' .. args.name .. '"'
cachedName.inqueue = true
if(args.callback ~= nil)then
tinsert(cachedName.callback, args)
end
self.CacheQueue[query] = args.name
dbg('Info(' .. args.name ..') added to queue')
self:AskWho( { query = query, queue = args.queue, flags = 0, info = args.name } )
end
end
return nil
end
@@ -256,11 +256,11 @@ function lib.CachedUserInfo(_, name)
end
function lib.GetWhoLibDebug(_, mode)
return lib.Debug
return lib.Debug
end
function lib.SetWhoLibDebug(_, mode)
lib.Debug = mode
lib.Debug = mode
dbg = mode and dbgfunc or NOP
end
@@ -298,12 +298,12 @@ end
---
function lib:AllQueuesEmpty()
local queueCount = getn(self.Queue[1]) + getn(self.Queue[2]) + getn(self.Queue[3]) + getn(self.CacheQueue)
local queueCount = getn(self.Queue[1]) + getn(self.Queue[2]) + getn(self.Queue[3]) + getn(self.CacheQueue)
-- Be sure that we have cleared the in-progress status
if self.WhoInProgress then
queueCount = queueCount + 1
end
-- Be sure that we have cleared the in-progress status
if self.WhoInProgress then
queueCount = queueCount + 1
end
return queueCount == 0
end
@@ -344,19 +344,19 @@ local INSTANT_QUERY_MIN_INTERVAL = 60 -- only once every 1 min
function lib:UpdateWeights()
local weightsum, sum, count = 0, 0, 0
for k,v in pairs(queue_weights) do
sum = sum + v
weightsum = weightsum + v * getn(self.Queue[k])
sum = sum + v
weightsum = weightsum + v * getn(self.Queue[k])
end
if weightsum == 0 then
for k,v in pairs(queue_weights) do queue_bounds[k] = v end
return
for k,v in pairs(queue_weights) do queue_bounds[k] = v end
return
end
local adjust = sum / weightsum
for k,v in pairs(queue_bounds) do
queue_bounds[k] = queue_weights[k] * adjust * getn(self.Queue[k])
queue_bounds[k] = queue_weights[k] * adjust * getn(self.Queue[k])
end
end
@@ -376,17 +376,17 @@ function lib:GetNextFromScheduler()
local n,i = math.random(),0
repeat
i=i+1
n = n - queue_bounds[i]
i=i+1
n = n - queue_bounds[i]
until i >= getn(self.Queue) or n <= 0
dbg(string.format("Q=%d, bound=%d", i, queue_bounds[i]))
if getn(self.Queue[i]) > 0 then
dbg(string.format("Q=%d, bound=%d", i, queue_bounds[i]))
return i, self.Queue[i]
dbg(string.format("Q=%d, bound=%d", i, queue_bounds[i]))
return i, self.Queue[i]
else
dbg("Queues empty, waiting")
dbg("Queues empty, waiting")
end
end
@@ -424,10 +424,10 @@ function lib:AskWhoNext()
self.WhoInProgress = false
local v,k,args = nil
local kludge = 10
local kludge = 10
repeat
k, v = self:GetNextFromScheduler()
if not k then break end
k, v = self:GetNextFromScheduler()
if not k then break end
if WhoFrame:IsShown() and k > self.WHOLIB_QUEUE_QUIET then
break
end
@@ -435,7 +435,7 @@ function lib:AskWhoNext()
args = tremove(v, 1)
break
end
kludge = kludge - 1
kludge = kludge - 1
until kludge <= 0
if args then
@@ -453,9 +453,9 @@ function lib:AskWhoNext()
self.Quiet = false
if args.whotoui then
-- self.hooked.SetWhoToUI(args.whotoui)
else
-- self.hooked.SetWhoToUI(args.gui and true or false)
-- self.hooked.SetWhoToUI(args.whotoui)
else
-- self.hooked.SetWhoToUI(args.gui and true or false)
end
else
-- self.hooked.SetWhoToUI(true)
@@ -469,11 +469,11 @@ function lib:AskWhoNext()
self.WhoInProgress = false
end
-- Keep processing the who queue if there is more work
-- Keep processing the who queue if there is more work
if not self:AllQueuesEmpty() then
self:AskWhoNextIn5sec()
else
dbg("*** Done processing requests ***")
else
dbg("*** Done processing requests ***")
end
end
@@ -486,10 +486,10 @@ function lib:AskWho(args)
end
function lib:ReturnWho()
if not self.Args then
self.Quiet = nil
return
end
if not self.Args then
self.Quiet = nil
return
end
if(self.Args.queue == self.WHOLIB_QUEUE_QUIET or self.Args.queue == self.WHOLIB_QUEUE_SCANNING)then
self.Quiet = nil
@@ -723,7 +723,7 @@ end
local MULTIBYTE_FIRST_CHAR = "^([\192-\255]?%a?[\128-\191]*)"
function lib:CapitalizeInitial(name)
return string.gsub(name, MULTIBYTE_FIRST_CHAR, string.upper, 1)
return string.gsub(name, MULTIBYTE_FIRST_CHAR, string.upper, 1)
end
---
@@ -736,7 +736,7 @@ lib.PossibleEvents = {
}
function lib:TriggerEvent(...)
callbacks:Fire(event, unpack(arg))
callbacks:Fire(event, unpack(arg))
end
---
@@ -761,7 +761,7 @@ SlashCmdList['WHOLIB_DEBUG'] = function()
-- /wholibdebug: toggle debug on/off
local self = lib
self:SetWhoLibDebug(not self.Debug)
self:SetWhoLibDebug(not self.Debug)
end
SLASH_WHOLIB_DEBUG1 = '/wholibdebug'
@@ -889,12 +889,12 @@ end
FriendsFrame:UnregisterEvent("WHO_LIST_UPDATE")
function lib:WHO_LIST_UPDATE()
if not lib.Quiet then
if not lib.Quiet then
WhoList_Update()
FriendsFrame_Update()
end
FriendsFrame_Update()
end
lib:ProcessWhoResults()
lib:ProcessWhoResults()
end
function lib:ProcessWhoResults()
+1
View File
@@ -17,6 +17,7 @@
<Include file="LibDataBroker\LibDataBroker-1.1.xml"/>
<Include file="LibElvUIPlugin-1.0\LibElvUIPlugin-1.0.xml"/>
<Include file="oUF\oUF.xml"/>
<Include file="oUF_Plugins\oUF_Plugins.xml"/>
<Include file="UTF8\UTF8.xml"/>
<Include file="LibCompress\LibCompress.xml"/>
<Include file="LibBase64-1.0\LibBase64-1.0.xml"/>
+94 -89
View File
@@ -16,7 +16,6 @@ At least one of the above widgets must be present for the element to work.
## Options
.disableMouse - Disables mouse events (boolean)
.disableCooldown - Disables the cooldown spiral (boolean)
.size - Aura icon size. Defaults to 16 (number)
.spacing - Spacing between each icon. Defaults to 0 (number)
.['spacing-x'] - Horizontal spacing between each icon. Takes priority over `spacing` (number)
@@ -64,18 +63,26 @@ button.isDebuff - indicates if the button holds a debuff (boolean)
local ns = oUF
local oUF = ns.oUF
local tinsert = table.insert
local floor = math.floor
local tinsert, getn = table.insert, table.getn
local floor, min, mod = math.floor, math.min, math.mod
local CreateFrame = CreateFrame
local GetTime = GetTime
local UnitAura = UnitAura
local GetPlayerBuff = GetPlayerBuff
local GetPlayerBuffTexture = GetPlayerBuffTexture
local GetPlayerBuffApplications = GetPlayerBuffApplications
local GetPlayerBuffDispelType = GetPlayerBuffDispelType
local GetPlayerBuffTimeLeft = GetPlayerBuffTimeLeft
local VISIBLE = 1
local HIDDEN = 0
local function UpdateTooltip(self)
if self.filter == 'HELPFUL' then
if self:GetParent().__owner.unit == "player" then
local index = GetPlayerBuff(self:GetID() - 1, self.filter)
GameTooltip:SetPlayerBuff(index)
elseif self.filter == 'HELPFUL' then
GameTooltip:SetUnitBuff(self:GetParent().__owner.unit, self:GetID(), self.filter)
else
GameTooltip:SetUnitDebuff(self:GetParent().__owner.unit, self:GetID(), self.filter)
@@ -83,7 +90,7 @@ local function UpdateTooltip(self)
end
local function onEnter(self)
if(not self:IsVisible()) then return end
if not self:IsVisible() then return end
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT')
self:UpdateTooltip()
@@ -97,9 +104,6 @@ local function createAuraIcon(element, index)
local button = CreateFrame('Button', '$parentButton' .. index, element)
button:RegisterForClicks('RightButtonUp')
local cd = CreateFrame('Cooldown', '$parentCooldown', button, 'oUF_CooldownFrameTemplate')
cd:SetAllPoints()
local icon = button:CreateTexture(nil, 'BORDER')
icon:SetAllPoints()
@@ -113,12 +117,11 @@ local function createAuraIcon(element, index)
button.overlay = overlay
button.UpdateTooltip = UpdateTooltip
button:SetScript('OnEnter', onEnter)
button:SetScript('OnEnter', function() onEnter(this) end)
button:SetScript('OnLeave', onLeave)
button.icon = icon
button.count = count
button.cd = cd
--[[ Callback: Auras:PostCreateIcon(button)
Called after a new aura button has been created.
@@ -126,29 +129,39 @@ local function createAuraIcon(element, index)
* self - the widget holding the aura buttons
* button - the newly created aura button (Button)
--]]
if(element.PostCreateIcon) then element:PostCreateIcon(button) end
if element.PostCreateIcon then element:PostCreateIcon(button) end
return button
end
local function customFilter(element, unit, button, name)
if(name) then
return true
end
local function customFilter(element, unit, button, texture)
if texture then return true end
end
local function updateIcon(element, unit, index, offset, filter, isDebuff, visible)
local name, rank, texture, count, dispelType, duration, expiration = UnitAura(unit, index, filter)
local texture, count, dispelType, duration, expiration
if element.forceShow then
name, rank, texture = GetSpellInfo(26993)
count, dispelType, duration, expiration = 5, 'Magic', 0, 60
if unit == "player" then
local idx = GetPlayerBuff(index - 1, filter)
--if idx < 0 then return end
--index = idx
texture = GetPlayerBuffTexture(idx)
count = GetPlayerBuffApplications(idx)
dispelType = GetPlayerBuffDispelType(idx)
duration = GetPlayerBuffTimeLeft(idx)
else
texture, count, dispelType, duration, expiration = UnitAura(unit, index, filter)
end
if(name) then
if element.forceShow then
texture = 'Interface\\Icons\\Spell_Holy_DivineSpirit'
count, dispelType = 5, 'Magic'
end
if texture then
local position = visible + offset + 1
local button = element[position]
if(not button) then
if not button then
--[[ Override: Auras:CreateIcon(position)
Used to create the aura button at a given position.
@@ -182,24 +195,12 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl
--]]
local show = true
if not element.forceShow then
show = (element.CustomFilter or customFilter) (element, unit, button, name, rank, texture, count, dispelType, duration, expiration)
show = (element.CustomFilter or customFilter) (element, unit, button, texture, count, dispelType, duration, expiration)
end
if(show) then
-- We might want to consider delaying the creation of an actual cooldown
-- object to this point, but I think that will just make things needlessly
-- complicated.
if(button.cd and not element.disableCooldown) then
if(duration and duration > 0) then
button.cd:SetCooldown(GetTime() - (duration - expiration), duration)
button.cd:Show()
else
button.cd:Hide()
end
end
if(button.overlay) then
if((isDebuff and element.showDebuffType) or (not isDebuff and element.showBuffType) or element.showType) then
if show then
if button.overlay then
if (isDebuff and element.showDebuffType) or (not isDebuff and element.showBuffType) or element.showType then
local color = DebuffTypeColor[dispelType] or DebuffTypeColor.none
button.overlay:SetVertexColor(color.r, color.g, color.b)
@@ -209,11 +210,12 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl
end
end
if(button.icon) then button.icon:SetTexture(texture) end
if(button.count) then button.count:SetText(count > 1 and count) end
if button.icon then button.icon:SetTexture(texture) end
if button.count then button.count:SetText(count > 1 and count) end
local size = element.size or 16
button:SetSize(size, size)
button:SetWidth(size)
button:SetHeight(size)
button:EnableMouse(not element.disableMouse)
button:SetID(index)
@@ -228,7 +230,7 @@ local function updateIcon(element, unit, index, offset, filter, isDebuff, visibl
* index - the index of the aura (number)
* position - the actual position of the aura button (number)
--]]
if(element.PostUpdateIcon) then
if element.PostUpdateIcon then
element:PostUpdateIcon(unit, button, index, position)
end
@@ -252,7 +254,7 @@ local function SetPosition(element, from, to)
-- Bail out if the to range is out of scope.
if(not button) then break end
local col = (i - 1) % cols
local col = mod((i - 1), cols)
local row = floor((i - 1) / cols)
button:ClearAllPoints()
@@ -261,25 +263,25 @@ local function SetPosition(element, from, to)
end
local function filterIcons(element, unit, filter, limit, isDebuff, offset, dontHide)
if(not offset) then offset = 0 end
if not offset then offset = 0 end
local index = 1
local visible = 0
local hidden = 0
while(visible < limit) do
while visible < limit do
local result = updateIcon(element, unit, index, offset, filter, isDebuff, visible)
if(not result) then
if not result then
break
elseif(result == VISIBLE) then
elseif result == VISIBLE then
visible = visible + 1
elseif(result == HIDDEN) then
elseif result == HIDDEN then
hidden = hidden + 1
end
index = index + 1
end
if(not dontHide) then
for i = visible + offset + 1, #element do
if not dontHide then
for i = visible + offset + 1, getn(element) do
element[i]:Hide()
end
end
@@ -288,42 +290,43 @@ local function filterIcons(element, unit, filter, limit, isDebuff, offset, dontH
end
local function UpdateAuras(self, event, unit)
if(self.unit ~= unit) then return end
if event == "PLAYER_AURAS_CHANGED" then unit = "player" end
if self.unit ~= unit then return end
local auras = self.Auras
if(auras) then
if auras then
--[[ Callback: Auras:PreUpdate(unit)
Called before the element has been updated.
* self - the widget holding the aura buttons
* unit - the unit for which the update has been triggered (string)
--]]
if(auras.PreUpdate) then auras:PreUpdate(unit) end
if auras.PreUpdate then auras:PreUpdate(unit) end
local numBuffs = auras.numBuffs or 32
local numDebuffs = auras.numDebuffs or 40
local max = auras.numTotal or numBuffs + numDebuffs
local visibleBuffs, hiddenBuffs = filterIcons(auras, unit, auras.buffFilter or auras.filter or 'HELPFUL', math.min(numBuffs, max), nil, 0, true)
local visibleBuffs, hiddenBuffs = filterIcons(auras, unit, auras.buffFilter or auras.filter or 'HELPFUL', min(numBuffs, max), nil, 0, true)
local hasGap
if(visibleBuffs ~= 0 and auras.gap) then
if visibleBuffs ~= 0 and auras.gap then
hasGap = true
visibleBuffs = visibleBuffs + 1
local button = auras[visibleBuffs]
if(not button) then
if not button then
button = (auras.CreateIcon or createAuraIcon) (auras, visibleBuffs)
tinsert(auras, button)
auras.createdIcons = auras.createdIcons + 1
end
-- Prevent the button from displaying anything.
if(button.cd) then button.cd:Hide() end
if(button.icon) then button.icon:SetTexture() end
if(button.overlay) then button.overlay:Hide() end
if(button.stealable) then button.stealable:Hide() end
if(button.count) then button.count:SetText() end
if button.icon then button.icon:SetTexture() end
if button.overlay then button.overlay:Hide() end
if button.stealable then button.stealable:Hide() end
if button.count then button.count:SetText() end
button:EnableMouse(false)
button:Show()
@@ -341,10 +344,10 @@ local function UpdateAuras(self, event, unit)
end
end
local visibleDebuffs, hiddenDebuffs = filterIcons(auras, unit, auras.debuffFilter or auras.filter or 'HARMFUL', math.min(numDebuffs, max - visibleBuffs), true, visibleBuffs)
local visibleDebuffs, hiddenDebuffs = filterIcons(auras, unit, auras.debuffFilter or auras.filter or 'HARMFUL', min(numDebuffs, max - visibleBuffs), true, visibleBuffs)
auras.visibleDebuffs = visibleDebuffs
if(hasGap and visibleDebuffs == 0) then
if hasGap and visibleDebuffs == 0 then
auras[visibleBuffs]:Hide()
visibleBuffs = visibleBuffs - 1
end
@@ -364,11 +367,11 @@ local function UpdateAuras(self, event, unit)
* from - the offset of the first aura button to be (re-)anchored (number)
* to - the offset of the last aura button to be (re-)anchored (number)
--]]
if(auras.PreSetPosition) then
if auras.PreSetPosition then
fromRange, toRange = auras:PreSetPosition(max)
end
if(fromRange or auras.createdIcons > auras.anchoredIcons) then
if fromRange or auras.createdIcons > auras.anchoredIcons then
--[[ Override: Auras:SetPosition(from, to)
Used to (re-)anchor the aura buttons.
Called when new aura buttons have been created or if :PreSetPosition is defined.
@@ -387,72 +390,72 @@ local function UpdateAuras(self, event, unit)
* self - the widget holding the aura buttons
* unit - the unit for which the update has been triggered (string)
--]]
if(auras.PostUpdate) then auras:PostUpdate(unit) end
if auras.PostUpdate then auras:PostUpdate(unit) end
end
local buffs = self.Buffs
if(buffs) then
if(buffs.PreUpdate) then buffs:PreUpdate(unit) end
if buffs then
if buffs.PreUpdate then buffs:PreUpdate(unit) end
local numBuffs = buffs.num or 32
local visibleBuffs, hiddenBuffs = filterIcons(buffs, unit, buffs.filter or 'HELPFUL', numBuffs)
buffs.visibleBuffs = visibleBuffs
local fromRange, toRange
if(buffs.PreSetPosition) then
if buffs.PreSetPosition then
fromRange, toRange = buffs:PreSetPosition(numBuffs)
end
if(fromRange or buffs.createdIcons > buffs.anchoredIcons) then
if fromRange or buffs.createdIcons > buffs.anchoredIcons then
(buffs.SetPosition or SetPosition) (buffs, fromRange or buffs.anchoredIcons + 1, toRange or buffs.createdIcons)
buffs.anchoredIcons = buffs.createdIcons
end
if(buffs.PostUpdate) then buffs:PostUpdate(unit) end
if buffs.PostUpdate then buffs:PostUpdate(unit) end
end
local debuffs = self.Debuffs
if(debuffs) then
if(debuffs.PreUpdate) then debuffs:PreUpdate(unit) end
if debuffs then
if debuffs.PreUpdate then debuffs:PreUpdate(unit) end
local numDebuffs = debuffs.num or 40
local visibleDebuffs, hiddenDebuffs = filterIcons(debuffs, unit, debuffs.filter or 'HARMFUL', numDebuffs, true)
debuffs.visibleDebuffs = visibleDebuffs
local fromRange, toRange
if(debuffs.PreSetPosition) then
if debuffs.PreSetPosition then
fromRange, toRange = debuffs:PreSetPosition(numDebuffs)
end
if(fromRange or debuffs.createdIcons > debuffs.anchoredIcons) then
if fromRange or debuffs.createdIcons > debuffs.anchoredIcons then
(debuffs.SetPosition or SetPosition) (debuffs, fromRange or debuffs.anchoredIcons + 1, toRange or debuffs.createdIcons)
debuffs.anchoredIcons = debuffs.createdIcons
end
if(debuffs.PostUpdate) then debuffs:PostUpdate(unit) end
if debuffs.PostUpdate then debuffs:PostUpdate(unit) end
end
end
local function Update(self, event, unit)
if(self.unit ~= unit) then return end
if self.unit ~= unit then return end
UpdateAuras(self, event, unit)
-- Assume no event means someone wants to re-anchor things. This is usually
-- done by UpdateAllElements and :ForceUpdate.
if(event == 'ForceUpdate' or not event) then
if event == 'ForceUpdate' or not event then
local buffs = self.Buffs
if(buffs) then
if buffs then
(buffs.SetPosition or SetPosition) (buffs, 1, buffs.createdIcons)
end
local debuffs = self.Debuffs
if(debuffs) then
if debuffs then
(debuffs.SetPosition or SetPosition) (debuffs, 1, debuffs.createdIcons)
end
local auras = self.Auras
if(auras) then
if auras then
(auras.SetPosition or SetPosition) (auras, 1, auras.createdIcons)
end
end
@@ -463,11 +466,12 @@ local function ForceUpdate(element)
end
local function Enable(self)
if(self.Buffs or self.Debuffs or self.Auras) then
if self.Buffs or self.Debuffs or self.Auras then
self:RegisterEvent('PLAYER_AURAS_CHANGED', UpdateAuras)
self:RegisterEvent('UNIT_AURA', UpdateAuras)
local buffs = self.Buffs
if(buffs) then
if buffs then
buffs.__owner = self
buffs.ForceUpdate = ForceUpdate
@@ -478,7 +482,7 @@ local function Enable(self)
end
local debuffs = self.Debuffs
if(debuffs) then
if debuffs then
debuffs.__owner = self
debuffs.ForceUpdate = ForceUpdate
@@ -489,7 +493,7 @@ local function Enable(self)
end
local auras = self.Auras
if(auras) then
if auras then
auras.__owner = self
auras.ForceUpdate = ForceUpdate
@@ -504,13 +508,14 @@ local function Enable(self)
end
local function Disable(self)
if(self.Buffs or self.Debuffs or self.Auras) then
if self.Buffs or self.Debuffs or self.Auras then
self:UnregisterEvent('PLAYER_AURAS_CHANGED', UpdateAuras)
self:UnregisterEvent('UNIT_AURA', UpdateAuras)
if(self.Buffs) then self.Buffs:Hide() end
if(self.Debuffs) then self.Debuffs:Hide() end
if(self.Auras) then self.Auras:Hide() end
if self.Buffs then self.Buffs:Hide() end
if self.Debuffs then self.Debuffs:Hide() end
if self.Auras then self.Auras:Hide() end
end
end
oUF:AddElement('Auras', Update, Enable, Disable)
oUF:AddElement('Auras', Update, Enable, Disable)
+101 -245
View File
@@ -11,9 +11,7 @@ Castbar - A `StatusBar` to represent spell cast/channel progress.
## Sub-Widgets
.Text - A `FontString` to represent spell name.
.Icon - A `Texture` to represent spell icon.
.Time - A `FontString` to represent spell duration.
.SafeZone - A `Texture` to represent latency.
## Notes
@@ -52,138 +50,80 @@ A default texture will be applied to the StatusBar and Texture widgets if they d
Text:SetPoint("LEFT", Castbar)
-- Add spell icon
local Icon = Castbar:CreateTexture(nil, "OVERLAY")
local Icon = Castbar:CreateTexture(nil, 'OVERLAY')
Icon:SetSize(20, 20)
Icon:SetPoint("TOPLEFT", Castbar, "TOPLEFT")
-- Add safezone
local SafeZone = Castbar:CreateTexture(nil, "OVERLAY")
Icon:SetPoint('TOPLEFT', Castbar, 'TOPLEFT')
-- Register it with oUF
Castbar.bg = Background
Castbar.Spark = Spark
Castbar.Time = Time
Castbar.Text = Text
Castbar.Icon = Icon
Castbar.SafeZone = SafeZone
Castbar.Icon = Icon
self.Castbar = Castbar
--]]
local ns = oUF
local oUF = ns.oUF
local match = string.match
local GetNetStats = GetNetStats
local GetActionTexture = GetActionTexture
local GetContainerItemInfo = GetContainerItemInfo
local GetSpellTexture = GetSpellTexture
local GetTime = GetTime
local UnitCastingInfo = UnitCastingInfo
local UnitChannelInfo = UnitChannelInfo
local UnitIsUnit = UnitIsUnit
local tradeskillCastTime, tradeskillCastDuration, tradeskillCurrent, tradeskillTotal, mergeTradeskill = 0, 0, 0, 0, false
local iconTexture
hooksecurefunc("UseAction", function(id)
iconTexture = GetActionTexture(id)
end)
local function updateSafeZone(self)
local safeZone = self.SafeZone
local width = self:GetWidth()
local _, _, ms = GetNetStats()
hooksecurefunc("CastSpell", function(id, bookType)
iconTexture = GetSpellTexture(id, bookType)
end)
-- Guard against GetNetStats returning latencies of 0.
if(ms ~= 0) then
local safeZoneRatio = (ms / 1e3) / self.max
if(safeZoneRatio > 1) then
safeZoneRatio = 1
end
safeZone:SetWidth(width * safeZoneRatio)
safeZone:Show()
else
safeZone:Hide()
end
end
hooksecurefunc("UseContainerItem", function(id, index)
iconTexture = GetContainerItemInfo(id, index)
end)
local function UNIT_SPELLCAST_SENT(self, event, unit, spell, rank, target)
local function SPELLCAST_START(self, event, name, endTime)
local element = self.Castbar
element.curTarget = (target and target ~= "") and target or nil
if element.isTradeSkill then
element.tradeSkillCastName = spell
end
end
local function UNIT_SPELLCAST_START(self, event, unit)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local element = self.Castbar
local name, _, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(unit)
if(not name) then
return element:Hide()
end
endTime = endTime / 1e3
startTime = startTime / 1e3
local max = endTime - startTime
element.castName = name
element.duration = GetTime() - startTime
element.max = max
endTime = endTime / 1000
element.startTime = GetTime()
element.duration = element.startTime
element.max = endTime
element.delay = 0
element.casting = true
element.holdTime = 0
element.isTradeSkill = isTradeSkill
if(mergeTradeskill and isTradeSkill and UnitIsUnit(unit, "player")) then
element.duration = element.duration + (element.max * tradeskillCurrent)
element.max = max * tradeskillTotal
if(unit == "player") then
tradeskillCurrent = tradeskillCurrent + 1
tradeskillCastDuration = element.duration
tradeskillCastTime = max
end
element:SetValue(element.duration)
else
element:SetValue(0)
end
element:SetMinMaxValues(0, element.max)
element:SetValue(0)
if(element.Text) then element.Text:SetText(text) end
if(element.Icon) then element.Icon:SetTexture(texture) end
if(element.Time) then element.Time:SetText() end
local sf = element.SafeZone
if(sf) then
sf:ClearAllPoints()
sf:SetPoint("RIGHT")
sf:SetPoint("TOP")
sf:SetPoint("BOTTOM")
updateSafeZone(element)
if(element.Text) then element.Text:SetText(name) end
if(element.Icon) then
if(not iconTexture) then iconTexture = "Interface\\Icons\\Ability_Ambush" end
element.Icon:SetTexture(iconTexture)
iconTexture = nil
end
if(element.Time) then element.Time:SetText() end
--[[ Callback: Castbar:PostCastStart(unit, name)
Called after the element has been updated upon a spell cast start.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the spell being cast (string)
--]]
if(element.PostCastStart) then
element:PostCastStart(unit, name)
element:PostCastStart(name)
end
element:Show()
end
local function UNIT_SPELLCAST_FAILED(self, event, unit, spellname)
local function SPELLCAST_FAILED(self, event)
if(not self.casting) then return end
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local element = self.Castbar
if(spellname and (element.castName ~= spellname and element.tradeSkillCastName ~= spellname)) then
return
end
if(mergeTradeskill and UnitIsUnit(unit, "player")) then
mergeTradeskill = false
element.tradeSkillCastName = nil
end
local text = element.Text
if(text) then
@@ -197,40 +137,14 @@ local function UNIT_SPELLCAST_FAILED(self, event, unit, spellname)
Called after the element has been updated upon a failed spell cast.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the failed spell (string)
--]]
if(element.PostCastFailed) then
return element:PostCastFailed(unit, spellname)
return element:PostCastFailed()
end
end
local function UNIT_SPELLCAST_FAILED_QUIET(self, event, unit, spellname)
if(not self.casting) then return end
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local function SPELLCAST_INTERRUPTED(self, event)
local element = self.Castbar
if(spellname and (element.castName ~= spellname and element.tradeSkillCastName ~= spellname)) then
return
end
if(mergeTradeskill and UnitIsUnit(unit, "player")) then
mergeTradeskill = false
element.tradeSkillCastName = nil
end
element.casting = nil
element:SetValue(0)
element:Hide()
end
local function UNIT_SPELLCAST_INTERRUPTED(self, event, unit, spellname)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local element = self.Castbar
if(spellname and element.castName ~= spellname) then
return
end
local text = element.Text
if(text) then
@@ -245,25 +159,22 @@ local function UNIT_SPELLCAST_INTERRUPTED(self, event, unit, spellname)
Called after the element has been updated upon an interrupted spell cast.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the interrupted spell (string)
--]]
if(element.PostCastInterrupted) then
return element:PostCastInterrupted(unit, spellname)
return element:PostCastInterrupted()
end
end
local function UNIT_SPELLCAST_DELAYED(self, event, unit)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local function SPELLCAST_DELAYED(self, event, delay)
local element = self.Castbar
local name, _, _, _, startTime = UnitCastingInfo(unit)
if(not startTime or not element:IsShown()) then return end
if(not delay or not element:IsShown()) then return end
local duration = GetTime() - (startTime / 1000)
delay = delay / 1000
local duration = GetTime() - (element.startTime / 1000)
if(duration < 0) then duration = 0 end
element.delay = element.delay + element.duration - duration
element.startTime = element.startTime + delay
element.delay = delay
element.duration = duration
element:SetValue(duration)
@@ -272,27 +183,20 @@ local function UNIT_SPELLCAST_DELAYED(self, event, unit)
Called after the element has been updated when a spell cast has been delayed.
* self - the Castbar widget
* unit - unit that the update has been triggered (string)
* name - name of the delayed spell (string)
--]]
if(element.PostCastDelayed) then
return element:PostCastDelayed(unit, name)
return element:PostCastDelayed()
end
end
local function UNIT_SPELLCAST_STOP(self, event, unit, spellname)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local function SPELLCAST_STOP(self, event)
local element = self.Castbar
if(spellname and (element.castName ~= spellname)) then
return
if(element.casting or element.channeling) then
iconTexture = nil
end
if(mergeTradeskill and UnitIsUnit(unit, "player")) then
if(tradeskillCurrent == tradeskillTotal) then
mergeTradeskill = false
end
else
if(element:IsShown()) then
element.casting = nil
end
@@ -300,34 +204,23 @@ local function UNIT_SPELLCAST_STOP(self, event, unit, spellname)
Called after the element has been updated when a spell cast has finished.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the spell (string)
--]]
if(element.PostCastStop) then
return element:PostCastStop(unit, spellname)
return element:PostCastStop()
end
end
local function UNIT_SPELLCAST_CHANNEL_START(self, event, unit)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local function SPELLCAST_CHANNEL_START(self, event, endTime, name)
local element = self.Castbar
local name, _, _, texture, startTime, endTime = UnitChannelInfo(unit)
if(not name) then
return
end
endTime = endTime / 1e3
startTime = startTime / 1e3
local max = (endTime - startTime)
local duration = endTime - GetTime()
element.duration = duration
element.max = max
endTime = endTime / 1000
element.startTime = GetTime()
element.duration = element.startTime + endTime
element.max = endTime
element.delay = 0
element.startTime = startTime
element.endTime = endTime
element.extraTickRatio = 0
element.channeling = true
element.holdTime = 0
@@ -335,71 +228,54 @@ local function UNIT_SPELLCAST_CHANNEL_START(self, event, unit)
-- executed or be fully completed by the OnUpdate handler before CHANNEL_START
-- is called.
element.casting = nil
element.castName = nil
element:SetMinMaxValues(0, max)
element:SetValue(duration)
element:SetMinMaxValues(0, endTime)
element:SetValue(endTime)
if(element.Text) then element.Text:SetText(name) end
if(element.Icon) then element.Icon:SetTexture(texture) end
if(element.Time) then element.Time:SetText() end
local sf = element.SafeZone
if(sf) then
sf:ClearAllPoints()
sf:SetPoint("LEFT")
sf:SetPoint("TOP")
sf:SetPoint("BOTTOM")
updateSafeZone(element)
if(element.Icon) then
if(not iconTexture) then iconTexture = "Interface\\Icons\\Ability_Ambush" end
element.Icon:SetTexture(iconTexture)
iconTexture = nil
end
if(element.Time) then element.Time:SetText() end
--[[ Callback: Castbar:PostChannelStart(unit, name)
Called after the element has been updated upon a spell channel start.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the channeled spell (string)
--]]
if(element.PostChannelStart) then
element:PostChannelStart(unit, name)
element:PostChannelStart(name)
end
element:Show()
end
local function UNIT_SPELLCAST_CHANNEL_UPDATE(self, event, unit)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local function SPELLCAST_CHANNEL_UPDATE(self, event, delay)
local element = self.Castbar
local name, _, _, _, startTime, endTime = UnitChannelInfo(unit)
if(not name or not element:IsShown()) then
if(not element:IsShown()) then
return
end
local duration = (endTime / 1000) - GetTime()
element.delay = element.delay + element.duration - duration
delay = delay / 1000
local duration = element.startTime + (element.max - GetTime()) - delay
element.delay = element.delay - duration
element.duration = duration
element.max = (endTime - startTime) / 1000
element.startTime = startTime / 1000
element.endTime = endTime / 1000
element:SetMinMaxValues(0, element.max)
element.startTime = element.startTime - duration
element:SetValue(duration)
--[[ Callback: Castbar:PostChannelUpdate(unit, name)
Called after the element has been updated after a channeled spell has been delayed or interrupted.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the channeled spell (string)
--]]
if(element.PostChannelUpdate) then
return element:PostChannelUpdate(unit, name)
return element:PostChannelUpdate()
end
end
local function UNIT_SPELLCAST_CHANNEL_STOP(self, event, unit, spellname)
if(self.unit ~= unit and self.realUnit ~= unit) then return end
local function SPELLCAST_CHANNEL_STOP(self, event)
local element = self.Castbar
if(element:IsShown()) then
element.channeling = nil
@@ -408,22 +284,20 @@ local function UNIT_SPELLCAST_CHANNEL_STOP(self, event, unit, spellname)
Called after the element has been updated after a channeled spell has been completed.
* self - the Castbar widget
* unit - unit for which the update has been triggered (string)
* name - name of the channeled spell (string)
--]]
if(element.PostChannelStop) then
return element:PostChannelStop(unit, spellname)
return element:PostChannelStop()
end
end
end
local function onUpdate(self, elapsed)
if(self.casting) then
local duration = self.duration + elapsed
if(duration >= self.max or (tradeskillTotal > 1 and duration >= (tradeskillCastDuration + tradeskillCastTime * 1.25))) then
local duration = GetTime() - self.startTime
if(duration >= self.max) then
self.casting = nil
self:Hide()
tradeskillTotal = 0
if(self.PostCastStop) then self:PostCastStop(self.__owner.unit) end
return
@@ -449,10 +323,10 @@ local function onUpdate(self, elapsed)
self:SetValue(duration)
if(self.Spark) then
self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0)
self.Spark:SetPoint("CENTER", self, "LEFT", (duration / ((self.startTime + self.max) - self.startTime)) * self:GetWidth(), 0)
end
elseif(self.channeling) then
local duration = self.duration - elapsed
local duration = self.startTime + (self.max - GetTime())
if(duration <= 0) then
self.channeling = nil
@@ -489,15 +363,14 @@ local function onUpdate(self, elapsed)
self.casting = nil
self.castName = nil
self.channeling = nil
tradeskillTotal = 0
self:Hide()
end
end
local function Update(self, ...)
UNIT_SPELLCAST_START(self, ...)
return UNIT_SPELLCAST_CHANNEL_START(self, ...)
SPELLCAST_START(self, unpack(arg))
return SPELLCAST_CHANNEL_START(self, unpack(arg))
end
local function ForceUpdate(element)
@@ -510,30 +383,28 @@ local function Enable(self, unit)
element.__owner = self
element.ForceUpdate = ForceUpdate
if(not (unit and match(unit, "%wtarget$"))) then
self:RegisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START)
self:RegisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED)
self:RegisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP)
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED)
self:RegisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED)
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", UNIT_SPELLCAST_CHANNEL_START)
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE)
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP)
self:RegisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT, true)
self:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET", UNIT_SPELLCAST_FAILED_QUIET)
end
element.holdTime = 0
element:SetScript("OnUpdate", element.OnUpdate or onUpdate)
element:SetScript("OnUpdate", function()
if element.OnUpdate then
else
onUpdate(this, arg1)
end
end)
if(unit == "player") then
self:RegisterEvent("SPELLCAST_START", SPELLCAST_START)
self:RegisterEvent("SPELLCAST_STOP", SPELLCAST_STOP)
self:RegisterEvent("SPELLCAST_FAILED", SPELLCAST_FAILED)
self:RegisterEvent("SPELLCAST_INTERRUPTED", SPELLCAST_INTERRUPTED)
self:RegisterEvent("SPELLCAST_DELAYED", SPELLCAST_DELAYED)
self:RegisterEvent("SPELLCAST_CHANNEL_START", SPELLCAST_CHANNEL_START)
self:RegisterEvent("SPELLCAST_CHANNEL_UPDATE", SPELLCAST_CHANNEL_UPDATE)
self:RegisterEvent("SPELLCAST_CHANNEL_STOP", SPELLCAST_CHANNEL_STOP)
if(self.unit == "player") then
CastingBarFrame:UnregisterAllEvents()
CastingBarFrame.Show = CastingBarFrame.Hide
CastingBarFrame:Hide()
PetCastingBarFrame:UnregisterAllEvents()
PetCastingBarFrame.Show = PetCastingBarFrame.Hide
PetCastingBarFrame:Hide()
end
if(element:IsObjectType("StatusBar") and not element:GetStatusBarTexture()) then
@@ -545,11 +416,6 @@ local function Enable(self, unit)
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
end
local safeZone = element.SafeZone
if(safeZone and safeZone:IsObjectType("Texture") and not safeZone:GetTexture()) then
safeZone:SetTexture(1, 0, 0)
end
element:Hide()
return true
@@ -561,27 +427,17 @@ local function Disable(self)
if(element) then
element:Hide()
self:UnregisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START)
self:UnregisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED)
self:UnregisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP)
self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED)
self:UnregisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED)
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START", UNIT_SPELLCAST_CHANNEL_START)
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE)
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP)
self:UnregisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT)
self:UnregisterEvent("UNIT_SPELLCAST_FAILED_QUIET", UNIT_SPELLCAST_FAILED_QUIET)
self:UnregisterEvent("SPELLCAST_START", SPELLCAST_START)
self:UnregisterEvent("SPELLCAST_FAILED", SPELLCAST_FAILED)
self:UnregisterEvent("SPELLCAST_STOP", SPELLCAST_STOP)
self:UnregisterEvent("SPELLCAST_INTERRUPTED", SPELLCAST_INTERRUPTED)
self:UnregisterEvent("SPELLCAST_DELAYED", SPELLCAST_DELAYED)
self:UnregisterEvent("SPELLCAST_CHANNEL_START", SPELLCAST_CHANNEL_START)
self:UnregisterEvent("SPELLCAST_CHANNEL_UPDATE", SPELLCAST_CHANNEL_UPDATE)
self:UnregisterEvent("SPELLCAST_CHANNEL_STOP", SPELLCAST_CHANNEL_STOP)
element:SetScript("OnUpdate", nil)
end
end
hooksecurefunc("DoTradeSkill", function(_, num)
tradeskillCastTime = 0
tradeskillCastDuration = 0
tradeskillCurrent = 0
tradeskillTotal = num or 1
mergeTradeskill = true
end)
oUF:AddElement("Castbar", Update, Enable, Disable)
oUF:AddElement("Castbar", function() end, Enable, Disable)
+5 -6
View File
@@ -1,21 +1,20 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="power.lua"/>
<!--<Script file="auras.lua"/>-->
<Script file="auras.lua"/>
<Script file="health.lua"/>
<Script file="raidtargetindicator.lua"/>
<Script file="leaderindicator.lua"/>
<Script file="combatindicator.lua"/>
<Script file="restingindicator.lua"/>
<!--<Script file="pvpindicator.lua"/>-->
<Script file="pvpindicator.lua"/>
<Script file="portrait.lua"/>
<!--
<Script file="range.lua"/>
<Script file="castbar.lua"/>-->
<Script file="range.lua"/>-->
<Script file="castbar.lua"/>
<Script file="tags.lua"/>
<Script file="masterlooterindicator.lua"/>
<Script file="assistantindicator.lua"/>
<!--<Script file="readycheckindicator.lua"/>
<Script file="combopoints.lua"/>
<!--<Script file="combopoints.lua"/>
<Script file="raidroleindicator.lua"/>
<Script file="happinessindicator.lua"/>
-->
@@ -87,7 +87,7 @@ local function Path(self, ...)
* event - the event triggering the update (string)
* ... - the arguments accompanying the event
--]]
return (self.PvPIndicator.Override or Update) (self, ...)
return (self.PvPIndicator.Override or Update) (self, unpack(arg))
end
local function ForceUpdate(element)
@@ -1,152 +0,0 @@
--[[
# Element: Ready Check Indicator
Handles the visibility and updating of an indicator based on the unit's ready check status.
## Widget
ReadyCheckIndicator - A `Texture` representing ready check status.
## Notes
This element updates by changing the texture.
Default textures will be applied if the layout does not provide custom ones. See Options.
## Options
.finishedTime - For how many seconds the icon should stick after a check has completed. Defaults to 10 (number).
.fadeTime - For how many seconds the icon should fade away after the stick duration has completed. Defaults to
1.5 (number).
.readyTexture - Path to an alternate texture for the ready check "ready" status.
.notReadyTexture - Path to an alternate texture for the ready check "notready" status.
.waitingTexture - Path to an alternate texture for the ready check "waiting" status.
## Attributes
.status - the unit"s ready check status (string?)["ready", "noready", "waiting"]
## Examples
-- Position and size
local ReadyCheckIndicator = self:CreateTexture(nil, "OVERLAY")
ReadyCheckIndicator:SetSize(16, 16)
ReadyCheckIndicator:SetPoint("TOP")
-- Register with oUF
self.ReadyCheckIndicator = ReadyCheckIndicator
--]]
local ns = oUF
local oUF = ns.oUF
local sub = string.sub
local GetReadyCheckStatus = GetReadyCheckStatus
local UnitExists = UnitExists
local function OnFinished(self)
local element = self:GetParent()
element:Hide()
--[[ Callback: ReadyCheckIndicator:PostUpdateFadeOut()
Called after the element has been faded out.
* self - the ReadyCheckIndicator element
--]]
if(element.PostUpdateFadeOut) then
element:PostUpdateFadeOut()
end
end
local function Update(self, event)
local element = self.ReadyCheckIndicator
--[[ Callback: ReadyCheckIndicator:PreUpdate()
Called before the element has been updated.
* self - the ReadyCheckIndicator element
--]]
if(element.PreUpdate) then
element:PreUpdate()
end
local unit = self.unit
local status = GetReadyCheckStatus(unit)
if(UnitExists(unit) and status) then
if(status == "ready") then
element:SetTexture(element.readyTexture)
elseif(status == "notready") then
element:SetTexture(element.notReadyTexture)
else
element:SetTexture(element.waitingTexture)
end
element.status = status
element:Show()
elseif(event ~= "READY_CHECK_FINISHED") then
element.status = nil
element:Hide()
end
if(event == "READY_CHECK_FINISHED") then
if(element.status == "waiting") then
element:SetTexture(element.notReadyTexture)
end
end
--[[ Callback: ReadyCheckIndicator:PostUpdate(status)
Called after the element has been updated.
* self - the ReadyCheckIndicator element
* status - the unit"s ready check status (string?)["ready", "notready", "waiting"]
--]]
if(element.PostUpdate) then
return element:PostUpdate(status)
end
end
local function Path(self, ...)
--[[ Override: ReadyCheckIndicator.Override(self, event, ...)
Used to completely override the internal update function.
* self - the parent object
* event - the event triggering the update (string)
* ... - the arguments accompanying the event
--]]
return (self.ReadyCheckIndicator.Override or Update) (self, ...)
end
local function ForceUpdate(element)
return Path(element.__owner, "ForceUpdate")
end
local function Enable(self, unit)
local element = self.ReadyCheckIndicator
if(element and (unit and (sub(unit, 1, 5) == "party" or sub(unit, 1, 4) == "raid"))) then
element.__owner = self
element.ForceUpdate = ForceUpdate
element.readyTexture = element.readyTexture or READY_CHECK_READY_TEXTURE
element.notReadyTexture = element.notReadyTexture or READY_CHECK_NOT_READY_TEXTURE
element.waitingTexture = element.waitingTexture or READY_CHECK_WAITING_TEXTURE
self:RegisterEvent("READY_CHECK", Path, true)
self:RegisterEvent("READY_CHECK_CONFIRM", Path, true)
self:RegisterEvent("READY_CHECK_FINISHED", Path, true)
return true
end
end
local function Disable(self)
local element = self.ReadyCheckIndicator
if(element) then
element:Hide()
self:UnregisterEvent("READY_CHECK", Path)
self:UnregisterEvent("READY_CHECK_CONFIRM", Path)
self:UnregisterEvent("READY_CHECK_FINISHED", Path)
end
end
oUF:AddElement("ReadyCheckIndicator", Path, Enable, Disable)
+2 -2
View File
@@ -615,8 +615,8 @@ local function Tag(self, fs, tagstr)
tinsert(self.__mousetags, fs)
fs:SetAlpha(0)
if not self.__HookFunc then
self:HookScript('OnEnter', OnEnter)
self:HookScript('OnLeave', OnLeave)
HookScript(self, 'OnEnter', function() OnEnter(this) end)
HookScript(self, 'OnLeave', function() OnLeave(this) end)
self.__HookFunc = true;
end
tagstr = string.gsub(tagstr, '%[mouseover%]', '')
+1 -43
View File
@@ -1,7 +1,7 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="templates.lua"/>
<Include file="templates.xml"/>
<Script file="init.lua"/>
<Script file="private.lua"/>
<Script file="ouf.lua"/>
@@ -16,46 +16,4 @@
<Cooldown name="oUF_CooldownFrameTemplate" inherits="CooldownFrameTemplate" drawEdge="true" virtual="true"/>
<!--
Sub-object as a child of the parent unit frame:
<Button name="oUF_HeaderTargetTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
<Frames>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
Separate unit template example:
<Button name="oUF_HeaderSeparateSubOjectsTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
<Attributes>
<Attribute name="oUF-onlyProcessChildren" type="boolean" value="true"/>
</Attributes>
<Frames>
<Button name="$parentUnit" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
<Button name="$parentPet" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="pet"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
-->
</Ui>
+8 -10
View File
@@ -59,7 +59,7 @@ local function onAttributeChanged(self, name, value)
if(not self.onlyProcessChildren) then
updateActiveUnit(self, "OnAttributeChanged")
end
--[[
if(self.unit and self.unit == value) then
return
else
@@ -67,7 +67,7 @@ local function onAttributeChanged(self, name, value)
iterateChildren(self:GetChildren())
end
end
]]
end
end
@@ -273,8 +273,8 @@ local function togglemenu(self, unit)
ToggleDropDownMenu(1, nil, secureDropdown, "cursor")
end
local function onShow()
return this:UpdateAllElements("OnShow")
local function onShow(self)
return self:UpdateAllElements("OnShow")
end
local function initObject(unit, style, styleFunc, header, ...)
@@ -282,7 +282,7 @@ local function initObject(unit, style, styleFunc, header, ...)
for i = 1, num do
local object = arg[i]
local objectUnit = object.guessUnit or unit
local suffix = match(objectUnit or unit, "%w+target")
local suffix = objectUnit and match(objectUnit or unit, "%w+target")
object.__elements = {}
object.__registeredEvents = {}
@@ -331,8 +331,7 @@ local function initObject(unit, style, styleFunc, header, ...)
styleFunc(object, objectUnit, not header)
--object:SetScript("OnAttributeChanged", onAttributeChanged)
object:SetScript("OnShow", onShow)
object:SetScript("OnShow", function() onShow(this) end)
activeElements[object] = {}
for element in next, elements do
@@ -359,7 +358,6 @@ local function walkObject(object, unit)
-- Check if we should leave the main frame blank.
if(object.onlyProcessChildren) then
object.hasChildren = true
--object:SetScript("OnAttributeChanged", onAttributeChanged)
return initObject(unit, style, styleFunc, header, object:GetChildren())
end
@@ -620,7 +618,7 @@ do
end
--[[if(visibility) then
if(visibility) then
local type, list = split(" ", visibility, 2)
if(list and type == "custom") then
RegisterStateDriver(header, "visibility", list)
@@ -630,7 +628,7 @@ do
RegisterStateDriver(header, "visibility", condition)
header.visibility = condition
end
end]]
end
return header
end
+4 -3
View File
@@ -1,5 +1,6 @@
local pairs = pairs
local ipairs = ipairs
local upper = string.upper
local unitExistsWatchers = {}
local unitExistsCache = setmetatable({},{
@@ -94,7 +95,7 @@ end
-- Given a point return the opposite point and which axes the point
-- depends on.
local function getRelativePointAnchor(point)
point = strupper(point)
point = upper(point)
if point == "TOP" then
return "BOTTOM", 0, -1
elseif point == "BOTTOM" then
@@ -139,7 +140,7 @@ local function fillTable(tbl, ...)
for key in pairs(tbl) do
tbl[key] = nil
end
for i = 1, getn(arg), 1 do
for i = 1, arg.n, 1 do
local key = arg[i]
key = tonumber(key) or key
tbl[key] = true
@@ -150,7 +151,7 @@ end
-- the array portion of the table in order
local function doubleFillTable(tbl, ...)
fillTable(tbl, unpack(arg))
for i = 1, getn(arg), 1 do
for i = 1, arg.n, 1 do
tbl[i] = arg[i]
end
end
@@ -0,0 +1,391 @@
local ns = oUF
local oUF = ns.oUF
assert(oUF, "oUF_AuraBars was unable to locate oUF install.")
local format = string.format
local floor, huge, min, mod = math.floor, math.huge, math.min, math.mod
local tsort, getn = table.sort, table.getn
local tremove = table.remove
local random = math.random
local CreateFrame = CreateFrame
local UnitAura = UnitAura
local UnitIsFriend = UnitIsFriend
local DAY, HOUR, MINUTE = 86400, 3600, 60
local function FormatTime(s)
if s < MINUTE then
return format("%.1fs", s)
elseif s < HOUR then
return format("%dm %ds", mod(s/60,60), mod(s,60))
elseif s < DAY then
return format("%dh %dm", s/(60*60), mod(s/60,60))
else
return format("%dd %dh", s/DAY, (s / HOUR) - (floor(s/DAY) * 24))
end
end
local function UpdateTooltip(self)
GameTooltip:SetUnitAura(self.__unit, self:GetParent().aura.name, self:GetParent().aura.rank, self:GetParent().aura.filter)
end
local function OnEnter(self)
if(not self:IsVisible()) then return end
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
self:UpdateTooltip()
end
local function OnLeave(self)
GameTooltip:Hide()
end
local function SetAnchors(self)
local bars = self.bars
for index = 1, getn(bars) do
local frame = bars[index]
local anchor = frame.anchor
frame:Height(self.auraBarHeight or 20)
frame.statusBar.iconHolder:Size(frame:GetHeight())
frame:Width((self.auraBarWidth or self:GetWidth()) - (frame:GetHeight() + (self.gap or 0)))
frame:ClearAllPoints()
if self.down == true then
if self == anchor then -- Root frame so indent for icon
frame:SetPoint("TOPLEFT", anchor, "TOPLEFT", (frame:GetHeight() + (self.gap or 0) ), -1)
else
frame:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, (-self.spacing or 0))
end
else
if self == anchor then -- Root frame so indent for icon
frame:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", (frame:GetHeight() + (self.gap or 0)), 1)
else
frame:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, (self.spacing or 0))
end
end
end
end
local function CreateAuraBar(oUF, anchor)
local auraBarParent = oUF.AuraBars
local frame = CreateFrame("Frame", nil, auraBarParent)
frame:SetHeight(auraBarParent.auraBarHeight or 20)
frame:SetWidth((auraBarParent.auraBarWidth or auraBarParent:GetWidth()) - (frame:GetHeight() + (auraBarParent.gap or 0)))
frame.anchor = anchor
-- the main bar
local statusBar = CreateFrame("StatusBar", nil, frame)
statusBar:SetStatusBarTexture(auraBarParent.auraBarTexture or [[Interface\TargetingFrame\UI-StatusBar]])
statusBar:SetAlpha(auraBarParent.fgalpha or 1)
statusBar:SetAllPoints(frame)
frame.statusBar = statusBar
if auraBarParent.down == true then
if auraBarParent == anchor then -- Root frame so indent for icon
frame:SetPoint("TOPLEFT", anchor, "TOPLEFT", (frame:GetHeight() + (auraBarParent.gap or 0) ), -1)
else
frame:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, (-auraBarParent.spacing or 0))
end
else
if auraBarParent == anchor then -- Root frame so indent for icon
frame:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", (frame:GetHeight() + (auraBarParent.gap or 0)), 1)
else
frame:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, (auraBarParent.spacing or 0))
end
end
local spark = statusBar:CreateTexture(nil, "OVERLAY", nil)
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
spark:SetWidth(12)
spark:SetBlendMode("ADD")
spark:SetPoint("CENTER", statusBar:GetStatusBarTexture(), "RIGHT")
statusBar.spark = spark
statusBar.iconHolder = CreateFrame("Button", nil, statusBar)
statusBar.iconHolder:SetHeight(frame:GetHeight())
statusBar.iconHolder:SetWidth(frame:GetHeight())
statusBar.iconHolder:SetPoint("BOTTOMRIGHT", frame, "BOTTOMLEFT", -auraBarParent.gap, 0)
statusBar.iconHolder.__unit = oUF.unit
statusBar.iconHolder:SetScript("OnEnter", OnEnter)
statusBar.iconHolder:SetScript("OnLeave", OnLeave)
statusBar.iconHolder.UpdateTooltip = UpdateTooltip
statusBar.icon = statusBar.iconHolder:CreateTexture(nil, "BACKGROUND")
statusBar.icon:SetTexCoord(.07, .93, .07, .93)
statusBar.icon:SetAllPoints()
statusBar.spelltime = statusBar:CreateFontString(nil, "ARTWORK")
if auraBarParent.spellTimeObject then
statusBar.spelltime:SetFontObject(auraBarParent.spellTimeObject)
else
statusBar.spelltime:SetFont(auraBarParent.spellTimeFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellTimeSize or 10)
end
statusBar.spelltime:SetTextColor(1, 1, 1)
statusBar.spelltime:SetJustifyH("RIGHT")
statusBar.spelltime:SetJustifyV("CENTER")
statusBar.spelltime:SetPoint("RIGHT", 0, 0)
statusBar.spellname = statusBar:CreateFontString(nil, "ARTWORK")
if auraBarParent.spellNameObject then
statusBar.spellname:SetFontObject(auraBarParent.spellNameObject)
else
statusBar.spellname:SetFont(auraBarParent.spellNameFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.spellNameSize or 10)
end
statusBar.spellname:SetTextColor(1, 1, 1)
statusBar.spellname:SetJustifyH("LEFT")
statusBar.spellname:SetJustifyV("CENTER")
statusBar.spellname:SetPoint("LEFT", 0, 0)
statusBar.spellname:SetPoint("RIGHT", statusBar.spelltime, "LEFT")
if auraBarParent.PostCreateBar then
auraBarParent.PostCreateBar(frame)
end
return frame
end
local function UpdateBars(auraBars)
local bars = auraBars.bars
local timenow = GetTime()
for index = 1, getn(bars) do
local frame = bars[index]
local bar = frame.statusBar
if not frame:IsVisible() then
break
end
if bar.aura.noTime then
bar.spelltime:SetText()
bar.spark:Hide()
else
local timeleft = bar.aura.expirationTime - timenow
bar:SetValue(timeleft)
bar.spelltime:SetText(FormatTime(timeleft))
if auraBars.spark == true then
if (auraBars.scaleTime and ((auraBars.scaleTime <= 0) or (auraBars.scaleTime > 0 and timeleft < auraBars.scaleTime))) then
bar.spark:Show()
else
bar.spark:Hide()
end
end
end
end
end
local function DefaultFilter(self, unit, name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate)
if unitCaster == "player" and not shouldConsolidate then
return true
end
end
local sort = function(a, b)
local compa, compb = a.noTime and huge or a.expirationTime, b.noTime and huge or b.expirationTime
return compa > compb
end
local function Update(self, event, unit)
if self.unit ~= unit then return end
local auraBars = self.AuraBars
local helpOrHarm
local isFriend = UnitIsFriend("player", unit) == 1 and true or false
local both = false
if auraBars.friendlyAuraType and auraBars.enemyAuraType then
if isFriend then
helpOrHarm = auraBars.friendlyAuraType
else
helpOrHarm = auraBars.enemyAuraType
end
else
helpOrHarm = isFriend and "HELPFUL" or "HARMFUL"
end
if helpOrHarm == "BOTH" then
both = true
helpOrHarm = "HELPFUL"
end
-- Create a table of auras to display
local auras = {}
local lastAuraIndex = 0
local counter = 0
if auraBars.forceShow then
for index = 1, auraBars.maxBars do
local spellID = 47540
local name, rank, icon = GetSpellInfo(spellID)
local count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate = 5, "Magic", 0, 0, "player", nil, nil
lastAuraIndex = lastAuraIndex + 1
auras[lastAuraIndex] = {}
auras[lastAuraIndex].spellID = spellID
auras[lastAuraIndex].name = name
auras[lastAuraIndex].rank = rank
auras[lastAuraIndex].icon = icon
auras[lastAuraIndex].count = count
auras[lastAuraIndex].debuffType = debuffType
auras[lastAuraIndex].duration = duration
auras[lastAuraIndex].expirationTime = expirationTime
auras[lastAuraIndex].unitCaster = unitCaster
auras[lastAuraIndex].isStealable = isStealable
auras[lastAuraIndex].noTime = (duration == 0 and expirationTime == 0)
auras[lastAuraIndex].filter = helpOrHarm
auras[lastAuraIndex].shouldConsolidate = shouldConsolidate
end
else
for index = 1, 40 do
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID
if not both then
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, helpOrHarm)
if not name then break end
else
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, "HELPFUL")
if not name then
name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, "HARMFUL")
if not name then break end
end
end
if (auraBars.filter or DefaultFilter)(self, unit, name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellID) then
lastAuraIndex = lastAuraIndex + 1
auras[lastAuraIndex] = {}
auras[lastAuraIndex].spellID = spellID
auras[lastAuraIndex].name = name
auras[lastAuraIndex].rank = rank
auras[lastAuraIndex].icon = icon
auras[lastAuraIndex].count = count
auras[lastAuraIndex].debuffType = debuffType
auras[lastAuraIndex].duration = duration
auras[lastAuraIndex].expirationTime = expirationTime
auras[lastAuraIndex].unitCaster = unitCaster
auras[lastAuraIndex].isStealable = isStealable
auras[lastAuraIndex].noTime = (duration == 0 and expirationTime == 0)
auras[lastAuraIndex].filter = helpOrHarm
auras[lastAuraIndex].shouldConsolidate = shouldConsolidate
end
end
end
if auraBars.sort and not auraBars.forceShow then
tsort(auras, type(auraBars.sort) == "function" and auraBars.sort or sort)
end
for i=1, getn(auras) do
if i > auraBars.maxBars then
tremove(auras, i)
else
lastAuraIndex = i
end
end
-- Show and configure bars for buffs/debuffs.
local bars = auraBars.bars
if lastAuraIndex == 0 then
self.AuraBars:SetHeight(1)
end
for index = 1 , lastAuraIndex do
-- if auraBars:GetWidth() == 0 then break end
local aura = auras[index]
local frame = bars[index]
if not frame then
frame = CreateAuraBar(self, index == 1 and auraBars or bars[index - 1])
bars[index] = frame
end
if index == lastAuraIndex then
if self.AuraBars.down then
self.AuraBars:SetHeight(self.AuraBars:GetTop() - frame:GetBottom())
elseif frame:GetTop() and self.AuraBars:GetBottom() then
self.AuraBars:SetHeight(frame:GetTop() - self.AuraBars:GetBottom())
else
self.AuraBars:SetHeight(20)
end
end
local bar = frame.statusBar
frame.index = index
-- Backup the details of the aura onto the bar, so the OnUpdate function can use it
bar.aura = aura
-- Configure
if bar.aura.noTime then
bar:SetMinMaxValues(0, 1)
bar:SetValue(1)
else
if auraBars.scaleTime and auraBars.scaleTime > 0 then
local maxvalue = min(auraBars.scaleTime, bar.aura.duration)
bar:SetMinMaxValues(0, auraBars.scaleTime)
bar:SetWidth(
( maxvalue / auraBars.scaleTime ) *
( ( auraBars.auraBarWidth or auraBars:GetWidth() ) -
( bar:GetHeight() + (auraBars.gap or 0) ) ) ) -- icon size + gap
else
bar:SetMinMaxValues(0, bar.aura.duration)
end
bar:SetValue(bar.aura.expirationTime - GetTime())
end
bar.icon:SetTexture(bar.aura.icon)
-- bar.spellname:SetText(bar.aura.count > 1 and format("%s [%d]", bar.aura.name, bar.aura.count) or bar.aura.name)
bar.spelltime:SetText(not bar.noTime and FormatTime(bar.aura.expirationTime-GetTime()))
-- Colour bars
local r, g, b = .2, .6, 1 -- Colour for buffs
if auraBars.buffColor then
r, g, b = unpack(auraBars.buffColor)
end
if helpOrHarm == "HARMFUL" then
local debuffType = bar.aura.debuffType and bar.aura.debuffType or "none"
r, g, b = DebuffTypeColor[debuffType].r, DebuffTypeColor[debuffType].g, DebuffTypeColor[debuffType].b
if auraBars.debuffColor then
r, g, b = unpack(auraBars.debuffColor)
else
if debuffType == "none" and auraBars.defaultDebuffColor then
r, g, b = unpack(auraBars.defaultDebuffColor)
end
end
end
bar:SetStatusBarColor(r, g, b)
frame:Show()
end
-- Hide unused bars.
for index = lastAuraIndex + 1, getn(bars) do
bars[index]:Hide()
end
if auraBars.PostUpdate then
auraBars:PostUpdate(event, unit)
end
end
local function Enable(self)
if self.AuraBars then
self:RegisterEvent("PLAYER_AURAS_CHANGED", Update)
self.AuraBars:SetHeight(1)
self.AuraBars.bars = self.AuraBars.bars or {}
self.AuraBars.SetAnchors = SetAnchors
self.AuraBars:SetScript("OnUpdate", function() UpdateBars(self.AuraBars) end)
self.AuraBars.maxBars = self.AuraBars.maxBars or 40
return true
end
end
local function Disable(self)
local auraFrame = self.AuraBars
if auraFrame then
self:UnregisterEvent("PLAYER_AURAS_CHANGED", Update)
auraFrame:SetScript("OnUpdate", nil)
end
end
oUF:AddElement("AuraBars", Update, Enable, Disable)
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="oUF_AuraBars.lua"/>
</Ui>
@@ -0,0 +1,110 @@
local ns = oUF
local oUF = ns.oUF
assert(oUF, "oUF not loaded")
local cos, sin, sqrt2, max, atan2 = math.cos, math.sin, math.sqrt(2), math.max, math.atan2
local tinsert, tremove = table.insert, table.remove
local pi2 = 3.141592653589793 / 2
local GetPlayerMapPosition = GetPlayerMapPosition
local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local UnitInRange = UnitInRange
local UnitIsConnected = UnitIsConnected
local UnitIsUnit = UnitIsUnit
local _FRAMES, OnUpdateFrame = {}
local function CalculateCorner(r) return .5 + cos(r) / sqrt2, .5 + sin(r) / sqrt2 end
local function RotateTexture(texture, angle)
local LRx, LRy = CalculateCorner(angle + 0.785398163)
local LLx, LLy = CalculateCorner(angle + 2.35619449)
local ULx, ULy = CalculateCorner(angle + 3.92699082)
local URx, URy = CalculateCorner(angle - 0.785398163)
texture:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy)
end
local GetAngle = function(unit1, unit2)
local x1, y1 = GetPlayerMapPosition(unit1)
if x1 <= 0 and y1 <= 0 then return nil end
local x2, y2 = GetPlayerMapPosition(unit2)
if x2 <= 0 and y2 <= 0 then return nil end
return -pi2 - GetPlayerFacing() - atan2(y2 - y1, x2 - x1)
end
local minThrottle = 0.02
local numArrows, inRange, unit, GPS
local Update = function(self, elapsed)
if self.elapsed and self.elapsed > (self.throttle or minThrottle) then
numArrows = 0
for _, object in next, _FRAMES do
if object:IsShown() then
GPS = object.GPS
unit = object.unit
if unit then
if unit and GPS.outOfRange then
inRange = CheckInteractDistance(unit, 4)
end
if not unit or not (UnitInParty(unit) or UnitInRaid(unit)) or UnitIsUnit(unit, "player") or not UnitIsConnected(unit) or (GPS.onMouseOver and (GetMouseFocus() ~= object)) or (GPS.outOfRange and inRange) then
GPS:Hide()
else
local angle = GetAngle("player", unit)
if angle == nil then
GPS:Hide()
else
GPS:Show()
RotateTexture(GPS.Texture, angle)
numArrows = numArrows + 1
end
end
else
GPS:Hide()
end
end
end
self.elapsed = 0
self.throttle = max(minThrottle, 0.005 * numArrows)
else
self.elapsed = (self.elapsed or 0) + elapsed
end
end
local Enable = function(self)
local GPS = self.GPS
if GPS then
tinsert(_FRAMES, self)
if not OnUpdateFrame then
OnUpdateFrame = CreateFrame("Frame")
OnUpdateFrame:SetScript("OnUpdate", function()
Update(this, arg1)
end)
end
OnUpdateFrame:Show()
return true
end
end
local Disable = function(self)
local GPS = self.GPS
if GPS then
for k, frame in next, _FRAMES do
if frame == self then
tremove(_FRAMES, k)
GPS:Hide()
break
end
end
if getn(_FRAMES) == 0 and OnUpdateFrame then
OnUpdateFrame:Hide()
end
end
end
oUF:AddElement("GPS", function() end, Enable, Disable)
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="oUF_GPS.lua"/>
</Ui>
@@ -0,0 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Include file="oUF_AuraBars\oUF_AuraBars.xml"/>
<Include file="oUF_Smooth\oUF_Smooth.xml"/>
<Include file="oUF_GPS\oUF_GPS.xml"/>
</Ui>
@@ -0,0 +1,55 @@
local ns = oUF
local oUF = ns.oUF
assert(oUF, "<name> was unable to locate oUF install.")
local smoothing = {}
local function Smooth(self, value)
local _, max = self:GetMinMaxValues()
if value == self:GetValue() or (self._max and self._max ~= max) then
smoothing[self] = nil
self:SetValue_(value)
else
smoothing[self] = value
end
self._max = max
end
local function SmoothBar(bar)
if not bar.SetValue_ then
bar.SetValue_ = bar.SetValue;
bar.SetValue = Smooth;
end
end
local function hook(frame)
if frame.Health then
SmoothBar(frame.Health)
end
if frame.Power then
SmoothBar(frame.Power)
end
end
for i, frame in ipairs(oUF.objects) do hook(frame) end
oUF:RegisterInitCallback(hook)
local f, min, max = CreateFrame("Frame"), math.min, math.max
f:SetScript("OnUpdate", function()
local limit = 30/GetFramerate()
for bar, value in pairs(smoothing) do
local cur = bar:GetValue()
local new = cur + min((value-cur)/(bar.SmoothSpeed or 3), max(value-cur, limit))
if new ~= new then
-- Mad hax to prevent QNAN.
new = value
end
bar:SetValue_(new)
if (cur == value or abs(new - value) < 2) and bar.Smooth then
bar:SetValue_(value)
smoothing[bar] = nil
elseif not bar.Smooth then
bar:SetValue_(value)
smoothing[bar] = nil
end
end
end)
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="oUF_Smooth.lua"/>
</Ui>
+23 -1
View File
@@ -12,6 +12,8 @@ local mod = math.mod
local CreateFrame = CreateFrame
local UIFrameFadeIn = UIFrameFadeIn
local UIFrameFadeOut = UIFrameFadeOut
local GetNumShapeshiftForms = GetNumShapeshiftForms
local GetShapeshiftFormInfo = GetShapeshiftFormInfo
E.ActionBars = AB
@@ -468,6 +470,25 @@ function AB:ActionButton_GetPagedID(button)
end
end
local function IsInShapeshiftForm()
for i = 1, GetNumShapeshiftForms() do
local _, _, active = GetShapeshiftFormInfo(i)
if active ~= nil then return true end
end
return false
end
function AB:UNIT_PORTRAIT_UPDATE()
if arg1 == "player" and E.myclass == "DRUID" then
local inForm = IsInShapeshiftForm()
if inForm then
BonusActionBarFrame:Show()
else
BonusActionBarFrame:Hide()
end
end
end
function AB:Initialize()
self.db = E.db.actionbar
@@ -490,8 +511,9 @@ function AB:Initialize()
self:SecureHook("ActionButton_Update")
self:RawHook("ActionButton_GetPagedID")
self:SecureHook("PetActionBar_Update", "UpdatePet")
self:RegisterEvent("UNIT_PORTRAIT_UPDATE")
if E.myclass == "WARRIOR" then
if E.myclass == "WARRIOR" or (E.myclass == "DRUID" and IsInShapeshiftForm()) then
BonusActionBarFrame:Show()
end
end
+9 -9
View File
@@ -28,7 +28,7 @@ local bind = CreateFrame("Frame", "ElvUI_KeyBinder", E.UIParent)
function AB:ActivateBindMode()
bind.active = true
E:StaticPopupSpecial_Show(ElvUIBindPopupWindow)
E:StaticPopupSpecial_Show(ElvUIBindPopupWindow)
AB:RegisterEvent("PLAYER_REGEN_DISABLED", "DeactivateBindMode", false)
end
@@ -265,7 +265,7 @@ function AB:LoadKeyBinder()
for b, _ in pairs(self["handledButtons"]) do
self:RegisterButton(b, true)
end
end
if not IsAddOnLoaded("Blizzard_MacroUI") then
self:SecureHook("LoadAddOn", "RegisterMacro")
@@ -282,11 +282,11 @@ function AB:LoadKeyBinder()
f:SetFrameLevel(99)
f:SetClampedToScreen(true)
E:Size(f, 360, 130)
E:SetTemplate(f, "Transparent")
E:SetTemplate(f, "Transparent")
f:Hide()
local header = CreateFrame("Button", nil, f)
E:SetTemplate(header, "Default", true)
local header = CreateFrame("Button", nil, f)
E:SetTemplate(header, "Default", true)
E:Size(header, 100, 25)
E:Point(header, "CENTER", f, "TOP")
header:SetFrameLevel(header:GetFrameLevel() + 2)
@@ -295,8 +295,8 @@ function AB:LoadKeyBinder()
header:SetScript("OnMouseDown", function() f:StartMoving() end)
header:SetScript("OnMouseUp", function() f:StopMovingOrSizing() end)
local title = header:CreateFontString("OVERLAY")
E:FontTemplate(title)
local title = header:CreateFontString("OVERLAY")
E:FontTemplate(title)
E:Point(title, "CENTER", header, "CENTER")
title:SetText("Key Binds")
@@ -311,8 +311,8 @@ function AB:LoadKeyBinder()
local perCharCheck = CreateFrame("CheckButton", f:GetName().."CheckButton", f, "OptionsCheckButtonTemplate")
_G[perCharCheck:GetName() .. "Text"]:SetText(CHARACTER_SPECIFIC_KEYBINDINGS)
perCharCheck:SetScript("OnShow", function()
perCharCheck:SetChecked(GetCurrentBindingSet() == 2)
perCharCheck:SetScript("OnShow", function()
perCharCheck:SetChecked(GetCurrentBindingSet() == 2)
end)
perCharCheck:SetScript("OnClick", function()
+28 -24
View File
@@ -12,13 +12,15 @@ 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 GetPlayerBuff = GetPlayerBuff
local GetPlayerBuffTexture = GetPlayerBuffTexture
local GetPlayerBuffApplications = GetPlayerBuffApplications
local GetPlayerBuffDispelType = GetPlayerBuffDispelType
local GetPlayerBuffTimeLeft = GetPlayerBuffTimeLeft
local DIRECTION_TO_POINT = {
DOWN_RIGHT = "TOPLEFT",
@@ -96,20 +98,20 @@ local function UpdateTooltip()
end
end
local function OnEnter()
if not this:IsVisible() then return end
local function OnEnter(self)
if not self:IsVisible() then return end
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT", -5, -5)
this:UpdateTooltip()
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", -5, -5)
self:UpdateTooltip()
end
local function OnLeave()
GameTooltip:Hide()
end
local function OnClick()
if this.index and this.index > 0 then
CancelPlayerBuff(this.index)
local function OnClick(self)
if self.index and self.index >= 0 then
CancelPlayerBuff(self.index)
end
end
@@ -134,9 +136,9 @@ function A:CreateIcon(button)
E:SetInside(button.highlight)
button.UpdateTooltip = UpdateTooltip
button:SetScript("OnEnter", OnEnter)
button:SetScript("OnLeave", OnLeave)
button:SetScript("OnClick", OnClick)
button:SetScript("OnEnter", function() OnEnter(this) end)
button:SetScript("OnLeave", function() OnLeave() end)
button:SetScript("OnClick", function() OnClick(this) end)
E:SetTemplate(button, "Default")
end
@@ -412,16 +414,18 @@ function A:UpdateHeader(header)
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
local i, aura, buffIndex, icon = 0
while true do
buffIndex = GetPlayerBuff(i, filter)
icon = GetPlayerBuffTexture(buffIndex)
if not icon then break end
aura = freshTable()
aura.count, aura.dispelType, aura.expires = GetPlayerBuffApplications(buffIndex), GetPlayerBuffDispelType(buffIndex), GetPlayerBuffTimeLeft(buffIndex)
aura.icon = icon
aura.index = buffIndex
aura.filter = filter
tinsert(sortingTable, aura)
i = i + 1
end
local sortMethod = (sorters[db.sortMethod] or sorters["INDEX"])[db.sortDir == "-"][db.seperateOwn]
@@ -429,7 +433,7 @@ function A:UpdateHeader(header)
self:ConfigureAuras(header, sortingTable, weaponPosition)
while sortingTable[1] do
releaseTable(wipe(sortingTable))
releaseTable(tremove(sortingTable))
end
end
+28 -25
View File
@@ -152,15 +152,8 @@ local function UpdateLocation(from, to)
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
local aName = GetItemInfo(bagIDs[a])
local bName = GetItemInfo(bagIDs[b])
if aName and bName then
return aName < bName
@@ -185,8 +178,8 @@ local function DefaultSort(a, b)
end
end
local _, _, aRarity, _, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID)
local _, _, bRarity, _, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID)
local _, _, aRarity, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID)
local _, _, bRarity, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID)
aRarity = bagQualities[a]
bRarity = bagQualities[b]
@@ -368,19 +361,29 @@ function B:ScanBags()
end
end
-- TEMPORARY MAYBE UNTIL ALTERNATIVE FIX
function B:GetItemFamily(bagType)
local itemSubType = select(6, GetItemInfo(match(bagType, "item:(%d+)")))
local bagType = {
["Bag"] = 0,
["Quiver"] = 1,
["Ammo Pouch"] = 2,
["Soul Bag"] = 4,
}
if strupper(itemSubType) == "BAG" then
return 0
elseif strupper(itemSubType) == "QUIVER" then
return 1
elseif strupper(itemSubType) == "KEYRING" then
return -2
else
return nil
function B:GetItemFamily(bagID)
if bagID == KEYRING_CONTAINER then return KEYRING_CONTAINER end
if bagID == 0 then return 0 end
local _, _, id = strfind(GetInventoryItemLink("player", ContainerIDToInventoryID(bagID)) or "", "item:(%d+)")
if id then
local _, _, _, _, itemType, subType = GetItemInfo(id)
local bagSubType = bagType[subType]
if bagSubType == 0 then return 0 end -- based off https://wow.gamepedia.com/ItemFamily
if bagSubType == 1 then return 1 end
if bagSubType == 2 then return 2 end
if bagSubType == 4 then return 4 end
end
return nil
end
function B:IsSpecialtyBag(bagID)
@@ -392,8 +395,8 @@ function B:IsSpecialtyBag(bagID)
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
local family = B:GetItemFamily(bagID)
if family == 0 or family == nil then return false else return false end
return family
end
@@ -402,7 +405,7 @@ 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))
local equipSlot = select(8, GetItemInfo(item))
if equipSlot == "INVTYPE_BAG" then
itemFamily = 1
end
+3 -2
View File
@@ -114,8 +114,7 @@ function mod:ExperienceBar_OnClick()
end
function mod:UpdateExperienceDimensions()
self.expBar:SetWidth(self.db.experience.width)
self.expBar:SetHeight(self.db.experience.height)
E:Size(self.expBar, self.db.experience.width, 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)
@@ -158,6 +157,8 @@ function mod:LoadExperienceBar()
self.expBar.rested:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(self.expBar.rested)
self.expBar.rested:SetStatusBarColor(1, 0, 1, 0.2)
E:Kill(ExhaustionTick)
E:Kill(MainMenuExpBar)
self:UpdateExperienceDimensions()
+1 -22
View File
@@ -11,9 +11,8 @@ 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 DURABILITY = "Durability"
local displayString = ""
local tooltipString = "%d%%"
@@ -34,26 +33,6 @@ local slots = {
"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
+42 -45
View File
@@ -48,15 +48,15 @@ end
function M:GetLocTextColor()
local pvpType = GetZonePVPInfo()
if(pvpType == "sanctuary") then
if pvpType == "sanctuary" then
return 0.035, 0.58, 0.84
elseif(pvpType == "arena") then
elseif pvpType == "arena" then
return 0.84, 0.03, 0.03
elseif(pvpType == "friendly") then
elseif pvpType == "friendly" then
return 0.05, 0.85, 0.03
elseif(pvpType == "hostile") then
elseif pvpType == "hostile" then
return 0.84, 0.03, 0.03
elseif(pvpType == "contested") then
elseif pvpType == "contested" then
return 0.9, 0.85, 0.05
else
return 0.84, 0.03, 0.03
@@ -104,7 +104,7 @@ local function ResetZoom()
isResetting = false
end
local function SetupZoomReset()
if(E.db.general.minimap.resetZoom.enable and not isResetting) then
if E.db.general.minimap.resetZoom.enable and not isResetting then
isResetting = true
E:Delay(E.db.general.minimap.resetZoom.time, ResetZoom)
end
@@ -120,8 +120,8 @@ function M:UpdateSettings()
Minimap:SetScale(E.MinimapSize / 140)
end
if(LeftMiniPanel and RightMiniPanel) then
if(E.db.datatexts.minimapPanels and E.private.general.minimap.enable) then
if LeftMiniPanel and RightMiniPanel then
if E.db.datatexts.minimapPanels and E.private.general.minimap.enable then
LeftMiniPanel:Show()
RightMiniPanel:Show()
else
@@ -130,48 +130,48 @@ function M:UpdateSettings()
end
end
if(BottomMiniPanel) then
if(E.db.datatexts.minimapBottom and E.private.general.minimap.enable) then
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
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
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
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
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
if TopRightMiniPanel then
if E.db.datatexts.minimapTopRight and E.private.general.minimap.enable then
TopRightMiniPanel:Show()
else
TopRightMiniPanel:Hide()
@@ -179,19 +179,19 @@ function M:UpdateSettings()
end
if MMHolder then
MMHolder:SetWidth(E.MinimapWidth + E.Border + E.Spacing*3)
E:Width(MMHolder, 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)
E:Height(MMHolder, E.MinimapHeight + (LeftMiniPanel and (LeftMiniPanel:GetHeight() + E.Border) or 24) + E.Spacing*3)
else
MMHolder:SetHeight(E.MinimapHeight + E.Border + E.Spacing*3)
E:Height(MMHolder, E.MinimapHeight + E.Border + E.Spacing*3)
end
end
if Minimap.location then
Minimap.location:SetWidth(E.MinimapSize)
E:Width(Minimap.location, E.MinimapSize)
if(E.db.general.minimap.locationText ~= "SHOW" or not E.private.general.minimap.enable) then
if E.db.general.minimap.locationText ~= "SHOW" or not E.private.general.minimap.enable then
Minimap.location:Hide()
else
Minimap.location:Show()
@@ -199,8 +199,7 @@ function M:UpdateSettings()
end
if MinimapMover then
MinimapMover:SetWidth(MMHolder:GetWidth())
MinimapMover:SetHeight(MMHolder:GetHeight())
E:Size(MinimapMover, MMHolder:GetWidth(), MMHolder:GetHeight())
end
if GameTimeFrame then
@@ -210,7 +209,7 @@ function M:UpdateSettings()
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)
E:Point(GameTimeFrame, 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
@@ -220,7 +219,7 @@ function M:UpdateSettings()
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)
E:Point(MiniMapMailFrame, 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
@@ -228,7 +227,7 @@ function M:UpdateSettings()
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)
E:Point(MiniMapBattlefieldFrame, 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
@@ -238,7 +237,7 @@ function M:UpdateSettings()
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)
E:Point(MiniMapInstanceDifficulty, pos, Minimap, pos, x, y)
MiniMapInstanceDifficulty:SetScale(scale)
end
end
@@ -261,11 +260,10 @@ function M:Initialize()
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)
E:Point(mmholder, "TOPRIGHT", E.UIParent, "TOPRIGHT", -3, -3)
E:Size(mmholder, E.MinimapWidth + 29, E.MinimapHeight + 53)
Minimap:ClearAllPoints()
Minimap:SetPoint("TOPRIGHT", mmholder, "TOPRIGHT", -E.Border, -E.Border)
E:Point(Minimap, "TOPRIGHT", mmholder, "TOPRIGHT", -E.Border, -E.Border)
Minimap:SetMaskTexture("Interface\\ChatFrame\\ChatFrameBackground")
Minimap.backdrop = CreateFrame("Frame", nil, UIParent)
@@ -289,7 +287,7 @@ function M:Initialize()
Minimap.location = Minimap:CreateFontString(nil, "OVERLAY")
E:FontTemplate(Minimap.location, nil, nil, "OUTLINE")
Minimap.location:SetPoint("TOP", Minimap, "TOP", 0, -2)
E:Point(Minimap.location, "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
@@ -323,9 +321,8 @@ function M:Initialize()
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)
E:Size(fm, E.db.farmSize)
E:Point(fm, "TOP", E.UIParent, "TOP", 0, -120)
fm:SetClampedToScreen(true)
E:CreateBackdrop(fm, "Default")
fm:EnableMouseWheel(true)
@@ -338,14 +335,14 @@ function M:Initialize()
fm:Hide()
FarmModeMap:SetScript("OnShow", function()
if(BuffsMover and not E:HasMoverBeenMoved("BuffsMover")) then
if BuffsMover and not E:HasMoverBeenMoved("BuffsMover") then
BuffsMover:ClearAllPoints()
BuffsMover:SetPoint("TOPRIGHT", E.UIParent, "TOPRIGHT", -3, -3)
E:Point(BuffsMover, "TOPRIGHT", E.UIParent, "TOPRIGHT", -3, -3)
end
if(DebuffsMover and not E:HasMoverBeenMoved("DebuffsMover")) then
if DebuffsMover and not E:HasMoverBeenMoved("DebuffsMover") then
DebuffsMover:ClearAllPoints()
DebuffsMover:SetPoint("TOPRIGHT", ElvUIPlayerBuffs, "BOTTOMRIGHT", 0, -3)
E:Point(DebuffsMover, "TOPRIGHT", ElvUIPlayerBuffs, "BOTTOMRIGHT", 0, -3)
end
MinimapCluster:ClearAllPoints()
@@ -353,11 +350,11 @@ function M:Initialize()
end)
FarmModeMap:SetScript("OnHide", function()
if(BuffsMover and not E:HasMoverBeenMoved("BuffsMover")) then
if BuffsMover and not E:HasMoverBeenMoved("BuffsMover") then
E:ResetMovers(L["Player Buffs"])
end
if(DebuffsMover and not E:HasMoverBeenMoved("DebuffsMover")) then
if DebuffsMover and not E:HasMoverBeenMoved("DebuffsMover") then
E:ResetMovers(L["Player Debuffs"])
end
+7 -10
View File
@@ -5,7 +5,6 @@ local AFK = E:NewModule("AFK", "AceEvent-3.0", "AceTimer-3.0");
--Cache global variables
--Lua functions
local _G = _G
local GetTime = GetTime
local floor = math.floor
--WoW API / Variables
local CinematicFrame = CinematicFrame
@@ -14,12 +13,12 @@ local GetBattlefieldStatus = GetBattlefieldStatus
local GetGuildInfo = GetGuildInfo
local GetScreenHeight = GetScreenHeight
local GetScreenWidth = GetScreenWidth
local GetTime = GetTime
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
@@ -185,11 +184,11 @@ function AFK:OnEvent(event, ...)
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 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)
@@ -284,11 +283,9 @@ function AFK:Initialize()
E:Size(self.AFKMode.bottom.logo, 320, 150)
E:Point(self.AFKMode.bottom.logo, "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")
E:Point(self.AFKMode.bottom.faction, "BOTTOMLEFT", self.AFKMode.bottom, "BOTTOMLEFT", -20, -16)
self.AFKMode.bottom.faction:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\"..factionGroup.."-Logo")
self.AFKMode.bottom.faction:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\"..E.myfaction.."-Logo")
E:Size(self.AFKMode.bottom.faction, 140)
self.AFKMode.bottom.name = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
+1 -1
View File
@@ -543,7 +543,7 @@ function mod:QueueObject(object)
object:SetTexture("")
object:SetTexCoord(0, 0, 0, 0)
elseif objectType == "FontString" then
E:Width(object, 0.001)
object:SetWidth(0.001)
elseif objectType == "StatusBar" then
object:SetStatusBarTexture("")
end
+68 -79
View File
@@ -1,27 +1,30 @@
local E, L, V, P, G = unpack(ElvUI)
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
local ns = oUF
local ElvUF = ns.oUF
local ns = oUF;
local ElvUF = ns.oUF;
local _G = _G;
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv;
local type, unpack, select, pairs = type, unpack, select, pairs;
local min, random = math.min, math.random;
local format = string.format;
local UnitMana = UnitMana;
local UnitManaMax = UnitManaMax;
local UnitHealth = UnitHealth;
local UnitHealthMax = UnitHealthMax;
local UnitName = UnitName;
local UnitClass = UnitClass;
local InCombatLockdown = InCombatLockdown;
local UnregisterUnitWatch = UnregisterUnitWatch;
local RegisterUnitWatch = RegisterUnitWatch;
local RegisterStateDriver = RegisterStateDriver;
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE;
local CLASS_SORT_ORDER = CLASS_SORT_ORDER;
local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS;
--Cache global variables
--Lua functions
local _G = _G
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv
local type, unpack, select, pairs = type, unpack, select, pairs
local min, random = math.min, math.random
local format = string.format
local find = string.find
--WoW API / Variables
local UnitMana = UnitMana
local UnitManaMax = UnitManaMax
local UnitHealth = UnitHealth
local UnitHealthMax = UnitHealthMax
local UnitName = UnitName
local UnitClass = UnitClass
local UnitAffectingCombat = UnitAffectingCombat
local UnregisterUnitWatch = UnregisterUnitWatch
local RegisterUnitWatch = RegisterUnitWatch
local RegisterStateDriver = RegisterStateDriver
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local CLASS_SORT_ORDER = CLASS_SORT_ORDER
local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS
local attributeBlacklist = {["showRaid"] = true, ["showParty"] = true, ["showSolo"] = true}
local configEnv
@@ -29,45 +32,45 @@ local originalEnvs = {}
local overrideFuncs = {}
local function createConfigEnv()
if( configEnv ) then return end
if configEnv then return end
configEnv = setmetatable({
UnitMana = function (unit, displayType)
if(unit:find("target") or unit:find("focus")) then
return UnitMana(unit, displayType);
if find(unit, "target") or find(unit, "focus") then
return UnitMana(unit, displayType)
end
return random(1, UnitManaMax(unit, displayType) or 1);
return random(1, UnitManaMax(unit, displayType) or 1)
end,
UnitHealth = function(unit)
if(unit:find("target") or unit:find("focus")) then
return UnitHealth(unit);
if find(unit, "target") or find(unit, "focus") then
return UnitHealth(unit)
end
return random(1, UnitHealthMax(unit));
return random(1, UnitHealthMax(unit))
end,
UnitName = function(unit)
if(unit:find("target") or unit:find("focus")) then
return UnitName(unit);
if find(unit, "target") or find(unit, "focus") then
return UnitName(unit)
end
if(E.CreditsList) then
local max = #E.CreditsList;
return E.CreditsList[random(1, max)];
if E.CreditsList then
local max = getn(E.CreditsList)
return E.CreditsList[random(1, max)]
end
return "Test Name";
return "Test Name"
end,
UnitClass = function(unit)
if(unit:find("target") or unit:find("focus")) then
return UnitClass(unit);
if find(unit, "target") or find(unit, "focus") then
return UnitClass(unit)
end
local classToken = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))];
return LOCALIZED_CLASS_NAMES_MALE[classToken], classToken;
local classToken = CLASS_SORT_ORDER[random(1, getn(CLASS_SORT_ORDER))]
return LOCALIZED_CLASS_NAMES_MALE[classToken], classToken
end,
Hex = function(r, g, b)
if(type(r) == "table") then
if(r.r) then r, g, b = r.r, r.g, r.b; else r, g, b = unpack(r); end
if type(r) == "table" then
if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
end
return format("|cff%02x%02x%02x", r*255, g*255, b*255);
return format("|cff%02x%02x%02x", r*255, g*255, b*255)
end,
ColorGradient = ElvUF.ColorGradient,
}, {
@@ -101,11 +104,11 @@ local function createConfigEnv()
end
function UF:ForceShow(frame)
if InCombatLockdown() then return; end
if UnitAffectingCombat("player") then return end
if not frame.isForced then
frame.oldUnit = frame.unit
frame.unit = "player"
frame.isForced = true;
frame.isForced = true
frame.oldOnUpdate = frame:GetScript("OnUpdate")
end
@@ -119,17 +122,17 @@ function UF:ForceShow(frame)
frame:Update()
end
if(_G[frame:GetName().."Target"]) then
self:ForceShow(_G[frame:GetName().."Target"]);
if _G[frame:GetName().."Target"] then
self:ForceShow(_G[frame:GetName().."Target"])
end
if(_G[frame:GetName().."Pet"]) then
self:ForceShow(_G[frame:GetName().."Pet"]);
if _G[frame:GetName().."Pet"] then
self:ForceShow(_G[frame:GetName().."Pet"])
end
end
function UF:UnforceShow(frame)
if InCombatLockdown() then return; end
if UnitAffectingCombat("player") then return end
if not frame.isForced then
return
end
@@ -152,11 +155,11 @@ function UF:UnforceShow(frame)
frame:Update()
end
if(_G[frame:GetName().."Target"]) then
if _G[frame:GetName().."Target"] then
self:UnforceShow(_G[frame:GetName().."Target"])
end
if(_G[frame:GetName().."Pet"]) then
if _G[frame:GetName().."Pet"] then
self:UnforceShow(_G[frame:GetName().."Pet"])
end
end
@@ -164,11 +167,10 @@ end
function UF:ShowChildUnits(header, ...)
header.isForced = true
for i=1, select("#", ...) do
local frame = select(i, ...)
for i = 1, arg.n do
local frame = arg[i]
frame:RegisterForClicks(nil)
frame:SetID(i)
frame.TargetGlow:SetAlpha(0)
self:ForceShow(frame)
end
end
@@ -176,16 +178,15 @@ end
function UF:UnshowChildUnits(header, ...)
header.isForced = nil
for i=1, select("#", ...) do
local frame = select(i, ...)
for i = 1, arg.n do
local frame = arg[i]
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
frame.TargetGlow:SetAlpha(1)
self:UnforceShow(frame)
end
end
local function OnAttributeChanged(self)
if not self:GetParent().forceShow and not self.forceShow then return; end
if not self:GetParent().forceShow and not self.forceShow then return end
if not self:IsShown() then return end
local db = self.db or self:GetParent().db
@@ -199,7 +200,7 @@ local function OnAttributeChanged(self)
end
function UF:HeaderConfig(header, configMode)
if InCombatLockdown() then return; end
if UnitAffectingCombat("player") then return end
createConfigEnv()
header.forceShow = configMode
@@ -216,27 +217,27 @@ function UF:HeaderConfig(header, configMode)
end
end
RegisterStateDriver(header, "visibility", "show")
--RegisterStateDriver(header, "visibility", "show")
else
for func, env in pairs(originalEnvs) do
setfenv(func, env)
originalEnvs[func] = nil
end
RegisterStateDriver(header, "visibility", header.db.visibility)
--RegisterStateDriver(header, "visibility", header.db.visibility)
if(header:GetScript("OnEvent")) then
header:GetScript("OnEvent")(header, "PLAYER_ENTERING_WORLD");
if header:GetScript("OnEvent") then
header:GetScript("OnEvent")(header, "PLAYER_ENTERING_WORLD")
end
end
for i=1, #header.groups do
for i = 1, getn(header.groups) do
local group = header.groups[i]
if group:IsShown() then
group.forceShow = header.forceShow
group.forceShowAuras = header.forceShowAuras
group:HookScript("OnAttributeChanged", OnAttributeChanged)
--HookScript(group, "OnAttributeChanged", OnAttributeChanged)
if configMode then
for key in pairs(attributeBlacklist) do
group:SetAttribute(key, nil)
@@ -258,7 +259,7 @@ function UF:HeaderConfig(header, configMode)
end
end
UF["headerFunctions"][header.groupName]:AdjustVisibility(header);
UF["headerFunctions"][header.groupName]:AdjustVisibility(header)
end
function UF:PLAYER_REGEN_DISABLED()
@@ -275,19 +276,7 @@ function UF:PLAYER_REGEN_DISABLED()
end
end
for i=1, 5 do
if self["arena"..i] and self["arena"..i].isForced then
self:UnforceShow(self["arena"..i])
end
end
for i=1, 4 do
if self["boss"..i] and self["boss"..i].isForced then
self:UnforceShow(self["boss"..i])
end
end
for i=1, 4 do
for i = 1, 4 do
if self["party"..i] and self["party"..i].isForced then
self:UnforceShow(self["party"..i])
end
@@ -0,0 +1,288 @@
local E, L, V, P, G = unpack(ElvUI) --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames")
--Cache global variables
--Lua functions
local match = string.match
local strsplit = strsplit
local tostring = tostring
local format = format
local select = select
local getn = table.getn
--WoW API / Variables
local CreateFrame = CreateFrame
local IsShiftKeyDown = IsShiftKeyDown
local IsAltKeyDown = IsAltKeyDown
local IsControlKeyDown = IsControlKeyDown
local UnitIsFriend = UnitIsFriend
local UnitIsUnit = UnitIsUnit
local UnitCanAttack = UnitCanAttack
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
function UF:Construct_AuraBars()
local bar = self.statusBar
E:SetTemplate(self, "Default", nil, nil, UF.thinBorders, true)
local inset = UF.thinBorders and E.mult or nil
E:SetInside(bar, self, inset, inset)
UF["statusbars"][bar] = true
UF:Update_StatusBar(bar)
UF:Configure_FontString(bar.spelltime)
UF:Configure_FontString(bar.spellname)
UF:Update_FontString(bar.spelltime)
UF:Update_FontString(bar.spellname)
bar.spellname:ClearAllPoints()
E:Point(bar.spellname, "LEFT", bar, "LEFT", 2, 0)
E:Point(bar.spellname, "RIGHT", bar.spelltime, "LEFT", -4, 0)
-- bar.spellname:SetWordWrap(false)
E:SetTemplate(bar.iconHolder, "Default", nil, nil, UF.thinBorders, true)
E:SetInside(bar.icon, bar.iconHolder, inset, inset)
bar.icon:SetDrawLayer("OVERLAY")
bar.bg = bar:CreateTexture(nil, "BORDER")
bar.bg:Hide()
bar.iconHolder:RegisterForClicks("RightButtonUp")
bar.iconHolder:SetScript("OnClick", function(self)
if E.db.unitframe.auraBlacklistModifier == "NONE" or not ((E.db.unitframe.auraBlacklistModifier == "SHIFT" and IsShiftKeyDown()) or (E.db.unitframe.auraBlacklistModifier == "ALT" and IsAltKeyDown()) or (E.db.unitframe.auraBlacklistModifier == "CTRL" and IsControlKeyDown())) then return; end
local auraName = self:GetParent().aura.name
if auraName then
E:Print(format(L["The spell '%s' has been added to the Blacklist unitframe aura filter."], auraName))
E.global["unitframe"]["aurafilters"]["Blacklist"]["spells"][auraName] = {
["enable"] = true,
["priority"] = 0,
}
UF:Update_AllFrames()
end
end)
end
function UF:Construct_AuraBarHeader(frame)
local auraBar = CreateFrame("Frame", nil, frame)
auraBar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element
auraBar.PostCreateBar = UF.Construct_AuraBars
auraBar.gap = (-frame.BORDER + frame.SPACING*3)
auraBar.spacing = (-frame.BORDER + frame.SPACING*3)
auraBar.spark = true
auraBar.filter = UF.AuraBarFilter
auraBar.PostUpdate = UF.ColorizeAuraBars
return auraBar
end
function UF:Configure_AuraBars(frame)
if not frame.VARIABLES_SET then return end
local auraBars = frame.AuraBars
local db = frame.db
if db.aurabar.enable then
if not frame:IsElementEnabled("AuraBars") then
frame:EnableElement("AuraBars")
end
auraBars:Show()
auraBars.friendlyAuraType = db.aurabar.friendlyAuraType
auraBars.enemyAuraType = db.aurabar.enemyAuraType
auraBars.scaleTime = db.aurabar.uniformThreshold
local buffColor = self.db.colors.auraBarBuff
local debuffColor = self.db.colors.auraBarDebuff
local attachTo = frame
if E:CheckClassColor(buffColor.r, buffColor.g, buffColor.b) then
buffColor = E.myclass == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
end
if E:CheckClassColor(debuffColor.r, debuffColor.g, debuffColor.b) then
debuffColor = E.myclass == "PRIEST" and E.PriestColors or (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass])
end
if db.aurabar.attachTo == "BUFFS" then
attachTo = frame.Buffs
elseif db.aurabar.attachTo == "DEBUFFS" then
attachTo = frame.Debuffs
elseif db.aurabar.attachTo == "PLAYER_AURABARS" and ElvUF_Player then
attachTo = ElvUF_Player.AuraBars
end
local anchorPoint, anchorTo = "BOTTOM", "TOP"
if db.aurabar.anchorPoint == "BELOW" then
anchorPoint, anchorTo = "TOP", "BOTTOM"
end
local yOffset
local spacing = (((db.aurabar.attachTo == "FRAME" and 3) or (db.aurabar.attachTo == "PLAYER_AURABARS" and 4) or 2) * frame.SPACING)
local border = (((db.aurabar.attachTo == "FRAME" or db.aurabar.attachTo == "PLAYER_AURABARS") and 2 or 1) * frame.BORDER)
if db.aurabar.anchorPoint == "BELOW" then
yOffset = -spacing + border - (not db.aurabar.yOffset and 0 or db.aurabar.yOffset)
else
yOffset = spacing - border + (not db.aurabar.yOffset and 0 or db.aurabar.yOffset)
end
local xOffset = (db.aurabar.attachTo == "FRAME" and frame.SPACING or 0)
local offsetLeft = xOffset + ((db.aurabar.attachTo == "FRAME" and ((anchorTo == "TOP" and frame.ORIENTATION ~= "LEFT") or (anchorTo == "BOTTOM" and frame.ORIENTATION == "LEFT"))) and frame.POWERBAR_OFFSET or 0)
local offsetRight = -xOffset - ((db.aurabar.attachTo == "FRAME" and ((anchorTo == "TOP" and frame.ORIENTATION ~= "RIGHT") or (anchorTo == "BOTTOM" and frame.ORIENTATION == "RIGHT"))) and frame.POWERBAR_OFFSET or 0)
auraBars.auraBarHeight = db.aurabar.height
auraBars:ClearAllPoints()
E:Point(auraBars, anchorPoint.."LEFT", attachTo, anchorTo.."LEFT", offsetLeft, yOffset)
E:Point(auraBars, anchorPoint.."RIGHT", attachTo, anchorTo.."RIGHT", offsetRight, yOffset)
auraBars.buffColor = {buffColor.r, buffColor.g, buffColor.b}
if UF.db.colors.auraBarByType then
auraBars.debuffColor = nil;
auraBars.defaultDebuffColor = {debuffColor.r, debuffColor.g, debuffColor.b}
else
auraBars.debuffColor = {debuffColor.r, debuffColor.g, debuffColor.b}
auraBars.defaultDebuffColor = nil;
end
auraBars.down = db.aurabar.anchorPoint == "BELOW"
if db.aurabar.sort == "TIME_REMAINING" then
auraBars.sort = true --default function
elseif db.aurabar.sort == "TIME_REMAINING_REVERSE" then
auraBars.sort = self.SortAuraBarReverse
elseif db.aurabar.sort == "TIME_DURATION" then
auraBars.sort = self.SortAuraBarDuration
elseif db.aurabar.sort == "TIME_DURATION_REVERSE" then
auraBars.sort = self.SortAuraBarDurationReverse
elseif db.aurabar.sort == "NAME" then
auraBars.sort = self.SortAuraBarName
else
auraBars.sort = nil
end
auraBars.maxBars = db.aurabar.maxBars
auraBars.forceShow = frame.forceShowAuras
-- auraBars:SetAnchors()
else
if frame:IsElementEnabled("AuraBars") then
frame:DisableElement("AuraBars")
auraBars:Hide()
end
end
end
local huge = math.huge
function UF.SortAuraBarReverse(a, b)
local compa, compb = a.noTime and huge or a.expirationTime, b.noTime and huge or b.expirationTime
return compa < compb
end
function UF.SortAuraBarDuration(a, b)
local compa, compb = a.noTime and huge or a.duration, b.noTime and huge or b.duration
return compa > compb
end
function UF.SortAuraBarDurationReverse(a, b)
local compa, compb = a.noTime and huge or a.duration, b.noTime and huge or b.duration
return compa < compb
end
function UF.SortAuraBarName(a, b)
return a.name > b.name
end
function UF:CheckFilter(name, caster, spellID, isFriend, isPlayer, isUnit, allowDuration, noDuration, canDispell, ...)
-- local friendCheck, filterName, filter, filterType, spellList, spell
-- for i=1, select("#", ...) do
-- filterName = select(i, ...)
-- friendCheck = (isFriend and match(filterName, "^Friendly:([^,]*)")) or (not isFriend and match(filterName, "^Enemy:([^,]*)")) or nil
-- if friendCheck ~= false then
-- if friendCheck ~= nil and (G.unitframe.specialFilters[friendCheck] or E.global.unitframe.aurafilters[friendCheck]) then
-- filterName = friendCheck -- this is for our filters to handle Friendly and Enemy
-- end
-- filter = E.global.unitframe.aurafilters[filterName]
-- if filter then
-- filterType = filter.type
-- spellList = filter.spells
-- spell = spellList and (spellList[spellID] or spellList[name])
-- if filterType and (filterType == "Whitelist") and (spell and spell.enable) and allowDuration then
-- return true, spell.priority -- this is the only difference from auarbars code
-- elseif filterType and (filterType == "Blacklist") and (spell and spell.enable) then
-- return false
-- end
-- elseif filterName == "Personal" and isPlayer and allowDuration then
-- return true
-- elseif filterName == "nonPersonal" and (not isPlayer) and allowDuration then
-- return true
-- elseif filterName == "CastByUnit" and (caster and isUnit) and allowDuration then
-- return true
-- elseif filterName == "notCastByUnit" and (caster and not isUnit) and allowDuration then
-- return true
-- elseif filterName == "Dispellable" and canDispell and allowDuration then
-- return true
-- elseif filterName == "blockNoDuration" and noDuration then
-- return false
-- elseif filterName == "blockNonPersonal" and (not isPlayer) then
-- return false
-- end
-- end
-- end
return true
end
function UF:AuraBarFilter(unit, name, _, _, _, debuffType, duration, _, unitCaster, isStealable, _, spellID)
if not self.db then return end
local db = self.db.aurabar
if not name then return nil end
local filterCheck, isUnit, isFriend, isPlayer, canDispell, allowDuration, noDuration
if db.priority ~= "" then
noDuration = (not duration or duration == 0)
isFriend = unit and UnitIsFriend("player", unit) and not UnitCanAttack("player", unit)
isPlayer = (unitCaster == "player" or unitCaster == "vehicle")
isUnit = unit and unitCaster and UnitIsUnit(unit, unitCaster)
canDispell = (self.type == "Buffs" and isStealable) or (self.type == "Debuffs" and debuffType and E:IsDispellableByMe(debuffType))
allowDuration = noDuration or (duration and (duration > 0) and (db.maxDuration == 0 or duration <= db.maxDuration) and (db.minDuration == 0 or duration >= db.minDuration))
filterCheck = UF:CheckFilter(name, unitCaster, spellID, isFriend, isPlayer, isUnit, allowDuration, noDuration, canDispell, strsplit(",", db.priority))
else
filterCheck = true -- Allow all auras to be shown when the filter list is empty
end
return filterCheck
end
function UF:ColorizeAuraBars()
local bars = self.bars
for index = 1, getn(bars) do
local frame = bars[index]
if not frame:IsVisible() then break end
local spellName = frame.statusBar.aura.name
local spellID = frame.statusBar.aura.spellID
-- local colors = E.global.unitframe.AuraBarColors[spellID] or E.global.unitframe.AuraBarColors[tostring(spellID)] or E.global.unitframe.AuraBarColors[spellName]
-- if E.db.unitframe.colors.auraBarTurtle and (E.global.unitframe.aurafilters.TurtleBuffs.spells[spellID] or E.global.unitframe.aurafilters.TurtleBuffs.spells[spellName]) and not colors then
-- colors = E.db.unitframe.colors.auraBarTurtleColor
-- end
if colors then
frame.statusBar:SetStatusBarColor(colors.r, colors.g, colors.b)
frame.statusBar.bg:SetTexture(colors.r * 0.25, colors.g * 0.25, colors.b * 0.25)
else
local r, g, b = frame.statusBar:GetStatusBarColor()
frame.statusBar.bg:SetTexture(r * 0.25, g * 0.25, b * 0.25)
end
if UF.db.colors.transparentAurabars and not frame.statusBar.isTransparent then
UF:ToggleTransparentStatusBar(true, frame.statusBar, frame.statusBar.bg, nil, true)
elseif(frame.statusBar.isTransparent and not UF.db.colors.transparentAurabars) then
UF:ToggleTransparentStatusBar(false, frame.statusBar, frame.statusBar.bg, nil, true)
end
if UF.db.colors.transparentAurabars then
local _, _, _, alpha = frame:GetBackdropColor()
if colors then
frame:SetBackdropColor(colors.r * 0.58, colors.g * 0.58, colors.b * 0.58, alpha)
else
local r, g, b = frame.statusBar:GetStatusBarColor()
frame:SetBackdropColor(r * 0.58, g * 0.58, b * 0.58, alpha)
end
end
end
end
+573
View File
@@ -0,0 +1,573 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local unpack = unpack
local find, format, lower = string.find, string.format, string.lower
local strsplit = strsplit
local tsort, getn = table.sort, table.getn
local ceil = math.ceil
--WoW API / Variables
local GetTime = GetTime
local CreateFrame = CreateFrame
local IsShiftKeyDown = IsShiftKeyDown
local IsAltKeyDown = IsAltKeyDown
local IsControlKeyDown = IsControlKeyDown
local UnitCanAttack = UnitCanAttack
local UnitIsFriend = UnitIsFriend
local UnitIsUnit = UnitIsUnit
function UF:Construct_Buffs(frame)
local buffs = CreateFrame("Frame", frame:GetName().."Buffs", frame)
buffs.spacing = E.Spacing
buffs.PreSetPosition = (not frame:GetScript("OnUpdate")) and self.SortAuras or nil
buffs.PostCreateIcon = self.Construct_AuraIcon
buffs.PostUpdateIcon = self.PostUpdateAura
--buffs.CustomFilter = self.AuraFilter
buffs:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element
buffs.type = "buffs"
--Set initial width to prevent division by zero. This value doesn't matter, as it will be updated later
E:Width(buffs, 100)
return buffs
end
function UF:Construct_Debuffs(frame)
local debuffs = CreateFrame("Frame", frame:GetName().."Debuffs", frame)
debuffs.spacing = E.Spacing
debuffs.PreSetPosition = (not frame:GetScript("OnUpdate")) and self.SortAuras or nil
debuffs.PostCreateIcon = self.Construct_AuraIcon
debuffs.PostUpdateIcon = self.PostUpdateAura
--debuffs.CustomFilter = self.AuraFilter
debuffs.type = "debuffs"
debuffs:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element
--Set initial width to prevent division by zero. This value doesn't matter, as it will be updated later
E:Width(debuffs, 100)
return debuffs
end
function UF:Construct_AuraIcon(button)
local offset = UF.thinBorders and E.mult or E.Border
button.text = button:CreateFontString(nil, "OVERLAY")
E:Point(button.text, "CENTER", 1, 1)
button.text:SetJustifyH("CENTER")
E:SetTemplate(button, "Default", nil, nil, UF.thinBorders, true)
E:SetInside(button.icon, button, offset, offset)
button.icon:SetTexCoord(unpack(E.TexCoords))
button.icon:SetDrawLayer("ARTWORK")
button.count:ClearAllPoints()
E:Point(button.count, "BOTTOMRIGHT", 1, 1)
button.count:SetJustifyH("RIGHT")
button.overlay:SetTexture(nil)
button:RegisterForClicks("RightButtonUp")
button:SetScript("OnClick", function(self)
if E.db.unitframe.auraBlacklistModifier == "NONE"
or not ((E.db.unitframe.auraBlacklistModifier == "SHIFT" and IsShiftKeyDown())
or (E.db.unitframe.auraBlacklistModifier == "ALT" and IsAltKeyDown())
or (E.db.unitframe.auraBlacklistModifier == "CTRL" and IsControlKeyDown())) then return end
local auraName = self.name
if auraName then
E:Print(format(L["The spell '%s' has been added to the Blacklist unitframe aura filter."], auraName))
E.global["unitframe"]["aurafilters"]["Blacklist"]["spells"][auraName] = {
["enable"] = true,
["priority"] = 0,
}
UF:Update_AllFrames()
end
end)
UF:UpdateAuraIconSettings(button, true)
end
function UF:EnableDisable_Auras(frame)
if frame.db.debuffs.enable or frame.db.buffs.enable then
if not frame:IsElementEnabled("Aura") then
frame:EnableElement("Aura")
end
else
if frame:IsElementEnabled("Aura") then
frame:DisableElement("Aura")
end
end
end
local function ReverseUpdate(frame)
UF:Configure_Auras(frame, "Debuffs")
UF:Configure_Auras(frame, "Buffs")
end
function UF:Configure_Auras(frame, auraType)
if not frame.VARIABLES_SET then return end
local db = frame.db
local auras = frame[auraType]
auraType = lower(auraType)
local rows = db[auraType].numrows
local totalWidth = frame.UNIT_WIDTH - frame.SPACING*2
if frame.USE_POWERBAR_OFFSET then
local powerOffset = ((frame.ORIENTATION == "MIDDLE" and 2 or 1) * frame.POWERBAR_OFFSET)
if not (db[auraType].attachTo == "POWER" and frame.ORIENTATION == "MIDDLE") then
totalWidth = totalWidth - powerOffset
end
end
E:Width(auras, totalWidth)
auras.forceShow = frame.forceShowAuras
auras.num = db[auraType].perrow * rows
auras.size = db[auraType].sizeOverride ~= 0 and db[auraType].sizeOverride or ((((auras:GetWidth() - (auras.spacing*(auras.num/rows - 1))) / auras.num)) * rows)
if db[auraType].sizeOverride and db[auraType].sizeOverride > 0 then
E:Width(auras, db[auraType].perrow * db[auraType].sizeOverride)
end
local attachTo = self:GetAuraAnchorFrame(frame, db[auraType].attachTo, db.debuffs.attachTo == "BUFFS" and db.buffs.attachTo == "DEBUFFS")
--Use frame.SPACING override since it may be different from E.Spacing due to forced thin borders
local x, y = E:GetXYOffset(db[auraType].anchorPoint, frame.SPACING)
if db[auraType].attachTo == "FRAME" then
y = 0
elseif db[auraType].attachTo == "HEALTH" or db[auraType].attachTo == "POWER" then
local newX = E:GetXYOffset(db[auraType].anchorPoint, -frame.BORDER)
local _, newY = E:GetXYOffset(db[auraType].anchorPoint, (frame.BORDER + frame.SPACING))
x = newX
y = newY
else
x = 0
end
if auraType == "buffs" and frame.Debuffs.attachTo and frame.Debuffs.attachTo == frame.Buffs and db[auraType].attachTo == "DEBUFFS" then
--Update Debuffs first, as we would otherwise get conflicting anchor points
--This is usually only an issue on profile change
ReverseUpdate(frame)
return
end
auras:ClearAllPoints()
E:Point(auras, E.InversePoints[db[auraType].anchorPoint], attachTo, db[auraType].anchorPoint, x + db[auraType].xOffset, y + db[auraType].yOffset)
E:Height(auras, auras.size * rows)
auras["growth-y"] = find(db[auraType].anchorPoint, "TOP") and "UP" or "DOWN"
auras["growth-x"] = db[auraType].anchorPoint == "LEFT" and "LEFT" or db[auraType].anchorPoint == "RIGHT" and "RIGHT" or (find(db[auraType].anchorPoint, "LEFT") and "RIGHT" or "LEFT")
auras.initialAnchor = E.InversePoints[db[auraType].anchorPoint]
--These are needed for SmartAuraPosition
auras.attachTo = attachTo
auras.point = E.InversePoints[db[auraType].anchorPoint]
auras.anchorPoint = db[auraType].anchorPoint
auras.xOffset = x + db[auraType].xOffset
auras.yOffset = y + db[auraType].yOffset
if db[auraType].enable then
auras:Show()
UF:UpdateAuraIconSettings(auras)
else
auras:Hide()
end
local position = db.smartAuraPosition
if position == "BUFFS_ON_DEBUFFS" then
if db.debuffs.attachTo == "BUFFS" then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Buffs"], L["Debuffs"], L["Frame"]))
db.debuffs.attachTo = "FRAME"
frame.Debuffs.attachTo = frame
end
frame.Buffs.PostUpdate = nil
frame.Debuffs.PostUpdate = UF.UpdateBuffsHeaderPosition
elseif position == "DEBUFFS_ON_BUFFS" then
if db.buffs.attachTo == "DEBUFFS" then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Debuffs"], L["Buffs"], L["Frame"]))
db.buffs.attachTo = "FRAME"
frame.Buffs.attachTo = frame
end
frame.Buffs.PostUpdate = UF.UpdateDebuffsHeaderPosition
frame.Debuffs.PostUpdate = nil
elseif position == "FLUID_BUFFS_ON_DEBUFFS" then
if db.debuffs.attachTo == "BUFFS" then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Buffs"], L["Debuffs"], L["Frame"]))
db.debuffs.attachTo = "FRAME"
frame.Debuffs.attachTo = frame
end
frame.Buffs.PostUpdate = UF.UpdateBuffsHeight
frame.Debuffs.PostUpdate = UF.UpdateBuffsPositionAndDebuffHeight
elseif position == "FLUID_DEBUFFS_ON_BUFFS" then
if db.buffs.attachTo == "DEBUFFS" then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Debuffs"], L["Buffs"], L["Frame"]))
db.buffs.attachTo = "FRAME"
frame.Buffs.attachTo = frame
end
frame.Buffs.PostUpdate = UF.UpdateDebuffsPositionAndBuffHeight
frame.Debuffs.PostUpdate = UF.UpdateDebuffsHeight
else
frame.Buffs.PostUpdate = nil
frame.Debuffs.PostUpdate = nil
end
end
local function SortAurasByTime(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aTime = a.expiration or -1
local bTime = b.expiration or -1
if aTime and bTime then
if sortDirection == "DESCENDING" then
return aTime < bTime
else
return aTime > bTime
end
end
elseif a:IsShown() then
return true
end
end
end
local function SortAurasByName(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aName = a.spell or ""
local bName = b.spell or ""
if aName and bName then
if sortDirection == "DESCENDING" then
return aName < bName
else
return aName > bName
end
end
elseif a:IsShown() then
return true
end
end
end
local function SortAurasByDuration(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aTime = a.duration or -1
local bTime = b.duration or -1
if aTime and bTime then
if sortDirection == "DESCENDING" then
return aTime < bTime
else
return aTime > bTime
end
end
elseif a:IsShown() then
return true
end
end
end
local function SortAurasByCaster(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aPlayer = a.isPlayer or false
local bPlayer = b.isPlayer or false
if sortDirection == "DESCENDING" then
return (aPlayer and not bPlayer)
else
return (not aPlayer and bPlayer)
end
elseif a:IsShown() then
return true
end
end
end
function UF:SortAuras()
--[[if not self.db then return end
--Sorting by Index is Default
if self.db.sortMethod == "TIME_REMAINING" then
tsort(self, SortAurasByTime)
elseif self.db.sortMethod == "NAME" then
tsort(self, SortAurasByName)
elseif self.db.sortMethod == "DURATION" then
tsort(self, SortAurasByDuration)
elseif self.db.sortMethod == "PLAYER" then
tsort(self, SortAurasByCaster)
end]]
--Look into possibly applying filter priorities for auras here.
return 1, getn(self) --from/to range needed for the :SetPosition call in oUF aura element. Without this aura icon position gets all whacky when not sorted by index
end
function UF:UpdateAuraIconSettings(auras, noCycle)
local frame = auras:GetParent()
local type = auras.type
if noCycle then
frame = auras:GetParent():GetParent()
type = auras:GetParent().type
end
if not frame.db then return end
local db = frame.db[type]
local unitframeFont = LSM:Fetch("font", E.db["unitframe"].font)
local unitframeFontOutline = E.db["unitframe"].fontOutline
local index = 1
auras.db = db
if db then
if not noCycle then
while auras[index] do
local button = auras[index]
E:FontTemplate(button.text, unitframeFont, db.fontSize, unitframeFontOutline)
E:FontTemplate(button.count, unitframeFont, db.countFontSize or db.fontSize, unitframeFontOutline)
if db.clickThrough and button:IsMouseEnabled() then
button:EnableMouse(false)
elseif not db.clickThrough and not button:IsMouseEnabled() then
button:EnableMouse(true)
end
index = index + 1
end
else
E:FontTemplate(auras.text, unitframeFont, db.fontSize, unitframeFontOutline)
E:FontTemplate(auras.count, unitframeFont, db.countFontSize or db.fontSize, unitframeFontOutline)
if db.clickThrough and auras:IsMouseEnabled() then
auras:EnableMouse(false)
elseif not db.clickThrough and not auras:IsMouseEnabled() then
auras:EnableMouse(true)
end
end
end
end
function UF:PostUpdateAura(unit, button)
local auras = button:GetParent()
local frame = auras:GetParent()
local type = auras.type
local db = frame.db and frame.db[type]
if db then
if db.clickThrough and button:IsMouseEnabled() then
button:EnableMouse(false)
elseif not db.clickThrough and not button:IsMouseEnabled() then
button:EnableMouse(true)
end
end
if button.isDebuff then
local color = (button.dtype and DebuffTypeColor[button.dtype]) or DebuffTypeColor.none
button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
end
local size = button:GetParent().size
if size then
E:Size(button, size)
end
if button.expiration and button.duration and (button.duration ~= 0) then
local getTime = GetTime()
if not button:GetScript("OnUpdate") then
button.expirationTime = button.expiration
button.expirationSaved = button.expiration - getTime
button.nextupdate = -1
button:SetScript("OnUpdate", UF.UpdateAuraTimer)
end
if (button.expirationTime ~= button.expiration) or (button.expirationSaved ~= (button.expiration - getTime)) then
button.expirationTime = button.expiration
button.expirationSaved = button.expiration - getTime
button.nextupdate = -1
end
end
if button.expiration and button.duration and (button.duration == 0 or button.expiration <= 0) then
button.expirationTime = nil
button.expirationSaved = nil
button:SetScript("OnUpdate", nil)
if button.text:GetFont() then
button.text:SetText("")
end
end
end
function UF:UpdateAuraTimer(elapsed)
self.expirationSaved = self.expirationSaved - elapsed
if self.nextupdate > 0 then
self.nextupdate = self.nextupdate - elapsed
return
end
if self.expirationSaved <= 0 then
self:SetScript("OnUpdate", nil)
if self.text:GetFont() then
self.text:SetText("")
end
return
end
local timervalue, formatid
timervalue, formatid, self.nextupdate = E:GetTimeInfo(self.expirationSaved, 4)
if self.text:GetFont() then
self.text:SetFormattedText(format("%s%s|r", E.TimeColors[formatid], E.TimeFormats[formatid][2]), timervalue)
elseif self:GetParent():GetParent().db then
self.text:FontTemplate(LSM:Fetch("font", E.db["unitframe"].font), self:GetParent():GetParent().db[self:GetParent().type].fontSize, E.db["unitframe"].fontOutline)
self.text:SetFormattedText(format("%s%s|r", E.TimeColors[formatid], E.TimeFormats[formatid][2]), timervalue)
end
end
function UF:AuraFilter(unit, button, texture, count, dispelType, duration, expiration)
local db = self:GetParent().db
if not db or not db[self.type] then return true end
db = db[self.type]
if not name then return nil end
local filterCheck, isUnit, isFriend, isPlayer, canDispell, allowDuration, noDuration, spellPriority
isPlayer = (caster == "player" or caster == "vehicle")
isFriend = unit and UnitIsFriend("player", unit) and not UnitCanAttack("player", unit)
button.isPlayer = isPlayer
button.isFriend = isFriend
button.isStealable = isStealable
button.dtype = dispelType
button.duration = duration
button.expiration = expiration
button.name = name
button.owner = caster --what uses this?
button.spell = name --what uses this? (SortAurasByName?)
button.priority = 0
noDuration = (not duration or duration == 0)
allowDuration = noDuration or (duration and (duration > 0) and (db.maxDuration == 0 or duration <= db.maxDuration) and (db.minDuration == 0 or duration >= db.minDuration))
if db.priority ~= "" then
isUnit = unit and caster and UnitIsUnit(unit, caster)
canDispell = (self.type == "buffs" and isStealable) or (self.type == "debuffs" and dispelType and E:IsDispellableByMe(dispelType))
filterCheck, spellPriority = UF:CheckFilter(name, caster, spellID, isFriend, isPlayer, isUnit, allowDuration, noDuration, canDispell, strsplit(",", db.priority))
if spellPriority then button.priority = spellPriority end -- this is the only difference from auarbars code
else
filterCheck = allowDuration and true -- Allow all auras to be shown when the filter list is empty, while obeying duration sliders
end
return filterCheck
end
function UF:UpdateBuffsHeaderPosition()
local parent = self:GetParent()
local buffs = parent.Buffs
local debuffs = parent.Debuffs
local numDebuffs = self.visibleDebuffs
if numDebuffs == 0 then
buffs:ClearAllPoints()
E:Point(buffs, debuffs.point, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
else
buffs:ClearAllPoints()
E:Point(buffs, buffs.point, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
end
end
function UF:UpdateDebuffsHeaderPosition()
local parent = self:GetParent()
local debuffs = parent.Debuffs
local buffs = parent.Buffs
local numBuffs = self.visibleBuffs
if numBuffs == 0 then
debuffs:ClearAllPoints()
E:Point(debuffs, buffs.point, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
else
debuffs:ClearAllPoints()
E:Point(debuffs, debuffs.point, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
end
end
function UF:UpdateBuffsPositionAndDebuffHeight()
local parent = self:GetParent()
local db = parent.db
local buffs = parent.Buffs
local debuffs = parent.Debuffs
local numDebuffs = self.visibleDebuffs
if numDebuffs == 0 then
buffs:ClearAllPoints()
E:Point(buffs, debuffs.point, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
else
buffs:ClearAllPoints()
E:Point(buffs, buffs.point, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
end
if numDebuffs > 0 then
local numRows = ceil(numDebuffs/db.debuffs.perrow)
E:Height(debuffs, debuffs.size * (numRows > db.debuffs.numrows and db.debuffs.numrows or numRows))
else
E:Height(debuffs, debuffs.size)
end
end
function UF:UpdateDebuffsPositionAndBuffHeight()
local parent = self:GetParent()
local db = parent.db
local debuffs = parent.Debuffs
local buffs = parent.Buffs
local numBuffs = self.visibleBuffs
if numBuffs == 0 then
debuffs:ClearAllPoints()
E:Point(debuffs, buffs.point, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
else
debuffs:ClearAllPoints()
E:Point(debuffs, debuffs.point, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
end
if numBuffs > 0 then
local numRows = ceil(numBuffs/db.buffs.perrow)
E:Height(buffs, buffs.size * (numRows > db.buffs.numrows and db.buffs.numrows or numRows))
else
E:Height(buffs, buffs.size)
end
end
function UF:UpdateBuffsHeight()
local parent = self:GetParent()
local db = parent.db
local buffs = parent.Buffs
local numBuffs = self.visibleBuffs
if numBuffs > 0 then
local numRows = ceil(numBuffs/db.buffs.perrow)
E:Height(buffs, buffs.size * (numRows > db.buffs.numrows and db.buffs.numrows or numRows))
else
E:Height(buffs, buffs.size)
-- Any way to get rid of the last row as well?
-- Using buffs:SetHeight(0) makes frames anchored to this one disappear
end
end
function UF:UpdateDebuffsHeight()
local parent = self:GetParent()
local db = parent.db
local debuffs = parent.Debuffs
local numDebuffs = self.visibleDebuffs
if numDebuffs > 0 then
local numRows = ceil(numDebuffs/db.debuffs.perrow)
E:Height(debuffs, debuffs.size * (numRows > db.debuffs.numrows and db.debuffs.numrows or numRows))
else
E:Height(debuffs, debuffs.size)
-- Any way to get rid of the last row as well?
-- Using debuffs:SetHeight(0) makes frames anchored to this one disappear
end
end
@@ -0,0 +1,291 @@
local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local unpack, tonumber = unpack, tonumber
local abs, min = abs, math.min
--WoW API / Variables
local CreateFrame = CreateFrame
local UnitIsPlayer = UnitIsPlayer
local UnitClass = UnitClass
local UnitReaction = UnitReaction
--local UnitCanAttack = UnitCanAttack
local ns = oUF
local ElvUF = ns.oUF
local INVERT_ANCHORPOINT = {
TOPLEFT = "BOTTOMRIGHT",
LEFT = "RIGHT",
BOTTOMLEFT = "TOPRIGHT",
RIGHT = "LEFT",
TOPRIGHT = "BOTTOMLEFT",
BOTTOMRIGHT = "TOPLEFT",
CENTER = "CENTER",
TOP = "BOTTOM",
BOTTOM = "TOP",
}
function UF:Construct_Castbar(frame, moverName)
local castbar = CreateFrame("StatusBar", nil, frame)
castbar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 30) --Make it appear above everything else
self["statusbars"][castbar] = true
castbar.CustomDelayText = self.CustomCastDelayText
castbar.CustomTimeText = self.CustomTimeText
castbar.PostCastStart = self.PostCastStart
castbar.PostChannelStart = self.PostCastStart
castbar:SetClampedToScreen(true)
E:CreateBackdrop(castbar, "Default", nil, nil, self.thinBorders, true)
CreateStatusBarTexturePointer(castbar)
castbar.Time = castbar:CreateFontString(nil, "OVERLAY")
self:Configure_FontString(castbar.Time)
castbar.Time:SetPoint("RIGHT", castbar, "RIGHT", -4, 0)
castbar.Time:SetTextColor(0.84, 0.75, 0.65)
castbar.Time:SetJustifyH("RIGHT")
castbar.Text = castbar:CreateFontString(nil, "OVERLAY")
self:Configure_FontString(castbar.Text)
castbar.Text:SetPoint("LEFT", castbar, "LEFT", 4, 0)
castbar.Text:SetTextColor(0.84, 0.75, 0.65)
castbar.Text:SetJustifyH("LEFT")
castbar.Spark = castbar:CreateTexture(nil, "OVERLAY")
castbar.Spark:SetBlendMode("ADD")
castbar.Spark:SetVertexColor(1, 1, 1)
castbar.bg = castbar:CreateTexture(nil, "BORDER")
castbar.bg:Hide()
local button = CreateFrame("Frame", nil, castbar)
local holder = CreateFrame("Frame", nil, castbar)
E:SetTemplate(button, "Default", nil, nil, self.thinBorders, true)
castbar.Holder = holder
--these are placeholder so the mover can be created.. it will be changed.
castbar.Holder:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 0, -(frame.BORDER - frame.SPACING))
castbar:SetPoint("BOTTOMLEFT", castbar.Holder, "BOTTOMLEFT", frame.BORDER, frame.BORDER)
button:SetPoint("RIGHT", castbar, "LEFT", -E.Spacing*3, 0)
if moverName then
E:CreateMover(castbar.Holder, frame:GetName().."CastbarMover", moverName, nil, -6, nil, "ALL,SOLO")
end
local icon = button:CreateTexture(nil, "ARTWORK")
local offset = frame.BORDER --use frame.BORDER since it may be different from E.Border due to forced thin borders
E:SetInside(icon, nil, offset, offset)
icon:SetTexCoord(unpack(E.TexCoords))
icon.bg = button
--Set to castbar.Icon
castbar.ButtonIcon = icon
return castbar
end
function UF:Configure_Castbar(frame)
if not frame.VARIABLES_SET then return end
local castbar = frame.Castbar
local db = frame.db
E:Width(castbar, db.castbar.width - ((frame.BORDER+frame.SPACING)*2))
E:Height(castbar, db.castbar.height - ((frame.BORDER+frame.SPACING)*2))
E:Width(castbar.Holder, db.castbar.width)
E:Height(castbar.Holder, db.castbar.height)
if castbar.Holder:GetScript("OnSizeChanged") then
castbar.Holder:GetScript("OnSizeChanged")(castbar.Holder)
end
--Icon
if db.castbar.icon then
castbar.Icon = castbar.ButtonIcon
if not db.castbar.iconAttached then
E:Size(castbar.Icon.bg, db.castbar.iconSize)
else
if db.castbar.insideInfoPanel and frame.USE_INFO_PANEL then
E:Size(castbar.Icon.bg, db.infoPanel.height - frame.SPACING*2)
else
E:Size(castbar.Icon.bg, db.castbar.height-frame.SPACING*2)
end
E:Width(castbar, db.castbar.width - castbar.Icon.bg:GetWidth() - (frame.BORDER + frame.SPACING*5))
end
castbar.Icon.bg:Show()
else
castbar.ButtonIcon.bg:Hide()
castbar.Icon = nil
end
if db.castbar.spark then
castbar.Spark:Show()
else
castbar.Spark:Hide()
end
castbar:ClearAllPoints()
if db.castbar.insideInfoPanel and frame.USE_INFO_PANEL then
if not db.castbar.iconAttached then
E:SetInside(castbar, frame.InfoPanel, 0, 0)
else
local iconWidth = db.castbar.icon and (castbar.Icon.bg:GetWidth() - frame.BORDER) or 0
if frame.ORIENTATION == "RIGHT" then
castbar:SetPoint("TOPLEFT", frame.InfoPanel, "TOPLEFT")
castbar:SetPoint("BOTTOMRIGHT", frame.InfoPanel, "BOTTOMRIGHT", -iconWidth - frame.SPACING*3, 0)
else
castbar:SetPoint("TOPLEFT", frame.InfoPanel, "TOPLEFT", iconWidth + frame.SPACING*3, 0)
castbar:SetPoint("BOTTOMRIGHT", frame.InfoPanel, "BOTTOMRIGHT")
end
end
if castbar.Holder.mover then
E:DisableMover(castbar.Holder.mover:GetName())
end
else
local isMoved = E:HasMoverBeenMoved(frame:GetName().."CastbarMover") or not castbar.Holder.mover
if not isMoved then
castbar.Holder.mover:ClearAllPoints()
end
castbar:ClearAllPoints()
if frame.ORIENTATION ~= "RIGHT" then
E:Point(castbar, "BOTTOMRIGHT", castbar.Holder, "BOTTOMRIGHT", -(frame.BORDER+frame.SPACING), frame.BORDER+frame.SPACING)
if not isMoved then
E:Point(castbar.Holder.mover, "TOPRIGHT", frame, "BOTTOMRIGHT", 0, -(frame.BORDER - frame.SPACING))
end
else
E:Point(castbar, "BOTTOMLEFT", castbar.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
if not isMoved then
E:Point(castbar.Holder.mover, "TOPLEFT", frame, "BOTTOMLEFT", 0, -(frame.BORDER - frame.SPACING))
end
end
if castbar.Holder.mover then
E:EnableMover(castbar.Holder.mover:GetName())
end
end
if not db.castbar.iconAttached and db.castbar.icon then
local attachPoint = db.castbar.iconAttachedTo == "Frame" and frame or frame.Castbar
local anchorPoint = db.castbar.iconPosition
castbar.Icon.bg:ClearAllPoints()
E:Point(castbar.Icon.bg, INVERT_ANCHORPOINT[anchorPoint], attachPoint, anchorPoint, db.castbar.iconXOffset, db.castbar.iconYOffset)
elseif db.castbar.icon then
castbar.Icon.bg:ClearAllPoints()
if frame.ORIENTATION == "RIGHT" then
E:Point(castbar.Icon.bg, "LEFT", castbar, "RIGHT", frame.SPACING*3, 0)
else
E:Point(castbar.Icon.bg, "RIGHT", castbar, "LEFT", -frame.SPACING*3, 0)
end
end
if db.castbar.enable and not frame:IsElementEnabled("Castbar") then
frame:EnableElement("Castbar")
elseif not db.castbar.enable and frame:IsElementEnabled("Castbar") then
frame:DisableElement("Castbar")
if castbar.Holder.mover then
E:DisableMover(castbar.Holder.mover:GetName())
end
end
end
function UF:CustomCastDelayText(duration)
local db = self:GetParent().db
if not db then return end
if self.channeling then
if db.castbar.format == "CURRENT" then
self.Time:SetText(format("%.1f |cffaf5050%.1f|r", abs(duration - self.max), self.delay))
elseif db.castbar.format == "CURRENTMAX" then
self.Time:SetText(format("%.1f / %.1f |cffaf5050%.1f|r", duration, self.max, self.delay))
elseif db.castbar.format == "REMAINING" then
self.Time:SetText(format("%.1f |cffaf5050%.1f|r", duration, self.delay))
end
else
if db.castbar.format == "CURRENT" then
self.Time:SetText(format("%.1f |cffaf5050%s %.1f|r", duration, "+", self.delay))
elseif db.castbar.format == "CURRENTMAX" then
self.Time:SetText(format("%.1f / %.1f |cffaf5050%s %.1f|r", duration, self.max, "+", self.delay))
elseif db.castbar.format == "REMAINING" then
self.Time:SetText(format("%.1f |cffaf5050%s %.1f|r", abs(duration - self.max), "+", self.delay))
end
end
end
function UF:CustomTimeText(duration)
local db = self:GetParent().db
if not db then return end
if self.channeling then
if db.castbar.format == "CURRENT" then
self.Time:SetText(format("%.1f", abs(duration - self.max)))
elseif db.castbar.format == "CURRENTMAX" then
self.Time:SetText(format("%.1f / %.1f", duration, self.max))
self.Time:SetText(format("%.1f / %.1f", abs(duration - self.max), self.max))
elseif db.castbar.format == "REMAINING" then
self.Time:SetText(format("%.1f", duration))
end
else
if db.castbar.format == "CURRENT" then
self.Time:SetText(format("%.1f", duration))
elseif db.castbar.format == "CURRENTMAX" then
self.Time:SetText(format("%.1f / %.1f", duration, self.max))
elseif db.castbar.format == "REMAINING" then
self.Time:SetText(format("%.1f", abs(duration - self.max)))
end
end
end
function UF:PostCastStart(name)
local db = self:GetParent().db
if not db or not db.castbar then return; end
self.Text:SetText(name)
-- Get length of Time, then calculate available length for Text
local timeWidth = self.Time:GetStringWidth()
local textWidth = self:GetWidth() - timeWidth - 10
local textStringWidth = self.Text:GetStringWidth()
if timeWidth == 0 or textStringWidth == 0 then
E:Delay(0.05, function() -- Delay may need tweaking
textWidth = self:GetWidth() - self.Time:GetStringWidth() - 10
textStringWidth = self.Text:GetStringWidth()
if textWidth > 0 then self.Text:SetWidth(min(textWidth, textStringWidth)) end
end)
else
self.Text:SetWidth(min(textWidth, textStringWidth))
end
self.Spark:SetHeight(self:GetHeight() * 2)
local colors = ElvUF.colors
local r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
local t
if UF.db.colors.castClassColor and UnitIsPlayer("player") then
local _, class = UnitClass("player")
t = ElvUF.colors.class[class]
elseif UF.db.colors.castReactionColor and UnitReaction("player", "player") then
t = ElvUF.colors.reaction[UnitReaction("player", "player")]
end
if t then
r, g, b = t[1], t[2], t[3]
end
--[[
if self.notInterruptible and unit ~= "player" and UnitCanAttack("player", unit) then
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
end
]]
self:SetStatusBarColor(r, g, b)
UF:ToggleTransparentStatusBar(UF.db.colors.transparentCastbar, self, self.bg, nil, true)
if self.bg:IsShown() then
self.bg:SetTexture(r * 0.25, g * 0.25, b * 0.25)
local _, _, _, alpha = self.backdrop:GetBackdropColor()
self.backdrop:SetBackdropColor(r * 0.58, g * 0.58, b * 0.58, alpha)
end
end
@@ -0,0 +1,461 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
local _G = _G
local pairs = pairs
local select = select
local assert = assert
local tinsert = table.insert
local CreateFrame = CreateFrame
local UnitIsUnit = UnitIsUnit
local UnitReaction = UnitReaction
local UnitIsPlayer = UnitIsPlayer
local UnitClass = UnitClass
local UnitExists = UnitExists
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local FACTION_BAR_COLORS = FACTION_BAR_COLORS
function UF:FrameGlow_MouseOnUnit(frame)
if frame and frame:IsVisible() and UnitExists("mouseover") then
local unit = frame.unit or (frame.isForced and "player")
return unit and UnitIsUnit("mouseover", unit)
elseif frame.isHighlight then
return true
end
return false
end
function UF:FrameGlow_ElementHook(frame, glow, which)
if not (frame and frame.__elements) then return end
tinsert(frame.__elements, function()
local unit = frame.unit or (frame.isForced and "player")
if unit then
UF:FrameGlow_SetGlowColor(glow, unit, which)
end
if which == "mouseoverGlow" then
UF:FrameGlow_PositionHighlight(frame)
UF:FrameGlow_CheckMouseover(frame)
else
UF:FrameGlow_PositionGlow(frame, glow, glow.powerGlow)
end
if which == "targetGlow" then
UF:FrameGlow_CheckTarget(frame)
end
end)
end
function UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
if (frame and power and powerName and glow and offset) and not glow[powerName.."Hooked"] then
glow[powerName.."Hooked"] = true
local func = function() UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, true) end
HookScript(power, "OnShow", func)
HookScript(power, "OnHide", func)
end
end
function UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, fromScript)
if not (frame and glow and offset) then return end
local power = powerName and frame[powerName]
if not power then return end
if not fromScript then
UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
end
local portrait = (frame.USE_PORTRAIT and not frame.PORTRAIT_WIDTH == 0) and (frame.Portrait and frame.Portrait.backdrop)
if powerName == "HappinessIndicator" and (power and power.backdrop and power:IsVisible()) then
if frame.ORIENTATION == "RIGHT" then
glow:SetPoint("TOPLEFT", power.backdrop, -offset, offset)
glow:SetPoint("TOPRIGHT", portrait or frame.Health.backdrop, offset, offset)
else
glow:SetPoint("TOPLEFT", portrait or frame.Health.backdrop, -offset, offset)
glow:SetPoint("TOPRIGHT", power.backdrop, offset, offset)
end
else
if (power and power.backdrop and power:IsVisible()) and (not (frame.CLASSBAR_DETACHED or frame.USE_MINI_CLASSBAR)) then
if frame.ORIENTATION == "RIGHT" then
glow:SetPoint("TOPLEFT", power.backdrop, -offset, offset)
glow:SetPoint("TOPRIGHT", portrait or power.backdrop, offset, offset)
else
glow:SetPoint("TOPLEFT", portrait or power.backdrop, -offset, offset)
glow:SetPoint("TOPRIGHT", power.backdrop, offset, offset)
end
elseif frame.Health and frame.Health.backdrop then
if frame.ORIENTATION == "RIGHT" then
glow:SetPoint("TOPLEFT", frame.Health.backdrop, -offset, offset)
glow:SetPoint("TOPRIGHT", portrait or frame.Health.backdrop, offset, offset)
else
glow:SetPoint("TOPLEFT", portrait or frame.Health.backdrop, -offset, offset)
glow:SetPoint("TOPRIGHT", frame.Health.backdrop, offset, offset)
end
end
end
end
function UF:FrameGlow_PositionGlow(frame, mainGlow, powerGlow)
if not (frame and frame.VARIABLES_SET) then return end
local infoPanel = frame.InfoPanel
local additionalPower = frame.AdditionalPower
local runes = frame.Runes
local comboPoints = frame.ComboPoints
local happiness = frame.HappinessIndicator
local power = frame.Power and frame.Power.backdrop
local health = frame.Health and frame.Health.backdrop
local portrait = (frame.USE_PORTRAIT and not frame.PORTRAIT_WIDTH ~= 0) and (frame.Portrait and frame.Portrait.backdrop)
local offset = (E.PixelMode and E.mult*3) or E.mult*4 -- edgeSize is 3
mainGlow:ClearAllPoints()
if frame.ORIENTATION == "RIGHT" then
mainGlow:SetPoint("TOPLEFT", health, -offset, offset)
mainGlow:SetPoint("TOPRIGHT", portrait or health, offset, offset)
else
mainGlow:SetPoint("TOPLEFT", portrait or health, -offset, offset)
mainGlow:SetPoint("TOPRIGHT", health, offset, offset)
end
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
mainGlow:SetPoint("BOTTOMLEFT", health, -offset, -offset)
mainGlow:SetPoint("BOTTOMRIGHT", health, offset, -offset)
else
--offset is set because its one pixel off for some reason
mainGlow:SetPoint("BOTTOMLEFT", frame, -offset, -(E.PixelMode and offset or offset-1))
mainGlow:SetPoint("BOTTOMRIGHT", frame, offset, -(E.PixelMode and offset or offset-1))
end
if powerGlow then
powerGlow:ClearAllPoints()
powerGlow:SetPoint("TOPLEFT", power, -offset, offset)
powerGlow:SetPoint("TOPRIGHT", power, offset, offset)
powerGlow:SetPoint("BOTTOMLEFT", power, -offset, -offset)
powerGlow:SetPoint("BOTTOMRIGHT", power, offset, -offset)
end
if additionalPower then
UF:FrameGlow_ClassGlowPosition(frame, "AdditionalPower", mainGlow, offset)
elseif runes then
UF:FrameGlow_ClassGlowPosition(frame, "Runes", mainGlow, offset)
elseif comboPoints then
UF:FrameGlow_ClassGlowPosition(frame, "ComboPoints", mainGlow, offset)
elseif happiness then
UF:FrameGlow_ClassGlowPosition(frame, "HappinessIndicator", mainGlow, offset)
end
end
function UF:FrameGlow_CreateGlow(frame, mouse)
-- Main Glow to wrap the health frame to it's best ability
E:CreateShadow(frame, "Default")
local mainGlow = frame.shadow
mainGlow:SetFrameStrata("BACKGROUND")
mainGlow:Hide()
frame.shadow = nil
-- Secondary Glow for power frame when using power offset or mini power
E:CreateShadow(frame, "Default")
local powerGlow = frame.shadow
powerGlow:SetFrameStrata("BACKGROUND")
powerGlow:Hide()
frame.shadow = nil
if mouse then
mainGlow:SetFrameLevel(4)
powerGlow:SetFrameLevel(4)
else
mainGlow:SetFrameLevel(3)
powerGlow:SetFrameLevel(3)
end
-- Eventing Frame
if not frame.Highlight then
frame.Highlight = CreateFrame("Frame", nil, frame)
frame.Highlight:Hide()
HookScript(frame, "OnEnter", function()
frame.isHighlight = true
UF:FrameGlow_CheckMouseover(frame)
end)
HookScript(frame, "OnLeave", function()
frame.isHighlight = false
UF:FrameGlow_CheckMouseover(frame)
end)
HookScript(frame.Highlight, "OnEvent", function()
if event == "UPDATE_MOUSEOVER_UNIT" then
UF:FrameGlow_CheckMouseover(frame)
elseif event == "PLAYER_TARGET_CHANGED" then
UF:FrameGlow_CheckTarget(frame)
end
end)
end
mainGlow.powerGlow = powerGlow
return mainGlow
end
function UF:FrameGlow_SetGlowColor(glow, unit, which)
if not glow then return end
local option = E.db.unitframe.colors.frameGlow[which]
local r, g, b, a = 1, 1, 1, 1
if option.color then
local color = option.color
r, g, b, a = color.r, color.g, color.b, color.a
end
if option.class then
local isPlayer = unit and UnitIsPlayer(unit)
local reaction = unit and UnitReaction(unit, "player")
if isPlayer then
local _, class = UnitClass(unit)
if class then
local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
if color then
r, g, b = color.r, color.g, color.b
end
end
elseif reaction then
local color = FACTION_BAR_COLORS[reaction]
if color then
r, g, b = color.r, color.g, color.b
end
end
end
if which == "mouseoverGlow" then
glow:SetVertexColor(r, g, b, a)
else
glow:SetBackdropBorderColor(r, g, b, a)
if glow.powerGlow then
glow.powerGlow:SetBackdropBorderColor(r, g, b, a)
end
end
end
function UF:FrameGlow_HideGlow(glow)
if not glow then return end
if glow:IsShown() then glow:Hide() end
if glow.powerGlow and glow.powerGlow:IsShown() then
glow.powerGlow:Hide()
end
end
function UF:FrameGlow_ConfigureGlow(frame, unit, dbTexture)
if not frame then return end
if not unit then
unit = frame.unit or (frame.isForced and "player")
end
local shouldHide
if frame.Highlight and frame.Highlight.texture then
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
frame.Highlight.texture:SetTexture(dbTexture)
UF:FrameGlow_SetGlowColor(frame.Highlight.texture, unit, "mouseoverGlow")
else
shouldHide = "texture"
end
end
if frame.MouseGlow then
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
UF:FrameGlow_SetGlowColor(frame.MouseGlow, unit, "mainGlow")
else
UF:FrameGlow_HideGlow(frame.MouseGlow)
if shouldHide then
shouldHide = "both"
end
end
end
if shouldHide then
if shouldHide == "both" and frame.Highlight:IsShown() then
frame.Highlight:Hide()
elseif shouldHide == "texture" then
frame.Highlight.texture:Hide()
end
end
if frame.TargetGlow then
UF:FrameGlow_CheckTarget(frame, true)
end
end
function UF:FrameGlow_CheckTarget(frame, setColor)
if not (frame and frame.TargetGlow and frame:IsVisible()) then return end
local unit = frame.unit or (frame.isForced and "player")
if E.db.unitframe.colors.frameGlow.targetGlow.enable and (unit and UnitIsUnit(unit, "target")) and not (frame.db and frame.db.disableTargetGlow) then
if setColor then
UF:FrameGlow_SetGlowColor(frame.TargetGlow, unit, "targetGlow")
end
if frame.TargetGlow.powerGlow then
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
frame.TargetGlow.powerGlow:Show()
elseif frame.TargetGlow.powerGlow:IsShown() then
frame.TargetGlow.powerGlow:Hide()
end
end
frame.TargetGlow:Show()
else
UF:FrameGlow_HideGlow(frame.TargetGlow)
end
end
function UF:FrameGlow_CheckMouseover(frame, onEnter)
if not (frame and frame.MouseGlow and frame:IsVisible()) then return end
local shouldShow
if UF:FrameGlow_MouseOnUnit(frame, onEnter) then
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
shouldShow = "frame"
end
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
shouldShow = (shouldShow and "both") or "texture"
end
end
if shouldShow then
if frame.Highlight and not frame.Highlight:IsShown() then
frame.Highlight:Show()
end
if (shouldShow == "both" or shouldShow == "frame") then
if frame.MouseGlow.powerGlow then
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
frame.MouseGlow.powerGlow:Show()
elseif frame.MouseGlow.powerGlow:IsShown() then
frame.MouseGlow.powerGlow:Hide()
end
end
frame.MouseGlow:Show()
if (shouldShow == "frame") and frame.Highlight.texture and frame.Highlight.texture:IsShown() then
frame.Highlight.texture:Hide()
end
end
if (shouldShow == "both" or shouldShow == "texture") and frame.Highlight.texture and not frame.Highlight.texture:IsShown() then
frame.Highlight.texture:Show()
end
elseif frame.Highlight and frame.Highlight:IsShown() then
frame.Highlight:Hide()
end
end
function UF:FrameGlow_PositionHighlight(frame)
if frame.Highlight and frame.Highlight.texture then
frame.Highlight.texture:ClearAllPoints()
frame.Highlight.texture:SetPoint("TOPLEFT", frame.Health, "TOPLEFT")
frame.Highlight.texture:SetPoint("BOTTOMRIGHT", frame.Health.texturePointer, "BOTTOMRIGHT")
end
end
function UF:Configure_HighlightGlow(frame)
if frame.Highlight and frame.Highlight.texture then
local dbTexture = UF.LSM:Fetch("statusbar", E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
frame.Highlight.texture:SetTexture(dbTexture)
end
end
function UF:Construct_HighlightGlow(frame, glow)
if frame.Health and frame.Highlight then
HookScript(frame.Highlight, "OnHide", function()
UF:FrameGlow_HideGlow(glow)
if this.texture and this.texture:IsShown() then
this.texture:Hide()
end
end)
frame.Highlight:Show()
frame.Highlight:SetScript("OnUpdate", function()
if this.elapsed and this.elapsed > 0.1 then
if not UF:FrameGlow_MouseOnUnit(frame) then
this:Hide()
end
this.elapsed = 0
else
this.elapsed = (this.elapsed or 0) + arg1
end
end)
frame.Highlight.texture = frame.Health:CreateTexture("$parentHighlight", "OVERLAY")
frame.Highlight.texture:Hide()
UF:FrameGlow_ElementHook(frame, frame.Highlight.texture, "mouseoverGlow")
end
end
function UF:Construct_MouseGlow(frame)
local mainGlow = UF:FrameGlow_CreateGlow(frame, true)
UF:FrameGlow_ElementHook(frame, mainGlow, "mainGlow")
UF:Construct_HighlightGlow(frame, mainGlow)
frame.Highlight:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
return mainGlow
end
function UF:Construct_TargetGlow(frame)
local targetGlow = UF:FrameGlow_CreateGlow(frame)
UF:FrameGlow_ElementHook(frame, targetGlow, "targetGlow")
frame.Highlight:RegisterEvent("PLAYER_TARGET_CHANGED")
return targetGlow
end
function UF:FrameGlow_CheckChildren(frame, dbTexture)
if frame.GetName then
local pet = _G[frame:GetName().."Pet"]
if pet then
UF:FrameGlow_ConfigureGlow(pet, pet.unit, dbTexture)
end
local target = _G[frame:GetName().."Target"]
if target then
UF:FrameGlow_ConfigureGlow(target, target.unit, dbTexture)
end
end
end
function UF:FrameGlow_UpdateFrames()
local dbTexture = UF.LSM:Fetch("statusbar", E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
-- focus, focustarget, pet, pettarget, player, target, targettarget, targettargettarget
for unit in pairs(self.units) do
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
end
-- arena{1-5}, boss{1-5}
for unit in pairs(self.groupunits) do
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
end
-- assist, tank, party, raid, raid40, raidpet
for groupName in pairs(self.headers) do
assert(self[groupName], "UF FrameGlow: Invalid group specified.")
local group = self[groupName]
if group.GetNumChildren then
for i = 1, group:GetNumChildren() do
local frame = select(i, group:GetChildren())
if frame and frame.Health then
UF:FrameGlow_ConfigureGlow(frame, frame.unit, dbTexture)
UF:FrameGlow_CheckChildren(frame, dbTexture)
elseif frame then
for n = 1, frame:GetNumChildren() do
local child = select(n, frame:GetChildren())
if child and child.Health then
UF:FrameGlow_ConfigureGlow(child, child.unit, dbTexture)
UF:FrameGlow_CheckChildren(child, dbTexture)
end
end
end
end
end
end
end
+41
View File
@@ -0,0 +1,41 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
--WoW API / Variables
local CreateFrame = CreateFrame
function UF:Construct_GPS(frame)
local gps = CreateFrame("Frame", nil, frame)
gps:SetFrameLevel(frame:GetFrameLevel() + 50)
gps:Hide()
gps.Texture = gps:CreateTexture("OVERLAY")
gps.Texture:SetTexture([[Interface\AddOns\ElvUI\media\textures\arrow.tga]])
gps.Texture:SetBlendMode("BLEND")
gps.Texture:SetVertexColor(214/255, 41/255, 41/255)
gps.Texture:SetAllPoints()
return gps
end
function UF:Configure_GPS(frame)
local GPS = frame.GPS
if frame.db.GPSArrow.enable then
if not frame:IsElementEnabled("GPS") then
frame:EnableElement("GPS")
end
E:Size(GPS, frame.db.GPSArrow.size)
GPS.onMouseOver = frame.db.GPSArrow.onMouseOver
GPS.outOfRange = frame.db.GPSArrow.outOfRange
E:Point(GPS, "CENTER", frame, "CENTER", frame.db.GPSArrow.xOffset, frame.db.GPSArrow.yOffset)
else
if frame:IsElementEnabled("GPS") then
frame:DisableElement("GPS")
end
end
end
@@ -176,6 +176,9 @@ function UF:Configure_HealthBar(frame)
--Transparency Settings
UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, (frame.USE_PORTRAIT and frame.USE_PORTRAIT_OVERLAY) ~= true)
--Highlight Texture
UF:Configure_HighlightGlow(frame)
frame:UpdateElement("Health")
end
@@ -1,11 +1,17 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="AuraBars.lua"/>
<Script file="Auras.lua"/>
<Script file="Castbar.lua"/>
<Script file="CombatIndicator.lua"/>
<Script file="GPS.lua"/>
<Script file="Health.lua"/>
<Script file="Name.lua"/>
<Script file="Portrait.lua"/>
<Script file="Power.lua"/>
<Script file="InfoPanel.lua"/>
<Script file="PvPIndicator.lua"/>
<Script file="RaidIcon.lua"/>
<Script file="RaidRoleIcons.lua"/>
<Script file="RestingIndicator.lua"/>
<Script file="FrameGlow.lua"/>
</Ui>
@@ -54,11 +54,11 @@ function UF:Configure_Portrait(frame, dontHide)
portrait:SetParent(frame.Health);
end
portrait:SetAllPoints(frame.Health);
--portrait:SetAllPoints(frame.Health);
portrait:SetWidth(frame.Health:GetWidth())
portrait:SetHeight(frame.Health:GetHeight())
portrait:SetPoint("TOPLEFT", frame.Health, "TOPLEFT", 0, -frame.BORDER)
portrait:SetPoint("TOPLEFT", frame.Health, "TOPLEFT", - frame.BORDER - frame.SPACING, -(frame.BORDER + frame.SPACING))
portrait:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", - frame.BORDER - frame.SPACING, -(frame.BORDER + frame.SPACING))
portrait:SetAlpha(0.35);
if(not dontHide) then
portrait:Show();
@@ -0,0 +1,23 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
--WoW API / Variables
function UF:Construct_PvPIndicator(frame)
local pvp = frame.RaisedElementParent:CreateFontString(nil, "OVERLAY")
UF:Configure_FontString(pvp)
return pvp
end
function UF:Configure_PVPIndicator(frame)
local pvp = frame.PvPText
local x, y = self:GetPositionOffset(frame.db.pvp.position)
pvp:ClearAllPoints()
E:Point(pvp, frame.db.pvp.position, frame.Health, frame.db.pvp.position, x, y)
frame:Tag(pvp, frame.db.pvp.text_format)
end
+3 -3
View File
@@ -5,9 +5,6 @@ local _G = _G
local tinsert = table.insert
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver
local IsInInstance = IsInInstance
local ns = oUF
@@ -33,6 +30,7 @@ function UF:Construct_PartyFrames()
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.GPS = UF:Construct_GPS(self)
self.unitframeType = "party"
UF:Update_StatusBars()
@@ -114,6 +112,8 @@ function UF:Update_PartyFrames(frame, db)
UF:Configure_RaidIcon(frame)
UF:Configure_GPS(frame)
UF:Configure_RaidRoleIcons(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
+11 -10
View File
@@ -1,14 +1,10 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames")
local tinsert = table.insert
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
--WoW API / Variables
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
local IsInInstance = IsInInstance
local GetInstanceInfo = GetInstanceInfo
local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver
local ns = oUF
local ElvUF = ns.oUF
@@ -30,8 +26,11 @@ function UF:Construct_RaidFrames()
self.Portrait2D = UF:Construct_Portrait(self, "texture")
self.Name = UF:Construct_NameText(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self);
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.GPS = UF:Construct_GPS(self)
self.InfoPanel = UF:Construct_InfoPanel(self)
UF:Update_StatusBars()
UF:Update_FontStrings()
@@ -112,6 +111,8 @@ function UF:Update_RaidFrames(frame, db)
UF:Configure_Portrait(frame)
UF:Configure_GPS(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_RaidRoleIcons(frame)
@@ -1,5 +1,6 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="UnitFrames.lua"/>
<Script file="Config_Enviroment.lua"/>
<Script file="Tags.lua"/>
<Include file="Elements\Load_Elements.xml"/>
<Include file="Units\Load_Units.xml"/>
+3 -1
View File
@@ -485,6 +485,7 @@ end
ElvUF.Tags.OnUpdateThrottle["pvptimer"] = 1
ElvUF.Tags.Methods["pvptimer"] = function(unit)
if (UnitIsPVPFreeForAll(unit) or UnitIsPVP(unit)) then
--[[
local timer = GetPVPTimer()
if timer ~= 301000 and timer ~= -1 then
@@ -492,8 +493,9 @@ ElvUF.Tags.Methods["pvptimer"] = function(unit)
local secs = floor((timer / 1000) - (mins * 60))
return format("%s (%01.f:%02.f)", PVP, mins, secs)
else
]]
return PVP
end
--end
else
return ""
end
+8 -8
View File
@@ -693,7 +693,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
E:EnableMover(self[group].mover:GetName())
end
else
-- UnregisterStateDriver(self[group], "visibility")
--UnregisterStateDriver(self[group], "visibility")
self[group]:Hide()
if self[group].mover then
E:DisableMover(self[group].mover:GetName())
@@ -707,8 +707,8 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
UF["headerFunctions"][group]["Update"] = function()
local db = UF.db["units"][group]
if db.enable ~= true then
UnregisterStateDriver(UF[group], "visibility")
--UF[group]:Hide()
--UnregisterStateDriver(UF[group], "visibility")
UF[group]:Hide()
if(UF[group].mover) then
E:DisableMover(UF[group].mover:GetName())
end
@@ -821,7 +821,7 @@ hiddenParent:Hide()
local HandleFrame = function(baseName)
local frame
if(type(baseName) == "string") then
if type(baseName) == "string" then
frame = _G[baseName]
else
frame = baseName
@@ -835,17 +835,17 @@ local HandleFrame = function(baseName)
frame:SetParent(hiddenParent)
local health = frame.healthbar
if(health) then
if health then
health:UnregisterAllEvents()
end
local power = frame.manabar
if(power) then
if power then
power:UnregisterAllEvents()
end
local spell = frame.spellbar
if(spell) then
if spell then
spell:UnregisterAllEvents()
end
end
@@ -868,7 +868,7 @@ function ElvUF:DisableBlizzard(unit)
HandleFrame(TargetofTargetFrame)
elseif string.match(unit, "(party)%d?$") == "party" and E.private["unitframe"]["disabledBlizzardFrames"].party then
local id = string.match(unit, "party(%d)")
if(id) then
if id then
HandleFrame("PartyMemberFrame"..id)
else
for i = 1, 4 do
@@ -2,9 +2,6 @@
<Script file="Player.lua"/>
<Script file="Target.lua"/>
<Script file="TargetTarget.lua"/>
<Script file="focus.lua"/>
<Script file="focustarget.lua"/>
<Script file="pet.lua"/>
<Script file="pettarget.lua"/>
<Script file="targettargettarget.lua"/>
<Script file="Pet.lua"/>
<Script file="PetTarget.lua"/>
</Ui>
+89
View File
@@ -0,0 +1,89 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local _G = _G
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_PetFrame(frame)
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
frame.Health.frequentUpdates = true
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
frame.Power.frequentUpdates = true
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.Buffs = self:Construct_Buffs(frame)
frame.Debuffs = self:Construct_Debuffs(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
frame.MouseGlow = self:Construct_MouseGlow(frame)
frame.TargetGlow = self:Construct_TargetGlow(frame)
E:Point(frame, "BOTTOM", E.UIParent, "BOTTOM", 0, 118)
E:CreateMover(frame, frame:GetName().."Mover", L["Pet Frame"], nil, nil, nil, "ALL,SOLO")
frame.unitframeType = "pet"
end
function UF:Update_PetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == "inset" and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == "spaced" and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = db.power.offset ~= 0 and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == "MIDDLE")
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
frame.VARIABLES_SET = true
end
frame.colors = ElvUF.colors
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
frame:RegisterForClicks(self.db.targetOnMouseDown and "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
E:Size(frame, frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
E:Size(_G[frame:GetName().."Mover"], frame:GetWidth(), frame:GetHeight())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_Auras(frame, "Buffs")
UF:Configure_Auras(frame, "Debuffs")
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "pet")
@@ -0,0 +1,86 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local _G = _G
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_PetTargetFrame(frame)
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
frame.Health.frequentUpdates = true
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
frame.Power.frequentUpdates = true
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.Buffs = self:Construct_Buffs(frame)
frame.Debuffs = self:Construct_Debuffs(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
E:Point(frame, "BOTTOM", ElvUF_Pet, "TOP", 0, 7)
E:CreateMover(frame, frame:GetName().."Mover", L["PetTarget Frame"], nil, nil, nil, "ALL,SOLO")
frame.unitframeType = "pettarget"
end
function UF:Update_PetTargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == "inset" and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == "spaced" and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = db.power.offset ~= 0 and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == "MIDDLE")
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
frame.VARIABLES_SET = true
end
frame.colors = ElvUF.colors
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
frame:RegisterForClicks(self.db.targetOnMouseDown and "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
E:Size(frame, frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
E:Size(_G[frame:GetName().."Mover"], frame:GetWidth(), frame:GetHeight())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_Auras(frame, "Buffs")
UF:Configure_Auras(frame, "Debuffs")
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "pettarget")
+14 -4
View File
@@ -22,9 +22,13 @@ function UF:Construct_PlayerFrame(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.Buffs = self:Construct_Buffs(frame)
frame.Debuffs = self:Construct_Debuffs(frame)
frame.Castbar = self:Construct_Castbar(frame, L["Player Castbar"])
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.RestingIndicator = self:Construct_RestingIndicator(frame)
frame.CombatIndicator = self:Construct_CombatIndicator(frame)
frame.PvPText = self:Construct_PvPIndicator(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68)
@@ -78,10 +82,8 @@ function UF:Update_PlayerFrame(frame, db)
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
frame:RegisterForClicks(self.db.targetOnMouseDown and "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
frame:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
_G[frame:GetName().."Mover"]:SetWidth(frame:GetWidth())
_G[frame:GetName().."Mover"]:SetHeight(frame:GetHeight())
E:Size(frame, frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
E:Size(_G[frame:GetName().."Mover"], frame:GetWidth(), frame:GetHeight())
UF:Configure_InfoPanel(frame)
@@ -93,10 +95,18 @@ function UF:Update_PlayerFrame(frame, db)
UF:UpdateNameSettings(frame)
UF:Configure_PVPIndicator(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_Auras(frame, "Buffs")
UF:Configure_Auras(frame, "Debuffs")
UF:Configure_Castbar(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
+11
View File
@@ -20,8 +20,13 @@ function UF:Construct_TargetFrame(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.Buffs = self:Construct_Buffs(frame)
frame.Debuffs = self:Construct_Debuffs(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.GPS = self:Construct_GPS(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
frame.MouseGlow = self:Construct_MouseGlow(frame)
frame.TargetGlow = self:Construct_TargetGlow(frame)
E:Point(frame, "BOTTOMRIGHT", E.UIParent, "BOTTOM", 413, 68)
E:CreateMover(frame, frame:GetName().."Mover", L["Target Frame"], nil, nil, nil, "ALL,SOLO")
@@ -85,6 +90,12 @@ function UF:Update_TargetFrame(frame, db)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_Auras(frame, "Buffs")
UF:Configure_Auras(frame, "Debuffs")
UF:Configure_GPS(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
@@ -15,6 +15,8 @@ function UF:Construct_TargetTargetFrame(frame)
frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.Buffs = self:Construct_Buffs(frame)
frame.Debuffs = self:Construct_Debuffs(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
@@ -70,6 +72,10 @@ function UF:Update_TargetTargetFrame(frame, db)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_Auras(frame, "Buffs")
UF:Configure_Auras(frame, "Debuffs")
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db["units"].player.castbar.height))
+5
View File
@@ -21,6 +21,11 @@ G["classtimer"] = {}
G["nameplates"] = {}
G["unitframe"] = {
["specialFilters"] = {},
["aurafilters"] = {}
}
G["chat"] = {
["classColorMentionExcludedNames"] = {}
}
+38 -756
View File
@@ -556,7 +556,7 @@ P["bags"] = {
["showBackdrop"] = false,
["mouseover"] = false
}
};
}
--UnitFrame
P["unitframe"] = {
@@ -625,6 +625,24 @@ P["unitframe"] = {
[3] = {r = 0.33, g = 0.59, b = 0.33},
},
},
["frameGlow"] = {
["mainGlow"] = {
["enable"] = false,
["class"] = false,
["color"] = {r = 1, g = 1, b = 1, a = 1}
},
["targetGlow"] = {
["enable"] = false,
["class"] = false,
["color"] = {r = 1, g = 1, b = 1, a = 1}
},
["mouseoverGlow"] = {
["enable"] = false,
["class"] = false,
["texture"] = "ElvUI Blank",
["color"] = {r = 1, g = 1, b = 1, a = 0.1}
}
},
},
["units"] = {
@@ -641,6 +659,8 @@ P["unitframe"] = {
["threatStyle"] = "GLOW",
["smartAuraPosition"] = "DISABLED",
["colorOverride"] = "USE_DEFAULT",
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = false,
["health"] = {
["text_format"] = "[healthcolor][health:current-percent]",
["position"] = "LEFT",
@@ -696,9 +716,9 @@ P["unitframe"] = {
["scale"] = 1,
},
["portrait"] = {
["enable"] = true,
["enable"] = false,
["width"] = 45,
["overlay"] = true,
["overlay"] = false,
["style"] = "3D",
},
["buffs"] = {
@@ -738,20 +758,15 @@ P["unitframe"] = {
["width"] = 270,
["height"] = 18,
["icon"] = true,
["latency"] = true,
["format"] = "REMAINING",
["ticks"] = true,
["spark"] = true,
["displayTarget"] = false,
["iconSize"] = 42,
["iconAttached"] = true,
["insideInfoPanel"] = true,
["iconAttachedTo"] = "Frame",
["iconPosition"] = "LEFT",
["iconXOffset"] = -10,
["iconYOffset"] = 0,
["tickWidth"] = 1,
["tickColor"] = {r = 0, g = 0, b = 0, a = 0.8},
["iconYOffset"] = 0
},
["classbar"] = {
["enable"] = true,
@@ -805,6 +820,8 @@ P["unitframe"] = {
["rangeCheck"] = true,
["healPrediction"] = true,
["middleClickFocus"] = true,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = true,
["health"] = {
["text_format"] = "[healthcolor][health:current-percent]",
["position"] = "RIGHT",
@@ -954,6 +971,8 @@ P["unitframe"] = {
["colorOverride"] = "USE_DEFAULT",
["width"] = 130,
["height"] = 36,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = true,
["health"] = {
["text_format"] = "",
["position"] = "RIGHT",
@@ -1039,6 +1058,8 @@ P["unitframe"] = {
["colorOverride"] = "USE_DEFAULT",
["width"] = 130,
["height"] = 36,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = false,
["health"] = {
["text_format"] = "",
["position"] = "RIGHT",
@@ -1114,216 +1135,6 @@ P["unitframe"] = {
["yOffset"] = 8,
},
},
["focus"] = {
["enable"] = true,
["rangeCheck"] = true,
["threatStyle"] = "GLOW",
["orientation"] = "MIDDLE",
["smartAuraPosition"] = "DISABLED",
["colorOverride"] = "USE_DEFAULT",
["width"] = 190,
["height"] = 36,
["healPrediction"] = true,
["health"] = {
["text_format"] = "",
["position"] = "RIGHT",
["xOffset"] = -2,
["yOffset"] = 0,
["attachTextTo"] = "Health",
},
["power"] = {
["enable"] = true,
["text_format"] = "",
["width"] = "fill",
["height"] = 7,
["offset"] = 0,
["position"] = "LEFT",
["hideonnpc"] = false,
["xOffset"] = 2,
["yOffset"] = 0,
["attachTextTo"] = "Health",
},
["infoPanel"] = {
["enable"] = false,
["height"] = 14,
["transparent"] = false,
},
["name"] = {
["position"] = "CENTER",
["text_format"] = "[namecolor][name:medium]",
["xOffset"] = 0,
["yOffset"] = 0,
["attachTextTo"] = "Health",
},
["portrait"] = {
["enable"] = false,
["width"] = 45,
["overlay"] = false,
["style"] = "3D",
},
["buffs"] = {
["enable"] = false,
["perrow"] = 7,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "BOTTOMLEFT",
["fontSize"] = 10,
["clickThrough"] = false,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,Personal,PlayerBuffs,CastByUnit,Dispellable", --Focus Buffs
["xOffset"] = 0,
["yOffset"] = 0,
},
["debuffs"] = {
["enable"] = true,
["perrow"] = 5,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "TOPRIGHT",
["fontSize"] = 10,
["clickThrough"] = false,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,Personal,RaidDebuffs,Dispellable,Whitelist", --Focus Debuffs
["xOffset"] = 0,
["yOffset"] = 0,
},
["castbar"] = {
["enable"] = true,
["width"] = 190,
["height"] = 18,
["icon"] = true,
["format"] = "REMAINING",
["spark"] = true,
["iconSize"] = 32,
["iconAttached"] = true,
["insideInfoPanel"] = true,
["iconAttachedTo"] = "Frame",
["iconPosition"] = "LEFT",
["iconXOffset"] = -10,
["iconYOffset"] = 0,
},
["aurabar"] = {
["enable"] = false,
["anchorPoint"] = "ABOVE",
["attachTo"] = "DEBUFFS",
["maxBars"] = 3,
["minDuration"] = 0,
["maxDuration"] = 120,
["priority"] = "Blacklist,blockNoDuration,Personal,PlayerBuffs,RaidDebuffs", --Focus AuraBars
["friendlyAuraType"] = "HELPFUL",
["enemyAuraType"] = "HARMFUL",
["height"] = 20,
["sort"] = "TIME_REMAINING",
["uniformThreshold"] = 0,
["yOffset"] = 0,
},
["raidicon"] = {
["enable"] = true,
["size"] = 18,
["attachTo"] = "TOP",
["attachToObject"] = "Frame",
["xOffset"] = 0,
["yOffset"] = 8,
},
["GPSArrow"] = {
["enable"] = true,
["size"] = 45,
["xOffset"] = 0,
["yOffset"] = 0,
["onMouseOver"] = true,
["outOfRange"] = true,
},
},
["focustarget"] = {
["enable"] = false,
["rangeCheck"] = true,
["threatStyle"] = "NONE",
["orientation"] = "MIDDLE",
["smartAuraPosition"] = "DISABLED",
["colorOverride"] = "USE_DEFAULT",
["width"] = 190,
["height"] = 26,
["health"] = {
["text_format"] = "",
["position"] = "RIGHT",
["xOffset"] = -2,
["yOffset"] = 0,
},
["power"] = {
["enable"] = false,
["text_format"] = "",
["width"] = "fill",
["height"] = 7,
["offset"] = 0,
["position"] = "LEFT",
["hideonnpc"] = false,
["xOffset"] = 2,
["yOffset"] = 0,
},
["infoPanel"] = {
["enable"] = false,
["height"] = 12,
["transparent"] = false,
},
["name"] = {
["position"] = "CENTER",
["text_format"] = "[namecolor][name:medium]",
["yOffset"] = 0,
["xOffset"] = 0,
},
["portrait"] = {
["enable"] = false,
["width"] = 45,
["overlay"] = false,
["style"] = "3D",
},
["buffs"] = {
["enable"] = false,
["perrow"] = 7,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "BOTTOMLEFT",
["fontSize"] = 10,
["clickThrough"] = false,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,Personal,PlayerBuffs,Dispellable,CastByUnit", --FocusTarget Buffs
["xOffset"] = 0,
["yOffset"] = 0,
},
["debuffs"] = {
["enable"] = false,
["perrow"] = 5,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "BOTTOMRIGHT",
["fontSize"] = 10,
["clickThrough"] = false,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,Personal,RaidDebuffs,Dispellable,Whitelist", --FocusTarget Debuffs
["xOffset"] = 0,
["yOffset"] = 0,
},
["raidicon"] = {
["enable"] = true,
["size"] = 18,
["attachTo"] = "TOP",
["attachToObject"] = "Frame",
["xOffset"] = 0,
["yOffset"] = 8,
},
},
["pet"] = {
["enable"] = true,
["rangeCheck"] = true,
@@ -1333,6 +1144,8 @@ P["unitframe"] = {
["colorOverride"] = "USE_DEFAULT",
["width"] = 130,
["height"] = 36,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = true,
["healPrediction"] = true,
["health"] = {
["text_format"] = "",
@@ -1430,6 +1243,8 @@ P["unitframe"] = {
["colorOverride"] = "USE_DEFAULT",
["width"] = 130,
["height"] = 26,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = false,
["health"] = {
["text_format"] = "",
["position"] = "RIGHT",
@@ -1497,218 +1312,6 @@ P["unitframe"] = {
["yOffset"] = 0,
},
},
["boss"] = {
["enable"] = true,
["rangeCheck"] = true,
["growthDirection"] = "DOWN",
["orientation"] = "RIGHT",
["smartAuraPosition"] = "DISABLED",
["colorOverride"] = "USE_DEFAULT",
["width"] = 216,
["height"] = 46,
["spacing"] = 25,
["targetGlow"] = true,
["health"] = {
["text_format"] = "[healthcolor][health:current]",
["position"] = "LEFT",
["yOffset"] = 0,
["xOffset"] = 2,
["attachTextTo"] = "Health",
},
["power"] = {
["enable"] = true,
["text_format"] = "[powercolor][power:current]",
["width"] = "fill",
["height"] = 7,
["offset"] = 0,
["position"] = "RIGHT",
["hideonnpc"] = false,
["yOffset"] = 0,
["xOffset"] = -2,
["attachTextTo"] = "Health",
},
["portrait"] = {
["enable"] = false,
["width"] = 35,
["overlay"] = false,
["style"] = "3D",
},
["infoPanel"] = {
["enable"] = false,
["height"] = 16,
["transparent"] = false,
},
["name"] = {
["position"] = "CENTER",
["text_format"] = "[namecolor][name:medium]",
["yOffset"] = 0,
["xOffset"] = 0,
["attachTextTo"] = "Health",
},
["buffs"] = {
["enable"] = true,
["perrow"] = 3,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "LEFT",
["fontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,CastByUnit,Whitelist", --Boss Buffs
["xOffset"] = 0,
["yOffset"] = 20,
["sizeOverride"] = 22,
},
["debuffs"] = {
["enable"] = true,
["perrow"] = 3,
["numrows"] = 2,
["attachTo"] = "FRAME",
["anchorPoint"] = "LEFT",
["fontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "Blacklist,Personal,RaidDebuffs,CastByUnit,Whitelist", --Boss Debuffs
["xOffset"] = 0,
["yOffset"] = -3,
["sizeOverride"] = 22,
},
["castbar"] = {
["enable"] = true,
["width"] = 215,
["height"] = 18,
["icon"] = true,
["format"] = "REMAINING",
["spark"] = true,
["iconSize"] = 32,
["iconAttached"] = true,
["insideInfoPanel"] = true,
["iconAttachedTo"] = "Frame",
["iconPosition"] = "LEFT",
["iconXOffset"] = -10,
["iconYOffset"] = 0,
},
["raidicon"] = {
["enable"] = true,
["size"] = 18,
["attachTo"] = "TOP",
["attachToObject"] = "Frame",
["xOffset"] = 0,
["yOffset"] = 8,
},
},
["arena"] = {
["enable"] = true,
["rangeCheck"] = true,
["growthDirection"] = "DOWN",
["orientation"] = "RIGHT",
["smartAuraPosition"] = "DISABLED",
["spacing"] = 25,
["width"] = 246,
["height"] = 47,
["healPrediction"] = true,
["colorOverride"] = "USE_DEFAULT",
["targetGlow"] = true,
["health"] = {
["text_format"] = "[healthcolor][health:current]",
["position"] = "LEFT",
["yOffset"] = 0,
["xOffset"] = 2,
["attachTextTo"] = "Health",
},
["power"] = {
["enable"] = true,
["text_format"] = "[powercolor][power:current]",
["width"] = "fill",
["height"] = 7,
["offset"] = 0,
["attachTextTo"] = "Health",
["position"] = "RIGHT",
["hideonnpc"] = false,
["yOffset"] = 0,
["xOffset"] = -2,
},
["infoPanel"] = {
["enable"] = false,
["height"] = 17,
["transparent"] = false,
},
["name"] = {
["position"] = "CENTER",
["text_format"] = "[namecolor][name:medium]",
["yOffset"] = 0,
["xOffset"] = 0,
["attachTextTo"] = "Health",
},
["portrait"] = {
["enable"] = false,
["width"] = 45,
["overlay"] = false,
["style"] = "3D",
},
["buffs"] = {
["enable"] = true,
["perrow"] = 3,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "LEFT",
["fontSize"] = 10,
["clickThrough"] = false,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,TurtleBuffs,PlayerBuffs,Dispellable", --Arena Buffs
["sizeOverride"] = 27,
["xOffset"] = 0,
["yOffset"] = 16,
},
["debuffs"] = {
["enable"] = true,
["perrow"] = 3,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "LEFT",
["fontSize"] = 10,
["clickThrough"] = false,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,blockNoDuration,Personal,CCDebuffs,Whitelist", --Arena Debuffs
["sizeOverride"] = 27,
["xOffset"] = 0,
["yOffset"] = -16,
},
["castbar"] = {
["enable"] = true,
["width"] = 256,
["height"] = 18,
["icon"] = true,
["format"] = "REMAINING",
["spark"] = true,
["iconSize"] = 32,
["iconAttached"] = true,
["insideInfoPanel"] = true,
["iconAttachedTo"] = "Frame",
["iconPosition"] = "LEFT",
["iconXOffset"] = -10,
["iconYOffset"] = 0,
},
["pvpTrinket"] = {
["enable"] = true,
["position"] = "RIGHT",
["size"] = 46,
["xOffset"] = 1,
["yOffset"] = 0,
},
},
["party"] = {
["enable"] = true,
["rangeCheck"] = true,
@@ -1730,7 +1333,8 @@ P["unitframe"] = {
["colorOverride"] = "USE_DEFAULT",
["width"] = 184,
["height"] = 54,
["targetGlow"] = true,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = false,
["health"] = {
["text_format"] = "[healthcolor][health:current-percent]",
["position"] = "LEFT",
@@ -1917,7 +1521,8 @@ P["unitframe"] = {
["colorOverride"] = "USE_DEFAULT",
["width"] = 80,
["height"] = 44,
["targetGlow"] = true,
["disableMouseoverGlow"] = false,
["disableTargetGlow"] = false,
["health"] = {
["text_format"] = "[healthcolor][health:deficit]",
["position"] = "BOTTOM",
@@ -2056,163 +1661,6 @@ P["unitframe"] = {
["yOffset"] = 2,
},
},
["raid40"] = {
["enable"] = true,
["rangeCheck"] = true,
["threatStyle"] = "GLOW",
["orientation"] = "MIDDLE",
["visibility"] = "[@raid26,noexists] hide;show",
["growthDirection"] = "RIGHT_DOWN",
["horizontalSpacing"] = 3,
["verticalSpacing"] = 3,
["numGroups"] = 8,
["groupsPerRowCol"] = 1,
["groupBy"] = "GROUP",
["sortDir"] = "ASC",
["showPlayer"] = true,
["healPrediction"] = false,
["colorOverride"] = "USE_DEFAULT",
["width"] = 80,
["height"] = 27,
["targetGlow"] = true,
["health"] = {
["text_format"] = "[healthcolor][health:deficit]",
["position"] = "BOTTOM",
["orientation"] = "HORIZONTAL",
["frequentUpdates"] = false,
["attachTextTo"] = "Health",
["yOffset"] = 2,
["xOffset"] = 0,
},
["power"] = {
["enable"] = false,
["text_format"] = "",
["width"] = "fill",
["height"] = 7,
["offset"] = 0,
["position"] = "BOTTOMRIGHT",
["hideonnpc"] = false,
["yOffset"] = 2,
["xOffset"] = -2,
},
["infoPanel"] = {
["enable"] = false,
["height"] = 12,
["transparent"] = false,
},
["name"] = {
["position"] = "CENTER",
["text_format"] = "[namecolor][name:short]",
["yOffset"] = 0,
["xOffset"] = 0,
["attachTextTo"] = "Health",
},
["portrait"] = {
["enable"] = false,
["width"] = 45,
["overlay"] = false,
["style"] = "3D",
},
["buffs"] = {
["enable"] = false,
["perrow"] = 3,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "LEFT",
["fontSize"] = 10,
["countFontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,TurtleBuffs", --Raid40 Buffs
["xOffset"] = 0,
["yOffset"] = 0,
},
["debuffs"] = {
["enable"] = false,
["perrow"] = 3,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "RIGHT",
["fontSize"] = 10,
["countFontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 300,
["priority"] = "Blacklist,RaidDebuffs,CCDebuffs,Dispellable,Whitelist", --Raid40 Debuffs
["xOffset"] = 0,
["yOffset"] = 0,
},
["rdebuffs"] = {
["enable"] = false,
["showDispellableDebuff"] = true,
["onlyMatchSpellID"] = true,
["fontSize"] = 10,
["font"] = "Homespun",
["fontOutline"] = "MONOCHROMEOUTLINE",
["size"] = 22,
["xOffset"] = 0,
["yOffset"] = 0,
["duration"] = {
["position"] = "CENTER",
["xOffset"] = 0,
["yOffset"] = 0,
["color"] = {r = 1, g = 0.9, b = 0, a = 1}
},
["stack"] = {
["position"] = "BOTTOMRIGHT",
["xOffset"] = 0,
["yOffset"] = 2,
["color"] = {r = 1, g = 0.9, b = 0, a = 1}
},
},
["roleIcon"] = {
["enable"] = false,
["position"] = "BOTTOMRIGHT",
["attachTo"] = "Health",
["xOffset"] = -1,
["yOffset"] = 1,
["size"] = 15,
},
["raidRoleIcons"] = {
["enable"] = true,
["position"] = "TOPLEFT",
},
["buffIndicator"] = {
["enable"] = true,
["size"] = 8,
["fontSize"] = 10,
["profileSpecific"] = false,
},
["raidicon"] = {
["enable"] = true,
["size"] = 18,
["attachTo"] = "TOP",
["attachToObject"] = "Frame",
["xOffset"] = 0,
["yOffset"] = 8,
},
["GPSArrow"] = {
["enable"] = true,
["size"] = 45,
["xOffset"] = 0,
["yOffset"] = 0,
["onMouseOver"] = true,
["outOfRange"] = true,
},
["readycheckIcon"] = {
["enable"] = true,
["size"] = 12,
["attachTo"] = "Health",
["position"] = "BOTTOM",
["xOffset"] = 0,
["yOffset"] = 2,
},
},
["raidpet"] = {
["enable"] = false,
["rangeCheck"] = true,
@@ -2327,172 +1775,6 @@ P["unitframe"] = {
["yOffset"] = 8,
},
},
["tank"] = {
["enable"] = true,
["orientation"] = "LEFT",
["threatStyle"] = "GLOW",
["colorOverride"] = "USE_DEFAULT",
["rangeCheck"] = true,
["width"] = 120,
["height"] = 28,
["disableDebuffHighlight"] = true,
["verticalSpacing"] = 7,
["buffs"] = {
["enable"] = false,
["perrow"] = 6,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "TOPLEFT",
["fontSize"] = 10,
["countFontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "",
["xOffset"] = 0,
["yOffset"] = 2,
},
["debuffs"] = {
["enable"] = false,
["perrow"] = 6,
["numrows"] = 1,
["attachTo"] = "BUFFS",
["anchorPoint"] = "TOPRIGHT",
["fontSize"] = 10,
["countFontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "",
["xOffset"] = 0,
["yOffset"] = 1,
},
["buffIndicator"] = {
["enable"] = true,
["size"] = 8,
["fontSize"] = 10,
["profileSpecific"] = false,
},
["rdebuffs"] = {
["enable"] = true,
["showDispellableDebuff"] = true,
["onlyMatchSpellID"] = true,
["fontSize"] = 10,
["font"] = "Homespun",
["fontOutline"] = "MONOCHROMEOUTLINE",
["size"] = 26,
["xOffset"] = 0,
["yOffset"] = 0,
["duration"] = {
["position"] = "CENTER",
["xOffset"] = 0,
["yOffset"] = 0,
["color"] = {r = 1, g = 0.9, b = 0, a = 1}
},
["stack"] = {
["position"] = "BOTTOMRIGHT",
["xOffset"] = 0,
["yOffset"] = 2,
["color"] = {r = 1, g = 0.9, b = 0, a = 1}
},
},
["targetsGroup"] = {
["enable"] = true,
["anchorPoint"] = "RIGHT",
["xOffset"] = 1,
["yOffset"] = 0,
["width"] = 120,
["height"] = 28,
["colorOverride"] = "USE_DEFAULT",
},
},
["assist"] = {
["enable"] = true,
["orientation"] = "LEFT",
["threatStyle"] = "GLOW",
["colorOverride"] = "USE_DEFAULT",
["rangeCheck"] = true,
["width"] = 120,
["height"] = 28,
["disableDebuffHighlight"] = true,
["verticalSpacing"] = 7,
["buffs"] = {
["enable"] = false,
["perrow"] = 6,
["numrows"] = 1,
["attachTo"] = "FRAME",
["anchorPoint"] = "TOPLEFT",
["fontSize"] = 10,
["countFontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "",
["xOffset"] = 0,
["yOffset"] = 2,
},
["debuffs"] = {
["enable"] = false,
["perrow"] = 6,
["numrows"] = 1,
["attachTo"] = "BUFFS",
["anchorPoint"] = "TOPRIGHT",
["fontSize"] = 10,
["countFontSize"] = 10,
["sortMethod"] = "TIME_REMAINING",
["sortDirection"] = "DESCENDING",
["clickThrough"] = false,
["minDuration"] = 0,
["maxDuration"] = 0,
["priority"] = "",
["xOffset"] = 0,
["yOffset"] = 1,
},
["buffIndicator"] = {
["enable"] = true,
["size"] = 8,
["fontSize"] = 10,
["profileSpecific"] = false,
},
["rdebuffs"] = {
["enable"] = true,
["showDispellableDebuff"] = true,
["onlyMatchSpellID"] = true,
["fontSize"] = 10,
["font"] = "Homespun",
["fontOutline"] = "MONOCHROMEOUTLINE",
["size"] = 26,
["xOffset"] = 0,
["yOffset"] = 0,
["duration"] = {
["position"] = "CENTER",
["xOffset"] = 0,
["yOffset"] = 0,
["color"] = {r = 1, g = 0.9, b = 0, a = 1}
},
["stack"] = {
["position"] = "BOTTOMRIGHT",
["xOffset"] = 0,
["yOffset"] = 2,
["color"] = {r = 1, g = 0.9, b = 0, a = 1}
},
},
["targetsGroup"] = {
["enable"] = true,
["anchorPoint"] = "RIGHT",
["xOffset"] = 1,
["yOffset"] = 0,
["width"] = 120,
["height"] = 28,
["colorOverride"] = "USE_DEFAULT",
},
},
},
}
+1 -1
View File
@@ -692,7 +692,7 @@ end
E.Options.args.actionbar = {
type = "group",
name = L["ActionBars"],
childGroups = "tab",
childGroups = "tree",
get = function(info) return E.db.actionbar[ info[getn(info)] ] end,
set = function(info, value) E.db.actionbar[ info[getn(info)] ] = value AB:UpdateButtonSettings() end,
args = {
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, sort, tremove = table.insert, table.sort, table.remove
do
local widgetType = "LSM30_Background"
local widgetVersion = 11
@@ -15,7 +19,7 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
@@ -36,7 +40,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -140,7 +144,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -156,19 +160,18 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[getn(sortedlist)+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
--print(k)
if k == self.value then
f.check:Show()
end
f.obj = self
f.dropdown = self.dropdown
self.dropdown:AddFrame(f)
self.dropdown:AddFrame(f, i)
end
wipe(sortedlist)
end
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, sort, tremove = table.insert, table.sort, table.remove
do
local widgetType = "LSM30_Border"
local widgetVersion = 11
@@ -15,7 +19,7 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
@@ -39,7 +43,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -135,7 +139,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -151,19 +155,18 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[getn(sortedlist)+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
--print(k)
if k == self.value then
f.check:Show()
end
f.obj = self
f.dropdown = self.dropdown
self.dropdown:AddFrame(f)
self.dropdown:AddFrame(f, i)
end
wipe(sortedlist)
end
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, sort, tremove = table.insert, table.sort, table.remove
do
local widgetType = "LSM30_Font"
local widgetVersion = 11
@@ -15,7 +19,7 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick()
@@ -29,7 +33,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -120,7 +124,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -136,9 +140,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[getn(sortedlist)+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
local _, size, outline= f.text:GetFont()
@@ -149,7 +153,7 @@ do
f.check:Show()
end
f.obj = self
self.dropdown:AddFrame(f)
self.dropdown:AddFrame(f, i)
end
wipe(sortedlist)
end
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, sort, tremove = table.insert, table.sort, table.remove
do
local widgetType = "LSM30_Sound"
local widgetVersion = 11
@@ -15,7 +19,7 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick()
@@ -35,7 +39,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -145,7 +149,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -161,9 +165,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[getn(sortedlist)+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
@@ -171,7 +175,7 @@ do
f.check:Show()
end
f.obj = self
self.dropdown:AddFrame(f)
self.dropdown:AddFrame(f, i)
end
wipe(sortedlist)
end
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, sort, tremove = table.insert, table.sort, table.remove
do
local widgetType = "LSM30_Statusbar"
local widgetVersion = 11
@@ -15,7 +19,7 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick()
@@ -29,7 +33,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -129,7 +133,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -145,13 +149,12 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[getn(sortedlist)+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
--print(k)
if k == self.value then
f.check:Show()
end
@@ -160,7 +163,7 @@ do
f.bar:SetTexture(statusbar)
f.obj = self
f.dropdown = self.dropdown
self.dropdown:AddFrame(f)
self.dropdown:AddFrame(f, i)
end
wipe(sortedlist)
end
@@ -16,6 +16,9 @@ local Media = LibStub("LibSharedMedia-3.0")
AGSMW = AGSMW or {}
local next, ipairs = next, ipairs
local tinsert, tremove = table.insert, table.remove
AceGUIWidgetLSMlists = {
['font'] = Media:HashTable("font"),
['sound'] = Media:HashTable("sound"),
@@ -160,38 +163,36 @@ do
self.slider:SetValue(self.slider:GetValue()+(15*dir*-1))
end
local function AddFrame(self, frame)
local function AddFrame(self, frame, i)
frame:SetParent(self.contentframe)
frame:SetFrameStrata(self:GetFrameStrata())
frame:SetFrameLevel(self:GetFrameLevel() + 100)
if next(self.contentRepo) then
frame:SetPoint("TOPLEFT", self.contentRepo[getn(self.contentRepo)], "BOTTOMLEFT", 0, 0)
frame:SetPoint("RIGHT", self.contentframe, "RIGHT", 0, 0)
frame:SetPoint("TOPLEFT", self.contentRepo[i-1], "BOTTOMLEFT", 0, 0)
self.contentframe:SetHeight(self.contentframe:GetHeight() + frame:GetHeight())
self.contentRepo[getn(self.contentRepo)+1] = frame
else
self.contentframe:SetHeight(frame:GetHeight())
frame:SetPoint("TOPLEFT", self.contentframe, "TOPLEFT", 0, 0)
frame:SetPoint("RIGHT", self.contentframe, "RIGHT", 0, 0)
self.contentRepo[1] = frame
frame:SetPoint("TOPLEFT", self.contentframe, 0, 0)
end
self.contentRepo[i] = frame
if self.contentframe:GetHeight() > UIParent:GetHeight()*2/5 - 20 then
self.scrollframe:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -28, 12)
self:SetHeight(UIParent:GetHeight()*2/5)
if self.contentframe:GetHeight() > GetScreenHeight()*2/5 - 20 then
self.scrollframe:SetWidth(128)
self:SetHeight(GetScreenHeight()*2/5)
self.slider:Show()
self:SetScript("OnMouseWheel", OnMouseWheel)
self:SetScript("OnMouseWheel", function() OnMouseWheel(this, arg1) end)
self.scrollframe:UpdateScrollChildRect()
self.slider:SetMinMaxValues(0, self.contentframe:GetHeight()-self.scrollframe:GetHeight())
else
self.scrollframe:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -14, 12)
self.scrollframe:SetWidth(142)
self:SetHeight(self.contentframe:GetHeight()+25)
self.slider:Hide()
self:SetScript("OnMouseWheel", nil)
self.scrollframe:UpdateScrollChildRect()
self.slider:SetMinMaxValues(0, 0)
end
frame:SetWidth(self.scrollframe:GetWidth())
self.contentframe:SetWidth(self.scrollframe:GetWidth())
end
@@ -210,7 +211,7 @@ do
function AGSMW:GetDropDownFrame()
local frame
if next(DropDownCache) then
frame = table.remove(DropDownCache)
frame = tremove(DropDownCache)
else
frame = CreateFrame("Frame", nil, UIParent)
frame:SetClampedToScreen(true)
@@ -225,14 +226,13 @@ do
frame.contentframe = contentframe
local scrollframe = CreateFrame("ScrollFrame", nil, frame)
scrollframe:SetWidth(160)
scrollframe:SetWidth(128)
scrollframe:SetHeight((GetScreenHeight()*2/5) - 24)
scrollframe:SetPoint("TOPLEFT", frame, "TOPLEFT", 14, -13)
scrollframe:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -14, 12)
scrollframe:SetScrollChild(contentframe)
frame.scrollframe = scrollframe
contentframe:SetPoint("TOPLEFT", scrollframe)
contentframe:SetPoint("TOPRIGHT", scrollframe)
local bgTex = frame:CreateTexture(nil, "ARTWORK")
bgTex:SetAllPoints(scrollframe)
@@ -255,7 +255,7 @@ do
slider:SetScript("OnValueChanged", slider_OnValueChanged)
frame.slider = slider
end
frame:SetHeight(UIParent:GetHeight()*2/5)
frame:SetHeight(GetScreenHeight()*2/5)
frame.slider:SetValue(0)
frame:Show()
return frame
@@ -267,7 +267,7 @@ do
frame:Hide()
frame:SetBackdrop(frameBackdrop)
frame.bgTex:SetTexture(nil)
table.insert(DropDownCache, frame)
tinsert(DropDownCache, frame)
return nil
end
end
@@ -256,7 +256,7 @@ do
end
WidgetBase.Fire = function(self, name, argc, ...)
argc = table.getn(arg)
argc = arg.n
local func = self.events[name]
if func then
local success, ret = safecall(func, argc+3, self, name, argc, unpack(arg))
@@ -310,8 +310,8 @@ do
AceGUI:Release(self)
end
WidgetBase.SetPoint = function(self,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
return self.frame:SetPoint(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
WidgetBase.SetPoint = function(self, a1,a2,a3,a4,a5)
return self.frame:SetPoint(a1,a2,a3,a4,a5)
end
WidgetBase.ClearAllPoints = function(self)
@@ -322,8 +322,8 @@ do
return self.frame:GetNumPoints()
end
WidgetBase.GetPoint = function(self,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
return self.frame:GetPoint(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
WidgetBase.GetPoint = function(self, a1,a2,a3,a4,a5)
return self.frame:GetPoint(a1,a2,a3,a4,a5)
end
WidgetBase.GetUserDataTable = function(self)
@@ -325,7 +325,7 @@ local methods = {
local button = CreateFrame("Button", strfmt("AceGUI30TreeButton%d", num), self.treeframe)
button.obj = self
button:SetWidth(175)
button:SetWidth(DEFAULT_TREE_WIDTH)
button:SetHeight(18)
local toggle = CreateFrame("Button", "$parentToggle", button)
@@ -419,7 +419,6 @@ local methods = {
end,
["RefreshTree"] = function(self,scrollToSelection)
local t = GetTime()
local buttons = self.buttons
local lines = self.lines
@@ -500,6 +499,7 @@ local methods = {
end
local buttonnum = 1
local treewidth = treeframe:GetWidth()
for i = first, last do
local line = lines[i]
local button = buttons[buttonnum]
@@ -509,19 +509,20 @@ local methods = {
buttons[buttonnum] = button
button:SetParent(treeframe)
button:SetFrameLevel(treeframe:GetFrameLevel()+1)
button:ClearAllPoints()
if buttonnum == 1 then
if self.showscroll then
button:SetPoint("TOPRIGHT", -22, -10)
button:SetPoint("TOPLEFT", 0, -10)
else
button:SetPoint("TOPRIGHT", 0, -10)
button:SetPoint("TOPLEFT", 0, -10)
end
end
button:ClearAllPoints()
if buttonnum == 1 then
if self.showscroll then
button:SetWidth(treewidth - 22)
button:SetPoint("TOPRIGHT", -22, -10)
else
button:SetPoint("TOPRIGHT", buttons[buttonnum-1], "BOTTOMRIGHT",0,0)
button:SetPoint("TOPLEFT", buttons[buttonnum-1], "BOTTOMLEFT",0,0)
button:SetWidth(treewidth)
button:SetPoint("TOPRIGHT", 0, -10)
end
else
button:SetWidth(self.showscroll and (treewidth - 22) or treewidth)
button:SetPoint("TOPRIGHT", buttons[buttonnum-1], "BOTTOMRIGHT",0,0)
end
UpdateButton(button, line, status.selected == line.uniquevalue, line.hasChildren, groupstatus[line.uniquevalue] )
@@ -542,7 +543,7 @@ local methods = {
self.filter = false
local status = self.status or self.localstatus
local groups = status.groups
for i = 1, tgetn(arg) do
for i = 1, arg.n do
groups[tconcat(arg, "\001", 1, i)] = true
end
status.selected = uniquevalue
@@ -563,11 +564,13 @@ local methods = {
if show then
self.scrollbar:Show()
if self.buttons[1] then
self.buttons[1]:SetWidth(self.treeframe:GetWidth() - 22)
self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",-22,-10)
end
else
self.scrollbar:Hide()
if self.buttons[1] then
self.buttons[1]:SetWidth(self.treeframe:GetWidth())
self.buttons[1]:SetPoint("TOPRIGHT", self.treeframe,"TOPRIGHT",0,-10)
end
end
@@ -107,7 +107,6 @@ do
end
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", self.slider:IsShown() and -12 or 0, offset)
status.offset = offset
status.scrollvalue = value
end
@@ -151,7 +150,6 @@ do
if value < 1000 then
child:ClearAllPoints()
child:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, offset)
child:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -12, offset)
status.offset = offset
end
end
@@ -324,16 +322,17 @@ do
slider.obj = self
scrollFrame:SetScrollChild(itemFrame)
scrollFrame:SetWidth(defaultWidth - 12)
scrollFrame:SetHeight(self.maxHeight - 24)
scrollFrame:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -12)
scrollFrame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -6, 12)
scrollFrame:EnableMouseWheel(true)
scrollFrame:SetScript("OnMouseWheel", OnMouseWheel)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:SetToplevel(true)
scrollFrame:SetFrameStrata("FULLSCREEN_DIALOG")
itemFrame:SetWidth(defaultWidth - 12)
itemFrame:SetPoint("TOPLEFT", scrollFrame, "TOPLEFT", 0, 0)
itemFrame:SetPoint("TOPRIGHT", scrollFrame, "TOPRIGHT", -12, 0)
itemFrame:SetHeight(400)
itemFrame:SetToplevel(true)
itemFrame:SetFrameStrata("FULLSCREEN_DIALOG")
@@ -392,7 +391,10 @@ do
AceGUI:ClearFocus()
else
self.open = true
self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth())
local width = self.pulloutWidth or self.frame:GetWidth()
self.pullout:SetWidth(width)
self.pullout.scrollFrame:SetWidth(width - 12)
self.pullout.itemFrame:SetWidth(width - (self.pullout.slider:IsShown() and 24 or 12))
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0)
AceGUI:SetFocus(self)
end
+1 -1
View File
@@ -507,7 +507,7 @@ end
E.Options.args.nameplate = {
type = "group",
name = L["NamePlates"],
childGroups = "tab",
childGroups = "tree",
get = function(info) return E.db.nameplates[ info[getn(info)] ] end,
set = function(info, value) E.db.nameplates[ info[getn(info)] ] = value; NP:ConfigureAll(); end,
args = {
+134 -187
View File
@@ -340,53 +340,53 @@ local function GetOptionsTable_AuraBars(friendlyOnly, updateFunc, groupName)
updateFunc(UF, groupName)
end,
}
config.args.filters.args.filterPriority = {
order = 22,
dragdrop = true,
type = "multiselect",
name = L["Filter Priority"],
dragOnLeave = function() end, --keep this here
dragOnEnter = function(info, value)
carryFilterTo = info.obj.value
end,
dragOnMouseDown = function(info, value)
carryFilterFrom, carryFilterTo = info.obj.value, nil
end,
dragOnMouseUp = function(info, value)
filterPriority("aurabar", groupName, carryFilterTo, nil, carryFilterFrom) --add it in the new spot
carryFilterFrom, carryFilterTo = nil, nil
end,
dragOnClick = function(info, value)
filterPriority("aurabar", groupName, carryFilterFrom, true)
end,
stateSwitchGetText = function(button, text, value)
local friend, enemy = match(text, "^Friendly:([^,]*)"), match(text, "^Enemy:([^,]*)")
return (friend and format("|cFF33FF33%s|r %s", L["Friend"], friend)) or (enemy and format("|cFFFF3333%s|r %s", L["Enemy"], enemy))
end,
stateSwitchOnClick = function(info, value)
filterPriority("aurabar", groupName, carryFilterFrom, nil, nil, true)
end,
values = function()
local str = E.db.unitframe.units[groupName].aurabar.priority
if str == "" then return nil end
return {strsplit(",",str)}
end,
get = function(info, value)
local str = E.db.unitframe.units[groupName].aurabar.priority
if str == "" then return nil end
local tbl = {strsplit(",",str)}
return tbl[value]
end,
set = function(info, value)
E.db.unitframe.units[groupName].aurabar[ info[getn(info)] ] = nil -- this was being set when drag and drop was first added, setting it to nil to clear tester profiles of this variable
updateFunc(UF, groupName)
end
}
config.args.filters.args.spacer1 = {
order = 23,
type = "description",
name = L["Use drag and drop to rearrange filter priority or right click to remove a filter."].."\n"..L["Use Shift+LeftClick to toggle between friendly or enemy or normal state. Normal state will allow the filter to be checked on all units. Friendly state is for friendly units only and enemy state is for enemy units."],
}
-- config.args.filters.args.filterPriority = {
-- order = 22,
-- dragdrop = true,
-- type = "multiselect",
-- name = L["Filter Priority"],
-- dragOnLeave = function() end, --keep this here
-- dragOnEnter = function(info, value)
-- carryFilterTo = info.obj.value
-- end,
-- dragOnMouseDown = function(info, value)
-- carryFilterFrom, carryFilterTo = info.obj.value, nil
-- end,
-- dragOnMouseUp = function(info, value)
-- filterPriority("aurabar", groupName, carryFilterTo, nil, carryFilterFrom) --add it in the new spot
-- carryFilterFrom, carryFilterTo = nil, nil
-- end,
-- dragOnClick = function(info, value)
-- filterPriority("aurabar", groupName, carryFilterFrom, true)
-- end,
-- stateSwitchGetText = function(button, text, value)
-- local friend, enemy = match(text, "^Friendly:([^,]*)"), match(text, "^Enemy:([^,]*)")
-- return (friend and format("|cFF33FF33%s|r %s", L["Friend"], friend)) or (enemy and format("|cFFFF3333%s|r %s", L["Enemy"], enemy))
-- end,
-- stateSwitchOnClick = function(info, value)
-- filterPriority("aurabar", groupName, carryFilterFrom, nil, nil, true)
-- end,
-- values = function()
-- local str = E.db.unitframe.units[groupName].aurabar.priority
-- if str == "" then return nil end
-- return {strsplit(",",str)}
-- end,
-- get = function(info, value)
-- local str = E.db.unitframe.units[groupName].aurabar.priority
-- if str == "" then return nil end
-- local tbl = {strsplit(",",str)}
-- return tbl[value]
-- end,
-- set = function(info, value)
-- E.db.unitframe.units[groupName].aurabar[ info[getn(info)] ] = nil -- this was being set when drag and drop was first added, setting it to nil to clear tester profiles of this variable
-- updateFunc(UF, groupName)
-- end
-- }
-- config.args.filters.args.spacer1 = {
-- order = 23,
-- type = "description",
-- name = L["Use drag and drop to rearrange filter priority or right click to remove a filter."].."\n"..L["Use Shift+LeftClick to toggle between friendly or enemy or normal state. Normal state will allow the filter to be checked on all units. Friendly state is for friendly units only and enemy state is for enemy units."],
-- }
return config
end
@@ -589,58 +589,58 @@ local function GetOptionsTable_Auras(friendlyUnitOnly, auraType, isGroupFrame, u
updateFunc(UF, groupName, numUnits)
end,
}
config.args.filters.args.filterPriority = {
order = 22,
dragdrop = true,
type = "multiselect",
name = L["Filter Priority"],
dragOnLeave = function() end, --keep this here
dragOnEnter = function(info, value)
carryFilterTo = info.obj.value
end,
dragOnMouseDown = function(info, value)
carryFilterFrom, carryFilterTo = info.obj.value, nil
end,
dragOnMouseUp = function(info, value)
filterPriority(auraType, groupName, carryFilterTo, nil, carryFilterFrom) --add it in the new spot
carryFilterFrom, carryFilterTo = nil, nil
end,
dragOnClick = function(info, value)
filterPriority(auraType, groupName, carryFilterFrom, true)
end,
stateSwitchGetText = function(button, text, value)
local friend, enemy = match(text, "^Friendly:([^,]*)"), match(text, "^Enemy:([^,]*)")
return (friend and format("|cFF33FF33%s|r %s", L["Friend"], friend)) or (enemy and format("|cFFFF3333%s|r %s", L["Enemy"], enemy))
end,
stateSwitchOnClick = function(info, value)
filterPriority(auraType, groupName, carryFilterFrom, nil, nil, true)
end,
values = function()
local str = E.db.unitframe.units[groupName][auraType].priority
if str == "" then return nil end
return {strsplit(",",str)}
end,
get = function(info, value)
local str = E.db.unitframe.units[groupName][auraType].priority
if str == "" then return nil end
local tbl = {strsplit(",",str)}
return tbl[value]
end,
set = function(info, value)
E.db.unitframe.units[groupName][auraType][ info[getn(info)] ] = nil -- this was being set when drag and drop was first added, setting it to nil to clear tester profiles of this variable
updateFunc(UF, groupName, numUnits)
end
}
config.args.filters.args.spacer1 = {
order = 23,
type = "description",
name = L["Use drag and drop to rearrange filter priority or right click to remove a filter."].."\n"..L["Use Shift+LeftClick to toggle between friendly or enemy or normal state. Normal state will allow the filter to be checked on all units. Friendly state is for friendly units only and enemy state is for enemy units."],
}
-- config.args.filters.args.filterPriority = {
-- order = 22,
-- dragdrop = true,
-- type = "multiselect",
-- name = L["Filter Priority"],
-- dragOnLeave = function() end, --keep this here
-- dragOnEnter = function(info, value)
-- carryFilterTo = info.obj.value
-- end,
-- dragOnMouseDown = function(info, value)
-- carryFilterFrom, carryFilterTo = info.obj.value, nil
-- end,
-- dragOnMouseUp = function(info, value)
-- filterPriority(auraType, groupName, carryFilterTo, nil, carryFilterFrom) --add it in the new spot
-- carryFilterFrom, carryFilterTo = nil, nil
-- end,
-- dragOnClick = function(info, value)
-- filterPriority(auraType, groupName, carryFilterFrom, true)
-- end,
-- stateSwitchGetText = function(button, text, value)
-- local friend, enemy = match(text, "^Friendly:([^,]*)"), match(text, "^Enemy:([^,]*)")
-- return (friend and format("|cFF33FF33%s|r %s", L["Friend"], friend)) or (enemy and format("|cFFFF3333%s|r %s", L["Enemy"], enemy))
-- end,
-- stateSwitchOnClick = function(info, value)
-- filterPriority(auraType, groupName, carryFilterFrom, nil, nil, true)
-- end,
-- values = function()
-- local str = E.db.unitframe.units[groupName][auraType].priority
-- if str == "" then return nil end
-- return {strsplit(",",str)}
-- end,
-- get = function(info, value)
-- local str = E.db.unitframe.units[groupName][auraType].priority
-- if str == "" then return nil end
-- local tbl = {strsplit(",",str)}
-- return tbl[value]
-- end,
-- set = function(info, value)
-- E.db.unitframe.units[groupName][auraType][ info[getn(info)] ] = nil -- this was being set when drag and drop was first added, setting it to nil to clear tester profiles of this variable
-- updateFunc(UF, groupName, numUnits)
-- end
-- }
-- config.args.filters.args.spacer1 = {
-- order = 23,
-- type = "description",
-- name = L["Use drag and drop to rearrange filter priority or right click to remove a filter."].."\n"..L["Use Shift+LeftClick to toggle between friendly or enemy or normal state. Normal state will allow the filter to be checked on all units. Friendly state is for friendly units only and enemy state is for enemy units."],
-- }
return config
end
local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits)
local function GetOptionsTable_Castbar(updateFunc, groupName, numUnits)
local config = {
order = 800,
type = "group",
@@ -668,7 +668,7 @@ local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits
frameName = gsub(frameName, "t(arget)", "T%1")
if numUnits then
for i=1, numUnits do
for i = 1, numUnits do
local castbar = _G[frameName..i].Castbar
if not castbar.oldHide then
castbar.oldHide = castbar.Hide
@@ -697,59 +697,54 @@ local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits
},
configureButton = {
order = 4,
type = "execute",
name = L["Coloring"],
desc = L["This opens the UnitFrames Color settings. These settings affect all unitframes."],
type = "execute",
func = function() ACD:SelectGroup("ElvUI", "unitframe", "generalOptionsGroup", "allColorsGroup", "castBars") end,
func = function() ACD:SelectGroup("ElvUI", "unitframe", "generalOptionsGroup", "allColorsGroup", "castBars") end
},
enable = {
type = "toggle",
order = 5,
name = L["Enable"],
type = "toggle",
name = L["Enable"]
},
width = {
order = 6,
name = L["Width"],
type = "range",
name = L["Width"],
softMax = 600,
min = 50, max = GetScreenWidth(), step = 1,
min = 50, max = GetScreenWidth(), step = 1
},
height = {
order = 7,
name = L["Height"],
type = "range",
min = 10, max = 85, step = 1,
},
latency = {
order = 8,
name = L["Latency"],
type = "toggle",
name = L["Height"],
min = 10, max = 85, step = 1
},
format = {
order = 9,
order = 8,
type = "select",
name = L["Format"],
values = {
["CURRENTMAX"] = L["Current / Max"],
["CURRENT"] = L["Current"],
["REMAINING"] = L["Remaining"],
},
["REMAINING"] = L["Remaining"]
}
},
spark = {
order = 10,
order = 9,
type = "toggle",
name = L["Spark"],
desc = L["Display a spark texture at the end of the castbar statusbar to help show the differance between castbar and backdrop."],
desc = L["Display a spark texture at the end of the castbar statusbar to help show the differance between castbar and backdrop."]
},
insideInfoPanel = {
order = 11,
order = 10,
type = "toggle",
name = L["Inside Information Panel"],
desc = L["Display the castbar inside the information panel, the icon will be displayed outside the main unitframe."],
type = "toggle",
disabled = function() return not E.db.unitframe.units[groupName].infoPanel or not E.db.unitframe.units[groupName].infoPanel.enable end,
disabled = function() return not E.db.unitframe.units[groupName].infoPanel or not E.db.unitframe.units[groupName].infoPanel.enable end
},
iconSettings = {
order = 13,
order = 11,
type = "group",
name = L["Icon"],
guiInline = true,
@@ -758,22 +753,22 @@ local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits
args = {
icon = {
order = 1,
name = L["Enable"],
type = "toggle",
name = L["Enable"]
},
iconAttached = {
order = 2,
name = L["Icon Inside Castbar"],
desc = L["Display the castbar icon inside the castbar."],
type = "toggle",
name = L["Icon Inside Castbar"],
desc = L["Display the castbar icon inside the castbar."]
},
iconSize = {
order = 3,
type = "range",
name = L["Icon Size"],
desc = L["This dictates the size of the icon when it is not attached to the castbar."],
type = "range",
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end,
min = 8, max = 150, step = 1,
min = 8, max = 150, step = 1
},
iconAttachedTo = {
order = 4,
@@ -782,86 +777,38 @@ local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end,
values = {
["Frame"] = L["Frame"],
["Castbar"] = L["Castbar"],
},
["Castbar"] = L["Castbar"]
}
},
iconPosition = {
type = "select",
order = 5,
name = L["Position"],
values = positionValues,
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end,
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end
},
iconXOffset = {
order = 5,
type = "range",
name = L["xOffset"],
min = -300, max = 300, step = 1,
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end,
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end
},
iconYOffset = {
order = 6,
type = "range",
name = L["yOffset"],
min = -300, max = 300, step = 1,
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end,
},
},
},
},
disabled = function() return E.db.unitframe.units[groupName].castbar.iconAttached end
}
}
}
}
}
if hasTicks then
config.args.displayTarget = {
order = 11,
type = "toggle",
name = L["Display Target"],
desc = L["Display the target of your current cast. Useful for mouseover casts."],
}
config.args.ticks = {
order = 12,
type = "group",
guiInline = true,
name = L["Ticks"],
args = {
ticks = {
order = 1,
type = 'toggle',
name = L["Ticks"],
desc = L["Display tick marks on the castbar for channelled spells. This will adjust automatically for spells like Drain Soul and add additional ticks based on haste."],
},
tickColor = {
order = 2,
type = "color",
name = COLOR,
hasAlpha = true,
get = function(info)
local c = E.db.unitframe.units[groupName].castbar.tickColor
local d = P.unitframe.units[groupName].castbar.tickColor
return c.r, c.g, c.b, c.a, d.r, d.g, d.b, d.a
end,
set = function(info, r, g, b, a)
local c = E.db.unitframe.units[groupName].castbar.tickColor
c.r, c.g, c.b, c.a = r, g, b, a
updateFunc(UF, groupName, numUnits)
end,
},
tickWidth = {
order = 3,
type = "range",
name = L["Width"],
min = 1, max = 20, step = 1,
},
},
}
end
return config
end
local function GetOptionsTable_InformationPanel(updateFunc, groupName, numUnits)
local config = {
@@ -1904,7 +1851,7 @@ end
E.Options.args.unitframe = {
type = "group",
name = L["UnitFrames"],
childGroups = "tab",
childGroups = "tree",
get = function(info) return E.db.unitframe[ info[getn(info)] ] end,
set = function(info, value) E.db.unitframe[ info[getn(info)] ] = value end,
args = {
@@ -2734,10 +2681,10 @@ E.Options.args.unitframe.args.player = {
power = GetOptionsTable_Power(true, UF.CreateAndUpdateUF, "player", nil, true),
name = GetOptionsTable_Name(UF.CreateAndUpdateUF, "player"),
portrait = GetOptionsTable_Portrait(UF.CreateAndUpdateUF, "player"),
--buffs = GetOptionsTable_Auras(true, "buffs", false, UF.CreateAndUpdateUF, "player"),
--debuffs = GetOptionsTable_Auras(true, "debuffs", false, UF.CreateAndUpdateUF, "player"),
castbar = GetOptionsTable_Castbar(true, UF.CreateAndUpdateUF, "player"),
--aurabar = GetOptionsTable_AuraBars(true, UF.CreateAndUpdateUF, "player"),
buffs = GetOptionsTable_Auras(true, "buffs", false, UF.CreateAndUpdateUF, "player"),
debuffs = GetOptionsTable_Auras(true, "debuffs", false, UF.CreateAndUpdateUF, "player"),
castbar = GetOptionsTable_Castbar(UF.CreateAndUpdateUF, "player"),
aurabar = GetOptionsTable_AuraBars(true, UF.CreateAndUpdateUF, "player"),
raidicon = GetOptionsTable_RaidIcon(UF.CreateAndUpdateUF, "player"),
classbar = {
order = 1000,
@@ -3097,7 +3044,7 @@ E.Options.args.unitframe.args.target = {
portrait = GetOptionsTable_Portrait(UF.CreateAndUpdateUF, "target"),
--buffs = GetOptionsTable_Auras(false, "buffs", false, UF.CreateAndUpdateUF, "target"),
--debuffs = GetOptionsTable_Auras(false, "debuffs", false, UF.CreateAndUpdateUF, "target"),
castbar = GetOptionsTable_Castbar(false, UF.CreateAndUpdateUF, "target"),
--castbar = GetOptionsTable_Castbar(UF.CreateAndUpdateUF, "target"),
--aurabar = GetOptionsTable_AuraBars(false, UF.CreateAndUpdateUF, "target"),
raidicon = GetOptionsTable_RaidIcon(UF.CreateAndUpdateUF, "target"),
GPSArrow = GetOptionsTableForNonGroup_GPS("target"),
@@ -3647,7 +3594,7 @@ E.Options.args.unitframe.args.pet = {
portrait = GetOptionsTable_Portrait(UF.CreateAndUpdateUF, "pet"),
--buffs = GetOptionsTable_Auras(true, "buffs", false, UF.CreateAndUpdateUF, "pet"),
--debuffs = GetOptionsTable_Auras(true, "debuffs", false, UF.CreateAndUpdateUF, "pet"),
castbar = GetOptionsTable_Castbar(false, UF.CreateAndUpdateUF, "pet"),
--castbar = GetOptionsTable_Castbar(UF.CreateAndUpdateUF, "pet"),
},
}