public bool InsertCharacterPosition(DDO_CharacterPosition cp) { DataSet ds = new DataSet(); cmd = "insert into character_position values(" + cp.m_characterId + ",\"" + cp.m_position.X + "\",\"" + cp.m_position.Y + "\");"; try { pool.ExecuteSql(database, cmd); } catch { return(false); } return(true); }
//CHARACTER POSITION public bool UpdateCharacterPosition(DDO_CharacterPosition cp) { DataSet ds = new DataSet(); cmd = "update character_position set `x`=\"" + cp.m_position.X + "\",`y`=\"" + cp.m_position.Y + "\" where charid=" + cp.m_characterId + ";"; try { pool.ExecuteSql(database, cmd); } catch { return(false); } return(true); }
public bool GetCharacterPosition(int charId, out DDO_CharacterPosition res) { DataSet ds = new DataSet(); cmd = "select * from character_position where charid=" + charId + ";"; pool.ExecuteSql(database, cmd, ds); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { res = default(DDO_CharacterPosition); return(false); } float x = float.Parse(dt.Rows[0]["x"].ToString()); float y = float.Parse(dt.Rows[0]["y"].ToString()); res = new DDO_CharacterPosition(charId, new System.Numerics.Vector2(x, y)); return(true); }