Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
pet_generic.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/*
7 * Ordered alphabetically using scriptname.
8 * Scriptnames of files in this file should be prefixed with "npc_pet_gen_".
9 */
10
11#include "ScriptMgr.h"
12#include "ScriptedCreature.h"
13#include "Player.h"
14
22
24{
25public:
26 npc_pet_gen_mojo() : CreatureScript("npc_pet_gen_mojo") { }
27
29 {
30 npc_pet_gen_mojoAI(Creature* creature) : ScriptedAI(creature)
31 {
32 _victimGUID = 0;
33 }
34
36 {
37 _victimGUID = 0;
38
39 if (Unit* owner = me->GetOwner())
40 me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f);
41 }
42
43 void EnterCombat(Unit* /*who*/) OVERRIDE { }
44 void UpdateAI(uint32 /*diff*/) OVERRIDE { }
45
46 void ReceiveEmote(Player* player, uint32 emote) OVERRIDE
47 {
48 me->HandleEmoteCommand(emote);
49 Unit* owner = me->GetOwner();
50 if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TypeID::TYPEID_PLAYER ||
51 owner->ToPlayer()->GetTeam() != player->GetTeam())
52 {
53 return;
54 }
55
56 Talk(SAY_MOJO, player);
57
58 if (_victimGUID)
60 victim->RemoveAura(SPELL_FEELING_FROGGY);
61
62 _victimGUID = player->GetGUID();
63
64 DoCast(player, SPELL_FEELING_FROGGY, true);
66 me->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f);
67 }
68
69 private:
71 };
72
74 {
75 return new npc_pet_gen_mojoAI(creature);
76 }
77};
78
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ TYPEID_PLAYER
Definition Object.h:55
@ TEXT_EMOTE_KISS
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
CreatureScript(const char *name)
static Player * GetPlayer(WorldObject const &, uint64 guid)
Player * ToPlayer()
Definition Object.h:204
TypeID GetTypeId() const
Definition Object.h:131
uint32 GetTeam() const
Definition Player.h:2527
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Mojo
@ SPELL_FEELING_FROGGY
@ SAY_MOJO
@ SPELL_SEDUCTION_VISUAL
void AddSC_generic_pet_scripts()
Creature * me
ScriptedAI(Creature *creature)
void ReceiveEmote(Player *player, uint32 emote) OVERRIDE
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================