<NME> GameClock.cs
<BEF> ﻿using UnityEngine;
using System.Collections;

/// <summary>
/// Game clock for the world.
/// </summary>
/// Ticks up the game clock one minute every [clockrate] seconds.
public class GameClock : UWEBase {
	
	public int[] gametimevals=new int[3]; //For save games.

	public int game_time;

	/// <summary>
	/// How long has passed since the last clock tick
	/// </summary>
	public float clockTime;
	/// <summary>
	/// The clock rate. How long is a second relative to the clockTime
	/// </summary>
	public float clockRate=1.0f; 


	/// <summary>
	/// What game second we are at.
	/// </summary>
	public int _second;

	/// <summary>
	/// What game hour we are at
	/// </summary>
	public int _hour;
	/// <summary>
	/// What game day we are at.
	/// </summary>
	//public int _hour;
	/// <summary>
	/// What game day we are at.
	/// </summary>
	public int _day;

	public static GameClock instance;

	void Start()
	{
		instance=this;
	}

	// Update is called once per frame
	void Update () {
			clockTime=0.0f;	
			if (_second>=60)
			{
				ClockTick ();
					
				_second=0;
			}
			{
				gametimevals[0]=0;
				gametimevals[1]++;
	/// <summary>
	/// Clock tick. Activates regeneration, hunger and fatigue methods.
	/// </summary>
	static void ClockTick()
	{//Advance the time.
		instance._minute++;
		if (instance._minute%5==0)
					}
				}
			}
			clockTime=0.0f;	
			if (_second>=60)
			{
				ClockTick ();//Move minute forward
					
				_second=0;
			}
		}
	}
				instance._day++;
			}
		}
	}

	/// <summary>
	/// Move the clock forward 1 hour.
		{
			ClockTick();//one minute

			int overflow=0;
			instance.gametimevals[0]+=60;
			if(instance.gametimevals[0]>=255)
			{
				overflow= Mathf.Max(0,instance.gametimevals[0]-255);
				instance.gametimevals[0]=overflow;
				instance.gametimevals[1]++;
				if(instance.gametimevals[1]>=255)
				{
					instance.gametimevals[1]=0;
					instance.gametimevals[2]++;
					if(instance.gametimevals[2]>=255)
					{
						instance.gametimevals[2]=0;
					}
				}
			}
		}
	}

	/// <summary>
	/// Adds the now.
	/// </summary>
	/// <returns>Adds a period of time onto the current time. For setting appointments with NPCs</returns>
	/// <param name="iDay">I day.</param>
	/// <param name="iHour">I hour.</param>
	/// <param name="iMinute">I minute.</param>
	public static int AddNow(int iDay, int iHour, int iMinute)
	{
		return ConvertNow()+ Convert(iDay,iHour,iMinute);
	}

	/// <summary>
	/// Compares the day,hour& minute passed with the current time
	/// </summary>
	/// <param name="iMinute">I minute.</param>
	public static int Convert(int iDay, int iHour, int iMinute)
	{
		return ((iDay*24*60) + (iHour*60)+iMinute); 
	}

	/// <summary>
	/// <summary>
	/// Turns a day, hour and minute into a number.
	/// <returns>The now.</returns>
	public static int ConvertNow()
	{
		return Convert(instance._day,instance._hour,instance._minute);
	}

	public static void setUWTime(long timevalue)
	}

	/// <summary>
	/// Turns the current day, hour and minute into a number.
	/// </summary>
	/// <returns>The now.</returns>

		System.TimeSpan ts=	System.TimeSpan.FromSeconds((double)timevalue);
		instance._day=ts.Days;
		instance._hour=ts.Hours;
		instance._minute=ts.Minutes;
		instance._second=ts.Seconds;
		Debug.Log( instance._day + " days " + instance._hour +" hours " + instance._minute + " minutes " + instance._second + " seconds");


	}
		//int absoluteseconds = second + (minute*60) + (hour*3600) + (day*86400);

		//in uw this value is gameday << 16 | gamehour <<8 | gamesecond


		System.TimeSpan ts=	System.TimeSpan.FromSeconds((double)timevalue);

	public static int hour()
	{
		return instance._hour;
	}

	public static int day()

	public static long getUWTime()
	{
		System.TimeSpan ts = new System.TimeSpan(instance._day,0, instance._minute,instance._second);
		return (long)ts.TotalSeconds;
	}



	public static int second()
	{
		return instance._second;
	}

	public static int hour()
	{
		//return instance._hour;
		return instance._minute/60;
	}

	public static int day()
	{
		return instance._day;
	}
		/// <summary>
		/// Returns the clock minute..
		/// </summary>
	public static int minute()
	{
		return instance._minute % 24;
	}

		/// <summary>
		/// Returns the total mintues.
		/// </summary>
		/// <returns>The minimum.</returns>
	public static int game_min()
	{
		return instance._minute;
	}

}

<MSG> Added check_inv_quality and set_inv_quality to ConversationVM
Npc.npctalkto is now updated properly in conversation memory 
Fixed give_to_npc to use all selected slots
Updated x_skills to operate the same way as x_clock for retrieving and potentially setting skills. 
Fixed a couple of string replacement types
Changed skill constants to match usage in x_skills
Change billboarding to work differntly for NPCs and objects
<DFF> @@ -1,5 +1,6 @@
 ﻿using UnityEngine;
 using System.Collections;
+//TODO: Remove hours and just use minutes in range 1 to 1440.
 
 /// <summary>
 /// Game clock for the world.
@@ -29,7 +30,7 @@ public class GameClock : UWEBase {
 	/// <summary>
 	/// What game hour we are at
 	/// </summary>
-	public int _hour;
+	//public int _hour;
 	/// <summary>
 	/// What game day we are at.
 	/// </summary>
@@ -51,7 +52,7 @@ public class GameClock : UWEBase {
 			clockTime=0.0f;	
 			if (_second>=60)
 			{
-				ClockTick ();
+				ClockTick ();//Move minute forward
 					
 				_second=0;
 			}
@@ -61,7 +62,7 @@ public class GameClock : UWEBase {
 	/// <summary>
 	/// Clock tick. Activates regeneration, hunger and fatigue methods.
 	/// </summary>
-	static void ClockTick()
+/*	static void ClockTick()
 	{//Advance the time.
 		instance._minute++;
 		if (instance._minute%5==0)
@@ -80,7 +81,26 @@ public class GameClock : UWEBase {
 				instance._day++;
 			}
 		}
-	}
+	}*/
+
+		/// <summary>
+		/// Clock tick for every minute
+		/// </summary>
+		static void ClockTick()
+		{//Advance the time.
+				instance._minute++;
+				if (instance._minute%5==0)
+				{
+						GameWorldController.instance.playerUW.RegenMana();
+						GameWorldController.instance.playerUW.UpdateHungerAndFatigue();
+				}
+				if (instance._minute>=1440)
+				{
+						instance._minute=0;
+						instance._day++;
+						//instance._hour++;
+				}
+		}
 
 	/// <summary>
 	/// Move the clock forward 1 hour.
@@ -125,7 +145,9 @@ public class GameClock : UWEBase {
 	/// <param name="iMinute">I minute.</param>
 	public static int Convert(int iDay, int iHour, int iMinute)
 	{
-		return ((iDay*24*60) + (iHour*60)+iMinute); 
+				Debug.Log("Convert no you should never use!");
+				return 0;
+		//return ((iDay*24*60) + (iHour*60)+iMinute); 
 	}
 
 	/// <summary>
@@ -134,7 +156,9 @@ public class GameClock : UWEBase {
 	/// <returns>The now.</returns>
 	public static int ConvertNow()
 	{
-		return Convert(instance._day,instance._hour,instance._minute);
+			Debug.Log("Convert no you should never use!");
+		//return Convert(instance._day,instance._hour,instance._minute);
+			return 0;
 	}
 
 	public static void setUWTime(long timevalue)
@@ -147,10 +171,10 @@ public class GameClock : UWEBase {
 
 		System.TimeSpan ts=	System.TimeSpan.FromSeconds((double)timevalue);
 		instance._day=ts.Days;
-		instance._hour=ts.Hours;
+		//instance._hour=ts.Hours;
 		instance._minute=ts.Minutes;
 		instance._second=ts.Seconds;
-		Debug.Log( instance._day + " days " + instance._hour +" hours " + instance._minute + " minutes " + instance._second + " seconds");
+		//Debug.Log( instance._day + " days " + instance._hour +" hours " + instance._minute + " minutes " + instance._second + " seconds");
 
 
 	}
@@ -163,7 +187,8 @@ public class GameClock : UWEBase {
 
 	public static int hour()
 	{
-		return instance._hour;
+		//return instance._hour;
+		return instance._minute/60;
 	}
 
 	public static int day()

Added check_inv_quality and set_inv_quality to ConversationVM Npc.npctalkto is now updated properly in conversation memory  Fixed give_to_npc to use all selected slots Updated x_skills to operate the same way as x_clock for retrieving and potentially setting skills.  Fixed a couple of string replacement types Changed skill constants to match usage in x_skills Change billboarding to work differntly for NPCs and objects