突破返还

back_recharge
wangyuan 2019-05-29 13:31:41 +08:00
parent c3f08b1321
commit 65747a5daf
5 changed files with 42 additions and 5 deletions

View File

@ -33,6 +33,8 @@ public class SCHeroRankUpConfig implements BaseConfig{
private int show; private int show;
private int[][] sumConsume;
@Override @Override
public void init() throws Exception { public void init() throws Exception {
Map<Integer,Map<Integer,Map<Integer,SCHeroRankUpConfig>>> result = new TreeMap<>(); Map<Integer,Map<Integer,Map<Integer,SCHeroRankUpConfig>>> result = new TreeMap<>();

View File

@ -57,6 +57,10 @@ public class SGameSetting implements BaseConfig {
private int adventureBaseRewardPrivilege; private int adventureBaseRewardPrivilege;
private int adventureFastBattlePrivilege; private int adventureFastBattlePrivilege;
private float smeltReturnDiscount;
private int equipCompoundLimit;
private static SGameSetting gameSetting; private static SGameSetting gameSetting;

View File

@ -239,6 +239,12 @@ public class PlayerManager extends MongoBase {
return false; return false;
} }
Integer limitNum = sVipLevelConfig.getPrivilegeMap().get(privilageId); Integer limitNum = sVipLevelConfig.getPrivilegeMap().get(privilageId);
if(limitNum == null){
return false;
}
if(!vipInfo.containsKey(privilageId)){
vipInfo.put(privilageId,0);
}
if(vipInfo.get(privilageId) + updateNum > limitNum){ if(vipInfo.get(privilageId) + updateNum > limitNum){
return false; return false;
} }

View File

@ -276,20 +276,18 @@ public class WorkShopLogic {
int[][] costs = new int[costLength][]; int[][] costs = new int[costLength][];
if(costMineral!=null && costMineral.length>0){ if(costMineral!=null && costMineral.length>0){
costs[--costLength] =costMineral; costs[--costLength] =costMineral;
costs[costLength][1] = costs[costLength][1]*nums;
} }
if(runneIdsList.size() ==0){ if(runneIdsList.size() ==0){
runneIdsList =new ArrayList<>(specialRunes.length); runneIdsList =new ArrayList<>(specialRunes.length);
} }
for(Integer runneId : runneIdsList){ for(Integer runneId : runneIdsList){
costs[--costLength] = new int[]{runneId, nums}; costs[--costLength] = new int[]{runneId, 1};
} }
for(int specialRunneId[] : specialRunes){ for(int specialRunneId[] : specialRunes){
costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]*nums}; costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]};
runneIdsList.add(specialRunneId[0]);
} }
boolean enoughCost = ItemUtil.itemCost(user,costs); boolean enoughCost = ItemUtil.itemCost(user,costs,nums);
if(!enoughCost){ if(!enoughCost){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE,"道具不足"); MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE,"道具不足");
return; return;

View File

@ -686,6 +686,17 @@ public class ItemUtil {
return true; return true;
} }
public static boolean itemCost(User user,int[][] costItems,int times) throws Exception {
Map<Integer, Integer> itemMap = new HashMap<>();
selectCost(costItems,itemMap,times);
boolean result = checkCost(user, itemMap);
if (!result) {
return false;
}
useItem(user, itemMap);
return true;
}
public static boolean checkCost(User user, Map<Integer, Integer> itemMap) throws Exception { public static boolean checkCost(User user, Map<Integer, Integer> itemMap) throws Exception {
if (itemMap == null) { if (itemMap == null) {
return true; return true;
@ -732,6 +743,22 @@ public class ItemUtil {
} }
} }
private static void selectCost(int[][] costItems, Map<Integer, Integer> itemMap,int times) {
for (int[] costItem : costItems){
int itemId = costItem[0];
int itemNum = costItem[1]*times;
SItem sItem = SItem.getsItemMap().get(itemId);
int itemType = getItemType(sItem);
switch (itemType) {
case GlobalItemType.ITEM:
putcountMap(itemId,itemNum,itemMap);
break;
default:
break;
}
}
}
/** /**
* 使 * 使
* @param user * @param user