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