-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathchat_cmd_handler.lua
More file actions
272 lines (240 loc) · 9.6 KB
/
Copy pathchat_cmd_handler.lua
File metadata and controls
272 lines (240 loc) · 9.6 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
function EngBank_cmd(msg)
local cmd, params = EngBags_SplitSpace(msg);
local param2;
cmd = string.lower(cmd);
if (cmd == "hide") then
EngBank_frame:Hide();
elseif (cmd == "show") then
EngBank_frame:Show();
elseif (cmd == "update") then
-- force window update
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
elseif (cmd == "display") then
-- Debugging - display item cache
EngBank_UpdateInventoryCache();
EngBank_DisplayItemCache();
elseif (cmd == "checkhooks") then
EngBank_RegisterHooks(EngBank_HOOKS_CHECK);
elseif (cmd == "debug") then
if (EngBank_DEBUGMESSAGES == 0) then
EngBank_DEBUGMESSAGES = 1;
EngBags_Print("EngBank: Debugging messages on.");
else
EngBank_DEBUGMESSAGES = 0;
EngBags_Print("EngBank: Debugging messages off.");
end
elseif (cmd == "lock") then
EngBankConfig["moveLock"] = 0;
EngBank_Button_MoveLockToggle:SetText(EBLocal["EngBank_Button_MoveLock_locked"]);
elseif (cmd == "unlock") then
EngBankConfig["moveLock"] = 1;
EngBank_Button_MoveLockToggle:SetText(EBLocal["EngBank_Button_MoveLock_unlocked"]);
elseif (cmd == "scale") then
EngBagsConfig["frameWindowScale"] = tonumber(params);
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
EngBags_Print("Window scale set to: "..EngBagsConfig["frameWindowScale"]);
elseif (cmd == "set") then
if (params == "") then
EngBags_Print("Current settings:", 1.0,0.5,0.5);
for key,value in EngBankConfig do
if (not string.find(key, "__version")) then
EngBags_Print(" "..key.." = "..value);
end
end
else
params, param2 = EngBank_SplitSpace(params);
if ( (EngBankConfig[params] ~= nil) and (param2 ~= nil) ) then
EngBankConfig[params] = param2;
EngBags_Print(params.." set to '"..param2.."'", 0,1,0.5);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
else
EngBags_Print("Invalid variable or value. (Variables are case sensitive)", 1,0.2,0.2);
end
end
elseif (cmd == "resetdefaults") then
EngBankConfig = {};
EngBank_SetDefaultValues(1);
EngBags_Print("Default values loaded..");
EngBags_Print("If you are resetting defaults because the mod wasn't running, you might have to reload your UI to make it work again. Try /console reloadui", 1,0.2,0.2);
elseif (cmd == "config") then
EngBank_OptsFrame:Show();
elseif (cmd == "test") then
-- development test stuff
local skillName, isHeader, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType;
local i, i2;
local skillType, numAvailable, isExpanded, tmp, tmp2;
local reagentName, reagentTexture, reagentCount, playerReagentCount;
local craftName, craftSubSpellName, craftType;
--[[
for i = 1, GetNumSkillLines() do
skillName, isHeader, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType = GetSkillLineInfo(i);
if (isHeader) then
EngBags_Print(skillName, 1,0,0);
else
EngBags_Print(skillName, 0,1,1);
end
end
--]]
--[[
if (GetNumTradeSkills() > 0) then
for i = 1, GetNumTradeSkills() do
skillName, skillType, numAvailable, isExpanded = GetTradeSkillInfo(i);
--Print("|cFFFF007F"..skillType.."|r = "..skillName..", |cFF007FFF"..numAvailable.."|r");
if (skillType ~= "header") then
--tmp = GetTradeSkillTools(i);
Print( GetTradeSkillItemLink(i) );
if (GetTradeSkillNumReagents(i) > 0) then
for i2 = 1, GetTradeSkillNumReagents(i) do
reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(i, i2);
Print( "--> "..GetTradeSkillReagentItemLink(i,i2)..", "..reagentCount );
end
end
end
end
local tradeskillName, currentLevel, maxLevel = GetTradeSkillLine();
Print( tradeskillName..", "..currentLevel..", "..maxLevel );
end --]]
if (GetNumCrafts() > 0) then
for i = 1, GetNumCrafts() do
craftName, craftSubSpellName, craftType, numAvailable, isExpanded = GetCraftInfo(i);
Print("|cFFFF007F"..craftType.."|r = "..craftName..", |cFF007FFF"..craftSubSpellName..", "..numAvailable.."|r");
if (GetCraftNumReagents(i) > 0) then
for i2 = 1, GetCraftNumReagents(i) do
reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(i, i2);
Print( "--> "..GetCraftReagentItemLink(i,i2)..", "..reagentCount );
end
end
end
local tradeskillName, currentLevel, maxLevel = GetCraftDisplaySkillLine();
Print( tradeskillName..", "..currentLevel..", "..maxLevel );
end
else
for key,value in EngBank_HELP[ EILocal["help_text"] ] do
EngBags_Print(string.gsub(value, "\r", ""));
end
end
end
function EngInventory_cmd(msg)
local cmd, params = EngBags_SplitSpace(msg);
local param2;
cmd = string.lower(cmd);
if (cmd == "hide") then
EngInventory_frame:Hide();
elseif (cmd == "show") then
EngInventory_frame:Show();
elseif (cmd == "update") then
-- force window update
EngInventory_window_update_required = ENGINVENTORY_MANDATORY;
EngInventory_UpdateWindow();
elseif (cmd == "display") then
-- Debugging - display item cache
EngInventory_UpdateInventoryCache();
EngInventory_DisplayItemCache();
elseif (cmd == "checkhooks") then
EngInventory_RegisterHooks(ENGINVENTORY_HOOKS_CHECK);
elseif (cmd == "debug") then
if (ENGINVENTORY_DEBUGMESSAGES == 0) then
ENGINVENTORY_DEBUGMESSAGES = 1;
EngBags_Print("EngInventory: Debugging messages on.");
else
ENGINVENTORY_DEBUGMESSAGES = 0;
EngBags_Print("EngInventory: Debugging messages off.");
end
elseif (cmd == "lock") then
EngInventoryConfig["moveLock"] = 0;
EngInventory_Button_MoveLockToggle:SetText(EILocal["EngInventory_Button_MoveLock_locked"]);
elseif (cmd == "unlock") then
EngInventoryConfig["moveLock"] = 1;
EngInventory_Button_MoveLockToggle:SetText(EILocal["EngInventory_Button_MoveLock_unlocked"]);
elseif (cmd == "scale") then
EngBagsConfig["frameWindowScale"] = tonumber(params);
EngInventory_SetDefaultValues(0);
EngInventory_window_update_required = ENGINVENTORY_MANDATORY;
EngInventory_UpdateWindow();
EngBags_Print("Window scale set to: "..EngBagsConfig["frameWindowScale"]);
elseif (cmd == "set") then
if (params == "") then
EngBags_Print("Current settings:", 1.0,0.5,0.5);
for key,value in EngInventoryConfig do
if (not string.find(key, "__version")) then
EngBags_Print(" "..key.." = "..value);
end
end
else
params, param2 = EngInventory_SplitSpace(params);
if ( (EngInventoryConfig[params] ~= nil) and (param2 ~= nil) ) then
EngInventoryConfig[params] = param2;
EngBags_Print(params.." set to '"..param2.."'", 0,1,0.5);
EngInventory_window_update_required = ENGINVENTORY_MANDATORY;
EngInventory_UpdateWindow();
else
EngBags_Print("Invalid variable or value. (Variables are case sensitive)", 1,0.2,0.2);
end
end
elseif (cmd == "resetdefaults") then
EngInventoryConfig = {};
EngInventory_SetDefaultValues(1);
EngBags_Print("Default values loaded..");
EngBags_Print("If you are resetting defaults because the mod wasn't running, you might have to reload your UI to make it work again. Try /console reloadui", 1,0.2,0.2);
elseif (cmd == "config") then
EngInventory_OptsFrame:Show();
elseif (cmd == "test") then
-- development test stuff
local skillName, isHeader, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType;
local i, i2;
local skillType, numAvailable, isExpanded, tmp, tmp2;
local reagentName, reagentTexture, reagentCount, playerReagentCount;
local craftName, craftSubSpellName, craftType;
--[[
for i = 1, GetNumSkillLines() do
skillName, isHeader, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType = GetSkillLineInfo(i);
if (isHeader) then
EngBags_Print(skillName, 1,0,0);
else
EngBags_Print(skillName, 0,1,1);
end
end
--]]
--[[
if (GetNumTradeSkills() > 0) then
for i = 1, GetNumTradeSkills() do
skillName, skillType, numAvailable, isExpanded = GetTradeSkillInfo(i);
--Print("|cFFFF007F"..skillType.."|r = "..skillName..", |cFF007FFF"..numAvailable.."|r");
if (skillType ~= "header") then
--tmp = GetTradeSkillTools(i);
Print( GetTradeSkillItemLink(i) );
if (GetTradeSkillNumReagents(i) > 0) then
for i2 = 1, GetTradeSkillNumReagents(i) do
reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(i, i2);
Print( "--> "..GetTradeSkillReagentItemLink(i,i2)..", "..reagentCount );
end
end
end
end
local tradeskillName, currentLevel, maxLevel = GetTradeSkillLine();
Print( tradeskillName..", "..currentLevel..", "..maxLevel );
end --]]
if (GetNumCrafts() > 0) then
for i = 1, GetNumCrafts() do
craftName, craftSubSpellName, craftType, numAvailable, isExpanded = GetCraftInfo(i);
Print("|cFFFF007F"..craftType.."|r = "..craftName..", |cFF007FFF"..craftSubSpellName..", "..numAvailable.."|r");
if (GetCraftNumReagents(i) > 0) then
for i2 = 1, GetCraftNumReagents(i) do
reagentName, reagentTexture, reagentCount, playerReagentCount = GetCraftReagentInfo(i, i2);
Print( "--> "..GetCraftReagentItemLink(i,i2)..", "..reagentCount );
end
end
end
local tradeskillName, currentLevel, maxLevel = GetCraftDisplaySkillLine();
Print( tradeskillName..", "..currentLevel..", "..maxLevel );
end
else
for key,value in ENGINVENTORY_HELP[ EILocal["help_text"] ] do
EngBags_Print(string.gsub(value, "\r", ""));
end
end
end