using Ion.Storage; using Holo.Virtual.Users; using Holo; using System.Text; using System.Data; using System.Collections; using System; using System.Collections.Generic; namespace Zak.COD.Human.Properties.XP { public class XP { #region Declares // Max amount of XP user can get [value based on MW2 Xbox]. private const int MAX_XP = 2434700; // Array XP using MAX_XP. private string[] mXP = new string[MAX_XP]; // XP Array. // Get User By Using VirtualUser. private virtualUser U; // Declare ID. int ID; public List ExperincePoints; int GotKill; int XPoints; #endregion #region Contructure public XP() { //Credits to Quackster for telling me how to do this with Stringbuilder but im using List now. ExperincePoints = new List(); using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { foreach (DataRow XPRow in dbClient.getTable("SELECT * FROM users").Rows) { // Previously using Convert.ToInt32 now using Explict cast conversion. ExperincePoints.Add(new XP( (int)(XPRow["gotkill"]), (int)(XPRow["xp"]), (string)(XPRow["matchname"]))); } } } public XP(int mGotKill, int mXP, string mMatchName) { mGotKill = this.GotKill; mXP = this.XPoints; mMatchName = this.U.MatchName; } #endregion #region Indexer // Advanced int indexer public string this[int XP] { // Get properties. get { //Define index using variable XP = this.XPoints; // if index is greater then 0 and is low than max xp. if (XP >= 0 && XP < MAX_XP) { // return amount of XP user has. return mXP[XP]; } else { // XP is higher than MAX_XP value throw new System.IndexOutOfRangeException(); } } // Set properties. set { // if index is greater then 0 and is low than max xp. if (XP >= 0 && XP < MAX_XP) { //Array mXP value is set to the amount of the index value. mXP[XP] = value; } else { // If value is higher then MAX_XP throw new System.IndexOutOfRangeException(); } } } #endregion #region Methods // Advanced Maths system coming soon. public void UpdateXP(int ID) { int GotKill = this.GotKill; int XP = this.XPoints; // Kill greater then 0. if (GotKill > 0) { // If match is search and destroy. if (U.MatchName.Contains("[S&D]")) { // Update UserXp by 500. GotKill = +500; // Remove kill so it does not loop and give loads of xp. GotKill = -1; } else { // Update UserXp by 100. XP = +100; // Remove kill so it does not loop and give loads of xp. GotKill = -1; } } } #endregion } }