public BoardRope(BaseGalleon galleon)
            : base(5368)
        {
            m_Galleon = galleon;
            m_Locked = true;

            Movable = false;
        }
        public BoardRope()
            : base(5368)
        {
            m_Locked = true;
            Movable = false;

            m_Galleon = BaseGalleon.FindGalleonAt(new Point2D(X, Y), Map);
            if (m_Galleon != null)
                m_Galleon.Ropes.Add(this);
        }
        public TillerMan(BaseGalleon galleon)
            : base()
        {
            m_Galleon = galleon;
            CantWalk = true;

            InitStats(31, 41, 51);

            SpeechHue = Utility.RandomDyedHue();

            Hue = Utility.RandomSkinHue();


            if (this.Female = Utility.RandomBool())
            {
                this.Body = 0x191;
                this.Name = NameList.RandomName("female");
                AddItem(new Kilt(Utility.RandomDyedHue()));
                AddItem(new Shirt(Utility.RandomDyedHue()));
                AddItem(new ThighBoots());
                Title = "the tillerman";
            }
            else
            {
                this.Body = 0x190;
                this.Name = NameList.RandomName("male");
                AddItem(new ShortPants(Utility.RandomNeutralHue()));
                AddItem(new Shirt(Utility.RandomDyedHue()));
                AddItem(new Sandals());
                Title = "the tillerman";
            }

            AddItem(new Bandana(Utility.RandomDyedHue()));

            Utility.AssignRandomHair(this);

            Container pack = new Backpack();

            pack.DropItem(new Gold(250, 300));

            pack.Movable = false;

            AddItem(pack);
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Galleon = reader.ReadItem() as BaseGalleon;
                        m_Locked = reader.ReadBool();

                        if (m_Galleon == null)
                            Delete();

                        break;
                    }
            }
        }
        public ConfirmDryDockGump(Mobile from, BaseGalleon galleon)
            : base(150, 200)
        {
            m_From = from;
            m_Galleon = galleon;

            m_From.CloseGump(typeof(ConfirmDryDockGump));

            AddPage(0);

            AddBackground(0, 0, 220, 170, 5054);
            AddBackground(10, 10, 200, 150, 3000);

            AddHtmlLocalized(20, 20, 180, 80, 1018319, true, false); // Do you wish to dry dock this boat?

            AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE
            AddButton(20, 100, 4005, 4007, 2, GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL
            AddButton(20, 125, 4005, 4007, 1, GumpButtonType.Reply, 0);
        }
Example #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadEncodedInt();

            m_Pole    = reader.ReadItem() as BindingPole;
            m_Rope    = reader.ReadItem() as BindingRope;
            m_Captain = reader.ReadMobile();
            m_Galleon = reader.ReadItem() as BaseGalleon;

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                Mobile mob = reader.ReadMobile();
                if (mob != null)
                {
                    m_Helpers.Add(mob);
                }
            }

            if (m_Rope != null)
            {
                m_Rope.Quest = this;
            }

            if (m_Pole != null)
            {
                m_Pole.Quest = this;
            }
            else
            {
                AddPole();
            }

            AddReward(new BaseReward(1116712)); //The gold listed on the bulletin board and a special reward from the officer if captured alive.
        }
Example #7
0
        public virtual void DoDamageBoat(BaseGalleon galleon)
        {
            int damage = Utility.RandomMinMax(MinBoatDamage, MaxBoatDamage);

            galleon.OnTakenDamage(this, damage);

            for (int x = this.X - 2; x <= this.X + 2; x++)
            {
                for (int y = this.Y - 2; y <= this.Y + 2; y++)
                {
                    BaseBoat boat = BaseBoat.FindBoatAt(new Point2D(x, y), this.Map);
                    if (boat != null && boat == galleon)
                    {
                        Direction toPush = Direction.North;
                        if (this.X < x && x - this.X > 1)
                        {
                            toPush = Direction.West;
                        }
                        else if (this.X > x && this.X - x > 1)
                        {
                            toPush = Direction.East;
                        }
                        else if (this.Y < y)
                        {
                            toPush = Direction.South;
                        }
                        else if (this.Y > y)
                        {
                            toPush = Direction.North;
                        }

                        boat.StartMove(toPush, 1, 0x2, BaseBoat.SlowDriftInterval, true, false);
                        //TODO: Message and Sound?
                    }
                }
            }
        }
Example #8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                Type          = (LocationType)reader.ReadInt();
                m_Galleon     = reader.ReadItem() as BaseGalleon;
                m_House       = reader.ReadItem() as BaseHouse;
                m_Description = reader.ReadString();
                m_Marked      = reader.ReadBool();
                Target        = reader.ReadPoint3D();
                m_TargetMap   = reader.ReadMap();

                break;
            }

            case 1:
            {
                m_House = reader.ReadItem() as BaseHouse;
                goto case 0;
            }

            case 0:
            {
                m_Description = reader.ReadString();
                m_Marked      = reader.ReadBool();
                Target        = reader.ReadPoint3D();
                m_TargetMap   = reader.ReadMap();

                break;
            }
            }
        }
Example #9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Boat     = reader.ReadItem() as BaseGalleon;
                m_Side     = (BoatRopeSide)reader.ReadInt();
                m_Locked   = reader.ReadBool();
                m_KeyValue = reader.ReadUInt();

                if (m_Boat == null)
                {
                    Delete();
                }

                break;
            }
            }
        }
Example #10
0
 public InternalTarget(ShipCannonDeed deed, BaseGalleon galleon)
     : base(2, false, TargetFlags.None)
 {
     Deed    = deed;
     Galleon = galleon;
 }
 public override void DoDamageBoat(BaseGalleon galleon)
 {
     DoAreaExplosion();
     base.DoDamageBoat(galleon);
 }
Example #12
0
        public GrantAccessGump(Mobile player, BaseGalleon galleon) : base(50, 50, galleon)
        {
            player.CloseGump(typeof(GrantAccessGump));

            m_Player  = player;
            m_Galleon = galleon;
            m_Entry   = galleon.SecurityEntry;

            if (m_Entry == null)
            {
                m_Entry = new SecurityEntry(m_Galleon);
                m_Galleon.SecurityEntry = m_Entry;
            }

            bool          isAccessed = m_Entry.Manifest.ContainsKey(player);
            bool          inGuild    = m_Entry.IsInGuild(player);
            bool          inParty    = m_Entry.IsInParty(player);
            bool          isPublic   = m_Entry.IsPublic;
            SecurityLevel level      = m_Entry.GetEffectiveLevel(player);

            //Player Info
            AddHtmlLocalized(10, 85, 100, 20, 1149763, LabelColor, false, false); //Player:
            AddHtml(90, 85, 100, 20, Color(player.Name, "DarkCyan"), false, false);

            AddHtmlLocalized(10, 105, 100, 20, 1149768, LabelColor, false, false); //Effective Level:
            AddHtmlLocalized(150, 105, 100, 20, GetLevel(level), GetHue(level), false, false);

            //Default Info
            int cliloc = isPublic ? 1149756 : 1149757;
            int hue    = isPublic ? CrewHue : NoHue;

            AddHtmlLocalized(10, 130, 100, 20, 1149731, LabelColor, false, false); //Public Access:
            AddHtmlLocalized(150, 130, 50, 20, cliloc, hue, false, false);         //Yes/No

            if (isPublic)
            {
                AddHtmlLocalized(230, 130, 100, 20, GetLevel(m_Entry.DefaultPublicAccess), GetHue(m_Entry.DefaultPublicAccess), false, false);
            }

            cliloc = inParty ? 1149756 : 1149757;
            hue    = inParty ? CrewHue : NoHue;

            AddHtmlLocalized(10, 150, 200, 20, 1149769, LabelColor, false, false);  //Is Party Member:
            AddHtmlLocalized(150, 150, 50, 20, cliloc, hue, false, false);

            if (inParty)
            {
                AddHtmlLocalized(230, 150, 100, 20, GetLevel(m_Entry.DefaultPartyAccess), GetHue(m_Entry.DefaultPartyAccess), false, false);
            }

            cliloc = inGuild ? 1149756 : 1149757;
            hue    = inGuild ? CrewHue : NoHue;

            AddHtmlLocalized(10, 170, 200, 20, 1149770, LabelColor, false, false);   //Is Guild Member
            AddHtmlLocalized(150, 170, 50, 20, cliloc, hue, false, false);

            if (inGuild)
            {
                AddHtmlLocalized(230, 170, 100, 20, GetLevel(m_Entry.DefaultGuildAccess), GetHue(m_Entry.DefaultGuildAccess), false, false);
            }

            AddHtmlLocalized(10, 195, 300, 20, 1149747, LabelColor, false, false);  //Access list status:

            AddButton(65, 215, isAccessed ? 4006 : 4005, isAccessed ? 4006 : 4007, 1, GumpButtonType.Reply, 0);
            if (!isAccessed)
            {
                AddHtmlLocalized(100, 215, 200, 20, 1149775, NoHue, false, false); //Not in access list
            }
            else
            {
                AddHtmlLocalized(100, 215, 200, 20, 1149776, NoHue, false, false); //Remove from access list
            }
            AddButton(65, 235, level == SecurityLevel.Denied ? 4006 : 4005, level == SecurityLevel.Denied ? 4006 : 4007, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(100, 235, 200, 20, 1149726, LabelColor, false, false);  //Deny access

            AddButton(65, 255, level == SecurityLevel.Passenger ? 4006 : 4005, level == SecurityLevel.Passenger ? 4006 : 4007, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(100, 255, 200, 20, 1149727, level == SecurityLevel.Passenger ? GetHue(level) : LabelColor, false, false); //Passenger

            AddButton(65, 275, level == SecurityLevel.Crewman ? 4006 : 4005, level == SecurityLevel.Passenger ? 4006 : 4007, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(100, 275, 200, 20, 1149728, level == SecurityLevel.Crewman ? GetHue(level) : LabelColor, false, false);  //Crew

            AddButton(65, 295, level == SecurityLevel.Officer ? 4006 : 4005, level == SecurityLevel.Passenger ? 4006 : 4007, 5, GumpButtonType.Reply, 0);
            AddHtmlLocalized(100, 295, 200, 20, 1149729, level == SecurityLevel.Officer ? GetHue(level) : LabelColor, false, false);

            AddButton(65, 315, level == SecurityLevel.Captain ? 4006 : 4005, level == SecurityLevel.Captain ? 4006 : 4007, 6, GumpButtonType.Reply, 0);
            AddHtmlLocalized(100, 315, 200, 20, 1149730, level == SecurityLevel.Captain ? GetHue(level) : LabelColor, false, false);

            //BOtton of screen
            AddButton(10, 370, 4005, 4007, 7, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 370, 100, 20, 1149777, LabelColor, false, false);  //MAIN MENU

            AddButton(195, 370, 4005, 4007, 8, GumpButtonType.Reply, 0);
            AddHtmlLocalized(230, 370, 100, 20, 1149734, LabelColor, false, false);  //ACCESS LIST
        }
            public SmoothMove(BaseGalleon galleon, object[] objectsonboard)
                : base(0xF6)
            {
                short packetlen = 1 + 17;

                packetlen += (short)(objectsonboard.Length * 10);

                packetlen = (short)(((packetlen & 0xff) << 8) | ((packetlen >> 8) & 0xff));
                //to little endian

                m_Stream = new PacketWriter( packetlen );
                m_Stream.Write((byte)PacketID);

                m_Stream.Write((short)packetlen);

                m_Stream.Write((int)galleon.Serial);
                m_Stream.Write((byte)galleon.Speed);
                m_Stream.Write((byte)galleon.Moving);
                m_Stream.Write((byte)galleon.Direction);

                m_Stream.Write((short)galleon.X);
                m_Stream.Write((short)galleon.Y);
                m_Stream.Write((byte)0xFF);
                m_Stream.Write((sbyte)galleon.Z);

                m_Stream.Write((byte)0x0);
                m_Stream.Write((byte)objectsonboard.Length);

                #region items
                foreach (object o in objectsonboard)
                {
                    if (o is Mobile)
                    {
                            m_Stream.Write((int)((Mobile)o).Serial);
                            m_Stream.Write((short)((Mobile)o).X);
                            m_Stream.Write((short)((Mobile)o).Y);
                            m_Stream.Write((byte)0xFF);
                            m_Stream.Write((sbyte)((Mobile)o).Z);
                    }

                    if (o is Item)
                    {
                        m_Stream.Write((int)((Item)o).Serial);
                        m_Stream.Write((short)((Item)o).X);
                        m_Stream.Write((short)((Item)o).Y);
                        m_Stream.Write((byte)0xFF);
                        m_Stream.Write((sbyte)((Item)o).Z);
                    }
                }
                #endregion


                //    * BYTE[1] 0xF6
                //    * BYTE[2] Packet Length ( little endian format )
                //    * BYTE[4] Serial Multi
                //    * BYTE[1] Movement Speed
                //    * BYTE[1] Movement Direction
                //    * BYTE[1] Multi Direction
                //    * BYTE[2] X
                //    * BYTE[2] Y
                //    * BYTE[1] Fixed 0xFF
                //    * SBYTE[1] Z
                //    * BYTE[1] Fixed 0x0
                //    * BYTE[1] List Length
                //    * BYTE[List Length * 10] List 

                //Each List Entry is Composed by:

                //    * BYTE[4] Item Serial
                //    * BYTE[2] X
                //    * BYTE[2] Y
                //    * BYTE[1] Fixed 0xFF
                //    * SBYTE[1] Z 
            }
Example #14
0
        public virtual AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house, ref BaseGalleon boat)
        {
            if (Deleted)
            {
                return(AddonFitResult.Blocked);
            }

            foreach (var c in m_Components)
            {
                var p3D = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);

                if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, (c.Z == 0)))
                {
                    return(AddonFitResult.Blocked);
                }
                if (!CheckHouse(from, p3D, map, c.ItemData.Height, ref house) && !CheckBoat(from, p3D, map, ref boat))
                {
                    return(AddonFitResult.NotInHouse);
                }

                if (c.NeedsWall)
                {
                    var wall = c.WallPosition;

                    if (!IsWall(p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map))
                    {
                        return(AddonFitResult.NoWall);
                    }
                }
            }

            if (house != null)
            {
                if (RestrictToClassicHouses && house is HouseFoundation)
                {
                    return(AddonFitResult.BadHouse);
                }

                var doors = house.Doors;

                for (var i = 0; i < doors.Count; ++i)
                {
                    var door = doors[i] as BaseDoor;

                    var doorLoc    = door.GetWorldLocation();
                    var doorHeight = door.ItemData.CalcHeight;

                    foreach (var c in m_Components)
                    {
                        var addonLoc    = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);
                        var addonHeight = c.ItemData.CalcHeight;

                        if (Utility.InRange(doorLoc, addonLoc, 1) && (addonLoc.Z == doorLoc.Z ||
                                                                      ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)))
                        {
                            return(AddonFitResult.DoorTooClose);
                        }
                    }
                }
            }

            return(AddonFitResult.Valid);
        }
Example #15
0
        public Target[] AcquireTarget()
        {
            AmmoInfo ammo = AmmoInfo.GetAmmoInfo(AmmoType);

            int     xOffset = 0; int yOffset = 0;
            int     currentRange = 0;
            Point3D pnt          = Location;
            Map     map          = Map;

            switch (GetFacing())
            {
            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;
            int lateralOffset = 1;

            while (currentRange++ <= Range)
            {
                xOffset = xo;
                yOffset = yo;

                if (LateralOffset > 1 && currentRange % LateralOffset == 0)
                {
                    lateralOffset++;
                }

                TimeSpan delay = TimeSpan.FromSeconds(currentRange / 10.0);

                switch (AmmoType)
                {
                case AmmunitionType.Empty: break;

                case AmmunitionType.Cannonball:
                case AmmunitionType.FrostCannonball:
                case AmmunitionType.FlameCannonball:
                {
                    Point3D newPoint = pnt;
                    //List<IEntity> list = new List<IEntity>();

                    for (int i = -lateralOffset; i <= lateralOffset; i++)
                    {
                        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);
                        }

                        BaseGalleon g = FindValidBoatTarget(newPoint, map, ammo);

                        if (g != null && g.DamageTaken < DamageLevel.Severely && g.Owner is PlayerMobile)
                        {
                            var target = new Target();
                            target.Entity   = g;
                            target.Location = newPoint;
                            target.Range    = currentRange;

                            return(new Target[] { target });
                        }
                    }
                }
                break;

                case AmmunitionType.Grapeshot:
                {
                    Point3D       newPoint = pnt;
                    List <Target> mobiles  = new List <Target>();

                    for (int i = -lateralOffset; i <= lateralOffset; i++)
                    {
                        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);
                        }

                        foreach (Mobile m in GetTargets(newPoint, map))
                        {
                            var target = new Target();
                            target.Entity   = m;
                            target.Location = newPoint;
                            target.Range    = currentRange;

                            mobiles.Add(target);
                        }

                        if (mobiles.Count > 0 && ammo.SingleTarget)
                        {
                            var toHit = mobiles[Utility.Random(mobiles.Count)];
                            ColUtility.Free(mobiles);
                            return(new Target[] { toHit });
                        }
                    }

                    if (mobiles.Count > 0)
                    {
                        return(mobiles.ToArray());
                    }
                }
                break;
                }
            }

            return(null);
        }
Example #16
0
        public void OnTick(Point3DList path, Direction dir, int i)
        {
            if (path.Count > i)
            {
                Point3D point = path[i];
                int     o     = i - 1;

                Server.Effects.PlaySound(point, this.Map, 278);
                Server.Effects.PlaySound(point, this.Map, 279);

                for (int rn = 0; rn < (o * 2) + 1; rn++)
                {
                    int  y = 0, x = 0, y2 = 0, x2 = 0;
                    bool diag = false;
                    switch ((int)dir)
                    {
                    case (int)Direction.Running:
                    case (int)Direction.North: { x = x - o + rn; break; }

                    case 129:
                    case (int)Direction.Right: { x = x - o + rn; y = y - o + rn; break; }

                    case 130:
                    case (int)Direction.East: { y = y - o + rn; break; }

                    case 131:
                    case (int)Direction.Down: { y = y - o + rn; x = x + o - rn; break; }

                    case 132:
                    case (int)Direction.South: { x = x + o - rn; break; }

                    case 133:
                    case (int)Direction.Left: { x = x + o - rn; y = y + o - rn; break; }

                    case 134:
                    case (int)Direction.West: { y = y + o - rn; break; }

                    case (int)Direction.ValueMask:
                    case (int)Direction.Up: { y = y + o - rn; x = x - o + rn; break; }
                    }
                    switch ((int)dir)
                    {
                    case 129:
                    case (int)Direction.Right: { y2++; diag = true; break; }

                    case 131:
                    case (int)Direction.Down: { x2--; diag = true; break; }

                    case 133:
                    case (int)Direction.Left: { y2--; diag = true; break; }

                    case (int)Direction.ValueMask:
                    case (int)Direction.Up: { x2++; diag = true; break; }

                    default: { break; }
                    }

                    Point3D ep  = new Point3D(point.X + x, point.Y + y, point.Z);
                    Point3D ep2 = new Point3D(ep.X + x2, ep.Y + y2, ep.Z);

                    if (diag && i >= ((2 * path.Count) / 3))
                    {
                        return;
                    }

                    Point3D p;
                    if (diag && rn < (o * 2))
                    {
                        p = ep2;
                    }
                    else
                    {
                        p = ep;
                    }

                    if (Spells.SpellHelper.CheckMulti(p, this.Map))
                    {
                        BaseGalleon galleon = BaseGalleon.FindGalleonAt(p, this.Map);
                        if (galleon != null && !m_HasPushed)
                        {
                            int damage = Utility.RandomMinMax(MinBoatDamage, MaxBoatDamage);
                            galleon.OnTakenDamage(this, damage);

                            galleon.StartMove(dir, 1, 0x2, galleon.SlowDriftInterval, true, false);
                            m_HasPushed = true;
                        }
                        continue;
                    }

                    LandTile t = this.Map.Tiles.GetLandTile(x, y);

                    if (IsSeaTile(t))
                    {
                        Mobile spawn = new EffectSpawn();
                        spawn.MoveToWorld(p, this.Map);
                    }
                }
            }
        }
Example #17
0
        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);
        }
Example #18
0
 public RelocateTarget(GalleonPilot pilot, BaseGalleon galleon)
     : base(12, false, TargetFlags.None)
 {
     m_Pilot   = pilot;
     m_Galleon = galleon;
 }
Example #19
0
 public Hold(BaseGalleon boat)
     : base(0x3EAE)
 {
     m_Galleon = boat;
     Movable   = false;
 }
Example #20
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                IPoint3D p   = targeted as IPoint3D;
                Map      map = from.Map;

                if (p == null || map == null || this.m_Deed.Deleted)
                {
                    return;
                }

                if (this.m_Deed.IsChildOf(from.Backpack))
                {
                    BaseAddon addon = this.m_Deed.Addon;

                    Server.Spells.SpellHelper.GetSurfaceTop(ref p);

                    BaseHouse   house = null;
                    BaseGalleon boat  = null;

                    AddonFitResult res = addon.CouldFit(p, map, from, ref house, ref boat);

                    if (res == AddonFitResult.Valid)
                    {
                        addon.Resource = this.m_Deed.Resource;

                        if (addon.RetainDeedHue)
                        {
                            addon.Hue = this.m_Deed.Hue;
                        }

                        addon.MoveToWorld(new Point3D(p), map);

                        if (house != null)
                        {
                            house.Addons.Add(addon);
                        }
                        else if (boat != null)
                        {
                            boat.AddAddon(addon);
                        }

                        this.m_Deed.DeleteDeed();
                    }
                    else if (res == AddonFitResult.Blocked)
                    {
                        from.SendLocalizedMessage(500269); // You cannot build that there.
                    }
                    else if (res == AddonFitResult.NotInHouse)
                    {
                        from.SendLocalizedMessage(500274); // You can only place this in a house that you own!
                    }
                    else if (res == AddonFitResult.DoorTooClose)
                    {
                        from.SendLocalizedMessage(500271); // You cannot build near the door.
                    }
                    else if (res == AddonFitResult.NoWall)
                    {
                        from.SendLocalizedMessage(500268); // This object needs to be mounted on something.
                    }
                    if (res != AddonFitResult.Valid)
                    {
                        addon.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
            }
Example #21
0
        public PirateCaptain(BaseGalleon galleon)
            : base(galleon, AIType.AI_Melee, FightMode.Weakest, 25, 1, .2, .4)
        {
            PickRandomName();

            if (m_PirateName > 0 && (m_PirateName == 1116679 || m_PirateName == 1116680 || m_PirateName == 1116683))
            {
                Female = true;
            }

            SpeechHue = Utility.RandomDyedHue();
            Title     = "the dread pirate";
            Hue       = Race.RandomSkinHue();

            Body = Female ? 0x191 : 0x190;

            SetStr(500, 750);
            SetDex(125, 175);
            SetInt(61, 75);

            SetHits(4500, 5000);

            SetDamage(23, 35);

            SetSkill(SkillName.Fencing, 115.0, 120.0);
            SetSkill(SkillName.Macing, 115.0, 120.0);
            SetSkill(SkillName.MagicResist, 115.0, 120.0);
            SetSkill(SkillName.Swords, 115.0, 120.0);
            SetSkill(SkillName.Tactics, 115.0, 120.0);
            SetSkill(SkillName.Wrestling, 115.0, 120.0);
            SetSkill(SkillName.Anatomy, 115.0, 120.0);

            Item hat;
            Item fancyShirt = new FancyShirt();
            Item shirt      = new Shirt(GetRandomShirtHue());

            shirt.Layer = Layer.OuterTorso;

            if (Utility.RandomBool())
            {
                hat = new Bandana();
            }
            else
            {
                hat = new TricorneHat();
            }

            hat.Hue = Utility.RandomNeutralHue();

            AddItem(new Boots());
            AddItem(shirt);
            AddItem(fancyShirt);
            AddItem(hat);
            AddItem(new Cloak(Utility.RandomNeutralHue()));

            switch (Utility.Random(7))
            {
            case 0: AddItem(new Longsword()); break;

            case 1: AddItem(new Cutlass()); break;

            case 2: AddItem(new Broadsword()); break;

            case 5: AddItem(new Dagger()); break;
            }

            Utility.AssignRandomHair(this);

            Fame  = 22000;
            Karma = -22000;

            if (IsSoulboundEnemies)
            {
                IsSoulbound = true;
            }
        }
 public MoveTimer(BaseGalleon boat, TimeSpan interval, bool single)
     : base(interval, interval, single ? 1 : 0)
 {
     m_Boat = boat;
     Priority = TimerPriority.TwentyFiveMS;
 }
            public DecayTimer(BaseGalleon boat)
                : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(5.0))
            {
                m_Boat = boat;

                Priority = TimerPriority.TwoFiftyMS;
            }
 public RenameBoatPrompt(BaseGalleon galleon)
 {
     m_Boat = galleon;
 }
Example #25
0
        public ShipSecurityGump(Mobile from, BaseGalleon galleon)
            : base(galleon)
        {
            from.CloseGump(typeof(ShipSecurityGump));

            m_From    = from;
            m_Galleon = galleon;
            m_Entry   = galleon.SecurityEntry;

            if (m_Entry == null)
            {
                m_Entry = new SecurityEntry(m_Galleon);
                m_Galleon.SecurityEntry = m_Entry;
            }

            PartyAccess pa = m_Entry.PartyAccess;

            AddHtmlLocalized(10, 79, 300, 18, 1149743, LabelColor, false, false); // Party membership modifies access to this ship:

            if (pa == PartyAccess.Never)
            {
                AddImage(55, 97, 0xFA6);
            }
            else
            {
                AddButton(55, 97, 0xFA5, 0xFA7, 1001, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(90, 99, 210, 18, 1149778, LabelColor, false, false); // Never

            if (pa == PartyAccess.LeaderOnly)
            {
                AddImage(55, 115, 0xFA6);
            }
            else
            {
                AddButton(55, 115, 0xFA5, 0xFA7, 1002, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(90, 117, 210, 18, 1149744, LabelColor, false, false); // When I am Party Leader

            if (pa == PartyAccess.MemberOnly)
            {
                AddImage(55, 133, 0xFA6);
            }
            else
            {
                AddButton(55, 133, 0xFA5, 0xFA7, 1003, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(90, 135, 210, 18, 1149745, LabelColor, false, false); // When I am a Party Member

            AddHtmlLocalized(10, 158, 125, 18, 1149731, LabelColor, false, false); // Public Access:
            AddButton(140, 156, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 2);
            AddHtmlLocalized(175, 158, 125, 18, GetLevel(m_Entry.DefaultPublicAccess), GetHue(m_Entry.DefaultPublicAccess), false, false);

            AddHtmlLocalized(10, 175, 150, 18, 1149732, LabelColor, false, false); // Party Access:
            AddButton(140, 173, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 3);
            AddHtmlLocalized(175, 175, 125, 18, GetLevel(m_Entry.DefaultPartyAccess), GetHue(m_Entry.DefaultPartyAccess), false, false);

            AddHtmlLocalized(10, 193, 150, 18, 1149733, LabelColor, false, false); // Guild Access:
            AddButton(140, 191, 0xFA5, 0xFA7, 0, GumpButtonType.Page, 4);
            AddHtmlLocalized(175, 193, 125, 18, GetLevel(m_Entry.DefaultGuildAccess), GetHue(m_Entry.DefaultGuildAccess), false, false);

            AddHtmlLocalized(195, 357, 100, 18, 1149734, LabelColor, false, false); // ACCESS LIST
            AddButton(160, 355, 0xFA5, 0xFA7, 2000, GumpButtonType.Reply, 0);

            AddPage(2);

            AddBackground(30, 215, 190, 130, 0xA3C);
            AddHtmlLocalized(80, 220, 100, 18, 1149731, LabelColor, false, false); // Public Access:

            if (m_Entry.DefaultPublicAccess == SecurityLevel.NA)
            {
                AddImage(40, 243, 0xFA6);
            }
            else
            {
                AddButton(40, 243, 0xFA5, 0xFA7, 1100, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(75, 245, 140, 18, 1149725, m_Entry.DefaultPublicAccess == SecurityLevel.NA ? NAHue : LabelColor, false, false); // N/A

            if (m_Entry.DefaultPublicAccess == SecurityLevel.Passenger)
            {
                AddImage(40, 261, 0xFA6);
            }
            else
            {
                AddButton(40, 261, 0xFA5, 0xFA7, 1102, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(75, 263, 140, 18, 1149727, m_Entry.DefaultPublicAccess == SecurityLevel.Passenger ? PassengerHue : LabelColor, false, false); // PASSENGER

            if (m_Entry.DefaultPublicAccess == SecurityLevel.Crewman)
            {
                AddImage(40, 279, 0xFA6);
            }
            else
            {
                AddButton(40, 279, 0xFA5, 0xFA7, 1103, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(75, 281, 140, 18, 1149728, m_Entry.DefaultPublicAccess == SecurityLevel.Crewman ? CrewHue : LabelColor, false, false); // CREW

            if (m_Entry.DefaultPublicAccess == SecurityLevel.Officer)
            {
                AddImage(40, 297, 0xFA6);
            }
            else
            {
                AddButton(40, 297, 0xFA5, 0xFA7, 1104, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(75, 299, 140, 18, 1149729, m_Entry.DefaultPublicAccess == SecurityLevel.Officer ? OfficerHue : LabelColor, false, false); // OFFICER

            if (m_Entry.DefaultPublicAccess == SecurityLevel.Denied)
            {
                AddImage(40, 315, 0xFA6);
            }
            else
            {
                AddButton(40, 315, 0xFA5, 0xFA7, 1101, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(75, 317, 140, 18, 1149726, m_Entry.DefaultPublicAccess == SecurityLevel.Denied ? DenyHue : LabelColor, false, false); // DENY ACCESS

            AddPage(3);

            AddBackground(70, 215, 190, 130, 0xA3C);
            AddHtmlLocalized(120, 220, 100, 18, 1149732, LabelColor, false, false); // Party Access:

            if (m_Entry.DefaultPartyAccess == SecurityLevel.NA)
            {
                AddImage(80, 243, 0xFA6);
            }
            else
            {
                AddButton(80, 243, 0xFA5, 0xFA7, 1200, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(115, 245, 140, 18, 1149725, m_Entry.DefaultPartyAccess == SecurityLevel.NA ? NAHue : LabelColor, false, false); // N/A

            if (m_Entry.DefaultPartyAccess == SecurityLevel.Passenger)
            {
                AddImage(80, 261, 0xFA6);
            }
            else
            {
                AddButton(80, 261, 0xFA5, 0xFA7, 1202, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(115, 263, 140, 18, 1149727, m_Entry.DefaultPartyAccess == SecurityLevel.Passenger ? PassengerHue : LabelColor, false, false); // PASSENGER

            if (m_Entry.DefaultPartyAccess == SecurityLevel.Crewman)
            {
                AddImage(80, 279, 0xFA6);
            }
            else
            {
                AddButton(80, 279, 0xFA5, 0xFA7, 1203, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(115, 281, 140, 18, 1149728, m_Entry.DefaultPartyAccess == SecurityLevel.Crewman ? CrewHue : LabelColor, false, false); // CREW

            if (m_Entry.DefaultPartyAccess == SecurityLevel.Officer)
            {
                AddImage(80, 297, 0xFA6);
            }
            else
            {
                AddButton(80, 297, 0xFA5, 0xFA7, 1204, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(115, 299, 140, 18, 1149729, m_Entry.DefaultPartyAccess == SecurityLevel.Officer ? OfficerHue : LabelColor, false, false); // OFFICER

            if (m_Entry.DefaultPartyAccess == SecurityLevel.Denied)
            {
                AddImage(80, 315, 0xFA6);
            }
            else
            {
                AddButton(80, 315, 0xFA5, 0xFA7, 1201, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(115, 317, 140, 18, 1149726, m_Entry.DefaultPartyAccess == SecurityLevel.Denied ? DenyHue : LabelColor, false, false); // DENY ACCESS

            AddPage(4);

            AddBackground(110, 215, 190, 130, 0xA3C);
            AddHtmlLocalized(160, 220, 100, 18, 1149733, LabelColor, false, false); // Guild Access:

            if (m_Entry.DefaultGuildAccess == SecurityLevel.NA)
            {
                AddImage(120, 243, 0xFA6);
            }
            else
            {
                AddButton(120, 243, 0xFA5, 0xFA7, 1300, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(155, 245, 140, 18, 1149725, m_Entry.DefaultGuildAccess == SecurityLevel.NA ? NAHue : LabelColor, false, false); // N/A

            if (m_Entry.DefaultGuildAccess == SecurityLevel.Passenger)
            {
                AddImage(120, 261, 0xFA6);
            }
            else
            {
                AddButton(120, 261, 0xFA5, 0xFA7, 1302, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(155, 263, 140, 18, 1149727, m_Entry.DefaultGuildAccess == SecurityLevel.Passenger ? PassengerHue : LabelColor, false, false); // PASSENGER

            if (m_Entry.DefaultGuildAccess == SecurityLevel.Crewman)
            {
                AddImage(120, 279, 0xFA6);
            }
            else
            {
                AddButton(120, 279, 0xFA5, 0xFA7, 1303, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(155, 281, 140, 18, 1149728, m_Entry.DefaultGuildAccess == SecurityLevel.Crewman ? CrewHue : LabelColor, false, false); // CREW

            if (m_Entry.DefaultGuildAccess == SecurityLevel.Officer)
            {
                AddImage(120, 297, 0xFA6);
            }
            else
            {
                AddButton(120, 297, 0xFA5, 0xFA7, 1304, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(155, 299, 140, 18, 1149729, m_Entry.DefaultGuildAccess == SecurityLevel.Officer ? OfficerHue : LabelColor, false, false); // OFFICER

            if (m_Entry.DefaultGuildAccess == SecurityLevel.Denied)
            {
                AddImage(120, 315, 0xFA6);
            }
            else
            {
                AddButton(120, 315, 0xFA5, 0xFA7, 1301, GumpButtonType.Reply, 0);
            }

            AddHtmlLocalized(155, 317, 140, 18, 1149726, m_Entry.DefaultGuildAccess == SecurityLevel.Denied ? DenyHue : LabelColor, false, false); // DENY ACCESS
        }
Example #26
0
 public Carronade(BaseGalleon g) : base(g)
 {
 }
Example #27
0
        public static void FillHold(BaseGalleon galleon)
        {
            if (galleon == null)
            {
                return;
            }

            Container hold = galleon.GalleonHold;

            if (hold != null)
            {
                int cnt = Utility.RandomMinMax(7, 14);

                for (int i = 0; i < cnt; i++)
                {
                    Item item = RunicReforging.GenerateRandomItem(galleon);

                    if (item != null)
                    {
                        hold.DropItem(item);
                    }
                }

                hold.DropItem(new Swab());
                hold.DropItem(new Ramrod());
                hold.DropItem(new Matches(Utility.RandomMinMax(25, 30)));
                hold.DropItem(new HeavyCannonball(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new LightCannonball(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new HeavyGrapeshot(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new LightGrapeshot(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new HeavyPowderCharge(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new LightPowderCharge(Utility.RandomMinMax(7, 10)));
                hold.DropItem(new FuseCord(Utility.RandomMinMax(7, 10)));

                if (.10 >= Utility.RandomDouble())
                {
                    hold.DropItem(new SmugglersCache());
                }

                if (.10 >= Utility.RandomDouble())
                {
                    FishSteak steaks = new FishSteak(5);
                    switch (Utility.Random(5))
                    {
                    case 0:
                        steaks.Name = "Spiced Salmon";
                        steaks.Hue  = 1759;
                        break;

                    case 1:
                        steaks.Name = "Dried Tuna";
                        steaks.Hue  = 2108;
                        break;

                    case 2:
                        steaks.Name = "Salted Snapper";
                        steaks.Hue  = 1864;
                        break;

                    case 3:
                        steaks.Name = "Salted Herring";
                        steaks.Hue  = 2302;
                        break;

                    case 4:
                        steaks.Name = "Spiced Salmon";
                        steaks.Hue  = 1637;
                        break;
                    }

                    hold.DropItem(steaks);
                }

                hold.DropItem(new Gold(Utility.RandomMinMax(5000, 25000)));

                if (0.50 > Utility.RandomDouble())
                {
                    switch (Utility.Random(4))
                    {
                    case 0:
                    case 1:
                    case 2: hold.DropItem(new IronWire(Utility.RandomMinMax(1, 5))); break;

                    case 3:
                    case 4:
                    case 5: hold.DropItem(new CopperWire(Utility.RandomMinMax(1, 5))); break;

                    case 6:
                    case 7: hold.DropItem(new SilverWire(Utility.RandomMinMax(1, 5))); break;

                    case 8: hold.DropItem(new GoldWire(Utility.RandomMinMax(1, 5))); break;
                    }
                }

                switch (Utility.Random(8))
                {
                case 0:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new IronOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new IronIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 1:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new DullCopperOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new DullCopperIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 2:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new ShadowIronOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new ShadowIronIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 3:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new CopperOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new CopperIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 4:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new BronzeOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new BronzeIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 5:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new AgapiteOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new AgapiteIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 6:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new VeriteOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new VeriteIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 7:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new ValoriteOre(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new ValoriteIngot(Utility.RandomMinMax(40, 50)));
                    }
                    break;
                }

                switch (Utility.Random(5))
                {
                case 0:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new Board(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new Log(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 1:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new OakBoard(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new OakLog(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 2:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new AshBoard(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new AshLog(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 3:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new YewBoard(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new YewLog(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 4:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new BloodwoodBoard(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new BloodwoodLog(Utility.RandomMinMax(40, 50)));
                    }
                    break;
                }

                switch (Utility.Random(4))
                {
                case 0:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new Leather(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new Hides(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 1:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new SpinedLeather(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new SpinedHides(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 2:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new HornedLeather(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new HornedHides(Utility.RandomMinMax(40, 50)));
                    }
                    break;

                case 3:
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new BarbedLeather(Utility.RandomMinMax(40, 50)));
                    }
                    else
                    {
                        hold.DropItem(new BarbedHides(Utility.RandomMinMax(40, 50)));
                    }
                    break;
                }

                switch (Utility.Random(4))
                {
                case 0: hold.DropItem(new HeavyCannonball(Utility.RandomMinMax(5, 10))); break;

                case 1: hold.DropItem(new LightCannonball(Utility.RandomMinMax(5, 10))); break;

                case 2: hold.DropItem(new HeavyGrapeshot(Utility.RandomMinMax(5, 10))); break;

                case 3: hold.DropItem(new LightGrapeshot(Utility.RandomMinMax(5, 10))); break;
                }


                //Rares
                if (0.8 > Utility.RandomDouble())
                {
                    Item deed;

                    if (Utility.RandomBool())
                    {
                        if (Core.EJ)
                        {
                            deed = new CarronadeDeed();
                        }
                        else
                        {
                            deed = new HeavyShipCannonDeed();
                        }
                    }
                    else
                    {
                        if (Core.EJ)
                        {
                            deed = new CulverinDeed();
                        }
                        else
                        {
                            deed = new LightShipCannonDeed();
                        }
                    }

                    hold.DropItem(deed);
                }

                if (0.025 > Utility.RandomDouble())
                {
                    if (Utility.RandomBool())
                    {
                        hold.DropItem(new WhiteClothDyeTub());
                    }
                    else
                    {
                        hold.DropItem(PermanentBoatPaint.DropRandom());
                    }
                }

                RefinementComponent.Roll(hold, 3, 0.25);

                if (Points.PointsSystem.RisingTide.Enabled)
                {
                    hold.DropItem(new MaritimeCargo());
                    hold.DropItem(new MaritimeCargo());

                    if (galleon is OrcishGalleon)
                    {
                        hold.DropItem(new MaritimeCargo());

                        if (Utility.RandomBool())
                        {
                            hold.DropItem(new MaritimeCargo());
                        }
                    }
                }
            }
        }
Example #28
0
 public Blundercannon(BaseGalleon g) : base(g)
 {
 }
Example #29
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is RecallRune)
                {
                    RecallRune rune = (RecallRune)o;

                    if (rune.Marked)
                    {
                        m_Owner.Effect(rune.Target, rune.TargetMap, true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(501805); // That rune is not yet marked.
                    }
                }
                else if (o is Runebook)
                {
                    RunebookEntry e = ((Runebook)o).Default;

                    if (e != null)
                    {
                        m_Owner.Effect(e.Location, e.Map, true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502354); // Target is not marked.
                    }
                }
                else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat)
                {
                    BaseBoat boat = ((Key)o).Link as BaseBoat;

                    if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue))
                    {
                        m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false, true);
                    }
                    else
                    {
                        from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
                    }
                }

                #region High Seas
                else if (o is ShipRune && ((ShipRune)o).Galleon != null)
                {
                    BaseGalleon galleon = ((ShipRune)o).Galleon;

                    if (!galleon.Deleted && galleon.Map != null && galleon.Map != Map.Internal && galleon.HasAccess(from))
                    {
                        m_Owner.Effect(galleon.GetMarkedLocation(), galleon.Map, false, true);
                    }
                    else
                    {
                        from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
                    }
                }
                #endregion

                #region New Magincia
                else if (o is Server.Engines.NewMagincia.WritOfLease)
                {
                    Server.Engines.NewMagincia.WritOfLease lease = (Server.Engines.NewMagincia.WritOfLease)o;

                    if (lease.RecallLoc != Point3D.Zero && lease.Facet != null && lease.Facet != Map.Internal)
                    {
                        m_Owner.Effect(lease.RecallLoc, lease.Facet, false);
                    }
                    else
                    {
                        from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
                    }
                }
                #endregion

                else
                {
                    from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
                }
            }
Example #30
0
        public virtual void Shoot(object cannoneer)
        {
            AmmoInfo ammo = AmmoInfo.GetAmmoInfo(AmmoType);

            if (ammo == null)
            {
                return;
            }

            Mobile shooter = null;

            if (cannoneer is Mobile)
            {
                shooter = (Mobile)cannoneer;
            }

            if (shooter != null && shooter.Player)
            {
                m_Hits -= Utility.RandomMinMax(0, 4);
            }

            DoShootEffects();
            AddAction(shooter, 1149691); //Fired successfully.

            int       xOffset = 0; int yOffset = 0;
            int       currentRange = 0;
            Point3D   pnt          = this.Location;
            Map       map          = this.Map;
            Direction d            = GetFacing();

            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;
            int lateralOffset = 1;

            int latDist = ammo.LateralOffset;

            int  range = Range;
            bool hit   = false;

            while (currentRange++ <= range)
            {
                xOffset = xo;
                yOffset = yo;

                if (currentRange % latDist == 0)
                {
                    lateralOffset++;
                }

                TimeSpan delay = TimeSpan.FromSeconds((double)currentRange / 10.0);

                switch (AmmoType)
                {
                case AmmunitionType.Empty: break;

                case AmmunitionType.Cannonball:
                case AmmunitionType.FrostCannonball:
                case AmmunitionType.FlameCannonball:
                {
                    Point3D            newPoint    = pnt;
                    List <IEntity>     list        = new List <IEntity>();
                    List <IDamageable> damageables = new List <IDamageable>();

                    for (int i = -lateralOffset; i <= lateralOffset; i++)
                    {
                        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);
                        }

                        BaseGalleon g = FindValidBoatTarget(newPoint, map, ammo);

                        if (g != null && g != Galleon && g.IsEnemy(Galleon))
                        {
                            list.Add(g);
                        }

                        damageables.AddRange(FindDamageables(shooter, newPoint, map, false, false, false, true, true));
                    }

                    foreach (var m in damageables)
                    {
                        list.Add(m);
                    }

                    if (list.Count > 0)
                    {
                        IEntity toHit = list[Utility.Random(list.Count)];

                        if (toHit is Mobile)
                        {
                            Timer.DelayCall(delay, new TimerStateCallback(OnMobileHit), new object[] { (Mobile)toHit, newPoint, ammo, shooter });
                            hit = true;
                        }
                        else if (toHit is BaseGalleon)
                        {
                            Timer.DelayCall(delay, new TimerStateCallback(OnShipHit), new object[] { (BaseGalleon)toHit, newPoint, ammo, shooter });
                            hit = true;
                        }
                        else if (toHit is DamageableItem)
                        {
                            Timer.DelayCall(delay, new TimerStateCallback(OnDamageableItemHit), new object[] { (DamageableItem)toHit, newPoint, ammo, shooter });
                            hit = true;
                        }
                    }
                }
                break;

                case AmmunitionType.Grapeshot:
                {
                    Point3D       newPoint = pnt;
                    List <Mobile> mobiles  = new List <Mobile>();

                    for (int i = -lateralOffset; i <= lateralOffset; i++)
                    {
                        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);
                        }

                        mobiles.AddRange(FindDamageables(shooter, newPoint, map, true, true, true, true, false).OfType <Mobile>());
                    }

                    if (mobiles.Count > 0)
                    {
                        Timer.DelayCall(delay, new TimerStateCallback(OnMobileHit), new object[] { mobiles, newPoint, ammo, shooter });
                        hit = true;
                    }
                }
                break;
                }

                if (hit && ammo.SingleTarget)
                {
                    break;
                }
            }

            ClearCannon();
            InvalidateDamageState();

            if (shooter != null)
            {
                ResendGump(shooter);
            }
        }
Example #31
0
 public bool ValidateDockOrLand()
 {
     return(BaseGalleon.IsNearLandOrDocks(Boat));
 }
Example #32
0
        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();
                }
            }
        }
Example #33
0
 public BaseShipCaptain(BaseGalleon galleon)
     : this(galleon, AIType.AI_Melee, FightMode.Weakest, 10, 1, .2, .4)
 {
 }
Example #34
0
 public ShipWheel(BaseGalleon galleon, int id)
     : base(id)
 {
     Galleon = galleon;
     Movable = false;
 }
Example #35
0
 public PumpkinCannon(BaseGalleon g)
     : base(g)
 {
 }
Example #36
0
 public void SetGalleon(BaseGalleon galleon)
 {
     m_Marked = true;
     Galleon  = galleon;
 }
Example #37
0
        public virtual AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house)
        {
            BaseGalleon boat = null;

            return(CouldFit(p, map, from, ref house, ref boat));
        }
Example #38
0
        public void Mark(Mobile m)
        {
            RecallRuneEmpty();

            m_Marked = true;

            bool setDesc = false;

            m_Galleon = BaseBoat.FindBoatAt(m) as BaseGalleon;

            if (m_Galleon != null)
            {
                Type = RecallRuneType.Ship;
            }
            else
            {
                m_House = BaseHouse.FindHouseAt(m);

                if (m_House == null)
                {
                    Target      = m.Location;
                    m_TargetMap = m.Map;

                    Type = RecallRuneType.Normal;
                }
                else
                {
                    HouseSign sign = m_House.Sign;

                    if (sign != null)
                    {
                        m_Description = sign.Name;
                    }
                    else
                    {
                        m_Description = null;
                    }

                    if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0)
                    {
                        m_Description = "an unnamed house";
                    }

                    setDesc = true;

                    int x = m_House.BanLocation.X;
                    int y = m_House.BanLocation.Y + 2;
                    int z = m_House.BanLocation.Z;

                    Map map = m_House.Map;

                    if (map != null && !map.CanFit(x, y, z, 16, false, false))
                    {
                        z = map.GetAverageZ(x, y);
                    }

                    Target      = new Point3D(x, y, z);
                    m_TargetMap = map;

                    Type = RecallRuneType.Shop;
                }
            }

            if (!setDesc)
            {
                m_Description = BaseRegion.GetRuneNameFor(Region.Find(Target, m_TargetMap));
            }

            CalculateHue();
            InvalidateProperties();
        }
Example #39
0
        public override AddonFitResult CouldFit(IPoint3D p, Map map, Mobile from, ref BaseHouse house, ref BaseGalleon boat)
        {
            AddonFitResult result = base.CouldFit(p, map, from, ref house, ref boat);

            if (result == AddonFitResult.Valid)
            {
                foreach (AddonToolComponent c in Tools)
                {
                    Point3D p3D = new Point3D(p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z);

                    if (!map.CanFit(p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, (c.Z == 0)))
                    {
                        return(AddonFitResult.Blocked);
                    }
                    else if (!CheckHouse(from, p3D, map, c.ItemData.Height, ref house))
                    {
                        return(AddonFitResult.NotInHouse);
                    }

                    if (c.NeedsWall)
                    {
                        Point3D wall = c.WallPosition;

                        if (!BaseAddon.IsWall(p3D.X + wall.X, p3D.Y + wall.Y, p3D.Z + wall.Z, map))
                        {
                            return(AddonFitResult.NoWall);
                        }
                    }
                }
            }

            return(result);
        }
            public TurnTimer(BaseGalleon boat, int offset)
                : base(TimeSpan.FromSeconds(0.5))
            {
                m_Boat = boat;
                m_Offset = offset;

                Priority = TimerPriority.TenMS;
            }