void HomeMovementGenerator<Creature>::Finalize(Creature& owner)
{
    if (i_travel_timer == 0)
    {
        if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME)
            owner.ClearTemporaryFaction();

        owner.LoadCreatureAddon(true);
        owner.AI()->JustReachedHome();
    }
}
Example #2
0
void HomeMovementGenerator<Creature>::Finalize(Creature& owner)
{
    if (arrived)
    {
        if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME)
            owner.ClearTemporaryFaction();

        owner.SetWalk(!owner.hasUnitState(UNIT_STAT_RUNNING_STATE) && !owner.IsLevitating(), false);
        owner.LoadCreatureAddon(true);
        owner.AI()->JustReachedHome();
    }
}
void HomeMovementGenerator<Creature>::Finalize(Creature& owner)
{
    if (i_travel_timer == 0)
    {
        owner.AddSplineFlag(SPLINEFLAG_WALKMODE);

        // restore orientation of not moving creature at returning to home
        if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE)
        {
            // such a mob might need very exact spawning point, hence relocate to spawn-position
            if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetGUIDLow()))
            {
                owner.Relocate(data->posX, data->posY, data->posZ, data->orientation);
                owner.SendHeartBeat(false);
            }
        }

        if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME)
            owner.ClearTemporaryFaction();

        owner.LoadCreatureAddon(true);
        owner.AI()->JustReachedHome();
    }
}