Rev 19 | Rev 23 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#include "pch.h"
#pragma hdrstop
#include "ClientDebugCommands.h"
#include <Console/ConsoleClient.h>
#include <DB/WowClientDB.h>
#include <WowSvcs/ClientServices.h>
/****************************************************************************
*
* Command definitions
*
***/
//===========================================================================
BOOL CCommand_BootMe(const char *command, const char *arguments)
{
CDataStore msg;
msg.Put(CMSG_BOOTME);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
//===========================================================================
BOOL CCommand_CreateItem(char const* command, char const* arguments)
{
char string[256];
SStrCopy(string, arguments, 0xffffffff);
char *token = 0;
token = strtok(string, " \t");
int itemId = SStrToInt(token);
int quantity = 1;
if (token = strtok(NULL, "\r\n")) {
quantity = SStrToInt(token);
}
CDataStore msg;
msg.Put(CMSG_CREATEITEM);
msg.Put(itemId);
msg.Put(quantity);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
//===========================================================================
BOOL CCommand_Learn(const char* command, const char* arguments)
{
int spellId = 0;
if (isdigit(*arguments)) {
spellId = SStrToInt(arguments);
if (spellId <= 0) {
return TRUE;
}
}
else {
ConsoleWrite("Learning by spell name is not yet implemented", DEFAULT_COLOR);
return TRUE;
}
CDataStore msg;
msg.Put(CMSG_LEARN_SPELL);
msg.Put(spellId);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
//===========================================================================
BOOL CCommand_Recharge (char const* command, char const* arguments) {
CDataStore msg;
msg.Put(CMSG_RECHARGE);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
/****************************************************************************
*
* External functions
*
***/
//===========================================================================
void DebugClientCommands::Install()
{
ConsoleCommandRegister("bootme",CCommand_BootMe,DEBUG,NOHELP);
ConsoleCommandRegister("learn",CCommand_Learn,DEBUG,"Learn a spell or -1 for all spells");
ConsoleCommandRegister("ci",CCommand_CreateItem,GAME,NOHELP);
ConsoleCommandRegister("createitem",CCommand_CreateItem,GAME,NOHELP);
ConsoleCommandRegister("recharge",CCommand_Recharge,GAME,NOHELP);
}
//===========================================================================
void DebugClientCommands::Uninstall()
{
ConsoleCommandUnregister("bootme");
ConsoleCommandUnregister("learn");
ConsoleCommandUnregister("ci");
ConsoleCommandUnregister("createitem");
ConsoleCommandUnregister("recharge");
}