mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 11:21:58 +01:00
Scripts/Pet: Baby Blizzard Bear & Egbert (#24349)
* Baby Blizzard Bear & Egbert
* SQL
* Update 9999_99_99_99_world.sql
SQL fix
* Rename 9999_99_99_99_world.sql to 2020_04_04_00_world.sql
Co-authored-by: Eridium <6587064+Killyana@users.noreply.github.com>
Co-authored-by: Giacomo Pozzoni <giacomopoz@gmail.com>
(cherry picked from commit 264a583903)
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- Baby Blizzard Bear
|
||||
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=32841;
|
||||
DELETE FROM `creature_template_addon` WHERE `entry` IN (32841);
|
||||
INSERT INTO `creature_template_addon` (`entry`, `auras`) VALUES (32841,'61854');
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=32841 AND `source_type`=0;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=3284100 AND `source_type`=9;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(32841,0,0,0,8,0,100,0,61853,0,15000,15000,80,3284100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Baby Blizzard Bear - On Spell Hit - Action list'),
|
||||
(3284100,9,0,0,0,0,100,0,10000,15000,0,0,28,61853,0,0,0,0,0,1,0,0,0,0,0,0,0,'Baby Blizzard Bear - Action list - Remove Spell');
|
||||
|
||||
-- Egbert
|
||||
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=23258;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=23258 AND `source_type`=0;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid`=2325800 AND `source_type`=9;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(23258,0,0,0,8,0,100,0,40669,0,15000,15000,80,2325800,0,0,0,0,0,1,0,0,0,0,0,0,0,'Egbert - On Spell Hit - Action list'),
|
||||
(2325800,9,0,0,0,0,100,0,5000,15000,0,0,28,40669,0,0,0,0,0,1,0,0,0,0,0,0,0,'Egbert - Action list - Remove Spell');
|
||||
@@ -21,15 +21,11 @@
|
||||
*/
|
||||
|
||||
/* ContentData
|
||||
npc_pet_gen_baby_blizzard_bear 100% Baby Blizzard Bear sits down occasionally
|
||||
npc_pet_gen_egbert 100% Egbert run's around
|
||||
npc_pet_gen_pandaren_monk 100% Pandaren Monk drinks and bows with you
|
||||
npc_pet_gen_mojo 100% Mojo follows you when you kiss it
|
||||
EndContentData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "DB2Structure.h"
|
||||
#include "Map.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "PassiveAI.h"
|
||||
@@ -37,136 +33,6 @@
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
enum BabyBlizzardBearMisc
|
||||
{
|
||||
SPELL_BBB_PET_SIT = 61853,
|
||||
EVENT_BBB_PET_SIT = 1,
|
||||
EVENT_BBB_PET_SIT_INTER = 2
|
||||
};
|
||||
|
||||
class npc_pet_gen_baby_blizzard_bear : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_gen_baby_blizzard_bear() : CreatureScript("npc_pet_gen_baby_blizzard_bear") {}
|
||||
|
||||
struct npc_pet_gen_baby_blizzard_bearAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_baby_blizzard_bearAI(Creature* creature) : NullCreatureAI(creature)
|
||||
{
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
|
||||
_events.ScheduleEvent(EVENT_BBB_PET_SIT, urandms(10, 30));
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
if (!me->IsWithinDist(owner, 25.f))
|
||||
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_BBB_PET_SIT:
|
||||
me->CastSpell(me, SPELL_BBB_PET_SIT, false);
|
||||
_events.ScheduleEvent(EVENT_BBB_PET_SIT_INTER, urandms(15, 30));
|
||||
break;
|
||||
case EVENT_BBB_PET_SIT_INTER:
|
||||
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
_events.ScheduleEvent(EVENT_BBB_PET_SIT, urandms(10, 30));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_gen_baby_blizzard_bearAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
enum EgbertMisc
|
||||
{
|
||||
SPELL_EGBERT = 40669,
|
||||
EVENT_RETURN = 3
|
||||
};
|
||||
|
||||
class npc_pet_gen_egbert : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_gen_egbert() : CreatureScript("npc_pet_gen_egbert") {}
|
||||
|
||||
struct npc_pet_gen_egbertAI : public NullCreatureAI
|
||||
{
|
||||
npc_pet_gen_egbertAI(Creature* creature) : NullCreatureAI(creature)
|
||||
{
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
if (owner->GetMap()->GetEntry()->ExpansionID > 1)
|
||||
me->SetCanFly(true);
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_events.Reset();
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason why) override
|
||||
{
|
||||
if (!_EnterEvadeMode(why))
|
||||
return;
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
{
|
||||
if (!me->IsWithinDist(owner, 40.f))
|
||||
{
|
||||
me->RemoveAura(SPELL_EGBERT);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
|
||||
}
|
||||
}
|
||||
|
||||
if (me->HasAura(SPELL_EGBERT))
|
||||
_events.ScheduleEvent(EVENT_RETURN, urandms(5, 20));
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_RETURN:
|
||||
me->RemoveAura(SPELL_EGBERT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_pet_gen_egbertAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
enum PandarenMonkMisc
|
||||
{
|
||||
SPELL_PANDAREN_MONK = 69800,
|
||||
@@ -351,8 +217,6 @@ struct npc_pet_gen_soul_trader : public ScriptedAI
|
||||
|
||||
void AddSC_generic_pet_scripts()
|
||||
{
|
||||
new npc_pet_gen_baby_blizzard_bear();
|
||||
new npc_pet_gen_egbert();
|
||||
new npc_pet_gen_pandaren_monk();
|
||||
new npc_pet_gen_mojo();
|
||||
RegisterCreatureAI(npc_pet_gen_soul_trader);
|
||||
|
||||
Reference in New Issue
Block a user