副本扫荡,购买挑战次数,获取排行榜
parent
af186980d4
commit
d89b59021f
|
@ -21,6 +21,12 @@ public class SChallengeMapConfig implements BaseConfig{
|
|||
|
||||
private int[] size;
|
||||
|
||||
private int refresh;
|
||||
|
||||
private int ifRank;
|
||||
|
||||
private int[] sweepingAward;
|
||||
|
||||
public int getMapId() {
|
||||
return mapId;
|
||||
}
|
||||
|
@ -32,4 +38,16 @@ public class SChallengeMapConfig implements BaseConfig{
|
|||
public int[] getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public int getRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public int getIfRank() {
|
||||
return ifRank;
|
||||
}
|
||||
|
||||
public int[] getSweepingAward() {
|
||||
return sweepingAward;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "ChallengeSetting")
|
||||
public class SChallengeSetting implements BaseConfig{
|
||||
|
||||
public static SChallengeSetting challengeSetting;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SChallengeSetting> SChallengeSetting = STableManager.getConfig(SChallengeSetting.class);
|
||||
for (SChallengeSetting sChallengeSetting : SChallengeSetting.values()) {
|
||||
challengeSetting = sChallengeSetting;
|
||||
}
|
||||
}
|
||||
|
||||
private int id;
|
||||
|
||||
private int limit;
|
||||
|
||||
private int item;
|
||||
|
||||
private int[] cost;
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public int[] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getItem() {
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,11 @@ public class RedisKey {
|
|||
|
||||
public static final String UNDERLINE_LINE = "_";
|
||||
|
||||
/**
|
||||
* 副本竞速排行榜
|
||||
*/
|
||||
public static final String MAP_RANK = "MAP_RANK_";
|
||||
|
||||
/**
|
||||
* 最近登录服务器列表
|
||||
*/
|
||||
|
|
|
@ -683,6 +683,28 @@ public class RedisUtil {
|
|||
}
|
||||
}
|
||||
|
||||
//操作sortset
|
||||
public void zsetAddOne(String key, String uid, int useTime){
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
redisTemplate.opsForZSet().add(key, uid, useTime);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
TimeUtils.sleep(FAILED_SLEEP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//操作sortset
|
||||
public int getZsetSize(String key){
|
||||
try {
|
||||
return redisTemplate.opsForZSet().size(key).intValue();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getZset(String key,double min,double max){
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class CrossInfo {
|
||||
|
||||
private Set<Integer> stars;
|
||||
private Set<Integer> stars = new HashSet<>(3);
|
||||
|
||||
private int leastTime;
|
||||
private int leastTime = 100000;
|
||||
|
||||
private Set<Integer> heroIds = new HashSet<>(5);
|
||||
|
||||
private long sendRewardTime;
|
||||
|
||||
private int forces;
|
||||
|
||||
|
||||
public Set<Integer> getStars() {
|
||||
return stars;
|
||||
}
|
||||
|
||||
public void setStars(Set<Integer> stars) {
|
||||
this.stars = stars;
|
||||
}
|
||||
|
||||
public int getLeastTime() {
|
||||
return leastTime;
|
||||
}
|
||||
|
@ -34,4 +35,16 @@ public class CrossInfo {
|
|||
public void setSendRewardTime(long sendRewardTime) {
|
||||
this.sendRewardTime = sendRewardTime;
|
||||
}
|
||||
|
||||
public Set<Integer> getHeroIds() {
|
||||
return heroIds;
|
||||
}
|
||||
|
||||
public int getForces() {
|
||||
return forces;
|
||||
}
|
||||
|
||||
public void setForces(int forces) {
|
||||
this.forces = forces;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
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.MessageTypeProto;
|
||||
|
||||
public class MapFightEndRequestHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FIGHT_END_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
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.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MapGetRankInfoRequestHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_GET_RANK_INFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapGetRankInfoRequest mapGetRankInfoRequest = MapInfoProto.MapGetRankInfoRequest.parseFrom(message);
|
||||
int mapId = mapGetRankInfoRequest.getMapId();
|
||||
MapLogic.getInstance().getMapRank(iSession, mapId, MessageTypeProto.MessageType.MAP_GET_RANK_INFO_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,10 @@ public class MapLogic {
|
|||
|
||||
private Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||
|
||||
private static final int STAR_1 = 1; // 完成任务
|
||||
private static final int STAR_2 = 2; // 时间小于指定时间
|
||||
private static final int STAR_3 = 3; // 100% 探索度
|
||||
|
||||
public void init(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
Map<String, BaseBehavior> beansOfType = configurableApplicationContext.getBeansOfType(BaseBehavior.class);
|
||||
for (BaseBehavior baseBehavior : beansOfType.values()) {
|
||||
|
@ -126,20 +130,22 @@ public class MapLogic {
|
|||
// }
|
||||
// }
|
||||
// }
|
||||
if (user.getPlayerInfoManager().getMapId() < mapId) {
|
||||
user.getPlayerInfoManager().setMapId(mapId);
|
||||
}
|
||||
if (mapId > user.getPlayerInfoManager().getMapId()) {
|
||||
LOGGER.info("enterMap() uid=>{} mapManager.getMaxMapId()=>{} mapId =>{} ", uid, user.getPlayerInfoManager().getMapId(), mapId);
|
||||
SChallengeSetting sChallengeSetting = SChallengeSetting.challengeSetting;
|
||||
if (mapManager.getDayFightCount() > sChallengeSetting.getLimit()) {
|
||||
LOGGER.info("enterMap() uid=>{} max fight count =>{} ", uid, mapManager.getDayFightCount());
|
||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
if (user.getPlayerInfoManager().getMapId() < mapId) {
|
||||
user.getPlayerInfoManager().setMapId(mapId);
|
||||
}
|
||||
String error = initTeamInfo(teamId, uid, user, mapManager);
|
||||
if (!error.isEmpty()){
|
||||
LOGGER.info("enterMap() uid=>{} error =>{} ", uid, error);
|
||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
mapManager.setDayFightCount(mapManager.getDayFightCount() + 1);
|
||||
mapManager.setCurMapId(mapId);
|
||||
initMap(mapManager, user);
|
||||
user.setMapManager(mapManager);
|
||||
|
@ -520,7 +526,15 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
updateMapMission(mapManager,EventType.updateEvent, targetEventId,0);
|
||||
updateMapMission(mapManager,EventType.updateEvent, pointId,0);
|
||||
int totalWeight = updateMapMission(mapManager,EventType.updateEvent, pointId,0);
|
||||
if (totalWeight >= 100) {
|
||||
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapManager.getCurMapId());
|
||||
if (crossInfo == null) {
|
||||
crossInfo = new CrossInfo();
|
||||
}
|
||||
crossInfo.getStars().add(STAR_3);
|
||||
mapManager.updateCrossInfoMap(mapManager.getCurMapId(), crossInfo);
|
||||
}
|
||||
CommonProto.Drop.Builder dropBuilder = null;
|
||||
if (sOptionConfig.getReward().length > 0) {
|
||||
dropBuilder = ItemUtil.drop(user, sOptionConfig.getReward(), 1, 1);
|
||||
|
@ -715,6 +729,7 @@ public class MapLogic {
|
|||
public void resetMapInfo(User user, boolean needTemporaryItem) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
mapManager.setMapMissionProgres(null);
|
||||
mapManager.setMission(null);
|
||||
mapManager.setMapInfo(new HashMap<>());
|
||||
mapManager.setTypeEight(new HashMap<>());
|
||||
mapManager.setWalkCells(new HashSet<>());
|
||||
|
@ -955,14 +970,14 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
public void updateMapMission(MapManager mapManager,int eventType,int eventId,int bossIdOrItemId){
|
||||
public int updateMapMission(MapManager mapManager,int eventType,int eventId,int bossIdOrItemId){
|
||||
int mapId = mapManager.getCurMapId();
|
||||
if(mapId==0){
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
MapMission mapMission = mapManager.getMapMissionProgres();
|
||||
if(mapMission == null){
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
int addScore=0;
|
||||
Map<Integer, Integer> allMissionProgress = mapMission.getAllMissionProgress();
|
||||
|
@ -1073,6 +1088,7 @@ public class MapLogic {
|
|||
if(needUpdate){
|
||||
mapMission.setAllMissionProgress(allMissionProgress);
|
||||
}
|
||||
return mapMission.getTotalWeight();
|
||||
}
|
||||
|
||||
public int getLeftTime(User user) throws Exception {
|
||||
|
@ -1099,7 +1115,9 @@ public class MapLogic {
|
|||
return useTime;
|
||||
}
|
||||
|
||||
public CheckMissionReturn checkMission(Mission mission, User user) throws Exception {
|
||||
public CheckMissionReturn checkMission(User user) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
Mission mission = user.getMapManager().getMission();
|
||||
if (mission.getTime() > 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1113,13 +1131,86 @@ public class MapLogic {
|
|||
int[] reward = {sMissionEventsConfig.getReward()};
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, 1, 0);
|
||||
checkMissionReturn.drop = drop;
|
||||
mission.setTime(getUseTime(user));
|
||||
int useTime = getUseTime(user);
|
||||
mission.setTime(useTime);
|
||||
CrossInfo crossInfo = user.getMapManager().getCrossInfoMap().get(mapManager.getCurMapId());
|
||||
if (crossInfo == null) {
|
||||
crossInfo = new CrossInfo();
|
||||
}
|
||||
user.getMapManager().setMission(mission);
|
||||
crossInfo.getStars().add(STAR_1);
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
if (useTime > 0 && useTime <= sChallengeConfig.getMapTime()) {
|
||||
crossInfo.getStars().add(STAR_2);
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
int heroForces = 0;
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
heroForces += HeroLogic.getInstance().calHeoForce(user, hero);
|
||||
crossInfo.getHeroIds().add(hero.getTemplateId());
|
||||
}
|
||||
crossInfo.setForces(heroForces);
|
||||
}
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
|
||||
if (sChallengeMapConfig.getIfRank() == 1 && useTime > 0 && useTime < crossInfo.getLeastTime()) {
|
||||
crossInfo.setLeastTime(useTime);
|
||||
String key = RedisKey.getKey(RedisKey.MAP_RANK, Integer.toString(mapManager.getCurMapId()), true);
|
||||
RedisUtil.getInstence().zsetAddOne(key, mapManager.getRootId(), useTime);
|
||||
int zsetSize = RedisUtil.getInstence().getZsetSize(key);
|
||||
if (zsetSize > 10) {
|
||||
// TODO 删除最后一名
|
||||
RedisUtil.getInstence().removeZSetRange(key, 1);
|
||||
}
|
||||
}
|
||||
mapManager.updateCrossInfoMap(mapManager.getCurMapId(), crossInfo);
|
||||
}
|
||||
mapManager.setMission(mission);
|
||||
checkMissionReturn.mission = mission;
|
||||
return checkMissionReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取竞速排行榜
|
||||
* @param session
|
||||
* @param mapId
|
||||
* @param messageType
|
||||
*/
|
||||
public void getMapRank(ISession session, int mapId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
String key = RedisKey.getKey(RedisKey.MAP_RANK, Integer.toString(mapId), true);
|
||||
Set<String> zset = RedisUtil.getInstence().getZset(key, 0, -1);
|
||||
List<MapInfoProto.MapRankInfo> mapRankInfos = new ArrayList<>(10);
|
||||
int rank = 1;
|
||||
for (String s : zset) {
|
||||
User user = UserManager.getUser(Integer.parseInt(s));
|
||||
if (user == null) {
|
||||
continue;
|
||||
}
|
||||
CrossInfo crossInfo = user.getMapManager().getCrossInfoMap().get(mapId);
|
||||
if (crossInfo == null) {
|
||||
continue;
|
||||
}
|
||||
MapInfoProto.MapRankInfo mapRankInfo = MapInfoProto.MapRankInfo
|
||||
.newBuilder()
|
||||
.setUid(Integer.parseInt(s))
|
||||
.setForces(crossInfo.getForces())
|
||||
.addAllHeroIds(crossInfo.getHeroIds())
|
||||
.setHead(user.getPlayerInfoManager().getHead())
|
||||
.setLevel(user.getPlayerInfoManager().getLevel())
|
||||
.setTime(crossInfo.getLeastTime())
|
||||
.setName(user.getPlayerInfoManager().getNickName())
|
||||
.setRank(rank)
|
||||
.build();
|
||||
mapRankInfos.add(mapRankInfo);
|
||||
rank++;
|
||||
}
|
||||
MapInfoProto.MapGetRankInfoResponse mapGetRankInfoResponse = MapInfoProto.MapGetRankInfoResponse.newBuilder()
|
||||
.addAllMapRankInfo(mapRankInfos)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapGetRankInfoResponse, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始探索(开始计时)
|
||||
* @param session
|
||||
|
@ -1146,6 +1237,83 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapStartExploreResponse, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买战斗次数
|
||||
* @param session
|
||||
* @param buyCount
|
||||
* @param messageType
|
||||
*/
|
||||
public void buyFightCount(ISession session, int buyCount, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
if (buyCount <= 0 || buyCount>= 100) {
|
||||
buyCount = 1;
|
||||
}
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
SChallengeSetting sChallengeSetting = SChallengeSetting.challengeSetting;
|
||||
if (mapManager.getBuyFightCount() + buyCount > sChallengeSetting.getLimit()) {
|
||||
LOGGER.info("buyFightCount over max count: {}", (mapManager.getBuyFightCount() + buyCount));
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
int needGem = 0;
|
||||
for (int i = 1; i < buyCount; i++) {
|
||||
mapManager.setBuyFightCount(mapManager.getBuyFightCount() + 1);
|
||||
needGem += MathUtils.calABX(mapManager.getBuyFightCount(), sChallengeSetting.getCost());
|
||||
}
|
||||
int[][] itemCost = {{sChallengeSetting.getItem(),needGem}};
|
||||
boolean b = ItemUtil.itemCost(user, itemCost);
|
||||
if (!b) {
|
||||
LOGGER.info("buyFightCount item not enough");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫荡副本
|
||||
* @param session
|
||||
* @param count
|
||||
* @param messageType
|
||||
*/
|
||||
public void sweep(ISession session, int mapId, int count, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
if (count <= 0 || count>= 100) {
|
||||
count = 1;
|
||||
}
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapId);
|
||||
if (crossInfo == null) {
|
||||
LOGGER.info("sweep 未三星通关");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
if (crossInfo.getStars().size() != 3) {
|
||||
LOGGER.info("sweep 未三星通关");
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
SChallengeSetting sChallengeSetting = SChallengeSetting.challengeSetting;
|
||||
if (mapManager.getDayFightCount() + count > sChallengeSetting.getLimit()) {
|
||||
LOGGER.info("sweep over max count: {}", (mapManager.getBuyFightCount() + count));
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
mapManager.setDayFightCount(mapManager.getDayFightCount() + count);
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId);
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
for (int i = 0; i < count; i++) {
|
||||
ItemUtil.activityDrop(user, dropBuilder, sChallengeMapConfig.getSweepingAward(), 1);
|
||||
}
|
||||
MapInfoProto.MapSweepResponse mapSweepResponse = MapInfoProto.MapSweepResponse
|
||||
.newBuilder()
|
||||
.setDrop(dropBuilder)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapSweepResponse, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有关卡信息
|
||||
|
|
|
@ -54,6 +54,12 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private int dieCount;
|
||||
|
||||
private Map<Integer, CrossInfo> crossInfoMap = new HashMap<>();
|
||||
|
||||
private int dayFightCount;
|
||||
|
||||
private int buyFightCount;
|
||||
|
||||
public MapManager() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -296,4 +302,31 @@ public class MapManager extends MongoBase {
|
|||
this.mapMissionProgres = mapMissionProgres;
|
||||
updateString("mapMissionProgres", mapMissionProgres);
|
||||
}
|
||||
|
||||
public Map<Integer, CrossInfo> getCrossInfoMap() {
|
||||
return crossInfoMap;
|
||||
}
|
||||
|
||||
public void updateCrossInfoMap(int key, CrossInfo crossInfo) {
|
||||
updateString("crossInfoMap." + key, crossInfo);
|
||||
this.crossInfoMap.put(key, crossInfo);
|
||||
}
|
||||
|
||||
public int getDayFightCount() {
|
||||
return dayFightCount;
|
||||
}
|
||||
|
||||
public void setDayFightCount(int dayFightCount) {
|
||||
updateString("dayFightCount", dayFightCount);
|
||||
this.dayFightCount = dayFightCount;
|
||||
}
|
||||
|
||||
public int getBuyFightCount() {
|
||||
return buyFightCount;
|
||||
}
|
||||
|
||||
public void setBuyFightCount(int buyFightCount) {
|
||||
updateString("buyFightCount", buyFightCount);
|
||||
this.buyFightCount = buyFightCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MapSweepRequestHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.MAP_SWEEP_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapSweepRequest mapEnterRequest = MapInfoProto.MapSweepRequest.parseFrom(message);
|
||||
MapLogic.getInstance().sweep(iSession, mapEnterRequest.getMapId(), mapEnterRequest.getSweepCount(), MessageTypeProto.MessageType.MAP_SWEEP_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -28,6 +28,8 @@ public class CBean2Proto {
|
|||
.setEnergy(0)
|
||||
.setLastUpdateEnergyTime(mapManager.getLastUpdateEnergyTime())
|
||||
.setServerTime((int)(System.currentTimeMillis()/1000))
|
||||
.setBuyFightCount(mapManager.getBuyFightCount())
|
||||
.setDayFightCount(mapManager.getDayFightCount())
|
||||
.build();
|
||||
return player;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue