Subversion Repositories WoWGM

Rev

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

Rev 31 Rev 32
Line -... Line 1...
-
 
1
/****************************************************************************
-
 
2
*
-
 
3
*		ClientGMCommands.cpp
-
 
4
*
-
 
5
*		Written by Tristan Cormier
-
 
6
*		11.20.24
-
 
7
*
-
 
8
***/
-
 
9
 
-
 
10
 
1
#include "pch.h"
11
#include "pch.h"
2
#pragma hdrstop
12
#pragma hdrstop
3
 
13
 
4
#include "ClientGMCommands.h"
14
#include "ClientGMCommands.h"
5
 
15
 
Line 12... Line 22...
12
*   Private
22
*   Private
13
*
23
*
14
***/
24
***/
15
 
25
 
16
//===========================================================================
26
//===========================================================================
17
char const* GetWord (const char* string, char* buffer, uint bufferchars) {
27
char const* GetWord (char const* string, char* buffer, uint bufferchars) {
18
 
28
	//TODO:
19
  //ASSERT(string);
29
  //ASSERT(string);
20
  //ASSERT(buffer || bufferchars);
30
  //ASSERT(buffer || bufferchars);
21
 
31
	
22
  uint length = bufferchars - 1;
32
  uint length = bufferchars - 1;
23
  for (uint i = 0; i != length; i++) {
33
  for (uint i = 0; i != length; i++) {
24
    if (buffer[i] == ' ')
34
    if (buffer[i] == ' ')
25
      break;
35
      break;
26
    buffer[i] = *string;
36
    buffer[i] = *string;
27
    ++string;
37
    ++string;
28
  };
38
  };
29
 
-
 
30
  return string;    
39
  return string;    
31
}
40
}
32
 
41
 
33
 
42
 
34
/****************************************************************************
43
/****************************************************************************
Line 36... Line 45...
36
*   Client GM Commands
45
*   Client GM Commands
37
*
46
*
38
***/
47
***/
39
 
48
 
40
//===========================================================================
49
//===========================================================================
41
BOOL CCommand_GMResurrect (const char *command, const char *arguments) {
50
BOOL CCommand_GMResurrect (char const* command, char const* arguments) {
42
	if (command && *command) {
51
	if (command && *command) {
43
		CDataStore msg;
52
		CDataStore msg;
44
		msg.Put(CMSG_GM_RESURRECT);
53
		msg.Put(CMSG_GM_RESURRECT);
45
		msg.PutString(arguments);
54
		msg.PutString(arguments);
46
		msg.Finalize();
55
		msg.Finalize();
-
 
56
 
47
		ClientServices_Send(&msg);
57
		ClientServices_Send(&msg);
48
	} else {
-
 
49
		ConsoleWrite("Expected a player name", DEFAULT_COLOR);
-
 
50
	}
58
	}
-
 
59
	else
-
 
60
		ConsoleWrite("Expected a player name", DEFAULT_COLOR);
-
 
61
	
51
	return TRUE;
62
	return TRUE;
52
}
63
}
53
 
64
 
54
//===========================================================================
65
//===========================================================================
55
BOOL CCommand_SetSecurity (char const* command, char const* arguments) {
66
BOOL CCommand_SetSecurity (char const* command, char const* arguments) {
56
  char name[49];
67
  char name[49];
-
 
68
	GetWord(command, name, sizeof(name));
57
 
69
 
58
  GetWord(command, name, sizeof(name));
-
 
59
  int security = SStrToInt(command);
70
	int security = SStrToInt(command);
60
 
71
 
61
  ConsoleWriteA("Setting '%s' to security group %d", DEFAULT_COLOR, name, security);
72
  ConsoleWriteA("Setting '%s' to security group %d", DEFAULT_COLOR, name, security);
62
 
73
 
63
  CDataStore msg;
74
  CDataStore msg;
64
  msg.Put(CMSG_SET_SECURITY_GROUP);
75
  msg.Put(CMSG_SET_SECURITY_GROUP);
Line 86... Line 97...
86
//===========================================================================
97
//===========================================================================
87
void GMClientCommands::Uninstall () {
98
void GMClientCommands::Uninstall () {
88
  ConsoleCommandUnregister("setsecurity");
99
  ConsoleCommandUnregister("setsecurity");
89
	ConsoleCommandUnregister("resurrect");
100
	ConsoleCommandUnregister("resurrect");
90
}
101
}
-
 
102