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
@@ -0,0 +1,5 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (53475,53487,54015);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(53475, 'spell_gen_oracle_wolvar_reputation'), -- Set Oracle Faction Friendly
(53487, 'spell_gen_oracle_wolvar_reputation'), -- Set Wolvar Faction Honored
(54015, 'spell_gen_oracle_wolvar_reputation'); -- Set Oracle Faction Honored
@@ -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();
}