mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-06 21:50:00 +00:00
compat: make hooksecurefunc append by default
This commit is contained in:
+5
-5
@@ -34,9 +34,9 @@ ACTIONBAR_SECURE_TEMPLATE_BUTTON = nil
|
||||
UNITFRAME_SECURE_TEMPLATE = nil
|
||||
|
||||
--[[ Vanilla API Extensions ]]--
|
||||
function hooksecurefunc(tbl, name, func, append)
|
||||
function hooksecurefunc(tbl, name, func, prepend)
|
||||
if type(tbl) == "string" then
|
||||
append, func, name, tbl = func, name, tbl, _G
|
||||
prepend, func, name, tbl = func, name, tbl, _G
|
||||
end
|
||||
|
||||
if not tbl or not tbl[name] then return end
|
||||
@@ -45,15 +45,15 @@ function hooksecurefunc(tbl, name, func, append)
|
||||
pfUI.hooks[tostring(func)]["old"] = tbl[name]
|
||||
pfUI.hooks[tostring(func)]["new"] = func
|
||||
|
||||
if append then
|
||||
if prepend 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)
|
||||
pfUI.hooks[tostring(func)]["old"](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)
|
||||
pfUI.hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+4
-4
@@ -395,17 +395,17 @@ hooksecurefunc("CastSpell", function(id, bookType)
|
||||
local cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime, _, _, cachedSpellId, cachedBookType = libspell.GetSpellInfo(id, bookType)
|
||||
|
||||
CastCustom(cachedSpellId, cachedBookType, cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime)
|
||||
end, true)
|
||||
end)
|
||||
|
||||
hooksecurefunc("CastSpellByName", function(spellCasted, target)
|
||||
local cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime, _, _, cachedSpellId, cachedBookType = libspell.GetSpellInfo(spellCasted)
|
||||
|
||||
CastCustom(cachedSpellId, cachedBookType, cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime)
|
||||
end, true)
|
||||
end)
|
||||
|
||||
hooksecurefunc("UseAction", function(slot, target, button)
|
||||
if GetActionText(slot) or not IsCurrentAction(slot) then return end
|
||||
|
||||
|
||||
scanner:SetAction(slot)
|
||||
local rawSpellName, rank = scanner:Line(1)
|
||||
if not rawSpellName then return end -- ignore if the spell is not found
|
||||
@@ -413,7 +413,7 @@ hooksecurefunc("UseAction", function(slot, target, button)
|
||||
local cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime, _, _, cachedSpellId, cachedBookType = libspell.GetSpellInfo(rawSpellName .. (rank and ("(" .. rank .. ")") or ""))
|
||||
|
||||
CastCustom(cachedSpellId, cachedBookType, cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime)
|
||||
end, true)
|
||||
end)
|
||||
|
||||
-- add libcast to pfUI API
|
||||
pfUI.api.libcast = libcast
|
||||
|
||||
+3
-3
@@ -236,13 +236,13 @@ hooksecurefunc("CastSpell", function(id, bookType)
|
||||
local rawEffect, rank = libspell.GetSpellInfo(id, bookType)
|
||||
local duration = libdebuff:GetDuration(rawEffect, rank)
|
||||
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration, "player")
|
||||
end, true)
|
||||
end)
|
||||
|
||||
hooksecurefunc("CastSpellByName", function(effect, target)
|
||||
local rawEffect, rank = libspell.GetSpellInfo(effect)
|
||||
local duration = libdebuff:GetDuration(rawEffect, rank)
|
||||
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration, "player")
|
||||
end, true)
|
||||
end)
|
||||
|
||||
hooksecurefunc("UseAction", function(slot, target, button)
|
||||
if GetActionText(slot) or not IsCurrentAction(slot) then return end
|
||||
@@ -250,7 +250,7 @@ hooksecurefunc("UseAction", function(slot, target, button)
|
||||
local rawEffect, rank = scanner:Line(1)
|
||||
local duration = libdebuff:GetDuration(rawEffect, rank)
|
||||
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration, "player")
|
||||
end, true)
|
||||
end)
|
||||
|
||||
function libdebuff:UnitDebuff(unit, id)
|
||||
local unitname = UnitName(unit)
|
||||
|
||||
+3
-3
@@ -397,7 +397,7 @@ hooksecurefunc("CastSpell", function(id, bookType)
|
||||
spell_queue[1] = effect
|
||||
spell_queue[2] = effect.. ( rank or "" )
|
||||
spell_queue[3] = UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player")
|
||||
end, true)
|
||||
end)
|
||||
|
||||
hooksecurefunc("CastSpellByName", function(effect, target)
|
||||
if not libpredict.sender.enabled then return end
|
||||
@@ -414,7 +414,7 @@ hooksecurefunc("CastSpellByName", function(effect, target)
|
||||
spell_queue[1] = effect
|
||||
spell_queue[2] = effect.. ( rank or "" )
|
||||
spell_queue[3] = target or mouseover or default
|
||||
end, true)
|
||||
end)
|
||||
|
||||
local scanner = libtipscan:GetScanner("prediction")
|
||||
hooksecurefunc("UseAction", function(slot, target, selfcast)
|
||||
@@ -426,7 +426,7 @@ hooksecurefunc("UseAction", function(slot, target, selfcast)
|
||||
spell_queue[1] = effect
|
||||
spell_queue[2] = effect.. ( rank or "" )
|
||||
spell_queue[3] = selfcast and UnitName("player") or UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player")
|
||||
end, true)
|
||||
end)
|
||||
|
||||
libpredict.sender = CreateFrame("Frame", "pfPredictionSender", UIParent)
|
||||
libpredict.sender.enabled = true
|
||||
|
||||
+3
-3
@@ -158,13 +158,13 @@ hooksecurefunc("CastSpell", function(id, bookType)
|
||||
local name, rank, icon = libspell.GetSpellInfo(id, bookType)
|
||||
if not name then return end
|
||||
if libtotem:CheckAddQueue(name, rank, icon) then return end
|
||||
end, true)
|
||||
end)
|
||||
|
||||
hooksecurefunc("CastSpellByName", function(effect, target)
|
||||
local name, rank, icon = libspell.GetSpellInfo(effect)
|
||||
if not name then return end
|
||||
if libtotem:CheckAddQueue(name, rank, icon) then return end
|
||||
end, true)
|
||||
end)
|
||||
|
||||
local scanner = libtipscan:GetScanner("prediction")
|
||||
hooksecurefunc("UseAction", function(slot, target, selfcast)
|
||||
@@ -174,4 +174,4 @@ hooksecurefunc("UseAction", function(slot, target, selfcast)
|
||||
local icon = GetActionTexture(slot)
|
||||
if not name then return end
|
||||
if libtotem:CheckAddQueue(name, rank, icon) then return end
|
||||
end, true)
|
||||
end)
|
||||
|
||||
+1
-1
@@ -426,7 +426,7 @@ pfUI:RegisterModule("loot", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
end
|
||||
end,true)
|
||||
end)
|
||||
else
|
||||
pfUI.loot:RemoveMasterlootMenus()
|
||||
UIDropDownMenu_Initialize(GroupLootDropDown, GroupLootDropDown_Initialize, "MENU")
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ pfUI:RegisterModule("minimap", "vanilla:tbc", function ()
|
||||
pfUI.minimap:SetAlpha(0)
|
||||
Minimap:Hide()
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
|
||||
-- battleground icon
|
||||
MiniMapBattlefieldFrame:ClearAllPoints()
|
||||
|
||||
@@ -66,7 +66,7 @@ pfUI:RegisterModule("socialmod", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
end
|
||||
|
||||
do -- add colors to friend list
|
||||
@@ -119,7 +119,7 @@ pfUI:RegisterModule("socialmod", "vanilla:tbc", function ()
|
||||
friendInfo:SetVertexColor(1,1,1,.4)
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
end
|
||||
|
||||
do -- add colors to who list
|
||||
@@ -193,6 +193,6 @@ pfUI:RegisterModule("socialmod", "vanilla:tbc", function ()
|
||||
local color = GetDifficultyColor(level)
|
||||
_G["WhoFrameButton"..i.."Level"]:SetTextColor(color.r, color.g, color.b)
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -536,7 +536,7 @@ pfUI:RegisterModule("thirdparty-vanilla", "vanilla", function()
|
||||
local colorstr = rgbhex(RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b, RAID_CLASS_COLORS[class].a)
|
||||
_G.WIM_ClassColors[wimclass] = gsub(colorstr, "^|cff", "")
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
|
||||
-- convo menu
|
||||
CreateBackdrop(WIM_Icon_ToolTip, 0, nil, tonumber(C.tooltip.alpha))
|
||||
@@ -560,7 +560,7 @@ pfUI:RegisterModule("thirdparty-vanilla", "vanilla", function()
|
||||
btn:SetText(btn_txt)
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
|
||||
if WIM_HistoryFrame then -- history frame
|
||||
CreateBackdrop(WIM_HistoryFrame, nil, nil, .8)
|
||||
|
||||
@@ -304,7 +304,7 @@ pfUI:RegisterModule("turtle-wow", "vanilla", function ()
|
||||
|
||||
-- only run once
|
||||
initialized = true
|
||||
end, true)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ pfUI:RegisterSkin("Auctionhouse", "vanilla:tbc", function ()
|
||||
hooksecurefunc("AuctionFrame_OnShow", function()
|
||||
AuctionFrame:ClearAllPoints()
|
||||
AuctionFrame:SetPoint("TOPLEFT", 10, -104)
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
StripTextures(AuctionFrame, true)
|
||||
CreateBackdrop(AuctionFrame, nil, nil, .75)
|
||||
@@ -80,7 +80,7 @@ pfUI:RegisterSkin("Auctionhouse", "vanilla:tbc", function ()
|
||||
for i = 1, NUM_BROWSE_TO_DISPLAY do
|
||||
HandleIcon(_G["BrowseButton"..i.."Item"], _G["BrowseButton"..i.."ItemIconTexture"])
|
||||
end
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
SkinArrowButton(BrowsePrevPageButton, "left", 18)
|
||||
SkinArrowButton(BrowseNextPageButton, "right", 18)
|
||||
@@ -149,7 +149,7 @@ pfUI:RegisterSkin("Auctionhouse", "vanilla:tbc", function ()
|
||||
for i = 1, NUM_BIDS_TO_DISPLAY do
|
||||
HandleIcon(_G["BidButton"..i.."Item"], _G["BidButton"..i.."ItemIconTexture"])
|
||||
end
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
SkinMoneyInputFrame(BidBidPrice)
|
||||
BidBidPrice:ClearAllPoints()
|
||||
@@ -195,13 +195,13 @@ pfUI:RegisterSkin("Auctionhouse", "vanilla:tbc", function ()
|
||||
for i = 1, NUM_AUCTIONS_TO_DISPLAY do
|
||||
HandleIcon(_G["AuctionsButton"..i.."Item"], _G["AuctionsButton"..i.."ItemIconTexture"])
|
||||
end
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
SkinButton(AuctionsItemButton)
|
||||
hooksecurefunc("AuctionSellItemButton_OnEvent", function()
|
||||
if event ~= "NEW_AUCTION_UPDATE" then return end
|
||||
HandleIcon(AuctionsItemButton, AuctionsItemButton:GetNormalTexture())
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
SkinMoneyInputFrame(StartPrice)
|
||||
SkinMoneyInputFrame(BuyoutPrice)
|
||||
|
||||
@@ -22,6 +22,6 @@ pfUI:RegisterSkin("Battlefield Minimap", "vanilla:tbc", function ()
|
||||
hooksecurefunc("BattlefieldMinimap_ShowOpacity", function()
|
||||
OpacityFrame:ClearAllPoints()
|
||||
OpacityFrame:SetPoint("TOPRIGHT", "BattlefieldMinimap", "TOPLEFT", -2*border, 0)
|
||||
end, 1)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -142,7 +142,7 @@ pfUI:RegisterSkin("Character", "vanilla:tbc", function ()
|
||||
RefreshCharacterSlot(this)
|
||||
end
|
||||
end)
|
||||
hooksecurefunc("PetTab_Update", RefreshPetPosition, 1)
|
||||
hooksecurefunc("PetTab_Update", RefreshPetPosition)
|
||||
this.hooked = true
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -264,7 +264,7 @@ pfUI:RegisterSkin("Inspect", "vanilla", function ()
|
||||
|
||||
UpdateSlots()
|
||||
QueueFunction(UpdateSlots)
|
||||
end, 1)
|
||||
end)
|
||||
end
|
||||
|
||||
do -- Honor Tab
|
||||
|
||||
@@ -67,7 +67,7 @@ pfUI:RegisterSkin("Mailbox", "vanilla:tbc", function ()
|
||||
else
|
||||
SendMailPackageButton:SetBackdropBorderColor(GetStringColor(pfUI_config.appearance.border.color))
|
||||
end
|
||||
end, 1)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
skin:RegisterEvent("MAIL_SHOW")
|
||||
|
||||
@@ -63,7 +63,7 @@ pfUI:RegisterSkin("Merchant", "vanilla:tbc", function ()
|
||||
_G["MerchantItem"..i]:SetPoint("TOPLEFT", _G["MerchantItem"..i-2], "BOTTOMLEFT", 0, -15)
|
||||
end
|
||||
end
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
StripTextures(MerchantPrevPageButton)
|
||||
SkinArrowButton(MerchantPrevPageButton, "left", 18)
|
||||
|
||||
@@ -216,7 +216,7 @@ pfUI:RegisterSkin("Profession", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
end
|
||||
end, true)
|
||||
end)
|
||||
end
|
||||
|
||||
-- Compatibility
|
||||
|
||||
@@ -27,7 +27,7 @@ pfUI:RegisterSkin("Quest Log", "vanilla:tbc", function ()
|
||||
hooksecurefunc("QuestLog_OnShow", function()
|
||||
QuestLogFrame:ClearAllPoints()
|
||||
QuestLogFrame:SetPoint("TOPLEFT", 10, -104)
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
QuestLogFrame:SetWidth(676)
|
||||
QuestLogFrame:SetHeight(440)
|
||||
@@ -191,7 +191,7 @@ pfUI:RegisterSkin("Quest Log", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
end
|
||||
end, 1)
|
||||
end)
|
||||
end
|
||||
|
||||
do -- right pane
|
||||
|
||||
@@ -7,7 +7,7 @@ pfUI:RegisterSkin("Readycheck", "vanilla:tbc", function ()
|
||||
else -- vanilla
|
||||
update_func = "ReadyCheck_OnUpdate"
|
||||
end
|
||||
|
||||
|
||||
StripTextures(ReadyCheckFrame, true)
|
||||
CreateBackdrop(ReadyCheckFrame, nil, nil, .75)
|
||||
CreateBackdropShadow(ReadyCheckFrame)
|
||||
@@ -41,7 +41,7 @@ pfUI:RegisterSkin("Readycheck", "vanilla:tbc", function ()
|
||||
hooksecurefunc("ShowReadyCheck", function()
|
||||
max = ReadyCheckFrame.timer
|
||||
frame.bar:SetMinMaxValues(0, max)
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
hooksecurefunc(update_func, function()
|
||||
if not ReadyCheckFrame.timer then return end
|
||||
@@ -50,6 +50,6 @@ pfUI:RegisterSkin("Readycheck", "vanilla:tbc", function ()
|
||||
frame.bar:SetStatusBarColor(GetColorGradient(perc))
|
||||
frame.bar:SetValue(ReadyCheckFrame.timer)
|
||||
frame.bar.text:SetText(round(ReadyCheckFrame.timer, 2))
|
||||
end, 1)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -34,6 +34,6 @@ pfUI:RegisterSkin("GM Survey", "vanilla", function ()
|
||||
GMSurveyFrameComment:SetMaxLetters(2000)
|
||||
hooksecurefunc("GMSurveyFrame_Update", function()
|
||||
GMSurveyFrameComment:SetWidth(505)
|
||||
end, 1)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -43,7 +43,7 @@ pfUI:RegisterSkin("Trade", "vanilla:tbc", function ()
|
||||
|
||||
hooksecurefunc("TradeFrame_UpdateTargetItem", function(id)
|
||||
HandleIcon(_G["TradeRecipientItem"..id.."ItemButton"], _G["TradeRecipientItem"..id..'IconTexture'])
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
SkinMoneyInputFrame(TradePlayerInputMoneyFrame)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ pfUI:RegisterSkin("Trainer", "vanilla:tbc", function ()
|
||||
SkinButton(ClassTrainerSkillIcon, nil, nil, nil, nil, true)
|
||||
hooksecurefunc("ClassTrainer_SetSelection", function()
|
||||
HandleIcon(ClassTrainerSkillIcon, ClassTrainerSkillIcon:GetNormalTexture())
|
||||
end, 1)
|
||||
end)
|
||||
|
||||
StripTextures(ClassTrainerExpandButtonFrame)
|
||||
StripTextures(ClassTrainerCollapseAllButton)
|
||||
|
||||
Reference in New Issue
Block a user