mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Merge branch 'master' into 310
Conflicts: src/game/Player.cpp src/game/Player.h src/game/Unit.cpp
This commit is contained in:
commit
963aed5e0b
49 changed files with 1124 additions and 986 deletions
|
|
@ -6956,15 +6956,13 @@ bool Unit::IsHostileTo(Unit const* unit) const
|
|||
// forced reaction
|
||||
if(target_faction->faction)
|
||||
{
|
||||
ForcedReactions::const_iterator forceItr = ((Player*)tester)->m_forcedReactions.find(target_faction->faction);
|
||||
if(forceItr!=((Player*)tester)->m_forcedReactions.end())
|
||||
return forceItr->second <= REP_HOSTILE;
|
||||
if(ReputationRank const* force =((Player*)tester)->GetReputationMgr().GetForcedRankIfAny(target_faction))
|
||||
return *force <= REP_HOSTILE;
|
||||
|
||||
// if faction have reputation then hostile state for tester at 100% dependent from at_war state
|
||||
if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
|
||||
if(raw_target_faction->reputationListID >=0)
|
||||
if(FactionState const* factionState = ((Player*)tester)->GetFactionState(raw_target_faction))
|
||||
return (factionState->Flags & FACTION_FLAG_AT_WAR);
|
||||
if(FactionState const* factionState = ((Player*)tester)->GetReputationMgr().GetState(raw_target_faction))
|
||||
return (factionState->Flags & FACTION_FLAG_AT_WAR);
|
||||
}
|
||||
}
|
||||
// CvP forced reaction and reputation case
|
||||
|
|
@ -6973,14 +6971,13 @@ bool Unit::IsHostileTo(Unit const* unit) const
|
|||
// forced reaction
|
||||
if(tester_faction->faction)
|
||||
{
|
||||
ForcedReactions::const_iterator forceItr = ((Player const*)target)->m_forcedReactions.find(tester_faction->faction);
|
||||
if(forceItr!=((Player const*)target)->m_forcedReactions.end())
|
||||
return forceItr->second <= REP_HOSTILE;
|
||||
if(ReputationRank const* force = ((Player*)target)->GetReputationMgr().GetForcedRankIfAny(tester_faction))
|
||||
return *force <= REP_HOSTILE;
|
||||
|
||||
// apply reputation state
|
||||
FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction);
|
||||
if(raw_tester_faction && raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)target)->GetReputationRank(raw_tester_faction) <= REP_HOSTILE;
|
||||
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) <= REP_HOSTILE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7071,15 +7068,13 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
|
|||
// forced reaction
|
||||
if(target_faction->faction)
|
||||
{
|
||||
ForcedReactions::const_iterator forceItr = ((Player const*)tester)->m_forcedReactions.find(target_faction->faction);
|
||||
if(forceItr!=((Player const*)tester)->m_forcedReactions.end())
|
||||
return forceItr->second >= REP_FRIENDLY;
|
||||
if(ReputationRank const* force =((Player*)tester)->GetReputationMgr().GetForcedRankIfAny(target_faction))
|
||||
return *force >= REP_FRIENDLY;
|
||||
|
||||
// if faction have reputation then friendly state for tester at 100% dependent from at_war state
|
||||
if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction))
|
||||
if(raw_target_faction->reputationListID >=0)
|
||||
if(FactionState const* FactionState = ((Player*)tester)->GetFactionState(raw_target_faction))
|
||||
return !(FactionState->Flags & FACTION_FLAG_AT_WAR);
|
||||
if(FactionState const* factionState = ((Player*)tester)->GetReputationMgr().GetState(raw_target_faction))
|
||||
return !(factionState->Flags & FACTION_FLAG_AT_WAR);
|
||||
}
|
||||
}
|
||||
// CvP forced reaction and reputation case
|
||||
|
|
@ -7088,14 +7083,13 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
|
|||
// forced reaction
|
||||
if(tester_faction->faction)
|
||||
{
|
||||
ForcedReactions::const_iterator forceItr = ((Player const*)target)->m_forcedReactions.find(tester_faction->faction);
|
||||
if(forceItr!=((Player const*)target)->m_forcedReactions.end())
|
||||
return forceItr->second >= REP_FRIENDLY;
|
||||
if(ReputationRank const* force =((Player*)target)->GetReputationMgr().GetForcedRankIfAny(tester_faction))
|
||||
return *force >= REP_FRIENDLY;
|
||||
|
||||
// apply reputation state
|
||||
if(FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction))
|
||||
if(raw_tester_faction->reputationListID >=0 )
|
||||
return ((Player const*)target)->GetReputationRank(raw_tester_faction) >= REP_FRIENDLY;
|
||||
return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) >= REP_FRIENDLY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7360,7 +7354,7 @@ Unit* Unit::GetCharm() const
|
|||
return pet;
|
||||
|
||||
sLog.outError("Unit::GetCharm: Charmed creature %u not exist.",GUID_LOPART(charm_guid));
|
||||
const_cast<Unit*>(this)->SetCharm(0);
|
||||
const_cast<Unit*>(this)->SetCharm(NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
@ -8233,6 +8227,9 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
|
|||
return true;
|
||||
}
|
||||
|
||||
//TODO add spellEffect immunity checks!, player with flag in bg is imune to imunity buffs from other friendly players!
|
||||
//SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_EFFECT];
|
||||
|
||||
SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
|
||||
for(SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
|
||||
if(itr->type == spellInfo->Dispel)
|
||||
|
|
@ -11421,4 +11418,4 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
|
|||
BuildHeartBeatMsg(&data);
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue