diff --git a/zone/gm_commands/zone.cpp b/zone/gm_commands/zone.cpp index add9471da..bdd9dfc98 100644 --- a/zone/gm_commands/zone.cpp +++ b/zone/gm_commands/zone.cpp @@ -8,21 +8,34 @@ void command_zone(Client *c, const Seperator *sep) return; } + std::string zone_identifier = sep->arg[1]; + + if (StringIsNumber(zone_identifier) && zone_identifier == "0") { + c->Message(Chat::White, "Sending you to the safe coordinates of this zone."); + + c->MovePC( + 0.0f, + 0.0f, + 0.0f, + 0.0f, + 0, + ZoneToSafeCoords + ); + return; + } + auto zone_id = ( sep->IsNumber(1) ? - std::stoul(sep->arg[1]) : - ZoneID(sep->arg[1]) + std::stoul(zone_identifier) : + ZoneID(zone_identifier) ); auto zone_short_name = ZoneName(zone_id); - if ( - !zone_id || - !zone_short_name - ) { + if (!zone_id || !zone_short_name) { c->Message( Chat::White, fmt::format( "No zones were found matching '{}'.", - sep->arg[1] + zone_identifier ).c_str() ); return; @@ -44,6 +57,7 @@ void command_zone(Client *c, const Seperator *sep) auto x = sep->IsNumber(2) ? std::stof(sep->arg[2]) : 0.0f; auto y = sep->IsNumber(3) ? std::stof(sep->arg[3]) : 0.0f; auto z = sep->IsNumber(4) ? std::stof(sep->arg[4]) : 0.0f; + auto zone_mode = sep->IsNumber(2) ? ZoneSolicited : ZoneToSafeCoords; c->MovePC( zone_id, @@ -51,6 +65,7 @@ void command_zone(Client *c, const Seperator *sep) y, z, 0.0f, - sep->IsNumber(2) ? 0 : ZoneToSafeCoords + 0, + zone_mode ); -} \ No newline at end of file +} diff --git a/zone/gm_commands/zone_instance.cpp b/zone/gm_commands/zone_instance.cpp index d54b3b251..4d36580b7 100644 --- a/zone/gm_commands/zone_instance.cpp +++ b/zone/gm_commands/zone_instance.cpp @@ -10,7 +10,7 @@ void command_zone_instance(Client *c, const Seperator *sep) auto instance_id = std::stoul(sep->arg[1]); if (!instance_id) { - c->Message(Chat::White, "You must enter a valid instance id."); + c->Message(Chat::White, "You must enter a valid Instance ID."); return; } @@ -36,18 +36,16 @@ void command_zone_instance(Client *c, const Seperator *sep) ); return; } - - if (database.CharacterInInstanceGroup(instance_id, c->CharacterID())) { - c->Message(Chat::White, "You are already a part of this instance, sending you there."); - c->MoveZoneInstance(instance_id); - return; + + if (!database.CharacterInInstanceGroup(instance_id, c->CharacterID())) { + database.AddClientToInstance(instance_id, c->CharacterID()); } - + if (!database.VerifyInstanceAlive(instance_id, c->CharacterID())) { c->Message( Chat::White, fmt::format( - "Instance ID {} expired or you are not apart of this instance.", + "Instance ID {} expired.", instance_id ).c_str() ); @@ -57,6 +55,7 @@ void command_zone_instance(Client *c, const Seperator *sep) auto x = sep->IsNumber(2) ? std::stof(sep->arg[2]) : 0.0f; auto y = sep->IsNumber(3) ? std::stof(sep->arg[3]) : 0.0f; auto z = sep->IsNumber(4) ? std::stof(sep->arg[4]) : 0.0f; + auto zone_mode = sep->IsNumber(2) ? ZoneSolicited : ZoneToSafeCoords; c->MovePC( zone_id, @@ -65,6 +64,7 @@ void command_zone_instance(Client *c, const Seperator *sep) y, z, 0.0f, - sep->IsNumber(2) ? 0 : ZoneToSafeCoords + 0, + zone_mode ); }