[Rules] Add Rule to disable PVP Regions (#4513)

This commit is contained in:
Alex King 2024-10-17 02:48:19 -04:00 committed by GitHub
parent f76c798910
commit be42b73f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View File

@ -338,6 +338,7 @@ RULE_STRING(World, IPExemptionZones, "", "Comma-delimited list of zones to exclu
RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value")
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
RULE_BOOL(World, EnablePVPRegions, true, "Enables or disables PVP Regions automatically setting your PVP flag")
RULE_CATEGORY_END()
RULE_CATEGORY(Zone)

View File

@ -8677,14 +8677,16 @@ int Client::GetAccountAge() {
void Client::CheckRegionTypeChanges()
{
if (!zone->HasWaterMap())
if (!zone->HasWaterMap()) {
return;
}
auto new_region = zone->watermap->ReturnRegionType(glm::vec3(m_Position));
// still same region, do nothing
if (last_region_type == new_region)
if (last_region_type == new_region) {
return;
}
// If we got out of water clear any water aggro for water only npcs
if (last_region_type == RegionTypeWater) {
@ -8695,13 +8697,15 @@ void Client::CheckRegionTypeChanges()
last_region_type = new_region;
// PVP is the only state we need to keep track of, so we can just return now for PVP servers
if (RuleI(World, PVPSettings) > 0)
if (RuleI(World, PVPSettings) > 0) {
return;
}
if (last_region_type == RegionTypePVP)
if (last_region_type == RegionTypePVP && RuleB(World, EnablePVPRegions)) {
temp_pvp = true;
else if (temp_pvp)
} else if (temp_pvp) {
temp_pvp = false;
}
}
void Client::ProcessAggroMeter()