/// <summary> /// 修改经验 /// </summary> public static int MODIFYEXP_QUERY(string serverIP, int usersn, float iExp, int userByID, string UserName, ref string strDesc) { int result = -1; string sql = null; try { //查询等级对应的经验值 long iLevel = CommonInfo.JW2_ExpToLevel(iExp); //修改等级1 serverIP = CommonInfo.JW2_FindDBIP(serverIP, 7); sql = "select sql_statement from sqlexpress where sql_type='JW2_MODIFYLEVEL_QUERY1' and sql_condition = 'JW2_MODIFYLEVEL_QUERY1'"; System.Data.DataSet ds = SqlHelper.ExecuteDataset(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { sql = ds.Tables[0].Rows[0].ItemArray[0].ToString(); sql = string.Format(sql, iLevel, usersn); result = MySqlHelper.ExecuteNonQuery(SqlHelper.JW2GetConnectionString(serverIP, SqlHelper.jw2User, SqlHelper.jw2UserPwd, SqlHelper.jw2gameDB), sql); } //修改等级2 serverIP = CommonInfo.JW2_FindDBIP(serverIP, 9); sql = "select sql_statement from sqlexpress where sql_type='JW2_MODIFYLEVEL_QUERY2' and sql_condition = 'JW2_MODIFYLEVEL_QUERY2'"; System.Data.DataSet ds1 = SqlHelper.ExecuteDataset(sql); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { sql = ds1.Tables[0].Rows[0].ItemArray[0].ToString(); sql = string.Format(sql, iLevel, usersn); result += MySqlHelper.ExecuteNonQuery(SqlHelper.JW2GetConnectionString(serverIP, SqlHelper.jw2User, SqlHelper.jw2UserPwd, SqlHelper.jw2messengerDB), sql); } //修改经验 serverIP = CommonInfo.JW2_FindDBIP(serverIP, 7); sql = "select sql_statement from sqlexpress where sql_type='JW2_MODIFYEXP_QUERY' and sql_condition = 'JW2_MODIFYEXP_QUERY'"; System.Data.DataSet ds2 = SqlHelper.ExecuteDataset(sql); if (ds2 != null && ds2.Tables[0].Rows.Count > 0) { sql = ds2.Tables[0].Rows[0].ItemArray[0].ToString(); sql = string.Format(sql, iExp, usersn); result += MySqlHelper.ExecuteNonQuery(SqlHelper.JW2GetConnectionString(serverIP, SqlHelper.jw2User, SqlHelper.jw2UserPwd, SqlHelper.jw2gameDB), sql); } if (result == 3) { strDesc = "修改玩家:" + UserName.ToString() + ",等级:" + iLevel.ToString() + ",经验:" + iExp.ToString() + ",成功,请稍等,系统处理中!"; SqlHelper.insertGMtoolsLog(userByID, "劲舞团II", serverIP, "JW2_MODIFYEXP_QUERY", "修改玩家:" + UserName.ToString() + ",等级:" + iLevel.ToString() + ",经验:" + iExp.ToString() + ",成功(修改经验,jw2)"); } else { strDesc = "修改玩家:" + UserName.ToString() + ",等级:" + iLevel.ToString() + ",经验:" + iExp.ToString() + ",失败,请确认该角色是否存在!"; SqlHelper.insertGMtoolsLog(userByID, "劲舞团II", serverIP, "JW2_MODIFYEXP_QUERY", "修改玩家:" + UserName.ToString() + ",等级:" + iLevel.ToString() + ",经验:" + iExp.ToString() + ",失败(修改经验,jw2)"); } } catch (System.Exception ex) { strDesc = "数据库连接失败,请重新尝试!"; SqlHelper.errLog.WriteLog("浏览JW2_MODIFYEXP_QUERY_玩家" + usersn.ToString() + "-" + UserName + "修改经验服务器IP" + serverIP + ex.Message); } return(result); }