Subversion Repositories WoWGM

Rev

Rev 31 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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