*Implement Championing system. More info about this patch at http://www.wowwiki.com/Championing

*Dont forget that this system can only works fine if has a DB support with level 80 instances' reputations(so need some data to creature_onkill_reputation).

--HG--
branch : trunk
This commit is contained in:
Anubisss
2009-08-16 01:54:50 +02:00
parent 6337c3adfb
commit 4b31577eb3
3 changed files with 58 additions and 4 deletions
+30 -4
View File
@@ -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);
+5
View File
@@ -2204,6 +2204,9 @@ class MANGOS_DLL_SPEC Player : public Unit
//bool isActiveObject() const { return true; }
bool canSeeSpellClickOn(Creature const* creature) const;
inline uint32 GetChampioningFaction() const { return m_ChampioningFaction; }
inline void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
protected:
uint32 m_contestedPvPTimer;
@@ -2479,6 +2482,8 @@ class MANGOS_DLL_SPEC Player : public Unit
ReputationMgr m_reputationMgr;
SpellCooldowns m_spellCooldowns;
uint32 m_ChampioningFaction;
};
void AddItemsSetItem(Player*player,Item *item);
+23
View File
@@ -2872,6 +2872,29 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
}
return;
}
case 57819: // Argent Champion
case 57820: // Ebon Champion
case 57821: // Champion of the Kirin Tor
case 57822: // Wyrmrest Champion
{
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 FactionID = 0;
if(apply)
{
switch(m_spellProto->Id)
{
case 57819: FactionID = 1106; break; // Argent Crusade
case 57820: FactionID = 1098; break; // Knights of the Ebon Blade
case 57821: FactionID = 1090; break; // Kirin Tor
case 57822: FactionID = 1091; break; // The Wyrmrest Accord
}
}
((Player*)caster)->SetChampioningFaction(FactionID);
return;
}
// LK Intro VO (1)
case 58204:
if(m_target->GetTypeId() == TYPEID_PLAYER)