突破返还
parent
c3f08b1321
commit
65747a5daf
|
@ -33,6 +33,8 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
|||
|
||||
private int show;
|
||||
|
||||
private int[][] sumConsume;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer,Map<Integer,Map<Integer,SCHeroRankUpConfig>>> result = new TreeMap<>();
|
||||
|
|
|
@ -57,6 +57,10 @@ public class SGameSetting implements BaseConfig {
|
|||
private int adventureBaseRewardPrivilege;
|
||||
private int adventureFastBattlePrivilege;
|
||||
|
||||
private float smeltReturnDiscount;
|
||||
|
||||
private int equipCompoundLimit;
|
||||
|
||||
|
||||
|
||||
private static SGameSetting gameSetting;
|
||||
|
|
|
@ -239,6 +239,12 @@ public class PlayerManager extends MongoBase {
|
|||
return false;
|
||||
}
|
||||
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){
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -276,20 +276,18 @@ public class WorkShopLogic {
|
|||
int[][] costs = new int[costLength][];
|
||||
if(costMineral!=null && costMineral.length>0){
|
||||
costs[--costLength] =costMineral;
|
||||
costs[costLength][1] = costs[costLength][1]*nums;
|
||||
}
|
||||
if(runneIdsList.size() ==0){
|
||||
runneIdsList =new ArrayList<>(specialRunes.length);
|
||||
}
|
||||
for(Integer runneId : runneIdsList){
|
||||
costs[--costLength] = new int[]{runneId, nums};
|
||||
costs[--costLength] = new int[]{runneId, 1};
|
||||
}
|
||||
for(int specialRunneId[] : specialRunes){
|
||||
costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]*nums};
|
||||
runneIdsList.add(specialRunneId[0]);
|
||||
costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]};
|
||||
}
|
||||
|
||||
boolean enoughCost = ItemUtil.itemCost(user,costs);
|
||||
boolean enoughCost = ItemUtil.itemCost(user,costs,nums);
|
||||
if(!enoughCost){
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE,"道具不足");
|
||||
return;
|
||||
|
|
|
@ -686,6 +686,17 @@ public class ItemUtil {
|
|||
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 {
|
||||
if (itemMap == null) {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue