fix(DB/Script): Move Tailhorn Stag and Amberpine Woodsman behavior into SmartAI. (#23708)

This commit is contained in:
Rocco Silipo
2025-11-15 16:54:43 +01:00
committed by GitHub
parent 771146e59f
commit 435ca302ef
2 changed files with 68 additions and 112 deletions

View File

@@ -0,0 +1,68 @@
-- Set Creature Template Addon (Amberpine Woodsman)
DELETE FROM `creature_template_addon` WHERE (`entry` = 27293);
INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES
(27293, 0, 0, 0, 1, 0, 0, '');
-- Update Spawn Points (Amberpine Woodsman)
UPDATE `creature` SET `position_x` = 3499.0676, `position_y` = -2838.0798, `position_z` = 202.27922, `orientation` = 2.89724, `Comment` = 'Has Guid SAI' WHERE (`id1` = 27293) AND (`guid` = 110578);
UPDATE `creature` SET `position_x` = 3497.1128, `position_y` = -2836.0088, `position_z` = 202.26859, `orientation` = 4.55530 WHERE (`id1` = 27293) AND (`guid` = 110579);
UPDATE `creature` SET `position_x` = 3474.6736, `position_y` = -2776.7188, `position_z` = 201.02751, `orientation` = 2.56563, `Comment` = 'Has Guid SAI' WHERE (`id1` = 27293) AND (`guid` = 110580);
UPDATE `creature` SET `position_x` = 3475.1519, `position_y` = -2774.3525, `position_z` = 200.75826, `orientation` = 3.59537 WHERE (`id1` = 27293) AND (`guid` = 110581);
UPDATE `creature` SET `position_x` = 3374.5999, `position_y` = -2805.997, `position_z` = 199.0484, `orientation` = 1.34390, `Comment` = 'Has Guid SAI' WHERE (`id1` = 27293) AND (`guid` = 110582);
UPDATE `creature` SET `position_x` = 3375.972, `position_y` = -2803.756, `position_z` = 199.01216, `orientation` = 3.99680 WHERE (`id1` = 27293) AND (`guid` = 110583);
UPDATE `creature` SET `position_x` = 3460.5964, `position_y` = -2902.6494, `position_z` = 201.07785, `orientation` = 5.89921, `Comment` = 'Has Guid SAI' WHERE (`id1` = 27293) AND (`guid` = 110602);
UPDATE `creature` SET `position_x` = 3460.07, `position_y` = -2904.9836, `position_z` = 201.10063, `orientation` = 0.52359 WHERE (`id1` = 27293) AND (`guid` = 110603);
UPDATE `creature` SET `position_x` = 3390.5305, `position_y` = -2862.014, `position_z` = 199.62068, `orientation` = 3.24631 WHERE (`id1` = 27293) AND (`guid` = 110604);
UPDATE `creature` SET `position_x` = 3390.0286, `position_y` = -2864.7012, `position_z` = 200.0756, `orientation` = 2.56563, `Comment` = 'Has Guid SAI' WHERE (`id1` = 27293) AND (`guid` = 110605);
-- Set Creature Addon (Amberpine Woodsman)
DELETE FROM `creature_addon` WHERE (`guid` IN (110578, 110579, 110580, 110581, 110582, 110583, 110602, 110603, 110604, 110605));
INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `visibilityDistanceType`, `auras`) VALUES
(110578, 0, 0, 8, 0, 0, 0, NULL),
(110579, 0, 0, 0, 0, 133, 0, NULL),
(110580, 0, 0, 8, 0, 0, 0, NULL),
(110581, 0, 0, 0, 0, 133, 0, NULL),
(110582, 0, 0, 8, 0, 0, 0, NULL),
(110583, 0, 0, 0, 0, 133, 0, NULL),
(110602, 0, 0, 8, 0, 0, 0, NULL),
(110603, 0, 0, 0, 0, 133, 0, NULL),
(110604, 0, 0, 0, 0, 133, 0, NULL),
(110605, 0, 0, 8, 0, 0, 0, NULL);
-- Remove Script Name and set SmartAI (Amberpine Woodsman)
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE (`entry` = 27293);
-- Set Guid SmartAI
DELETE FROM `smart_scripts` WHERE (`source_type` = 0) AND (`entryorguid` IN (-110578, -110580, -110582, -110602, -110605));
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`, `event_param6`, `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
(-110578, 0, 0, 0, 1, 0, 100, 0, 1000, 3000, 500, 3000, 0, 0, 5, 36, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amberpine Woodsman - Out of Combat - Play Emote 36'),
(-110580, 0, 0, 0, 1, 0, 100, 0, 1000, 3000, 500, 3000, 0, 0, 5, 36, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amberpine Woodsman - Out of Combat - Play Emote 36'),
(-110582, 0, 0, 0, 1, 0, 100, 0, 1000, 3000, 500, 3000, 0, 0, 5, 36, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amberpine Woodsman - Out of Combat - Play Emote 36'),
(-110602, 0, 0, 0, 1, 0, 100, 0, 1000, 3000, 500, 3000, 0, 0, 5, 36, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amberpine Woodsman - Out of Combat - Play Emote 36'),
(-110605, 0, 0, 0, 1, 0, 100, 0, 1000, 3000, 500, 3000, 0, 0, 5, 36, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Amberpine Woodsman - Out of Combat - Play Emote 36');
-- Remove Script Name and set SmartAI (Tallhorn Stag)
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE (`entry` = 26363);
-- Set Comments (Tallhorn Stag)
UPDATE `creature` SET `Comment` = 'Has Personal SAI' WHERE (`id1` = 26363) AND (`guid` IN (119621, 119622, 119642, 119643, 119656));
-- Set Guid Sai (Tallhorn Stag)
DELETE FROM `smart_scripts` WHERE (`source_type` = 0) AND (`entryorguid` IN (-119621, -119622, -119642, -119643, -119656));
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`, `event_param6`, `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
(-119621, 0, 0, 1, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 537166592, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Immune To Players & Immune To NPC\'s & Stunned & Prevent Emotes From Chat Text'),
(-119621, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Feign Death'),
(-119621, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 29266, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Cast \'Permanent Feign Death\''),
(-119622, 0, 0, 1, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 537166592, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Immune To Players & Immune To NPC\'s & Stunned & Prevent Emotes From Chat Text'),
(-119622, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Feign Death'),
(-119622, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 29266, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Cast \'Permanent Feign Death\''),
(-119642, 0, 0, 1, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 537166592, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Immune To Players & Immune To NPC\'s & Stunned & Prevent Emotes From Chat Text'),
(-119642, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Feign Death'),
(-119642, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 29266, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Cast \'Permanent Feign Death\''),
(-119643, 0, 0, 1, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 537166592, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Immune To Players & Immune To NPC\'s & Stunned & Prevent Emotes From Chat Text'),
(-119643, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Feign Death'),
(-119643, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 29266, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Cast \'Permanent Feign Death\''),
(-119656, 0, 0, 1, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 537166592, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Immune To Players & Immune To NPC\'s & Stunned & Prevent Emotes From Chat Text'),
(-119656, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Set Flags Feign Death'),
(-119656, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 29266, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Tallhorn Stag - On Respawn - Cast \'Permanent Feign Death\'');

View File

@@ -390,116 +390,6 @@ class spell_q12227_camera_shake : public SpellScript
OnEffectHitTarget += SpellEffectFn(spell_q12227_camera_shake::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// Tallhorn Stage
enum TallhornStage
{
//Gameobject
OBJECT_HAUNCH = 188665
};
class npc_tallhorn_stag : public CreatureScript
{
public:
npc_tallhorn_stag() : CreatureScript("npc_tallhorn_stag") { }
struct npc_tallhorn_stagAI : public ScriptedAI
{
npc_tallhorn_stagAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
_phase = 1;
}
void UpdateAI(uint32 /*diff*/) override
{
if (_phase == 1)
{
if (me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f))
{
me->SetStandState(UNIT_STAND_STATE_DEAD);
me->SetImmuneToPC(true);
me->ReplaceAllDynamicFlags(UNIT_DYNFLAG_DEAD);
}
_phase = 0;
}
DoMeleeAttackIfReady();
}
private:
uint8 _phase;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_tallhorn_stagAI(creature);
}
};
// Amberpine Woodsman
enum AmberpineWoodsman
{
// Creature
NPC_TALLHORN_STAG = 26363
};
enum AmberpineWoodsmanEvents
{
EVENT_WOODSMAN_1 = 1,
EVENT_WOODSMAN_2 = 2
};
class npc_amberpine_woodsman : public CreatureScript
{
public:
npc_amberpine_woodsman() : CreatureScript("npc_amberpine_woodsman") { }
struct npc_amberpine_woodsmanAI : public ScriptedAI
{
npc_amberpine_woodsmanAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
if (me->FindNearestCreature(NPC_TALLHORN_STAG, 0.2f))
{
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
}
else
_events.ScheduleEvent(EVENT_WOODSMAN_1, 0ms);
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_WOODSMAN_1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LOOT);
_events.ScheduleEvent(EVENT_WOODSMAN_2, 3s);
break;
case EVENT_WOODSMAN_2:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H);
_events.ScheduleEvent(EVENT_WOODSMAN_1, 4s);
break;
default:
break;
}
}
UpdateVictim();
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_amberpine_woodsmanAI(creature);
}
};
/*######
## Quest 12288: Overwhelmed!
@@ -1178,8 +1068,6 @@ void AddSC_grizzly_hills()
new npc_emily();
new npc_mrfloppy();
new npc_ravenous_worg();
new npc_tallhorn_stag();
new npc_amberpine_woodsman();
RegisterCreatureAI(npc_wounded_skirmisher);
RegisterSpellScript(spell_renew_skirmisher);
new npc_venture_co_straggler();