瀏覽代碼

添加领取学院年级奖励

cyzhao 4 年之前
父節點
當前提交
3973879ead

+ 1 - 1
Gameserver/Amfphp/base/CmdCode.php

@@ -1068,7 +1068,7 @@ class CmdCode {
     /**
      *  领取任务卡奖励
      */
-    const cmd_college_ReceiveTaskCardReward = 7302;
+    const cmd_college_ReceiveCollegeReward = 7302;
     
     /**
      *  领取课程奖励

+ 34 - 9
Gameserver/Amfphp/model/User/Info_College.php

@@ -23,6 +23,12 @@ class Info_College extends Object_ext{
     /// 所处的课程id
     /// </summary>
     public $courseId = 1001;
+    
+    /**
+     * 将领取课程奖励的保存在这
+     * @var type
+     */
+    public $comCourseList = array();
 
     /// <summary>
     /// 任务卡信息
@@ -83,24 +89,43 @@ class Info_College extends Object_ext{
         $this->progress += 1;            
     }
     
+    public function updataCourseNew() {            
+        //检测是否到下一年级
+//        $collegeDic = GameConfig::college_getItem($this->collegeId);      
+//        if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){
+//            $this->courseId += 1;
+//            $this->initCompMissCardDic();
+//            $this->progress = 0;
+//        } else {
+            $this->collegeId += 1;
+            $newCollegeDic = GameConfig::college_getItem($this->collegeId);  
+            $cList = explode(',', $newCollegeDic->cList);
+            $this->courseId = $cList[0];
+            $this->initCompMissCardDic();           
+//        }                  
+    }
+    
     /**
      * 
      */
-    public function updataCourse() {            
+    public function updataCourse() {   
+        array_pushs($this->comCourseList, $this->courseId);               
         //检测是否到下一年级
         $collegeDic = GameConfig::college_getItem($this->collegeId);      
         if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){
             $this->courseId += 1;
             $this->initCompMissCardDic();
             $this->progress = 0;
-        } else {
-            $this->collegeId += 1;
-            $newCollegeDic = GameConfig::college_getItem($this->collegeId);  
-            $cList = explode(',', $newCollegeDic->cList);
-            $this->courseId = $cList[0];
-            $this->initCompMissCardDic();
-            $this->progress = 0;
-        }                  
+        } 
+        
+//        else {
+//            $this->collegeId += 1;
+//            $newCollegeDic = GameConfig::college_getItem($this->collegeId);  
+//            $cList = explode(',', $newCollegeDic->cList);
+//            $this->courseId = $cList[0];
+//            $this->initCompMissCardDic();
+//            $this->progress = 0;
+//        }                  
     }
     
     

+ 19 - 5
Gameserver/Amfphp/process/CollegeProc.php

@@ -77,12 +77,26 @@ class CollegeProc {
     }
     
     /**
-     * 废弃 同任务模块用一个
+     * 
      * @param Req $req
      */
-//    public static function ReceiveTaskCardReward($req) {
-//        
-//    }
+    public static function ReceiveCollegeReward($req) {
+        $collegeInfo = $req->userInfo->game->college;
+        $dic = GameConfig::college_getItem($collegeInfo->collegeId);
+        if(count(explode(',', $dic->cList)) != count($collegeInfo->comCourseList)){
+            return Resp::err(ErrCode::err_db); 
+        }
+        StoreProc::AddMultiItemInStore($req, GameConfig::course_getItem($collegeInfo->courseId)->prize);      # 发放奖励
+        
+        $college = new Info_College($req->userInfo->game->college);       
+        $college->updataCourseNew();  
+        
+        $req->userInfo->game->college = $college;
+        UserProc::updateUserInfo();     
+        
+        return Resp::ok(array('college'=>$req->userInfo->game->college));  
+        
+    }
     
     /**
      * 领取课程奖励
@@ -107,7 +121,7 @@ class CollegeProc {
             return Resp::err(ErrCode::err_db); 
         }
               
-        StoreProc::AddMultiItemInStore($req, GameConfig::course_getItem($collegeInfo->courseId));      # 发放奖励
+        StoreProc::AddMultiItemInStore($req, GameConfig::course_getItem($collegeInfo->courseId)->prize);      # 发放奖励
         
         $college = new Info_College($req->userInfo->game->college);       
         $college->updataCourse();