Subversion Repositories WoWGM

Rev

Rev 22 | Rev 24 | 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
//===========================================================================
80
BOOL CCommand_Recharge (char const* command, char const* arguments) {
81
	CDataStore msg;
82
	msg.Put(CMSG_RECHARGE);
83
	msg.Finalize();
84
	ClientServices_Send(&msg);
85
	return TRUE;
86
}
7 tristanc 87
 
22 tristanc 88
 
3 tristanc 89
/****************************************************************************
90
*
91
*	External functions
92
*
93
***/
94
 
95
//===========================================================================
96
void DebugClientCommands::Install()
97
{
98
  ConsoleCommandRegister("bootme",CCommand_BootMe,DEBUG,NOHELP);
7 tristanc 99
  ConsoleCommandRegister("learn",CCommand_Learn,DEBUG,"Learn a spell or -1 for all spells");
15 tristanc 100
  ConsoleCommandRegister("ci",CCommand_CreateItem,GAME,NOHELP);
101
  ConsoleCommandRegister("createitem",CCommand_CreateItem,GAME,NOHELP);
22 tristanc 102
  ConsoleCommandRegister("recharge",CCommand_Recharge,GAME,NOHELP);
23 tristanc 103
  ConsoleCommandRegister("decharge",CCommand_Decharge,GAME,NOHELP);
3 tristanc 104
}
105
 
106
//===========================================================================
107
void DebugClientCommands::Uninstall()
108
{
109
  ConsoleCommandUnregister("bootme");
7 tristanc 110
  ConsoleCommandUnregister("learn");
15 tristanc 111
  ConsoleCommandUnregister("ci");
112
  ConsoleCommandUnregister("createitem");
22 tristanc 113
  ConsoleCommandUnregister("recharge");
23 tristanc 114
  ConsoleCommandUnregister("decharge");
3 tristanc 115
}