试炼副本提交
parent
30e252118f
commit
407a161831
|
|
@ -58,4 +58,14 @@ public class Cell {
|
|||
public void setForce(int force) {
|
||||
this.force = force;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Cell{" +
|
||||
"cellId=" + cellId +
|
||||
", pointId=" + pointId +
|
||||
", eventId=" + eventId +
|
||||
", force=" + force +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private int lastUpdateEnergyTime;
|
||||
|
||||
private long startExporeTime;
|
||||
// private long startExporeTime;
|
||||
|
||||
private long canMoveTime;
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ public class MapManager extends MongoBase {
|
|||
return curMapId;
|
||||
}
|
||||
|
||||
public void setCurMapId(int curMapId) throws Exception {
|
||||
public void setCurMapId(int curMapId) {
|
||||
updateString("curMapId", curMapId);
|
||||
this.curMapId = curMapId;
|
||||
}
|
||||
|
|
@ -136,12 +136,12 @@ public class MapManager extends MongoBase {
|
|||
return curXY;
|
||||
}
|
||||
|
||||
public void setCurXY(int curXY) throws Exception {
|
||||
public void setCurXY(int curXY) {
|
||||
updateString("curXY", curXY);
|
||||
this.curXY = curXY;
|
||||
}
|
||||
|
||||
public void addOrUpdateCell(int key, Cell cell) throws Exception {
|
||||
public void addOrUpdateCell(int key, Cell cell) {
|
||||
updateString("mapInfo." + key, cell);
|
||||
this.mapInfo.put(key, cell);
|
||||
}
|
||||
|
|
@ -345,14 +345,14 @@ public class MapManager extends MongoBase {
|
|||
this.foodBufferMap = foodBufferMap;
|
||||
}
|
||||
|
||||
public long getStartExporeTime() {
|
||||
return startExporeTime;
|
||||
}
|
||||
|
||||
public void setStartExporeTime(long startExporeTime) {
|
||||
updateString("startExporeTime", startExporeTime);
|
||||
this.startExporeTime = startExporeTime;
|
||||
}
|
||||
// public long getStartExporeTime() {
|
||||
// return startExporeTime;
|
||||
// }
|
||||
//
|
||||
// public void setStartExporeTime(long startExporeTime) {
|
||||
// updateString("startExporeTime", startExporeTime);
|
||||
// this.startExporeTime = startExporeTime;
|
||||
// }
|
||||
|
||||
public Mission getMission() {
|
||||
return mission;
|
||||
|
|
@ -786,6 +786,23 @@ public class MapManager extends MongoBase {
|
|||
trialInfo.setEnergy(energy);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
public void updateTrailHeroInfo(Map<String, TrailHero> heroInfo){
|
||||
trialInfo.setHeroInfo(heroInfo);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
public void updateTrialCurXY(int curXY){
|
||||
trialInfo.setCurXY(curXY);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
|
||||
public void updateTrialMapInfo(Map<Integer, Cell> mapInfo){
|
||||
trialInfo.setMapInfo(mapInfo);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
public void updateTrialExitMapId(int mapId){
|
||||
trialInfo.setQuitMapId(mapId);
|
||||
updateString("trialInfo",trialInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/5/28
|
||||
* @discribe
|
||||
*/
|
||||
public class TrailHero {
|
||||
|
||||
private int tmpId;
|
||||
|
||||
private Map<Integer,Integer> property;
|
||||
|
||||
private int star;
|
||||
|
||||
private String heroSkills;
|
||||
|
||||
private int level;
|
||||
|
||||
public int getTmpId() {
|
||||
return tmpId;
|
||||
}
|
||||
|
||||
public void setTmpId(int tmpId) {
|
||||
this.tmpId = tmpId;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
public void setProperty(Map<Integer, Integer> property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) {
|
||||
this.star = star;
|
||||
}
|
||||
|
||||
public TrailHero(int tmpId, Map<Integer, Integer> property, int star,String heroSkills,int level) {
|
||||
this.tmpId = tmpId;
|
||||
this.property = property;
|
||||
this.star = star;
|
||||
this.heroSkills = heroSkills;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getHeroSkills() {
|
||||
return heroSkills;
|
||||
}
|
||||
|
||||
public void setHeroSkills(String heroSkills) {
|
||||
this.heroSkills = heroSkills;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,12 +25,18 @@ public class TrialInfo {
|
|||
|
||||
private int energy;
|
||||
//进入副本英雄信息
|
||||
private Map<String, Map<Integer,Integer>> heroInfo = new HashMap<>(5);
|
||||
private Map<String,TrailHero> heroInfo = new HashMap<>(5);
|
||||
//回复血量次数
|
||||
private int addHpCount;
|
||||
|
||||
private int highestTower;
|
||||
|
||||
private int curXY;
|
||||
|
||||
private int quitMapId;
|
||||
|
||||
private Map<Integer, Cell> mapInfo = new HashMap<>();
|
||||
|
||||
public int getFloor() {
|
||||
return floor;
|
||||
}
|
||||
|
|
@ -87,11 +93,35 @@ public class TrialInfo {
|
|||
this.highestTower = highestTower;
|
||||
}
|
||||
|
||||
public Map<String, Map<Integer, Integer>> getHeroInfo() {
|
||||
public Map<String, TrailHero> getHeroInfo() {
|
||||
return heroInfo;
|
||||
}
|
||||
|
||||
public void setHeroInfo(Map<String, Map<Integer, Integer>> heroInfo) {
|
||||
public void setHeroInfo(Map<String, TrailHero> heroInfo) {
|
||||
this.heroInfo = heroInfo;
|
||||
}
|
||||
|
||||
public Map<Integer, Cell> getMapInfo() {
|
||||
return mapInfo;
|
||||
}
|
||||
|
||||
public void setMapInfo(Map<Integer, Cell> mapInfo) {
|
||||
this.mapInfo = mapInfo;
|
||||
}
|
||||
|
||||
public int getCurXY() {
|
||||
return curXY;
|
||||
}
|
||||
|
||||
public void setCurXY(int curXY) {
|
||||
this.curXY = curXY;
|
||||
}
|
||||
|
||||
public int getQuitMapId() {
|
||||
return quitMapId;
|
||||
}
|
||||
|
||||
public void setQuitMapId(int quitMapId) {
|
||||
this.quitMapId = quitMapId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.handler.map.behavior;
|
|||
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.handler.map.TrailHero;
|
||||
import com.ljsd.jieling.logic.fight.specialparm.SpecialForTeamBuildEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
|
|
@ -217,6 +219,9 @@ public class BehaviorUtil {
|
|||
* @return
|
||||
*/
|
||||
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId,boolean isMySelf) {
|
||||
if(teamId==GlobalsDef.TRIAL_TEAM){
|
||||
return getFightTeamInfo(user,teamId);
|
||||
}
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
|
|
@ -246,6 +251,47 @@ public class BehaviorUtil {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取FightUnitInfo
|
||||
* @param user
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId) {
|
||||
//无尽副本使用镜像来战斗
|
||||
if(teamId!= GlobalsDef.TRIAL_TEAM){
|
||||
return getFightTeamInfo(user,teamId,true);
|
||||
}
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
Map<String, TrailHero> heroInfo = user.getMapManager().getTrialInfo().getHeroInfo();
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
if (heroInfo.isEmpty()||!heroInfo.containsKey(teamPosHeroInfo.getHeroId())) {
|
||||
continue;
|
||||
}
|
||||
TrailHero trailHero = heroInfo.get(teamPosHeroInfo.getHeroId());
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
//存起来
|
||||
String heroSkill = trailHero.getHeroSkills();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb,trailHero.getTmpId(),trailHero.getLevel(),trailHero.getProperty()).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(trailHero.getTmpId()))
|
||||
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
|
||||
.setProperty(property.substring(0, property.length()-1))
|
||||
.setPosition(teamPosHeroInfo.getPosition())
|
||||
.build();
|
||||
heroFightInfos.add(heroFightInfo);
|
||||
}
|
||||
return CommonProto.FightTeamInfo.
|
||||
newBuilder()
|
||||
.addAllFightUnitList(heroFightInfos)
|
||||
// .setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(user,teamId))
|
||||
// .setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user,teamId))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取FightUnitInfo
|
||||
* @param user
|
||||
|
|
@ -269,7 +315,7 @@ public class BehaviorUtil {
|
|||
StringBuilder skillSb = new StringBuilder();
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,skillSb).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero, heroAttributeMap).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getTemplateId(),hero.getLevel(), heroAttributeMap).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
|
|
@ -312,7 +358,7 @@ public class BehaviorUtil {
|
|||
StringBuilder skillSb = new StringBuilder();
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,skillSb).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero, heroAttributeMap).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getTemplateId(),hero.getLevel(), heroAttributeMap).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.TrialInfo;
|
||||
import com.ljsd.jieling.handler.map.mapType.AbstractMap;
|
||||
import com.ljsd.jieling.handler.map.mapType.TowerMap;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
|
|
@ -15,6 +17,8 @@ import com.ljsd.jieling.protocols.MapInfoProto;
|
|||
import util.TimeUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Component
|
||||
public class FourtyTwoBehavior extends BaseBehavior {
|
||||
|
||||
|
|
@ -44,8 +48,8 @@ public class FourtyTwoBehavior extends BaseBehavior {
|
|||
if(trialInfo.getFloor()> trialInfo.getHighestTower()){
|
||||
trialInfo.setHighestTower(trialInfo.getFloor());
|
||||
AbstractRank towerRank = RankContext.getRankEnum(RankEnum.TOWER_RANK.getType());
|
||||
if(towerRank.getScore(trialInfo.getFloor(),(int)time/1000)>towerRank.getScoreById(user.getId(),"")){
|
||||
towerRank.addRank(user.getId(),"", trialInfo.getFloor(),(int)time/1000);
|
||||
if(towerRank.getScore(trialInfo.getFloor(),(int)(time/1000))>towerRank.getScoreById(user.getId(),"")){
|
||||
towerRank.addRank(user.getId(),"", trialInfo.getFloor(),(int)(time/1000));
|
||||
}
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_LEVEL, trialInfo.getFloor());
|
||||
|
|
@ -55,11 +59,12 @@ public class FourtyTwoBehavior extends BaseBehavior {
|
|||
// }
|
||||
mapManager.setTrialEnergy(0);
|
||||
|
||||
mapManager.setStartExporeTime(0);
|
||||
// mapManager.setStartExporeTime(0);
|
||||
mapManager.setMapIntoFlag(2);
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(trialInfo.getFloor());
|
||||
mapManager.setCurMapId(sTrialConfig.getMapId());
|
||||
MapLogic.getInstance().initTrialMap(mapManager, user);
|
||||
// STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(trialInfo.getFloor());
|
||||
// mapManager.setCurMapId(sTrialConfig.getMapId());
|
||||
// mapManager.updateTrialMapInfo(mapManager.getMapInfo());
|
||||
// MapLogic.getInstance().getMap(user).initMap(mapManager, user);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.family.GuildFightLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
|
@ -29,10 +30,15 @@ public class FightEndRequestHandler extends BaseHandler {
|
|||
int fightId = fightEndRequest.getFightId();
|
||||
if (type == 1){
|
||||
//MapLogic.getInstance().endDifficultyFight(iSession, frames,fightId,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}else if(type == 2){
|
||||
int dropout = fightEndRequest.getDropout();
|
||||
MapLogic.getInstance().endFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE,dropout);
|
||||
}else if(type == 3){
|
||||
}
|
||||
// else if(type == 2){
|
||||
// int dropout = fightEndRequest.getDropout();
|
||||
// FightInfoProto.FightEndResponse.Builder builder = FightInfoProto.FightEndResponse.newBuilder();
|
||||
// MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid()).getMapManager().getCurMapId())
|
||||
// .endFight(iSession.getUid(),frames, builder,dropout);
|
||||
// MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true);
|
||||
// }
|
||||
else if(type == 3){
|
||||
MapLogic.getInstance().endSuddlenlyFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
}else if(type == 5){
|
||||
MapLogic.getInstance().endMonsterAttackFight(iSession, frames,MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.family.GuildFightLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
|
|
@ -18,48 +20,19 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
|
|||
return MessageTypeProto.MessageType.FIGHT_START_REQUEST;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
// byte[] message = netData.parseClientProtoNetData();
|
||||
//// FightInfoProto.FightStartRequest fightEndRequest = FightInfoProto.FightStartRequest.parseFrom(message);
|
||||
// FightInfoProto.FightStartRequest fightStartRequest = FightInfoProto.FightStartRequest.parseFrom(message);
|
||||
// int type = fightStartRequest.getType();
|
||||
// int fightId = fightStartRequest.getFightId();
|
||||
// int teamId = fightStartRequest.getTeamId();
|
||||
//
|
||||
//
|
||||
// if (type ==1){
|
||||
// User user = UserManager.getUser(iSession.getUid());
|
||||
// int curMapId = user.getMapManager().getCurMapId();
|
||||
// if(curMapId>0){
|
||||
// MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.FIGHT_START_RESPONSE.getNumber(),"在地图探索中,不可以操作");
|
||||
// return;
|
||||
// }
|
||||
// MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,type,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
// }else if(type == 2){
|
||||
// MapLogic.getInstance().startBossFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
//
|
||||
// }else if(type == 3){
|
||||
// MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
// }else if(type == 5){
|
||||
// MapLogic.getInstance().startMonsterAttackFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
// } else {
|
||||
//// MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,type,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
//
|
||||
// MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.FIGHT_START_RESPONSE.getNumber(),"type is wrong:" + type);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, FightInfoProto.FightStartRequest fightStartRequest) throws Exception {
|
||||
int type = fightStartRequest.getType();
|
||||
int fightId = fightStartRequest.getFightId();
|
||||
int teamId = fightStartRequest.getTeamId();
|
||||
if(type == 2){
|
||||
MapLogic.getInstance().startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
}else if(type == 3){
|
||||
// if(type == 2){
|
||||
// FightInfoProto.FightStartResponse.Builder builder = FightInfoProto.FightStartResponse.newBuilder();
|
||||
//
|
||||
// MapLogic.getInstance().getMap(UserManager.getUser(iSession.getUid()).getMapManager().getCurMapId())
|
||||
// .startFight(iSession.getUid(),builder);
|
||||
// MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true);
|
||||
// }else
|
||||
if(type == 3){
|
||||
MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
}else if(type == 5){
|
||||
MapLogic.getInstance().startMonsterAttackFight(iSession,fightId,teamId, MessageTypeProto.MessageType.FIGHT_START_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.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/6/1
|
||||
* @discribe
|
||||
*/
|
||||
@Component
|
||||
public class TrailSaveHeroesHandler extends BaseHandler<MapInfoProto.TrialHeroInfoSaveRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.TRIAL_HERO_INFO_SAVE_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, MapInfoProto.TrialHeroInfoSaveRequest proto) throws Exception {
|
||||
MapLogic.getInstance().saveTrailTeam(iSession,proto.getHeroIdsList(), MessageTypeProto.MessageType.TRIAL_HERO_INFO_SAVE_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/6/1
|
||||
* @discribe
|
||||
*/
|
||||
@Component
|
||||
public class TrialGetBoxRewardHandler extends BaseHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.TRIAL_GET_BOX_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
MapLogic.getInstance().trialGetBox(iSession,MessageTypeProto.MessageType.TRIAL_GET_BOX_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ import java.util.*;
|
|||
*/
|
||||
public abstract class AbstractMap implements IMap {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(AbstractMap.class);
|
||||
private Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||
protected Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||
int endlessSeason;
|
||||
int type;
|
||||
public void init(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
|
|
@ -123,20 +123,20 @@ public abstract class AbstractMap implements IMap {
|
|||
} else {
|
||||
LOGGER.error("the curmap={}", mapManager.getCurMapId());
|
||||
}
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
Map<Integer, Integer> 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);
|
||||
}
|
||||
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
// Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
// for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
// Map<Integer, Integer> 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("enterMap() uid=>{} mapId =>{}", uid, mapManager.getCurMapId());
|
||||
}
|
||||
|
|
@ -154,14 +154,13 @@ public abstract class AbstractMap implements IMap {
|
|||
LOGGER.info("当前层使用时间{}",time);
|
||||
//清除副本中增加的怪物被动技能
|
||||
user.getMapManager().removeMonsterTempSkill();
|
||||
if(outType==0){
|
||||
boolean result = MapLogic.getInstance().onlyLevelMap(user, true);
|
||||
if (!result) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
// if(outType==0){
|
||||
MapLogic.getInstance().onlyLevelMap(user, true);
|
||||
// if (!result) {
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// public AbstractMap(int type){
|
||||
// this.type = type;
|
||||
// }
|
||||
|
|
@ -199,10 +198,10 @@ public abstract class AbstractMap implements IMap {
|
|||
}
|
||||
//todo initTeam ?
|
||||
String error = MapLogic.getInstance().initTeamInfo(teamId, user.getId(), user, mapManager,1);
|
||||
if (!error.isEmpty()) {
|
||||
LOGGER.info("enterMap() uid=>{} error =>{} ", user.getId(), error);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
// if (!error.isEmpty()) {
|
||||
// LOGGER.info("enterMap() uid=>{} error =>{} ", user.getId(), error);
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
mapManager.setCurMapId(mapId);
|
||||
//todo 更新地圖次數
|
||||
user.setMapManager(mapManager);
|
||||
|
|
@ -222,108 +221,12 @@ public abstract class AbstractMap implements IMap {
|
|||
.setMonsterForce(cell.getForce());
|
||||
cells.add(cellProto.build());
|
||||
}
|
||||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if (mapManager.getCanMoveTime() > 0) {
|
||||
long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
||||
if (leftTime > 0) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN, Collections.singletonList((leftTime / 1000)+""));
|
||||
}
|
||||
}
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
if (cell == null) {
|
||||
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
if (cell == null) {
|
||||
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
int bigEventId = cell.getEventId();
|
||||
SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
||||
if (sEventPointConfig == null) {
|
||||
LOGGER.info("sEventPointConfig == null");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
if (option == null) {
|
||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int groupId = option[0];
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||
// Integer newGroupId= STableManager.getFigureConfig(MapStaticConfig.class).getDifficultyMonster().get(groupId);
|
||||
// if(newGroupId!=null){
|
||||
// groupId = newGroupId;
|
||||
// }
|
||||
}
|
||||
int destoryXY = mapManager.getTriggerXY();
|
||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, mapManager.getTeamId(), true);
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(3);
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(groupId, monsterByGroup, Global.MONSTER_1);
|
||||
monsterTeamList.addAll(monsterGroupList);
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList1 = BehaviorUtil.getFightTeamInfos(groupId, monsterByGroup, Global.MONSTER_2);
|
||||
monsterTeamList.addAll(monsterGroupList1);
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList2 = BehaviorUtil.getFightTeamInfos(groupId, monsterByGroup, Global.MONSTER_3);
|
||||
monsterTeamList.addAll(monsterGroupList2);
|
||||
//设置战斗随机种子
|
||||
int seed = (int) (System.currentTimeMillis() / 1000);
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
int mostTime = sChallengeConfig.getMostTime();
|
||||
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
for (int i = 2; i < checkResult.length; i++) {
|
||||
if (checkResult[i] <= 0) {
|
||||
remainHp.add(0);
|
||||
} else {
|
||||
remainHp.add(checkResult[i]);
|
||||
}
|
||||
}
|
||||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
int teamId = mapManager.getTeamId();
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
|
||||
if (resultCode == 0) {
|
||||
//复活相关(无尽本不复活)
|
||||
revive(user,sChallengeConfig,remainHp,teamId);
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
fastFightResponseBuilder.setResult(resultCode)
|
||||
.setEnventDrop(dropBuilder)
|
||||
.addAllRemainHpList(remainHp)
|
||||
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||
.setLastXY(mapManager.getLastXY());
|
||||
mapManager.setCurXY(mapManager.getLastXY());
|
||||
return;
|
||||
}
|
||||
refreshHp(user,teamId,checkResult);
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
|
||||
if (mapManager.getMonsterId() > 0) {
|
||||
BaseBehavior baseBehavior = baseBehaviorMap.get(10);
|
||||
baseBehavior.afterFastFight(user, groupId, fastFightResponseBuilder);
|
||||
}
|
||||
fastFightResponseBuilder.setEnventDrop(drop.build());
|
||||
fastFightResponseBuilder.setResult(resultCode);
|
||||
fastFightResponseBuilder.addAllRemainHpList(remainHp);
|
||||
fastFightResponseBuilder.setEssenceValue(mapManager.getTrialInfo().getEnergy());
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, checkResult[1]);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
}
|
||||
/**
|
||||
* 开始战斗
|
||||
* @param uid
|
||||
* @param responseBuilder
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startFight(int uid,FightInfoProto.FightStartResponse.Builder responseBuilder) throws Exception{
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
|
@ -374,6 +277,10 @@ public abstract class AbstractMap implements IMap {
|
|||
BehaviorUtil.getFightInfo(user, groupId, responseBuilder, pointId, sChallengeConfig.getMostTime(), true);
|
||||
}
|
||||
|
||||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
public void endFight(int uid, String frames, FightInfoProto.FightEndResponse.Builder builder,int dropout) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
String key = RedisKey.getKey(RedisKey.FIGHT, Integer.toString(uid), false);
|
||||
|
|
@ -391,7 +298,6 @@ public abstract class AbstractMap implements IMap {
|
|||
}
|
||||
}
|
||||
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
int triggerXY = mapManager.getTriggerXY();
|
||||
int optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
||||
int nextEventId = 0;
|
||||
|
|
@ -401,31 +307,30 @@ public abstract class AbstractMap implements IMap {
|
|||
int resultCode=0;
|
||||
int[] checkResult = new int[0];
|
||||
int monsterGroupId=0;
|
||||
SMonsterGroup sMonsterGroup=null;
|
||||
if(dropout ==0){
|
||||
int seed = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_SEED));
|
||||
monsterGroupId = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_GROUPID));
|
||||
CommonProto.FightTeamInfo.Builder fightTeamBuilder = CommonProto.FightTeamInfo.newBuilder();
|
||||
JsonFormat.merge((String) valueMap.get(RedisKey.FIGHT_HEROES), fightTeamBuilder);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = fightTeamBuilder.build();
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = BehaviorUtil.getFightTeamInfos(valueMap);
|
||||
sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||
if (sMonsterGroup == null) {
|
||||
LOGGER.info("endFight() uid=>{} monsterGroupId=>{} sMonsterGroup == null", uid, monsterGroupId);
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||
int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
|
||||
checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
|
||||
resultCode = checkResult[0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
int seed = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_SEED));
|
||||
monsterGroupId = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_GROUPID));
|
||||
CommonProto.FightTeamInfo.Builder fightTeamBuilder = CommonProto.FightTeamInfo.newBuilder();
|
||||
JsonFormat.merge((String) valueMap.get(RedisKey.FIGHT_HEROES), fightTeamBuilder);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = fightTeamBuilder.build();
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = BehaviorUtil.getFightTeamInfos(valueMap);
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||
if (sMonsterGroup == null) {
|
||||
LOGGER.info("endFight() uid=>{} monsterGroupId=>{} sMonsterGroup == null", uid, monsterGroupId);
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||
int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
|
||||
checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
|
||||
resultCode = checkResult[0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
if (resultCode == 0 || dropout == 1) {
|
||||
if (resultCode == 0) {
|
||||
//todo 无尽副本复活
|
||||
//无尽副本复活消耗
|
||||
revive(user,sChallengeConfig,remainHp,mapManager.getTeamId());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.handler.map.mapType;
|
||||
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
|
@ -7,27 +9,35 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.Cell;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.handler.map.TowerBuff;
|
||||
import com.ljsd.jieling.handler.map.*;
|
||||
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightDispatcher;
|
||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.TowerRankUtil;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import util.CellUtil;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -42,10 +52,13 @@ public class TowerMap extends AbstractMap {
|
|||
|
||||
@Override
|
||||
public void outMap(int uid,int outType, int curXY,MapInfoProto.MapOutResponse.Builder builder) throws Exception{
|
||||
super.outMap(uid,outType,curXY,builder);
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(outType == 0||mapManager.getTrialInfo().getFloor()-1==STrialConfig.getHighestTower()) {
|
||||
//退出地图需要记录换层数据
|
||||
mapManager.updateTrialMapInfo(mapManager.getMapInfo());
|
||||
mapManager.updateTrialCurXY(mapManager.getCurXY());
|
||||
mapManager.updateTrialExitMapId(mapManager.getCurMapId());
|
||||
if(mapManager.getTowerUnusedBuffer()!=null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
|
|
@ -59,10 +72,14 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//换层需要把镜像数据清除掉
|
||||
mapManager.updateTrialMapInfo(new HashMap<>());
|
||||
mapManager.updateTrialCurXY(0);
|
||||
mapManager.updateTrialExitMapId(0);
|
||||
}
|
||||
mapManager.setCurrTowerTime(0);
|
||||
mapManager.setTrialEnergy(0);
|
||||
|
||||
super.outMap(uid,outType,curXY,builder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -71,20 +88,56 @@ public class TowerMap extends AbstractMap {
|
|||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
MapManager mapManager = UserManager.getUser(uid).getMapManager();
|
||||
int curFloor = mapManager.getTrialInfo().getFloor();
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
int curFloor = trialInfo.getFloor();
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(curFloor);
|
||||
if(sTrialConfig.getMapId()!=mapId){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
super.enterMap(uid, mapId, teamId,mapEnterResponse);
|
||||
if(!trialInfo.getMapInfo().isEmpty()&&mapManager.getCurMapId()==0){
|
||||
mapManager.setMapInfo(trialInfo.getMapInfo());
|
||||
mapManager.setCurMapId(trialInfo.getQuitMapId());
|
||||
List<CommonProto.Cell> cells = new ArrayList<>(trialInfo.getMapInfo().size());
|
||||
for (Map.Entry<Integer, Cell> entry : trialInfo.getMapInfo().entrySet()) {
|
||||
cellToProto(cells, entry);
|
||||
}
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
mapEnterResponse.setCurXY(trialInfo.getCurXY());
|
||||
}else{
|
||||
super.enterMap(uid, mapId, teamId,mapEnterResponse);
|
||||
}
|
||||
// if(mapManager.getTowerUnusedBuffer()!=null&&mapManager.getTowerUnusedBuffer().size()>=1){
|
||||
// List<MapInfoProto.TowerBuff> towerBuffs = new ArrayList<>();
|
||||
// for(Map.Entry<Integer,Integer> buffer:mapManager.getTowerUnusedBuffer().entrySet()){
|
||||
// TowerBuff towerBuff = new TowerBuff(buffer.getKey(),buffer.getValue());
|
||||
// towerBuffs.add(CBean2Proto.getTowerBuff(towerBuff));
|
||||
// }
|
||||
// mapEnterResponse.addAllBuf(towerBuffs);
|
||||
// MapEnterResponse.addAllBuf(towerBuffs);
|
||||
// }
|
||||
Map<String, TrailHero> heroInfo = trialInfo.getHeroInfo();
|
||||
if(!heroInfo.isEmpty()){
|
||||
for(Map.Entry<String,TrailHero> entry:heroInfo.entrySet()){
|
||||
TrailHero trailHero = entry.getValue();
|
||||
int remainHp = trailHero.getProperty().get(HeroAttributeEnum.CurHP.getPropertyId());
|
||||
int maxHp = trailHero.getProperty().get(HeroAttributeEnum.Hp.getPropertyId());
|
||||
//判断血量万分比,如果小于0.01%返回0.01%
|
||||
int calHp = remainHp>0? (int) (remainHp * 10000D / maxHp > 0 ? remainHp * 10000D / maxHp : 1) :0;
|
||||
MapInfoProto.TrialHeroInfo info = MapInfoProto.TrialHeroInfo.newBuilder().setHeroId(entry.getKey())
|
||||
.setTmpId(trailHero.getTmpId())
|
||||
.setHeroHp(calHp)
|
||||
.setStar(trailHero.getStar())
|
||||
.setLevel(trailHero.getLevel())
|
||||
.build();
|
||||
mapEnterResponse.addInfos(info);
|
||||
}
|
||||
}
|
||||
mapManager.setTeamId(GlobalsDef.TRIAL_TEAM);
|
||||
//当前使用英雄
|
||||
TeamPosManager teamPosManager = UserManager.getUser(uid).getTeamPosManager();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(GlobalsDef.TRIAL_TEAM);
|
||||
if(teamPosHeroInfos!=null&&teamPosHeroInfos.size()==1){
|
||||
mapEnterResponse.setCurHero(teamPosHeroInfos.get(0).getHeroId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -102,9 +155,7 @@ public class TowerMap extends AbstractMap {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshHp(User user, int teamId, int[] checkResult) {
|
||||
super.refreshHp(user, teamId, checkResult);
|
||||
public void updateEnergy(User user) {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
//删点之前进行查找
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
|
|
@ -121,25 +172,29 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
}
|
||||
public void initMap(MapManager mapManager, User user) throws Exception {
|
||||
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
if(mapManager.getTrialInfo().getFloor()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTrialInfo().getFloor();i++){
|
||||
ItemUtil.drop(user,STrialConfig.sTrialConfigMap.get(i).getReward(),1.0f,1,BIReason.TOWER_SWEEP_REWARD);
|
||||
int type = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(i).getRandomBossType());
|
||||
if(type == 3){
|
||||
STrialConfig config = STrialConfig.sTrialConfigMap.get(i);
|
||||
int[][][] randomMapPointId = config.getRandomMapPointId();
|
||||
int randomPoint = MathUtils.randomFromWeight(randomMapPointId[type-1]);
|
||||
int initialEventId = MapPointConfig.getScMapEventMap().get(randomPoint).getInitialEventId();
|
||||
mapManager.addTowerUnusedBuffer(i,initialEventId);
|
||||
}
|
||||
if(type == 4){
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
}
|
||||
}
|
||||
Map<Integer, Cell> trialMapInfo = mapManager.getTrialInfo().getMapInfo();
|
||||
if(trialMapInfo !=null&&!trialMapInfo.isEmpty()){
|
||||
mapManager.setMapInfo(trialMapInfo);
|
||||
return;
|
||||
}
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||
// if(mapManager.getTrialInfo().getFloor()>1&&mapManager.getMapIntoFlag()==0){
|
||||
// for(int i = 1 ; i <mapManager.getTrialInfo().getFloor();i++){
|
||||
//// ItemUtil.drop(user,STrialConfig.sTrialConfigMap.get(i).getReward(),1.0f,1,BIReason.TOWER_SWEEP_REWARD);
|
||||
// int type = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(i).getRandomBossType());
|
||||
// if(type == 3){
|
||||
// STrialConfig config = STrialConfig.sTrialConfigMap.get(i);
|
||||
// int[][][] randomMapPointId = config.getRandomMapPointId();
|
||||
// int randomPoint = MathUtils.randomFromWeight(randomMapPointId[type-1]);
|
||||
// int initialEventId = MapPointConfig.getScMapEventMap().get(randomPoint).getInitialEventId();
|
||||
// mapManager.addTowerUnusedBuffer(i,initialEventId);
|
||||
// }
|
||||
// if(type == 4){
|
||||
// int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor()).getRandomStore());
|
||||
// StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (sTrialConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTrialInfo().getFloor());
|
||||
return;
|
||||
|
|
@ -158,7 +213,13 @@ public class TowerMap extends AbstractMap {
|
|||
/* if(mapManager.getTowerStartTime()!=0){
|
||||
mapManager.setCurrTowerTime((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
}*/
|
||||
int boxPointId = STrialSetting.sTrialSetting.getBoxPointId();
|
||||
mapManager.setTowerStartTime(TimeUtils.now());
|
||||
for(int[] box:sTrialConfig.getBoxPosition()){
|
||||
int position = CellUtil.xy2Pos(box[0], box[1]);
|
||||
Cell cellValue = new Cell(position,0, boxPointId);
|
||||
newMap.put(position,cellValue);
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||
SCMap scMap1 = entry.getValue();
|
||||
|
|
@ -232,4 +293,108 @@ public class TowerMap extends AbstractMap {
|
|||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if (mapManager.getMapInfo() == null) {
|
||||
LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||
if (cell == null) {
|
||||
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||
if (cell == null) {
|
||||
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
}
|
||||
int bigEventId = cell.getEventId();
|
||||
SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
||||
if (sEventPointConfig == null) {
|
||||
LOGGER.info("sEventPointConfig == null");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int[] option = sEventPointConfig.getOption();
|
||||
if (option == null) {
|
||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
int groupId = option[0];
|
||||
int destoryXY = mapManager.getTriggerXY();
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
// int mostTime = sChallengeConfig.getMostTime();
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), 1000, "", GameFightType.MapFastFight, groupId, 3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
int[] checkResult = fightResult.getCheckResult();
|
||||
|
||||
|
||||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
//更新血量
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
if(teamPosHeroInfos==null||teamPosHeroInfos.size()!=1){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
TrailHero trailHero = trialInfo.getHeroInfo().get(teamPosHeroInfos.get(0).getHeroId());
|
||||
|
||||
//血量剩余
|
||||
int remainHp;
|
||||
Map<Integer, Integer> property = trailHero.getProperty();
|
||||
Cell createCell = null;
|
||||
if (resultCode == 0) {
|
||||
remainHp = 0;
|
||||
}else{
|
||||
//判断是否是打败的boss
|
||||
if(trialInfo.getEnergy()==-1){
|
||||
//生成传送门
|
||||
int transportPoint = STrialSetting.sTrialSetting.getTransportPoint();
|
||||
int[] transportPosition = STrialSetting.sTrialSetting.getTransportPortion();
|
||||
MapPointConfig config = MapPointConfig.getScMapEventMap().get(transportPoint);
|
||||
int position = CellUtil.xy2Pos(transportPosition[0], transportPosition[1]);
|
||||
createCell = new Cell(position, config.getInitialEventId(), transportPoint);
|
||||
LOGGER.info("生成传送门信息:{}",createCell.toString());
|
||||
|
||||
}
|
||||
updateEnergy(user);
|
||||
remainHp = checkResult[2];
|
||||
}
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
//生成传送门,需要在删点之后
|
||||
if(createCell!=null){
|
||||
mapManager.addOrUpdateCell(createCell.getCellId(),createCell);
|
||||
CommonProto.Cell transportCell = CBean2Proto.getCell(createCell);
|
||||
fastFightResponseBuilder.setCell(transportCell);
|
||||
}
|
||||
LOGGER.info("剩余血量:{}",remainHp);
|
||||
int maxHp = trailHero.getProperty().get(HeroAttributeEnum.Hp.getPropertyId());
|
||||
property.put(HeroAttributeEnum.CurHP.getPropertyId(), remainHp);
|
||||
int calHp = remainHp>0? (int) (remainHp * 10000D / maxHp > 0 ? remainHp * 10000D / maxHp : 1) :0;
|
||||
|
||||
mapManager.updateTrailHeroInfo(trialInfo.getHeroInfo());
|
||||
fastFightResponseBuilder.addRemainHpList(calHp);
|
||||
//------------
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
|
||||
if (mapManager.getMonsterId() > 0) {
|
||||
BaseBehavior baseBehavior = baseBehaviorMap.get(10);
|
||||
baseBehavior.afterFastFight(user, groupId, fastFightResponseBuilder);
|
||||
}
|
||||
fastFightResponseBuilder.setEnventDrop(drop.build());
|
||||
fastFightResponseBuilder.setResult(resultCode);
|
||||
fastFightResponseBuilder.setEssenceValue(trialInfo.getEnergy());
|
||||
fastFightResponseBuilder.setFightData(fightResult.getFightData());
|
||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
||||
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, checkResult[1]);
|
||||
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -948,7 +948,7 @@ public class ExpeditionLogic {
|
|||
StringBuilder skillSb = new StringBuilder();
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,skillSb).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero, heroAttributeMap).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getTemplateId(),hero.getLevel(), heroAttributeMap).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
|
|
|
|||
|
|
@ -482,6 +482,9 @@ public class HeroLogic{
|
|||
}else {
|
||||
heroIds.forEach(heroId->set.add(heroManager.getHero(heroId.getHeroId()).getTemplateId()));
|
||||
}
|
||||
if(teamId==GlobalsDef.TRIAL_TEAM&&heroIds.size()!=1){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
if(set.size()!=heroIds.size()){
|
||||
throw new ErrorCodeException(ErrorCode.NO_USE_SAME_HERO);
|
||||
|
|
@ -1076,11 +1079,11 @@ public class HeroLogic{
|
|||
}else {
|
||||
heroAttributeMap=calHeroFinalAttributeWhenInMap(user, hero,false,teamId);
|
||||
}
|
||||
return getHeroPropertyBuilder(sb,hero,heroAttributeMap);
|
||||
return getHeroPropertyBuilder(sb,hero.getTemplateId(),hero.getLevel(),heroAttributeMap);
|
||||
}
|
||||
public StringBuilder getHeroPropertyBuilder(StringBuilder sb,Hero hero,Map<Integer, Integer> heroAttributeMap){
|
||||
sb.append(hero.getLevel()).append(DIVISION);
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
public StringBuilder getHeroPropertyBuilder(StringBuilder sb,int tempId,int heroLevel,Map<Integer, Integer> heroAttributeMap){
|
||||
sb.append(heroLevel).append(DIVISION);
|
||||
SCHero scHero = SCHero.getsCHero().get(tempId);
|
||||
List<Integer> templatePropetyIds = transTemplateByHeroPropertyName.get(scHero.getPropertyName());
|
||||
for(Integer templatePropetyId:templatePropetyIds){
|
||||
Integer propertyValue = heroAttributeMap.get(templatePropetyId);
|
||||
|
|
@ -1089,7 +1092,7 @@ public class HeroLogic{
|
|||
}
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(templatePropetyId);
|
||||
if(sPropertyConfig.getIfFormula() == 1){
|
||||
sb.append(propertyValue/(hero.getLevel()+10)/100).append(DIVISION);
|
||||
sb.append(propertyValue/(heroLevel+10)/100).append(DIVISION);
|
||||
}else{
|
||||
if(sPropertyConfig.getStyle() == GlobalsDef.PERCENT_TYPE){
|
||||
sb.append(propertyValue/10000f).append(DIVISION);
|
||||
|
|
|
|||
|
|
@ -31,10 +31,7 @@ public class STrialConfig implements BaseConfig {
|
|||
* 是否是记录层
|
||||
*/
|
||||
private int isSaveFloor;
|
||||
/**
|
||||
* 扫荡奖励
|
||||
*/
|
||||
private int[] reward;
|
||||
|
||||
/**
|
||||
* "类型#怪物组id
|
||||
* 1普通
|
||||
|
|
@ -74,6 +71,10 @@ public class STrialConfig implements BaseConfig {
|
|||
|
||||
private int[][] floorReward;
|
||||
|
||||
private int[][][] boxReward;
|
||||
|
||||
private int[][] boxPosition;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -86,10 +87,6 @@ public class STrialConfig implements BaseConfig {
|
|||
return isSaveFloor;
|
||||
}
|
||||
|
||||
public int[] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int[][] getRandomMonsterType() {
|
||||
return randomMonsterType;
|
||||
}
|
||||
|
|
@ -123,4 +120,12 @@ public class STrialConfig implements BaseConfig {
|
|||
public int[][] getFloorReward() {
|
||||
return floorReward;
|
||||
}
|
||||
|
||||
public int[][][] getBoxReward() {
|
||||
return boxReward;
|
||||
}
|
||||
|
||||
public int[][] getBoxPosition() {
|
||||
return boxPosition;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,14 @@ public class STrialSetting implements BaseConfig{
|
|||
|
||||
private int[] bombReward;
|
||||
|
||||
private int[] bossPosition;
|
||||
|
||||
private int transportPoint;
|
||||
|
||||
private int[] transportPortion;
|
||||
|
||||
private int boxPointId;
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
|
|
@ -69,4 +77,20 @@ public class STrialSetting implements BaseConfig{
|
|||
public void setBombReward(int[] bombReward) {
|
||||
this.bombReward = bombReward;
|
||||
}
|
||||
|
||||
public int[] getBossPosition() {
|
||||
return bossPosition;
|
||||
}
|
||||
|
||||
public int getTransportPoint() {
|
||||
return transportPoint;
|
||||
}
|
||||
|
||||
public int[] getTransportPortion() {
|
||||
return transportPortion;
|
||||
}
|
||||
|
||||
public int getBoxPointId() {
|
||||
return boxPointId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,26 +12,31 @@ import java.util.List;
|
|||
*/
|
||||
public class BIUtil {
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.print(randomForOneArray(23,8).toString());
|
||||
|
||||
outBIReasonFile("serverlogic\\src\\main\\java\\com\\ljsd\\jieling\\globals\\BIReason.java","conf\\BIoutput.txt");
|
||||
}
|
||||
/**
|
||||
* 将数组均匀拆分为几份
|
||||
*/
|
||||
public static List<Integer> randomForOneArray(int sum, int split) {
|
||||
List<Integer> result = new ArrayList<>();
|
||||
if (split == 0) {
|
||||
return result;
|
||||
public static void outBIReasonFile(String in,String out){
|
||||
StringBuffer buf = new StringBuffer();
|
||||
Path path = Paths.get(in);
|
||||
try {
|
||||
List<String> lines = Files.readAllLines(path);
|
||||
lines.forEach(str -> buf.append(str));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int remain = sum % split;
|
||||
int out = split - remain;
|
||||
int item = (sum+out) / split;
|
||||
|
||||
for (int i = 0; i < split; i++) {
|
||||
int innerItem = i == 0 ? item-out : item;
|
||||
result.add(innerItem);
|
||||
String replace = buf.toString().replace("}", "").replace(" ","");
|
||||
String[] split = replace.split("=");
|
||||
StringBuilder content = new StringBuilder();
|
||||
for(String s:split){
|
||||
String[] reason= s.split("int")[0].split(";//");
|
||||
if(reason.length<2){
|
||||
continue;
|
||||
}
|
||||
content.append(reason[0]).append("\t").append(reason[1].replaceAll(" ","")).append("\n");
|
||||
}
|
||||
try {
|
||||
Files.write(Paths.get(out), content.toString().getBytes());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue