mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-16 18:00:48 +00:00
compat: initial layout of client abstraction api
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user