瀏覽代碼

结算修改

王刚 1 年之前
父節點
當前提交
72c76355f3
共有 1 個文件被更改,包括 94 次插入93 次删除
  1. 94 93
      Gameserver/App/process/FightProc.php

+ 94 - 93
Gameserver/App/process/FightProc.php

@@ -37,9 +37,9 @@ class FightProc {
                 return self::TowerRefreshSkills();
             case CmdCode::fight_tower_updatelocklist:                           # 6810 挑战关卡: 更新技能锁定列表
                 return self::TowerUpdateLockskillList();
-            case CmdCode::fight_rankInfo:                                       # 6811 获取主线关卡排行榜信息    
+            case CmdCode::fight_rankInfo:                                       # 6811 获取主线关卡排行榜信息
                 return self::GetRankInfo();
-            case CmdCode::fight_rank_uidEquipInfo:                              # 6812 获取主线关卡榜内玩家的装备信息    
+            case CmdCode::fight_rank_uidEquipInfo:                              # 6812 获取主线关卡榜内玩家的装备信息
                 return self::GetUidEquipInfo_Rank();
             case CmdCode::fight_rank_GetMainGateRankRewardInfo:                 # 6813 荣誉榜信息
                 return self::GetmainGate_RankRewardInfo();
@@ -108,7 +108,7 @@ class FightProc {
             'fightSweepNum' => ctx()->gates->fightSweepNum,
             'prizeArr' => $prizeArr,
             'store' => ctx()->store,
-            'task'=> ctx()->task,
+            'task' => ctx()->task,
         );
         return Resp::ok($ret);
     }
@@ -389,10 +389,10 @@ class FightProc {
         $t->skill_zhudong_lockState = $li_zds;
         $t->skill_beidong_lockState = $li_bds;
         UserProc::updateUserInfo();
-        
-        $ret = array(               
-                'task'=> ctx()->task,
-            );
+
+        $ret = array(
+            'task' => ctx()->task,
+        );
         return Resp::ok($ret);
     }
 
@@ -436,7 +436,7 @@ class FightProc {
                 'store' => ctx()->store,
                 'gold' => ctx()->base()->gold,
                 'cash' => ctx()->base()->cash,
-                'task'=> ctx()->task,
+                'task' => ctx()->task,
             );
             return Resp::ok($ret);
         }
@@ -516,8 +516,8 @@ class FightProc {
         $ret = array(
             'gates' => ctx()->gates,
             'store' => ctx()->store,
-            'task'=> ctx()->task,
-            'gold'=> ctx()->baseInfo->gold,
+            'task' => ctx()->task,
+            'gold' => ctx()->baseInfo->gold,
         );
         return Resp::ok($ret);
     }
@@ -528,6 +528,7 @@ class FightProc {
      */
     public static function Settle() {
         list($resultType, $gateId, $gold, $curTs, $pickups) = req()->paras;
+        # 客户端需要增加参数: killmonserNum,killBosssNum, finalHpPercent(最终血量百分比)
         $gateMo = GameConfig::gate_getItem($gateId);
         my_Assert($gateMo != null, ErrCode::err_const_no);
         my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::gate_NoUserGateInfo);
@@ -539,7 +540,7 @@ class FightProc {
         if ($resultType) {                                                      # 胜利
             if (ctx()->gates->GateList->$gateId->pass == 0) {
                 ctx()->gates->GateList->$gateId->pass = 1;
-                TaskProc::Day7TaskReset($gateId);                                
+                TaskProc::Day7TaskReset($gateId);
             }
             TaskProc::OnPassGate_X($gateId);
             StoreProc::AddMultiItemInStore($gateMo->reward_win);
@@ -569,23 +570,23 @@ class FightProc {
         ctx()->baseInfo->Add_Gold($gold);
         //ctx()->baseInfo->Add_Exp($exp);
 
-        if(Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainStoryGate){
+        if (Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainStoryGate) {
             TaskProc::OnFightNumMainGate();
-        } else if(Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainChallengeGate){
+        } else if (Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainChallengeGate) {
             TaskProc::OnFightNumChallengeGate();
         }
         TaskProc::OnKillCommonNumMonster(1000);
         TaskProc::OnKillleaderNumMonster(500);
-             
+
         UserProc::updateUserInfo();
         $ret = array(
             'gates' => ctx()->gates,
             'store' => ctx()->store,
-            'task'=> ctx()->task,
+            'task' => ctx()->task,
         );
         return Resp::ok($ret);
     }
-         
+
     /**
      * 参与主线关卡排行榜
      * @param type $gateIndex
@@ -595,16 +596,16 @@ class FightProc {
         $mem = gMem();
         $arr = array();
         $uid = req()->uid;
-        $arr["$uid"] = $maxGateIndex;    
-        $mem->zadd($memKey,$arr);
-        
+        $arr["$uid"] = $maxGateIndex;
+        $mem->zadd($memKey, $arr);
+
         $length = $mem->zlen($memKey);
-        if($length > glc()->Rank_MainGateIndex_OnListRank){
+        if ($length > glc()->Rank_MainGateIndex_OnListRank) {
             $num = $length - glc()->Rank_MainGateIndex_OnListRank;
-            $mem->zremrangebyrank($memKey,0, $num-1);
-        }      
+            $mem->zremrangebyrank($memKey, 0, $num - 1);
+        }
     }
-    
+
     /**
      * 战力榜
      * @param type $gateIndex
@@ -615,95 +616,95 @@ class FightProc {
         $arr = array();
         $uid = req()->uid;
         $power = 10;
-        $arr["$uid"] = $power;    
-        $mem->zadd($memKey,$arr);
-        
+        $arr["$uid"] = $power;
+        $mem->zadd($memKey, $arr);
+
         $length = $mem->zlen($memKey);
-        if($length > glc()->Rank_FightPower_OnListRank){
+        if ($length > glc()->Rank_FightPower_OnListRank) {
             $num = $length - glc()->Rank_FightPower_OnListRank;
-            $mem->zremrangebyrank($memKey,0, $num-1);
-        }      
+            $mem->zremrangebyrank($memKey, 0, $num - 1);
+        }
     }
-    
+
     /**
-     * 6811 获取主线关卡排行榜信息    
+     * 6811 获取主线关卡排行榜信息
      * @return type
      */
     public static function GetRankInfo() {
-        list($type) = req()->paras;               
-        
+        list($type) = req()->paras;
+
         $selfIsHasRank = 0; //本人是否上榜 0未上榜没有排名 1上榜则selfRank就是排名
         $selfExtraInfo = 0;
-                      
-        if($type == 1){
-            $list = gMem()->zrevrange(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid),0, glc()->Rank_MainGateIndex_OnListRank, true);
+
+        if ($type == 1) {
+            $list = gMem()->zrevrange(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), 0, glc()->Rank_MainGateIndex_OnListRank, true);
             $selfExtraInfo = ctx()->gates->UnlockedGatesMaxId;
         } else {
-            $list = gMem()->zrevrange(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid),0, glc()->Rank_FightPower_OnListRank, true);
-            $selfExtraInfo = 0;//战力还没有
+            $list = gMem()->zrevrange(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), 0, glc()->Rank_FightPower_OnListRank, true);
+            $selfExtraInfo = 0; //战力还没有
         }
-        
+
         $selfRank = self::initOtherUidRankInfo(req()->uid, $selfExtraInfo);
-        
+
         $retArr = array();
-        if(count($list)>0){
+        if (count($list) > 0) {
             foreach ($list as $uid => $score) {
                 $rankInfo = self::initOtherUidRankInfo($uid, $score);
-                if($rankInfo->uid == req()->uid){
+                if ($rankInfo->uid == req()->uid) {
                     $selfIsHasRank = 1;
                     $selfRank = $rankInfo;
                 }
-                
+
                 $retArr[] = $rankInfo;
-            }                     
+            }
         }
-        
+
         UserProc::updateUserInfo();
         $ret = array(
             'rankInfo' => $retArr,
-            'selfRank' =>$selfRank,
-            'selfIsHasRank' => $selfIsHasRank,         
+            'selfRank' => $selfRank,
+            'selfIsHasRank' => $selfIsHasRank,
         );
         return Resp::ok($ret);
     }
-    
+
     /**
      * 初始化玩家rank
      * @param type $uid
      * @param type $score
      * @return \loyalsoft\Ins_rank
      */
-    static function initOtherUidRankInfo($uid,$score) {       
+    static function initOtherUidRankInfo($uid, $score) {
         $ins_rank = new Ins_rank();
         $lv = gMem()->zrank(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), $uid);
-        if($lv == null){
+        if ($lv == null) {
             $lv = 0;
         }
-        $ins_rank->rank = $lv+1;
+        $ins_rank->rank = $lv + 1;
         $ins_rank->uid = $uid;
         $userInfo = UserProc::getUserGame(req()->zoneid, $uid);
         $ins_rank->name = $userInfo->baseInfo->name;
         $ins_rank->headImg = $userInfo->baseInfo->headImg;
-        
+
         $ins_rank->score = $score;
         return $ins_rank;
     }
-    
+
     /**
-     * 6812 获取排行榜内玩家的装备信息   
+     * 6812 获取排行榜内玩家的装备信息
      * @return type
      */
     public static function GetUidEquipInfo_Rank() {
         list($uid) = req()->paras;
-        $userInfo = UserProc::getUserGame(req()->zoneid, $uid);    
-     
+        $userInfo = UserProc::getUserGame(req()->zoneid, $uid);
+
         $store = $userInfo->store;
-        $heros = $userInfo->heros;    
-        
+        $heros = $userInfo->heros;
+
         UserProc::updateUserInfo();
         $ret = array(
             'store' => $store,
-            'heros' =>$heros,           
+            'heros' => $heros,
         );
         return Resp::ok($ret);
     }
@@ -714,82 +715,82 @@ class FightProc {
      */
     public static function IsAchievedMainGate_PassReward($maxGateIndex) {
         $rewards = GameConfig::rank_passgatereward();
-        
-        $memKey = MemKey_GameRun::RankReward_MainGateIndex_Zone_hash(req()->zoneid);                
+
+        $memKey = MemKey_GameRun::RankReward_MainGateIndex_Zone_hash(req()->zoneid);
         foreach ($rewards as $passGateId => $mo) {
-            if($passGateId == $maxGateIndex && !gMem()->hexists($memKey, $maxGateIndex)){
+            if ($passGateId == $maxGateIndex && !gMem()->hexists($memKey, $maxGateIndex)) {
                 gMem()->hset($memKey, $maxGateIndex, req()->uid);
                 break;
             }
-        }       
+        }
     }
-     
+
     /*
      * 战力奖励是否达成
      */
+
     public static function IsAchievedFightPower_PassReward() {
-        $power = 0;//临时
+        $power = 0; //临时
         $rewards = GameConfig::rank_fightpowerreward();
-        
-        $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);                
+
+        $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);
         foreach ($rewards as $fightPower => $mo) {
-            if($power>=$fightPower && !gMem()->hexists($memKey, $fightPower)){
-                gMem()->hset($memKey, $fightPower, req()->uid);           
+            if ($power >= $fightPower && !gMem()->hexists($memKey, $fightPower)) {
+                gMem()->hset($memKey, $fightPower, req()->uid);
             }
-        } 
+        }
     }
-    
+
     /**
-     * 6813 
+     * 6813
      * @return type
      */
     public static function GetmainGate_RankRewardInfo() {
-        //list($type) = req()->paras;               
-                                           
-        $memKey = MemKey_GameRun::RankReward_MainGateIndex_Zone_hash(req()->zoneid);              
+        //list($type) = req()->paras;
+
+        $memKey = MemKey_GameRun::RankReward_MainGateIndex_Zone_hash(req()->zoneid);
         $dic = gMem()->hgetall($memKey);
-        
+
         UserProc::updateUserInfo();
         $ret = array(
-            'rankReward' => $dic,             
+            'rankReward' => $dic,
         );
         return Resp::ok($ret);
     }
-    
+
     /**
-     * 6814 
+     * 6814
      * @return type
      */
     public static function GetFightPower_RankRewardInfo() {
-        //list($type) = req()->paras;               
-                                           
-        $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);              
+        //list($type) = req()->paras;
+
+        $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);
         $dic = gMem()->hgetall($memKey);
-        
+
         UserProc::updateUserInfo();
         $ret = array(
-            'rankReward' => $dic,             
+            'rankReward' => $dic,
         );
         return Resp::ok($ret);
     }
-    
+
     /**
-     * 6815 
+     * 6815
      * @return type
      */
     public static function ReceiveRankReward() {
-        list($type,$id) = req()->paras;               
-        
+        list($type, $id) = req()->paras;
+
         my_Assert($gateMo != null, ErrCode::err_const_no);
         my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::gate_NoUserGateInfo);
-        
-        
-        $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);              
+
+        $memKey = MemKey_GameRun::RankReward_FightPower_Zone_hash(req()->zoneid);
         $dic = gMem()->hgetall($memKey);
-        
+
         UserProc::updateUserInfo();
         $ret = array(
-            'rankReward' => $dic,             
+            'rankReward' => $dic,
         );
         return Resp::ok($ret);
     }