TrinityCore
Loading...
Searching...
No Matches
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
22SDCategory: Desolace
23EndScriptData */
24
25/* ContentData
26npc_aged_dying_ancient_kodo
27EndContentData */
28
29#include "ScriptMgr.h"
30#include "GameObject.h"
31#include "GameObjectAI.h"
32#include "MotionMaster.h"
33#include "Player.h"
34#include "ScriptedEscortAI.h"
35#include "ScriptedGossip.h"
36#include "SpellInfo.h"
37
56
58{
59public:
60 npc_aged_dying_ancient_kodo() : CreatureScript("npc_aged_dying_ancient_kodo") { }
61
63 {
65
66 void MoveInLineOfSight(Unit* who) override
67 {
68 if (who->GetEntry() == NPC_SMEED && me->IsWithinDistInMap(who, 10.0f) && !me->HasAura(SPELL_KODO_KOMBO_GOSSIP))
69 {
72 if (Creature* smeed = who->ToCreature())
73 smeed->AI()->Talk(SAY_SMEED_HOME);
74 }
75 }
76
77 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
78 {
79 Unit* unitCaster = caster->ToUnit();
80 if (!unitCaster)
81 return;
82
83 if (spellInfo->Id == SPELL_KODO_KOMBO_ITEM)
84 {
87 {
88 unitCaster->CastSpell(unitCaster, SPELL_KODO_KOMBO_PLAYER_BUFF, true);
90
92 me->CombatStop();
94 me->SetSpeedRate(MOVE_RUN, 0.6f);
95
97
99 me->setActive(true);
101 }
102 }
103 else if (spellInfo->Id == SPELL_KODO_KOMBO_GOSSIP)
104 {
109 me->setActive(false);
110 me->DespawnOrUnsummon(60s);
111 }
112 }
113
114 bool OnGossipHello(Player* player) override
115 {
117 {
120 }
121
122 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
123 return true;
124 }
125 };
126
127 CreatureAI* GetAI(Creature* creature) const override
128 {
129 return new npc_aged_dying_ancient_kodoAI(creature);
130 }
131
132};
133
135{
137}
#define PET_FOLLOW_DIST
Definition PetDefines.h:85
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
@ FACTION_FRIENDLY
@ UNIT_NPC_FLAG_GOSSIP
@ MOVE_RUN
Creature *const me
Definition CreatureAI.h:82
void EngagementOver()
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:293
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition Creature.cpp:540
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
static ObjectGuid const Empty
Definition ObjectGuid.h:140
static Creature * ToCreature(Object *o)
Definition Object.h:186
static Unit * ToUnit(Object *o)
Definition Object.h:192
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void TalkedToCreature(uint32 entry, ObjectGuid guid)
Definition Player.cpp:16306
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition Player.cpp:14233
uint32 Id
Definition SpellInfo.h:289
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
virtual float GetFollowAngle() const
Definition Unit.h:1782
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition Unit.cpp:8678
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:5691
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
void setActive(bool isActiveObject)
Definition Object.cpp:991
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
CreatureAI * GetAI(Creature *creature) const override
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
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