public override bool CheckNonlocalLift(Mobile from, Item item) { if (m_Galleon == null || from == null) { return(false); } if (m_Galleon.GetSecurityLevel(from) >= SecurityLevel.Captain) { return(true); } return(base.CheckNonlocalLift(from, item)); }
public override void OnDoubleClick(Mobile from) { from.RevealingAction(); BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map); Item mount = from.FindItemOnLayer(Layer.Mount); if (boat == null || m_Galleon == null || boat != m_Galleon) { from.SendLocalizedMessage(1116724); // You cannot pilot a ship unless you are aboard it! } else if (m_Galleon.GetSecurityLevel(from) < SecurityLevel.Crewman) { from.SendLocalizedMessage(1116726); // This is not your ship! } else if (Pilot != null && Pilot != from && (m_Galleon.GetSecurityLevel(from) < m_Galleon.GetSecurityLevel(Pilot) || Pilot == m_Galleon.Owner)) { from.SendLocalizedMessage(502221); // Someone else is already using this item. } else if (from.Flying) { from.SendLocalizedMessage(1116615); // You cannot pilot a ship while flying! } else if (from.Mounted && !(mount is BoatMountItem)) { from.SendLocalizedMessage(1010097); // You cannot use this while mounted or flying. } else if (Pilot == null && m_Galleon.Scuttled) { from.SendLocalizedMessage(1116725); // This ship is too damaged to sail! } else if (Pilot != null) { if (from != Pilot) // High authorized player takes control of the ship { boat.RemovePilot(from); boat.LockPilot(from); } else { boat.RemovePilot(from); } } else { boat.LockPilot(from); } }
public override void OnDoubleClick(Mobile from) { from.RevealingAction(); BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map); Item mount = from.FindItemOnLayer(Layer.Mount); if (boat != null && Pilot == from) { boat.RemovePilot(from); } else if (!from.InRange(this.Location, 3)) { from.SendLocalizedMessage(500295); //You are too far away to do that. } else if (boat == null && boat != m_Galleon) { from.SendLocalizedMessage(1116724); //You cannot pilot a ship unless you are aboard it! } else if (m_Galleon.GetSecurityLevel(from) < SecurityLevel.Crewman) { from.SendLocalizedMessage(1116726); //This is not your ship! } else if (Pilot != null && Pilot != from) { from.SendLocalizedMessage(502221); // Someone else is already using this item. } else if (from.Flying) { from.SendLocalizedMessage(1116615); // You cannot pilot a ship while flying! } else if (from.Mounted && !(mount is BoatMountItem)) { from.SendLocalizedMessage(1010097); //You cannot use this while mounted or flying. } else if (Pilot == null && m_Galleon.Scuttled) { from.SendLocalizedMessage(1116725); //This ship is too damaged to sail! } else { boat.LockPilot(from); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is IPoint3D) { IPoint3D pnt = (IPoint3D)targeted; BaseGalleon galleon = BaseGalleon.FindGalleonAt(pnt, from.Map); if (galleon == null || !galleon.Contains(from)) { return; } if (galleon.GetSecurityLevel(from) < SecurityLevel.Captain) { from.SendMessage("You must be the captain to paint this ship!"); } else if (galleon.Contains(pnt) /*&& boat.X == pnt.X && boat.Y == pnt.Y*/) { if (m_Paint.Permanent) { if (galleon.TryPermanentPaintBoat(from, m_Paint.Hue)) { m_Paint.Delete(); } } else { if (galleon.TryPaintBoat(from, m_Paint.Hue)) { m_Paint.Delete(); } } } else { from.SendLocalizedMessage(1116612); //You must target the main mast of the ship you wish to dye. } } }
public override void OnDoubleClick(Mobile from) { if (m_Galleon == null || from.AccessLevel > AccessLevel.Player) { base.OnDoubleClick(from); } else if (!m_Galleon.Contains(from)) { if (m_Galleon.TillerMan != null) { m_Galleon.TillerManSay("You must be on the ship to open the container."); } } else if (m_Galleon.Owner is PlayerMobile && !m_Galleon.Scuttled && m_Galleon.GetSecurityLevel(from) < SecurityLevel.Crewman) { from.SendMessage("You must be at least a crewman to access the ship container."); } else { base.OnDoubleClick(from); } }
public override void OnDoubleClick(Mobile from) { if (m_Galleon == null || from.AccessLevel > AccessLevel.Player) { base.OnDoubleClick(from); } else if (!m_Galleon.Contains(from)) { if (m_Galleon.TillerMan != null) { m_Galleon.TillerManSay(502490); // You must be on the ship to open the hold. } } else if (m_Galleon.Owner is PlayerMobile && !m_Galleon.Scuttled && m_Galleon.GetSecurityLevel(from) < SecurityLevel.Officer) { from.SendMessage("You must be at least an officer to access the cargo hold."); } else { base.OnDoubleClick(from); } }
public virtual void OnShipHit(object obj) { object[] list = (object[])obj; BaseGalleon target = list[0] as BaseGalleon; Point3D pnt = (Point3D)list[1]; var ammoInfo = AmmoInfo.GetAmmoInfo((AmmunitionType)list[2]); if (ammoInfo != null && target != null) { int damage = (Utility.RandomMinMax(ammoInfo.MinDamage, ammoInfo.MaxDamage)); damage /= 7; target.OnTakenDamage(Operator, damage); int z = target.ZSurface; if (target.TillerMan != null && target.TillerMan is IEntity) { z = ((IEntity)target.TillerMan).Z; } Direction d = Utility.GetDirection(this, pnt); int xOffset = 0; int yOffset = 0; Point3D hit = pnt; if (!ammoInfo.RequiresSurface) { switch (d) { default: case Direction.North: xOffset = Utility.RandomMinMax(-1, 1); yOffset = Utility.RandomMinMax(-2, 0); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; case Direction.South: xOffset = Utility.RandomMinMax(-1, 1); yOffset = Utility.RandomMinMax(0, 2); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; case Direction.East: xOffset = Utility.RandomMinMax(0, 2); yOffset = Utility.RandomMinMax(-1, 1); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; case Direction.West: xOffset = Utility.RandomMinMax(-2, 0); yOffset = Utility.RandomMinMax(-1, 1); hit = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z); break; } } Effects.SendLocationEffect(hit, target.Map, Utility.RandomBool() ? 14000 : 14013, 15, 10); Effects.PlaySound(hit, target.Map, 0x207); if (Operator != null && (!Operator.Deleted || CanFireUnmanned)) { Mobile victim = target.Owner; if (victim != null && target.Contains(victim) && Operator.CanBeHarmful(victim, false)) { Operator.DoHarmful(victim); } else { List <Mobile> candidates = new List <Mobile>(); SecurityLevel highest = SecurityLevel.Passenger; foreach (var mob in target.GetMobilesOnBoard().OfType <PlayerMobile>().Where(pm => Operator.CanBeHarmful(pm, false))) { if (target.GetSecurityLevel(mob) > highest) { candidates.Insert(0, mob); } else { candidates.Add(mob); } } if (candidates.Count > 0) { Operator.DoHarmful(candidates[0]); } else if (victim != null && Operator.IsHarmfulCriminal(victim)) { Operator.CriminalAction(false); } ColUtility.Free(candidates); } } } }