public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_cannon = reader.ReadItem() as BaseCannon; }
protected override void OnTarget(Mobile from, object targeted) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null || m_Deed.Deleted) { return; } if (targeted is Container) { from.SendLocalizedMessage(501978); // The weight is too great to combine in a container. return; } if (targeted is Item) { if (((Item)targeted).Parent != null) { from.SendLocalizedMessage(501978); // The weight is too great to combine in a container. return; } } if (m_Deed.IsChildOf(from.Backpack)) { BaseCannon cannon = m_Deed.FireCannon; cannon.Owner = from; m_Deed.Delete(); cannon.MoveToWorld(new Point3D(p), map); } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
public static string GetAmmoName(BaseCannon cannon) { AmmoInfo info = AmmoInfo.GetAmmoInfo(cannon.LoadedAmmo); if (info != null) { return(info.Name); } return("unloaded"); }
protected override void OnTarget(Mobile from, object obj) { if (obj is BaseCannon) { BaseCannon cannon = (BaseCannon)obj; if (cannon.CanLight) { cannon.LightFuse(from); } else { from.SendLocalizedMessage(1116078); //There is no fuse to light! Prime the cannon first. } } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 1: m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); goto case 0; case 0: m_cannon = reader.ReadItem() as BaseCannon; m_Hits = reader.ReadInt(); m_HitsMax = reader.ReadInt(); break; } }
public override void OnThink() { base.OnThink(); if( NextThink > DateTime.Now ) return; if( m_Cannon == null ) { m_Cannon = new CannonNorth(this); Direction = Direction.North; Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map); } if( m_Cannon.Deleted ) Delete(); if( Combatant == null ) return; NextThink = DateTime.Now + TimeSpan.FromSeconds(2.5); FireCannon(Combatant); }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_cannon = reader.ReadItem() as BaseCannon; m_Hits = reader.ReadInt(); m_HitsMax = reader.ReadInt(); }
public DismantleContext(BaseCannon cannon, Mobile from) : base(1116069, 3) { m_From = from; m_Cannon = cannon; }
public Disassemble( BaseCannon cannon ) : base( 6142, 3 ) { m_Cannon = cannon; }
public CannonComponent(int itemID, BaseCannon c) : base(itemID) { m_cannon = c; m_HitsMax = 200; m_Hits = 200; }
public void UnHitch() { Mobile from = m_Owner; Mobile mount = m_Hitch; Map map = Map; Point3D p = Location; BaseCannon cn = null; switch (Direction) { case Direction.Up: case Direction.North: { cn = new CannonNorth(m_Owner); break; } case Direction.Down: case Direction.South: { cn = new CannonSouth(m_Owner); break; } case Direction.Right: case Direction.East: { cn = new CannonEast(m_Owner); break; } case Direction.Left: case Direction.West: { cn = new CannonWest(m_Owner); break; } } Delete(); bool canspawn = true; if (!mount.Deleted && mount != null && !mount.IsDeadBondedPet && mount.Map != Map.Internal && from.InRange(p, 5) && ((BaseCreature)m_Hitch).ControlMaster == m_Owner) { foreach (AddonComponent ac in cn.Components) { if (!map.CanSpawnMobile(new Point3D(p.X + ac.Offset.X, p.Y + ac.Offset.Y, p.Z + ac.Offset.Z))) { canspawn = false; } } } if (!canspawn) { from.SendLocalizedMessage(1011578); // There is an obstacle blocking this location or part of the structure would be on invalid terrain. MovableCannon mc = new MovableCannon(from, mount); mc.Location = p; cn.Delete(); } else { from.SendMessage("The Cannon has been unhitched."); cn.MoveToWorld(p, map); } }
public CannonComponent( int itemID, BaseCannon c ) : base( itemID ) { m_cannon = c; m_HitsMax = 200; m_Hits = 200; }
public CleanContext(BaseCannon cannon, Mobile from) : base(1149626, 3) { m_From = from; m_Cannon = cannon; }
public ChargeContext(BaseCannon cannon, Mobile from) : base(1149630, 3) { m_From = from; m_Cannon = cannon; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); m_Cannon = (BaseCannon)reader.ReadItem(); }
public PrimeContext(BaseCannon cannon, Mobile from) : base(1149637, 3) { m_From = from; m_Cannon = cannon; }
public LoadContext(BaseCannon cannon, Mobile from) : base(1149635, 3) { m_From = from; m_Cannon = cannon; }
public static string GetAmmoName(BaseCannon cannon) { AmmoInfo info = AmmoInfo.GetAmmoInfo(cannon.LoadedAmmo); if (info != null) return info.Name; return "unloaded"; }
public RepairContext(BaseCannon cannon, Mobile from) : base(1116602, 3) { m_From = from; m_Cannon = cannon; }
public virtual void OnHitByCannon(BaseCannon cannon, int damage) { }
public LoadCannonTarget(BaseCannon cannon) : base(3, false, TargetFlags.None) { m_Cannon = cannon; }
public Disassemble(BaseCannon cannon) : base(6142, 3) { m_Cannon = cannon; }
private bool HasTarget(Mobile focus, BaseCannon cannon, bool shootatboat) { if (cannon == null || cannon.Deleted || cannon.Map == null || cannon.Map == Map.Internal || m_Galleon == null || m_Galleon.Deleted) return false; Direction d = cannon.GetFacing(); int xOffset = 0; int yOffset = 0; int cannonrange = cannon.Range; int currentRange = 0; Point3D pnt = cannon.Location; switch (d) { case Direction.North: xOffset = 0; yOffset = -1; break; case Direction.South: xOffset = 0; yOffset = 1; break; case Direction.West: xOffset = -1; yOffset = 0; break; case Direction.East: xOffset = 1; yOffset = 0; break; } int xo = xOffset; int yo = yOffset; while (currentRange++ <= cannonrange) { xOffset = xo; yOffset = yo; for (int i = -1; i <= 1; i++) { Point3D newPoint; if (xOffset == 0) newPoint = new Point3D(pnt.X + (xOffset + i), pnt.Y + (yOffset * currentRange), pnt.Z); else newPoint = new Point3D(pnt.X + (xOffset * currentRange), pnt.Y + (yOffset + i), pnt.Z); if (shootatboat) { BaseGalleon g = BaseGalleon.FindGalleonAt(newPoint, this.Map); if (g != null && g == m_TargetBoat && g != Galleon) return true; } else { if (focus == null) return false; if (newPoint.X == focus.X && newPoint.Y == focus.Y) { Console.WriteLine("Shooting: {0} at {1} / {2}", focus.Name, newPoint.X, newPoint.Y); return true; } } } } return false; }
public CannonComponent(int itemID, BaseCannon c) : base(itemID) { m_cannon = c; }
public bool TryAddCannon(Mobile from, Point3D pnt, BaseCannon cannon, ShipCannonDeed deed) { if (cannon == null) return false; if (IsValidCannonSpot(ref pnt, from)) { cannon.MoveToWorld(pnt, this.Map); m_Cannons.Add((Item)cannon); UpdateCannonID(cannon); cannon.Position = GetCannonPosition(pnt); cannon.DoAreaMessage(1116074, 10, from); //~1_NAME~ deploys a ship cannon. if (deed != null && from.AccessLevel == AccessLevel.Player) deed.Delete(); return true; } cannon.Delete(); return false; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch(version) { case 1: m_MinDamage = reader.ReadInt(); m_MaxDamage = reader.ReadInt(); goto case 0; case 0: m_cannon = reader.ReadItem() as BaseCannon; m_Hits = reader.ReadInt(); m_HitsMax = reader.ReadInt(); break; } }
public void RemoveCannon(BaseCannon cannon) { if(m_Cannons.Contains(cannon)) m_Cannons.Remove(cannon); }
public CannonGump(BaseCannon cannon, Mobile from) : base(50, 50) { m_Cannon = cannon; m_From = from; AddBackground(0, 0, 300, 200, 2620); Type charge = cannon is LightShipCannon ? typeof(LightPowderCharge) : typeof(HeavyPowderCharge); bool cleaned = cannon.Cleaned; bool charged = cannon.Charged; bool primed = cannon.Primed; bool loaded = cannon.AmmoType != AmmoType.Empty; AddHtmlLocalized(0, 10, 300, 16, 1149614 + (int)m_Cannon.Position, 21758, false, false); AddHtmlLocalized(45, 40, 100, 16, 1149626, LabelColor, false, false); //CLEAN if(!charged) AddHtmlLocalized(45, 60, 100, 16, 1149630, LabelColor, false, false); //CHARGE else AddHtmlLocalized(45, 60, 100, 16, 1149629, LabelColor, false, false); //REMOVE if(!loaded) AddHtmlLocalized(45, 80, 100, 16, 1149635, LabelColor, false, false); //LOAD else AddHtmlLocalized(45, 80, 100, 16, 1149629, LabelColor, false, false); //REMOVE if(!primed) AddHtmlLocalized(45, 100, 100, 16, 1149637, LabelColor, false, false); //PRIME else if (cannon.CanLight) AddHtmlLocalized(45, 100, 100, 16, 1149638, LabelColor, false, false); //FIRE else AddHtmlLocalized(45, 100, 100, 16, 1149629, LabelColor, false, false); //REMOVE if (!cleaned) AddHtmlLocalized(150, 40, 100, 16, 1149628, RedHue, false, false); //Dirty else AddHtmlLocalized(150, 40, 100, 16, 1149627, GreenHue, false, false); //Clean if (!charged) AddHtmlLocalized(150, 60, 100, 16, 1149632, RedHue, false, false); //Not Charged else AddHtmlLocalized(150, 60, 100, 16, 1149631, GreenHue, false, false); //Charged if (!loaded) AddHtmlLocalized(150, 80, 100, 16, 1149636, RedHue, false, false); //Not Loaded else AddHtmlLocalized(150, 80, 100, 16, 1114057, AmmoInfo.GetAmmoName(cannon), GreenHue, false, false); //AddHtmlLocalized(150, 80, 100, 16, cannon.AmmoType == AmmoType.Grapeshot ? 1095741 : 1116029, GreenHue, false, false); if (!primed) AddHtmlLocalized(150, 100, 100, 16, 1149639, RedHue, false, false); //No Fuse else AddHtmlLocalized(150, 100, 100, 16, 1149640, GreenHue, false, false); //Primed AddButton(10, 40, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0); AddButton(10, 60, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0); AddButton(10, 80, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0); AddButton(10, 100, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0); if (!cannon.Actions.ContainsKey(from) || cannon.Actions[from].Count == 0) cannon.AddAction(from, 1149653); //You are now operating the cannon. int y = 170; int count = cannon.Actions[from].Count - 1; int hue = 0; for (int i = count; i >= 0; i--) { if (i < count - 3) break; if (i == count) hue = 29315; //0xFFFF00; else hue = 12684; AddHtmlLocalized(10, y, 385, 20, cannon.Actions[from][i], hue, false, false); y -= 16; } }
public void UpdateCannonID(BaseCannon cannon) { if (cannon == null) return; int type = cannon is LightShipCannon ? 0 : 1; switch (this.Facing) { default: case Direction.South: case Direction.North: { if (cannon.X == X) cannon.ItemID = m_CannonIDs[GetValueForDirection(this.Facing)][type]; else if (cannon.X < X) cannon.ItemID = m_CannonIDs[GetValueForDirection(Direction.West)][type]; else cannon.ItemID = m_CannonIDs[GetValueForDirection(Direction.East)][type]; break; } case Direction.West: case Direction.East: { if (cannon.Y == Y) cannon.ItemID = m_CannonIDs[GetValueForDirection(this.Facing)][type]; else if (cannon.Y < Y) cannon.ItemID = m_CannonIDs[GetValueForDirection(Direction.North)][type]; else cannon.ItemID = m_CannonIDs[GetValueForDirection(Direction.South)][type]; break; } } }