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; 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 68ce190e7..78c77f982 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 @@ -1959,4 +1959,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 03b81e11f..3f3a81d41 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 @@ -73,6 +73,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); @@ -406,7 +416,43 @@ public class MapManager extends MongoBase { return findSuddenlyBossMapId; } + public Set getTakeCopyMisionRewards() { return takeCopyMisionRewards; } + 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; + } }