| 3 |
tristanc |
1 |
#include "pch.h"
|
|
|
2 |
#pragma hdrstop
|
|
|
3 |
|
|
|
4 |
#include "ClientCommands.h"
|
| 6 |
tristanc |
5 |
|
| 3 |
tristanc |
6 |
#include <ClientDebugCommands.h>
|
| 6 |
tristanc |
7 |
#include <ClientGMCommands.h>
|
| 3 |
tristanc |
8 |
#include <Console/ConsoleClient.h>
|
|
|
9 |
#include <FrameScript/FrameScript.h>
|
|
|
10 |
#include <WowSvcs/ClientServices.h>
|
|
|
11 |
|
| 31 |
tristanc |
12 |
|
| 3 |
tristanc |
13 |
/****************************************************************************
|
|
|
14 |
*
|
| 31 |
tristanc |
15 |
* Client memory addresses
|
| 3 |
tristanc |
16 |
*
|
|
|
17 |
***/
|
|
|
18 |
|
| 32 |
tristanc |
19 |
#define INSTALLGAMECONSOLECOMMANDSPTR 0x00407870
|
|
|
20 |
#define UNINSTALLGAMECONSOLECOMMANDSPTR 0x00406EF0
|
| 3 |
tristanc |
21 |
|
|
|
22 |
|
|
|
23 |
/****************************************************************************
|
|
|
24 |
*
|
| 31 |
tristanc |
25 |
* Client function pointers
|
| 3 |
tristanc |
26 |
*
|
|
|
27 |
***/
|
|
|
28 |
|
| 31 |
tristanc |
29 |
void (*InstallGameConsoleCommandsPtr)() = *(void (*)())INSTALLGAMECONSOLECOMMANDSPTR;
|
| 3 |
tristanc |
30 |
void (*UninstallGameConsoleCommandsPtr)() = *(void (*)())UNINSTALLGAMECONSOLECOMMANDSPTR;
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
/****************************************************************************
|
|
|
34 |
*
|
| 31 |
tristanc |
35 |
* Client Game Commands
|
| 3 |
tristanc |
36 |
*
|
|
|
37 |
***/
|
|
|
38 |
|
|
|
39 |
//===========================================================================
|
| 33 |
tristanc |
40 |
BOOL CCommand_Beastmaster (char const* commandStr, char const* arguments) {
|
|
|
41 |
CDataStore msg;
|
|
|
42 |
msg.Put(CMSG_BEASTMASTER);
|
|
|
43 |
BYTE val = SStrCmpI(arguments, "off") != 0;
|
|
|
44 |
msg.Put(val);
|
|
|
45 |
msg.Finalize();
|
|
|
46 |
ClientServices_Send(&msg);
|
|
|
47 |
return TRUE;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
//===========================================================================
|
| 31 |
tristanc |
51 |
BOOL CCommand_GodMode (const char* cmd, const char* arguments) {
|
| 3 |
tristanc |
52 |
if (arguments && *arguments) {
|
|
|
53 |
int enable = atoi(arguments);
|
|
|
54 |
|
|
|
55 |
CDataStore msg;
|
|
|
56 |
msg.Put(CMSG_GODMODE);
|
|
|
57 |
msg.Put(enable);
|
|
|
58 |
msg.Finalize();
|
|
|
59 |
|
|
|
60 |
ClientServices_Send(&msg);
|
|
|
61 |
}
|
| 31 |
tristanc |
62 |
|
| 3 |
tristanc |
63 |
return TRUE;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
/****************************************************************************
|
|
|
68 |
*
|
| 31 |
tristanc |
69 |
* Private
|
| 3 |
tristanc |
70 |
*
|
|
|
71 |
***/
|
|
|
72 |
|
|
|
73 |
//===========================================================================
|
| 31 |
tristanc |
74 |
void InstallGameConsoleCommands () {
|
| 3 |
tristanc |
75 |
InstallGameConsoleCommandsPtr();
|
|
|
76 |
|
|
|
77 |
// Register our own commands
|
|
|
78 |
ConsoleCommandRegister("godmode",CCommand_GodMode,GAME,NOHELP);
|
| 33 |
tristanc |
79 |
ConsoleCommandRegister("beastmaster",CCommand_Beastmaster,GAME,NOHELP);
|
| 3 |
tristanc |
80 |
|
|
|
81 |
DebugClientCommands::Install();
|
| 6 |
tristanc |
82 |
GMClientCommands::Install();
|
| 3 |
tristanc |
83 |
}
|
|
|
84 |
|
|
|
85 |
//===========================================================================
|
| 31 |
tristanc |
86 |
void UninstallGameConsoleCommands () {
|
| 3 |
tristanc |
87 |
UninstallGameConsoleCommandsPtr();
|
|
|
88 |
|
|
|
89 |
// Unregister our own commands
|
|
|
90 |
ConsoleCommandUnregister("godmode");
|
| 33 |
tristanc |
91 |
ConsoleCommandUnregister("beastmaster");
|
| 3 |
tristanc |
92 |
|
|
|
93 |
DebugClientCommands::Uninstall();
|
| 6 |
tristanc |
94 |
GMClientCommands::Uninstall();
|
| 3 |
tristanc |
95 |
}
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
/****************************************************************************
|
|
|
99 |
*
|
| 31 |
tristanc |
100 |
* Detours setup
|
| 3 |
tristanc |
101 |
*
|
|
|
102 |
***/
|
|
|
103 |
|
|
|
104 |
//===========================================================================
|
| 31 |
tristanc |
105 |
void WowGM::InstallGameConsoleCommands () {
|
| 3 |
tristanc |
106 |
DETOUR_INIT;
|
|
|
107 |
DETOUR_ATTACH(InstallGameConsoleCommandsPtr,::InstallGameConsoleCommands);
|
|
|
108 |
DETOUR_ATTACH(UninstallGameConsoleCommandsPtr,::UninstallGameConsoleCommands);
|
|
|
109 |
DETOUR_COMMIT;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
//===========================================================================
|
| 31 |
tristanc |
113 |
void WowGM::UninstallGameConsoleCommands () {
|
| 3 |
tristanc |
114 |
DETOUR_INIT;
|
|
|
115 |
DETOUR_DETACH(InstallGameConsoleCommandsPtr,::InstallGameConsoleCommands);
|
|
|
116 |
DETOUR_DETACH(UninstallGameConsoleCommandsPtr,::UninstallGameConsoleCommands);
|
|
|
117 |
DETOUR_COMMIT;
|
|
|
118 |
}
|
| 32 |
tristanc |
119 |
|