mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-03 20:20:01 +00:00
compat: initial layout of client abstraction api
This commit is contained in:
+7
-47
@@ -3,6 +3,10 @@ pfUI.api = { }
|
||||
-- load pfUI environment
|
||||
setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
-- Client API shortcuts
|
||||
gfind = string.gmatch or string.gfind
|
||||
mod = math.mod or mod
|
||||
|
||||
-- [ strsplit ]
|
||||
-- Splits a string using a delimiter.
|
||||
-- 'delimiter' [string] characters that will be interpreted as delimiter
|
||||
@@ -110,11 +114,11 @@ end
|
||||
-- 'f' [float] the number to breakdown.
|
||||
-- returns: [int],[float] whole and fractional part.
|
||||
function pfUI.api.modf(f)
|
||||
if math.modf then return math.modf(f) end
|
||||
if modf then return modf(f) end
|
||||
if f > 0 then
|
||||
return math.floor(f), math.mod(f,1)
|
||||
return math.floor(f), mod(f,1)
|
||||
end
|
||||
return math.ceil(f), math.mod(f,1)
|
||||
return math.ceil(f), mod(f,1)
|
||||
end
|
||||
|
||||
-- [ SanitizePattern ]
|
||||
@@ -283,47 +287,6 @@ do -- create a scope so we don't have to worry about upvalue collisions
|
||||
end
|
||||
end
|
||||
|
||||
-- [ hooksecurefunc ]
|
||||
-- Hooks a global function and injects custom code
|
||||
-- 'name' [string] name of the function that should be hooked
|
||||
-- 'func' [function] function containing the custom code
|
||||
-- 'append' [bool] optional variable, used to append custom
|
||||
-- code instead of prepending it
|
||||
function pfUI.api.hooksecurefunc(name, func, append)
|
||||
if not _G[name] then return end
|
||||
|
||||
pfUI.hooks[tostring(func)] = {}
|
||||
pfUI.hooks[tostring(func)]["old"] = _G[name]
|
||||
pfUI.hooks[tostring(func)]["new"] = func
|
||||
|
||||
if append then
|
||||
pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
end
|
||||
else
|
||||
pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
end
|
||||
end
|
||||
|
||||
_G[name] = pfUI.hooks[tostring(func)]["function"]
|
||||
end
|
||||
|
||||
-- [ HookScript ]
|
||||
-- Sets a function to be called automatically after the original function is called
|
||||
-- 'f' [frame] the frame that should get a function hook
|
||||
-- 'script' [string] the name of the function that should be hooked
|
||||
-- 'func' [function] the function that should run after the original one
|
||||
function pfUI.api.HookScript(f, script, func)
|
||||
local prev = f:GetScript(script)
|
||||
f:SetScript(script, function()
|
||||
if prev then prev() end
|
||||
func()
|
||||
end)
|
||||
end
|
||||
|
||||
-- [ HookAddonOrVariable ]
|
||||
-- Sets a function to be called automatically once an addon gets loaded
|
||||
-- 'addon' [string] addon or variable name
|
||||
@@ -903,6 +866,3 @@ function pfUI.api.GetColorGradient(perc)
|
||||
gradientcolors[perc].b,
|
||||
gradientcolors[perc].h
|
||||
end
|
||||
|
||||
-- [ shortcuts ]
|
||||
pfUI.api.gfind = string.gfind
|
||||
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
if pfUI.client < 20000 then return end
|
||||
|
||||
message("TBC compat module loaded. Good Luck!")
|
||||
|
||||
-- load pfUI environment
|
||||
setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
-- the "MiniMapTrackingFrame" is called "MiniMapTracking"
|
||||
pfUI.api.MiniMapTrackingFrame = _G.MiniMapTracking
|
||||
pfUI.api.UIOptionsFrame = _G.InterfaceOptionsFrame
|
||||
|
||||
-- tbc name of the friendlist button has changed
|
||||
for i=1, FRIENDS_TO_DISPLAY do
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextNameLocation"] = _G["FriendsFrameFriendButton"..i.."ButtonTextLocation"]
|
||||
end
|
||||
|
||||
-- gfind got replaced by gmatch
|
||||
pfUI.api.gfind = string.gmatch
|
||||
|
||||
-- blacklist pfUI functions
|
||||
pfUI.api.hooksecurefunc = _G.hooksecurefunc
|
||||
|
||||
-- tbc removed the offset of -1
|
||||
function pfUI.api.GetPlayerBuff(id, btype)
|
||||
return _G.GetPlayerBuff(id+1, btype)
|
||||
end
|
||||
|
||||
-- tbc uses a "Cooldown" frametype
|
||||
function pfUI.api.CreateFrame(f, n, p, t)
|
||||
if f == "Model" and t == "CooldownFrameTemplate" then
|
||||
return _G.CreateFrame("Cooldown", n, p, t)
|
||||
elseif f == "LootButton" then
|
||||
local ret = _G.CreateFrame("Button", n, p, t)
|
||||
ret.SetSlot = ret.SetID
|
||||
return ret
|
||||
else
|
||||
return _G.CreateFrame(f, n, p, t)
|
||||
end
|
||||
end
|
||||
|
||||
-- fake vanilla UnitBuff return values
|
||||
function pfUI.api.UnitBuff(unitstr, i)
|
||||
local name, rank, icon, count = _G.UnitBuff(unitstr, i)
|
||||
return icon, count
|
||||
end
|
||||
|
||||
-- fake vanilla UnitDebuff return values
|
||||
function pfUI.api.UnitDebuff(unitstr, i)
|
||||
local name, rank, texture, stacks, dtype, duration, timeLeft = _G.UnitDebuff(unitstr, i)
|
||||
return texture, stacks, dtype
|
||||
end
|
||||
|
||||
-- use native UnitDebuff instead of libdebuff emulation
|
||||
pfUI.api.libdebuff = {
|
||||
["UnitDebuff"] = function(self, unit, i)
|
||||
return _G.UnitDebuff(unit, i)
|
||||
end
|
||||
}
|
||||
|
||||
-- blacklist unrequired modules
|
||||
pfUI.module.autoshift = true
|
||||
pfUI.module.itemclick = true
|
||||
|
||||
-- the function GetContainerNumSlots returns numbers for keyrings in tbc
|
||||
function pfUI.api.GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag and not pfUI.bag.showKeyring then
|
||||
return 0
|
||||
else
|
||||
return _G.GetContainerNumSlots(bag)
|
||||
end
|
||||
end
|
||||
+15
-15
@@ -376,7 +376,7 @@ function pfUI.uf:UpdateConfig()
|
||||
f.buffs[i].stacks:SetShadowColor(0, 0, 0)
|
||||
f.buffs[i].stacks:SetShadowOffset(0.8, -0.8)
|
||||
f.buffs[i].stacks:SetTextColor(1,1,.5)
|
||||
f.buffs[i].cd = f.buffs[i].cd or CreateFrame("Model", nil, f.buffs[i])
|
||||
f.buffs[i].cd = f.buffs[i].cd or CreateFrame(COOLDOWN_FRAME_TYPE, nil, f.buffs[i])
|
||||
f.buffs[i].cd.pfCooldownType = "ALL"
|
||||
|
||||
f.buffs[i]:RegisterForClicks("RightButtonUp")
|
||||
@@ -403,7 +403,7 @@ function pfUI.uf:UpdateConfig()
|
||||
if f:GetName() == "pfPlayer" then
|
||||
f.buffs[i]:SetScript("OnUpdate", function()
|
||||
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .4 end
|
||||
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(this:GetID()-1,"HELPFUL"))
|
||||
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(PLAYER_BUFF_START_ID+this:GetID(),"HELPFUL"))
|
||||
CooldownFrame_SetTimer(this.cd, GetTime(), timeleft, 1)
|
||||
end)
|
||||
end
|
||||
@@ -414,13 +414,13 @@ function pfUI.uf:UpdateConfig()
|
||||
|
||||
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT")
|
||||
if parent.label == "player" then
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(id-1,"HELPFUL"))
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+id,"HELPFUL"))
|
||||
else
|
||||
GameTooltip:SetUnitBuff(parent.label .. parent.id, id)
|
||||
end
|
||||
|
||||
if IsShiftKeyDown() then
|
||||
local texture = parent.label == "player" and GetPlayerBuffTexture(GetPlayerBuff(id-1,"HELPFUL")) or UnitBuff(parent.label .. parent.id, id)
|
||||
local texture = parent.label == "player" and GetPlayerBuffTexture(GetPlayerBuff(PLAYER_BUFF_START_ID+id,"HELPFUL")) or UnitBuff(parent.label .. parent.id, id)
|
||||
|
||||
local playerlist = ""
|
||||
local first = true
|
||||
@@ -463,7 +463,7 @@ function pfUI.uf:UpdateConfig()
|
||||
|
||||
f.buffs[i]:SetScript("OnClick", function()
|
||||
if this:GetParent().label == "player" then
|
||||
CancelPlayerBuff(GetPlayerBuff(id-1,"HELPFUL"))
|
||||
CancelPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+id,"HELPFUL"))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -493,7 +493,7 @@ function pfUI.uf:UpdateConfig()
|
||||
f.debuffs[i].stacks:SetShadowColor(0, 0, 0)
|
||||
f.debuffs[i].stacks:SetShadowOffset(0.8, -0.8)
|
||||
f.debuffs[i].stacks:SetTextColor(1,1,.5)
|
||||
f.debuffs[i].cd = f.debuffs[i].cd or CreateFrame("Model", nil, f.debuffs[i])
|
||||
f.debuffs[i].cd = f.debuffs[i].cd or CreateFrame(COOLDOWN_FRAME_TYPE, nil, f.debuffs[i])
|
||||
f.debuffs[i].cd.pfCooldownType = "ALL"
|
||||
|
||||
f.debuffs[i]:RegisterForClicks("RightButtonUp")
|
||||
@@ -505,7 +505,7 @@ function pfUI.uf:UpdateConfig()
|
||||
if f:GetName() == "pfPlayer" then
|
||||
f.debuffs[i]:SetScript("OnUpdate", function()
|
||||
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .4 end
|
||||
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(this:GetID()-1,"HARMFUL"))
|
||||
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(PLAYER_BUFF_START_ID+this:GetID(),"HARMFUL"))
|
||||
CooldownFrame_SetTimer(this.cd, GetTime(), timeleft, 1)
|
||||
end)
|
||||
end
|
||||
@@ -514,7 +514,7 @@ function pfUI.uf:UpdateConfig()
|
||||
if not this:GetParent().label then return end
|
||||
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMRIGHT")
|
||||
if this:GetParent().label == "player" then
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(id-1,"HARMFUL"))
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+id,"HARMFUL"))
|
||||
else
|
||||
GameTooltip:SetUnitDebuff(this:GetParent().label .. this:GetParent().id, id)
|
||||
end
|
||||
@@ -526,7 +526,7 @@ function pfUI.uf:UpdateConfig()
|
||||
|
||||
f.debuffs[i]:SetScript("OnClick", function()
|
||||
if this:GetParent().label == "player" then
|
||||
CancelPlayerBuff(GetPlayerBuff(id-1,"HARMFUL"))
|
||||
CancelPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+id,"HARMFUL"))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -1061,8 +1061,8 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
for i=1, unit.config.bufflimit do
|
||||
local texture, stacks
|
||||
if unit.label == "player" then
|
||||
stacks = GetPlayerBuffApplications(GetPlayerBuff(i-1,"HELPFUL"))
|
||||
texture = GetPlayerBuffTexture(GetPlayerBuff(i-1,"HELPFUL"))
|
||||
stacks = GetPlayerBuffApplications(GetPlayerBuff(PLAYER_BUFF_START_ID+i,"HELPFUL"))
|
||||
texture = GetPlayerBuffTexture(GetPlayerBuff(PLAYER_BUFF_START_ID+i,"HELPFUL"))
|
||||
else
|
||||
texture, stacks = UnitBuff(unitstr, i)
|
||||
end
|
||||
@@ -1120,9 +1120,9 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
|
||||
local texture, stacks, dtype
|
||||
if unit.label == "player" then
|
||||
texture = GetPlayerBuffTexture(GetPlayerBuff(i-1, "HARMFUL"))
|
||||
stacks = GetPlayerBuffApplications(GetPlayerBuff(i-1, "HARMFUL"))
|
||||
dtype = GetPlayerBuffDispelType(GetPlayerBuff(i-1, "HARMFUL"))
|
||||
texture = GetPlayerBuffTexture(GetPlayerBuff(PLAYER_BUFF_START_ID+i, "HARMFUL"))
|
||||
stacks = GetPlayerBuffApplications(GetPlayerBuff(PLAYER_BUFF_START_ID+i, "HARMFUL"))
|
||||
dtype = GetPlayerBuffDispelType(GetPlayerBuff(PLAYER_BUFF_START_ID+i, "HARMFUL"))
|
||||
else
|
||||
texture, stacks, dtype = UnitDebuff(unitstr, i)
|
||||
end
|
||||
@@ -1143,7 +1143,7 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
unit.debuffs[i]:Show()
|
||||
|
||||
if unit:GetName() == "pfPlayer" then
|
||||
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(unit.debuffs[i]:GetID() - 1, "HARMFUL"),"HARMFUL")
|
||||
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(PLAYER_BUFF_START_ID+unit.debuffs[i]:GetID(), "HARMFUL"),"HARMFUL")
|
||||
CooldownFrame_SetTimer(unit.debuffs[i].cd, GetTime(), timeleft, 1)
|
||||
elseif libdebuff then
|
||||
local name, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff(unitstr, i)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
-- load pfUI environment
|
||||
setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
if pfUI.client < 20000 or pfUI.client > 20400 then return end
|
||||
DEFAULT_CHAT_FRAME:AddMessage("Compatibility Mode for |cff33ffccTBC |cffffff002.4.3|r has been loaded. Good Luck!")
|
||||
|
||||
-- blacklist unrequired modules
|
||||
pfUI.module.autoshift = true
|
||||
pfUI.module.itemclick = true
|
||||
|
||||
-- [[ Constants ]]--
|
||||
CASTBAR_EVENTS = { "UNIT_SPELLCAST_START", "UNIT_SPELLCAST_STOP",
|
||||
"UNIT_SPELLCAST_FAILED", "UNIT_SPELLCAST_INTERRUPTED",
|
||||
"UNIT_SPELLCAST_DELAYED", "UNIT_SPELLCAST_CHANNEL_START",
|
||||
"UNIT_SPELLCAST_CHANNEL_STOP", "UNIT_SPELLCAST_CHANNEL_UPDATE",
|
||||
"PLAYER_TARGET_CHANGED" }
|
||||
|
||||
NAMEPLATE_OBJECTORDER = { "border", "glow", "_", "_", "name", "level",
|
||||
"levelicon", "raidicon" }
|
||||
|
||||
NAMEPLATE_FRAMETYPE = "Frame"
|
||||
|
||||
MINIMAP_TRACKING_FRAME = _G.MiniMapTracking
|
||||
UI_OPTIONS_FRAME = _G.InterfaceOptionsFrame
|
||||
|
||||
FRIENDS_NAME_LOCATION = "ButtonTextLocation"
|
||||
|
||||
COOLDOWN_FRAME_TYPE = "Cooldown"
|
||||
LOOT_BUTTON_FRAME_TYPE = "Button"
|
||||
|
||||
PLAYER_BUFF_START_ID = 0
|
||||
|
||||
--[[ TBC API Extensions ]]--
|
||||
function UnitBuff(unitstr, i)
|
||||
-- fake return values to be vanilla alike
|
||||
local name, rank, icon, count = _G.UnitBuff(unitstr, i)
|
||||
return icon, count
|
||||
end
|
||||
|
||||
function UnitDebuff(unitstr, i)
|
||||
-- fake return values to be vanilla alike
|
||||
local name, rank, texture, stacks, dtype, duration, timeLeft = _G.UnitDebuff(unitstr, i)
|
||||
return texture, stacks, dtype
|
||||
end
|
||||
|
||||
-- the function GetContainerNumSlots returns numbers for keyrings in tbc
|
||||
function GetContainerNumSlots(bag)
|
||||
if bag == -2 and pfUI.bag and not pfUI.bag.showKeyring then
|
||||
return 0
|
||||
else
|
||||
return _G.GetContainerNumSlots(bag)
|
||||
end
|
||||
end
|
||||
|
||||
--[[ DEBUG ]]--
|
||||
function TargetByName()
|
||||
message("|cffff5555You shouldn't be here!|r TargetByName is blacklisted")
|
||||
message(debugstack())
|
||||
return
|
||||
end
|
||||
@@ -0,0 +1,56 @@
|
||||
-- load pfUI environment
|
||||
setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
if pfUI.client > 11200 then return end
|
||||
|
||||
-- [[ Constants ]]--
|
||||
CASTBAR_EVENTS = { "SPELLCAST_START", "SPELLCAST_STOP", "SPELLCAST_FAILED",
|
||||
"SPELLCAST_INTERRUPTED", "SPELLCAST_DELAYED", "SPELLCAST_CHANNEL_START",
|
||||
"SPELLCAST_CHANNEL_STOP", "SPELLCAST_CHANNEL_UPDATE",
|
||||
"PLAYER_TARGET_CHANGED" }
|
||||
|
||||
NAMEPLATE_OBJECTORDER = { "border", "glow", "name", "level", "levelicon",
|
||||
"raidicon" }
|
||||
|
||||
NAMEPLATE_FRAMETYPE = "Button"
|
||||
|
||||
MINIMAP_TRACKING_FRAME = _G.MiniMapTrackingFrame
|
||||
UI_OPTIONS_FRAME = _G.UIOptionsFrame
|
||||
|
||||
FRIENDS_NAME_LOCATION = "ButtonTextNameLocation"
|
||||
|
||||
COOLDOWN_FRAME_TYPE = "Model"
|
||||
LOOT_BUTTON_FRAME_TYPE = "LootButton"
|
||||
|
||||
PLAYER_BUFF_START_ID = -1
|
||||
|
||||
--[[ Vanilla API Extensions ]]--
|
||||
function hooksecurefunc(name, func, append)
|
||||
if not _G[name] then return end
|
||||
|
||||
pfUI.hooks[tostring(func)] = {}
|
||||
pfUI.hooks[tostring(func)]["old"] = _G[name]
|
||||
pfUI.hooks[tostring(func)]["new"] = func
|
||||
|
||||
if append then
|
||||
pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
end
|
||||
else
|
||||
pfUI.hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
pfUI.hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
end
|
||||
end
|
||||
|
||||
_G[name] = pfUI.hooks[tostring(func)]["function"]
|
||||
end
|
||||
|
||||
function HookScript(f, script, func)
|
||||
local prev = f:GetScript(script)
|
||||
f:SetScript(script, function()
|
||||
if prev then prev() end
|
||||
func()
|
||||
end)
|
||||
end
|
||||
+45
-45
@@ -31,31 +31,56 @@ if pfUI.api.libcast then return end
|
||||
local libcast = CreateFrame("Frame", "pfEnemyCast")
|
||||
local player = UnitName("player")
|
||||
|
||||
function libcast:GetCastInfo(unit)
|
||||
local db = self.db[unit]
|
||||
UnitChannelInfo = _G.UnitChannelInfo or function(unit)
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||
local db = libcast.db[unit]
|
||||
|
||||
-- clean legacy values
|
||||
if db and db.cast and db.start + db.delay + db.casttime / 1000 > GetTime() then
|
||||
return db.cast, db.start, db.casttime, db.icon, db.delay, db.channel
|
||||
if db and db.cast and db.start + db.casttime / 1000 > GetTime() then
|
||||
if not db.channel then return end
|
||||
cast = db.cast
|
||||
nameSubtext = ""
|
||||
text = ""
|
||||
texture = db.icon
|
||||
startTime = db.start * 1000
|
||||
endTime = startTime + db.casttime
|
||||
isTradeSkill = nil
|
||||
elseif db then
|
||||
-- remove cast action to the database
|
||||
self.db[unit].cast = nil
|
||||
self.db[unit].start = nil
|
||||
self.db[unit].casttime = nil
|
||||
self.db[unit].icon = nil
|
||||
self.db[unit].delay = nil
|
||||
self.db[unit].channel = nil
|
||||
db.cast = nil
|
||||
db.start = nil
|
||||
db.casttime = nil
|
||||
db.icon = nil
|
||||
db.channel = nil
|
||||
end
|
||||
|
||||
return nil, 0, 0, "", 0, nil
|
||||
return cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||
end
|
||||
|
||||
function libcast:RegisterEventFunc(func, frame)
|
||||
table.insert(self.frames, { func, frame })
|
||||
end
|
||||
UnitCastingInfo = _G.UnitCastingInfo or function(unit)
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||
local db = libcast.db[unit]
|
||||
|
||||
function libcast:TriggerEvents()
|
||||
for id, ft in pairs(self.frames) do ft[1](ft[2]) end
|
||||
-- clean legacy values
|
||||
if db and db.cast and db.start + db.casttime / 1000 > GetTime() then
|
||||
if db.channel then return end
|
||||
cast = db.cast
|
||||
nameSubtext = ""
|
||||
text = ""
|
||||
texture = db.icon
|
||||
startTime = db.start * 1000
|
||||
endTime = startTime + db.casttime
|
||||
isTradeSkill = nil
|
||||
elseif db then
|
||||
-- remove cast action to the database
|
||||
db.cast = nil
|
||||
db.start = nil
|
||||
db.casttime = nil
|
||||
db.icon = nil
|
||||
db.channel = nil
|
||||
end
|
||||
|
||||
return cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||
end
|
||||
|
||||
function libcast:AddAction(mob, spell, channel)
|
||||
@@ -69,10 +94,7 @@ function libcast:AddAction(mob, spell, channel)
|
||||
self.db[mob].start = GetTime()
|
||||
self.db[mob].casttime = casttime
|
||||
self.db[mob].icon = icon
|
||||
self.db[mob].delay = 0
|
||||
self.db[mob].channel = channel
|
||||
|
||||
self:TriggerEvents()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,10 +106,7 @@ function libcast:RemoveAction(mob, spell)
|
||||
self.db[mob].start = nil
|
||||
self.db[mob].casttime = nil
|
||||
self.db[mob].icon = nil
|
||||
self.db[mob].delay = nil
|
||||
self.db[mob].channel = nil
|
||||
|
||||
self:TriggerEvents()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,7 +124,6 @@ libcast.OTHER_SPELL_INTERRUPT = SanitizePattern(SPELLINTERRUPTOTHEROTHER)
|
||||
|
||||
-- main data
|
||||
libcast.db = { [player] = {} }
|
||||
libcast.frames = {}
|
||||
|
||||
-- environmental casts
|
||||
libcast:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE")
|
||||
@@ -140,19 +158,13 @@ libcast:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
libcast:SetScript("OnEvent", function()
|
||||
-- Fill database with player casts
|
||||
if event == "PLAYER_TARGET_CHANGED" then
|
||||
if not pfScanActive then
|
||||
this:TriggerEvents()
|
||||
end
|
||||
elseif event == "SPELLCAST_START" then
|
||||
if event == "SPELLCAST_START" then
|
||||
-- add cast action to the database
|
||||
this.db[player].cast = arg1
|
||||
this.db[player].start = GetTime()
|
||||
this.db[player].casttime = arg2
|
||||
this.db[player].icon = nil
|
||||
this.db[player].delay = 0
|
||||
this.db[player].channel = nil
|
||||
this:TriggerEvents()
|
||||
elseif event == "SPELLCAST_STOP" or event == "SPELLCAST_FAILED" or event == "SPELLCAST_INTERRUPTED" then
|
||||
if this.db[player] and not this.db[player].channel then
|
||||
-- remove cast action to the database
|
||||
@@ -160,14 +172,11 @@ libcast:SetScript("OnEvent", function()
|
||||
this.db[player].start = nil
|
||||
this.db[player].casttime = nil
|
||||
this.db[player].icon = nil
|
||||
this.db[player].delay = nil
|
||||
this.db[player].channel = nil
|
||||
this:TriggerEvents()
|
||||
end
|
||||
elseif event == "SPELLCAST_DELAYED" then
|
||||
if this.db[player].cast then
|
||||
this.db[player].delay = this.db[player].delay + arg1/1000
|
||||
this:TriggerEvents()
|
||||
this.db[player].start = this.db[player].start + arg1/1000
|
||||
end
|
||||
elseif event == "SPELLCAST_CHANNEL_START" then
|
||||
-- add cast action to the database
|
||||
@@ -175,9 +184,7 @@ libcast:SetScript("OnEvent", function()
|
||||
this.db[player].start = GetTime()
|
||||
this.db[player].casttime = arg1
|
||||
this.db[player].icon = nil
|
||||
this.db[player].delay = 0
|
||||
this.db[player].channel = true
|
||||
this:TriggerEvents()
|
||||
elseif event == "SPELLCAST_CHANNEL_STOP" then
|
||||
if this.db[player] and this.db[player].channel then
|
||||
-- remove cast action to the database
|
||||
@@ -185,13 +192,10 @@ libcast:SetScript("OnEvent", function()
|
||||
this.db[player].start = nil
|
||||
this.db[player].casttime = nil
|
||||
this.db[player].icon = nil
|
||||
this.db[player].delay = nil
|
||||
this.db[player].channel = nil
|
||||
this:TriggerEvents()
|
||||
end
|
||||
elseif event == "SPELLCAST_CHANNEL_UPDATE" then
|
||||
this.db[player].delay = this.db[player].delay + this.db[player].casttime / 1000 - this.db[player].delay + this.db[player].start - GetTime() - arg1 / 1000
|
||||
|
||||
this.db[player].start = this.db[player].start - arg1 / 1000
|
||||
-- Fill database with environmental casts
|
||||
elseif arg1 then
|
||||
-- (.+) begins to cast (.+).
|
||||
@@ -292,7 +296,6 @@ libcast.customcast[strlower(aimedshot)] = function(begin)
|
||||
libcast.db[player].start = start
|
||||
libcast.db[player].casttime = duration
|
||||
libcast.db[player].icon = icon
|
||||
libcast.db[player].delay = 0
|
||||
libcast.db[player].channel = nil
|
||||
libcast:TriggerEvents()
|
||||
else
|
||||
@@ -301,7 +304,6 @@ libcast.customcast[strlower(aimedshot)] = function(begin)
|
||||
libcast.db[player].start = nil
|
||||
libcast.db[player].casttime = nil
|
||||
libcast.db[player].icon = nil
|
||||
libcast.db[player].delay = nil
|
||||
libcast.db[player].channel = nil
|
||||
libcast:TriggerEvents()
|
||||
end
|
||||
@@ -318,7 +320,6 @@ libcast.customcast[strlower(multishot)] = function(begin)
|
||||
libcast.db[player].start = start
|
||||
libcast.db[player].casttime = duration
|
||||
libcast.db[player].icon = icon
|
||||
libcast.db[player].delay = 0
|
||||
libcast.db[player].channel = nil
|
||||
libcast:TriggerEvents()
|
||||
else
|
||||
@@ -327,14 +328,13 @@ libcast.customcast[strlower(multishot)] = function(begin)
|
||||
libcast.db[player].start = nil
|
||||
libcast.db[player].casttime = nil
|
||||
libcast.db[player].icon = nil
|
||||
libcast.db[player].delay = nil
|
||||
libcast.db[player].channel = nil
|
||||
libcast:TriggerEvents()
|
||||
end
|
||||
end
|
||||
|
||||
local function CastCustom(spell)
|
||||
if not libcast:GetCastInfo(UnitName("player")) then
|
||||
if not UnitCastingInfo(UnitName("player")) then
|
||||
for custom, func in pairs(libcast.customcast) do
|
||||
if strfind(strlower(spell), custom) or strlower(spell) == custom then
|
||||
func(true)
|
||||
|
||||
@@ -12,6 +12,7 @@ setfenv(1, pfUI:GetEnvironment())
|
||||
|
||||
-- return instantly when another libdebuff is already active
|
||||
if pfUI.api.libdebuff then return end
|
||||
if pfUI.client >= 20000 then return end
|
||||
|
||||
local libdebuff = CreateFrame("Frame", "pfdebuffsScanner", UIParent)
|
||||
local scanner = libtipscan:GetScanner("libdebuff")
|
||||
|
||||
+1
-1
@@ -318,7 +318,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
if tpl == "BankItemButtonGenericTemplate" then
|
||||
local bankslot = pfUI.bags[bag].slots[slot].frame
|
||||
local name = "pfBag" .. bag .. "item" .. slot .. "Cooldown"
|
||||
bankslot.cd = CreateFrame("Model", name, bankslot, "CooldownFrameTemplate")
|
||||
bankslot.cd = CreateFrame(COOLDOWN_FRAME_TYPE, name, bankslot, "CooldownFrameTemplate")
|
||||
bankslot.cd:SetAllPoints(bankslot)
|
||||
bankslot.cd.pfCooldownType = "ALL"
|
||||
else
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ pfUI:RegisterModule("buff", function ()
|
||||
else
|
||||
buff.id = buff.gid
|
||||
end
|
||||
buff.bid = GetPlayerBuff(buff.id-1, buff.btype)
|
||||
buff.bid = GetPlayerBuff(PLAYER_BUFF_START_ID+buff.id, buff.btype)
|
||||
|
||||
--detect weapon buffs
|
||||
if buff.btype == "HELPFUL" and ((C.buffs.separateweapons == "0" and buff.gid <= pfUI.buff.wepbuffs.count) or (pfUI.buff.wepbuffs.count > 0 and buff.weapon ~= nil)) then
|
||||
@@ -203,7 +203,7 @@ pfUI:RegisterModule("buff", function ()
|
||||
local offset = (mh and 1 or 0) + (oh and 1 or 0)
|
||||
|
||||
for i=1,32 do
|
||||
local bid, untilCancelled = GetPlayerBuff(i-1, "HELPFUL")
|
||||
local bid, untilCancelled = GetPlayerBuff(PLAYER_BUFF_START_ID+i, "HELPFUL")
|
||||
if bid < 0 then
|
||||
return i - 1 + offset
|
||||
end
|
||||
|
||||
@@ -31,13 +31,13 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
local counter = 1
|
||||
local l = string.len(text)
|
||||
for i = 1, l, 3 do
|
||||
counter = math.mod(counter*8161, 4294967279) + (string.byte(text,i)*16776193) + ((string.byte(text,i+1) or (l-i+256))*8372226) + ((string.byte(text,i+2) or (l-i+256))*3932164)
|
||||
counter = mod(counter*8161, 4294967279) + (string.byte(text,i)*16776193) + ((string.byte(text,i+1) or (l-i+256))*8372226) + ((string.byte(text,i+2) or (l-i+256))*3932164)
|
||||
end
|
||||
counter = math.mod(8161, 4294967279) + (string.byte(text,l)*16776193) + ((string.byte(text,l+1) or (l-l+256))*8372226) + ((string.byte(text,l+2) or (l+256))*3932164)
|
||||
counter = mod(8161, 4294967279) + (string.byte(text,l)*16776193) + ((string.byte(text,l+1) or (l-l+256))*8372226) + ((string.byte(text,l+2) or (l+256))*3932164)
|
||||
|
||||
local hash = math.mod(math.mod(counter, 4294967291),16777216)
|
||||
local r = (hash - (math.mod(hash,65536))) / 65536
|
||||
local g = ((hash - r*65536) - ( math.mod((hash - r*65536),256)) ) / 256
|
||||
local hash = mod(mod(counter, 4294967291),16777216)
|
||||
local r = (hash - (mod(hash,65536))) / 65536
|
||||
local g = ((hash - r*65536) - ( mod((hash - r*65536),256)) ) / 256
|
||||
local b = hash - r*65536 - g*256
|
||||
rgbcache[text] = { r / 255, g / 255, b / 255 }
|
||||
return unpack(rgbcache[text])
|
||||
@@ -58,7 +58,7 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
|
||||
local function GetBuffData(unit, id, type, skipTooltip)
|
||||
if unit == "player" then
|
||||
local bid = GetPlayerBuff(id-1, type)
|
||||
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID+id, type)
|
||||
local remaining = GetPlayerBuffTimeLeft(bid)
|
||||
local texture = GetPlayerBuffTexture(bid)
|
||||
local name
|
||||
@@ -93,7 +93,7 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. skill .. "|r" .. T["is now blacklisted."])
|
||||
end
|
||||
elseif this.parent.unit == "player" then
|
||||
CancelPlayerBuff(GetPlayerBuff(this.id-1,this.type))
|
||||
CancelPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,this.type))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
GameTooltip:SetOwner(this, "NONE")
|
||||
|
||||
if this.unit == "player" then
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(this.id-1,this.type))
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,this.type))
|
||||
elseif this.type == "HARMFUL" then
|
||||
GameTooltip:SetUnitDebuff(this.unit, this.id)
|
||||
elseif this.type == "HELPFUL" then
|
||||
@@ -428,4 +428,4 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
pfUI.uf.target.debuffbar:SetPoint("BOTTOM", pfUI.uf.target, "TOP", 0, border*2+1)
|
||||
UpdateMovable(pfUI.uf.target.debuffbar)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
+41
-27
@@ -19,8 +19,6 @@ pfUI:RegisterModule("castbar", function ()
|
||||
cb.unitstr = unitstr
|
||||
cb.unitname = unitname
|
||||
|
||||
cb.delay = 0
|
||||
|
||||
-- statusbar
|
||||
cb.bar = CreateFrame("StatusBar", nil, cb)
|
||||
cb.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar")
|
||||
@@ -77,18 +75,23 @@ pfUI:RegisterModule("castbar", function ()
|
||||
return
|
||||
end
|
||||
|
||||
local spellname, start, duration, icon, delay, channel = libcast:GetCastInfo(name)
|
||||
if spellname then
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name)
|
||||
if cast then
|
||||
local duration = endTime - startTime
|
||||
local max = duration / 1000
|
||||
local cur = channel and duration / 1000 - delay + start - GetTime() or
|
||||
GetTime() - start - delay
|
||||
local cur = GetTime() - startTime / 1000
|
||||
|
||||
if UnitChannelInfo(name) then
|
||||
cur = duration + startTime / 1000 - GetTime() -- channel
|
||||
end
|
||||
|
||||
cur = cur > max and max or cur
|
||||
cur = cur < 0 and 0 or cur
|
||||
|
||||
this.bar:SetValue(cur)
|
||||
|
||||
if delay > 0 then
|
||||
delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(delay,1) .. " |r "
|
||||
if this.delay and this.delay > 0 then
|
||||
local delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(this.delay,1) .. " |r "
|
||||
this.bar.right:SetText(delay .. string.format("%.1f",cur) .. " / " .. round(max,1))
|
||||
else
|
||||
this.bar.right:SetText(string.format("%.1f",cur) .. " / " .. round(max,1))
|
||||
@@ -102,27 +105,38 @@ pfUI:RegisterModule("castbar", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
function cb.OnEvent(self)
|
||||
local name = self.unitstr and UnitName(self.unitstr) or self.unitname
|
||||
|
||||
local spellname, start, casttime, icon, delay, channel = libcast:GetCastInfo(name)
|
||||
if spellname then
|
||||
self.bar:SetStatusBarColor(strsplit(",", C.appearance.castbar[(channel and "channelcolor" or "castbarcolor")]))
|
||||
self.bar:SetMinMaxValues(0, casttime / 1000)
|
||||
self.bar.left:SetText(spellname)
|
||||
|
||||
self:SetAlpha(1)
|
||||
self:Show()
|
||||
self.fadeout = nil
|
||||
self.playername = name
|
||||
else
|
||||
self.bar:SetMinMaxValues(1,100)
|
||||
self.bar:SetValue(100)
|
||||
self.fadeout = 1
|
||||
end
|
||||
-- register for all castbar events
|
||||
for _, event in pairs(CASTBAR_EVENTS) do
|
||||
cb:RegisterEvent(event)
|
||||
end
|
||||
|
||||
libcast:RegisterEventFunc(cb.OnEvent, cb)
|
||||
cb:SetScript("OnEvent", function()
|
||||
if strfind(event, "DELAYED") then
|
||||
this.delay = ( this.delay or 0 ) + arg1/1000
|
||||
end
|
||||
|
||||
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
||||
if not name then return end
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name)
|
||||
local channel = UnitChannelInfo(name)
|
||||
|
||||
if cast then
|
||||
local duration = endTime - startTime
|
||||
this.bar:SetStatusBarColor(strsplit(",", C.appearance.castbar[(channel and "channelcolor" or "castbarcolor")]))
|
||||
this.bar:SetMinMaxValues(0, duration / 1000)
|
||||
this.bar.left:SetText(cast)
|
||||
|
||||
this:SetAlpha(1)
|
||||
this:Show()
|
||||
this.fadeout = nil
|
||||
else
|
||||
this.bar:SetMinMaxValues(1,100)
|
||||
this.bar:SetValue(100)
|
||||
this.delay = 0
|
||||
this.fadeout = 1
|
||||
end
|
||||
end)
|
||||
|
||||
return cb
|
||||
end
|
||||
|
||||
|
||||
@@ -174,6 +174,11 @@ pfUI:RegisterModule("eqcompare", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- add HookScript method if not already existing
|
||||
GameTooltip.HookScript = GameTooltip.HookScript or HookScript
|
||||
ShoppingTooltip1.HookScript = ShoppingTooltip1.HookScript or HookScript
|
||||
ShoppingTooltip2.HookScript = ShoppingTooltip2.HookScript or HookScript
|
||||
|
||||
pfUI.eqcompare.ShoppingTooltipShow = function()
|
||||
-- abort if no comparison tooltip has been set
|
||||
if not pfUI.eqcompare.tooltip then return end
|
||||
@@ -184,9 +189,9 @@ pfUI:RegisterModule("eqcompare", function ()
|
||||
end
|
||||
|
||||
-- Add Gametooltip Hooks
|
||||
HookScript(GameTooltip, "OnShow", pfUI.eqcompare.GameTooltipShow)
|
||||
GameTooltip:HookScript("OnShow", pfUI.eqcompare.GameTooltipShow)
|
||||
if C.tooltip.compare.basestats == "1" then
|
||||
HookScript(ShoppingTooltip1, "OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
HookScript(ShoppingTooltip2, "OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
ShoppingTooltip1:HookScript("OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
ShoppingTooltip2:HookScript("OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
end
|
||||
end)
|
||||
|
||||
+1
-1
@@ -502,7 +502,7 @@ pfUI:RegisterModule("loot", function ()
|
||||
end
|
||||
|
||||
function pfUI.loot:CreateSlot(id)
|
||||
local frame = CreateFrame("LootButton", 'pfLootButton'..id, pfUI.loot)
|
||||
local frame = CreateFrame(LOOT_BUTTON_FRAME_TYPE, 'pfLootButton'..id, pfUI.loot)
|
||||
frame:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
frame:SetPoint("LEFT", C.appearance.border.default*2, 0)
|
||||
frame:SetPoint("RIGHT", -C.appearance.border.default*2, 0)
|
||||
|
||||
@@ -114,7 +114,7 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
if (j < numTexturesVert) then
|
||||
texturePixelHeight,textureFileHeight = 256,256
|
||||
else
|
||||
texturePixelHeight = math.mod(textureHeight, 256)
|
||||
texturePixelHeight = mod(textureHeight, 256)
|
||||
if (texturePixelHeight == 0) then texturePixelHeight = 256 end
|
||||
textureFileHeight = 16
|
||||
while (textureFileHeight < texturePixelHeight) do
|
||||
@@ -129,7 +129,7 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
if (k < numTexturesHorz) then
|
||||
texturePixelWidth, textureFileWidth = 256,256
|
||||
else
|
||||
texturePixelWidth = math.mod(textureWidth, 256)
|
||||
texturePixelWidth = mod(textureWidth, 256)
|
||||
if (texturePixelWidth == 0) then texturePixelWidth = 256 end
|
||||
textureFileWidth = 16
|
||||
while (textureFileWidth < texturePixelWidth) do
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ pfUI:RegisterModule("minimap", function ()
|
||||
this.highlight:Show()
|
||||
end)
|
||||
|
||||
MiniMapTrackingFrame:SetFrameStrata("LOW")
|
||||
MINIMAP_TRACKING_FRAME:SetFrameStrata("LOW")
|
||||
|
||||
-- Create coordinates text frame with location configurable
|
||||
pfUI.minimapCoordinates = CreateFrame("Frame", "pfMinimapCoord", pfUI.minimap)
|
||||
|
||||
+22
-13
@@ -19,10 +19,9 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
pfUI.nameplates.scanner.parentCount = parentCount
|
||||
|
||||
for _, nameplate in ipairs({WorldFrame:GetChildren()}) do
|
||||
if not nameplate.done and nameplate:GetObjectType() == "Button" then
|
||||
if not nameplate.done and nameplate:GetObjectType() == NAMEPLATE_FRAMETYPE then
|
||||
local regions = nameplate:GetRegions()
|
||||
if regions and regions:GetObjectType() == "Texture" and regions:GetTexture() == "Interface\\Tooltips\\Nameplate-Border" then
|
||||
|
||||
local visible = nameplate:IsVisible()
|
||||
nameplate:Hide()
|
||||
nameplate:SetScript("OnShow", pfUI.nameplates.OnShow)
|
||||
@@ -83,7 +82,16 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
this.nameplate.parent = this
|
||||
this.healthbar = this:GetChildren()
|
||||
this.healthbar:SetScript("OnEnter", function() return nil end)
|
||||
this.border, this.glow, this.name, this.level, this.levelicon , this.raidicon = this:GetRegions()
|
||||
|
||||
for i, frame in pairs({this:GetRegions()}) do
|
||||
if NAMEPLATE_OBJECTORDER[i] == "_" then
|
||||
frame.Show = function() return end
|
||||
frame:Hide()
|
||||
else
|
||||
this[NAMEPLATE_OBJECTORDER[i]] = frame
|
||||
end
|
||||
end
|
||||
|
||||
this.healthbar:SetParent(this.nameplate)
|
||||
this.border:SetParent(this.nameplate)
|
||||
this.glow:SetParent(this.nameplate)
|
||||
@@ -120,7 +128,7 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
|
||||
-- add click handlers
|
||||
if C.nameplates["clickthrough"] == "0" then
|
||||
if C.nameplates["legacy"] == "0" then
|
||||
if C.nameplates["legacy"] == "0" and pfUI.client < 20000 then
|
||||
this.nameplate:SetScript("OnClick", function() this.parent:Click() end)
|
||||
else
|
||||
this.nameplate:EnableMouse(false)
|
||||
@@ -589,16 +597,17 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
|
||||
-- show castbar
|
||||
if healthbar.castbar and pfUI.castbar and C.nameplates["showcastbar"] == "1" then
|
||||
local spellname, start, casttime, icon = libcast:GetCastInfo(unitname)
|
||||
casttime = casttime / 1000
|
||||
if not spellname then
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(unitname)
|
||||
|
||||
if not cast then
|
||||
healthbar.castbar:Hide()
|
||||
else
|
||||
healthbar.castbar:SetMinMaxValues(0, casttime)
|
||||
healthbar.castbar:SetValue(GetTime() - start)
|
||||
healthbar.castbar.text:SetText(round(start + casttime - GetTime(),1))
|
||||
local duration = endTime - startTime
|
||||
healthbar.castbar:SetMinMaxValues(0, duration/1000)
|
||||
healthbar.castbar:SetValue(GetTime() - startTime/1000)
|
||||
healthbar.castbar.text:SetText(round(startTime/1000 + duration/1000 - GetTime(),1))
|
||||
if C.nameplates.spellname == "1" and healthbar.castbar.spell then
|
||||
healthbar.castbar.spell:SetText(spellname)
|
||||
healthbar.castbar.spell:SetText(cast)
|
||||
else
|
||||
healthbar.castbar.spell:SetText("")
|
||||
end
|
||||
@@ -608,7 +617,7 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
end
|
||||
|
||||
if icon then
|
||||
healthbar.castbar.icon:SetTexture("Interface\\Icons\\" .. icon)
|
||||
healthbar.castbar.icon:SetTexture("Interface\\Icons\\" .. texture)
|
||||
healthbar.castbar.icon:SetTexCoord(.1,.9,.1,.9)
|
||||
end
|
||||
end
|
||||
@@ -634,7 +643,7 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
this.debuffs[j].icon:SetTexCoord(.078, .92, .079, .937)
|
||||
|
||||
if icon then
|
||||
this.debuffs[j].cd = this.debuffs[j].cd or CreateFrame("Model", nil, this.debuffs[j], "CooldownFrameTemplate")
|
||||
this.debuffs[j].cd = this.debuffs[j].cd or CreateFrame(COOLDOWN_FRAME_TYPE, nil, this.debuffs[j], "CooldownFrameTemplate")
|
||||
this.debuffs[j].cd.pfCooldownType = "ALL"
|
||||
|
||||
local name, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff("target", j)
|
||||
|
||||
+2
-2
@@ -178,10 +178,10 @@ pfUI:RegisterModule("share", function ()
|
||||
bit_pattern = bit_pattern .. bin_bits
|
||||
end
|
||||
|
||||
if math.mod(string.len(bit_pattern), 3) == 2 then
|
||||
if mod(string.len(bit_pattern), 3) == 2 then
|
||||
trailing = '=='
|
||||
bit_pattern = bit_pattern .. '0000000000000000'
|
||||
elseif math.mod(string.len(bit_pattern), 3) == 1 then
|
||||
elseif mod(string.len(bit_pattern), 3) == 1 then
|
||||
trailing = '='
|
||||
bit_pattern = bit_pattern .. '00000000'
|
||||
end
|
||||
|
||||
+8
-8
@@ -161,7 +161,7 @@ pfUI:RegisterModule("skin", function ()
|
||||
end
|
||||
end
|
||||
|
||||
UIOptionsFrame:SetScript("OnShow", function()
|
||||
UI_OPTIONS_FRAME:SetScript("OnShow", function()
|
||||
-- default events
|
||||
UIOptionsFrame_Load();
|
||||
MultiActionBar_Update();
|
||||
@@ -172,15 +172,15 @@ pfUI:RegisterModule("skin", function ()
|
||||
-- customize
|
||||
UIOptionsBlackground:Hide()
|
||||
|
||||
UIOptionsFrame:SetMovable(true)
|
||||
UIOptionsFrame:EnableMouse(true)
|
||||
UIOptionsFrame:SetScale(.8)
|
||||
UIOptionsFrame:SetScript("OnMouseDown",function()
|
||||
UIOptionsFrame:StartMoving()
|
||||
UI_OPTIONS_FRAME:SetMovable(true)
|
||||
UI_OPTIONS_FRAME:EnableMouse(true)
|
||||
UI_OPTIONS_FRAME:SetScale(.8)
|
||||
UI_OPTIONS_FRAME:SetScript("OnMouseDown",function()
|
||||
UI_OPTIONS_FRAME:StartMoving()
|
||||
end)
|
||||
|
||||
UIOptionsFrame:SetScript("OnMouseUp",function()
|
||||
UIOptionsFrame:StopMovingOrSizing()
|
||||
UI_OPTIONS_FRAME:SetScript("OnMouseUp",function()
|
||||
UI_OPTIONS_FRAME:StopMovingOrSizing()
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -56,11 +56,11 @@ pfUI:RegisterModule("socialmod", function ()
|
||||
zone = ( zone == playerzone and "|cffffffff" or "|cffaaaaaa" ) .. zone .. "|r"
|
||||
name = "|cff" .. string.format("%02x%02x%02x", ccolor.r*255, ccolor.g*255, ccolor.b*255) .. name .. "|r"
|
||||
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextNameLocation"]:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), name, zone, status))
|
||||
_G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION]:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), name, zone, status))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetText(format(TEXT(FRIENDS_LEVEL_TEMPLATE), level, class))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetTextColor(lcolor.r + .2, lcolor.g + .2, lcolor.b + .2)
|
||||
else
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextNameLocation"]:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), name))
|
||||
_G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION]:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), name))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetText(TEXT(UNKNOWN))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetTextColor(.2,.2,.2)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pfUI:RegisterModule("tracking", function ()
|
||||
|
||||
MiniMapTrackingFrame:UnregisterAllEvents()
|
||||
MiniMapTrackingFrame:Hide()
|
||||
MINIMAP_TRACKING_FRAME:UnregisterAllEvents()
|
||||
MINIMAP_TRACKING_FRAME:Hide()
|
||||
|
||||
local function HasEntries(tbl)
|
||||
for _ in pairs(tbl) do
|
||||
|
||||
Reference in New Issue
Block a user