diff options
author | Anubisss <none@none> | 2009-05-20 23:08:46 +0200 |
---|---|---|
committer | Anubisss <none@none> | 2009-05-20 23:08:46 +0200 |
commit | 425bb9fb55aec1c8d64cd6798b9a8f253d16e99a (patch) | |
tree | 79164a6ae89e5411e6a762a8c2644b5f46bea706 | |
parent | a78ade9503138aff02352bdb782ee62203a8f742 (diff) |
*Merge SD2.
*r978: Added few basic parts for ramparts instance script to be used in further development.
*r979: Added support for quest 9686. - Skip this patch. Its already scripted.
*r980: Added gossip to play movie cutscene after quest 12499/12500 rewarded.
*r981: Clean up some code and correcting icon for gossip items. - Just use enums.
*r982: Added support for quest 938 (consider it a test for similar quests)
--HG--
branch : trunk
14 files changed, 513 insertions, 21 deletions
diff --git a/sql/updates/3433_world.sql b/sql/updates/3433_world.sql new file mode 100644 index 00000000000..0d5b0eeda61 --- /dev/null +++ b/sql/updates/3433_world.sql @@ -0,0 +1,10 @@ +UPDATE `instance_template` SET `script` = 'instance_ramparts' WHERE `map` = 543; + +UPDATE `creature_template` SET `ScriptName` = 'npc_alexstrasza_wr_gate' WHERE `entry` = 31333; + +UPDATE `creature_template` SET `ScriptName` = 'npc_mist' WHERE `entry` = 3568; + +DELETE FROM `script_texts` WHERE `entry` IN (-1000411, -1000412); +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000411, 'Mist! I feared I would never see you again! Yes, I am well, do not worry for me. You must rest and recover your health.', 0, 0, 7, 0, 'mist SAY_AT_HOME'), +(-1000412, 'growls in acknowledgement before straightening and making her way off into the forest.', 0, 2, 0, 0, 'mist EMOTE_AT_HOME'); diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index ce502d37bf9..b8423969e7d 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -403,6 +403,9 @@ UPDATE `gameobject_template` SET `ScriptName`='go_defias_cannon' WHERE `entry`=1 UPDATE `gameobject_template` SET `ScriptName`='go_door_lever_dm' WHERE `entry`=101833; UPDATE `gameobject_template` SET `ScriptName`='go_main_chambers_access_panel' WHERE `entry` IN (184125,184126); +/* DRAGONBLIGHT */ +UPDATE `creature_template` SET `ScriptName`='npc_alexstrasza_wr_gate' WHERE `entry`=31333; + /* DEADWIND PASS */ /* DESOLACE */ @@ -479,6 +482,8 @@ UPDATE `creature_template` SET `ScriptName`='mob_broggok_poisoncloud' WHERE `ent UPDATE `creature_template` SET `ScriptName`='mob_shadowmoon_channeler' WHERE `entry`=17653; /* HELLFIRE RAMPARTS */ +UPDATE `instance_template` SET `script`='instance_ramparts' WHERE `map`=543; + /* Vazruden,Omor the Unscarred,Watchkeeper Gargolmar */ UPDATE `creature_template` SET `ScriptName`='boss_omor_the_unscarred' WHERE `entry`=17308; UPDATE `creature_template` SET `ScriptName`='boss_watchkeeper_gargolmar' WHERE `entry`=17306; @@ -848,6 +853,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_stone_watcher_of_norgannon' WHE UPDATE `creature_template` SET `ScriptName`='npc_OOX17' WHERE `entry`=7784; /* TELDRASSIL */ +UPDATE `creature_template` SET `ScriptName`='npc_mist' WHERE `entry`=3568; /* TEMPEST KEEP */ diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index b491d653501..92047628b30 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -149,6 +149,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/darkshore/darkshore.cpp scripts/zone/deadmines/def_deadmines.h scripts/zone/deadmines/deadmines.cpp + scripts/zone/dragonblight/dragonblight.cpp scripts/zone/dun_morogh/dun_morogh.cpp scripts/zone/dustwallow_marsh/dustwallow_marsh.cpp scripts/zone/eastern_plaguelands/eastern_plaguelands.cpp @@ -170,6 +171,8 @@ SET(trinityscript_LIB_SRCS scripts/zone/hellfire_citadel/hellfire_ramparts/boss_omor_the_unscarred.cpp scripts/zone/hellfire_citadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp + scripts/zone/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h + scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp scripts/zone/hellfire_citadel/magtheridons_lair/def_magtheridons_lair.h scripts/zone/hellfire_citadel/magtheridons_lair/instance_magtheridons_lair.cpp @@ -315,6 +318,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/sunwell_plateau/def_sunwell_plateau.h scripts/zone/sunwell_plateau/instance_sunwell_plateau.cpp scripts/zone/tanaris/tanaris.cpp + scrips/zone/teldrassil/teldrassil.cpp scripts/zone/tempest_keep/arcatraz/arcatraz.cpp scripts/zone/tempest_keep/arcatraz/boss_harbinger_skyriss.cpp scripts/zone/tempest_keep/arcatraz/def_arcatraz.h diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index e805c77a66d..9ba94eb4ac6 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -254,6 +254,9 @@ extern void AddSC_instance_deadmines(); //Deadwind pass //Desolace //Dire Maul + +extern void AddSC_dragonblight(); + //Dun Morogh extern void AddSC_dun_morogh(); @@ -309,6 +312,7 @@ extern void AddSC_instance_shattered_halls(); extern void AddSC_boss_watchkeeper_gargolmar(); extern void AddSC_boss_omor_the_unscarred(); extern void AddSC_boss_vazruden_the_herald(); +extern void AddSC_instance_ramparts(); //Hellfire Peninsula extern void AddSC_boss_doomlordkazzak(); @@ -504,6 +508,8 @@ extern void AddSC_sunwell_plateau(); extern void AddSC_tanaris(); //Teldrassil + extern void AddSC_teldrassil(); + //Tempest Keep //--Arcatraz extern void AddSC_arcatraz(); @@ -1130,6 +1136,9 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //Deadwind pass //Desolace //Dire Maul + + AddSC_dragonblight(); + //Dun Morogh AddSC_dun_morogh(); @@ -1185,6 +1194,7 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") AddSC_boss_watchkeeper_gargolmar(); AddSC_boss_omor_the_unscarred(); AddSC_boss_vazruden_the_herald(); + AddSC_instance_ramparts(); //Hellfire Peninsula AddSC_boss_doomlordkazzak(); @@ -1380,6 +1390,8 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") AddSC_tanaris(); //Teldrassil + AddSC_teldrassil(); + //Tempest Keep //--Arcatraz AddSC_arcatraz(); diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index f2c4a03f1cc..419d0c09255 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -612,6 +612,10 @@ <Filter Name="Dragonblight" > + <File + RelativePath="..\scripts\zone\dragonblight\dragonblight.cpp" + > + </File> </Filter> <Filter Name="Grizzly Hills" @@ -1232,6 +1236,10 @@ <Filter Name="Teldrassil" > + <File + RelativePath="..\scripts\zone\teldrassil\teldrassil.cpp" + > + </File> </Filter> <Filter Name="Temple of Ahn'Qiraj" @@ -1687,6 +1695,14 @@ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\def_hellfire_ramparts.h" + > + </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\instance_hellfire_ramparts.cpp" + > + </File> </Filter> <Filter Name="Shattered Halls" diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 8ad9c4eab60..9ec9a72ec99 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -777,6 +777,10 @@ <Filter Name="Dalaran" > + <File + RelativePath="..\scripts\zone\dragonblight\dragonblight.cpp" + > + </File> </Filter> <Filter Name="Dragonblight" @@ -1401,6 +1405,10 @@ <Filter Name="Teldrassil" > + <File + RelativePath="..\scripts\zone\teldrassil\teldrassil.cpp" + > + </File> </Filter> <Filter Name="Temple of Ahn'Qiraj" @@ -1856,6 +1864,14 @@ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\def_hellfire_ramparts.h" + > + </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\instance_hellfire_ramparts.cpp" + > + </File> </Filter> <Filter Name="Shattered Halls" diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 1a00590325f..b92dd51a0d7 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -975,6 +975,10 @@ <Filter Name="Teldrassil" > + <File + RelativePath="..\scripts\zone\teldrassil\teldrassil.cpp" + > + </File> </Filter> <Filter Name="Tanaris" @@ -1966,6 +1970,14 @@ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp" > </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\def_hellfire_ramparts.h" + > + </File> + <File + RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\instance_hellfire_ramparts.cpp" + > + </File> </Filter> <Filter Name="Shattered Halls" @@ -2386,6 +2398,10 @@ <Filter Name="Dragonblight" > + <File + RelativePath="..\scripts\zone\dragonblight\dragonblight.cpp" + > + </File> </Filter> <Filter Name="Borean Tundra" diff --git a/src/bindings/scripts/scripts/zone/dragonblight/dragonblight.cpp b/src/bindings/scripts/scripts/zone/dragonblight/dragonblight.cpp new file mode 100644 index 00000000000..2430ee659ac --- /dev/null +++ b/src/bindings/scripts/scripts/zone/dragonblight/dragonblight.cpp @@ -0,0 +1,71 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Dragonblight +SD%Complete: 100 +SDComment: +SDCategory: Dragonblight +EndScriptData */ + +/* ContentData +npc_alexstrasza_wr_gate +EndContentData */ + +#include "precompiled.h" + +enum +{ + QUEST_RETURN_TO_AG_A = 12499, + QUEST_RETURN_TO_AG_H = 12500, + MOVIE_ID_GATES = 14 +}; + +#define GOSSIP_ITEM_WHAT_HAPPENED "Alexstrasza, can you show me what happened here?" + +bool GossipHello_npc_alexstrasza_wr_gate(Player* pPlayer, Creature* pCreature) +{ + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_A) || pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_AG_H)) + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_WHAT_HAPPENED, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + return true; +} + +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); + } + + return true; +} + +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(); +} diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp index 85c094dada0..8aeb6e53810 100644 --- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Eversong_Woods SD%Complete: 100 -SDComment: Quest support: 8483, 8488, 8490 +SDComment: Quest support: 8483, 8488, 8490, 9686 SDCategory: Eversong Woods EndScriptData */ @@ -25,6 +25,8 @@ EndScriptData */ npc_prospector_anvilward npc_apprentice_mirveda npc_infused_crystal +npc_kelerun_bloodmourn +go_harbinger_second_trial EndContentData */ #include "precompiled.h" diff --git a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp index e3b56c97051..e43bf6e3a6c 100644 --- a/src/bindings/scripts/scripts/zone/feralas/feralas.cpp +++ b/src/bindings/scripts/scripts/zone/feralas/feralas.cpp @@ -133,7 +133,7 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI } } - void Aggro(Unit* who) + void EnterCombat(Unit* who) { //For an small probability the npc says something when he get aggro switch(rand()%10) diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h new file mode 100644 index 00000000000..4ced55bfb09 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/def_hellfire_ramparts.h @@ -0,0 +1,16 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_RAMPARTS_H +#define DEF_RAMPARTS_H + +#define ENCOUNTERS 2 + +enum +{ + TYPE_VAZRUDEN = 1, + TYPE_NAZAN = 2 +}; + +#endif diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp new file mode 100644 index 00000000000..9893c3c6849 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp @@ -0,0 +1,124 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Instance_Hellfire_Ramparts +SD%Complete: 50 +SDComment: +SDCategory: Hellfire Ramparts +EndScriptData */ + +#include "precompiled.h" +#include "def_hellfire_ramparts.h" + +struct TRINITY_DLL_DECL instance_ramparts : public ScriptedInstance +{ + instance_ramparts(Map* pMap) : ScriptedInstance(pMap) {Initialize();} + + uint32 m_uiEncounter[ENCOUNTERS]; + uint64 m_uiChestNGUID; + uint64 m_uiChestHGUID; + + void Initialize() + { + m_uiChestNGUID = 0; + m_uiChestHGUID = 0; + + for(uint8 i = 0; i < ENCOUNTERS; i++) + m_uiEncounter[i] = NOT_STARTED; + + } + + void OnObjectCreate(GameObject* pGo) + { + switch(pGo->GetEntry()) + { + case 185168: m_uiChestNGUID = pGo->GetGUID(); break; + case 185169: m_uiChestHGUID = pGo->GetGUID(); break; + } + } + + Player* GetFirstPlayerInInstance() + { + Map::PlayerList const& pPlayers = instance->GetPlayers(); + + if (!pPlayers.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr) + { + if (Player* pPlr = itr->getSource()) + return pPlr; + } + } + + debug_log("TSCR: Instance Ramparts: GetFirstPlayerInInstance, but PlayerList is empty."); + return NULL; + } + + void DoRespawnChest() + { + if (Player* pPlayer = GetFirstPlayerInInstance()) + { + uint64 uiChest; + + if (instance->IsHeroic()) + uiChest = m_uiChestHGUID; + else + uiChest = m_uiChestNGUID; + + if (GameObject* pGo = GameObject::GetGameObject(*pPlayer,uiChest)) + { + if (pGo->isSpawned()) + return; + + pGo->SetRespawnTime(HOUR*IN_MILISECONDS); + } + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + debug_log("TSCR: Instance Ramparts: SetData received for type %u with data %u",uiType,uiData); + + switch(uiType) + { + case TYPE_VAZRUDEN: + if (uiData == DONE && m_uiEncounter[1] == DONE) + DoRespawnChest(); + m_uiEncounter[0] = uiData; + break; + case TYPE_NAZAN: + if (uiData == DONE && m_uiEncounter[0] == DONE) + DoRespawnChest(); + m_uiEncounter[1] = uiData; + break; + } + } +}; + +InstanceData* GetInstanceData_instance_ramparts(Map* pMap) +{ + return new instance_ramparts(pMap); +} + +void AddSC_instance_ramparts() +{ + Script* pNewScript; + pNewScript = new Script; + pNewScript->Name = "instance_ramparts"; + pNewScript->GetInstanceData = &GetInstanceData_instance_ramparts; + pNewScript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp index 9a3eb551765..9bf0e77420f 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp @@ -34,16 +34,19 @@ EndContentData */ ## npc_aeranas ######*/ -#define SAY_SUMMON -1000138 -#define SAY_FREE -1000139 +enum +{ + SAY_SUMMON = -1000138, + SAY_FREE = -1000139, -#define FACTION_HOSTILE 16 -#define FACTION_FRIENDLY 35 + FACTION_HOSTILE = 16, + FACTION_FRIENDLY = 35, -#define SPELL_ENVELOPING_WINDS 15535 -#define SPELL_SHOCK 12553 + SPELL_ENVELOPING_WINDS = 15535, + SPELL_SHOCK = 12553, -#define C_AERANAS 17085 + C_AERANAS = 17085 +}; struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI { @@ -127,14 +130,17 @@ bool GOHello_go_haaleshi_altar(Player *player, GameObject* _GO) ## npc_wounded_blood_elf ######*/ -#define SAY_ELF_START -1000117 -#define SAY_ELF_SUMMON1 -1000118 -#define SAY_ELF_RESTING -1000119 -#define SAY_ELF_SUMMON2 -1000120 -#define SAY_ELF_COMPLETE -1000121 -#define SAY_ELF_AGGRO -1000122 - -#define QUEST_ROAD_TO_FALCON_WATCH 9375 +enum +{ + SAY_ELF_START = -1000117, + SAY_ELF_SUMMON1 = -1000118, + SAY_ELF_RESTING = -1000119, + SAY_ELF_SUMMON2 = -1000120, + SAY_ELF_COMPLETE = -1000121, + SAY_ELF_AGGRO = -1000122, + + QUEST_ROAD_TO_FALCON_WATCH = 9375 +}; struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI { @@ -171,8 +177,8 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI DoScriptText(SAY_ELF_COMPLETE, m_creature, player); // Award quest credit Player* player = Unit::GetPlayer(PlayerGUID); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature); + if (player) + player->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature); break; } } @@ -203,8 +209,8 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI { // If NPC dies, player fails the quest Player* player = Unit::GetPlayer(PlayerGUID); - if (player && player->GetTypeId() == TYPEID_PLAYER) - ((Player*)player)->FailQuest(QUEST_ROAD_TO_FALCON_WATCH); + if (player) + player->FailQuest(QUEST_ROAD_TO_FALCON_WATCH); } } diff --git a/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp b/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp new file mode 100644 index 00000000000..846b3a008f6 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp @@ -0,0 +1,193 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Teldrassil +SD%Complete: 100 +SDComment: Quest support: 938 +SDCategory: Teldrassil +EndScriptData */ + +/* ContentData +npc_mist +EndContentData */ + +#include "precompiled.h" + +/*#### +# npc_mist +####*/ + +enum +{ + SAY_AT_HOME = -1000411, + EMOTE_AT_HOME = -1000412, + QUEST_MIST = 938, + NPC_ARYNIA = 3519, +}; + +struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI +{ + npc_mistAI(Creature *c) : ScriptedAI(c) + { + uiNpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); + uiPlayerGUID = 0; + } + + uint64 uiPlayerGUID; + uint32 uiNpcFlags; + uint32 uiCheckPlayerTimer; + + void Reset() + { + uiCheckPlayerTimer = 2500; + + if (!uiPlayerGUID) + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, uiNpcFlags); + } + + void MoveInLineOfSight(Unit *pWho) + { + if (pWho->GetEntry() == NPC_ARYNIA) + { + if (m_creature->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(SAY_AT_HOME, pWho); + DoComplete(); + } + } + } + + void EnterEvadeMode() + { + m_creature->InterruptNonMeleeSpells(true); + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(); + m_creature->LoadCreaturesAddon(); + + if (m_creature->isAlive()) + { + if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) + m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + else + { + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MoveTargetedHome(); + } + } + + m_creature->SetLootRecipient(NULL); + + Reset(); + } + + void DoStart(uint64 uiPlayer) + { + uiPlayerGUID = uiPlayer; + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + + if (Player* pPlayer = Unit::GetPlayer(uiPlayer)) + m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } + + void DoComplete() + { + DoScriptText(EMOTE_AT_HOME, m_creature); + + if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) + { + if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) + { + uint16 uiQuestLogSlot = pPlayer->FindQuestSlot(QUEST_MIST); + + if (uiQuestLogSlot < MAX_QUEST_LOG_SIZE) + { + if (pPlayer->GetQuestSlotState(uiQuestLogSlot) != QUEST_STATE_FAIL) + pPlayer->AreaExploredOrEventHappens(QUEST_MIST); + } + } + } + + uiPlayerGUID = 0; + EnterEvadeMode(); + } + + void EnterCombat(Unit* who) { } + + void JustDied(Unit* pKiller) + { + if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) + pPlayer->FailTimedQuest(QUEST_MIST); + + uiPlayerGUID = 0; + m_creature->GetMotionMaster()->MovementExpired(); + } + + void UpdateAI(const uint32 diff) + { + if (uiPlayerGUID) + { + if (!m_creature->isInCombat()) + { + if (uiCheckPlayerTimer < diff) + { + uiCheckPlayerTimer = 5000; + + Player* pPlayer = Unit::GetPlayer(uiPlayerGUID); + + if (pPlayer && !pPlayer->isAlive()) + { + uiPlayerGUID = 0; + EnterEvadeMode(); + } + } + else + uiCheckPlayerTimer -= diff; + } + } + + if(!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_mist(Creature* pCreature) +{ + return new npc_mistAI(pCreature); +} + +bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_MIST) + ((npc_mistAI*)(pCreature->AI()))->DoStart(pPlayer->GetGUID()); + + return true; +} + +void AddSC_teldrassil() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_mist"; + newscript->GetAI = &GetAI_npc_mist; + newscript->pQuestAccept = &QuestAccept_npc_mist; + newscript->RegisterSelf(); +} + |