Skip to content

Commit

Permalink
Core/Entities: Allow 2 side parties to work.
Browse files Browse the repository at this point in the history
  • Loading branch information
QAston committed Sep 17, 2011
1 parent a644e0d commit 8c2e58d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/server/game/Entities/Unit/Unit.cpp
Expand Up @@ -9239,6 +9239,7 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
return entry;
}

// function based on function Unit::UnitReaction from 13850 client
ReputationRank Unit::GetReactionTo(Unit const* target) const
{
// always friendly to self
Expand Down Expand Up @@ -9268,7 +9269,9 @@ ReputationRank Unit::GetReactionTo(Unit const* target) const

// same group - checks dependant only on our faction - skip FFA_PVP for example
if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner))
return GetFactionReactionTo(getFactionTemplateEntry(), target);
return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work
// however client seems to allow mixed group parties, because in 13850 client it works like:
// return GetFactionReactionTo(getFactionTemplateEntry(), target);
}

// check FFA_PVP
Expand Down Expand Up @@ -12368,6 +12371,7 @@ bool Unit::IsValidAttackTarget(Unit const* target) const
return _IsValidAttackTarget(target, NULL);
}

// function based on function Unit::CanAttack from 13850 client
bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const
{
ASSERT(target);
Expand Down Expand Up @@ -12435,6 +12439,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
return true;

// PvP case - can't attack when attacker or target are in sanctuary
// however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)
&& ((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY) || (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY)))
return false;
Expand All @@ -12460,6 +12465,7 @@ bool Unit::IsValidAssistTarget(Unit const* target) const
return _IsValidAssistTarget(target, NULL);
}

// function based on function Unit::CanAssist from 13850 client
bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const
{
ASSERT(target);
Expand Down

0 comments on commit 8c2e58d

Please sign in to comment.