diff options
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 48b4845f3f0..2bd8ab771ed 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -479,6 +479,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_isWorldObject = true; sWorld.IncreasePlayerCount(); + + m_ChampioningFaction = 0; } Player::~Player () @@ -6110,11 +6112,35 @@ void Player::RewardReputation(Unit *pVictim, float rate) if(!Rep) return; + uint32 ChampioningFaction = 0; + + if(GetChampioningFaction()) + { + // support for: Championing - http://www.wowwiki.com/Championing + + Map const *pMap = GetMap(); + if(pMap && pMap->IsDungeon()) + { + bool Heroic = pMap->IsHeroic(); + + InstanceTemplate const *pInstance = objmgr.GetInstanceTemplate(pMap->GetId()); + if(pInstance) + { + AccessRequirement const *pAccessRequirement = objmgr.GetAccessRequirement(pInstance->access_id); + if(pAccessRequirement) + { + if(!pMap->IsRaid() && ((!Heroic && pAccessRequirement->levelMin == 80) || (Heroic && pAccessRequirement->heroicLevelMin == 80))) + ChampioningFaction = GetChampioningFaction(); + } + } + } + } + if(Rep->repfaction1 && (!Rep->team_dependent || GetTeam()==ALLIANCE)) { - int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue1, Rep->repfaction1, false); + int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue1, ChampioningFaction ? ChampioningFaction : Rep->repfaction1, false); donerep1 = int32(donerep1*rate); - FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1); + FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) GetReputationMgr().ModifyReputation(factionEntry1, donerep1); @@ -6130,9 +6156,9 @@ void Player::RewardReputation(Unit *pVictim, float rate) if(Rep->repfaction2 && (!Rep->team_dependent || GetTeam()==HORDE)) { - int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue2, Rep->repfaction2, false); + int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue2, ChampioningFaction ? ChampioningFaction : Rep->repfaction2, false); donerep2 = int32(donerep2*rate); - FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2); + FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) GetReputationMgr().ModifyReputation(factionEntry2, donerep2); @@ -21833,6 +21859,7 @@ void Player::ActivateSpec(uint8 spec) _LoadActions(result); } UnsummonPetTemporaryIfAny(); + AutoUnequipOffhandIfNeed(); SendActionButtons(1); SetPower(getPowerType(), 0); } |