mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
Fixed an issue where leave-zone was working outside of instanced zones (#431)
This commit is contained in:
parent
13980c4133
commit
f0a4324bd4
@ -304,27 +304,15 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
if ((chatCommand == "leave-zone")) {
|
if ((chatCommand == "leave-zone")) {
|
||||||
const auto currentZone = dZoneManager::Instance()->GetZone()->GetZoneID().GetMapID();
|
const auto currentZone = dZoneManager::Instance()->GetZone()->GetZoneID().GetMapID();
|
||||||
|
|
||||||
auto newZone = 1100;
|
auto newZone = 0;
|
||||||
|
if (currentZone % 100 == 0) {
|
||||||
switch (currentZone)
|
|
||||||
{
|
|
||||||
case 1101:
|
|
||||||
newZone = 1100;
|
|
||||||
break;
|
|
||||||
case 1204:
|
|
||||||
newZone = 1200;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
newZone = 1100;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentZone == newZone)
|
|
||||||
{
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"You are not in an instanced zone.");
|
ChatPackets::SendSystemMessage(sysAddr, u"You are not in an instanced zone.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
newZone = (currentZone / 100) * 100;
|
||||||
}
|
}
|
||||||
|
// If new zone would be inaccessible, then default to Avant Gardens.
|
||||||
|
if (!CheckIfAccessibleZone(newZone)) newZone = 1100;
|
||||||
|
|
||||||
ChatPackets::SendSystemMessage(sysAddr, u"Leaving zone...");
|
ChatPackets::SendSystemMessage(sysAddr, u"Leaving zone...");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user