diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 6 | ||||
-rw-r--r-- | src/bindings/scripts/VC80/80ScriptDev2.vcproj | 4 | ||||
-rw-r--r-- | src/bindings/scripts/VC90/90ScriptDev2.vcproj | 4 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/sholazar_basin/sholazar_basin.cpp | 180 | ||||
-rw-r--r-- | src/game/Object.h | 11 |
6 files changed, 201 insertions, 5 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 6fe9c0e1ec0..dab90812b59 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -294,6 +294,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/shadowmoon_valley/boss_doomwalker.cpp scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp scripts/zone/shattrath/shattrath_city.cpp + scripts/zone/sholazar_basin/sholazar_basin.cpp scripts/zone/silithus/silithus.cpp scripts/zone/silvermoon/silvermoon_city.cpp scripts/zone/silverpine_forest/silverpine_forest.cpp diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index f81edfdfb01..27835f8e23e 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -476,6 +476,9 @@ extern void AddSC_shadowmoon_valley(); //Shattrath extern void AddSC_shattrath_city(); +//Sholazar Basin +extern void AddSC_sholazar_basin(); + //Silithus extern void AddSC_silithus(); @@ -1381,6 +1384,9 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //Shattrath AddSC_shattrath_city(); + //Sholazar Basin + AddSC_sholazar_basin(); + //Silithus AddSC_silithus(); diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 53a1624820c..1ff051ed857 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -2457,6 +2457,10 @@ <Filter Name="Sholazar Basin" > + <File + RelativePath="..\scripts\zone\sholazar_basin\sholazar_basin.cpp" + > + </File> </Filter> <Filter Name="Dalaran" diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 1b8d6f0638e..1980514e712 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -2458,6 +2458,10 @@ <Filter Name="Sholazar Basin" > + <File + RelativePath="..\scripts\zone\sholazar_basin\sholazar_basin.cpp" + > + </File> </Filter> <Filter Name="Dalaran" diff --git a/src/bindings/scripts/scripts/zone/sholazar_basin/sholazar_basin.cpp b/src/bindings/scripts/scripts/zone/sholazar_basin/sholazar_basin.cpp new file mode 100644 index 00000000000..d48f4377a09 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/sholazar_basin/sholazar_basin.cpp @@ -0,0 +1,180 @@ +/* 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: Sholazar_Basin +SD%Complete: 100 +SDComment: Quest support: 12570 +SDCategory: Sholazar_Basin +EndScriptData */ + +/* ContentData +npc_injured_rainspeaker_oracle +EndContentData */ + +#include "precompiled.h" +#include "../../npc/npc_escortAI.h" + +/*###### +## npc_injured_rainspeaker_oracle +######*/ + +#define GOSSIP_ITEM1 "I am ready to travel to your village now." + +enum +{ + SAY_START_IRO = -1571000, + SAY_QUEST_ACCEPT_IRO = -1571001, + SAY_END_IRO = -1571002, + + QUEST_FORTUNATE_MISUNDERSTANDINGS = 12570, + FACTION_ESCORTEE_A = 774, + FACTION_ESCORTEE_H = 775 +}; + +struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI +{ + npc_injured_rainspeaker_oracleAI(Creature* c) : npc_escortAI(c) { c_guid = c->GetGUID(); } + + uint64 c_guid; + + void Reset() + { + 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 WaypointReached(uint32 i) + { + Player* player = Unit::GetPlayer(PlayerGUID); + + if(!player) + 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: + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_JUMPING); + m_creature->SetSpeed(MOVE_SWIM, 0.85f, true); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING + MOVEMENTFLAG_LEVITATING); + break; + case 19: + m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); + break; + case 28: + if(Player* pPlayer = Unit::GetPlayer( PlayerGUID)) + player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, m_creature); + // me->RestoreFaction(); + DoScriptText(SAY_END_IRO,m_creature); + SetRun(false); + break; + } + } + + void JustDied(Unit* killer) + { + if (!IsBeingEscorted) + return; + + if(Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + { + if(pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) + pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); + } + } + + void UpdateAI(Player *player, Creature *_Creature,const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } +}; + + +bool GossipHello_npc_injured_rainspeaker_oracle(Player *player, Creature *_Creature ) +{ + if( _Creature->isQuestGiver() ) + player->PrepareQuestMenu( _Creature->GetGUID() ); + + if( player->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) == QUEST_STATUS_INCOMPLETE ) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID()); + + return true; +} + +bool GossipSelect_npc_injured_rainspeaker_oracle(Player *player, Creature *_Creature, uint32 sender, uint32 action ) +{ + if( action == GOSSIP_ACTION_INFO_DEF+1 ) + { + CAST_AI(npc_escortAI, (_Creature->AI()))->Start(true, true, false, player->GetGUID()); + CAST_AI(npc_escortAI, (_Creature->AI()))->SetMaxPlayerDistance(35.0f); + _Creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); + DoScriptText(SAY_START_IRO,_Creature); + + switch (player->GetTeam()){ + case ALLIANCE: + _Creature->setFaction(FACTION_ESCORTEE_A); + break; + case HORDE: + _Creature->setFaction(FACTION_ESCORTEE_H); + break; + } + } + return true; +} + +bool QuestAccept_npc_injured_rainspeaker_oracle(Player *player, Creature *_Creature, Quest const *_Quest) +{ + DoScriptText(SAY_QUEST_ACCEPT_IRO,_Creature); + return false; +} + +CreatureAI* GetAI_npc_injured_rainspeaker_oracle(Creature *_Creature) +{ + npc_injured_rainspeaker_oracleAI* thisAI = new npc_injured_rainspeaker_oracleAI(_Creature); + + thisAI->FillPointMovementListForCreature(); + + return thisAI; +} + +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(); +} diff --git a/src/game/Object.h b/src/game/Object.h index b7e5a6efa3e..3004601cd50 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -560,11 +560,12 @@ class TRINITY_DLL_SPEC WorldObject : public Object bool IsTempWorldObject; #ifdef MAP_BASED_RAND_GEN - int32 irand(int32 min, int32 max) const { return int32 (GetMap()->mtRand.randInt(max - min)) + min; } - uint32 urand(uint32 min, uint32 max) const { return GetMap()->mtRand.randInt(max - min) + min; } - int32 rand32() const { return GetMap()->mtRand.randInt(); } - double rand_norm() const { return GetMap()->mtRand.randExc(); } - double rand_chance() const { return GetMap()->mtRand.randExc(100.0); } + // Object may not have map assigned - use global scope rand in that case + int32 irand(int32 min, int32 max) const { return FindMap() ? int32 (GetMap()->mtRand.randInt(max - min)) + min : ::irand(min, max); } + uint32 urand(uint32 min, uint32 max) const { return FindMap() ? GetMap()->mtRand.randInt(max - min) + min : ::urand(min, max); } + int32 rand32() const { return FindMap() ? GetMap()->mtRand.randInt(): ::rand32(); } + double rand_norm() const { return FindMap() ? GetMap()->mtRand.randExc(): ::rand_norm(); } + double rand_chance() const { return FindMap() ? GetMap()->mtRand.randExc(100.0): ::rand_chance(); } #endif protected: |