diff options
author | Malcrom <malcromdev@gmail.com> | 2013-12-24 12:15:41 -0330 |
---|---|---|
committer | Malcrom <malcromdev@gmail.com> | 2013-12-24 12:15:41 -0330 |
commit | 9d2d4ba921757d6aaa3d06e5bab2be1a288f3ffd (patch) | |
tree | 9c30872e7a3ec37cc910489b7856ceece31d31e1 /src | |
parent | eacc165a12d8bda6a2353b426704617be8a2028a (diff) |
Scripting/Hellfire: Moved some gossip to db and fix some magic numbers.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Outland/zone_hellfire_peninsula.cpp | 364 |
1 files changed, 108 insertions, 256 deletions
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 672cf51bdb7..01f0f938501 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -19,18 +19,15 @@ /* ScriptData SDName: Hellfire_Peninsula SD%Complete: 100 -SDComment: Quest support: 9375, 9410, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths) +SDComment: Quest support: 9375, 9410, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths) "Needs update" SDCategory: Hellfire Peninsula EndScriptData */ /* ContentData npc_aeranas npc_ancestral_wolf -go_haaleshi_altar -npc_naladu -npc_tracy_proudwell -npc_trollbane npc_wounded_blood_elf +npc_fel_guard_hound EndContentData */ #include "ScriptMgr.h" @@ -46,14 +43,12 @@ EndContentData */ enum Aeranas { - SAY_SUMMON = 0, - SAY_FREE = 1, - - FACTION_HOSTILE = 16, - FACTION_FRIENDLY = 35, - - SPELL_ENVELOPING_WINDS = 15535, - SPELL_SHOCK = 12553 + SAY_SUMMON = 0, + SAY_FREE = 1, + FACTION_HOSTILE = 16, + FACTION_FRIENDLY = 35, + SPELL_ENVELOPING_WINDS = 15535, + SPELL_SHOCK = 12553 }; class npc_aeranas : public CreatureScript @@ -61,24 +56,15 @@ class npc_aeranas : public CreatureScript public: npc_aeranas() : CreatureScript("npc_aeranas") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_aeranasAI(creature); - } - struct npc_aeranasAI : public ScriptedAI { npc_aeranasAI(Creature* creature) : ScriptedAI(creature) { } - uint32 Faction_Timer; - uint32 EnvelopingWinds_Timer; - uint32 Shock_Timer; - void Reset() OVERRIDE { - Faction_Timer = 8000; - EnvelopingWinds_Timer = 9000; - Shock_Timer = 5000; + faction_Timer = 8000; + envelopingWinds_Timer = 9000; + shock_Timer = 5000; me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); me->setFaction(FACTION_FRIENDLY); @@ -88,13 +74,13 @@ public: void UpdateAI(uint32 diff) OVERRIDE { - if (Faction_Timer) + if (faction_Timer) { - if (Faction_Timer <= diff) + if (faction_Timer <= diff) { me->setFaction(FACTION_HOSTILE); - Faction_Timer = 0; - } else Faction_Timer -= diff; + faction_Timer = 0; + } else faction_Timer -= diff; } if (!UpdateVictim()) @@ -111,21 +97,31 @@ public: return; } - if (Shock_Timer <= diff) + if (shock_Timer <= diff) { DoCastVictim(SPELL_SHOCK); - Shock_Timer = 10000; - } else Shock_Timer -= diff; + shock_Timer = 10000; + } else shock_Timer -= diff; - if (EnvelopingWinds_Timer <= diff) + if (envelopingWinds_Timer <= diff) { DoCastVictim(SPELL_ENVELOPING_WINDS); - EnvelopingWinds_Timer = 25000; - } else EnvelopingWinds_Timer -= diff; + envelopingWinds_Timer = 25000; + } else envelopingWinds_Timer -= diff; DoMeleeAttackIfReady(); } + + private: + uint32 faction_Timer; + uint32 envelopingWinds_Timer; + uint32 shock_Timer; }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_aeranasAI(creature); + } }; /*###### @@ -134,13 +130,11 @@ public: enum AncestralWolf { - EMOTE_WOLF_LIFT_HEAD = 0, - EMOTE_WOLF_HOWL = 1, - SAY_WOLF_WELCOME = 2, - - SPELL_ANCESTRAL_WOLF_BUFF = 29981, - - NPC_RYGA = 17123 + EMOTE_WOLF_LIFT_HEAD = 0, + EMOTE_WOLF_HOWL = 1, + SAY_WOLF_WELCOME = 2, + SPELL_ANCESTRAL_WOLF_BUFF = 29981, + NPC_RYGA = 17123 }; class npc_ancestral_wolf : public CreatureScript @@ -148,11 +142,6 @@ class npc_ancestral_wolf : public CreatureScript public: npc_ancestral_wolf() : CreatureScript("npc_ancestral_wolf") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ancestral_wolfAI(creature); - } - struct npc_ancestral_wolfAI : public npc_escortAI { npc_ancestral_wolfAI(Creature* creature) : npc_escortAI(creature) @@ -166,20 +155,18 @@ public: Reset(); } - Creature* pRyga; - void Reset() OVERRIDE { - pRyga = NULL; + ryga = NULL; DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true); } void MoveInLineOfSight(Unit* who) OVERRIDE { - if (!pRyga && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f)) + if (!ryga && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f)) if (Creature* temp = who->ToCreature()) - pRyga = temp; + ryga = temp; npc_escortAI::MoveInLineOfSight(who); } @@ -195,154 +182,19 @@ public: Talk(EMOTE_WOLF_HOWL); break; case 50: - if (pRyga && pRyga->IsAlive() && !pRyga->IsInCombat()) - pRyga->AI()->Talk(SAY_WOLF_WELCOME); + if (ryga && ryga->IsAlive() && !ryga->IsInCombat()) + ryga->AI()->Talk(SAY_WOLF_WELCOME); break; } } - }; -}; - -/*###### -## npc_naladu -######*/ - -#define GOSSIP_NALADU_ITEM1 "Why don't you escape?" - -enum Naladu -{ - GOSSIP_TEXTID_NALADU1 = 9788 -}; - -class npc_naladu : public CreatureScript -{ -public: - npc_naladu() : CreatureScript("npc_naladu") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF+1) - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_NALADU1, creature->GetGUID()); - - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NALADU_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } -}; - -/*###### -## npc_tracy_proudwell -######*/ - -#define GOSSIP_TEXT_REDEEM_MARKS "I have marks to redeem!" -#define GOSSIP_TRACY_PROUDWELL_ITEM1 "I heard that your dog Fei Fei took Klatu's prayer beads..." -#define GOSSIP_TRACY_PROUDWELL_ITEM2 "<back>" - -enum Tracy -{ - GOSSIP_TEXTID_TRACY_PROUDWELL1 = 10689, - QUEST_DIGGING_FOR_PRAYER_BEADS = 10916 -}; - -class npc_tracy_proudwell : public CreatureScript -{ -public: - npc_tracy_proudwell() : CreatureScript("npc_tracy_proudwell") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TRACY_PROUDWELL1, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_TRADE: - player->GetSession()->SendListInventory(creature->GetGUID()); - break; - } - - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (creature->IsVendor()) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_REDEEM_MARKS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (player->GetQuestStatus(QUEST_DIGGING_FOR_PRAYER_BEADS) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } -}; - -/*###### -## npc_trollbane -######*/ - -#define GOSSIP_TROLLBANE_ITEM1 "Tell me of the Sons of Lothar." -#define GOSSIP_TROLLBANE_ITEM2 "<more>" -#define GOSSIP_TROLLBANE_ITEM3 "Tell me of your homeland." - -enum Trollbane -{ - GOSSIP_TEXTID_TROLLBANE1 = 9932, - GOSSIP_TEXTID_TROLLBANE2 = 9933, - GOSSIP_TEXTID_TROLLBANE3 = 8772 -}; - -class npc_trollbane : public CreatureScript -{ -public: - npc_trollbane() : CreatureScript("npc_trollbane") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE1, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE2, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE3, creature->GetGUID()); - break; - } - - return true; - } + private: + Creature* ryga; + }; - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; + return new npc_ancestral_wolfAI(creature); } }; @@ -358,8 +210,10 @@ enum WoundedBloodElf SAY_ELF_SUMMON2 = 3, SAY_ELF_COMPLETE = 4, SAY_ELF_AGGRO = 5, - - QUEST_ROAD_TO_FALCON_WATCH = 9375 + QUEST_ROAD_TO_FALCON_WATCH = 9375, + NPC_HAALESHI_WINDWALKER = 16966, + NPC_HAALESHI_TALONGUARD = 16967, + FACTION_FALCON_WATCH_QUEST = 775 }; class npc_wounded_blood_elf : public CreatureScript @@ -367,28 +221,22 @@ class npc_wounded_blood_elf : public CreatureScript public: npc_wounded_blood_elf() : CreatureScript("npc_wounded_blood_elf") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE + struct npc_wounded_blood_elfAI : public npc_escortAI { - if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_wounded_blood_elf::npc_wounded_blood_elfAI, creature->AI())) - pEscortAI->Start(true, false, player->GetGUID()); - - // Change faction so mobs attack - creature->setFaction(775); - } + npc_wounded_blood_elfAI(Creature* creature) : npc_escortAI(creature) { } - return true; - } + void Reset() OVERRIDE { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_wounded_blood_elfAI(creature); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + Talk(SAY_ELF_AGGRO); + } - struct npc_wounded_blood_elfAI : public npc_escortAI - { - npc_wounded_blood_elfAI(Creature* creature) : npc_escortAI(creature) { } + void JustSummoned(Creature* summoned) OVERRIDE + { + summoned->AI()->AttackStart(me); + } void WaypointReached(uint32 waypointId) OVERRIDE { @@ -404,8 +252,8 @@ public: case 9: Talk(SAY_ELF_SUMMON1, player); // Spawn two Haal'eshi Talonguard - DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(NPC_HAALESHI_TALONGUARD, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); break; case 13: Talk(SAY_ELF_RESTING, player); @@ -413,8 +261,8 @@ public: case 14: Talk(SAY_ELF_SUMMON2, player); // Spawn two Haal'eshi Windwalker - DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(NPC_HAALESHI_WINDWALKER, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); break; case 27: Talk(SAY_ELF_COMPLETE, player); @@ -423,20 +271,26 @@ public: break; } } + }; - void Reset() OVERRIDE { } - - void EnterCombat(Unit* /*who*/) OVERRIDE + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE + { + if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - Talk(SAY_ELF_AGGRO); - } + if (npc_escortAI* pEscortAI = CAST_AI(npc_wounded_blood_elf::npc_wounded_blood_elfAI, creature->AI())) + pEscortAI->Start(true, false, player->GetGUID()); - void JustSummoned(Creature* summoned) OVERRIDE - { - summoned->AI()->AttackStart(me); + // Change faction so mobs attack + creature->setFaction(FACTION_FALCON_WATCH_QUEST); } - }; + + return true; + } + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_wounded_blood_elfAI(creature); + } }; /*###### @@ -445,9 +299,8 @@ public: enum FelGuard { - SPELL_SUMMON_POO = 37688, - - NPC_DERANGED_HELBOAR = 16863 + SPELL_SUMMON_POO = 37688, + NPC_DERANGED_HELBOAR = 16863 }; class npc_fel_guard_hound : public CreatureScript @@ -455,32 +308,24 @@ class npc_fel_guard_hound : public CreatureScript public: npc_fel_guard_hound() : CreatureScript("npc_fel_guard_hound") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_fel_guard_houndAI(creature); - } - struct npc_fel_guard_houndAI : public ScriptedAI { npc_fel_guard_houndAI(Creature* creature) : ScriptedAI(creature) { } - uint32 uiCheckTimer; - uint64 uiHelboarGUID; - void Reset() OVERRIDE { - uiCheckTimer = 5000; //check for creature every 5 sec - uiHelboarGUID = 0; + checkTimer = 5000; //check for creature every 5 sec + helboarGUID = 0; } - void MovementInform(uint32 uiType, uint32 uiId) OVERRIDE + void MovementInform(uint32 type, uint32 id) OVERRIDE { - if (uiType != POINT_MOTION_TYPE || uiId != 1) + if (type != POINT_MOTION_TYPE || id != 1) return; - if (Creature* pHelboar = me->GetCreature(*me, uiHelboarGUID)) + if (Creature* helboar = me->GetCreature(*me, helboarGUID)) { - pHelboar->RemoveCorpse(); + helboar->RemoveCorpse(); DoCast(SPELL_SUMMON_POO); if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) @@ -488,36 +333,43 @@ public: } } - void UpdateAI(uint32 uiDiff) OVERRIDE + void UpdateAI(uint32 diff) OVERRIDE { - if (uiCheckTimer <= uiDiff) + if (checkTimer <= diff) { - if (Creature* pHelboar = me->FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false)) + if (Creature* helboar = me->FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false)) { - if (pHelboar->GetGUID() != uiHelboarGUID && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) + if (helboar->GetGUID() != helboarGUID && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) { - uiHelboarGUID = pHelboar->GetGUID(); - me->GetMotionMaster()->MovePoint(1, pHelboar->GetPositionX(), pHelboar->GetPositionY(), pHelboar->GetPositionZ()); + helboarGUID = helboar->GetGUID(); + me->GetMotionMaster()->MovePoint(1, helboar->GetPositionX(), helboar->GetPositionY(), helboar->GetPositionZ()); } } - uiCheckTimer = 5000; - }else uiCheckTimer -= uiDiff; + checkTimer = 5000; + } + else checkTimer -= diff; if (!UpdateVictim()) return; DoMeleeAttackIfReady(); } + + private: + uint32 checkTimer; + uint64 helboarGUID; }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_fel_guard_houndAI(creature); + } }; void AddSC_hellfire_peninsula() { new npc_aeranas(); new npc_ancestral_wolf(); - new npc_naladu(); - new npc_tracy_proudwell(); - new npc_trollbane(); new npc_wounded_blood_elf(); new npc_fel_guard_hound(); } |