public List <character> GetCharacters() { db db1 = new db(); db1.SetCommand("s_CharactersGet", CommandType.StoredProcedure); db1.AddParam <int>("LoginID", SqlDbType.Int, 4, owner.loginID); db1.Read(); // access the datareader within the class while (db1.dr.Read()) { character chr1 = new character(); chr1.id = Int32.Parse(db1.dr["id"].ToString()); chr1.hp = Int32.Parse(db1.dr["hp"].ToString()); chr1.mana = Int32.Parse(db1.dr["mana"].ToString()); chr1.owner = owner.loginName; chr1.stamina = Int32.Parse(db1.dr["stamina"].ToString()); //chr1.tile_on = Int32.Parse(db1.dr["tile_on"].ToString()); chr1.x = Int32.Parse(db1.dr["x"].ToString()); chr1.y = Int32.Parse(db1.dr["y"].ToString()); chr1.name = db1.dr["charactername"].ToString(); list.Add( chr1 ); } return(list); }
public TileDB(int characterid) /* Constructor for Tiles around usernames character */ { db1 = new MMO.db(); Tiles = new List <MMO.Tile>(); db1.SetCommand("s_TilesGet", CommandType.StoredProcedure); db1.AddParam <int>("characterid", SqlDbType.Int, 4, characterid); db1.Read(); // access the datareader within the class while (db1.dr.Read()) { AddTile(Int32.Parse(db1.dr["id"].ToString()), Int32.Parse(db1.dr["x"].ToString()), Int32.Parse(db1.dr["y"].ToString()), Int32.Parse(db1.dr["tile_type_id"].ToString()) ); } }
public TileDB(int characterid) /* Constructor for Tiles around usernames character */ { db1 = new MMO.db(); Tiles = new List<MMO.Tile>(); db1.SetCommand("s_TilesGet", CommandType.StoredProcedure); db1.AddParam<int>("characterid", SqlDbType.Int, 4, characterid); db1.Read(); // access the datareader within the class while (db1.dr.Read()) { AddTile(Int32.Parse(db1.dr["id"].ToString()), Int32.Parse(db1.dr["x"].ToString()), Int32.Parse(db1.dr["y"].ToString()), Int32.Parse(db1.dr["tile_type_id"].ToString()) ); } }