[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:
Alex King 2023-12-03 11:44:30 -05:00 committed by GitHub
parent 22994e3264
commit e719aa43cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 649 additions and 862 deletions

View File

@ -238,25 +238,6 @@ enum { //some random constants
// Timer to update aggrometer
#define AGGRO_METER_UPDATE_MS 1000
//Some hard coded statuses from commands and other places:
enum {
minStatusToBeGM = 40,
minStatusToUseGMCommands = 80,
minStatusToKick = 150,
minStatusToAvoidFalling = 100,
minStatusToIgnoreZoneFlags = 80,
minStatusToSeeOthersZoneFlags = 80,
minStatusToEditOtherGuilds = 80,
commandMovecharSelfOnly = 80, //below this == only self move allowed
commandMovecharToSpecials = 200, //ability to send people to cshom/load zones
commandCastSpecials = 100, //can cast special spells
commandDoAnimOthers = 100, //can #doanim on others
commandEditPlayerCorpses = 150, //can Edit Player Corpses
commandInterrogateInv = 100, //below this == only log on error state and self-only target dump
commandInvSnapshot = 150 //ability to clear/restore snapshots
};
// This is the item ID we use for say links, we use the max that fits in 5 ASCII chars
#define SAYLINK_ITEM_ID 0xFFFFF

View File

@ -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)

View File

@ -277,7 +277,7 @@ void Doors::HandleClick(Client *sender, uint8 trigger)
// enforce flags before they hit zoning process
auto z = GetZone(m_destination_zone_name, 0);
if (z && !z->flag_needed.empty() && Strings::IsNumber(z->flag_needed) && Strings::ToInt(z->flag_needed) == 1) {
if (sender->Admin() < minStatusToIgnoreZoneFlags && !sender->HasZoneFlag(z->zoneidnumber)) {
if (!sender->GetGM() && !sender->HasZoneFlag(z->zoneidnumber)) {
LogInfo(
"Character [{}] does not have the flag to be in this zone [{}]!",
sender->GetCleanName(),

View File

@ -23,10 +23,7 @@ void command_castspell(Client *c, const Seperator *sep)
const uint16 spell_id = Strings::ToUnsignedInt(sep->arg[1]);
if (IsCastRestrictedSpell(spell_id) && c->Admin() < commandCastSpecials) {
c->Message(Chat::White, "Unable to cast spell.");
return;
} else if (spell_id >= SPDAT_RECORDS) {
if (spell_id >= SPDAT_RECORDS) {
c->Message(Chat::White, "Invalid Spell ID.");
return;
}

View File

@ -9,18 +9,22 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(Chat::White, "Usage: #corpse deletenpccorpses - Deletes all NPC corpses");
c->Message(Chat::White, "Usage: #corpse inspectloot - Inspects the loot on a corpse");
c->Message(Chat::White, "Usage: #corpse listnpc - Lists all NPC corpses");
c->Message(Chat::White, "Usage: #corpse lock - Locks the corpse, only GMs can loot the corpse when it is locked");
c->Message(
Chat::White,
"Usage: #corpse lock - Locks the corpse, only GMs can loot the corpse when it is locked"
);
c->Message(Chat::White, "Usage: #corpse removecash - Removes the cash from a corpse");
c->Message(Chat::White, "Usage: #corpse unlock - Unlocks the corpses, allowing non-GMs to loot the corpse");
if (c->Admin() >= commandEditPlayerCorpses) {
c->Message(Chat::White, "Usage: #corpse charid [Character ID] - Change player corpse's owner");
c->Message(Chat::White, "Usage: #corpse deleteplayercorpses - Deletes all player corpses");
c->Message(Chat::White, "Usage: #corpse depop [Bury] - Depops single target corpse.");
c->Message(Chat::White, "Usage: #corpse depopall [Bury] - Depops all target player's corpses.");
c->Message(Chat::White, "Usage: #corpse listplayer - Lists all player corpses");
c->Message(Chat::White, "Usage: #corpse moveallgraveyard - Moves all player corpses to the current zone's graveyard or non-instance");
c->Message(Chat::White, "Note: Set bury to 0 to skip burying the corpses.");
}
c->Message(Chat::White, "Usage: #corpse charid [Character ID] - Change player corpse's owner");
c->Message(Chat::White, "Usage: #corpse deleteplayercorpses - Deletes all player corpses");
c->Message(Chat::White, "Usage: #corpse depop [Bury] - Depops single target corpse.");
c->Message(Chat::White, "Usage: #corpse depopall [Bury] - Depops all target player's corpses.");
c->Message(Chat::White, "Usage: #corpse listplayer - Lists all player corpses");
c->Message(
Chat::White,
"Usage: #corpse moveallgraveyard - Moves all player corpses to the current zone's graveyard or non-instance"
);
c->Message(Chat::White, "Note: Set bury to 0 to skip burying the corpses.");
return;
}
@ -59,72 +63,57 @@ void command_corpse(Client *c, const Seperator *sep)
c->Message(Chat::White, "Usage: #corpse deletenpccorpses - Deletes all NPC corpses");
c->Message(Chat::White, "Usage: #corpse inspectloot - Inspects the loot on a corpse");
c->Message(Chat::White, "Usage: #corpse listnpc - Lists all NPC corpses");
c->Message(Chat::White, "Usage: #corpse lock - Locks the corpse, only GMs can loot the corpse when it is locked");
c->Message(
Chat::White,
"Usage: #corpse lock - Locks the corpse, only GMs can loot the corpse when it is locked"
);
c->Message(Chat::White, "Usage: #corpse removecash - Removes the cash from a corpse");
c->Message(Chat::White, "Usage: #corpse unlock - Unlocks the corpses, allowing non-GMs to loot the corpse");
if (c->Admin() >= commandEditPlayerCorpses) {
c->Message(Chat::White, "Usage: #corpse charid [Character ID] - Change player corpse's owner");
c->Message(Chat::White, "Usage: #corpse deleteplayercorpses - Deletes all player corpses");
c->Message(Chat::White, "Usage: #corpse depop [Bury] - Depops single target corpse.");
c->Message(Chat::White, "Usage: #corpse depopall [Bury] - Depops all target player's corpses.");
c->Message(Chat::White, "Usage: #corpse listplayer - Lists all player corpses");
c->Message(Chat::White, "Usage: #corpse moveallgraveyard - Moves all player corpses to the current zone's graveyard or non-instance");
c->Message(Chat::White, "Note: Set bury to 0 to skip burying the corpses.");
}
c->Message(Chat::White, "Usage: #corpse charid [Character ID] - Change player corpse's owner");
c->Message(Chat::White, "Usage: #corpse deleteplayercorpses - Deletes all player corpses");
c->Message(Chat::White, "Usage: #corpse depop [Bury] - Depops single target corpse.");
c->Message(Chat::White, "Usage: #corpse depopall [Bury] - Depops all target player's corpses.");
c->Message(Chat::White, "Usage: #corpse listplayer - Lists all player corpses");
c->Message(
Chat::White,
"Usage: #corpse moveallgraveyard - Moves all player corpses to the current zone's graveyard or non-instance"
);
c->Message(Chat::White, "Note: Set bury to 0 to skip burying the corpses.");
return;
}
if (is_delete_player_corpses) {
if (c->Admin() >= commandEditPlayerCorpses) {
auto corpses_deleted = entity_list.DeletePlayerCorpses();
auto deleted_string = (
corpses_deleted ?
fmt::format(
"{} Player corpse{} deleted.",
corpses_deleted,
corpses_deleted != 1 ? "s" : ""
) :
"There are no player corpses to delete."
);
c->Message(Chat::White, deleted_string.c_str());
} else {
c->Message(Chat::White, "Your status is not high enough to delete player corpses.");
return;
}
auto corpses_deleted = entity_list.DeletePlayerCorpses();
auto deleted_string = (
corpses_deleted ?
fmt::format(
"{} Player corpse{} deleted.",
corpses_deleted,
corpses_deleted != 1 ? "s" : ""
) :
"There are no player corpses to delete."
);
c->Message(Chat::White, deleted_string.c_str());
} else if (is_delete) {
if (!target || !target->IsCorpse()) {
c->Message(Chat::White, "You must target a corpse to use this command.");
return;
}
if (target->IsPlayerCorpse() && c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to delete a player corpse.");
return;
}
c->Message(
Chat::White,
fmt::format(
"Deleting {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
c->GetTargetDescription(target)
).c_str()
);
if (
target->IsNPCCorpse() ||
c->Admin() >= commandEditPlayerCorpses
) {
c->Message(
Chat::White,
fmt::format(
"Deleting {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
c->GetTargetDescription(target)
).c_str()
);
target->CastToCorpse()->Delete();
}
target->CastToCorpse()->Delete();
} else if (is_list_npc) {
entity_list.ListNPCCorpses(c);
} else if (is_list_player) {
if (c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to list player corpses.");
return;
}
entity_list.ListPlayerCorpses(c);
} else if (is_delete_npc_corpses) {
auto corpses_deleted = entity_list.DeleteNPCCorpses();
@ -139,42 +128,32 @@ void command_corpse(Client *c, const Seperator *sep)
);
c->Message(Chat::White, deleted_string.c_str());
} else if (is_character_id) {
if (c->Admin() >= commandEditPlayerCorpses) {
if (!target || !target->IsPlayerCorpse()) {
c->Message(Chat::White, "You must target a player corpse to use this command.");
return;
}
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "Usage: #corpse charid [Character ID] - Change player corpse's owner");
return;
}
auto character_id = Strings::ToInt(sep->arg[2]);
c->Message(
Chat::White,
fmt::format(
"Setting the owner to {} ({}) for the player corpse {}.",
database.GetCharNameByID(character_id),
target->CastToCorpse()->SetCharID(character_id),
c->GetTargetDescription(target)
).c_str()
);
} else {
c->Message(Chat::White, "Your status is not high enough to modify a player corpse's owner.");
if (!target || !target->IsPlayerCorpse()) {
c->Message(Chat::White, "You must target a player corpse to use this command.");
return;
}
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "Usage: #corpse charid [Character ID] - Change player corpse's owner");
return;
}
const uint32 character_id = Strings::ToUnsignedInt(sep->arg[2]);
c->Message(
Chat::White,
fmt::format(
"Setting the owner to {} ({}) for the player corpse {}.",
database.GetCharNameByID(character_id),
target->CastToCorpse()->SetCharID(character_id),
c->GetTargetDescription(target)
).c_str()
);
} else if (is_reset_looter) {
if (!target || !target->IsCorpse()) {
c->Message(Chat::White, "You must target a corpse to use this command.");
return;
}
if (target->IsPlayerCorpse() && c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to reset looter on a player corpse.");
return;
}
target->CastToCorpse()->ResetLooter();
c->Message(
Chat::White,
@ -190,36 +169,22 @@ void command_corpse(Client *c, const Seperator *sep)
return;
}
if (target->IsPlayerCorpse() && c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to remove cash from a player corpse.");
return;
}
target->CastToCorpse()->RemoveCash();
if (
target->IsNPCCorpse() ||
c->Admin() >= commandEditPlayerCorpses
) {
target->CastToCorpse()->RemoveCash();
c->Message(
Chat::White,
fmt::format(
"Removed cash from {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
c->GetTargetDescription(target)
).c_str()
);
}
c->Message(
Chat::White,
fmt::format(
"Removed cash from {} corpse {}.",
target->IsNPCCorpse() ? "NPC" : "player",
c->GetTargetDescription(target)
).c_str()
);
} else if (is_inspect_loot) {
if (!target || !target->IsCorpse()) {
c->Message(Chat::White, "You must target a corpse to use this command.");
return;
}
if (target->IsPlayerCorpse() && c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to inspect the loot of a player corpse.");
return;
}
target->CastToCorpse()->QueryLoot(c);
} else if (is_lock) {
if (!target || !target->IsCorpse()) {
@ -227,11 +192,6 @@ void command_corpse(Client *c, const Seperator *sep)
return;
}
if (target->IsPlayerCorpse() && c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to lock player corpses.");
return;
}
target->CastToCorpse()->Lock();
c->Message(
Chat::White,
@ -247,11 +207,6 @@ void command_corpse(Client *c, const Seperator *sep)
return;
}
if (target->IsPlayerCorpse() && c->Admin() < commandEditPlayerCorpses) {
c->Message(Chat::White, "Your status is not high enough to unlock player corpses.");
return;
}
target->CastToCorpse()->UnLock();
c->Message(
Chat::White,
@ -267,30 +222,20 @@ void command_corpse(Client *c, const Seperator *sep)
return;
}
if (c->Admin() >= commandEditPlayerCorpses) {
bool bury_corpse = (
sep->IsNumber(2) ?
(
Strings::ToInt(sep->arg[2]) != 0 ?
true :
false
) :
false
);
c->Message(
Chat::White,
fmt::format(
"Depopping player corpse {}.",
c->GetTargetDescription(target)
).c_str()
);
target->CastToCorpse()->DepopPlayerCorpse();
if (bury_corpse) {
target->CastToCorpse()->Bury();
}
} else {
c->Message(Chat::White, "Your status is not high enough to depop a player corpse.");
return;
const bool bury_corpse = sep->IsNumber(2) ? Strings::ToBool(sep->arg[2]) : false;
c->Message(
Chat::White,
fmt::format(
"Depopping player corpse {}.",
c->GetTargetDescription(target)
).c_str()
);
target->CastToCorpse()->DepopPlayerCorpse();
if (bury_corpse) {
target->CastToCorpse()->Bury();
}
} else if (is_depop_all) {
if (!target || !target->IsClient()) {
@ -298,50 +243,36 @@ void command_corpse(Client *c, const Seperator *sep)
return;
}
if (c->Admin() >= commandEditPlayerCorpses) {
bool bury_corpse = (
sep->IsNumber(2) ?
(
Strings::ToInt(sep->arg[2]) != 0 ?
true :
false
) :
false
);
const bool bury_corpse = sep->IsNumber(2) ? Strings::ToBool(sep->arg[2]) : false;
c->Message(
Chat::White,
fmt::format(
"Depopping all player corpses for {}.",
c->GetTargetDescription(target)
).c_str()
);
target->CastToClient()->DepopAllCorpses();
if (bury_corpse) {
target->CastToClient()->BuryPlayerCorpses();
}
} else if (is_move_all_to_graveyard) {
const int moved_count = entity_list.MovePlayerCorpsesToGraveyard(true);
if (moved_count) {
c->Message(
Chat::White,
fmt::format(
"Depopping all player corpses for {}.",
c->GetTargetDescription(target)
"Moved {} player corpse{} to graveyard in {} ({}).",
moved_count,
moved_count != 1 ? "s" : "",
ZoneLongName(zone->GetZoneID()),
ZoneName(zone->GetZoneID())
).c_str()
);
target->CastToClient()->DepopAllCorpses();
if (bury_corpse) {
target->CastToClient()->BuryPlayerCorpses();
}
} else {
c->Message(Chat::White, "Your status is not high enough to depop all of a player's corpses.");
return;
}
} else if (is_move_all_to_graveyard) {
int moved_count = entity_list.MovePlayerCorpsesToGraveyard(true);
if (c->Admin() >= commandEditPlayerCorpses) {
if (moved_count) {
c->Message(
Chat::White,
fmt::format(
"Moved {} player corpse{} to graveyard in {} ({}).",
moved_count,
moved_count != 1 ? "s" : "",
ZoneLongName(zone->GetZoneID()),
ZoneName(zone->GetZoneID())
).c_str()
);
} else {
c->Message(Chat::White, "There are no player corpses to move to the graveyard.");
}
} else {
c->Message(Chat::White, "Your status is not high enough to move all player corpses to the graveyard.");
c->Message(Chat::White, "There are no player corpses to move to the graveyard.");
}
}
}

View File

@ -10,7 +10,7 @@ void command_doanim(Client *c, const Seperator *sep)
}
Mob* t = c;
if (c->GetTarget() && c->Admin() >= commandDoAnimOthers) {
if (c->GetTarget()) {
t = c->GetTarget();
}

View File

@ -81,11 +81,6 @@ void command_guild(Client *c, const Seperator *sep)
).c_str()
);
} else {
if (c->Admin() < minStatusToEditOtherGuilds) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
auto guild_name = sep->argplus[3];
auto guild_id = guild_mgr.CreateGuild(sep->argplus[3], leader_id);
@ -144,16 +139,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds) {
if (c->GuildID() != guild_id) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
} else if (!guild_mgr.CheckGMStatus(guild_id, c->Admin())) {
c->Message(Chat::White, "You cannot edit your current guild, your status is not high enough.");
return;
}
}
LogGuilds(
"[{}]: Deleting guild [{}] ([{}]) with GM command",
c->GetName(),
@ -175,16 +160,10 @@ void command_guild(Client *c, const Seperator *sep)
SendGuildSubCommands(c);
} else if (is_info) {
if (arguments != 2 && c->IsInAGuild()) {
if (c->Admin() >= minStatusToEditOtherGuilds) {
c->Message(Chat::White, "#guild info [Guild ID]");
} else {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
}
c->Message(Chat::White, "#guild info [Guild ID]");
} else {
auto guild_id = GUILD_NONE;
if (arguments != 2 || !sep->IsNumber(2)) {
guild_id = c->GuildID();
} else if (c->Admin() >= minStatusToEditOtherGuilds) {
if (sep->IsNumber(2)) {
guild_id = Strings::ToUnsignedInt(sep->arg[2]);
}
@ -193,11 +172,6 @@ void command_guild(Client *c, const Seperator *sep)
}
}
} else if (is_list) {
if (c->Admin() < minStatusToEditOtherGuilds) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
guild_mgr.ListGuilds(c, std::string());
} else if (is_rename) {
if (!sep->IsNumber(2)) {
@ -215,16 +189,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds) {
if (c->GuildID() != guild_id) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
} else if (!guild_mgr.CheckGMStatus(guild_id, c->Admin())) {
c->Message(Chat::White, "You cannot edit your current guild, your status is not high enough.");
return;
}
}
auto new_guild_name = sep->argplus[3];
LogGuilds(
"[{}]: Renaming guild [{}] ([{}]) to [{}] with GM command",
@ -293,11 +257,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds && guild_id != c->GuildID()) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
if (!guild_id || guild_id == GUILD_NONE) {
LogGuilds(
"[{}]: Removing [{}] ([{}]) from guild with GM command",
@ -390,16 +349,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds) {
if (c->GuildID() != guild_id) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
} else if (!guild_mgr.CheckGMStatus(guild_id, c->Admin())) {
c->Message(Chat::White, "You cannot edit your current guild, your status is not high enough.");
return;
}
}
LogGuilds(
"[{}]: Setting leader of guild [{}] ([{}]) to [{}] with GM command",
c->GetName(),
@ -461,11 +410,6 @@ void command_guild(Client *c, const Seperator *sep)
return;
}
if (c->Admin() < minStatusToEditOtherGuilds && character_id != c->CharacterID()) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
return;
}
LogGuilds(
"[{}]: Setting [{}] ([{}])'s guild rank to [{}] with GM command",
c->GetName(),
@ -498,8 +442,6 @@ void command_guild(Client *c, const Seperator *sep)
);
if (!client) {
c->Message(Chat::White, "You must target someone or specify a character name.");
} else if (c->Admin() < minStatusToEditOtherGuilds && client->GuildID() != c->GuildID()) {
c->Message(Chat::White, "You cannot edit other peoples' guilds.");
} else {
if (!client->IsInAGuild()) {
c->Message(

View File

@ -15,20 +15,13 @@ void command_interrogateinv(Client *c, const Seperator *sep)
// same or not.
if (strcasecmp(sep->arg[1], "help") == 0) {
if (c->Admin() < commandInterrogateInv) {
c->Message(Chat::White, "Usage: #interrogateinv");
c->Message(Chat::White, " Displays your inventory's current in-memory nested storage references");
}
else {
c->Message(Chat::White, "Usage: #interrogateinv [log] [silent]");
c->Message(
Chat::White,
" Displays your or your Player target inventory's current in-memory nested storage references"
);
c->Message(Chat::White, " [log] - Logs interrogation to file");
c->Message(Chat::White, " [silent] - Omits the in-game message portion of the interrogation");
}
return;
c->Message(Chat::White, "Usage: #interrogateinv [log] [silent]");
c->Message(
Chat::White,
" Displays your or your Player target inventory's current in-memory nested storage references"
);
c->Message(Chat::White, " [log] - Logs interrogation to file");
c->Message(Chat::White, " [silent] - Omits the in-game message portion of the interrogation");
}
Client *target = nullptr;
@ -38,33 +31,20 @@ void command_interrogateinv(Client *c, const Seperator *sep)
bool error = false;
bool allowtrip = false;
if (c->Admin() < commandInterrogateInv) {
if (c->GetInterrogateInvState()) {
c->Message(Chat::Red, "The last use of #interrogateinv on this inventory instance discovered an error...");
c->Message(Chat::Red, "Logging out, zoning or re-arranging items at this point will result in item loss!");
return;
}
target = c;
allowtrip = true;
if (c->GetTarget() == nullptr) {
target = c;
} else if (c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
} else {
c->Message(Chat::Default, "Use of this command is limited to Client entities");
return;
}
else {
if (c->GetTarget() == nullptr) {
target = c;
}
else if (c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
else {
c->Message(Chat::Default, "Use of this command is limited to Client entities");
return;
}
if (strcasecmp(sep->arg[1], "log") == 0) {
log = true;
}
if (strcasecmp(sep->arg[2], "silent") == 0) {
silent = true;
}
if (strcasecmp(sep->arg[1], "log") == 0) {
log = true;
}
if (strcasecmp(sep->arg[2], "silent") == 0) {
silent = true;
}
bool success = target->InterrogateInventory(c, log, silent, allowtrip, error);

View File

@ -27,50 +27,48 @@ void command_invsnapshot(Client *c, const Seperator *sep)
"<td><c \"#AAAAAA\">takes snapshot of character inventory</td>"
"</tr>";
if (c->Admin() >= commandInvSnapshot) {
window_text.append(
"<tr>"
"<td><c \"#00FF00\">gcount</td>"
"<td></td>"
"<td><c \"#AAAAAA\">returns global snapshot count</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">gclear</td>"
"<td><c \"#FFFF00\"><br>now</td>"
"<td><c \"#AAAAAA\">delete all snapshots - rule<br>delete all snapshots - now</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">count</td>"
"<td></td>"
"<td><c \"#AAAAAA\">returns character snapshot count</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">clear</td>"
"<td><c \"#FFFF00\"><br>now</td>"
"<td><c \"#AAAAAA\">delete character snapshots - rule<br>delete character snapshots - now</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">list</td>"
"<td><br><c \"#FFFF00\">count</td>"
"<td><c \"#AAAAAA\">lists entry ids for current character<br>limits to count</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">parse</td>"
"<td><c \"#00FF00\">tstmp</td>"
"<td><c \"#AAAAAA\">displays slots and items in snapshot</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">compare</td>"
"<td><c \"#00FF00\">tstmp</td>"
"<td><c \"#AAAAAA\">compares inventory against snapshot</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">restore</td>"
"<td><c \"#00FF00\">tstmp</td>"
"<td><c \"#AAAAAA\">restores slots and items in snapshot</td>"
"</tr>"
);
}
window_text.append(
"<tr>"
"<td><c \"#00FF00\">gcount</td>"
"<td></td>"
"<td><c \"#AAAAAA\">returns global snapshot count</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">gclear</td>"
"<td><c \"#FFFF00\"><br>now</td>"
"<td><c \"#AAAAAA\">delete all snapshots - rule<br>delete all snapshots - now</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">count</td>"
"<td></td>"
"<td><c \"#AAAAAA\">returns character snapshot count</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">clear</td>"
"<td><c \"#FFFF00\"><br>now</td>"
"<td><c \"#AAAAAA\">delete character snapshots - rule<br>delete character snapshots - now</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">list</td>"
"<td><br><c \"#FFFF00\">count</td>"
"<td><c \"#AAAAAA\">lists entry ids for current character<br>limits to count</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">parse</td>"
"<td><c \"#00FF00\">tstmp</td>"
"<td><c \"#AAAAAA\">displays slots and items in snapshot</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">compare</td>"
"<td><c \"#00FF00\">tstmp</td>"
"<td><c \"#AAAAAA\">compares inventory against snapshot</td>"
"</tr>"
"<tr>"
"<td><c \"#00FF00\">restore</td>"
"<td><c \"#00FF00\">tstmp</td>"
"<td><c \"#AAAAAA\">restores slots and items in snapshot</td>"
"</tr>"
);
window_text.append(
"</table>"
@ -81,34 +79,30 @@ void command_invsnapshot(Client *c, const Seperator *sep)
return;
}
if (c->Admin() >= commandInvSnapshot) { // global arguments
if (strcmp(sep->arg[1], "gcount") == 0) {
auto is_count = database.CountInvSnapshots();
c->Message(
Chat::White,
"There %s %i inventory snapshot%s.",
(is_count == 1 ? "is" : "are"),
is_count,
(is_count == 1 ? "" : "s"));
if (strcmp(sep->arg[1], "gcount") == 0) {
auto is_count = database.CountInvSnapshots();
return;
}
if (strcmp(sep->arg[1], "gclear") == 0) {
if (strcmp(sep->arg[2], "now") == 0) {
database.ClearInvSnapshots(true);
c->Message(Chat::White, "Inventory snapshots cleared using current time.");
} else {
database.ClearInvSnapshots();
c->Message(
Chat::White,
"There %s %i inventory snapshot%s.",
(is_count == 1 ? "is" : "are"),
is_count,
(is_count == 1 ? "" : "s"));
return;
Chat::White, "Inventory snapshots cleared using RuleI(Character, InvSnapshotHistoryD) (%i day%s).",
RuleI(Character, InvSnapshotHistoryD), (RuleI(Character, InvSnapshotHistoryD) == 1 ? "" : "s"));
}
if (strcmp(sep->arg[1], "gclear") == 0) {
if (strcmp(sep->arg[2], "now") == 0) {
database.ClearInvSnapshots(true);
c->Message(Chat::White, "Inventory snapshots cleared using current time.");
}
else {
database.ClearInvSnapshots();
c->Message(
Chat::White, "Inventory snapshots cleared using RuleI(Character, InvSnapshotHistoryD) (%i day%s).",
RuleI(Character, InvSnapshotHistoryD), (RuleI(Character, InvSnapshotHistoryD) == 1 ? "" : "s"));
}
return;
}
return;
}
if (!c->GetTarget() || !c->GetTarget()->IsClient()) {
@ -127,8 +121,7 @@ void command_invsnapshot(Client *c, const Seperator *sep)
tc->GetName(),
RuleI(Character, InvSnapshotMinIntervalM),
(RuleI(Character, InvSnapshotMinIntervalM) == 1 ? "" : "s"));
}
else {
} else {
tc->SetNextInvSnapshot(RuleI(Character, InvSnapshotMinRetryM));
c->Message(
Chat::White,
@ -141,278 +134,266 @@ void command_invsnapshot(Client *c, const Seperator *sep)
return;
}
if (c->Admin() >= commandInvSnapshot) {
if (strcmp(sep->arg[1], "count") == 0) {
auto is_count = database.CountCharacterInvSnapshots(tc->CharacterID());
if (strcmp(sep->arg[1], "count") == 0) {
auto is_count = database.CountCharacterInvSnapshots(tc->CharacterID());
c->Message(
Chat::White,
"%s (id: %u) has %i inventory snapshot%s.",
tc->GetName(),
tc->CharacterID(),
is_count,
(is_count == 1 ? "" : "s"));
return;
}
if (strcmp(sep->arg[1], "clear") == 0) {
if (strcmp(sep->arg[2], "now") == 0) {
database.ClearCharacterInvSnapshots(tc->CharacterID(), true);
c->Message(
Chat::White,
"%s (id: %u) has %i inventory snapshot%s.",
"%s\'s (id: %u) inventory snapshots cleared using current time.",
tc->GetName(),
tc->CharacterID());
} else {
database.ClearCharacterInvSnapshots(tc->CharacterID());
c->Message(
Chat::White,
"%s\'s (id: %u) inventory snapshots cleared using RuleI(Character, InvSnapshotHistoryD) (%i day%s).",
tc->GetName(),
tc->CharacterID(),
is_count,
(is_count == 1 ? "" : "s"));
RuleI(Character, InvSnapshotHistoryD),
(RuleI(Character, InvSnapshotHistoryD) == 1 ? "" : "s"));
}
return;
}
if (strcmp(sep->arg[1], "list") == 0) {
std::list<std::pair<uint32, int>> is_list;
database.ListCharacterInvSnapshots(tc->CharacterID(), is_list);
if (is_list.empty()) {
c->Message(Chat::White, "No inventory snapshots for %s (id: %u)", tc->GetName(), tc->CharacterID());
return;
}
if (strcmp(sep->arg[1], "clear") == 0) {
if (strcmp(sep->arg[2], "now") == 0) {
database.ClearCharacterInvSnapshots(tc->CharacterID(), true);
c->Message(
Chat::White,
"%s\'s (id: %u) inventory snapshots cleared using current time.",
tc->GetName(),
tc->CharacterID());
}
else {
database.ClearCharacterInvSnapshots(tc->CharacterID());
c->Message(
Chat::White,
"%s\'s (id: %u) inventory snapshots cleared using RuleI(Character, InvSnapshotHistoryD) (%i day%s).",
tc->GetName(),
tc->CharacterID(),
RuleI(Character, InvSnapshotHistoryD),
(RuleI(Character, InvSnapshotHistoryD) == 1 ? "" : "s"));
}
return;
auto list_count = 0;
if (sep->IsNumber(2)) {
list_count = Strings::ToInt(sep->arg[2]);
}
if (list_count < 1 || list_count > is_list.size()) {
list_count = is_list.size();
}
if (strcmp(sep->arg[1], "list") == 0) {
std::list<std::pair<uint32, int>> is_list;
database.ListCharacterInvSnapshots(tc->CharacterID(), is_list);
std::string window_title = StringFormat("Snapshots for %s", tc->GetName());
if (is_list.empty()) {
c->Message(Chat::White, "No inventory snapshots for %s (id: %u)", tc->GetName(), tc->CharacterID());
return;
}
auto list_count = 0;
if (sep->IsNumber(2)) {
list_count = Strings::ToInt(sep->arg[2]);
}
if (list_count < 1 || list_count > is_list.size()) {
list_count = is_list.size();
}
std::string window_title = StringFormat("Snapshots for %s", tc->GetName());
std::string window_text =
"<table>"
"<tr>"
"<td>Timestamp</td>"
"<td>Entry Count</td>"
"</tr>";
for (auto iter : is_list) {
if (!list_count) {
break;
}
window_text.append(
StringFormat(
std::string window_text =
"<table>"
"<tr>"
"<td>%u</td>"
"<td>%i</td>"
"</tr>",
iter.first,
iter.second
));
"<td>Timestamp</td>"
"<td>Entry Count</td>"
"</tr>";
--list_count;
for (auto iter: is_list) {
if (!list_count) {
break;
}
window_text.append(
"</table>"
);
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
return;
}
if (strcmp(sep->arg[1], "parse") == 0) {
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "A timestamp is required to use this option.");
return;
}
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
c->Message(
Chat::White,
"No inventory snapshots for %s (id: %u) exist at %u.",
tc->GetName(),
tc->CharacterID(),
timestamp
);
return;
}
std::list<std::pair<int16, uint32>> parse_list;
database.ParseCharacterInvSnapshot(tc->CharacterID(), timestamp, parse_list);
std::string window_title = StringFormat("Snapshot Parse for %s @ %u", tc->GetName(), timestamp);
std::string window_text = "Slot: ItemID - Description<br>";
for (auto iter : parse_list) {
auto item_data = database.GetItem(iter.second);
std::string window_line = StringFormat(
"%i: %u - %s<br>",
StringFormat(
"<tr>"
"<td>%u</td>"
"<td>%i</td>"
"</tr>",
iter.first,
iter.second,
(item_data ? item_data->Name : "[error]"));
iter.second
));
if (window_text.length() + window_line.length() < 4095) {
window_text.append(window_line);
}
else {
c->Message(Chat::White, "Too many snapshot entries to list...");
break;
}
}
--list_count;
}
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
window_text.append(
"</table>"
);
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
return;
}
if (strcmp(sep->arg[1], "parse") == 0) {
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "A timestamp is required to use this option.");
return;
}
if (strcmp(sep->arg[1], "compare") == 0) {
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "A timestamp is required to use this option.");
return;
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
c->Message(
Chat::White,
"No inventory snapshots for %s (id: %u) exist at %u.",
tc->GetName(),
tc->CharacterID(),
timestamp
);
return;
}
std::list<std::pair<int16, uint32>> parse_list;
database.ParseCharacterInvSnapshot(tc->CharacterID(), timestamp, parse_list);
std::string window_title = StringFormat("Snapshot Parse for %s @ %u", tc->GetName(), timestamp);
std::string window_text = "Slot: ItemID - Description<br>";
for (auto iter: parse_list) {
auto item_data = database.GetItem(iter.second);
std::string window_line = StringFormat(
"%i: %u - %s<br>",
iter.first,
iter.second,
(item_data ? item_data->Name : "[error]"));
if (window_text.length() + window_line.length() < 4095) {
window_text.append(window_line);
} else {
c->Message(Chat::White, "Too many snapshot entries to list...");
break;
}
}
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
c->Message(
Chat::White,
"No inventory snapshots for %s (id: %u) exist at %u.",
tc->GetName(),
tc->CharacterID(),
timestamp
);
return;
}
return;
}
std::list<std::pair<int16, uint32>> inv_compare_list;
database.DivergeCharacterInventoryFromInvSnapshot(tc->CharacterID(), timestamp, inv_compare_list);
if (strcmp(sep->arg[1], "compare") == 0) {
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "A timestamp is required to use this option.");
return;
}
std::list<std::pair<int16, uint32>> iss_compare_list;
database.DivergeCharacterInvSnapshotFromInventory(tc->CharacterID(), timestamp, iss_compare_list);
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
std::string window_title = StringFormat("Snapshot Comparison for %s @ %u", tc->GetName(), timestamp);
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
c->Message(
Chat::White,
"No inventory snapshots for %s (id: %u) exist at %u.",
tc->GetName(),
tc->CharacterID(),
timestamp
);
return;
}
std::string window_text = "Slot: (action) Snapshot -&gt; Inventory<br>";
std::list<std::pair<int16, uint32>> inv_compare_list;
database.DivergeCharacterInventoryFromInvSnapshot(tc->CharacterID(), timestamp, inv_compare_list);
auto inv_iter = inv_compare_list.begin();
auto iss_iter = iss_compare_list.begin();
std::list<std::pair<int16, uint32>> iss_compare_list;
database.DivergeCharacterInvSnapshotFromInventory(tc->CharacterID(), timestamp, iss_compare_list);
while (true) {
std::string window_line;
std::string window_title = StringFormat("Snapshot Comparison for %s @ %u", tc->GetName(), timestamp);
if (inv_iter == inv_compare_list.end() && iss_iter == iss_compare_list.end()) {
break;
}
else if (inv_iter != inv_compare_list.end() && iss_iter == iss_compare_list.end()) {
window_line = StringFormat("%i: (delete) [empty] -&gt; %u<br>", inv_iter->first, inv_iter->second);
std::string window_text = "Slot: (action) Snapshot -&gt; Inventory<br>";
auto inv_iter = inv_compare_list.begin();
auto iss_iter = iss_compare_list.begin();
while (true) {
std::string window_line;
if (inv_iter == inv_compare_list.end() && iss_iter == iss_compare_list.end()) {
break;
} else if (inv_iter != inv_compare_list.end() && iss_iter == iss_compare_list.end()) {
window_line = StringFormat("%i: (delete) [empty] -&gt; %u<br>", inv_iter->first, inv_iter->second);
++inv_iter;
} else if (inv_iter == inv_compare_list.end() && iss_iter != iss_compare_list.end()) {
window_line = StringFormat("%i: (insert) %u -&gt; [empty]<br>", iss_iter->first, iss_iter->second);
++iss_iter;
} else {
if (inv_iter->first < iss_iter->first) {
window_line = StringFormat(
"%i: (delete) [empty] -&gt; %u<br>",
inv_iter->first,
inv_iter->second
);
++inv_iter;
} else if (inv_iter->first > iss_iter->first) {
window_line = StringFormat(
"%i: (insert) %u -&gt; [empty]<br>",
iss_iter->first,
iss_iter->second
);
++iss_iter;
} else {
window_line = StringFormat(
"%i: (replace) %u -&gt; %u<br>",
iss_iter->first,
iss_iter->second,
inv_iter->second
);
++inv_iter;
}
else if (inv_iter == inv_compare_list.end() && iss_iter != iss_compare_list.end()) {
window_line = StringFormat("%i: (insert) %u -&gt; [empty]<br>", iss_iter->first, iss_iter->second);
++iss_iter;
}
else {
if (inv_iter->first < iss_iter->first) {
window_line = StringFormat(
"%i: (delete) [empty] -&gt; %u<br>",
inv_iter->first,
inv_iter->second
);
++inv_iter;
}
else if (inv_iter->first > iss_iter->first) {
window_line = StringFormat(
"%i: (insert) %u -&gt; [empty]<br>",
iss_iter->first,
iss_iter->second
);
++iss_iter;
}
else {
window_line = StringFormat(
"%i: (replace) %u -&gt; %u<br>",
iss_iter->first,
iss_iter->second,
inv_iter->second
);
++inv_iter;
++iss_iter;
}
}
if (window_text.length() + window_line.length() < 4095) {
window_text.append(window_line);
}
else {
c->Message(Chat::White, "Too many comparison entries to list...");
break;
}
}
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
if (window_text.length() + window_line.length() < 4095) {
window_text.append(window_line);
} else {
c->Message(Chat::White, "Too many comparison entries to list...");
break;
}
}
c->SendPopupToClient(window_title.c_str(), window_text.c_str());
return;
}
if (strcmp(sep->arg[1], "restore") == 0) {
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "A timestamp is required to use this option.");
return;
}
if (strcmp(sep->arg[1], "restore") == 0) {
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "A timestamp is required to use this option.");
return;
}
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
c->Message(
Chat::White,
"No inventory snapshots for %s (id: %u) exist at %u.",
tc->GetName(),
tc->CharacterID(),
timestamp
);
return;
}
if (database.SaveCharacterInvSnapshot(tc->CharacterID())) {
tc->SetNextInvSnapshot(RuleI(Character, InvSnapshotMinIntervalM));
}
else {
c->Message(
Chat::Red, "Failed to take pre-restore inventory snapshot of %s (id: %u).",
tc->GetName(), tc->CharacterID());
return;
}
if (database.RestoreCharacterInvSnapshot(tc->CharacterID(), timestamp)) {
// cannot delete all valid item slots from client..so, we worldkick
tc->WorldKick(); // self restores update before the 'kick' is processed
c->Message(
Chat::White, "Successfully applied snapshot %u to %s's (id: %u) inventory.",
timestamp, tc->GetName(), tc->CharacterID());
}
else {
c->Message(
Chat::Red, "Failed to apply snapshot %u to %s's (id: %u) inventory.",
timestamp, tc->GetName(), tc->CharacterID());
}
uint32 timestamp = Strings::ToUnsignedInt(sep->arg[2]);
if (!database.ValidateCharacterInvSnapshotTimestamp(tc->CharacterID(), timestamp)) {
c->Message(
Chat::White,
"No inventory snapshots for %s (id: %u) exist at %u.",
tc->GetName(),
tc->CharacterID(),
timestamp
);
return;
}
if (database.SaveCharacterInvSnapshot(tc->CharacterID())) {
tc->SetNextInvSnapshot(RuleI(Character, InvSnapshotMinIntervalM));
} else {
c->Message(
Chat::Red, "Failed to take pre-restore inventory snapshot of %s (id: %u).",
tc->GetName(), tc->CharacterID());
return;
}
if (database.RestoreCharacterInvSnapshot(tc->CharacterID(), timestamp)) {
// cannot delete all valid item slots from client..so, we worldkick
tc->WorldKick(); // self restores update before the 'kick' is processed
c->Message(
Chat::White, "Successfully applied snapshot %u to %s's (id: %u) inventory.",
timestamp, tc->GetName(), tc->CharacterID());
} else {
c->Message(
Chat::Red, "Failed to apply snapshot %u to %s's (id: %u) inventory.",
timestamp, tc->GetName(), tc->CharacterID());
}
return;
}
}

View File

@ -2,18 +2,18 @@
void command_movechar(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
const int arguments = sep->argnum;
if (arguments < 2) {
c->Message(Chat::White, "Usage: #movechar [Character ID|Character Name] [Zone ID|Zone Short Name]");
return;
}
std::string character_name = (
const std::string &character_name = (
sep->IsNumber(1) ?
database.GetCharNameByID(Strings::ToUnsignedInt(sep->arg[1])) :
sep->arg[1]
);
auto character_id = database.GetCharacterID(character_name.c_str());
const uint32 character_id = database.GetCharacterID(character_name.c_str());
if (!character_id) {
c->Message(
Chat::White,
@ -25,15 +25,15 @@ void command_movechar(Client *c, const Seperator *sep)
return;
}
auto account_id = database.GetAccountIDByChar(character_name.c_str());
const uint32 account_id = database.GetAccountIDByChar(character_name.c_str());
std::string zone_short_name = Strings::ToLower(
const std::string &zone_short_name = Strings::ToLower(
sep->IsNumber(2) ?
ZoneName(Strings::ToUnsignedInt(sep->arg[2]), true) :
sep->arg[2]
);
bool is_unknown_zone = zone_short_name.find("unknown") != std::string::npos;
const bool is_unknown_zone = zone_short_name.find("unknown") != std::string::npos;
if (is_unknown_zone) {
c->Message(
Chat::White,
@ -45,63 +45,34 @@ void command_movechar(Client *c, const Seperator *sep)
return;
}
auto zone_id = ZoneID(zone_short_name);
auto z = GetZone(zone_id);
const uint32 zone_id = ZoneID(zone_short_name);
auto z = GetZone(zone_id);
if (!z) {
c->Message(Chat::Red, "Invalid zone.");
return;
}
bool is_special_zone = (
zone_short_name.find("cshome") != std::string::npos ||
zone_short_name.find("load") != std::string::npos ||
zone_short_name.find("load2") != std::string::npos
const bool moved = database.MoveCharacterToZone(character_name.c_str(), zone_id);
std::string moved_string = moved ? "Succeeded" : "Failed";
c->Message(
Chat::White,
fmt::format(
"Character Move {} | Character: {} ({})",
moved_string,
character_name,
character_id
).c_str()
);
if (c->Admin() < commandMovecharToSpecials && is_special_zone) {
c->Message(
Chat::White,
fmt::format(
"{} ({}) is a special zone and you cannot move someone there.",
z->long_name,
zone_short_name
).c_str()
);
return;
}
if (
c->Admin() >= commandMovecharSelfOnly ||
account_id == c->AccountID()
) {
bool moved = database.MoveCharacterToZone(character_name.c_str(), zone_id);
std::string moved_string = (
moved ?
"Succeeded" :
"Failed"
);
c->Message(
Chat::White,
fmt::format(
"Character Move {} | Character: {} ({})",
moved_string,
character_name,
character_id
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Character Move {} | Zone: {} ({}) ID: {}",
moved_string,
z->long_name,
zone_short_name,
zone_id
).c_str()
);
} else {
c->Message(Chat::White, "You cannot move characters that are not on your account.");
}
c->Message(
Chat::White,
fmt::format(
"Character Move {} | Zone: {} ({}) ID: {}",
moved_string,
z->long_name,
zone_short_name,
zone_id
).c_str()
);
}

View File

@ -2,13 +2,8 @@
void ShowFlags(Client *c, const Seperator *sep)
{
auto t = c;
if (
c->GetTarget() &&
c->GetTarget()->IsClient() &&
c->Admin() >= minStatusToSeeOthersZoneFlags
) {
Client *t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}

View File

@ -2,12 +2,8 @@
void ShowPEQZoneFlags(Client *c, const Seperator *sep)
{
auto t = c;
if (
c->GetTarget() &&
c->GetTarget()->IsClient() &&
c->Admin() >= minStatusToSeeOthersZoneFlags
) {
Client *t = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
t = c->GetTarget()->CastToClient();
}

View File

@ -1343,7 +1343,7 @@ bool Client::CanEnterZone(const std::string& zone_short_name, int16 instance_ver
}
if (!z->flag_needed.empty() && Strings::IsNumber(z->flag_needed) && Strings::ToBool(z->flag_needed)) {
if (Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(z->zoneidnumber)) {
if (!GetGM() && !HasZoneFlag(z->zoneidnumber)) {
LogInfo(
"Character [{}] does not have the flag to be in this zone [{}]!",
GetCleanName(),