From 9eea348d8256633a0f333dd7d6eb256b4c25ec06 Mon Sep 17 00:00:00 2001 From: Rushor Date: Fri, 30 Jan 2015 17:27:58 +0100 Subject: Scripts/Areatrigger: Assign Script to 'Ancient Leaves' Trigger --- src/server/scripts/Kalimdor/zone_felwood.cpp | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/zone_felwood.cpp b/src/server/scripts/Kalimdor/zone_felwood.cpp index cdf04b1d4cc..91b9ce08010 100644 --- a/src/server/scripts/Kalimdor/zone_felwood.cpp +++ b/src/server/scripts/Kalimdor/zone_felwood.cpp @@ -100,7 +100,44 @@ public: } }; +/*###### +## at_ancient_leaf +######*/ + +enum AncientMisc +{ + QUEST_ANCIENT_LEAF = 7632, + NPC_VARTRUS = 14524, + NPC_STOMA = 14525, + NPC_HASTAT = 14526, + CREATURE_GROUP_ANCIENTS = 1 +}; + +class at_ancient_leaf : public AreaTriggerScript +{ + public: + at_ancient_leaf() : AreaTriggerScript("at_ancient_leaf") { } + + bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) override + { + if (player->IsGameMaster() || !player->IsAlive()) + return false; + + // Handle Call Ancients event start - The area trigger summons 3 ancients + if ((player->GetQuestStatus(QUEST_ANCIENT_LEAF) == QUEST_STATUS_COMPLETE) || (player->GetQuestStatus(QUEST_ANCIENT_LEAF) == QUEST_STATUS_REWARDED)) + { + // If ancients are already spawned, skip the rest + if (GetClosestCreatureWithEntry(player, NPC_VARTRUS, 50.0f) || GetClosestCreatureWithEntry(player, NPC_STOMA, 50.0f) || GetClosestCreatureWithEntry(player, NPC_HASTAT, 50.0f)) + return true; + + player->GetMap()->SummonCreatureGroup(CREATURE_GROUP_ANCIENTS); + } + return false; + } +}; + void AddSC_felwood() { new npcs_riverbreeze_and_silversky(); + new at_ancient_leaf(); } -- cgit v1.2.3