public List <DDO_EquipmentInfo> GetAllEquipmentByCharacterId(int charId) { DataSet ds = new DataSet(); cmd = "select * from `equipment` where charid=" + charId + ";"; pool.ExecuteSql(database, cmd, ds); DataTable dt = ds.Tables[0]; List <DDO_EquipmentInfo> res = new List <DDO_EquipmentInfo> (); for (int i = 0; i < dt.Rows.Count; i++) { DDO_EquipmentInfo equipment = new DDO_EquipmentInfo(); equipment.m_strengthNum = byte.Parse(dt.Rows[i]["strength_num"].ToString()); //equipment.m_holeNum = short.Parse (dt.Rows[i]["hole_num"].ToString ()); equipment.m_realId = short.Parse(dt.Rows[i]["realid"].ToString()); string gems = dt.Rows[i]["gem_list"].ToString(); equipment.m_inlaidGemIdList = new List <short> (); if (gems.Length != 0) { string[] s = gems.Split(' '); for (int j = 0; j < s.Length; j++) { equipment.m_inlaidGemIdList.Add(short.Parse(s[j])); } } JsonData attr = JsonMapper.ToObject(dt.Rows[i]["enchant_attr"].ToString()); equipment.m_enchantAttr = GetAttr(attr); res.Add(equipment); } return(res); }
public void InsertEquipmentInfo(DDO_EquipmentInfo eq) { string gems; if (eq.m_inlaidGemIdList.Count != 0) { gems = eq.m_inlaidGemIdList[0].ToString(); for (int i = 0; i < eq.m_inlaidGemIdList.Count; i++) { gems = gems + " " + eq.m_inlaidGemIdList[i].ToString(); } } else { gems = ""; } string enchantAttr = GetString(eq.m_enchantAttr); cmd = "insert into `equipment` values(" + eq.m_realId + "," + eq.m_characterId + "," + eq.m_strengthNum + ",\"" + gems + "\",\"" + enchantAttr + "\");"; pool.ExecuteSql(database, cmd); }
public void UpdateEquipmentInfo(DDO_EquipmentInfo eq) { string gems; if (eq.m_inlaidGemIdList.Count != 0) { gems = eq.m_inlaidGemIdList[0].ToString(); for (int i = 1; i < eq.m_inlaidGemIdList.Count; i++) { gems = gems + " " + eq.m_inlaidGemIdList[i].ToString(); } } else { gems = ""; } string enchantAttr = GetString(eq.m_enchantAttr); cmd = "update `equipment` set `charid`=" + eq.m_characterId + ", strength_num=" + eq.m_strengthNum + ", gem_list=\"" + gems + "\",enchant_attr=\"" + enchantAttr + "\" where realid=" + eq.m_realId + ";"; pool.ExecuteSql(database, cmd); }