|
16 | 16 |
|
17 | 17 | /* ScriptData |
18 | 18 | SDName: Zuldrak |
19 | | -SD%Complete: |
20 | | -SDComment: |
| 19 | +SD%Complete: 100 |
| 20 | +SDComment: Quest support: 12934. |
21 | 21 | SDCategory: Zuldrak |
22 | 22 | EndScriptData */ |
23 | 23 |
|
|
39 | 39 | static float m_afSpawnLocation[] = {5768.71f, -2969.29f, 273.816f}; |
40 | 40 | static uint32 m_auiBosses[] = {NPC_AZBARIN, NPC_DUKE_SINGEN, NPC_ERATHIUS, NPC_GARGORAL}; |
41 | 41 |
|
| 42 | +struct MANGOS_DLL_DECL npc_gurgthockAI : public ScriptedAI |
| 43 | +{ |
| 44 | + npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } |
| 45 | + |
| 46 | + uint64 m_uiPlayerGUID; |
| 47 | + |
| 48 | + void SetPlayerGUID(uint64 uiPlayerGUID) { m_uiPlayerGUID = uiPlayerGUID; } |
| 49 | + |
| 50 | + void Reset() |
| 51 | + { |
| 52 | + m_uiPlayerGUID = 0; |
| 53 | + } |
| 54 | + |
| 55 | + void SummonedCreatureJustDied(Creature* pSummoned) |
| 56 | + { |
| 57 | + uint32 uiEntry = pSummoned->GetEntry(); |
| 58 | + for(uint8 i = 0; i < 4; ++i) |
| 59 | + { |
| 60 | + if (uiEntry == m_auiBosses[i]) |
| 61 | + { |
| 62 | + if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_uiPlayerGUID)) |
| 63 | + pPlayer->GroupEventHappens(QUEST_FROM_BEYOND, m_creature); |
| 64 | + |
| 65 | + m_uiPlayerGUID = 0; |
| 66 | + return; |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | +}; |
| 71 | + |
42 | 72 | bool QuestAccept_npc_gurgthock(Player* pPlayer, Creature* pCreature, const Quest* pQuest) |
43 | 73 | { |
44 | 74 | if (pQuest->GetQuestId() == QUEST_FROM_BEYOND) |
| 75 | + { |
45 | 76 | pCreature->SummonCreature(m_auiBosses[urand(0, 3)], m_afSpawnLocation[0], m_afSpawnLocation[1], m_afSpawnLocation[2], 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); |
46 | 77 |
|
| 78 | + if (npc_gurgthockAI* pGurthockAI = dynamic_cast<npc_gurgthockAI*>(pCreature->AI())) |
| 79 | + pGurthockAI->SetPlayerGUID(pPlayer->GetGUID()); |
| 80 | + } |
47 | 81 | return true; |
48 | 82 | } |
49 | 83 |
|
| 84 | +CreatureAI* GetAI_npc_gurgthock(Creature* pCreature) |
| 85 | +{ |
| 86 | + return new npc_gurgthockAI(pCreature); |
| 87 | +} |
| 88 | + |
50 | 89 | void AddSC_zuldrak() |
51 | 90 | { |
52 | 91 | Script* pNewScript; |
53 | 92 |
|
54 | 93 | pNewScript = new Script; |
55 | 94 | pNewScript->Name = "npc_gurgthock"; |
| 95 | + pNewScript->GetAI = &GetAI_npc_gurgthock; |
56 | 96 | pNewScript->pQuestAccept = &QuestAccept_npc_gurgthock; |
57 | 97 | pNewScript->RegisterSelf(); |
58 | 98 | } |
0 commit comments