TeleportPets() public static méthode

public static TeleportPets ( Mobile master, Point3D loc, Map map ) : void
master Mobile
loc Point3D
map Map
Résultat void
Exemple #1
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            Point3D loc = new Point3D(5703, 639, 0);
            Map     map = this.Map;

            Effects.SendLocationParticles(EffectItem.Create(loc, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 0, 0, 2023, 0);
            Effects.PlaySound(loc, map, 0x1FE);

            BaseCreature.TeleportPets(defender, loc, map);

            defender.MoveToWorld(loc, map);

            defender.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1152076); // You are captured by the jailor and returned to your cell.
        }
 public void ReturnToBoat(Point3D loc, Map map, Mobile from)
 {
     if (!SpellHelper.CheckTravel(from, TravelCheckType.RecallFrom))
     {
     }
     else if (Worlds.AllowEscape(from, from.Map, from.Location, from.X, from.Y) == false)
     {
         this.SayTo(from, "Your ship is somewhere I cannot send you.");
     }
     else if (Worlds.RegionAllowedRecall(from.Map, from.Location, from.X, from.Y) == false)
     {
         this.SayTo(from, "Your ship is somewhere I cannot send you.");
     }
     else if (Worlds.RegionAllowedTeleport(map, loc, loc.X, loc.Y) == false)
     {
         this.SayTo(from, "Your ship is somewhere I cannot send you.");
     }
     else if (!SpellHelper.CheckTravel(from, map, loc, TravelCheckType.RecallTo))
     {
     }
     else if (Server.Misc.WeightOverloading.IsOverloaded(from))
     {
         from.SendLocalizedMessage(502359, "", 0x22);                   // Thou art too encumbered to move.
     }
     else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
     {
         from.SendLocalizedMessage(501942);                   // That location is blocked.
     }
     else
     {
         BaseCreature.TeleportPets(from, loc, map, false);
         from.PlaySound(0x13);
         Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 0, 0, 5024, 0);
         from.MoveToWorld(loc, map);
         from.PlaySound(0x13);
         Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 0, 0, 5024, 0);
     }
 }
            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                Map map = m_Owner.Map;

                if (map == null)
                {
                    return;
                }

                if (0.25 < Utility.RandomDouble())
                {
                    return;
                }

                Mobile toTeleport = null;

                foreach (Mobile m in m_Owner.GetMobilesInRange(10))
                {
                    if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m) && m.AccessLevel == AccessLevel.Player && ((BaseCreature)m_Owner).IsEnemy(m))
                    {
                        toTeleport = m;
                        break;
                    }
                }

                if (toTeleport != null)
                {
                    int offset = Utility.Random(8) * 2;

                    Point3D to = m_Owner.Location;

                    for (int i = 0; i < m_Offsets.Length; i += 2)
                    {
                        int x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length];
                        int y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                        if (map.CanSpawnMobile(x, y, m_Owner.Z))
                        {
                            to = new Point3D(x, y, m_Owner.Z);
                            break;
                        }
                        else
                        {
                            int z = map.GetAverageZ(x, y);

                            if (map.CanSpawnMobile(x, y, z))
                            {
                                to = new Point3D(x, y, z);
                                break;
                            }
                        }
                    }

                    Mobile m = toTeleport;

                    Point3D from = m.Location;

                    m.Location = to;

                    Server.Spells.SpellHelper.Turn(m_Owner, toTeleport);
                    Server.Spells.SpellHelper.Turn(toTeleport, m_Owner);

                    m.ProcessDelta();

                    m.PlaySound(0x58D);

                    m_Owner.Combatant = toTeleport;

                    BaseCreature.TeleportPets(m, m.Location, m.Map, false);
                }
            }