Merge pull request #3040

Core/Spell: Fix spell related to reputation in Oracle and Frenzy faction
This commit is contained in:
kiper
2011-09-21 10:02:30 +02:00
committed by QAston
parent 82bc917265
commit cdb4f60a14
2 changed files with 52 additions and 0 deletions
@@ -1313,6 +1313,52 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader
}
};
class spell_gen_oracle_wolvar_reputation: public SpellScriptLoader
{
public:
spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { }
class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript)
void HandleDummy(SpellEffIndex effIndex)
{
if (Player* player = GetCaster()->ToPlayer())
{
uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue();
int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
return;
// Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated)
// Not when player already has equal or higher rep with this faction
if (player->GetReputationMgr().GetBaseReputation(factionEntry) < repChange)
player->GetReputationMgr().SetReputation(factionEntry, repChange);
// EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation
}
}
void Register()
{
OnEffect += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_gen_oracle_wolvar_reputation_SpellScript();
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -1343,4 +1389,5 @@ void AddSC_generic_spell_scripts()
new spell_gen_allow_cast_from_item_only();
new spell_gen_launch();
new spell_gen_vehicle_scaling();
new spell_gen_oracle_wolvar_reputation();
}