コード例 #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_cannon = reader.ReadItem() as BaseCannon;
        }
コード例 #2
0
            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.
                }
            }
コード例 #3
0
ファイル: AmmoInfo.cs プロジェクト: pallop/Servuo
        public static string GetAmmoName(BaseCannon cannon)
        {
            AmmoInfo info = AmmoInfo.GetAmmoInfo(cannon.LoadedAmmo);

            if (info != null)
            {
                return(info.Name);
            }

            return("unloaded");
        }
コード例 #4
0
ファイル: Matches.cs プロジェクト: somedude373/NeverFade
            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.
                    }
                }
            }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
		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);
		}
コード例 #7
0
ファイル: FireableCannon.cs プロジェクト: greeduomacro/annox
		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();
		}
コード例 #8
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public DismantleContext(BaseCannon cannon, Mobile from)
     : base(1116069, 3)
 {
     m_From = from;
     m_Cannon = cannon;
 }
コード例 #9
0
			public Disassemble( BaseCannon cannon ) : base( 6142, 3 )
			{
				m_Cannon = cannon;
			}
コード例 #10
0
 public CannonComponent(int itemID, BaseCannon c) : base(itemID)
 {
     m_cannon  = c;
     m_HitsMax = 200;
     m_Hits    = 200;
 }
コード例 #11
0
        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);
            }
        }
コード例 #12
0
		public CannonComponent( int itemID, BaseCannon c ) : base( itemID )
		{
			m_cannon = c;
			m_HitsMax = 200;
			m_Hits = 200;
		}
コード例 #13
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public CleanContext(BaseCannon cannon, Mobile from) : base(1149626, 3)
 {
     m_From = from;
     m_Cannon = cannon;
 }
コード例 #14
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public ChargeContext(BaseCannon cannon, Mobile from) : base(1149630, 3)
 {
     m_From = from;
     m_Cannon = cannon;
 }
コード例 #15
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			m_Cannon = (BaseCannon)reader.ReadItem();
		}
コード例 #16
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public PrimeContext(BaseCannon cannon, Mobile from) : base(1149637, 3)
 {
     m_From = from;
     m_Cannon = cannon;
 }
コード例 #17
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public LoadContext(BaseCannon cannon, Mobile from)
     : base(1149635, 3)
 {
     m_From = from;
     m_Cannon = cannon;
 }
コード例 #18
0
ファイル: AmmoInfo.cs プロジェクト: Crome696/ServUO
        public static string GetAmmoName(BaseCannon cannon)
        {
            AmmoInfo info = AmmoInfo.GetAmmoInfo(cannon.LoadedAmmo);

            if (info != null)
                return info.Name;

            return "unloaded";
        }
コード例 #19
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public RepairContext(BaseCannon cannon, Mobile from)
     : base(1116602, 3)
 {
     m_From = from;
     m_Cannon = cannon;
 }
コード例 #20
0
ファイル: BaseSeaChampion.cs プロジェクト: Crome696/ServUO
 public virtual void OnHitByCannon(BaseCannon cannon, int damage)
 {
 }
コード例 #21
0
ファイル: Cannon.cs プロジェクト: Crome696/ServUO
 public LoadCannonTarget(BaseCannon cannon) : base(3, false, TargetFlags.None)
 {
     m_Cannon = cannon;
 }
コード例 #22
0
 public Disassemble(BaseCannon cannon) : base(6142, 3)
 {
     m_Cannon = cannon;
 }
コード例 #23
0
ファイル: BaseShipCaptain.cs プロジェクト: Crome696/ServUO
        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;
        }
コード例 #24
0
 public CannonComponent(int itemID, BaseCannon c) : base(itemID)
 {
     m_cannon = c;
 }
コード例 #25
0
ファイル: BaseGalleon.cs プロジェクト: Ravenwolfe/ServUO
        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;
        }
コード例 #26
0
		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;
            }
		}
コード例 #27
0
ファイル: BaseGalleon.cs プロジェクト: Ravenwolfe/ServUO
 public void RemoveCannon(BaseCannon cannon)
 {
     if(m_Cannons.Contains(cannon))
         m_Cannons.Remove(cannon);
 }
コード例 #28
0
ファイル: CannonGump.cs プロジェクト: Crome696/ServUO
        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;
            }
        }
コード例 #29
0
ファイル: BaseGalleon.cs プロジェクト: Ravenwolfe/ServUO
        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;
                    }
            }
        }