public void GetYaoSaiBossFightLog(GameServerClient client, int nID, byte[] cmdParams, int count) { try { Dictionary <int, List <YaoSaiBossFightLog> > bossFightDict = new Dictionary <int, List <YaoSaiBossFightLog> >(); MySQLConnection conn = null; try { RoleParamType roleParamType = RoleParamNameInfo.GetRoleParamType("20008", null); string cmdText = "select * from t_yaosaiboss_fight"; GameDBManager.SystemServerSQLEvents.AddEvent(string.Format("+SQL: {0}", cmdText), EventLevels.Important); conn = DBManager.getInstance().DBConns.PopDBConnection(); MySQLCommand cmd = new MySQLCommand(cmdText, conn); MySQLDataReader reader = cmd.ExecuteReaderEx(); while (reader.Read()) { int rid = int.Parse(reader["rid"].ToString()); int otherrid = int.Parse(reader["otherrid"].ToString()); string otherrname = reader["otherrname"].ToString(); int invitetype = int.Parse(reader["invitetype"].ToString()); int fightlife = int.Parse(reader["fightlife"].ToString()); List <YaoSaiBossFightLog> fightLogList = null; if (!bossFightDict.TryGetValue(rid, out fightLogList)) { fightLogList = new List <YaoSaiBossFightLog>(); bossFightDict[rid] = fightLogList; } fightLogList.Add(new YaoSaiBossFightLog { OtherRid = otherrid, OtherRname = otherrname, InviteType = invitetype, FightLife = fightlife }); } cmd.Dispose(); } catch (Exception ex) { LogManager.WriteException(ex.Message); } finally { if (null != conn) { DBManager.getInstance().DBConns.PushDBConnection(conn); } } client.sendCmd <Dictionary <int, List <YaoSaiBossFightLog> > >(nID, bossFightDict); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("YaoSaiBoss :: 获取角色boss信息错误 cmd={0}, ex={1}", nID, ex.Message), null, true); } }
public void GetYaoSaiBossData(GameServerClient client, int nID, byte[] cmdParams, int count) { try { Dictionary <int, YaoSaiBossData> roleBossDataDict = new Dictionary <int, YaoSaiBossData>(); MySQLConnection conn = null; try { RoleParamType roleParamType = RoleParamNameInfo.GetRoleParamType("20008", null); string cmdText = "select * from t_yaosaiboss"; GameDBManager.SystemServerSQLEvents.AddEvent(string.Format("+SQL: {0}", cmdText), EventLevels.Important); conn = DBManager.getInstance().DBConns.PopDBConnection(); MySQLCommand cmd = new MySQLCommand(cmdText, conn); MySQLDataReader reader = cmd.ExecuteReaderEx(); while (reader.Read()) { int rid = int.Parse(reader["rid"].ToString()); int bossID = int.Parse(reader["bossID"].ToString()); int bossLife = int.Parse(reader["bosslife"].ToString()); DateTime deadTime = DateTime.Parse(reader["deadtime"].ToString()); roleBossDataDict[rid] = new YaoSaiBossData { OwnerID = rid, BossID = bossID, LifeV = (double)bossLife, DeadTime = deadTime }; } cmd.Dispose(); } catch (Exception ex) { LogManager.WriteException(ex.Message); } finally { if (null != conn) { DBManager.getInstance().DBConns.PushDBConnection(conn); } } client.sendCmd <Dictionary <int, YaoSaiBossData> >(nID, roleBossDataDict); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("YaoSaiBoss :: 获取角色boss信息错误 cmd={0}, ex={1}", nID, ex.Message), null, true); } }