Subversion Repositories WoWGM

Rev

Rev 31 | Rev 33 | 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 "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;
30
 
3 tristanc 31
void (*UninstallGameConsoleCommandsPtr)()	= *(void (*)())UNINSTALLGAMECONSOLECOMMANDSPTR;
32
 
33
 
34
/****************************************************************************
35
*
31 tristanc 36
*   Client Game Commands
3 tristanc 37
*
38
***/
39
 
40
//===========================================================================
31 tristanc 41
BOOL CCommand_GodMode (const char* cmd, const char* arguments) {	
3 tristanc 42
	if (arguments && *arguments) {
43
		int enable = atoi(arguments);
44
 
45
		CDataStore msg;
46
		msg.Put(CMSG_GODMODE);
47
		msg.Put(enable);
48
		msg.Finalize();
49
 
50
		ClientServices_Send(&msg);
51
	}
31 tristanc 52
 
3 tristanc 53
	return TRUE;
54
}
55
 
56
 
57
/****************************************************************************
58
*
31 tristanc 59
*   Private
3 tristanc 60
*
61
***/
62
 
63
//===========================================================================
31 tristanc 64
void InstallGameConsoleCommands () {
3 tristanc 65
	InstallGameConsoleCommandsPtr();
66
 
67
	// Register our own commands
68
	ConsoleCommandRegister("godmode",CCommand_GodMode,GAME,NOHELP);
69
 
70
	DebugClientCommands::Install();
6 tristanc 71
	GMClientCommands::Install();
3 tristanc 72
}
73
 
74
//===========================================================================
31 tristanc 75
void UninstallGameConsoleCommands () {
3 tristanc 76
	UninstallGameConsoleCommandsPtr();
77
 
78
	// Unregister our own commands
79
	ConsoleCommandUnregister("godmode");
80
 
81
	DebugClientCommands::Uninstall();
6 tristanc 82
	GMClientCommands::Uninstall();
3 tristanc 83
}
84
 
85
 
86
/****************************************************************************
87
*
31 tristanc 88
*   Detours setup
3 tristanc 89
*
90
***/
91
 
92
//===========================================================================
31 tristanc 93
void WowGM::InstallGameConsoleCommands () {
3 tristanc 94
	DETOUR_INIT;
95
	DETOUR_ATTACH(InstallGameConsoleCommandsPtr,::InstallGameConsoleCommands);
96
	DETOUR_ATTACH(UninstallGameConsoleCommandsPtr,::UninstallGameConsoleCommands);
97
	DETOUR_COMMIT;
98
}
99
 
100
//===========================================================================
31 tristanc 101
void WowGM::UninstallGameConsoleCommands () {
3 tristanc 102
	DETOUR_INIT;	
103
	DETOUR_DETACH(InstallGameConsoleCommandsPtr,::InstallGameConsoleCommands);
104
	DETOUR_DETACH(UninstallGameConsoleCommandsPtr,::UninstallGameConsoleCommands);
105
	DETOUR_COMMIT;
106
}
32 tristanc 107