aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp34
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp157
2 files changed, 174 insertions, 17 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 186cdb8c552..18128660436 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2774,6 +2774,8 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
if (apply)
{
uint32 creatureEntry = GetMiscValue();
+ uint32 displayId = 0;
+ uint32 vehicleId = 0;
// Festive Holiday Mount
if (target->HasAura(62061))
@@ -2784,30 +2786,28 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
creatureEntry = 15665;
}
- CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry);
- if (!ci)
+ if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry))
{
- sLog->outError(LOG_FILTER_SQL, "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue());
- return;
- }
+ uint32 team = 0;
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ team = target->ToPlayer()->GetTeam();
- uint32 team = 0;
- if (target->GetTypeId() == TYPEID_PLAYER)
- team = target->ToPlayer()->GetTeam();
+ displayId = ObjectMgr::ChooseDisplayId(team, ci);
+ sObjectMgr->GetCreatureModelRandomGender(&displayId);
- uint32 displayID = ObjectMgr::ChooseDisplayId(team, ci);
- sObjectMgr->GetCreatureModelRandomGender(&displayID);
+ vehicleId = ci->VehicleId;
- //some spell has one aura of mount and one of vehicle
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON
- && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
- displayID = 0;
+ //some spell has one aura of mount and one of vehicle
+ for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON
+ && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue())
+ displayId = 0;
+ }
- target->Mount(displayID, ci->VehicleId, GetMiscValue());
+ target->Mount(displayId, vehicleId, creatureEntry);
// cast speed aura
- if (MountCapabilityEntry const* mountCapability = target->GetMountCapability(uint32(GetMiscValueB())))
+ if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(GetAmount()))
target->CastSpell(target, mountCapability->SpeedModSpell, true);
}
else
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 54cb346a033..d1d4f660172 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3163,6 +3163,160 @@ class spell_gen_replenishment : public SpellScriptLoader
}
};
+enum RunningWildMountIds
+{
+ RUNNING_WILD_MODEL_MALE = 29422,
+ RUNNING_WILD_MODEL_FEMALE = 29423,
+ SPELL_ALTERED_FORM = 97709,
+};
+
+class spell_gen_running_wild : public SpellScriptLoader
+{
+ public:
+ spell_gen_running_wild() : SpellScriptLoader("spell_gen_running_wild") { }
+
+ class spell_gen_running_wild_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_running_wild_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sCreatureDisplayInfoStore.LookupEntry(RUNNING_WILD_MODEL_MALE))
+ return false;
+ if (!sCreatureDisplayInfoStore.LookupEntry(RUNNING_WILD_MODEL_FEMALE))
+ return false;
+ return true;
+ }
+
+ void HandleMount(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ PreventDefaultAction();
+
+ target->Mount(target->getGender() == GENDER_FEMALE ? RUNNING_WILD_MODEL_FEMALE : RUNNING_WILD_MODEL_MALE, 0, 0);
+
+ // cast speed aura
+ if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(aurEff->GetAmount()))
+ target->CastSpell(target, mountCapability->SpeedModSpell, TRIGGERED_FULL_MASK);
+ }
+
+ void Register()
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_gen_running_wild_AuraScript::HandleMount, EFFECT_1, SPELL_AURA_MOUNTED, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ class spell_gen_running_wild_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_running_wild_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_ALTERED_FORM))
+ return false;
+ return true;
+ }
+
+ bool Load()
+ {
+ // Definitely not a good thing, but currently the only way to do something at cast start
+ // Should be replaced as soon as possible with a new hook: BeforeCastStart
+ GetCaster()->CastSpell(GetCaster(), SPELL_ALTERED_FORM, TRIGGERED_FULL_MASK);
+ return false;
+ }
+
+ void Register()
+ {
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_running_wild_AuraScript();
+ }
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_running_wild_SpellScript();
+ }
+};
+
+class spell_gen_two_forms : public SpellScriptLoader
+{
+ public:
+ spell_gen_two_forms() : SpellScriptLoader("spell_gen_two_forms") { }
+
+ class spell_gen_two_forms_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_two_forms_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (GetCaster()->isInCombat())
+ {
+ SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TRANSFORM);
+ return SPELL_FAILED_CUSTOM_ERROR;
+ }
+
+ // Player cannot transform to human form if he is forced to be worgen for some reason (Darkflight)
+ if (GetCaster()->GetAuraEffectsByType(SPELL_AURA_WORGEN_ALTERED_FORM).size() > 1)
+ {
+ SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TRANSFORM);
+ return SPELL_FAILED_CUSTOM_ERROR;
+ }
+
+ return SPELL_CAST_OK;
+ }
+
+ void HandleTransform(SpellEffIndex effIndex)
+ {
+ Unit* target = GetHitUnit();
+ PreventHitDefaultEffect(effIndex);
+ if (target->HasAuraType(SPELL_AURA_WORGEN_ALTERED_FORM))
+ target->RemoveAurasByType(SPELL_AURA_WORGEN_ALTERED_FORM);
+ else // Basepoints 1 for this aura control whether to trigger transform transition animation or not.
+ target->CastCustomSpell(SPELL_ALTERED_FORM, SPELLVALUE_BASE_POINT0, 1, target, TRIGGERED_FULL_MASK);
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_gen_two_forms_SpellScript::CheckCast);
+ OnEffectHitTarget += SpellEffectFn(spell_gen_two_forms_SpellScript::HandleTransform, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_two_forms_SpellScript();
+ }
+};
+
+class spell_gen_darkflight : public SpellScriptLoader
+{
+ public:
+ spell_gen_darkflight() : SpellScriptLoader("spell_gen_darkflight") { }
+
+ class spell_gen_darkflight_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_darkflight_SpellScript);
+
+ void TriggerTransform()
+ {
+ GetCaster()->CastSpell(GetCaster(), SPELL_ALTERED_FORM, TRIGGERED_FULL_MASK);
+ }
+
+ void Register()
+ {
+ AfterCast += SpellCastFn(spell_gen_darkflight_SpellScript::TriggerTransform);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_darkflight_SpellScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3243,4 +3397,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_increase_stats_buff("spell_mage_arcane_brilliance");
new spell_gen_increase_stats_buff("spell_mage_dalaran_brilliance");
new spell_gen_replenishment();
+ new spell_gen_running_wild();
+ new spell_gen_two_forms();
+ new spell_gen_darkflight();
}