back_recharge
lvxinran 2020-02-24 17:14:08 +08:00
commit d005fbed44
7 changed files with 39 additions and 15 deletions

View File

@ -86,7 +86,6 @@ public interface GlobalsDef {
int TEAM_ARENA_ATTACH =201;//竞技场进攻编队
int BLOODY_TEAM =701; //血战队伍
int CHAMPION_ATTACK_TEAM =801; //
int GUILD_BOSS_TEAM =901; //工会boss队伍
//特权解锁类型
int LEVEL_UNLOCK_PRIVILEGE = 1;

View File

@ -4,6 +4,7 @@ import com.google.protobuf.GeneratedMessage;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.util.MessageUtil;
@ -13,11 +14,12 @@ import java.util.*;
/**
* 伪事务
*/
public class SimpleTransaction {
//当前过程的session
private ISession session;
private List<TransTask> tasks = new LinkedList<>();
private Map<Integer, List<GeneratedMessage>> sendCacheMap = new HashMap<>();
private Map<Integer, LinkedList<GeneratedMessage>> sendCacheMap = new HashMap<>();
private static final Map<Integer, MessageUtil.CombinePolicy> combineMsgId = new HashMap<>();
static {
@ -45,7 +47,35 @@ public class SimpleTransaction {
combineMsgId.put(MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, (MessageUtil.CombinePolicy< PlayerInfoProto.AllGiftGoodsIndication>) list -> {
List<PlayerInfoProto.AllGiftGoodsIndication> combineList = new LinkedList<>();
if(list.size()>0){
combineList.add(list.get(list.size()-1));
if(list.size()>1){
//修复连续获得多个英雄 前端无法处理问题
HashMap<Integer, Integer> giftId2startTimeMap = new HashMap<>();
list.getFirst().getGiftGoodsInfoList().forEach(giftGoodsInfo -> {
if(giftGoodsInfo.getStartTime()!=0){
giftId2startTimeMap.put(giftGoodsInfo.getGoodsId(),giftGoodsInfo.getStartTime());
}
});
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder();
list.getLast().getGiftGoodsInfoList().forEach(giftGoodsInfo -> {
if(giftId2startTimeMap.containsKey(giftGoodsInfo.getGoodsId())){
CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder();
builder.setStartTime(giftId2startTimeMap.get(giftGoodsInfo.getGoodsId()));
builder.setBuyTimes(giftGoodsInfo.getBuyTimes());
builder.setEndTime(giftGoodsInfo.getEndTime());
builder.setGoodsId(giftGoodsInfo.getGoodsId());
builder.setDynamicBuyTimes(giftGoodsInfo.getDynamicBuyTimes());
build.addGiftGoodsInfo(builder);
}else {
build.addGiftGoodsInfo(giftGoodsInfo);
}
});
combineList.add(build.build());
}else {
combineList.add(list.getLast());
}
}
return combineList;
});
@ -61,7 +91,7 @@ public class SimpleTransaction {
public void dealWhileCommit(TransTask transTask) {
if (transTask instanceof SendTask && combineMsgId.keySet().contains(((SendTask) transTask).getMsgId())) {
List<GeneratedMessage> linkedList = sendCacheMap.getOrDefault(((SendTask) transTask).getMsgId(), null);
LinkedList<GeneratedMessage> linkedList = sendCacheMap.getOrDefault(((SendTask) transTask).getMsgId(), null);
if (null == linkedList) {
linkedList = new LinkedList<>();
sendCacheMap.put(((SendTask) transTask).getMsgId(), linkedList);

View File

@ -66,7 +66,7 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
}else if(type == 6){
MapLogic.getInstance().startMainLevelFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
} else if(type == 7){
GuildFightLogic.startBossFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
GuildFightLogic.startBossFight(iSession, teamId,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else {
throw new ErrorCodeException(ErrorCode.newDefineCode("type is wrong:" + type));
}

View File

@ -110,7 +110,7 @@ public class UserManager {
teamPosManager.addTeamOfInitPlayer(teamHeros);
int force = HeroLogic.getInstance().calTeamTotalForce(user, 1, true);
playerManager.setMaxForce(force);
user.getExpeditionManager().setForceSnap(force);
// user.getExpeditionManager().setForceSnap(force);
KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
}

View File

@ -64,7 +64,6 @@ public class ExpeditionLogic {
//每日重置
public void flushUserdataEveryDay(User user) throws Exception {
ExpeditionManager manager = user.getExpeditionManager();
manager.setForceSnap(user.getPlayerInfoManager().getMaxForce());
takeAllReward(user);
manager.clearExpeditionNodeInfos();
manager.setLay(1);
@ -215,7 +214,7 @@ public class ExpeditionLogic {
}
int minFoce = sExpeditionSetting.getMatchForce()[0];
int manFoce = sExpeditionSetting.getMatchForce()[1];
int standerFoce = (int) (user.getExpeditionManager().getForceSnap() * (minFoce / 10000f) + nodeInfo.getLay() / size * (manFoce - minFoce));
int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * (minFoce / 10000f) + nodeInfo.getLay() / size * (manFoce - minFoce));
float randomForce = (standerFoce * ((sExpeditionSetting.getMatchForceRange()[0] + (int) (Math.random() * (sExpeditionSetting.getMatchForceRange()[1] - sExpeditionSetting.getMatchForceRange()[0]))) / 10000f));
if(nodeInfo.getType()==NODETYPE_ADVANCE){

View File

@ -1046,13 +1046,12 @@ public class GuildFightLogic {
}
public static void startBossFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
public static void startBossFight(ISession session,int teamId, MessageTypeProto.MessageType messageType) throws Exception {
if(curSGuildBossConfig == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int uid = session.getUid();
User user = UserManager.getUser(uid);
int teamId = GlobalsDef.GUILD_BOSS_TEAM;
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));

View File

@ -25,10 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.*;
public class MessageUtil {
@ -343,7 +340,7 @@ public class MessageUtil {
* @param list 移除被合并项
* @return 返回一个合并协议
*/
List<T> combine(List<T> list);
List<T> combine(LinkedList<T> list);
}
public static void checkAndSendMsg(){