public static RoleParamType GetRoleParamType(string paramName, string value = null) { RoleParamType roleParamType; lock (RoleParamNameInfo.readerWriterLock) { if (GameDBManager.Flag_Splite_RoleParams_Table != 0) { if (RoleParamNameInfo.RoleParamNameTypeDict.TryGetValue(paramName, out roleParamType)) { return(roleParamType); } int key; if (int.TryParse(paramName, NumberStyles.None, NumberFormatInfo.InvariantInfo, out key) && key >= 0) { if (key < 10000) { int rem; Math.DivRem(key, 10, out rem); roleParamType = new RoleParamType(paramName, paramName, "t_roleparams_char", "idx", "v" + rem, key - rem, key, 2); } else if (key < 20000) { int rem; Math.DivRem(key, 40, out rem); roleParamType = new RoleParamType(paramName, paramName, "t_roleparams_long", "idx", "v" + rem, key - rem, key, 2); } else { roleParamType = new RoleParamType(paramName, paramName, "t_roleparams_2", "pname", "pvalue", key, key, 0); } } else { if (RoleParamNameInfo.GetPrefixParamNameType(paramName) == null && (!RoleParamNameInfo.RoleParamNameTypeExtDict.TryGetValue(paramName, out roleParamType) || roleParamType.Type != -1)) { string msg = string.Format("使用了未配置的角色参数:{0},{1}", paramName, value); MyConsole.WriteLine(msg, new object[0]); LogManager.WriteLog(LogTypes.Error, msg, null, true); } roleParamType = new RoleParamType(paramName, paramName, "t_roleparams_2", "pname", "pvalue", 0, 0, 0); } RoleParamNameInfo.RoleParamNameTypeDict[paramName] = roleParamType; } else { if (RoleParamNameInfo.OldRoleParamNameTypeDict.TryGetValue(paramName, out roleParamType)) { return(roleParamType); } roleParamType = new RoleParamType(paramName, paramName, "t_roleparams", "pname", "pvalue", 0, 0, 0); RoleParamNameInfo.OldRoleParamNameTypeDict[paramName] = roleParamType; } } return(roleParamType); }
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); } }