Esempio n. 1
0
        public Aquarium(int itemID) : base(itemID)
        {
            Movable = false;

            if (itemID == 0x3060)
            {
                AddComponent(new AddonContainerComponent(0x3061), -1, 0, 0);
            }

            if (itemID == 0x3062)
            {
                AddComponent(new AddonContainerComponent(0x3063), 0, -1, 0);
            }

            MaxItems = 30;

            m_Food  = new AquariumState();
            m_Water = new AquariumState();

            m_Food.State  = (int)FoodState.Full;
            m_Water.State = (int)WaterState.Strong;

            m_Food.Maintain = Utility.RandomMinMax(1, 2);
            m_Food.Improve  = m_Food.Maintain + Utility.RandomMinMax(1, 2);

            m_Water.Maintain = Utility.RandomMinMax(1, 3);

            m_Events = new List <int>();

            m_Timer = Timer.DelayCall(EvaluationInterval, EvaluationInterval, new TimerCallback(Evaluate));
        }
Esempio n. 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            case 2:
            case 1:
            {
                DateTime next = reader.ReadDateTime();

                if (next < DateTime.UtcNow)
                {
                    next = DateTime.UtcNow;
                }

                m_Timer = Timer.DelayCall(next - DateTime.UtcNow, EvaluationInterval, new TimerCallback(Evaluate));

                goto case 0;
            }

            case 0:
            {
                m_LiveCreatures = reader.ReadInt();
                m_VacationLeft  = reader.ReadInt();

                m_Food  = new AquariumState();
                m_Water = new AquariumState();

                m_Food.Deserialize(reader);
                m_Water.Deserialize(reader);

                m_Events = new List <int>();

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    m_Events.Add(reader.ReadInt());
                }

                m_RewardAvailable = reader.ReadBool();

                break;
            }
            }

            if (version < 2)
            {
                Weight  = DefaultWeight;
                Movable = false;
            }

            if (version < 3)
            {
                ValidationQueue <Aquarium> .Add(this);
            }
        }