public KuaFuWorldRoleData InsertKuaFuWorldRoleData(KuaFuWorldRoleData data, int tempRoleID) { try { object[] ptidAndRid; int result = DbHelperMySQL.GetSingleValues(string.Format("SELECT ptid,rid FROM `t_pt_roles` where temprid={0}", data.LocalRoleID), out ptidAndRid); bool flag; if (result >= 0) { flag = !ptidAndRid.All((object x) => x != null); } else { flag = true; } if (!flag) { if (!(data.PTID.ToString() != ptidAndRid[0].ToString())) { return(this.QueryKuaFuWorldRoleData(data.LocalRoleID, data.PTID)); } data.TempRoleID = tempRoleID; } else { data.TempRoleID = data.LocalRoleID; } List <Tuple <string, byte[]> > imgList = new List <Tuple <string, byte[]> >(); imgList.Add(new Tuple <string, byte[]>("content", data.RoleData)); string strSql = string.Format("insert into `t_pt_roles`(ptid,rid,temprid,userid,zoneid,channel,roledata) values('{0}','{1}','{2}','{3}','{4}','{5}',@content)", new object[] { data.PTID, data.LocalRoleID, data.TempRoleID, data.UserID, data.ZoneID, data.Channel }); result = DbHelperMySQL.ExecuteSqlInsertImg(strSql, imgList); if (result >= 0) { return(data); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(null); }
public bool LoadZorkBattleRankInfo(int rankType, List <KFZorkRankInfo> rankList) { try { string strSql = this.FormatLoadZorkBattleRankSql(rankType); if (string.IsNullOrEmpty(strSql)) { return(false); } MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false); while (sdr != null && sdr.Read()) { KFZorkRankInfo rankInfo = new KFZorkRankInfo(); rankInfo.Key = Convert.ToInt32(sdr["a"]); rankInfo.Value = Convert.ToInt32(sdr["b"]); if (rankType == 1) { string strParam = string.Format("SELECT zoneid,rname,rebornlev FROM `t_kf_5v5_zhandui_roles` WHERE rid={0};", rankInfo.Key); object[] arr; if (DbHelperMySQL.GetSingleValues(strParam, out arr) >= 0) { rankInfo.StrParam1 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString()); rankInfo.Param1 = Convert.ToInt32(arr[2]); } rankList.Add(rankInfo); } } if (sdr != null) { sdr.Close(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return(false); } return(true); }
private bool LoadBHMatchRankInfo(int rankType, int seasonCur, int seasonLast, KuaFuData <Dictionary <int, List <BangHuiMatchRankInfo> > > BHMatchRankInfoDict) { bool result; if (null == BHMatchRankInfoDict) { result = false; } else { List <BangHuiMatchRankInfo> rankList = null; if (!BHMatchRankInfoDict.V.TryGetValue(rankType, out rankList)) { rankList = (BHMatchRankInfoDict.V[rankType] = new List <BangHuiMatchRankInfo>()); } else { rankList.Clear(); } try { string strSql = this.FormatLoadBHMatchRankSql(rankType, seasonCur, seasonLast); if (string.IsNullOrEmpty(strSql)) { return(false); } MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false); while (sdr != null && sdr.Read()) { BangHuiMatchRankInfo rankInfo = new BangHuiMatchRankInfo(); rankInfo.Key = Convert.ToInt32(sdr["a"]); rankInfo.Value = Convert.ToInt32(sdr["b"]); switch (rankType) { case 4: case 6: case 10: case 12: { string strParam = string.Format("SELECT zoneid,rname FROM t_banghui_match_roles WHERE `type`={0} AND rid={1};", 1, rankInfo.Key); object[] arr; if (DbHelperMySQL.GetSingleValues(strParam, out arr) >= 0) { rankInfo.Param1 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString()); } string strParam2 = string.Format("SELECT zoneid_bh,bhname FROM t_banghui_match_bh, \r\n (SELECT bhid FROM t_banghui_match_roles WHERE `type`={0} AND rid={1}) a1 WHERE t_banghui_match_bh.bhid = a1.bhid;", 1, rankInfo.Key); if (DbHelperMySQL.GetSingleValues(strParam2, out arr) >= 0) { rankInfo.Param2 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString()); } rankList.Add(rankInfo); break; } case 5: case 7: case 11: case 13: { string strParam = string.Format("SELECT zoneid,rname FROM t_banghui_match_roles WHERE `type`={0} AND rid={1};", 2, rankInfo.Key); rankInfo.Param1 = Convert.ToString(DbHelperMySQL.GetSingle(strParam)); object[] arr; if (DbHelperMySQL.GetSingleValues(strParam, out arr) >= 0) { rankInfo.Param1 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString()); } string strParam2 = string.Format("SELECT zoneid_bh,bhname FROM t_banghui_match_bh, \r\n (SELECT bhid FROM t_banghui_match_roles WHERE `type`={0} AND rid={1}) a1 WHERE t_banghui_match_bh.bhid = a1.bhid;", 2, rankInfo.Key); if (DbHelperMySQL.GetSingleValues(strParam2, out arr) >= 0) { rankInfo.Param2 = KuaFuServerManager.FormatName(Convert.ToInt32(arr[0]), arr[1].ToString()); } rankList.Add(rankInfo); break; } case 8: case 9: goto IL_24B; default: goto IL_24B; } continue; IL_24B: KuaFuData <BHMatchBHData> bhData = null; if (this.BHMatchBHDataDict_Gold.TryGetValue(rankInfo.Key, out bhData)) { rankInfo.Param1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname); rankInfo.Param2 = KuaFuServerManager.FormatName(bhData.V.zoneid_r, bhData.V.rname); rankList.Add(rankInfo); } else if (this.BHMatchBHDataDict_Rookie.TryGetValue(rankInfo.Key, out bhData)) { rankInfo.Param1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname); rankInfo.Param2 = KuaFuServerManager.FormatName(bhData.V.zoneid_r, bhData.V.rname); rankList.Add(rankInfo); } } TimeUtil.AgeByNow(ref BHMatchRankInfoDict.Age); if (sdr != null) { sdr.Close(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return(false); } result = true; } return(result); }