diff options
| author | silinoron <none@none> | 2010-08-07 13:11:55 -0700 |
|---|---|---|
| committer | silinoron <none@none> | 2010-08-07 13:11:55 -0700 |
| commit | 9e1695a9c5ee85e3378dd0507982d0074ea1a82a (patch) | |
| tree | 5e52604a2e5f63dde238a334d11216a54bb0db1d /src | |
| parent | c787f11de17a94d28e97c28c04fb855d935cdc15 (diff) | |
Convert outdoors northrend scripts to the new format.
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/scripts/Northrend/borean_tundra.cpp | 2998 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/crystalsong_forest.cpp | 81 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/dalaran.cpp | 162 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/dragonblight.cpp | 340 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/grizzly_hills.cpp | 788 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/howling_fjord.cpp | 414 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/icecrown.cpp | 456 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/sholazar_basin.cpp | 552 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/storm_peaks.cpp | 632 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/zuldrak.cpp | 1792 |
10 files changed, 4161 insertions, 4054 deletions
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index 4b16a3298bc..d405c1e15af 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -53,140 +53,152 @@ enum eSinkhole SPELL_SUMMON_WORM = 46800, }; -struct npc_sinkhole_kill_creditAI : public ScriptedAI +class npc_sinkhole_kill_credit : public CreatureScript { - npc_sinkhole_kill_creditAI(Creature* c) : ScriptedAI(c){} +public: + npc_sinkhole_kill_credit() : CreatureScript("npc_sinkhole_kill_credit") { } - uint32 uiPhaseTimer; - uint8 Phase; - uint64 casterGuid; - - void Reset() + struct npc_sinkhole_kill_creditAI : public ScriptedAI { - uiPhaseTimer = 500; - Phase = 0; - casterGuid = 0; - } + npc_sinkhole_kill_creditAI(Creature* c) : ScriptedAI(c){} - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (Phase) - return; + uint32 uiPhaseTimer; + uint8 Phase; + uint64 casterGuid; - if (spell->Id == SPELL_SET_CART && caster->GetTypeId() == TYPEID_PLAYER - && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE) + void Reset() { - Phase = 1; - casterGuid = caster->GetGUID(); + uiPhaseTimer = 500; + Phase = 0; + casterGuid = 0; } - } - void EnterCombat(Unit* /*who*/){} + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (Phase) + return; + + if (spell->Id == SPELL_SET_CART && caster->GetTypeId() == TYPEID_PLAYER + && CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE) + { + Phase = 1; + casterGuid = caster->GetGUID(); + } + } - void UpdateAI(const uint32 diff) - { - if (!Phase) - return; + void EnterCombat(Unit* /*who*/){} - if (uiPhaseTimer <= diff) + void UpdateAI(const uint32 diff) { - switch (Phase) + if (!Phase) + return; + + if (uiPhaseTimer <= diff) { - case 1: - DoCast(me, SPELL_EXPLODE_CART, true); - DoCast(me, SPELL_SUMMON_CART, true); - if (GameObject* cart = me->FindNearestGameObject(188160,3)) - cart->SetUInt32Value(GAMEOBJECT_FACTION, 14); - uiPhaseTimer = 3000; - Phase = 2; - break; - case 2: - if (GameObject* cart = me->FindNearestGameObject(188160,3)) - cart->UseDoorOrButton(); - DoCast(me, SPELL_EXPLODE_CART, true); - uiPhaseTimer = 3000; - Phase = 3; - break; - case 3: - DoCast(me, SPELL_EXPLODE_CART, true); - uiPhaseTimer = 2000; - Phase = 4; - case 5: - DoCast(me, SPELL_SUMMON_WORM, true); - if (Unit* worm = me->FindNearestCreature(26250, 3)) - { - worm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - worm->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); - } - uiPhaseTimer = 1000; - Phase = 6; - break; - case 6: - DoCast(me, SPELL_EXPLODE_CART, true); - if (Unit* worm = me->FindNearestCreature(26250, 3)) - { - me->Kill(worm); - worm->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - uiPhaseTimer = 2000; - Phase = 7; - break; - case 7: - DoCast(me, SPELL_EXPLODE_CART, true); - if (Player *caster = Unit::GetPlayer(*me, casterGuid)) - caster->KilledMonster(me->GetCreatureInfo(),me->GetGUID()); - uiPhaseTimer = 5000; - Phase = 8; - break; - case 8: - EnterEvadeMode(); - break; - } - } else uiPhaseTimer -= diff; + switch (Phase) + { + case 1: + DoCast(me, SPELL_EXPLODE_CART, true); + DoCast(me, SPELL_SUMMON_CART, true); + if (GameObject* cart = me->FindNearestGameObject(188160,3)) + cart->SetUInt32Value(GAMEOBJECT_FACTION, 14); + uiPhaseTimer = 3000; + Phase = 2; + break; + case 2: + if (GameObject* cart = me->FindNearestGameObject(188160,3)) + cart->UseDoorOrButton(); + DoCast(me, SPELL_EXPLODE_CART, true); + uiPhaseTimer = 3000; + Phase = 3; + break; + case 3: + DoCast(me, SPELL_EXPLODE_CART, true); + uiPhaseTimer = 2000; + Phase = 4; + case 5: + DoCast(me, SPELL_SUMMON_WORM, true); + if (Unit* worm = me->FindNearestCreature(26250, 3)) + { + worm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + worm->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + } + uiPhaseTimer = 1000; + Phase = 6; + break; + case 6: + DoCast(me, SPELL_EXPLODE_CART, true); + if (Unit* worm = me->FindNearestCreature(26250, 3)) + { + me->Kill(worm); + worm->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + uiPhaseTimer = 2000; + Phase = 7; + break; + case 7: + DoCast(me, SPELL_EXPLODE_CART, true); + if (Player *caster = Unit::GetPlayer(*me, casterGuid)) + caster->KilledMonster(me->GetCreatureInfo(),me->GetGUID()); + uiPhaseTimer = 5000; + Phase = 8; + break; + case 8: + EnterEvadeMode(); + break; + } + } else uiPhaseTimer -= diff; - } + } -}; + }; -CreatureAI* GetAI_npc_sinkhole_kill_credit(Creature* pCreature) -{ - return new npc_sinkhole_kill_creditAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_sinkhole_kill_creditAI(creature); + } +}; /*###### ## npc_khunok_the_behemoth ######*/ -struct npc_khunok_the_behemothAI : public ScriptedAI +class npc_khunok_the_behemoth : public CreatureScript { - npc_khunok_the_behemothAI(Creature *c) : ScriptedAI(c) {} +public: + npc_khunok_the_behemoth() : CreatureScript("npc_khunok_the_behemoth") { } - void MoveInLineOfSight(Unit *who) + struct npc_khunok_the_behemothAI : public ScriptedAI { - ScriptedAI::MoveInLineOfSight(who); - - if (who->GetTypeId() != TYPEID_UNIT) - return; + npc_khunok_the_behemothAI(Creature *c) : ScriptedAI(c) {} - if (who->GetEntry() == 25861 && me->IsWithinDistInMap(who, 10.0f)) + void MoveInLineOfSight(Unit *who) { - if (Unit *owner = who->GetOwner()) + ScriptedAI::MoveInLineOfSight(who); + + if (who->GetTypeId() != TYPEID_UNIT) + return; + + if (who->GetEntry() == 25861 && me->IsWithinDistInMap(who, 10.0f)) { - if (owner->GetTypeId() == TYPEID_PLAYER) + if (Unit *owner = who->GetOwner()) { - owner->CastSpell(owner, 46231, true); - CAST_CRE(who)->ForcedDespawn(); + if (owner->GetTypeId() == TYPEID_PLAYER) + { + owner->CastSpell(owner, 46231, true); + CAST_CRE(who)->ForcedDespawn(); + } } } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_khunok_the_behemothAI(creature); } }; -CreatureAI* GetAI_npc_khunok_the_behemoth(Creature* pCreature) -{ - return new npc_khunok_the_behemothAI(pCreature); -} - /*###### ## npc_keristrasza ######*/ @@ -198,29 +210,35 @@ enum eKeristrasza #define GOSSIP_HELLO_KERI "I am prepared to face Saragosa!" -bool GossipHello_npc_keristrasza(Player* pPlayer, Creature* pCreature) +class npc_keristrasza : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_keristrasza() : CreatureScript("npc_keristrasza") { } - if (pPlayer->GetQuestStatus(11957) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KERI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(11957) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KERI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -bool GossipSelect_npc_keristrasza(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_TO_SARAGOSA, true); + return true; } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_TO_SARAGOSA, true); + } + + return true; + } +}; /*###### ## npc_corastrasza @@ -237,31 +255,37 @@ enum eCorastrasza QUEST_ACES_HIGH = 13413 }; -bool GossipHello_npc_corastrasza(Player* pPlayer, Creature* pCreature) +class npc_corastrasza : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_corastrasza() : CreatureScript("npc_corastrasza") { } - if (pPlayer->GetQuestStatus(QUEST_ACES_HIGH) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_ACES_HIGH_DAILY) == QUEST_STATUS_INCOMPLETE) //It's the same dragon for both quests. - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_C_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestStatus(QUEST_ACES_HIGH) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_ACES_HIGH_DAILY) == QUEST_STATUS_INCOMPLETE) //It's the same dragon for both quests. + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_C_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_corastrasza(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SUMMON_WYRMREST_SKYTALON, true); - pPlayer->CastSpell(pPlayer, SPELL_WYRMREST_SKYTALON_RIDE_PERIODIC, true); + pPlayer->CastSpell(pPlayer, SPELL_SUMMON_WYRMREST_SKYTALON, true); + pPlayer->CastSpell(pPlayer, SPELL_WYRMREST_SKYTALON_RIDE_PERIODIC, true); - } + } - return true; -} + return true; + } +}; /*###### ## npc_iruk @@ -276,28 +300,35 @@ enum eIruk GOSSIP_TEXT_I = 12585 }; -bool GossipHello_npc_iruk(Player* pPlayer, Creature* pCreature) +class npc_iruk : public CreatureScript { +public: + npc_iruk() : CreatureScript("npc_iruk") { } - if (pPlayer->GetQuestStatus(QUEST_SPIRITS_WATCH_OVER_US) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_I, pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestStatus(QUEST_SPIRITS_WATCH_OVER_US) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_iruk(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_I, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CastSpell(pPlayer, SPELL_CREATURE_TOTEM_OF_ISSLIRUK, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CastSpell(pPlayer, SPELL_CREATURE_TOTEM_OF_ISSLIRUK, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - return true; -} +}; + /*###### ## mob_nerubar_victim ######*/ @@ -308,36 +339,45 @@ const uint32 nerubarVictims[3] = { 45526, 45527, 45514 }; -struct mob_nerubar_victimAI : public ScriptedAI -{ - mob_nerubar_victimAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} +class mob_nerubar_victim : public CreatureScript +{ +public: + mob_nerubar_victim() : CreatureScript("mob_nerubar_victim") { } - void JustDied(Unit* Killer) + struct mob_nerubar_victimAI : public ScriptedAI { - if (Killer->GetTypeId() == TYPEID_PLAYER) + mob_nerubar_victimAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + + void JustDied(Unit* Killer) { - if (CAST_PLR(Killer)->GetQuestStatus(11611) == QUEST_STATUS_INCOMPLETE) + if (Killer->GetTypeId() == TYPEID_PLAYER) { - uint8 uiRand = urand(0,99); - if (uiRand < 25) + if (CAST_PLR(Killer)->GetQuestStatus(11611) == QUEST_STATUS_INCOMPLETE) { - Killer->CastSpell(me,45532,true); - CAST_PLR(Killer)->KilledMonsterCredit(WARSONG_PEON, 0); + uint8 uiRand = urand(0,99); + if (uiRand < 25) + { + Killer->CastSpell(me,45532,true); + CAST_PLR(Killer)->KilledMonsterCredit(WARSONG_PEON, 0); + } + else if (uiRand < 75) + Killer->CastSpell(me, nerubarVictims[urand(0,2)], true); } - else if (uiRand < 75) - Killer->CastSpell(me, nerubarVictims[urand(0,2)], true); } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new mob_nerubar_victimAI(creature); } }; -CreatureAI* GetAI_mob_nerubar_victim(Creature *pCreature) -{ - return new mob_nerubar_victimAI (pCreature); -} + /*###### ## npc_scourge_prisoner ######*/ @@ -347,28 +387,36 @@ enum eScourgePrisoner GO_SCOURGE_CAGE = 187867 }; -struct npc_scourge_prisonerAI : public ScriptedAI +class npc_scourge_prisoner : public CreatureScript { - npc_scourge_prisonerAI(Creature* pCreature) : ScriptedAI (pCreature){} +public: + npc_scourge_prisoner() : CreatureScript("npc_scourge_prisoner") { } - void Reset() + struct npc_scourge_prisonerAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); + npc_scourge_prisonerAI(Creature* pCreature) : ScriptedAI (pCreature){} - if (GameObject* pGO = me->FindNearestGameObject(GO_SCOURGE_CAGE,5.0f)) - if (pGO->GetGoState() == GO_STATE_ACTIVE) - pGO->SetGoState(GO_STATE_READY); - } + void Reset() + { + me->SetReactState(REACT_PASSIVE); + + if (GameObject* pGO = me->FindNearestGameObject(GO_SCOURGE_CAGE,5.0f)) + if (pGO->GetGoState() == GO_STATE_ACTIVE) + pGO->SetGoState(GO_STATE_READY); + } + + }; + CreatureAI *GetAI(Creature *creature) const + { + return new npc_scourge_prisonerAI(creature); + } }; -CreatureAI* GetAI_npc_scourge_prisoner(Creature* pCreature) -{ - return new npc_scourge_prisonerAI(pCreature); -} /*###### ## npc_jenny ######*/ + enum eJenny { QUEST_LOADER_UP = 11881, @@ -381,95 +429,107 @@ enum eJenny SPELL_DROP_CRATE = 46342 }; -struct npc_jennyAI : public ScriptedAI +class npc_jenny : public CreatureScript { - npc_jennyAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_jenny() : CreatureScript("npc_jenny") { } - bool setCrateNumber; - - void Reset() + struct npc_jennyAI : public ScriptedAI { - if (!setCrateNumber) - setCrateNumber = true; + npc_jennyAI(Creature* pCreature) : ScriptedAI(pCreature) {} - me->SetReactState(REACT_PASSIVE); + bool setCrateNumber; - switch (CAST_PLR(me->GetOwner())->GetTeamId()) + void Reset() { - case TEAM_ALLIANCE: - me->setFaction(FACTION_ESCORT_A_NEUTRAL_ACTIVE); - break; - default: - case TEAM_HORDE: - me->setFaction(FACTION_ESCORT_H_NEUTRAL_ACTIVE); - break; - } - } + if (!setCrateNumber) + setCrateNumber = true; - void DamageTaken(Unit* /*pDone_by*/, uint32& /*uiDamage*/) - { - DoCast(me, SPELL_DROP_CRATE, true); - } + me->SetReactState(REACT_PASSIVE); - void UpdateAI(const uint32 /*diff*/) - { - if (setCrateNumber) + switch (CAST_PLR(me->GetOwner())->GetTeamId()) + { + case TEAM_ALLIANCE: + me->setFaction(FACTION_ESCORT_A_NEUTRAL_ACTIVE); + break; + default: + case TEAM_HORDE: + me->setFaction(FACTION_ESCORT_H_NEUTRAL_ACTIVE); + break; + } + } + + void DamageTaken(Unit* /*pDone_by*/, uint32& /*uiDamage*/) { - me->AddAura(SPELL_CRATES_CARRIED,me); - setCrateNumber = false; + DoCast(me, SPELL_DROP_CRATE, true); } - if (!setCrateNumber && !me->HasAura(SPELL_CRATES_CARRIED)) - me->DisappearAndDie(); + void UpdateAI(const uint32 /*diff*/) + { + if (setCrateNumber) + { + me->AddAura(SPELL_CRATES_CARRIED,me); + setCrateNumber = false; + } - if (!UpdateVictim()) - return; + if (!setCrateNumber && !me->HasAura(SPELL_CRATES_CARRIED)) + me->DisappearAndDie(); + + if (!UpdateVictim()) + return; + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_jennyAI (creature); } }; -CreatureAI* GetAI_npc_jenny(Creature *pCreature) -{ - return new npc_jennyAI (pCreature); -} - /*###### ## npc_fezzix_geartwist ######*/ -struct npc_fezzix_geartwistAI : public ScriptedAI +class npc_fezzix_geartwist : public CreatureScript { - npc_fezzix_geartwistAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_fezzix_geartwist() : CreatureScript("npc_fezzix_geartwist") { } - void MoveInLineOfSight(Unit* pWho) + struct npc_fezzix_geartwistAI : public ScriptedAI { - ScriptedAI::MoveInLineOfSight(pWho); - - if (pWho->GetTypeId() != TYPEID_UNIT) - return; + npc_fezzix_geartwistAI(Creature* pCreature) : ScriptedAI(pCreature) {} - if (pWho->GetEntry() == NPC_JENNY && me->IsWithinDistInMap(pWho, 10.0f)) + void MoveInLineOfSight(Unit* pWho) { - if (Unit* pOwner = pWho->GetOwner()) + ScriptedAI::MoveInLineOfSight(pWho); + + if (pWho->GetTypeId() != TYPEID_UNIT) + return; + + if (pWho->GetEntry() == NPC_JENNY && me->IsWithinDistInMap(pWho, 10.0f)) { - if (pOwner->GetTypeId() == TYPEID_PLAYER) + if (Unit* pOwner = pWho->GetOwner()) { - if (pWho->HasAura(SPELL_CRATES_CARRIED)) + if (pOwner->GetTypeId() == TYPEID_PLAYER) { - pOwner->CastSpell(pOwner, SPELL_GIVE_JENNY_CREDIT, true); // Maybe is not working. - CAST_PLR(pOwner)->CompleteQuest(QUEST_LOADER_UP); - CAST_CRE(pWho)->DisappearAndDie(); + if (pWho->HasAura(SPELL_CRATES_CARRIED)) + { + pOwner->CastSpell(pOwner, SPELL_GIVE_JENNY_CREDIT, true); // Maybe is not working. + CAST_PLR(pOwner)->CompleteQuest(QUEST_LOADER_UP); + CAST_CRE(pWho)->DisappearAndDie(); + } } } } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_fezzix_geartwistAI(creature); } }; -CreatureAI* GetAI_npc_fezzix_geartwist(Creature* pCreature) -{ - return new npc_fezzix_geartwistAI(pCreature); -} - /*###### ## npc_nesingwary_trapper ######*/ @@ -504,112 +564,117 @@ const uint32 CaribouTraps[CaribouTrapsNum] = GO_CARIBOU_TRAP_6, GO_CARIBOU_TRAP_7, GO_CARIBOU_TRAP_8, GO_CARIBOU_TRAP_9, GO_CARIBOU_TRAP_10, GO_CARIBOU_TRAP_11, GO_CARIBOU_TRAP_12, GO_CARIBOU_TRAP_13, GO_CARIBOU_TRAP_14, GO_CARIBOU_TRAP_15, }; -//#define SAY_NESINGWARY_1 -1571008 -struct npc_nesingwary_trapperAI : public ScriptedAI +class npc_nesingwary_trapper : public CreatureScript { - npc_nesingwary_trapperAI(Creature *c) : ScriptedAI(c) { c->SetVisibility(VISIBILITY_OFF); } - - uint64 go_caribouGUID; - uint8 Phase; - uint32 uiPhaseTimer; +public: + npc_nesingwary_trapper() : CreatureScript("npc_nesingwary_trapper") { } - void Reset() + struct npc_nesingwary_trapperAI : public ScriptedAI { - me->SetVisibility(VISIBILITY_OFF); - uiPhaseTimer = 2500; - Phase = 1; - go_caribouGUID = 0; - } - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} + npc_nesingwary_trapperAI(Creature *c) : ScriptedAI(c) { c->SetVisibility(VISIBILITY_OFF); } - void JustDied(Unit * /*who*/) - { - if (GameObject *go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) - go_caribou->SetLootState(GO_JUST_DEACTIVATED); + uint64 go_caribouGUID; + uint8 Phase; + uint32 uiPhaseTimer; - if (TempSummon *summon = me->ToTempSummon()) - if (summon->isSummon()) - if (Unit *pTemp = summon->GetSummoner()) - if (pTemp->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pTemp)->KilledMonsterCredit(me->GetEntry(),0); + void Reset() + { + me->SetVisibility(VISIBILITY_OFF); + uiPhaseTimer = 2500; + Phase = 1; + go_caribouGUID = 0; + } + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} - if (GameObject *go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) - go_caribou->SetGoState(GO_STATE_READY); - } + void JustDied(Unit * /*who*/) + { + if (GameObject *go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) + go_caribou->SetLootState(GO_JUST_DEACTIVATED); - void UpdateAI(const uint32 diff) - { - if (uiPhaseTimer <= diff) + if (TempSummon *summon = me->ToTempSummon()) + if (summon->isSummon()) + if (Unit *pTemp = summon->GetSummoner()) + if (pTemp->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pTemp)->KilledMonsterCredit(me->GetEntry(),0); + + if (GameObject *go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) + go_caribou->SetGoState(GO_STATE_READY); + } + + void UpdateAI(const uint32 diff) { - switch (Phase) + if (uiPhaseTimer <= diff) { - case 1: - me->SetVisibility(VISIBILITY_ON); - uiPhaseTimer = 2000; - Phase = 2; - break; + switch (Phase) + { + case 1: + me->SetVisibility(VISIBILITY_ON); + uiPhaseTimer = 2000; + Phase = 2; + break; - case 2: - if (GameObject *go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f)) - me->GetMotionMaster()->MovePoint(0, go_fur->GetPositionX(), go_fur->GetPositionY(), go_fur->GetPositionZ()); - uiPhaseTimer = 1500; - Phase = 3; - break; - case 3: - //DoScriptText(SAY_NESINGWARY_1, me); - uiPhaseTimer = 2000; - Phase = 4; - break; - case 4: - me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT); - uiPhaseTimer = 1000; - Phase = 5; - break; - case 5: - me->HandleEmoteCommand(EMOTE_ONESHOT_NONE); - uiPhaseTimer = 500; - Phase = 6; - break; - case 6: - if (GameObject *go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f)) - go_fur->Delete(); - uiPhaseTimer = 500; - Phase = 7; - break; + case 2: + if (GameObject *go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f)) + me->GetMotionMaster()->MovePoint(0, go_fur->GetPositionX(), go_fur->GetPositionY(), go_fur->GetPositionZ()); + uiPhaseTimer = 1500; + Phase = 3; + break; + case 3: + //DoScriptText(SAY_NESINGWARY_1, me); + uiPhaseTimer = 2000; + Phase = 4; + break; + case 4: + me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT); + uiPhaseTimer = 1000; + Phase = 5; + break; + case 5: + me->HandleEmoteCommand(EMOTE_ONESHOT_NONE); + uiPhaseTimer = 500; + Phase = 6; + break; + case 6: + if (GameObject *go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f)) + go_fur->Delete(); + uiPhaseTimer = 500; + Phase = 7; + break; - case 7: - { - GameObject *go_caribou = NULL; - for (uint8 i = 0; i < CaribouTrapsNum; ++i) + case 7: { - go_caribou = me->FindNearestGameObject(CaribouTraps[i], 5.0f); - if (go_caribou) + GameObject *go_caribou = NULL; + for (uint8 i = 0; i < CaribouTrapsNum; ++i) { - go_caribou->SetGoState(GO_STATE_ACTIVE); - go_caribouGUID = go_caribou->GetGUID(); - break; + go_caribou = me->FindNearestGameObject(CaribouTraps[i], 5.0f); + if (go_caribou) + { + go_caribou->SetGoState(GO_STATE_ACTIVE); + go_caribouGUID = go_caribou->GetGUID(); + break; + } } + Phase = 8; + uiPhaseTimer = 1000; } - Phase = 8; - uiPhaseTimer = 1000; + break; + case 8: + DoCast(me, SPELL_TRAPPED, true); + Phase = 0; + break; } - break; - case 8: - DoCast(me, SPELL_TRAPPED, true); - Phase = 0; - break; - } - } else uiPhaseTimer -= diff; + } else uiPhaseTimer -= diff; + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_nesingwary_trapperAI(creature); } }; -CreatureAI* GetAI_npc_nesingwary_trapper(Creature *pCreature) -{ - return new npc_nesingwary_trapperAI (pCreature); -} - /*###### ## npc_lurgglbr ######*/ @@ -629,127 +694,133 @@ enum eLurgglbr #define SAY_WP_41_LUR_START -1571006 #define SAY_WP_41_LUR_END -1571007*/ -struct npc_lurgglbrAI : public npc_escortAI +class npc_lurgglbr : public CreatureScript { - npc_lurgglbrAI(Creature* pCreature) : npc_escortAI(pCreature){} - - uint32 IntroTimer; - uint32 IntroPhase; +public: + npc_lurgglbr() : CreatureScript("npc_lurgglbr") { } - void Reset() + struct npc_lurgglbrAI : public npc_escortAI { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + npc_lurgglbrAI(Creature* pCreature) : npc_escortAI(pCreature){} + + uint32 IntroTimer; + uint32 IntroPhase; + + void Reset() { - IntroTimer = 0; - IntroPhase = 0; + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + IntroTimer = 0; + IntroPhase = 0; + } } - } - void WaypointReached(uint32 i) - { - switch (i) + void WaypointReached(uint32 i) { - case 0: - IntroPhase = 1; - IntroTimer = 2000; - break; - case 41: - IntroPhase = 4; - IntroTimer = 2000; - break; + switch (i) + { + case 0: + IntroPhase = 1; + IntroTimer = 2000; + break; + case 41: + IntroPhase = 4; + IntroTimer = 2000; + break; + } } - } - void UpdateAI(const uint32 diff) - { - if (IntroPhase) + void UpdateAI(const uint32 diff) { - if (IntroTimer <= diff) + if (IntroPhase) { - switch(IntroPhase) + if (IntroTimer <= diff) { - case 1: - //DoScriptText(SAY_WP_1_LUR_START,me); - IntroPhase = 2; - IntroTimer = 7500; - break; - case 2: - //DoScriptText(SAY_WP_1_LUR_END,me); - IntroPhase = 3; - IntroTimer = 7500; - break; - case 3: - me->SetReactState(REACT_AGGRESSIVE); - IntroPhase = 0; - IntroTimer = 0; - break; - case 4: - //DoScriptText(SAY_WP_41_LUR_START,me); - IntroPhase = 5; - IntroTimer = 8000; - break; - case 5: - //DoScriptText(SAY_WP_41_LUR_END,me); - IntroPhase = 6; - IntroTimer = 2500; - break; + switch(IntroPhase) + { + case 1: + //DoScriptText(SAY_WP_1_LUR_START,me); + IntroPhase = 2; + IntroTimer = 7500; + break; + case 2: + //DoScriptText(SAY_WP_1_LUR_END,me); + IntroPhase = 3; + IntroTimer = 7500; + break; + case 3: + me->SetReactState(REACT_AGGRESSIVE); + IntroPhase = 0; + IntroTimer = 0; + break; + case 4: + //DoScriptText(SAY_WP_41_LUR_START,me); + IntroPhase = 5; + IntroTimer = 8000; + break; + case 5: + //DoScriptText(SAY_WP_41_LUR_END,me); + IntroPhase = 6; + IntroTimer = 2500; + break; - case 6: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->AreaExploredOrEventHappens(QUEST_ESCAPE_WINTERFIN_CAVERNS); - IntroPhase = 7; - IntroTimer = 2500; - break; + case 6: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->AreaExploredOrEventHappens(QUEST_ESCAPE_WINTERFIN_CAVERNS); + IntroPhase = 7; + IntroTimer = 2500; + break; - case 7: - me->ForcedDespawn(); - IntroPhase = 0; - IntroTimer = 0; - break; - } - } else IntroTimer -= diff; + case 7: + me->ForcedDespawn(); + IntroPhase = 0; + IntroTimer = 0; + break; + } + } else IntroTimer -= diff; + } + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; } - npc_escortAI::UpdateAI(diff); + }; - if (!UpdateVictim()) - return; + CreatureAI *GetAI(Creature *creature) const + { + return new npc_lurgglbrAI(creature); } -}; -CreatureAI* GetAI_npc_lurgglbr(Creature* pCreature) -{ - return new npc_lurgglbrAI(pCreature); -} - -bool QuestAccept_npc_lurgglbr(Player* pPlayer, Creature* pCreature, Quest const *pQuest) -{ - if (pQuest->GetQuestId() == QUEST_ESCAPE_WINTERFIN_CAVERNS) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *pQuest) { - if (GameObject* pGo = pCreature->FindNearestGameObject(GO_CAGE, 5.0f)) + if (pQuest->GetQuestId() == QUEST_ESCAPE_WINTERFIN_CAVERNS) { - pGo->SetRespawnTime(0); - pGo->SetGoType(GAMEOBJECT_TYPE_BUTTON); - pGo->UseDoorOrButton(20); - } + if (GameObject* pGo = pCreature->FindNearestGameObject(GO_CAGE, 5.0f)) + { + pGo->SetRespawnTime(0); + pGo->SetGoType(GAMEOBJECT_TYPE_BUTTON); + pGo->UseDoorOrButton(20); + } - if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbrAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); + if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbrAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); - switch (pPlayer->GetTeam()) - { - case ALLIANCE: - pCreature->setFaction(FACTION_ESCORTEE_A); - break; - default: - case HORDE: - pCreature->setFaction(FACTION_ESCORTEE_H); - break; - } + switch (pPlayer->GetTeam()) + { + case ALLIANCE: + pCreature->setFaction(FACTION_ESCORTEE_A); + break; + default: + case HORDE: + pCreature->setFaction(FACTION_ESCORTEE_H); + break; + } - return true; + return true; + } + return false; } - return false; -} +}; /*###### ## npc_nexus_drake_hatchling @@ -768,87 +839,93 @@ enum eNexusDrakeHatchling QUEST_DRAKE_HUNT_D = 11940 }; -struct npc_nexus_drake_hatchlingAI : public FollowerAI //The spell who makes the npc follow the player is missing, also we can use FollowerAI! +class npc_nexus_drake_hatchling : public CreatureScript { - npc_nexus_drake_hatchlingAI(Creature *c) : FollowerAI(c) {} +public: + npc_nexus_drake_hatchling() : CreatureScript("npc_nexus_drake_hatchling") { } - uint64 HarpoonerGUID; - bool WithRedDragonBlood; - - void Reset() + struct npc_nexus_drake_hatchlingAI : public FollowerAI //The spell who makes the npc follow the player is missing, also we can use FollowerAI! { - WithRedDragonBlood = false; - HarpoonerGUID = 0; - } + npc_nexus_drake_hatchlingAI(Creature *c) : FollowerAI(c) {} - void EnterCombat(Unit* pWho) - { - if (me->canAttack(pWho)) - AttackStart(pWho); - } + uint64 HarpoonerGUID; + bool WithRedDragonBlood; - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_DRAKE_HARPOON && caster->GetTypeId() == TYPEID_PLAYER) + void Reset() { - HarpoonerGUID = caster->GetGUID(); - DoCast(me, SPELL_RED_DRAGONBLOOD, true); + WithRedDragonBlood = false; + HarpoonerGUID = 0; } - WithRedDragonBlood = true; - } - void MoveInLineOfSight(Unit *pWho) - { - FollowerAI::MoveInLineOfSight(pWho); + void EnterCombat(Unit* pWho) + { + if (me->canAttack(pWho)) + AttackStart(pWho); + } - if (!HarpoonerGUID) - return; + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_DRAKE_HARPOON && caster->GetTypeId() == TYPEID_PLAYER) + { + HarpoonerGUID = caster->GetGUID(); + DoCast(me, SPELL_RED_DRAGONBLOOD, true); + } + WithRedDragonBlood = true; + } - if (me->HasAura(SPELL_SUBDUED) && pWho->GetEntry() == NPC_RAELORASZ) + void MoveInLineOfSight(Unit *pWho) { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + FollowerAI::MoveInLineOfSight(pWho); + + if (!HarpoonerGUID) + return; + + if (me->HasAura(SPELL_SUBDUED) && pWho->GetEntry() == NPC_RAELORASZ) { - if (Player *pHarpooner = Unit::GetPlayer(*me, HarpoonerGUID)) + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) { - pHarpooner->KilledMonsterCredit(26175,0); - pHarpooner->RemoveAura(SPELL_DRAKE_HATCHLING_SUBDUED); - SetFollowComplete(); - HarpoonerGUID = 0; - me->DisappearAndDie(); + if (Player *pHarpooner = Unit::GetPlayer(*me, HarpoonerGUID)) + { + pHarpooner->KilledMonsterCredit(26175,0); + pHarpooner->RemoveAura(SPELL_DRAKE_HATCHLING_SUBDUED); + SetFollowComplete(); + HarpoonerGUID = 0; + me->DisappearAndDie(); + } } } } - } - void UpdateAI(const uint32 /*diff*/) - { - if (WithRedDragonBlood && HarpoonerGUID && !me->HasAura(SPELL_RED_DRAGONBLOOD)) + void UpdateAI(const uint32 /*diff*/) { - if (Player *pHarpooner = Unit::GetPlayer(*me, HarpoonerGUID)) + if (WithRedDragonBlood && HarpoonerGUID && !me->HasAura(SPELL_RED_DRAGONBLOOD)) { - EnterEvadeMode(); - StartFollow(pHarpooner, 35, NULL); + if (Player *pHarpooner = Unit::GetPlayer(*me, HarpoonerGUID)) + { + EnterEvadeMode(); + StartFollow(pHarpooner, 35, NULL); - DoCast(me, SPELL_SUBDUED, true); - pHarpooner->CastSpell(pHarpooner, SPELL_DRAKE_HATCHLING_SUBDUED, true); + DoCast(me, SPELL_SUBDUED, true); + pHarpooner->CastSpell(pHarpooner, SPELL_DRAKE_HATCHLING_SUBDUED, true); - me->AttackStop(); - WithRedDragonBlood = false; + me->AttackStop(); + WithRedDragonBlood = false; + } } - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); + CreatureAI *GetAI(Creature *creature) const + { + return new npc_nexus_drake_hatchlingAI(creature); } }; -CreatureAI* GetAI_npc_nexus_drake_hatchling(Creature* pCreature) -{ - return new npc_nexus_drake_hatchlingAI(pCreature); -} - /*###### ## npc_thassarian ######*/ @@ -891,358 +968,376 @@ enum eThassarian #define GOSSIP_ITEM_T "Let's do this, Thassarian. It's now or never." -struct npc_thassarianAI : public npc_escortAI +class npc_thassarian : public CreatureScript { - npc_thassarianAI(Creature* pCreature) : npc_escortAI(pCreature) - { - } - - uint64 uiArthas; - uint64 uiTalbot; - uint64 uiLeryssa; - uint64 uiArlos; - - bool bArthasInPosition; - bool bArlosInPosition; - bool bLeryssaInPosition; - bool bTalbotInPosition; - - uint32 uiPhase; - uint32 uiPhaseTimer; +public: + npc_thassarian() : CreatureScript("npc_thassarian") { } - void Reset() + struct npc_thassarianAI : public npc_escortAI { - me->RestoreFaction(); - me->RemoveStandFlags(UNIT_STAND_STATE_SIT); + npc_thassarianAI(Creature* pCreature) : npc_escortAI(pCreature) + { + } - uiArthas = 0; - uiTalbot = 0; - uiLeryssa = 0; - uiArlos = 0; + uint64 uiArthas; + uint64 uiTalbot; + uint64 uiLeryssa; + uint64 uiArlos; - bArthasInPosition = false; - bArlosInPosition = false; - bLeryssaInPosition = false; - bTalbotInPosition = false; + bool bArthasInPosition; + bool bArlosInPosition; + bool bLeryssaInPosition; + bool bTalbotInPosition; - uiPhase = 0; - uiPhaseTimer = 0; - } + uint32 uiPhase; + uint32 uiPhaseTimer; - void WaypointReached(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(uiPointId) + void Reset() { - case 3: - SetEscortPaused(true); - if (Creature *pArthas = me->SummonCreature(NPC_IMAGE_LICH_KING, 3730.313, 3518.689, 473.324, 1.562, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000)) - { - uiArthas = pArthas->GetGUID(); - pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pArthas->SetReactState(REACT_PASSIVE); - pArthas->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pArthas->GetMotionMaster()->MovePoint(0, 3737.374756,3564.841309,477.433014); - } - if (Creature *pTalbot = me->SummonCreature(NPC_COUNSELOR_TALBOT, 3747.23, 3614.936, 473.321, 4.462012, TEMPSUMMON_CORPSE_TIMED_DESPAWN,120000)) - { - uiTalbot = pTalbot->GetGUID(); - pTalbot->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTalbot->GetMotionMaster()->MovePoint(0, 3738.000977,3568.882080,477.433014); - } - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; + me->RestoreFaction(); + me->RemoveStandFlags(UNIT_STAND_STATE_SIT); - case 4: - SetEscortPaused(true); - uiPhase = 7; - break; - } - } + uiArthas = 0; + uiTalbot = 0; + uiLeryssa = 0; + uiArlos = 0; - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + bArthasInPosition = false; + bArlosInPosition = false; + bLeryssaInPosition = false; + bTalbotInPosition = false; - if (bArthasInPosition && bTalbotInPosition) - { - uiPhase = 1; - bArthasInPosition = false; - bTalbotInPosition = false; + uiPhase = 0; + uiPhaseTimer = 0; } - if (bArlosInPosition && bLeryssaInPosition) + void WaypointReached(uint32 uiPointId) { - bArlosInPosition = false; - bLeryssaInPosition = false; - DoScriptText(SAY_THASSARIAN_1, me); - SetEscortPaused(false); - } + Player* pPlayer = GetPlayerForEscort(); - if (uiPhaseTimer <= uiDiff) - { - Creature* pTalbot = me->GetCreature(*me, uiTalbot); - Creature* pArthas = me->GetCreature(*me, uiArthas); - switch (uiPhase) - { - case 1: - if (pTalbot) - pTalbot->SetStandState(UNIT_STAND_STATE_KNEEL); - uiPhaseTimer = 3000; - ++uiPhase; - break; + if (!pPlayer) + return; - case 2: - if (pTalbot) + switch(uiPointId) + { + case 3: + SetEscortPaused(true); + if (Creature *pArthas = me->SummonCreature(NPC_IMAGE_LICH_KING, 3730.313, 3518.689, 473.324, 1.562, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000)) { - pTalbot->UpdateEntry(NPC_PRINCE_VALANAR,ALLIANCE); - pTalbot->setFaction(14); - pTalbot->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTalbot->SetReactState(REACT_PASSIVE); + uiArthas = pArthas->GetGUID(); + pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pArthas->SetReactState(REACT_PASSIVE); + pArthas->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pArthas->GetMotionMaster()->MovePoint(0, 3737.374756,3564.841309,477.433014); } - uiPhaseTimer = 5000; - ++uiPhase; - break; - - case 3: - if (pTalbot) - DoScriptText(SAY_TALBOT_1, pTalbot); - uiPhaseTimer = 5000; - ++uiPhase; + if (Creature *pTalbot = me->SummonCreature(NPC_COUNSELOR_TALBOT, 3747.23, 3614.936, 473.321, 4.462012, TEMPSUMMON_CORPSE_TIMED_DESPAWN,120000)) + { + uiTalbot = pTalbot->GetGUID(); + pTalbot->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTalbot->GetMotionMaster()->MovePoint(0, 3738.000977,3568.882080,477.433014); + } + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; case 4: - if (pArthas) - DoScriptText(SAY_LICH_1, pArthas); - uiPhaseTimer = 5000; - ++uiPhase; + SetEscortPaused(true); + uiPhase = 7; break; + } + } - case 5: - if (pTalbot) - DoScriptText(SAY_TALBOT_2, pTalbot); - uiPhaseTimer = 5000; - ++uiPhase; - break; + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); - case 6: - if (Creature* pArlos = me->SummonCreature(NPC_GENERAL_ARLOS, 3745.527100, 3615.655029, 473.321533, 4.447805, TEMPSUMMON_CORPSE_TIMED_DESPAWN,120000)) - { - uiArlos = pArlos->GetGUID(); - pArlos->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pArlos->GetMotionMaster()->MovePoint(0, 3735.570068, 3572.419922, 477.441010); - } - if (Creature *pLeryssa = me->SummonCreature(NPC_LERYSSA, 3749.654541, 3614.959717, 473.323486, 4.524959, TEMPSUMMON_CORPSE_TIMED_DESPAWN,120000)) - { - uiLeryssa = pLeryssa->GetGUID(); - pLeryssa->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pLeryssa->SetReactState(REACT_PASSIVE); - pLeryssa->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pLeryssa->GetMotionMaster()->MovePoint(0, 3741.969971, 3571.439941, 477.441010); - } - uiPhaseTimer = 2000; - uiPhase = 0; - break; + if (bArthasInPosition && bTalbotInPosition) + { + uiPhase = 1; + bArthasInPosition = false; + bTalbotInPosition = false; + } - case 7: - DoScriptText(SAY_THASSARIAN_2, me); - uiPhaseTimer = 5000; - ++uiPhase; - break; + if (bArlosInPosition && bLeryssaInPosition) + { + bArlosInPosition = false; + bLeryssaInPosition = false; + DoScriptText(SAY_THASSARIAN_1, me); + SetEscortPaused(false); + } - case 8: - if (pArthas && pTalbot) - { - pArthas->SetInFront(me); //The client doesen't update with the new orientation :l - pTalbot->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LICH_2, pArthas); - } - uiPhaseTimer = 5000; - uiPhase = 9; - break; + if (uiPhaseTimer <= uiDiff) + { + Creature* pTalbot = me->GetCreature(*me, uiTalbot); + Creature* pArthas = me->GetCreature(*me, uiArthas); + switch (uiPhase) + { + case 1: + if (pTalbot) + pTalbot->SetStandState(UNIT_STAND_STATE_KNEEL); + uiPhaseTimer = 3000; + ++uiPhase; + break; - case 9: - DoScriptText(SAY_THASSARIAN_3, me); - uiPhaseTimer = 5000; - uiPhase = 10; - break; + case 2: + if (pTalbot) + { + pTalbot->UpdateEntry(NPC_PRINCE_VALANAR,ALLIANCE); + pTalbot->setFaction(14); + pTalbot->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTalbot->SetReactState(REACT_PASSIVE); + } + uiPhaseTimer = 5000; + ++uiPhase; + break; - case 10: - if (pTalbot) - DoScriptText(SAY_TALBOT_3, pTalbot); - uiPhaseTimer = 5000; - uiPhase = 11; - break; + case 3: + if (pTalbot) + DoScriptText(SAY_TALBOT_1, pTalbot); + uiPhaseTimer = 5000; + ++uiPhase; + break; - case 11: - if (pArthas) - DoScriptText(SAY_LICH_3, pArthas); - uiPhaseTimer = 5000; - uiPhase = 12; - break; + case 4: + if (pArthas) + DoScriptText(SAY_LICH_1, pArthas); + uiPhaseTimer = 5000; + ++uiPhase; + break; - case 12: - if (pTalbot) - DoScriptText(SAY_TALBOT_4, pTalbot); - uiPhaseTimer = 2000; - uiPhase = 13; - break; + case 5: + if (pTalbot) + DoScriptText(SAY_TALBOT_2, pTalbot); + uiPhaseTimer = 5000; + ++uiPhase; + break; - case 13: - if (pArthas) - pArthas->RemoveFromWorld(); - ++uiPhase; - break; + case 6: + if (Creature* pArlos = me->SummonCreature(NPC_GENERAL_ARLOS, 3745.527100, 3615.655029, 473.321533, 4.447805, TEMPSUMMON_CORPSE_TIMED_DESPAWN,120000)) + { + uiArlos = pArlos->GetGUID(); + pArlos->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pArlos->GetMotionMaster()->MovePoint(0, 3735.570068, 3572.419922, 477.441010); + } + if (Creature *pLeryssa = me->SummonCreature(NPC_LERYSSA, 3749.654541, 3614.959717, 473.323486, 4.524959, TEMPSUMMON_CORPSE_TIMED_DESPAWN,120000)) + { + uiLeryssa = pLeryssa->GetGUID(); + pLeryssa->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pLeryssa->SetReactState(REACT_PASSIVE); + pLeryssa->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pLeryssa->GetMotionMaster()->MovePoint(0, 3741.969971, 3571.439941, 477.441010); + } + uiPhaseTimer = 2000; + uiPhase = 0; + break; - case 14: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pTalbot) - { - pTalbot->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTalbot->SetReactState(REACT_AGGRESSIVE); - pTalbot->CastSpell(me, SPELL_SHADOW_BOLT, false); - } - uiPhaseTimer = 1500; - ++uiPhase; - break; + case 7: + DoScriptText(SAY_THASSARIAN_2, me); + uiPhaseTimer = 5000; + ++uiPhase; + break; - case 15: - me->SetReactState(REACT_AGGRESSIVE); - AttackStart(pTalbot); - uiPhase = 0; - break; + case 8: + if (pArthas && pTalbot) + { + pArthas->SetInFront(me); //The client doesen't update with the new orientation :l + pTalbot->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LICH_2, pArthas); + } + uiPhaseTimer = 5000; + uiPhase = 9; + break; - case 16: - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - uiPhaseTimer = 20000; - ++uiPhase; - break; + case 9: + DoScriptText(SAY_THASSARIAN_3, me); + uiPhaseTimer = 5000; + uiPhase = 10; + break; - case 17: - if (Creature* pLeryssa = me->GetCreature(*me, uiLeryssa)) - pLeryssa->RemoveFromWorld(); - if (Creature* pArlos= me->GetCreature(*me, uiArlos)) - pArlos->RemoveFromWorld(); - if (pTalbot) - pTalbot->RemoveFromWorld(); - me->RemoveStandFlags(UNIT_STAND_STATE_SIT); - SetEscortPaused(false); - uiPhaseTimer = 0; - uiPhase = 0; - } - } else uiPhaseTimer -= uiDiff; + case 10: + if (pTalbot) + DoScriptText(SAY_TALBOT_3, pTalbot); + uiPhaseTimer = 5000; + uiPhase = 11; + break; - if (!UpdateVictim()) - return; + case 11: + if (pArthas) + DoScriptText(SAY_LICH_3, pArthas); + uiPhaseTimer = 5000; + uiPhase = 12; + break; - DoMeleeAttackIfReady(); - } + case 12: + if (pTalbot) + DoScriptText(SAY_TALBOT_4, pTalbot); + uiPhaseTimer = 2000; + uiPhase = 13; + break; - void JustDied(Unit* /*pKiller*/) - { - if (Creature* pTalbot = me->GetCreature(*me, uiTalbot)) - pTalbot->RemoveFromWorld(); + case 13: + if (pArthas) + pArthas->RemoveFromWorld(); + ++uiPhase; + break; - if (Creature* pLeryssa = me->GetCreature(*me, uiLeryssa)) - pLeryssa->RemoveFromWorld(); + case 14: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pTalbot) + { + pTalbot->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTalbot->SetReactState(REACT_AGGRESSIVE); + pTalbot->CastSpell(me, SPELL_SHADOW_BOLT, false); + } + uiPhaseTimer = 1500; + ++uiPhase; + break; - if (Creature* pArlos = me->GetCreature(*me, uiArlos)) - pArlos->RemoveFromWorld(); + case 15: + me->SetReactState(REACT_AGGRESSIVE); + AttackStart(pTalbot); + uiPhase = 0; + break; - if (Creature* pArthas = me->GetCreature(*me, uiArthas)) - pArthas->RemoveFromWorld(); - } -}; + case 16: + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + uiPhaseTimer = 20000; + ++uiPhase; + break; -bool GossipHello_npc_thassarian(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + case 17: + if (Creature* pLeryssa = me->GetCreature(*me, uiLeryssa)) + pLeryssa->RemoveFromWorld(); + if (Creature* pArlos= me->GetCreature(*me, uiArlos)) + pArlos->RemoveFromWorld(); + if (pTalbot) + pTalbot->RemoveFromWorld(); + me->RemoveStandFlags(UNIT_STAND_STATE_SIT); + SetEscortPaused(false); + uiPhaseTimer = 0; + uiPhase = 0; + } + } else uiPhaseTimer -= uiDiff; - if (pPlayer->GetQuestStatus(QUEST_LAST_RITES) == QUEST_STATUS_INCOMPLETE && pCreature->GetAreaId() == 4125) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_T, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (!UpdateVictim()) + return; - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + DoMeleeAttackIfReady(); + } - return true; -} + void JustDied(Unit* /*pKiller*/) + { + if (Creature* pTalbot = me->GetCreature(*me, uiTalbot)) + pTalbot->RemoveFromWorld(); -bool GossipSelect_npc_thassarian(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + if (Creature* pLeryssa = me->GetCreature(*me, uiLeryssa)) + pLeryssa->RemoveFromWorld(); + + if (Creature* pArlos = me->GetCreature(*me, uiArlos)) + pArlos->RemoveFromWorld(); + + if (Creature* pArthas = me->GetCreature(*me, uiArthas)) + pArthas->RemoveFromWorld(); + } + }; + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF+1: - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(200.0f); - break; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_LAST_RITES) == QUEST_STATUS_INCOMPLETE && pCreature->GetAreaId() == 4125) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_T, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} -CreatureAI* GetAI_npc_thassarian(Creature *pCreature) -{ - return new npc_thassarianAI (pCreature); -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(200.0f); + break; + } + return true; + } + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_thassarianAI(creature); + } +}; /*###### ## npc_image_lich_king ######*/ -struct npc_image_lich_kingAI : public ScriptedAI +class npc_image_lich_king : public CreatureScript { - npc_image_lich_kingAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_image_lich_king() : CreatureScript("npc_image_lich_king") { } - void Reset() + struct npc_image_lich_kingAI : public ScriptedAI { - me->RestoreFaction(); - } + npc_image_lich_kingAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + void Reset() + { + me->RestoreFaction(); + } - if (me->isSummon()) - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) - CAST_AI(npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bArthasInPosition = true; + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; + + if (me->isSummon()) + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + CAST_AI(npc_thassarian::npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bArthasInPosition = true; + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_image_lich_kingAI(creature); } }; -CreatureAI* GetAI_npc_image_lich_king(Creature* pCreature) -{ - return new npc_image_lich_kingAI (pCreature); -} - /*###### ## npc_general_arlos ######*/ -struct npc_general_arlosAI : public ScriptedAI +class npc_general_arlos : public CreatureScript { - npc_general_arlosAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_general_arlos() : CreatureScript("npc_general_arlos") { } - void MovementInform(uint32 uiType, uint32 /*uiId*/) + struct npc_general_arlosAI : public ScriptedAI { - if (uiType != POINT_MOTION_TYPE) - return; - - me->addUnitState(UNIT_STAT_STUNNED); - me->CastSpell(me, SPELL_STUN, true); - if (me->isSummon()) - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) - CAST_AI(npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bArlosInPosition = true; + npc_general_arlosAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; + + me->addUnitState(UNIT_STAT_STUNNED); + me->CastSpell(me, SPELL_STUN, true); + if (me->isSummon()) + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + CAST_AI(npc_thassarian::npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bArlosInPosition = true; + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_general_arlosAI(creature); } }; -CreatureAI* GetAI_npc_general_arlos(Creature *pCreature) -{ - return new npc_general_arlosAI(pCreature); -} - /*###### ## npc_counselor_talbot ######*/ @@ -1253,227 +1348,239 @@ enum eCounselorTalbot SPELL_SOUL_BLAST = 50992, }; -struct npc_counselor_talbotAI : public ScriptedAI +class npc_counselor_talbot : public CreatureScript { - npc_counselor_talbotAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pCreature->RestoreFaction(); - } - - uint64 LeryssaGUID; - uint64 ArlosGUID; +public: + npc_counselor_talbot() : CreatureScript("npc_counselor_talbot") { } - bool bCheck; + struct npc_counselor_talbotAI : public ScriptedAI + { + npc_counselor_talbotAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pCreature->RestoreFaction(); + } - uint32 uiShadowBoltTimer; - uint32 uiDeflectionTimer; - uint32 uiSoulBlastTimer; + uint64 LeryssaGUID; + uint64 ArlosGUID; - void Reset() - { - LeryssaGUID = 0; - ArlosGUID = 0; - bCheck = false; - uiShadowBoltTimer = urand(5000,12000); - uiDeflectionTimer = urand(20000,25000); - uiSoulBlastTimer = urand (12000,18000); - } - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + bool bCheck; - if (me->isSummon()) - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) - CAST_AI(npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bTalbotInPosition = true; - } + uint32 uiShadowBoltTimer; + uint32 uiDeflectionTimer; + uint32 uiSoulBlastTimer; - void UpdateAI(const uint32 uiDiff) - { - if (bCheck) + void Reset() { - if (Creature *pLeryssa = me->FindNearestCreature(NPC_LERYSSA, 50.0f, true)) - LeryssaGUID = pLeryssa->GetGUID(); - if (Creature *pArlos = me->FindNearestCreature(NPC_GENERAL_ARLOS, 50.0f, true)) - ArlosGUID = pArlos->GetGUID(); - bCheck = false; + LeryssaGUID = 0; + ArlosGUID = 0; + bCheck = false; + uiShadowBoltTimer = urand(5000,12000); + uiDeflectionTimer = urand(20000,25000); + uiSoulBlastTimer = urand (12000,18000); } + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; - if (!UpdateVictim()) - return; + if (me->isSummon()) + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + CAST_AI(npc_thassarian::npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bTalbotInPosition = true; + } - if (me->GetAreaId() == 4125) + void UpdateAI(const uint32 uiDiff) { - if (uiShadowBoltTimer <= uiDiff) + if (bCheck) { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - uiShadowBoltTimer = urand(5000,12000); - } else uiShadowBoltTimer -= uiDiff; + if (Creature *pLeryssa = me->FindNearestCreature(NPC_LERYSSA, 50.0f, true)) + LeryssaGUID = pLeryssa->GetGUID(); + if (Creature *pArlos = me->FindNearestCreature(NPC_GENERAL_ARLOS, 50.0f, true)) + ArlosGUID = pArlos->GetGUID(); + bCheck = false; + } - if (uiDeflectionTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_DEFLECTION); - uiDeflectionTimer = urand(20000,25000); - } else uiDeflectionTimer -= uiDiff; + if (!UpdateVictim()) + return; - if (uiSoulBlastTimer <= uiDiff) + if (me->GetAreaId() == 4125) { - DoCast(me->getVictim(), SPELL_SOUL_BLAST); - uiSoulBlastTimer = urand (12000,18000); - } else uiSoulBlastTimer -= uiDiff; - } - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* pKiller) - { - if (!LeryssaGUID || !ArlosGUID) - return; - - Creature *pLeryssa = Unit::GetCreature(*me, LeryssaGUID); - Creature *pArlos = Unit::GetCreature(*me, ArlosGUID); - if (!pLeryssa || !pArlos) - return; - - DoScriptText(SAY_ARLOS_1, pArlos); - DoScriptText(SAY_ARLOS_2, pArlos); - DoScriptText(SAY_LERYSSA_1, pLeryssa); - pArlos->Kill(pArlos, false); - pLeryssa->RemoveAura(SPELL_STUN); - pLeryssa->clearUnitState(UNIT_STAT_STUNNED); - pLeryssa->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pLeryssa->GetMotionMaster()->MovePoint(0,3722.114502, 3564.201660, 477.441437); - - if (pKiller->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pKiller)->RewardPlayerAndGroupAtEvent(NPC_PRINCE_VALANAR, 0); + if (uiShadowBoltTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + uiShadowBoltTimer = urand(5000,12000); + } else uiShadowBoltTimer -= uiDiff; + + if (uiDeflectionTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_DEFLECTION); + uiDeflectionTimer = urand(20000,25000); + } else uiDeflectionTimer -= uiDiff; + + if (uiSoulBlastTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SOUL_BLAST); + uiSoulBlastTimer = urand (12000,18000); + } else uiSoulBlastTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* pKiller) + { + if (!LeryssaGUID || !ArlosGUID) + return; + + Creature *pLeryssa = Unit::GetCreature(*me, LeryssaGUID); + Creature *pArlos = Unit::GetCreature(*me, ArlosGUID); + if (!pLeryssa || !pArlos) + return; + + DoScriptText(SAY_ARLOS_1, pArlos); + DoScriptText(SAY_ARLOS_2, pArlos); + DoScriptText(SAY_LERYSSA_1, pLeryssa); + pArlos->Kill(pArlos, false); + pLeryssa->RemoveAura(SPELL_STUN); + pLeryssa->clearUnitState(UNIT_STAT_STUNNED); + pLeryssa->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pLeryssa->GetMotionMaster()->MovePoint(0,3722.114502, 3564.201660, 477.441437); + + if (pKiller->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pKiller)->RewardPlayerAndGroupAtEvent(NPC_PRINCE_VALANAR, 0); + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_counselor_talbotAI(creature); } }; -CreatureAI* GetAI_npc_counselor_talbot(Creature* pCreature) -{ - return new npc_counselor_talbotAI (pCreature); -} - /*###### ## npc_leryssa ######*/ -struct npc_leryssaAI : public ScriptedAI +class npc_leryssa : public CreatureScript { - npc_leryssaAI(Creature* pCreature) : ScriptedAI(pCreature) - { - bDone = false; - Phase = 0; - uiPhaseTimer = 0; +public: + npc_leryssa() : CreatureScript("npc_leryssa") { } - pCreature->RemoveStandFlags(UNIT_STAND_STATE_SIT); - } + struct npc_leryssaAI : public ScriptedAI + { + npc_leryssaAI(Creature* pCreature) : ScriptedAI(pCreature) + { + bDone = false; + Phase = 0; + uiPhaseTimer = 0; - bool bDone; + pCreature->RemoveStandFlags(UNIT_STAND_STATE_SIT); + } - uint32 Phase; - uint32 uiPhaseTimer; + bool bDone; - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + uint32 Phase; + uint32 uiPhaseTimer; - if (!bDone) + void MovementInform(uint32 uiType, uint32 /*uiId*/) { - if (Creature* pTalbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true)) - CAST_AI(npc_counselor_talbotAI, pTalbot->AI())->bCheck = true; + if (uiType != POINT_MOTION_TYPE) + return; - me->addUnitState(UNIT_STAT_STUNNED); - me->CastSpell(me, SPELL_STUN, true); + if (!bDone) + { + if (Creature* pTalbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true)) + CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, pTalbot->AI())->bCheck = true; - if (me->isSummon()) - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) - CAST_AI(npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bLeryssaInPosition = true; - bDone = true; - } - else - { - me->SetStandState(UNIT_STAND_STATE_SIT); - if (me->isSummon()) - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) - pSummoner->SetStandState(UNIT_STAND_STATE_SIT); - uiPhaseTimer = 1500; - Phase = 1; - } - } + me->addUnitState(UNIT_STAT_STUNNED); + me->CastSpell(me, SPELL_STUN, true); - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); + if (me->isSummon()) + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + CAST_AI(npc_thassarian::npc_thassarianAI,CAST_CRE(pSummoner)->AI())->bLeryssaInPosition = true; + bDone = true; + } + else + { + me->SetStandState(UNIT_STAND_STATE_SIT); + if (me->isSummon()) + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + pSummoner->SetStandState(UNIT_STAND_STATE_SIT); + uiPhaseTimer = 1500; + Phase = 1; + } + } - if (uiPhaseTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - switch (Phase) + ScriptedAI::UpdateAI(uiDiff); + + if (uiPhaseTimer <= uiDiff) { - case 1: - if (me->isSummon()) - if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) - DoScriptText(SAY_THASSARIAN_4, pThassarian); - uiPhaseTimer = 5000; - ++Phase; - break; - case 2: - DoScriptText(SAY_LERYSSA_2, me); - uiPhaseTimer = 5000; - ++Phase; - break; - case 3: - if (me->isSummon()) - if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) - DoScriptText(SAY_THASSARIAN_5, pThassarian); - uiPhaseTimer = 5000; - ++Phase; - break; - case 4: - DoScriptText(SAY_LERYSSA_3, me); - uiPhaseTimer = 5000; - ++Phase; - break; - case 5: - if (me->isSummon()) - if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) - DoScriptText(SAY_THASSARIAN_6, pThassarian); - uiPhaseTimer = 5000; - ++Phase; - break; + switch (Phase) + { + case 1: + if (me->isSummon()) + if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) + DoScriptText(SAY_THASSARIAN_4, pThassarian); + uiPhaseTimer = 5000; + ++Phase; + break; + case 2: + DoScriptText(SAY_LERYSSA_2, me); + uiPhaseTimer = 5000; + ++Phase; + break; + case 3: + if (me->isSummon()) + if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) + DoScriptText(SAY_THASSARIAN_5, pThassarian); + uiPhaseTimer = 5000; + ++Phase; + break; + case 4: + DoScriptText(SAY_LERYSSA_3, me); + uiPhaseTimer = 5000; + ++Phase; + break; + case 5: + if (me->isSummon()) + if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) + DoScriptText(SAY_THASSARIAN_6, pThassarian); + uiPhaseTimer = 5000; + ++Phase; + break; - case 6: - DoScriptText(SAY_LERYSSA_4, me); - uiPhaseTimer = 5000; - ++Phase; - break; - case 7: - if (me->isSummon()) - if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) - { - DoScriptText(SAY_THASSARIAN_7, pThassarian); - CAST_AI(npc_thassarianAI,CAST_CRE(pThassarian)->AI())->uiPhase = 16; - } - uiPhaseTimer = 5000; - Phase = 0; - break; - } - } else uiPhaseTimer -= uiDiff; + case 6: + DoScriptText(SAY_LERYSSA_4, me); + uiPhaseTimer = 5000; + ++Phase; + break; + case 7: + if (me->isSummon()) + if (Unit* pThassarian = CAST_SUM(me)->GetSummoner()) + { + DoScriptText(SAY_THASSARIAN_7, pThassarian); + CAST_AI(npc_thassarian::npc_thassarianAI,CAST_CRE(pThassarian)->AI())->uiPhase = 16; + } + uiPhaseTimer = 5000; + Phase = 0; + break; + } + } else uiPhaseTimer -= uiDiff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); + CreatureAI *GetAI(Creature *creature) const + { + return new npc_leryssaAI(creature); } }; -CreatureAI* GetAI_npc_leryssa(Creature *pCreature) -{ - return new npc_leryssaAI (pCreature); -} - /*###### ## npc_beryl_sorcerer ######*/ @@ -1488,63 +1595,69 @@ enum eBerylSorcerer SPELL_COSMETIC_ENSLAVE_CHAINS_SELF = 45631 }; -struct npc_beryl_sorcererAI : public FollowerAI +class npc_beryl_sorcerer : public CreatureScript { - npc_beryl_sorcererAI(Creature* pCreature) : FollowerAI(pCreature) {} +public: + npc_beryl_sorcerer() : CreatureScript("npc_beryl_sorcerer") { } - bool bEnslaved; - - void Reset() + struct npc_beryl_sorcererAI : public FollowerAI { - me->SetReactState(REACT_AGGRESSIVE); - bEnslaved = false; - } + npc_beryl_sorcererAI(Creature* pCreature) : FollowerAI(pCreature) {} - void EnterCombat(Unit* pWho) - { - if (me->canAttack(pWho)) - AttackStart(pWho); - } + bool bEnslaved; - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_ARCANE_CHAINS && pCaster->GetTypeId() == TYPEID_PLAYER && me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !bEnslaved) + void Reset() { - EnterEvadeMode(); //We make sure that the npc is not attacking the player! - me->SetReactState(REACT_PASSIVE); - StartFollow(CAST_PLR(pCaster), NULL, NULL); - me->UpdateEntry(NPC_CAPTURED_BERLY_SORCERER, TEAM_NEUTRAL); - DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF, true); - CAST_PLR(pCaster)->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER, 0); - bEnslaved = true; + me->SetReactState(REACT_AGGRESSIVE); + bEnslaved = false; } - } - void MoveInLineOfSight(Unit* pWho) - { - FollowerAI::MoveInLineOfSight(pWho); + void EnterCombat(Unit* pWho) + { + if (me->canAttack(pWho)) + AttackStart(pWho); + } - if (pWho->GetEntry() == NPC_LIBRARIAN_DONATHAN && me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { - SetFollowComplete(); - me->DisappearAndDie(); + if (pSpell->Id == SPELL_ARCANE_CHAINS && pCaster->GetTypeId() == TYPEID_PLAYER && me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !bEnslaved) + { + EnterEvadeMode(); //We make sure that the npc is not attacking the player! + me->SetReactState(REACT_PASSIVE); + StartFollow(CAST_PLR(pCaster), NULL, NULL); + me->UpdateEntry(NPC_CAPTURED_BERLY_SORCERER, TEAM_NEUTRAL); + DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF, true); + CAST_PLR(pCaster)->KilledMonsterCredit(NPC_CAPTURED_BERLY_SORCERER, 0); + bEnslaved = true; + } } - } - void UpdateAI(const uint32 /*uiDiff*/) - { - if (!UpdateVictim()) - return; + void MoveInLineOfSight(Unit* pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + + if (pWho->GetEntry() == NPC_LIBRARIAN_DONATHAN && me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + { + SetFollowComplete(); + me->DisappearAndDie(); + } + } + + void UpdateAI(const uint32 /*uiDiff*/) + { + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *GetAI(Creature *creature) + { + return new npc_beryl_sorcererAI(creature); } }; -CreatureAI* GetAI_npc_beryl_sorcerer(Creature* pCreature) -{ - return new npc_beryl_sorcererAI(pCreature); -} - /*###### ## npc_imprisoned_beryl_sorcerer ######*/ @@ -1564,116 +1677,122 @@ enum eImprisionedBerylSorcerer SAY_IMPRISIONED_BERYL_7 = -1571030, }; -struct npc_imprisoned_beryl_sorcererAI : public ScriptedAI +class npc_imprisoned_beryl_sorcerer : public CreatureScript { - npc_imprisoned_beryl_sorcererAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_imprisoned_beryl_sorcerer() : CreatureScript("npc_imprisoned_beryl_sorcerer") { } - uint64 CasterGUID; + struct npc_imprisoned_beryl_sorcererAI : public ScriptedAI + { + npc_imprisoned_beryl_sorcererAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint32 uiStep; - uint32 uiPhase; + uint64 CasterGUID; - void Reset() - { - uiStep = 1; - uiPhase = 0; - CasterGUID = NULL; - } + uint32 uiStep; + uint32 uiPhase; - void EnterCombat(Unit* /*pWho*/) - { - } + void Reset() + { + uiStep = 1; + uiPhase = 0; + CasterGUID = NULL; + } - void SpellHit(Unit* pUnit, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_NEURAL_NEEDLE && pUnit->GetTypeId() == TYPEID_PLAYER) + void EnterCombat(Unit* /*pWho*/) { - ++uiPhase; - CasterGUID = pUnit->GetGUID(); } - } - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); + void SpellHit(Unit* pUnit, const SpellEntry* pSpell) + { + if (pSpell->Id == SPELL_NEURAL_NEEDLE && pUnit->GetTypeId() == TYPEID_PLAYER) + { + ++uiPhase; + CasterGUID = pUnit->GetGUID(); + } + } - if (!me->HasAura(SPELL_COSMETIC_ENSLAVE_CHAINS_SELF)) - DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF); + void UpdateAI(const uint32 uiDiff) + { + ScriptedAI::UpdateAI(uiDiff); - if (me->GetReactState() != REACT_PASSIVE) - me->SetReactState(REACT_PASSIVE); + if (!me->HasAura(SPELL_COSMETIC_ENSLAVE_CHAINS_SELF)) + DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF); - switch (uiPhase) - { - case 1: - if (uiStep == 1) - { - DoScriptText(SAY_IMPRISIONED_BERYL_1, me); - uiStep = 2; - } - break; + if (me->GetReactState() != REACT_PASSIVE) + me->SetReactState(REACT_PASSIVE); - case 2: - if (uiStep == 2) - { - DoScriptText(SAY_IMPRISIONED_BERYL_2, me); - uiStep = 3; - } - break; + switch (uiPhase) + { + case 1: + if (uiStep == 1) + { + DoScriptText(SAY_IMPRISIONED_BERYL_1, me); + uiStep = 2; + } + break; - case 3: - if (uiStep == 3) - { - DoScriptText(SAY_IMPRISIONED_BERYL_3, me); - uiStep = 4; - } - break; + case 2: + if (uiStep == 2) + { + DoScriptText(SAY_IMPRISIONED_BERYL_2, me); + uiStep = 3; + } + break; - case 4: - if (uiStep == 4) - { - DoScriptText(SAY_IMPRISIONED_BERYL_4, me); - uiStep = 5; - } - break; + case 3: + if (uiStep == 3) + { + DoScriptText(SAY_IMPRISIONED_BERYL_3, me); + uiStep = 4; + } + break; - case 5: - if (uiStep == 5) - { - if (Player *pCaster = Unit::GetPlayer(*me, CasterGUID)) + case 4: + if (uiStep == 4) { - DoScriptText(SAY_IMPRISIONED_BERYL_5, me); - pCaster->KilledMonsterCredit(25478,0); - uiStep = 6; + DoScriptText(SAY_IMPRISIONED_BERYL_4, me); + uiStep = 5; } - } - break; + break; - case 6: - if (uiStep == 6) - { - DoScriptText(SAY_IMPRISIONED_BERYL_6, me); - uiStep = 7; - } - break; + case 5: + if (uiStep == 5) + { + if (Player *pCaster = Unit::GetPlayer(*me, CasterGUID)) + { + DoScriptText(SAY_IMPRISIONED_BERYL_5, me); + pCaster->KilledMonsterCredit(25478,0); + uiStep = 6; + } + } + break; - case 7: - if (uiStep == 7) - { - DoScriptText(SAY_IMPRISIONED_BERYL_7, me); - uiStep = 1; - uiPhase = 0; - } - break; + case 6: + if (uiStep == 6) + { + DoScriptText(SAY_IMPRISIONED_BERYL_6, me); + uiStep = 7; + } + break; + + case 7: + if (uiStep == 7) + { + DoScriptText(SAY_IMPRISIONED_BERYL_7, me); + uiStep = 1; + uiPhase = 0; + } + break; + } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_imprisoned_beryl_sorcererAI(creature); } }; -CreatureAI* GetAI_npc_imprisoned_beryl_sorcerer(Creature* pCreature) -{ - return new npc_imprisoned_beryl_sorcererAI(pCreature); -} - /*###### ## npc_mootoo_the_younger ######*/ @@ -1690,75 +1809,84 @@ enum Mootoo_the_Younger_Entries NPC_MOOTOO_THE_YOUNGER =25504, QUEST_ESCAPING_THE_MIST =11664 }; -bool QuestAccept_npc_mootoo_the_younger(Player* pPlayer, Creature* pCreature, Quest const* quest) + +class npc_mootoo_the_younger : public CreatureScript { - if (quest->GetQuestId() == QUEST_ESCAPING_THE_MIST) +public: + npc_mootoo_the_younger() : CreatureScript("npc_mootoo_the_younger") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - switch (pPlayer->GetTeam()) + if (quest->GetQuestId() == QUEST_ESCAPING_THE_MIST) { - case ALLIANCE: - pCreature->setFaction(FACTION_ESCORTEE_A); - break; - case HORDE: - pCreature->setFaction(FACTION_ESCORTEE_H); - break; + switch (pPlayer->GetTeam()) + { + case ALLIANCE: + pCreature->setFaction(FACTION_ESCORTEE_A); + break; + case HORDE: + pCreature->setFaction(FACTION_ESCORTEE_H); + break; + } + DoScriptText(SAY_1, pCreature); + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); } - DoScriptText(SAY_1, pCreature); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + return true; } - return true; -} -struct npc_mootoo_the_youngerAI : public npc_escortAI -{ - npc_mootoo_the_youngerAI(Creature *c) : npc_escortAI(c) {} - void Reset() + struct npc_mootoo_the_youngerAI : public npc_escortAI { - SetDespawnAtFar(false); - } + npc_mootoo_the_youngerAI(Creature *c) : npc_escortAI(c) {} - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer=GetPlayerForEscort()) - pPlayer->FailQuest(QUEST_ESCAPING_THE_MIST); - } + void Reset() + { + SetDespawnAtFar(false); + } - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) - { - case 10: - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - DoScriptText(SAY_2, me); - break; - case 12: - DoScriptText(SAY_3, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT); - break; - case 16: - DoScriptText(SAY_4, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - break; - case 20: - me->SetPhaseMask(1,true); - DoScriptText(SAY_5, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me); - SetRun(true); - break; + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer=GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_ESCAPING_THE_MIST); + } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 10: + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + DoScriptText(SAY_2, me); + break; + case 12: + DoScriptText(SAY_3, me); + me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT); + break; + case 16: + DoScriptText(SAY_4, me); + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + break; + case 20: + me->SetPhaseMask(1,true); + DoScriptText(SAY_5, me); + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me); + SetRun(true); + break; + } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_mootoo_the_youngerAI(creature); } }; -CreatureAI* GetAI_npc_mootoo_the_younger(Creature* pCreature) -{ - return new npc_mootoo_the_youngerAI(pCreature); -} /*###### ## npc_bonker_togglevolt @@ -1775,77 +1903,84 @@ enum Script_Texts_Bonker_Togglevolt SAY_bonker_2 =-1700003 }; -bool QuestAccept_npc_bonker_togglevolt(Player* pPlayer, Creature* pCreature, Quest const* quest) +class npc_bonker_togglevolt : public CreatureScript { - if (quest->GetQuestId() == QUEST_GET_ME_OUTA_HERE) +public: + npc_bonker_togglevolt() : CreatureScript("npc_bonker_togglevolt") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - switch (pPlayer->GetTeam()) + if (quest->GetQuestId() == QUEST_GET_ME_OUTA_HERE) { - case ALLIANCE: - pCreature->setFaction(FACTION_ESCORTEE_A); - break; - case HORDE: - pCreature->setFaction(FACTION_ESCORTEE_H); - break; + switch (pPlayer->GetTeam()) + { + case ALLIANCE: + pCreature->setFaction(FACTION_ESCORTEE_A); + break; + case HORDE: + pCreature->setFaction(FACTION_ESCORTEE_H); + break; + } + DoScriptText(SAY_bonker_2, pCreature, pPlayer); + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, true, pPlayer->GetGUID()); } - DoScriptText(SAY_bonker_2, pCreature, pPlayer); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, true, pPlayer->GetGUID()); + return true; } - return true; -} -struct npc_bonker_togglevoltAI : public npc_escortAI -{ - npc_bonker_togglevoltAI(Creature *c) : npc_escortAI(c) {} - uint32 Bonker_agro; - void Reset() + struct npc_bonker_togglevoltAI : public npc_escortAI { - Bonker_agro=0; - SetDespawnAtFar(false); - } + npc_bonker_togglevoltAI(Creature *c) : npc_escortAI(c) {} + uint32 Bonker_agro; - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->FailQuest(QUEST_ESCAPING_THE_MIST); - } + void Reset() + { + Bonker_agro=0; + SetDespawnAtFar(false); + } - void UpdateEscortAI(const uint32 /*diff*/) - { - if (GetAttack() && UpdateVictim()) + void JustDied(Unit* /*killer*/) { - if (Bonker_agro == 0) + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_ESCAPING_THE_MIST); + } + + void UpdateEscortAI(const uint32 /*diff*/) + { + if (GetAttack() && UpdateVictim()) { - DoScriptText(SAY_bonker_1,me); - Bonker_agro++; + if (Bonker_agro == 0) + { + DoScriptText(SAY_bonker_1,me); + Bonker_agro++; + } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); + else Bonker_agro=0; } - else Bonker_agro=0; - } - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; + if (!pPlayer) + return; - switch(i) - { - case 29: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_GET_ME_OUTA_HERE, me); - break; + switch(i) + { + case 29: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_GET_ME_OUTA_HERE, me); + break; + } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_bonker_togglevoltAI(creature); } }; -CreatureAI* GetAI_npc_bonker_togglevolt(Creature* pCreature) -{ - return new npc_bonker_togglevoltAI(pCreature); -} - /*###### ## Help Those That Cannot Help Themselves, Quest 11876 ######*/ @@ -1887,75 +2022,81 @@ const uint32 MammothTraps[MammothTrapsNum] = GO_MAMMOTH_TRAP_21, GO_MAMMOTH_TRAP_22 }; -struct npc_trapped_mammoth_calfAI : public ScriptedAI +class npc_trapped_mammoth_calf : public CreatureScript { - npc_trapped_mammoth_calfAI(Creature* c) : ScriptedAI(c) {} +public: + npc_trapped_mammoth_calf() : CreatureScript("npc_trapped_mammoth_calf") { } - uint32 uiTimer; - bool bStarted; - - void Reset() + struct npc_trapped_mammoth_calfAI : public ScriptedAI { - uiTimer = 1500; - bStarted = false; + npc_trapped_mammoth_calfAI(Creature* c) : ScriptedAI(c) {} + + uint32 uiTimer; + bool bStarted; - GameObject* pTrap; - for (uint8 i = 0; i < MammothTrapsNum; ++i) + void Reset() { - pTrap = me->FindNearestGameObject(MammothTraps[i],11.0f); - if (pTrap) + uiTimer = 1500; + bStarted = false; + + GameObject* pTrap; + for (uint8 i = 0; i < MammothTrapsNum; ++i) { - pTrap->SetGoState(GO_STATE_ACTIVE); - return; + pTrap = me->FindNearestGameObject(MammothTraps[i],11.0f); + if (pTrap) + { + pTrap->SetGoState(GO_STATE_ACTIVE); + return; + } } } - } - void UpdateAI(const uint32 diff) - { - if (bStarted) + void UpdateAI(const uint32 diff) { - if (uiTimer <= diff) + if (bStarted) { - Position pos; - me->GetRandomNearPosition(pos, 10.0f); - me->GetMotionMaster()->MovePoint(0,pos); - bStarted = false; + if (uiTimer <= diff) + { + Position pos; + me->GetRandomNearPosition(pos, 10.0f); + me->GetMotionMaster()->MovePoint(0,pos); + bStarted = false; + } + else uiTimer -= diff; } - else uiTimer -= diff; } - } - - void DoAction(const int32 param) - { - if (param == 1) - bStarted = true; - } - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { + void DoAction(const int32 param) + { + if (param == 1) + bStarted = true; + } - if (uiType != POINT_MOTION_TYPE) - return; - me->DisappearAndDie(); - GameObject* pTrap; - for (uint8 i = 0; i < MammothTrapsNum; ++i) + void MovementInform(uint32 uiType, uint32 /*uiId*/) { - pTrap = me->FindNearestGameObject(MammothTraps[i],11.0f); - if (pTrap) - { - pTrap->SetLootState(GO_JUST_DEACTIVATED); + + if (uiType != POINT_MOTION_TYPE) return; + me->DisappearAndDie(); + GameObject* pTrap; + for (uint8 i = 0; i < MammothTrapsNum; ++i) + { + pTrap = me->FindNearestGameObject(MammothTraps[i],11.0f); + if (pTrap) + { + pTrap->SetLootState(GO_JUST_DEACTIVATED); + return; + } } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_trapped_mammoth_calfAI(creature); } }; -CreatureAI* GetAI_npc_trapped_mammoth_calf(Creature* pCreature) -{ - return new npc_trapped_mammoth_calfAI(pCreature); -} - /*###### ## Quest 11653: Hah... You're Not So Big Now! ######*/ @@ -1969,29 +2110,35 @@ enum eNotSoBig SPELL_AURA_NOTSOBIG_4 = 45681 }; -struct npc_magmoth_crusherAI : public ScriptedAI +class npc_magmoth_crusher : public CreatureScript { - npc_magmoth_crusherAI(Creature* c) : ScriptedAI(c) {} +public: + npc_magmoth_crusher() : CreatureScript("npc_magmoth_crusher") { } - void JustDied(Unit *pKiller) + struct npc_magmoth_crusherAI : public ScriptedAI { - if (pKiller->GetTypeId() == TYPEID_PLAYER && - CAST_PLR(pKiller)->GetQuestStatus(QUEST_YOU_RE_NOT_SO_BIG_NOW) == QUEST_STATUS_INCOMPLETE && - (me->HasAura(SPELL_AURA_NOTSOBIG_1) || me->HasAura(SPELL_AURA_NOTSOBIG_2) || - me->HasAura(SPELL_AURA_NOTSOBIG_3) || me->HasAura(SPELL_AURA_NOTSOBIG_4))) + npc_magmoth_crusherAI(Creature* c) : ScriptedAI(c) {} + + void JustDied(Unit *pKiller) { - Quest const* qInfo = objmgr.GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); - if (qInfo) - CAST_PLR(pKiller)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0],0); + if (pKiller->GetTypeId() == TYPEID_PLAYER && + CAST_PLR(pKiller)->GetQuestStatus(QUEST_YOU_RE_NOT_SO_BIG_NOW) == QUEST_STATUS_INCOMPLETE && + (me->HasAura(SPELL_AURA_NOTSOBIG_1) || me->HasAura(SPELL_AURA_NOTSOBIG_2) || + me->HasAura(SPELL_AURA_NOTSOBIG_3) || me->HasAura(SPELL_AURA_NOTSOBIG_4))) + { + Quest const* qInfo = objmgr.GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); + if (qInfo) + CAST_PLR(pKiller)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0],0); + } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_magmoth_crusherAI(creature); } }; -CreatureAI* GetAI_npc_magmoth_crusher(Creature* pCreature) -{ - return new npc_magmoth_crusherAI(pCreature); -} - /*###### ## Quest 11608: Bury Those Cockroaches! ######*/ @@ -1999,43 +2146,49 @@ CreatureAI* GetAI_npc_magmoth_crusher(Creature* pCreature) #define QUEST_BURY_THOSE_COCKROACHES 11608 #define SPELL_SEAFORIUM_DEPTH_CHARGE_EXPLOSION 45502 -struct npc_seaforium_depth_chargeAI : public ScriptedAI +class npc_seaforium_depth_charge : public CreatureScript { - npc_seaforium_depth_chargeAI(Creature *c) : ScriptedAI(c) {} +public: + npc_seaforium_depth_charge() : CreatureScript("npc_seaforium_depth_charge") { } - uint32 uiExplosionTimer; - void Reset() - { - uiExplosionTimer = urand(5000,10000); - } - void UpdateAI(const uint32 diff) + struct npc_seaforium_depth_chargeAI : public ScriptedAI { - if (uiExplosionTimer < diff) + npc_seaforium_depth_chargeAI(Creature *c) : ScriptedAI(c) {} + + uint32 uiExplosionTimer; + void Reset() + { + uiExplosionTimer = urand(5000,10000); + } + void UpdateAI(const uint32 diff) { - DoCast(SPELL_SEAFORIUM_DEPTH_CHARGE_EXPLOSION); - for (uint8 i = 0; i < 4; ++i) + if (uiExplosionTimer < diff) { - if (Creature* cCredit = me->FindNearestCreature(25402 + i, 10.0f))//25402-25405 credit markers + DoCast(SPELL_SEAFORIUM_DEPTH_CHARGE_EXPLOSION); + for (uint8 i = 0; i < 4; ++i) { - if (Unit* uOwner = me->GetOwner()) + if (Creature* cCredit = me->FindNearestCreature(25402 + i, 10.0f))//25402-25405 credit markers { - Player* pOwner = uOwner->ToPlayer(); - if (pOwner && pOwner->GetQuestStatus(QUEST_BURY_THOSE_COCKROACHES) == QUEST_STATUS_INCOMPLETE) - pOwner->KilledMonsterCredit(cCredit->GetEntry(),cCredit->GetGUID()); + if (Unit* uOwner = me->GetOwner()) + { + Player* pOwner = uOwner->ToPlayer(); + if (pOwner && pOwner->GetQuestStatus(QUEST_BURY_THOSE_COCKROACHES) == QUEST_STATUS_INCOMPLETE) + pOwner->KilledMonsterCredit(cCredit->GetEntry(),cCredit->GetGUID()); + } } } - } - me->Kill(me); - return; - } else uiExplosionTimer -= diff; + me->Kill(me); + return; + } else uiExplosionTimer -= diff; + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_seaforium_depth_chargeAI(creature); } }; -CreatureAI* GetAI_npc_seaforium_depth_charge(Creature* pCreature) -{ - return new npc_seaforium_depth_chargeAI(pCreature); -} - /*###### ## Help Those That Cannot Help Themselves, Quest 11876 ######*/ @@ -2046,41 +2199,47 @@ enum eValiancekeepcannons GO_VALIANCE_KEEP_CANNON_2 = 188692 }; -struct npc_valiance_keep_cannoneerAI : public ScriptedAI +class npc_valiance_keep_cannoneer : public CreatureScript { - npc_valiance_keep_cannoneerAI(Creature* c) : ScriptedAI(c) {} +public: + npc_valiance_keep_cannoneer() : CreatureScript("npc_valiance_keep_cannoneer") { } - uint32 uiTimer; - - void Reset() + struct npc_valiance_keep_cannoneerAI : public ScriptedAI { - uiTimer = urand(13000,18000); - } + npc_valiance_keep_cannoneerAI(Creature* c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (uiTimer <= diff) - { - me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); - GameObject* pCannon = me->FindNearestGameObject(GO_VALIANCE_KEEP_CANNON_1,10); - if (!pCannon) - pCannon = me->FindNearestGameObject(GO_VALIANCE_KEEP_CANNON_2,10); - if (pCannon) - pCannon->Use(me); + uint32 uiTimer; + + void Reset() + { uiTimer = urand(13000,18000); } - else uiTimer -= diff; - if (!UpdateVictim()) - return; - } + void UpdateAI(const uint32 diff) + { + if (uiTimer <= diff) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); + GameObject* pCannon = me->FindNearestGameObject(GO_VALIANCE_KEEP_CANNON_1,10); + if (!pCannon) + pCannon = me->FindNearestGameObject(GO_VALIANCE_KEEP_CANNON_2,10); + if (pCannon) + pCannon->Use(me); + uiTimer = urand(13000,18000); + } + else uiTimer -= diff; -}; + if (!UpdateVictim()) + return; + } -CreatureAI* GetAI_npc_valiance_keep_cannoneer(Creature* pCreature) -{ - return new npc_valiance_keep_cannoneerAI(pCreature); -} + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_valiance_keep_cannoneerAI(creature); + } +}; /******************************************************* * npc_warmage_coldarra @@ -2099,227 +2258,120 @@ enum NPCs NPC_WARMAGE_WATKINS = 27904 }; -struct npc_warmage_coldarraAI : public Scripted_NoMovementAI +class npc_warmage_coldarra : public CreatureScript { - npc_warmage_coldarraAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature){} +public: + npc_warmage_coldarra() : CreatureScript("npc_warmage_coldarra") { } - uint32 m_uiTimer; //Timer until recast - - void Reset() + struct npc_warmage_coldarraAI : public Scripted_NoMovementAI { - m_uiTimer = 0; - } + npc_warmage_coldarraAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature){} - void EnterCombat(Unit* /*pWho*/) {} + uint32 m_uiTimer; //Timer until recast - void AttackStart(Unit* /*pWho*/) {} - - void UpdateAI(const uint32 uiDiff) - { - if (m_uiTimer <= uiDiff) + void Reset() { - std::list<Creature*> orbList; - GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f); + m_uiTimer = 0; + } + + void EnterCombat(Unit* /*pWho*/) {} + + void AttackStart(Unit* /*pWho*/) {} - switch(me->GetEntry()) + void UpdateAI(const uint32 uiDiff) + { + if (m_uiTimer <= uiDiff) { - case NPC_WARMAGE_HOLLISTER: + std::list<Creature*> orbList; + GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f); + + switch(me->GetEntry()) { - if (!orbList.empty()) + case NPC_WARMAGE_HOLLISTER: { - for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + if (!orbList.empty()) { - if (Creature* pOrb = *itr) - if (pOrb->GetPositionY() > 6680) - DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + { + if (Creature* pOrb = *itr) + if (pOrb->GetPositionY() > 6680) + DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + } } + m_uiTimer = urand(90000,120000); } - m_uiTimer = urand(90000,120000); - } - break; - case NPC_WARMAGE_CALANDRA: - { - if (!orbList.empty()) + break; + case NPC_WARMAGE_CALANDRA: { - for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + if (!orbList.empty()) { - if (Creature* pOrb = *itr) - if ((pOrb->GetPositionY() < 6680) && (pOrb->GetPositionY() > 6630)) - DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + { + if (Creature* pOrb = *itr) + if ((pOrb->GetPositionY() < 6680) && (pOrb->GetPositionY() > 6630)) + DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + } } + m_uiTimer = urand(90000,120000); } - m_uiTimer = urand(90000,120000); - } - break; - case NPC_WARMAGE_WATKINS: - { - if (!orbList.empty()) + break; + case NPC_WARMAGE_WATKINS: { - for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + if (!orbList.empty()) { - if (Creature* pOrb = *itr) - if (pOrb->GetPositionY() < 6630) - DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + { + if (Creature* pOrb = *itr) + if (pOrb->GetPositionY() < 6630) + DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + } } + m_uiTimer = urand(90000,120000); } - m_uiTimer = urand(90000,120000); + break; } - break; } - } - else m_uiTimer -= uiDiff; + else m_uiTimer -= uiDiff; - ScriptedAI::UpdateAI(uiDiff); + ScriptedAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_warmage_coldarraAI(creature); } }; -CreatureAI* GetAI_npc_warmage_coldarra(Creature* pCreature) -{ - return new npc_warmage_coldarraAI(pCreature); -} - void AddSC_borean_tundra() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_sinkhole_kill_credit"; - newscript->GetAI = &GetAI_npc_sinkhole_kill_credit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_khunok_the_behemoth"; - newscript->GetAI = &GetAI_npc_khunok_the_behemoth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_keristrasza"; - newscript->pGossipHello = &GossipHello_npc_keristrasza; - newscript->pGossipSelect = &GossipSelect_npc_keristrasza; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_corastrasza"; - newscript->pGossipHello = &GossipHello_npc_corastrasza; - newscript->pGossipSelect = &GossipSelect_npc_corastrasza; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_iruk"; - newscript->pGossipHello = &GossipHello_npc_iruk; - newscript->pGossipSelect = &GossipSelect_npc_iruk; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_nerubar_victim"; - newscript->GetAI = &GetAI_mob_nerubar_victim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_scourge_prisoner"; - newscript->GetAI = &GetAI_npc_scourge_prisoner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_jenny"; - newscript->GetAI = &GetAI_npc_jenny; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_fezzix_geartwist"; - newscript->GetAI = &GetAI_npc_fezzix_geartwist; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_nesingwary_trapper"; - newscript->GetAI = &GetAI_npc_nesingwary_trapper; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lurgglbr"; - newscript->GetAI = &GetAI_npc_lurgglbr; - newscript->pQuestAccept = &QuestAccept_npc_lurgglbr; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_nexus_drake_hatchling"; - newscript->GetAI = &GetAI_npc_nexus_drake_hatchling; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thassarian"; - newscript->GetAI = &GetAI_npc_thassarian; - newscript->pGossipHello = &GossipHello_npc_thassarian; - newscript->pGossipSelect = &GossipSelect_npc_thassarian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_image_lich_king"; - newscript->GetAI = &GetAI_npc_image_lich_king; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_counselor_talbot"; - newscript->GetAI = &GetAI_npc_counselor_talbot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_leryssa"; - newscript->GetAI = &GetAI_npc_leryssa; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_general_arlos"; - newscript->GetAI = &GetAI_npc_general_arlos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_beryl_sorcerer"; - newscript->GetAI = &GetAI_npc_beryl_sorcerer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_imprisoned_beryl_sorcerer"; - newscript->GetAI = &GetAI_npc_imprisoned_beryl_sorcerer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mootoo_the_younger"; - newscript->GetAI = &GetAI_npc_mootoo_the_younger; - newscript->pQuestAccept=&QuestAccept_npc_mootoo_the_younger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_bonker_togglevolt"; - newscript->GetAI = &GetAI_npc_bonker_togglevolt; - newscript->pQuestAccept=&QuestAccept_npc_bonker_togglevolt; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_trapped_mammoth_calf"; - newscript->GetAI = &GetAI_npc_trapped_mammoth_calf; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_magmoth_crusher"; - newscript->GetAI = &GetAI_npc_magmoth_crusher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_seaforium_depth_charge"; - newscript->GetAI = &GetAI_npc_seaforium_depth_charge; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_valiance_keep_cannoneer"; - newscript->GetAI = &GetAI_npc_valiance_keep_cannoneer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_warmage_coldarra"; - newscript->GetAI = &GetAI_npc_warmage_coldarra; - newscript->RegisterSelf(); + new npc_sinkhole_kill_credit; + new npc_khunok_the_behemoth; + new npc_keristrasza; + new npc_corastrasza; + new npc_iruk; + new mob_nerubar_victim; + new npc_scourge_prisoner; + new npc_jenny; + new npc_fezzix_geartwist; + new npc_nesingwary_trapper; + new npc_lurgglbr; + new npc_nexus_drake_hatchling; + new npc_thassarian; + new npc_image_lich_king; + new npc_counselor_talbot; + new npc_leryssa; + new npc_general_arlos; + new npc_beryl_sorcerer; + new npc_imprisoned_beryl_sorcerer; + new npc_mootoo_the_younger; + new npc_bonker_togglevolt; + new npc_trapped_mammoth_calf; + new npc_magmoth_crusher; + new npc_seaforium_depth_charge; + new npc_valiance_keep_cannoneer; + new npc_warmage_coldarra; } diff --git a/src/server/scripts/Northrend/crystalsong_forest.cpp b/src/server/scripts/Northrend/crystalsong_forest.cpp index e8743b92db4..da618c3cc3d 100644 --- a/src/server/scripts/Northrend/crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/crystalsong_forest.cpp @@ -42,68 +42,69 @@ enum NPCs NPC_WARMAGE_ILSUDRIA = 32372 }; -struct npc_warmage_violetstandAI : public Scripted_NoMovementAI +class npc_warmage_violetstand : public CreatureScript { - npc_warmage_violetstandAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature){} +public: + npc_warmage_violetstand() : CreatureScript("npc_warmage_violetstand") { } - uint64 uiTargetGUID; - - void Reset() + struct npc_warmage_violetstandAI : public Scripted_NoMovementAI { - uiTargetGUID = 0; - } + npc_warmage_violetstandAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature){} - void UpdateAI(const uint32 /*uiDiff*/) - { - if (me->IsNonMeleeSpellCasted(false)) - return; + uint64 uiTargetGUID; + + void Reset() + { + uiTargetGUID = 0; + } - if (me->GetEntry() == NPC_WARMAGE_SARINA) + void UpdateAI(const uint32 /*uiDiff*/) { - if (!uiTargetGUID) + if (me->IsNonMeleeSpellCasted(false)) + return; + + if (me->GetEntry() == NPC_WARMAGE_SARINA) { - std::list<Creature*> orbList; - GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f); - if (!orbList.empty()) + if (!uiTargetGUID) { - for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) + std::list<Creature*> orbList; + GetCreatureListWithEntryInGrid(orbList, me, NPC_TRANSITUS_SHIELD_DUMMY, 32.0f); + if (!orbList.empty()) { - if (Creature* pOrb = *itr) + for (std::list<Creature*>::const_iterator itr = orbList.begin(); itr != orbList.end(); ++itr) { - if (pOrb->GetPositionY() < 1000) + if (Creature* pOrb = *itr) { - uiTargetGUID = pOrb->GetGUID(); - break; + if (pOrb->GetPositionY() < 1000) + { + uiTargetGUID = pOrb->GetGUID(); + break; + } } } } } + }else + { + if (!uiTargetGUID) + if (Creature* pOrb = GetClosestCreatureWithEntry(me,NPC_TRANSITUS_SHIELD_DUMMY,32.0f)) + uiTargetGUID = pOrb->GetGUID(); + } - }else - { - if (!uiTargetGUID) - if (Creature* pOrb = GetClosestCreatureWithEntry(me,NPC_TRANSITUS_SHIELD_DUMMY,32.0f)) - uiTargetGUID = pOrb->GetGUID(); - } + if (Creature* pOrb = me->GetCreature(*me,uiTargetGUID)) + DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); - if (Creature* pOrb = me->GetCreature(*me,uiTargetGUID)) - DoCast(pOrb,SPELL_TRANSITUS_SHIELD_BEAM); + } + }; + CreatureAI *GetAI(Creature *creature) const + { + return new npc_warmage_violetstandAI(creature); } }; -CreatureAI* GetAI_npc_warmage_violetstand(Creature* pCreature) -{ - return new npc_warmage_violetstandAI(pCreature); -} - void AddSC_crystalsong_forest() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_warmage_violetstand"; - newscript->GetAI = &GetAI_npc_warmage_violetstand; - newscript->RegisterSelf(); + new npc_warmage_violetstand; }
\ No newline at end of file diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index a602b84fcf0..7ff4559e202 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -41,68 +41,74 @@ enum NPCs // All outdoor guards are within 35.0f of these NPCs NPC_SWEETBERRY_H = 29715, }; -struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI +class npc_mageguard_dalaran : public CreatureScript { - npc_mageguard_dalaranAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_NORMAL, true); - pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); - } - - void Reset(){} - - void EnterCombat(Unit* /*pWho*/){} +public: + npc_mageguard_dalaran() : CreatureScript("npc_mageguard_dalaran") { } - void AttackStart(Unit* /*pWho*/){} - - void MoveInLineOfSight(Unit *pWho) + struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI { - if (!pWho || !pWho->IsInWorld() || pWho->GetZoneId() != 4395) - return; + npc_mageguard_dalaranAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) + { + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_NORMAL, true); + pCreature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + } - if (!me->IsWithinDist(pWho, 65.0f, false)) - return; + void Reset(){} - Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself(); + void EnterCombat(Unit* /*pWho*/){} - if (!pPlayer || pPlayer->isGameMaster() || pPlayer->IsBeingTeleported()) - return; + void AttackStart(Unit* /*pWho*/){} - switch (me->GetEntry()) + void MoveInLineOfSight(Unit *pWho) { - case 29254: - if (pPlayer->GetTeam() == HORDE) // Horde unit found in Alliance area - if (GetClosestCreatureWithEntry(me, NPC_APPLEBOUGH_A, 32.0f)) - { - if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me - DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out - } - else // In my line of sight, and "indoors" - DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out - break; - case 29255: - if (pPlayer->GetTeam() == ALLIANCE) // Alliance unit found in Horde area - if (GetClosestCreatureWithEntry(me, NPC_SWEETBERRY_H, 32.0f)) - { - if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me - DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out - } - else // In my line of sight, and "indoors" - DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out - break; + if (!pWho || !pWho->IsInWorld() || pWho->GetZoneId() != 4395) + return; + + if (!me->IsWithinDist(pWho, 65.0f, false)) + return; + + Player *pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself(); + + if (!pPlayer || pPlayer->isGameMaster() || pPlayer->IsBeingTeleported()) + return; + + switch (me->GetEntry()) + { + case 29254: + if (pPlayer->GetTeam() == HORDE) // Horde unit found in Alliance area + if (GetClosestCreatureWithEntry(me, NPC_APPLEBOUGH_A, 32.0f)) + { + if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me + DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out + } + else // In my line of sight, and "indoors" + DoCast(pWho, SPELL_TRESPASSER_A); // Teleport the Horde unit out + break; + case 29255: + if (pPlayer->GetTeam() == ALLIANCE) // Alliance unit found in Horde area + if (GetClosestCreatureWithEntry(me, NPC_SWEETBERRY_H, 32.0f)) + { + if (me->isInBackInMap(pWho, 12.0f)) // In my line of sight, "outdoors", and behind me + DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out + } + else // In my line of sight, and "indoors" + DoCast(pWho, SPELL_TRESPASSER_H); // Teleport the Alliance unit out + break; + } + me->SetOrientation(me->GetHomePosition().GetOrientation()); + return; } - me->SetOrientation(me->GetHomePosition().GetOrientation()); - return; - } - void UpdateAI(const uint32 /*diff*/){} -}; + void UpdateAI(const uint32 /*diff*/){} + }; -CreatureAI* GetAI_npc_mageguard_dalaran(Creature* pCreature) -{ - return new npc_mageguard_dalaranAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_mageguard_dalaranAI(creature); + } +}; /*###### ## npc_hira_snowdawn @@ -115,44 +121,40 @@ enum eHiraSnowdawn #define GOSSIP_TEXT_TRAIN_HIRA "I seek training to ride a steed." -bool GossipHello_npc_hira_snowdawn(Player* pPlayer, Creature* pCreature) +class npc_hira_snowdawn : public CreatureScript { - if (!pCreature->isVendor() || !pCreature->isTrainer()) - return false; +public: + npc_hira_snowdawn() : CreatureScript("npc_hira_snowdawn") { } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_TRAIN_HIRA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (!pCreature->isVendor() || !pCreature->isTrainer()) + return false; - if (pPlayer->getLevel() >= 80 && pPlayer->HasSpell(SPELL_COLD_WEATHER_FLYING)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_TRAIN_HIRA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (pPlayer->getLevel() >= 80 && pPlayer->HasSpell(SPELL_COLD_WEATHER_FLYING)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -bool GossipSelect_npc_hira_snowdawn(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRAIN) - pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); + return true; + } - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRAIN) + pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); - return true; -} + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; + } +}; void AddSC_dalaran() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_mageguard_dalaran"; - newscript->GetAI = &GetAI_npc_mageguard_dalaran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_hira_snowdawn"; - newscript->pGossipHello = &GossipHello_npc_hira_snowdawn; - newscript->pGossipSelect = &GossipSelect_npc_hira_snowdawn; - newscript->RegisterSelf(); + new npc_mageguard_dalaran; + new npc_hira_snowdawn; } diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index f79deb594b0..e9224e6365c 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -39,28 +39,34 @@ enum eEnums #define GOSSIP_ITEM_WHAT_HAPPENED "Alexstrasza, can you show me what happened here?" -bool GossipHello_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* pCreature) +class npc_alexstrasza_wr_gate : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_alexstrasza_wr_gate() : CreatureScript("npc_alexstrasza_wr_gate") { } - if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_A) || pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_H)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WHAT_HAPPENED, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_A) || pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_H)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WHAT_HAPPENED, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->SendMovieStart(MOVIE_ID_GATES); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->SendMovieStart(MOVIE_ID_GATES); + } + + return true; + } +}; /*###### ## npc_inquisitor_hallard. Quest 12321 @@ -104,171 +110,165 @@ enum eInquisitor #define QUEST_A_RIGHTEOUS_SERMON 12321 -struct npc_inquisitor_hallardAI : public npc_escortAI -{ - npc_inquisitor_hallardAI(Creature* pCreature) : npc_escortAI(pCreature) { } +class npc_inquisitor_hallard : public CreatureScript +{ +public: + npc_inquisitor_hallard() : CreatureScript("npc_inquisitor_hallard") { } - bool Completed; + struct npc_inquisitor_hallardAI : public npc_escortAI + { + npc_inquisitor_hallardAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; - Creature* Godfrey = me->FindNearestCreature(NPC_GODFREY, 50, true); - if (!Godfrey) - return; - switch (i) + bool Completed; + + void WaypointReached(uint32 i) { - case 1: - DoScriptText(SAY_WP_1, me, Godfrey); - me->SetUInt64Value(UNIT_FIELD_TARGET, Godfrey->GetGUID()); - me->HandleEmoteCommand(5); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case 2: - Godfrey->HandleEmoteCommand(434); - DoScriptText(SAY_WP_2, me, Godfrey); - me->HandleEmoteCommand(15); - break; - case 3: - DoScriptText(SAY_WP_3, me, Godfrey); - me->HandleEmoteCommand(1); - break; - case 4: - DoScriptText(SAY_WP_4, Godfrey); - break; - case 5: - DoScriptText(SAY_WP_5, Godfrey); - break; - case 6: - DoScriptText(SAY_WP_6, Godfrey); - break; - case 7: - DoScriptText(SAY_WP_7, me, Godfrey); - me->HandleEmoteCommand(1); - break; - case 8: - DoScriptText(SAY_WP_8, me, Godfrey); - me->HandleEmoteCommand(16); - break; - case 9: - DoScriptText(SAY_WP_9, me, Godfrey); - me->HandleEmoteCommand(5); - break; - case 10: - DoScriptText(SAY_WP_10, me, Godfrey); - DoCast(Godfrey, SPELL_HOLY_FIRE); - break; - case 11: - Godfrey->HandleEmoteCommand(434); - DoScriptText(SAY_WP_11, Godfrey); - break; - case 12: - DoScriptText(SAY_WP_12, me, Godfrey); - DoCast(Godfrey, SPELL_HOLY_FIRE); - break; - case 13: - DoScriptText(SAY_WP_13, me, Godfrey); - DoCast(Godfrey, SPELL_HOLY_FIRE); - break; - case 14: - Godfrey->HandleEmoteCommand(434); - DoScriptText(SAY_WP_14, Godfrey); - break; - case 15: - DoScriptText(SAY_WP_15, me, Godfrey); - DoCast(Godfrey, SPELL_HOLY_FIRE); - break; - case 16: - DoScriptText(SAY_WP_16, me, Godfrey); - break; - case 17: - DoScriptText(SAY_WP_17, me, Godfrey); - break; - case 18: - DoScriptText(SAY_WP_18, Godfrey); - break; - case 19: - DoScriptText(SAY_WP_19, me, Godfrey); - break; - case 20: - DoScriptText(SAY_WP_20, Godfrey); - break; - case 21: - DoScriptText(SAY_WP_21, Godfrey); - break; - case 22: - DoScriptText(SAY_WP_22, me, Godfrey); - break; - case 23: - DoScriptText(SAY_WP_23, Godfrey); - break; - case 24: - DoScriptText(SAY_WP_24, Godfrey); - break; - case 25: - DoScriptText(SAY_WP_25, me, Godfrey); - break; - case 26: - DoScriptText(SAY_WP_26, me); - me->SetUInt64Value(UNIT_FIELD_TARGET, pPlayer->GetGUID()); - break; - case 27: - DoScriptText(SAY_WP_27, me, Godfrey); - me->SetUInt64Value(UNIT_FIELD_TARGET, Godfrey->GetGUID()); - Completed = true; - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_A_RIGHTEOUS_SERMON, me); - break; + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + Creature* Godfrey = me->FindNearestCreature(NPC_GODFREY, 50, true); + if (!Godfrey) + return; + switch (i) + { + case 1: + DoScriptText(SAY_WP_1, me, Godfrey); + me->SetUInt64Value(UNIT_FIELD_TARGET, Godfrey->GetGUID()); + me->HandleEmoteCommand(5); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case 2: + Godfrey->HandleEmoteCommand(434); + DoScriptText(SAY_WP_2, me, Godfrey); + me->HandleEmoteCommand(15); + break; + case 3: + DoScriptText(SAY_WP_3, me, Godfrey); + me->HandleEmoteCommand(1); + break; + case 4: + DoScriptText(SAY_WP_4, Godfrey); + break; + case 5: + DoScriptText(SAY_WP_5, Godfrey); + break; + case 6: + DoScriptText(SAY_WP_6, Godfrey); + break; + case 7: + DoScriptText(SAY_WP_7, me, Godfrey); + me->HandleEmoteCommand(1); + break; + case 8: + DoScriptText(SAY_WP_8, me, Godfrey); + me->HandleEmoteCommand(16); + break; + case 9: + DoScriptText(SAY_WP_9, me, Godfrey); + me->HandleEmoteCommand(5); + break; + case 10: + DoScriptText(SAY_WP_10, me, Godfrey); + DoCast(Godfrey, SPELL_HOLY_FIRE); + break; + case 11: + Godfrey->HandleEmoteCommand(434); + DoScriptText(SAY_WP_11, Godfrey); + break; + case 12: + DoScriptText(SAY_WP_12, me, Godfrey); + DoCast(Godfrey, SPELL_HOLY_FIRE); + break; + case 13: + DoScriptText(SAY_WP_13, me, Godfrey); + DoCast(Godfrey, SPELL_HOLY_FIRE); + break; + case 14: + Godfrey->HandleEmoteCommand(434); + DoScriptText(SAY_WP_14, Godfrey); + break; + case 15: + DoScriptText(SAY_WP_15, me, Godfrey); + DoCast(Godfrey, SPELL_HOLY_FIRE); + break; + case 16: + DoScriptText(SAY_WP_16, me, Godfrey); + break; + case 17: + DoScriptText(SAY_WP_17, me, Godfrey); + break; + case 18: + DoScriptText(SAY_WP_18, Godfrey); + break; + case 19: + DoScriptText(SAY_WP_19, me, Godfrey); + break; + case 20: + DoScriptText(SAY_WP_20, Godfrey); + break; + case 21: + DoScriptText(SAY_WP_21, Godfrey); + break; + case 22: + DoScriptText(SAY_WP_22, me, Godfrey); + break; + case 23: + DoScriptText(SAY_WP_23, Godfrey); + break; + case 24: + DoScriptText(SAY_WP_24, Godfrey); + break; + case 25: + DoScriptText(SAY_WP_25, me, Godfrey); + break; + case 26: + DoScriptText(SAY_WP_26, me); + me->SetUInt64Value(UNIT_FIELD_TARGET, pPlayer->GetGUID()); + break; + case 27: + DoScriptText(SAY_WP_27, me, Godfrey); + me->SetUInt64Value(UNIT_FIELD_TARGET, Godfrey->GetGUID()); + Completed = true; + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_A_RIGHTEOUS_SERMON, me); + break; + } } - } - void Reset() - { - Completed = false; - } + void Reset() + { + Completed = false; + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } -}; + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } + }; -bool QuestAccept_npc_inquisitor_hallard(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_A_RIGHTEOUS_SERMON) - { - DoScriptText(SAY_WP_0, pCreature, pPlayer); - if (npc_escortAI* pEscortAI = CAST_AI(npc_inquisitor_hallardAI, pCreature->AI())) - { - pEscortAI->Start(true, false, pPlayer->GetGUID(), 0, true); - pCreature->GetMotionMaster()->MovePoint(0, 3801.543, -679.350, 213.75); + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_A_RIGHTEOUS_SERMON) + { + DoScriptText(SAY_WP_0, pCreature, pPlayer); + if (npc_escortAI* pEscortAI = CAST_AI(npc_inquisitor_hallardAI, pCreature->AI())) + { + pEscortAI->Start(true, false, pPlayer->GetGUID(), 0, true); + pCreature->GetMotionMaster()->MovePoint(0, 3801.543, -679.350, 213.75); + } } + return true; } - return true; -} -CreatureAI* GetAI_npc_inquisitor_hallard(Creature* pCreature) -{ - return new npc_inquisitor_hallardAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_inquisitor_hallardAI(creature); + } +}; void AddSC_dragonblight() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_alexstrasza_wr_gate"; - newscript->pGossipHello = &GossipHello_npc_alexstrasza_wr_gate; - newscript->pGossipSelect = &GossipSelect_npc_alexstrasza_wr_gate; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_inquisitor_hallard"; - newscript->GetAI = &GetAI_npc_inquisitor_hallard; - newscript->pQuestAccept = &QuestAccept_npc_inquisitor_hallard; - newscript->RegisterSelf(); - + new npc_alexstrasza_wr_gate; + new npc_inquisitor_hallard; } diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 6f4028c5110..03bd63f6284 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -56,67 +56,73 @@ enum eEnums QUEST_THE_BEAR_GODS_OFFSPRING = 12231 }; -bool GossipHello_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature) +class npc_orsonn_and_kodian : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_orsonn_and_kodian() : CreatureScript("npc_orsonn_and_kodian") { } - if (pPlayer->GetQuestStatus(QUEST_CHILDREN_OF_URSOC) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_THE_BEAR_GODS_OFFSPRING) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - switch(pCreature->GetEntry()) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_CHILDREN_OF_URSOC) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_THE_BEAR_GODS_OFFSPRING) == QUEST_STATUS_INCOMPLETE) { - case NPC_ORSONN: - if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_CHILDREN_OF_URSOC, NPC_ORSONN_CREDIT) || !pPlayer->GetReqKillOrCastCurrentCount(QUEST_THE_BEAR_GODS_OFFSPRING, NPC_ORSONN_CREDIT)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN1, pCreature->GetGUID()); - return true; - } - break; - case NPC_KODIAN: - if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_CHILDREN_OF_URSOC, NPC_KODIAN_CREDIT) || !pPlayer->GetReqKillOrCastCurrentCount(QUEST_THE_BEAR_GODS_OFFSPRING, NPC_KODIAN_CREDIT)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN1, pCreature->GetGUID()); - return true; - } - break; + switch(pCreature->GetEntry()) + { + case NPC_ORSONN: + if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_CHILDREN_OF_URSOC, NPC_ORSONN_CREDIT) || !pPlayer->GetReqKillOrCastCurrentCount(QUEST_THE_BEAR_GODS_OFFSPRING, NPC_ORSONN_CREDIT)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN1, pCreature->GetGUID()); + return true; + } + break; + case NPC_KODIAN: + if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_CHILDREN_OF_URSOC, NPC_KODIAN_CREDIT) || !pPlayer->GetReqKillOrCastCurrentCount(QUEST_THE_BEAR_GODS_OFFSPRING, NPC_KODIAN_CREDIT)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN1, pCreature->GetGUID()); + return true; + } + break; + } } - } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_orsonn_and_kodian(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN3, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->TalkedToCreature(NPC_ORSONN_CREDIT, pCreature->GetGUID()); - break; - - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->TalkedToCreature(NPC_KODIAN_CREDIT, pCreature->GetGUID()); - break; - } + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ORSONN3, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->TalkedToCreature(NPC_ORSONN_CREDIT, pCreature->GetGUID()); + break; - return true; -} + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_KODIAN2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->TalkedToCreature(NPC_KODIAN_CREDIT, pCreature->GetGUID()); + break; + } + + return true; + } +}; /*###### ## Quest 12027: Mr. Floppy's Perilous Adventure @@ -149,221 +155,232 @@ enum eFloppy }; //emily -struct npc_emilyAI : public npc_escortAI +class npc_emily : public CreatureScript { - npc_emilyAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_emily() : CreatureScript("npc_emily") { } - uint32 m_uiChatTimer; + struct npc_emilyAI : public npc_escortAI + { + npc_emilyAI(Creature* pCreature) : npc_escortAI(pCreature) { } - uint64 RWORGGUID; - uint64 MrfloppyGUID; + uint32 m_uiChatTimer; - bool Completed; + uint64 RWORGGUID; + uint64 MrfloppyGUID; - void JustSummoned(Creature* pSummoned) - { - if (Creature* Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 50.0f)) - pSummoned->AI()->AttackStart(Mrfloppy); - else - pSummoned->AI()->AttackStart(me->getVictim()); - } + bool Completed; - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; - switch (i) + void JustSummoned(Creature* pSummoned) { - case 9: - if (Creature *Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 100.0f)) - MrfloppyGUID = Mrfloppy->GetGUID(); - break; - case 10: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - { - DoScriptText(SAY_WORGHAGGRO1, me); - me->SummonCreature(NPC_HUNGRY_WORG,me->GetPositionX()+5,me->GetPositionY()+2,me->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); - } - break; - case 11: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - break; - case 17: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - DoScriptText(SAY_WORGRAGGRO3, me); - if (Creature *RWORG = me->SummonCreature(NPC_RAVENOUS_WORG,me->GetPositionX()+10,me->GetPositionY()+8,me->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000)) - { - RWORG->setFaction(35); - RWORGGUID = RWORG->GetGUID(); - } - break; - case 18: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - { - if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) - RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); - DoCast(Mrfloppy,SPELL_MRFLOPPY); - } - break; - case 19: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - { - if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) + if (Creature* Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 50.0f)) + pSummoned->AI()->AttackStart(Mrfloppy); + else + pSummoned->AI()->AttackStart(me->getVictim()); + } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + switch (i) + { + case 9: + if (Creature *Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 100.0f)) + MrfloppyGUID = Mrfloppy->GetGUID(); + break; + case 10: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) + { + DoScriptText(SAY_WORGHAGGRO1, me); + me->SummonCreature(NPC_HUNGRY_WORG,me->GetPositionX()+5,me->GetPositionY()+2,me->GetPositionZ()+1,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + } + break; + case 11: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) + Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + break; + case 17: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) + Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + DoScriptText(SAY_WORGRAGGRO3, me); + if (Creature *RWORG = me->SummonCreature(NPC_RAVENOUS_WORG,me->GetPositionX()+10,me->GetPositionY()+8,me->GetPositionZ()+2,3.229f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000)) + { + RWORG->setFaction(35); + RWORGGUID = RWORG->GetGUID(); + } + break; + case 18: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) { if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) - Mrfloppy->EnterVehicle(RWORG); + RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); + DoCast(Mrfloppy,SPELL_MRFLOPPY); } - } - break; - case 20: - if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) - RWORG->HandleEmoteCommand(34); - break; - case 21: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - { - if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) + break; + case 19: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) { - RWORG->Kill(Mrfloppy); - Mrfloppy->ExitVehicle(); - RWORG->setFaction(14); - RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ()); - DoScriptText(SAY_VICTORY2, me); + if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0)) + { + if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) + Mrfloppy->EnterVehicle(RWORG); + } } - } - break; - case 22: - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - { - if (Mrfloppy->isDead()) + break; + case 20: + if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) + RWORG->HandleEmoteCommand(34); + break; + case 21: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) { if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) - RWORG->DisappearAndDie(); - me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); - Mrfloppy->setDeathState(ALIVE); - Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - DoScriptText(SAY_VICTORY3, me); + { + RWORG->Kill(Mrfloppy); + Mrfloppy->ExitVehicle(); + RWORG->setFaction(14); + RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10,RWORG->GetPositionY()+80,RWORG->GetPositionZ()); + DoScriptText(SAY_VICTORY2, me); + } } - } - break; - case 24: - if (pPlayer) - { - Completed = true; - pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, me); - DoScriptText(SAY_QUEST_COMPLETE, me, pPlayer); - } - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case 25: - DoScriptText(SAY_VICTORY4, me); - break; - case 27: - me->DisappearAndDie(); - if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) - Mrfloppy->DisappearAndDie(); - break; + break; + case 22: + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) + { + if (Mrfloppy->isDead()) + { + if (Creature *RWORG = Unit::GetCreature(*me, RWORGGUID)) + RWORG->DisappearAndDie(); + me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ()); + Mrfloppy->setDeathState(ALIVE); + Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + DoScriptText(SAY_VICTORY3, me); + } + } + break; + case 24: + if (pPlayer) + { + Completed = true; + pPlayer->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, me); + DoScriptText(SAY_QUEST_COMPLETE, me, pPlayer); + } + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case 25: + DoScriptText(SAY_VICTORY4, me); + break; + case 27: + me->DisappearAndDie(); + if (Creature *Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID)) + Mrfloppy->DisappearAndDie(); + break; + } } - } - - void EnterCombat(Unit* /*Who*/) - { - DoScriptText(SAY_RANDOMAGGRO, me); - } - void Reset() - { - m_uiChatTimer = 4000; - MrfloppyGUID = 0; - RWORGGUID = 0; - } + void EnterCombat(Unit* /*Who*/) + { + DoScriptText(SAY_RANDOMAGGRO, me); + } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + void Reset() + { + m_uiChatTimer = 4000; + MrfloppyGUID = 0; + RWORGGUID = 0; + } - if (HasEscortState(STATE_ESCORT_ESCORTING)) + void UpdateAI(const uint32 uiDiff) { - if (m_uiChatTimer <= uiDiff) + npc_escortAI::UpdateAI(uiDiff); + + if (HasEscortState(STATE_ESCORT_ESCORTING)) { - m_uiChatTimer = 12000; + if (m_uiChatTimer <= uiDiff) + { + m_uiChatTimer = 12000; + } + else + m_uiChatTimer -= uiDiff; } - else - m_uiChatTimer -= uiDiff; } - } -}; + }; -bool QuestAccept_npc_emily(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - DoScriptText(SAY_QUEST_ACCEPT, pCreature); - if (Creature* Mrfloppy = GetClosestCreatureWithEntry(pCreature, NPC_MRFLOPPY, 180.0f)) + if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE) { - Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - } + DoScriptText(SAY_QUEST_ACCEPT, pCreature); + if (Creature* Mrfloppy = GetClosestCreatureWithEntry(pCreature, NPC_MRFLOPPY, 180.0f)) + { + Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } - if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI()))) - pEscortAI->Start(true, false, pPlayer->GetGUID()); + if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI()))) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } - return true; -} -CreatureAI* GetAI_npc_emily(Creature* pCreature) -{ - return new npc_emilyAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_emilyAI(creature); + } +}; //mrfloppy - -struct npc_mrfloppyAI : public ScriptedAI +class npc_mrfloppy : public CreatureScript { - npc_mrfloppyAI(Creature *c) : ScriptedAI(c) {} +public: + npc_mrfloppy() : CreatureScript("npc_mrfloppy") { } - uint64 EmilyGUID; - uint64 RWORGGUID; - uint64 HWORGGUID; + struct npc_mrfloppyAI : public ScriptedAI + { + npc_mrfloppyAI(Creature *c) : ScriptedAI(c) {} - void Reset() {} + uint64 EmilyGUID; + uint64 RWORGGUID; + uint64 HWORGGUID; - void EnterCombat(Unit* Who) - { - if (Creature* Emily = GetClosestCreatureWithEntry(me, NPC_EMILY, 50.0f)) + void Reset() {} + + void EnterCombat(Unit* Who) { - switch(Who->GetEntry()) + if (Creature* Emily = GetClosestCreatureWithEntry(me, NPC_EMILY, 50.0f)) { - case NPC_HUNGRY_WORG: - DoScriptText(SAY_WORGHAGGRO2, Emily); - break; - case NPC_RAVENOUS_WORG: - DoScriptText(SAY_WORGRAGGRO4, Emily); - break; - default: - DoScriptText(SAY_RANDOMAGGRO, Emily); + switch(Who->GetEntry()) + { + case NPC_HUNGRY_WORG: + DoScriptText(SAY_WORGHAGGRO2, Emily); + break; + case NPC_RAVENOUS_WORG: + DoScriptText(SAY_WORGRAGGRO4, Emily); + break; + default: + DoScriptText(SAY_RANDOMAGGRO, Emily); + } } } - } - void EnterEvadeMode() {} + void EnterEvadeMode() {} - void MoveInLineOfSight(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + } + }; + + CreatureAI *GetAI(Creature *creature) const { - if (!UpdateVictim()) - return; + return new npc_mrfloppyAI(creature); } }; -CreatureAI* GetAI_npc_mrfloppy(Creature* pCreature) -{ - return new npc_mrfloppyAI(pCreature); -} - // Outhouse Bunny enum eOuthouseBunny @@ -378,49 +395,56 @@ enum eSounds SOUND_FEMALE = 12671, SOUND_MALE = 12670 }; -struct npc_outhouse_bunnyAI : public ScriptedAI -{ - npc_outhouse_bunnyAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint8 m_counter; - uint8 m_gender; +class npc_outhouse_bunny : public CreatureScript +{ +public: + npc_outhouse_bunny() : CreatureScript("npc_outhouse_bunny") { } - void Reset() + struct npc_outhouse_bunnyAI : public ScriptedAI { - m_counter = 0; - m_gender = 0; - } + npc_outhouse_bunnyAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void SetData(uint32 uiType, uint32 uiData) - { - if (uiType == 1) - m_gender = uiData; - } + uint8 m_counter; + uint8 m_gender; - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_OUTHOUSE_GROANS) + void Reset() { - ++m_counter; - if (m_counter < 5) - DoCast(pCaster, SPELL_CAMERA_SHAKE, true); - else - m_counter = 0; - DoCast(me, SPELL_DUST_FIELD, true); - switch (m_gender) + m_counter = 0; + m_gender = 0; + } + + void SetData(uint32 uiType, uint32 uiData) + { + if (uiType == 1) + m_gender = uiData; + } + + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) + { + if (pSpell->Id == SPELL_OUTHOUSE_GROANS) { - case GENDER_FEMALE: DoPlaySoundToSet(me, SOUND_FEMALE); break; - case GENDER_MALE: DoPlaySoundToSet(me, SOUND_MALE); break; + ++m_counter; + if (m_counter < 5) + DoCast(pCaster, SPELL_CAMERA_SHAKE, true); + else + m_counter = 0; + DoCast(me, SPELL_DUST_FIELD, true); + switch (m_gender) + { + case GENDER_FEMALE: DoPlaySoundToSet(me, SOUND_FEMALE); break; + case GENDER_MALE: DoPlaySoundToSet(me, SOUND_MALE); break; + } } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_outhouse_bunnyAI(creature); } }; -CreatureAI* GetAI_npc_outhouse_bunny(Creature* pCreature) -{ - return new npc_outhouse_bunnyAI (pCreature); -} - // Tallhorn Stage enum etallhornstage @@ -428,37 +452,43 @@ enum etallhornstage OBJECT_HAUNCH = 188665 }; -struct npc_tallhorn_stagAI : public ScriptedAI +class npc_tallhorn_stag : public CreatureScript { - npc_tallhorn_stagAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint8 m_uiPhase; +public: + npc_tallhorn_stag() : CreatureScript("npc_tallhorn_stag") { } - void Reset() + struct npc_tallhorn_stagAI : public ScriptedAI { - m_uiPhase = 1; - } + npc_tallhorn_stagAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 /*uiDiff*/) - { - if (m_uiPhase == 1) + uint8 m_uiPhase; + + void Reset() { - if (GameObject* haunch = me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f)) + m_uiPhase = 1; + } + + void UpdateAI(const uint32 /*uiDiff*/) + { + if (m_uiPhase == 1) { - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + if (GameObject* haunch = me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f)) + { + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + } + m_uiPhase = 0; } - m_uiPhase = 0; } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_tallhorn_stagAI(creature); } }; -CreatureAI* GetAI_npc_tallhorn_stag(Creature* pCreature) -{ - return new npc_tallhorn_stagAI (pCreature); -} - // Amberpine Woodsman enum eamberpinewoodsman @@ -466,54 +496,64 @@ enum eamberpinewoodsman TALLHORN_STAG = 26363 }; -struct npc_amberpine_woodsmanAI : public ScriptedAI +class npc_amberpine_woodsman : public CreatureScript { - npc_amberpine_woodsmanAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_amberpine_woodsman() : CreatureScript("npc_amberpine_woodsman") { } - uint8 m_uiPhase; - uint32 m_uiTimer; - - void Reset() + struct npc_amberpine_woodsmanAI : public ScriptedAI { - m_uiTimer = 0; - m_uiPhase = 1; - } + npc_amberpine_woodsmanAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 uiDiff) - { - // call this each update tick? - if (Creature* stag = me->FindNearestCreature(TALLHORN_STAG, 0.2f)) + uint8 m_uiPhase; + uint32 m_uiTimer; + + void Reset() { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + m_uiTimer = 0; + m_uiPhase = 1; } - else - if (m_uiPhase) + + void UpdateAI(const uint32 uiDiff) + { + // call this each update tick? + if (Creature* stag = me->FindNearestCreature(TALLHORN_STAG, 0.2f)) { - if (m_uiTimer <= uiDiff) + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + } + else + if (m_uiPhase) { - switch(m_uiPhase) + if (m_uiTimer <= uiDiff) { - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LOOT); - m_uiTimer = 3000; - m_uiPhase = 2; - break; - case 2: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H); - m_uiTimer = 4000; - m_uiPhase = 1; - break; + switch(m_uiPhase) + { + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LOOT); + m_uiTimer = 3000; + m_uiPhase = 2; + break; + case 2: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H); + m_uiTimer = 4000; + m_uiPhase = 1; + break; + } } + else + m_uiTimer -= uiDiff; } - else - m_uiTimer -= uiDiff; - } - ScriptedAI::UpdateAI(uiDiff); + ScriptedAI::UpdateAI(uiDiff); - UpdateVictim(); + UpdateVictim(); + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_amberpine_woodsmanAI(creature); } }; - /*###### ## Quest 12288: Overwhelmed! ######*/ @@ -528,100 +568,70 @@ enum eSkirmisher RANDOM_SAY_3 = -1800046 //Thank you. $Class! }; -struct npc_wounded_skirmisherAI : public ScriptedAI +class npc_wounded_skirmisher : public CreatureScript { - npc_wounded_skirmisherAI(Creature *c) : ScriptedAI(c) {} - - uint64 uiPlayerGUID; - - uint32 DespawnTimer; +public: + npc_wounded_skirmisher() : CreatureScript("npc_wounded_skirmisher") { } - void Reset () + struct npc_wounded_skirmisherAI : public ScriptedAI { - DespawnTimer = 5000; - uiPlayerGUID = 0; - } + npc_wounded_skirmisherAI(Creature *c) : ScriptedAI(c) {} + + uint64 uiPlayerGUID; - void MovementInform(uint32, uint32 id) - { - if (id == 1) - me->ForcedDespawn(DespawnTimer); - } + uint32 DespawnTimer; - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER - && caster->ToPlayer()->GetQuestStatus(12288) == QUEST_STATUS_INCOMPLETE) - { - caster->ToPlayer()->KilledMonsterCredit(CREDIT_NPC, 0); - DoScriptText(RAND(RANDOM_SAY_1,RANDOM_SAY_2,RANDOM_SAY_3),caster); - if(me->IsStandState()) - me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+7, me->GetPositionY()+7, me->GetPositionZ()); - else - { - me->SetStandState(UNIT_STAND_STATE_STAND); - me->ForcedDespawn(DespawnTimer); + void Reset () + { + DespawnTimer = 5000; + uiPlayerGUID = 0; + } + + void MovementInform(uint32, uint32 id) + { + if (id == 1) + me->ForcedDespawn(DespawnTimer); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER + && caster->ToPlayer()->GetQuestStatus(12288) == QUEST_STATUS_INCOMPLETE) + { + caster->ToPlayer()->KilledMonsterCredit(CREDIT_NPC, 0); + DoScriptText(RAND(RANDOM_SAY_1,RANDOM_SAY_2,RANDOM_SAY_3),caster); + if(me->IsStandState()) + me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+7, me->GetPositionY()+7, me->GetPositionZ()); + else + { + me->SetStandState(UNIT_STAND_STATE_STAND); + me->ForcedDespawn(DespawnTimer); + } + } - } - } - - void UpdateAI(const uint32 /*diff*/) + + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *GetAI(Creature *creature) const { - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); + return new npc_wounded_skirmisherAI(creature); } }; -CreatureAI* GetAI_npc_wounded_skirmisher(Creature* pCreature) -{ - return new npc_wounded_skirmisherAI(pCreature); -} - -CreatureAI* GetAI_npc_amberpine_woodsman(Creature* pCreature) -{ - return new npc_amberpine_woodsmanAI (pCreature); -} - void AddSC_grizzly_hills() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_orsonn_and_kodian"; - newscript->pGossipHello = &GossipHello_npc_orsonn_and_kodian; - newscript->pGossipSelect = &GossipSelect_npc_orsonn_and_kodian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_emily"; - newscript->GetAI = &GetAI_npc_emily; - newscript->pQuestAccept = &QuestAccept_npc_emily; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mrfloppy"; - newscript->GetAI = &GetAI_npc_mrfloppy; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_outhouse_bunny"; - newscript->GetAI = &GetAI_npc_outhouse_bunny; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tallhorn_stag"; - newscript->GetAI = &GetAI_npc_tallhorn_stag; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_amberpine_woodsman"; - newscript->GetAI = &GetAI_npc_amberpine_woodsman; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_wounded_skirmisher"; - newscript->GetAI = &GetAI_npc_wounded_skirmisher; - newscript->RegisterSelf(); + new npc_orsonn_and_kodian; + new npc_emily; + new npc_mrfloppy; + new npc_outhouse_bunny; + new npc_tallhorn_stag; + new npc_amberpine_woodsman; + new npc_wounded_skirmisher; } diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp index f72f8f861f0..db74a401678 100644 --- a/src/server/scripts/Northrend/howling_fjord.cpp +++ b/src/server/scripts/Northrend/howling_fjord.cpp @@ -43,108 +43,116 @@ enum Entries SPELL_COSMETIC_LOW_POLY_FIRE = 56274 }; -bool QuestAccept_npc_apothecary_hanes(Player* pPlayer, Creature* pCreature, Quest const* quest) +class npc_apothecary_hanes : public CreatureScript { - if (quest->GetQuestId() == QUEST_TRAIL_OF_FIRE) +public: + npc_apothecary_hanes() : CreatureScript("npc_apothecary_hanes") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - switch (pPlayer->GetTeam()) + if (quest->GetQuestId() == QUEST_TRAIL_OF_FIRE) { - case ALLIANCE: - pCreature->setFaction(FACTION_ESCORTEE_A); - break; - case HORDE: - pCreature->setFaction(FACTION_ESCORTEE_H); - break; + switch (pPlayer->GetTeam()) + { + case ALLIANCE: + pCreature->setFaction(FACTION_ESCORTEE_A); + break; + case HORDE: + pCreature->setFaction(FACTION_ESCORTEE_H); + break; + } + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); } - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + return true; } - return true; -} - -struct npc_Apothecary_HanesAI : public npc_escortAI -{ - npc_Apothecary_HanesAI(Creature* pCreature) : npc_escortAI(pCreature){} - uint32 PotTimer; - void Reset () + struct npc_Apothecary_HanesAI : public npc_escortAI { - SetDespawnAtFar(false); - PotTimer = 10000; //10 sec cooldown on potion - } + npc_Apothecary_HanesAI(Creature* pCreature) : npc_escortAI(pCreature){} + uint32 PotTimer; - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->FailQuest(QUEST_TRAIL_OF_FIRE); - } + void Reset () + { + SetDespawnAtFar(false); + PotTimer = 10000; //10 sec cooldown on potion + } - void UpdateEscortAI(const uint32 diff) - { - if (HealthBelowPct(75)) + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_TRAIL_OF_FIRE); + } + + void UpdateEscortAI(const uint32 diff) { - if (PotTimer <= diff) + if (HealthBelowPct(75)) { - DoCast(me, 17534, true); - PotTimer = 10000; - } else PotTimer -= diff; + if (PotTimer <= diff) + { + DoCast(me, 17534, true); + PotTimer = 10000; + } else PotTimer -= diff; + } + if (GetAttack() && UpdateVictim()) + DoMeleeAttackIfReady(); } - if (GetAttack() && UpdateVictim()) - DoMeleeAttackIfReady(); - } - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; - switch(i) + void WaypointReached(uint32 i) { - case 1: - me->SetReactState(REACT_AGGRESSIVE); - SetRun(true); - break; - case 23: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_TRAIL_OF_FIRE, me); - me->ForcedDespawn(); - break; - case 5: - if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) - Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); - SetRun(false); - break; - case 6: - if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) - Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); - SetRun(true); - break; - case 8: - if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) - Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); - SetRun(false); - break; - case 9: - if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) - Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); - break; - case 10: - SetRun(true); - break; - case 13: - SetRun(false); - break; - case 14: - if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) - Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); - SetRun(true); - break; + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + switch(i) + { + case 1: + me->SetReactState(REACT_AGGRESSIVE); + SetRun(true); + break; + case 23: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_TRAIL_OF_FIRE, me); + me->ForcedDespawn(); + break; + case 5: + if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) + Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); + SetRun(false); + break; + case 6: + if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) + Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); + SetRun(true); + break; + case 8: + if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) + Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); + SetRun(false); + break; + case 9: + if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) + Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); + break; + case 10: + SetRun(true); + break; + case 13: + SetRun(false); + break; + case 14: + if (Unit* Trigger = me->FindNearestCreature(NPC_HANES_FIRE_TRIGGER,10.0f)) + Trigger->CastSpell(Trigger, SPELL_COSMETIC_LOW_POLY_FIRE, false); + SetRun(true); + break; + } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_Apothecary_HanesAI(creature); } }; -CreatureAI* GetAI_npc_apothecary_hanes(Creature* pCreature) -{ - return new npc_Apothecary_HanesAI(pCreature); -} + /*###### ## npc_plaguehound_tracker ######*/ @@ -154,55 +162,61 @@ enum ePlaguehound QUEST_SNIFF_OUT_ENEMY = 11253 }; -struct npc_plaguehound_trackerAI : public npc_escortAI +class npc_plaguehound_tracker : public CreatureScript { - npc_plaguehound_trackerAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_plaguehound_tracker() : CreatureScript("npc_plaguehound_tracker") { } - void Reset() + struct npc_plaguehound_trackerAI : public npc_escortAI { - InitScriptData(); - } + npc_plaguehound_trackerAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void InitScriptData() - { - Player* pPlayer = NULL; - if (me->isSummon()) - if (Unit* summoner = CAST_SUM(me)->GetSummoner()) - if (summoner->GetTypeId() == TYPEID_PLAYER) - pPlayer = CAST_PLR(summoner); - - if (!pPlayer) - return; + void Reset() + { + InitScriptData(); + } - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - Start(false, false, pPlayer->GetGUID()); - } + void InitScriptData() + { + Player* pPlayer = NULL; + if (me->isSummon()) + if (Unit* summoner = CAST_SUM(me)->GetSummoner()) + if (summoner->GetTypeId() == TYPEID_PLAYER) + pPlayer = CAST_PLR(summoner); - void WaypointReached(uint32 i) - { - Player* pPlayer = NULL; - if (me->isSummon()) - if (Unit* summoner = CAST_SUM(me)->GetSummoner()) - if (summoner->GetTypeId() == TYPEID_PLAYER) - pPlayer = CAST_PLR(summoner); + if (!pPlayer) + return; - if (!pPlayer) - return; + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + Start(false, false, pPlayer->GetGUID()); + } - switch(i) + void WaypointReached(uint32 i) { - case 26: - me->ForcedDespawn(); - break; + Player* pPlayer = NULL; + if (me->isSummon()) + if (Unit* summoner = CAST_SUM(me)->GetSummoner()) + if (summoner->GetTypeId() == TYPEID_PLAYER) + pPlayer = CAST_PLR(summoner); + + if (!pPlayer) + return; + + switch(i) + { + case 26: + me->ForcedDespawn(); + break; + } } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_plaguehound_trackerAI(creature); } }; -CreatureAI* GetAI_npc_plaguehound_tracker(Creature* pCreature) -{ - return new npc_plaguehound_trackerAI(pCreature); -} - /*###### ## npc_razael_and_lyana ######*/ @@ -221,50 +235,56 @@ enum eRazael GOSSIP_TEXTID_LYANA2 = 11588 }; -bool GossipHello_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature) +class npc_razael_and_lyana : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_razael_and_lyana() : CreatureScript("npc_razael_and_lyana") { } - if (pPlayer->GetQuestStatus(QUEST_REPORTS_FROM_THE_FIELD) == QUEST_STATUS_INCOMPLETE) - switch (pCreature->GetEntry()) - { - case NPC_RAZAEL: - if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_REPORTS_FROM_THE_FIELD, NPC_RAZAEL)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_RAZAEL_REPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_RAZAEL1, pCreature->GetGUID()); - return true; - } - break; - case NPC_LYANA: - if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_REPORTS_FROM_THE_FIELD, NPC_LYANA)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LYANA_REPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LYANA1, pCreature->GetGUID()); - return true; - } - break; - } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_razael_and_lyana(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + if (pPlayer->GetQuestStatus(QUEST_REPORTS_FROM_THE_FIELD) == QUEST_STATUS_INCOMPLETE) + switch (pCreature->GetEntry()) + { + case NPC_RAZAEL: + if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_REPORTS_FROM_THE_FIELD, NPC_RAZAEL)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_RAZAEL_REPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_RAZAEL1, pCreature->GetGUID()); + return true; + } + break; + case NPC_LYANA: + if (!pPlayer->GetReqKillOrCastCurrentCount(QUEST_REPORTS_FROM_THE_FIELD, NPC_LYANA)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LYANA_REPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LYANA1, pCreature->GetGUID()); + return true; + } + break; + } + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_RAZAEL2, pCreature->GetGUID()); - pPlayer->TalkedToCreature(NPC_RAZAEL, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LYANA2, pCreature->GetGUID()); - pPlayer->TalkedToCreature(NPC_LYANA, pCreature->GetGUID()); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_RAZAEL2, pCreature->GetGUID()); + pPlayer->TalkedToCreature(NPC_RAZAEL, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LYANA2, pCreature->GetGUID()); + pPlayer->TalkedToCreature(NPC_LYANA, pCreature->GetGUID()); + break; + } + return true; } - return true; -} +}; /*###### ## npc_mcgoyver @@ -283,56 +303,42 @@ enum eMcGoyver GOSSIP_TEXTID_MCGOYVER = 12193 }; -bool GossipHello_npc_mcgoyver(Player* pPlayer, Creature* pCreature) +class npc_mcgoyver : public CreatureScript { - if (pPlayer->GetQuestStatus(QUEST_WE_CAN_REBUILD_IT) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_mcgoyver() : CreatureScript("npc_mcgoyver") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_WE_CAN_REBUILD_IT) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_I, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_mcgoyver(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_II, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_MCGOYVER, pCreature->GetGUID()); - pPlayer->CastSpell(pPlayer, SPELL_CREATURE_DARK_IRON_INGOTS, true); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CastSpell(pPlayer, SPELL_TAXI_EXPLORERS_LEAGUE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MG_II, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_MCGOYVER, pCreature->GetGUID()); + pPlayer->CastSpell(pPlayer, SPELL_CREATURE_DARK_IRON_INGOTS, true); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CastSpell(pPlayer, SPELL_TAXI_EXPLORERS_LEAGUE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - return true; -} +}; void AddSC_howling_fjord() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_apothecary_hanes"; - newscript->GetAI = &GetAI_npc_apothecary_hanes; - newscript->pQuestAccept = &QuestAccept_npc_apothecary_hanes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_plaguehound_tracker"; - newscript->GetAI = &GetAI_npc_plaguehound_tracker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_razael_and_lyana"; - newscript->pGossipHello = &GossipHello_npc_razael_and_lyana; - newscript->pGossipSelect = &GossipSelect_npc_razael_and_lyana; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mcgoyver"; - newscript->pGossipHello = &GossipHello_npc_mcgoyver; - newscript->pGossipSelect = &GossipSelect_npc_mcgoyver; - newscript->RegisterSelf(); + new npc_apothecary_hanes; + new npc_plaguehound_tracker; + new npc_razael_and_lyana; + new npc_mcgoyver; } diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index a40d363eeb8..8be061fc188 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -54,58 +54,64 @@ enum eArete QUEST_THE_STORY_THUS_FAR = 12807 }; -bool GossipHello_npc_arete(Player* pPlayer, Creature* pCreature) +class npc_arete : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_arete() : CreatureScript("npc_arete") { } - if (pPlayer->GetQuestStatus(QUEST_THE_STORY_THUS_FAR) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE1, pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_THE_STORY_THUS_FAR) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE1, pCreature->GetGUID()); + return true; + } + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_arete(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE3, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE4, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE5, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE6, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE7, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(QUEST_THE_STORY_THUS_FAR); - break; - } + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE3, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE4, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE5, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE6, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE7, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(QUEST_THE_STORY_THUS_FAR); + break; + } - return true; -} + return true; + } +}; /*###### ## npc_dame_evniki_kapsalis @@ -116,21 +122,27 @@ enum eDameEnvikiKapsalis TITLE_CRUSADER = 123 }; -bool GossipHello_npc_dame_evniki_kapsalis(Player* pPlayer, Creature* pCreature) +class npc_dame_evniki_kapsalis : public CreatureScript { - if (pPlayer->HasTitle(TITLE_CRUSADER)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); +public: + npc_dame_evniki_kapsalis() : CreatureScript("npc_dame_evniki_kapsalis") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->HasTitle(TITLE_CRUSADER)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); -bool GossipSelect_npc_dame_evniki_kapsalis(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } +}; /*###### ## npc_squire_david @@ -149,30 +161,34 @@ enum eSquireDavid #define GOSSIP_SQUIRE_ITEM_1 "I am ready to fight!" #define GOSSIP_SQUIRE_ITEM_2 "How do the Argent Crusader raiders fight?" -bool GossipHello_npc_squire_david(Player* pPlayer, Creature* pCreature) +class npc_squire_david : public CreatureScript { - if (pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_H) == QUEST_STATUS_INCOMPLETE || - pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_A) == QUEST_STATUS_INCOMPLETE)//We need more info about it. +public: + npc_squire_david() : CreatureScript("npc_squire_david") { } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SQUIRE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SQUIRE_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - } + if (pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_H) == QUEST_STATUS_INCOMPLETE || + pPlayer->GetQuestStatus(QUEST_THE_ASPIRANT_S_CHALLENGE_A) == QUEST_STATUS_INCOMPLETE)//We need more info about it. + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SQUIRE_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SQUIRE_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + } - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_SQUIRE, pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_SQUIRE, pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_squire_david(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->SummonCreature(NPC_ARGENT_VALIANT,8575.451,952.472,547.554,0.38); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->SummonCreature(NPC_ARGENT_VALIANT,8575.451,952.472,547.554,0.38); + } + return true; } - //else - //pPlayer->SEND_GOSSIP_MENU(???, pCreature->GetGUID()); Missing text - return true; -} +}; /*###### ## npc_argent_valiant @@ -186,70 +202,76 @@ enum eArgentValiant NPC_ARGENT_VALIANT_CREDIT = 24108 }; -struct npc_argent_valiantAI : public ScriptedAI +class npc_argent_valiant : public CreatureScript { - npc_argent_valiantAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pCreature->GetMotionMaster()->MovePoint(0,8599.258,963.951,547.553); - pCreature->setFaction(35); //wrong faction in db? - } - - uint32 uiChargeTimer; - uint32 uiShieldBreakerTimer; +public: + npc_argent_valiant() : CreatureScript("npc_argent_valiant") { } - void Reset() + struct npc_argent_valiantAI : public ScriptedAI { - uiChargeTimer = 7000; - uiShieldBreakerTimer = 10000; - } - - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + npc_argent_valiantAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pCreature->GetMotionMaster()->MovePoint(0,8599.258,963.951,547.553); + pCreature->setFaction(35); //wrong faction in db? + } - me->setFaction(14); - } + uint32 uiChargeTimer; + uint32 uiShieldBreakerTimer; - void DamageTaken(Unit* pDoneBy, uint32& uiDamage) - { - if (uiDamage > me->GetHealth() && pDoneBy->GetTypeId() == TYPEID_PLAYER) + void Reset() { - uiDamage = 0; - CAST_PLR(pDoneBy)->KilledMonsterCredit(NPC_ARGENT_VALIANT_CREDIT,0); - me->setFaction(35); - me->ForcedDespawn(5000); - me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); - EnterEvadeMode(); + uiChargeTimer = 7000; + uiShieldBreakerTimer = 10000; } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; - if (uiChargeTimer <= uiDiff) + me->setFaction(14); + } + + void DamageTaken(Unit* pDoneBy, uint32& uiDamage) { - DoCastVictim(SPELL_CHARGE); - uiChargeTimer = 7000; - } else uiChargeTimer -= uiDiff; + if (uiDamage > me->GetHealth() && pDoneBy->GetTypeId() == TYPEID_PLAYER) + { + uiDamage = 0; + CAST_PLR(pDoneBy)->KilledMonsterCredit(NPC_ARGENT_VALIANT_CREDIT,0); + me->setFaction(35); + me->ForcedDespawn(5000); + me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); + EnterEvadeMode(); + } + } - if (uiShieldBreakerTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCastVictim(SPELL_SHIELD_BREAKER); - uiShieldBreakerTimer = 10000; - } else uiShieldBreakerTimer -= uiDiff; + if (!UpdateVictim()) + return; + + if (uiChargeTimer <= uiDiff) + { + DoCastVictim(SPELL_CHARGE); + uiChargeTimer = 7000; + } else uiChargeTimer -= uiDiff; + + if (uiShieldBreakerTimer <= uiDiff) + { + DoCastVictim(SPELL_SHIELD_BREAKER); + uiShieldBreakerTimer = 10000; + } else uiShieldBreakerTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); + CreatureAI *GetAI(Creature *creature) const + { + return new npc_argent_valiantAI(creature); } }; -CreatureAI* GetAI_npc_argent_valiant(Creature* pCreature) -{ - return new npc_argent_valiantAI (pCreature); -} - /*###### ## npc_argent_tournament_post ######*/ @@ -261,31 +283,37 @@ enum eArgentTournamentPost NPC_ICEHOWL = 35470 }; -struct npc_argent_tournament_postAI : public ScriptedAI +class npc_argent_tournament_post : public CreatureScript { - npc_argent_tournament_postAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_argent_tournament_post() : CreatureScript("npc_argent_tournament_post") { } - void UpdateAI(const uint32 /*uiDiff*/) + struct npc_argent_tournament_postAI : public ScriptedAI { - if (me->IsNonMeleeSpellCasted(false)) - return; + npc_argent_tournament_postAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + void UpdateAI(const uint32 /*uiDiff*/) + { + if (me->IsNonMeleeSpellCasted(false)) + return; + + if (Creature* pTarget = me->FindNearestCreature(NPC_GORMOK_THE_IMPALER, 6.0f)) + DoCast(pTarget, SPELL_ROPE_BEAM); - if (Creature* pTarget = me->FindNearestCreature(NPC_GORMOK_THE_IMPALER, 6.0f)) - DoCast(pTarget, SPELL_ROPE_BEAM); + if (Creature* pTarget2 = me->FindNearestCreature(NPC_ICEHOWL, 6.0f)) + DoCast(pTarget2, SPELL_ROPE_BEAM); - if (Creature* pTarget2 = me->FindNearestCreature(NPC_ICEHOWL, 6.0f)) - DoCast(pTarget2, SPELL_ROPE_BEAM); + if (!UpdateVictim()) + return; + } + }; - if (!UpdateVictim()) - return; + CreatureAI *GetAI(Creature *creature) const + { + return new npc_argent_tournament_postAI(creature); } }; -CreatureAI* GetAI_npc_argent_tournament_post(Creature* pCreature) -{ - return new npc_argent_tournament_postAI (pCreature); -} - /*###### ## npc_alorah_and_grimmin ######*/ @@ -299,46 +327,52 @@ enum ealorah_and_grimmin NPC_PRIEST_GRIMMIN = 36102 }; -struct npc_alorah_and_grimminAI : public ScriptedAI +class npc_alorah_and_grimmin : public CreatureScript { - npc_alorah_and_grimminAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - bool uiCast; +public: + npc_alorah_and_grimmin() : CreatureScript("npc_alorah_and_grimmin") { } - void Reset() + struct npc_alorah_and_grimminAI : public ScriptedAI { - uiCast = false; - } + npc_alorah_and_grimminAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 /*uiDiff*/) - { - if (uiCast) - return; - uiCast = true; - Creature* pTarget = NULL; + bool uiCast; - switch(me->GetEntry()) + void Reset() { - case NPC_PRIESTESS_ALORAH: - pTarget = me->FindNearestCreature(NPC_EYDIS_DARKBANE, 10.0f); - break; - case NPC_PRIEST_GRIMMIN: - pTarget = me->FindNearestCreature(NPC_FJOLA_LIGHTBANE, 10.0f); - break; + uiCast = false; + } + + void UpdateAI(const uint32 /*uiDiff*/) + { + if (uiCast) + return; + uiCast = true; + Creature* pTarget = NULL; + + switch(me->GetEntry()) + { + case NPC_PRIESTESS_ALORAH: + pTarget = me->FindNearestCreature(NPC_EYDIS_DARKBANE, 10.0f); + break; + case NPC_PRIEST_GRIMMIN: + pTarget = me->FindNearestCreature(NPC_FJOLA_LIGHTBANE, 10.0f); + break; + } + if (pTarget) + DoCast(pTarget, SPELL_CHAIN); + + if (!UpdateVictim()) + return; } - if (pTarget) - DoCast(pTarget, SPELL_CHAIN); + }; - if (!UpdateVictim()) - return; + CreatureAI *GetAI(Creature *creature) const + { + return new npc_alorah_and_grimminAI(creature); } }; -CreatureAI* GetAI_npc_alorah_and_grimmin(Creature* pCreature) -{ - return new npc_alorah_and_grimminAI (pCreature); -} - /*###### ## npc_guardian_pavilion ######*/ @@ -352,73 +386,47 @@ enum eGuardianPavilion SPELL_TRESPASSER_A = 63986, }; -struct npc_guardian_pavilionAI : public Scripted_NoMovementAI +class npc_guardian_pavilion : public CreatureScript { - npc_guardian_pavilionAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) {} +public: + npc_guardian_pavilion() : CreatureScript("npc_guardian_pavilion") { } - void MoveInLineOfSight(Unit* pWho) + struct npc_guardian_pavilionAI : public Scripted_NoMovementAI { - if (me->GetAreaId() != AREA_SUNREAVER_PAVILION && me->GetAreaId() != AREA_SILVER_COVENANT_PAVILION) - return; + npc_guardian_pavilionAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) {} + + void MoveInLineOfSight(Unit* pWho) + { + if (me->GetAreaId() != AREA_SUNREAVER_PAVILION && me->GetAreaId() != AREA_SILVER_COVENANT_PAVILION) + return; - if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER || !me->IsHostileTo(pWho) || !me->isInBackInMap(pWho, 5.0f)) - return; + if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER || !me->IsHostileTo(pWho) || !me->isInBackInMap(pWho, 5.0f)) + return; - if (pWho->HasAura(SPELL_TRESPASSER_H) || pWho->HasAura(SPELL_TRESPASSER_A)) - return; + if (pWho->HasAura(SPELL_TRESPASSER_H) || pWho->HasAura(SPELL_TRESPASSER_A)) + return; - if (pWho->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) - pWho->CastSpell(pWho, SPELL_TRESPASSER_H, true); - else - pWho->CastSpell(pWho, SPELL_TRESPASSER_A, true); + if (pWho->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) + pWho->CastSpell(pWho, SPELL_TRESPASSER_H, true); + else + pWho->CastSpell(pWho, SPELL_TRESPASSER_A, true); + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_guardian_pavilionAI(creature); } }; -CreatureAI* GetAI_npc_guardian_pavilion(Creature* pCreature) -{ - return new npc_guardian_pavilionAI (pCreature); -} - void AddSC_icecrown() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_arete"; - newscript->pGossipHello = &GossipHello_npc_arete; - newscript->pGossipSelect = &GossipSelect_npc_arete; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dame_evniki_kapsalis"; - newscript->pGossipHello = &GossipHello_npc_dame_evniki_kapsalis; - newscript->pGossipSelect = &GossipSelect_npc_dame_evniki_kapsalis; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_squire_david"; - newscript->pGossipHello = &GossipHello_npc_squire_david; - newscript->pGossipSelect = &GossipSelect_npc_squire_david; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_argent_valiant"; - newscript->GetAI = &GetAI_npc_argent_valiant; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_argent_tournament_post"; - newscript->GetAI = &GetAI_npc_argent_tournament_post; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_alorah_and_grimmin"; - newscript->GetAI = &GetAI_npc_alorah_and_grimmin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_guardian_pavilion"; - newscript->GetAI = &GetAI_npc_guardian_pavilion; - newscript->RegisterSelf(); + new npc_arete; + new npc_dame_evniki_kapsalis; + new npc_squire_david; + new npc_argent_valiant; + new npc_argent_tournament_post; + new npc_alorah_and_grimmin; + new npc_guardian_pavilion; } diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index cae5012eb3a..5c846d71760 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -48,117 +48,123 @@ enum eRainspeaker FACTION_ESCORTEE_H = 775 }; -struct npc_injured_rainspeaker_oracleAI : public npc_escortAI +class npc_injured_rainspeaker_oracle : public CreatureScript { - npc_injured_rainspeaker_oracleAI(Creature* c) : npc_escortAI(c) { c_guid = c->GetGUID(); } +public: + npc_injured_rainspeaker_oracle() : CreatureScript("npc_injured_rainspeaker_oracle") { } - uint64 c_guid; - - void Reset() + struct npc_injured_rainspeaker_oracleAI : public npc_escortAI { - me->RestoreFaction(); - // if we will have other way to assign this to only one npc remove this part - if (GUID_LOPART(me->GetGUID()) != 101030) - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - } + npc_injured_rainspeaker_oracleAI(Creature* c) : npc_escortAI(c) { c_guid = c->GetGUID(); } - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); + uint64 c_guid; - if (!pPlayer) - return; - - switch(i) + void Reset() { - case 1: SetRun(); break; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_JUMPING); - me->SetSpeed(MOVE_SWIM, 0.85f, true); - me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); - break; - case 19: - me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); - break; - case 28: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); - // me->RestoreFaction(); - DoScriptText(SAY_END_IRO,me); - SetRun(false); - break; + me->RestoreFaction(); + // if we will have other way to assign this to only one npc remove this part + if (GUID_LOPART(me->GetGUID()) != 101030) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } } - } - void JustDied(Unit* /*killer*/) - { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - return; + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 1: SetRun(); break; + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_JUMPING); + me->SetSpeed(MOVE_SWIM, 0.85f, true); + me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); + break; + case 19: + me->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); + break; + case 28: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me); + // me->RestoreFaction(); + DoScriptText(SAY_END_IRO,me); + SetRun(false); + break; + } + } - if (Player* pPlayer = GetPlayerForEscort()) + void JustDied(Unit* /*killer*/) { - if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) - pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (Player* pPlayer = GetPlayerForEscort()) + { + if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) + pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); + } } - } -}; + }; -bool GossipHello_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + return true; + } -bool GossipSelect_npc_injured_rainspeaker_oracle(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(35.0f); - pCreature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); - DoScriptText(SAY_START_IRO, pCreature); - - switch (pPlayer->GetTeam()){ - case ALLIANCE: - pCreature->setFaction(FACTION_ESCORTEE_A); - break; - case HORDE: - pCreature->setFaction(FACTION_ESCORTEE_H); - break; + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(35.0f); + pCreature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); + DoScriptText(SAY_START_IRO, pCreature); + + switch (pPlayer->GetTeam()){ + case ALLIANCE: + pCreature->setFaction(FACTION_ESCORTEE_A); + break; + case HORDE: + pCreature->setFaction(FACTION_ESCORTEE_H); + break; + } } + return true; } - return true; -} -bool QuestAccept_npc_injured_rainspeaker_oracle(Player* /*pPlayer*/, Creature* pCreature, Quest const * /*_Quest*/) -{ - DoScriptText(SAY_QUEST_ACCEPT_IRO, pCreature); - return false; -} + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, Quest const * /*_Quest*/) + { + DoScriptText(SAY_QUEST_ACCEPT_IRO, pCreature); + return false; + } -CreatureAI* GetAI_npc_injured_rainspeaker_oracle(Creature* pCreature) -{ - return new npc_injured_rainspeaker_oracleAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_injured_rainspeaker_oracleAI(creature); + } +}; /*###### ## npc_vekjik @@ -179,40 +185,46 @@ enum eVekjik QUEST_MAKING_PEACE = 12573 }; -bool GossipHello_npc_vekjik(Player* pPlayer, Creature* pCreature) +class npc_vekjik : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_vekjik() : CreatureScript("npc_vekjik") { } - if (pPlayer->GetQuestStatus(QUEST_MAKING_PEACE) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VEKJIK1, pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_MAKING_PEACE) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VEKJIK1, pCreature->GetGUID()); + return true; + } + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_vekjik(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VEKJIK2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - DoScriptText(SAY_TEXTID_VEKJIK1, pCreature, pPlayer); - pPlayer->AreaExploredOrEventHappens(QUEST_MAKING_PEACE); - pCreature->CastSpell(pPlayer, SPELL_FREANZYHEARTS_FURY, false); - break; - } + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VEKJIK2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + DoScriptText(SAY_TEXTID_VEKJIK1, pCreature, pPlayer); + pPlayer->AreaExploredOrEventHappens(QUEST_MAKING_PEACE); + pCreature->CastSpell(pPlayer, SPELL_FREANZYHEARTS_FURY, false); + break; + } - return true; -} + return true; + } +}; /*###### ## avatar_of_freya @@ -233,71 +245,83 @@ enum eFreya GOSSIP_TEXTID_AVATAR3 = 13305 }; -bool GossipHello_npc_avatar_of_freya(Player* pPlayer, Creature* pCreature) +class npc_avatar_of_freya : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_avatar_of_freya() : CreatureScript("npc_avatar_of_freya") { } - if (pPlayer->GetQuestStatus(QUEST_FREYA_PACT) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR1, pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestStatus(QUEST_FREYA_PACT) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -bool GossipSelect_npc_avatar_of_freya(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR1, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR3, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CastSpell(pPlayer, SPELL_FREYA_CONVERSATION, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXTID_AVATAR3, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CastSpell(pPlayer, SPELL_FREYA_CONVERSATION, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - return true; -} +}; /*###### -## npc_geezle +## npc_bushwhacker ######*/ -struct npc_bushwhackerAI : public ScriptedAI +class npc_bushwhacker : public CreatureScript { - npc_bushwhackerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - MoveToSummoner(); - } +public: + npc_bushwhacker() : CreatureScript("npc_bushwhacker") { } - void MoveToSummoner() + struct npc_bushwhackerAI : public ScriptedAI { - if (me->isSummon()) - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) - if (pSummoner) - me->GetMotionMaster()->MovePoint(0,pSummoner->GetPositionX(),pSummoner->GetPositionY(),pSummoner->GetPositionZ()); - } + npc_bushwhackerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + MoveToSummoner(); + } - void UpdateAI(const uint32 /*uiDiff*/) - { - if (!UpdateVictim()) - return; + void MoveToSummoner() + { + if (me->isSummon()) + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + if (pSummoner) + me->GetMotionMaster()->MovePoint(0,pSummoner->GetPositionX(),pSummoner->GetPositionY(),pSummoner->GetPositionZ()); + } + + void UpdateAI(const uint32 /*uiDiff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); + CreatureAI *GetAI(Creature *creature) const + { + return new npc_bushwhackerAI(creature); } }; -CreatureAI* GetAI_npc_bushwhacker(Creature* pCreature) -{ - return new npc_bushwhackerAI(pCreature); -} - /*###### ## npc_engineer_helice ######*/ @@ -318,132 +342,112 @@ enum eEnums QUEST_DISASTER = 12688 }; -struct npc_engineer_heliceAI : public npc_escortAI +class npc_engineer_helice : public CreatureScript { - npc_engineer_heliceAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - uint32 m_uiChatTimer; +public: + npc_engineer_helice() : CreatureScript("npc_engineer_helice") { } + + struct npc_engineer_heliceAI : public npc_escortAI + { + npc_engineer_heliceAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + uint32 m_uiChatTimer; + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 0: + DoScriptText(SAY_WP_2, me); + break; + case 1: + DoScriptText(SAY_WP_3, me); + me->CastSpell(5918.33, 5372.91, -98.770, SPELL_EXPLODE_CRYSTAL, true); + me->SummonGameObject(184743, 5918.33, 5372.91, -98.770, 0, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds + me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); + break; + case 2: + DoScriptText(SAY_WP_4, me); + break; + case 7: + DoScriptText(SAY_WP_5, me); + break; + case 8: + me->CastSpell(5887.37, 5379.39, -91.289, SPELL_EXPLODE_CRYSTAL, true); + me->SummonGameObject(184743, 5887.37, 5379.39, -91.289, 0, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds + me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); + break; + case 9: + DoScriptText(SAY_WP_6, me); + break; + case 13: + if (pPlayer) + { + pPlayer->GroupEventHappens(QUEST_DISASTER, me); + DoScriptText(SAY_WP_7, me); + } + break; + } + } - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); - switch (i) + void Reset() + { + m_uiChatTimer = 4000; + } + void JustDied(Unit* /*pKiller*/) { - case 0: - DoScriptText(SAY_WP_2, me); - break; - case 1: - DoScriptText(SAY_WP_3, me); - me->CastSpell(5918.33, 5372.91, -98.770, SPELL_EXPLODE_CRYSTAL, true); - me->SummonGameObject(184743, 5918.33, 5372.91, -98.770, 0, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds - me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - break; - case 2: - DoScriptText(SAY_WP_4, me); - break; - case 7: - DoScriptText(SAY_WP_5, me); - break; - case 8: - me->CastSpell(5887.37, 5379.39, -91.289, SPELL_EXPLODE_CRYSTAL, true); - me->SummonGameObject(184743, 5887.37, 5379.39, -91.289, 0, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds - me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); - break; - case 9: - DoScriptText(SAY_WP_6, me); - break; - case 13: - if (pPlayer) - { - pPlayer->GroupEventHappens(QUEST_DISASTER, me); - DoScriptText(SAY_WP_7, me); - } - break; + Player* pPlayer = GetPlayerForEscort(); + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + if (pPlayer) + pPlayer->FailQuest(QUEST_DISASTER); + } } - } - void Reset() - { - m_uiChatTimer = 4000; - } - void JustDied(Unit* /*pKiller*/) - { - Player* pPlayer = GetPlayerForEscort(); - if (HasEscortState(STATE_ESCORT_ESCORTING)) + void UpdateAI(const uint32 uiDiff) { - if (pPlayer) - pPlayer->FailQuest(QUEST_DISASTER); - } - } + npc_escortAI::UpdateAI(uiDiff); - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + if (m_uiChatTimer <= uiDiff) + { + m_uiChatTimer = 12000; + } + else + m_uiChatTimer -= uiDiff; + } + } + }; - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - if (m_uiChatTimer <= uiDiff) - { - m_uiChatTimer = 12000; - } - else - m_uiChatTimer -= uiDiff; - } + CreatureAI *GetAI(Creature *creature) const + { + return new npc_engineer_heliceAI(creature); } -}; - -CreatureAI* GetAI_npc_engineer_helice(Creature* pCreature) -{ - return new npc_engineer_heliceAI(pCreature); -} -bool QuestAccept_npc_engineer_helice(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_DISASTER) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - if (npc_engineer_heliceAI* pEscortAI = CAST_AI(npc_engineer_heliceAI, pCreature->AI())) - { - pCreature->GetMotionMaster()->MoveJumpTo(0, 0.4, 0.4); - pCreature->setFaction(113); + if (pQuest->GetQuestId() == QUEST_DISASTER) + { + if (npc_engineer_heliceAI* pEscortAI = CAST_AI(npc_engineer_heliceAI, pCreature->AI())) + { + pCreature->GetMotionMaster()->MoveJumpTo(0, 0.4, 0.4); + pCreature->setFaction(113); - pEscortAI->Start(false, false, pPlayer->GetGUID()); - DoScriptText(SAY_WP_1, pCreature); + pEscortAI->Start(false, false, pPlayer->GetGUID()); + DoScriptText(SAY_WP_1, pCreature); + } } + return true; } - return true; -} +}; void AddSC_sholazar_basin() { - Script *newscript; - newscript = new Script; - newscript->Name = "npc_injured_rainspeaker_oracle"; - newscript->GetAI = &GetAI_npc_injured_rainspeaker_oracle; - newscript->pGossipHello = &GossipHello_npc_injured_rainspeaker_oracle; - newscript->pGossipSelect = &GossipSelect_npc_injured_rainspeaker_oracle; - newscript->pQuestAccept = &QuestAccept_npc_injured_rainspeaker_oracle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_vekjik"; - newscript->pGossipHello = &GossipHello_npc_vekjik; - newscript->pGossipSelect = &GossipSelect_npc_vekjik; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_avatar_of_freya"; - newscript->pGossipHello = &GossipHello_npc_avatar_of_freya; - newscript->pGossipSelect = &GossipSelect_npc_avatar_of_freya; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_bushwhacker"; - newscript->GetAI = &GetAI_npc_bushwhacker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_engineer_helice"; - newscript->GetAI = &GetAI_npc_engineer_helice; - newscript->pQuestAccept = &QuestAccept_npc_engineer_helice; - newscript->RegisterSelf(); + new npc_injured_rainspeaker_oracle; + new npc_vekjik; + new npc_avatar_of_freya; + new npc_bushwhacker; + new npc_engineer_helice; } diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index a074cd2a2e9..aa6d7e9d9f2 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -31,42 +31,48 @@ enum eAgnetta FACTION_HOSTILE_AT1 = 45 }; -struct npc_agnetta_tyrsdottarAI : public ScriptedAI +class npc_agnetta_tyrsdottar : public CreatureScript { - npc_agnetta_tyrsdottarAI(Creature* pCreature) : ScriptedAI(pCreature) { } +public: + npc_agnetta_tyrsdottar() : CreatureScript("npc_agnetta_tyrsdottar") { } - void Reset() + struct npc_agnetta_tyrsdottarAI : public ScriptedAI { - me->RestoreFaction(); - } -}; - -CreatureAI* GetAI_npc_agnetta_tyrsdottar(Creature* pCreature) -{ - return new npc_agnetta_tyrsdottarAI(pCreature); -} + npc_agnetta_tyrsdottarAI(Creature* pCreature) : ScriptedAI(pCreature) { } -bool GossipHello_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_ITS_THAT_YOUR_GOBLIN) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AGNETTA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + void Reset() + { + me->RestoreFaction(); + } + }; - pPlayer->SEND_GOSSIP_MENU(13691, pCreature->GetGUID()); - return true; -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_agnetta_tyrsdottarAI(creature); + } -bool GossipSelect_npc_agnetta_tyrsdottar(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - DoScriptText(SAY_AGGRO, pCreature); - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(FACTION_HOSTILE_AT1); - pCreature->AI()->AttackStart(pPlayer); + if (pPlayer->GetQuestStatus(QUEST_ITS_THAT_YOUR_GOBLIN) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AGNETTA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(13691, pCreature->GetGUID()); + return true; } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + DoScriptText(SAY_AGGRO, pCreature); + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(FACTION_HOSTILE_AT1); + pCreature->AI()->AttackStart(pPlayer); + } + + return true; + } +}; /*###### ## npc_frostborn_scout @@ -81,38 +87,44 @@ enum eFrostbornScout QUEST_MISSING_SCOUTS = 12864 }; -bool GossipHello_npc_frostborn_scout(Player* pPlayer, Creature* pCreature) +class npc_frostborn_scout : public CreatureScript { +public: + npc_frostborn_scout() : CreatureScript("npc_frostborn_scout") { } - if (pPlayer->GetQuestStatus(QUEST_MISSING_SCOUTS) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->PlayerTalkClass->SendGossipMenu(13611, pCreature->GetGUID()); - } - return true; -} + if (pPlayer->GetQuestStatus(QUEST_MISSING_SCOUTS) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->PlayerTalkClass->SendGossipMenu(13611, pCreature->GetGUID()); + } -bool GossipSelect_npc_frostborn_scout(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->PlayerTalkClass->SendGossipMenu(13612, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->PlayerTalkClass->SendGossipMenu(13613, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->PlayerTalkClass->SendGossipMenu(13614, pCreature->GetGUID()); - pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_SCOUTS); - break; + return true; } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->PlayerTalkClass->SendGossipMenu(13612, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->PlayerTalkClass->SendGossipMenu(13613, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->PlayerTalkClass->SendGossipMenu(13614, pCreature->GetGUID()); + pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_SCOUTS); + break; + } + + return true; + } +}; /*###### ## npc_thorim @@ -133,42 +145,48 @@ enum eThorim GOSSIP_TEXTID_THORIM4 = 13803 }; -bool GossipHello_npc_thorim(Player* pPlayer, Creature* pCreature) +class npc_thorim : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_thorim() : CreatureScript("npc_thorim") { } - if (pPlayer->GetQuestStatus(QUEST_SIBLING_RIVALRY) == QUEST_STATUS_INCOMPLETE) { - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM1, pCreature->GetGUID()); - return true; + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_SIBLING_RIVALRY) == QUEST_STATUS_INCOMPLETE) { + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM1, pCreature->GetGUID()); + return true; + } + return false; } - return false; -} -bool GossipSelect_npc_thorim(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM3, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM4, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CompleteQuest(QUEST_SIBLING_RIVALRY); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM3, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM4, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CompleteQuest(QUEST_SIBLING_RIVALRY); + break; + } + return true; } - return true; -} +}; /*###### ## npc_goblin_prisoner @@ -179,27 +197,33 @@ enum eGoblinPrisoner GO_RUSTY_CAGE = 191544 }; -struct npc_goblin_prisonerAI : public ScriptedAI +class npc_goblin_prisoner : public CreatureScript { - npc_goblin_prisonerAI(Creature* pCreature) : ScriptedAI (pCreature){} +public: + npc_goblin_prisoner() : CreatureScript("npc_goblin_prisoner") { } - void Reset() + struct npc_goblin_prisonerAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); + npc_goblin_prisonerAI(Creature* pCreature) : ScriptedAI (pCreature){} - if (GameObject* pGO = me->FindNearestGameObject(GO_RUSTY_CAGE,5.0f)) + void Reset() { - if (pGO->GetGoState() == GO_STATE_ACTIVE) - pGO->SetGoState(GO_STATE_READY); + me->SetReactState(REACT_PASSIVE); + + if (GameObject* pGO = me->FindNearestGameObject(GO_RUSTY_CAGE,5.0f)) + { + if (pGO->GetGoState() == GO_STATE_ACTIVE) + pGO->SetGoState(GO_STATE_READY); + } } - } -}; + }; -CreatureAI* GetAI_npc_goblin_prisoner(Creature* pCreature) -{ - return new npc_goblin_prisonerAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_goblin_prisonerAI(creature); + } +}; /*###### ## npc_victorious_challenger @@ -216,80 +240,86 @@ enum eVictoriousChallenger SPELL_REND_VC = 11977 }; -struct npc_victorious_challengerAI : public ScriptedAI +class npc_victorious_challenger : public CreatureScript { - npc_victorious_challengerAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 SunderArmorTimer; - uint32 RendTimer; +public: + npc_victorious_challenger() : CreatureScript("npc_victorious_challenger") { } - void Reset() + struct npc_victorious_challengerAI : public ScriptedAI { - me->RestoreFaction(); + npc_victorious_challengerAI(Creature* pCreature) : ScriptedAI(pCreature) {} - SunderArmorTimer = 10000; - RendTimer = 15000; - } + uint32 SunderArmorTimer; + uint32 RendTimer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + me->RestoreFaction(); - if (RendTimer < diff) + SunderArmorTimer = 10000; + RendTimer = 15000; + } + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_REND_VC, true); - RendTimer = 15000; - }else RendTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + if (RendTimer < diff) + { + DoCast(me->getVictim(), SPELL_REND_VC, true); + RendTimer = 15000; + }else RendTimer -= diff; + + if (SunderArmorTimer < diff) + { + DoCast(me->getVictim(), SPELL_SUNDER_ARMOR, true); + SunderArmorTimer = 10000; + }else SunderArmorTimer -= diff; + + DoMeleeAttackIfReady(); + } - if (SunderArmorTimer < diff) + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_SUNDER_ARMOR, true); - SunderArmorTimer = 10000; - }else SunderArmorTimer -= diff; + me->RestoreFaction(); + } - DoMeleeAttackIfReady(); - } + }; - void KilledUnit(Unit* /*victim*/) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->RestoreFaction(); - } + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -}; + if (pPlayer->GetQuestStatus(QUEST_TAKING_ALL_CHALLENGERS) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_DEFENDING_YOUR_TITLE) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CHALLENGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -bool GossipHello_npc_victorious_challenger(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + return false; + } - if (pPlayer->GetQuestStatus(QUEST_TAKING_ALL_CHALLENGERS) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_DEFENDING_YOUR_TITLE) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CHALLENGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(14); + pCreature->AI()->AttackStart(pPlayer); + } + return true; } - return false; -} - -bool GossipSelect_npc_victorious_challenger(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + CreatureAI *GetAI(Creature *creature) const { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(14); - pCreature->AI()->AttackStart(pPlayer); + return new npc_victorious_challengerAI(creature); } - - return true; -} - -CreatureAI* GetAI_npc_victorious_challenger(Creature* pCreature) -{ - return new npc_victorious_challengerAI(pCreature); -} +}; /*###### ## npc_loklira_crone @@ -309,43 +339,49 @@ enum eLokliraCrone GOSSIP_TEXTID_LOK3 = 13780 }; -bool GossipHello_npc_loklira_crone(Player* pPlayer, Creature* pCreature) +class npc_loklira_crone : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_loklira_crone() : CreatureScript("npc_loklira_crone") { } - if (pPlayer->GetQuestStatus(QUEST_HYLDSMEET) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_HYLDSMEET) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + return false; } - return false; -} -bool GossipSelect_npc_loklira_crone(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK1, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK3, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CompleteQuest(QUEST_HYLDSMEET); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK1, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK3, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CompleteQuest(QUEST_HYLDSMEET); + break; + } + return true; } - return true; -} +}; ///////////////////// ///npc_injured_goblin @@ -360,84 +396,90 @@ enum eInjuredGoblin #define GOSSIP_ITEM_1 "I am ready, lets get you out of here" -struct npc_injured_goblinAI : public npc_escortAI +class npc_injured_goblin : public CreatureScript { - npc_injured_goblinAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_injured_goblin() : CreatureScript("npc_injured_goblin") { } - void WaypointReached(uint32 i) + struct npc_injured_goblinAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); - switch (i) + npc_injured_goblinAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void WaypointReached(uint32 i) { - case 26: - DoScriptText(SAY_END_WP_REACHED, me, pPlayer); - break; - case 27: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_BITTER_DEPARTURE, me); - break; + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 26: + DoScriptText(SAY_END_WP_REACHED, me, pPlayer); + break; + case 27: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_BITTER_DEPARTURE, me); + break; + } } - } - void EnterCombat(Unit* /*pWho*/) {} + void EnterCombat(Unit* /*pWho*/) {} - void Reset() {} + void Reset() {} - void JustDied(Unit* /*pKiller*/) - { - Player* pPlayer = GetPlayerForEscort(); - if (HasEscortState(STATE_ESCORT_ESCORTING) && pPlayer) - pPlayer->FailQuest(QUEST_BITTER_DEPARTURE); - } + void JustDied(Unit* /*pKiller*/) + { + Player* pPlayer = GetPlayerForEscort(); + if (HasEscortState(STATE_ESCORT_ESCORTING) && pPlayer) + pPlayer->FailQuest(QUEST_BITTER_DEPARTURE); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; - void UpdateAI(const uint32 uiDiff) + CreatureAI *GetAI(Creature *creature) const { - npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); + return new npc_injured_goblinAI(creature); } -}; - -CreatureAI* GetAI_npc_injured_goblin(Creature* pCreature) -{ - return new npc_injured_goblinAI(pCreature); -} - -bool GossipHello_npc_injured_goblin(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_BITTER_DEPARTURE) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->PlayerTalkClass->SendGossipMenu(9999999, pCreature->GetGUID()); - } - else - pPlayer->SEND_GOSSIP_MENU(999999, pCreature->GetGUID()); - return true; -} + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool QuestAccept_npc_injured_goblin(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest) -{ - if (quest->GetQuestId() == QUEST_BITTER_DEPARTURE) - DoScriptText(SAY_QUEST_ACCEPT, pCreature); + if (pPlayer->GetQuestStatus(QUEST_BITTER_DEPARTURE) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->PlayerTalkClass->SendGossipMenu(9999999, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(999999, pCreature->GetGUID()); + return true; + } - return false; -} + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest) + { + if (quest->GetQuestId() == QUEST_BITTER_DEPARTURE) + DoScriptText(SAY_QUEST_ACCEPT, pCreature); -bool GossipSelect_npc_injured_goblin(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblinAI, pCreature->AI()); + return false; + } - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pEscortAI->Start(true, true, pPlayer->GetGUID()); - pCreature->setFaction(113); + npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblinAI, pCreature->AI()); + + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pEscortAI->Start(true, true, pPlayer->GetGUID()); + pCreature->setFaction(113); + } + return true; } - return true; -} +}; /*###### ## npc_roxi_ramrocket @@ -446,91 +488,53 @@ bool GossipSelect_npc_injured_goblin(Player* pPlayer, Creature* pCreature, uint3 #define SPELL_MECHANO_HOG 60866 #define SPELL_MEKGINEERS_CHOPPER 60867 -bool GossipHello_npc_roxi_ramrocket(Player* pPlayer, Creature* pCreature) +class npc_roxi_ramrocket : public CreatureScript { - //Quest Menu - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_roxi_ramrocket() : CreatureScript("npc_roxi_ramrocket") { } - //Trainer Menu - if( pCreature->isTrainer() ) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + //Quest Menu + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - //Vendor Menu - if( pCreature->isVendor() ) - if(pPlayer->HasSpell(SPELL_MECHANO_HOG) || pPlayer->HasSpell(SPELL_MEKGINEERS_CHOPPER)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + //Trainer Menu + if( pCreature->isTrainer() ) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + //Vendor Menu + if( pCreature->isVendor() ) + if(pPlayer->HasSpell(SPELL_MECHANO_HOG) || pPlayer->HasSpell(SPELL_MEKGINEERS_CHOPPER)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); -bool GossipSelect_npc_roxi_ramrocket(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action ) -{ - switch(action) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action ) { - case GOSSIP_ACTION_TRAIN: - pPlayer->SEND_TRAINERLIST( pCreature->GetGUID() ); - break; - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST( pCreature->GetGUID() ); - break; + switch(action) + { + case GOSSIP_ACTION_TRAIN: + pPlayer->SEND_TRAINERLIST( pCreature->GetGUID() ); + break; + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST( pCreature->GetGUID() ); + break; + } + return true; } - return true; -} +}; void AddSC_storm_peaks() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_agnetta_tyrsdottar"; - newscript->GetAI = &GetAI_npc_agnetta_tyrsdottar; - newscript->pGossipHello = &GossipHello_npc_agnetta_tyrsdottar; - newscript->pGossipSelect = &GossipSelect_npc_agnetta_tyrsdottar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_frostborn_scout"; - newscript->pGossipHello = &GossipHello_npc_frostborn_scout; - newscript->pGossipSelect = &GossipSelect_npc_frostborn_scout; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thorim"; - newscript->pGossipHello = &GossipHello_npc_thorim; - newscript->pGossipSelect = &GossipSelect_npc_thorim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_goblin_prisoner"; - newscript->GetAI = &GetAI_npc_goblin_prisoner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_victorious_challenger"; - newscript->GetAI = &GetAI_npc_victorious_challenger; - newscript->pGossipHello = &GossipHello_npc_victorious_challenger; - newscript->pGossipSelect = &GossipSelect_npc_victorious_challenger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_loklira_crone"; - newscript->pGossipHello = &GossipHello_npc_loklira_crone; - newscript->pGossipSelect = &GossipSelect_npc_loklira_crone; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_injured_goblin"; - newscript->GetAI = &GetAI_npc_injured_goblin; - newscript->pGossipHello = &GossipHello_npc_injured_goblin; - newscript->pGossipSelect = &GossipSelect_npc_injured_goblin; - newscript->pQuestAccept = &QuestAccept_npc_injured_goblin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_roxi_ramrocket"; - newscript->pGossipHello = &GossipHello_npc_roxi_ramrocket; - newscript->pGossipSelect = &GossipSelect_npc_roxi_ramrocket; - newscript->RegisterSelf(); + new npc_agnetta_tyrsdottar; + new npc_frostborn_scout; + new npc_thorim; + new npc_goblin_prisoner; + new npc_victorious_challenger; + new npc_loklira_crone; + new npc_injured_goblin; + new npc_roxi_ramrocket; } diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 029d3fc7640..a11b886d65f 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -32,68 +32,74 @@ enum eDrakuruShackles NPC_RAGECLAW = 29686 }; -struct npc_drakuru_shacklesAI : public ScriptedAI +class npc_drakuru_shackles : public CreatureScript { - npc_drakuru_shacklesAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_drakuru_shackles() : CreatureScript("npc_drakuru_shackles") { } - uint64 RageclawGUID; - - void Reset() + struct npc_drakuru_shacklesAI : public ScriptedAI { - RageclawGUID = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + npc_drakuru_shacklesAI(Creature* pCreature) : ScriptedAI(pCreature) {} - float x, y, z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 0.1f); + uint64 RageclawGUID; - if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, - 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) + void Reset() { - RageclawGUID = summon->GetGUID(); - LockRageclaw(); + RageclawGUID = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + float x, y, z; + me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 0.1f); + + if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, + 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) + { + RageclawGUID = summon->GetGUID(); + LockRageclaw(); + } } - } - void LockRageclaw() - { - Unit *Rageclaw = Unit::GetCreature(*me, RageclawGUID); - // pointer check not needed - me->SetInFront(Rageclaw); - Rageclaw->SetInFront(me); + void LockRageclaw() + { + Unit *Rageclaw = Unit::GetCreature(*me, RageclawGUID); + // pointer check not needed + 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* pWho) - { - if (!pWho) - return; + void UnlockRageclaw(Unit* pWho) + { + if (!pWho) + return; - Creature *Rageclaw = Unit::GetCreature(*me, RageclawGUID); - // pointer check not needed - DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true); + Creature *Rageclaw = Unit::GetCreature(*me, RageclawGUID); + // pointer check not needed + DoCast(Rageclaw, SPELL_FREE_RAGECLAW, true); - me->setDeathState(DEAD); - } + me->setDeathState(DEAD); + } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_UNLOCK_SHACKLE) + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { - if (Creature *Rageclaw = Unit::GetCreature(*me, RageclawGUID)) - UnlockRageclaw(pCaster); - else - me->setDeathState(JUST_DIED); + if (pSpell->Id == SPELL_UNLOCK_SHACKLE) + { + if (Creature *Rageclaw = Unit::GetCreature(*me, RageclawGUID)) + UnlockRageclaw(pCaster); + else + me->setDeathState(JUST_DIED); + } } - } -}; + }; -CreatureAI* GetAI_npc_drakuru_shackles(Creature* pCreature) -{ - return new npc_drakuru_shacklesAI (pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_drakuru_shacklesAI(creature); + } +}; /*#### ## npc_captured_rageclaw @@ -111,65 +117,71 @@ const char * SAY_RAGECLAW_3 = "No more mister nice wolvar!"; #define SAY_RAGECLAW RAND(SAY_RAGECLAW_1,SAY_RAGECLAW_2,SAY_RAGECLAW_3) -struct npc_captured_rageclawAI : public ScriptedAI +class npc_captured_rageclaw : public CreatureScript { - npc_captured_rageclawAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_captured_rageclaw() : CreatureScript("npc_captured_rageclaw") { } - uint32 DespawnTimer; - bool Despawn; - - void Reset() + struct npc_captured_rageclawAI : public ScriptedAI { - Despawn = false; - DespawnTimer = 0; - me->setFaction(35); - DoCast(me, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P - } + npc_captured_rageclawAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void MoveInLineOfSight(Unit * /*who*/){} + uint32 DespawnTimer; + bool Despawn; - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_FREE_RAGECLAW) + 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 SpellEntry* pSpell) { - me->RemoveAurasDueToSpell(SPELL_LEFT_CHAIN); + if (pSpell->Id == SPELL_FREE_RAGECLAW) + { + me->RemoveAurasDueToSpell(SPELL_LEFT_CHAIN); - me->RemoveAurasDueToSpell(SPELL_RIGHT_CHAIN); + me->RemoveAurasDueToSpell(SPELL_RIGHT_CHAIN); - me->RemoveAurasDueToSpell(SPELL_KNEEL); + me->RemoveAurasDueToSpell(SPELL_KNEEL); - me->setFaction(me->GetCreatureInfo()->faction_H); + me->setFaction(me->GetCreatureInfo()->faction_H); - DoCast(me, SPELL_UNSHACKLED, true); - me->MonsterSay(SAY_RAGECLAW, LANG_UNIVERSAL, NULL); - me->GetMotionMaster()->MoveRandom(10); + DoCast(me, SPELL_UNSHACKLED, true); + me->MonsterSay(SAY_RAGECLAW, LANG_UNIVERSAL, NULL); + me->GetMotionMaster()->MoveRandom(10); - DespawnTimer = 10000; - Despawn = true; + DespawnTimer = 10000; + Despawn = true; + } } - } - void UpdateAI(const uint32 uiDiff) - { - if (UpdateVictim()) + void UpdateAI(const uint32 uiDiff) { - DoMeleeAttackIfReady(); - return; - } + if (UpdateVictim()) + { + DoMeleeAttackIfReady(); + return; + } - if (!Despawn) - return; + if (!Despawn) + return; - if (DespawnTimer <= uiDiff) - me->DisappearAndDie(); - else DespawnTimer -= uiDiff; - } -}; + if (DespawnTimer <= uiDiff) + me->DisappearAndDie(); + else DespawnTimer -= uiDiff; + } + }; -CreatureAI* GetAI_npc_captured_rageclaw(Creature* pCreature) -{ - return new npc_captured_rageclawAI (pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_captured_rageclawAI(creature); + } +}; /*#### ## npc_gymer @@ -183,32 +195,38 @@ enum eGymer SPELL_GYMER = 55568 }; -bool GossipHello_npc_gymer(Player* pPlayer, Creature* pCreature) +class npc_gymer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_gymer() : CreatureScript("npc_gymer") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(QUEST_STORM_KING_VENGEANCE) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_G, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(13640, pCreature->GetGUID()); - } + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -bool GossipSelect_npc_gymer(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_GYMER, true); + if (pPlayer->GetQuestStatus(QUEST_STORM_KING_VENGEANCE) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_G, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(13640, pCreature->GetGUID()); + } + + return true; } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_GYMER, true); + } + + return true; + } +}; /*#### ## npc_gurgthock @@ -299,233 +317,238 @@ const Position AddSpawnPosition[] = {5828.899, -2960.15479, 312.751648, 3.53}, // caster location }; - -struct npc_gurgthockAI : public ScriptedAI +class npc_gurgthock : public CreatureScript { - npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint64 SummonGUID; - uint64 uiPlayerGUID; +public: + npc_gurgthock() : CreatureScript("npc_gurgthock") { } - uint32 uiTimer; - uint32 uiPhase; - uint32 uiRemoveFlagTimer; - uint32 uiQuest; - uint8 uiBossRandom; + struct npc_gurgthockAI : public ScriptedAI + { + npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature) {} - bool bRemoveFlag; + uint64 SummonGUID; + uint64 uiPlayerGUID; - void Reset() - { - SummonGUID = 0; - uiPlayerGUID = 0; + uint32 uiTimer; + uint32 uiPhase; + uint32 uiRemoveFlagTimer; + uint32 uiQuest; + uint8 uiBossRandom; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - uiTimer = 0; - uiPhase = 0; - uiQuest = 0; - uiRemoveFlagTimer = 5000; + bool bRemoveFlag; - uiBossRandom = 0; + void Reset() + { + SummonGUID = 0; + uiPlayerGUID = 0; - bRemoveFlag = false; - } + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + uiTimer = 0; + uiPhase = 0; + uiQuest = 0; + uiRemoveFlagTimer = 5000; - void SetGUID(const uint64 &guid, int32 id) - { - uiPlayerGUID = guid; - } + uiBossRandom = 0; - void SetData(uint32 uiId, uint32 uiValue) - { - bRemoveFlag = true; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + bRemoveFlag = false; + } - switch(uiId) + void SetGUID(const uint64 &guid, int32 id) { - case 1: - switch(uiValue) - { - case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: - DoScriptText(SAY_QUEST_ACCEPT_TUSKARRMAGEDON, me); - uiPhase = 1; - uiTimer = 4000; - break; - case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: - DoScriptText(SAY_QUEST_ACCEPT_KORRAK_1, me); - uiPhase = 3; - uiTimer = 3000; - break; - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: - uiPhase = 6; - uiTimer = 3000; - break; - case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: - uiTimer = 5000; - uiPhase = 7; - break; - case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: - uiTimer = 2000; - uiPhase = 12; - break; - } - break; - } - } + uiPlayerGUID = guid; + } - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); + void SetData(uint32 uiId, uint32 uiValue) + { + bRemoveFlag = true; + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (bRemoveFlag) - if (uiRemoveFlagTimer <= uiDiff) + switch(uiId) { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - bRemoveFlag = false; - - uiRemoveFlagTimer = 10000; - } else uiRemoveFlagTimer -= uiDiff; + case 1: + switch(uiValue) + { + case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: + DoScriptText(SAY_QUEST_ACCEPT_TUSKARRMAGEDON, me); + uiPhase = 1; + uiTimer = 4000; + break; + case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: + DoScriptText(SAY_QUEST_ACCEPT_KORRAK_1, me); + uiPhase = 3; + uiTimer = 3000; + break; + case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: + case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: + uiPhase = 6; + uiTimer = 3000; + break; + case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: + uiTimer = 5000; + uiPhase = 7; + break; + case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: + uiTimer = 2000; + uiPhase = 12; + break; + } + break; + } + } - if (uiPhase) + void UpdateAI(const uint32 uiDiff) { - Player* pPlayer = me->GetPlayer(*me, uiPlayerGUID); + ScriptedAI::UpdateAI(uiDiff); - if (uiTimer <= uiDiff) - { - switch(uiPhase) + if (bRemoveFlag) + if (uiRemoveFlagTimer <= uiDiff) { - case 1: - if (Creature* pSummon = me->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - SummonGUID = pSummon->GetGUID(); - uiPhase = 2; - uiTimer = 4000; - break; - case 2: - if (Creature* pSummon = Unit::GetCreature(*me, SummonGUID)) - pSummon->GetMotionMaster()->MoveJump(5776.319824, -2981.005371, 273.100037, 10.0f, 20.0f); - uiPhase = 0; - SummonGUID = 0; - break; - case 3: - DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, me); - uiTimer = 3000; - uiPhase = 4; - break; - case 4: - if (Creature* pSummon = me->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - SummonGUID = pSummon->GetGUID(); - uiTimer = 3000; - uiPhase = 0; - break; - case 6: - { - if (!pPlayer) - return; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + bRemoveFlag = false; - std::string sText = ("The grand Amphitheater of Anguish awaits, " + std::string(pPlayer->GetName()) + ". Remember, once a battle starts you have to stay in the area. WIN OR DIE!"); + uiRemoveFlagTimer = 10000; + } else uiRemoveFlagTimer -= uiDiff; - me->MonsterSay(sText.c_str(),LANG_UNIVERSAL,0); - uiTimer = 5000; - uiPhase = 9; - } - break; - case 7: - { - if (!pPlayer) - return; + if (uiPhase) + { + Player* pPlayer = me->GetPlayer(*me, uiPlayerGUID); - std::string sText = ("Prepare to make you stand, " + std::string(pPlayer->GetName()) + "! Get in the Amphitheater and stand ready! Remember, you and your opponent must stay in the arena at all times or you will be disqualified!"); - me->MonsterSay(sText.c_str(),LANG_UNIVERSAL,0); + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + if (Creature* pSummon = me->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) + SummonGUID = pSummon->GetGUID(); + uiPhase = 2; + uiTimer = 4000; + break; + case 2: + if (Creature* pSummon = Unit::GetCreature(*me, SummonGUID)) + pSummon->GetMotionMaster()->MoveJump(5776.319824, -2981.005371, 273.100037, 10.0f, 20.0f); + uiPhase = 0; + SummonGUID = 0; + break; + case 3: + DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, me); uiTimer = 3000; - uiPhase = 8; - } - break; - case 8: - DoScriptText(SAY_QUEST_ACCEPT_MAGNATAUR, me); - uiTimer = 5000; - uiPhase = 11; - break; - case 9: + uiPhase = 4; + break; + case 4: + if (Creature* pSummon = me->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) + SummonGUID = pSummon->GetGUID(); + uiTimer = 3000; + uiPhase = 0; + break; + case 6: + { + if (!pPlayer) + return; + + std::string sText = ("The grand Amphitheater of Anguish awaits, " + std::string(pPlayer->GetName()) + ". Remember, once a battle starts you have to stay in the area. WIN OR DIE!"); + + me->MonsterSay(sText.c_str(),LANG_UNIVERSAL,0); + uiTimer = 5000; + uiPhase = 9; + } + break; + case 7: + { + if (!pPlayer) + return; + + std::string sText = ("Prepare to make you stand, " + std::string(pPlayer->GetName()) + "! Get in the Amphitheater and stand ready! Remember, you and your opponent must stay in the arena at all times or you will be disqualified!"); + me->MonsterSay(sText.c_str(),LANG_UNIVERSAL,0); + uiTimer = 3000; + uiPhase = 8; + } + break; + case 8: + DoScriptText(SAY_QUEST_ACCEPT_MAGNATAUR, me); + uiTimer = 5000; + uiPhase = 11; + break; + case 9: + { + if (!pPlayer) + return; + + std::string sText = ("Here we are once again, ladies and gentlemen. The epic struggle between life and death in the Amphitheater of Anguish! For this round we have " + std::string(pPlayer->GetName()) + " versus the hulking jormungar, Yg... Yggd? Yggdoze? Who comes up with these names?! " + std::string(pPlayer->GetName()) + " versus big worm!"); + me->MonsterYell(sText.c_str(),LANG_UNIVERSAL,0); + uiTimer = 10000; + uiPhase = 10; + } + break; + case 10: + me->SummonCreature(NPC_YGGDRAS, SpawnPosition[1], TEMPSUMMON_CORPSE_DESPAWN, 1000); + DoScriptText(EMOTE_YGGDRAS_SPAWN,me); + uiPhase = 0; + break; + case 11: + if (Creature* pCreature = me->SummonCreature(NPC_STINKBEARD, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) + DoScriptText(SAY_STINKBEARD_SPAWN,pCreature); + uiPhase = 0; + break; + case 12: { if (!pPlayer) return; - std::string sText = ("Here we are once again, ladies and gentlemen. The epic struggle between life and death in the Amphitheater of Anguish! For this round we have " + std::string(pPlayer->GetName()) + " versus the hulking jormungar, Yg... Yggd? Yggdoze? Who comes up with these names?! " + std::string(pPlayer->GetName()) + " versus big worm!"); - me->MonsterYell(sText.c_str(),LANG_UNIVERSAL,0); - uiTimer = 10000; - uiPhase = 10; + std::string sText = ("Prepare to make you stand, " + std::string(pPlayer->GetName()) + "! Get in the Amphitheater and stand ready! Remember, you and your opponent must stay in the arena at all times or you will be disqualified!"); + me->MonsterSay(sText.c_str(),LANG_UNIVERSAL,0); + uiTimer = 5000; + uiPhase = 13; } break; - case 10: - me->SummonCreature(NPC_YGGDRAS, SpawnPosition[1], TEMPSUMMON_CORPSE_DESPAWN, 1000); - DoScriptText(EMOTE_YGGDRAS_SPAWN,me); - uiPhase = 0; - break; - case 11: - if (Creature* pCreature = me->SummonCreature(NPC_STINKBEARD, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - DoScriptText(SAY_STINKBEARD_SPAWN,pCreature); - uiPhase = 0; - break; - case 12: - { - if (!pPlayer) - return; - - std::string sText = ("Prepare to make you stand, " + std::string(pPlayer->GetName()) + "! Get in the Amphitheater and stand ready! Remember, you and your opponent must stay in the arena at all times or you will be disqualified!"); - me->MonsterSay(sText.c_str(),LANG_UNIVERSAL,0); - uiTimer = 5000; - uiPhase = 13; - } - break; - case 13: - DoScriptText(SAY_GURGTHOCK_ELEMENTAL_SPAWN,me); - uiTimer = 3000; - uiPhase = 14; - break; - case 14: - uiBossRandom = urand(0,3); - if (Creature* pCreature = me->SummonCreature(Boss[uiBossRandom].uiBoss,SpawnPosition[2],TEMPSUMMON_CORPSE_DESPAWN, 1000)) - pCreature->AI()->SetData(1,uiBossRandom); - uiPhase = 0; - break; - } - }else uiTimer -= uiDiff; + case 13: + DoScriptText(SAY_GURGTHOCK_ELEMENTAL_SPAWN,me); + uiTimer = 3000; + uiPhase = 14; + break; + case 14: + uiBossRandom = urand(0,3); + if (Creature* pCreature = me->SummonCreature(Boss[uiBossRandom].uiBoss,SpawnPosition[2],TEMPSUMMON_CORPSE_DESPAWN, 1000)) + pCreature->AI()->SetData(1,uiBossRandom); + uiPhase = 0; + break; + } + }else uiTimer -= uiDiff; + } } - } -}; + }; -bool QuestAccept_npc_gurgthock(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - switch (pQuest->GetQuestId()) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: - pCreature->AI()->SetData(1, pQuest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: - pCreature->AI()->SetData(1, pQuest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: - pCreature->AI()->SetData(1, pQuest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: - pCreature->AI()->SetData(1, pQuest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: - pCreature->AI()->SetData(1, pQuest->GetQuestId()); - break; - } + switch (pQuest->GetQuestId()) + { + case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: + pCreature->AI()->SetData(1, pQuest->GetQuestId()); + break; + case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: + pCreature->AI()->SetData(1, pQuest->GetQuestId()); + break; + case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: + case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: + pCreature->AI()->SetData(1, pQuest->GetQuestId()); + break; + case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: + pCreature->AI()->SetData(1, pQuest->GetQuestId()); + break; + case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: + pCreature->AI()->SetData(1, pQuest->GetQuestId()); + break; + } - pCreature->AI()->SetGUID(pPlayer->GetGUID()); + pCreature->AI()->SetGUID(pPlayer->GetGUID()); - return false; -} + return false; + } -CreatureAI* GetAI_npc_gurgthock(Creature* pCreature) -{ - return new npc_gurgthockAI(pCreature); -} + CreatureAI *GetAI(Creature *creature) const + { + return new npc_gurgthockAI(creature); + } +}; /*#### ## npc_orinoko_tuskbreaker @@ -544,125 +567,131 @@ enum eOrinokoTuskbreaker SAY_CALL_FOR_HELP = -1571032 }; -struct npc_orinoko_tuskbreakerAI : public ScriptedAI +class npc_orinoko_tuskbreaker : public CreatureScript { - npc_orinoko_tuskbreakerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - } +public: + npc_orinoko_tuskbreaker() : CreatureScript("npc_orinoko_tuskbreaker") { } - bool bSummoned; - bool bBattleShout; - bool bFishyScent; - - uint32 uiBattleShoutTimer; - uint32 uiFishyScentTimer; - - uint64 AffectedGUID; - uint64 uiWhisker; - - void Reset() - { - bSummoned = false; - bBattleShout = false; - bFishyScent = false; - uiBattleShoutTimer = 0; - uiFishyScentTimer = 20000; - uiWhisker = 0; - AffectedGUID = 0; - } - - void EnterEvadeMode() + struct npc_orinoko_tuskbreakerAI : public ScriptedAI { - if (Creature *pWhisker = me->GetCreature(*me, uiWhisker)) - pWhisker->RemoveFromWorld(); - } - - void MovementInform(uint32 uiType, uint32 uiId) - { - if (uiType != POINT_MOTION_TYPE) - return; + npc_orinoko_tuskbreakerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); - uiBattleShoutTimer = 7000; - } + bool bSummoned; + bool bBattleShout; + bool bFishyScent; - void EnterCombat(Unit* pWho) - { - DoCast(pWho, SPELL_IMPALE); - } + uint32 uiBattleShoutTimer; + uint32 uiFishyScentTimer; - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint64 AffectedGUID; + uint64 uiWhisker; - if (!bBattleShout && uiBattleShoutTimer <= uiDiff) + void Reset() { - DoCast(me, SPELL_BATTLE_SHOUT); - bBattleShout = true; - } else uiBattleShoutTimer -= uiDiff; + bSummoned = false; + bBattleShout = false; + bFishyScent = false; + uiBattleShoutTimer = 0; + uiFishyScentTimer = 20000; + uiWhisker = 0; + AffectedGUID = 0; + } - if (uiFishyScentTimer <= uiDiff) + void EnterEvadeMode() { - if (Unit *pAffected = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - DoCast(pAffected, SPELL_FISHY_SCENT); - AffectedGUID = pAffected->GetGUID(); - } - uiFishyScentTimer = 20000; - } else uiFishyScentTimer -= uiDiff; + if (Creature *pWhisker = me->GetCreature(*me, uiWhisker)) + pWhisker->RemoveFromWorld(); + } - if (!bSummoned && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + void MovementInform(uint32 uiType, uint32 uiId) { - DoScriptText(SAY_CALL_FOR_HELP ,me); - //DoCast(me->getVictim(), SPELL_SUMMON_WHISKER); petai is not working correctly??? + if (uiType != POINT_MOTION_TYPE) + return; - 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; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); + uiBattleShoutTimer = 7000; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit* pWho) + { + DoCast(pWho, SPELL_IMPALE); + } - void JustSummoned(Creature* pSummon) - { - switch(pSummon->GetEntry()) + void UpdateAI(const uint32 uiDiff) { - case NPC_WHISKER: - pSummon->AI()->AttackStart(me->getVictim()); - break; - case NPC_HUNGRY_PENGUIN: - if (Unit *pAffected = Unit::GetUnit(*me, AffectedGUID)) + if (!UpdateVictim()) + return; + + if (!bBattleShout && uiBattleShoutTimer <= uiDiff) + { + DoCast(me, SPELL_BATTLE_SHOUT); + bBattleShout = true; + } else uiBattleShoutTimer -= uiDiff; + + if (uiFishyScentTimer <= uiDiff) + { + if (Unit *pAffected = SelectUnit(SELECT_TARGET_RANDOM,0)) { - if (pAffected->isAlive()) - pSummon->AI()->AttackStart(pAffected); + DoCast(pAffected, SPELL_FISHY_SCENT); + AffectedGUID = pAffected->GetGUID(); } - break; + uiFishyScentTimer = 20000; + } else uiFishyScentTimer -= uiDiff; + + if (!bSummoned && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + { + DoScriptText(SAY_CALL_FOR_HELP ,me); + //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; + } + + DoMeleeAttackIfReady(); } - } - void JustDied(Unit* pKiller) - { - if (uiWhisker) - if (Creature *pWhisker = me->GetCreature(*me, uiWhisker)) - pWhisker->RemoveFromWorld(); + void JustSummoned(Creature* pSummon) + { + switch(pSummon->GetEntry()) + { + case NPC_WHISKER: + pSummon->AI()->AttackStart(me->getVictim()); + break; + case NPC_HUNGRY_PENGUIN: + if (Unit *pAffected = Unit::GetUnit(*me, AffectedGUID)) + { + if (pAffected->isAlive()) + pSummon->AI()->AttackStart(pAffected); + } + break; + } + } + + void JustDied(Unit* pKiller) + { + if (uiWhisker) + if (Creature *pWhisker = me->GetCreature(*me, uiWhisker)) + pWhisker->RemoveFromWorld(); - if (pKiller->GetTypeId() == TYPEID_PLAYER) - pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, pKiller); + if (pKiller->GetTypeId() == TYPEID_PLAYER) + pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, pKiller); + } + }; + + CreatureAI *GetAI(Creature *creature) const + { + return new npc_orinoko_tuskbreakerAI(creature); } }; -CreatureAI* GetAI_npc_orinoko_tuskbreaker(Creature* pCreature) -{ - return new npc_orinoko_tuskbreakerAI(pCreature); -} - /*#### ## npc_korrak_bloodrager ####*/ @@ -675,86 +704,92 @@ enum eKorrakBloodrager SPELL_ENRAGE = 42745 }; -struct npc_korrak_bloodragerAI : public npc_escortAI +class npc_korrak_bloodrager : public CreatureScript { - npc_korrak_bloodragerAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_korrak_bloodrager() : CreatureScript("npc_korrak_bloodrager") { } + + struct npc_korrak_bloodragerAI : public npc_escortAI { - Start(true,true, 0, NULL); - SetDespawnAtEnd(false); - } + npc_korrak_bloodragerAI(Creature* pCreature) : npc_escortAI(pCreature) + { + Start(true,true, 0, NULL); + SetDespawnAtEnd(false); + } - uint32 uiChargeTimer; - uint32 uiUppercutTimer; + uint32 uiChargeTimer; + uint32 uiUppercutTimer; - bool bEnrage; + bool bEnrage; - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - uiChargeTimer = 15000; - uiUppercutTimer = 12000; - bEnrage = false; - } + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + uiChargeTimer = 15000; + uiUppercutTimer = 12000; + bEnrage = false; + } - void WaypointReached(uint32 uiI) - { - switch(uiI) + void WaypointReached(uint32 uiI) { - case 6: - me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), 0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - break; + switch(uiI) + { + case 6: + me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), 0); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + break; + } } - } - void EnterCombat(Unit* /*pWho*/) - { - DoCast(me, SPELL_GROW); - } + void EnterCombat(Unit* /*pWho*/) + { + DoCast(me, SPELL_GROW); + } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (uiUppercutTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_NEAREST, 0)) - DoCast(pTarget, SPELL_UPPERCUT); - uiUppercutTimer = 12000; - } else uiUppercutTimer -= uiDiff; + if (uiUppercutTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_NEAREST, 0)) + DoCast(pTarget, SPELL_UPPERCUT); + uiUppercutTimer = 12000; + } else uiUppercutTimer -= uiDiff; - if (uiChargeTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_FARTHEST, 0)) - DoCast(pTarget, SPELL_CHARGE); - uiChargeTimer = 15000; - } else uiChargeTimer -= uiDiff; + if (uiChargeTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_FARTHEST, 0)) + DoCast(pTarget, SPELL_CHARGE); + uiChargeTimer = 15000; + } else uiChargeTimer -= uiDiff; - if (!bEnrage && me->GetHealth()*100 / me->GetMaxHealth() <= 20) + if (!bEnrage && me->GetHealth()*100 / me->GetMaxHealth() <= 20) + { + DoCast(me, SPELL_ENRAGE); + bEnrage = true; + } + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* pKiller) { - DoCast(me, SPELL_ENRAGE); - bEnrage = true; + if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, pKiller); } - DoMeleeAttackIfReady(); - } + }; - void JustDied(Unit* pKiller) + CreatureAI *GetAI(Creature *creature) const { - if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, pKiller); + return new npc_korrak_bloodragerAI(creature); } }; -CreatureAI* GetAI_npc_korrak_bloodrager(Creature* pCreature) -{ - return new npc_korrak_bloodragerAI(pCreature); -} - /*#### ## npc_yggdras ####*/ @@ -766,81 +801,91 @@ enum eYggdras SPELL_JORMUNGAR_SPAWN = 55859 }; -struct npc_yggdrasAI : public ScriptedAI +class npc_yggdras : public CreatureScript { - npc_yggdrasAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 uiCleaveTimer; - uint32 uiCorrodeFleshTimer; +public: + npc_yggdras() : CreatureScript("npc_yggdras") { } - void Reset() + struct npc_yggdrasAI : public ScriptedAI { - uiCleaveTimer = 9000; - uiCorrodeFleshTimer = 6000; - } + npc_yggdrasAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 uiCleaveTimer; + uint32 uiCorrodeFleshTimer; + + void Reset() + { + uiCleaveTimer = 9000; + uiCorrodeFleshTimer = 6000; + } - if (me->getVictim()->GetPositionZ() >= 286.276) + void UpdateAI(const uint32 uiDiff) { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (!UpdateVictim()) + return; + + if (me->getVictim()->GetPositionZ() >= 286.276) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (pUnit->GetPositionZ() <= 286.276) + if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - me->getThreatManager().resetAllAggro(); - me->AddThreat(pUnit,5.0f); - break; + if (pUnit->GetPositionZ() <= 286.276) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(pUnit,5.0f); + break; + } + EnterEvadeMode(); } - EnterEvadeMode(); } } - } - if (uiCleaveTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - uiCleaveTimer = 9000; - } else uiCleaveTimer -= uiDiff; + if (uiCleaveTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + uiCleaveTimer = 9000; + } else uiCleaveTimer -= uiDiff; - if (uiCorrodeFleshTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CORRODE_FLESH); - uiCorrodeFleshTimer = 6000; - } else uiCorrodeFleshTimer -= uiDiff; + if (uiCorrodeFleshTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CORRODE_FLESH); + uiCorrodeFleshTimer = 6000; + } else uiCorrodeFleshTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* pKiller) - { - if (Unit* pSummoner = me->ToTempSummon()->GetSummoner()) + void JustDied(Unit* pKiller) { - std::string sText = (std::string(pKiller->GetName()) + " has defeated Yg.. Yggg-really big worm!"); - pSummoner->MonsterYell(sText.c_str(),LANG_UNIVERSAL,0); - } + if (Unit* pSummoner = me->ToTempSummon()->GetSummoner()) + { + std::string sText = (std::string(pKiller->GetName()) + " has defeated Yg.. Yggg-really big worm!"); + pSummoner->MonsterYell(sText.c_str(),LANG_UNIVERSAL,0); + } - if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - pPlayer->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1, pKiller); - pPlayer->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2, pKiller); + if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) + { + pPlayer->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1, pKiller); + pPlayer->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2, pKiller); + } + + for (uint8 i = 0; i < 3; ++i) + DoCast(pKiller, SPELL_JORMUNGAR_SPAWN, true); } + }; - for (uint8 i = 0; i < 3; ++i) - DoCast(pKiller, SPELL_JORMUNGAR_SPAWN, true); + CreatureAI *GetAI(Creature *creature) const + { + return new npc_yggdrasAI(creature); } }; -CreatureAI* GetAI_npc_yggdras(Creature* pCreature) -{ - return new npc_yggdrasAI(pCreature); -} +/*#### +## npc_stinkbeard +####*/ enum eStinkbeard { @@ -851,350 +896,370 @@ enum eStinkbeard SPELL_THUNDERCLAP = 15588 }; -/*#### -## npc_stinkbeard -####*/ - -struct npc_stinkbeardAI : public npc_escortAI +class npc_stinkbeard : public CreatureScript { - npc_stinkbeardAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_stinkbeard() : CreatureScript("npc_stinkbeard") { } + + struct npc_stinkbeardAI : public npc_escortAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - Start(true,true, 0, NULL); - SetDespawnAtEnd(false); - } + npc_stinkbeardAI(Creature* pCreature) : npc_escortAI(pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + Start(true,true, 0, NULL); + SetDespawnAtEnd(false); + } - uint32 uiKnockAwayTimer; - uint32 uiStinkyBeardTimer; + uint32 uiKnockAwayTimer; + uint32 uiStinkyBeardTimer; - bool bEnrage; - bool bThunderClap; + bool bEnrage; + bool bThunderClap; - void Reset() - { - me->AddAura(SPELL_THUNDERBLADE,me); - uiKnockAwayTimer = 10000; - uiStinkyBeardTimer = 15000; - bEnrage = false; - bThunderClap = false; - } + void Reset() + { + me->AddAura(SPELL_THUNDERBLADE,me); + uiKnockAwayTimer = 10000; + uiStinkyBeardTimer = 15000; + bEnrage = false; + bThunderClap = false; + } - void WaypointReached(uint32 uiI) - { - switch(uiI) + void WaypointReached(uint32 uiI) { - case 7: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - break; + switch(uiI) + { + case 7: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + break; + } } - } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (Unit* victim = me->getVictim()) - { - if (victim->GetPositionZ() >= 286.276) + if (Unit* victim = me->getVictim()) { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (victim->GetPositionZ() >= 286.276) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (pUnit->GetPositionZ() <= 286.276) + if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - me->getThreatManager().resetAllAggro(); - me->AddThreat(pUnit,5.0f); - break; + if (pUnit->GetPositionZ() <= 286.276) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(pUnit,5.0f); + break; + } + EnterEvadeMode(); } - EnterEvadeMode(); } } } - } - - if (bThunderClap && me->GetHealth()*100 / me->GetMaxHealth() <= 10) - { - DoCastAOE(SPELL_THUNDERCLAP); - bThunderClap = true; - } - - if (uiKnockAwayTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + + if (bThunderClap && me->GetHealth()*100 / me->GetMaxHealth() <= 10) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, SPELL_KNOCK_AWAY); + DoCastAOE(SPELL_THUNDERCLAP); + bThunderClap = true; } - uiKnockAwayTimer = 10000; - } else uiKnockAwayTimer -= uiDiff; - if (uiStinkyBeardTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (uiKnockAwayTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, SPELL_KNOCK_AWAY); + } + uiKnockAwayTimer = 10000; + } else uiKnockAwayTimer -= uiDiff; + + if (uiStinkyBeardTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, SPELL_STINKY_BEARD); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, SPELL_STINKY_BEARD); + } + uiStinkyBeardTimer = 15000; + } else uiStinkyBeardTimer -= uiDiff; + + if (!bEnrage && me->GetHealth()*100 / me->GetMaxHealth() <= 20) + { + DoCast(me, SPELL_ENRAGE_STINKBEARD); + bEnrage = true; } - uiStinkyBeardTimer = 15000; - } else uiStinkyBeardTimer -= uiDiff; + DoMeleeAttackIfReady(); + } - if (!bEnrage && me->GetHealth()*100 / me->GetMaxHealth() <= 20) + void JustDied(Unit* pKiller) { - DoCast(me, SPELL_ENRAGE_STINKBEARD); - bEnrage = true; + if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR, pKiller); + + std::string sText = ("And with AUTHORITY, " + std::string(pKiller->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); } - DoMeleeAttackIfReady(); - } + }; - void JustDied(Unit* pKiller) + CreatureAI *GetAI(Creature *creature) const { - if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR, pKiller); - - std::string sText = ("And with AUTHORITY, " + std::string(pKiller->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); + return new npc_stinkbeardAI(creature); } }; -CreatureAI* GetAI_npc_stinkbeard(Creature* pCreature) -{ - return new npc_stinkbeardAI(pCreature); -} - /*#### ## npc_elemental_lord ####*/ -struct npc_elemental_lordAI : public ScriptedAI +class npc_elemental_lord : public CreatureScript { - npc_elemental_lordAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_elemental_lord() : CreatureScript("npc_elemental_lord") { } - std::list<uint64> SummonList; - - uint32 uiElementalSpellTimer; + struct npc_elemental_lordAI : public ScriptedAI + { + npc_elemental_lordAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uint8 uiBossRandom; - uint32 uiSpellEntry; + std::list<uint64> SummonList; - bool bAddAttack; + uint32 uiElementalSpellTimer; - void Reset() - { - uiBossRandom = 0; - uiSpellEntry = 0; - uiElementalSpellTimer = urand(5000,8000); + uint8 uiBossRandom; + uint32 uiSpellEntry; - bAddAttack = false; - } + bool bAddAttack; - void SetData(uint32 uiData, uint32 uiValue) - { - if (uiData == 1) + void Reset() { - uiBossRandom = uiValue; - SummonAdds(); - } - } - - void SummonAdds() - { - if (!Boss[uiBossRandom].uiAdd) - return; + uiBossRandom = 0; + uiSpellEntry = 0; + uiElementalSpellTimer = urand(5000,8000); - SummonList.clear(); + bAddAttack = false; + } - for (uint8 uiI = 0; uiI < 16 ; uiI++) + void SetData(uint32 uiData, uint32 uiValue) { - if (Creature* pSummon = me->SummonCreature(Boss[uiBossRandom].uiAdd,AddSpawnPosition[uiI])) + if (uiData == 1) { - pSummon->AI()->SetData(1,uiBossRandom); - SummonList.push_back(pSummon->GetGUID()); + uiBossRandom = uiValue; + SummonAdds(); } } - - } - void EnterCombat(Unit* pUnit) - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + void SummonAdds() + { + if (!Boss[uiBossRandom].uiAdd) + return; + + SummonList.clear(); + + for (uint8 uiI = 0; uiI < 16 ; uiI++) { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (Creature* pSummon = me->SummonCreature(Boss[uiBossRandom].uiAdd,AddSpawnPosition[uiI])) { - pTemp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :( - pTemp->AI()->AttackStart(pUnit); + pSummon->AI()->SetData(1,uiBossRandom); + SummonList.push_back(pSummon->GetGUID()); } } - } + + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit* pUnit) + { + if (!SummonList.empty()) + for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + { + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + { + pTemp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :( + pTemp->AI()->AttackStart(pUnit); + } + } + } - if (me->getVictim()->GetPositionZ() >= 286.276) + void UpdateAI(const uint32 uiDiff) { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (!UpdateVictim()) + return; + + if (me->getVictim()->GetPositionZ() >= 286.276) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (pUnit->GetPositionZ() <= 286.276) + if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - me->getThreatManager().resetAllAggro(); - me->AddThreat(pUnit,5.0f); - break; + if (pUnit->GetPositionZ() <= 286.276) + { + me->getThreatManager().resetAllAggro(); + me->AddThreat(pUnit,5.0f); + break; + } + EnterEvadeMode(); } - EnterEvadeMode(); } } - } - - if (uiElementalSpellTimer <= uiDiff) - { - DoCastVictim(Boss[uiBossRandom].uiSpell); + + if (uiElementalSpellTimer <= uiDiff) + { + DoCastVictim(Boss[uiBossRandom].uiSpell); - uiElementalSpellTimer = urand(5000,8000); - } else uiElementalSpellTimer -= uiDiff; + uiElementalSpellTimer = urand(5000,8000); + } else uiElementalSpellTimer -= uiDiff; + + if (!bAddAttack && me->GetHealth()*100 / me->GetMaxHealth() <= 20) + { + if (!SummonList.empty()) + for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + { + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + { + if (pTemp->GetPositionZ() >= 287.00f) + continue; + + if (pTemp->getVictim()) + pTemp->GetMotionMaster()->MoveChase(pTemp->getVictim()); + } + } + + bAddAttack = true; + } - if (!bAddAttack && me->GetHealth()*100 / me->GetMaxHealth() <= 20) + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* pKiller) { if (!SummonList.empty()) for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) { if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - { - if (pTemp->GetPositionZ() >= 287.00f) - continue; - - if (pTemp->getVictim()) - pTemp->GetMotionMaster()->MoveChase(pTemp->getVictim()); - } + pTemp->ForcedDespawn(); } - - bAddAttack = true; - } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* pKiller) - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - pTemp->ForcedDespawn(); - } + if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND, pKiller); - if (Player* pPlayer = pKiller->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND, pKiller); + std::string sText = (std::string(pKiller->GetName()) + " is victorious once more!"); - std::string sText = (std::string(pKiller->GetName()) + " is victorious once more!"); + if (Unit* pSummoner = me->ToTempSummon()->GetSummoner()) + pSummoner->MonsterYell(sText.c_str(),LANG_UNIVERSAL,0); + } + }; - if (Unit* pSummoner = me->ToTempSummon()->GetSummoner()) - pSummoner->MonsterYell(sText.c_str(),LANG_UNIVERSAL,0); + CreatureAI *GetAI(Creature* creature) const + { + return new npc_elemental_lordAI(creature); } }; -CreatureAI* GetAI_npc_elemental_lord(Creature* pCreature) -{ - return new npc_elemental_lordAI(pCreature); -} - /*#### ## npc_fiend_elemental ####*/ -struct npc_fiend_elementalAI : public ScriptedAI +class npc_fiend_elemental : public CreatureScript { - npc_fiend_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 uiMissleTimer; - uint32 uiSpell; +public: + npc_fiend_elemental() : CreatureScript("npc_fiend_elemental") { } - void Reset() + struct npc_fiend_elementalAI : public ScriptedAI { - if (me->GetPositionZ() >= 287.0f) - me->GetMotionMaster()->MoveIdle(); + npc_fiend_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) {} - uiSpell = 0; - uiMissleTimer = urand(2000,7000); - } + uint32 uiMissleTimer; + uint32 uiSpell; - void AttackStart(Unit* pWho) - { - if (!pWho) - return; - - AttackStartNoMove(pWho); - } - - void SetData(uint32 uiData, uint32 uiValue) - { - if (uiData == 1) - uiSpell = Boss[uiValue].uiAddSpell; + void Reset() + { + if (me->GetPositionZ() >= 287.0f) + me->GetMotionMaster()->MoveIdle(); - } + uiSpell = 0; + uiMissleTimer = urand(2000,7000); + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void AttackStart(Unit* pWho) + { + if (!pWho) + return; + + AttackStartNoMove(pWho); + } - if (me->GetPositionZ() >= 287.0f) - if (uiMissleTimer <= uiDiff) - { - DoCast(me,uiSpell); // this spell is not supported ... YET! - uiMissleTimer = urand(2000,7000); + void SetData(uint32 uiData, uint32 uiValue) + { + if (uiData == 1) + uiSpell = Boss[uiValue].uiAddSpell; + + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (me->GetPositionZ() >= 287.0f) + if (uiMissleTimer <= uiDiff) + { + DoCast(me,uiSpell); // this spell is not supported ... YET! + uiMissleTimer = urand(2000,7000); + + } else uiMissleTimer -= uiDiff; - } else uiMissleTimer -= uiDiff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); + CreatureAI *GetAI(Creature *creature) const + { + return new npc_fiend_elementalAI(creature); } }; -CreatureAI* GetAI_npc_fiend_elemental(Creature* pCreature) -{ - return new npc_fiend_elementalAI(pCreature); -} - /*#### ## npc_released_offspring_harkoa ####*/ -struct npc_released_offspring_harkoaAI : public ScriptedAI +class npc_released_offspring_harkoa : public CreatureScript { - npc_released_offspring_harkoaAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_released_offspring_harkoa() : CreatureScript("npc_released_offspring_harkoa") { } - void Reset() + struct npc_released_offspring_harkoaAI : public ScriptedAI { - float x, y, z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 25.0f); - me->GetMotionMaster()->MovePoint(0, x, y, z); - } + npc_released_offspring_harkoaAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void MovementInform(uint32 uiType, uint32 /*uiId*/) + void Reset() + { + float x, y, z; + me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 25.0f); + me->GetMotionMaster()->MovePoint(0, x, y, z); + } + + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; + me->DisappearAndDie(); + } + }; + + CreatureAI *GetAI(Creature *creature) const { - if (uiType != POINT_MOTION_TYPE) - return; - me->DisappearAndDie(); + return new npc_released_offspring_harkoaAI(creature); } }; -CreatureAI* GetAI_npc_released_offspring_harkoa(Creature* pCreature) -{ - return new npc_released_offspring_harkoaAI(pCreature); -} - /*###### ## npc_crusade_recruit ######*/ @@ -1214,91 +1279,97 @@ enum eCrusade_recruit #define GOSSIP_ITEM_1 "Get out there and make those Scourge wish they were never reborn!" -struct npc_crusade_recruitAI : public ScriptedAI +class npc_crusade_recruit : public CreatureScript { - npc_crusade_recruitAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint8 m_uiPhase; //The current phase we are in - uint32 m_uiTimer; //Timer until phase transition - float m_heading; //Store creature heading +public: + npc_crusade_recruit() : CreatureScript("npc_crusade_recruit") { } - void Reset() + struct npc_crusade_recruitAI : public ScriptedAI { - 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(); - } + npc_crusade_recruitAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 uiDiff) - { - if (m_uiPhase) + 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(); + } + + void UpdateAI(const uint32 uiDiff) { - if (m_uiTimer <= uiDiff) + if (m_uiPhase) { - switch(m_uiPhase) + if (m_uiTimer <= uiDiff) { - case 1: - // say random text - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - DoScriptText(RAND(SAY_RECRUIT_1,SAY_RECRUIT_2,SAY_RECRUIT_3), me); - m_uiTimer = 3000; - m_uiPhase = 2; - break; - case 2: - // walk forward - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - 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; + 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); + DoScriptText(RAND(SAY_RECRUIT_1,SAY_RECRUIT_2,SAY_RECRUIT_3), me); + m_uiTimer = 3000; + m_uiPhase = 2; + break; + case 2: + // walk forward + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + 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; + } } + else + m_uiTimer -= uiDiff; } - else - m_uiTimer -= uiDiff; + ScriptedAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; } - ScriptedAI::UpdateAI(uiDiff); + }; - if (!UpdateVictim()) - return; + CreatureAI *GetAI(Creature *creature) const + { + return new npc_crusade_recruitAI(creature); } -}; -CreatureAI* GetAI_npc_crusade_recruit(Creature* pCreature) -{ - return new npc_crusade_recruitAI (pCreature); -} - -bool GossipHello_npc_crusade_recruit(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_CRUSADE_TEXT, pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(GOSSIP_CRUSADE_TEXT, pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_crusade_recruit(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_QUEST_CREDIT, true); - CAST_AI(npc_crusade_recruitAI, (pCreature->AI()))->m_uiPhase = 1; - pCreature->SetInFront(pPlayer); - pCreature->SendMovementFlagUpdate(); - } + if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_QUEST_CREDIT, true); + CAST_AI(npc_crusade_recruitAI, (pCreature->AI()))->m_uiPhase = 1; + pCreature->SetInFront(pPlayer); + pCreature->SendMovementFlagUpdate(); + } - return true; -} + return true; + } +}; /*###### ## Quest 12916: Our Only Hope! @@ -1311,92 +1382,41 @@ enum eScourgeEnclosure NPC_GYMER_DUMMY = 29928 //from quest template }; -bool GOHello_go_scourge_enclosure(Player* pPlayer, GameObject* pGO) +class go_scourge_enclosure : public GameObjectScript { - if (pPlayer->GetQuestStatus(QUEST_OUR_ONLY_HOPE) == QUEST_STATUS_INCOMPLETE) +public: + go_scourge_enclosure() : GameObjectScript("go_scourge_enclosure") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGO) { - Creature* pGymerDummy = pGO->FindNearestCreature(NPC_GYMER_DUMMY,20.0f); - if (pGymerDummy) + if (pPlayer->GetQuestStatus(QUEST_OUR_ONLY_HOPE) == QUEST_STATUS_INCOMPLETE) { - pGO->UseDoorOrButton(); - pPlayer->KilledMonsterCredit(pGymerDummy->GetEntry(),pGymerDummy->GetGUID()); - pGymerDummy->CastSpell(pGymerDummy, 55529, true); - pGymerDummy->DisappearAndDie(); + Creature* pGymerDummy = pGO->FindNearestCreature(NPC_GYMER_DUMMY,20.0f); + if (pGymerDummy) + { + pGO->UseDoorOrButton(); + pPlayer->KilledMonsterCredit(pGymerDummy->GetEntry(),pGymerDummy->GetGUID()); + pGymerDummy->CastSpell(pGymerDummy, 55529, true); + pGymerDummy->DisappearAndDie(); + } } + return true; } - return true; -} +}; void AddSC_zuldrak() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_drakuru_shackles"; - newscript->GetAI = &GetAI_npc_drakuru_shackles; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_captured_rageclaw"; - newscript->GetAI = &GetAI_npc_captured_rageclaw; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_gymer"; - newscript->pGossipHello = &GossipHello_npc_gymer; - newscript->pGossipSelect = &GossipSelect_npc_gymer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_gurgthock"; - newscript->GetAI = &GetAI_npc_gurgthock; - newscript->pQuestAccept = &QuestAccept_npc_gurgthock; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_orinoko_tuskbreaker"; - newscript->GetAI = &GetAI_npc_orinoko_tuskbreaker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_korrak_bloodrager"; - newscript->GetAI = &GetAI_npc_korrak_bloodrager; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_yggdras"; - newscript->GetAI = &GetAI_npc_yggdras; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_stinkbeard"; - newscript->GetAI = &GetAI_npc_stinkbeard; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_released_offspring_harkoa"; - newscript->GetAI = &GetAI_npc_released_offspring_harkoa; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_crusade_recruit"; - newscript->GetAI = &GetAI_npc_crusade_recruit; - newscript->pGossipHello = &GossipHello_npc_crusade_recruit; - newscript->pGossipSelect = &GossipSelect_npc_crusade_recruit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_elemental_lord"; - newscript->GetAI = &GetAI_npc_elemental_lord; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_fiend_elemental"; - newscript->GetAI = &GetAI_npc_fiend_elemental; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_scourge_enclosure"; - newscript->pGOHello = &GOHello_go_scourge_enclosure; - newscript->RegisterSelf(); + new npc_drakuru_shackles; + new npc_captured_rageclaw; + new npc_gymer; + new npc_gurgthock; + new npc_orinoko_tuskbreaker; + new npc_korrak_bloodrager; + new npc_yggdras; + new npc_stinkbeard; + new npc_released_offspring_harkoa; + new npc_crusade_recruit; + new npc_elemental_lord; + new npc_fiend_elemental; + new go_scourge_enclosure; } |
