This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTalentedTalentFrame.lua
140 lines (121 loc) · 4.44 KB
/
TalentedTalentFrame.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
local AceGUI = LibStub("AceGUI-3.0")
function Talented:InitUI()
self:Debug("Initializing")
self.InitRightClickSpecSwapButtons()
self:MakeButtonTabs()
self:Debug("Initialized")
end
function Talented.InitRightClickSpecSwapButtons()
local btnHeader = "PlayerTalentFrameSpecializationSpecButton"
for i=1, GetNumSpecializations() do
local btn = _G[btnHeader..i]
btn:RegisterForClicks("LeftButtonUp","RightButtonUp")
btn:HookScript("OnClick", function(self, button, down)
if button ~= "RightButton" then return end
if i ~= GetSpecialization() then SetSpecialization(i) end
end)
end
end
function Talented:MakeButtonTabs()
local pve = CreateFrame("Button",nil,PlayerTalentFrameTalents,"SpellBookSkillLineTabTemplate")
pve:SetPoint("TOPLEFT", PlayerTalentFrame, "TOPRIGHT", 0, -35)
Talented.PvETexture = "Interface\\Icons\\INV_Helmet_08"
pve:SetNormalTexture(Talented.PvETexture)
pve:SetScript("OnClick", function(btn)
self:InitPvEDropdown()
end)
pve.tooltip = "PVE Builds"
pve:Show()
self.PvETab = pve
local pvp = CreateFrame("Button",nil,pve,"SpellBookSkillLineTabTemplate")
pvp:SetPoint("TOPLEFT", pve, "BOTTOMLEFT", 0, -22)
-- For ElvUI AddOnSkins plugin
Talented.PvPTexture = "Interface\\Icons\\achievement_bg_winwsg"
pvp:SetNormalTexture(Talented.PvPTexture)
pvp:SetScript("OnClick", function(btn)
self:InitPvPDropdown()
end)
pvp.tooltip = "PVP Builds"
pvp:Show()
self.PvPTab = pvp
if self.db.global.config.hidePvPButton then
self.PvPTab:Hide()
end
end
function Talented:InitPvEDropdown()
GameTooltip:Hide()
local specid = self.tools.ActiveSpecID()
local activeBuild = self.tools.GetActiveTalentString()
local compare = self.tools.CompareTalentStrings
local menu = {
{ text=TALENTS, isTitle=true, notCheckable=true}
}
for name,build in self.tools.traverseBuilds(self.db.class[specid].PvE) do
local btn = {
text = name,
value = build,
checked = compare(build, activeBuild),
func = function(btn) self.tools.LearnTalentString(btn.value) end
}
tinsert(menu, btn)
end
tinsert(menu, {text='', isTitle=true, notCheckable=true})
-- Save Button
tinsert(menu, {
text=SAVE,
colorCode="|cff00ff00",
func = function() self:SavePvEBuild(GetServerTime()) end,
notCheckable=true
})
-- Delete Button
tinsert(menu, {
text=DELETE,
colorCode="|cffff0000",
func = function() self:DeleteMatchingBuilds("PvE", activeBuild, compare) end,
notCheckable=true
})
Talented.PvEDropdown = Talented.PvEDropdown or CreateFrame("Frame", "TalentedPvEDropdown", Talented.PvETab, "UIDropDownMenuTemplate")
local menuFrame = Talented.PvEDropdown
menuFrame:ClearAllPoints()
menuFrame:SetPoint("TOPLEFT", Talented.PvETab,"TOPRIGHT")
EasyMenu(menu, menuFrame, "cursor", 0, 0, "MENU", 1)
end
function Talented:InitPvPDropdown()
GameTooltip:Hide()
local specid = self.tools.ActiveSpecID()
local activeBuild = self.tools.GetActivePvPTalentIDs()
local compare = self.tools.ComparePvPTalentBuilds
local menu = {
{ text = PVP..' '..TALENTS, isTitle=true, notCheckable=true}
}
for name,build in self.tools.traverseBuilds(self.db.class[specid].PvP) do
local btn = {
text = name,
value = build,
checked = compare(build, activeBuild),
func = function(btn) self.tools.LearnPvPTalentGroup(btn.value) end
}
tinsert(menu, btn)
end
tinsert(menu, {text='', isTitle=true, notCheckable=true})
-- Save Button
tinsert(menu, {
text=SAVE,
colorCode="|cff00ff00",
func = function() self:SavePvPBuild(GetServerTime()) end,
notCheckable=true
})
-- Delete Button
tinsert(menu, {
text=DELETE,
colorCode="|cffff0000",
func = function() self:DeleteMatchingBuilds("PvP", activeBuild, compare) end,
notCheckable=true
})
tinsert(menu, saveBtn)
Talented.PvPDropdown = Talented.PvPDropdown or CreateFrame("Frame", "TalentedPvEDropdown", Talented.PvPTab, "UIDropDownMenuTemplate")
local menuFrame = Talented.PvPDropdown
menuFrame:ClearAllPoints()
menuFrame:SetPoint("TOPLEFT", Talented.PvPTab,"TOPRIGHT")
EasyMenu(menu, menuFrame, "cursor", 0, 0, "MENU", 1)
end