diff api/Objects/Category.cs @ 0:520818033bb6

Initial commit of WarFoundry code
author IBBoard <dev@ibboard.co.uk>
date Fri, 19 Dec 2008 15:57:51 +0000
parents
children 613bc5eaac59
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/api/Objects/Category.cs	Fri Dec 19 15:57:51 2008 +0000
@@ -0,0 +1,158 @@
+using System;
+using System.Xml;
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	/// <summary>
+	/// Summary description for Category.
+	/// </summary>
+	public class Category : WarFoundryObject
+	{
+		private int minPts, maxPts, minPc, maxPc, minChoice, maxChoice, baseVal, incVal, incAmount;
+		/*private GameSystem system;*/
+		
+		public Category(string id, string name, int minPoints, int maxPoints, int minPercent, int maxPercent, int minChoices, int maxChoices, int baseValue, int incrementValue, int incrementAmount) : base(id, name)
+		{
+			minPts = minPoints;
+			maxPts = maxPoints;
+			minPc = minPercent;
+			maxPc = maxPercent;
+			baseVal = baseValue;
+			incVal = incrementValue;
+			incAmount = incrementAmount;
+		}
+		
+		/*public Category(XmlElement node, GameSystem gameSystem, AbstractNativeWarFoundryFactory factory) : base(factory)
+		{
+			//system = gameSystem;
+			ID = node.GetAttribute("id");
+			Name = node.GetAttribute("name");
+
+			try
+			{
+				min = int.Parse(node.GetAttribute("minimum"));
+			}
+			catch(FormatException)
+			{
+				throw new FormatException("Attribute 'minimum' of category "+id+" was not a valid number");
+			}
+
+			try
+			{
+				max = int.Parse(node.GetAttribute("maximum"));
+			}
+			catch(FormatException)
+			{
+				throw new FormatException("Attribute 'maximum' of category "+id+" was not a valid number");
+			}
+
+			string val = "";
+			val = node.GetAttribute("baseValue");
+
+			if (val!="")
+			{
+				try
+				{
+					baseValue = int.Parse(val);
+				
+				}
+				catch(FormatException)
+				{
+					throw new FormatException("Attribute 'baseValue' of category "+id+" was not a valid number");
+				}
+			}
+
+			val = node.GetAttribute("incValue");
+
+			if (val!="")
+			{
+				try
+				{
+					incValue = int.Parse(val);
+				}
+				catch(FormatException)
+				{
+					throw new FormatException("Attribute 'incValue' of category "+id+" was not a valid number");
+				}
+			}
+
+			val = node.GetAttribute("incAmount");
+
+			if (val!="")
+			{
+				try
+				{
+					incAmount = int.Parse(val);
+				}
+				catch(FormatException)
+				{
+					throw new FormatException("Attribute 'incAmount' of category "+id+" was not a valid number");
+				}
+			}
+		}*/
+
+		protected override string DefaultName()
+		{
+			return "";
+		}
+
+		/*public GameSystem GameSystem
+		{
+			get { return system; }
+		}*/
+
+		public int MinimumPoints
+		{
+			get { return minPts; }
+			set { minPts = value; }
+		}
+
+		public int MaximumPoints
+		{
+			get { return maxPts; }
+			set { maxPts = value; }
+		}
+		
+		public int MinimumPercentage
+		{
+			get { return minPc; }
+			set { minPc = value; }
+		}
+
+		public int MaximumPercentage
+		{
+			get { return maxPc; }
+			set { maxPc = value; }
+		}
+
+		public int MinimumChoices
+		{
+			get { return minChoice; }
+			set { minChoice = value; }
+		}
+
+		public int MaximumChoices
+		{
+			get { return maxChoice; }
+			set { maxChoice = value; }
+		}
+
+		public int BaseValue
+		{
+			get { return baseVal; }
+			set { baseVal = value; }
+		}
+
+		public int IncrementValue
+		{
+			get { return incVal; }
+			set { incVal = value; }
+		}
+
+		public int IncrementAmount
+		{
+			get { return incAmount; }
+			set { incAmount = value; }
+		}
+	}
+}