爬塔副本
parent
9c4d61065b
commit
d9bf43b0d1
|
|
@ -1221,6 +1221,27 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTowerLeftTime(User user, boolean needResetMap) throws Exception {
|
||||||
|
int curMapId = user.getMapManager().getTower();
|
||||||
|
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(curMapId);
|
||||||
|
if (sTrialConfig == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(sTrialConfig.getMapId());
|
||||||
|
long startExporeTime = user.getMapManager().getStartExporeTime();
|
||||||
|
if (sChallengeConfig == null || startExporeTime == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int useTime = (int) ((TimeUtils.now() - startExporeTime) / 1000);
|
||||||
|
if (needResetMap && useTime >= sChallengeConfig.getMapTime()) {
|
||||||
|
resetMapInfo(user, false);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return sChallengeConfig.getMapTime() - useTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int getUseTime(User user) throws Exception {
|
public int getUseTime(User user) throws Exception {
|
||||||
long startExporeTime = user.getMapManager().getStartExporeTime();
|
long startExporeTime = user.getMapManager().getStartExporeTime();
|
||||||
if (startExporeTime == 0) {
|
if (startExporeTime == 0) {
|
||||||
|
|
@ -1916,6 +1937,7 @@ public class MapLogic {
|
||||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||||
mapEnterResponse.setEssenceValue(mapManager.getEssenceValue());
|
mapEnterResponse.setEssenceValue(mapManager.getEssenceValue());
|
||||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||||
|
mapEnterResponse.setLeftTime(getTowerLeftTime(user, false));
|
||||||
if (mapManager.getTemporaryItems() != null) {
|
if (mapManager.getTemporaryItems() != null) {
|
||||||
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||||
}
|
}
|
||||||
|
|
@ -2021,7 +2043,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 开始战斗
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
|
@ -2030,7 +2052,7 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 结束战斗
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
|
|
@ -2063,8 +2085,18 @@ public class MapLogic {
|
||||||
* @param iSession
|
* @param iSession
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
public void outTowerCopy(ISession iSession, MessageTypeProto.MessageType messageType) {
|
public void outTowerCopy(ISession iSession, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
mapManager.setEssenceValue(0);
|
||||||
|
resetMapInfo(user, true);
|
||||||
|
MapInfoProto.MapTowerResetResponse mapTowerResetResponse = MapInfoProto.MapTowerResetResponse
|
||||||
|
.newBuilder()
|
||||||
|
.setResetCount(mapManager.getResetCount())
|
||||||
|
.setTower(1)
|
||||||
|
.build();
|
||||||
|
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapTowerResetResponse, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2091,7 +2123,7 @@ public class MapLogic {
|
||||||
.setResetCount(mapManager.getResetCount())
|
.setResetCount(mapManager.getResetCount())
|
||||||
.setTower(1)
|
.setTower(1)
|
||||||
.build();
|
.build();
|
||||||
MessageUtil.sendMessage(uid, 1, messageType.getNumber(), mapTowerResetResponse, true);
|
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapTowerResetResponse, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue