森罗幻境提交,部分任务添加

back_recharge
lvxinran 2020-06-03 16:13:26 +08:00
parent 4defdf8aca
commit 86b864fc45
10 changed files with 128 additions and 89 deletions

View File

@ -252,5 +252,7 @@ public interface BIReason {
int ECPEDITION_RELIVE_CONSUME = 1061;//大闹天宫消耗
int TRIAL_ADD_HP_CONSUME = 1062;//试炼回春散消耗
}

View File

@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.PVEFightEvent;
import com.ljsd.jieling.logic.fight.PVPFightEvent;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.network.session.ISession;
@ -92,8 +93,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
}
RankEnum.toRank(RankEnum.CAR_DEALY_RANK.getType()).incrementRankScore(uid,"",myscore);
RankEnum.toRank(RankEnum.CAR_DEALY_GUILD_RANK.getType()).incrementRankScore(guildInfo.getId(),"",gainScore,isNew?1:0);
user.getUserMissionManager().onGameEvent(user, GameEvent.CAR_PLAY,1);
}break;
case 2:{
@ -131,6 +131,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challeageId));
RedisUtil.getInstence().zsetAddOne(key,content + "|" + challeageId,(int)(System.currentTimeMillis()/1000));
RedisUtil.getInstence().zsetAddOne(challenegeKey,challengeContent + "|" + uid,(int)(System.currentTimeMillis()/1000));
user.getUserMissionManager().onGameEvent(user, GameEvent.CAR_PLAY_LOOT,1);
}break;
default:
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);

View File

@ -2,7 +2,6 @@ package com.ljsd.jieling.handler.map;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -23,7 +22,6 @@ import com.ljsd.jieling.handler.mission.Mission;
import com.ljsd.jieling.ktbeans.KTGameType;
import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.dao.*;
@ -1342,14 +1340,9 @@ public class MapLogic {
//删点之前进行查找
if (sChallengeConfig.getType() == 2) {
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
if(cell.getCellId()!=mapManager.getBossXY()){
if(mapManager.getTrialInfo().getEnergy()!=-1){
if (randomMonsterType[0][1] == cell.getPointId()) {
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
} else {
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getEliteEnergy());
}
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
}
}
}
@ -2575,15 +2568,30 @@ public class MapLogic {
MapManager mapManager = user.getMapManager();
TrialInfo trialInfo = mapManager.getTrialInfo();
Map<String, TrailHero> heroInfo = trialInfo.getHeroInfo();
if(mapManager.getCurMapId()==0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if(heroInfo.size()<1||!heroInfo.containsKey(heroId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] healing = STrialSetting.sTrialSetting.getHealingId();
if(trialInfo.getAddHpCount()>=healing[1]){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
boolean itemCost = ItemUtil.itemCost(user, new int[][]{{healing[0],1}}, BIReason.TRIAL_ADD_HP_CONSUME, 1);
if(!itemCost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
Map<Integer, Integer> propertyMap = heroInfo.get(heroId).getProperty();
int curHp = propertyMap.get(HeroAttributeEnum.CurHP.getPropertyId());
if(curHp==0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}else{
//todo 加血逻辑
int maxHp = propertyMap.get(HeroAttributeEnum.Hp.getPropertyId());
propertyMap.put(HeroAttributeEnum.CurHP.getPropertyId(),curHp+maxHp*5000/10000);
trialInfo.getHeroInfo().get(heroId).setProperty(propertyMap);
mapManager.updateTrailHeroInfo(heroInfo);
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),null);
}
@ -3087,7 +3095,7 @@ public class MapLogic {
* @param messageType
* @throws Exception
*/
public void trialGetBox(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
public void trialGetBox(ISession session,int type,MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
MapManager mapManager = user.getMapManager();
AbstractMap map = getMap(user);
@ -3098,10 +3106,10 @@ public class MapLogic {
int floor = mapManager.getTrialInfo().getFloor();
if(floor>10000){
STrialwelfareConfig welfareConfig = STrialwelfareConfig.sTrialwelfareConfigMap.get(floor % 10000);
drop = getBoxReward(welfareConfig.getBoxPosition(),welfareConfig.getBoxReward(),user,curXY);
drop = getBoxReward(welfareConfig.getBoxPosition(),welfareConfig.getBoxReward(),user,curXY,type);
}else{
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(floor);
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY);
drop = getBoxReward(sTrialConfig.getBoxPosition(),sTrialConfig.getBoxReward(),user,curXY,type);
}
}
MapInfoProto.GetTrialBoxRewardResponse response = MapInfoProto.GetTrialBoxRewardResponse.newBuilder().setBoxDrop(drop).build();
@ -3117,21 +3125,35 @@ public class MapLogic {
* @return
* @throws Exception
*/
private CommonProto.Drop.Builder getBoxReward(int[][] boxPosition,int[][][] boxReward,User user,int curXY) throws Exception {
private CommonProto.Drop.Builder getBoxReward(int[][] boxPosition,int[][][] boxReward,User user,int curXY,int type) throws Exception {
MapManager mapManager = user.getMapManager();
CommonProto.Drop.Builder drop= null;
for(int i = 0 ; i<boxPosition.length;i++){
int xyPos = CellUtil.xy2Pos(boxPosition[i][0], boxPosition[i][1]);
Cell cell = mapManager.getMapInfo().get(xyPos);
if(xyPos==curXY){
if(type==1){
List<int[][]> reward = Arrays.asList(boxReward);
drop = ItemUtil.drop(user,reward,BIReason.MAP_EVENET_REWARD);
for(int[] position:boxPosition){
int xyPos = CellUtil.xy2Pos(position[0], position[1]);
Cell cell = mapManager.getMapInfo().get(xyPos);
if(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) {
cell.setPointId(0);
int[][] dropArray = boxReward[i];
drop = ItemUtil.drop(user, dropArray, BIReason.MAP_EVENET_REWARD);
mapManager.addOrUpdateCell(cell.getCellId(), cell);
break;
}else{
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
}else{
for(int i = 0 ; i<boxPosition.length;i++){
int xyPos = CellUtil.xy2Pos(boxPosition[i][0], boxPosition[i][1]);
Cell cell = mapManager.getMapInfo().get(xyPos);
if(xyPos==curXY){
if(cell!=null&&cell.getPointId()==STrialSetting.sTrialSetting.getBoxPointId()) {
cell.setPointId(0);
int[][] dropArray = boxReward[i];
drop = ItemUtil.drop(user, dropArray, BIReason.MAP_EVENET_REWARD);
mapManager.addOrUpdateCell(cell.getCellId(), cell);
break;
}else{
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
}
}

View File

@ -27,7 +27,7 @@ public class FightBehavior extends BaseBehavior {
// int triggerXY = mapManager.getTriggerXY();
// Cell cell = mapManager.getMapInfo().get(triggerXY);
// STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
// int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
// int[][] randomMonsterType = sTrialConfig.getGameType();
// if (randomMonsterType[0][1] == cell.getPointId()) {
// mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy());
// } else {

View File

@ -4,6 +4,7 @@ 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.MapInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@ -13,7 +14,7 @@ import org.springframework.stereotype.Component;
* @discribe
*/
@Component
public class TrialGetBoxRewardHandler extends BaseHandler {
public class TrialGetBoxRewardHandler extends BaseHandler<MapInfoProto.GetTrialBoxRewardRequest> {
@Override
@ -22,7 +23,7 @@ public class TrialGetBoxRewardHandler extends BaseHandler {
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
MapLogic.getInstance().trialGetBox(iSession,MessageTypeProto.MessageType.TRIAL_GET_BOX_RESPONSE);
public void processWithProto(ISession iSession, MapInfoProto.GetTrialBoxRewardRequest proto) throws Exception {
MapLogic.getInstance().trialGetBox(iSession,proto.getType(),MessageTypeProto.MessageType.TRIAL_GET_BOX_RESPONSE);
}
}

View File

@ -0,0 +1,27 @@
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/3
* @discribe
*/
@Component
public class UseAddHpHandler extends BaseHandler<MapInfoProto.UseAddHpItemRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.TRIAL_USE_ADD_HP_ITEM_REQUEST;
}
@Override
public void processWithProto(ISession iSession, MapInfoProto.UseAddHpItemRequest proto) throws Exception {
MapLogic.getInstance().useAddHp(iSession,proto.getHeroId(), MessageTypeProto.MessageType.TRIAL_USE_ADD_HP_ITEM_RESPONSE);
}
}

View File

@ -1,14 +1,11 @@
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;
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.*;
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
@ -24,22 +21,17 @@ 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.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.FightInfoProto;
import com.ljsd.jieling.protocols.MapInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
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
@ -164,15 +156,8 @@ public class TowerMap extends AbstractMap {
//删点之前进行查找
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
if(cell.getCellId()!=mapManager.getBossXY()){
if(mapManager.getTrialInfo().getEnergy()>=0){
if (randomMonsterType[0][1] == cell.getPointId()) {
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
} else {
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getEliteEnergy());
}
}
if(cell.getCellId()!=mapManager.getBossXY()&&mapManager.getTrialInfo().getEnergy()>=0){
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
}
}
public void initMap(MapManager mapManager, User user) throws Exception {
@ -220,8 +205,8 @@ public class TowerMap extends AbstractMap {
Map<Integer, Cell> newMap = new HashMap<>();
Random random = new Random();
Map<Integer, SCMap> scMap = SCMap.sCMap.get(sTrialConfig.getMapId());
Map<Integer, Cell> cellMap1 = new HashMap<>(sTrialConfig.getMonsterCount()[0]);
Map<Integer, Cell> cellMap2 = new HashMap<>(sTrialConfig.getMonsterCount()[1]);
Map<Integer, Cell> cellMap1 = new HashMap<>(sTrialConfig.getGameCount()[0]);
Map<Integer, Cell> cellMap2 = new HashMap<>(sTrialConfig.getGameCount()[1]);
/* if(mapManager.getTowerStartTime()!=0){
mapManager.setCurrTowerTime((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
@ -243,7 +228,7 @@ public class TowerMap extends AbstractMap {
}
if (scMap1.getEvent() == 1) {
int i = 0;
while (cellMap1.size() < sTrialConfig.getMonsterCount()[0]) {
while (cellMap1.size() < sTrialConfig.getGameCount()[0]) {
i++;
if (i >= 10000) {
break;
@ -252,7 +237,7 @@ public class TowerMap extends AbstractMap {
int x = scMap1.getGroups()[randomIndex][0];
int y = scMap1.getGroups()[randomIndex][1];
int xy = CellUtil.xy2Pos(x, y);
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(sTrialConfig.getRandomMonsterType()[0][1]);
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(sTrialConfig.getGameType()[0][1]);
if (mapPointConfig == null) {
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
continue;
@ -262,7 +247,7 @@ public class TowerMap extends AbstractMap {
}
} else if (scMap1.getEvent() == 2) {
int i = 0;
while (cellMap2.size() < sTrialConfig.getMonsterCount()[1]) {
while (cellMap2.size() < sTrialConfig.getGameCount()[1]) {
i++;
if (i >= 10000) {
break;
@ -271,7 +256,7 @@ public class TowerMap extends AbstractMap {
int x = scMap1.getGroups()[randomIndex][0];
int y = scMap1.getGroups()[randomIndex][1];
int xy = CellUtil.xy2Pos(x, y);
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(sTrialConfig.getRandomMonsterType()[1][1]);
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(sTrialConfig.getGameType()[1][1]);
if (mapPointConfig == null) {
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
continue;
@ -279,7 +264,29 @@ public class TowerMap extends AbstractMap {
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
cellMap2.put(xy, cellValue);
}
} else {
} else if (scMap1.getEvent()==99){
//每层只有四个怪
int i = 0;
int[] monster = MathUtils.randomFromWeightWithTaking(sTrialConfig.getMonsterPoint(),4);
while (cellMap2.size() < 4 ) {
if (i >= 10000) {
break;
}
int randomIndex = random.nextInt(scMap1.getGroups().length);
int x = scMap1.getGroups()[randomIndex][0];
int y = scMap1.getGroups()[randomIndex][1];
int xy = CellUtil.xy2Pos(x, y);
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(monster[i]);
if (mapPointConfig == null) {
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
cellMap2.put(xy, cellValue);
i++;
}
}
else {
// 随机出现的事件点
int randomIndex = random.nextInt(scMap1.getGroups().length);
int x = scMap1.getGroups()[randomIndex][0];

View File

@ -22,6 +22,7 @@ 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.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
@ -267,6 +268,7 @@ public class DeathPathLogic {
if(!deathMaxDamage.containsKey(pathId)||deathMaxDamage.get(pathId)<damage){
user.getGuildMyInfo().setDeathMaxDamage(pathId,damage);
}
user.getUserMissionManager().onGameEvent(user, GameEvent.TEN_CHALLENGE,1);
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
}

View File

@ -32,16 +32,11 @@ public class STrialConfig implements BaseConfig {
*/
private int isSaveFloor;
/**
* "#id
* 1
* 2"
*/
private int[][] randomMonsterType;
private int[][] gameType;
/**
*
*/
private int[] monsterCount;
private int[] gameCount;
/**
* "#
* 1boss
@ -58,14 +53,10 @@ public class STrialConfig implements BaseConfig {
*
*/
private int normalEnergy;
/**
*
*/
private int eliteEnergy;
private int[][] randomStore;
private int[] monsterPoint;
private int[][] monsterPoint;
/**
*
*/
@ -89,12 +80,12 @@ public class STrialConfig implements BaseConfig {
return isSaveFloor;
}
public int[][] getRandomMonsterType() {
return randomMonsterType;
public int[][] getGameType() {
return gameType;
}
public int[] getMonsterCount() {
return monsterCount;
public int[] getGameCount() {
return gameCount;
}
public int[][] getRandomBossType() {
@ -105,10 +96,6 @@ public class STrialConfig implements BaseConfig {
return normalEnergy;
}
public int getEliteEnergy() {
return eliteEnergy;
}
public int[][][] getRandomMapPointId() {
return randomMapPointId;
}
@ -131,7 +118,7 @@ public class STrialConfig implements BaseConfig {
return boxPosition;
}
public int[] getMonsterPoint() {
public int[][] getMonsterPoint() {
return monsterPoint;
}
}

View File

@ -23,15 +23,6 @@ public class STrialSetting implements BaseConfig{
}
private int id;
/**
*
*/
private int dailyReset;
/**
*
*/
private int rebornTimes;
/**
* id
*/
@ -51,18 +42,13 @@ public class STrialSetting implements BaseConfig{
private int[] treasureProbability;
//回春散
private int[] healingId;
public int getId() {
return id;
}
public int getDailyReset() {
return dailyReset;
}
public int getRebornTimes() {
return rebornTimes;
}
public int[][] getBombId() {
return bombId;
}
@ -98,4 +84,8 @@ public class STrialSetting implements BaseConfig{
public int[] getTreasureProbability() {
return treasureProbability;
}
public int[] getHealingId() {
return healingId;
}
}