| 3 |
tristanc |
1 |
#include "pch.h"
|
|
|
2 |
#pragma hdrstop
|
|
|
3 |
|
|
|
4 |
#include "ClientDebugCommands.h"
|
| 6 |
tristanc |
5 |
|
| 3 |
tristanc |
6 |
#include <Console/ConsoleClient.h>
|
| 7 |
tristanc |
7 |
#include <DB/WowClientDB.h>
|
| 3 |
tristanc |
8 |
#include <WowSvcs/ClientServices.h>
|
|
|
9 |
|
| 31 |
tristanc |
10 |
|
| 3 |
tristanc |
11 |
/****************************************************************************
|
|
|
12 |
*
|
| 31 |
tristanc |
13 |
* Client Debug Commands
|
| 3 |
tristanc |
14 |
*
|
|
|
15 |
***/
|
|
|
16 |
|
|
|
17 |
//===========================================================================
|
| 31 |
tristanc |
18 |
BOOL CCommand_BootMe (const char *command, const char *arguments) {
|
| 3 |
tristanc |
19 |
CDataStore msg;
|
|
|
20 |
msg.Put(CMSG_BOOTME);
|
|
|
21 |
msg.Finalize();
|
|
|
22 |
ClientServices_Send(&msg);
|
|
|
23 |
return TRUE;
|
|
|
24 |
}
|
|
|
25 |
|
| 7 |
tristanc |
26 |
//===========================================================================
|
| 31 |
tristanc |
27 |
BOOL CCommand_Bug (char const* command, char const* args) {
|
| 30 |
tristanc |
28 |
//TODO:
|
|
|
29 |
//ASSERT(command);
|
|
|
30 |
|
|
|
31 |
unsigned int category;
|
|
|
32 |
|
|
|
33 |
if (!SStrCmpI(command, "bug"))
|
|
|
34 |
category = 0;
|
|
|
35 |
else if (!SStrCmpI(command, "suggestion"))
|
|
|
36 |
category = 1;
|
|
|
37 |
|
|
|
38 |
if (ClientServices_Report(category, args))
|
|
|
39 |
ConsolePrintf("%s submitted", command);
|
|
|
40 |
else
|
|
|
41 |
ConsolePrintf("%s submission failed", command);
|
|
|
42 |
|
|
|
43 |
return TRUE;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
//===========================================================================
|
| 31 |
tristanc |
47 |
BOOL CCommand_CreateItem (char const* command, char const* arguments) {
|
| 15 |
tristanc |
48 |
char string[256];
|
|
|
49 |
SStrCopy(string, arguments, 0xffffffff);
|
|
|
50 |
char *token = 0;
|
|
|
51 |
token = strtok(string, " \t");
|
| 19 |
tristanc |
52 |
int itemId = SStrToInt(token);
|
| 15 |
tristanc |
53 |
int quantity = 1;
|
|
|
54 |
if (token = strtok(NULL, "\r\n")) {
|
| 19 |
tristanc |
55 |
quantity = SStrToInt(token);
|
| 15 |
tristanc |
56 |
}
|
|
|
57 |
CDataStore msg;
|
|
|
58 |
msg.Put(CMSG_CREATEITEM);
|
|
|
59 |
msg.Put(itemId);
|
|
|
60 |
msg.Put(quantity);
|
|
|
61 |
msg.Finalize();
|
|
|
62 |
ClientServices_Send(&msg);
|
|
|
63 |
return TRUE;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
//===========================================================================
|
| 25 |
tristanc |
67 |
BOOL CCommand_CreateMonster (char const* command, char const* arguments) {
|
|
|
68 |
int type = SStrToInt(arguments);
|
|
|
69 |
|
|
|
70 |
CDataStore msg;
|
|
|
71 |
msg.Put(CMSG_CREATEMONSTER);
|
|
|
72 |
msg.Put(type);
|
|
|
73 |
msg.Finalize();
|
|
|
74 |
ClientServices_Send(&msg);
|
|
|
75 |
return TRUE;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
//===========================================================================
|
| 23 |
tristanc |
79 |
BOOL CCommand_Decharge (char const* command, char const* arguments) {
|
|
|
80 |
CDataStore msg;
|
|
|
81 |
msg.Put(CMSG_DECHARGE);
|
|
|
82 |
msg.Finalize();
|
|
|
83 |
ClientServices_Send(&msg);
|
|
|
84 |
return TRUE;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
//===========================================================================
|
| 31 |
tristanc |
88 |
BOOL CCommand_Learn (const char* command, const char* arguments) {
|
| 7 |
tristanc |
89 |
int spellId = 0;
|
|
|
90 |
if (isdigit(*arguments)) {
|
| 19 |
tristanc |
91 |
spellId = SStrToInt(arguments);
|
| 7 |
tristanc |
92 |
if (spellId <= 0) {
|
|
|
93 |
return TRUE;
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
else {
|
|
|
97 |
ConsoleWrite("Learning by spell name is not yet implemented", DEFAULT_COLOR);
|
|
|
98 |
return TRUE;
|
|
|
99 |
}
|
| 3 |
tristanc |
100 |
|
| 7 |
tristanc |
101 |
CDataStore msg;
|
|
|
102 |
msg.Put(CMSG_LEARN_SPELL);
|
|
|
103 |
msg.Put(spellId);
|
|
|
104 |
msg.Finalize();
|
|
|
105 |
ClientServices_Send(&msg);
|
|
|
106 |
return TRUE;
|
|
|
107 |
}
|
|
|
108 |
|
| 22 |
tristanc |
109 |
//===========================================================================
|
| 24 |
tristanc |
110 |
BOOL CCommand_Level (char const* command, char const* arguments) {
|
|
|
111 |
|
|
|
112 |
int level = SStrToInt(arguments);
|
|
|
113 |
if (level <= 0 || level > 100) {
|
|
|
114 |
ConsoleWrite("Invalid level specified\n", DEFAULT_COLOR);
|
|
|
115 |
}
|
|
|
116 |
else {
|
|
|
117 |
CDataStore msg;
|
|
|
118 |
msg.Put(CMSG_LEVEL_CHEAT);
|
|
|
119 |
msg.Put(level);
|
|
|
120 |
msg.Finalize();
|
|
|
121 |
ClientServices_Send(&msg);
|
|
|
122 |
}
|
|
|
123 |
return TRUE;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
//===========================================================================
|
| 22 |
tristanc |
127 |
BOOL CCommand_Recharge (char const* command, char const* arguments) {
|
|
|
128 |
CDataStore msg;
|
|
|
129 |
msg.Put(CMSG_RECHARGE);
|
|
|
130 |
msg.Finalize();
|
|
|
131 |
ClientServices_Send(&msg);
|
|
|
132 |
return TRUE;
|
|
|
133 |
}
|
| 7 |
tristanc |
134 |
|
| 22 |
tristanc |
135 |
|
| 3 |
tristanc |
136 |
/****************************************************************************
|
|
|
137 |
*
|
| 31 |
tristanc |
138 |
* External
|
| 3 |
tristanc |
139 |
*
|
|
|
140 |
***/
|
|
|
141 |
|
|
|
142 |
//===========================================================================
|
| 31 |
tristanc |
143 |
void DebugClientCommands::Install () {
|
| 3 |
tristanc |
144 |
ConsoleCommandRegister("bootme",CCommand_BootMe,DEBUG,NOHELP);
|
| 7 |
tristanc |
145 |
ConsoleCommandRegister("learn",CCommand_Learn,DEBUG,"Learn a spell or -1 for all spells");
|
| 15 |
tristanc |
146 |
ConsoleCommandRegister("ci",CCommand_CreateItem,GAME,NOHELP);
|
|
|
147 |
ConsoleCommandRegister("createitem",CCommand_CreateItem,GAME,NOHELP);
|
| 25 |
tristanc |
148 |
ConsoleCommandRegister("cm",CCommand_CreateMonster,GAME,NOHELP);
|
|
|
149 |
ConsoleCommandRegister("createmonster",CCommand_CreateMonster,GAME,NOHELP);
|
| 22 |
tristanc |
150 |
ConsoleCommandRegister("recharge",CCommand_Recharge,GAME,NOHELP);
|
| 23 |
tristanc |
151 |
ConsoleCommandRegister("decharge",CCommand_Decharge,GAME,NOHELP);
|
| 24 |
tristanc |
152 |
ConsoleCommandRegister("level",CCommand_Level,DEBUG,NOHELP);
|
| 3 |
tristanc |
153 |
}
|
|
|
154 |
|
|
|
155 |
//===========================================================================
|
| 31 |
tristanc |
156 |
void DebugClientCommands::Uninstall () {
|
| 3 |
tristanc |
157 |
ConsoleCommandUnregister("bootme");
|
| 7 |
tristanc |
158 |
ConsoleCommandUnregister("learn");
|
| 15 |
tristanc |
159 |
ConsoleCommandUnregister("ci");
|
|
|
160 |
ConsoleCommandUnregister("createitem");
|
| 25 |
tristanc |
161 |
ConsoleCommandUnregister("cm");
|
|
|
162 |
ConsoleCommandUnregister("createmonster");
|
| 22 |
tristanc |
163 |
ConsoleCommandUnregister("recharge");
|
| 23 |
tristanc |
164 |
ConsoleCommandUnregister("decharge");
|
| 24 |
tristanc |
165 |
ConsoleCommandUnregister("level");
|
| 3 |
tristanc |
166 |
}
|