back_recharge
parent
65d2d64219
commit
618a1903e1
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.handler.map;
|
|||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
|
@ -616,6 +617,55 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始战斗
|
||||
* @param session
|
||||
* @param messageType
|
||||
*/
|
||||
public void startFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("mapManager.getMapInfo() == null");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
if (cell == null) {
|
||||
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
if (cell == null) {
|
||||
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
int bigEventId = cell.getEventId();
|
||||
SEventPointConfig sEventPointConfig = SEventPointConfig.sEventPointConfigMap.get(bigEventId);
|
||||
if (sEventPointConfig == null) {
|
||||
LOGGER.info("sEventPointConfig == null");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
if (option == null) {
|
||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getFightInfo(user, option[0], fightStartResponse);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束战斗
|
||||
* @param session
|
||||
* @param result
|
||||
* @param messageType
|
||||
* @param monsterGroupId
|
||||
* @throws Exception
|
||||
*/
|
||||
public void endFight(ISession session, int result, MessageTypeProto.MessageType messageType, int monsterGroupId) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class StartFightRequestHandler extends BaseHandler{
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FIGHT_START_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
// FightInfoProto.FightStartRequest fightEndRequest = FightInfoProto.FightStartRequest.parseFrom(message);
|
||||
MapLogic.getInstance().startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -59,6 +59,7 @@ public class MissionLogic {
|
|||
.newBuilder()
|
||||
.setMissionStep(doingMission.getMissionStep())
|
||||
.setItemId(doingMission.getMissionId())
|
||||
.setIsOpen(doingMission.isOpen())
|
||||
.setState(states)
|
||||
.build();
|
||||
missionGetAllResponse.addMissions(mission);
|
||||
|
@ -69,6 +70,7 @@ public class MissionLogic {
|
|||
.newBuilder()
|
||||
.setMissionStep(sMissionEventsConfig.getMissionNum())
|
||||
.setItemId(finishMission)
|
||||
.setIsOpen(true)
|
||||
.setState("")
|
||||
.build();
|
||||
missionGetAllResponse.addMissions(mission);
|
||||
|
@ -111,6 +113,7 @@ public class MissionLogic {
|
|||
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
|
||||
finishMissions.add(mission.getMissionId());
|
||||
user.getMissionManager().updateFinishMissions(finishMissions);
|
||||
mission.setOpen(true);
|
||||
} else {
|
||||
user.getMissionManager().updateOneDoingMissions(mission.getMissionId(), mission);
|
||||
}
|
||||
|
@ -151,7 +154,7 @@ public class MissionLogic {
|
|||
Mission mission = doingMissions.get(missionId);
|
||||
mission.setOpen(true);
|
||||
user.getMissionManager().updateOneDoingMissions(missionId, mission);
|
||||
MessageUtil.sendErrorResponse(session, 1, messageType.getNumber(), "");
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue