Esempio n. 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 4:
                    {
                        if (reader.ReadInt() == 1)
                        {
                            m_BoatCourse = new BoatCourse(reader);
                            m_BoatCourse.Boat = this;
                            m_BoatCourse.Map = this.Map;
                        }

                        m_DockedBoat = reader.ReadItem() as BaseDockedBoat;
                        m_VirtualMount = reader.ReadItem() as BoatMountItem;
                        m_Decay = reader.ReadBool();
                        goto case 3;
                    }
                case 3:
                    {
                        m_MapItem = (MapItem)reader.ReadItem();
                        m_NextNavPoint = reader.ReadInt();

                        goto case 2;
                    }
                case 2:
                    {
                        m_Facing = (Direction)reader.ReadInt();

                        goto case 1;
                    }
                case 1:
                    {
                        m_DecayTime = reader.ReadDeltaTime();

                        goto case 0;
                    }
                case 0:
                    {
                        if (version < 3)
                            m_NextNavPoint = -1;

                        if (version < 2)
                        {
                            if (ItemID == NorthID)
                                m_Facing = Direction.North;
                            else if (ItemID == SouthID)
                                m_Facing = Direction.South;
                            else if (ItemID == EastID)
                                m_Facing = Direction.East;
                            else if (ItemID == WestID)
                                m_Facing = Direction.West;
                        }

                        m_Owner = reader.ReadMobile();
                        m_PPlank = reader.ReadItem() as Plank;
                        m_SPlank = reader.ReadItem() as Plank;

                        if (!IsClassicBoat && !(this is RowBoat))
                            m_TillerMan = reader.ReadMobile() as object;
                        else
                            m_TillerMan = reader.ReadItem() as object;

                        m_Hold = reader.ReadItem() as Hold;
                        m_Anchored = reader.ReadBool();
                        m_ShipName = reader.ReadString();

                        m_Anchored = false; //No more anchors[High Seas]

                        if (version < 1)
                            Refresh();

                        break;
                    }
            }

            m_Instances.Add(this);

            if (m_VirtualMount == null)
                m_VirtualMount = new BoatMountItem(this);

            if (version == 6)
            {
                if (m_MapItem != null)
                    Timer.DelayCall(TimeSpan.FromSeconds(10), delegate
                    {
                        BoatCourse = new BoatCourse(this, m_MapItem);
                    });
            }
        }
Esempio n. 2
0
        public void AssociateMap(MapItem map)
        {
            if (CheckDecay())
                return;

            if (map is BlankMap)
            {
                if (TillerMan != null)
                    TillerManSay(502575); // Ar, that is not a map, tis but a blank piece of paper!
            }
            else if (map.Pins.Count == 0)
            {
                if (TillerMan != null)
                    TillerManSay(502576); // Arrrr, this map has no course on it!
            }
            else
            {
                StopMove(false);

                MapItem = map;
                NextNavPoint = -1;

                BoatCourse = new BoatCourse(this, map);

                if (TillerMan != null)
                    TillerManSay(502577); // A map!
            }
        }