Inheritance: Packet
		public virtual void OnTick()
		{
			if ( m_Stage == 0 )
			{
				m_Active = ( m_ChanceOfPercipitation > Utility.Random( 100 ) );
				m_ExtremeTemperature = ( m_ChanceOfExtremeTemperature > Utility.Random( 100 ) );

				if ( m_MoveSpeed > 0 )
				{
					Reposition();
					RecalculateMovementAngle();
				}
			}

			if ( m_Active )
			{
				if ( m_Stage > 0 && m_MoveSpeed > 0 )
					MoveForward();

				int type, density, temperature;

				temperature = m_Temperature;

				if ( m_ExtremeTemperature )
					temperature *= -1;

				if ( m_Stage < 15 )
				{
					density = m_Stage * 5;
				}
				else
				{
					density = 150 - (m_Stage * 5);

					if ( density < 10 )
						density = 10;
					else if ( density > 70 )
						density = 70;
				}

				if ( density == 0 )
					type = 0xFE;
				else if ( temperature > 0 )
					type = 0;
				else
					type = 2;

				ArrayList states = NetState.Instances;

				Packet weatherPacket = null;

				for ( int i = 0; i < states.Count; ++i )
				{
					NetState ns = (NetState)states[i];
					Mobile mob = ns.Mobile;

					if ( mob == null || mob.Map != m_Facet )
						continue;

					bool contains = ( m_Area.Length == 0 );

					for ( int j = 0; !contains && j < m_Area.Length; ++j )
						contains = m_Area[j].Contains( mob.Location );

					if ( !contains )
						continue;

					if ( weatherPacket == null )
						weatherPacket = new Server.Network.Weather( type, density, temperature );

					ns.Send( weatherPacket );
				}
			}

			m_Stage++;
			m_Stage %= 30;
		}
Beispiel #2
0
        public virtual void OnTick()
        {
            if (m_Stage == 0)
            {
                m_Active             = (m_ChanceOfPercipitation > Utility.Random(100));
                m_ExtremeTemperature = (m_ChanceOfExtremeTemperature > Utility.Random(100));

                if (m_MoveSpeed > 0)
                {
                    Reposition();
                    RecalculateMovementAngle();
                }
            }

            if (m_Active)
            {
                if (m_Stage > 0 && m_MoveSpeed > 0)
                {
                    MoveForward();
                }

                int type, density, temperature;

                temperature = m_Temperature;

                if (m_ExtremeTemperature)
                {
                    temperature *= -1;
                }

                if (m_Stage < 15)
                {
                    density = m_Stage * 5;
                }
                else
                {
                    density = 150 - (m_Stage * 5);

                    if (density < 10)
                    {
                        density = 10;
                    }
                    else if (density > 70)
                    {
                        density = 70;
                    }
                }

                if (density == 0)
                {
                    type = 0xFE;
                }
                else if (temperature > 0)
                {
                    type = 0;
                }
                else
                {
                    type = 2;
                }

                ArrayList states = NetState.Instances;

                Packet weatherPacket = null;

                for (int i = 0; i < states.Count; ++i)
                {
                    NetState ns  = (NetState)states[i];
                    Mobile   mob = ns.Mobile;

                    if (mob == null || mob.Map != m_Facet)
                    {
                        continue;
                    }

                    bool contains = (m_Area.Length == 0);

                    for (int j = 0; !contains && j < m_Area.Length; ++j)
                    {
                        contains = m_Area[j].Contains(mob.Location);
                    }

                    if (!contains)
                    {
                        continue;
                    }

                    if (weatherPacket == null)
                    {
                        weatherPacket = new Server.Network.Weather(type, density, temperature);
                    }

                    ns.Send(weatherPacket);
                }
            }

            m_Stage++;
            m_Stage %= 30;
        }