Core/Misc: Whitespace and a minor typo fix (thanks Kapoeira)
This commit is contained in:
@@ -12412,13 +12412,13 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
|||||||
|
|
||||||
// CvC case - can attack each other only when one of them is hostile
|
// CvC case - can attack each other only when one of them is hostile
|
||||||
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE))
|
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE))
|
||||||
return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
|
return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
|
||||||
|
|
||||||
// PvP, PvC, CvP case
|
// PvP, PvC, CvP case
|
||||||
// can't attack friendly targets
|
// can't attack friendly targets
|
||||||
if ( GetReactionTo(target) > REP_NEUTRAL
|
if ( GetReactionTo(target) > REP_NEUTRAL
|
||||||
|| target->GetReactionTo(this) > REP_NEUTRAL)
|
|| target->GetReactionTo(this) > REP_NEUTRAL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Creature const* creatureAttacker = ToCreature();
|
Creature const* creatureAttacker = ToCreature();
|
||||||
if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)
|
if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)
|
||||||
@@ -12427,18 +12427,18 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
|||||||
Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL;
|
Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL;
|
||||||
Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? target->GetAffectingPlayer() : NULL;
|
Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? target->GetAffectingPlayer() : NULL;
|
||||||
|
|
||||||
// check duel - before sanctuary checks
|
// check duel - before sanctuary checks
|
||||||
if (playerAffectingAttacker && playerAffectingTarget)
|
if (playerAffectingAttacker && playerAffectingTarget)
|
||||||
if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->opponent == playerAffectingTarget && playerAffectingAttacker->duel->startTime != 0)
|
if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->opponent == playerAffectingTarget && playerAffectingAttacker->duel->startTime != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY))
|
if ((target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY))
|
||||||
|| (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY)))
|
|| (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// additional checks - only PvP case
|
// additional checks - only PvP case
|
||||||
if (playerAffectingAttacker && playerAffectingTarget)
|
if (playerAffectingAttacker && playerAffectingTarget)
|
||||||
{
|
{
|
||||||
if (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP)
|
if (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -12448,8 +12448,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
|||||||
|
|
||||||
return (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_UNK1)
|
return (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_UNK1)
|
||||||
|| (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_UNK1);
|
|| (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_UNK1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::canAttack(Unit const* target, bool force) const
|
bool Unit::canAttack(Unit const* target, bool force) const
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const
|
|||||||
|
|
||||||
if (!factionEntry)
|
if (!factionEntry)
|
||||||
{
|
{
|
||||||
sLog->outError("ReputationMgr::IsAtWar: Can't get AtWat flag of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id);
|
sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user