Subversion Repositories WoWGM

Rev

Rev 25 | Rev 32 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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