Skip to content

Commit

Permalink
Pet/Misc: Improve Egbert's AI even more
Browse files Browse the repository at this point in the history
(cherry picked from commit af5f4ae)
  • Loading branch information
Kittnz authored and Shauren committed Apr 5, 2016
1 parent a6a8b5b commit b33afb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions sql/updates/world/2016_04_05_14_world_2016_02_13_00_world.sql
@@ -0,0 +1,4 @@
SET @ENTRY:=23258;
SET @AURA:=40670;
DELETE FROM `creature_template_addon` WHERE `entry` = @ENTRY;
INSERT INTO `creature_template_addon` (`entry`, `auras`) VALUES (@ENTRY, @AURA);
12 changes: 5 additions & 7 deletions src/server/scripts/World/npcs_special.cpp
Expand Up @@ -2516,9 +2516,8 @@ class npc_train_wrecker : public CreatureScript

enum EgbertMisc
{
SPELL_EGBERT = 40670,
SPELL_EGBERT2 = 40669,
EVENT_RETURN = 3,
SPELL_EGBERT = 40669,
EVENT_RETURN = 3
};

class npc_egbert : public CreatureScript
Expand All @@ -2540,7 +2539,6 @@ class npc_egbert : public CreatureScript
_events.Reset();
if (Unit* owner = me->GetCharmerOrOwner())
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
me->CastSpell(me, SPELL_EGBERT);
}

void EnterEvadeMode(EvadeReason why) override
Expand All @@ -2559,20 +2557,20 @@ class npc_egbert : public CreatureScript
{
if (!me->IsWithinDist(owner, 40.f))
{
me->RemoveAura(SPELL_EGBERT2);
me->RemoveAura(SPELL_EGBERT);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
}
}

if (me->HasAura(SPELL_EGBERT2))
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_EGBERT2);
me->RemoveAura(SPELL_EGBERT);
break;
default:
break;
Expand Down

0 comments on commit b33afb6

Please sign in to comment.