Rev 36 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/******************************************************************************
*
* ClientDebugCommands.cpp
*
*
* By Tristan Cormier - 11/21/2024
*
***/
#include "pch.h"
#pragma hdrstop
#include "ClientDebugCommands.h"
#include <Console/ConsoleClient.h>
#include <DB/WowClientDB.h>
#include <WowSvcs/ClientServices.h>
#include "Object/ObjectClient/Player_C.h"
#include "ObjectMgrClient/ObjectMgrClient.h"
/******************************************************************************
*
* Private
*
***/
//=============================================================================
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 (const char * command, const char * 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_CreateMonster (char const* command, char const* arguments) {
// Monster type to create: negative for pet
int type = SStrToInt(arguments);
CDataStore msg;
msg.Put(CMSG_CREATEMONSTER);
msg.Put(type);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
//=============================================================================
BOOL CCommand_Decharge (char const* command, char const* arguments) {
CDataStore msg;
msg.Put(CMSG_DECHARGE);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
//=============================================================================
BOOL CCommand_DLoc (char const *command, char const *arguments)
{
unsigned long long playerGUID = ClntObjMgrGetActivePlayer();
CGPlayer_C *player = (CGPlayer_C *)ClntObjMgrObjectPtr(playerGUID,TYPE_PLAYER,__FILE__,__LINE__);
C3Vector pos;
player->GetPosition(pos);
ConsoleWriteA("%g,%g,%g", DEFAULT_COLOR, pos.x, pos.y, pos.z);
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 {
// TODO:
ConsoleWrite("Learning spells by 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_Level (const char * command, const char * arguments) {
int level = SStrToInt(arguments);
if (level <= 0 || level > 100)
ConsoleWrite("Invalid level specified\n", DEFAULT_COLOR);
else {
CDataStore msg;
msg.Put(CMSG_LEVEL_CHEAT);
msg.Put(level);
msg.Finalize();
ClientServices_Send(&msg);
}
return TRUE;
}
//=============================================================================
BOOL CCommand_Recharge (const char * command, const char * arguments) {
CDataStore msg;
msg.Put(CMSG_RECHARGE);
msg.Finalize();
ClientServices_Send(&msg);
return TRUE;
}
/******************************************************************************
*
* Exports
*
***/
//=============================================================================
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("cm", CCommand_CreateMonster, GAME, NOHELP);
ConsoleCommandRegister("createmonster", CCommand_CreateMonster, GAME, NOHELP);
ConsoleCommandRegister("dloc", CCommand_DLoc, DEBUG, NOHELP);
ConsoleCommandRegister("recharge", CCommand_Recharge, GAME, NOHELP);
ConsoleCommandRegister("decharge", CCommand_Decharge, GAME, NOHELP);
ConsoleCommandRegister("level", CCommand_Level, DEBUG, NOHELP);
}
//=============================================================================
void DebugClientCommands::Uninstall () {
ConsoleCommandUnregister("bootme");
ConsoleCommandUnregister("learn");
ConsoleCommandUnregister("ci");
ConsoleCommandUnregister("createitem");
ConsoleCommandUnregister("cm");
ConsoleCommandUnregister("createmonster");
ConsoleCommandUnregister ("dloc");
ConsoleCommandUnregister("recharge");
ConsoleCommandUnregister("decharge");
ConsoleCommandUnregister("level");
}
//===================================
// MIT License
//
// Copyright (c) 2024 by Tristan Cormier
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//===================================
Generated by GNU Enscript 1.6.5.90.