mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Scripts/Items: Imp in a Ball
This commit is contained in:
@@ -56,6 +56,7 @@ EndContentData */
|
||||
#include "CellImpl.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "Pet.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
|
||||
/*########
|
||||
# npc_air_force_bots
|
||||
@@ -2353,6 +2354,60 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class npc_imp_in_a_ball : public CreatureScript
|
||||
{
|
||||
private:
|
||||
enum
|
||||
{
|
||||
SAY_RANDOM,
|
||||
|
||||
EVENT_TALK = 1,
|
||||
};
|
||||
|
||||
public:
|
||||
npc_imp_in_a_ball() : CreatureScript("npc_imp_in_a_ball") { }
|
||||
|
||||
struct npc_imp_in_a_ballAI : public ScriptedAI
|
||||
{
|
||||
npc_imp_in_a_ballAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
summonerGUID = 0;
|
||||
}
|
||||
|
||||
void IsSummonedBy(Unit* summoner) override
|
||||
{
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
summonerGUID = summoner->GetGUID();
|
||||
events.ScheduleEvent(EVENT_TALK, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
|
||||
if (events.ExecuteEvent() == EVENT_TALK)
|
||||
{
|
||||
if (Player* owner = ObjectAccessor::GetPlayer(*me, summonerGUID))
|
||||
{
|
||||
sCreatureTextMgr->SendChat(me, SAY_RANDOM, owner,
|
||||
owner->GetGroup() ? CHAT_MSG_MONSTER_PARTY : CHAT_MSG_MONSTER_WHISPER, LANG_ADDON, TEXT_RANGE_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap events;
|
||||
uint64 summonerGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_imp_in_a_ballAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_npcs_special()
|
||||
{
|
||||
new npc_air_force_bots();
|
||||
@@ -2375,4 +2430,5 @@ void AddSC_npcs_special()
|
||||
new npc_experience();
|
||||
new npc_firework();
|
||||
new npc_spring_rabbit();
|
||||
new npc_imp_in_a_ball();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user