Ver código fonte

7日任务解锁接口变动

cyzhao 8 meses atrás
pai
commit
cf91f5025d

+ 68 - 2
Gameserver/App/process/FightProc.php

@@ -135,6 +135,8 @@ class FightProc {
         TaskProc::OnPassMainChallengeGate_X_Num($gateId, $index);
         TaskProc::OnKillCommonNumMonster($killMonsterNum);
         TaskProc::OnKillleaderNumMonster($killBossNum);
+        
+        TaskProc::Day7TaskReset();
         UserProc::updateUserInfo();
         return Resp::ok(array("task" => ctx()->task,
                     'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
@@ -638,7 +640,7 @@ class FightProc {
 
             if (ctx()->gates->GateList->$gateId->pass == 0) {
                 ctx()->gates->GateList->$gateId->pass = 1;
-                TaskProc::Day7TaskReset($gateId);                               # 刷新七日任务
+                                              
                 $maxGateId = ctx()->gates->maxPassGateNumId();
 
                 if ($maxGateId > 0) {
@@ -728,7 +730,7 @@ class FightProc {
         }
 
         ctx()->gates->GateList->$gateId->fightNum += 1;
-
+        TaskProc::Day7TaskReset();
         TaskProc::OnFightNumMainGate();
         TaskProc::OnKillCommonNumMonster($killMonsterNum);
         TaskProc::OnKillleaderNumMonster($killBossNum);
@@ -932,6 +934,70 @@ class FightProc {
         }
     }
 
+    /**
+     * 查看某功能是否解锁
+     * @param type $id
+     */
+    static function isFunUnlock($id) {
+        $funMo = GameConfig::fun_unlock_getItem($id);
+        if ($funMo->unlockType1 != null && self::unlockCondition($funMo->unlockType1, $funMo->unlockParas1)) {
+            return true;
+        }
+
+        if ($funMo->unlockType2 != null && self::unlockCondition($funMo->unlockType2, $funMo->unlockParas2)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 解锁条件id
+     * @param type $conditionId
+     */
+    static function unlockCondition($conditionId, $paras) {
+        $funUnlock = false;
+        switch ($conditionId) {
+            case Enum_FunUnlockType::battle_Gate:
+                $gateId = $paras;
+                if (ctx()->gates->GateList->$gateId->fightNum > 0) {
+                    $funUnlock = true;
+                }
+                break;
+            case Enum_FunUnlockType::passBattle_Gate:
+                $gateId = $paras;
+                if (ctx()->gates->GateList->$gateId->pass >= 1) {
+                    $funUnlock = true;
+                }
+
+                break;
+            case Enum_FunUnlockType::getGem:
+                if (ctx()->store->gemStore != null) {
+                    $funUnlock = true;
+                }
+
+                break;
+            case Enum_FunUnlockType::userLv:
+                if (ctx()->baseInfo->level >= $paras) {
+                    $funUnlock = true;
+                }
+
+                break;
+            case Enum_FunUnlockType::mainChallengeGate_State:
+                $str = explode(',', $paras);
+                $uGateId = $str[0];
+                $gateState = $str[1];
+
+                if (StlUtil::dictHasProperty(ctx()->gates->GateList, $uGateId) && ctx()->gates->GateList->$uGateId->tz_state >= $gateState) {
+                    $funUnlock = true;
+                }
+
+                break;
+            default:
+                break;
+        }
+        return $funUnlock;
+    }
+
     /**
      * 检测次级功能解锁的
      * @param type $resultType

+ 2 - 5
Gameserver/App/process/TaskProc.php

@@ -316,11 +316,8 @@ class TaskProc {
     /**
      * 7日狂欢数据重置
      */
-    public static function Day7TaskReset($gateId) {
-        $funMo = GameConfig::fun_unlock_getItem(6);
-        $unlockGateId = $funMo->unlockGateId;
-        
-        if ($gateId != $unlockGateId) {
+    public static function Day7TaskReset() {                   
+        if (!FightProc::isFunUnlock(6)) {
             return;
         }