[11892] Really fix [11890]. This basicly reverts commit 11890

Remove the actually not required faction check in Player::GetNPCIfCanInteractWith - this is done by IsHostileTo a line before
Improve the Player-login AtWar selection to also consider forced reactions

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2012-01-31 00:12:45 +01:00
parent 85309aa3c1
commit 6aab5c1022
8 changed files with 70 additions and 61 deletions

View file

@ -2180,15 +2180,8 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
if (unit->IsHostileTo(this))
return NULL;
// not unfriendly
if(FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(unit->getFaction()))
if(factionTemplate->faction)
if(FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction))
if(faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction, true) <= REP_UNFRIENDLY)
return NULL;
// not too far
if(!unit->IsWithinDistInMap(this,INTERACTION_DISTANCE))
if (!unit->IsWithinDistInMap(this, INTERACTION_DISTANCE))
return NULL;
return unit;
@ -6229,7 +6222,7 @@ void Player::setFactionForRace(uint8 race)
ReputationRank Player::GetReputationRank(uint32 faction) const
{
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction);
return GetReputationMgr().GetRank(factionEntry, false);
return GetReputationMgr().GetRank(factionEntry);
}
//Calculate total reputation percent player gain with quest/creature level
@ -6310,7 +6303,7 @@ void Player::RewardReputation(Unit *pVictim, float rate)
int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue1, Rep->repfaction1, pVictim->getLevel());
donerep1 = int32(donerep1*rate);
FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1);
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1, false);
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1)
GetReputationMgr().ModifyReputation(factionEntry1, donerep1);
@ -6328,7 +6321,7 @@ void Player::RewardReputation(Unit *pVictim, float rate)
int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, Rep->repvalue2, Rep->repfaction2, pVictim->getLevel());
donerep2 = int32(donerep2*rate);
FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2);
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2, false);
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2)
GetReputationMgr().ModifyReputation(factionEntry2, donerep2);