TrinityCore
zone_desolace.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: Desolace
20SD%Complete: 100
21SDComment: Quest support: 5561, 5581
22SDCategory: Desolace
23EndScriptData */
24
25/* ContentData
26npc_aged_dying_ancient_kodo
27EndContentData */
28
29#include "ScriptMgr.h"
30#include "GameObjectAI.h"
31#include "MotionMaster.h"
32#include "Player.h"
33#include "ScriptedCreature.h"
34#include "ScriptedGossip.h"
35#include "SpellInfo.h"
36
38{
40
41 QUEST_KODO = 5561,
42
43 NPC_SMEED = 11596,
48
53
54};
55
57{
58public:
59 npc_aged_dying_ancient_kodo() : CreatureScript("npc_aged_dying_ancient_kodo") { }
60
62 {
64
65 void MoveInLineOfSight(Unit* who) override
66 {
67 if (who->GetEntry() == NPC_SMEED && me->IsWithinDistInMap(who, 10.0f) && !me->HasAura(SPELL_KODO_KOMBO_GOSSIP))
68 {
71 if (Creature* smeed = who->ToCreature())
72 smeed->AI()->Talk(SAY_SMEED_HOME);
73 }
74 }
75
76 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
77 {
78 Unit* unitCaster = caster->ToUnit();
79 if (!unitCaster)
80 return;
81
82 if (spellInfo->Id == SPELL_KODO_KOMBO_ITEM)
83 {
86 {
87 unitCaster->CastSpell(unitCaster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
89
91 me->CombatStop();
93 me->SetSpeedRate(MOVE_RUN, 0.6f);
94
96
98 me->setActive(true);
100 }
101 }
102 else if (spellInfo->Id == SPELL_KODO_KOMBO_GOSSIP)
103 {
108 me->setActive(false);
109 me->DespawnOrUnsummon(60s);
110 }
111 }
112
113 bool OnGossipHello(Player* player) override
114 {
116 {
119 }
120
121 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
122 return true;
123 }
124 };
125
126 CreatureAI* GetAI(Creature* creature) const override
127 {
128 return new npc_aged_dying_ancient_kodoAI(creature);
129 }
130
131};
132
134{
136}
#define PET_FOLLOW_DIST
Definition: PetDefines.h:97
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
@ FACTION_FRIENDLY
@ MOVE_RUN
Definition: UnitDefines.h:118
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
Creature *const me
Definition: CreatureAI.h:61
void EngagementOver()
Definition: CreatureAI.cpp:287
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:371
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition: Creature.cpp:577
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
static Creature * ToCreature(Object *o)
Definition: Object.h:219
static Unit * ToUnit(Object *o)
Definition: Object.h:225
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void TalkedToCreature(uint32 entry, ObjectGuid guid)
Definition: Player.cpp:16709
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: Player.cpp:14367
uint32 const Id
Definition: SpellInfo.h:325
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition: Unit.cpp:5827
void SetFaction(uint32 faction) override
Definition: Unit.h:859
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
virtual float GetFollowAngle() const
Definition: Unit.h:1744
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition: Unit.cpp:8525
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void setActive(bool isActiveObject)
Definition: Object.cpp:922
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
CreatureAI * GetAI(Creature *creature) const override
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
void SpellHit(WorldObject *caster, SpellInfo const *spellInfo) override
void AddSC_desolace()
DyingKodo
@ SAY_SMEED_HOME
@ SPELL_KODO_KOMBO_GOSSIP
@ NPC_ANCIENT_KODO
@ NPC_TAMED_KODO
@ NPC_DYING_KODO
@ SPELL_KODO_KOMBO_PLAYER_BUFF
@ QUEST_KODO
@ NPC_SMEED
@ NPC_AGED_KODO
@ SPELL_KODO_KOMBO_DESPAWN_BUFF
@ SPELL_KODO_KOMBO_ITEM