Subversion Repositories WoWGM

Rev

Rev 23 | Rev 25 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
//===========================================================================
23 tristanc 48
BOOL CCommand_Decharge (char const* command, char const* arguments) {
49
	CDataStore msg;
50
	msg.Put(CMSG_DECHARGE);
51
	msg.Finalize();
52
	ClientServices_Send(&msg);
53
	return TRUE;
54
}
55
 
56
//===========================================================================
7 tristanc 57
BOOL CCommand_Learn(const char* command, const char* arguments)
58
{
59
	int spellId = 0;
60
	if (isdigit(*arguments)) {
19 tristanc 61
		spellId = SStrToInt(arguments);
7 tristanc 62
		if (spellId <= 0) {
63
			return TRUE;
64
		}
65
	}
66
	else {
67
		ConsoleWrite("Learning by spell name is not yet implemented", DEFAULT_COLOR);
68
		return TRUE;
69
	}
3 tristanc 70
 
7 tristanc 71
	CDataStore msg;
72
	msg.Put(CMSG_LEARN_SPELL);
73
	msg.Put(spellId);
74
	msg.Finalize();
75
	ClientServices_Send(&msg);
76
	return TRUE;
77
}
78
 
22 tristanc 79
//===========================================================================
24 tristanc 80
BOOL CCommand_Level (char const* command, char const* arguments) {
81
 
82
	int level = SStrToInt(arguments);
83
	if (level <= 0 || level > 100) {
84
		ConsoleWrite("Invalid level specified\n", DEFAULT_COLOR);
85
	}
86
	else {
87
		CDataStore msg;
88
		msg.Put(CMSG_LEVEL_CHEAT);
89
		msg.Put(level);
90
		msg.Finalize();
91
		ClientServices_Send(&msg);
92
	}
93
	return TRUE;
94
}
95
 
96
//===========================================================================
22 tristanc 97
BOOL CCommand_Recharge (char const* command, char const* arguments) {
98
	CDataStore msg;
99
	msg.Put(CMSG_RECHARGE);
100
	msg.Finalize();
101
	ClientServices_Send(&msg);
102
	return TRUE;
103
}
7 tristanc 104
 
22 tristanc 105
 
3 tristanc 106
/****************************************************************************
107
*
108
*	External functions
109
*
110
***/
111
 
112
//===========================================================================
113
void DebugClientCommands::Install()
114
{
115
  ConsoleCommandRegister("bootme",CCommand_BootMe,DEBUG,NOHELP);
7 tristanc 116
  ConsoleCommandRegister("learn",CCommand_Learn,DEBUG,"Learn a spell or -1 for all spells");
15 tristanc 117
  ConsoleCommandRegister("ci",CCommand_CreateItem,GAME,NOHELP);
118
  ConsoleCommandRegister("createitem",CCommand_CreateItem,GAME,NOHELP);
22 tristanc 119
  ConsoleCommandRegister("recharge",CCommand_Recharge,GAME,NOHELP);
23 tristanc 120
  ConsoleCommandRegister("decharge",CCommand_Decharge,GAME,NOHELP);
24 tristanc 121
  ConsoleCommandRegister("level",CCommand_Level,DEBUG,NOHELP);
3 tristanc 122
}
123
 
124
//===========================================================================
125
void DebugClientCommands::Uninstall()
126
{
127
  ConsoleCommandUnregister("bootme");
7 tristanc 128
  ConsoleCommandUnregister("learn");
15 tristanc 129
  ConsoleCommandUnregister("ci");
130
  ConsoleCommandUnregister("createitem");
22 tristanc 131
  ConsoleCommandUnregister("recharge");
23 tristanc 132
  ConsoleCommandUnregister("decharge");
24 tristanc 133
  ConsoleCommandUnregister("level");
3 tristanc 134
}