mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
Merge branch 'dev' into actionbars
This commit is contained in:
@@ -7,7 +7,7 @@ local select = select
|
|||||||
local tonumber = tonumber
|
local tonumber = tonumber
|
||||||
local type = type
|
local type = type
|
||||||
local unpack = unpack
|
local unpack = unpack
|
||||||
local format, gsub, lower, match, upper = string.format, string.gsub, string.lower, string.match, string.upper
|
local find, format, gsub, lower, match, upper = string.find, string.format, string.gsub, string.lower, string.match, string.upper
|
||||||
local getn = table.getn
|
local getn = table.getn
|
||||||
--WoW API
|
--WoW API
|
||||||
local GetItemInfo = GetItemInfo
|
local GetItemInfo = GetItemInfo
|
||||||
@@ -400,3 +400,24 @@ function GetItemInfoByName(itemName)
|
|||||||
|
|
||||||
return GetItemInfo(itemInfoDB[itemName])
|
return GetItemInfo(itemInfoDB[itemName])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GetItemCount(itemName)
|
||||||
|
local count = 0
|
||||||
|
for bag = NUM_BAG_FRAMES, 0, -1 do
|
||||||
|
for slot = 1, GetContainerNumSlots(bag) do
|
||||||
|
local _, itemCount = GetContainerItemInfo(bag, slot)
|
||||||
|
if itemCount then
|
||||||
|
local itemLink = GetContainerItemLink(bag, slot)
|
||||||
|
local _, _, itemParse = find(itemLink, "(%d+):")
|
||||||
|
local queryName, _, _, _, _, _ = GetItemInfo(itemParse)
|
||||||
|
if queryName and queryName ~= "" then
|
||||||
|
if queryName == itemName then
|
||||||
|
count = count + itemCount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return count
|
||||||
|
end
|
||||||
@@ -7,9 +7,10 @@ Dependencies: None
|
|||||||
License: MIT
|
License: MIT
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
local match = string.match
|
||||||
|
|
||||||
local MAJOR_VERSION = "LibBabble-Zone-3.0"
|
local MAJOR_VERSION = "LibBabble-Zone-3.0"
|
||||||
--local MINOR_VERSION = 90000 + tonumber(("$Revision: 107 $"):match("%d+"))
|
local MINOR_VERSION = 90000 + tonumber(match("$Revision: 107 $", "%d+"))
|
||||||
local MINOR_VERSION = 90000 + tonumber(string.match("$Revision: 107 $", "%d+"))
|
|
||||||
|
|
||||||
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
|
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
|
||||||
local lib = LibStub("LibBabble-3.0"):New(MAJOR_VERSION, MINOR_VERSION)
|
local lib = LibStub("LibBabble-3.0"):New(MAJOR_VERSION, MINOR_VERSION)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ local new, del = AceCore.new, AceCore.del
|
|||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local type, pairs, next, error = type, pairs, next, error
|
local type, pairs, next, error = type, pairs, next, error
|
||||||
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget
|
local setmetatable, getmetatable, rawset, rawget = setmetatable, getmetatable, rawset, rawget
|
||||||
|
local format, lower = string.format, string.lower
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local _G = AceCore._G
|
local _G = AceCore._G
|
||||||
@@ -255,7 +256,7 @@ local function validateDefaults(defaults, keyTbl, offset)
|
|||||||
offset = offset or 0
|
offset = offset or 0
|
||||||
for k in pairs(defaults) do
|
for k in pairs(defaults) do
|
||||||
if not keyTbl[k] or k == "profiles" then
|
if not keyTbl[k] or k == "profiles" then
|
||||||
error(("Usage: AceDBObject:RegisterDefaults(defaults): '%s' is not a valid datatype."):format(k), 3 + offset)
|
error(format("Usage: AceDBObject:RegisterDefaults(defaults): '%s' is not a valid datatype.", k), 3 + offset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -275,7 +276,7 @@ local _, raceKey = UnitRace("player")
|
|||||||
local _, factionKey = UnitFactionGroup("player")
|
local _, factionKey = UnitFactionGroup("player")
|
||||||
-- Ace3v: the faction key may error when in GM mode
|
-- Ace3v: the faction key may error when in GM mode
|
||||||
factionKey = factionKey or "Others"
|
factionKey = factionKey or "Others"
|
||||||
local localeKey = string.lower(GetLocale())
|
local localeKey = lower(GetLocale())
|
||||||
|
|
||||||
-- Actual database initialization function
|
-- Actual database initialization function
|
||||||
local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
local function initdb(sv, defaults, defaultProfile, olddb, parent)
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ end
|
|||||||
--
|
--
|
||||||
-- function MyAddOn:TimerFeedback()
|
-- function MyAddOn:TimerFeedback()
|
||||||
-- self.timerCount = self.timerCount + 1
|
-- self.timerCount = self.timerCount + 1
|
||||||
-- print(("%d seconds passed"):format(5 * self.timerCount))
|
-- print(format("%d seconds passed", 5 * self.timerCount))
|
||||||
-- -- run 30 seconds in total
|
-- -- run 30 seconds in total
|
||||||
-- if self.timerCount == 6 then
|
-- if self.timerCount == 6 then
|
||||||
-- self:CancelTimer(self.testTimer)
|
-- self:CancelTimer(self.testTimer)
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
|||||||
|
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||||
|
..\FrameXML\UI.xsd">
|
||||||
|
<Script file="LibItemPrice-1.1.lua"/>
|
||||||
|
</Ui>
|
||||||
@@ -24,6 +24,8 @@ local band = _G.bit.band
|
|||||||
local table_insert = _G.table.insert
|
local table_insert = _G.table.insert
|
||||||
local table_sort = _G.table.sort
|
local table_sort = _G.table.sort
|
||||||
|
|
||||||
|
local find, lower = string.find, string.lower
|
||||||
|
|
||||||
local locale = GetLocale()
|
local locale = GetLocale()
|
||||||
local locale_is_western
|
local locale_is_western
|
||||||
local LOCALE_MASK = 0
|
local LOCALE_MASK = 0
|
||||||
@@ -166,12 +168,12 @@ function lib:Register(mediatype, key, data, langmask)
|
|||||||
if type(key) ~= "string" then
|
if type(key) ~= "string" then
|
||||||
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
|
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
|
||||||
end
|
end
|
||||||
mediatype = string.lower(mediatype)
|
mediatype = lower(mediatype)
|
||||||
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end
|
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end
|
||||||
if mediatype == lib.MediaType.SOUND and type(data) == "string" then
|
if mediatype == lib.MediaType.SOUND and type(data) == "string" then
|
||||||
local path = data
|
local path = data
|
||||||
-- Only wav, ogg and mp3 are valid sounds.
|
-- Only wav, ogg and mp3 are valid sounds.
|
||||||
if not string.find(path, ".ogg", nil, true) and not string.find(path, ".mp3", nil, true) and not string.find(path, ".wav", nil, true) then
|
if not find(path, ".ogg", nil, true) and not find(path, ".mp3", nil, true) and not find(path, ".wav", nil, true) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<Include file="AceComm-3.0\AceComm-3.0.xml"/>
|
<Include file="AceComm-3.0\AceComm-3.0.xml"/>
|
||||||
<Include file="AceSerializer-3.0\AceSerializer-3.0.xml"/>
|
<Include file="AceSerializer-3.0\AceSerializer-3.0.xml"/>
|
||||||
<Include file="AceTimer-3.0\AceTimer-3.0.xml"/>
|
<Include file="AceTimer-3.0\AceTimer-3.0.xml"/>
|
||||||
|
<Include file="LibItemPrice-1.1\LibItemPrice-1.1.xml"/>
|
||||||
<Include file="AceHook-3.0\AceHook-3.0.xml"/>
|
<Include file="AceHook-3.0\AceHook-3.0.xml"/>
|
||||||
<Include file="LibSharedMedia-3.0\LibSharedMedia-3.0.xml"/>
|
<Include file="LibSharedMedia-3.0\LibSharedMedia-3.0.xml"/>
|
||||||
<Include file="LibSimpleSticky\LibSimpleSticky.xml"/>
|
<Include file="LibSimpleSticky\LibSimpleSticky.xml"/>
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
local ns = oUF
|
local ns = oUF
|
||||||
local oUF = ns.oUF
|
local oUF = ns.oUF
|
||||||
|
|
||||||
|
local format, match = string.format, string.match
|
||||||
|
|
||||||
local hiddenParent = CreateFrame("Frame")
|
local hiddenParent = CreateFrame("Frame")
|
||||||
|
|
||||||
-- sourced from FrameXML/PartyMemberFrame.lua
|
-- sourced from FrameXML/PartyMemberFrame.lua
|
||||||
local MAX_PARTY_MEMBERS = MAX_PARTY_MEMBERS or 4
|
local MAX_PARTY_MEMBERS = MAX_PARTY_MEMBERS or 4
|
||||||
|
|
||||||
local hiddenParent = CreateFrame('Frame', nil, UIParent)
|
local hiddenParent = CreateFrame("Frame", nil, UIParent)
|
||||||
hiddenParent:SetAllPoints()
|
hiddenParent:SetAllPoints()
|
||||||
hiddenParent:Hide()
|
hiddenParent:Hide()
|
||||||
|
|
||||||
local function handleFrame(baseName)
|
local function handleFrame(baseName)
|
||||||
local frame
|
local frame
|
||||||
if(type(baseName) == 'string') then
|
if type(baseName) == "string" then
|
||||||
frame = _G[baseName]
|
frame = _G[baseName]
|
||||||
else
|
else
|
||||||
frame = baseName
|
frame = baseName
|
||||||
end
|
end
|
||||||
|
|
||||||
if(frame) then
|
if frame then
|
||||||
frame:UnregisterAllEvents()
|
frame:UnregisterAllEvents()
|
||||||
frame:Hide()
|
frame:Hide()
|
||||||
|
|
||||||
@@ -26,46 +28,46 @@ local function handleFrame(baseName)
|
|||||||
frame:SetParent(hiddenParent)
|
frame:SetParent(hiddenParent)
|
||||||
|
|
||||||
local health = frame.healthBar or frame.healthbar
|
local health = frame.healthBar or frame.healthbar
|
||||||
if(health) then
|
if health then
|
||||||
health:UnregisterAllEvents()
|
health:UnregisterAllEvents()
|
||||||
end
|
end
|
||||||
|
|
||||||
local power = frame.manabar
|
local power = frame.manabar
|
||||||
if(power) then
|
if power then
|
||||||
power:UnregisterAllEvents()
|
power:UnregisterAllEvents()
|
||||||
end
|
end
|
||||||
|
|
||||||
local spell = frame.castBar or frame.spellbar
|
local spell = frame.castBar or frame.spellbar
|
||||||
if(spell) then
|
if spell then
|
||||||
spell:UnregisterAllEvents()
|
spell:UnregisterAllEvents()
|
||||||
end
|
end
|
||||||
|
|
||||||
local buffFrame = frame.BuffFrame
|
local buffFrame = frame.BuffFrame
|
||||||
if(buffFrame) then
|
if buffFrame then
|
||||||
buffFrame:UnregisterAllEvents()
|
buffFrame:UnregisterAllEvents()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function oUF:DisableBlizzard(unit)
|
function oUF:DisableBlizzard(unit)
|
||||||
if(not unit) then return end
|
if not unit then return end
|
||||||
|
|
||||||
if(unit == 'player') then
|
if unit == "player" then
|
||||||
handleFrame(PlayerFrame)
|
handleFrame(PlayerFrame)
|
||||||
elseif(unit == 'pet') then
|
elseif unit == "pet" then
|
||||||
handleFrame(PetFrame)
|
handleFrame(PetFrame)
|
||||||
elseif(unit == 'target') then
|
elseif unit == "target" then
|
||||||
handleFrame(TargetFrame)
|
handleFrame(TargetFrame)
|
||||||
handleFrame(ComboFrame)
|
handleFrame(ComboFrame)
|
||||||
elseif(unit == 'targettarget') then
|
elseif unit == "targettarget" then
|
||||||
handleFrame(TargetofTargetFrame)
|
handleFrame(TargetofTargetFrame)
|
||||||
elseif(unit:match('party%d?$')) then
|
elseif match(unit, "party%d?$") then
|
||||||
local id = unit:match('party(%d)')
|
local id = match(unit, "party(%d)")
|
||||||
if(id) then
|
if id then
|
||||||
handleFrame('PartyMemberFrame' .. id)
|
handleFrame("PartyMemberFrame" .. id)
|
||||||
else
|
else
|
||||||
for i = 1, MAX_PARTY_MEMBERS do
|
for i = 1, MAX_PARTY_MEMBERS do
|
||||||
handleFrame(string.format('PartyMemberFrame%d', i))
|
handleFrame(format("PartyMemberFrame%d", i))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,37 +27,37 @@ A default texture will be applied to the StatusBar and Texture widgets if they d
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
-- Position and size
|
-- Position and size
|
||||||
local Castbar = CreateFrame('StatusBar', nil, self)
|
local Castbar = CreateFrame("StatusBar", nil, self)
|
||||||
Castbar:SetSize(20, 20)
|
Castbar:SetSize(20, 20)
|
||||||
Castbar:SetPoint('TOP')
|
Castbar:SetPoint("TOP")
|
||||||
Castbar:SetPoint('LEFT')
|
Castbar:SetPoint("LEFT")
|
||||||
Castbar:SetPoint('RIGHT')
|
Castbar:SetPoint("RIGHT")
|
||||||
|
|
||||||
-- Add a background
|
-- Add a background
|
||||||
local Background = Castbar:CreateTexture(nil, 'BACKGROUND')
|
local Background = Castbar:CreateTexture(nil, "BACKGROUND")
|
||||||
Background:SetAllPoints(Castbar)
|
Background:SetAllPoints(Castbar)
|
||||||
Background:SetTexture(1, 1, 1, .5)
|
Background:SetTexture(1, 1, 1, .5)
|
||||||
|
|
||||||
-- Add a spark
|
-- Add a spark
|
||||||
local Spark = Castbar:CreateTexture(nil, 'OVERLAY')
|
local Spark = Castbar:CreateTexture(nil, "OVERLAY")
|
||||||
Spark:SetSize(20, 20)
|
Spark:SetSize(20, 20)
|
||||||
Spark:SetBlendMode('ADD')
|
Spark:SetBlendMode("ADD")
|
||||||
|
|
||||||
-- Add a timer
|
-- Add a timer
|
||||||
local Time = Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall')
|
local Time = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
|
||||||
Time:SetPoint('RIGHT', Castbar)
|
Time:SetPoint("RIGHT", Castbar)
|
||||||
|
|
||||||
-- Add spell text
|
-- Add spell text
|
||||||
local Text = Castbar:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall')
|
local Text = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
|
||||||
Text:SetPoint('LEFT', Castbar)
|
Text:SetPoint("LEFT", Castbar)
|
||||||
|
|
||||||
-- Add spell icon
|
-- Add spell icon
|
||||||
local Icon = Castbar:CreateTexture(nil, 'OVERLAY')
|
local Icon = Castbar:CreateTexture(nil, "OVERLAY")
|
||||||
Icon:SetSize(20, 20)
|
Icon:SetSize(20, 20)
|
||||||
Icon:SetPoint('TOPLEFT', Castbar, 'TOPLEFT')
|
Icon:SetPoint("TOPLEFT", Castbar, "TOPLEFT")
|
||||||
|
|
||||||
-- Add safezone
|
-- Add safezone
|
||||||
local SafeZone = Castbar:CreateTexture(nil, 'OVERLAY')
|
local SafeZone = Castbar:CreateTexture(nil, "OVERLAY")
|
||||||
|
|
||||||
-- Register it with oUF
|
-- Register it with oUF
|
||||||
Castbar.bg = Background
|
Castbar.bg = Background
|
||||||
@@ -71,6 +71,8 @@ A default texture will be applied to the StatusBar and Texture widgets if they d
|
|||||||
local ns = oUF
|
local ns = oUF
|
||||||
local oUF = ns.oUF
|
local oUF = ns.oUF
|
||||||
|
|
||||||
|
local match = string.match
|
||||||
|
|
||||||
local GetNetStats = GetNetStats
|
local GetNetStats = GetNetStats
|
||||||
local GetTime = GetTime
|
local GetTime = GetTime
|
||||||
local UnitCastingInfo = UnitCastingInfo
|
local UnitCastingInfo = UnitCastingInfo
|
||||||
@@ -99,7 +101,7 @@ end
|
|||||||
|
|
||||||
local function UNIT_SPELLCAST_SENT(self, event, unit, spell, rank, target)
|
local function UNIT_SPELLCAST_SENT(self, event, unit, spell, rank, target)
|
||||||
local element = self.Castbar
|
local element = self.Castbar
|
||||||
element.curTarget = (target and target ~= '') and target or nil
|
element.curTarget = (target and target ~= "") and target or nil
|
||||||
|
|
||||||
if element.isTradeSkill then
|
if element.isTradeSkill then
|
||||||
element.tradeSkillCastName = spell
|
element.tradeSkillCastName = spell
|
||||||
@@ -127,11 +129,11 @@ local function UNIT_SPELLCAST_START(self, event, unit)
|
|||||||
element.holdTime = 0
|
element.holdTime = 0
|
||||||
element.isTradeSkill = isTradeSkill
|
element.isTradeSkill = isTradeSkill
|
||||||
|
|
||||||
if(mergeTradeskill and isTradeSkill and UnitIsUnit(unit, 'player')) then
|
if(mergeTradeskill and isTradeSkill and UnitIsUnit(unit, "player")) then
|
||||||
element.duration = element.duration + (element.max * tradeskillCurrent)
|
element.duration = element.duration + (element.max * tradeskillCurrent)
|
||||||
element.max = max * tradeskillTotal
|
element.max = max * tradeskillTotal
|
||||||
|
|
||||||
if(unit == 'player') then
|
if(unit == "player") then
|
||||||
tradeskillCurrent = tradeskillCurrent + 1
|
tradeskillCurrent = tradeskillCurrent + 1
|
||||||
tradeskillCastDuration = element.duration
|
tradeskillCastDuration = element.duration
|
||||||
tradeskillCastTime = max
|
tradeskillCastTime = max
|
||||||
@@ -150,9 +152,9 @@ local function UNIT_SPELLCAST_START(self, event, unit)
|
|||||||
local sf = element.SafeZone
|
local sf = element.SafeZone
|
||||||
if(sf) then
|
if(sf) then
|
||||||
sf:ClearAllPoints()
|
sf:ClearAllPoints()
|
||||||
sf:SetPoint('RIGHT')
|
sf:SetPoint("RIGHT")
|
||||||
sf:SetPoint('TOP')
|
sf:SetPoint("TOP")
|
||||||
sf:SetPoint('BOTTOM')
|
sf:SetPoint("BOTTOM")
|
||||||
updateSafeZone(element)
|
updateSafeZone(element)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -178,7 +180,7 @@ local function UNIT_SPELLCAST_FAILED(self, event, unit, spellname)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(mergeTradeskill and UnitIsUnit(unit, 'player')) then
|
if(mergeTradeskill and UnitIsUnit(unit, "player")) then
|
||||||
mergeTradeskill = false
|
mergeTradeskill = false
|
||||||
element.tradeSkillCastName = nil
|
element.tradeSkillCastName = nil
|
||||||
end
|
end
|
||||||
@@ -212,7 +214,7 @@ local function UNIT_SPELLCAST_FAILED_QUIET(self, event, unit, spellname)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(mergeTradeskill and UnitIsUnit(unit, 'player')) then
|
if(mergeTradeskill and UnitIsUnit(unit, "player")) then
|
||||||
mergeTradeskill = false
|
mergeTradeskill = false
|
||||||
element.tradeSkillCastName = nil
|
element.tradeSkillCastName = nil
|
||||||
end
|
end
|
||||||
@@ -286,7 +288,7 @@ local function UNIT_SPELLCAST_STOP(self, event, unit, spellname)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if(mergeTradeskill and UnitIsUnit(unit, 'player')) then
|
if(mergeTradeskill and UnitIsUnit(unit, "player")) then
|
||||||
if(tradeskillCurrent == tradeskillTotal) then
|
if(tradeskillCurrent == tradeskillTotal) then
|
||||||
mergeTradeskill = false
|
mergeTradeskill = false
|
||||||
end
|
end
|
||||||
@@ -345,9 +347,9 @@ local function UNIT_SPELLCAST_CHANNEL_START(self, event, unit)
|
|||||||
local sf = element.SafeZone
|
local sf = element.SafeZone
|
||||||
if(sf) then
|
if(sf) then
|
||||||
sf:ClearAllPoints()
|
sf:ClearAllPoints()
|
||||||
sf:SetPoint('LEFT')
|
sf:SetPoint("LEFT")
|
||||||
sf:SetPoint('TOP')
|
sf:SetPoint("TOP")
|
||||||
sf:SetPoint('BOTTOM')
|
sf:SetPoint("BOTTOM")
|
||||||
updateSafeZone(element)
|
updateSafeZone(element)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -432,13 +434,13 @@ local function onUpdate(self, elapsed)
|
|||||||
if(self.CustomDelayText) then
|
if(self.CustomDelayText) then
|
||||||
self:CustomDelayText(duration)
|
self:CustomDelayText(duration)
|
||||||
else
|
else
|
||||||
self.Time:SetText(format('%.1f|cffff0000-%.1f|r', duration, self.delay))
|
self.Time:SetText(format("%.1f|cffff0000-%.1f|r", duration, self.delay))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(self.CustomTimeText) then
|
if(self.CustomTimeText) then
|
||||||
self:CustomTimeText(duration)
|
self:CustomTimeText(duration)
|
||||||
else
|
else
|
||||||
self.Time:SetText(format('%.1f', duration))
|
self.Time:SetText(format("%.1f", duration))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -447,7 +449,7 @@ local function onUpdate(self, elapsed)
|
|||||||
self:SetValue(duration)
|
self:SetValue(duration)
|
||||||
|
|
||||||
if(self.Spark) then
|
if(self.Spark) then
|
||||||
self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
|
self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0)
|
||||||
end
|
end
|
||||||
elseif(self.channeling) then
|
elseif(self.channeling) then
|
||||||
local duration = self.duration - elapsed
|
local duration = self.duration - elapsed
|
||||||
@@ -465,13 +467,13 @@ local function onUpdate(self, elapsed)
|
|||||||
if(self.CustomDelayText) then
|
if(self.CustomDelayText) then
|
||||||
self:CustomDelayText(duration)
|
self:CustomDelayText(duration)
|
||||||
else
|
else
|
||||||
self.Time:SetText(format('%.1f|cffff0000-%.1f|r', duration, self.delay))
|
self.Time:SetText(format("%.1f|cffff0000-%.1f|r", duration, self.delay))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(self.CustomTimeText) then
|
if(self.CustomTimeText) then
|
||||||
self:CustomTimeText(duration)
|
self:CustomTimeText(duration)
|
||||||
else
|
else
|
||||||
self.Time:SetText(format('%.1f', duration))
|
self.Time:SetText(format("%.1f", duration))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -479,7 +481,7 @@ local function onUpdate(self, elapsed)
|
|||||||
self.duration = duration
|
self.duration = duration
|
||||||
self:SetValue(duration)
|
self:SetValue(duration)
|
||||||
if(self.Spark) then
|
if(self.Spark) then
|
||||||
self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
|
self.Spark:SetPoint("CENTER", self, "LEFT", (duration / self.max) * self:GetWidth(), 0)
|
||||||
end
|
end
|
||||||
elseif(self.holdTime > 0) then
|
elseif(self.holdTime > 0) then
|
||||||
self.holdTime = self.holdTime - elapsed
|
self.holdTime = self.holdTime - elapsed
|
||||||
@@ -499,7 +501,7 @@ local function Update(self, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function ForceUpdate(element)
|
local function ForceUpdate(element)
|
||||||
return Update(element.__owner, 'ForceUpdate', element.__owner.unit)
|
return Update(element.__owner, "ForceUpdate", element.__owner.unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Enable(self, unit)
|
local function Enable(self, unit)
|
||||||
@@ -508,23 +510,23 @@ local function Enable(self, unit)
|
|||||||
element.__owner = self
|
element.__owner = self
|
||||||
element.ForceUpdate = ForceUpdate
|
element.ForceUpdate = ForceUpdate
|
||||||
|
|
||||||
if(not (unit and unit:match('%wtarget$'))) then
|
if(not (unit and match(unit, "%wtarget$"))) then
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_START', UNIT_SPELLCAST_START)
|
self:RegisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_FAILED', UNIT_SPELLCAST_FAILED)
|
self:RegisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_STOP', UNIT_SPELLCAST_STOP)
|
self:RegisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_INTERRUPTED', UNIT_SPELLCAST_INTERRUPTED)
|
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_DELAYED', UNIT_SPELLCAST_DELAYED)
|
self:RegisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_START', UNIT_SPELLCAST_CHANNEL_START)
|
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_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_STOP', UNIT_SPELLCAST_CHANNEL_STOP)
|
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_SENT', UNIT_SPELLCAST_SENT, true)
|
self:RegisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT, true)
|
||||||
self:RegisterEvent('UNIT_SPELLCAST_FAILED_QUIET', UNIT_SPELLCAST_FAILED_QUIET)
|
self:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET", UNIT_SPELLCAST_FAILED_QUIET)
|
||||||
end
|
end
|
||||||
|
|
||||||
element.holdTime = 0
|
element.holdTime = 0
|
||||||
element:SetScript('OnUpdate', element.OnUpdate or onUpdate)
|
element:SetScript("OnUpdate", element.OnUpdate or onUpdate)
|
||||||
|
|
||||||
if(self.unit == 'player') then
|
if(self.unit == "player") then
|
||||||
CastingBarFrame:UnregisterAllEvents()
|
CastingBarFrame:UnregisterAllEvents()
|
||||||
CastingBarFrame.Show = CastingBarFrame.Hide
|
CastingBarFrame.Show = CastingBarFrame.Hide
|
||||||
CastingBarFrame:Hide()
|
CastingBarFrame:Hide()
|
||||||
@@ -534,17 +536,17 @@ local function Enable(self, unit)
|
|||||||
PetCastingBarFrame:Hide()
|
PetCastingBarFrame:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
if(element:IsObjectType('StatusBar') and not element:GetStatusBarTexture()) then
|
if(element:IsObjectType("StatusBar") and not element:GetStatusBarTexture()) then
|
||||||
element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||||
end
|
end
|
||||||
|
|
||||||
local spark = element.Spark
|
local spark = element.Spark
|
||||||
if(spark and spark:IsObjectType('Texture') and not spark:GetTexture()) then
|
if(spark and spark:IsObjectType("Texture") and not spark:GetTexture()) then
|
||||||
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
|
spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
|
||||||
end
|
end
|
||||||
|
|
||||||
local safeZone = element.SafeZone
|
local safeZone = element.SafeZone
|
||||||
if(safeZone and safeZone:IsObjectType('Texture') and not safeZone:GetTexture()) then
|
if(safeZone and safeZone:IsObjectType("Texture") and not safeZone:GetTexture()) then
|
||||||
safeZone:SetTexture(1, 0, 0)
|
safeZone:SetTexture(1, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -559,22 +561,22 @@ local function Disable(self)
|
|||||||
if(element) then
|
if(element) then
|
||||||
element:Hide()
|
element:Hide()
|
||||||
|
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_START', UNIT_SPELLCAST_START)
|
self:UnregisterEvent("UNIT_SPELLCAST_START", UNIT_SPELLCAST_START)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_FAILED', UNIT_SPELLCAST_FAILED)
|
self:UnregisterEvent("UNIT_SPELLCAST_FAILED", UNIT_SPELLCAST_FAILED)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_STOP', UNIT_SPELLCAST_STOP)
|
self:UnregisterEvent("UNIT_SPELLCAST_STOP", UNIT_SPELLCAST_STOP)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_INTERRUPTED', UNIT_SPELLCAST_INTERRUPTED)
|
self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED", UNIT_SPELLCAST_INTERRUPTED)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_DELAYED', UNIT_SPELLCAST_DELAYED)
|
self:UnregisterEvent("UNIT_SPELLCAST_DELAYED", UNIT_SPELLCAST_DELAYED)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_START', UNIT_SPELLCAST_CHANNEL_START)
|
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_UPDATE", UNIT_SPELLCAST_CHANNEL_UPDATE)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_CHANNEL_STOP', UNIT_SPELLCAST_CHANNEL_STOP)
|
self:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", UNIT_SPELLCAST_CHANNEL_STOP)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_SENT', UNIT_SPELLCAST_SENT)
|
self:UnregisterEvent("UNIT_SPELLCAST_SENT", UNIT_SPELLCAST_SENT)
|
||||||
self:UnregisterEvent('UNIT_SPELLCAST_FAILED_QUIET', UNIT_SPELLCAST_FAILED_QUIET)
|
self:UnregisterEvent("UNIT_SPELLCAST_FAILED_QUIET", UNIT_SPELLCAST_FAILED_QUIET)
|
||||||
|
|
||||||
element:SetScript('OnUpdate', nil)
|
element:SetScript("OnUpdate", nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hooksecurefunc('DoTradeSkill', function(_, num)
|
hooksecurefunc("DoTradeSkill", function(_, num)
|
||||||
tradeskillCastTime = 0
|
tradeskillCastTime = 0
|
||||||
tradeskillCastDuration = 0
|
tradeskillCastDuration = 0
|
||||||
tradeskillCurrent = 0
|
tradeskillCurrent = 0
|
||||||
@@ -582,4 +584,4 @@ hooksecurefunc('DoTradeSkill', function(_, num)
|
|||||||
mergeTradeskill = true
|
mergeTradeskill = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
oUF:AddElement('Castbar', Update, Enable, Disable)
|
oUF:AddElement("Castbar", Update, Enable, Disable)
|
||||||
@@ -17,20 +17,20 @@ Default textures will be applied if the layout does not provide custom ones. See
|
|||||||
.finishedTime - For how many seconds the icon should stick after a check has completed. Defaults to 10 (number).
|
.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
|
.fadeTime - For how many seconds the icon should fade away after the stick duration has completed. Defaults to
|
||||||
1.5 (number).
|
1.5 (number).
|
||||||
.readyTexture - Path to an alternate texture for the ready check 'ready' status.
|
.readyTexture - Path to an alternate texture for the ready check "ready" status.
|
||||||
.notReadyTexture - Path to an alternate texture for the ready check 'notready' 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.
|
.waitingTexture - Path to an alternate texture for the ready check "waiting" status.
|
||||||
|
|
||||||
## Attributes
|
## Attributes
|
||||||
|
|
||||||
.status - the unit's ready check status (string?)['ready', 'noready', 'waiting']
|
.status - the unit"s ready check status (string?)["ready", "noready", "waiting"]
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
-- Position and size
|
-- Position and size
|
||||||
local ReadyCheckIndicator = self:CreateTexture(nil, 'OVERLAY')
|
local ReadyCheckIndicator = self:CreateTexture(nil, "OVERLAY")
|
||||||
ReadyCheckIndicator:SetSize(16, 16)
|
ReadyCheckIndicator:SetSize(16, 16)
|
||||||
ReadyCheckIndicator:SetPoint('TOP')
|
ReadyCheckIndicator:SetPoint("TOP")
|
||||||
|
|
||||||
-- Register with oUF
|
-- Register with oUF
|
||||||
self.ReadyCheckIndicator = ReadyCheckIndicator
|
self.ReadyCheckIndicator = ReadyCheckIndicator
|
||||||
@@ -39,6 +39,8 @@ Default textures will be applied if the layout does not provide custom ones. See
|
|||||||
local ns = oUF
|
local ns = oUF
|
||||||
local oUF = ns.oUF
|
local oUF = ns.oUF
|
||||||
|
|
||||||
|
local sub = string.sub
|
||||||
|
|
||||||
local GetReadyCheckStatus = GetReadyCheckStatus
|
local GetReadyCheckStatus = GetReadyCheckStatus
|
||||||
local UnitExists = UnitExists
|
local UnitExists = UnitExists
|
||||||
|
|
||||||
@@ -71,9 +73,9 @@ local function Update(self, event)
|
|||||||
local unit = self.unit
|
local unit = self.unit
|
||||||
local status = GetReadyCheckStatus(unit)
|
local status = GetReadyCheckStatus(unit)
|
||||||
if(UnitExists(unit) and status) then
|
if(UnitExists(unit) and status) then
|
||||||
if(status == 'ready') then
|
if(status == "ready") then
|
||||||
element:SetTexture(element.readyTexture)
|
element:SetTexture(element.readyTexture)
|
||||||
elseif(status == 'notready') then
|
elseif(status == "notready") then
|
||||||
element:SetTexture(element.notReadyTexture)
|
element:SetTexture(element.notReadyTexture)
|
||||||
else
|
else
|
||||||
element:SetTexture(element.waitingTexture)
|
element:SetTexture(element.waitingTexture)
|
||||||
@@ -81,13 +83,13 @@ local function Update(self, event)
|
|||||||
|
|
||||||
element.status = status
|
element.status = status
|
||||||
element:Show()
|
element:Show()
|
||||||
elseif(event ~= 'READY_CHECK_FINISHED') then
|
elseif(event ~= "READY_CHECK_FINISHED") then
|
||||||
element.status = nil
|
element.status = nil
|
||||||
element:Hide()
|
element:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
if(event == 'READY_CHECK_FINISHED') then
|
if(event == "READY_CHECK_FINISHED") then
|
||||||
if(element.status == 'waiting') then
|
if(element.status == "waiting") then
|
||||||
element:SetTexture(element.notReadyTexture)
|
element:SetTexture(element.notReadyTexture)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -96,7 +98,7 @@ local function Update(self, event)
|
|||||||
Called after the element has been updated.
|
Called after the element has been updated.
|
||||||
|
|
||||||
* self - the ReadyCheckIndicator element
|
* self - the ReadyCheckIndicator element
|
||||||
* status - the unit's ready check status (string?)['ready', 'notready', 'waiting']
|
* status - the unit"s ready check status (string?)["ready", "notready", "waiting"]
|
||||||
--]]
|
--]]
|
||||||
if(element.PostUpdate) then
|
if(element.PostUpdate) then
|
||||||
return element:PostUpdate(status)
|
return element:PostUpdate(status)
|
||||||
@@ -115,12 +117,12 @@ local function Path(self, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function ForceUpdate(element)
|
local function ForceUpdate(element)
|
||||||
return Path(element.__owner, 'ForceUpdate')
|
return Path(element.__owner, "ForceUpdate")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Enable(self, unit)
|
local function Enable(self, unit)
|
||||||
local element = self.ReadyCheckIndicator
|
local element = self.ReadyCheckIndicator
|
||||||
if(element and (unit and (unit:sub(1, 5) == 'party' or unit:sub(1, 4) == 'raid'))) then
|
if(element and (unit and (sub(unit, 1, 5) == "party" or sub(unit, 1, 4) == "raid"))) then
|
||||||
element.__owner = self
|
element.__owner = self
|
||||||
element.ForceUpdate = ForceUpdate
|
element.ForceUpdate = ForceUpdate
|
||||||
|
|
||||||
@@ -128,9 +130,9 @@ local function Enable(self, unit)
|
|||||||
element.notReadyTexture = element.notReadyTexture or READY_CHECK_NOT_READY_TEXTURE
|
element.notReadyTexture = element.notReadyTexture or READY_CHECK_NOT_READY_TEXTURE
|
||||||
element.waitingTexture = element.waitingTexture or READY_CHECK_WAITING_TEXTURE
|
element.waitingTexture = element.waitingTexture or READY_CHECK_WAITING_TEXTURE
|
||||||
|
|
||||||
self:RegisterEvent('READY_CHECK', Path, true)
|
self:RegisterEvent("READY_CHECK", Path, true)
|
||||||
self:RegisterEvent('READY_CHECK_CONFIRM', Path, true)
|
self:RegisterEvent("READY_CHECK_CONFIRM", Path, true)
|
||||||
self:RegisterEvent('READY_CHECK_FINISHED', Path, true)
|
self:RegisterEvent("READY_CHECK_FINISHED", Path, true)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -141,10 +143,10 @@ local function Disable(self)
|
|||||||
if(element) then
|
if(element) then
|
||||||
element:Hide()
|
element:Hide()
|
||||||
|
|
||||||
self:UnregisterEvent('READY_CHECK', Path)
|
self:UnregisterEvent("READY_CHECK", Path)
|
||||||
self:UnregisterEvent('READY_CHECK_CONFIRM', Path)
|
self:UnregisterEvent("READY_CHECK_CONFIRM", Path)
|
||||||
self:UnregisterEvent('READY_CHECK_FINISHED', Path)
|
self:UnregisterEvent("READY_CHECK_FINISHED", Path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
oUF:AddElement('ReadyCheckIndicator', Path, Enable, Disable)
|
oUF:AddElement("ReadyCheckIndicator", Path, Enable, Disable)
|
||||||
+118
-115
@@ -8,6 +8,9 @@ local argcheck = Private.argcheck
|
|||||||
local print = Private.print
|
local print = Private.print
|
||||||
local error = Private.error
|
local error = Private.error
|
||||||
|
|
||||||
|
local gsub, lower, match, split, upper = string.gsub, string.lower, string.match, string.split, string.upper
|
||||||
|
local insert, remove = table.insert, table.remove
|
||||||
|
|
||||||
local styles, style = {}
|
local styles, style = {}
|
||||||
local callback, units, objects, headers = {}, {}, {}, {}
|
local callback, units, objects, headers = {}, {}, {}, {}
|
||||||
|
|
||||||
@@ -20,11 +23,11 @@ local function enableTargetUpdate(object)
|
|||||||
object.__eventless = true
|
object.__eventless = true
|
||||||
|
|
||||||
local total = 0
|
local total = 0
|
||||||
object:SetScript('OnUpdate', function()
|
object:SetScript("OnUpdate", function()
|
||||||
if not this.unit then
|
if not this.unit then
|
||||||
return
|
return
|
||||||
elseif total > this.onUpdateFrequency then
|
elseif total > this.onUpdateFrequency then
|
||||||
this:UpdateAllElements('OnUpdate')
|
this:UpdateAllElements("OnUpdate")
|
||||||
total = 0
|
total = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,23 +41,23 @@ local function updateActiveUnit(self, event, unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function iterateChildren(...)
|
local function iterateChildren(...)
|
||||||
for i = 1, table.getn(arg) do
|
for i = 1, getn(arg) do
|
||||||
local obj = arg[i]
|
local obj = arg[i]
|
||||||
|
|
||||||
if(type(obj) == 'table' and obj.isChild) then
|
if(type(obj) == "table" and obj.isChild) then
|
||||||
updateActiveUnit(obj, 'iterateChildren')
|
updateActiveUnit(obj, "iterateChildren")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onAttributeChanged(self, name, value)
|
local function onAttributeChanged(self, name, value)
|
||||||
if(name == 'unit' and value) then
|
if(name == "unit" and value) then
|
||||||
if(self.hasChildren) then
|
if(self.hasChildren) then
|
||||||
iterateChildren(self:GetChildren())
|
iterateChildren(self:GetChildren())
|
||||||
end
|
end
|
||||||
|
|
||||||
if(not self.onlyProcessChildren) then
|
if(not self.onlyProcessChildren) then
|
||||||
updateActiveUnit(self, 'OnAttributeChanged')
|
updateActiveUnit(self, "OnAttributeChanged")
|
||||||
end
|
end
|
||||||
--[[
|
--[[
|
||||||
if(self.unit and self.unit == value) then
|
if(self.unit and self.unit == value) then
|
||||||
@@ -69,7 +72,7 @@ local function onAttributeChanged(self, name, value)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local frame_metatable = {
|
local frame_metatable = {
|
||||||
__index = CreateFrame('Button')
|
__index = CreateFrame("Button")
|
||||||
}
|
}
|
||||||
Private.frame_metatable = frame_metatable
|
Private.frame_metatable = frame_metatable
|
||||||
|
|
||||||
@@ -81,7 +84,7 @@ for k, v in next, {
|
|||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
|
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
|
||||||
if(element.update) then
|
if(element.update) then
|
||||||
element.update(self, 'OnShow', unit)
|
element.update(self, "OnShow", unit)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -92,7 +95,7 @@ for k, v in next, {
|
|||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
|
if(not element or not self:IsElementEnabled(name) or not activeElements[self]) then return end
|
||||||
if(element.update) then
|
if(element.update) then
|
||||||
element.update(self, 'OnShow', unit)
|
element.update(self, "OnShow", unit)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -101,14 +104,14 @@ for k, v in next, {
|
|||||||
|
|
||||||
* self - unit frame for which the element should be enabled
|
* self - unit frame for which the element should be enabled
|
||||||
* name - name of the element to be enabled (string)
|
* name - name of the element to be enabled (string)
|
||||||
* unit - unit to be passed to the element's Enable function. Defaults to the frame's unit (string?)
|
* unit - unit to be passed to the element"s Enable function. Defaults to the frame"s unit (string?)
|
||||||
--]]
|
--]]
|
||||||
EnableElement = function(self, name, unit)
|
EnableElement = function(self, name, unit)
|
||||||
local unit = unit or self.unit
|
local unit = unit or self.unit
|
||||||
if not unit then return end
|
if not unit then return end
|
||||||
|
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
argcheck(unit or self.unit, 3, 'string', 'nil')
|
argcheck(unit or self.unit, 3, "string", "nil")
|
||||||
|
|
||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if(not element or self:IsElementEnabled(name) or not activeElements[self]) then return end
|
if(not element or self:IsElementEnabled(name) or not activeElements[self]) then return end
|
||||||
@@ -117,7 +120,7 @@ for k, v in next, {
|
|||||||
activeElements[self][name] = true
|
activeElements[self][name] = true
|
||||||
|
|
||||||
if(element.update) then
|
if(element.update) then
|
||||||
table.insert(self.__elements, element.update)
|
insert(self.__elements, element.update)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -129,7 +132,7 @@ for k, v in next, {
|
|||||||
* name - name of the element to be disabled (string)
|
* name - name of the element to be disabled (string)
|
||||||
--]]
|
--]]
|
||||||
DisableElement = function(self, name)
|
DisableElement = function(self, name)
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
|
|
||||||
local enabled = self:IsElementEnabled(name)
|
local enabled = self:IsElementEnabled(name)
|
||||||
if(not enabled) then return end
|
if(not enabled) then return end
|
||||||
@@ -137,7 +140,7 @@ for k, v in next, {
|
|||||||
local update = elements[name].update
|
local update = elements[name].update
|
||||||
for k, func in next, self.__elements do
|
for k, func in next, self.__elements do
|
||||||
if(func == update) then
|
if(func == update) then
|
||||||
table.remove(self.__elements, k)
|
remove(self.__elements, k)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -148,7 +151,7 @@ for k, v in next, {
|
|||||||
-- The main reason we do this is to make sure the full update is completed
|
-- The main reason we do this is to make sure the full update is completed
|
||||||
-- if an element for some reason removes itself _during_ the update
|
-- if an element for some reason removes itself _during_ the update
|
||||||
-- progress.
|
-- progress.
|
||||||
self:UpdateAllElements('DisableElement')
|
self:UpdateAllElements("DisableElement")
|
||||||
|
|
||||||
return elements[name].disable(self)
|
return elements[name].disable(self)
|
||||||
end,
|
end,
|
||||||
@@ -160,7 +163,7 @@ for k, v in next, {
|
|||||||
* name - name of the element (string)
|
* name - name of the element (string)
|
||||||
--]]
|
--]]
|
||||||
IsElementEnabled = function(self, name)
|
IsElementEnabled = function(self, name)
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
|
|
||||||
local element = elements[name]
|
local element = elements[name]
|
||||||
if(not element) then return end
|
if(not element) then return end
|
||||||
@@ -174,7 +177,7 @@ for k, v in next, {
|
|||||||
`RegisterUnitWatch`.
|
`RegisterUnitWatch`.
|
||||||
|
|
||||||
* self - unit frame
|
* self - unit frame
|
||||||
* asState - if true, the frame's "state-unitexists" attribute will be set to a boolean value denoting whether the
|
* asState - if true, the frame"s "state-unitexists" attribute will be set to a boolean value denoting whether the
|
||||||
unit exists; if false, the frame will be shown if its unit exists, and hidden if it does not (boolean)
|
unit exists; if false, the frame will be shown if its unit exists, and hidden if it does not (boolean)
|
||||||
--]]
|
--]]
|
||||||
Enable = RegisterUnitWatch,
|
Enable = RegisterUnitWatch,
|
||||||
@@ -192,13 +195,13 @@ for k, v in next, {
|
|||||||
Used to update all enabled elements on the given frame.
|
Used to update all enabled elements on the given frame.
|
||||||
|
|
||||||
* self - unit frame
|
* self - unit frame
|
||||||
* event - event name to pass to the elements' update functions (string)
|
* event - event name to pass to the elements" update functions (string)
|
||||||
--]]
|
--]]
|
||||||
UpdateAllElements = function(self, event)
|
UpdateAllElements = function(self, event)
|
||||||
local unit = self.unit
|
local unit = self.unit
|
||||||
if(not UnitExists(unit)) then return end
|
if(not UnitExists(unit)) then return end
|
||||||
|
|
||||||
assert(type(event) == 'string', "Invalid argument 'event' in UpdateAllElements.")
|
assert(type(event) == "string", "Invalid argument 'event' in UpdateAllElements.")
|
||||||
|
|
||||||
if(self.PreUpdate) then
|
if(self.PreUpdate) then
|
||||||
self:PreUpdate(event)
|
self:PreUpdate(event)
|
||||||
@@ -227,23 +230,23 @@ local function InitializeSecureMenu()
|
|||||||
local unit = SecureTemplatesDropdown.unit
|
local unit = SecureTemplatesDropdown.unit
|
||||||
if(not unit) then return end
|
if(not unit) then return end
|
||||||
|
|
||||||
local unitType = string.match(unit, '^([a-z]+)[0-9]+$') or unit
|
local unitType = match(unit, "^([a-z]+)[0-9]+$") or unit
|
||||||
|
|
||||||
local menu
|
local menu
|
||||||
if(unitType == 'party') then
|
if(unitType == "party") then
|
||||||
menu = 'PARTY'
|
menu = "PARTY"
|
||||||
elseif(UnitIsUnit(unit, 'player')) then
|
elseif(UnitIsUnit(unit, "player")) then
|
||||||
menu = 'SELF'
|
menu = "SELF"
|
||||||
elseif(UnitIsUnit(unit, 'pet')) then
|
elseif(UnitIsUnit(unit, "pet")) then
|
||||||
menu = 'PET'
|
menu = "PET"
|
||||||
elseif(UnitIsPlayer(unit)) then
|
elseif(UnitIsPlayer(unit)) then
|
||||||
if(UnitInRaid(unit) or UnitInParty(unit)) then
|
if(UnitInRaid(unit) or UnitInParty(unit)) then
|
||||||
menu = 'PARTY'
|
menu = "PARTY"
|
||||||
else
|
else
|
||||||
menu = 'PLAYER'
|
menu = "PLAYER"
|
||||||
end
|
end
|
||||||
elseif(UnitIsUnit(unit, 'target')) then
|
elseif(UnitIsUnit(unit, "target")) then
|
||||||
menu = 'RAID_TARGET_ICON'
|
menu = "RAID_TARGET_ICON"
|
||||||
end
|
end
|
||||||
|
|
||||||
if(menu) then
|
if(menu) then
|
||||||
@@ -253,33 +256,33 @@ end
|
|||||||
|
|
||||||
local function togglemenu(self, unit)
|
local function togglemenu(self, unit)
|
||||||
if(not secureDropdown) then
|
if(not secureDropdown) then
|
||||||
secureDropdown = CreateFrame('Frame', 'SecureTemplatesDropdown', nil, 'UIDropDownMenuTemplate')
|
secureDropdown = CreateFrame("Frame", "SecureTemplatesDropdown", nil, "UIDropDownMenuTemplate")
|
||||||
secureDropdown:SetID(1)
|
secureDropdown:SetID(1)
|
||||||
|
|
||||||
table.insert(UnitPopupFrames, secureDropdown:GetName())
|
insert(UnitPopupFrames, secureDropdown:GetName())
|
||||||
UIDropDownMenu_Initialize(secureDropdown, InitializeSecureMenu, 'MENU')
|
UIDropDownMenu_Initialize(secureDropdown, InitializeSecureMenu, "MENU")
|
||||||
end
|
end
|
||||||
|
|
||||||
if(secureDropdown.openedFor and secureDropdown.openedFor ~= self) then
|
if(secureDropdown.openedFor and secureDropdown.openedFor ~= self) then
|
||||||
CloseDropDownMenus()
|
CloseDropDownMenus()
|
||||||
end
|
end
|
||||||
|
|
||||||
secureDropdown.unit = string.lower(unit)
|
secureDropdown.unit = lower(unit)
|
||||||
secureDropdown.openedFor = self
|
secureDropdown.openedFor = self
|
||||||
|
|
||||||
ToggleDropDownMenu(1, nil, secureDropdown, 'cursor')
|
ToggleDropDownMenu(1, nil, secureDropdown, "cursor")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onShow()
|
local function onShow()
|
||||||
return this:UpdateAllElements('OnShow')
|
return this:UpdateAllElements("OnShow")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function initObject(unit, style, styleFunc, header, ...)
|
local function initObject(unit, style, styleFunc, header, ...)
|
||||||
local num = table.getn(arg)
|
local num = getn(arg)
|
||||||
for i = 1, num do
|
for i = 1, num do
|
||||||
local object = arg[i]
|
local object = arg[i]
|
||||||
local objectUnit = object.guessUnit or unit
|
local objectUnit = object.guessUnit or unit
|
||||||
local suffix = string.match(objectUnit or unit, '%w+target')
|
local suffix = match(objectUnit or unit, "%w+target")
|
||||||
|
|
||||||
object.__elements = {}
|
object.__elements = {}
|
||||||
object.__registeredEvents = {}
|
object.__registeredEvents = {}
|
||||||
@@ -287,10 +290,10 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
object = setmetatable(object, frame_metatable)
|
object = setmetatable(object, frame_metatable)
|
||||||
|
|
||||||
-- Expose the frame through oUF.objects.
|
-- Expose the frame through oUF.objects.
|
||||||
table.insert(objects, object)
|
insert(objects, object)
|
||||||
|
|
||||||
-- We have to force update the frames when PEW fires.
|
-- We have to force update the frames when PEW fires.
|
||||||
object:RegisterEvent('PLAYER_ENTERING_WORLD', object.UpdateAllElements)
|
object:RegisterEvent("PLAYER_ENTERING_WORLD", object.UpdateAllElements)
|
||||||
|
|
||||||
object:SetScript("OnClick", function()
|
object:SetScript("OnClick", function()
|
||||||
if arg1 == "RightButton" then
|
if arg1 == "RightButton" then
|
||||||
@@ -302,14 +305,14 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
|
|
||||||
if(not header) then
|
if(not header) then
|
||||||
-- Other target units are handled by :HandleUnit().
|
-- Other target units are handled by :HandleUnit().
|
||||||
if(suffix == 'target') then
|
if(suffix == "target") then
|
||||||
enableTargetUpdate(object)
|
enableTargetUpdate(object)
|
||||||
else
|
else
|
||||||
oUF:HandleUnit(object, unit)
|
oUF:HandleUnit(object, unit)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Used to update frames when they change position in a group.
|
-- Used to update frames when they change position in a group.
|
||||||
object:RegisterEvent('RAID_ROSTER_UPDATE', object.UpdateAllElements)
|
object:RegisterEvent("RAID_ROSTER_UPDATE", object.UpdateAllElements)
|
||||||
|
|
||||||
if(num > 1) then
|
if(num > 1) then
|
||||||
if(object:GetParent() == header) then
|
if(object:GetParent() == header) then
|
||||||
@@ -319,7 +322,7 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(suffix == 'target') then
|
if(suffix == "target") then
|
||||||
enableTargetUpdate(object)
|
enableTargetUpdate(object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -328,8 +331,8 @@ local function initObject(unit, style, styleFunc, header, ...)
|
|||||||
|
|
||||||
styleFunc(object, objectUnit, not header)
|
styleFunc(object, objectUnit, not header)
|
||||||
|
|
||||||
--object:SetScript('OnAttributeChanged', onAttributeChanged)
|
--object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||||
object:SetScript('OnShow', onShow)
|
object:SetScript("OnShow", onShow)
|
||||||
|
|
||||||
activeElements[object] = {}
|
activeElements[object] = {}
|
||||||
for element in next, elements do
|
for element in next, elements do
|
||||||
@@ -356,7 +359,7 @@ local function walkObject(object, unit)
|
|||||||
-- Check if we should leave the main frame blank.
|
-- Check if we should leave the main frame blank.
|
||||||
if(object.onlyProcessChildren) then
|
if(object.onlyProcessChildren) then
|
||||||
object.hasChildren = true
|
object.hasChildren = true
|
||||||
--object:SetScript('OnAttributeChanged', onAttributeChanged)
|
--object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||||
return initObject(unit, style, styleFunc, header, object:GetChildren())
|
return initObject(unit, style, styleFunc, header, object:GetChildren())
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -370,7 +373,7 @@ Used to add a function to a table to be executed upon unit frame/header initiali
|
|||||||
* func - function to be added
|
* func - function to be added
|
||||||
--]]
|
--]]
|
||||||
function oUF:RegisterInitCallback(func)
|
function oUF:RegisterInitCallback(func)
|
||||||
table.insert(callback, func)
|
insert(callback, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ oUF:RegisterMetaFunction(name, func)
|
--[[ oUF:RegisterMetaFunction(name, func)
|
||||||
@@ -381,8 +384,8 @@ Used to make a (table of) function(s) available to all unit frames.
|
|||||||
* func - function or a table of functions (function or table)
|
* func - function or a table of functions (function or table)
|
||||||
--]]
|
--]]
|
||||||
function oUF:RegisterMetaFunction(name, func)
|
function oUF:RegisterMetaFunction(name, func)
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
argcheck(func, 3, 'function', 'table')
|
argcheck(func, 3, "function", "table")
|
||||||
|
|
||||||
if(frame_metatable.__index[name]) then
|
if(frame_metatable.__index[name]) then
|
||||||
return
|
return
|
||||||
@@ -392,17 +395,17 @@ function oUF:RegisterMetaFunction(name, func)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--[[ oUF:RegisterStyle(name, func)
|
--[[ oUF:RegisterStyle(name, func)
|
||||||
Used to register a style with oUF. This will also set the active style if it hasn't been set yet.
|
Used to register a style with oUF. This will also set the active style if it hasn"t been set yet.
|
||||||
|
|
||||||
* self - the global oUF object
|
* self - the global oUF object
|
||||||
* name - name of the style
|
* name - name of the style
|
||||||
* func - function(s) defining the style (function or table)
|
* func - function(s) defining the style (function or table)
|
||||||
--]]
|
--]]
|
||||||
function oUF:RegisterStyle(name, func)
|
function oUF:RegisterStyle(name, func)
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
argcheck(func, 3, 'function', 'table')
|
argcheck(func, 3, "function", "table")
|
||||||
|
|
||||||
if(styles[name]) then return error('Style [%s] already registered.', name) end
|
if(styles[name]) then return error("Style [%s] already registered.", name) end
|
||||||
if(not style) then style = name end
|
if(not style) then style = name end
|
||||||
|
|
||||||
styles[name] = func
|
styles[name] = func
|
||||||
@@ -415,15 +418,15 @@ Used to set the active style.
|
|||||||
* name - name of the style (string)
|
* name - name of the style (string)
|
||||||
--]]
|
--]]
|
||||||
function oUF:SetActiveStyle(name)
|
function oUF:SetActiveStyle(name)
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
if(not styles[name]) then return error('Style [%s] does not exist.', name) end
|
if(not styles[name]) then return error("Style [%s] does not exist.", name) end
|
||||||
|
|
||||||
style = name
|
style = name
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local function iter(_, n)
|
local function iter(_, n)
|
||||||
-- don't expose the style functions.
|
-- don"t expose the style functions.
|
||||||
return (next(styles, n))
|
return (next(styles, n))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -440,18 +443,18 @@ end
|
|||||||
local getCondition
|
local getCondition
|
||||||
do
|
do
|
||||||
local conditions = {
|
local conditions = {
|
||||||
raid40 = '[target=raid26,exists] show;',
|
raid40 = "[target=raid26,exists] show;",
|
||||||
raid25 = '[target=raid11,exists] show;',
|
raid25 = "[target=raid11,exists] show;",
|
||||||
raid10 = '[target=raid6,exists] show;',
|
raid10 = "[target=raid6,exists] show;",
|
||||||
raid = '[group:raid] show;',
|
raid = "[group:raid] show;",
|
||||||
party = '[group:party,nogroup:raid] show;',
|
party = "[group:party,nogroup:raid] show;",
|
||||||
solo = '[target=player,exists,nogroup:party] show;',
|
solo = "[target=player,exists,nogroup:party] show;",
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCondition(...)
|
function getCondition(...)
|
||||||
local cond = ''
|
local cond = ""
|
||||||
|
|
||||||
for i = 1, select('#', arg) do
|
for i = 1, getn(arg) do
|
||||||
local short = select(i, unpack(arg))
|
local short = select(i, unpack(arg))
|
||||||
|
|
||||||
local condition = conditions[short]
|
local condition = conditions[short]
|
||||||
@@ -460,21 +463,21 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return cond .. 'hide'
|
return cond .. "hide"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function generateName(unit, ...)
|
local function generateName(unit, ...)
|
||||||
local name = 'oUF_' .. style:gsub('^oUF_?', ''):gsub('[^%a%d_]+', '')
|
local name = "oUF_" .. gsub(style, gsub("^oUF_?", ""), gsub("[^%a%d_]+", ""))
|
||||||
|
|
||||||
local raid, party, groupFilter
|
local raid, party, groupFilter
|
||||||
for i = 1, select('#', arg), 2 do
|
for i = 1, getn(arg), 2 do
|
||||||
local att, val = select(i, unpack(arg))
|
local att, val = select(i, unpack(arg))
|
||||||
if(att == 'showRaid') then
|
if(att == "showRaid") then
|
||||||
raid = true
|
raid = true
|
||||||
elseif(att == 'showParty') then
|
elseif(att == "showParty") then
|
||||||
party = true
|
party = true
|
||||||
elseif(att == 'groupFilter') then
|
elseif(att == "groupFilter") then
|
||||||
groupFilter = val
|
groupFilter = val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -482,27 +485,27 @@ local function generateName(unit, ...)
|
|||||||
local append
|
local append
|
||||||
if(raid) then
|
if(raid) then
|
||||||
if(groupFilter) then
|
if(groupFilter) then
|
||||||
if(type(groupFilter) == 'number' and groupFilter > 0) then
|
if(type(groupFilter) == "number" and groupFilter > 0) then
|
||||||
append = groupFilter
|
append = groupFilter
|
||||||
elseif(groupFilter:match('TANK')) then
|
elseif(match(groupFilter, "TANK")) then
|
||||||
append = 'MainTank'
|
append = "MainTank"
|
||||||
elseif(groupFilter:match('ASSIST')) then
|
elseif(match(groupFilter, "ASSIST")) then
|
||||||
append = 'MainAssist'
|
append = "MainAssist"
|
||||||
else
|
else
|
||||||
local _, count = groupFilter:gsub(',', '')
|
local _, count = gsub(groupFilter, ",", "")
|
||||||
if(count == 0) then
|
if(count == 0) then
|
||||||
append = 'Raid' .. groupFilter
|
append = "Raid" .. groupFilter
|
||||||
else
|
else
|
||||||
append = 'Raid'
|
append = "Raid"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
append = 'Raid'
|
append = "Raid"
|
||||||
end
|
end
|
||||||
elseif(party) then
|
elseif(party) then
|
||||||
append = 'Party'
|
append = "Party"
|
||||||
elseif(unit) then
|
elseif(unit) then
|
||||||
append = unit:gsub('^%l', string.upper)
|
append = gsub(unit, "^%l", upper)
|
||||||
end
|
end
|
||||||
|
|
||||||
if(append) then
|
if(append) then
|
||||||
@@ -530,17 +533,17 @@ do
|
|||||||
|
|
||||||
local unit
|
local unit
|
||||||
if(not self.onlyProcessChildren) then
|
if(not self.onlyProcessChildren) then
|
||||||
local groupFilter = header:GetAttribute('groupFilter')
|
local groupFilter = header:GetAttribute("groupFilter")
|
||||||
|
|
||||||
if(header:GetAttribute('showRaid')) then
|
if(header:GetAttribute("showRaid")) then
|
||||||
unit = 'raid'
|
unit = "raid"
|
||||||
elseif(header:GetAttribute('showParty')) then
|
elseif(header:GetAttribute("showParty")) then
|
||||||
unit = 'party'
|
unit = "party"
|
||||||
end
|
end
|
||||||
|
|
||||||
self.menu = togglemenu
|
self.menu = togglemenu
|
||||||
--self:SetAttribute('type1', 'target')
|
--self:SetAttribute("type1", "target")
|
||||||
--self:SetAttribute('type2', 'menu')
|
--self:SetAttribute("type2", "menu")
|
||||||
self.guessUnit = unit
|
self.guessUnit = unit
|
||||||
self.unit = "player"
|
self.unit = "player"
|
||||||
-- self.onlyProcessChildren =true
|
-- self.onlyProcessChildren =true
|
||||||
@@ -567,7 +570,7 @@ do
|
|||||||
* self - the global oUF object
|
* self - the global oUF object
|
||||||
* overrideName - unique global name to be used for the header. Defaults to an auto-generated name based on the name
|
* overrideName - unique global name to be used for the header. Defaults to an auto-generated name based on the name
|
||||||
of the active style and other arguments passed to `:SpawnHeader` (string?)
|
of the active style and other arguments passed to `:SpawnHeader` (string?)
|
||||||
* template - name of a template to be used for creating the header. Defaults to `'oUF_GroupHeaderTemplate'`
|
* template - name of a template to be used for creating the header. Defaults to `"oUF_GroupHeaderTemplate"`
|
||||||
(string?)
|
(string?)
|
||||||
* visibility - macro conditional(s) which define when to display the header (string).
|
* visibility - macro conditional(s) which define when to display the header (string).
|
||||||
* ... - further argument pairs. Consult [Group Headers](http://wowprogramming.com/docs/secure_template/Group_Headers)
|
* ... - further argument pairs. Consult [Group Headers](http://wowprogramming.com/docs/secure_template/Group_Headers)
|
||||||
@@ -581,20 +584,20 @@ do
|
|||||||
* oUF-onlyProcessChildren - can be used to force headers to only process children (boolean?)
|
* oUF-onlyProcessChildren - can be used to force headers to only process children (boolean?)
|
||||||
--]]
|
--]]
|
||||||
function oUF:SpawnHeader(overrideName, template, visibility, ...)
|
function oUF:SpawnHeader(overrideName, template, visibility, ...)
|
||||||
if(not style) then return error('Unable to create frame. No styles have been registered.') end
|
if(not style) then return error("Unable to create frame. No styles have been registered.") end
|
||||||
|
|
||||||
template = (template or 'oUF_GroupHeaderTemplate')
|
template = (template or "oUF_GroupHeaderTemplate")
|
||||||
|
|
||||||
local isPetHeader = string.match(template, 'PetHeader')
|
local isPetHeader = match(template, "PetHeader")
|
||||||
local name = overrideName or generateName(nil, unpack(arg))
|
local name = overrideName or generateName(nil, unpack(arg))
|
||||||
local header = CreateFrame('Frame', name, UIParent, template)
|
local header = CreateFrame("Frame", name, UIParent, template)
|
||||||
header:Hide()
|
header:Hide()
|
||||||
|
|
||||||
header.attributes = {}
|
header.attributes = {}
|
||||||
header.SetAttribute = setAttribute
|
header.SetAttribute = setAttribute
|
||||||
header.GetAttribute = getAttribute
|
header.GetAttribute = getAttribute
|
||||||
|
|
||||||
--header:SetAttribute('template', 'SecureUnitButtonTemplate')
|
--header:SetAttribute("template", "SecureUnitButtonTemplate")
|
||||||
for i = 1, getn(arg), 2 do
|
for i = 1, getn(arg), 2 do
|
||||||
local att, val = select(i, unpack(arg))
|
local att, val = select(i, unpack(arg))
|
||||||
if(not att) then break end
|
if(not att) then break end
|
||||||
@@ -607,24 +610,24 @@ do
|
|||||||
header.visibility = visibility
|
header.visibility = visibility
|
||||||
|
|
||||||
-- Expose the header through oUF.headers.
|
-- Expose the header through oUF.headers.
|
||||||
table.insert(headers, header)
|
insert(headers, header)
|
||||||
|
|
||||||
header.initialConfigFunction = initialConfigFunction
|
header.initialConfigFunction = initialConfigFunction
|
||||||
header.headerType = isPetHeader and 'pet' or 'group'
|
header.headerType = isPetHeader and "pet" or "group"
|
||||||
|
|
||||||
if(header:GetAttribute('showParty')) then
|
if(header:GetAttribute("showParty")) then
|
||||||
self:DisableBlizzard('party')
|
self:DisableBlizzard("party")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[if(visibility) then
|
--[[if(visibility) then
|
||||||
local type, list = string.split(' ', visibility, 2)
|
local type, list = split(" ", visibility, 2)
|
||||||
if(list and type == 'custom') then
|
if(list and type == "custom") then
|
||||||
RegisterStateDriver(header, 'visibility', list)
|
RegisterStateDriver(header, "visibility", list)
|
||||||
header.visibility = list
|
header.visibility = list
|
||||||
else
|
else
|
||||||
local condition = getCondition(string.split(',', visibility))
|
local condition = getCondition(split(",", visibility))
|
||||||
RegisterStateDriver(header, 'visibility', condition)
|
RegisterStateDriver(header, "visibility", condition)
|
||||||
header.visibility = condition
|
header.visibility = condition
|
||||||
end
|
end
|
||||||
end]]
|
end]]
|
||||||
@@ -637,18 +640,18 @@ end
|
|||||||
Used to create a single unit frame and apply the currently active style to it.
|
Used to create a single unit frame and apply the currently active style to it.
|
||||||
|
|
||||||
* self - the global oUF object
|
* self - the global oUF object
|
||||||
* unit - the frame's unit (string)
|
* unit - the frame"s unit (string)
|
||||||
* overrideName - unique global name to use for the unit frame. Defaults to an auto-generated name based on the unit
|
* overrideName - unique global name to use for the unit frame. Defaults to an auto-generated name based on the unit
|
||||||
(string?)
|
(string?)
|
||||||
--]]
|
--]]
|
||||||
function oUF:Spawn(unit, overrideName)
|
function oUF:Spawn(unit, overrideName)
|
||||||
argcheck(unit, 2, 'string')
|
argcheck(unit, 2, "string")
|
||||||
if(not style) then return error('Unable to create frame. No styles have been registered.') end
|
if(not style) then return error("Unable to create frame. No styles have been registered.") end
|
||||||
|
|
||||||
unit = string.lower(unit)
|
unit = lower(unit)
|
||||||
|
|
||||||
local name = overrideName or generateName(unit)
|
local name = overrideName or generateName(unit)
|
||||||
local object = CreateFrame('Button', name, UIParent)
|
local object = CreateFrame("Button", name, UIParent)
|
||||||
object:Hide()
|
object:Hide()
|
||||||
Private.UpdateUnits(object, unit)
|
Private.UpdateUnits(object, unit)
|
||||||
|
|
||||||
@@ -671,12 +674,12 @@ Used to register an element with oUF.
|
|||||||
* disable - used to disable the element for a given unit frame (function?)
|
* disable - used to disable the element for a given unit frame (function?)
|
||||||
--]]
|
--]]
|
||||||
function oUF:AddElement(name, update, enable, disable)
|
function oUF:AddElement(name, update, enable, disable)
|
||||||
argcheck(name, 2, 'string')
|
argcheck(name, 2, "string")
|
||||||
argcheck(update, 3, 'function', 'nil')
|
argcheck(update, 3, "function", "nil")
|
||||||
argcheck(enable, 4, 'function', 'nil')
|
argcheck(enable, 4, "function", "nil")
|
||||||
argcheck(disable, 5, 'function', 'nil')
|
argcheck(disable, 5, "function", "nil")
|
||||||
|
|
||||||
if(elements[name]) then return error('Element [%s] is already registered.', name) end
|
if(elements[name]) then return error("Element [%s] is already registered.", name) end
|
||||||
elements[name] = {
|
elements[name] = {
|
||||||
update = update;
|
update = update;
|
||||||
enable = enable;
|
enable = enable;
|
||||||
|
|||||||
+13
-15
@@ -1,7 +1,7 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||||
local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
|
local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
|
||||||
local Search = LibStub("LibItemSearch-1.2");
|
local Search = LibStub("LibItemSearch-1.2");
|
||||||
-- local LIP = LibStub("ItemPrice-1.1", true);
|
local LIP = LibStub("ItemPrice-1.1", true);
|
||||||
|
|
||||||
--Cache global variables
|
--Cache global variables
|
||||||
--Lua functions
|
--Lua functions
|
||||||
@@ -700,10 +700,10 @@ function B:GetGraysValue()
|
|||||||
for s = 1, GetContainerNumSlots(b) do
|
for s = 1, GetContainerNumSlots(b) do
|
||||||
local l = GetContainerItemLink(b, s)
|
local l = GetContainerItemLink(b, s)
|
||||||
if l and find(l,"ff9d9d9d") then
|
if l and find(l,"ff9d9d9d") then
|
||||||
-- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
||||||
-- if(select(3, GetItemInfo(l)) == 0 and p > 0) then
|
if select(3, GetItemInfo(l)) == 0 and p > 0 then
|
||||||
-- c = c + p
|
c = c + p
|
||||||
-- end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -718,25 +718,24 @@ function B:VendorGrays(delete, _, getValue)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local c = 0
|
local c = 0
|
||||||
local count = 0
|
|
||||||
for b = 0, NUM_BAG_FRAMES do
|
for b = 0, NUM_BAG_FRAMES do
|
||||||
for s = 1, GetContainerNumSlots(b) do
|
for s = 1, GetContainerNumSlots(b) do
|
||||||
local l = GetContainerItemLink(b, s)
|
local l = GetContainerItemLink(b, s)
|
||||||
if l and find(l,"ff9d9d9d") then
|
if l and find(l,"ff9d9d9d") then
|
||||||
-- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s))
|
||||||
if delete then
|
if delete then
|
||||||
if not getValue then
|
if not getValue then
|
||||||
PickupContainerItem(b, s)
|
PickupContainerItem(b, s)
|
||||||
DeleteCursorItem()
|
DeleteCursorItem()
|
||||||
end
|
end
|
||||||
-- c = c + p
|
c = c + p
|
||||||
count = count + 1
|
|
||||||
else
|
else
|
||||||
if not getValue then
|
if not getValue then
|
||||||
UseContainerItem(b, s)
|
UseContainerItem(b, s)
|
||||||
PickupMerchantItem()
|
PickupMerchantItem()
|
||||||
end
|
end
|
||||||
-- c = c + p
|
c = c + p
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -753,12 +752,11 @@ function B:VendorGrays(delete, _, getValue)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function B:VendorGrayCheck()
|
function B:VendorGrayCheck()
|
||||||
-- local value = B:GetGraysValue()
|
local value = B:GetGraysValue()
|
||||||
|
|
||||||
-- if value == 0 then
|
if value == 0 then
|
||||||
-- E:Print(L["No gray items to delete."])
|
E:Print(L["No gray items to delete."])
|
||||||
-- else
|
elseif not MerchantFrame or not MerchantFrame:IsShown() then
|
||||||
if not MerchantFrame or not MerchantFrame:IsShown() then
|
|
||||||
E.PopupDialogs["DELETE_GRAYS"].Money = value
|
E.PopupDialogs["DELETE_GRAYS"].Money = value
|
||||||
E:StaticPopup_Show("DELETE_GRAYS")
|
E:StaticPopup_Show("DELETE_GRAYS")
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -83,8 +83,10 @@ function M:MERCHANT_SHOW()
|
|||||||
if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end
|
if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end
|
||||||
|
|
||||||
local cost, possible = GetRepairAllCost()
|
local cost, possible = GetRepairAllCost()
|
||||||
if cost > 0 then
|
local money = GetMoney()
|
||||||
if possible then
|
|
||||||
|
if possible then
|
||||||
|
if cost > 0 and money >= cost then
|
||||||
RepairAllItems(autoRepair == "PLAYER")
|
RepairAllItems(autoRepair == "PLAYER")
|
||||||
E:Print(L["Your items have been repaired for: "]..E:FormatMoney(cost, "BLIZZARD"))
|
E:Print(L["Your items have been repaired for: "]..E:FormatMoney(cost, "BLIZZARD"))
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
local E, L, V, P, G = unpack(ElvUI)
|
||||||
|
local IP = E:NewModule("Tooltip_ItemPrice", "AceHook-3.0")
|
||||||
|
|
||||||
|
local LIP = LibStub:GetLibrary("ItemPrice-1.1")
|
||||||
|
|
||||||
|
local match = string.match
|
||||||
|
|
||||||
|
local GetActionCount = GetActionCount
|
||||||
|
local GetAuctionItemInfo = GetAuctionItemInfo
|
||||||
|
local GetAuctionSellItemInfo = GetAuctionSellItemInfo
|
||||||
|
local GetContainerItemInfo = GetContainerItemInfo
|
||||||
|
local GetCraftReagentInfo = GetCraftReagentInfo
|
||||||
|
local GetInboxItem = GetInboxItem
|
||||||
|
local GetItemCount = GetItemCount
|
||||||
|
local GetLootRollItemInfo = GetLootRollItemInfo
|
||||||
|
local GetLootSlotInfo = GetLootSlotInfo
|
||||||
|
local GetMerchantItemInfo = GetMerchantItemInfo
|
||||||
|
local GetQuestItemInfo = GetQuestItemInfo
|
||||||
|
local GetQuestLogRewardInfo = GetQuestLogRewardInfo
|
||||||
|
local GetSendMailItem = GetSendMailItem
|
||||||
|
local GetTradePlayerItemInfo = GetTradePlayerItemInfo
|
||||||
|
local GetTradeSkillReagentInfo = GetTradeSkillReagentInfo
|
||||||
|
local GetTradeTargetItemInfo = GetTradeTargetItemInfo
|
||||||
|
local IsConsumableAction = IsConsumableAction
|
||||||
|
|
||||||
|
local tooltips = {
|
||||||
|
"GameTooltip",
|
||||||
|
"ItemRefTooltip"
|
||||||
|
}
|
||||||
|
|
||||||
|
function IP:SetAction(tt, id)
|
||||||
|
local itemName = GameTooltipTextLeft1:GetText()
|
||||||
|
if not itemName then return end
|
||||||
|
|
||||||
|
local item = GetItemInfoByName(itemName)
|
||||||
|
if item then
|
||||||
|
local count = 1
|
||||||
|
if IsConsumableAction(id) then
|
||||||
|
local actionCount = GetActionCount(id)
|
||||||
|
if actionCount and actionCount == GetItemCount(item) then
|
||||||
|
count = actionCount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetAuctionItem(tt, type, index)
|
||||||
|
local _, _, count = GetAuctionItemInfo(type, index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetAuctionSellItem(tt)
|
||||||
|
local _, _, count = GetAuctionSellItemInfo()
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetBagItem(tt, bag, slot)
|
||||||
|
local _, count = GetContainerItemInfo(bag, slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetCraftItem(tt, skill, slot)
|
||||||
|
local count = 1
|
||||||
|
if slot then
|
||||||
|
count = select(3, GetCraftReagentInfo(skill, slot))
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetHyperlink(tt, link, count)
|
||||||
|
count = tonumber(count)
|
||||||
|
if not count or count < 1 then
|
||||||
|
local owner = tt:GetParent()
|
||||||
|
count = owner and tonumber(owner.count)
|
||||||
|
if not count or count < 1 then
|
||||||
|
count = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetInboxItem(tt, index, attachmentIndex)
|
||||||
|
local _, _, count = GetInboxItem(index, attachmentIndex)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetInventoryItem(tt, unit, slot)
|
||||||
|
if type(slot) ~= "number" or slot < 0 then return end
|
||||||
|
|
||||||
|
local count = 1
|
||||||
|
if slot < 20 or slot > 39 and slot < 68 then
|
||||||
|
count = GetInventoryItemCount(unit, slot)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetLootItem(tt, slot)
|
||||||
|
local _, _, count = GetLootSlotInfo(slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetLootRollItem(tt, rollID)
|
||||||
|
local _, _, count = GetLootRollItemInfo(rollID)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetMerchantItem(tt, slot)
|
||||||
|
local _, _, _, count = GetMerchantItemInfo(slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetQuestItem(tt, type, slot)
|
||||||
|
local _, _, count = GetQuestItemInfo(type, slot)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetQuestLogItem(tt, type, index)
|
||||||
|
local _, _, count = GetQuestLogRewardInfo(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetSendMailItem(tt, index)
|
||||||
|
local _, _, count = GetSendMailItem(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetTradePlayerItem(tt, index)
|
||||||
|
local _, _, count = GetTradePlayerItemInfo(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetTradeSkillItem(tt, skill, slot)
|
||||||
|
local count = 1
|
||||||
|
if slot then
|
||||||
|
count = select(3, GetTradeSkillReagentInfo(skill, slot))
|
||||||
|
end
|
||||||
|
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetTradeTargetItem(tt, index)
|
||||||
|
local _, _, count = GetTradeTargetItemInfo(index)
|
||||||
|
self:SetPrice(tt, count)
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:SetPrice(tt, count)
|
||||||
|
if MerchantFrame:IsShown() then return end
|
||||||
|
|
||||||
|
local itemName = GameTooltipTextLeft1:GetText()
|
||||||
|
if not itemName then return end
|
||||||
|
|
||||||
|
local _, itemString = GetItemInfoByName(itemName)
|
||||||
|
if not itemString then return end
|
||||||
|
|
||||||
|
local itemID = match(itemString, "item:(%d+)")
|
||||||
|
if not itemID then return end
|
||||||
|
|
||||||
|
local price = LIP:GetSellValue(itemID)
|
||||||
|
|
||||||
|
if price and price > 0 then
|
||||||
|
tt:AddDoubleLine(SALE_PRICE_COLON, E:FormatMoney(count and price * count or price, "BLIZZARD", false), nil, nil, nil, 1, 1, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
if tt:IsShown() then tt:Show() end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:ApplyHooks(tooltip)
|
||||||
|
self:SecureHook(tooltip, "SetAction", "SetAction")
|
||||||
|
self:SecureHook(tooltip, "SetAuctionItem", "SetAuctionItem")
|
||||||
|
self:SecureHook(tooltip, "SetAuctionSellItem", "SetAuctionSellItem")
|
||||||
|
self:SecureHook(tooltip, "SetBagItem", "SetBagItem")
|
||||||
|
self:SecureHook(tooltip, "SetCraftItem", "SetCraftItem")
|
||||||
|
self:SecureHook(tooltip, "SetHyperlink", "SetHyperlink")
|
||||||
|
self:SecureHook(tooltip, "SetInboxItem", "SetInboxItem")
|
||||||
|
self:SecureHook(tooltip, "SetInventoryItem", "SetInventoryItem")
|
||||||
|
self:SecureHook(tooltip, "SetLootItem", "SetLootItem")
|
||||||
|
self:SecureHook(tooltip, "SetLootRollItem", "SetLootRollItem")
|
||||||
|
self:SecureHook(tooltip, "SetMerchantItem", "SetMerchantItem")
|
||||||
|
self:SecureHook(tooltip, "SetQuestItem", "SetQuestItem")
|
||||||
|
self:SecureHook(tooltip, "SetQuestLogItem", "SetQuestLogItem")
|
||||||
|
self:SecureHook(tooltip, "SetSendMailItem", "SetSendMailItem")
|
||||||
|
self:SecureHook(tooltip, "SetTradePlayerItem", "SetTradePlayerItem")
|
||||||
|
self:SecureHook(tooltip, "SetTradeSkillItem", "SetTradeSkillItem")
|
||||||
|
self:SecureHook(tooltip, "SetTradeTargetItem", "SetTradeTargetItem")
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:UpdateSettings()
|
||||||
|
if E.db.tooltip.itemPrice then
|
||||||
|
for _, tooltip in pairs(tooltips) do
|
||||||
|
self:ApplyHooks(_G[tooltip])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self:UnhookAll()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function IP:Initialize()
|
||||||
|
self:UpdateSettings()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function InitializeCallback()
|
||||||
|
IP:Initialize()
|
||||||
|
end
|
||||||
|
|
||||||
|
E:RegisterModule(IP:GetName(), InitializeCallback)
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||||
<Script file="Tooltip.lua"/>
|
<Script file="Tooltip.lua"/>
|
||||||
|
<Script file="ItemPrice.lua"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
@@ -1,30 +1,32 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI)
|
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||||
|
|
||||||
local _G = _G;
|
--Cache global variables
|
||||||
local floor = math.floor;
|
--Lua functions
|
||||||
local format = string.format;
|
local _G = _G
|
||||||
|
local floor = math.floor
|
||||||
local GetPVPTimer = GetPVPTimer;
|
local format = string.format
|
||||||
local GetTime = GetTime;
|
--WoW API / Variables
|
||||||
local UnitClass = UnitClass;
|
local GetPVPTimer = GetPVPTimer
|
||||||
local UnitClassification = UnitClassification;
|
local GetTime = GetTime
|
||||||
local UnitGUID = UnitGUID;
|
local UnitClass = UnitClass
|
||||||
local UnitIsAFK = UnitIsAFK;
|
local UnitClassification = UnitClassification
|
||||||
local UnitIsConnected = UnitIsConnected;
|
local UnitGUID = UnitGUID
|
||||||
local UnitIsDND = UnitIsDND;
|
local UnitIsAFK = UnitIsAFK
|
||||||
local UnitIsDead = UnitIsDead;
|
local UnitIsConnected = UnitIsConnected
|
||||||
local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
|
local UnitIsDND = UnitIsDND
|
||||||
local UnitIsGhost = UnitIsGhost;
|
local UnitIsDead = UnitIsDead
|
||||||
local UnitIsPVP = UnitIsPVP;
|
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
|
||||||
local UnitIsPVPFreeForAll = UnitIsPVPFreeForAll;
|
local UnitIsGhost = UnitIsGhost
|
||||||
local UnitIsPlayer = UnitIsPlayer;
|
local UnitIsPVP = UnitIsPVP
|
||||||
local UnitLevel = UnitLevel;
|
local UnitIsPVPFreeForAll = UnitIsPVPFreeForAll
|
||||||
local UnitMana = UnitMana;
|
local UnitIsPlayer = UnitIsPlayer
|
||||||
local UnitManaMax = UnitManaMax;
|
local UnitLevel = UnitLevel
|
||||||
local UnitPowerType = UnitPowerType;
|
local UnitMana = UnitMana
|
||||||
local UnitReaction = UnitReaction;
|
local UnitManaMax = UnitManaMax
|
||||||
local DEFAULT_AFK_MESSAGE = DEFAULT_AFK_MESSAGE;
|
local UnitPowerType = UnitPowerType
|
||||||
local PVP = PVP;
|
local UnitReaction = UnitReaction
|
||||||
|
local DEFAULT_AFK_MESSAGE = DEFAULT_AFK_MESSAGE
|
||||||
|
local PVP = PVP
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Tags
|
-- Tags
|
||||||
@@ -34,7 +36,7 @@ ElvUF.Tags.Events["afk"] = "PLAYER_FLAGS_CHANGED"
|
|||||||
ElvUF.Tags.Methods["afk"] = function(unit)
|
ElvUF.Tags.Methods["afk"] = function(unit)
|
||||||
local isAFK = UnitIsAFK(unit)
|
local isAFK = UnitIsAFK(unit)
|
||||||
if isAFK then
|
if isAFK then
|
||||||
return ("|cffFFFFFF[|r|cffFF0000%s|r|cFFFFFFFF]|r"):format(DEFAULT_AFK_MESSAGE)
|
return format("|cffFFFFFF[|r|cffFF0000%s|r|cFFFFFFFF]|r", DEFAULT_AFK_MESSAGE)
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
@@ -474,7 +476,7 @@ ElvUF.Tags.Methods["statustimer"] = function(unit)
|
|||||||
local timer = GetTime() - unitStatus[guid][2]
|
local timer = GetTime() - unitStatus[guid][2]
|
||||||
local mins = floor(timer / 60)
|
local mins = floor(timer / 60)
|
||||||
local secs = floor(timer - (mins * 60))
|
local secs = floor(timer - (mins * 60))
|
||||||
return ("%s (%01.f:%02.f)"):format(status, mins, secs)
|
return format("%s (%01.f:%02.f)", status, mins, secs)
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
@@ -488,7 +490,7 @@ ElvUF.Tags.Methods["pvptimer"] = function(unit)
|
|||||||
if timer ~= 301000 and timer ~= -1 then
|
if timer ~= 301000 and timer ~= -1 then
|
||||||
local mins = floor((timer / 1000) / 60)
|
local mins = floor((timer / 1000) / 60)
|
||||||
local secs = floor((timer / 1000) - (mins * 60))
|
local secs = floor((timer / 1000) - (mins * 60))
|
||||||
return ("%s (%01.f:%02.f)"):format(PVP, mins, secs)
|
return format("%s (%01.f:%02.f)", PVP, mins, secs)
|
||||||
else
|
else
|
||||||
return PVP
|
return PVP
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ P["tooltip"] = {
|
|||||||
["playerTitles"] = true,
|
["playerTitles"] = true,
|
||||||
["guildRanks"] = true,
|
["guildRanks"] = true,
|
||||||
["inspectInfo"] = true,
|
["inspectInfo"] = true,
|
||||||
|
["itemPrice"] = true,
|
||||||
["itemCount"] = "BAGS_ONLY",
|
["itemCount"] = "BAGS_ONLY",
|
||||||
["spellID"] = true,
|
["spellID"] = true,
|
||||||
["font"] = "PT Sans Narrow",
|
["font"] = "PT Sans Narrow",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ local AceCore = LibStub("AceCore-3.0")
|
|||||||
local min, max, floor = math.min, math.max, math.floor
|
local min, max, floor = math.min, math.max, math.floor
|
||||||
local pairs, ipairs, type = pairs, ipairs, type
|
local pairs, ipairs, type = pairs, ipairs, type
|
||||||
local tsort, tinsert, tgetn, tsetn = table.sort, table.insert, table.getn, table.setn
|
local tsort, tinsert, tgetn, tsetn = table.sort, table.insert, table.getn, table.setn
|
||||||
|
local format = string.format
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local PlaySound = PlaySound
|
local PlaySound = PlaySound
|
||||||
@@ -578,7 +579,7 @@ do
|
|||||||
local function AddListItem(self, value, text, itemType)
|
local function AddListItem(self, value, text, itemType)
|
||||||
if not itemType then itemType = "Dropdown-Item-Toggle" end
|
if not itemType then itemType = "Dropdown-Item-Toggle" end
|
||||||
local exists = AceGUI:GetWidgetVersion(itemType)
|
local exists = AceGUI:GetWidgetVersion(itemType)
|
||||||
if not exists then error(("The given item type, %q, does not exist within AceGUI-3.0"):format(tostring(itemType)), 2) end
|
if not exists then error(format("The given item type, %q, does not exist within AceGUI-3.0", tostring(itemType)), 2) end
|
||||||
|
|
||||||
local item = AceGUI:Create(itemType)
|
local item = AceGUI:Create(itemType)
|
||||||
item:SetText(text)
|
item:SetText(text)
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
|||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local min, max, floor, format = math.min, math.max, math.floor, string.format
|
local min, max, floor = math.min, math.max, math.floor
|
||||||
|
local format, gsub = string.format, string.gsub
|
||||||
local tonumber, pairs = tonumber, pairs
|
local tonumber, pairs = tonumber, pairs
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
@@ -101,7 +102,7 @@ local function EditBox_OnEnterPressed()
|
|||||||
local self = this.obj
|
local self = this.obj
|
||||||
local value = this:GetText()
|
local value = this:GetText()
|
||||||
if self.ispercent then
|
if self.ispercent then
|
||||||
value = value:gsub('%%', '')
|
value = gsub(value, '%%', '')
|
||||||
value = tonumber(value) / 100
|
value = tonumber(value) / 100
|
||||||
else
|
else
|
||||||
value = tonumber(value)
|
value = tonumber(value)
|
||||||
|
|||||||
@@ -63,14 +63,24 @@ E.Options.args.tooltip = {
|
|||||||
name = L["Inspect Info"],
|
name = L["Inspect Info"],
|
||||||
desc = L["Display the players talent spec and item level in the tooltip, this may not immediately update when mousing over a unit."],
|
desc = L["Display the players talent spec and item level in the tooltip, this may not immediately update when mousing over a unit."],
|
||||||
},
|
},
|
||||||
spellID = {
|
itemPrice = {
|
||||||
order = 6,
|
order = 6,
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
|
name = L["Item Price"],
|
||||||
|
desc = L["Display vendor sell value on item tooltips."],
|
||||||
|
set = function(info, value)
|
||||||
|
E.db.tooltip[info[getn(info)]] = value
|
||||||
|
E:GetModule("Tooltip_ItemPrice"):UpdateSettings()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
spellID = {
|
||||||
|
order = 7,
|
||||||
|
type = "toggle",
|
||||||
name = L["Spell/Item IDs"],
|
name = L["Spell/Item IDs"],
|
||||||
desc = L["Display the spell or item ID when mousing over a spell or item tooltip."]
|
desc = L["Display the spell or item ID when mousing over a spell or item tooltip."]
|
||||||
},
|
},
|
||||||
itemCount = {
|
itemCount = {
|
||||||
order = 7,
|
order = 8,
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Item Count"],
|
name = L["Item Count"],
|
||||||
desc = L["Display how many of a certain item you have in your possession."],
|
desc = L["Display how many of a certain item you have in your possession."],
|
||||||
@@ -82,14 +92,14 @@ E.Options.args.tooltip = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
colorAlpha = {
|
colorAlpha = {
|
||||||
order = 8,
|
order = 9,
|
||||||
type = "range",
|
type = "range",
|
||||||
name = OPACITY,
|
name = OPACITY,
|
||||||
isPercent = true,
|
isPercent = true,
|
||||||
min = 0, max = 1, step = 0.01
|
min = 0, max = 1, step = 0.01
|
||||||
},
|
},
|
||||||
fontGroup = {
|
fontGroup = {
|
||||||
order = 8,
|
order = 10,
|
||||||
type = "group",
|
type = "group",
|
||||||
guiInline = true,
|
guiInline = true,
|
||||||
name = L["Tooltip Font Settings"],
|
name = L["Tooltip Font Settings"],
|
||||||
@@ -148,7 +158,7 @@ E.Options.args.tooltip = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
factionColors = {
|
factionColors = {
|
||||||
order = 9,
|
order = 11,
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Custom Faction Colors"],
|
name = L["Custom Faction Colors"],
|
||||||
guiInline = true,
|
guiInline = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user