mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 22:01:30 +00:00
[Bug Fix] Fix MovePC in #zone and #zoneinstance Commands. (#2236)
* [Bug Fix] Fix MovePC in #zone and #zoneinstance COmmands. * #zone 0 Optional Functionality.
This commit is contained in:
parent
57ac46d090
commit
38da37755d
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user