public NonPlayer GetNPC(String characterID) { NonPlayer npc = null; if (MySqlConnection.State.Equals("Closed")) { InitDriver(); } SqlQuery = "SELECT * FROM non_player_character WHERE character_id = '" + characterID + "'"; MySqlCommand = new MySqlCommand(SqlQuery, MySqlConnection); MySqlDataReader = MySqlCommand.ExecuteReader(); if (MySqlDataReader.Read()) { String name = MySqlDataReader.GetString(1); String sex = MySqlDataReader.GetString(2); String type = MySqlDataReader.GetString(3); Archetype archetype = Archetype.GetArchetype(MySqlDataReader.GetString(4)); int gold = MySqlDataReader.GetInt32(5); int level = MySqlDataReader.GetInt32(6); Item item = null; if (!MySqlDataReader.IsDBNull(7)) { item = _itemDriver.GetItem(MySqlDataReader.GetString(7)); } MoveSet moveSet = _moveSetDriver.GetMoveSet(characterID); BaseStat baseStat = _baseStatDriver.GetBaseStat(characterID); npc = new NonPlayer(name, sex, gold, level, archetype, moveSet, type, baseStat, new BattleStatus(), item, characterID); } return(npc); }
public MoveSet GetMoveSet(String characterID) { MoveSet moveSet = new MoveSet(); if (MySqlConnection.State.Equals("Closed")) { InitDriver(); } SqlQuery = "SELECT * FROM move_set WHERE character_id = '" + characterID + "'"; MySqlCommand = new MySqlCommand(SqlQuery, MySqlConnection); MySqlDataReader = MySqlCommand.ExecuteReader(); if (MySqlDataReader.Read()) { for (int i = 1; i <= 4; i++) { if (!MySqlDataReader.IsDBNull(i)) { String moveName = MySqlDataReader.GetString(i); Move move = _moveDriver.GetMove(moveName); moveSet.AddMove(move); } } } return(moveSet); }
public NonPlayer(String name, String sex, int gold, int level, Archetype archetype, MoveSet moveSet, String type, BaseStat baseStat, BattleStatus battleStatus, Item item, String id) { CharacterName = name; CharacterSex = sex; CharacterGold = gold; CharacterLevel = level; CharacterArchetype = archetype; CharacterMoveSet = moveSet; CharacterBaseStat = baseStat; CharacterBattleStatus = battleStatus; CharacterItem = item; SetCharacterType(type); CharacterID = id; }
private Player() { CharacterName = "Player1"; CharacterSex = "MALEFE"; CharacterGold = 500; CharacterLevel = 1; CharacterCurrentXP = 0; CharacterLimitXP = 1; CharacterMoveSet = new MoveSet(); CharacterBaseStat = new BaseStat(); CharacterBattleStatus = new BattleStatus(); PlayerBag = new Bag(); CharacterItem = null; CharacterType = "PLAYER"; CharacterID = "PLAYER_1"; }