折扣 妖精抽卡次数提交
parent
8a1c93570d
commit
3dd49ea868
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 <cost.length;i++){
|
||||
costItem[i] = cost[i];
|
||||
}
|
||||
int[][] costItems = new int[][]{costItem};
|
||||
if(costItems[0][0]==Global.GEM){
|
||||
//每日妖精抽取次数
|
||||
if(sLotterySetting.getMoneyTimes()!=0 && !PlayerLogic.getInstance().checkAndUpdate(user,sLotterySetting.getMoneyTimes(), perCount)){
|
||||
throw new ErrorCodeException("已抽取今日最大次数");
|
||||
}
|
||||
//检测是否有折扣
|
||||
if(sLotterySetting.getDiscountTimes()!=0){
|
||||
List<SPrivilegeTypeConfig> 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<Integer, SSpiritAnimalLevel> levelMap = SSpiritAnimalLevel.configByQualityAndLevel.get(animal.getQuality());
|
||||
|
|
|
|||
|
|
@ -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<Integer, Map<Integer, Integer>> getChangeIds() {
|
||||
return changeIds;
|
||||
|
|
|
|||
Loading…
Reference in New Issue