逍遥游修改
parent
8f17bdc655
commit
4d3d9abf1e
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.logic.mission.MissionType;
|
import com.ljsd.jieling.logic.mission.MissionType;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
import rpc.protocols.MapInfoProto;
|
import rpc.protocols.MapInfoProto;
|
||||||
import rpc.protocols.MessageTypeProto;
|
import rpc.protocols.MessageTypeProto;
|
||||||
|
@ -315,47 +316,42 @@ public class JourneyMap {
|
||||||
}
|
}
|
||||||
//取总点数和最大格子数,算出走的步数
|
//取总点数和最大格子数,算出走的步数
|
||||||
diceAmount =Math.min(diceAmount,pathInfo.getAllPathInfo().length-pathInfo.getCurrentPath());
|
diceAmount =Math.min(diceAmount,pathInfo.getAllPathInfo().length-pathInfo.getCurrentPath());
|
||||||
|
|
||||||
// 服务器调试,一次走一格
|
|
||||||
// diceAmount = 1;
|
|
||||||
// randomNum.clear();
|
|
||||||
// randomNum.add(1);
|
|
||||||
|
|
||||||
if(diceAmount==0){
|
if(diceAmount==0){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pathInfo.setCurrentPath(pathInfo.getCurrentPath()+diceAmount);
|
// 服务器调试,一次走一格
|
||||||
Path arrivePath = pathInfo.getAllPathInfo()[pathInfo.getCurrentPath() - 1];
|
// int num = 4;
|
||||||
int mapPointId = arrivePath.getMapPointId();
|
// diceAmount = num;
|
||||||
|
// randomNum.clear();
|
||||||
|
// randomNum.add(num);
|
||||||
|
|
||||||
MapInfoProto.JourneyDoResponse.Builder builder = MapInfoProto.JourneyDoResponse.newBuilder().addAllPointes(randomNum);
|
MapInfoProto.JourneyDoResponse.Builder builder = MapInfoProto.JourneyDoResponse.newBuilder().addAllPointes(randomNum);
|
||||||
//基础奖励
|
//基础奖励
|
||||||
int[] common = travelConfig.getCommonReward();
|
int[] common = travelConfig.getCommonReward();
|
||||||
|
|
||||||
int[] commonRewardArray= new int[randomNum.size()] ;
|
ArrayList<Integer> reward = new ArrayList<>();
|
||||||
for(int i=0;i<commonRewardArray.length;i++){
|
for (int i = 0; i < randomNum.size(); i++) {
|
||||||
commonRewardArray[i] = common[randomNum.get(i)-1];
|
reward.add(common[randomNum.get(i)-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonProto.Drop.Builder drop = null;// ItemUtil.drop(user,commonRewardArray,1,0, BIReason.JOURNEY_COMMON_REWARD);
|
CommonProto.Drop.Builder drop = null;// ItemUtil.drop(user,commonRewardArray,1,0, BIReason.JOURNEY_COMMON_REWARD);
|
||||||
|
|
||||||
//地图点判断
|
|
||||||
if(mapPointId==0){
|
|
||||||
builder.setPathType(0);
|
|
||||||
}else{
|
|
||||||
int pathType = 0;
|
int pathType = 0;
|
||||||
|
Path arrivePath = null;
|
||||||
|
for (int i = 0; i < diceAmount; i++) {
|
||||||
|
|
||||||
|
pathInfo.setCurrentPath(pathInfo.getCurrentPath()+1);
|
||||||
|
arrivePath = pathInfo.getAllPathInfo()[pathInfo.getCurrentPath() - 1];
|
||||||
|
int mapPointId = arrivePath.getMapPointId();
|
||||||
|
|
||||||
|
//地图点判断
|
||||||
|
if(mapPointId!=0){
|
||||||
MapPointConfig config = MapPointConfig.getScMapEventMap().get(mapPointId);
|
MapPointConfig config = MapPointConfig.getScMapEventMap().get(mapPointId);
|
||||||
switch (config.getStyle()){
|
switch (config.getStyle()){
|
||||||
|
|
||||||
case EventType.reward:
|
case EventType.reward:
|
||||||
//奖励节点完成
|
//奖励节点完成
|
||||||
commonRewardArray = new int[randomNum.size()+1];
|
reward.add(arrivePath.getRewardId());
|
||||||
for(int i=0;i<commonRewardArray.length-1;i++){
|
|
||||||
commonRewardArray[i] = common[randomNum.get(i)-1];
|
|
||||||
}
|
|
||||||
// int[][] treasureChest = travelConfig.getTreasureChest();
|
|
||||||
// int[] reward = MathUtils.randomFromWeightWithTaking(treasureChest, 1);
|
|
||||||
// commonRewardArray[commonRewardArray.length-1] = reward[0];
|
|
||||||
commonRewardArray[commonRewardArray.length-1] = arrivePath.getRewardId();
|
|
||||||
pathType = 1;
|
pathType = 1;
|
||||||
break;
|
break;
|
||||||
case EventType.random:
|
case EventType.random:
|
||||||
|
@ -386,8 +382,8 @@ public class JourneyMap {
|
||||||
Map<Integer, List<Long>> monsterHpByGroup = MonsterUtil.getMonsterHpByGroup(bossId);
|
Map<Integer, List<Long>> monsterHpByGroup = MonsterUtil.getMonsterHpByGroup(bossId);
|
||||||
List<Long> list = monsterHpByGroup.get(0);
|
List<Long> list = monsterHpByGroup.get(0);
|
||||||
Map<Integer,Long> hpMap = new HashMap<>();
|
Map<Integer,Long> hpMap = new HashMap<>();
|
||||||
for(int i = 1;i<=list.size();i++){
|
for(int j = 1;j<=list.size();j++){
|
||||||
hpMap.put(i,list.get(i-1));
|
hpMap.put(j,list.get(j-1));
|
||||||
}
|
}
|
||||||
monster.setRemainHp(hpMap);
|
monster.setRemainHp(hpMap);
|
||||||
long allHp =0;
|
long allHp =0;
|
||||||
|
@ -408,8 +404,8 @@ public class JourneyMap {
|
||||||
case EventType.journeyStore:
|
case EventType.journeyStore:
|
||||||
List<SFreeTravelStore> sFreeTravelStores = SFreeTravelStore.storeMapByMapId.get(mapId);
|
List<SFreeTravelStore> sFreeTravelStores = SFreeTravelStore.storeMapByMapId.get(mapId);
|
||||||
int[] goodsArray = new int[sFreeTravelStores.size()];
|
int[] goodsArray = new int[sFreeTravelStores.size()];
|
||||||
for(int i = 0 ; i <sFreeTravelStores.size();i++){
|
for(int j = 0 ; j <sFreeTravelStores.size();j++){
|
||||||
goodsArray[i] = sFreeTravelStores.get(i).getID();
|
goodsArray[j] = sFreeTravelStores.get(j).getID();
|
||||||
}
|
}
|
||||||
int goodsId = MathUtils.randomFromArray(goodsArray);
|
int goodsId = MathUtils.randomFromArray(goodsArray);
|
||||||
JourneyGoods journeyGoods = new JourneyGoods(goodsId, (int) ((TimeUtils.now()+TimeUtils.ONE_MINUTE* SSpecialConfig.getIntegerValue(SSpecialConfig.FREETRAVEL_EVENT_TIME)) / 1000));
|
JourneyGoods journeyGoods = new JourneyGoods(goodsId, (int) ((TimeUtils.now()+TimeUtils.ONE_MINUTE* SSpecialConfig.getIntegerValue(SSpecialConfig.FREETRAVEL_EVENT_TIME)) / 1000));
|
||||||
|
@ -427,41 +423,24 @@ public class JourneyMap {
|
||||||
case EventType.doubleReward:
|
case EventType.doubleReward:
|
||||||
//倍数
|
//倍数
|
||||||
int mutiNum = config.getInitialEventId();
|
int mutiNum = config.getInitialEventId();
|
||||||
commonRewardArray = new int[randomNum.size()*mutiNum];
|
for(int k=0; k<mutiNum; k++){//2
|
||||||
for(int j=0;j<randomNum.size();j++){//1
|
reward.add(common[randomNum.get(0)-1]);
|
||||||
for(int i = 0;i<mutiNum;i++){//2
|
|
||||||
commonRewardArray[i+j*mutiNum] = common[randomNum.get(j)-1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pathType = 2;
|
pathType = 2;
|
||||||
break;
|
break;
|
||||||
case EventType.journeyFinal:
|
case EventType.journeyFinal:
|
||||||
pathType = 7;
|
pathType = 7;
|
||||||
|
|
||||||
commonRewardArray = new int[randomNum.size()+1];
|
|
||||||
for(int i=0;i<commonRewardArray.length-1;i++){
|
|
||||||
commonRewardArray[i] = common[randomNum.get(i)-1];
|
|
||||||
}
|
|
||||||
//int []finalReward = travelConfig.getFinalReward();
|
|
||||||
//commonRewardArray[commonRewardArray.length-1] = finalReward;
|
|
||||||
|
|
||||||
int []commonRewardArrayNew = Arrays.copyOf(commonRewardArray,commonRewardArray.length
|
|
||||||
+travelConfig.getFinalReward().length);
|
|
||||||
|
|
||||||
System.arraycopy(travelConfig.getFinalReward(),0,commonRewardArrayNew,
|
|
||||||
commonRewardArray.length,travelConfig.getFinalReward().length);
|
|
||||||
commonRewardArray=commonRewardArrayNew;
|
|
||||||
|
|
||||||
|
|
||||||
if(!pathInfo.isFirstPass()){
|
if(!pathInfo.isFirstPass()){
|
||||||
commonRewardArray = Arrays.copyOf(commonRewardArray,commonRewardArray.length+1);
|
reward.add(travelConfig.getFirstReward());
|
||||||
commonRewardArray[commonRewardArray.length-1] = travelConfig.getFirstReward();
|
|
||||||
pathInfo.setFirstPass(true);
|
pathInfo.setFirstPass(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
builder.setPathType(pathType);
|
builder.setPathType(pathType);
|
||||||
|
|
||||||
// 逍遥游仙缘埋点
|
// 逍遥游仙缘埋点
|
||||||
|
@ -475,9 +454,9 @@ public class JourneyMap {
|
||||||
user.getMapManager().setJourneyFinishNum(finishNum);
|
user.getMapManager().setJourneyFinishNum(finishNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
Integer[] array = reward.toArray(new Integer[0]);
|
||||||
|
int[] ints = Arrays.stream(array).mapToInt(Integer::intValue).toArray();
|
||||||
drop = ItemUtil.drop(user,commonRewardArray,1,0, BIReason.JOURNEY_COMMON_REWARD);
|
drop = ItemUtil.drop(user,ints,1,0,BIReason.JOURNEY_COMMON_REWARD);
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
arrivePath.setMapPointId(0);
|
arrivePath.setMapPointId(0);
|
||||||
user.getMapManager().updateJourneyInfoByMapId(mapId,pathInfo);
|
user.getMapManager().updateJourneyInfoByMapId(mapId,pathInfo);
|
||||||
|
@ -485,8 +464,9 @@ public class JourneyMap {
|
||||||
|
|
||||||
//消耗云游值任务
|
//消耗云游值任务
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.XIAOYAOYOU_CONSUME, MissionType.XIAOYAOYOU_CONSUME_NUM, consume[1]);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.XIAOYAOYOU_CONSUME, MissionType.XIAOYAOYOU_CONSUME_NUM, consume[1]);
|
||||||
|
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build(),true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build(),true);
|
||||||
|
|
||||||
|
reward.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,9 +3,9 @@ package com.ljsd.jieling.handler.map.mapHandler;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
import com.ljsd.jieling.handler.map.JourneyMap;
|
import com.ljsd.jieling.handler.map.JourneyMap;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import rpc.protocols.MapInfoProto;
|
import rpc.protocols.MapInfoProto;
|
||||||
import rpc.protocols.MessageTypeProto;
|
import rpc.protocols.MessageTypeProto;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lvxinran
|
* @author lvxinran
|
||||||
|
|
Loading…
Reference in New Issue