排行榜显示

back_recharge
zhangshanxue 2019-09-06 14:54:00 +08:00
parent 9406f2c28f
commit c118c195f4
8 changed files with 61 additions and 42 deletions

View File

@ -17,8 +17,12 @@ public class SSpecialConfig implements BaseConfig {
private String value;
public static final String PHONE_BINDING = "Phone_Binding";
public static final String MANDATORY_ASTROLOGICAL = "Mandatory_Astrological";
public static final String MANDATORY_ASTROLOGICAL = "Mandatory_Astrological";//强制占星跳到第四颗星
public static final String ARENA_RANKINGSHOWNUM = "Arena_RankingShowNum";//竞技场排行榜上榜显示排名
public static final String TRIAL_RANKINGSHOWNUM = "Trial_RankingShowNum";//试炼副本排行榜上榜显示排名
public static final String BEASTS_RANKINGSHOWNUM = "Beasts_RankingShowNum";//兽潮来袭排行榜上榜显示排名
public static final String ADVENTURE_RANKINGSHOWNUM = "Adventure_RankingShowNum";//外敌入侵排行榜上榜显示排名
public static final String COMBAT_RANKINGSHOWNUM = "Combat_RankingShowNum";//战力排行榜上榜显示排名
@Override
public void init() throws Exception {
@ -40,7 +44,7 @@ public class SSpecialConfig implements BaseConfig {
public static int getIntegerValue(String key) {
String value = enumers.get(key);
if(value==null){
if (value == null) {
return -1;
}
return Integer.valueOf(value);

View File

@ -2996,7 +2996,9 @@ public class MapLogic {
*/
public void getTowerRank(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.TOWER_RANK, "", 0, 99);
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.TRIAL_RANKINGSHOWNUM);
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.TOWER_RANK, "", 0, rankEndLine);
Iterator<ZSetOperations.TypedTuple<String>> iterator = zsetreverseRangeWithScores.iterator();
MapInfoProto.TowerRankResponse.Builder response = MapInfoProto.TowerRankResponse.newBuilder();
int rank = 1;

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.handler.monsterAttack;
import com.ljsd.jieling.config.SSpecialConfig;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.handler.BaseHandler;
@ -30,7 +31,8 @@ public class GetMonsterAttackRankHandler extends BaseHandler<PlayerInfoProto.Get
int start = 0;
List<CommonProto.MonsterRankInfo> monsterRankInfos = new LinkedList<>();
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.MONSTER_ATTACK_RANK, "", 0, 100);
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.BEASTS_RANKINGSHOWNUM);
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.MONSTER_ATTACK_RANK, "", 0, rankEndLine-1);
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
String value = item.getValue();

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.config.SActivityRewardConfig;
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
import com.ljsd.jieling.config.SSpecialConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
@ -71,7 +72,8 @@ class ForceRankActivity extends AbstractActivity {
}
}
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, "", 0, maxRank-1);
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.COMBAT_RANKINGSHOWNUM);
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, "", 0, rankEndLine-1);
int rank = 1;
int nowTime = (int) (TimeUtils.now() / 1000);
for (ZSetOperations.TypedTuple<String> item : rankInfo) {

View File

@ -437,35 +437,39 @@ public class ArenaLogic {
}
int start = (page - 1) * 20, end = page * 20 - 1;
List<CommonProto.ArenaEnemy> arenaRankMemberInfo = new ArrayList<>(20);
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK,Integer.toString(curSeason), start, end);
for(ZSetOperations.TypedTuple<String> item : arenaRankInfo){
String value = item.getValue();
int score =item.getScore().intValue();
int uid = Integer.parseInt(value);
User user = UserManager.getUser(uid);
int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE,false);
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TEAM_ARENA_DEFENSE);
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
for(TeamPosHeroInfo teamPosHeroInfo:teamPosHeroInfoList){
heroTids.add(heroMap.get(teamPosHeroInfo.getHeroId()).getTemplateId());
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.ARENA_RANKINGSHOWNUM);
if(end<rankEndLine) {
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ARENA_RANK, Integer.toString(curSeason), start, end);
for (ZSetOperations.TypedTuple<String> item : arenaRankInfo) {
String value = item.getValue();
int score = item.getScore().intValue();
int uid = Integer.parseInt(value);
User user = UserManager.getUser(uid);
int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE, false);
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TEAM_ARENA_DEFENSE);
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList) {
heroTids.add(heroMap.get(teamPosHeroInfo.getHeroId()).getTemplateId());
}
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(heroTids).build();
PlayerManager playerInfoManager = user.getPlayerInfoManager();
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
.setUid(uid)
.setLevel(playerInfoManager.getLevel())
.setName(playerInfoManager.getNickName())
.setScore(score)
.setHead(0)
.setRank(++start)
.setTotalForce(totalForce)
.setHeadFrame(playerInfoManager.getHeadFrame())
.build();
arenaRankMemberInfo.add(CommonProto.ArenaEnemy.newBuilder()
.setPersonInfo(personInfoBuild)
.setTeam(teamBuild)
.build());
}
CommonProto.Team teamBuild = CommonProto.Team.newBuilder().addAllHeroTid(heroTids).build();
PlayerManager playerInfoManager = user.getPlayerInfoManager();
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
.setUid(uid)
.setLevel(playerInfoManager.getLevel())
.setName(playerInfoManager.getNickName())
.setScore(score)
.setHead(0)
.setRank(++start)
.setTotalForce(totalForce)
.setHeadFrame(playerInfoManager.getHeadFrame())
.build();
arenaRankMemberInfo.add(CommonProto.ArenaEnemy.newBuilder()
.setPersonInfo(personInfoBuild)
.setTeam(teamBuild)
.build());
}
int uid = session.getUid();
int score = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(uid)).intValue();

View File

@ -61,6 +61,7 @@ public class Hero extends MongoBase {
this.star = initStar;
this.skillList = new ArrayList<>();
this.equipByPositionMap = new HashMap<>();
this.soulEquipByPositionMap = new HashMap<>();
this.especialEquip = "";
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
if(skillIds!=null && !skillIds.isEmpty()){

View File

@ -831,13 +831,17 @@ public class CombatLogic {
int myuid = session.getUid();
int start = (page - 1) * 20, end = page * 20 - 1;
List<CommonProto.AdventureRankItemInfo> adventureRankItemInfos = new ArrayList<>(20);
Set<ZSetOperations.TypedTuple<String>> adventureBossRankInfo= RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ADVENTRUEN_BOSS_RANK,"", start, end);
for(ZSetOperations.TypedTuple<String> item : adventureBossRankInfo){
String value = item.getValue();
int score =item.getScore().intValue();
int uid = Integer.parseInt(value);
User user = UserManager.getUser(uid);
adventureRankItemInfos.add(CBean2Proto.getAdventureRankItemInfo(uid,user,score,++start));
int rankEndLine = SSpecialConfig.getIntegerValue(SSpecialConfig.ADVENTURE_RANKINGSHOWNUM);
if(end<rankEndLine){
Set<ZSetOperations.TypedTuple<String>> adventureBossRankInfo= RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.ADVENTRUEN_BOSS_RANK,"", start, end);
for(ZSetOperations.TypedTuple<String> item : adventureBossRankInfo){
String value = item.getValue();
int score =item.getScore().intValue();
int uid = Integer.parseInt(value);
User user = UserManager.getUser(uid);
adventureRankItemInfos.add(CBean2Proto.getAdventureRankItemInfo(uid,user,score,++start));
}
}
int score = RedisUtil.getInstence().getZSetScore(RedisKey.ADVENTRUEN_BOSS_RANK,"", Integer.toString(myuid)).intValue();

View File

@ -225,7 +225,7 @@ public class ItemLogic {
for (String equipId : equipIdsList) {
SoulEquip soulEquip = equipManager.getSoulEquipMap().get(equipId);
SItem sItem = SItem.getsItemMap().get(soulEquip.getEquipId());
equipManager.remove(equipId);
equipManager.removeSoulEquip(equipId);
if (reward.length() == 0) {
reward = new StringBuilder(sItem.getResolveReward());
} else {