This repository was archived by the owner on Jan 24, 2020. It is now read-only.
forked from laytya/AdvancedTradeSkillWindow-vanilla
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatsw_abstraction.lua
More file actions
executable file
·175 lines (155 loc) · 4.05 KB
/
atsw_abstraction.lua
File metadata and controls
executable file
·175 lines (155 loc) · 4.05 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
-- Blizzard API abstraction code
function ATSW_GetTradeSkillSelectionIndex()
if(atsw_oldmode) then
return GetCraftSelectionIndex();
else
return GetTradeSkillSelectionIndex();
end
end
function ATSW_GetNumTradeSkills()
if(atsw_oldmode) then
return GetNumCrafts();
else
return GetNumTradeSkills();
end
end
function ATSW_GetTradeSkillLine()
local tradeskillName, currentLevel, maxLevel;
if(atsw_oldmode) then
tradeskillName, currentLevel, maxLevel = GetCraftDisplaySkillLine();
else
tradeskillName, currentLevel, maxLevel = GetTradeSkillLine();
end
if(tradeskillName==nil) then
tradeskillName = "";
end
return tradeskillName, currentLevel, maxLevel;
end
function ATSW_GetFirstTradeSkill()
if(atsw_oldmode) then
return 1;
else
return GetFirstTradeSkill();
end
end
function ATSW_ExpandTradeSkillSubClass(index)
if(atsw_oldmode) then
return ExpandCraftSkillLine(index);
else
return ExpandTradeSkillSubClass(index);
end
end
function ATSW_CollapseTradeSkillSubClass(index)
if(atsw_oldmode) then
return CollapseCraftSkillLine(index);
else
return CollapseTradeSkillSubClass(index);
end
end
function ATSW_GetTradeSkillInfo(index)
local skillName, skillType, numAvailable, isExpanded;
if(atsw_oldmode) then
skillName, craftSubSpellName, skillType, numAvailable, isExpanded = GetCraftInfo(index);
else
skillName, skillType, numAvailable, isExpanded = GetTradeSkillInfo(index);
end
return skillName, skillType, numAvailable, isExpanded;
end
function ATSW_SelectTradeSkill(index)
if(atsw_oldmode) then
return SelectCraft(index);
else
return SelectTradeSkill(index);
end
end
function ATSW_GetTradeSkillCooldown(index)
if(atsw_oldmode) then
return nil;
else
return GetTradeSkillCooldown(index);
end
end
function ATSW_GetTradeSkillNumMade(index)
local minMade, maxMade;
if(atsw_oldmode) then
minMade=1;
maxMade=1;
else
minMade, maxMade = GetTradeSkillNumMade(index);
end
return minMade, maxMade;
end
function ATSW_GetTradeSkillIcon(index)
if(atsw_oldmode) then
return GetCraftIcon(index);
else
return GetTradeSkillIcon(index);
end
end
function ATSW_GetTradeSkillNumReagents(index)
if(atsw_oldmode) then
return GetCraftNumReagents(index);
else
return GetTradeSkillNumReagents(index);
end
end
function ATSW_GetTradeSkillReagentInfo(index, reagentIndex)
local reagentName, reagentTexture, reagentCount, playerReagentCount;
if(atsw_oldmode) then
reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(index, reagentIndex);
else
reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(index, reagentIndex);
end
return reagentName, reagentTexture, reagentCount, playerReagentCount;
end
function ATSW_GetTradeSkillReagentItemLink(index, reagentIndex)
if(atsw_oldmode) then
return GetCraftReagentItemLink(index, reagentIndex);
else
return GetTradeSkillReagentItemLink(index, reagentIndex);
end
end
function ATSW_GetTradeSkillItemLink(index)
if(atsw_oldmode) then
return GetCraftItemLink(index);
else
return GetTradeSkillItemLink(index);
end
end
function ATSW_GetTradeSkillTools(index)
if(atsw_oldmode) then
return GetCraftSpellFocus(index);
else
return GetTradeSkillTools(index);
end
end
function ATSW_inspect(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. ATSW_inspect(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
function ATSW_SetTextColor(obj, red, green, blue, alpha, font_name)
ATSW_DisplayMessage("Called SetTextColor for '"..obj:GetName().."',type '"..type(obj).."'")
if type(obj) == "table" then
print(ATSW_inspect(obj))
end
font_name = font_name or "GameFontNormal"
local font_obj = obj:GetNormalFontObject();
if not font_obj then
obj:SetNormalFontObject(font_name);
font_obj = obj:GetNormalFontObject();
end
if alpha then
font_obj:SetTextColor(red, green, blue, alpha);
else
font_obj:SetTextColor(red, green, blue);
end
obj:SetNormalFontObject(font_obj);
end