using System; using System.Data; using System.Text; using System.Threading; using System.Collections; using System.Collections.Generic; using Holo.Virtual.Users; using Holo.Virtual.Arrows; using Holo.Virtual.Rooms; using Ion.Storage; namespace Holo.Managers { /// /// Provides management for logged in users, aswell for retrieving details such as ID/name and vice versa from the database. /// public static class arrowManager { public static Hashtable _Arrows = new Hashtable(); public static void Init(bool update) { DataColumn dCol; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dCol = dbClient.getColumn("SELECT id FROM arrows"); } int[] IDs = dataHandling.dColToArray(dCol, null); for (int i = 0; i < IDs.Length; i++) { virtualArrow Arrow = new virtualArrow(IDs[i]); _Arrows.Remove(IDs[i]); _Arrows.Add(IDs[i], Arrow); } if (update) Out.WriteLine("Arrow System Updated Successfully"); else Out.WriteLine("Arrow System Loaded Successfully"); } public static virtualArrow getArrow(int aID) { try { return (virtualArrow)_Arrows[aID]; } catch { return null; } } public static virtualArrow getArrowFromXY(int x, int y, int roomid) { int ID; DataRow dRow; using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient()) { dRow = dbClient.getRow("SELECT id FROM arrows WHERE x = '" + x + "' AND y = '" + y + "' AND roomid = '" + roomid + "'"); } ID = Convert.ToInt32(dRow[0]); try { return (virtualArrow)_Arrows[ID]; } catch { return null; } } } }