Subversion Repositories WoWGM

Rev

Rev 6 | Rev 31 | 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
6 tristanc 3
 
4
#include "ClientGMCommands.h"
5
 
6
#include <Console/ConsoleClient.h>
7
#include <WowSvcs/ClientServices.h>
8
 
26 tristanc 9
 
10
//===========================================================================
11
char const* GetWord (const char* string, char* buffer, uint bufferchars) {
12
 
13
  //ASSERT(string);
14
  //ASSERT(buffer || bufferchars);
15
 
16
  uint length = bufferchars - 1;
17
  for (uint i = 0; i != length; i++) {
18
    if (buffer[i] == ' ')
19
      break;
20
    buffer[i] = *string;
21
    ++string;
22
  };
23
 
24
  return string;    
25
}
26
 
27
 
6 tristanc 28
/****************************************************************************
29
*
30
*	Command definitions
31
*
32
***/
33
 
34
//===========================================================================
35
BOOL CCommand_GMResurrect(const char *command, const char *arguments)
36
{
37
	if (command && *command) {
38
		CDataStore msg;
39
		msg.Put(CMSG_GM_RESURRECT);
40
		msg.PutString(arguments);
41
		msg.Finalize();
42
		ClientServices_Send(&msg);
43
	} else {
44
		ConsoleWrite("Expected a player name", DEFAULT_COLOR);
45
	}
46
	return TRUE;
47
}
48
 
26 tristanc 49
//===========================================================================
50
BOOL CCommand_SetSecurity (char const* command, char const* arguments) {
51
  char name[49];
6 tristanc 52
 
26 tristanc 53
  GetWord(command, name, sizeof(name));
54
  int security = SStrToInt(command);
55
 
56
  ConsoleWriteA("Setting '%s' to security group %d", DEFAULT_COLOR, name, security);
57
 
58
  CDataStore msg;
59
  msg.Put(CMSG_SET_SECURITY_GROUP);
60
  msg.Put(security);
61
  msg.Finalize();
62
 
63
  ClientServices_Send(&msg);
64
 
65
  return TRUE;
66
}
67
 
68
 
6 tristanc 69
/****************************************************************************
70
*
71
*	External functions
72
*
73
***/
74
 
75
//===========================================================================
76
void GMClientCommands::Install()
77
{
26 tristanc 78
  ConsoleCommandRegister("setsecurity",CCommand_SetSecurity,GM,"Set another character's security group");
6 tristanc 79
	ConsoleCommandRegister("resurrect",CCommand_GMResurrect,DEBUG,NOHELP);
80
}
81
 
82
//===========================================================================
83
void GMClientCommands::Uninstall()
84
{
26 tristanc 85
  ConsoleCommandUnregister("setsecurity");
6 tristanc 86
	ConsoleCommandUnregister("resurrect");
87
}