mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 16:16:27 +00:00
fix(Core/Quest): improved flight of the wintergarde defender (#12437)
* fix(Scripts/Quest): Flight of the Wintergarde Defender * . * update * update
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
--
|
||||
UPDATE `creature_template` SET `ScriptName`='npc_wintergarde_gryphon' WHERE `entry`=27258;
|
||||
|
||||
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 48397) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 30) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 188679) AND (`ConditionValue2` = 15) AND (`ConditionValue3` = 0);
|
||||
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 48363) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 29) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 27315) AND (`ConditionValue2` = 5) AND (`ConditionValue3` = 0);
|
||||
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 48363) AND (`SourceId` = 0) AND (`ElseGroup` = 1) AND (`ConditionTypeOrReference` = 29) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 27336) AND (`ConditionValue2` = 5) AND (`ConditionValue3` = 0);
|
||||
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 48397) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 29) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 27315) AND (`ConditionValue2` = 5) AND (`ConditionValue3` = 0);
|
||||
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 48397) AND (`SourceId` = 0) AND (`ElseGroup` = 1) AND (`ConditionTypeOrReference` = 29) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 27336) AND (`ConditionValue2` = 5) AND (`ConditionValue3` = 0);
|
||||
|
||||
-- fly speed 200%
|
||||
UPDATE `creature_template_addon` SET `bytes1` = 50331648, `auras` = '60534' WHERE (`entry` = 27258);
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q12237_rescue_villager';
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q12237_drop_off_villager';
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_call_wintergarde_gryphon';
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(48363, 'spell_q12237_rescue_villager'),
|
||||
(48397, 'spell_q12237_drop_off_villager'),
|
||||
(48388, 'spell_call_wintergarde_gryphon');
|
||||
|
||||
DELETE FROM `creature_text` WHERE `creatureid` IN (27336,27315);
|
||||
INSERT INTO `creature_text` (`creatureid`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`broadcasttextid`,`textrange`,`comment`) VALUES
|
||||
(27336,0,0,"HELP! HELP!",12,0,100,0,0,0,26342,0, "Helpless Wintergarde Villager"),
|
||||
(27336,0,1,"I'll die before I let one of you fiends turn me!",12,0,100,0,0,0,26347,0, "Helpless Wintergarde Villager"),
|
||||
(27336,0,2,"THEY'RE TRYING TO KILL ME! HELP!",12,0,100,0,0,0,26346,0, "Helpless Wintergarde Villager"),
|
||||
(27336,0,3,"Where did this all come from! Somebody help!",12,0,100,0,0,0,26348,0, "Helpless Wintergarde Villager"),
|
||||
(27336,0,4,"YOU'LL NEVER CATCH ME, FIENDS!",12,0,100,0,0,0,26343,0, "Helpless Wintergarde Villager"),
|
||||
(27336,1,0,"Are you sure you know how to fly this thing? Feels a little wobbly.",12,0,100,0,0,0,26359,0, "Helpless Wintergarde Villager"),
|
||||
(27336,1,1,"For the love of the Light, get me out of here!",12,0,100,0,0,0,26344,0, "Helpless Wintergarde Villager"),
|
||||
(27336,1,2,"I don't mean to sound ungrateful, but could you fly a little closer to the ground? I hate heights!",12,0,100,0,0,0,26360,0, "Helpless Wintergarde Villager"),
|
||||
(27336,1,3,"I picked a bad day to stop drinking!",12,0,100,0,0,0,26345,0, "Helpless Wintergarde Villager"),
|
||||
(27336,1,4,"I'm gettin' a little woozy... Oooooof...",12,0,100,0,0,0,26364,0, "Helpless Wintergarde Villager"),
|
||||
(27336,1,5,"Who woulda thought that we'd have this problem again? Oh wait, EVERYBODY DID!",12,0,100,0,0,0,26349,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,0,"How can I ever repay you for this, friend?",12,0,100,0,0,0,26363,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,1,"HURRAY!",12,0,100,0,0,0,26382,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,2,"Kindness is not lost with this one, Urik. Thank you, hero!",12,0,100,0,0,0,26383,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,3,"My shop's doors will always be open to you, friend.",12,0,100,0,0,0,26385,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,4,"Safe at last! Thank you, stranger!",12,0,100,0,0,0,26381,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,5,"Thanks for your help, hero!",12,0,100,0,0,0,26357,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,6,"We made it! We actually made it!",12,0,100,0,0,0,26384,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,7,"You are my guardian angel! Like a white knight you flew in from the heavens and lifted me from the pit of damnation!",12,0,100,0,0,0,26362,0, "Helpless Wintergarde Villager"),
|
||||
(27336,2,8,"You saved my life! Thanks!",12,0,100,0,0,0,26358,0, "Helpless Wintergarde Villager"),
|
||||
(27315,0,0,"HELP! HELP!",12,0,100,0,0,0,26342,0, "Helpless Wintergarde Villager"),
|
||||
(27315,0,1,"I'll die before I let one of you fiends turn me!",12,0,100,0,0,0,26347,0, "Helpless Wintergarde Villager"),
|
||||
(27315,0,2,"THEY'RE TRYING TO KILL ME! HELP!",12,0,100,0,0,0,26346,0, "Helpless Wintergarde Villager"),
|
||||
(27315,0,3,"Where did this all come from! Somebody help!",12,0,100,0,0,0,26348,0, "Helpless Wintergarde Villager"),
|
||||
(27315,0,4,"YOU'LL NEVER CATCH ME, FIENDS!",12,0,100,0,0,0,26343,0, "Helpless Wintergarde Villager"),
|
||||
(27315,1,0,"Are you sure you know how to fly this thing? Feels a little wobbly.",12,0,100,0,0,0,26359,0, "Helpless Wintergarde Villager"),
|
||||
(27315,1,1,"For the love of the Light, get me out of here!",12,0,100,0,0,0,26344,0, "Helpless Wintergarde Villager"),
|
||||
(27315,1,2,"I don't mean to sound ungrateful, but could you fly a little closer to the ground? I hate heights!",12,0,100,0,0,0,26360,0, "Helpless Wintergarde Villager"),
|
||||
(27315,1,3,"I picked a bad day to stop drinking!",12,0,100,0,0,0,26345,0, "Helpless Wintergarde Villager"),
|
||||
(27315,1,4,"I'm gettin' a little woozy... Oooooof...",12,0,100,0,0,0,26364,0, "Helpless Wintergarde Villager"),
|
||||
(27315,1,5,"Who woulda thought that we'd have this problem again? Oh wait, EVERYBODY DID!",12,0,100,0,0,0,26349,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,0,"How can I ever repay you for this, friend?",12,0,100,0,0,0,26363,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,1,"HURRAY!",12,0,100,0,0,0,26382,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,2,"Kindness is not lost with this one, Urik. Thank you, hero!",12,0,100,0,0,0,26383,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,3,"My shop's doors will always be open to you, friend.",12,0,100,0,0,0,26385,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,4,"Safe at last! Thank you, stranger!",12,0,100,0,0,0,26381,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,5,"Thanks for your help, hero!",12,0,100,0,0,0,26357,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,6,"We made it! We actually made it!",12,0,100,0,0,0,26384,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,7,"You are my guardian angel! Like a white knight you flew in from the heavens and lifted me from the pit of damnation!",12,0,100,0,0,0,26362,0, "Helpless Wintergarde Villager"),
|
||||
(27315,2,8,"You saved my life! Thanks!",12,0,100,0,0,0,26358,0, "Helpless Wintergarde Villager");
|
||||
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 27315;
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 27315);
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(27315, 0, 0, 1, 8, 0, 100, 512, 48363, 0, 0, 0, 0, 28, 49774, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Spellhit \'Rescue Villager\' - Remove Aura \'Cower + Fear Visual\''),
|
||||
(27315, 0, 1, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Spellhit \'Rescue Villager\' - Set Event Phase 2'),
|
||||
(27315, 0, 2, 0, 1, 2, 100, 1, 18000, 18000, 18000, 18000, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - Out of Combat - Say Line 1 (Phase 2) (No Repeat)'),
|
||||
(27315, 0, 3, 0, 23, 2, 100, 1, 43671, 0, 1000, 1000, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Aura \'Ride Vehicle\' - Say Line 2 (Phase 2) (No Repeat)'),
|
||||
(27315, 0, 4, 0, 60, 0, 100, 1, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Update - Set Event Phase 1 (No Repeat)'),
|
||||
(27315, 0, 5, 0, 1, 1, 100, 0, 30000, 45000, 50000, 50000, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - Out of Combat - Say Line 0 (Phase 1)'),
|
||||
(27315, 0, 6, 0, 1, 1, 100, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - Out of Combat - Set Reactstate Passive (Phase 1)');
|
||||
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 27336;
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 27336);
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(27336, 0, 0, 1, 8, 0, 100, 512, 48363, 0, 0, 0, 0, 28, 49774, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Spellhit \'Rescue Villager\' - Remove Aura \'Cower + Fear Visual\''),
|
||||
(27336, 0, 1, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 22, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Spellhit \'Rescue Villager\' - Set Event Phase 2'),
|
||||
(27336, 0, 2, 0, 1, 2, 100, 1, 18000, 18000, 18000, 18000, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - Out of Combat - Say Line 1 (Phase 2) (No Repeat)'),
|
||||
(27336, 0, 3, 0, 23, 2, 100, 1, 43671, 0, 1000, 1000, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Aura \'Ride Vehicle\' - Say Line 2 (Phase 2) (No Repeat)'),
|
||||
(27336, 0, 4, 0, 60, 0, 100, 1, 0, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - On Update - Set Event Phase 1 (No Repeat)'),
|
||||
(27336, 0, 5, 0, 1, 1, 100, 0, 30000, 45000, 50000, 50000, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - Out of Combat - Say Line 0 (Phase 1)'),
|
||||
(27336, 0, 6, 0, 1, 1, 100, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Helpless Wintergarde Villager - Out of Combat - Set Reactstate Passive (Phase 1)');
|
||||
@@ -633,6 +633,264 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
enum WintergardeGryphon
|
||||
{
|
||||
SPELL_RESCUE_VILLAGER = 48363,
|
||||
SPELL_DROP_OFF_VILLAGER = 48397,
|
||||
SPELL_RIDE_VEHICLE = 43671,
|
||||
|
||||
NPC_HELPLESS_VILLAGER_A = 27315,
|
||||
NPC_HELPLESS_VILLAGER_B = 27336,
|
||||
|
||||
EVENT_VEHICLE_GET = 1,
|
||||
EVENT_TAKE_OFF = 2,
|
||||
EVENT_GET_VILLAGER = 3,
|
||||
|
||||
EVENT_PHASE_FEAR = 1,
|
||||
EVENT_PHASE_VEHICLE = 2,
|
||||
|
||||
POINT_LAND = 1,
|
||||
POINT_TAKE_OFF = 2,
|
||||
|
||||
QUEST_FLIGHT_OF_THE_WINTERGARDE_DEFENDER = 12237,
|
||||
GO_TEMP_GRYPHON_STATION = 188679,
|
||||
AREA_WINTERGARDE_KEEP = 4177
|
||||
};
|
||||
|
||||
class npc_wintergarde_gryphon : public VehicleAI
|
||||
{
|
||||
public:
|
||||
npc_wintergarde_gryphon(Creature* creature) : VehicleAI(creature)
|
||||
{
|
||||
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
me->DespawnOrUnsummon(3s, 0s);
|
||||
}
|
||||
|
||||
void IsSummonedBy(Unit* summoner) override
|
||||
{
|
||||
me->SetFacingToObject(summoner);
|
||||
Position pos = summoner->GetPosition();
|
||||
me->GetMotionMaster()->MovePoint(POINT_LAND, pos);
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 id) override
|
||||
{
|
||||
if (type == POINT_MOTION_TYPE && id == POINT_LAND)
|
||||
events.ScheduleEvent(EVENT_VEHICLE_GET, 0s);
|
||||
}
|
||||
|
||||
void PassengerBoarded(Unit* passenger, int8 seatId, bool apply) override
|
||||
{
|
||||
if (!apply && seatId == 0)
|
||||
{
|
||||
// left the vehicle with a passenger will result in despawn
|
||||
if (Vehicle* gryphon = me->GetVehicleKit())
|
||||
if (Unit* villager = gryphon->GetPassenger(1))
|
||||
{
|
||||
if (villager->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
if (Creature* seat = villager->ToCreature())
|
||||
{
|
||||
seat->ExitVehicle();
|
||||
seat->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
me->RemoveVehicleKit(); // not Crash (;
|
||||
events.ScheduleEvent(EVENT_TAKE_OFF, 2s);
|
||||
me->CastSpell(passenger, VEHICLE_SPELL_PARACHUTE, true);
|
||||
}
|
||||
}
|
||||
|
||||
Creature* getVillager() { return ObjectAccessor::GetCreature(*me, villagerGUID); }
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_VEHICLE_GET:
|
||||
{
|
||||
me->SetDisableGravity(false);
|
||||
me->SetHover(false);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
break;
|
||||
}
|
||||
case EVENT_TAKE_OFF:
|
||||
{
|
||||
me->DespawnOrUnsummon(4050);
|
||||
me->SetOrientation(2.5f);
|
||||
me->SetSpeedRate(MOVE_FLIGHT, 1.0f);
|
||||
Position pos = me->GetPosition();
|
||||
Position offset = { 14.0f, 14.0f, 16.0f, 0.0f };
|
||||
pos.RelocateOffset(offset);
|
||||
me->GetMotionMaster()->MovePoint(POINT_TAKE_OFF, pos);
|
||||
break;
|
||||
}
|
||||
case EVENT_GET_VILLAGER:
|
||||
{
|
||||
if (getVillager())
|
||||
{
|
||||
getVillager()->GetMotionMaster()->MovePoint(0, 3660.0f, -706.4f, 215.0f);
|
||||
getVillager()->DespawnOrUnsummon(7s, 0s);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
|
||||
{
|
||||
if (spell->Id != SPELL_DROP_OFF_VILLAGER)
|
||||
return;
|
||||
|
||||
if (Vehicle* gryphon = me->GetVehicleKit())
|
||||
if (Unit* villager = gryphon->GetPassenger(1))
|
||||
{
|
||||
villager->ExitVehicle();
|
||||
villager->GetMotionMaster()->Clear(false);
|
||||
villager->GetMotionMaster()->MoveIdle();
|
||||
villager->SetCanFly(false); // prevents movement in flight
|
||||
villagerGUID = villager->GetGUID();
|
||||
villager->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
|
||||
events.ScheduleEvent(EVENT_GET_VILLAGER, 3s);
|
||||
}
|
||||
}
|
||||
private:
|
||||
ObjectGuid villagerGUID;
|
||||
};
|
||||
|
||||
class spell_q12237_rescue_villager : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_q12237_rescue_villager);
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Player* owner = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if (!owner)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE;
|
||||
SpellCastResult result = SPELL_CAST_OK;
|
||||
|
||||
if (GetCaster()->GetAreaId() == AREA_WINTERGARDE_KEEP)
|
||||
{
|
||||
extension = SPELL_CUSTOM_ERROR_MUST_BE_NEAR_HELPLESS_VILLAGER;
|
||||
result = SPELL_FAILED_CUSTOM_ERROR;
|
||||
}
|
||||
|
||||
if (!GetCaster()->FindNearestCreature(NPC_HELPLESS_VILLAGER_A, 5.0f) && !GetCaster()->FindNearestCreature(NPC_HELPLESS_VILLAGER_B, 5.0f))
|
||||
{
|
||||
extension = SPELL_CUSTOM_ERROR_MUST_BE_NEAR_HELPLESS_VILLAGER;
|
||||
result = SPELL_FAILED_CUSTOM_ERROR;
|
||||
}
|
||||
|
||||
if (GetCaster()->FindNearestGameObject(GO_TEMP_GRYPHON_STATION, 15.0f))
|
||||
{
|
||||
extension = SPELL_CUSTOM_ERROR_NEED_HELPLESS_VILLAGER;
|
||||
result = SPELL_FAILED_CUSTOM_ERROR;
|
||||
}
|
||||
|
||||
if (GetCaster()->HasAura(SPELL_RIDE_VEHICLE))
|
||||
result = SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
|
||||
|
||||
if (result != SPELL_CAST_OK)
|
||||
{
|
||||
Spell::SendCastResult(owner, GetSpellInfo(), 0, result, extension);
|
||||
return result;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
target->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q12237_rescue_villager::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnCheckCast += SpellCheckCastFn(spell_q12237_rescue_villager::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_q12237_drop_off_villager : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_q12237_drop_off_villager);
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Player* master = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
if (!master)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
SpellCustomErrors extension = SPELL_CUSTOM_ERROR_NONE;
|
||||
SpellCastResult result = SPELL_CAST_OK;
|
||||
|
||||
if (!GetCaster()->FindNearestGameObject(GO_TEMP_GRYPHON_STATION, 10.0f))
|
||||
result = SPELL_FAILED_REQUIRES_SPELL_FOCUS;
|
||||
|
||||
if (!GetCaster()->HasAura(SPELL_RIDE_VEHICLE))
|
||||
{
|
||||
extension = SPELL_CUSTOM_ERROR_NO_PASSENGER;
|
||||
result = SPELL_FAILED_CUSTOM_ERROR;
|
||||
}
|
||||
|
||||
if (result != SPELL_CAST_OK)
|
||||
{
|
||||
Spell::SendCastResult(master, GetSpellInfo(), 0, result, extension);
|
||||
return result;
|
||||
}
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_q12237_drop_off_villager::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_call_wintergarde_gryphon : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_call_wintergarde_gryphon);
|
||||
|
||||
void SetDest(SpellDestination& dest)
|
||||
{
|
||||
// Adjust effect summon position
|
||||
Position const offset = { 0.0f, 0.0f, 9.0f, 0.0f };
|
||||
dest.RelocateOffset(offset);
|
||||
}
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (Player* playerCaster = GetCaster()->ToPlayer())
|
||||
{
|
||||
if (playerCaster->GetQuestStatus(QUEST_FLIGHT_OF_THE_WINTERGARDE_DEFENDER) == QUEST_STATUS_INCOMPLETE)
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_call_wintergarde_gryphon::CheckRequirement);
|
||||
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_call_wintergarde_gryphon::SetDest, EFFECT_0, TARGET_DEST_CASTER_FRONT);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_heated_battle : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -2009,6 +2267,10 @@ void AddSC_dragonblight()
|
||||
new npc_future_you();
|
||||
new npc_mindless_ghoul();
|
||||
new npc_injured_7th_legion_soldier();
|
||||
RegisterCreatureAI(npc_wintergarde_gryphon);
|
||||
RegisterSpellScript(spell_q12237_rescue_villager);
|
||||
RegisterSpellScript(spell_q12237_drop_off_villager);
|
||||
RegisterSpellScript(spell_call_wintergarde_gryphon);
|
||||
new npc_heated_battle();
|
||||
new spell_q12478_frostmourne_cavern();
|
||||
new spell_q12243_fire_upon_the_waters();
|
||||
|
||||
Reference in New Issue
Block a user