@Override public void initLogData(RankInfo rankInfo) { List<RoleHero> roleHeroList = GameContext.getRankDAO() .selectHeroRole("campId", rankInfo.getSubType(), "limit", getRecordLimit(rankInfo)); if (Util.isEmpty(roleHeroList)) { return; } for (RoleHero roleHero : roleHeroList) { if (null == roleHero) { continue; } RoleInstance role = GameContext.getRankDAO().selectRole("roleId", roleHero.getRoleId() + ""); if (null == role) { continue; } try { StringBuilder sb = getLogMessage(role, roleHero); doWriteLogFile(rankInfo, false, null, sb.toString()); } catch (Exception e) { continue; } } }
private StringBuilder getLogMessage(RoleInstance role, RoleHero hero) throws Exception { StringBuilder sb = new StringBuilder(); // keyId# sb.append(role.getRoleId()).append(UNDERLINE_CAT).append(hero.getHeroId()).append(CAT); // 英雄的战斗力 sb.append(GameContext.getHeroApp().getBattleScore(hero)).append(CAT); sb.append(hero.getLevel()).append(CAT); sb.append(hero.getExp()).append(CAT); sb.append(getRoleCreatTimeStr(role)).append(CAT); sb.append(hero.getHeroId()).append(CAT); // 英雄的名字 String heroName = GameContext.getGoodsApp().getGoodsTemplate(GoodsHero.class, hero.getHeroId()).getName(); sb.append(heroName).append(CAT); sb.append(getRoleBaseInfo(role)); return sb; }