From 2aa329e4d69fa4ccd0c1473304e6de0d47a5240e Mon Sep 17 00:00:00 2001 From: gaojie Date: Fri, 21 Jun 2019 15:07:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=81=8A=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ljsd/jieling/chat/logic/ChatLogic.java | 6 ++++++ .../java/com/ljsd/jieling/chat/messge/MessageCache.java | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java index 80af804bc..99ca30a34 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/logic/ChatLogic.java @@ -14,6 +14,7 @@ import com.ljsd.jieling.protocols.ChatProto; import com.ljsd.jieling.protocols.MessageTypeProto; import com.ljsd.jieling.util.CBean2Proto; import com.ljsd.jieling.util.MessageUtil; +import com.ljsd.jieling.util.ShieldedWordUtils; import java.util.ArrayList; import java.util.List; @@ -87,6 +88,11 @@ public class ChatLogic { int uid = iSession.getUid(); User user = UserManager.getUser(uid); FriendManager friendManager = user.getFriendManager(); + boolean result = ShieldedWordUtils.checkName(message); + if (!result) { + MessageUtil.sendErrorResponse(iSession, 0, msgId, ""); + return ; + } long nowTime = System.currentTimeMillis(); switch (chatType){ case 1: //世界 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java index aca166cbf..54afc6926 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/chat/messge/MessageCache.java @@ -1,12 +1,9 @@ package com.ljsd.jieling.chat.messge; -import com.ljsd.GameApplication; -import com.ljsd.jieling.db.redis.RedisKey; -import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.protocols.ChatProto; public class MessageCache { - private static final int capuatiy =20; + private static final int capuatiy =200; private static final int msgInterval = 24*3600*1000; private static final int perCaught= 20; From fa7c397e5dd461021e736c19ed5b9658ecbb9efe Mon Sep 17 00:00:00 2001 From: jiahuiwen <1024696487@qq.com> Date: Fri, 21 Jun 2019 17:33:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=A2=86=E5=8F=96=E5=89=AF=E6=9C=AC?= =?UTF-8?q?=E6=98=9F=E7=BA=A7=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/config/SChallengeStarBox.java | 35 ++++ .../ljsd/jieling/handler/map/MapLogic.java | 161 ++++++++++++++++++ .../ljsd/jieling/handler/map/MapManager.java | 46 +++++ 3 files changed, 242 insertions(+) create mode 100644 serverlogic/src/main/java/com/ljsd/jieling/config/SChallengeStarBox.java diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SChallengeStarBox.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SChallengeStarBox.java new file mode 100644 index 000000000..ed52a5108 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SChallengeStarBox.java @@ -0,0 +1,35 @@ +package com.ljsd.jieling.config; + +import com.ljsd.jieling.logic.STableManager; +import com.ljsd.jieling.logic.Table; + +import java.util.Map; + +@Table(name = "ChallengeStarBox") +public class SChallengeStarBox implements BaseConfig{ + @Override + public void init() throws Exception { + sChallengeStarBoxMap = STableManager.getConfig(SChallengeStarBox.class); + } + + public static Map sChallengeStarBoxMap; + + + private int id; + + private int starNum; + + private int[][] reward; + + public int getId() { + return id; + } + + public int getStarNum() { + return starNum; + } + + public int[][] getReward() { + return reward; + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java index 0af07fa5d..3a532e56b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java @@ -1949,4 +1949,165 @@ public class MapLogic { } } + + /** + * 试炼副本 爬塔 + */ + public void enterTowerCopy(ISession iSession, int teamId, MessageTypeProto.MessageType messageType) throws Exception { + int uid = iSession.getUid(); + User user = UserManager.getUser(uid); + MapManager mapManager = user.getMapManager(); + if (teamId == 0) { + LOGGER.info("enterTowerCopy() uid=>{} teamId =>{} ", uid, teamId); + MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), ""); + return; + } + // 判断次数 + if (mapManager.getFightCount() >= 5) { + LOGGER.info("enterTowerCopy() uid=>{} teamId =>{} ", uid, teamId); + MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), ""); + return; + } + int tower = mapManager.getTower(); + Map scMap = SCMap.sCMap.get(tower); + if (scMap == null) { + LOGGER.info("enterTowerCopy() uid=>{} scMap == null =>{} ", uid, tower); + MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), ""); + return; + } + SChallengeMapConfig scMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(tower); + if (scMapConfig == null) { + LOGGER.info("enterTowerCopy() uid=>{} sChallengeConfig == null =>{} ", uid, tower); + MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "该地图不存在"); + return; + } + SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(tower); + if (sChallengeConfig == null) { + LOGGER.info("enterTowerCopy() uid=>{} sChallengeConfig == null =>{} ", uid, tower); + MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "该地图不存在"); + return; + } + String error = initTeamInfo(teamId, uid, user, mapManager); + if (!error.isEmpty()) { + LOGGER.info("enterTowerCopy() uid=>{} error =>{} ", uid, error); + MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), ""); + return; + } + + + + user.setMapManager(mapManager); + + List cells = new ArrayList<>(mapManager.getMapInfo().size()); + for (Map.Entry entry : mapManager.getMapInfo().entrySet()) { + cellToProto(cells, entry); + } + MapInfoProto.MapEnterResponse.Builder mapEnterResponse = MapInfoProto.MapEnterResponse.newBuilder(); + + for (Map.Entry buffEntry : mapManager.getFoodBufferMap().entrySet()) { + if (buffEntry.getValue() <= 0) { + continue; + } + CommonProto.FoodBuffer foodBuffer = CBean2Proto.getFoodBuffer(buffEntry.getKey(), buffEntry.getValue()); + mapEnterResponse.addFoodBuffers(foodBuffer); + } + if (mapManager.getMission() != null) { + mapEnterResponse.setMissions(getMission(mapManager.getMission())); + } + mapEnterResponse.setDieCount(mapManager.getDieCount()); + mapEnterResponse.addAllMapList(cells); + mapEnterResponse.setCurXY(mapManager.getCurXY()); + mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells()); + if (mapManager.getTemporaryItems() != null) { + mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems())); + } + MapMission mapMissionProgres = mapManager.getMapMissionProgres(); + if (mapMissionProgres != null) { + Map allMissionProgress = mapMissionProgres.getAllMissionProgress(); + List exploreDetailList = new ArrayList<>(allMissionProgress.size()); + for (Map.Entry item : allMissionProgress.entrySet()) { + exploreDetailList.add(CommonProto.ExploreDetail.newBuilder().setId(item.getKey()).setProgress(item.getValue()).build()); + } + mapEnterResponse.addAllExploreDetail(exploreDetailList); + }else{ + LOGGER.error("the curmap={}",mapManager.getCurMapId()); + } + List teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId); + Map> heroAllAttributeMap = mapManager.getHeroAllAttributeMap(); + for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) { + Map map = heroAllAttributeMap.get(teamPosHeroInfo.getHeroId()); + if (map == null) { + continue; + } + MapInfoProto.HeroInfo heroInfo = MapInfoProto.HeroInfo.newBuilder() + .setHeroId(teamPosHeroInfo.getHeroId()) + .setHeroHp(map.get(HeroAttributeEnum.CurHP.getPropertyId()) == null ? 0 : map.get(HeroAttributeEnum.CurHP.getPropertyId())) + .setHeroMaxHp(map.get(HeroAttributeEnum.Hp.getPropertyId()) == null ? 0 : map.get(HeroAttributeEnum.Hp.getPropertyId())) + .build(); + mapEnterResponse.addHeroInfos(heroInfo); + } + LOGGER.info("enterTowerCopy() uid=>{} mapId =>{}", uid, mapManager.getTower()); + MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true); + } + + + /** + * 召唤首领 + * + * @param iSession + * @param messageType + */ + public void callChief(ISession iSession, MessageTypeProto.MessageType messageType) { + + } + + /** + * 使用炸弹 + * + * @param iSession + * @param messageType + */ + public void useBombs(ISession iSession, MessageTypeProto.MessageType messageType) { + + } + + /** + * @param iSession + * @param messageType + */ + public void outTowerCopy(ISession iSession, MessageTypeProto.MessageType messageType) { + + } + + + /** + * 领取副本星级奖励 + * @param session + * @param messageType + */ + public void takeStarReward(ISession session, int id, MessageTypeProto.MessageType messageType) throws Exception { + SChallengeStarBox sChallengeStarBox = SChallengeStarBox.sChallengeStarBoxMap.get(id); + if (sChallengeStarBox == null) { + LOGGER.info("takeStarReward uid=>{}, id=>{}", session.getUid(), id); + MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), ""); + return; + } + int uid = session.getUid(); + User user = UserManager.getUser(uid); + MapManager mapManager = user.getMapManager(); + if (id <= mapManager.getStarReward()){ + LOGGER.info("takeStarReward uid=>{}, id=>{} mapManager.getStarReward()=>{}", session.getUid(), id, mapManager.getStarReward()); + MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), ""); + return; + } + Map crossInfoMap = mapManager.getCrossInfoMap(); + int totalStar = 0; + for (CrossInfo crossInfo : crossInfoMap.values()) { + int star = crossInfo.getStars().size(); + totalStar += star; + } + + + } + } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapManager.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapManager.java index 9adf78c36..9c8881a86 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapManager.java @@ -69,6 +69,16 @@ public class MapManager extends MongoBase { private int findSuddenlyBossMapId; + // 副本星级奖励领取进度 challengeStarBox id + private int starReward; + + // 爬塔副本当前层数 + private int tower; + // 爬塔副本战斗次数 + private int fightCount; + // 爬塔副本重置次数 + private int resetCount; + public MapManager() { this.setRootCollection(User._COLLECTION_NAME); @@ -397,4 +407,40 @@ public class MapManager extends MongoBase { public int getFindSuddenlyBossMapId() { return findSuddenlyBossMapId; } + + public int getTower() { + return tower; + } + + public void setTower(int tower) { + updateString("tower" , tower); + this.tower = tower; + } + + public int getFightCount() { + return fightCount; + } + + public void setFightCount(int fightCount) { + updateString("fightCount" , fightCount); + this.fightCount = fightCount; + } + + public int getResetCount() { + return resetCount; + } + + public void setResetCount(int resetCount) { + updateString("resetCount" , resetCount); + this.resetCount = resetCount; + } + + public int getStarReward() { + return starReward; + } + + public void setStarReward(int starReward) { + updateString("starReward" , starReward); + this.starReward = starReward; + } }