ソースを参照

出战助战修改

cyzhao 1 ヶ月 前
コミット
e9ac0a48e3
2 ファイル変更24 行追加0 行削除
  1. 5 0
      Gameserver/App/base/ErrCode.php
  2. 19 0
      Gameserver/App/process/PetProc.php

+ 5 - 0
Gameserver/App/base/ErrCode.php

@@ -611,6 +611,11 @@ class ErrCode {
      * 至少派遣一只宠物进行探索
      */
     const user_store_addDispatchPet = 3333;
+    
+    /**
+     * 该宠物已经助战
+     */
+    const user_store_NoReplacePet = 3334;
 // </editor-fold>
 //
 //   // <editor-fold defaultstate="collapsed" desc="    shop 3400    ">

+ 19 - 0
Gameserver/App/process/PetProc.php

@@ -830,10 +830,29 @@ class PetProc {
     public static function Pet_ChangeFightPosition() {
         list($type, $uid, $index) = req()->paras;
 
+        $dic = ctx()->store(true)->petUids_supportFight_position;
         if ($type == 1) {//出战、替换
             ctx()->store(true)->petUid_fight_position = $uid;
+            
+            foreach ($dic as $k => $petUid) {
+                if($petUid == $uid){
+                    ctx()->store(true)->petUids_supportFight_position->$k = 0;
+                }
+            }
         } else if ($type == 2) {
+            $tag = false;
+            foreach ($dic as $k => $petUid) {
+                if($petUid == $uid && $k != $index){
+                    $tag = true;
+                    break;
+                }
+            }
+            my_Assert(!$tag, ErrCode::user_store_NoReplacePet);
+            
             ctx()->store(true)->petUids_supportFight_position->$index = $uid;
+            if(ctx()->store(true)->petUid_fight_position == $uid){
+                ctx()->store(true)->petUid_fight_position = 0;
+            }           
         }
 
 //        if ($type == 0 && $index == 0 && $uid != 0) {//上阵点击空白的地方