Subversion Repositories WoWGM

Rev

Rev 32 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
36 tristanc 1
/******************************************************************************
32 tristanc 2
*
36 tristanc 3
*   ClientGMCommands.cpp
32 tristanc 4
*
5
*
36 tristanc 6
*   By Tristan Cormier - 11/20/2024
7
*
32 tristanc 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
 
36 tristanc 20
/******************************************************************************
31 tristanc 21
*
22
*   Private
23
*
24
***/
25
 
36 tristanc 26
//=============================================================================
27
const char * GetWord (const char * string, char * buffer, uint bufferchars) {
28
    //TODO:
29
    //ASSERT(string);
30
    //ASSERT(buffer || bufferchars);
31
 
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;    
26 tristanc 40
}
41
 
42
 
36 tristanc 43
/******************************************************************************
6 tristanc 44
*
36 tristanc 45
*   Exports
6 tristanc 46
*
47
***/
48
 
36 tristanc 49
//=============================================================================
50
BOOL CCommand_GMResurrect (const char * command, const char * arguments) {
51
    if (command && *command) {
52
        CDataStore msg;
53
        msg.Put(CMSG_GM_RESURRECT);
54
        msg.PutString(arguments);
55
        msg.Finalize();
32 tristanc 56
 
36 tristanc 57
        ClientServices_Send(&msg);
58
    }
59
    else
60
        ConsoleWrite("Expected a player name", DEFAULT_COLOR);
61
 
62
    return TRUE;
6 tristanc 63
}
64
 
36 tristanc 65
//=============================================================================
66
BOOL CCommand_SetSecurity (const char * command, const char * arguments) {
67
    char name[49];
68
    GetWord(command, name, sizeof(name));
69
 
70
    int security = SStrToInt(command);
6 tristanc 71
 
36 tristanc 72
    ConsolePrintf("Setting '%s' to security group %d", name, security);
26 tristanc 73
 
36 tristanc 74
    CDataStore msg;
75
    msg.Put(CMSG_SET_SECURITY_GROUP);
76
    msg.Put(security);
77
    msg.Finalize();
26 tristanc 78
 
36 tristanc 79
    ClientServices_Send(&msg);
26 tristanc 80
 
36 tristanc 81
    return TRUE;
26 tristanc 82
}
83
 
36 tristanc 84
//=============================================================================
85
void GMClientCommands::Install () {
86
    ConsoleCommandRegister(
87
        "setsecurity",
88
        CCommand_SetSecurity,
89
        GM,
90
        "Set another character's security group"
91
    );
26 tristanc 92
 
36 tristanc 93
    ConsoleCommandRegister("resurrect", CCommand_GMResurrect, DEBUG, NOHELP);
6 tristanc 94
}
95
 
36 tristanc 96
//=============================================================================
31 tristanc 97
void GMClientCommands::Uninstall () {
36 tristanc 98
    ConsoleCommandUnregister("setsecurity");
99
    ConsoleCommandUnregister("resurrect");
6 tristanc 100
}
32 tristanc 101
 
36 tristanc 102
 
103
//===================================
104
// MIT License
105
//
106
// Copyright (c) 2024 by Tristan Cormier
107
//
108
// Permission is hereby granted, free of charge, to any person obtaining a copy
109
// of this software and associated documentation files (the "Software"), to deal
110
// in the Software without restriction, including without limitation the rights
111
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
112
// copies of the Software, and to permit persons to whom the Software is
113
// furnished to do so, subject to the following conditions:
114
//
115
// The above copyright notice and this permission notice shall be included in
116
// all copies or substantial portions of the Software.
117
// 
118
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
119
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
120
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
121
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
122
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
123
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
124
// THE SOFTWARE.
125
//===================================