mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Commands] Consolidate #lock and #unlock Commands into #serverlock. (#2193)
- Convert the two commands into one command. - Cleanup struct naming.
This commit is contained in:
parent
6b85c914a5
commit
992e4ac59e
@ -740,8 +740,8 @@ struct ServerMultiLineMsg_Struct {
|
||||
};
|
||||
|
||||
struct ServerLock_Struct {
|
||||
char myname[64]; // User that did it
|
||||
uint8 mode; // 0 = Unlocked ; 1 = Locked
|
||||
char character_name[64];
|
||||
bool is_locked;
|
||||
};
|
||||
|
||||
struct ServerMotd_Struct {
|
||||
|
||||
@ -972,8 +972,8 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
break;
|
||||
}
|
||||
|
||||
auto slock = (ServerLock_Struct*) pack->pBuffer;
|
||||
if (slock->mode >= 1) {
|
||||
auto l = (ServerLock_Struct*) pack->pBuffer;
|
||||
if (l->is_locked) {
|
||||
WorldConfig::LockWorld();
|
||||
} else {
|
||||
WorldConfig::UnlockWorld();
|
||||
@ -982,24 +982,24 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
if (loginserverlist.Connected()) {
|
||||
loginserverlist.SendStatus();
|
||||
SendEmoteMessage(
|
||||
slock->myname,
|
||||
l->character_name,
|
||||
0,
|
||||
AccountStatus::Player,
|
||||
Chat::Red,
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"World {}.",
|
||||
slock->mode ? "locked" : "unlocked"
|
||||
l->is_locked ? "locked" : "unlocked"
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
SendEmoteMessage(
|
||||
slock->myname,
|
||||
l->character_name,
|
||||
0,
|
||||
AccountStatus::Player,
|
||||
Chat::Red,
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"World {}, but login server not connected.",
|
||||
slock->mode ? "locked" : "unlocked"
|
||||
l->is_locked ? "locked" : "unlocked"
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
@ -229,7 +229,6 @@ int command_init(void)
|
||||
command_add("listpetition", "- List petitions", AccountStatus::Guide, command_listpetition) ||
|
||||
command_add("load_shared_memory", "[shared_memory_name] - Reloads shared memory and uses the input as output", AccountStatus::GMImpossible, command_load_shared_memory) ||
|
||||
command_add("loc", "- Print out your or your target's current location and heading", AccountStatus::Player, command_loc) ||
|
||||
command_add("lock", "- Lock the worldserver", AccountStatus::GMLeadAdmin, command_lock) ||
|
||||
command_add("logs", "Manage anything to do with logs", AccountStatus::GMImpossible, command_logs) ||
|
||||
command_add("makepet", "[Pet Name] - Make a pet", AccountStatus::Guide, command_makepet) ||
|
||||
command_add("mana", "- Fill your or your target's mana", AccountStatus::Guide, command_mana) ||
|
||||
@ -299,6 +298,7 @@ int command_init(void)
|
||||
command_add("sendzonespawns", "- Refresh spawn list for all clients in zone", AccountStatus::GMLeadAdmin, command_sendzonespawns) ||
|
||||
command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", AccountStatus::Player, command_sensetrap) ||
|
||||
command_add("serverinfo", "- Get CPU, Operating System, and Process Information about the server", AccountStatus::GMMgmt, command_serverinfo) ||
|
||||
command_add("serverlock", "[0|1] - Lock or Unlock the World Server (0 = Unlocked, 1 = Locked)", AccountStatus::GMLeadAdmin, command_serverlock) ||
|
||||
command_add("serverrules", "- Read this server's rules", AccountStatus::Player, command_serverrules) ||
|
||||
command_add("setaapts", "[AA|Group|Raid] [AA Amount] - Set your or your player target's Available AA Points by Type", AccountStatus::GMAdmin, command_setaapts) ||
|
||||
command_add("setaaxp", "[AA|Group|Raid] [AA Experience] - Set your or your player target's AA Experience by Type", AccountStatus::GMAdmin, command_setaaxp) ||
|
||||
@ -355,7 +355,6 @@ int command_init(void)
|
||||
command_add("undye", "- Remove dye from all of your or your target's armor slots", AccountStatus::GMAdmin, command_undye) ||
|
||||
command_add("undyeme", "- Remove dye from all of your armor slots", AccountStatus::Player, command_undyeme) ||
|
||||
command_add("unfreeze", "- Unfreeze your target", AccountStatus::QuestTroupe, command_unfreeze) ||
|
||||
command_add("unlock", "- Unlock the worldserver", AccountStatus::GMLeadAdmin, command_unlock) ||
|
||||
command_add("unmemspell", "[Spell ID] - Unmemorize a Spell by ID for you or your target", AccountStatus::Guide, command_unmemspell) ||
|
||||
command_add("unmemspells", " - Unmemorize all spells for you or your target", AccountStatus::Guide, command_unmemspells) ||
|
||||
command_add("unscribespell", "[Spell ID] - Unscribe a spell from your or your target's spell book by Spell ID", AccountStatus::GMCoder, command_unscribespell) ||
|
||||
@ -1242,7 +1241,6 @@ void command_bot(Client *c, const Seperator *sep)
|
||||
#include "gm_commands/list.cpp"
|
||||
#include "gm_commands/listpetition.cpp"
|
||||
#include "gm_commands/loc.cpp"
|
||||
#include "gm_commands/lock.cpp"
|
||||
#include "gm_commands/logcommand.cpp"
|
||||
#include "gm_commands/logs.cpp"
|
||||
#include "gm_commands/makepet.cpp"
|
||||
@ -1314,6 +1312,7 @@ void command_bot(Client *c, const Seperator *sep)
|
||||
#include "gm_commands/sendzonespawns.cpp"
|
||||
#include "gm_commands/sensetrap.cpp"
|
||||
#include "gm_commands/serverinfo.cpp"
|
||||
#include "gm_commands/serverlock.cpp"
|
||||
#include "gm_commands/serverrules.cpp"
|
||||
#include "gm_commands/set_adventure_points.cpp"
|
||||
#include "gm_commands/setaapts.cpp"
|
||||
@ -1368,7 +1367,6 @@ void command_bot(Client *c, const Seperator *sep)
|
||||
#include "gm_commands/undye.cpp"
|
||||
#include "gm_commands/undyeme.cpp"
|
||||
#include "gm_commands/unfreeze.cpp"
|
||||
#include "gm_commands/unlock.cpp"
|
||||
#include "gm_commands/unmemspell.cpp"
|
||||
#include "gm_commands/unmemspells.cpp"
|
||||
#include "gm_commands/unscribespell.cpp"
|
||||
|
||||
@ -139,7 +139,6 @@ void command_list(Client *c, const Seperator *sep);
|
||||
void command_listpetition(Client *c, const Seperator *sep);
|
||||
void command_load_shared_memory(Client *c, const Seperator *sep);
|
||||
void command_loc(Client *c, const Seperator *sep);
|
||||
void command_lock(Client *c, const Seperator *sep);
|
||||
void command_logs(Client *c, const Seperator *sep);
|
||||
void command_makepet(Client *c, const Seperator *sep);
|
||||
void command_mana(Client *c, const Seperator *sep);
|
||||
@ -214,6 +213,7 @@ void command_revoke(Client *c, const Seperator *sep);
|
||||
void command_roambox(Client *c, const Seperator *sep);
|
||||
void command_rules(Client *c, const Seperator *sep);
|
||||
void command_save(Client *c, const Seperator *sep);
|
||||
void command_serverlock(Client *c, const Seperator *sep);
|
||||
void command_scale(Client *c, const Seperator *sep);
|
||||
void command_scribespell(Client *c, const Seperator *sep);
|
||||
void command_scribespells(Client *c, const Seperator *sep);
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
#include "../client.h"
|
||||
#include "../worldserver.h"
|
||||
|
||||
extern WorldServer worldserver;
|
||||
|
||||
void command_lock(Client *c, const Seperator *sep)
|
||||
{
|
||||
auto outpack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct));
|
||||
ServerLock_Struct *lss = (ServerLock_Struct *) outpack->pBuffer;
|
||||
strcpy(lss->myname, c->GetName());
|
||||
lss->mode = 1;
|
||||
worldserver.SendPacket(outpack);
|
||||
safe_delete(outpack);
|
||||
}
|
||||
|
||||
22
zone/gm_commands/serverlock.cpp
Normal file
22
zone/gm_commands/serverlock.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "../client.h"
|
||||
#include "../worldserver.h"
|
||||
|
||||
extern WorldServer worldserver;
|
||||
|
||||
void command_serverlock(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (!sep->IsNumber(1)) {
|
||||
c->Message(Chat::White, "Usage: #serverlock [0|1] - Lock or Unlock the World Server (0 = Unlocked, 1 = Locked)");
|
||||
return;
|
||||
}
|
||||
|
||||
auto is_locked = std::stoi(sep->arg[1]) ? true : false;
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct));
|
||||
auto l = (ServerLock_Struct *) pack->pBuffer;
|
||||
strn0cpy(l->character_name, c->GetCleanName(), sizeof(l->character_name));
|
||||
l->is_locked = is_locked;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
#include "../client.h"
|
||||
#include "../worldserver.h"
|
||||
|
||||
extern WorldServer worldserver;
|
||||
|
||||
void command_unlock(Client *c, const Seperator *sep)
|
||||
{
|
||||
auto outpack = new ServerPacket(ServerOP_Lock, sizeof(ServerLock_Struct));
|
||||
ServerLock_Struct *lss = (ServerLock_Struct *) outpack->pBuffer;
|
||||
strcpy(lss->myname, c->GetName());
|
||||
lss->mode = 0;
|
||||
worldserver.SendPacket(outpack);
|
||||
safe_delete(outpack);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user