Subversion Repositories WoWGM

Rev

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