TrinityCore
Loading...
Searching...
No Matches
zulaman.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Zulaman
20SD%Complete: 90
21SDComment: Forest Frog will turn into different NPC's. Workaround to prevent new entry from running this script
22SDCategory: Zul'Aman
23EndScriptData */
24
25/* ContentData
26EndContentData */
27
28#include "ScriptMgr.h"
29#include "GameObject.h"
30#include "InstanceScript.h"
31#include "MotionMaster.h"
32#include "Player.h"
33#include "ScriptedCreature.h"
34#include "ScriptedGossip.h"
35#include "SpellInfo.h"
36#include "SpellScript.h"
37#include "zulaman.h"
38
39/*######
40## npc_zulaman_hostage
41######*/
42
43static uint32 const HostageEntry[] = {23790, 23999, 24024, 24001};
44static uint32 const ChestEntry[] = {186648, 187021, 186672, 186667};
45
46enum Npcs
47{
48 NPC_TANZAR = 23790,
49 NPC_HARKOR = 23999,
50 NPC_ASHLI = 24001,
51 NPC_KRAZ = 24024
52};
53
62
64{
65 public:
66 npc_zulaman_hostage() : CreatureScript("npc_zulaman_hostage") { }
67
69 {
70 npc_zulaman_hostageAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()) { }
71
73
98
99 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
100 {
101 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
102 ClearGossipMenuFor(player);
103
104 if (action == GOSSIP_ACTION_INFO_DEF + 1)
105 CloseGossipMenuFor(player);
106
108 return true;
109
111
112 //uint8 progress = instance->GetData(DATA_CHESTLOOTED);
114 float x, y, z;
115 me->GetPosition(x, y, z);
116 uint32 entry = me->GetEntry();
117 for (uint8 i = 0; i < 4; ++i)
118 {
119 if (HostageEntry[i] == entry)
120 {
121 me->SummonGameObject(ChestEntry[i], Position(x - 2, y, z, 0.f), QuaternionData(), 0s);
122 break;
123 }
124 }
125 return true;
126 }
127 };
128
129 CreatureAI* GetAI(Creature* creature) const override
130 {
131 return GetZulAmanAI<npc_zulaman_hostageAI>(creature);
132 }
133};
134
135/*######
136## npc_harrison_jones
137######*/
138
146
153
168
170{
173 HARRISON_MOVE_3 = 6883536
175
182
189
191{
193 WEAPON_SPEAR = 13631
195
197{
198 public:
199
200 npc_harrison_jones() : CreatureScript("npc_harrison_jones") { }
201
203 {
205 {
206 Initialize();
207 instance = creature->GetInstanceScript();
208 }
209
211 {
212 _gongEvent = 0;
213 _gongTimer = 0;
214 }
215
217
220
221 void Reset() override
222 {
223 Initialize();
224 }
225
226 void JustEngagedWith(Unit* /*who*/) override { }
227
228 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
229 {
230 if (me->GetCreatureTemplate()->GossipMenuId == menuId && !gossipListId)
231 {
232 CloseGossipMenuFor(player);
233 me->SetFacingToObject(player);
237 _gongTimer = 4000;
238 }
239 return false;
240 }
241
255
256 void UpdateAI(uint32 diff) override
257 {
258 if (_gongEvent)
259 {
260 if (_gongTimer <= diff)
261 {
262 switch (_gongEvent)
263 {
264 case GONG_EVENT_1:
267 _gongTimer = 12000;
268 break;
269 case GONG_EVENT_2:
270 me->SetFacingTo(6.235659f);
276 _gongTimer = 4000;
277 break;
278 case GONG_EVENT_3:
280 gong->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
282 _gongTimer = 105000;
283 break;
284 case GONG_EVENT_4:
287 gong->SetFlag(GO_FLAG_NOT_SELECTABLE);
288
289 // trigger or gong will need to be scripted to set IN_PROGRESS after enough hits.
290 // This is temp workaround.
291 instance->SetData(DATA_GONGEVENT, IN_PROGRESS); // to be removed.
292
294 {
295 // Players are Now Saved to instance at SPECIAL (Player should be notified?)
298 _gongTimer = 5000;
299 }
300 else
301 {
302 _gongTimer = 1000;
304 }
305 break;
306 case GONG_EVENT_5:
310 _gongTimer = 12000;
312 break;
313 case GONG_EVENT_6:
316 _gongTimer = 7000;
318 break;
319 case GONG_EVENT_7:
320 {
321 std::vector<Creature*> targetList;
323 for (Creature* target : targetList)
324 {
325 if (target->GetPositionX() > 120)
326 {
327 target->SetVirtualItem(0, uint32(WEAPON_SPEAR));
328 target->SetImmuneToPC(true);
329 target->SetReactState(REACT_PASSIVE);
330 target->AI()->SetData(0, 1);
331 }
332 else
333 {
334 target->SetImmuneToPC(true);
335 target->SetReactState(REACT_PASSIVE);
336 target->AI()->SetData(0, 2);
337 }
338 }
339
341 gate->SetGoState(GO_STATE_ACTIVE);
342 _gongTimer = 2000;
344 break;
345 }
346 case GONG_EVENT_8:
348 me->SetVirtualItem(0, uint32(0));
351 _gongTimer = 1000;
352 _gongEvent = 0;
353 break;
354 case GONG_EVENT_9:
355 me->GetMotionMaster()->MovePoint(0, 120.687f, 1674.0f, 42.0217f);
356 _gongTimer = 12000;
358 break;
359 case GONG_EVENT_10:
360 me->SetFacingTo(1.59044f);
361 _gongEvent = 11;
362 _gongTimer = 6000;
363 break;
364 case GONG_EVENT_11:
366
368 _gongEvent = 0;
369 _gongTimer = 1000;
370 break;
371 }
372 }
373 else
374 _gongTimer -= diff;
375 }
376 }
377 };
378
379 CreatureAI* GetAI(Creature* creature) const override
380 {
381 return GetZulAmanAI<npc_harrison_jonesAI>(creature);
382 }
383};
384
386{
388 new npc_harrison_jones();
389}
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition PlayerAI.cpp:32
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void AddGossipItemFor(Player *player, GossipOptionIcon icon, std::string const &text, uint32 sender, uint32 action)
void ClearGossipMenuFor(Player *player)
void InitGossipMenuFor(Player *player, uint32 menuId)
void CloseGossipMenuFor(Player *player)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ EMOTE_ONESHOT_NONE
@ EMOTE_STATE_USE_STANDING
@ UNIT_DYNFLAG_DEAD
@ GO_FLAG_NOT_SELECTABLE
@ GO_STATE_ACTIVE
@ REACT_PASSIVE
@ UNIT_STAND_STATE_DEAD
Definition UnitDefines.h:41
@ UNIT_NPC_FLAG_GOSSIP
@ SHEATH_STATE_MELEE
Definition UnitDefines.h:99
Creature *const me
Definition CreatureAI.h:82
void SetDisplayId(uint32 modelId) override
void SetTarget(ObjectGuid guid) override
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:186
GameObject * GetGameObject(uint32 type)
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void MovePath(uint32 pathId, bool repeatable)
static ObjectGuid const Empty
Definition ObjectGuid.h:140
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:89
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SetEntry(uint32 entry)
Definition Object.h:82
uint32 GetGossipOptionAction(uint32 selection) const
Definition GossipDef.h:269
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition Player.cpp:14233
PlayerMenu * PlayerTalkClass
Definition Player.h:1969
uint32 Id
Definition SpellInfo.h:289
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
void SetVirtualItem(uint32 slot, uint32 itemId)
Definition Unit.cpp:13868
virtual void SetSheath(SheathState sheathed)
Definition Unit.h:970
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13259
void SetEmoteState(Emote emote)
Definition Unit.h:967
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
bool HasNpcFlag(NPCFlags flags) const
Definition Unit.h:1096
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
void RemoveAllAuras()
Definition Unit.cpp:4157
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition Object.cpp:2015
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
CreatureAI * GetAI(Creature *creature) const override
Definition zulaman.cpp:379
CreatureAI * GetAI(Creature *creature) const override
Definition zulaman.cpp:129
void GetPosition(float &x, float &y) const
Definition Position.h:84
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
Definition zulaman.cpp:242
void JustEngagedWith(Unit *) override
Definition zulaman.cpp:226
bool OnGossipSelect(Player *player, uint32 menuId, uint32 gossipListId) override
Definition zulaman.cpp:228
void UpdateAI(uint32 diff) override
Definition zulaman.cpp:256
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override
Definition zulaman.cpp:99
bool OnGossipHello(Player *player) override
Definition zulaman.cpp:74
EntryIds
Definition zulaman.cpp:184
@ NPC_AMANISHI_GUARDIAN
Definition zulaman.cpp:187
@ NPC_HARRISON_JONES_2
Definition zulaman.cpp:186
@ NPC_HARRISON_JONES_1
Definition zulaman.cpp:185
@ SAY_HARRISON_2
Definition zulaman.cpp:143
@ SAY_HARRISON_0
Definition zulaman.cpp:141
@ SAY_HARRISON_1
Definition zulaman.cpp:142
@ SAY_HARRISON_3
Definition zulaman.cpp:144
Npcs
Definition zulaman.cpp:47
@ NPC_HARKOR
Definition zulaman.cpp:49
@ NPC_KRAZ
Definition zulaman.cpp:51
@ NPC_TANZAR
Definition zulaman.cpp:48
@ NPC_ASHLI
Definition zulaman.cpp:50
Weapons
Definition zulaman.cpp:191
@ WEAPON_MACE
Definition zulaman.cpp:192
@ WEAPON_SPEAR
Definition zulaman.cpp:193
Gossips
Definition zulaman.cpp:55
@ GOSSIP_MENU_HARKOR
Definition zulaman.cpp:57
@ GOSSIP_MENU_TANZAR
Definition zulaman.cpp:56
@ GOSSIP_OPTION_HOSTAGE
Definition zulaman.cpp:60
@ GOSSIP_MENU_ASHLI
Definition zulaman.cpp:58
@ GOSSIP_MENU_KRAZ
Definition zulaman.cpp:59
@ SPELL_COSMETIC_SPEAR_THROW
Definition zulaman.cpp:151
@ SPELL_BANGING_THE_GONG
Definition zulaman.cpp:149
@ SPELL_STEALTH
Definition zulaman.cpp:150
void AddSC_zulaman()
Definition zulaman.cpp:385
static uint32 const ChestEntry[]
Definition zulaman.cpp:44
Waypoints
Definition zulaman.cpp:170
@ HARRISON_MOVE_3
Definition zulaman.cpp:173
@ HARRISON_MOVE_1
Definition zulaman.cpp:171
@ HARRISON_MOVE_2
Definition zulaman.cpp:172
DisplayIds
Definition zulaman.cpp:177
@ MODEL_HARRISON_JONES_2
Definition zulaman.cpp:180
@ MODEL_HARRISON_JONES_0
Definition zulaman.cpp:178
@ MODEL_HARRISON_JONES_1
Definition zulaman.cpp:179
static uint32 const HostageEntry[]
Definition zulaman.cpp:43
@ GONG_EVENT_5
Definition zulaman.cpp:160
@ GONG_EVENT_2
Definition zulaman.cpp:157
@ GONG_EVENT_11
Definition zulaman.cpp:166
@ GONG_EVENT_8
Definition zulaman.cpp:163
@ GONG_EVENT_10
Definition zulaman.cpp:165
@ GONG_EVENT_6
Definition zulaman.cpp:161
@ GONG_EVENT_4
Definition zulaman.cpp:159
@ GONG_EVENT_9
Definition zulaman.cpp:164
@ GONG_EVENT_3
Definition zulaman.cpp:158
@ GONG_EVENT_7
Definition zulaman.cpp:162
@ GONG_EVENT_1
Definition zulaman.cpp:156
@ DATA_CHESTLOOTED
Definition zulaman.h:37
@ DATA_GONGEVENT
Definition zulaman.h:36
@ GO_STRANGE_GONG
Definition zulaman.h:77
@ GO_MASSIVE_GATE
Definition zulaman.h:70