/// <summary> /// Retrieve the properties of the player from the database. /// </summary> /// <param name="Database">Supplies the database connection to use for /// queries, if required. The active rowset may be consumed.</param> public void PopulateFromDatabase(IALFADatabase Database) { Database.ACR_SQLQuery(String.Format( "SELECT `Name`, `IsDM` FROM `players` WHERE `ID` = {0}", PlayerId)); if (!Database.ACR_SQLFetch()) { throw new ApplicationException("Failed to populate data for player " + PlayerId); } PlayerName = Database.ACR_SQLGetData(0); IsDM = GameWorldManager.ConvertToBoolean(Database.ACR_SQLGetData(1)); }
/// <summary> /// Retrieve the properties of the server from the database. /// </summary> /// <param name="Database">Supplies the database connection to use for /// queries, if required. The active rowset may be consumed.</param> public void PopulateFromDatabase(IALFADatabase Database) { Database.ACR_SQLQuery(String.Format( "SELECT `Name`, `IPAddress`, `IsPublic` FROM `servers` WHERE `ID` = {0}", ServerId)); if (!Database.ACR_SQLFetch()) { throw new ApplicationException("Failed to populate data for server " + ServerId); } ServerName = Database.ACR_SQLGetData(0); SetHostnameAndPort(Database.ACR_SQLGetData(1)); Public = GameWorldManager.ConvertToBoolean(Database.ACR_SQLGetData(2)); }
/// <summary> /// Retrieve the properties of the character from the database. /// </summary> /// <param name="Database">Supplies the database connection to use for /// queries, if required. The active rowset may be consumed.</param> public void PopulateFromDatabase(IALFADatabase Database) { Database.ACR_SQLQuery(String.Format( "SELECT `Name`, `PlayerID`, `IsOnline`, `Location` FROM `characters` WHERE `ID` = {0}", CharacterId)); if (!Database.ACR_SQLFetch()) { throw new ApplicationException("Failed to populate data for character " + CharacterId); } CharacterName = Database.ACR_SQLGetData(0); PlayerId = Convert.ToInt32(Database.ACR_SQLGetData(1)); IsOnline = GameWorldManager.ConvertToBoolean(Database.ACR_SQLGetData(2)); LocationString = Database.ACR_SQLGetData(3); }