Files
TrinityCore/src/server/scripts/Kalimdor/teldrassil.cpp
T
Xanadu 79622802f3 Merge. Revision history for source files should be all back now.
--HG--
branch : trunk
rename : sql/CMakeLists.txt => sql/tools/CMakeLists.txt
rename : src/server/game/Pools/PoolHandler.cpp => src/server/game/Pools/PoolMgr.cpp
rename : src/server/game/Pools/PoolHandler.h => src/server/game/Pools/PoolMgr.h
rename : src/server/game/PrecompiledHeaders/NixCorePCH.cpp => src/server/game/PrecompiledHeaders/gamePCH.cpp
rename : src/server/game/PrecompiledHeaders/NixCorePCH.h => src/server/game/PrecompiledHeaders/gamePCH.h
2010-07-20 02:49:28 +02:00

117 lines
2.9 KiB
C++

/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* 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, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Teldrassil
SD%Complete: 100
SDComment: Quest support: 938
SDCategory: Teldrassil
EndScriptData */
/* ContentData
npc_mist
EndContentData */
#include "ScriptPCH.h"
#include "ScriptedFollowerAI.h"
/*####
# npc_mist
####*/
enum eMist
{
SAY_AT_HOME = -1000323,
EMOTE_AT_HOME = -1000324,
QUEST_MIST = 938,
NPC_ARYNIA = 3519,
FACTION_DARNASSUS = 79
};
struct npc_mistAI : public FollowerAI
{
npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { }
void Reset() { }
void MoveInLineOfSight(Unit *pWho)
{
FollowerAI::MoveInLineOfSight(pWho);
if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA)
{
if (me->IsWithinDistInMap(pWho, 10.0f))
{
DoScriptText(SAY_AT_HOME, pWho);
DoComplete();
}
}
}
void DoComplete()
{
DoScriptText(EMOTE_AT_HOME, me);
if (Player* pPlayer = GetLeaderForFollower())
{
if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
pPlayer->GroupEventHappens(QUEST_MIST, me);
}
//The follow is over (and for later development, run off to the woods before really end)
SetFollowComplete();
}
//call not needed here, no known abilities
/*void UpdateFollowerAI(const uint32 uiDiff)
{
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)
{
if (npc_mistAI* pMistAI = CAST_AI(npc_mistAI, pCreature->AI()))
pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest);
}
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();
}