无尽副本,自动回复提交

back_recharge
lvxinran 2019-08-03 15:46:23 +08:00
parent f187a5043b
commit e5110e48e5
12 changed files with 202 additions and 32 deletions

View File

@ -28,6 +28,8 @@ public class SChallengeSetting implements BaseConfig{
private int[] cost; private int[] cost;
private int actionPowerId;
public int getDailyLimitPrivilege() { public int getDailyLimitPrivilege() {
return dailyLimitPrivilege; return dailyLimitPrivilege;
} }
@ -36,6 +38,7 @@ public class SChallengeSetting implements BaseConfig{
return buyTimesPrivilege; return buyTimesPrivilege;
} }
public int[] getCost() { public int[] getCost() {
return cost; return cost;
} }
@ -47,4 +50,12 @@ public class SChallengeSetting implements BaseConfig{
public int getItem() { public int getItem() {
return item; return item;
} }
public static SChallengeSetting getChallengeSetting() {
return challengeSetting;
}
public int getActionPowerId() {
return actionPowerId;
}
} }

View File

@ -0,0 +1,50 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="EndlessMapConfig")
public class SEndlessMapConfig implements BaseConfig {
private int id;
private int mapId;
private int teleportCost;
private int walkCost;
private int deathCost;
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
@Override
public void init() throws Exception {
sEndlessMapConfigMap = STableManager.getConfig(SEndlessMapConfig.class);
}
public int getId() {
return id;
}
public int getMapId() {
return mapId;
}
public int getTeleportCost() {
return teleportCost;
}
public int getWalkCost() {
return walkCost;
}
public int getDeathCost() {
return deathCost;
}
}

View File

@ -2,7 +2,9 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager; import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table; import com.ljsd.jieling.logic.Table;
import com.ljsd.jieling.util.ItemUtil;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Table(name ="GameSetting") @Table(name ="GameSetting")
@ -92,13 +94,27 @@ public class SGameSetting implements BaseConfig {
private int[][] sevenDaysLastReward; private int[][] sevenDaysLastReward;
private int[][] itemAdd;
private Map<Integer,int[]> itemRecoveryMap;
private static SGameSetting gameSetting; private static SGameSetting gameSetting;
@Override @Override
public void init() throws Exception { public void init() throws Exception {
Map<Integer, SGameSetting> config = STableManager.getConfig(SGameSetting.class); Map<Integer, SGameSetting> config = STableManager.getConfig(SGameSetting.class);
gameSetting = config.get(1); SGameSetting gameSettingTmp = config.get(1);
int[][] itemAdd = gameSettingTmp.getItemAdd();
Map<Integer,int[]> itemReTmp = new HashMap<>(itemAdd.length);
for(int[] items : itemAdd){
itemReTmp.put(items[0],items);
}
gameSettingTmp.setItemRecoveryMap(itemReTmp);
gameSetting = gameSettingTmp;
ItemUtil.initNoDelete();
} }
public static SGameSetting getGameSetting() { public static SGameSetting getGameSetting() {
@ -258,4 +274,17 @@ public class SGameSetting implements BaseConfig {
public int[][] getSevenDaysLastReward() { public int[][] getSevenDaysLastReward() {
return sevenDaysLastReward; return sevenDaysLastReward;
} }
public int[][] getItemAdd() {
return itemAdd;
}
public Map<Integer, int[]> getItemRecoveryMap() {
return itemRecoveryMap;
}
public void setItemRecoveryMap(Map<Integer, int[]> itemRecoveryMap) {
this.itemRecoveryMap = itemRecoveryMap;
}
} }

View File

@ -114,6 +114,7 @@ public interface BIReason {
int LUCKYCAT_CONSUME = 1030; int LUCKYCAT_CONSUME = 1030;
int CREATE_GUILD_CONSUME = 1030; // 创建宗门消耗 int CREATE_GUILD_CONSUME = 1031; // 创建宗门消耗
int ENDLESS_CONSUME_EXECUTION = 1032; //无尽副本消耗行动力
} }

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.globals;
public interface Global { public interface Global {
int STAMINA = 2; // 体力id int STAMINA = 2; // 体力id
int EXECUTION = 3;//行动力id
int HEROSTORY_TICKET = 28; //精英入场券 int HEROSTORY_TICKET = 28; //精英入场券
int GENERALSTORY_TICKET = 27; //普通入场券 int GENERALSTORY_TICKET = 27; //普通入场券
int INVASIONBOSS_TICKET = 44; //外敌挑战券 int INVASIONBOSS_TICKET = 44; //外敌挑战券

View File

@ -62,6 +62,7 @@ public class GMRequestHandler extends BaseHandler{
prarm1 = Integer.parseInt(commandArray[1]); prarm1 = Integer.parseInt(commandArray[1]);
if (prarm1 ==1){ if (prarm1 ==1){
prarm3 = commandArray[2].replace(",","#"); prarm3 = commandArray[2].replace(",","#");
prarm2 = Integer.parseInt(commandArray[2]);
}else{ }else{
if (gmCommandType == GlobalGm.RESET_USER_NAME){ if (gmCommandType == GlobalGm.RESET_USER_NAME){
prarm3 = commandArray[2]; prarm3 = commandArray[2];

View File

@ -238,7 +238,11 @@ public class MapLogic {
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId()); SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
mapEnterResponse.setDieCount(mapManager.getDieCount()); mapEnterResponse.setDieCount(mapManager.getDieCount());
mapEnterResponse.addAllMapList(cells); mapEnterResponse.addAllMapList(cells);
mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1])); if(type==4&&mapManager.getEndlessMapInfo().getCurCell()!=0){
mapEnterResponse.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
}else{
mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
}
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells()); mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
if (mapManager.getTemporaryItems() != null) { if (mapManager.getTemporaryItems() != null) {
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems())); mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
@ -520,7 +524,17 @@ public class MapLogic {
MapInfoProto.MapUpdateResponse.Builder mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder(); MapInfoProto.MapUpdateResponse.Builder mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder();
mapUpdateResponse.setLeftTime(getLeftTime(user, true)); mapUpdateResponse.setLeftTime(getLeftTime(user, true));
mapUpdateResponse.setEventId(cell.getEventId()); mapUpdateResponse.setEventId(cell.getEventId());
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
int[][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = cells.size();;
cost[0]= new int[]{costId,costNum};
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
if(!costResult){
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"行动力不足!");
return;
}
}
// LOGGER.info("updateMap() uid=>{} mapId =>{} eventId=>{}", uid, mapManager.getCurMapId(), cell.getEventId()); // LOGGER.info("updateMap() uid=>{} mapId =>{} eventId=>{}", uid, mapManager.getCurMapId(), cell.getEventId());
mapManager.updateFoodBufferByStep(cells.size()); mapManager.updateFoodBufferByStep(cells.size());
@ -880,7 +894,7 @@ public class MapLogic {
* @param messageType * @param messageType
* @throws Exception * @throws Exception
*/ */
public void outMap(ISession session, int mapId,int outType, MessageTypeProto.MessageType messageType) throws Exception { public void outMap(ISession session, int mapId,int outType, int curXY,MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid(); int uid = session.getUid();
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager(); MapManager mapManager = user.getMapManager();
@ -934,8 +948,21 @@ public class MapLogic {
} }
} }
} }
//无尽副本
if(challengeConfig.getType()==4) { if(challengeConfig.getType()==4) {
mapManager.updateEndlessLocation(mapManager.getCurXY()); mapManager.updateEndlessLocation(curXY);
if(outType==0){
int[][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapId).getTeleportCost();
cost[0]= new int[]{costId,costNum};
boolean costResult = ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
if(!costResult){
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"行动力不足!");
return;
}
LOGGER.info("传送消耗{}行动力"+costNum);
}
} }
MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), builder.build(), true);
return; return;
@ -1290,6 +1317,18 @@ public class MapLogic {
} }
mapManager.setLastFightResult(resultCode); mapManager.setLastFightResult(resultCode);
if (resultCode == 0) { if (resultCode == 0) {
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
//消耗行动力
int [][] cost = new int[1][];
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getCurMapId()).getDeathCost();
int [] cost1 = new int[]{costId,costNum};
cost[0] = cost1;
if(ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
costNum = user.getItemManager().getItem(costId).getItemNum();
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
}
}
// 失败需要等待n秒后复活所有英雄 // 失败需要等待n秒后复活所有英雄
int dieCount = user.getMapManager().getDieCount(); int dieCount = user.getMapManager().getDieCount();
dieCount++; dieCount++;
@ -1322,6 +1361,7 @@ public class MapLogic {
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==2){ if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==2){
fightEndResponse.setLastTowerTime((int)(mapManager.getCurrTowerTime()/1000)); fightEndResponse.setLastTowerTime((int)(mapManager.getCurrTowerTime()/1000));
} }
if(sOptionConfig!=null){ if(sOptionConfig!=null){
int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues(); int[][] jumpTypeValues = sOptionConfig.getJumpTypeValues();
if(jumpTypeValues.length>0 && jumpTypeValues[0][0] == 3){ if(jumpTypeValues.length>0 && jumpTypeValues[0][0] == 3){
@ -2795,6 +2835,7 @@ public class MapLogic {
iterator.remove(); iterator.remove();
} }
} }
user.getTeamPosManager().updateTeamPosByTeamId(401,team); user.getTeamPosManager().updateTeamPosByTeamId(401,team);
} }
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true); MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
@ -2817,6 +2858,7 @@ public class MapLogic {
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),entry.getValue().get(HeroAttributeEnum.Hp.getPropertyId())); mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),entry.getValue().get(HeroAttributeEnum.Hp.getPropertyId()));
} }
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
} }
@ -2860,4 +2902,16 @@ public class MapLogic {
} }
} }
/**
*
* @param session
* @param messageType
* @throws Exception
*/
public void refreshEndlessExecution(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
MapInfoProto.ExecutionRefreshResponse response = MapInfoProto.ExecutionRefreshResponse.newBuilder().setExeValue(user.getItemManager().getItem(1).getItemNum()).build();
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
}
} }

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map;
import com.ljsd.common.mogodb.MongoBase; import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.config.SChallengeSetting;
import com.ljsd.jieling.config.SGameSetting; import com.ljsd.jieling.config.SGameSetting;
import com.ljsd.jieling.config.SVipLevelConfig; import com.ljsd.jieling.config.SVipLevelConfig;
import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.GlobalsDef;
@ -242,30 +243,29 @@ public class MapManager extends MongoBase {
int itemNum = item.getItemNum(); int itemNum = item.getItemNum();
int updateTime = (int) (System.currentTimeMillis() / 1000); int updateTime = (int) (System.currentTimeMillis() / 1000);
int lastUpdateEnergyTime = item.getEndingTime(); int lastUpdateEnergyTime = item.getEndingTime();
int recoveryTime = SGameSetting.getGameSetting().getRecoveryTime();
int heroTimes = SGameSetting.getGameSetting().getHeroTimes();
if(itemId == Global.INVASIONBOSS_TICKET){ int[] recoveryItemInfo = SGameSetting.getGameSetting().getItemRecoveryMap().get(itemId);
recoveryTime = SGameSetting.getGameSetting().getInvasionBossTimesAdd(); if(recoveryItemInfo == null){
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(user.getPlayerInfoManager().getVipLevel()); return;
Map<Integer, Integer> privilegeMap = sVipLevelConfig.getPrivilegeMap();
heroTimes = privilegeMap.get(VipPrivilegeType.CHALLENGE_INVASIONBOSS_LIMIT);
} }
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(user.getPlayerInfoManager().getVipLevel());
Map<Integer, Integer> privilegeMap = sVipLevelConfig.getPrivilegeMap();
Integer heroTimes = privilegeMap.get(recoveryItemInfo[3]);
int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryTime; int recoveryTimes = (updateTime - lastUpdateEnergyTime)/recoveryItemInfo[2];
if(itemNum>=heroTimes){ if(itemNum>=heroTimes){
item.setEndingTime(updateTime); item.setEndingTime(updateTime);
return; return;
} }
if( recoveryTimes>0){ if( recoveryTimes>0){
if(itemNum<heroTimes ){ if(itemNum<heroTimes ){
int addValue = MathUtils.setBetweenWithMax(itemNum+recoveryTimes,0,heroTimes); int addValue = MathUtils.setBetweenWithMax(itemNum+recoveryTimes*recoveryItemInfo[1],0,heroTimes);
if(addValue!=0){ if(addValue!=0){
item.setItemNum(addValue); item.setItemNum(addValue);
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent, BIReason.TIME_REWARD,GlobalsDef.subReason,item.getItemId(),addValue,item.getItemNum()); KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent, BIReason.TIME_REWARD,GlobalsDef.subReason,item.getItemId(),addValue,item.getItemNum());
} }
} }
int time = lastUpdateEnergyTime + recoveryTimes*recoveryTime; int time = lastUpdateEnergyTime + recoveryTimes*recoveryItemInfo[2];
item.setEndingTime(time); item.setEndingTime(time);
} }
} }

View File

@ -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 EndlessRefreshExecutionHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.ENDLESS_EXECUTION_REFRESH_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
MapLogic.getInstance().refreshEndlessExecution(iSession,MessageTypeProto.MessageType.ENDLESS_EXECUTION_REFRESH_RESPONSE);
}
}

View File

@ -21,6 +21,7 @@ public class MapOutRequestHandler extends BaseHandler{
MapInfoProto.MapOutRequest mapOutRequest = MapInfoProto.MapOutRequest.parseFrom(bytes); MapInfoProto.MapOutRequest mapOutRequest = MapInfoProto.MapOutRequest.parseFrom(bytes);
int mapId = mapOutRequest.getMapId(); int mapId = mapOutRequest.getMapId();
int outType = mapOutRequest.getOutType(); int outType = mapOutRequest.getOutType();
MapLogic.getInstance().outMap(iSession, mapId,outType,MessageTypeProto.MessageType.MAP_OUT_RESPONSE); int curXY = mapOutRequest.getCurXY();
MapLogic.getInstance().outMap(iSession, mapId,outType,curXY,MessageTypeProto.MessageType.MAP_OUT_RESPONSE);
} }
} }

View File

@ -298,7 +298,7 @@ public class ItemLogic {
MapManager.getEnergy(user); MapManager.getEnergy(user);
itemList.add(itemMap.get(itemId)); itemList.add(itemMap.get(itemId));
} }
if (itemId == Global.HEROSTORY_TICKET || itemId == Global.INVASIONBOSS_TICKET ){ if (SGameSetting.getGameSetting().getItemRecoveryMap().containsKey(itemId) ){
MapManager.getTimesRecoveryTicket(user,itemId); MapManager.getTimesRecoveryTicket(user,itemId);
itemList.add(itemMap.get(itemId)); itemList.add(itemMap.get(itemId));
} }

View File

@ -32,10 +32,9 @@ public class ItemUtil {
private static Set<Integer> currencyMap = new HashSet<>(2); private static Set<Integer> currencyMap = new HashSet<>(2);
static { static {
notDelete.add(Global.STAMINA); notDelete.add(Global.STAMINA);
notDelete.add(Global.HEROSTORY_TICKET);
notDelete.add(Global.GENERALSTORY_TICKET);
notDelete.add(Global.INVASIONBOSS_TICKET);
equipQulityNameMap.put(5,"传说"); equipQulityNameMap.put(5,"传说");
equipQulityNameMap.put(6,"史诗"); equipQulityNameMap.put(6,"史诗");
currencyMap.add(Global.GEM); currencyMap.add(Global.GEM);
@ -43,6 +42,10 @@ public class ItemUtil {
currencyMap.add(Global.SOULCRYSTAL); currencyMap.add(Global.SOULCRYSTAL);
} }
public static void initNoDelete(){
notDelete.addAll(SGameSetting.getGameSetting().getItemRecoveryMap().keySet());
}
//指定道具掉落(如:邮件,初始化物品) //指定道具掉落(如:邮件,初始化物品)
public static CommonProto.Drop.Builder drop(User user, int[][] itemArr,int reason) throws Exception { public static CommonProto.Drop.Builder drop(User user, int[][] itemArr,int reason) throws Exception {
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder(); CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
@ -713,7 +716,7 @@ public class ItemUtil {
if (entry.getKey() ==Global.STAMINA){ if (entry.getKey() ==Global.STAMINA){
MapManager.getEnergy(user); MapManager.getEnergy(user);
} }
if (entry.getKey() == Global.HEROSTORY_TICKET || entry.getKey() == Global.INVASIONBOSS_TICKET ){ if (SGameSetting.getGameSetting().getItemRecoveryMap().containsKey(entry.getKey())){
MapManager.getTimesRecoveryTicket(user,entry.getKey()); MapManager.getTimesRecoveryTicket(user,entry.getKey());
needUpdateHero = false; needUpdateHero = false;
} }
@ -721,15 +724,13 @@ public class ItemUtil {
} }
} }
if (needUpdateHero){ if (needUpdateHero){
Item item = itemMap.get(Global.HEROSTORY_TICKET); Set<Integer> itemForTimeRecoverys = SGameSetting.getGameSetting().getItemRecoveryMap().keySet();
if(item == null){ for(Integer itemId : itemForTimeRecoverys){
MapManager.getTimesRecoveryTicket(user,Global.HEROSTORY_TICKET); Item item = itemMap.get(itemId);
itemList.add(CBean2Proto.getItem(item,-1)); if(item == null){
} MapManager.getTimesRecoveryTicket(user,itemId);
item = itemMap.get(Global.INVASIONBOSS_TICKET); itemList.add(CBean2Proto.getItem(item,-1));
if(item == null){ }
MapManager.getTimesRecoveryTicket(user,Global.INVASIONBOSS_TICKET);
itemList.add(CBean2Proto.getItem(item,-1));
} }
} }
return itemList; return itemList;
@ -919,7 +920,7 @@ public class ItemUtil {
if ((entry.getKey() == Global.STAMINA)){ if ((entry.getKey() == Global.STAMINA)){
MapManager.getEnergy(user); MapManager.getEnergy(user);
} }
if (entry.getKey() == Global.HEROSTORY_TICKET || entry.getKey() == Global.INVASIONBOSS_TICKET ){ if (SGameSetting.getGameSetting().getItemRecoveryMap().containsKey(entry.getKey()) ){
MapManager.getTimesRecoveryTicket(user,entry.getKey()); MapManager.getTimesRecoveryTicket(user,entry.getKey());
} }
Item item = user.getItemManager().getItem(entry.getKey()); Item item = user.getItemManager().getItem(entry.getKey());