public static string GetEntityID(string username) { throw new NotImplementedException(); using (MongoCRUD mongo = new MongoCRUD("Reldawin")) { return(mongo.GetRecord <DBPlayer>("player", new MongoCRUD.Condition { field = "ID", value = username }).ID.ToString()); } }
public static bool DoesUserExist(string username) { using (MongoCRUD mongo = new MongoCRUD("Reldawin")) { DBPlayer player = mongo.GetRecord <DBPlayer>("player", new MongoCRUD.Condition { field = "Username", value = username }); bool doesPlayerExist = player != null ? true : false; return(doesPlayerExist); } }
public static Point GetEntityCoordinates(string id) { using (MongoCRUD mongo = new MongoCRUD("Reldawin")) { DBPlayer player = mongo.GetRecord <DBPlayer>("player", new Guid(id)); Point p = new Point(player.Entity.WorldPositionX, player.Entity.WorldPositionY); return(p); } }
internal static List <DBTile> GetChunkData(int x, int y) { int chunkX = Convert.ToInt32(Math.Floor((double)x / 16)); int chunkY = Convert.ToInt32(Math.Floor((double)y / 16)); using (MongoCRUD mongo = new MongoCRUD("Reldawin")) { List <DBTile> tiles = mongo.GetChunk <DBTile>(chunkX, chunkY); return(tiles); } }
public static string[] GetPlayerPasswordAndID(string username) { using (MongoCRUD mongo = new MongoCRUD("Reldawin")) { DBPlayer player = mongo.GetRecord <DBPlayer>("player", new MongoCRUD.Condition { field = "Username", value = username }); string[] result = new string[2] { player.Password, player.ID.ToString() }; return(result); } }
public static void CreateAccount(string username, string password) { Random rand = new Random(); DBPlayer dBPlayer = new DBPlayer { Password = password, Username = username, Entity = new DBEntity { WorldPositionX = rand.Next(0, Program.MapWidth), WorldPositionY = rand.Next(0, Program.MapHeight) } }; using (MongoCRUD mongo = new MongoCRUD("Reldawin")) { mongo.InsertRecord <DBPlayer>("player", dBPlayer); } }