Przeglądaj źródła

fix: 获得新装备UID分配的bug.

wanggangzero 6 miesięcy temu
rodzic
commit
0fe602e5e7

+ 27 - 18
Gameserver/App/model/User/Info_Store.php

@@ -20,44 +20,43 @@ class Info_Store extends Object_ext {
      * @var \stdClass()
      */
     public $items;
-    
+
     /**
      * 宝石在背包库的唯一id
      * @var type
      */
-    public $gemLength = 0; 
-
+    public $gemLength = 0;
 
     /**
      * 宝石背包
      * \stdClass() 
      */
     public $gemStore;
-    
+
     /**
      * 装备界面默认页
      * @var int
      */
-    public $equipPag =1;
+    public $equipPag = 1;
 
     /**
      * 装备背包数据
      * @var \stdClass()
      */
     public $equip;
-    
+
     /**
      * 装备部位--废弃
      * @var \stdClass()
      */
     public $equipPosition;
-    
+
     /**
      * 6个装备部位
      * @var type
      */
     public $equipLocation;
-    
+
     /**
      * 宝石装备的信息--废弃
      * @var \stdClass()
@@ -69,9 +68,14 @@ class Info_Store extends Object_ext {
      * @var type
      */
     //public $equipPosition = null;
-    
+
     public $gemComposeNum = 0;
-    
+
+    /**
+     * @var int current UID
+     */
+    public $cuid = 10000;
+
     public function initialize() {
         
     }
@@ -82,24 +86,22 @@ class Info_Store extends Object_ext {
             $this->gemStore = new \stdClass();
             $this->equip = new \stdClass();
             $this->equipLocation = new \stdClass();
-            
+
             $this->equipPosition = new \stdClass();
-            for ($i = 1; $i <=6; $i++) {
-                $equip =  new Ins_EquipPosition();
+            for ($i = 1; $i <= 6; $i++) {
+                $equip = new Ins_EquipPosition();
                 $equip->typeId = $i;
                 $this->equipPosition->$i = $equip;
             }
-            
+
             $this->gemEquip = new \stdClass();
-            for ($k = 1; $k <=3; $k++) {                             
+            for ($k = 1; $k <= 3; $k++) {
                 $item = new \stdClass();
                 for ($j = 1; $j <= 6; $j++) {
                     $item->$j = new \stdClass();
                 }
-                $this->gemEquip->$k =$item;
+                $this->gemEquip->$k = $item;
             }
-            
-            
         } else {
             parent::__construct($arg);
         }
@@ -113,4 +115,11 @@ class Info_Store extends Object_ext {
             }
         }
     }
+
+    /**
+     * @return 产生下一个唯一ID
+     */
+    public function nextUID() {
+        return $this->cuid++;
+    }
 }

+ 1 - 3
Gameserver/App/process/EmailProc.php

@@ -82,7 +82,6 @@ class EmailProc {
 
         $tag = 0;
         if (null == req()) {
-            CLog::err("req() 为空!");
             return $tag;
         }
         $mail = self::getMailQueue(req()->zoneid, req()->uid);
@@ -173,7 +172,6 @@ class EmailProc {
         $zoneid = req()->zoneid;
         $mailId = req()->paras[0];                                              # 传递参数,邮件的id字符串
         my_Assert($mailId, ErrCode::email_wrongid);                             # 邮件id
-
         $mail = self::getMail($zoneid, $uid, $mailId);                          # 取出对应的邮件数据
         my_Assert($mail->readts > 0, ErrCode::err_innerfault);                  # 未打开的不可能调用领取接口
         my_Assert($mail->isExistReward(), ErrCode::email_no_appendix);          # 先判断邮件,是否存在有效的奖励物品
@@ -185,7 +183,7 @@ class EmailProc {
         }
 
         $err = StoreProc::AddMultiItemInStore($mail->appendix, 4);              # 发放奖励
-
+//        echoLine(json_encode(ctx()->store()->equip));
         my_Assert(ErrCode::ok == $err, $err);                                   # 发奖成功
         $mail->drawedts = now();                                                # 更新领取时间戳
         self::updateMail($zoneid, $uid, $mail);                                 # 回写邮件数据

+ 2 - 3
Gameserver/App/process/StoreProc.php

@@ -1194,7 +1194,6 @@ class StoreProc {
                         ctx()->store(true)->equip->$uid = $equip;
                         self::$reward_equip[] = $uid;
                     }
-
                     break;
                 case 701://道具宝箱
                     for ($i = 0; $i < $num; $i++) {
@@ -1224,7 +1223,7 @@ class StoreProc {
 
     public static function initEquip($typeId, $uid = 0) {
         if ($uid == 0) {
-            $uid = count((array) ctx()->store->equip) + 1;
+            $uid = ctx()->store->nextUID();
         }
         $ins_equip = new Ins_Equip();
         $ins_equip->uid = $uid;
@@ -1251,7 +1250,7 @@ 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) {           
+        if ($itemBoxMo->type == 1) {
             $reward = self::Distribute_Rewards($itemBoxMo->contents);
             self::AddMultiItemInStore($reward);
         } else {