1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/* 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 "ScriptedPch.h"
#include "ScriptedFollowerAI.h"
/*####
# npc_mist
####*/
enum eMist
{
SAY_AT_HOME = -1000411,
EMOTE_AT_HOME = -1000412,
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 (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA)
{
if (m_creature->IsWithinDistInMap(pWho, 10.0f))
{
DoScriptText(SAY_AT_HOME, pWho);
DoComplete();
}
}
}
void DoComplete()
{
DoScriptText(EMOTE_AT_HOME, m_creature);
if (Player* pPlayer = GetLeaderForFollower())
{
if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
pPlayer->GroupEventHappens(QUEST_MIST, m_creature);
}
//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();
}
|