From be42b73f5cf4824cfe1fc00b00f2e15d518b929f Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:48:19 -0400 Subject: [PATCH] [Rules] Add Rule to disable PVP Regions (#4513) --- common/ruletypes.h | 1 + zone/client.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 89e640da2..a42832527 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -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) diff --git a/zone/client.cpp b/zone/client.cpp index 4f2000780..d0a8d97b0 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -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()