四灵试炼,首通和最低记录,排行榜功能实现,未调试
parent
0633b9ae1c
commit
3c83e55d89
|
@ -23,6 +23,8 @@ public enum FightType {
|
|||
Firend(17),//好友
|
||||
TowerMap(18),//森罗幻境
|
||||
|
||||
FourChallenge(20),//四灵试炼
|
||||
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
@ -305,7 +305,9 @@ public class RedisKey {
|
|||
public final static String WORLD_ARE_JOIN = "WORLD_ARE_JOIN";//跨服参与人员
|
||||
public final static String WARLD_DIS_ARENA_RANK = "WARLD_DIS_ARENA_RANK";//跨服榜单
|
||||
|
||||
|
||||
public final static String FOUR_CHALLENGE_FIRST = "FOUR_CHALLENGE_FIRST";//四灵试炼首次通关
|
||||
public final static String FOUR_CHALLENGE_MINI_FORCE = "FOUR_CHALLENGE_MINI_FORCE";//四灵试炼最低战力
|
||||
public final static String FOUR_CHALLENGE_TIER_RANK = "FOUR_CHALLENGE_TIER_RANK";//四灵试炼层数排行榜
|
||||
|
||||
public static Set<String> familyKey = new HashSet<>();
|
||||
|
||||
|
@ -348,6 +350,7 @@ public class RedisKey {
|
|||
rankCacChe.add(DEATH_PATH_TOTAL_GUILD_RANK);
|
||||
rankCacChe.add(SITUATION_RANK);
|
||||
|
||||
rankCacChe.add(FOUR_CHALLENGE_TIER_RANK);
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.ljsd.jieling.logic.activity.fourChallenge;
|
||||
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
|
@ -11,10 +15,16 @@ import com.ljsd.jieling.logic.fight.FightDispatcher;
|
|||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SCHero;
|
||||
import config.SCampTowerConfig;
|
||||
import config.SCampTowerSetting;
|
||||
|
@ -24,7 +34,9 @@ import rpc.protocols.MessageTypeProto;
|
|||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
@ -159,16 +171,58 @@ public class FourChallengeLogic {
|
|||
|
||||
}
|
||||
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), teamId, 20, "", GameFightType.DailyChallenge, sCampTowerConfig.getMonster(), 3);
|
||||
// 战斗逻辑
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), teamId, 20, "", GameFightType.FourChallenge, sCampTowerConfig.getMonster(), 3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
int[] checkResult = fightResult.getCheckResult();
|
||||
response.setFightData(fightResult.getFightData());
|
||||
|
||||
AbstractRank rank = RankContext.getRankEnum(RankEnum.FOUR_CHALLENGE_TIER_RANK.getType());
|
||||
|
||||
if (checkResult[0] == 1) {
|
||||
// 挑战成功,获得道具,更新层数,更新次数
|
||||
drop = ItemUtil.drop(user, sCampTowerConfig.getFirstReward(), BIReason.FOUR_CHALLENGE_FIRST);
|
||||
user.getPlayerInfoManager().updateFourChallengeByIndex(campId - 1, currentFloor + 1);
|
||||
user.getPlayerInfoManager().setFourChallengeRemainTimes(campId - 1, fourChallengeRemainTimes[campId - 1] + 1);
|
||||
|
||||
// 排行榜
|
||||
rank.addRank(user.getId(),"",floorId);
|
||||
|
||||
// 计算战力
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
// 唯一id
|
||||
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.FourChallenge,user.getId()));
|
||||
// 创建时间
|
||||
arenaRecord.setCreateTime(TimeUtils.nowInt());
|
||||
// 战力
|
||||
arenaRecord.setAttackForce(myforce);
|
||||
// 战斗数据
|
||||
arenaRecord.setFightData(fightResult.getFightData().toByteArray());
|
||||
// key
|
||||
String floorIds = String.valueOf(floorId);
|
||||
|
||||
|
||||
// 首次通关记录
|
||||
Map<String, ArenaRecord> first = RedisUtil.getInstence().getMapValues(RedisKey.FOUR_CHALLENGE_FIRST, "", String.class, ArenaRecord.class);
|
||||
if (first.get(floorIds) == null){
|
||||
// 记录redis
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FOUR_CHALLENGE_FIRST, "", floorIds, arenaRecord);
|
||||
}
|
||||
|
||||
// 最低战力记录
|
||||
Map<String, ArenaRecord> force = RedisUtil.getInstence().getMapValues(RedisKey.FOUR_CHALLENGE_MINI_FORCE, "", String.class, ArenaRecord.class);
|
||||
if (force.get(floorIds) == null){
|
||||
// 记录redis
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FOUR_CHALLENGE_MINI_FORCE, "", floorIds, arenaRecord);
|
||||
}else {
|
||||
int attackForce = force.get(floorIds).getAttackForce();
|
||||
if (myforce < attackForce){
|
||||
// 记录redis
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FOUR_CHALLENGE_MINI_FORCE, "", floorIds, arenaRecord);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (type == 1) {
|
||||
|
|
|
@ -488,16 +488,38 @@ public class ArenaLogic {
|
|||
return (int)(k*(result-ea) + 0.5*parm);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看战斗回放
|
||||
* 1:竞技场防守记录
|
||||
* 2:竞技场冠军纪录
|
||||
* 3:boss记录
|
||||
* 4:四灵试炼战斗记录,【fightId格式为:层数#类别(0:首次,1:最低)】
|
||||
* 例子:1层首通:1#0,1层最低:1#1
|
||||
* @param iSession
|
||||
* @param type
|
||||
* @param fightId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getFightReplayData(ISession iSession,int type,String fightId) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
ArenaRecord arenaRecord=null;
|
||||
if(type == 2){
|
||||
arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"", fightId, ArenaRecord.class);
|
||||
}else if(type == 1){
|
||||
// 竞技场
|
||||
arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.ARENA_RRECORD, Integer.toString(uid), fightId, ArenaRecord.class);
|
||||
}else if(type == 3){
|
||||
arenaRecord = RedisUtil.getInstence().get(RedisKey.GUILDBOSS_ARENA_RECORD, fightId, ArenaRecord.class);
|
||||
}else if (type == 4){
|
||||
// 四灵试炼
|
||||
String[] split = fightId.split("#");
|
||||
if ("0".equals(split[1])){
|
||||
// 首通
|
||||
arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.FOUR_CHALLENGE_FIRST, "", split[0], ArenaRecord.class);
|
||||
}else if ("1".equals(split[1])){
|
||||
// 最低战力
|
||||
arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.FOUR_CHALLENGE_MINI_FORCE, "", split[0], ArenaRecord.class);
|
||||
}
|
||||
}
|
||||
if(arenaRecord == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("arena_rrecord null"));
|
||||
|
|
|
@ -49,7 +49,9 @@ public enum GameFightType {
|
|||
CarPersonChallenge(FightType.CarBossFight,new PVPFightHandler(),null),
|
||||
GuildChallenge(FightType.GuildChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||
NewGeneral(FightType.GuildChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null)
|
||||
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null),
|
||||
|
||||
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -2317,7 +2317,16 @@ public class HeroLogic{
|
|||
}
|
||||
return quality;
|
||||
}
|
||||
//TODO isMyself ???
|
||||
|
||||
/**
|
||||
* 计算队伍战力
|
||||
* @param targetUser
|
||||
* @param teamId
|
||||
* @param isMyself
|
||||
* @return
|
||||
*
|
||||
* // TODO isMyself ???
|
||||
*/
|
||||
public int calTeamTotalForce(User targetUser,int teamId,boolean isMyself){
|
||||
int totalForce =0;
|
||||
targetUser.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
|
|
|
@ -900,7 +900,7 @@ public class ItemLogic {
|
|||
*/
|
||||
public int[][] godTreeAdditon(User user, Map<Integer, Map<Integer, SJewelRankupConfig>> godTreePoolMap,int level){
|
||||
//人族层数
|
||||
int people = 10;
|
||||
int people = 100;
|
||||
//妖族层数
|
||||
int monster = 0;
|
||||
//佛教层数
|
||||
|
|
|
@ -42,6 +42,8 @@ public enum RankEnum {
|
|||
|
||||
GUILD_SHEJI_SCORE_RANK(27,RedisKey.GUILD_SHEJI_SCORE_RANK,GuildSheJiScoreRank::new,false),//param1:公会社稷贡献 param2:无 param3:无
|
||||
WARLD_DIS_ARENA_RANK(28,RedisKey.WARLD_DIS_ARENA_RANK,ArenaRank::new,true),//世界服排行
|
||||
|
||||
FOUR_CHALLENGE_TIER_RANK(29,RedisKey.FOUR_CHALLENGE_TIER_RANK,SituationRank::new,false),//四灵试炼排行榜,param1:层数 param2:无 param3:无
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
@ -14,6 +14,7 @@ public enum UUIDEnum {
|
|||
JEWEL(10),
|
||||
SpecialMonster(11),
|
||||
ROBOT_UUID(12),
|
||||
FourChallenge(13),
|
||||
;
|
||||
|
||||
private int value;
|
||||
|
|
Loading…
Reference in New Issue