|
@@ -123,6 +123,8 @@ class ShopProc {
|
|
case EnumShopGift::MonthCard_Shop:// 8 月卡
|
|
case EnumShopGift::MonthCard_Shop:// 8 月卡
|
|
self::BuyShop_MonthCard($type, $typeId, $buyNum);
|
|
self::BuyShop_MonthCard($type, $typeId, $buyNum);
|
|
break;
|
|
break;
|
|
|
|
+ case EnumShopGift::Equip_Shop : // 7 宝石宝箱---->2024.8.14 改为可能抽出宝石或是道具
|
|
|
|
+ self::BuyShop_EquipBox($type, $typeId, $buyNum);
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -260,6 +262,115 @@ class ShopProc {
|
|
ctx()->privateState->dailyShopReceived[] = $typeId;
|
|
ctx()->privateState->dailyShopReceived[] = $typeId;
|
|
TaskProc::OnBuyNumDailyShop_state();
|
|
TaskProc::OnBuyNumDailyShop_state();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 宝石宝箱---->2024.8.14 改为可能抽出宝石或是道具
|
|
|
|
+ */
|
|
|
|
+ public static function BuyShop_EquipBox($type, $typeId, $buyNum) {
|
|
|
|
+ $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]) {
|
|
|
|
+ ctx()->store->removeItem($itemId, $yaoshiArr[1]);
|
|
|
|
+ } else {
|
|
|
|
+ $cost = $mo->cost_one;
|
|
|
|
+ my_Assert(ctx()->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
|
+ ctx()->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(ctx()->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
|
|
|
|
+ ctx()->baseInfo->Consume_Cash($cost);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($mo->type == 1) {
|
|
|
|
+ if ($buyNum == 0) {
|
|
|
|
+ $buyNum = 1;
|
|
|
|
+ my_Assert(now() - ctx()->privateState->lastFreeGetTs_ShopBoxCommon_equip >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
|
|
|
|
+ ctx()->privateState->lastFreeGetTs_ShopBoxCommon_equip = now();
|
|
|
|
+ }
|
|
|
|
+ } else if ($mo->type == 2) {
|
|
|
|
+ if ($buyNum == 0) {
|
|
|
|
+ $buyNum = 1;
|
|
|
|
+ my_Assert(now() - ctx()->privateState->lastFreeGetTs_ShopBoxBright_equip >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
|
|
|
|
+ ctx()->privateState->lastFreeGetTs_ShopBoxBright_equip = now();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $arr = array();
|
|
|
|
+ $arr[] = 1;
|
|
|
|
+ $arr[] = 10;
|
|
|
|
+ if (!in_array($buyNum, $arr)) {
|
|
|
|
+ $buyNum = 1;
|
|
|
|
+ }
|
|
|
|
+ //TaskProc::OnOpenNumBrightBox($typeId, $buyNum);
|
|
|
|
+ TaskProc::OnOpenNumAnyBox($buyNum);
|
|
|
|
+ //FightProc::funUnlock_Gem();
|
|
|
|
+
|
|
|
|
+ $perList = explode(';', $mo->percent);
|
|
|
|
+ $allNum = 0;
|
|
|
|
+ foreach ($perList as $key => $value) {
|
|
|
|
+ $str = explode(',', $value);
|
|
|
|
+ $allNum += $str[1];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $allNum *= 1000;
|
|
|
|
+ for ($i = 0; $i < $buyNum; $i++) {
|
|
|
|
+ mt_srand((double) microtime() * 1000000);
|
|
|
|
+ $buyCount = 0;
|
|
|
|
+ if ($mo->type == 1) {
|
|
|
|
+ ctx()->privateState->buyNum_ShopBoxCommon_equip += 1;
|
|
|
|
+ $buyCount = ctx()->privateState->buyNum_ShopBoxCommon_equip;
|
|
|
|
+ } else {
|
|
|
|
+ ctx()->privateState->buyNum_ShopBoxBright_equip += 1;
|
|
|
|
+ $buyCount = ctx()->privateState->buyNum_ShopBoxBright_equip;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $bichu1 = explode(',', $mo->bichu1);
|
|
|
|
+ $qual = 0; //改成道具盒子了 但是这个变量不动了
|
|
|
|
+ if ($buyCount % $bichu1[0] == 0) {
|
|
|
|
+ $qual = $bichu1[1];
|
|
|
|
+ }
|
|
|
|
+ if ($mo->bichu2 != null) {
|
|
|
|
+ $bichu2 = explode(',', $mo->bichu2);
|
|
|
|
+ if ($buyCount % $bichu2[0] == 0) {
|
|
|
|
+ $qual = $bichu2[1];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($qual == 0) {
|
|
|
|
+ $start = 0;
|
|
|
|
+ $end = 0;
|
|
|
|
+ $randNum = mt_rand(1, $allNum);
|
|
|
|
+ foreach ($perList as $k => $val) {
|
|
|
|
+ $str = explode(',', $val);
|
|
|
|
+ $end += $str[1] * 1000;
|
|
|
|
+ if ($randNum > $start && $randNum <= $end) {
|
|
|
|
+ $qual = $str[0];
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ $start = $end;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($qual > 0) {
|
|
|
|
+ StoreProc::AddMultiItemInStore($qual . ",1", Enum_StoreSourceType::ShopBox);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //TaskProc::OnOpenNumBrightBox_state($typeId, $buyNum);
|
|
|
|
+ FightProc::funUnlock_equip_firstTime();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 宝石宝箱---->2024.8.14 改为可能抽出宝石或是道具
|
|
* 宝石宝箱---->2024.8.14 改为可能抽出宝石或是道具
|
|
@@ -366,8 +477,7 @@ class ShopProc {
|
|
StoreProc::AddMultiItemInStore($qual . ",1", Enum_StoreSourceType::ShopBox);
|
|
StoreProc::AddMultiItemInStore($qual . ",1", Enum_StoreSourceType::ShopBox);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- TaskProc::OnOpenNumBrightBox_state($typeId, $buyNum);
|
|
|
|
- FightProc::funUnlock_equip_firstTime();
|
|
|
|
|
|
+ TaskProc::OnOpenNumBrightBox_state($typeId, $buyNum);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|