瀏覽代碼

装备结算

cyzhao 6 月之前
父節點
當前提交
54f0e36886
共有 2 個文件被更改,包括 57 次插入39 次删除
  1. 14 0
      Gameserver/App/process/FightProc.php
  2. 43 39
      Gameserver/App/process/StoreProc.php

+ 14 - 0
Gameserver/App/process/FightProc.php

@@ -721,6 +721,11 @@ class FightProc {
         $str = "1," . $gold + $waveMo->rewardGold;
         StoreProc::AddMultiItemInStore($str);
 
+        if($waveMo->rewardItem != null){
+            $reward = self::Distribute_Rewards($waveMo->rewardItem);
+            StoreProc::AddMultiItemInStore($reward);
+        }
+        
         # 图纸奖励: 数量min-max, 部位随机
         if (strlen($waveMo->rewardTuZhi) > 0 && str_contains($waveMo->rewardTuZhi, '-')) {
             list($tz_min, $tz_max) = explode('-', $waveMo->rewardTuZhi);        # 图纸数量
@@ -795,6 +800,15 @@ class FightProc {
         );
         return Resp::ok($ret);
     }
+    
+    /**
+     * 装备概率结算
+     * @param type $equipStr
+     */
+    private static function EquipSettle($equipStr) {
+        StoreProc::DistributeItemsBox($itemId);
+        
+    }
 
 // <editor-fold defaultstate="collapsed" desc="功能解锁">
 

+ 43 - 39
Gameserver/App/process/StoreProc.php

@@ -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) {