forked from fusionpit/ClassTrainerPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoader.lua
More file actions
59 lines (54 loc) · 2.5 KB
/
Copy pathLoader.lua
File metadata and controls
59 lines (54 loc) · 2.5 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local eventFrame = CreateFrame("Frame")
local hookInstalled = false
local frameHooked = false
eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:RegisterEvent("TRAINER_SHOW")
eventFrame:SetScript("OnEvent", function(self, event, ...)
if event == "ADDON_LOADED" then
local addonName = ...
-- Mark that our addon is loaded
if addonName == "ClassTrainerPlus" then
hookInstalled = true
end
elseif event == "TRAINER_SHOW" then
-- Only handle if our addon is loaded AND it's not a profession trainer
if hookInstalled and not IsTradeskillTrainer() then
-- Don't hide ClassTrainerFrame, just move it offscreen and make it transparent
-- This keeps the trainer interaction alive
if ClassTrainerFrame then
ClassTrainerFrame:ClearAllPoints()
ClassTrainerFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", -5000, 0)
ClassTrainerFrame:SetAlpha(0)
end
-- Show our frame with a slight delay to ensure ClassTrainerPlusFrame_Show is loaded
if ClassTrainerPlusFrame then
local delayFrame = CreateFrame("Frame")
delayFrame:SetScript("OnUpdate", function(self)
self:SetScript("OnUpdate", nil)
ShowUIPanel(ClassTrainerPlusFrame)
-- Now call the init function if it exists
if ClassTrainerPlusFrame_Show then
if not frameHooked then
ClassTrainerPlusFrame:HookScript("OnShow", ClassTrainerPlusFrame_Show)
frameHooked = true
end
ClassTrainerPlusFrame_Show()
else
print("ERROR: ClassTrainerPlusFrame_Show still not found after delay")
end
end)
end
else
-- For profession trainers, ensure ClassTrainerFrame is visible and properly positioned
if ClassTrainerFrame then
ClassTrainerFrame:ClearAllPoints()
ClassTrainerFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, -104)
ClassTrainerFrame:SetAlpha(1)
end
-- Make sure ClassTrainerPlus doesn't interfere
if ClassTrainerPlusFrame and ClassTrainerPlusFrame:IsShown() then
HideUIPanel(ClassTrainerPlusFrame)
end
end
end
end)