From 3dd49ea8687164d7a300bf112122eb82490c869c Mon Sep 17 00:00:00 2001 From: lvxinran Date: Sat, 24 Oct 2020 15:52:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=98=E6=89=A3=20=E5=A6=96=E7=B2=BE?= =?UTF-8?q?=E6=8A=BD=E5=8D=A1=E6=AC=A1=E6=95=B0=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/logic/dao/PokemonManager.java | 2 +- .../ljsd/jieling/logic/hero/HeroLogic.java | 33 +++++++++++++++++-- .../src/main/java/config/SLotterySetting.java | 13 +++++++- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PokemonManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PokemonManager.java index 72407d442..de6e2569e 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PokemonManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PokemonManager.java @@ -50,7 +50,7 @@ public class PokemonManager extends MongoBase { public void removePokemon(String pokemonId){ pokemonMap.remove(pokemonId); - removeString("pokemonMap."+pokemonId); + removeString(getMongoKey()+".pokemonMap."+pokemonId); } public void updatePokemonStar(String id,int star){ pokemonMap.get(id).setStar(star); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index 6b8d1c32e..ffe0aa12f 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -5,6 +5,7 @@ import com.ljsd.jieling.chat.logic.ChatLogic; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig; import com.ljsd.jieling.core.GlobalsDef; +import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.exception.ErrorCode; @@ -260,7 +261,29 @@ public class HeroLogic{ if(!allowFree){ boolean enoughCost = false; for (int[] cost:sLotterySetting.getCostItem()){ - int [][] costItems = new int[][]{cost}; + int[] costItem = new int[cost.length]; + for(int i= 0; i missingType = SPrivilegeTypeConfig.privilegeByType.get(sLotterySetting.getDiscountTimes()); + Arrays.stream(costItems).forEach(n->{ + for(SPrivilegeTypeConfig config:missingType){ + if(user.getPlayerInfoManager().containPrivilageId(config.getId())){ + n[1] =(int)(n[1]/10000d*(10000+config.getCondition()[0][1])); + } + } + } + ); + } + } enoughCost = ItemUtil.itemCost(user, costItems,BIReason.RANDOM_HERO_CONSUME,type); if(enoughCost){ costAmount = cost; @@ -2812,6 +2835,9 @@ public class HeroLogic{ returnMap.put(coinReturn[0],returnMap.getOrDefault(coinReturn[0],0)+coinReturn[1]*sumItemNum); } + for(String pokemonId:pokemonIds){ + pokemonManager.removePokemon(pokemonId); + } }else{ SSpiritAnimal animal = SSpiritAnimal.pieceConfig.get(pieceId); @@ -2819,11 +2845,12 @@ public class HeroLogic{ if(animal==null){ throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); } + costMap.put(pieceId,pieceAmount); boolean checkCost = ItemUtil.checkCost(user, costMap); + int[] piecesCoinReturn = animal.getPiecesCoinReturn(); if(!checkCost){ throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); } - int[] piecesCoinReturn = animal.getPiecesCoinReturn(); returnMap.put(piecesCoinReturn[0],returnMap.getOrDefault(piecesCoinReturn[0],0)+piecesCoinReturn[1]*pieceAmount); ItemUtil.itemCost(user,costMap,BIReason.SPECIAL_FREE_PIECE_CONSUME,1); } @@ -2893,7 +2920,7 @@ public class HeroLogic{ if(animal==null){ throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); } - if(level>=animal.getMaxLevel()){ + if(pokemon.getLevel()>=animal.getMaxLevel()||level>animal.getMaxLevel()){ throw new ErrorCodeException(ErrorCode.HERO_LEVE_MAX); } Map levelMap = SSpiritAnimalLevel.configByQualityAndLevel.get(animal.getQuality()); diff --git a/tablemanager/src/main/java/config/SLotterySetting.java b/tablemanager/src/main/java/config/SLotterySetting.java index f17b974d9..58d803dcb 100644 --- a/tablemanager/src/main/java/config/SLotterySetting.java +++ b/tablemanager/src/main/java/config/SLotterySetting.java @@ -23,7 +23,11 @@ public class SLotterySetting implements BaseConfig { private int maxTimes; - private int[][] diamondBoxContain; + private int moneyTimes; + + private int discountTimes; + + private int[][] diamondBoxContain; private int[][] tenTimesMustGetItem; @@ -103,6 +107,13 @@ public class SLotterySetting implements BaseConfig { return activityId; } + public int getMoneyTimes() { + return moneyTimes; + } + + public int getDiscountTimes() { + return discountTimes; + } public static Map> getChangeIds() { return changeIds;