Pārlūkot izejas kodu

fixed: 初始物品uid,在生成完初始化物品后,利用count值更新下currentID; fixed: 替换言灵时清理旧言灵的反向引用.

gwang 5 gadi atpakaļ
vecāks
revīzija
99b414ab43

+ 3 - 3
Gameserver/Amfphp/model/User/PrivateStateModel.php

@@ -24,9 +24,9 @@ class PrivateStateModel extends Object_ext {
 
     /**
      *
-     * @var int 物品的uid,递增
+     * @var int 武器的uid,递增
      */
-    public $currentId = 13;
+    public $currentId = 0;
 
     /**
      *
@@ -177,7 +177,7 @@ class PrivateStateModel extends Object_ext {
         $this->Tasks = ObjectInit();
         $this->AchiTasks = ObjectInit();
         $this->maxItemNum = GameConfig::primordial_data()->User_Private_MaxItem_num; //100;
-        $this->currentId = 13;
+        $this->currentId = 0;
         $this->ItemNum = 0;
         $this->GemUpgrage = 0;
         $this->ItemUpgrage = 0;

+ 2 - 1
Gameserver/Amfphp/model/User/UserGameModel.php

@@ -190,7 +190,8 @@ class UserGameModel extends Object_ext {
         # 添加默认战队设置
         $this->heroTeamConfig = JsonUtil::encode(GameConfig::primordial_data()->User_HeroTeamConfig);
         $this->store->initialize();                                             # 添加默认物品
-        $this->heros->InitializeHero();                                     # 添加初始英雄
+        $this->privateState->currentId = count((array) $this->store->equipment) + 1;
+        $this->heros->InitializeHero();                                         # 添加初始英雄
     }
 
     /**

+ 2 - 1
Gameserver/Amfphp/process/GuildProc.php

@@ -151,13 +151,14 @@ class GuildProc {
 
     /**
      * [7001]获取公会列表,
+     * @param Req $req 
      */
     static function GetGuildList($req) { #
         $mem = $req->mem;
         $zoneid = $req->zoneid;
         $paydb = CPayInit();                                                    // 公会信息记录在paydb中了
 //客户端参数解析
-        $page = intval($req->paras[0]);                                         // 起始索引编号
+        $page = (count($req->paras) > 0) ? intval($req->paras[0]) : 1;                                         // 起始索引编号
         $startIndex = ($page - 1) * 20;
         if ($startIndex < 0) {                                                  // 防御代码避免出现 小于0的索引值
             $startIndex = 0;

+ 13 - 4
Gameserver/Amfphp/process/StoreProc.php

@@ -918,7 +918,10 @@ class StoreProc {
             Err(ErrCode::hero_no);
         }
         $user->store->yanling->$yanling_uid->herouid = $herouid;                # 言灵上添加反向引用, 避免查询时的循环
-
+        $oldYLid = $collectHeros->$herouid->yanling->$itemtype->itemuid;        # 旧言灵id
+        if ($oldYLid > 0) {                                                     # 代表替换操作
+            $user->store->yanling->$oldYLid->herouid = 0;                       # 清理旧言灵的
+        }
         $collectHeros->$herouid->yanling->$itemtype->itemuid = $yanling_uid;    # 英雄身上添加言灵记录
 
         UserProc::updateUserInfo($req);                                         # 5.回写数据
@@ -991,21 +994,27 @@ class StoreProc {
         }
 
         $user->store->equipment->$equipuid->herouid = $herouid;                 # 装备上添加反向引用, 避免查询时的循环
-
+        $oldEquipId = 0;
         switch ($itemtype) {                                                    # 添加或替换英雄该部位的装备
             case 1:                                                             # 武器   
+                $oldEquipId = $collectHeros->$herouid->equip->weapon->itemuid;
                 $collectHeros->$herouid->equip->weapon->itemuid = $equipuid;
                 break;
-            case 2:                                                             # 防具   
+            case 2:                                                             # 防具 
+                $oldEquipId = $collectHeros->$herouid->equip->armor->itemuid;
                 $collectHeros->$herouid->equip->armor->itemuid = $equipuid;
                 break;
             case 3:                                                             # 饰品   
+                $oldEquipId = $collectHeros->$herouid->equip->ring->itemuid;
                 $collectHeros->$herouid->equip->ring->itemuid = $equipuid;
                 break;
             default :
                 Err(ErrCode::store_equip_type);
                 break;
         }
+        if ($oldEquipId > 0) {
+            $user->store->equipment->$oldEquipId->herouid = 0;
+        }
 
         UserProc::updateUserInfo($req);                                         // 5.回写数据
         $ret = array('resp' => "succeed!");
@@ -1021,7 +1030,7 @@ class StoreProc {
      */
     static function UnWieldEquip($req) {
         $user = $req->userInfo->game;                                           # user引用
-        list($itemtype, $equipuid, $herouid) = $req->paras;                      # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID 
+        list($itemtype, $equipuid, $herouid) = $req->paras;                     # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID 
 
         $collectHeros = $user->heros->collectHeros;
         if (!$collectHeros) {