爬塔商店修改
parent
8698f042f1
commit
02124be971
|
|
@ -14,7 +14,6 @@ import com.ljsd.jieling.handler.mission.Mission;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
|
|
@ -77,6 +76,7 @@ public class MapLogic {
|
||||||
int uid = iSession.getUid();
|
int uid = iSession.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
|
mapManager.setStartExporeTime(0);
|
||||||
if (teamId == 0) {
|
if (teamId == 0) {
|
||||||
LOGGER.info("enterMap() uid=>{} teamId =>{} ", uid, teamId);
|
LOGGER.info("enterMap() uid=>{} teamId =>{} ", uid, teamId);
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||||
|
|
@ -239,8 +239,8 @@ public class MapLogic {
|
||||||
buffers.add(CBean2Proto.getTowerBuff(buff));
|
buffers.add(CBean2Proto.getTowerBuff(buff));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// mapManager.setStartExporeTime(System.currentTimeMillis());
|
mapManager.setCurrTowerTime(TimeUtils.now());
|
||||||
mapEnterResponse.addAllBuf(buffers);
|
//mapEnterResponse.addAllBuf(buffers);
|
||||||
LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
|
LOGGER.info("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
|
||||||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
@ -550,17 +550,8 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int behaviorType = sOptionConfig.getBehaviorType();
|
int behaviorType = sOptionConfig.getBehaviorType();
|
||||||
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
|
|
||||||
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
||||||
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||||
if (baseBehavior != null) {
|
|
||||||
boolean isSuccess = baseBehavior.process(optionId, user, behaviorTypeValues, eventUpdateResponse);
|
|
||||||
if (!isSuccess) {
|
|
||||||
LOGGER.info("updatePonintEvent() baseBehavior process fail! behaviorType=>{}", behaviorType);
|
|
||||||
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mapPointConfig.getTriggerRules() == 1) {
|
if (mapPointConfig.getTriggerRules() == 1) {
|
||||||
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -584,20 +575,11 @@ public class MapLogic {
|
||||||
if (sOptionConfig.getReward().length > 0) {
|
if (sOptionConfig.getReward().length > 0) {
|
||||||
dropBuilder = ItemUtil.drop(user, sOptionConfig.getReward(), 1, 1, BIReason.MAP_EVENET_REWARD);
|
dropBuilder = ItemUtil.drop(user, sOptionConfig.getReward(), 1, 1, BIReason.MAP_EVENET_REWARD);
|
||||||
}
|
}
|
||||||
List<CommonProto.EventBehaviorValues> eventBehaviorValuesList = new ArrayList<>();
|
CommonProto.EventBehaviorCommon.Builder eventBehaviorCommon = behaviorBuild(user, optionId);
|
||||||
for (int i = 0; i < sOptionConfig.getBehaviorTypeValues().length; i++) {
|
if(eventBehaviorCommon==null){
|
||||||
CommonProto.EventBehaviorValues.Builder eventBehaviorValues = CommonProto.EventBehaviorValues
|
eventBehaviorCommon = CommonProto.EventBehaviorCommon.newBuilder();
|
||||||
.newBuilder();
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"消息错误");
|
||||||
for (int j = 0; j < sOptionConfig.getBehaviorTypeValues()[i].length; j++) {
|
|
||||||
eventBehaviorValues.addBehaviorValues(sOptionConfig.getBehaviorTypeValues()[i][j]);
|
|
||||||
}
|
|
||||||
eventBehaviorValuesList.add(eventBehaviorValues.build());
|
|
||||||
}
|
}
|
||||||
CommonProto.EventBehaviorCommon eventBehaviorCommon = CommonProto.EventBehaviorCommon
|
|
||||||
.newBuilder()
|
|
||||||
.setBehaviorType(sOptionConfig.getBehaviorType())
|
|
||||||
.addAllEventBehaviorValues(eventBehaviorValuesList)
|
|
||||||
.build();
|
|
||||||
eventUpdateResponse.setEventBehaviorCommon(eventBehaviorCommon);
|
eventUpdateResponse.setEventBehaviorCommon(eventBehaviorCommon);
|
||||||
eventUpdateResponse.setEventId(nextEventId);
|
eventUpdateResponse.setEventId(nextEventId);
|
||||||
eventUpdateResponse.setLeftTime(getLeftTime(user, true));
|
eventUpdateResponse.setLeftTime(getLeftTime(user, true));
|
||||||
|
|
@ -809,11 +791,11 @@ public class MapLogic {
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
SChallengeConfig challengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
SChallengeConfig challengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||||
if(challengeConfig.getType()==2){
|
if(challengeConfig.getType()==2){
|
||||||
int time = (int)((System.currentTimeMillis()-mapManager.getStartExporeTime())/1000);
|
// int time = (int)((System.currentTimeMillis()-mapManager.getStartExporeTime())/1000);
|
||||||
mapManager.setCurrTowerTime(time);
|
// mapManager.setCurrTowerTime(time);
|
||||||
if(mapManager.getEveryTowerTime()!=null&&mapManager.getEveryTowerTime().get(mapManager.getTower())!=null){
|
// if(mapManager.getEveryTowerTime()!=null&&mapManager.getEveryTowerTime().get(mapManager.getTower())!=null){
|
||||||
mapManager.setTowerTimeByTower(mapManager.getTower(),time);
|
// mapManager.setTowerTimeByTower(mapManager.getTower(),time);
|
||||||
}
|
// }
|
||||||
if(mapManager.getTower()>=1){
|
if(mapManager.getTower()>=1){
|
||||||
mapManager.setMapIntoFlag(1);
|
mapManager.setMapIntoFlag(1);
|
||||||
}
|
}
|
||||||
|
|
@ -828,8 +810,9 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapInfoProto.MapOutResponse.Builder builder = MapInfoProto.MapOutResponse.newBuilder();
|
MapInfoProto.MapOutResponse.Builder builder = MapInfoProto.MapOutResponse.newBuilder();
|
||||||
builder.setUseTime(mapManager.getCurrTowerTime());
|
int time = (int) (TimeUtils.now()-mapManager.getCurrTowerTime())/1000;
|
||||||
LOGGER.info("当前层使用时间{}"+mapManager.getCurrTowerTime());
|
builder.setUseTime(time);
|
||||||
|
LOGGER.info("当前层使用时间{}",time);
|
||||||
if(mapManager.getTower()>mapManager.getHighestTower()){
|
if(mapManager.getTower()>mapManager.getHighestTower()){
|
||||||
mapManager.setHighestTower(mapManager.getTower());
|
mapManager.setHighestTower(mapManager.getTower());
|
||||||
}
|
}
|
||||||
|
|
@ -1245,9 +1228,8 @@ public class MapLogic {
|
||||||
if (monsterGroupId == mapManager.getSuddenlyBoss()) {
|
if (monsterGroupId == mapManager.getSuddenlyBoss()) {
|
||||||
mapManager.findSuddenlyBoss(0, 0);
|
mapManager.findSuddenlyBoss(0, 0);
|
||||||
}
|
}
|
||||||
// if(mapManager.getBossType()==1)
|
|
||||||
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||||
fightEndResponse.setLastTowerTime(mapManager.getCurrTowerTime());
|
fightEndResponse.setLastTowerTime((int)(TimeUtils.now()-mapManager.getCurrTowerTime())/1000);
|
||||||
}else{
|
}else{
|
||||||
fightEndResponse.setLastTowerTime(0);
|
fightEndResponse.setLastTowerTime(0);
|
||||||
}
|
}
|
||||||
|
|
@ -1564,7 +1546,7 @@ public class MapLogic {
|
||||||
.setMapIntoReset(mapManager.getMapIntoFlag())
|
.setMapIntoReset(mapManager.getMapIntoFlag())
|
||||||
.build();
|
.build();
|
||||||
builder.setTowerCopyInfo(towerCopyInfo);
|
builder.setTowerCopyInfo(towerCopyInfo);
|
||||||
LOGGER.info("关卡信息{}"+towerCopyInfo.toString());
|
LOGGER.info("关卡信息{}",towerCopyInfo.toString());
|
||||||
MessageUtil.sendMessage(iSession, 1, msgId, builder.build(), true);
|
MessageUtil.sendMessage(iSession, 1, msgId, builder.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2084,6 +2066,8 @@ public class MapLogic {
|
||||||
type = 2;
|
type = 2;
|
||||||
}else if(mapManager.getTower()==2){
|
}else if(mapManager.getTower()==2){
|
||||||
type = 4;
|
type = 4;
|
||||||
|
}else if(mapManager.getTower()==3||mapManager.getTower()==4){
|
||||||
|
type = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2176,7 +2160,7 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean isUse = ItemUtil.itemCost(user,bomb,BIReason.BOMB_CONSUME,mapManager.getCurMapId());
|
boolean isUse = ItemUtil.itemCost(user,bomb,BIReason.BOMB_CONSUME,mapManager.getCurMapId());
|
||||||
if(isUse){
|
if(!isUse){
|
||||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"无炸弹");
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"无炸弹");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2282,19 +2266,58 @@ public class MapLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),err);
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int mapPointId = mapManager.getTowerUnusedBuffer().get(towerLevel);
|
User user = UserManager.getUser(uid);
|
||||||
mapManager.consunmeTowerBuffer(towerLevel);
|
mapManager.consunmeTowerBuffer(towerLevel);
|
||||||
int buffId = SOptionConfig.sOptionConfigMap.get(optionId).getBehaviorTypeValues()[0][0];
|
|
||||||
LOGGER.info("使用第{},mapPointId,id是:{}",towerLevel,mapPointId);
|
|
||||||
CombatLogic.getInstance().bufferAddByEatFoodOrEventTrigger(mapManager,buffId);
|
|
||||||
LOGGER.info("使用第"+towerLevel+"层buff,id是:"+buffId);
|
|
||||||
MapInfoProto.UseTowerBuffResponse.Builder useTowerBuffResponse = MapInfoProto.UseTowerBuffResponse.newBuilder();
|
MapInfoProto.UseTowerBuffResponse.Builder useTowerBuffResponse = MapInfoProto.UseTowerBuffResponse.newBuilder();
|
||||||
useTowerBuffResponse.setBuffId(buffId);
|
CommonProto.EventBehaviorCommon.Builder eventBehaviorCommon = behaviorBuild(user, optionId);
|
||||||
|
if(eventBehaviorCommon==null){
|
||||||
|
useTowerBuffResponse = MapInfoProto.UseTowerBuffResponse.newBuilder();
|
||||||
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"使用错误");
|
||||||
|
}
|
||||||
|
useTowerBuffResponse.setEventBehaviorCommon(eventBehaviorCommon);
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),useTowerBuffResponse.build(),true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),useTowerBuffResponse.build(),true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型构造
|
||||||
|
* @param user
|
||||||
|
* @param optionId
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private CommonProto.EventBehaviorCommon.Builder behaviorBuild(User user,int optionId) throws Exception {
|
||||||
|
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||||
|
int behaviorType = sOptionConfig.getBehaviorType();
|
||||||
|
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
|
||||||
|
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
|
||||||
|
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
|
||||||
|
if (baseBehavior != null) {
|
||||||
|
boolean isSuccess = baseBehavior.process(optionId, user, behaviorTypeValues, eventUpdateResponse);
|
||||||
|
if (!isSuccess) {
|
||||||
|
LOGGER.info("updatePonintEvent() baseBehavior process fail! behaviorType=>{}", behaviorType);
|
||||||
|
// MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<CommonProto.EventBehaviorValues> eventBehaviorValuesList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < sOptionConfig.getBehaviorTypeValues().length; i++) {
|
||||||
|
CommonProto.EventBehaviorValues.Builder eventBehaviorValues = CommonProto.EventBehaviorValues
|
||||||
|
.newBuilder();
|
||||||
|
for (int j = 0; j < sOptionConfig.getBehaviorTypeValues()[i].length; j++) {
|
||||||
|
eventBehaviorValues.addBehaviorValues(sOptionConfig.getBehaviorTypeValues()[i][j]);
|
||||||
|
}
|
||||||
|
eventBehaviorValuesList.add(eventBehaviorValues.build());
|
||||||
|
}
|
||||||
|
CommonProto.EventBehaviorCommon.Builder eventBehaviorCommon = CommonProto.EventBehaviorCommon
|
||||||
|
.newBuilder()
|
||||||
|
.setBehaviorType(sOptionConfig.getBehaviorType())
|
||||||
|
.addAllEventBehaviorValues(eventBehaviorValuesList);
|
||||||
|
return eventBehaviorCommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private String checkUseTowerBuff(MapManager mapManager,int towerLevel,int optionId){
|
private String checkUseTowerBuff(MapManager mapManager,int towerLevel,int optionId){
|
||||||
if(!mapManager.getTowerUnusedBuffer().containsKey(towerLevel)){
|
if(!mapManager.getTowerUnusedBuffer().containsKey(towerLevel)){
|
||||||
return "使用错误,当前层不存在buff";
|
return "使用错误,当前层不存在buff";
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,8 @@ public class MapManager extends MongoBase {
|
||||||
private int bossType;
|
private int bossType;
|
||||||
//每层最快时间
|
//每层最快时间
|
||||||
private Map<Integer,Integer> everyTowerTime;
|
private Map<Integer,Integer> everyTowerTime;
|
||||||
//当前层使用时间
|
//当前层开始时间
|
||||||
private int currTowerTime;
|
private long currTowerTime;
|
||||||
|
|
||||||
private int mapIntoFlag;
|
private int mapIntoFlag;
|
||||||
|
|
||||||
|
|
@ -530,11 +530,11 @@ public class MapManager extends MongoBase {
|
||||||
this.bossType = bossType;
|
this.bossType = bossType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrTowerTime() {
|
public long getCurrTowerTime() {
|
||||||
return currTowerTime;
|
return currTowerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrTowerTime(int currTowerTime) {
|
public void setCurrTowerTime(long currTowerTime) {
|
||||||
updateString("currTowerTime",currTowerTime);
|
updateString("currTowerTime",currTowerTime);
|
||||||
this.currTowerTime = currTowerTime;
|
this.currTowerTime = currTowerTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public class FourtyThreeBehavior extends BaseBehavior{
|
||||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||||
LOGGER.info("43协议");
|
LOGGER.info("43协议");
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
if(mapManager.getTriggerXY()!=mapManager.getBossXY()){
|
if(mapManager.getBossXY()!=0&&mapManager.getTriggerXY()!=mapManager.getBossXY()){
|
||||||
LOGGER.info("错误");
|
LOGGER.info("错误");
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.ljsd.jieling.handler.map.MapManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
|
import com.ljsd.jieling.util.TimeUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|
@ -31,6 +32,7 @@ public class FourtyTwoBehavior extends BaseBehavior{
|
||||||
mapManager.removeBoss();
|
mapManager.removeBoss();
|
||||||
mapManager.setTower(mapManager.getTower()+1);
|
mapManager.setTower(mapManager.getTower()+1);
|
||||||
mapManager.setEssenceValue(0);
|
mapManager.setEssenceValue(0);
|
||||||
|
mapManager.setCurrTowerTime(TimeUtils.now());
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL,mapManager.getTower());
|
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL,mapManager.getTower());
|
||||||
MapLogic.getInstance().initTrialMap(mapManager, user);
|
MapLogic.getInstance().initTrialMap(mapManager, user);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue