Scripts/Quests: Handle quest 29409 (wandering isle) (#29784)

This commit is contained in:
Aqua Deus
2024-04-11 19:58:06 +02:00
committed by GitHub
parent 2ce4068459
commit 796b37102a
2 changed files with 259 additions and 1 deletions

View File

@@ -0,0 +1,48 @@
DELETE FROM `creature_text` WHERE `CreatureID`=54611 AND `GroupID` IN (0,1);
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(54611, 0, 0, 'A challenger approaches.', 12, 0, 100, 113, 0, 0, 59692, 0, 'Jaomin Ro to Player'),
(54611, 1, 0, 'You''ve been trained well.', 12, 0, 100, 2, 0, 0, 55205, 0, 'Jaomin Ro to Player'),
(54611, 1, 1, 'Well fought. Master Shang will be pleased.', 12, 0, 100, 2, 0, 0, 55206, 0, 'Jaomin Ro to Player'),
(54611, 1, 2, 'Amazing! You''re much stronger than you look.', 12, 0, 100, 2, 0, 0, 55207, 0, 'Jaomin Ro to Player'),
(54611, 1, 3, 'It seems I have more training to do. Thank you for the lesson.', 12, 0, 100, 2, 0, 0, 55208, 0, 'Jaomin Ro to Player'),
(54611, 1, 4, 'I bow to your skill. You bested me fairly.', 12, 0, 100, 2, 0, 0, 55209, 0, 'Jaomin Ro to Player'),
(54611, 1, 5, 'It was an honor to be defeated by you.', 12, 0, 100, 2, 0, 0, 55210, 0, 'Jaomin Ro to Player');
UPDATE `creature_template_difficulty` SET `StaticFlags1`=268959758, `StaticFlags3`=8388608, `StaticFlags4`=2147483648, `VerifiedBuild`=53441 WHERE (`Entry`=54611 AND `DifficultyID`=0); -- Jaomin Ro
UPDATE `creature_template_difficulty` SET `StaticFlags1`=524806, `ContentTuningID`=80, `VerifiedBuild`=53441 WHERE (`Entry`=57750 AND `DifficultyID`=0); -- Jaomin Ro
UPDATE `creature_template` SET `faction`=2104, `BaseAttackTime`=2000, `unit_flags`=33554432, `unit_flags2`=67584, `unit_flags3`=524288, `VehicleId`=1953, `ScriptName`='npc_jaomin_ro_hawk' WHERE `entry`=57750; -- Jaomin Ro
UPDATE `creature_template` SET `ScriptName`='npc_jaomin_ro' WHERE `entry`=54611; -- Jaomin Ro
DELETE FROM `creature_template_addon` WHERE `entry` = 57750;
INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES
(57750, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, '108971'); -- 57750 (Jaomin Ro) - Hawk Diving to Earth
-- Spell
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_force_summoner_to_ride_vehicle', 'spell_ride_drake');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(108583, 'spell_force_summoner_to_ride_vehicle'),
(108582, 'spell_ride_drake');
-- Areatrigger
DELETE FROM `areatrigger_scripts` WHERE `entry` = 7737;
INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES
(7737, 'SmartTrigger');
DELETE FROM `smart_scripts` WHERE `source_type` = 2 AND `entryOrGuid` = 7737;
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_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(7737, 2, 0, 0, 46, 0, 100, 0, 7737, 0, 0, 0, 0, 86, 88811, 2, 10, 450184, 54611, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On Trigger - Cast Area Trigger Dummy Timer Aura on Invoker');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry` = 7737;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(22, 1, 7737, 2, 0, 9, 0, 29409, 0, 0, 0, 0, 0, '', 'SAI only triggers when quest taken'),
(22, 1, 7737, 2, 0, 1, 0, 88811, 0, 0, 1, 0, 0, '', 'SAI only triggers when player has not aura');
-- Serverside Spell
DELETE FROM `serverside_spell` WHERE `Id`=109837 AND `DifficultyID`=0;
INSERT INTO `serverside_spell` (`Id`, `DifficultyID`, `CategoryId`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`, `AttributesEx7`, `AttributesEx8`, `AttributesEx9`, `AttributesEx10`, `AttributesEx11`, `AttributesEx12`, `AttributesEx13`, `AttributesEx14`, `Stances`, `StancesNot`, `Targets`, `TargetCreatureType`, `RequiresSpellFocus`, `FacingCasterFlags`, `CasterAuraState`, `TargetAuraState`, `ExcludeCasterAuraState`, `ExcludeTargetAuraState`, `CasterAuraSpell`, `TargetAuraSpell`, `ExcludeCasterAuraSpell`, `ExcludeTargetAuraSpell`, `CasterAuraType`, `TargetAuraType`, `ExcludeCasterAuraType`, `ExcludeTargetAuraType`, `CastingTimeIndex`, `RecoveryTime`, `CategoryRecoveryTime`, `StartRecoveryCategory`, `StartRecoveryTime`, `InterruptFlags`, `AuraInterruptFlags1`, `AuraInterruptFlags2`, `ChannelInterruptFlags1`, `ChannelInterruptFlags2`, `ProcFlags`, `ProcFlags2`, `ProcChance`, `ProcCharges`, `ProcCooldown`, `ProcBasePPM`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `Speed`, `LaunchDelay`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `ContentTuningId`, `SpellName`, `ConeAngle`, `ConeWidth`, `MaxTargetLevel`, `MaxAffectedTargets`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `SpellFamilyFlags4`, `DmgClass`, `PreventionType`, `AreaGroupId`, `SchoolMask`, `ChargeCategoryId`) VALUES
(109837, 0, 0, 0, 0, 0x29800180, 0x420, 0x10484005, 0x10130200, 0x800080, 0x60008, 0x1200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, -1, 0, 0, 0, 'Jaomin Ro Credit', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0);
DELETE FROM `serverside_spell_effect` WHERE `SpellID`=109837 AND `EffectIndex`=0 AND `DifficultyID`=0;
INSERT INTO `serverside_spell_effect` (`SpellID`, `EffectIndex`, `DifficultyID`, `Effect`, `EffectAura`, `EffectAmplitude`, `EffectAttributes`, `EffectAuraPeriod`, `EffectBonusCoefficient`, `EffectChainAmplitude`, `EffectChainTargets`, `EffectItemType`, `EffectMechanic`, `EffectPointsPerResource`, `EffectPosFacing`, `EffectRealPointsPerLevel`, `EffectTriggerSpell`, `BonusCoefficientFromAP`, `PvpMultiplier`, `Coefficient`, `Variance`, `ResourceCoefficient`, `GroupSizeBasePointsCoefficient`, `EffectBasePoints`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectSpellClassMask1`, `EffectSpellClassMask2`, `EffectSpellClassMask3`, `EffectSpellClassMask4`, `ImplicitTarget1`, `ImplicitTarget2`) VALUES
(109837, 0, 0, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54611, 0, 0, 0, 0, 0, 0, 0, 123, 0);

View File

@@ -17,12 +17,15 @@
#include "CellImpl.h"
#include "Containers.h"
#include "CreatureAI.h"
#include "CreatureAIImpl.h" // for RAND()
#include "GridNotifiersImpl.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "TaskScheduler.h"
enum TraineeMisc
@@ -400,10 +403,217 @@ private:
TaskScheduler _scheduler;
};
enum JaominRoMisc
{
// Spells
SPELL_CSA_AREATRIGGER_DUMMY = 88811,
SPELL_HAWK_DIVING_TO_EARTH = 108955,
SPELL_HAWK_DIVING_TO_EARTH_DMG = 108935,
SPELL_BABY_ELEPHANT_TAKES_A_BATH = 108938,
SPELL_FORCE_SUMMONER_TO_RIDE = 108583,
SPELL_EJECT_ALL_PASSENGERS = 50630,
SPELL_DIZZY = 108959,
SPELL_RIDE_DRAKE = 108582,
SPELL_SERVERSIDE_KILL_CREDIT = 109837,
SPELL_FULL_HEALTH = 17683,
// Texts
SAY_INTRO = 0,
SAY_DEFEATED = 1,
// Movement
POINT_RANDOM_DEST = 0,
// Events
EVENT_RANDOM_SPELL = 1,
EVENT_MOVE,
EVENT_HEAL,
EVENT_MOVE_HOME
};
// 54611 - Jaomin Ro
struct npc_jaomin_ro : public ScriptedAI
{
using ScriptedAI::ScriptedAI;
void JustEngagedWith(Unit* /*who*/) override
{
_events.ScheduleEvent(EVENT_RANDOM_SPELL, 4s, 6s);
}
void JustReachedHome() override
{
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE_2);
me->InitializeReactState();
}
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_CSA_AREATRIGGER_DUMMY && target->GetTypeId() == TYPEID_PLAYER && !me->IsInCombat())
{
Talk(SAY_INTRO, target);
me->SetOrientation(1.67690026f);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetEmoteState(EMOTE_STATE_READY_UNARMED);
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
_events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING) || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasAura(SPELL_RIDE_DRAKE))
return;
switch (_events.ExecuteEvent())
{
case EVENT_RANDOM_SPELL:
{
uint32 spellId = RAND(SPELL_BABY_ELEPHANT_TAKES_A_BATH, SPELL_HAWK_DIVING_TO_EARTH);
DoCast(spellId);
_events.ScheduleEvent(EVENT_RANDOM_SPELL, 4s, 6s);
break;
}
case EVENT_HEAL:
{
DoCastSelf(SPELL_FULL_HEALTH);
me->SetUninteractible(false);
break;
}
case EVENT_MOVE_HOME:
{
EnterEvadeMode();
break;
}
default:
break;
}
}
void OnHealthDepleted(Unit* attacker, bool /*isKill*/) override
{
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
me->RemoveAllAuras();
me->InterruptNonMeleeSpells(true);
_events.Reset();
me->SetUninteractible(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE_2);
me->SetEmoteState(EMOTE_ONESHOT_NONE);
DoCast(SPELL_SERVERSIDE_KILL_CREDIT);
Talk(SAY_DEFEATED, attacker);
_events.ScheduleEvent(EVENT_HEAL, 5s);
_events.ScheduleEvent(EVENT_MOVE_HOME, 6s);
}
private:
EventMap _events;
};
// 57750 - Jaomin Ro (Hawk)
struct npc_jaomin_ro_hawk : public ScriptedAI
{
using ScriptedAI::ScriptedAI;
void JustAppeared() override
{
me->SetReactState(REACT_PASSIVE);
me->SetSpeedRate(MOVE_RUN, 2.5f);
}
void IsSummonedBy(WorldObject* summonerWO) override
{
Unit* summoner = summonerWO->ToUnit();
if (!summoner)
return;
Unit* victim = summoner->GetVictim();
if (!victim)
return;
DoCast(SPELL_FORCE_SUMMONER_TO_RIDE);
_scheduler.Schedule(1s, [this, orientation = me->GetAbsoluteAngle(victim) - me->GetOrientation()](TaskContext /*context*/)
{
me->GetMotionMaster()->MovePoint(POINT_RANDOM_DEST, me->GetFirstCollisionPosition(40.0f, orientation));
});
}
void UpdateAI(uint32 diff) override
{
_scheduler.Update(diff);
}
void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_HAWK_DIVING_TO_EARTH_DMG && target->GetTypeId() == TYPEID_PLAYER)
{
DoCast(SPELL_EJECT_ALL_PASSENGERS);
me->DespawnOrUnsummon();
}
}
void MovementInform(uint32 type, uint32 pointId) override
{
if (type != POINT_MOTION_TYPE)
return;
switch (pointId)
{
case POINT_RANDOM_DEST:
{
DoCast(SPELL_EJECT_ALL_PASSENGERS);
me->DespawnOrUnsummon();
break;
}
default:
break;
}
}
private:
TaskScheduler _scheduler;
};
// 108583 - Force Summoner to Ride Vehicle
class spell_force_summoner_to_ride_vehicle : public SpellScript
{
void HandleScript(SpellEffIndex /*effIndex*/) const
{
GetHitUnit()->CastSpell(GetCaster(), GetEffectValue(), TRIGGERED_FULL_MASK);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_force_summoner_to_ride_vehicle::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 108582 - Ride Drake
class spell_ride_drake : public AuraScript
{
void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
{
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_DIZZY, TRIGGERED_FULL_MASK);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_ride_drake::OnRemoveVehicle, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_zone_the_wandering_isle()
{
RegisterCreatureAI(npc_tushui_huojin_trainee);
RegisterCreatureAI(npc_huojin_trainee);
RegisterCreatureAI(npc_tushui_leading_trainee);
RegisterCreatureAI(npc_instructor_zhi);
RegisterCreatureAI(npc_jaomin_ro);
RegisterCreatureAI(npc_jaomin_ro_hawk);
RegisterSpellScript(spell_force_summoner_to_ride_vehicle);
RegisterSpellScript(spell_ride_drake);
}