mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Cleanup] Remove hard-coded Status Checks (#3727)
* [Cleanup] Remove hard-coded Status Checks # Notes - Removed the hard-coded GM status checks since if you have access to the command we can now limit access to subcommands if necessary. * Update client_packet.cpp
This commit is contained in:
+201
-188
@@ -1385,10 +1385,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
|
||||
InitInnates();
|
||||
|
||||
/* If GM not set in DB, and does not meet min status to be GM, reset */
|
||||
if (m_pp.gm && admin < minStatusToBeGM)
|
||||
m_pp.gm = 0;
|
||||
|
||||
/* Load Guild */
|
||||
if (!IsInAGuild()) {
|
||||
m_pp.guild_id = GUILD_NONE;
|
||||
@@ -1702,8 +1698,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
this is not quite where live sends inventory, they do it after tribute
|
||||
*/
|
||||
if (loaditems) { /* Don't load if a length error occurs */
|
||||
if (admin >= minStatusToBeGM)
|
||||
if (m_pp.gm) {
|
||||
m_inv.SetGMInventory(true); // set to true to allow expansion-restricted packets through
|
||||
}
|
||||
|
||||
BulkSendInventoryItems();
|
||||
/* Send stuff on the cursor which isn't sent in bulk */
|
||||
@@ -6238,7 +6235,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app)
|
||||
damage = 31337;
|
||||
}
|
||||
|
||||
if (admin >= minStatusToAvoidFalling && GetGM()) {
|
||||
if (GetGM()) {
|
||||
Message(
|
||||
Chat::Red,
|
||||
fmt::format(
|
||||
@@ -6446,84 +6443,90 @@ void Client::Handle_OP_GetGuildsList(const EQApplicationPacket *app)
|
||||
|
||||
void Client::Handle_OP_GMBecomeNPC(const EQApplicationPacket *app)
|
||||
{
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /becomenpc when they shouldn't be able to"});
|
||||
return;
|
||||
}
|
||||
|
||||
if (app->size != sizeof(BecomeNPC_Struct)) {
|
||||
LogError("Wrong size: OP_GMBecomeNPC, size=[{}], expected [{}]", app->size, sizeof(BecomeNPC_Struct));
|
||||
return;
|
||||
}
|
||||
//entity_list.QueueClients(this, app, false);
|
||||
BecomeNPC_Struct* bnpc = (BecomeNPC_Struct*)app->pBuffer;
|
||||
|
||||
Mob* cli = (Mob*)entity_list.GetMob(bnpc->id);
|
||||
if (cli == nullptr) {
|
||||
auto *b = (BecomeNPC_Struct *) app->pBuffer;
|
||||
|
||||
Mob *m = entity_list.GetMob(b->id);
|
||||
if (!m) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cli->IsClient()) {
|
||||
Client* target = cli->CastToClient();
|
||||
target->QueuePacket(app);
|
||||
if(target->GetGM()) {
|
||||
target->SetInvul(false);
|
||||
target->SetHideMe(false);
|
||||
target->SetGM(false);
|
||||
if (m->IsClient()) {
|
||||
Client *t = m->CastToClient();
|
||||
t->QueuePacket(app);
|
||||
if (t->GetGM()) {
|
||||
t->SetInvul(false);
|
||||
t->SetHideMe(false);
|
||||
t->SetGM(false);
|
||||
}
|
||||
|
||||
cli->SendAppearancePacket(AT_NPCName, 1, true);
|
||||
target->SetBecomeNPC(true);
|
||||
target->SetBecomeNPCLevel(bnpc->maxlevel);
|
||||
cli->MessageString(Chat::White, TOGGLE_OFF);
|
||||
target->tellsoff = true;
|
||||
target->UpdateWho();
|
||||
m->SendAppearancePacket(AT_NPCName, 1, true);
|
||||
t->SetBecomeNPC(true);
|
||||
t->SetBecomeNPCLevel(b->maxlevel);
|
||||
m->MessageString(Chat::White, TOGGLE_OFF);
|
||||
t->tellsoff = true;
|
||||
t->UpdateWho();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMDelCorpse(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(GMDelCorpse_Struct))
|
||||
if (app->size != sizeof(GMDelCorpse_Struct)) {
|
||||
return;
|
||||
if (Admin() < commandEditPlayerCorpses) {
|
||||
}
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /delcorpse"});
|
||||
return;
|
||||
}
|
||||
GMDelCorpse_Struct* dc = (GMDelCorpse_Struct *)app->pBuffer;
|
||||
Mob* corpse = entity_list.GetMob(dc->corpsename);
|
||||
if (corpse == 0) {
|
||||
|
||||
auto *c = (GMDelCorpse_Struct *) app->pBuffer;
|
||||
Mob *corpse = entity_list.GetMob(c->corpsename);
|
||||
if (!c) {
|
||||
return;
|
||||
}
|
||||
if (corpse->IsCorpse() != true) {
|
||||
|
||||
if (!corpse->IsCorpse()) {
|
||||
return;
|
||||
}
|
||||
|
||||
corpse->CastToCorpse()->Delete();
|
||||
std::cout << name << " deleted corpse " << dc->corpsename << std::endl;
|
||||
Message(Chat::Red, "Corpse %s deleted.", dc->corpsename);
|
||||
return;
|
||||
Message(Chat::Red, fmt::format("Corpse {} deleted.", c->corpsename).c_str());
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMEmoteZone(const EQApplicationPacket *app)
|
||||
{
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
return;
|
||||
}
|
||||
if (app->size != sizeof(GMEmoteZone_Struct)) {
|
||||
LogError("Wrong size: OP_GMEmoteZone, size=[{}], expected [{}]", app->size, sizeof(GMEmoteZone_Struct));
|
||||
return;
|
||||
}
|
||||
GMEmoteZone_Struct* gmez = (GMEmoteZone_Struct*)app->pBuffer;
|
||||
char* newmessage = nullptr;
|
||||
if (strstr(gmez->text, "^") == 0)
|
||||
entity_list.Message(Chat::White, 15, gmez->text);
|
||||
else {
|
||||
for (newmessage = strtok((char*)gmez->text, "^"); newmessage != nullptr; newmessage = strtok(nullptr, "^"))
|
||||
entity_list.Message(Chat::White, 15, newmessage);
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /emote"});
|
||||
return;
|
||||
}
|
||||
|
||||
auto *gmez = (GMEmoteZone_Struct*)app->pBuffer;
|
||||
char *newmessage = nullptr;
|
||||
if (strstr(gmez->text, "^") == 0) {
|
||||
entity_list.Message(0, Chat::White, gmez->text);
|
||||
} else {
|
||||
for (newmessage = strtok((char *) gmez->text, "^"); newmessage != nullptr; newmessage = strtok(nullptr, "^")) {
|
||||
entity_list.Message(0, Chat::White, newmessage);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app)
|
||||
@@ -6533,154 +6536,149 @@ void Client::Handle_OP_GMEndTraining(const EQApplicationPacket *app)
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
OPGMEndTraining(app);
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMFind(const EQApplicationPacket *app)
|
||||
{
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /find"});
|
||||
return;
|
||||
}
|
||||
|
||||
if (app->size != sizeof(GMFind_Struct)) {
|
||||
LogError("Wrong size: OP_GMFind, size=[{}], expected [{}]", app->size, sizeof(GMFind_Struct));
|
||||
return;
|
||||
}
|
||||
|
||||
//Break down incoming
|
||||
auto* request = (GMFind_Struct*) app->pBuffer;
|
||||
//Create a new outgoing
|
||||
auto outapp = new EQApplicationPacket(OP_GMFind, sizeof(GMFind_Struct));
|
||||
auto* foundplayer = (GMFind_Struct*) outapp->pBuffer;
|
||||
//Copy the constants
|
||||
strcpy(foundplayer->charname, request->charname);
|
||||
strcpy(foundplayer->gmname, request->gmname);
|
||||
//Check if the NPC exits intrazone...
|
||||
auto* gt = entity_list.GetMob(request->charname);
|
||||
if (gt) {
|
||||
foundplayer->success = 1;
|
||||
foundplayer->x = gt->GetX();
|
||||
foundplayer->y = gt->GetY();
|
||||
foundplayer->z = gt->GetZ();
|
||||
foundplayer->zoneID = zone->GetZoneID();
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /find"});
|
||||
return;
|
||||
}
|
||||
//Send the packet...
|
||||
|
||||
auto *r = (GMFind_Struct *) app->pBuffer;
|
||||
auto outapp = new EQApplicationPacket(OP_GMFind, sizeof(GMFind_Struct));
|
||||
auto *f = (GMFind_Struct *) outapp->pBuffer;
|
||||
|
||||
strcpy(f->charname, r->charname);
|
||||
strcpy(f->gmname, r->gmname);
|
||||
|
||||
auto* gt = entity_list.GetMob(r->charname);
|
||||
if (gt) {
|
||||
f->success = 1;
|
||||
f->x = gt->GetX();
|
||||
f->y = gt->GetY();
|
||||
f->z = gt->GetZ();
|
||||
f->zoneID = zone->GetZoneID();
|
||||
}
|
||||
|
||||
FastQueuePacket(&outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMGoto(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(GMSummon_Struct)) {
|
||||
std::cout << "Wrong size on OP_GMGoto. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
|
||||
LogError("Wrong size: OP_GMGoto, size=[{}], expected [{}]", app->size, sizeof(GMSummon_Struct));
|
||||
return;
|
||||
}
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /goto"});
|
||||
return;
|
||||
}
|
||||
GMSummon_Struct* gmg = (GMSummon_Struct*)app->pBuffer;
|
||||
Mob* gt = entity_list.GetMob(gmg->charname);
|
||||
if (gt != nullptr) {
|
||||
|
||||
auto *gmg = (GMSummon_Struct *) app->pBuffer;
|
||||
Mob *gt = entity_list.GetMob(gmg->charname);
|
||||
if (!gt) {
|
||||
MovePC(zone->GetZoneID(), zone->GetInstanceID(), gt->GetX(), gt->GetY(), gt->GetZ(), gt->GetHeading());
|
||||
}
|
||||
else if (!worldserver.Connected())
|
||||
} else if (!worldserver.Connected()) {
|
||||
Message(Chat::Red, "Error: World server disconnected.");
|
||||
else {
|
||||
} else {
|
||||
auto pack = new ServerPacket(ServerOP_GMGoto, sizeof(ServerGMGoto_Struct));
|
||||
memset(pack->pBuffer, 0, pack->size);
|
||||
ServerGMGoto_Struct* wsgmg = (ServerGMGoto_Struct*)pack->pBuffer;
|
||||
ServerGMGoto_Struct *wsgmg = (ServerGMGoto_Struct *) pack->pBuffer;
|
||||
strcpy(wsgmg->myname, GetName());
|
||||
strcpy(wsgmg->gotoname, gmg->charname);
|
||||
wsgmg->admin = admin;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMHideMe(const EQApplicationPacket *app)
|
||||
{
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /hideme"});
|
||||
return;
|
||||
}
|
||||
if (app->size != sizeof(SpawnAppearance_Struct)) {
|
||||
LogError("Wrong size: OP_GMHideMe, size=[{}], expected [{}]", app->size, sizeof(SpawnAppearance_Struct));
|
||||
return;
|
||||
}
|
||||
SpawnAppearance_Struct* sa = (SpawnAppearance_Struct*)app->pBuffer;
|
||||
Message(Chat::Red, "#: %i, %i", sa->type, sa->parameter);
|
||||
SetHideMe(!sa->parameter);
|
||||
return;
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /hideme"});
|
||||
return;
|
||||
}
|
||||
|
||||
auto *sa = (SpawnAppearance_Struct *) app->pBuffer;
|
||||
SetHideMe(!sa->parameter);
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMKick(const EQApplicationPacket *app)
|
||||
{
|
||||
if (app->size != sizeof(GMKick_Struct))
|
||||
if (app->size != sizeof(GMKick_Struct)) {
|
||||
return;
|
||||
if (Admin() < minStatusToKick) {
|
||||
}
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /kick"});
|
||||
return;
|
||||
}
|
||||
GMKick_Struct* gmk = (GMKick_Struct *)app->pBuffer;
|
||||
|
||||
Client* client = entity_list.GetClientByName(gmk->name);
|
||||
if (client == 0) {
|
||||
if (!worldserver.Connected())
|
||||
auto *gmk = (GMKick_Struct *)app->pBuffer;
|
||||
Client *c = entity_list.GetClientByName(gmk->name);
|
||||
if (!c) {
|
||||
if (!worldserver.Connected()) {
|
||||
Message(Chat::Red, "Error: World server disconnected");
|
||||
else {
|
||||
} else {
|
||||
auto pack = new ServerPacket(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
|
||||
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)pack->pBuffer;
|
||||
auto *skp = (ServerKickPlayer_Struct *) pack->pBuffer;
|
||||
strcpy(skp->adminname, gmk->gmname);
|
||||
strcpy(skp->name, gmk->name);
|
||||
skp->adminrank = Admin();
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
entity_list.QueueClients(this, app);
|
||||
//client->Kick();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMKill(const EQApplicationPacket *app)
|
||||
{
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /kill"});
|
||||
return;
|
||||
}
|
||||
if (app->size != sizeof(GMKill_Struct)) {
|
||||
LogError("Wrong size: OP_GMKill, size=[{}], expected [{}]", app->size, sizeof(GMKill_Struct));
|
||||
return;
|
||||
}
|
||||
GMKill_Struct* gmk = (GMKill_Struct *)app->pBuffer;
|
||||
Mob* obj = entity_list.GetMob(gmk->name);
|
||||
Client* client = entity_list.GetClientByName(gmk->name);
|
||||
if (obj != 0) {
|
||||
if (client != 0) {
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /kill"});
|
||||
return;
|
||||
}
|
||||
|
||||
auto *gmk = (GMKill_Struct *) app->pBuffer;
|
||||
Mob *obj = entity_list.GetMob(gmk->name);
|
||||
Client *c = entity_list.GetClientByName(gmk->name);
|
||||
if (obj) {
|
||||
if (c) {
|
||||
entity_list.QueueClients(this, app);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
obj->Kill();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!worldserver.Connected())
|
||||
} else {
|
||||
if (!worldserver.Connected()) {
|
||||
Message(Chat::Red, "Error: World server disconnected");
|
||||
else {
|
||||
} else {
|
||||
auto pack = new ServerPacket(ServerOP_KillPlayer, sizeof(ServerKillPlayer_Struct));
|
||||
ServerKillPlayer_Struct* skp = (ServerKillPlayer_Struct*)pack->pBuffer;
|
||||
auto *skp = (ServerKillPlayer_Struct *) pack->pBuffer;
|
||||
strcpy(skp->gmname, gmk->gmname);
|
||||
strcpy(skp->target, gmk->name);
|
||||
skp->admin = Admin();
|
||||
@@ -6688,7 +6686,6 @@ void Client::Handle_OP_GMKill(const EQApplicationPacket *app)
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
|
||||
@@ -6697,32 +6694,30 @@ void Client::Handle_OP_GMLastName(const EQApplicationPacket *app)
|
||||
std::cout << "Wrong size on OP_GMLastName. Got: " << app->size << ", Expected: " << sizeof(GMLastName_Struct) << std::endl;
|
||||
return;
|
||||
}
|
||||
GMLastName_Struct* gmln = (GMLastName_Struct*)app->pBuffer;
|
||||
if (strlen(gmln->lastname) >= 64) {
|
||||
Message(Chat::Red, "/LastName: New last name too long. (max=63)");
|
||||
}
|
||||
else {
|
||||
Client* client = entity_list.GetClientByName(gmln->name);
|
||||
if (client == 0) {
|
||||
Message(Chat::Red, "/LastName: %s not found", gmln->name);
|
||||
}
|
||||
else {
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /lastname"});
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
client->ChangeLastName(gmln->lastname);
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /lastname"});
|
||||
return;
|
||||
}
|
||||
|
||||
auto *gmln = (GMLastName_Struct *) app->pBuffer;
|
||||
if (strlen(gmln->lastname) >= 64) {
|
||||
Message(Chat::Red, "/LastName: New last name too long. Max length is 63.");
|
||||
} else {
|
||||
Client *c = entity_list.GetClientByName(gmln->name);
|
||||
if (!c) {
|
||||
Message(Chat::Red, fmt::format("/LastName: {} not found", gmln->name).c_str());
|
||||
} else {
|
||||
c->ChangeLastName(gmln->lastname);
|
||||
}
|
||||
|
||||
gmln->unknown[0] = 1;
|
||||
gmln->unknown[1] = 1;
|
||||
gmln->unknown[2] = 1;
|
||||
gmln->unknown[3] = 1;
|
||||
entity_list.QueueClients(this, app, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app)
|
||||
@@ -6731,44 +6726,49 @@ void Client::Handle_OP_GMNameChange(const EQApplicationPacket *app)
|
||||
LogError("Wrong size: OP_GMNameChange, size=[{}], expected [{}]", app->size, sizeof(GMName_Struct));
|
||||
return;
|
||||
}
|
||||
const GMName_Struct* gmn = (const GMName_Struct *)app->pBuffer;
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
|
||||
auto *gmn = (GMName_Struct *) app->pBuffer;
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /name"});
|
||||
return;
|
||||
}
|
||||
Client* client = entity_list.GetClientByName(gmn->oldname);
|
||||
LogInfo("GM([{}]) changeing players name. Old:[{}] New:[{}]", GetName(), gmn->oldname, gmn->newname);
|
||||
bool usedname = database.CheckUsedName(gmn->newname);
|
||||
if (client == 0) {
|
||||
Message(Chat::Red, "%s not found for name change. Operation failed!", gmn->oldname);
|
||||
return;
|
||||
}
|
||||
if ((strlen(gmn->newname) > 63) || (strlen(gmn->newname) == 0)) {
|
||||
Message(Chat::Red, "Invalid number of characters in new name (%s).", gmn->newname);
|
||||
return;
|
||||
}
|
||||
if (!usedname) {
|
||||
Message(Chat::Red, "%s is already in use. Operation failed!", gmn->newname);
|
||||
return;
|
||||
|
||||
Client *c = entity_list.GetClientByName(gmn->oldname);
|
||||
LogInfo("GM([{}]) changeing players name. Old:[{}] New:[{}]", GetName(), gmn->oldname, gmn->newname);
|
||||
|
||||
const bool used_name = database.CheckUsedName(gmn->newname);
|
||||
if (!c) {
|
||||
Message(Chat::Red, fmt::format("{} not found for name change. Operation failed!", gmn->oldname).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(gmn->newname) > 63 || strlen(gmn->newname) == 0) {
|
||||
Message(Chat::Red, fmt::format("Invalid number of characters in new name '{}'.", gmn->newname).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!used_name) {
|
||||
Message(Chat::Red, fmt::format("{} is already in use. Operation failed!", gmn->newname).c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
database.UpdateName(gmn->oldname, gmn->newname);
|
||||
strcpy(client->name, gmn->newname);
|
||||
client->Save();
|
||||
strcpy(c->name, gmn->newname);
|
||||
c->Save();
|
||||
|
||||
if (gmn->badname == 1) {
|
||||
database.AddToNameFilter(gmn->oldname);
|
||||
}
|
||||
EQApplicationPacket* outapp = app->Copy();
|
||||
GMName_Struct* gmn2 = (GMName_Struct*)outapp->pBuffer;
|
||||
|
||||
auto *outapp = app->Copy();
|
||||
auto *gmn2 = (GMName_Struct *) outapp->pBuffer;
|
||||
gmn2->unknown[0] = 1;
|
||||
gmn2->unknown[1] = 1;
|
||||
gmn2->unknown[2] = 1;
|
||||
entity_list.QueueClients(this, outapp, false);
|
||||
safe_delete(outapp);
|
||||
UpdateWho();
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
@@ -6863,6 +6863,13 @@ void Client::Handle_OP_GMSummon(const EQApplicationPacket *app)
|
||||
std::cout << "Wrong size on OP_GMSummon. Got: " << app->size << ", Expected: " << sizeof(GMSummon_Struct) << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /summon"});
|
||||
return;
|
||||
}
|
||||
|
||||
OPGMSummon(app);
|
||||
return;
|
||||
}
|
||||
@@ -6873,12 +6880,14 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
|
||||
std::cout << "Wrong size on OP_GMToggle. Got: " << app->size << ", Expected: " << sizeof(GMToggle_Struct) << std::endl;
|
||||
return;
|
||||
}
|
||||
if (Admin() < minStatusToUseGMCommands) {
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /toggle"});
|
||||
return;
|
||||
}
|
||||
GMToggle_Struct *ts = (GMToggle_Struct *)app->pBuffer;
|
||||
|
||||
auto *ts = (GMToggle_Struct *)app->pBuffer;
|
||||
if (ts->toggle == 0) {
|
||||
MessageString(Chat::White, TOGGLE_OFF);
|
||||
tellsoff = true;
|
||||
@@ -6886,10 +6895,10 @@ void Client::Handle_OP_GMToggle(const EQApplicationPacket *app)
|
||||
MessageString(Chat::White, TOGGLE_ON);
|
||||
tellsoff = false;
|
||||
} else {
|
||||
Message(Chat::White, "Unkown value in /toggle packet");
|
||||
Message(Chat::White, "Unknown value in /toggle packet.");
|
||||
}
|
||||
|
||||
UpdateWho();
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMTraining(const EQApplicationPacket *app)
|
||||
@@ -6899,6 +6908,7 @@ void Client::Handle_OP_GMTraining(const EQApplicationPacket *app)
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
OPGMTraining(app);
|
||||
return;
|
||||
}
|
||||
@@ -6910,6 +6920,7 @@ void Client::Handle_OP_GMTrainSkill(const EQApplicationPacket *app)
|
||||
DumpPacket(app);
|
||||
return;
|
||||
}
|
||||
|
||||
OPGMTrainSkill(app);
|
||||
return;
|
||||
}
|
||||
@@ -6920,27 +6931,30 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
|
||||
std::cout << "Wrong size on OP_GMZoneRequest. Got: " << app->size << ", Expected: " << sizeof(GMZoneRequest_Struct) << std::endl;
|
||||
return;
|
||||
}
|
||||
if (Admin() < minStatusToBeGM) {
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /zone"});
|
||||
return;
|
||||
}
|
||||
|
||||
auto* gmzr = (GMZoneRequest_Struct*)app->pBuffer;
|
||||
auto *gmzr = (GMZoneRequest_Struct *) app->pBuffer;
|
||||
float target_x = -1, target_y = -1, target_z = -1, target_heading;
|
||||
|
||||
int16 min_status = AccountStatus::Player;
|
||||
uint8 min_level = 0;
|
||||
char target_zone[32];
|
||||
uint16 zone_id = gmzr->zone_id;
|
||||
if (gmzr->zone_id == 0)
|
||||
int16 min_status = AccountStatus::Player;
|
||||
uint8 min_level = 0;
|
||||
char target_zone[32];
|
||||
uint16 zone_id = gmzr->zone_id;
|
||||
if (gmzr->zone_id == 0) {
|
||||
zone_id = zonesummon_id;
|
||||
}
|
||||
|
||||
const char* zone_short_name = ZoneName(zone_id);
|
||||
if (zone_short_name == nullptr)
|
||||
const char *zone_short_name = ZoneName(zone_id);
|
||||
if (zone_short_name == nullptr) {
|
||||
target_zone[0] = 0;
|
||||
else
|
||||
} else {
|
||||
strcpy(target_zone, zone_short_name);
|
||||
}
|
||||
|
||||
// this both loads the safe points and does a sanity check on zone name
|
||||
auto z = GetZone(target_zone, 0);
|
||||
@@ -6954,41 +6968,40 @@ void Client::Handle_OP_GMZoneRequest(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_GMZoneRequest, sizeof(GMZoneRequest_Struct));
|
||||
auto* gmzr2 = (GMZoneRequest_Struct*)outapp->pBuffer;
|
||||
auto *gmzr2 = (GMZoneRequest_Struct *) outapp->pBuffer;
|
||||
strcpy(gmzr2->charname, GetName());
|
||||
gmzr2->zone_id = gmzr->zone_id;
|
||||
gmzr2->x = target_x;
|
||||
gmzr2->y = target_y;
|
||||
gmzr2->z = target_z;
|
||||
gmzr2->x = target_x;
|
||||
gmzr2->y = target_y;
|
||||
gmzr2->z = target_z;
|
||||
gmzr2->heading = target_heading;
|
||||
// Next line stolen from ZoneChange as well... - This gives us a nicer message than the normal "zone is down" message...
|
||||
if (target_zone[0] != 0 && admin >= min_status && GetLevel() >= min_level)
|
||||
|
||||
if (target_zone[0] != 0 && admin >= min_status && GetLevel() >= min_level) {
|
||||
gmzr2->success = 1;
|
||||
else {
|
||||
std::cout << "GetZoneSafeCoords failed. zoneid = " << gmzr->zone_id << "; czone = " << zone->GetZoneID() << std::endl;
|
||||
} else {
|
||||
LogError("GetZoneSafeCoords failed. Zone ID [{}] Current Zone [{}]", gmzr->zone_id, zone->GetZoneID());
|
||||
gmzr2->success = 0;
|
||||
}
|
||||
|
||||
QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GMZoneRequest2(const EQApplicationPacket *app)
|
||||
{
|
||||
if (Admin() < minStatusToBeGM) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /zone"});
|
||||
return;
|
||||
}
|
||||
if (app->size < sizeof(uint32)) {
|
||||
LogError("OP size error: OP_GMZoneRequest2 expected:[{}] got:[{}]", sizeof(uint32), app->size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetGM()) {
|
||||
Message(Chat::Red, "Your account has been reported for hacking.");
|
||||
RecordPlayerEventLog(PlayerEvent::POSSIBLE_HACK, PlayerEvent::PossibleHackEvent{.message = "Used /zone"});
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 zonereq = *((uint32 *)app->pBuffer);
|
||||
GoToSafeCoords(zonereq, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app)
|
||||
|
||||
Reference in New Issue
Block a user