|
@@ -866,7 +866,7 @@ class StoreProc {
|
|
|
$tag_index = 0;
|
|
|
$tag_gem = null;
|
|
|
foreach ($gemSetSlotDic as $slotId => $gemUid) {
|
|
|
- if($gemUid == 0){
|
|
|
+ if ($gemUid == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
$gem = new Ins_Gem(ctx()->store->gemStore->$gemUid);
|
|
@@ -887,8 +887,8 @@ class StoreProc {
|
|
|
//$gemSetSlotDic->$i = $ins_gem;
|
|
|
$go_index = $i;
|
|
|
break;
|
|
|
- }
|
|
|
- if($gemSetSlotDic->$i == 0){
|
|
|
+ }
|
|
|
+ if ($gemSetSlotDic->$i == 0) {
|
|
|
$go_index = $i;
|
|
|
break;
|
|
|
}
|
|
@@ -965,7 +965,7 @@ class StoreProc {
|
|
|
if ($uid == $gemUid) {
|
|
|
ctx()->store->equip->$eUid->gemSetSlot->$slotId = 0;
|
|
|
break 2;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1240,49 +1240,53 @@ class StoreProc {
|
|
|
public static function DistributeItemsBox($itemId) {
|
|
|
$itemBoxMo = GameConfig::item_2023_box_getItem($itemId);
|
|
|
my_Assert($itemBoxMo != null, ErrCode::err_const_no);
|
|
|
- if ($itemBoxMo->type == 1) {
|
|
|
- $strList = explode(';', $itemBoxMo->contents);
|
|
|
- $numList = explode('-', $strList[0]);
|
|
|
- $randNum = rand($numList[0], $numList[1]);
|
|
|
+ if ($itemBoxMo->type == 1) {
|
|
|
+ $reward = self::Distribute_Rewards($itemBoxMo->contents);
|
|
|
+ self::AddMultiItemInStore($reward);
|
|
|
+ } else {
|
|
|
+ self::AddMultiItemInStore($itemBoxMo->contents);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function Distribute_Rewards($contents) {
|
|
|
+ $strList = explode(';', $contents);
|
|
|
+ $numList = explode('-', $strList[0]);
|
|
|
+ $randNum = rand($numList[0], $numList[1]);
|
|
|
+
|
|
|
+ $ctxList = explode(',', $strList[1]);
|
|
|
+ $per = 0;
|
|
|
+ foreach ($ctxList as $value) {
|
|
|
+ $ctx = explode(':', $value);
|
|
|
+ $per += $ctx[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ $reward = "";
|
|
|
+ for ($i = 0; $i < $randNum; $i++) {
|
|
|
+ $ctxPer = rand(1, $per);
|
|
|
+ $start = 0;
|
|
|
+ $end = 0;
|
|
|
|
|
|
- $ctxList = explode(',', $strList[1]);
|
|
|
- $per = 0;
|
|
|
+ $id = 0;
|
|
|
foreach ($ctxList as $value) {
|
|
|
$ctx = explode(':', $value);
|
|
|
- $per += $ctx[1];
|
|
|
- }
|
|
|
-
|
|
|
- $reward = "";
|
|
|
- for ($i = 0; $i < $randNum; $i++) {
|
|
|
- $ctxPer = rand(1, $per);
|
|
|
- $start = 0;
|
|
|
- $end = 0;
|
|
|
-
|
|
|
- $id = 0;
|
|
|
- foreach ($ctxList as $value) {
|
|
|
- $ctx = explode(':', $value);
|
|
|
- $end += $ctx[1];
|
|
|
- if ($ctxPer > $start && $ctxPer <= $end) {
|
|
|
- $id = $ctx[0];
|
|
|
- break;
|
|
|
- }
|
|
|
- $start = $end;
|
|
|
+ $end += $ctx[1];
|
|
|
+ if ($ctxPer > $start && $ctxPer <= $end) {
|
|
|
+ $id = $ctx[0];
|
|
|
+ break;
|
|
|
}
|
|
|
+ $start = $end;
|
|
|
+ }
|
|
|
|
|
|
- if ($id != 0) {
|
|
|
- $str = $id . ',1';
|
|
|
- if ($reward == "") {
|
|
|
- $reward = $str;
|
|
|
- } else {
|
|
|
- $reward = $reward . ';' . $str;
|
|
|
- }
|
|
|
+ if ($id != 0) {
|
|
|
+ $str = $id . ',1';
|
|
|
+ if ($reward == "") {
|
|
|
+ $reward = $str;
|
|
|
+ } else {
|
|
|
+ $reward = $reward . ';' . $str;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- self::AddMultiItemInStore($reward);
|
|
|
- } else {
|
|
|
- self::AddMultiItemInStore($itemBoxMo->contents);
|
|
|
}
|
|
|
+ return $reward;
|
|
|
}
|
|
|
|
|
|
// public static function PutEquipInStore($equipId, $num) {
|