Ejemplo n.º 1
0
        public Aquarium(int itemID) : base(itemID)
        {
            if (itemID == 0x3060)
            {
                AddComponent(new AddonContainerComponent(0x3061), -1, 0, 0);
            }

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

            MaxItems = 30;
            Weight   = 10.0;

            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(TimeSpan.FromHours(24), TimeSpan.FromHours(24), new TimerCallback(Evaluate));
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            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();

            m_Timer = Timer.DelayCall(TimeSpan.FromHours(12), TimeSpan.FromHours(24), new TimerCallback(Evaluate));
        }
Ejemplo n.º 4
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 ) );
        }
Ejemplo n.º 5
0
        public Aquarium( int itemID )
            : base(itemID)
        {
            if ( itemID == 0x3060 )
                AddComponent( new AddonContainerComponent( 0x3061 ), -1, 0, 0 );

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

            MaxItems = 30;
            Weight = 10.0;

            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( TimeSpan.FromHours( 24 ), TimeSpan.FromHours( 24 ), new TimerCallback( Evaluate ) );
        }
Ejemplo n.º 6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                m_EvaluateDay = reader.ReadBool();

                goto case 1;
            }

            case 1:
            {
                DateTime next = reader.ReadDateTime();

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

                m_Timer = Timer.DelayCall(next - DateTime.Now, TimeSpan.FromHours(24), 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;
            }
            }
        }
Ejemplo n.º 7
0
        private void Deserialize(IGenericReader reader, int version)
        {
            switch (version)
            {
            case 3:
            case 2:
            case 1:
            {
                var next = reader.ReadDateTime();

                if (next < Core.Now)
                {
                    next = Core.Now;
                }

                _evaluateTimer = Timer.DelayCall(next - Core.Now, EvaluationInterval, Evaluate);

                goto case 0;
            }

            case 0:
            {
                _liveCreatures = reader.ReadInt();
                _vacationLeft  = reader.ReadInt();

                _food = new AquariumState(this);
                _food.Deserialize(reader);
                _water = new AquariumState(this);
                _water.Deserialize(reader);

                _events = new List <int>();
                var count = reader.ReadInt();
                for (var i = 0; i < count; i++)
                {
                    _events.Add(reader.ReadInt());
                }

                _rewardAvailable = reader.ReadBool();
                break;
            }
            }
        }
Ejemplo n.º 8
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.Now)
                            next = DateTime.Now;

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

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

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

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

                        this.m_Events = new List<int>();

                        int count = reader.ReadInt();

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

                        this.m_RewardAvailable = reader.ReadBool();

                        break;
                    }
            }

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

            if (version < 3)
                ValidationQueue<Aquarium>.Add(this);
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			
			switch ( version )
			{
				case 1: 				
					DateTime next = reader.ReadDateTime();
					
					if ( next < DateTime.Now )
						next = DateTime.Now;												
				
					m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromHours( 24 ), 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;					
			}
		}
Ejemplo n.º 11
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			
			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();
			
			m_Timer = Timer.DelayCall( TimeSpan.FromHours( 12 ), TimeSpan.FromHours( 24 ), new TimerCallback( Evaluate ) );
		}