fix(Scripts/ZulAman): Harrison Jones gong event RP with taskscheduler (#20713)
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
--
|
||||||
|
-- IMMUNE_TO_PC
|
||||||
|
UPDATE `creature_template` SET `unit_flags` = `unit_flags` | 256 WHERE (`entry` = 24358);
|
||||||
|
|
||||||
|
-- purge old waypoints
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id`=860442;
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id`=860441;
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id`=860440;
|
||||||
|
|
||||||
|
-- verify model 22340
|
||||||
|
UPDATE `creature_template_model` SET `VerifiedBuild` = 53788 WHERE (`CreatureID` = 24358) AND `Idx` = 0;
|
||||||
|
|
||||||
|
-- text
|
||||||
|
-- broadcast text still says three
|
||||||
|
UPDATE `creature_text` SET `Text`='Suit yourself. At least five of you must assist me if we\'re to get inside. Follow me....' WHERE `CreatureID`=24358 AND `GroupID`=0 AND `ID`=0;
|
||||||
|
|
||||||
|
-- to gong
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id` = 2435800;
|
||||||
|
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
|
||||||
|
(2435800, 1, 123.585014, 1646.5702, 42.208447, NULL, 0, 1),
|
||||||
|
(2435800, 2, 130.58502, 1644.0702, 42.208447, NULL, 0, 1),
|
||||||
|
(2435800, 3, 131.15666, 1643.7225, 42.18348, NULL, 0, 1);
|
||||||
|
|
||||||
|
-- to door
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id` = 2435801;
|
||||||
|
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
|
||||||
|
(2435801, 1, 126.804565, 1641.6201, 42.500977),
|
||||||
|
(2435801, 2, 121.95248, 1639.0178, 42.318478),
|
||||||
|
(2435801, 3, 120.78983, 1609.0632, 43.555756);
|
||||||
|
|
||||||
|
-- stealth
|
||||||
|
DELETE FROM `waypoint_data` WHERE `id` = 2435802;
|
||||||
|
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES
|
||||||
|
(2435802, 1, 120.59397, 1587.591, 43.74926);
|
||||||
@@ -323,31 +323,23 @@ enum Spells
|
|||||||
SPELL_COSMETIC_SPEAR_THROW = 43647
|
SPELL_COSMETIC_SPEAR_THROW = 43647
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Events
|
enum Phases
|
||||||
{
|
{
|
||||||
GONG_EVENT_1 = 1,
|
PHASE_GONG = 0,
|
||||||
GONG_EVENT_2 = 2,
|
PHASE_GATE_CLOSED = 1,
|
||||||
GONG_EVENT_3 = 3,
|
PHASE_GATE_OPENED = 2
|
||||||
GONG_EVENT_4 = 4,
|
|
||||||
GONG_EVENT_5 = 5,
|
|
||||||
GONG_EVENT_6 = 6,
|
|
||||||
GONG_EVENT_7 = 7,
|
|
||||||
GONG_EVENT_8 = 8,
|
|
||||||
GONG_EVENT_9 = 9,
|
|
||||||
GONG_EVENT_10 = 10,
|
|
||||||
GONG_EVENT_11 = 11
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Actions
|
enum Actions
|
||||||
{
|
{
|
||||||
ACTION_COMPLETE_EVENT_3 = 0,
|
ACTION_COMPLETE_GONG_RITUAL = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Waypoints
|
enum Waypoints
|
||||||
{
|
{
|
||||||
HARRISON_MOVE_1 = 860440,
|
HARRISON_MOVE_1 = 2435800,
|
||||||
HARRISON_MOVE_2 = 860441,
|
HARRISON_MOVE_2 = 2435801,
|
||||||
HARRISON_MOVE_3 = 860442
|
HARRISON_MOVE_3 = 2435802
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DisplayIds
|
enum DisplayIds
|
||||||
@@ -379,9 +371,8 @@ struct npc_harrison_jones : public ScriptedAI
|
|||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
_gongEvent = 0;
|
_phase = PHASE_GONG;
|
||||||
_gongTimer = 0;
|
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
uiTargetGUID.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override { }
|
void JustEngagedWith(Unit* /*who*/) override { }
|
||||||
@@ -394,8 +385,10 @@ struct npc_harrison_jones : public ScriptedAI
|
|||||||
me->SetFacingToObject(player);
|
me->SetFacingToObject(player);
|
||||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||||
Talk(SAY_HARRISON_0);
|
Talk(SAY_HARRISON_0);
|
||||||
_gongEvent = GONG_EVENT_1;
|
scheduler.Schedule(2s, [this](TaskContext /*task*/)
|
||||||
_gongTimer = 4000;
|
{
|
||||||
|
me->GetMotionMaster()->MovePath(HARRISON_MOVE_1, false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,12 +396,16 @@ struct npc_harrison_jones : public ScriptedAI
|
|||||||
{
|
{
|
||||||
if (spell->Id == SPELL_COSMETIC_SPEAR_THROW)
|
if (spell->Id == SPELL_COSMETIC_SPEAR_THROW)
|
||||||
{
|
{
|
||||||
me->RemoveAllAuras();
|
me->RemoveAllAuras(); // remove stealth
|
||||||
me->SetEntry(NPC_HARRISON_JONES_2);
|
me->SetEntry(NPC_HARRISON_JONES_2);
|
||||||
me->SetDisplayId(MODEL_HARRISON_JONES_2);
|
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
me->SetTarget();
|
me->PlayDistanceSound(1332); // human male death
|
||||||
me->SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_STAND_STATE, UNIT_STAND_STATE_DEAD);
|
me->HandleEmoteCommand(EMOTE_ONESHOT_WOUND_CRITICAL);
|
||||||
me->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
|
me->StopMoving();
|
||||||
|
scheduler.Schedule(1s, [this](TaskContext /*task*/)
|
||||||
|
{
|
||||||
|
me->SetStandState(UNIT_STAND_STATE_DEAD);
|
||||||
|
});
|
||||||
_instance->StorePersistentData(DATA_TIMED_RUN, 21);
|
_instance->StorePersistentData(DATA_TIMED_RUN, 21);
|
||||||
_instance->DoAction(ACTION_START_TIMED_RUN);
|
_instance->DoAction(ACTION_START_TIMED_RUN);
|
||||||
me->DespawnOrUnsummon(3min+30s, 0s);
|
me->DespawnOrUnsummon(3min+30s, 0s);
|
||||||
@@ -417,132 +414,103 @@ struct npc_harrison_jones : public ScriptedAI
|
|||||||
|
|
||||||
void DoAction(int32 action) override
|
void DoAction(int32 action) override
|
||||||
{
|
{
|
||||||
if (action == ACTION_COMPLETE_EVENT_3)
|
if (action == ACTION_COMPLETE_GONG_RITUAL)
|
||||||
{
|
{
|
||||||
me->GetMap()->ToInstanceMap()->PermBindAllPlayers();
|
me->GetMap()->ToInstanceMap()->PermBindAllPlayers();
|
||||||
_gongEvent = GONG_EVENT_4;
|
_phase = PHASE_GATE_CLOSED;
|
||||||
_gongTimer = 0;
|
me->RemoveAura(SPELL_BANGING_THE_GONG);
|
||||||
|
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(0));
|
||||||
|
if (GameObject* gong = _instance->GetGameObject(DATA_STRANGE_GONG))
|
||||||
|
gong->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
||||||
|
// Players are Now Saved to instance at SPECIAL (Player should be notified?)
|
||||||
|
scheduler.Schedule(500ms, [this](TaskContext /*task*/)
|
||||||
|
{
|
||||||
|
me->GetMotionMaster()->MovePath(HARRISON_MOVE_2, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenMassiveGateAndCallGuards()
|
||||||
|
{
|
||||||
|
if (GameObject* gate = _instance->GetGameObject(DATA_MASSIVE_GATE))
|
||||||
|
{
|
||||||
|
gate->AllowSaveToDB(true);
|
||||||
|
gate->SetGoState(GO_STATE_ACTIVE);
|
||||||
|
}
|
||||||
|
std::list<Creature*> targetList;
|
||||||
|
GetCreatureListWithEntryInGrid(targetList, me, NPC_AMANISHI_GUARDIAN, 26.0f);
|
||||||
|
if (!targetList.empty())
|
||||||
|
{
|
||||||
|
for (auto const& creature : targetList)
|
||||||
|
{
|
||||||
|
if (creature)
|
||||||
|
{
|
||||||
|
creature->SetImmuneToPC(true);
|
||||||
|
creature->SetReactState(REACT_PASSIVE);
|
||||||
|
|
||||||
|
if (creature->GetPositionX() > 120)
|
||||||
|
{
|
||||||
|
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR));
|
||||||
|
creature->AI()->SetData(0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
creature->AI()->SetData(0, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovementInform(uint32 type, uint32 id) override
|
||||||
|
{
|
||||||
|
// at gong
|
||||||
|
if (type == WAYPOINT_MOTION_TYPE && id == 2 && _phase == PHASE_GONG)
|
||||||
|
{
|
||||||
|
if (GameObject* gong = _instance->GetGameObject(DATA_STRANGE_GONG))
|
||||||
|
me->SetFacingToObject(gong);
|
||||||
|
scheduler.Schedule(2s, [this](TaskContext /*task*/)
|
||||||
|
{
|
||||||
|
Talk(SAY_HARRISON_1);
|
||||||
|
}).Schedule(7s, [this](TaskContext /*task*/)
|
||||||
|
{
|
||||||
|
DoCastSelf(SPELL_BANGING_THE_GONG);
|
||||||
|
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_MACE));
|
||||||
|
me->SetFacingTo(5.9696f);
|
||||||
|
if (GameObject* gong = _instance->GetGameObject(DATA_STRANGE_GONG))
|
||||||
|
gong->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// to the massive gate
|
||||||
|
else if (type == WAYPOINT_MOTION_TYPE && id == 1 && _phase == PHASE_GATE_CLOSED)
|
||||||
|
{
|
||||||
|
me->SetEntry(NPC_HARRISON_JONES_1);
|
||||||
|
Talk(SAY_HARRISON_2);
|
||||||
|
}
|
||||||
|
// at massive gate
|
||||||
|
else if (type == WAYPOINT_MOTION_TYPE && id == 2 && _phase == PHASE_GATE_CLOSED)
|
||||||
|
{
|
||||||
|
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
|
||||||
|
Talk(SAY_HARRISON_3);
|
||||||
|
scheduler.Schedule(8s, [this](TaskContext /*task*/)
|
||||||
|
{
|
||||||
|
OpenMassiveGateAndCallGuards();
|
||||||
|
_phase = PHASE_GATE_OPENED;
|
||||||
|
}).Schedule(10s, [this](TaskContext /*task*/)
|
||||||
|
{
|
||||||
|
DoCastSelf(SPELL_STEALTH);
|
||||||
|
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
|
||||||
|
me->GetMotionMaster()->MovePath(HARRISON_MOVE_3, false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
if (_gongEvent)
|
scheduler.Update(diff);
|
||||||
{
|
|
||||||
if (_gongTimer <= diff)
|
|
||||||
{
|
|
||||||
switch (_gongEvent)
|
|
||||||
{
|
|
||||||
case GONG_EVENT_1:
|
|
||||||
me->GetMotionMaster()->MovePath(HARRISON_MOVE_1, false);
|
|
||||||
_gongEvent = GONG_EVENT_2;
|
|
||||||
_gongTimer = 12000;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_2:
|
|
||||||
me->SetFacingTo(6.235659f);
|
|
||||||
Talk(SAY_HARRISON_1);
|
|
||||||
DoCastSelf(SPELL_BANGING_THE_GONG);
|
|
||||||
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_MACE));
|
|
||||||
me->SetSheath(SHEATH_STATE_MELEE);
|
|
||||||
_gongEvent = GONG_EVENT_3;
|
|
||||||
_gongTimer = 4000;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_3:
|
|
||||||
if (GameObject* gong = _instance->GetGameObject(DATA_STRANGE_GONG))
|
|
||||||
gong->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_4:
|
|
||||||
me->RemoveAura(SPELL_BANGING_THE_GONG);
|
|
||||||
if (GameObject* gong = _instance->GetGameObject(DATA_STRANGE_GONG))
|
|
||||||
gong->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
|
||||||
|
|
||||||
// Players are Now Saved to instance at SPECIAL (Player should be notified?)
|
|
||||||
me->GetMotionMaster()->MovePath(HARRISON_MOVE_2, false);
|
|
||||||
_gongEvent = GONG_EVENT_5;
|
|
||||||
_gongTimer = 5000;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_5:
|
|
||||||
me->SetEntry(NPC_HARRISON_JONES_1);
|
|
||||||
me->SetDisplayId(MODEL_HARRISON_JONES_1);
|
|
||||||
Talk(SAY_HARRISON_2);
|
|
||||||
_gongTimer = 12000;
|
|
||||||
_gongEvent = GONG_EVENT_6;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_6:
|
|
||||||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
|
|
||||||
Talk(SAY_HARRISON_3);
|
|
||||||
_gongTimer = 7000;
|
|
||||||
_gongEvent = GONG_EVENT_7;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_7:
|
|
||||||
if (!uiTargetGUID)
|
|
||||||
{
|
|
||||||
std::list<Creature*> targetList;
|
|
||||||
GetCreatureListWithEntryInGrid(targetList, me, NPC_AMANISHI_GUARDIAN, 26.0f);
|
|
||||||
if (!targetList.empty())
|
|
||||||
{
|
|
||||||
for (auto const& creature : targetList)
|
|
||||||
{
|
|
||||||
if (creature)
|
|
||||||
{
|
|
||||||
creature->SetImmuneToPC(true);
|
|
||||||
creature->SetReactState(REACT_PASSIVE);
|
|
||||||
|
|
||||||
if (creature->GetPositionX() > 120)
|
|
||||||
{
|
|
||||||
creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR));
|
|
||||||
creature->AI()->SetData(0, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
creature->AI()->SetData(0, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameObject* gate = _instance->GetGameObject(DATA_MASSIVE_GATE))
|
|
||||||
{
|
|
||||||
gate->AllowSaveToDB(true);
|
|
||||||
gate->SetGoState(GO_STATE_ACTIVE);
|
|
||||||
}
|
|
||||||
_gongTimer = 2000;
|
|
||||||
_gongEvent = GONG_EVENT_8;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_8:
|
|
||||||
DoCastSelf(SPELL_STEALTH);
|
|
||||||
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(0));
|
|
||||||
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
|
|
||||||
me->GetMotionMaster()->MovePath(HARRISON_MOVE_3, false);
|
|
||||||
_gongTimer = 1000;
|
|
||||||
_gongEvent = 0;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_9:
|
|
||||||
me->GetMotionMaster()->MovePoint(0, 120.687f, 1674.0f, 42.0217f);
|
|
||||||
_gongTimer = 12000;
|
|
||||||
_gongEvent = GONG_EVENT_10;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_10:
|
|
||||||
me->SetFacingTo(1.59044f);
|
|
||||||
_gongEvent = 11;
|
|
||||||
_gongTimer = 6000;
|
|
||||||
break;
|
|
||||||
case GONG_EVENT_11:
|
|
||||||
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
|
||||||
_gongEvent = 0;
|
|
||||||
_gongTimer = 1000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_gongTimer -= diff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InstanceScript* _instance;
|
InstanceScript* _instance;
|
||||||
uint8 _gongEvent;
|
uint32 _phase;
|
||||||
uint32 _gongTimer;
|
|
||||||
ObjectGuid uiTargetGUID;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class spell_ritual_of_power : public SpellScript
|
class spell_ritual_of_power : public SpellScript
|
||||||
@@ -553,7 +521,7 @@ class spell_ritual_of_power : public SpellScript
|
|||||||
{
|
{
|
||||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||||
if (Creature* creature = instance->GetCreature(DATA_HARRISON_JONES))
|
if (Creature* creature = instance->GetCreature(DATA_HARRISON_JONES))
|
||||||
creature->AI()->DoAction(ACTION_COMPLETE_EVENT_3);
|
creature->AI()->DoAction(ACTION_COMPLETE_GONG_RITUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
|
|||||||
Reference in New Issue
Block a user