Description: Archmage Arugal in Shadowfang Keep attacks in melee and doesn't use spells.
Current behaviour: When you attack last boss in Shadowfang Keep, he attacks in melee and does not do anything else.
Expected behaviour: Arugal should cast spells and we should have a short Arugal Event upon entering the dungeon on each fresh instance start.
Steps to reproduce the problem:
.go creature id 4275
(.gm on if you want to get range for combat?)Branch(es): 3.3.5
TC hash/commit: https://github.com/TrinityCore/TrinityCore/commit/19e757af5cb6bbde3f9263f0f4aaec87a7e0301c
TDB version: TDB 335.61
Operating system: Windows 8.1 x64
--
UPDATE `creature_template` SET `ScriptName`= 'boss_archmage_arugal' WHERE `entry`= 4275;
UPDATE `creature_text` SET `comment`= 'Archmage Arugal - Fenrus the Devourer dies' WHERE `entry`=4275 AND `groupid`=0;
DELETE FROM `creature_text` WHERE `entry`= 4275 AND `groupid` IN (1,2,3) ;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`BroadcastTextId`,`TextRange`,`comment`) VALUES
(4275, 1,0, 'You, too, shall serve!', 14, 0, 100, 0, 0, 0, 6115, 0, 'Archmage Arugal - Aggro'),
(4275, 2,0, 'Release your rage!', 14, 0, 100, 0, 0, 0, 6535, 0, 'Archmage Arugal - Transforms player into a Worgen'),
(4275, 3,0, 'Another falls!', 14, 0, 100, 0, 0, 0, 6116, 0, 'Archmage Arugal - Killing a player');
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index 94cf282..9936294 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -205,6 +205,130 @@ public:
};
+enum ArugalSpells
+{
+ SPELL_TELE_UPPER = 7587,
+ SPELL_TELE_SPAWN = 7586,
+ SPELL_TELE_STAIRS = 7136,
+ SPELL_ARUGAL_CURSE = 7621,
+ SPELL_THUNDERSHOCK = 7803,
+ SPELL_VOIDBOLT = 7588
+};
+
+enum ArugalTexts
+{
+ SAY_ARUGAL_AGGRO = 1, // You, too, shall serve!
+ SAY_ARUGAL_TRANSFORM = 2, // Release your rage!
+ SAY_ARUGAL_KILLED_UNIT = 3 // Another falls!
+};
+
+enum ArugalEvents
+{
+ EVENT_ARUGAL_VOID_BOLT = 1,
+ EVENT_ARUGAL_TELEPORT = 2,
+ EVENT_ARUGAL_THUNDERSHOCK = 3,
+ EVENT_ARUGAL_CURSE = 4
+};
+
+std::array<uint32, 3> arugalTeleportSpells =
+{
+ SPELL_TELE_UPPER,
+ SPELL_TELE_STAIRS,
+ SPELL_TELE_SPAWN
+};
+
+class boss_archmage_arugal : public CreatureScript
+{
+public:
+ boss_archmage_arugal() : CreatureScript("boss_archmage_arugal") { }
+
+ struct boss_archmage_arugalAI : public BossAI
+ {
+ boss_archmage_arugalAI(Creature* creature) : BossAI(creature, BOSS_ARUGAL) { }
+
+ void Reset() override
+ {
+ _Reset();
+ }
+
+ void KilledUnit(Unit* who) override
+ {
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_ARUGAL_KILLED_UNIT);
+ }
+
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) override
+ {
+ if (spell->Id == SPELL_ARUGAL_CURSE)
+ Talk(SAY_ARUGAL_TRANSFORM);
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _EnterCombat();
+ Talk(SAY_ARUGAL_AGGRO);
+ events.ScheduleEvent(EVENT_ARUGAL_CURSE, Seconds(7));
+ events.ScheduleEvent(EVENT_ARUGAL_TELEPORT, Seconds(15));
+ events.ScheduleEvent(EVENT_ARUGAL_VOID_BOLT, Seconds(1));
+ events.ScheduleEvent(EVENT_ARUGAL_THUNDERSHOCK, Seconds(10));
+ }
+
+ void AttackStart(Unit* who) override
+ {
+ if (!who)
+ return;
+
+ AttackStartCaster(who, 100.0f); // void bolt range is 100.f
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ events.Update(diff);
+
+ while (auto eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_ARUGAL_CURSE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 30.0f, true))
+ DoCast(target, SPELL_ARUGAL_CURSE);
+
+ events.ScheduleEvent(eventId, Seconds(15));
+ break;
+ case EVENT_ARUGAL_TELEPORT:
+ {
+ auto spell = arugalTeleportSpells.front();
+ DoCast(spell);
+ // rotate array, can be done with some kind of shuffle, up to you to figure out what is best
+ std::rotate(arugalTeleportSpells.begin(), arugalTeleportSpells.begin() + 1, arugalTeleportSpells.end());
+ events.ScheduleEvent(eventId, Seconds(20));
+ break;
+ }
+ case EVENT_ARUGAL_THUNDERSHOCK:
+ DoCastAOE(SPELL_THUNDERSHOCK);
+ events.ScheduleEvent(eventId, Seconds(30));
+ break;
+ case EVENT_ARUGAL_VOID_BOLT:
+ DoCastVictim(SPELL_VOIDBOLT);
+ events.ScheduleEvent(eventId, Seconds(5));
+ break;
+ }
+ }
+ DoMeleeAttackIfReady();
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetInstanceAI<boss_archmage_arugalAI>(creature);
+ }
+};
+
class spell_shadowfang_keep_haunting_spirits : public SpellScriptLoader
{
public:
@@ -249,4 +373,5 @@ void AddSC_shadowfang_keep()
new npc_shadowfang_prisoner();
new npc_arugal_voidwalker();
new spell_shadowfang_keep_haunting_spirits();
+ new boss_archmage_arugal();
}
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
index 88edc3f..80064ec 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
@@ -26,7 +26,8 @@ enum DataTypes
TYPE_FREE_NPC = 1,
TYPE_RETHILGORE = 2,
TYPE_FENRUS = 3,
- TYPE_NANDOS = 4
+ TYPE_NANDOS = 4,
+ BOSS_ARUGAL = 5
};
#endif
It _should_ work, didn't test tho
edit: As far as event goes, I think there is something in shadowfang_keep_instance script already, it happens when you kill the boss before Arugal so I didn't bother doing anything with it.
Thanks for the script, I have checked the creature_text
table and found that Line 0 exists already, so the first text line is already in the DB. Hence my version of the SQL file:
-- Archmage Arugal, NPC entry 4275
SET @Arugal := 4275;
UPDATE `creature_template` SET `ScriptName` = "boss_archmage_arugal" WHERE `entry`= @Arugal;
UPDATE `creature_text` SET `comment`= 'Archmage Arugal - Fenrus the Devourer dies' WHERE `entry`= @Arugal AND `groupid`= 0;
DELETE FROM `creature_text` WHERE `entry` = @Arugal AND `groupid` IN (1,2,3);
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`BroadcastTextId`,`TextRange`, `comment`) VALUES
(@Arugal,1,0,'You, too, shall serve!', 14,0,100,0,0,0,6115,0,'Archmage Arugal - Aggro'),
(@Arugal,2,0,'Release your rage!', 14,0,100,0,0,0,6535,0,'Archmage Arugal - Transforms player into a Worgen'),
(@Arugal,3,0,'Another falls!', 14,0,100,0,0,0,6116,0,'Archmage Arugal - Killing a player');
Notice that Line 0 (groupid
0) is used at the death of Fenrus the Devourer, entry 4274, but he uses SAI:
SELECT * FROM `smart_scripts` WHERE `entryorguid`= 4274;
entryorguid source_type id link event_type event_phase_mask event_chance event_flags event_param1 event_param2 event_param3 event_param4 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
----------- ----------- ------ ------ ---------- ---------------- ------------ ----------- ------------ ------------ ------------ ------------ ----------- ------------- ------------- ------------- ------------- ------------- ------------- ----------- ------------- ------------- ------------- -------- -------- -------- -------- ---------------------------------------------------------------------------
4274 0 0 0 0 0 100 2 2600 7200 23300 49000 11 7125 0 0 0 0 0 5 0 0 0 0 0 0 0 Fenrus the Devourer - In Combat - Cast 'Toxic Saliva' (No Repeat)
4274 0 1 0 4 0 100 515 0 0 0 0 34 3 1 0 0 0 0 1 0 0 0 0 0 0 0 Fenrus the Devourer - On Aggro - Set Instance Data 3 to 1 (No Repeat)
4274 0 2 0 6 0 100 515 0 0 0 0 34 3 3 0 0 0 0 1 0 0 0 0 0 0 0 Fenrus the Devourer - On Just Died - Set Instance Data 3 to 3 (No Repeat)
4274 0 3 0 7 0 100 515 0 0 0 0 34 3 2 0 0 0 0 1 0 0 0 0 0 0 0 Fenrus the Devourer - On Evade - Set Instance Data 3 to 2 (No Repeat)
I wonder how the /yell "Who dares interfere with the Sons of Arugal?" can be triggered, does it need a separate script, since it is Archmage Arugal, NPC (4275) who says it ? I notice Fenrus' SAI mentions Set Instance Data 3 to 3
, but I don't know much about accessing that kind of info. I can only guess it should be made a small part of Arugal's script, since it is that entry who yells the text line.
edit: I got the answer in #trinity from Riztazz, the yell already works: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp#L261
@Riztazz this DoCastAOE(ArugalSpells::SPELL_THUNDERSHOCK);
is realy necessary?
why not just : DoCastAOE(SPELL_THUNDERSHOCK);
?
Same for another spells/events that use enum
It isnt, i kept forgetting what i called enums and scrolling on my piece of crap notebook is pain in the ass;p
Fixed it for ya. :-) (diff updated).
edit: OK, thanks for updating the diff with more than the DoCast
/ DoCastAOE
spells.
Testing the diff above and commenting with feedback on the diff will be appreciated. :+1:
I also changed Talk(ArugalTexts::SAY_ARUGAL_AGGRO);
to Talk(SAY_ARUGAL_AGGRO);
and aligned the enum values to each other in your diff. :-)
@tkrokli can you PR this change please for ease of testing?
OK, sure. Consider it done. I was just about to start doing it right after answering Riztazz in #trinity .
@Riztazz : I had to add a missing enum for BOSS_ARUGAL
in your script, otherwise the compile seems to go just fine. I will create the PR as soon as I have logged in and taken a look at how the game behaves.
my bad, I overlooked the last diff:
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
index 88edc3f..80064ec 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h
@@ -26,7 +26,8 @@ enum DataTypes
TYPE_FREE_NPC = 1,
TYPE_RETHILGORE = 2,
TYPE_FENRUS = 3,
- TYPE_NANDOS = 4
+ TYPE_NANDOS = 4,
+ BOSS_ARUGAL = 5
};
#endif
Adding that to my changes and compiling again.
Closed by PR #17922 / commit https://github.com/TrinityCore/TrinityCore/commit/2b26894eb1eaf8572f61d303882878659692cdd3
Most helpful comment
It isnt, i kept forgetting what i called enums and scrolling on my piece of crap notebook is pain in the ass;p