|
@@ -169,19 +169,26 @@ class ShopProc {
|
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
|
|
|
if ($buyNum == 1) {
|
|
|
- $cost = $mo->cost_one;
|
|
|
+
|
|
|
$yaoshiArr = explode(',', $mo->cost_one_yaoshi);
|
|
|
$itemId = $yaoshiArr[0];
|
|
|
- if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items[$itemId] >= $yaoshiArr[1]) {
|
|
|
+ if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $yaoshiArr[1]) {
|
|
|
ctx()->store->removeItem($itemId, $yaoshiArr[1]);
|
|
|
} else {
|
|
|
+ $cost = $mo->cost_one;
|
|
|
my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
$user->baseInfo->Consume_Cash($cost);
|
|
|
}
|
|
|
- } elseif ($buyNum == 10) {
|
|
|
- $cost = $mo->cost_ten;
|
|
|
- my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
- $user->baseInfo->Consume_Cash($cost);
|
|
|
+ } elseif ($buyNum == 10) {
|
|
|
+ $yaoshiArr = explode(',', $mo->cost_ten_yaoshi);
|
|
|
+ $itemId = $yaoshiArr[0];
|
|
|
+ if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $yaoshiArr[1]) {
|
|
|
+ ctx()->store->removeItem($itemId, $yaoshiArr[1]);
|
|
|
+ } else {
|
|
|
+ $cost = $mo->cost_ten;
|
|
|
+ my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
+ $user->baseInfo->Consume_Cash($cost);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if ($mo->type == 1) {
|