master_ob2
parent
d909a31e20
commit
6d8b910c28
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"version":"7",
|
"version":"8",
|
||||||
"classes":[
|
"classes":[
|
||||||
{"name":"HeroLogic.class","fullName":"com.ljsd.jieling.logic.hero.HeroLogic"}
|
{"name":"HeroLogic.class","fullName":"com.ljsd.jieling.logic.hero.HeroLogic"},
|
||||||
|
{"name":"StoreLogic.class","fullName":"com.ljsd.jieling.logic.store.StoreLogic"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -656,9 +656,9 @@ public class StoreLogic {
|
||||||
if(relatedtoVIP == 1){
|
if(relatedtoVIP == 1){
|
||||||
if(limit == 6){
|
if(limit == 6){
|
||||||
int goodsNum = sStoreConfig.getGoods()[0][1]*itemNum;
|
int goodsNum = sStoreConfig.getGoods()[0][1]*itemNum;
|
||||||
check = PlayerLogic.getInstance().check(user,limit, goodsNum);
|
check = PlayerLogic.getInstance().check(user, limit, goodsNum);
|
||||||
}else{
|
}else{
|
||||||
check = PlayerLogic.getInstance().check(user,limit, itemNum);
|
check = PlayerLogic.getInstance().check(user, limit, itemNum);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
check = limit > buyTimes;
|
check = limit > buyTimes;
|
||||||
|
@ -700,12 +700,23 @@ public class StoreLogic {
|
||||||
StoreInfo storeInfo = storeInfoMap.get(storeId);
|
StoreInfo storeInfo = storeInfoMap.get(storeId);
|
||||||
Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap();
|
Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap();
|
||||||
int buyTimes = itemNumMap.get(itemId);
|
int buyTimes = itemNumMap.get(itemId);
|
||||||
// 校验道具小孩
|
// 校验道具消耗
|
||||||
int[][] cost = getCost(buyTimes ,itemNum, sStoreConfig.getCost(), sStoreConfig.getPremiumType(),sStoreConfig.getIsDiscount(),sStoreConfig.getDiscountDegree());
|
int[][] cost = getCost(buyTimes ,itemNum, sStoreConfig.getCost(), sStoreConfig.getPremiumType(),sStoreConfig.getIsDiscount(),sStoreConfig.getDiscountDegree());
|
||||||
boolean result = ItemUtil.itemCost(user, cost, BIReason.BUY_GOODS_CONSUME, storeId);
|
boolean result = ItemUtil.itemCost(user, cost, BIReason.BUY_GOODS_CONSUME, storeId);
|
||||||
if (!result){
|
if (!result){
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
|
// 特权处理
|
||||||
|
int relatedtoVIP = sStoreConfig.getRelatedtoVIP();
|
||||||
|
int vipId = sStoreConfig.getLimit();
|
||||||
|
if(relatedtoVIP == 1 && vipId != 0){
|
||||||
|
int num = itemNum;
|
||||||
|
if(vipId == 6){
|
||||||
|
num = sStoreConfig.getGoods()[0][1]*itemNum;
|
||||||
|
}
|
||||||
|
PlayerLogic.getInstance().checkAndUpdate(user, vipId, num);
|
||||||
|
}
|
||||||
|
|
||||||
itemNumMap.put(itemId,buyTimes + itemNum);
|
itemNumMap.put(itemId,buyTimes + itemNum);
|
||||||
storeInfo.setItemNumMap(itemNumMap);
|
storeInfo.setItemNumMap(itemNumMap);
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserStoreEvent,storeId,itemId,cost[0][0],itemNum,cost[0][1]);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserStoreEvent,storeId,itemId,cost[0][0],itemNum,cost[0][1]);
|
||||||
|
@ -948,6 +959,7 @@ public class StoreLogic {
|
||||||
Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap();
|
Map<Integer, Integer> itemNumMap = storeInfo.getItemNumMap();
|
||||||
ArrayList<int[][]> list = new ArrayList<>();
|
ArrayList<int[][]> list = new ArrayList<>();
|
||||||
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
|
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
|
||||||
|
// 道具消耗
|
||||||
Integer id = entry.getKey();
|
Integer id = entry.getKey();
|
||||||
Integer num = entry.getValue();
|
Integer num = entry.getValue();
|
||||||
int buyTimes = itemNumMap.get(id);
|
int buyTimes = itemNumMap.get(id);
|
||||||
|
@ -955,6 +967,17 @@ public class StoreLogic {
|
||||||
int[][] cost = getCost(buyTimes ,num, sStoreConfig.getCost(), sStoreConfig.getPremiumType(),sStoreConfig.getIsDiscount(),sStoreConfig.getDiscountDegree());
|
int[][] cost = getCost(buyTimes ,num, sStoreConfig.getCost(), sStoreConfig.getPremiumType(),sStoreConfig.getIsDiscount(),sStoreConfig.getDiscountDegree());
|
||||||
list.add(cost);
|
list.add(cost);
|
||||||
itemNumMap.put(id,buyTimes + num);
|
itemNumMap.put(id,buyTimes + num);
|
||||||
|
|
||||||
|
// 特权处理
|
||||||
|
int relatedtoVIP = sStoreConfig.getRelatedtoVIP();
|
||||||
|
int vipId = sStoreConfig.getLimit();
|
||||||
|
if(relatedtoVIP == 1 && vipId != 0){
|
||||||
|
int vipNum = num;
|
||||||
|
if(vipId == 6){
|
||||||
|
vipNum = sStoreConfig.getGoods()[0][1]*num;
|
||||||
|
}
|
||||||
|
PlayerLogic.getInstance().checkAndUpdate(user, vipId, vipNum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 消耗并存储
|
// 消耗并存储
|
||||||
ItemUtil.itemCost(user, list, BIReason.BUY_GOODS_CONSUME, 0);
|
ItemUtil.itemCost(user, list, BIReason.BUY_GOODS_CONSUME, 0);
|
||||||
|
|
Loading…
Reference in New Issue