|
@@ -62,7 +62,7 @@ class ShopProc {
|
|
|
return Resp::ok(array(
|
|
|
"privateState" => ctx()->privateState,
|
|
|
"baseInfo" => ctx()->baseInfo,
|
|
|
- "tili" => $addTili,
|
|
|
+ "tili" => $addTili,
|
|
|
"task" => ctx()->task,
|
|
|
));
|
|
|
}
|
|
@@ -81,38 +81,7 @@ class ShopProc {
|
|
|
$gateGift = array();
|
|
|
switch ($type) {
|
|
|
case EnumShopGift::GateGift_Shop://章节礼包
|
|
|
- my_Assert(!in_array($typeId, ctx()->privateState->gateGiftReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
|
-
|
|
|
- $mo = GameConfig::shop_gategift_getItem($typeId);
|
|
|
- my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-
|
|
|
- $price = explode(';', $mo->reward);
|
|
|
- foreach ($price as $value) {
|
|
|
- $item = explode(',', $value);
|
|
|
- if (GameConfig::item_getItem($item[0])->itemType == EnumItemType::tuzhiBox) {
|
|
|
- $dic = GameConfig::item();
|
|
|
- $list = array();
|
|
|
- foreach ($dic as $id => $val) {
|
|
|
- if ($val->itemType == EnumItemType::tuzhi) {
|
|
|
- $list[] = $val->typeId;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $randNum = rand(0, count($list) - 1);
|
|
|
- $tuzhiId = $list[$randNum];
|
|
|
- $gateGift[] = $tuzhiId . ',1';
|
|
|
- } else {
|
|
|
- $gateGift[] = $value;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- foreach ($gateGift as $str) {
|
|
|
- StoreProc::AddMultiItemInStore($str);
|
|
|
- }
|
|
|
-
|
|
|
- ctx()->privateState->gateGiftReceived[] = $typeId;
|
|
|
-
|
|
|
- ctx()->baseInfo->charge_amt += $mo->curPrice;
|
|
|
+ self::BuyShop_GateGift($type, $typeId, $buyNum);
|
|
|
break;
|
|
|
case EnumShopGift::Daily_Shop://每日商店
|
|
|
$mo = GameConfig::shop_daily_getItem($typeId);
|
|
@@ -134,7 +103,7 @@ class ShopProc {
|
|
|
}
|
|
|
$user->privateState->dailyShop_GuangGaoNum += 1;
|
|
|
$user->privateState->dailyShop_GuangGaoTs = now();
|
|
|
- }
|
|
|
+ }
|
|
|
} else {
|
|
|
my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
|
|
|
@@ -151,7 +120,7 @@ class ShopProc {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- TaskProc::OnBuyNumDailyShop();
|
|
|
+ TaskProc::OnBuyNumDailyShop();
|
|
|
}
|
|
|
|
|
|
// $str = explode(',', $mo->reward);
|
|
@@ -167,9 +136,9 @@ class ShopProc {
|
|
|
case EnumShopGift::GemBox_Shop ://宝石宝箱---->2024.8.14 改为可能抽出宝石或是道具
|
|
|
$mo = GameConfig::shop_box_getItem($typeId);
|
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
-
|
|
|
+
|
|
|
if ($buyNum == 1) {
|
|
|
-
|
|
|
+
|
|
|
$yaoshiArr = explode(',', $mo->cost_one_yaoshi);
|
|
|
$itemId = $yaoshiArr[0];
|
|
|
if (StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $yaoshiArr[1]) {
|
|
@@ -179,7 +148,7 @@ class ShopProc {
|
|
|
my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
$user->baseInfo->Consume_Cash($cost);
|
|
|
}
|
|
|
- } elseif ($buyNum == 10) {
|
|
|
+ } 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]) {
|
|
@@ -188,9 +157,9 @@ class ShopProc {
|
|
|
$cost = $mo->cost_ten;
|
|
|
my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
$user->baseInfo->Consume_Cash($cost);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ($mo->type == 1) {
|
|
|
if ($buyNum == 0) {
|
|
|
$buyNum = 1;
|
|
@@ -204,7 +173,7 @@ class ShopProc {
|
|
|
$user->privateState->lastFreeGetTs_ShopBoxBright = now();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$arr = array();
|
|
|
$arr[] = 1;
|
|
|
$arr[] = 10;
|
|
@@ -234,7 +203,7 @@ class ShopProc {
|
|
|
}
|
|
|
|
|
|
$bichu1 = explode(',', $mo->bichu1);
|
|
|
- $qual = 0;//改成道具盒子了 但是这个变量不动了
|
|
|
+ $qual = 0; //改成道具盒子了 但是这个变量不动了
|
|
|
if ($buyCount % $bichu1[0] == 0) {
|
|
|
$qual = $bichu1[1];
|
|
|
}
|
|
@@ -260,8 +229,8 @@ class ShopProc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ($qual > 0) {
|
|
|
- StoreProc::AddMultiItemInStore($qual.",1", Enum_StoreSourceType::ShopBox);
|
|
|
+ if ($qual > 0) {
|
|
|
+ StoreProc::AddMultiItemInStore($qual . ",1", Enum_StoreSourceType::ShopBox);
|
|
|
}
|
|
|
}
|
|
|
TaskProc::OnOpenNumBrightBox_state($typeId, $buyNum);
|
|
@@ -462,12 +431,50 @@ class ShopProc {
|
|
|
'privateState' => $user->privateState,
|
|
|
'store' => $user->store,
|
|
|
'task' => ctx()->task,
|
|
|
- 'heros'=> ctx()->heros,
|
|
|
+ 'heros' => ctx()->heros,
|
|
|
'reward' => StoreProc::$reward,
|
|
|
'reward_Gem' => StoreProc::$reward_Gem,
|
|
|
));
|
|
|
}
|
|
|
|
|
|
+ //商城章节礼包购买
|
|
|
+ public static function BuyShop_GateGift($type, $typeId, $buyNum) {
|
|
|
+ my_Assert(!in_array($typeId, ctx()->privateState->gateGiftReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
|
+
|
|
|
+ $mo = GameConfig::shop_gategift_getItem($typeId);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ $price = explode(';', $mo->reward);
|
|
|
+ foreach ($price as $value) {
|
|
|
+ $item = explode(',', $value);
|
|
|
+ if (GameConfig::item_getItem($item[0])->itemType == EnumItemType::tuzhiBox) {
|
|
|
+ $dic = GameConfig::item();
|
|
|
+ $list = array();
|
|
|
+ foreach ($dic as $id => $val) {
|
|
|
+ if ($val->itemType == EnumItemType::tuzhi) {
|
|
|
+ $list[] = $val->typeId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $randNum = rand(0, count($list) - 1);
|
|
|
+ $tuzhiId = $list[$randNum];
|
|
|
+ $gateGift[] = $tuzhiId . ',1';
|
|
|
+ } else {
|
|
|
+ $gateGift[] = $value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($gateGift as $str) {
|
|
|
+ StoreProc::AddMultiItemInStore($str);
|
|
|
+ }
|
|
|
+ ctx()->privateState->gateGiftReceived[] = $typeId;
|
|
|
+ ctx()->baseInfo->charge_amt += $mo->curPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function functionName($param) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 商城每日重置
|
|
|
*/
|