fix(Scripts/Quest): improved Overwhelmed! (#10387)

This commit is contained in:
Grimgravy
2022-03-25 08:44:25 -03:00
committed by GitHub
parent f0eb6d36a3
commit c797cb0b93
3 changed files with 358 additions and 152 deletions
@@ -0,0 +1,64 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1643290179356130100');
-- npc kneel
DELETE FROM `creature_addon` WHERE (`guid` IN (102453, 102454, 102455, 102457, 102458, 102459, 102462, 102463, 102464, 102466));
INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES
(102453, 0, 0, 8, 257, 0, 0, NULL),
(102454, 0, 0, 8, 257, 0, 0, NULL),
(102455, 0, 0, 8, 257, 0, 0, NULL),
(102457, 0, 0, 8, 257, 0, 0, NULL),
(102458, 0, 0, 8, 257, 0, 0, NULL),
(102459, 0, 0, 8, 257, 0, 0, NULL),
(102462, 0, 0, 8, 257, 0, 0, NULL),
(102463, 0, 0, 8, 257, 0, 0, NULL),
(102464, 0, 0, 8, 257, 0, 0, NULL),
(102466, 0, 0, 8, 257, 0, 0, NULL);
-- npc Wounded Skirmisher
DELETE FROM `creature` WHERE (`guid` IN (102453, 102454, 102455, 102456, 102457, 102458, 102459, 102460, 102461, 102462, 102463, 102464, 102466, 102467, 102469));
INSERT INTO `creature` (`guid`, `id1`, `id2`, `id3`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES
(102453, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4229.39, -2981.89, 283.151, 1.61792, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102454, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4134.07, -2897.23, 279.272, 5.12241, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102455, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4123.8, -2835.11, 284.196, 0.610865, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102456, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4000.98, -2847.93, 273.325, 6.03884, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102457, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4185.56, -2961.08, 283.319, 0.903392, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102458, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4017.75, -2835.31, 279.277, 1.47867, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102459, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4073.33, -2906.89, 278.332, 6.10865, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102460, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4085.95, -2846.31, 286.589, 2.94961, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102461, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4071.18, -2886.01, 281.6, 5.8294, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102462, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4074.98, -2940.5, 276.138, 4.22481, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102463, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4139.99, -3020.99, 285.459, 5.82814, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102464, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4166.57, -2964.73, 283.2, 2.63745, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102466, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4204.05, -3048.94, 280.839, 4.65053, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102467, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4057.32, -2822.2, 288.962, 3.4383, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0),
(102469, 27463, 0, 0, 571, 0, 0, 1, 1, 1, 4183.3, -2934.44, 283.114, 5.63741, 300, 0, 0, 9940, 0, 0, 0, 0, 0, '', 0);
-- npc Skirmisher Corpse
DELETE FROM `creature` WHERE `guid`=91749;
INSERT INTO `creature` (`guid`, `id1`, `id2`, `id3`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES
(91749, 27457, 0, 0, 571, 0, 0, 1, 1, 1, 4137.9, -3008.35, 285.667, 5.54491, 300, 0, 0, 4399, 0, 0, 0, 0, 0, '', 0);
DELETE FROM `waypoint_data` WHERE `id`=274630;
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES
(274630, 1, 4153.06, -2928.47, 282.58, 0, 0, 1, 0, 100, 0),
(274630, 2, 4184.53, -2909.76, 280.17, 0, 0, 1, 0, 100, 0);
DELETE FROM `waypoint_data` WHERE `id`=274631;
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES
(274631, 1, 4138.41, -2950.63, 282.92, 0, 0, 1, 0, 100, 0),
(274631, 2, 4153.06, -2928.47, 282.58, 0, 0, 1, 0, 100, 0),
(274631, 3, 4184.53, -2909.76, 280.17, 0, 0, 1, 0, 100, 0);
DELETE FROM `waypoint_data` WHERE `id`=274632;
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES
(274632, 1, 4184.53, -2909.76, 280.17, 0, 0, 1, 0, 100, 0);
/* implementing both conditions */
DELETE FROM `spell_script_names` WHERE `spell_id`=48812 AND `ScriptName`='spell_renew_skirmisher';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(48812, 'spell_renew_skirmisher');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceGroup`=0 AND `SourceEntry`=48812;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(17,0,48812,0,0,31,1,3,27463,0,0,0,0,"","Heals a wounded skirmisher at Blue Sky Logging Ground.");
+3
View File
@@ -21,6 +21,7 @@
#include "Common.h"
#include "Creature.h"
#include "UnitAI.h"
#include "EventMap.h"
class WorldObject;
class Unit;
@@ -67,6 +68,8 @@ class CreatureAI : public UnitAI
protected:
Creature* const me;
EventMap events;
bool UpdateVictim();
bool UpdateVictimWithGaze();
@@ -25,11 +25,11 @@
#include "SpellInfo.h"
#include "SpellScript.h"
// Theirs
// Theirs
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure
######*/
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure
######*/
enum Floppy
{
@@ -506,66 +506,204 @@ enum Skirmisher
{
// Quest
QUEST_OVERWHELMED = 12288,
// Spell
SPELL_RENEW_SKIRMISHER = 48812,
SPELL_KILL_CREDIT = 48813,
SPELL_CLEAVE = 15496,
SPELL_HAMSTRING = 9080,
SPELL_MORTAL_STRIKE = 32736,
// Text
SAY_RANDOM = 0
SAY_RANDOM = 0,
// EVENT
EVENT_WOUNDED_MOVE = 1,
EVENT_CLEAVE = 2,
EVENT_HAMSTRING = 3,
EVENT_MORTAL_STRIKE = 4,
// Waypoints
WOUNDED_MOVE_1 = 274630,
WOUNDED_MOVE_2 = 274631,
WOUNDED_MOVE_3 = 274632
};
class npc_wounded_skirmisher : public CreatureScript
struct npc_wounded_skirmisher : public CreatureAI
{
public:
npc_wounded_skirmisher() : CreatureScript("npc_wounded_skirmisher") { }
struct npc_wounded_skirmisherAI : public ScriptedAI
npc_wounded_skirmisher(Creature* creature) : CreatureAI(creature)
{
npc_wounded_skirmisherAI(Creature* creature) : ScriptedAI(creature) { }
Initialize();
}
void Initialize()
{
me->SetReactState(REACT_DEFENSIVE);
}
void Reset() override
{
_despawnTimer = 5000;
_playerGUID.Clear();
Initialize();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
void MovementInform(uint32, uint32 id) override
void EnterCombat(Unit* /*who*/) override
{
if (id == 1)
me->DespawnOrUnsummon(_despawnTimer);
events.ScheduleEvent(EVENT_CLEAVE, urand(1000, 7000));
events.ScheduleEvent(EVENT_HAMSTRING, urand(5000, 12000));
events.ScheduleEvent(EVENT_MORTAL_STRIKE, urand(5000, 10000));
}
void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER
&& caster->ToPlayer()->GetQuestStatus(QUEST_OVERWHELMED) == QUEST_STATUS_INCOMPLETE)
Player* playerCaster = caster->ToPlayer();
if (!playerCaster)
return;
if (spell->Id == SPELL_RENEW_SKIRMISHER && playerCaster->GetQuestStatus(QUEST_OVERWHELMED) == QUEST_STATUS_INCOMPLETE)
{
DoCast(caster, SPELL_KILL_CREDIT);
me->SetFacingToObject(caster);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Talk(SAY_RANDOM, caster);
if (me->IsStandState())
me->GetMotionMaster()->MovePoint(1, me->GetPositionX() + 7, me->GetPositionY() + 7, me->GetPositionZ());
else
DoCast(caster, SPELL_KILL_CREDIT);
if (!me->IsStandState())
{
me->SetStandState(UNIT_STAND_STATE_STAND);
me->DespawnOrUnsummon(_despawnTimer);
me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
events.ScheduleEvent(EVENT_WOUNDED_MOVE, 3000);
}
}
}
void UpdateAI(uint32 /*diff*/) override
void UpdateAI(uint32 diff) override
{
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_WOUNDED_MOVE:
if (me->GetPositionY() == -2835.11f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(20000);
}
if (me->GetPositionY() == -2981.89f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(18000);
}
if (me->GetPositionY() == -2934.44f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(9000);
}
if (me->GetPositionY() == -3020.99f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(22000);
}
if (me->GetPositionY() == -2964.73f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_2, false);
me->DespawnOrUnsummon(15000);
}
if (me->GetPositionY() == -2940.50f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(20000);
}
if (me->GetPositionY() == -2847.93f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(30000);
}
if (me->GetPositionY() == -2835.31f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(27000);
}
if (me->GetPositionY() == -2822.20f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(25000);
}
if (me->GetPositionY() == -2846.31f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_1, false);
me->DespawnOrUnsummon(21000);
}
if (me->GetPositionY() == -2897.23f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(15000);
}
if (me->GetPositionY() == -2886.01f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(25000);
}
if (me->GetPositionY() == -2906.89f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_3, false);
me->DespawnOrUnsummon(25000);
}
if (me->GetPositionY() == -3048.94f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_2, false);
me->DespawnOrUnsummon(30000);
}
if (me->GetPositionY() == -2961.08f)
{
me->GetMotionMaster()->MovePath(WOUNDED_MOVE_2, false);
me->DespawnOrUnsummon(25000);
}
break;
case EVENT_CLEAVE:
me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false);
events.RepeatEvent(urand(7000, 15000));
break;
case EVENT_HAMSTRING:
me->CastSpell(me->GetVictim(), SPELL_HAMSTRING, false);
events.RepeatEvent(urand(9000, 15000));
break;
case EVENT_MORTAL_STRIKE:
me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE, false);
events.RepeatEvent(urand(10000, 15000));
break;
}
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
private:
ObjectGuid _playerGUID;
uint32 _despawnTimer;
};
};
CreatureAI* GetAI(Creature* creature) const override
enum renewskirmisher
{
NPC_WOUNDED_SKIRMISHER = 27463
};
class spell_renew_skirmisher : public SpellScript
{
public:
PrepareSpellScript(spell_renew_skirmisher);
SpellCastResult CheckRequirement()
{
return new npc_wounded_skirmisherAI(creature);
if (Unit* caster = GetCaster())
if (Creature* wounded = caster->FindNearestCreature(NPC_WOUNDED_SKIRMISHER, 5.0f))
if (!wounded->IsInCombat())
return SPELL_CAST_OK;
return SPELL_FAILED_CASTER_AURASTATE;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_renew_skirmisher::CheckRequirement);
}
};
@@ -1163,7 +1301,8 @@ void AddSC_grizzly_hills()
new npc_outhouse_bunny();
new npc_tallhorn_stag();
new npc_amberpine_woodsman();
new npc_wounded_skirmisher();
RegisterCreatureAI(npc_wounded_skirmisher);
RegisterSpellScript(spell_renew_skirmisher);
new npc_venture_co_straggler();
new npc_lake_frog();
new spell_shredder_delivery();