public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 1:
            {
                m_Content = FillableContent.Lookup((FillableContentType)reader.ReadInt());
                goto case 0;
            }

            case 0:
            {
                if (reader.ReadBool())
                {
                    m_NextRespawnTime = reader.ReadDeltaTime();

                    TimeSpan delay = m_NextRespawnTime - DateTime.Now;
                    m_RespawnTimer = Timer.DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Respawn);
                }
                else
                {
                    CheckRespawn();
                }

                break;
            }
            }
        }
示例#2
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadEncodedInt();

            var durationID = reader.ReadEncodedInt();

            if (durationID < VendorRentalDuration.Instances.Length)
            {
                RentalDuration = VendorRentalDuration.Instances[durationID];
            }
            else
            {
                RentalDuration = VendorRentalDuration.Instances[0];
            }

            RentalPrice   = reader.ReadInt();
            LandlordRenew = reader.ReadBool();
            RenterRenew   = reader.ReadBool();
            RenewalPrice  = reader.ReadInt();

            RentalGold = reader.ReadInt();

            RentalExpireTime = reader.ReadDeltaTime();

            var delay = RentalExpireTime - DateTime.UtcNow;

            m_RentalExpireTimer = new RentalExpireTimer(this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero);
            m_RentalExpireTimer.Start();
        }
示例#3
0
        public void Deserialize(IGenericReader reader, int version)
        {
            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                if (World.FindEntity(reader.ReadUInt()) is ISpawnable spawnableEntity)
                {
                    Add(spawnableEntity);
                }
            }

            Running = reader.ReadBool();

            if (reader.ReadBool())
            {
                m_NextSpawn = reader.ReadDeltaTime();

                if (Spawning)
                {
                    m_SpawnTimer?.Stop();

                    TimeSpan delay = m_NextSpawn - DateTime.UtcNow;
                    m_SpawnTimer = Timer.DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, TimerCallback);
                }
            }

            CheckTimer();
        }
示例#4
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                if (reader.ReadBool())
                {
                    m_DecayTime = reader.ReadDeltaTime();
                    BeginDecay(m_DecayTime - DateTime.UtcNow);
                }

                break;
            }

            case 1:
            case 0:
            {
                if (Parent == null)
                {
                    BeginDecay(m_DefaultDecayTime);
                }
                break;
            }
            }

            if (version < 1 && Hue == 0)
            {
                Hue = 2301;
            }
        }
示例#5
0
            public override void Deserialize(IGenericReader reader)
            {
                base.Deserialize(reader);

                var version = reader.ReadInt();

                switch (version)
                {
                case 1:
                {
                    m_End = reader.ReadDeltaTime();

                    m_Timer = new InternalTimer(this, m_End - DateTime.UtcNow);
                    m_Timer.Start();

                    break;
                }

                case 0:
                {
                    var duration = TimeSpan.FromSeconds(10.0);

                    m_Timer = new InternalTimer(this, duration);
                    m_Timer.Start();

                    m_End = DateTime.UtcNow + duration;

                    break;
                }
                }
            }
示例#6
0
        public VendorInventory(BaseHouse house, IGenericReader reader)
        {
            House = house;

            var version = reader.ReadEncodedInt();

            Owner      = reader.ReadMobile();
            VendorName = reader.ReadString();
            ShopName   = reader.ReadString();

            Items = reader.ReadStrongItemList();
            Gold  = reader.ReadInt();

            ExpireTime = reader.ReadDeltaTime();

            if (Items.Count == 0 && Gold == 0)
            {
                Timer.DelayCall(Delete);
            }
            else
            {
                var delay = ExpireTime - DateTime.UtcNow;
                m_ExpireTimer = new ExpireTimer(this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero);
                m_ExpireTimer.Start();
            }
        }
示例#7
0
            public override void Deserialize(IGenericReader reader)
            {
                base.Deserialize(reader);

                var version = reader.ReadInt();

                switch (version)
                {
                case 1:
                {
                    m_Caster = reader.ReadMobile();

                    goto case 0;
                }

                case 0:
                {
                    m_End = reader.ReadDeltaTime();

                    m_Timer = new InternalTimer(this, TimeSpan.Zero, true, true);
                    m_Timer.Start();

                    break;
                }
                }
            }
示例#8
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                BeginDecay(m_DefaultDecayTime);

                break;
            }

            case 1:
            {
                if (reader.ReadBool())
                {
                    BeginDecay(reader.ReadDeltaTime() - DateTime.UtcNow);
                }

                break;
            }
            }
        }
示例#9
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                ICraftable.Deserialize(reader, this);

                m_Resource = (CraftResource)reader.ReadEncodedInt();

                goto case 0;
            }

            case 0:
            {
                m_BurntOut  = reader.ReadBool();
                m_Burning   = reader.ReadBool();
                m_Duration  = reader.ReadTimeSpan();
                m_Protected = reader.ReadBool();

                if (m_Burning && m_Duration != TimeSpan.Zero)
                {
                    DoTimer(reader.ReadDeltaTime() - DateTime.Now);
                }

                break;
            }
            }
        }
示例#10
0
 private void Deserialize(IGenericReader reader, int version)
 {
     if (reader.ReadBool())
     {
         var delay = reader.ReadDeltaTime();
         BeginDecay(delay - Core.Now);
     }
 }
示例#11
0
        public static void Deserialize(IGenericReader reader, int version, BaseObjectiveInstance objInstance)
        {
            if (reader.ReadBool())
            {
                DateTime endTime = reader.ReadDeltaTime();

                if (objInstance != null)
                {
                    objInstance.EndTime = endTime;
                }
            }

            DataType extraDataType = (DataType)reader.ReadByte();

            switch (extraDataType)
            {
            case DataType.EscortObjective:
            {
                bool completed = reader.ReadBool();

                if (objInstance is EscortObjectiveInstance instance)
                {
                    instance.HasCompleted = completed;
                }

                break;
            }

            case DataType.KillObjective:
            {
                int slain = reader.ReadInt();

                if (objInstance is KillObjectiveInstance instance)
                {
                    instance.Slain = slain;
                }

                break;
            }

            case DataType.DeliverObjective:
            {
                bool completed = reader.ReadBool();

                if (objInstance is DeliverObjectiveInstance instance)
                {
                    instance.HasCompleted = completed;
                }

                break;
            }
            }
        }
示例#12
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                NextWoolTime = reader.ReadDeltaTime();
                break;
            }
            }
        }
示例#13
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                Guardians = reader.ReadStrongMobileList();
                Temporary = reader.ReadBool();

                goto case 1;
            }

            case 1:
            {
                Owner = reader.ReadMobile();

                goto case 0;
            }

            case 0:
            {
                Level      = reader.ReadInt();
                DeleteTime = reader.ReadDeltaTime();
                m_Lifted   = reader.ReadStrongItemList();

                if (version < 2)
                {
                    Guardians = new List <Mobile>();
                }

                break;
            }
            }

            if (!Temporary)
            {
                m_Timer = new DeleteTimer(this, DeleteTime);
                m_Timer.Start();
            }
            else
            {
                Delete();
            }
        }
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                m_Guardians = reader.ReadEntityList <Mobile>();
                m_Temporary = reader.ReadBool();

                goto case 1;
            }

            case 1:
            {
                m_Owner = reader.ReadEntity <Mobile>();

                goto case 0;
            }

            case 0:
            {
                m_Level      = reader.ReadInt();
                m_DeleteTime = reader.ReadDeltaTime();
                m_Lifted     = reader.ReadEntityList <Item>();

                if (version < 2)
                {
                    m_Guardians = new List <Mobile>();
                }

                break;
            }
            }

            if (!m_Temporary)
            {
                m_Timer = new DeleteTimer(this, m_DeleteTime);
                m_Timer.Start();
            }
            else
            {
                Delete();
            }
        }
示例#15
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            if (reader.ReadBool())
            {
                m_DestinationString = reader.ReadString();                 // NOTE: We cannot EDI.Find here, regions have not yet been loaded :-(
            }
            if (reader.ReadBool())
            {
                m_DeleteTime  = reader.ReadDeltaTime();
                m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.Now);
                m_DeleteTimer.Start();
            }
        }
示例#16
0
        public PlantSystem(PlantItem plant, IGenericReader reader)
        {
            Plant = plant;

            int version = reader.ReadInt();

            FertileDirt = reader.ReadBool();

            if (version >= 1)
            {
                NextGrowth = reader.ReadDateTime();
            }
            else
            {
                NextGrowth = reader.ReadDeltaTime();
            }

            GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt();

            m_Water = reader.ReadInt();

            m_Hits           = reader.ReadInt();
            m_Infestation    = reader.ReadInt();
            m_Fungus         = reader.ReadInt();
            m_Poison         = reader.ReadInt();
            m_Disease        = reader.ReadInt();
            m_PoisonPotion   = reader.ReadInt();
            m_CurePotion     = reader.ReadInt();
            m_HealPotion     = reader.ReadInt();
            m_StrengthPotion = reader.ReadInt();

            Pollinated       = reader.ReadBool();
            m_SeedType       = (PlantType)reader.ReadInt();
            m_SeedHue        = (PlantHue)reader.ReadInt();
            m_AvailableSeeds = reader.ReadInt();
            m_LeftSeeds      = reader.ReadInt();

            m_AvailableResources = reader.ReadInt();
            m_LeftResources      = reader.ReadInt();

            if (version < 2 && PlantHueInfo.IsCrossable(m_SeedHue))
            {
                m_SeedHue |= PlantHue.Reproduces;
            }
        }
示例#17
0
            public override void Deserialize(IGenericReader reader)
            {
                base.Deserialize(reader);

                var version = reader.ReadInt();

                switch (version)
                {
                case 0:
                {
                    m_Caster = reader.ReadEntity <Mobile>();
                    m_End    = reader.ReadDeltaTime();

                    m_Timer = new InternalTimer(this, m_End - Core.Now);
                    m_Timer.Start();

                    break;
                }
                }
            }
示例#18
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Items     = reader.ReadEntityList <Item>();
                m_Mobiles   = reader.ReadEntityList <Mobile>();;
                m_DecayTime = reader.ReadDeltaTime();

                RefreshDecay(false);

                break;
            }
            }
        }
示例#19
0
            public override void Deserialize(IGenericReader reader)
            {
                base.Deserialize(reader);

                int version = reader.ReadInt();

                switch (version)
                {
                case 0:
                {
                    m_Caster = reader.ReadMobile();
                    m_End    = reader.ReadDeltaTime();

                    m_Timer = new InternalTimer(this, m_End - DateTime.UtcNow);
                    m_Timer.Start();

                    break;
                }
                }
            }
示例#20
0
        public static void Remove(IGenericReader reader, int version)
        {
            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                IEntity entity = World.FindEntity(reader.ReadUInt());

                if (entity != null)
                {
                    m_RemoveList ??= new List <IEntity>();
                    m_RemoveList.Add(entity);
                }
            }

            reader.ReadBool(); // m_Running

            if (reader.ReadBool())
            {
                reader.ReadDeltaTime(); // m_NextSpawn
            }
        }
示例#21
0
        public Player(Ethic ethic, IGenericReader reader)
        {
            Ethic = ethic;

            var version = reader.ReadEncodedInt();

            switch (version)
            {
            case 0:
            {
                Mobile = reader.ReadEntity <Mobile>();

                Power   = reader.ReadEncodedInt();
                History = reader.ReadEncodedInt();

                Steed    = reader.ReadEntity <Mobile>();
                Familiar = reader.ReadEntity <Mobile>();

                m_Shield = reader.ReadDeltaTime();

                break;
            }
            }
        }
示例#22
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            var version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Decays = reader.ReadBool();

                if (m_Decays)
                {
                    m_DecayTime = reader.ReadDeltaTime();

                    m_Timer = new InternalTimer(this, m_DecayTime);
                    m_Timer.Start();
                }

                break;
            }
            }
        }
示例#23
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_BurntOut  = reader.ReadBool();
                m_Burning   = reader.ReadBool();
                m_Duration  = reader.ReadTimeSpan();
                m_Protected = reader.ReadBool();

                if (m_Burning && m_Duration != TimeSpan.Zero)
                {
                    DoTimer(reader.ReadDeltaTime() - DateTime.Now);
                }

                break;
            }
            }
        }
示例#24
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 12:
            {
                if (reader.ReadBool())
                {
                    m_RestoreEquip = reader.ReadEntityList <Item>();
                }

                goto case 11;
            }

            case 11:
            {
                // Version 11, we move all bools to a CorpseFlag
                m_Flags = (CorpseFlag)reader.ReadInt();

                m_TimeOfDeath = reader.ReadDeltaTime();

                int count = reader.ReadInt();

                for (int i = 0; i < count; ++i)
                {
                    Item item = reader.ReadEntity <Item>();

                    if (reader.ReadBool())
                    {
                        SetRestoreInfo(item, reader.ReadPoint3D());
                    }
                    else if (item != null)
                    {
                        SetRestoreInfo(item, item.Location);
                    }
                }

                if (reader.ReadBool())
                {
                    BeginDecay(reader.ReadDeltaTime() - DateTime.Now);
                }

                m_Looters = reader.ReadEntityList <Mobile>();
                ;
                m_Killer = reader.ReadEntity <Mobile>();

                m_Aggressors = reader.ReadEntityList <Mobile>();
                ;
                m_Owner = reader.ReadEntity <Mobile>();

                m_CorpseName = reader.ReadString();

                m_AccessLevel = (AccessLevel)reader.ReadInt();
                reader.ReadInt();     // guild reserve
                m_Kills = reader.ReadInt();

                m_EquipItems = reader.ReadEntityList <Item>();
                break;
            }

            case 10:
            {
                m_TimeOfDeath = reader.ReadDeltaTime();

                goto case 9;
            }

            case 9:
            {
                int count = reader.ReadInt();

                for (int i = 0; i < count; ++i)
                {
                    Item item = reader.ReadEntity <Item>();

                    if (reader.ReadBool())
                    {
                        SetRestoreInfo(item, reader.ReadPoint3D());
                    }
                    else if (item != null)
                    {
                        SetRestoreInfo(item, item.Location);
                    }
                }

                goto case 8;
            }

            case 8:
            {
                SetFlag(CorpseFlag.VisitedByTaxidermist, reader.ReadBool());

                goto case 7;
            }

            case 7:
            {
                if (reader.ReadBool())
                {
                    BeginDecay(reader.ReadDeltaTime() - DateTime.Now);
                }

                goto case 6;
            }

            case 6:
            {
                m_Looters = reader.ReadEntityList <Mobile>();
                ;
                m_Killer = reader.ReadEntity <Mobile>();

                goto case 5;
            }

            case 5:
            {
                SetFlag(CorpseFlag.Carved, reader.ReadBool());

                goto case 4;
            }

            case 4:
            {
                m_Aggressors = reader.ReadEntityList <Mobile>();
                ;

                goto case 3;
            }

            case 3:
            {
                m_Owner = reader.ReadEntity <Mobile>();

                goto case 2;
            }

            case 2:
            {
                SetFlag(CorpseFlag.NoBones, reader.ReadBool());

                goto case 1;
            }

            case 1:
            {
                m_CorpseName = reader.ReadString();

                goto case 0;
            }

            case 0:
            {
                if (version < 10)
                {
                    m_TimeOfDeath = DateTime.Now;
                }

                if (version < 7)
                {
                    BeginDecay(m_DefaultDecayTime);
                }

                if (version < 6)
                {
                    m_Looters = new List <Mobile>();
                }

                if (version < 4)
                {
                    m_Aggressors = new List <Mobile>();
                }

                m_AccessLevel = (AccessLevel)reader.ReadInt();
                reader.ReadInt();     // guild reserve
                m_Kills = reader.ReadInt();
                SetFlag(CorpseFlag.Criminal, reader.ReadBool());

                m_EquipItems = reader.ReadEntityList <Item>();

                break;
            }
            }
        }
示例#25
0
        public override void Deserialize(IGenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
            {
                m_NextPayTime = reader.ReadDeltaTime();
                House         = reader.ReadEntity <BaseHouse>();

                goto case 0;
            }

            case 0:
            {
                m_Owner       = reader.ReadEntity <Mobile>();
                m_BankAccount = reader.ReadInt();
                m_HoldGold    = reader.ReadInt();

                m_SellItems = new Hashtable();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Item item = reader.ReadEntity <Item>();

                    int price = reader.ReadInt();
                    if (price > 100000000)
                    {
                        price = 100000000;
                    }

                    string description = reader.ReadString();

                    DateTime created = version < 1 ? DateTime.Now : reader.ReadDateTime();

                    if (item != null)
                    {
                        SetVendorItem(item, version < 1 && price <= 0 ? -1 : price, description, created);
                    }
                }

                break;
            }
            }

            Timer.DelayCall(TimeSpan.Zero, FixDresswear);

            m_NextPayTime = DateTime.Now + PayTimer.GetInterval();

            if (version < 2 && RawStr == 75 && RawDex == 75 && RawInt == 75)
            {
                InitStats(100, 100, 25);
            }

            TimeSpan delay = m_NextPayTime - DateTime.Now;

            m_PayTimer = new PayTimer(this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero);
            m_PayTimer.Start();

            Blessed = false;
        }