Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_westfall.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "ScriptedGossip.h"
9#include "Player.h"
10
11#define BOXTEXT "Are you sure you want to give this hobo money?"
12
13#define GOSSIP_TRANSIENT1 "Did you see who killed the Furlbrows?"
14#define GOSSIP_TRANSIENT2 "Maybe a couple copper will loosen your tongue. Now tell, did you see who killed the Furlbrows?"
15
16#define TALK1 "Listen, $g. I don't want any trouble. ok ? I didn't see who murdered 'em, but I sure heard it! lot of yelling. Human voices... you dig? Now get out of here before I change my mind about beating you up and takin' your shoes."
17#define TALK2 "I didn't see who killed 'em, $g, but i got a whiff. Smelled rich, kinda like you. Damn shame too. Furlbrows were a fixture around here. Nice people. always willin' to share a meal or a patch of dirt."
18#define TALK3 "Who killed the Furlbrows? I'll tell you who killed the Furlbrows: KING VARIAN WRYNN. THAT'S WHO! And he's killin' the rest of us too. One bum at a time. The only thing I can tell you is that I saw some gnolls leavin' the place a few hours before the law arrived."
19#define TALK4 "Between you, me, and the tree, murlocs killed the Furlbrows. Yep. saw 'em with my own two eyes. Think they'd been casin' the joint for days. maybe months. They left in a hurry once they got wind of \"Johnny Law\" and the idiot brigade over there..."
20
21#define TALKAGGRO0 "You'll get nothing out of me!"
22#define TALKAGGRO1 "You rich punks are all the same!"
23#define TALKAGGRO2 "Maybe i can sell your liver for some gold."
24#define TALKAGGRO3 "You got no business here, lout! Beat it!"
25
26#define TALKOOC1 "I miss being robed by the Defias. At least they'd leave you a little something to eat from time to time."
27#define TALKOOC2 "Looks like we'll be eating shoe leather for dinner again."
28
29#define RAGAMUFFINTEXT "Does she have boots? Get'em!"
30
32{
33public:
34 npc_transient() : CreatureScript("npc_transient") { }
35
36 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
37 {
38 player->PlayerTalkClass->ClearMenus();
39 if (action == GOSSIP_ACTION_INFO_DEF + 1)
40 {
41 if ((std::rand() % 2) == 1)
42 {
43 creature->setFaction(14);
44 CAST_AI(npc_transient::npc_transientAI, creature->AI())->AttackStart(player);
45 }
46 else
47 {
48 CAST_AI(npc_transient::npc_transientAI, creature->AI())->GiveClueCredit(player);
49 }
50 player->CLOSE_GOSSIP_MENU();
51 }
52 if (action == GOSSIP_ACTION_INFO_DEF + 2)
53 {
54 if ((std::rand() % 2) == 1)
55 {
56 creature->setFaction(14);
57 CAST_AI(npc_transient::npc_transientAI, creature->AI())->AttackStart(player);
58 }
59 else
60 {
61 CAST_AI(npc_transient::npc_transientAI, creature->AI())->GiveClueCredit(player);
62 }
63 player->CLOSE_GOSSIP_MENU();
64
65 }
66 return true;
67 }
68
69 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
70 {
71 if (player->GetQuestStatus(26209) == QUEST_STATUS_INCOMPLETE)
72 {
74 player->PlayerTalkClass->GetGossipMenu().AddMenuItem(11635, GOSSIP_ICON_CHAT, GOSSIP_TRANSIENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2, BOXTEXT, 2, false);
75 player->SEND_GOSSIP_MENU(16250, creature->GetGUID());
76 }
77 else
78 {
79 player->SEND_GOSSIP_MENU(16250, creature->GetGUID());
80 }
81
82 return true;
83 }
84
86 {
87 npc_transientAI(Creature* creature) : ScriptedAI(creature)
88 {
89 cooldown = 0;
90 talkCooldown = 0;
91 }
92
93 void GiveClueCredit(Player* player)
94 {
95 if (player->GetQuestObjectiveCounter(265754) < 1)
96 {
97 me->MonsterSay(TALK1, Language::LANG_COMMON, me);
98 player->KilledMonsterCredit(42414);
99 cooldown = 60000;
101 return;
102 }
103 if (player->GetQuestObjectiveCounter(265755) < 1)
104 {
105 me->MonsterSay(TALK2, Language::LANG_COMMON, me);
106 player->KilledMonsterCredit(42415);
107 cooldown = 60000;
109 return;
110 }
111 if (player->GetQuestObjectiveCounter(265756) < 1)
112 {
113 me->MonsterSay(TALK3, Language::LANG_COMMON, me);
114 player->KilledMonsterCredit(42416);
115 cooldown = 60000;
117 return;
118 }
119 if (player->GetQuestObjectiveCounter(265757) < 1)
120 {
121 me->MonsterSay(TALK4, Language::LANG_COMMON, me);
122 player->KilledMonsterCredit(42417);
123 cooldown = 60000;
125 return;
126 }
127 }
128
130 {
131 cooldown = 0;
132 talkCooldown = std::rand() % 120000 + 60000;
133 me->setFaction(7);
135 }
136
138 {
139 Reset();
140 }
141
142 void EnterCombat(Unit* /*who*/) OVERRIDE
143 {
144 switch (std::rand() % 3)
145 {
146 case 0:
147 {
148 me->MonsterSay(TALKAGGRO0, Language::LANG_COMMON, me);
149 break;
150 }
151 case 1:
152 {
153 me->MonsterSay(TALKAGGRO1, Language::LANG_COMMON, me);
154 break;
155 }
156 case 2:
157 {
158 me->MonsterSay(TALKAGGRO2, Language::LANG_COMMON, me);
159 break;
160 }
161 case 3:
162 {
163 me->MonsterSay(TALKAGGRO3, Language::LANG_COMMON, me);
164 break;
165 }
166 default:
167 break;
168 }
169 }
170
171 void JustDied(Unit* /*killer*/) OVERRIDE
172 {
173 float x = 0.0f, y = 0.0f;
174 GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation() + (M_PI / 2), x, y);
175 if (Creature* rm1 = me->SummonCreature(42413, x, y, 30.0f, M_PI / 2, TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 5000))
176 {
177 rm1->SetSpeed(MOVE_RUN, 0.5f);
178 rm1->GetMotionMaster()->MoveFollow(me, 0.0f, M_PI / 2);
179
180 if (me->getGender() == GENDER_FEMALE)
181 rm1->MonsterSay(RAGAMUFFINTEXT, Language::LANG_COMMON, me);
182 }
183
184 x = 0.0f, y = 0.0f;
185 GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation() + M_PI, x, y);
186 if (Creature* rm2 = me->SummonCreature(42413, x, y, 30.0f, M_PI, TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 5000))
187 {
188 rm2->SetSpeed(MOVE_RUN, 0.5f);
189 rm2->GetMotionMaster()->MoveFollow(me, 0.0f, M_PI);
190 }
191
192 x = 0.0f, y = 0.0f;
193 GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation() + (3*M_PI) / 2, x, y);
194 if (Creature* rm3 = me->SummonCreature(42413, x, y, 30.0f, (3 * M_PI) / 2, TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 5000))
195 {
196 rm3->SetSpeed(MOVE_RUN, 0.5f);
197 rm3->GetMotionMaster()->MoveFollow(me, 0.0f, (3 * M_PI) / 2);
198 }
199
200 x = 0.0f, y = 0.0f;
201 GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation() + M_PI * 2, x, y);
202 if (Creature* rm4 = me->SummonCreature(42413, x, y, 30.0f, M_PI * 2, TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 5000))
203 {
204 rm4->SetSpeed(MOVE_RUN, 0.5f);
205 rm4->GetMotionMaster()->MoveFollow(me, 0.0f, M_PI * 2);
206 }
207 }
208
210 {
211 Player* const player = who->ToPlayer();
212 if (!player)
213 return;
214
215 if (player->GetQuestStatus(26209) != QUEST_STATUS_INCOMPLETE || talkCooldown)
216 return;
217
218 if (me->GetEntry() == 42386)
219 {
220 if ((std::rand() % 2 + 1) == 2)
221 {
222 me->MonsterSay(TALKOOC1, Language::LANG_COMMON, me);
223 }
224 else
225 {
226 me->MonsterSay(TALKOOC2, Language::LANG_COMMON, me);
227 }
228 }
229
230 talkCooldown = std::rand() % 120000 + 60000;
231
232 }
233
235 {
236 if (cooldown)
237 {
238 if (cooldown <= diff)
239 {
240 Reset();
241 cooldown = 0;
242 }
243 else
244 cooldown -= diff;
245 }
246
247 if (talkCooldown)
248 {
249 if (talkCooldown <= diff)
250 {
251 talkCooldown = 0;
252 }
253 else
254 talkCooldown -= diff;
255 }
256
257 if (me->getFaction() == 14)
259 }
260 private:
263 };
264
266 {
267 return new npc_transientAI(creature);
268 }
269};
270
271
273{
274 new npc_transient();
275}
#define M_PI
Definition Common.h:192
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
void GetPositionWithDistInOrientation(Unit *pUnit, float dist, float orientation, float &x, float &y)
#define CAST_AI(a, b)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ GENDER_FEMALE
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ MOVE_RUN
Definition Unit.h:556
@ UNIT_FIELD_NPC_FLAGS
CreatureScript(const char *name)
Player * ToPlayer()
Definition Object.h:204
uint32 GetQuestObjectiveCounter(uint32 objectiveId) const
void KilledMonsterCredit(uint32 entry, uint64 guid=0)
QuestStatus GetQuestStatus(uint32 quest_id) const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void GiveClueCredit(Player *player)
void EnterCombat(Unit *) OVERRIDE
void MoveInLineOfSight(Unit *who) OVERRIDE
void JustDied(Unit *) OVERRIDE
npc_transientAI(Creature *creature)
#define BOXTEXT
#define TALKAGGRO2
#define TALKAGGRO3
#define TALK3
#define TALK1
#define TALK2
#define GOSSIP_TRANSIENT2
#define TALKOOC2
#define RAGAMUFFINTEXT
#define TALKAGGRO0
#define TALKAGGRO1
void AddSC_westfall()
#define GOSSIP_TRANSIENT1
#define TALK4
#define TALKOOC1