Subversion Repositories WoWGM

Rev

Rev 15 | Rev 22 | 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
//===========================================================================
7 tristanc 48
BOOL CCommand_Learn(const char* command, const char* arguments)
49
{
50
	int spellId = 0;
51
	if (isdigit(*arguments)) {
19 tristanc 52
		spellId = SStrToInt(arguments);
7 tristanc 53
		if (spellId <= 0) {
54
			return TRUE;
55
		}
56
	}
57
	else {
58
		ConsoleWrite("Learning by spell name is not yet implemented", DEFAULT_COLOR);
59
		return TRUE;
60
	}
3 tristanc 61
 
7 tristanc 62
	CDataStore msg;
63
	msg.Put(CMSG_LEARN_SPELL);
64
	msg.Put(spellId);
65
	msg.Finalize();
66
	ClientServices_Send(&msg);
67
	return TRUE;
68
}
69
 
70
 
3 tristanc 71
/****************************************************************************
72
*
73
*	External functions
74
*
75
***/
76
 
77
//===========================================================================
78
void DebugClientCommands::Install()
79
{
80
  ConsoleCommandRegister("bootme",CCommand_BootMe,DEBUG,NOHELP);
7 tristanc 81
  ConsoleCommandRegister("learn",CCommand_Learn,DEBUG,"Learn a spell or -1 for all spells");
15 tristanc 82
  ConsoleCommandRegister("ci",CCommand_CreateItem,GAME,NOHELP);
83
  ConsoleCommandRegister("createitem",CCommand_CreateItem,GAME,NOHELP);
3 tristanc 84
}
85
 
86
//===========================================================================
87
void DebugClientCommands::Uninstall()
88
{
89
  ConsoleCommandUnregister("bootme");
7 tristanc 90
  ConsoleCommandUnregister("learn");
15 tristanc 91
  ConsoleCommandUnregister("ci");
92
  ConsoleCommandUnregister("createitem");
3 tristanc 93
}