/// <summary> /// Loads and sends the list of characters of this account /// </summary> internal void SendCharacterList() { Database db = new Database(Server.UserDbConString); // TODO : Query CleanUP MySqlDataReader reader = db.ReaderQuery( "SELECT `char_id`,`slot`,`name`,`sex`,`race`," + "`hair_id`,`face_id`,`body_id`,`hands_id`,`feet_id`," + "`face_detail_id`,`hair_color`,`skin_color`,`x`,`y`,`layer`," + "`save_x`,`save_y`,`level`,`exp`,`job`,`job_level`,`create_date`" + " FROM `char`" + " WHERE `account_id` = @accId AND `delete_date`= 0", new string[] { "accId" }, new object[] { this.AccountId } ); List <CharacterListEntry> chars = new List <CharacterListEntry>(); Database db2 = new Database(Server.UserDbConString); while (reader.Read()) { CharacterListEntry c = new CharacterListEntry(); c.Name = (string)reader["name"]; c.Race = (int)reader["race"]; c.Sex = (int)reader["sex"]; c.SkinColor = (int)reader["skin_color"]; c.HairColor = (int)reader["hair_color"]; c.Job = (short)reader["job"]; c.JobLevel = (int)reader["job_level"]; c.Level = (int)reader["level"]; c.HairId = (int)reader["hair_id"]; c.FaceId = (int)reader["face_id"]; c.BodyId = (int)reader["body_id"]; c.HandsId = (int)reader["hands_id"]; c.FeetId = (int)reader["feet_id"]; c.CreateDate = (int)reader["create_date"]; MySqlDataReader equipList = db2.ReaderQuery( "SELECT `code`, `equip`" + " FROM `item`" + " WHERE `char_id` = @charId AND `equip` >= 0", new string[] { "charId" }, new object[] { (int)reader["char_id"] } ); while (equipList.Read()) { c.Equip[(int)equipList["equip"]] = (int)equipList["code"]; } equipList.Close(); chars.Add(c); } db.Dispose(); ClientPacketHandler.send_CharacterList(this, chars.ToArray()); }