Server.LightCycle.ComputeLevelFor C# (CSharp) Méthode

ComputeLevelFor() public static méthode

public static ComputeLevelFor ( Server.Mobile from ) : int
from Server.Mobile
Résultat int
		public static int ComputeLevelFor( Mobile from )
		{
			if ( m_LevelOverride > int.MinValue )
				return m_LevelOverride;

			int hours, minutes;

			Server.Items.Clock.GetTime( from.Map, from.X, out hours, out minutes );

			/* OSI times:
			 * 
			 * Midnight ->  3:59 AM : Night
			 *  4:00 AM -> 11:59 PM : Day
			 * 
			 * RunUO times:
			 * 
			 * 10:00 PM -> 11:59 PM : Scale to night
			 * Midnight ->  3:59 AM : Night
			 *  4:00 AM ->  5:59 AM : Scale to day
			 *  6:00 AM ->  9:59 PM : Day
			 */

			if ( hours < 4 )
				return NightLevel;

			if ( hours < 6 )
				return NightLevel + (((((hours - 4) * 60) + minutes) * (DayLevel - NightLevel)) / 120);

			if ( hours < 22 )
				return DayLevel;

			if ( hours < 24 )
				return DayLevel + (((((hours - 22) * 60) + minutes) * (NightLevel - DayLevel)) / 120);

			return NightLevel; // should never be
		}