diff options
| -rw-r--r-- | sql/updates/world/2013_06_18_05_world_misc.sql | 29 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/zone_zuldrak.cpp | 583 |
2 files changed, 272 insertions, 340 deletions
diff --git a/sql/updates/world/2013_06_18_05_world_misc.sql b/sql/updates/world/2013_06_18_05_world_misc.sql new file mode 100644 index 00000000000..7971ea5e89a --- /dev/null +++ b/sql/updates/world/2013_06_18_05_world_misc.sql @@ -0,0 +1,29 @@ +-- Add texts for Captured Rageclaw +DELETE FROM `creature_text` WHERE `entry`=29686; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(29686,0,0,'I poop on you, trollses!',0,0,100,0,0,0,'Captured Rageclaw'), +(29686,0,1,'ARRRROOOOGGGGAAAA!',0,0,100,0,0,0,'Captured Rageclaw'), +(29686,0,2,'No more mister nice wolvar!',0,0,100,0,0,0,'Captured Rageclaw'); + +-- Add option conditions for Crusade Recruit +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (15) AND `SourceGroup` IN (9650); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,9650,0,0,9,12509,0,0,0,0,'','Crusade Recruit - Show gossip option only if player has quest Troll Patrol: Intestinal Fortitude'); + +-- Add Any Missing Gossip Option for Gymer +DELETE FROM `gossip_menu_option` WHERE menu_id=9852; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`)VALUES +(9852,0,0,"I'm ready, Gymer. Let's go!",1,1,0,0,0,0,''); + +-- Add option conditions for Gymer +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (15) AND `SourceGroup` IN (9852); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,9852,0,0,9,12919,0,0,0,0,'','Gymer - Show gossip option only if player has quest The Storm King''s Vengeance'); + +-- Gymer SAI Quest: The Storm King''s Vengeance +SET @ENTRY := 29647; +UPDATE `creature_template` SET `AIName`= 'SmartAI',`ScriptName`= '' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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`,`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`) VALUES +(@ENTRY,0,0,1,62,0,100,0,9852,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Gymer - On Gossip Option Select - Close Gossip Window'), +(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,85,55568,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Gymer - On Gossip Option Select - Player cast Summon Gymer on self'); diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 8fdcf807cb7..a3d75a07943 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -31,13 +31,12 @@ enum DrakuruShackles { - SPELL_LEFT_CHAIN = 59951, - SPELL_RIGHT_CHAIN = 59952, - SPELL_UNLOCK_SHACKLE = 55083, - SPELL_FREE_RAGECLAW = 55223, - - NPC_RAGECLAW = 29686, - QUEST_TROLLS_IS_GONE_CRAZY = 12861 + NPC_RAGECLAW = 29686, + QUEST_TROLLS_IS_GONE_CRAZY = 12861, + SPELL_LEFT_CHAIN = 59951, + SPELL_RIGHT_CHAIN = 59952, + SPELL_UNLOCK_SHACKLE = 55083, + SPELL_FREE_RAGECLAW = 55223 }; class npc_drakuru_shackles : public CreatureScript @@ -49,11 +48,9 @@ public: { npc_drakuru_shacklesAI(Creature* creature) : ScriptedAI(creature) {} - uint64 RageclawGUID; - void Reset() { - RageclawGUID = 0; + _rageclawGUID = 0; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); float x, y, z; @@ -61,20 +58,20 @@ public: if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) { - RageclawGUID = summon->GetGUID(); + _rageclawGUID = summon->GetGUID(); LockRageclaw(); } } void LockRageclaw() { - Unit* Rageclaw = Unit::GetCreature(*me, RageclawGUID); + Unit* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed - me->SetInFront(Rageclaw); - Rageclaw->SetInFront(me); + me->SetInFront(rageclaw); + rageclaw->SetInFront(me); - DoCast(Rageclaw, SPELL_LEFT_CHAIN, true); - DoCast(Rageclaw, SPELL_RIGHT_CHAIN, true); + DoCast(rageclaw, SPELL_LEFT_CHAIN, true); + DoCast(rageclaw, SPELL_RIGHT_CHAIN, true); } void UnlockRageclaw(Unit* who) @@ -82,30 +79,33 @@ public: if (!who) return; - Creature* Rageclaw = Unit::GetCreature(*me, RageclawGUID); + Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed - DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true); + DoCast(rageclaw, SPELL_FREE_RAGECLAW, true); me->setDeathState(DEAD); } - void SpellHit(Unit* pCaster, const SpellInfo* pSpell) + void SpellHit(Unit* caster, const SpellInfo* spell) { - if (pSpell->Id == SPELL_UNLOCK_SHACKLE) + if (spell->Id == SPELL_UNLOCK_SHACKLE) { - if (pCaster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE) + if (caster->ToPlayer()->GetQuestStatus(QUEST_TROLLS_IS_GONE_CRAZY) == QUEST_STATUS_INCOMPLETE) { - if (Creature* pRageclaw = Unit::GetCreature(*me, RageclawGUID)) + if (Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID)) { - UnlockRageclaw(pCaster); - pCaster->ToPlayer()->KilledMonster(pRageclaw->GetCreatureTemplate(), RageclawGUID); - me->DisappearAndDie(); + UnlockRageclaw(caster); + caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID); + me->DespawnOrUnsummon(); } else me->setDeathState(JUST_DIED); } } } + + private: + uint64 _rageclawGUID; }; CreatureAI* GetAI(Creature* creature) const @@ -120,16 +120,11 @@ public: enum Rageclaw { - SPELL_UNSHACKLED = 55085, - SPELL_KNEEL = 39656 + SPELL_UNSHACKLED = 55085, + SPELL_KNEEL = 39656, + SAY_RAGECLAW = 0 }; -const char* SAY_RAGECLAW_1 = "I poop on you, trollses!"; -const char* SAY_RAGECLAW_2 = "ARRRROOOOGGGGAAAA!"; -const char* SAY_RAGECLAW_3 = "No more mister nice wolvar!"; - -#define SAY_RAGECLAW RAND(SAY_RAGECLAW_1, SAY_RAGECLAW_2, SAY_RAGECLAW_3) - class npc_captured_rageclaw : public CreatureScript { public: @@ -139,55 +134,36 @@ public: { npc_captured_rageclawAI(Creature* creature) : ScriptedAI(creature) {} - uint32 DespawnTimer; - bool Despawn; - void Reset() { - Despawn = false; - DespawnTimer = 0; me->setFaction(35); DoCast(me, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P } void MoveInLineOfSight(Unit* /*who*/){} - void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { - if (pSpell->Id == SPELL_FREE_RAGECLAW) + if (spell->Id == SPELL_FREE_RAGECLAW) { me->RemoveAurasDueToSpell(SPELL_LEFT_CHAIN); - me->RemoveAurasDueToSpell(SPELL_RIGHT_CHAIN); - me->RemoveAurasDueToSpell(SPELL_KNEEL); - me->setFaction(me->GetCreatureTemplate()->faction_H); - DoCast(me, SPELL_UNSHACKLED, true); - me->MonsterSay(SAY_RAGECLAW, LANG_UNIVERSAL, 0); + Talk(SAY_RAGECLAW); me->GetMotionMaster()->MoveRandom(10); - - DespawnTimer = 10000; - Despawn = true; + me->DespawnOrUnsummon(10000); } } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - if (UpdateVictim()) - { - DoMeleeAttackIfReady(); - return; - } - - if (!Despawn) + if (!UpdateVictim()) return; - if (DespawnTimer <= uiDiff) - me->DisappearAndDie(); - else DespawnTimer -= uiDiff; - } + DoMeleeAttackIfReady(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -197,56 +173,10 @@ public: }; /*#### -## npc_gymer -####*/ - -#define GOSSIP_ITEM_G "I'm ready, Gymer. Let's go!" - -enum eGymer -{ - QUEST_STORM_KING_VENGEANCE = 12919, - SPELL_GYMER = 55568 -}; - -class npc_gymer : public CreatureScript -{ -public: - npc_gymer() : CreatureScript("npc_gymer") { } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - - if (player->GetQuestStatus(QUEST_STORM_KING_VENGEANCE) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_G, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(13640, creature->GetGUID()); - } - - return true; - } - - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_GYMER, true); - } - - return true; - } -}; - -/*#### ## npc_gurgthock ####*/ -enum eGurgthock +enum Gurgthock { QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON = 12935, QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER = 12936, @@ -284,10 +214,10 @@ enum eGurgthock SPELL_BLAST_OF_AIR = 55912, // air SPELL_MAGMA_WAVE = 55916, // fire - SPELL_ORB_OF_WATER = 55888, // fiend of water spell - SPELL_ORB_OF_STORMS = 55882, // fiend of air spell - SPELL_BOULDER = 55886, // fiend of earth spell - SPELL_ORB_OF_FLAME = 55872, // fiend of fire spell + SPELL_ORB_OF_WATER = 55888, // fiend of water spell + SPELL_ORB_OF_STORMS = 55882, // fiend of air spell + SPELL_BOULDER = 55886, // fiend of earth spell + SPELL_ORB_OF_FLAME = 55872, // fiend of fire spell }; struct BossAndAdd @@ -342,21 +272,10 @@ public: { npc_gurgthockAI(Creature* creature) : ScriptedAI(creature) {} - uint64 SummonGUID; - uint64 uiPlayerGUID; - - uint32 uiTimer; - uint32 uiPhase; - uint32 uiRemoveFlagTimer; - uint32 uiQuest; - uint8 uiBossRandom; - - bool bRemoveFlag; - void Reset() { - SummonGUID = 0; - uiPlayerGUID = 0; + _summonGUID = 0; + _playerGUID = 0; me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); uiTimer = 0; @@ -364,25 +283,25 @@ public: uiQuest = 0; uiRemoveFlagTimer = 5000; - uiBossRandom = 0; + _bossRandom = 0; - bRemoveFlag = false; + _removeFlag = false; } void SetGUID(uint64 guid, int32 /*id*/) { - uiPlayerGUID = guid; + _playerGUID = guid; } - void SetData(uint32 uiId, uint32 uiValue) + void SetData(uint32 type, uint32 data) { - bRemoveFlag = true; + _removeFlag = true; me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - switch (uiId) + switch (type) { case 1: - switch (uiValue) + switch (data) { case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: Talk(SAY_QUEST_ACCEPT_TUSKARRMAGEDON); @@ -412,40 +331,40 @@ public: } } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - ScriptedAI::UpdateAI(uiDiff); + ScriptedAI::UpdateAI(diff); - if (bRemoveFlag) + if (_removeFlag) { - if (uiRemoveFlagTimer <= uiDiff) + if (uiRemoveFlagTimer <= diff) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - bRemoveFlag = false; + _removeFlag = false; uiRemoveFlagTimer = 10000; - } else uiRemoveFlagTimer -= uiDiff; + } else uiRemoveFlagTimer -= diff; } if (uiPhase) { - Player* player = me->GetPlayer(*me, uiPlayerGUID); + Player* player = me->GetPlayer(*me, _playerGUID); - if (uiTimer <= uiDiff) + if (uiTimer <= diff) { switch (uiPhase) { case 1: if (Creature* summon = me->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - SummonGUID = summon->GetGUID(); + _summonGUID = summon->GetGUID(); uiPhase = 2; uiTimer = 4000; break; case 2: - if (Creature* summon = Unit::GetCreature(*me, SummonGUID)) + if (Creature* summon = Unit::GetCreature(*me, _summonGUID)) summon->GetMotionMaster()->MoveJump(5776.319824f, -2981.005371f, 273.100037f, 10.0f, 20.0f); uiPhase = 0; - SummonGUID = 0; + _summonGUID = 0; break; case 3: Talk(SAY_QUEST_ACCEPT_KORRAK_2); @@ -454,7 +373,7 @@ public: break; case 4: if (Creature* summon = me->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - SummonGUID = summon->GetGUID(); + _summonGUID = summon->GetGUID(); uiTimer = 3000; uiPhase = 0; break; @@ -524,15 +443,28 @@ public: uiPhase = 14; break; case 14: - uiBossRandom = urand(0, 3); - if (Creature* creature = me->SummonCreature(Boss[uiBossRandom].uiBoss, SpawnPosition[2], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - creature->AI()->SetData(1, uiBossRandom); + _bossRandom = urand(0, 3); + if (Creature* creature = me->SummonCreature(Boss[_bossRandom].uiBoss, SpawnPosition[2], TEMPSUMMON_CORPSE_DESPAWN, 1000)) + creature->AI()->SetData(1, _bossRandom); uiPhase = 0; break; } - }else uiTimer -= uiDiff; + } + else uiTimer -= diff; } } + + private: + bool _removeFlag; + uint8 _bossRandom; + uint64 _summonGUID; + uint64 _playerGUID; + + uint32 uiTimer; + uint32 uiPhase; + uint32 uiRemoveFlagTimer; + uint32 uiQuest; + }; bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) @@ -572,15 +504,15 @@ public: ## npc_orinoko_tuskbreaker ####*/ -enum eOrinokoTuskbreaker +enum OrinokoTuskbreaker { - SPELL_BATTLE_SHOUT = 32064, - SPELL_FISHY_SCENT = 55937, - SPELL_IMPALE = 55929, - SPELL_SUMMON_WHISKER = 55946, + NPC_WHISKER = 30113, + NPC_HUNGRY_PENGUIN = 30110, - NPC_WHISKER = 30113, - NPC_HUNGRY_PENGUIN = 30110 + SPELL_BATTLE_SHOUT = 32064, + SPELL_FISHY_SCENT = 55937, + SPELL_IMPALE = 55929, + SPELL_SUMMON_WHISKER = 55946 }; class npc_orinoko_tuskbreaker : public CreatureScript @@ -596,31 +528,21 @@ public: me->SetReactState(REACT_PASSIVE); } - bool bSummoned; - bool bBattleShout; - bool bFishyScent; - - uint32 uiBattleShoutTimer; - uint32 uiFishyScentTimer; - - uint64 AffectedGUID; - uint64 uiWhisker; - void Reset() { - bSummoned = false; - bBattleShout = false; - bFishyScent = false; + _summoned = false; + _battleShout = false; + _fishyScent = false; uiBattleShoutTimer = 0; uiFishyScentTimer = 20000; - uiWhisker = 0; - AffectedGUID = 0; + _whiskerGUID = 0; + _affectedGUID = 0; } void EnterEvadeMode() { - if (Creature* pWhisker = me->GetCreature(*me, uiWhisker)) - pWhisker->RemoveFromWorld(); + if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) + whisker->RemoveFromWorld(); } void MovementInform(uint32 type, uint32 /*pointId*/) @@ -639,35 +561,35 @@ public: DoCast(who, SPELL_IMPALE); } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; - if (!bBattleShout && uiBattleShoutTimer <= uiDiff) + if (!_battleShout && uiBattleShoutTimer <= diff) { DoCast(me, SPELL_BATTLE_SHOUT); - bBattleShout = true; - } else uiBattleShoutTimer -= uiDiff; + _battleShout = true; + } else uiBattleShoutTimer -= diff; - if (uiFishyScentTimer <= uiDiff) + if (uiFishyScentTimer <= diff) { - if (Unit* pAffected = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* affected = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - DoCast(pAffected, SPELL_FISHY_SCENT); - AffectedGUID = pAffected->GetGUID(); + DoCast(affected, SPELL_FISHY_SCENT); + _affectedGUID = affected->GetGUID(); } uiFishyScentTimer = 20000; - } else uiFishyScentTimer -= uiDiff; + } else uiFishyScentTimer -= diff; - if (!bSummoned && !HealthAbovePct(50)) + if (!_summoned && !HealthAbovePct(50)) { Talk(SAY_CALL_FOR_HELP); //DoCast(me->GetVictim(), SPELL_SUMMON_WHISKER); petai is not working correctly??? - if (Creature* pWhisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - uiWhisker = pWhisker->GetGUID(); - bSummoned = true; + if (Creature* whisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + _whiskerGUID = whisker->GetGUID(); + _summoned = true; } DoMeleeAttackIfReady(); @@ -681,10 +603,10 @@ public: summon->AI()->AttackStart(me->GetVictim()); break; case NPC_HUNGRY_PENGUIN: - if (Unit* pAffected = Unit::GetUnit(*me, AffectedGUID)) + if (Unit* affected = Unit::GetUnit(*me, _affectedGUID)) { - if (pAffected->IsAlive()) - summon->AI()->AttackStart(pAffected); + if (affected->IsAlive()) + summon->AI()->AttackStart(affected); } break; } @@ -692,14 +614,23 @@ public: void JustDied(Unit* killer) { - if (uiWhisker) - if (Creature* pWhisker = me->GetCreature(*me, uiWhisker)) - pWhisker->RemoveFromWorld(); + if (_whiskerGUID) + if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) + whisker->RemoveFromWorld(); if (killer->GetTypeId() == TYPEID_PLAYER) killer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, killer); } + + private: + bool _summoned; + bool _battleShout; + bool _fishyScent; + uint32 uiBattleShoutTimer; + uint32 uiFishyScentTimer; + uint64 _affectedGUID; + uint64 _whiskerGUID; }; CreatureAI* GetAI(Creature* creature) const @@ -712,12 +643,12 @@ public: ## npc_korrak_bloodrager ####*/ -enum eKorrakBloodrager +enum KorrakBloodrager { - SPELL_GROW = 55948, - SPELL_CHARGE = 24193, - SPELL_UPPERCUT = 30471, - SPELL_ENRAGE = 42745 + SPELL_GROW = 55948, + SPELL_CHARGE = 24193, + SPELL_UPPERCUT = 30471, + SPELL_ENRAGE = 42745 }; class npc_korrak_bloodrager : public CreatureScript @@ -733,18 +664,14 @@ public: SetDespawnAtEnd(false); } - uint32 uiChargeTimer; - uint32 uiUppercutTimer; - - bool bEnrage; - void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); - uiChargeTimer = 15000; - uiUppercutTimer = 12000; - bEnrage = false; + _enrage = false; + _chargeTimer = 15000; + _uppercutTimer = 12000; + } void WaypointReached(uint32 waypointId) @@ -764,31 +691,31 @@ public: DoCast(me, SPELL_GROW); } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - npc_escortAI::UpdateAI(uiDiff); + npc_escortAI::UpdateAI(diff); if (!UpdateVictim()) return; - if (uiUppercutTimer <= uiDiff) + if (_uppercutTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0)) DoCast(target, SPELL_UPPERCUT); - uiUppercutTimer = 12000; - } else uiUppercutTimer -= uiDiff; + _uppercutTimer = 12000; + } else _uppercutTimer -= diff; - if (uiChargeTimer <= uiDiff) + if (_chargeTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) DoCast(target, SPELL_CHARGE); - uiChargeTimer = 15000; - } else uiChargeTimer -= uiDiff; + _chargeTimer = 15000; + } else _chargeTimer -= diff; - if (!bEnrage && !HealthAbovePct(20)) + if (!_enrage && !HealthAbovePct(20)) { DoCast(me, SPELL_ENRAGE); - bEnrage = true; + _enrage = true; } DoMeleeAttackIfReady(); } @@ -798,6 +725,10 @@ public: if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, killer); } + private: + bool _enrage; + uint32 _chargeTimer; + uint32 _uppercutTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -810,11 +741,11 @@ public: ## npc_yggdras ####*/ -enum eYggdras +enum Yggdras { - SPELL_CLEAVE = 40504, - SPELL_CORRODE_FLESH = 57076, - SPELL_JORMUNGAR_SPAWN = 55859 + SPELL_CLEAVE = 40504, + SPELL_CORRODE_FLESH = 57076, + SPELL_JORMUNGAR_SPAWN = 55859 }; class npc_yggdras : public CreatureScript @@ -826,16 +757,13 @@ public: { npc_yggdrasAI(Creature* creature) : ScriptedAI(creature) {} - uint32 uiCleaveTimer; - uint32 uiCorrodeFleshTimer; - void Reset() { - uiCleaveTimer = 9000; - uiCorrodeFleshTimer = 6000; + _cleaveTimer = 9000; + _corrodeFleshTimer = 6000; } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; @@ -858,17 +786,17 @@ public: } } - if (uiCleaveTimer <= uiDiff) + if (_cleaveTimer <= diff) { DoCast(me->GetVictim(), SPELL_CLEAVE); - uiCleaveTimer = 9000; - } else uiCleaveTimer -= uiDiff; + _cleaveTimer = 9000; + } else _cleaveTimer -= diff; - if (uiCorrodeFleshTimer <= uiDiff) + if (_corrodeFleshTimer <= diff) { DoCast(me->GetVictim(), SPELL_CORRODE_FLESH); - uiCorrodeFleshTimer = 6000; - } else uiCorrodeFleshTimer -= uiDiff; + _corrodeFleshTimer = 6000; + } else _corrodeFleshTimer -= diff; DoMeleeAttackIfReady(); } @@ -890,6 +818,9 @@ public: for (uint8 i = 0; i < 3; ++i) DoCast(killer, SPELL_JORMUNGAR_SPAWN, true); } + private: + uint32 _cleaveTimer; + uint32 _corrodeFleshTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -902,13 +833,13 @@ public: ## npc_stinkbeard ####*/ -enum eStinkbeard +enum Stinkbeard { - SPELL_ENRAGE_STINKBEARD = 50420, - SPELL_KNOCK_AWAY = 31389, - SPELL_STINKY_BEARD = 55867, - SPELL_THUNDERBLADE = 55866, - SPELL_THUNDERCLAP = 15588 + SPELL_ENRAGE_STINKBEARD = 50420, + SPELL_KNOCK_AWAY = 31389, + SPELL_STINKY_BEARD = 55867, + SPELL_THUNDERBLADE = 55866, + SPELL_THUNDERCLAP = 15588 }; class npc_stinkbeard : public CreatureScript @@ -926,19 +857,13 @@ public: SetDespawnAtEnd(false); } - uint32 uiKnockAwayTimer; - uint32 uiStinkyBeardTimer; - - bool bEnrage; - bool bThunderClap; - void Reset() { me->AddAura(SPELL_THUNDERBLADE, me); uiKnockAwayTimer = 10000; uiStinkyBeardTimer = 15000; - bEnrage = false; - bThunderClap = false; + _enrage = false; + _thunderClap = false; } void WaypointReached(uint32 waypointId) @@ -981,10 +906,10 @@ public: } } - if (bThunderClap && !HealthAbovePct(10)) + if (_thunderClap && !HealthAbovePct(10)) { DoCastAOE(SPELL_THUNDERCLAP); - bThunderClap = true; + _thunderClap = true; } if (uiKnockAwayTimer <= uiDiff) @@ -1007,10 +932,10 @@ public: uiStinkyBeardTimer = 15000; } else uiStinkyBeardTimer -= uiDiff; - if (!bEnrage && !HealthAbovePct(20)) + if (!_enrage && !HealthAbovePct(20)) { DoCast(me, SPELL_ENRAGE_STINKBEARD); - bEnrage = true; + _enrage = true; } DoMeleeAttackIfReady(); } @@ -1023,6 +948,11 @@ public: std::string sText = ("And with AUTHORITY, " + std::string(killer->GetName()) + " dominates the magnataur lord! Stinkbeard's clan is gonna miss him back home in the Dragonblight!"); me->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); } + private: + bool _enrage; + bool _thunderClap; + uint32 uiKnockAwayTimer; + uint32 uiStinkyBeardTimer; }; CreatureAI* GetAI(Creature* creature) const @@ -1189,16 +1119,13 @@ public: { npc_fiend_elementalAI(Creature* creature) : ScriptedAI(creature) {} - uint32 uiMissleTimer; - uint32 uiSpell; - void Reset() { if (me->GetPositionZ() >= 287.0f) me->GetMotionMaster()->MoveIdle(); - uiSpell = 0; - uiMissleTimer = urand(2000, 7000); + _spell = 0; + _missleTimer = urand(2000, 7000); } void AttackStart(Unit* who) @@ -1209,30 +1136,34 @@ public: AttackStartNoMove(who); } - void SetData(uint32 uiData, uint32 uiValue) + void SetData(uint32 Data, uint32 Value) { - if (uiData == 1) - uiSpell = Boss[uiValue].uiAddSpell; + if (Data == 1) + _spell = Boss[Value].uiAddSpell; } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { if (!UpdateVictim()) return; if (me->GetPositionZ() >= 287.0f) { - if (uiMissleTimer <= uiDiff) + if (_missleTimer <= diff) { - if (uiSpell) // Sometimes it is 0, why? - DoCast(me, uiSpell); // this spell (what spell) is not supported ... YET! - uiMissleTimer = urand(2000, 7000); - } else uiMissleTimer -= uiDiff; + if (_spell) // Sometimes it is 0, why? + DoCast(me, _spell); // this spell (what spell) is not supported ... YET! + _missleTimer = urand(2000, 7000); + } else _missleTimer -= diff; } DoMeleeAttackIfReady(); } + + private: + uint32 _missleTimer; + uint32 _spell; }; CreatureAI* GetAI(Creature* creature) const @@ -1261,11 +1192,11 @@ public: me->GetMotionMaster()->MovePoint(0, x, y, z); } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void MovementInform(uint32 Type, uint32 /*uiId*/) { - if (uiType != POINT_MOTION_TYPE) + if (Type != POINT_MOTION_TYPE) return; - me->DisappearAndDie(); + me->DespawnOrUnsummon(); } }; @@ -1279,16 +1210,17 @@ public: ## npc_crusade_recruit ######*/ -enum eCrusade_recruit +enum CrusadeRecruit { - SPELL_QUEST_CREDIT = 50633, - - QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509, - - GOSSIP_CRUSADE_TEXT = 13069 + SPELL_QUEST_CREDIT = 50633, + QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509 }; -#define GOSSIP_ITEM_1 "Get out there and make those Scourge wish they were never reborn!" +enum CrusadeRecruitEvents +{ + EVENT_RECRUIT_1 = 1, + EVENT_RECRUIT_2 = 2 +}; class npc_crusade_recruit : public CreatureScript { @@ -1299,87 +1231,58 @@ public: { npc_crusade_recruitAI(Creature* creature) : ScriptedAI(creature) {} - uint8 m_uiPhase; //The current phase we are in - uint32 m_uiTimer; //Timer until phase transition - float m_heading; //Store creature heading - void Reset() { - m_uiTimer = 0; - m_uiPhase = 0; me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); - m_heading = me->GetOrientation(); + _heading = me->GetOrientation(); } - void UpdateAI(uint32 uiDiff) + void UpdateAI(uint32 diff) { - if (m_uiPhase) + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - if (m_uiTimer <= uiDiff) + switch (eventId) { - switch (m_uiPhase) - { - case 1: - // say random text - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - Talk(SAY_RECRUIT); - m_uiTimer = 3000; - m_uiPhase = 2; - break; - case 2: - // walk forward - me->SetWalk(true); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(m_heading) * 10), me->GetPositionY() + (sin(m_heading) * 10), me->GetPositionZ()); - m_uiTimer = 5000; - m_uiPhase = 3; - break; - case 3: - // despawn - me->DisappearAndDie(); - m_uiTimer = 0; - m_uiPhase = 0; - break; - } + case EVENT_RECRUIT_1: + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + Talk(SAY_RECRUIT); + _events.ScheduleEvent(EVENT_RECRUIT_2, 3000); + break; + case EVENT_RECRUIT_2: + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (cos(_heading) * 10), me->GetPositionY() + (sin(_heading) * 10), me->GetPositionZ()); + me->DespawnOrUnsummon(5000); + break; + default: + break; } - else - m_uiTimer -= uiDiff; } - ScriptedAI::UpdateAI(uiDiff); if (!UpdateVictim()) return; } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_crusade_recruitAI(creature); - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (player->GetQuestStatus(QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_CRUSADE_TEXT, creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF +1) + void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) { + _events.ScheduleEvent(EVENT_RECRUIT_1, 100); player->CLOSE_GOSSIP_MENU(); - creature->CastSpell(player, SPELL_QUEST_CREDIT, true); - CAST_AI(npc_crusade_recruit::npc_crusade_recruitAI, (creature->AI()))->m_uiPhase = 1; - creature->SetInFront(player); - creature->SendMovementFlagUpdate(); + me->CastSpell(player, SPELL_QUEST_CREDIT, true); + me->SetInFront(player); + me->SendMovementFlagUpdate(); } - return true; + private: + EventMap _events; + float _heading; // Store creature heading + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_crusade_recruitAI(creature); } }; @@ -1390,8 +1293,9 @@ public: enum ScourgeEnclosure { - QUEST_OUR_ONLY_HOPE = 12916, - NPC_GYMER_DUMMY = 29928 //from quest template + QUEST_OUR_ONLY_HOPE = 12916, + NPC_GYMER_DUMMY = 29928, // From quest template + SPELL_GYMER_LOCK_EXPLOSION = 55529 }; class go_scourge_enclosure : public GameObjectScript @@ -1404,12 +1308,12 @@ public: go->UseDoorOrButton(); if (player->GetQuestStatus(QUEST_OUR_ONLY_HOPE) == QUEST_STATUS_INCOMPLETE) { - Creature* pGymerDummy = go->FindNearestCreature(NPC_GYMER_DUMMY, 20.0f); - if (pGymerDummy) + Creature* gymerDummy = go->FindNearestCreature(NPC_GYMER_DUMMY, 20.0f); + if (gymerDummy) { - player->KilledMonsterCredit(pGymerDummy->GetEntry(), pGymerDummy->GetGUID()); - pGymerDummy->CastSpell(pGymerDummy, 55529, true); - pGymerDummy->DisappearAndDie(); + player->KilledMonsterCredit(gymerDummy->GetEntry(), gymerDummy->GetGUID()); + gymerDummy->CastSpell(gymerDummy, SPELL_GYMER_LOCK_EXPLOSION, true); + gymerDummy->DespawnOrUnsummon(); } } return true; @@ -1946,7 +1850,6 @@ void AddSC_zuldrak() { new npc_drakuru_shackles; new npc_captured_rageclaw; - new npc_gymer; new npc_gurgthock; new npc_orinoko_tuskbreaker; new npc_korrak_bloodrager; |
