战力实时排行榜提交、十绝阵无用代码修改、限时抽卡修改、试炼本炸弹小游戏修改、试炼本小游戏删除点、日常本战力限制去掉

back_recharge
lvxinran 2020-06-25 16:36:48 +08:00
parent d649320af8
commit b36466de0b
11 changed files with 146 additions and 27 deletions

View File

@ -129,6 +129,7 @@ public class RedisKey {
public static final String AREDEF_TEAM_FORCE_RANK = "AREDEF_TEAM_FORCE_RANK";
public static final String EXPERT_RANK = "EXPERT_RANK";
public static final String FORCE_CURR_RANK = "FORCE_CURR_RANK";
public static final String MAIN_LEVEL_RANK = "MAIN_LEVEL_RANK";
public static final String RANDOM_CARD_RANK="RANDOM_CARD_RANK";
public static final String RANDOM_CARD_PERFECT_RANK = "RANDOM_CARD_PERFECT_RANK";

View File

@ -3055,6 +3055,7 @@ public class MapLogic {
PlayerManager playerInfoManager = user.getPlayerInfoManager();
//次数校验
SDailyChallengeConfig sDailyChallengeConfig = STableManager.getConfig(SDailyChallengeConfig.class).get(id);
SDailyChallengeConfig lastChange = STableManager.getConfig(SDailyChallengeConfig.class).get(id - 1);
if(sDailyChallengeConfig==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
@ -3063,10 +3064,17 @@ public class MapLogic {
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
}
boolean consumeCount = false;
Set<Integer> dailyPass = playerInfoManager.getDailyPass();
if(type==1){
if(playerInfoManager.getDailyPass().contains(id)){
if(dailyPass.contains(id)){
throw new ErrorCodeException(ErrorCode.DAILY_ALREADY_PASS);
}
//判断上一关是否已过
if(lastChange!=null&&lastChange.getType()==sDailyChallengeConfig.getType()){
if(!dailyPass.contains(id - 1)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
int[][] openRules = sDailyChallengeConfig.getOpenRules();
for(int[] rule:openRules){
boolean open = true;
@ -3077,9 +3085,6 @@ public class MapLogic {
case 2:
open = SMainLevelConfig.biggerThanFight(user.getMainLevelManager().getFightId(),rule[1]);
break;
case 3:
open = playerInfoManager.getMaxForce()>=rule[1];
break;
}
if(!open){
throw new ErrorCodeException(ErrorCode.DAILY_NO_OPEN);
@ -3105,7 +3110,7 @@ public class MapLogic {
}
}
if(type==2){
if(!playerInfoManager.getDailyPass().contains(id)){
if(!dailyPass.contains(id)){
throw new ErrorCodeException(ErrorCode.DAILY_ALREADY_PASS);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
@ -3270,9 +3275,9 @@ public class MapLogic {
if(response==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
// if(response.getGameStatus()==0){
// BehaviorUtil.destoryCurPoint(user);
// }
if(response.getGameStatus()==0){
BehaviorUtil.destoryCurPoint(user);
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
}
}

View File

@ -67,10 +67,7 @@ public class BombGame implements MapGame {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] idInfo = mapGameInfo.getId();
if(operationInfo.isEmpty()){
//第一次把奖励随机一下
idInfo = shuffle(idInfo);
}
int resultId = idInfo[(int)params[0]-1];
int gameStatus = 0;
@ -83,7 +80,7 @@ public class BombGame implements MapGame {
}
if(resultId!=-1){
//记录抽取次数
operationInfo.add((int)params[0]);
operationInfo.add((int)params[0]-1);
gameStatus = 3-operationInfo.size();
STrialGameConfig config = STrialGameConfig.trialGameConfigMap.get(resultId);
drop = ItemUtil.drop(user, new int[][]{{config.getRewardID(), config.getMin()}}, BIReason.MAP_EVENET_REWARD);

View File

@ -136,10 +136,10 @@ public class LimitRandomCardActivity extends AbstractActivity {
@Override
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
//150分赠一次
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_FREEINTEGRAL);
if((activityMission.getV()+count)/onceArrayValue[0]-activityMission.getV()/onceArrayValue[0]>0){
user.getPlayerInfoManager().updateVipPrivilage(onceArrayValue[1],-1);
}
// int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_FREEINTEGRAL);
// if((activityMission.getV()+count)/onceArrayValue[0]-activityMission.getV()/onceArrayValue[0]>0){
// user.getPlayerInfoManager().updateVipPrivilage(onceArrayValue[1],-1);
// }
activityMission.setV(activityMission.getV()+count);
}

View File

@ -0,0 +1,22 @@
package com.ljsd.jieling.logic.activity.event;
/**
* @author lvxinran
* @date 2020/6/22
* @discribe 线
*/
public class UserMainTeamForceEvent implements IEvent{
private int uid;
public UserMainTeamForceEvent(int uid) {
this.uid = uid;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
}

View File

@ -225,14 +225,14 @@ public class DeathPathLogic {
default:
break;
}
System.out.println("状态修改-------");
LOGGER.info("十绝阵状态修改-------");
//阶段信息改变发送推送
for(Map.Entry<Integer, ISession> sessionEntry:OnlineUserManager.sessionMap.entrySet()) {
Family.DeathPathStatusChangeIndication indication = Family.DeathPathStatusChangeIndication.newBuilder().setStatus(status).build();
MessageUtil.sendIndicationMessage(sessionEntry.getValue(),1, MessageTypeProto.MessageType.DEATH_PATH_STATUS_CHANGE_INDICATION.getNumber(),indication,true);
}
}
System.out.println("status="+status);
LOGGER.info("十绝阵status={}-------",status);
}
/**

View File

@ -256,7 +256,7 @@ public class HeroLogic{
}
user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount);
heroManager.updateRandCount(type,perCount);
Poster.getPoster().dispatchEvent(new RandomCardEvent(uid,sLotterySetting.getLotteryType(),SSpecialConfig.getIntegerValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_INTEGRAL)*sLotterySetting.getPerCount(),resultRandom));
Poster.getPoster().dispatchEvent(new RandomCardEvent(uid,sLotterySetting.getLotteryType(),sLotterySetting.getPerCount(),resultRandom));
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, resultRandom,BIReason.HERO_RANDOM);
builder.setDrop(drop);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
@ -593,7 +593,9 @@ public class HeroLogic{
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), teamForce);
}
if(teamId==GlobalsDef.FORMATION_NORMAL){
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(iSession.getUid()));
}
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_IN_TEAM,heroIds.size());
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
}
@ -1692,9 +1694,9 @@ public class HeroLogic{
float score = sPropertyConfig.getScore();
result += propertyValue*score;
// LOGGER.info("the propertyId={} the value is ={},propertyValue={},score={}result ={},the value={}",propertyId,propertyValue*score,propertyValue,score,result,propertyValue*score);
LOGGER.info("the propertyId={} the value is ={},propertyValue={},score={}result ={},the value={}",propertyId,propertyValue*score,propertyValue,score,result,propertyValue*score);
}
// System.out.println(result);
System.out.println(result);
return (int)result;
}
@ -2117,7 +2119,7 @@ public class HeroLogic{
//妖灵师是否在阵容中
public Set<Integer> isInTeam(User user,String heroId){
public boolean isInTeam(User user,String heroId,int teamId){
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
Set<Integer> collect = teamPosForHero.entrySet().stream().filter(integerListEntry ->
{
@ -2128,7 +2130,8 @@ public class HeroLogic{
}
return false;
}).map(Map.Entry::getKey).collect(Collectors.toSet());
return collect;
return collect.contains(teamId);
}

View File

@ -54,7 +54,7 @@ import java.util.*;
import java.util.stream.Collectors;
public class PlayerLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(MailLogic.class);
private static final Logger LOGGER = LoggerFactory.getLogger(PlayerLogic.class);
private PlayerLogic(){
Poster.getPoster().listenEvent(new UserForceUpEventHandler(), UserForceChangeEvent.class);

View File

@ -29,7 +29,9 @@ public enum RankEnum {
DEATH_PATH_TOTAL_PERSON_RANK(17,RedisKey.DEATH_PATH_TOTAL_PERSON_RANK,DeathPathTotalPersonRank::new),//param1玩家总伤害 param2无 param3:无
DEATH_PATH_TOTAL_GUILD_RANK(18,RedisKey.DEATH_PATH_TOTAL_GUILD_RANK,DeathPathTotalGuildRank::new),//param1工会总伤害 param2无 param3:无
GUILD_FORCE_RANK(20,RedisKey.GUILD_FORCE_RANK,GuildForceRank::new),//param1公会总战力 param2无 param3:无
EXPERT_RANK(21,RedisKey.EXPERT_RANK,GoldRank::new);//param1活动进度 param2无 param3:无
EXPERT_RANK(21,RedisKey.EXPERT_RANK,GoldRank::new),//param1活动进度 param2无 param3:无
FORCE_CURR_RANK(22,RedisKey.FORCE_CURR_RANK,ForceCurrRank::new);//param1人物战力 param2无 param3:无
private int type;
private String redisKey;
@ -41,6 +43,9 @@ public enum RankEnum {
rankMap = new HashMap<>();
abstractRankMap = new HashMap<>();
Arrays.stream(RankEnum.values()).forEach((rankEnum)->rankMap.put(rankEnum.getType(),rankEnum));
for (RankEnum item:RankEnum.values()) {
abstractRankMap.put(item.getType(),item.getRankFunction().apply(item.getType(),item.getRedisKey()));
}
}
RankEnum(int type,String redisKey, BiFunction<Integer,String,AbstractRank> rankFunction){
this.type = type;

View File

@ -6,9 +6,12 @@ import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.IRank;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.List;
@ -23,6 +26,7 @@ import java.util.function.BiConsumer;
*
*/
public abstract class AbstractRank implements IRank {
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractRank.class);
protected String redisKey;
protected int type;

View File

@ -0,0 +1,82 @@
package com.ljsd.jieling.logic.rank.rankImpl;
import com.ljsd.jieling.logic.activity.IEventHandler;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import java.util.*;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author lvxinran
* @date 2020/6/22
* @discribe
*/
public class ForceCurrRank extends AbstractRank implements IEventHandler{
public ForceCurrRank(int type, String redisKey) {
super(type, redisKey);
executor = new ScheduledThreadPoolExecutor(8);
executor.scheduleAtFixedRate(this::run,2,1, TimeUnit.SECONDS);
Poster.getPoster().listenEvent(this, UserMainTeamForceEvent.class);
}
private static Queue<UserMainTeamForceEvent> infoQueue = new ArrayDeque<>();
private ScheduledThreadPoolExecutor executor;
@Override
public int[] getDataByScore(Double score) {
return new int[]{score.intValue()};
}
@Override
public double getScore(double... data) {
return data[0];
}
@Override
public void onEvent(IEvent event) throws Exception {
RankContext.getRankEnum(RankEnum.FORCE_CURR_RANK.getType());
if(event instanceof UserMainTeamForceEvent){
infoQueue.offer((UserMainTeamForceEvent)event);
}
}
private void run(){
Queue<UserMainTeamForceEvent> infoQueue = ForceCurrRank.infoQueue;
if(infoQueue.isEmpty()){
return;
}
int size = infoQueue.size();
List<UserMainTeamForceEvent> eventList = new ArrayList<>(size);
if(size<100){
for(int i = 0 ; i < size;i++){
eventList.add(infoQueue.poll());
}
}
Set<Integer> changeId = new HashSet<>();
System.out.println(("有"+changeId.size()+"个用户主线战力更改"));
eventList.forEach(n->changeId.add(n.getUid()));
changeId.forEach(i-> {
try {
User user = UserManager.getUser(i);
int force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
addRank(i,"",force);
} catch (Exception e) {
e.printStackTrace();
}
});
}
}