|
@@ -80,6 +80,12 @@ class ShopProc {
|
|
$mo = GameConfig::shop_daily_getItem($typeId);
|
|
$mo = GameConfig::shop_daily_getItem($typeId);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
|
|
|
|
|
+ if($mo->freeNum > 0){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
my_Assert(in_array($typeId, $user->privateState->dailyShopRandItems), ErrCode::err_const_no);
|
|
my_Assert(in_array($typeId, $user->privateState->dailyShopRandItems), ErrCode::err_const_no);
|
|
my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
|
|
|
|
|
|
@@ -190,7 +196,7 @@ class ShopProc {
|
|
}
|
|
}
|
|
|
|
|
|
$n = rand(0, count($gemList)-1);
|
|
$n = rand(0, count($gemList)-1);
|
|
- $gem = StoreProc::initGem($gateGift[$n]->typeId);
|
|
|
|
|
|
+ $gem = StoreProc::initGem($gemList[$n]->typeId);
|
|
$resultArr[] = $gem->uid;
|
|
$resultArr[] = $gem->uid;
|
|
StoreProc::PutGemInStore2($gem);
|
|
StoreProc::PutGemInStore2($gem);
|
|
}
|
|
}
|
|
@@ -366,9 +372,26 @@ class ShopProc {
|
|
foreach ($arrType as $k) {
|
|
foreach ($arrType as $k) {
|
|
if(StlUtil::dictHasProperty($dataDic,$k) && count($dataDic->$k) > 0){
|
|
if(StlUtil::dictHasProperty($dataDic,$k) && count($dataDic->$k) > 0){
|
|
$arr2 = $dataDic->$k;
|
|
$arr2 = $dataDic->$k;
|
|
- $num = rand(0, count($arr2)-1);
|
|
|
|
- $result[] = $arr2[$num];
|
|
|
|
- unset($arr2[$num]);
|
|
|
|
|
|
+ $allNum = 0;
|
|
|
|
+ foreach ($arr2 as $giftTypeId) {
|
|
|
|
+ $allNum += GameConfig::shop_daily_getItem($giftTypeId)->per;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $randNum = rand(1,$allNum);
|
|
|
|
+ $start = 0;
|
|
|
|
+ $end = 0;
|
|
|
|
+ $index = 0;
|
|
|
|
+ foreach ($arr2 as $itemId) {
|
|
|
|
+ $per = GameConfig::shop_daily_getItem($itemId)->per;
|
|
|
|
+ $end += $per;
|
|
|
|
+ if($randNum >= $start && $randNum < $end){
|
|
|
|
+ $result[] = $itemId;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ $start = $end;
|
|
|
|
+ $index += 1;
|
|
|
|
+ }
|
|
|
|
+ unset($arr2[$index]);
|
|
|
|
|
|
$dataDic->$k = array_values($arr2);
|
|
$dataDic->$k = array_values($arr2);
|
|
}
|
|
}
|