diff --git a/zone/client.h b/zone/client.h index 13b78df9c..01a7fc552 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1352,7 +1352,7 @@ public: void ClearPendingAdventureDoorClick() { safe_delete(adventure_door_timer); } void ClearPendingAdventureData(); - bool CanEnterZone(std::string zone_short_name = "", int16 instance_version = -1); + bool CanEnterZone(const std::string& zone_short_name = "", int16 instance_version = -1); int GetAggroCount(); void IncrementAggroCount(bool raid_target = false); diff --git a/zone/doors.cpp b/zone/doors.cpp index b98fe2517..e50ddc92f 100644 --- a/zone/doors.cpp +++ b/zone/doors.cpp @@ -265,6 +265,19 @@ void Doors::HandleClick(Client *sender, uint8 trigger) } } + // enforce flags before they hit zoning process + auto z = GetZone(m_destination_zone_name, 0); + if (!z->flag_needed.empty() && Strings::IsNumber(z->flag_needed) && std::stoi(z->flag_needed) == 1) { + if (sender->Admin() < minStatusToIgnoreZoneFlags && !sender->HasZoneFlag(z->zoneidnumber)) { + LogInfo( + "Character [{}] does not have the flag to be in this zone [{}]!", + sender->GetCleanName(), + z->flag_needed + ); + sender->MessageString(Chat::LightBlue, DOORS_LOCKED); + } + } + /** * Guild Doors * diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 7524dcf2b..d0cbcd4ce 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -1198,7 +1198,7 @@ void Client::SetPEQZoneFlag(uint32 zone_id) { } } -bool Client::CanEnterZone(std::string zone_short_name, int16 instance_version) { +bool Client::CanEnterZone(const std::string& zone_short_name, int16 instance_version) { //check some critial rules to see if this char needs to be booted from the zone //only enforce rules here which are serious enough to warrant being kicked from //the zone @@ -1246,11 +1246,8 @@ bool Client::CanEnterZone(std::string zone_short_name, int16 instance_version) { return false; } - if (!z->flag_needed.empty()) { - if ( - Admin() < minStatusToIgnoreZoneFlags && - !HasZoneFlag(zone->GetZoneID()) - ) { + if (!z->flag_needed.empty() && Strings::IsNumber(z->flag_needed) && std::stoi(z->flag_needed) == 1) { + if (Admin() < minStatusToIgnoreZoneFlags && !HasZoneFlag(z->zoneidnumber)) { LogInfo( "Character [{}] does not have the flag to be in this zone [{}]!", GetCleanName(),