public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (Galleon != null) { if (Galleon.Contains(from)) { SecurityLevel level = Galleon.GetSecurityLevel(from); if (level >= SecurityLevel.Crewman) { list.Add(new EmergencyRepairEntry(this, from)); list.Add(new ShipRepairEntry(this, from)); } if (level == SecurityLevel.Captain) { list.Add(new RenameShipEntry(Galleon, from)); list.Add(new MoveTillermanEntry(this, from)); list.Add(new SecuritySettingsEntry(this, from)); list.Add(new ResetSecuritySettings(this, from)); } } else { list.Add(new DryDockEntry(Galleon, from)); } } }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (Galleon.GetSecurityLevel(from) >= SecurityLevel.Officer) { list.Add(new UnloadContext(this, from)); list.Add(new DismantleContext(this, from)); list.Add(new RepairContext(this, from)); } }
public override bool AllowEquipFrom(Mobile from) { if (Galleon == null || from == null) { return(false); } if (Galleon.GetSecurityLevel(from) >= SecurityLevel.Captain) { return(true); } return(base.AllowEquipFrom(from)); }
public override bool CheckNonlocalLift(Mobile from, Item item) { if (Galleon == null || from == null) { return(false); } if (Galleon.GetSecurityLevel(from) >= SecurityLevel.Captain) { return(true); } return(base.CheckNonlocalLift(from, item)); }
public override void OnDoubleClick(Mobile from) { if (Galleon.GetSecurityLevel(from) >= SecurityLevel.Crewman) { base.OnDoubleClick(from); if (!Viewing.Contains(from)) { Viewing.Add(from); } AddAction(from, from.InRange(Location, 2) ? 1149653 : 1149654); // You are now operating the cannon. : You are too far away. ResendGump(from, TimeSpan.FromMilliseconds(500)); } }
public override void OnDoubleClick(Mobile from) { from.RevealingAction(); BaseBoat boat = BaseBoat.FindBoatAt(from, from.Map); Item mount = from.FindItemOnLayer(Layer.Mount); if (boat == null || Galleon == null || boat != Galleon) { from.SendLocalizedMessage(1116724); // You cannot pilot a ship unless you are aboard it! } else if (Galleon.GetSecurityLevel(from) < SecurityLevel.Crewman) { from.SendLocalizedMessage(1116726); // This is not your ship! } else if (Pilot != null && Pilot != from && (Galleon.GetSecurityLevel(from) < Galleon.GetSecurityLevel(Pilot) || Pilot == 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 && 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) { if (Galleon == null || from.AccessLevel > AccessLevel.Player) { base.OnDoubleClick(from); } else if (!Galleon.Contains(from)) { if (Galleon.TillerMan != null) { Galleon.TillerManSay(502490); // You must be on the ship to open the hold. } } else if (Galleon.Owner is PlayerMobile && !Galleon.Scuttled && Galleon.GetSecurityLevel(from) < SecurityLevel.Officer) { from.Say(1010436); // You do not have permission to do this. } 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]; AmmoInfo ammoInfo = list[2] as AmmoInfo; Mobile shooter = list[3] as Mobile; if (target != null && Galleon != null) { int damage = (int)(ammoInfo.GetDamage(this) * Galleon.CannonDamageMod); target.OnTakenDamage(shooter, 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); Mobile victim = target.Owner; if (victim != null && target.Contains(victim) && shooter.CanBeHarmful(victim, false)) { shooter.DoHarmful(victim); } else { List <Mobile> candidates = new List <Mobile>(); SecurityLevel highest = SecurityLevel.Passenger; foreach (var mob in target.GetMobilesOnBoard().OfType <PlayerMobile>().Where(pm => shooter.CanBeHarmful(pm, false))) { if (Galleon.GetSecurityLevel(mob) > highest) { candidates.Insert(0, mob); } else { candidates.Add(mob); } } if (candidates.Count > 0) { shooter.DoHarmful(candidates[0]); } else if (victim != null && shooter.IsHarmfulCriminal(victim)) { shooter.CriminalAction(false); } ColUtility.Free(candidates); } if (Galleon.Map != null) { IPooledEnumerable eable = Galleon.Map.GetItemsInRange(hit, 1); foreach (Item item in eable) { if (item is IShipCannon && !Galleon.Contains(item)) { ((IShipCannon)item).OnDamage(damage, shooter); } } eable.Free(); } } }