if db.modebg or db.modeinst then Stub("PLAYER_ENTERING_WORLD") end |
end |
|
-- Like PlaySound, we should check our trade flag prior allowing this function to Hide the current BankFrame to ensure |
-- the trade isn't a blocked one and force the closure of our bank and/or guildbank. |
local function __hooked_Bank_OnEvent(self, event, ...) |
local delay, _, args, frame = 0, EasyDND, ..., nil |
if self then frame = self:GetName() or "none" end |
if event == "BANKFRAME_CLOSED" or ( frame and frame == "GuildBankFrame" ) then |
local fake = CreateFrame("Frame", nil, UIParent) |
fake:SetScript("OnUpdate", function(a, elapsed) |
if _.h then |
_.h = false |
fake:SetScript("OnUpdate",nil) |
fake = nil |
return |
end |
delay = delay + elapsed |
if delay > 0.005 then |
fake:SetScript("OnUpdate",nil) |
fake = nil |
_.h = false |
if type(event) == "string" then _.__orig_BankFrame_OnEvent(self, event, args) |
else _.__orig_HideUIPanel(self) end |
end |
end) |
else |
if type(event) == "string" then _.__orig_BankFrame_OnEvent(self, event, args) |
else _.__orig_HideUIPanel(self) end |
end |
end |
|
local function SetTradeFrameHook() |
local _, a, add = EasyDND, TradeFrame, TradeFrame.SetScript |
if _.db.profile.activated then |
if _.db.profile.anti_blocktrade and not _.q then |
InitiateTrade = __hooked_InitiateTrade |
add(a, "OnEvent", __hooked_TradeFrame_OnEvent) |
BankFrame_OnEvent = __hooked_Bank_OnEvent |
HideUIPanel = __hooked_Bank_OnEvent |
_.q = true |
elseif _.q and not _.db.profile.anti_blocktrade then |
InitiateTrade = _.__orig_InitiateTrade |
add(a, "OnEvent", _.__orig_TradeFrame_OnEvent) |
BankFrame_OnEvent = _.__orig_BankFrame_OnEvent |
HideUIPanel = _.__orig_HideUIPanel |
_.q = false |
end |
end |