diff --git a/source/WorldServer/Combat.cpp b/source/WorldServer/Combat.cpp index df2a2b1..7f536c9 100644 --- a/source/WorldServer/Combat.cpp +++ b/source/WorldServer/Combat.cpp @@ -144,6 +144,7 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) { if (attacker->IsPlayer() && target->IsPlayer()) { bool pvp_allowed = rule_manager.GetZoneRule(GetZoneID(), R_PVP, AllowPVP)->GetBool(); + int32 pvp_type = rule_manager.GetZoneRule(GetZoneID(), R_PVP, PVPType)->GetInt32(); if (!pvp_allowed) { LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: pvp is not allowed"); return false; @@ -158,6 +159,19 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) { LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: pvp range of %i exceeded abs(%i-%i).", pvpLevelRange, attackerLevel, defenderLevel); return false; } + switch(pvp_type) { + // 0 = FFA, skip these checks + case 1: { + if(((Player*)attacker)->GetPVPAlignment() == ((Player*)target)->GetPVPAlignment()) + return false; + break; + } + case 2: { + if(attacker->GetInfoStruct()->get_alignment() == target->GetInfoStruct()->get_alignment()) + return false; + break; + } + } } } diff --git a/source/WorldServer/Rules/Rules.cpp b/source/WorldServer/Rules/Rules.cpp index 5e87bfd..9953373 100644 --- a/source/WorldServer/Rules/Rules.cpp +++ b/source/WorldServer/Rules/Rules.cpp @@ -248,6 +248,7 @@ void RuleManager::Init() RULE_INIT(R_PVP, LevelRange, "4"); RULE_INIT(R_PVP, InvisPlayerDiscoveryRange, "20"); // value > 0 sets radius inner to see, = 0 means always seen, -1 = never seen RULE_INIT(R_PVP, PVPMitigationModByLevel, "25"); // gives a bonus to mitigation for PVP combat to offset the percentage level * mod (default 25) + RULE_INIT(R_PVP, PVPType, "0"); // 0 = FFA, 1 = PVPAlignment (Bind zone), 2 = Alignment (assigned via LUA function SetAlignment) /* COMBAT */ RULE_INIT(R_Combat, MaxCombatRange, "4.0"); diff --git a/source/WorldServer/Rules/Rules.h b/source/WorldServer/Rules/Rules.h index e55e0ad..758c639 100644 --- a/source/WorldServer/Rules/Rules.h +++ b/source/WorldServer/Rules/Rules.h @@ -107,6 +107,7 @@ enum RuleType { LevelRange, InvisPlayerDiscoveryRange, PVPMitigationModByLevel, + PVPType, /* COMBAT */ MaxCombatRange,