public bool GetCharacterAttributeByCharacterId(int charId, out DDO_CharacterAttribute resCharAttr) { cmd = "select * from `character_attribute` where charid=" + charId + ";"; DataSet ds = new DataSet(); pool.ExecuteSql(database, cmd, ds); if (ds.Tables[0].Rows.Count == 0) { resCharAttr = default(DDO_CharacterAttribute); return(false); } DataRow dr = ds.Tables[0].Rows[0]; short level = short.Parse(dr["level"].ToString()); int experience = int.Parse(dr["experience"].ToString()); ValueTuple <ActorUnitMainAttributeType, short>[] vt = new ValueTuple <ActorUnitMainAttributeType, short> [4]; string[] strings = dr["attributes"].ToString().Split(' '); short str = short.Parse(strings[0]); short intl = short.Parse(strings[1]); short sprt = short.Parse(strings[2]); short agl = short.Parse(strings[3]); resCharAttr = new DDO_CharacterAttribute(charId, level, experience, str, intl, sprt, agl); return(true); }
public bool UpdateCharacterAttribute(DDO_CharacterAttribute charAttr) { string giftPoints = string.Format("{0} {1} {2} {3}", charAttr.m_str, charAttr.m_intl, charAttr.m_sprt, charAttr.m_agl); cmd = "update`character_attribute` set `level`=" + charAttr.m_level + ", `experience`=" + charAttr.m_experience + ", attributes=\"" + giftPoints + "\" where charid=" + charAttr.m_characterId + ";"; try { pool.ExecuteSql(database, cmd); } catch { return(false); } return(true); }
//ATTRIBUTES public bool InsertCharacterAttribute(DDO_CharacterAttribute charAttr) { string giftPoints = string.Format("{0} {1} {2} {3}", charAttr.m_str, charAttr.m_intl, charAttr.m_sprt, charAttr.m_agl); cmd = "insert into `character_attribute` values(" + charAttr.m_characterId + "," + charAttr.m_level + "," + charAttr.m_experience + ",\"" + giftPoints + "\");"; try { pool.ExecuteSql(database, cmd); } catch { return(false); } return(true); }