Ejemplo n.º 1
0
        public void AddGalleonPilotAndWheel(Direction direction)
        {
            int dir = GetValueForDirection(this.Facing);

            ShipWheel wheel = new ShipWheel(this);
            wheel.ItemID = WheelItemIDs[dir][0];

            GalleonPilot pilot = new GalleonPilot(this);
            pilot.Direction = direction;

            m_Wheel = wheel;
            TillerMan = pilot;
            m_GalleonPilot = pilot;

            switch (direction)
            {
                default:
                case Direction.North:
                    pilot.Location = new Point3D(X, Y + TillerManDistance, Z + ZSurface);
                    wheel.Location = new Point3D(X, Y + WheelDistance, Z + 1);
                    break;
                case Direction.South:
                    pilot.Location = new Point3D(X, Y - TillerManDistance, Z + ZSurface);
                    wheel.Location = new Point3D(X, Y - WheelDistance, Z + 1);
                    break;
                case Direction.East:
                    pilot.Location = new Point3D(X - TillerManDistance, Y, Z + ZSurface);
                    wheel.Location = new Point3D(X - WheelDistance, Y, Z + 1);
                    break;
                case Direction.West:
                    pilot.Location = new Point3D(X + TillerManDistance, Y, Z + ZSurface);
                    wheel.Location = new Point3D(X + WheelDistance, Y, Z + 1);
                    break;
            }
        }
Ejemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
                case 3:
                case 2:
                    m_Pole = reader.ReadItem() as BindingPole;
                    m_CapturedCaptain = reader.ReadMobile();
                    goto case 1;
                case 1:
                    m_BaseBoatHue = reader.ReadInt();
                    goto case 0;
                case 0:
                    m_GalleonPilot = reader.ReadMobile();
                    m_Hits = reader.ReadInt();
                    m_Wheel = reader.ReadItem() as ShipWheel;
                    m_GalleonHold = reader.ReadItem() as GalleonHold;

                    if (version < 3)
                    {
                        reader.ReadItem();
                        reader.ReadItem();
                    }

                    m_DamageTaken = (DamageLevel)reader.ReadInt();

                    m_BasePaintHue = reader.ReadInt();
                    m_PaintCoats = reader.ReadInt();
                    m_NextPaintDecay = reader.ReadDateTime();

                    m_SecurityEntry = new SecurityEntry(this, reader);

                    int count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Static tile = reader.ReadItem() as Static;
                        if (tile != null && !tile.Deleted)
                            AddCannonTile(tile);
                    }

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Item cannon = reader.ReadItem();
                        if (cannon != null && !cannon.Deleted)
                            m_Cannons.Add(cannon);
                    }

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Static filler = reader.ReadItem() as Static;
                        if (filler != null && !filler.Deleted)
                            AddFillerTile(filler);
                    }

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        MooringLine line = reader.ReadItem() as MooringLine;
                        if (line != null && !line.Deleted)
                            AddMooringLine(line);
                    }

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        HoldItem hItem = reader.ReadItem() as HoldItem;
                        if (hItem != null && !hItem.Deleted)
                            AddHoldTile(hItem);
                    }

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Item addon = reader.ReadItem();
                        if (addon != null && !addon.Deleted)
                            AddAddon(addon);
                    }

                    count = reader.ReadInt();
                    for (int i = 0; i < count; i++)
                    {
                        Static atile = reader.ReadItem() as Static;
                        if (atile != null && !atile.Deleted)
                            AddAddonTile(atile);
                    }

                    break;
            }

            if (m_Pole != null)
                m_Pole.Galleon = this;
        }