Core/Quest: Threat From Above (#26468)

* [Quest] Threat From Above #26355

* [Quest] Threat From Above TrinityCore#26355

* Core/Quest: Threat From Above #26468 - modified sql according to guidelines; added override keyword

* Rename 2021_04_24_00_world.sql to 2021_04_25_00_world.sql

Co-authored-by: Edder <[email protected]>
Co-authored-by: Giacomo Pozzoni <[email protected]>
(cherry picked from commit 3e407c7d1c79cc94bf932880ee0eb68058d139fd)
This commit is contained in:
Edder
2022-03-09 00:42:48 +01:00
committed by Shauren
parent 9845fe92bb
commit 8202dc28c2
6 changed files with 52 additions and 34 deletions
@@ -0,0 +1,13 @@
-- delete non generic spell script for npc_wild_wyrm
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_eject_passenger_wild_wyrm';
-- add "special" generic spell script for "Eject Passenger 1"
-- the spell script "spell_eject_passenger_wild_wyrm" used this spell too
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_gen_eject_passenger_1';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(60603, 'spell_gen_eject_passenger_1');
-- add "special" generic spell script for "Eject Passenger 3"
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_gen_eject_passenger_3';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(52205, 'spell_gen_eject_passenger_3');
@@ -3503,3 +3503,12 @@ std::string Creature::GetDebugInfo() const
<< " WaypointPath: " << GetWaypointPath() << " SpawnId: " << GetSpawnId();
return sstr.str();
}
void Creature::ExitVehicle(Position const* /*exitPosition*/)
{
Unit::ExitVehicle();
// if the creature exits a vehicle, set it's home position to the
// exited position so it won't run away (home) and evade if it's hostile
SetHomePosition(GetPosition());
}
@@ -385,6 +385,8 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
std::string GetDebugInfo() const override;
void ExitVehicle(Position const* exitPosition = nullptr) override;
protected:
bool CreateFromProto(ObjectGuid::LowType guidlow, uint32 entry, CreatureData const* data = nullptr, uint32 vehId = 0);
bool InitEntry(uint32 entry, CreatureData const* data = nullptr);
+1 -1
View File
@@ -1795,7 +1795,7 @@ class TC_GAME_API Unit : public WorldObject
void HandleSpellClick(Unit* clicker, int8 seatId = -1);
void EnterVehicle(Unit* base, int8 seatId = -1);
void ExitVehicle(Position const* exitPosition = nullptr);
virtual void ExitVehicle(Position const* exitPosition = nullptr);
void ChangeSeat(int8 seatId, bool next = true);
// Should only be called by AuraEffect::HandleAuraControlVehicle(AuraApplication const* auraApp, uint8 mode, bool apply) const;
@@ -1158,38 +1158,6 @@ class spell_close_rift : public SpellScriptLoader
}
};
// 60603 - Eject Passenger 1
class spell_eject_passenger_wild_wyrm : public SpellScriptLoader
{
public:
spell_eject_passenger_wild_wyrm() : SpellScriptLoader("spell_eject_passenger_wild_wyrm") { }
class spell_eject_passenger_wild_wyrm_SpellScript : public SpellScript
{
PrepareSpellScript(spell_eject_passenger_wild_wyrm_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FIGHT_WYRM });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->RemoveAurasDueToSpell(SPELL_FIGHT_WYRM);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_eject_passenger_wild_wyrm_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_eject_passenger_wild_wyrm_SpellScript();
}
};
// 56689 - Grip
class spell_grip : public SpellScriptLoader
{
@@ -1572,7 +1540,6 @@ void AddSC_storm_peaks()
new spell_jokkum_scriptcast();
new spell_veranus_summon();
new spell_close_rift();
new spell_eject_passenger_wild_wyrm();
new spell_grip();
new spell_grab_on();
new spell_loosen_grip<5>("spell_thrust_spear");
@@ -3695,6 +3695,31 @@ class spell_gen_eject_passenger : public SpellScript
}
};
class spell_gen_eject_passenger_with_seatId : public SpellScript
{
PrepareSpellScript(spell_gen_eject_passenger_with_seatId);
public:
spell_gen_eject_passenger_with_seatId(uint8 seatId) : SpellScript(), _seatId(seatId) { }
private:
uint8 _seatId;
void EjectPassenger(SpellEffIndex /*effIndex*/)
{
if (Vehicle* vehicle = GetHitUnit()->GetVehicleKit())
{
if (Unit* passenger = vehicle->GetPassenger(_seatId))
passenger->ExitVehicle();
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_eject_passenger_with_seatId::EjectPassenger, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
enum GMFreeze
{
SPELL_GM_FREEZE = 9454
@@ -4842,6 +4867,8 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_whisper_gulch_yogg_saron_whisper);
RegisterSpellScript(spell_gen_eject_all_passengers);
RegisterSpellScript(spell_gen_eject_passenger);
RegisterSpellScriptWithArgs(spell_gen_eject_passenger_with_seatId, "spell_gen_eject_passenger_1", 0);
RegisterSpellScriptWithArgs(spell_gen_eject_passenger_with_seatId, "spell_gen_eject_passenger_3", 2);
RegisterSpellScript(spell_gen_gm_freeze);
RegisterSpellScript(spell_gen_stand);
RegisterSpellScript(spell_gen_mixology_bonus);