diff options
-rw-r--r-- | sql/scripts/world_scripts_full.sql | 1 | ||||
-rw-r--r-- | sql/updates/10563_world_scriptname.sql | 1 | ||||
-rw-r--r-- | src/server/scripts/Northrend/howling_fjord.cpp | 106 |
3 files changed, 108 insertions, 0 deletions
diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql index ddb0c52a5e6..68cca6830b3 100644 --- a/sql/scripts/world_scripts_full.sql +++ b/sql/scripts/world_scripts_full.sql @@ -821,6 +821,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_rinji' WHERE `entry`=7780; UPDATE `creature_template` SET `ScriptName`='npc_plaguehound_tracker' WHERE `entry`=24156; UPDATE `creature_template` SET `ScriptName`='npc_razael_and_lyana' WHERE `entry` IN (23778,23998); UPDATE `creature_template` SET `ScriptName`='npc_apothecary_hanes' WHERE `entry`=23784; +UPDATE `creature_template` SET `ScriptName`='npc_daegarn' WHERE `entry`=24151; /* ICECROWN */ UPDATE `creature_template` SET `ScriptName`='npc_arete' WHERE `entry`=29344; diff --git a/sql/updates/10563_world_scriptname.sql b/sql/updates/10563_world_scriptname.sql new file mode 100644 index 00000000000..4184ee9f9f2 --- /dev/null +++ b/sql/updates/10563_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_daegarn' WHERE `entry`=24151;
\ No newline at end of file diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp index 71f9335120b..d6d9e81175a 100644 --- a/src/server/scripts/Northrend/howling_fjord.cpp +++ b/src/server/scripts/Northrend/howling_fjord.cpp @@ -337,10 +337,116 @@ public: } }; +/*###### +## npc_daegarn +######*/ + +enum eDaegarnn +{ + QUEST_DEFEAT_AT_RING = 11300, + + NPC_FIRJUS = 24213, + NPC_JLARBORN = 24215, + NPC_YOROS = 24214, + NPC_OLUF = 23931, + + NPC_PRISONER_1 = 24253, // looks the same but has different abilities + NPC_PRISONER_2 = 24254, + NPC_PRISONER_3 = 24255, +}; + +static float afSummon[] = {838.81f, -4678.06f, -94.182f}; +static float afCenter[] = {801.88f, -4721.87f, -96.143f}; + +class npc_daegarn : public CreatureScript +{ +public: + npc_daegarn() : CreatureScript("npc_daegarn") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) + { + if (pQuest->GetQuestId() == QUEST_DEFEAT_AT_RING) + { + if (npc_daegarnAI* pDaegarnAI = CAST_AI(npc_daegarn::npc_daegarnAI, pCreature->AI())) + pDaegarnAI->StartEvent(pPlayer->GetGUID()); + } + + return true; + } + + // TODO: make prisoners help (unclear if summoned or using npc's from surrounding cages (summon inside small cages?)) + struct npc_daegarnAI : public ScriptedAI + { + npc_daegarnAI(Creature *pCreature) : ScriptedAI(pCreature) { } + + bool bEventInProgress; + uint64 uiPlayerGUID; + + void Reset() + { + bEventInProgress = false; + uiPlayerGUID = 0; + } + + void StartEvent(uint64 uiGUID) + { + if (bEventInProgress) + return; + + uiPlayerGUID = uiGUID; + + SummonGladiator(NPC_FIRJUS); + } + + void JustSummoned(Creature* pSummon) + { + if (Player* pPlayer = me->GetPlayer(*me,uiPlayerGUID)) + { + if (pPlayer->isAlive()) + { + pSummon->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pSummon->GetMotionMaster()->MovePoint(0, afCenter[0], afCenter[1], afCenter[2]); + pSummon->AI()->AttackStart(pPlayer); + return; + } + } + + Reset(); + } + + void SummonGladiator(uint32 uiEntry) + { + me->SummonCreature(uiEntry, afSummon[0], afSummon[1], afSummon[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30*IN_MILLISECONDS); + } + + void SummonedCreatureDies(Creature* pSummoned, Unit* pKiller) + { + uint32 uiEntry = 0; + + // will eventually reset the event if something goes wrong + switch(pSummoned->GetEntry()) + { + case NPC_FIRJUS: uiEntry = NPC_JLARBORN; break; + case NPC_JLARBORN: uiEntry = NPC_YOROS; break; + case NPC_YOROS: uiEntry = NPC_OLUF; break; + case NPC_OLUF: Reset(); return; + } + + SummonGladiator(uiEntry); + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_daegarnAI(creature); + } +}; + void AddSC_howling_fjord() { new npc_apothecary_hanes; new npc_plaguehound_tracker; new npc_razael_and_lyana; new npc_mcgoyver; + new npc_daegarn; } |