-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLoader.lua
36 lines (33 loc) · 1.35 KB
/
Loader.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
local hiddenFrame = CreateFrame("Frame", UIParent)
hiddenFrame:SetSize(1,1)
hiddenFrame:SetPoint("CENTER", UIParent, "CENTER", -10000, -10000)
local eventFrame = CreateFrame("Frame")
local oldCtp_OnEvent
local oldCtp_OnHide
eventFrame:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")
eventFrame:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_HIDE")
eventFrame:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_INTERACTION_MANAGER_FRAME_SHOW" then
local type = ...
if type == Enum.PlayerInteractionType.Trainer then
if IsTradeskillTrainer() then
return
end
RunNextFrame(function()
oldCtp_OnEvent = ClassTrainerFrame_OnEvent
ClassTrainerFrame_OnEvent = function() end
oldCtp_OnHide = ClassTrainerFrame:GetScript("OnHide")
ClassTrainerFrame:SetScript("OnHide", nil)
ClassTrainerPlusFrame_Show()
HideUIPanel(ClassTrainerFrame)
end)
end
elseif event == "PLAYER_INTERACTION_MANAGER_FRAME_HIDE" then
local type = ...
if type == Enum.PlayerInteractionType.Trainer then
ClassTrainerPlusFrame_Hide()
ClassTrainerFrame_OnEvent = oldCtp_OnEvent
ClassTrainerFrame:SetScript("OnHide", oldCtp_OnHide)
end
end
end)