[7818] Implement SPELL_AURA_MOD_FACTION_REPUTATION_GAIN. Author: DonTomika
--HG-- branch : trunk
This commit is contained in:
+9
-6
@@ -5745,7 +5745,7 @@ ReputationRank Player::GetReputationRank(uint32 faction) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Calculate total reputation percent player gain with quest/creature level
|
//Calculate total reputation percent player gain with quest/creature level
|
||||||
int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest)
|
int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest)
|
||||||
{
|
{
|
||||||
float percent = 100.0f;
|
float percent = 100.0f;
|
||||||
|
|
||||||
@@ -5754,14 +5754,17 @@ int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bo
|
|||||||
if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel()))
|
if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel()))
|
||||||
percent *= rate;
|
percent *= rate;
|
||||||
|
|
||||||
int32 repMod = GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN);
|
float repMod = GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN);
|
||||||
|
|
||||||
|
if (!for_quest)
|
||||||
|
repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
|
||||||
|
|
||||||
percent += rep > 0 ? repMod : -repMod;
|
percent += rep > 0 ? repMod : -repMod;
|
||||||
|
|
||||||
if (percent <= 0.0f)
|
if (percent <= 0.0f)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return int32(sWorld.getRate(RATE_REPUTATION_GAIN)*rep*percent/100);
|
return int32(sWorld.getRate(RATE_REPUTATION_GAIN)*rep*percent/100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calculates how many reputation points player gains in victim's enemy factions
|
//Calculates how many reputation points player gains in victim's enemy factions
|
||||||
@@ -5780,7 +5783,7 @@ void Player::RewardReputation(Unit *pVictim, float rate)
|
|||||||
|
|
||||||
if(Rep->repfaction1 && (!Rep->team_dependent || GetTeam()==ALLIANCE))
|
if(Rep->repfaction1 && (!Rep->team_dependent || GetTeam()==ALLIANCE))
|
||||||
{
|
{
|
||||||
int32 donerep1 = CalculateReputationGain(pVictim->getLevel(),Rep->repvalue1,false);
|
int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue1, Rep->repfaction1, false);
|
||||||
donerep1 = int32(donerep1*rate);
|
donerep1 = int32(donerep1*rate);
|
||||||
FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1);
|
FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(Rep->repfaction1);
|
||||||
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
|
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
|
||||||
@@ -5798,7 +5801,7 @@ void Player::RewardReputation(Unit *pVictim, float rate)
|
|||||||
|
|
||||||
if(Rep->repfaction2 && (!Rep->team_dependent || GetTeam()==HORDE))
|
if(Rep->repfaction2 && (!Rep->team_dependent || GetTeam()==HORDE))
|
||||||
{
|
{
|
||||||
int32 donerep2 = CalculateReputationGain(pVictim->getLevel(),Rep->repvalue2,false);
|
int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue2, Rep->repfaction2, false);
|
||||||
donerep2 = int32(donerep2*rate);
|
donerep2 = int32(donerep2*rate);
|
||||||
FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2);
|
FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(Rep->repfaction2);
|
||||||
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
|
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
|
||||||
@@ -5823,7 +5826,7 @@ void Player::RewardReputation(Quest const *pQuest)
|
|||||||
{
|
{
|
||||||
if(pQuest->RewRepFaction[i] && pQuest->RewRepValue[i] )
|
if(pQuest->RewRepFaction[i] && pQuest->RewRepValue[i] )
|
||||||
{
|
{
|
||||||
int32 rep = CalculateReputationGain(GetQuestLevel(pQuest),pQuest->RewRepValue[i],true);
|
int32 rep = CalculateReputationGain(GetQuestLevel(pQuest), pQuest->RewRepValue[i], pQuest->RewRepFaction[i], true);
|
||||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]);
|
FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]);
|
||||||
if(factionEntry)
|
if(factionEntry)
|
||||||
GetReputationMgr().ModifyReputation(factionEntry, rep);
|
GetReputationMgr().ModifyReputation(factionEntry, rep);
|
||||||
|
|||||||
+1
-1
@@ -2257,7 +2257,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
|||||||
Item* _StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update );
|
Item* _StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update );
|
||||||
|
|
||||||
void UpdateKnownCurrencies(uint32 itemId, bool apply);
|
void UpdateKnownCurrencies(uint32 itemId, bool apply);
|
||||||
int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, bool for_quest);
|
int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest);
|
||||||
void AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData );
|
void AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData );
|
||||||
|
|
||||||
GridReference<Player> m_gridRef;
|
GridReference<Player> m_gridRef;
|
||||||
|
|||||||
@@ -242,8 +242,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||||||
&AuraEffect::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
|
&AuraEffect::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
|
||||||
&AuraEffect::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
|
&AuraEffect::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
|
||||||
&AuraEffect::HandleModRating, //189 SPELL_AURA_MOD_RATING
|
&AuraEffect::HandleModRating, //189 SPELL_AURA_MOD_RATING
|
||||||
&AuraEffect::HandleNULL, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
|
&AuraEffect::HandleNoImmediateEffect, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN implemented in Player::CalculateReputationGain &AuraEffect::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
|
||||||
&AuraEffect::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
|
|
||||||
&AuraEffect::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE
|
&AuraEffect::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE
|
||||||
&AuraEffect::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
|
&AuraEffect::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
|
||||||
&AuraEffect::HandleNULL, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
|
&AuraEffect::HandleNULL, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
|
||||||
|
|||||||
Reference in New Issue
Block a user