diff options
-rw-r--r-- | sql/updates/world/2016_04_09_14_world_2016_03_27_00_world.sql (renamed from sql/updates/world/2016_04_09_13_world_2016_03_27_00_world.sql) | 0 | ||||
-rw-r--r-- | sql/updates/world/2016_04_09_15_world_2016_03_28_00_world.sql (renamed from sql/updates/world/2016_04_09_13_world_2016_03_28_00_world.sql) | 0 | ||||
-rw-r--r-- | sql/updates/world/2016_04_09_16_world_2016_03_28_01_world.sql | 1 | ||||
-rw-r--r-- | src/server/scripts/Pet/pet_generic.cpp | 65 |
4 files changed, 63 insertions, 3 deletions
diff --git a/sql/updates/world/2016_04_09_13_world_2016_03_27_00_world.sql b/sql/updates/world/2016_04_09_14_world_2016_03_27_00_world.sql index 9421881c88a..9421881c88a 100644 --- a/sql/updates/world/2016_04_09_13_world_2016_03_27_00_world.sql +++ b/sql/updates/world/2016_04_09_14_world_2016_03_27_00_world.sql diff --git a/sql/updates/world/2016_04_09_13_world_2016_03_28_00_world.sql b/sql/updates/world/2016_04_09_15_world_2016_03_28_00_world.sql index b4a7e2d5a36..b4a7e2d5a36 100644 --- a/sql/updates/world/2016_04_09_13_world_2016_03_28_00_world.sql +++ b/sql/updates/world/2016_04_09_15_world_2016_03_28_00_world.sql diff --git a/sql/updates/world/2016_04_09_16_world_2016_03_28_01_world.sql b/sql/updates/world/2016_04_09_16_world_2016_03_28_01_world.sql new file mode 100644 index 00000000000..b4a24b011b3 --- /dev/null +++ b/sql/updates/world/2016_04_09_16_world_2016_03_28_01_world.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName = "npc_pet_gen_baby_blizzard_bear" WHERE entry = 32841; diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index 395f9005024..4517c0ca253 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -21,9 +21,10 @@ */ /* ContentData - 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 + 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" @@ -31,6 +32,63 @@ #include "PassiveAI.h" #include "Player.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, @@ -260,6 +318,7 @@ class npc_pet_gen_mojo : public CreatureScript 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(); |