Subversion Repositories WoWGM

Rev

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

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