예제 #1
0
        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());
            }
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
            }
        }