Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
dfc0ca056c
|
@ -8,5 +8,3 @@ int string int string string int
|
||||||
6 成长基金 6 0 0 1
|
6 成长基金 6 0 0 1
|
||||||
7 云梦祈福 7 0 604800 2
|
7 云梦祈福 7 0 604800 2
|
||||||
8 孙龙的宝藏 8 0 604800 2
|
8 孙龙的宝藏 8 0 604800 2
|
||||||
9 招财猫 9 0 604800 2
|
|
||||||
10 七日狂欢 10 0 604800 2
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
Id ActivityId LuckyType LuckyTime ConsumeValue ValueUp ValueDown RmbValue
|
|
||||||
int int int int int int int int
|
|
||||||
1 9 16 1 200 300 200 0
|
|
||||||
2 9 16 2 500 750 500 0
|
|
||||||
3 9 16 3 1000 1200 1000 0
|
|
||||||
4 9 16 4 2000 2400 2000 100
|
|
||||||
5 9 16 5 3000 3600 3000 500
|
|
||||||
6 9 16 6 4000 4800 4000 1000
|
|
||||||
7 9 16 7 5000 6000 5000 1500
|
|
||||||
8 9 16 8 6000 7200 6000 2000
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ljsd.jieling.handler.map;
|
||||||
|
|
||||||
|
public class EndlessHero {
|
||||||
|
private int maxHp;
|
||||||
|
|
||||||
|
private int curHp;
|
||||||
|
|
||||||
|
public int getMaxHp() {
|
||||||
|
return maxHp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurHp() {
|
||||||
|
return curHp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxHp(int maxHp) {
|
||||||
|
this.maxHp = maxHp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurHp(int curHp) {
|
||||||
|
this.curHp = curHp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EndlessHero(int maxHp, int curHp) {
|
||||||
|
this.maxHp = maxHp;
|
||||||
|
this.curHp = curHp;
|
||||||
|
}
|
||||||
|
public EndlessHero() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.ljsd.jieling.handler.map;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class EndlessMapInfo {
|
||||||
|
private int curMapId;
|
||||||
|
|
||||||
|
private int curCell;
|
||||||
|
|
||||||
|
private Map<String,EndlessHero> endlessHeroInfo;
|
||||||
|
|
||||||
|
private Map<Integer,Map<Integer,String>> mapSign;
|
||||||
|
|
||||||
|
public int getCurMapId() {
|
||||||
|
return curMapId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurCell() {
|
||||||
|
return curCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurCell(int curCell) {
|
||||||
|
this.curCell = curCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurMapId(int curMapId) {
|
||||||
|
this.curMapId = curMapId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, EndlessHero> getEndlessHeroInfo() {
|
||||||
|
return endlessHeroInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndlessHeroInfo(Map<String, EndlessHero> endlessHeroInfo) {
|
||||||
|
this.endlessHeroInfo = endlessHeroInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Map<Integer, String>> getMapSign() {
|
||||||
|
return mapSign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMapSign(Map<Integer, Map<Integer, String>> mapSign) {
|
||||||
|
this.mapSign = mapSign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EndlessMapInfo() {
|
||||||
|
this.endlessHeroInfo =new HashMap<>();
|
||||||
|
this.mapSign = new HashMap<>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -138,7 +138,7 @@ public class MapLogic {
|
||||||
if (user.getPlayerInfoManager().getMapId() < mapId) {
|
if (user.getPlayerInfoManager().getMapId() < mapId) {
|
||||||
user.getPlayerInfoManager().setMapId(mapId);
|
user.getPlayerInfoManager().setMapId(mapId);
|
||||||
}
|
}
|
||||||
String error = initTeamInfo(teamId, uid, user, mapManager);
|
String error = initTeamInfo(teamId, uid, user, mapManager,1);
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
LOGGER.info("enterMap() uid=>{} error =>{} ", uid, error);
|
LOGGER.info("enterMap() uid=>{} error =>{} ", uid, error);
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
|
||||||
|
@ -161,6 +161,15 @@ public class MapLogic {
|
||||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "no ticket");
|
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "no ticket");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}else if(type ==4){
|
||||||
|
|
||||||
|
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
|
for (int i = 0; i <teamPosForHero.size() ; i++) {
|
||||||
|
String endlessHeroId = teamPosForHero.get(i).getHeroId();
|
||||||
|
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),false).get(1);
|
||||||
|
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
|
||||||
|
}
|
||||||
|
mapManager.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||||
}
|
}
|
||||||
//todo 更新地圖次數
|
//todo 更新地圖次數
|
||||||
mapManager.setCurMapId(mapId);
|
mapManager.setCurMapId(mapId);
|
||||||
|
@ -250,7 +259,17 @@ public class MapLogic {
|
||||||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String initTeamInfo(int teamId, int uid, User user, MapManager mapManager) throws Exception {
|
/**
|
||||||
|
*
|
||||||
|
* @param teamId
|
||||||
|
* @param uid
|
||||||
|
* @param user
|
||||||
|
* @param mapManager
|
||||||
|
* @param initType 1为正常初始化、2为复活初始化
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private String initTeamInfo(int teamId, int uid, User user, MapManager mapManager ,int initType) throws Exception {
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
|
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
|
||||||
return "阵容不存在";
|
return "阵容不存在";
|
||||||
|
@ -263,6 +282,18 @@ public class MapLogic {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false);
|
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false);
|
||||||
|
if(teamId==401){
|
||||||
|
Map<String, EndlessHero> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
|
||||||
|
if(endlessHeroInfo!=null&&endlessHeroInfo.size()>0){
|
||||||
|
if(initType!=2){
|
||||||
|
if(endlessHeroInfo.get(hero.getId())!=null){
|
||||||
|
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), endlessHeroInfo.get(hero.getId()).getCurHp());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
mapManager.updateEndlessHeroHp(hero.getId(),endlessHeroInfo.get(hero.getId()).getMaxHp());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||||
heroes.add(heroInfo.getHeroId());
|
heroes.add(heroInfo.getHeroId());
|
||||||
}
|
}
|
||||||
|
@ -889,6 +920,9 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(challengeConfig.getType()==4) {
|
||||||
|
mapManager.updateEndlessLocation(mapManager.getCurXY());
|
||||||
|
}
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -901,12 +935,6 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
long diff = (1565920800000L - 1563242400000L)/1000/60/60/24;
|
|
||||||
System.out.println(diff);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean onlyLevelMap(User user, boolean needTemporaryItem) throws Exception {
|
private boolean onlyLevelMap(User user, boolean needTemporaryItem) throws Exception {
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
if (mapManager.getMapInfo() == null) {
|
if (mapManager.getMapInfo() == null) {
|
||||||
|
@ -1047,7 +1075,7 @@ public class MapLogic {
|
||||||
if (leftTime <= (int) (time / 1000)) {
|
if (leftTime <= (int) (time / 1000)) {
|
||||||
resetMapInfo(user, false);
|
resetMapInfo(user, false);
|
||||||
} else {
|
} else {
|
||||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager);
|
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
|
@ -1074,6 +1102,11 @@ public class MapLogic {
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
}
|
}
|
||||||
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||||
|
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
|
mapManager.updateEndlessHeroHp(teamPosHeroInfo.getHeroId(),checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||||
|
@ -1233,6 +1266,7 @@ public class MapLogic {
|
||||||
int optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
int optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
||||||
int nextEventId = 0;
|
int nextEventId = 0;
|
||||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
||||||
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
int resultCode = checkResult[0];
|
int resultCode = checkResult[0];
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
|
@ -1245,7 +1279,6 @@ public class MapLogic {
|
||||||
int dieCount = user.getMapManager().getDieCount();
|
int dieCount = user.getMapManager().getDieCount();
|
||||||
dieCount++;
|
dieCount++;
|
||||||
user.getMapManager().setDieCount(dieCount);
|
user.getMapManager().setDieCount(dieCount);
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
|
||||||
int[] reviveTime = sChallengeConfig.getReviveTime();
|
int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||||
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||||
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||||
|
@ -1254,7 +1287,7 @@ public class MapLogic {
|
||||||
if (leftTime <= (int) (time / 1000)) {
|
if (leftTime <= (int) (time / 1000)) {
|
||||||
resetMapInfo(user, false);
|
resetMapInfo(user, false);
|
||||||
} else {
|
} else {
|
||||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager);
|
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
||||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
|
@ -1292,12 +1325,16 @@ public class MapLogic {
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int teamId = mapManager.getTeamId();
|
int teamId = mapManager.getTeamId();
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
}
|
}
|
||||||
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||||
|
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
|
mapManager.updateEndlessHeroHp(teamPosHeroInfo.getHeroId(),checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_GENERAL_FIGHT_REWARD);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_GENERAL_FIGHT_REWARD);
|
||||||
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
||||||
fightEndResponse.setEnventDrop(drop.build());
|
fightEndResponse.setEnventDrop(drop.build());
|
||||||
|
@ -2252,9 +2289,9 @@ public class MapLogic {
|
||||||
int[][] bossType = config.getRandomBossType();
|
int[][] bossType = config.getRandomBossType();
|
||||||
|
|
||||||
type = MathUtils.randomFromWeight(bossType);
|
type = MathUtils.randomFromWeight(bossType);
|
||||||
// if(mapManager.getTower()%5!=0){
|
if(mapManager.getTower()%5!=0){
|
||||||
// type = 3;
|
type = 3;
|
||||||
// }
|
}
|
||||||
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||||
int[][][] pointId = config.getRandomMapPointId();
|
int[][][] pointId = config.getRandomMapPointId();
|
||||||
int mapId = config.getMapId();
|
int mapId = config.getMapId();
|
||||||
|
@ -2681,4 +2718,109 @@ public class MapLogic {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取无尽副本英雄信息
|
||||||
|
* @param session
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void getEndlessHero(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
HeroManager heroManager = user.getHeroManager();
|
||||||
|
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||||
|
if(endlessMapInfo==null){
|
||||||
|
mapManager.setEndlessMapInfo(new EndlessMapInfo());
|
||||||
|
endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||||
|
}
|
||||||
|
Map<String, EndlessHero> endlessHeroInfo = endlessMapInfo.getEndlessHeroInfo();
|
||||||
|
MapInfoProto.GetEndlessHeroResponse.Builder response = MapInfoProto.GetEndlessHeroResponse.newBuilder();
|
||||||
|
for(Map.Entry<String,Hero> heroEntry : heroManager.getHeroMap().entrySet()) {
|
||||||
|
if(heroEntry.getValue().getLevel()<20){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int calHp = HeroLogic.getInstance().calHeroFinalAttributeWhenInMap(user, heroEntry.getValue(), true).get(1);
|
||||||
|
for (Map.Entry<String,EndlessHero> entry :endlessHeroInfo.entrySet()) {
|
||||||
|
if (!entry.getKey().equals(heroEntry.getKey())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(calHp!=entry.getValue().getMaxHp()){
|
||||||
|
int tempHp = calHp*entry.getValue().getCurHp()/entry.getValue().getMaxHp();
|
||||||
|
endlessHeroInfo.put(entry.getKey(),new EndlessHero(calHp,tempHp));
|
||||||
|
calHp = tempHp;
|
||||||
|
}else{
|
||||||
|
calHp = entry.getValue().getCurHp();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LOGGER.info("英雄ID{},血量{}",heroEntry.getKey(),calHp);
|
||||||
|
CommonProto.endlessHero endlessHero = CommonProto.endlessHero.newBuilder().setHeroId(heroEntry.getKey()).setHp(calHp).build();
|
||||||
|
response.addHeroInfo(endlessHero);
|
||||||
|
}
|
||||||
|
endlessMapInfo.setEndlessHeroInfo(endlessHeroInfo);
|
||||||
|
mapManager.setEndlessMapInfo(endlessMapInfo);
|
||||||
|
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
|
||||||
|
if(team!=null&&team.size()>0){
|
||||||
|
Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
||||||
|
while(iterator.hasNext()){
|
||||||
|
TeamPosHeroInfo teamInfo = iterator.next();
|
||||||
|
EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(teamInfo.getHeroId());
|
||||||
|
if(endlessHero==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(endlessHero.getCurHp()==0){
|
||||||
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||||
|
if(heroAllAttributeMap.containsKey(teamInfo.getHeroId())){
|
||||||
|
heroAllAttributeMap.remove(teamInfo.getHeroId());
|
||||||
|
}
|
||||||
|
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.getTeamPosManager().updateTeamPosByTeamId(401,team);
|
||||||
|
}
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无尽副本复位
|
||||||
|
* @param session
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void resetEndlessHero(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||||
|
|
||||||
|
for(Map.Entry<String,EndlessHero> entry:endlessMapInfo.getEndlessHeroInfo().entrySet()){
|
||||||
|
mapManager.updateEndlessHeroHp(entry.getKey(),entry.getValue().getMaxHp());
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, Map<Integer, Integer>> entry:mapManager.getHeroAllAttributeMap().entrySet()){
|
||||||
|
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),entry.getValue().get(HeroAttributeEnum.Hp.getPropertyId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无尽副本设置标记
|
||||||
|
* @param session
|
||||||
|
* @param cellId
|
||||||
|
* @param content
|
||||||
|
* @param messageType
|
||||||
|
*/
|
||||||
|
public void setEndlessSign(ISession session,int mapId,int cellId, String content, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
boolean result = ShieldedWordUtils.checkName(content,false);
|
||||||
|
String error;
|
||||||
|
if (!result) {
|
||||||
|
error = "输入有敏感字符";
|
||||||
|
}else{
|
||||||
|
mapManager.addEndlessSign(mapId,cellId,content);
|
||||||
|
error = "设置成功";
|
||||||
|
}
|
||||||
|
MapInfoProto.SignEndlessCellResponse response = MapInfoProto.SignEndlessCellResponse.newBuilder().setError(error).build();
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,8 @@ public class MapManager extends MongoBase {
|
||||||
private Map<Integer,Integer> towerReceivedReward = new HashMap<>();
|
private Map<Integer,Integer> towerReceivedReward = new HashMap<>();
|
||||||
|
|
||||||
private Map<Integer, Map<Integer,Integer>> monsterTempSkill = new HashMap<>();
|
private Map<Integer, Map<Integer,Integer>> monsterTempSkill = new HashMap<>();
|
||||||
|
//无尽副本信息
|
||||||
|
private EndlessMapInfo endlessMapInfo;
|
||||||
|
|
||||||
public MapManager() {
|
public MapManager() {
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
this.setRootCollection(User._COLLECTION_NAME);
|
||||||
|
@ -674,7 +676,52 @@ public class MapManager extends MongoBase {
|
||||||
|
|
||||||
public void setLastFightResult(int lastFightResult) {
|
public void setLastFightResult(int lastFightResult) {
|
||||||
this.lastFightResult = lastFightResult;
|
this.lastFightResult = lastFightResult;
|
||||||
updateString("lastFightResult",lastFightResult);
|
updateString("lastFightResult", lastFightResult);
|
||||||
|
}
|
||||||
|
public EndlessMapInfo getEndlessMapInfo() {
|
||||||
|
return endlessMapInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndlessMapInfo(EndlessMapInfo endlessMapInfo) {
|
||||||
|
updateString("endlessMapInfo",endlessMapInfo);
|
||||||
|
this.endlessMapInfo = endlessMapInfo;
|
||||||
|
}
|
||||||
|
public void addEndlessHero(String heroId,int maxHp){
|
||||||
|
if(endlessMapInfo==null){
|
||||||
|
setEndlessMapInfo(new EndlessMapInfo());
|
||||||
|
}
|
||||||
|
if(endlessMapInfo.getEndlessHeroInfo().containsKey(heroId)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EndlessHero endlessHero = new EndlessHero(maxHp, maxHp);
|
||||||
|
updateString("endlessMapInfo."+heroId,endlessHero);
|
||||||
|
endlessMapInfo.getEndlessHeroInfo().put(heroId,endlessHero);
|
||||||
|
}
|
||||||
|
public void updateEndlessHeroHp(String heroId,int hp){
|
||||||
|
updateString("endlessMapInfo.endlessHeroInfo."+heroId+".curHp",hp);
|
||||||
|
EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(heroId);
|
||||||
|
if(endlessHero!=null){
|
||||||
|
endlessHero.setCurHp(hp);
|
||||||
|
endlessMapInfo.getEndlessHeroInfo().put(heroId,endlessHero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void updateEndlessLocation(int cellId){
|
||||||
|
endlessMapInfo.setCurCell(cellId);
|
||||||
|
updateString("endlessMapInfo.curCell",cellId);
|
||||||
|
}
|
||||||
|
public void updateEndlessMapId(int mapId){
|
||||||
|
endlessMapInfo.setCurMapId(mapId);
|
||||||
|
updateString("endlessMapInfo.curMapId",mapId);
|
||||||
|
}
|
||||||
|
public void addEndlessSign(int mapId,int cellId,String info){
|
||||||
|
if(endlessMapInfo.getMapSign()==null){
|
||||||
|
endlessMapInfo.setMapSign(new HashMap<>());
|
||||||
|
}
|
||||||
|
if(!endlessMapInfo.getMapSign().containsKey(mapId)){
|
||||||
|
endlessMapInfo.getMapSign().put(mapId,new HashMap<>());
|
||||||
|
}
|
||||||
|
endlessMapInfo.getMapSign().get(mapId).put(mapId,info);
|
||||||
|
updateString("endlessMapInfo.mapSign."+mapId+"."+cellId,info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ljsd.jieling.handler.map.mapHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.handler.map.MapLogic;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class EndlessGetHeroHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
MapLogic.getInstance().getEndlessHero(iSession, MessageTypeProto.MessageType.ENDLESS_MAP_HERO_INFO_RESPONSE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ljsd.jieling.handler.map.mapHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.handler.map.MapLogic;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class EndlessResetHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.ENDLESS_MAP_RESET_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
MapLogic.getInstance().resetEndlessHero(iSession, MessageTypeProto.MessageType.ENDLESS_MAP_RESET_RESPONSE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ljsd.jieling.handler.map.mapHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.handler.map.MapLogic;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class EndlessSetSignHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
byte[] bytes = netData.parseClientProtoNetData();
|
||||||
|
MapInfoProto.SignEndlessCellRequest request = MapInfoProto.SignEndlessCellRequest.parseFrom(bytes);
|
||||||
|
CommonProto.endlessSign sign = request.getSign();
|
||||||
|
MapLogic.getInstance().setEndlessSign(iSession,sign.getMapId(),sign.getCellId(),sign.getInfo(),MessageTypeProto.MessageType.ENDLESS_MAP_SIGN_RESPONSE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -910,6 +910,10 @@ public class ActivityLogic {
|
||||||
public void blessChoose(ISession session, int locationId, MessageTypeProto.MessageType messageType) throws Exception {
|
public void blessChoose(ISession session, int locationId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(SBlessingConfig.sBlessingConfig.getActivityId());
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(SBlessingConfig.sBlessingConfig.getActivityId());
|
||||||
|
if(activityMission==null){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"不在活动开启时间内");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||||
if(activityProgressInfoMap.get(locationId+BlessInfoConfig.START_CAPACITY).getProgrss()!=0){
|
if(activityProgressInfoMap.get(locationId+BlessInfoConfig.START_CAPACITY).getProgrss()!=0){
|
||||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"已经抽过改格子");
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"已经抽过改格子");
|
||||||
|
@ -1012,7 +1016,9 @@ public class ActivityLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"活动不可刷新");
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"活动不可刷新");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlayerInfoProto.blessRefresh res = PlayerInfoProto.blessRefresh.newBuilder().setReward(getBlessInfoResponse(blessRefresh(user)).build()).build();
|
ActivityMission activityMission = blessRefresh(user);
|
||||||
|
activityMission.updateProgressInfo(BlessInfoConfig.LAST_REFRESH_TIME,new ActivityProgressInfo((int)(TimeUtils.now()/1000),0));
|
||||||
|
PlayerInfoProto.blessRefresh res = PlayerInfoProto.blessRefresh.newBuilder().setReward(getBlessInfoResponse(activityMission).build()).build();
|
||||||
|
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),res,true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),res,true);
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1031,6 @@ public class ActivityLogic {
|
||||||
activityMission.updateProgressInfo(entry.getKey(),tempProgress);
|
activityMission.updateProgressInfo(entry.getKey(),tempProgress);
|
||||||
}
|
}
|
||||||
activityMission = blessInfoInit(activityManager, 7);
|
activityMission = blessInfoInit(activityManager, 7);
|
||||||
activityMission.updateProgressInfo(BlessInfoConfig.LAST_REFRESH_TIME,new ActivityProgressInfo((int)(TimeUtils.now()/1000),0));
|
|
||||||
return activityMission;
|
return activityMission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,4 +94,9 @@ public class TeamPosManager extends MongoBase {
|
||||||
public void updateTeamPos(int teamId,List<int[][]> result){
|
public void updateTeamPos(int teamId,List<int[][]> result){
|
||||||
cacheTeamPro.put(teamId,result);
|
cacheTeamPro.put(teamId,result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTeamPosByTeamId(int teamId,List<TeamPosHeroInfo> infos){
|
||||||
|
teamPosForHero.put(teamId,infos);
|
||||||
|
updateString("teamPosForHero."+teamId,infos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,8 +389,25 @@ public class HeroLogic {
|
||||||
MessageUtil.sendErrorResponse(iSession,0,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,err);
|
MessageUtil.sendErrorResponse(iSession,0,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
|
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
|
||||||
|
if(teamId == 401){
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
|
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
|
||||||
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
|
||||||
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
|
if (hero == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,true);
|
||||||
|
if(user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo()!=null&&user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().size()>0){
|
||||||
|
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().get(hero.getId()).getCurHp());
|
||||||
|
}
|
||||||
|
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||||
|
heroes.add(heroInfo.getHeroId());
|
||||||
|
}
|
||||||
|
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
|
||||||
|
}
|
||||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue