Browse Source

功能解锁

cyzhao 8 months ago
parent
commit
0e7b4c3e6e

+ 54 - 0
Gameserver/App/model/User/Enum_SubFunType.php

@@ -0,0 +1,54 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+namespace loyalsoft;
+
+/**
+ * Description of Enum_FunUnlockType
+ *
+ * @author c'y'zhao
+ */
+class Enum_SubFunType {
+    /**
+     * 累充
+     */
+    const AccumulateRecharge = 1;
+
+    /**
+     * 7日签到
+     */
+    const Day7_Sign = 2;
+
+    /**
+     * 7日狂欢
+     */
+    const Day7_Happy = 3;
+
+    /**
+     * 日常
+     */
+    const DailyTask = 4;
+    /**
+     * 周常
+     */
+    const WeekTask = 5;
+    /**
+     * 首充
+     */
+    const FirstRecharge = 6;
+    /**
+     * 仙树寻宝
+     */
+    const Lottory = 7;
+
+    /**
+     * 限时售卖
+     */
+    const LimitTsSale = 8;
+    
+}

+ 10 - 4
Gameserver/App/model/User/Info_PrivateState.php

@@ -226,7 +226,7 @@ class Info_PrivateState extends Object_ext {
     public $funUnlockRecord = array();
     
     /**
-     * 解锁的功能记录 不做删除
+     * 解锁的功能记录 不做删除 为了防止有两种解锁条件的功能 重复解锁
      * @var array()
      */
     #[ArrayType]
@@ -274,7 +274,7 @@ class Info_PrivateState extends Object_ext {
     public $firstRechargeRewardRecord = array();
 
     /**
-     *
+     * 首充 充值后可以登录领奖的标志
      * @var type
      */
     public $firstRecharge_receiveTag = 0;
@@ -296,7 +296,7 @@ class Info_PrivateState extends Object_ext {
      * 次级功能开启时间记录
      * @var type
      */
-    public $subFunStartTs = null;
+    //public $subFunStartTs = null;
 
     /**
      * @var array 曾用名列表
@@ -339,6 +339,12 @@ class Info_PrivateState extends Object_ext {
      * @var type
      */
     public $sign_high_buyTs = 0;
+    
+    /**
+     * 限时贩售 刷新时间
+     * @var type
+     */
+    public $nextDayLogin = 0;
 
     public function initialize() {
         $this->junbeiShopNumRecord = new \stdClass();
@@ -354,7 +360,7 @@ class Info_PrivateState extends Object_ext {
                 $this->junbeiShop_XinYuan = new \stdClass();
                 $this->supplyBichuDic = new \stdClass();
                 $this->skillLockerNumber = glc()->Skill_LockBtn_InitCount;       # 初始值
-                $this->subFunStartTs = new \stdClass();
+                //$this->subFunStartTs = new \stdClass();
                 
             }
         } else {

+ 1 - 1
Gameserver/App/model/User/Info_UserBase.php

@@ -19,7 +19,7 @@ class Info_UserBase extends Object_ext {
      * @var int
      */
     public $lastLogin;
-
+    
     /**
      * 上次活动时间
      * @var int

+ 5 - 0
Gameserver/App/process/ActiveProc.php

@@ -39,6 +39,11 @@ class ActiveProc {
         }
     }
     
+    static function ResetActive() {              
+             
+    }
+
+    
     /**
      * 6106 抽奖里面的兑换
      * @return type

+ 31 - 71
Gameserver/App/process/FightProc.php

@@ -136,7 +136,7 @@ class FightProc {
         TaskProc::OnKillCommonNumMonster($killMonsterNum);
         TaskProc::OnKillleaderNumMonster($killBossNum);
         
-        TaskProc::Day7TaskReset();
+        //TaskProc::Day7TaskReset();
         UserProc::updateUserInfo();
         return Resp::ok(array("task" => ctx()->task,
                     'funUnlockRecord' => ctx()->privateState->funUnlockRecord,
@@ -640,7 +640,7 @@ class FightProc {
         }
 
         self::funUnlock_Gate($resultType, $gateId); //备注:这个接口的位置不能动 里面有关卡第一次胜利解锁的功能提示校验
-        self::subFunUnlock($resultType, $gateId);
+        //self::subFunUnlock($resultType, $gateId);
         if ($resultType) {                                                      # 胜利
             self::skillUnlock_gate($resultType, $gateId); //备注 这个接口位置不能动
 
@@ -736,7 +736,7 @@ class FightProc {
         }
 
         ctx()->gates->GateList->$gateId->fightNum += 1;
-        TaskProc::Day7TaskReset();
+        //TaskProc::Day7TaskReset();
         TaskProc::OnFightNumMainGate();
         TaskProc::OnKillCommonNumMonster($killMonsterNum);
         TaskProc::OnKillleaderNumMonster($killBossNum);
@@ -765,42 +765,7 @@ class FightProc {
     }
 
 // <editor-fold defaultstate="collapsed" desc="功能解锁">   
-
-    /**
-     * 检测功能解锁的
-     * @param type $resultType
-     * @param type $gateId
-     * @return type
-     */
-    static function funUnlock($resultType, $gateId) {
-        $dic = GameConfig::fun_unlock();
-        foreach ($dic as $id => $mo) {
-            if ($mo->unlockTip == 1 && $mo->unlockParas1 == $gateId) {
-                $tag = false;
-                //1:参与战斗结束即可  2战斗胜利  3某场战斗参加N次数才行
-                switch ($mo->unlockType1) {
-                    case 1:
-                        if (ctx()->gates->GateList->$gateId->fightNum == 0) {
-                            $tag = true;
-                        }
-                        break;
-                    case 2:
-                        if ($resultType == true && ctx()->gates->GateList->$gateId->pass == 0) {
-                            $tag = true;
-                        }
-
-                        break;
-                    default:
-                        break;
-                }
-
-                if ($tag) {
-                    ctx()->privateState->funUnlockRecord[] = $id;
-                }
-            }
-        }
-    }
-
+  
     /**
      * 检测功能解锁的 关卡
      * @param type $resultType
@@ -1005,47 +970,42 @@ class FightProc {
     }
 
     /**
-     * 检测次级功能解锁的
-     * @param type $resultType
-     * @param type $gateId
-     * @return type
+     * 次级功能解锁数据初始化
      */
-    static function subFunUnlock($resultType, $gateId) {
+    static function SubFunDateInit_FunUnlock($type) {
         $dic = GameConfig::subfun_unlock();
         foreach ($dic as $id => $mo) {
-            if ($mo->type != 1) {
+            if($mo->funTypeId != $type){
                 continue;
+            }            
+            
+            if($mo->type == 1 && $mo->id == Enum_SubFunType::Day7_Happy){
+                TaskProc::Day7TaskReset();
             }
-
-            if ($mo->unlockGateId == $gateId) {
-                $tag = false;
-                //1:参与战斗结束即可  2战斗胜利  3某场战斗参加N次数才行
-                switch ($mo->unlockType) {
-                    case 1:
-                        if (ctx()->gates->GateList->$gateId->fightNum == 0) {
-                            $tag = true;
-                        }
-                        break;
-                    case 2:
-                        if ($resultType == true && ctx()->gates->GateList->$gateId->pass == 0) {
-                            $tag = true;
-                        }
-
-                        break;
-                    default:
-                        break;
-                }
-
-                if ($tag) {
-                    if (!StlUtil::dictHasProperty(ctx()->privateState->subFunStartTs, $id)) {
-                        ctx()->privateState->subFunStartTs->$id = now();
-                    }
-                }
+            if($mo->type == 2 && $mo->id == Enum_SubFunType::DailyTask){
+                TaskProc::DailyTaskReset();
             }
+            
+            if($mo->type == 2 && $mo->id == Enum_SubFunType::WeekTask){
+                TaskProc::WeekTaskReset();
+            }
+            
+        }
+    }
+    
+    /**
+     * 次级功能解锁数据初始化
+     */
+    static function SubFunDateInit_Config() {
+        $dic = GameConfig::subfun_unlock();
+        foreach ($dic as $id => $mo) {                                  
+            if($mo->type == 3 && $mo->id == Enum_SubFunType::LimitTsSale && ctx()->privateState->nextDayLogin == 0){
+                ctx()->privateState->nextDayLogin = now(); 
+            }                       
         }
     }
 
-// </editor-fold>
+// </editor-fold> 
 // <editor-fold defaultstate="collapsed" desc="技能解锁">
 
     /**

+ 45 - 39
Gameserver/App/process/TaskProc.php

@@ -102,11 +102,11 @@ class TaskProc {
                 break;
         }
 
-        if($point != 0){
+        if ($point != 0) {
             $str = "5," . $point;
             StoreProc::$reward[] = $str;
         }
-        
+
         UserProc::updateUserInfo();
         return Resp::ok(array("task" => ctx()->task,
                     "store" => ctx()->store,
@@ -114,7 +114,7 @@ class TaskProc {
                     'reward_Gem' => StoreProc::$reward_Gem,
                     'gold' => ctx()->baseInfo->gold,
                     'cash' => ctx()->baseInfo->cash,
-                    'heros'=> ctx()->heros,
+                    'heros' => ctx()->heros,
         ));
     }
 
@@ -157,7 +157,7 @@ class TaskProc {
                     'reward_Gem' => StoreProc::$reward_Gem,
                     'gold' => ctx()->baseInfo->gold,
                     'cash' => ctx()->baseInfo->cash,
-                    'heros'=> ctx()->heros,
+                    'heros' => ctx()->heros,
         ));
     }
 
@@ -203,13 +203,13 @@ class TaskProc {
                 StoreProc::$reward[] = $ins_activeTaskInfo->mo()->activePoint;
                 break;
             case Enum_ActiveTaskType::DailyTask:
-                
+
                 ctx()->task->dailyTaskPoint += $activePointArr[1];
                 StoreProc::$reward[] = $ins_activeTaskInfo->mo()->activePoint;
                 TaskProc::OnReceiveTaskPrize();
                 break;
             case Enum_ActiveTaskType::WeekTask:
-                
+
                 ctx()->task->weekTaskPoint += $activePointArr[1];
                 StoreProc::$reward[] = $ins_activeTaskInfo->mo()->activePoint;
                 TaskProc::OnReceiveTaskPrize();
@@ -217,15 +217,15 @@ class TaskProc {
             default:
                 break;
         }
-       
+
         UserProc::updateUserInfo();
         return Resp::ok(array("task" => ctx()->task,
                     "store" => ctx()->store,
                     'reward' => StoreProc::$reward,
                     'reward_Gem' => StoreProc::$reward_Gem,
                     'gold' => ctx()->baseInfo->gold,
-                    'cash' => ctx()->baseInfo->cash,   
-                    'heros'=> ctx()->heros,
+                    'cash' => ctx()->baseInfo->cash,
+                    'heros' => ctx()->heros,
         ));
     }
 
@@ -234,7 +234,7 @@ class TaskProc {
         if ($ins_activeTaskInfo->mo()->type != Enum_ActiveTaskType::MainTask) {
             return;
         }
-       
+
         $nextId = $ins_activeTaskInfo->mo()->next;
         if ($nextId != null) {
             StlUtil::dictRemove(ctx()->task->activeTaskInfo, $uid);
@@ -291,16 +291,14 @@ class TaskProc {
         ));
     }
 
-    static function ResetTask() {
-        self::DailyTaskReset();
-        self::ClearDay7Task();
-        $week = date("w");
-        if ($week == 1) {//每周一 第一次登录的时候刷新
-            //self::ResetTask_Week();
-            self::WeekTaskReset();
-        }
-        
-        //self::checkMainTask();
+    static function ResetTask() {                  
+//        self::DailyTaskReset();
+//        self::ClearDay7Task();                      
+//        $week = date("w");
+//        if ($week == 1) {//每周一 第一次登录的时候刷新         
+//            self::WeekTaskReset();            
+//        }
+             
     }
 
     static function ClearDay7Task() {
@@ -318,10 +316,10 @@ class TaskProc {
     /**
      * 7日狂欢数据重置
      */
-    public static function Day7TaskReset() {                   
-        if (!FightProc::isFunUnlock(6)) {
-            return;
-        }
+    public static function Day7TaskReset() {
+//        if (!FightProc::isFunUnlock(6)) {
+//            return;
+//        }
 
         if (ctx()->task->day7_startTs == 0) {
             $tag = true;
@@ -394,6 +392,10 @@ class TaskProc {
      * 日常
      */
     static function DailyTaskReset() {
+        if (!FightProc::isFunUnlock(5)) {
+            return;
+        }
+
         self::ClearActiveTask(Enum_ActiveTaskType::DailyTask);
         self::initActiveTask(Enum_ActiveTaskType::DailyTask);
         self::autoRecoverState_activeTask();
@@ -405,6 +407,9 @@ class TaskProc {
      * 周常
      */
     static function WeekTaskReset() {
+        if (!FightProc::isFunUnlock(5)) {
+            return;
+        }
         self::ClearActiveTask(Enum_ActiveTaskType::WeekTask);
         self::initActiveTask(Enum_ActiveTaskType::WeekTask);
 
@@ -423,21 +428,21 @@ class TaskProc {
         ctx()->task->activeTaskLength = $length;
         self::autoRecoverState_activeTask();
     }
-    
+
     static function checkMainTask() {
         $activeTaskInfo = ctx()->task->activeTaskInfo;
         $tag = false;
         foreach ($activeTaskInfo as $key => $task) {
             $ins_TaskStep_Active = new Ins_TaskStep_Active($task);
-            if($ins_TaskStep_Active->mo()->type == Enum_ActiveTaskType::MainTask){
+            if ($ins_TaskStep_Active->mo()->type == Enum_ActiveTaskType::MainTask) {
                 $tag = true;
                 break;
             }
         }
-        if(!$tag){
+        if (!$tag) {
             TaskProc::MainTaskInit(glc()->FirstMainTaskId);
-        } 
-        self::autoRecoverState_activeTask();   
+        }
+        self::autoRecoverState_activeTask();
     }
 
 //    static function MainTaskCheck_oldUserDate() {
@@ -480,7 +485,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::PassGate_X, Enum_PropelType::add, 1, array($gateId));
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 通关第X关
      */
@@ -560,7 +565,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::ComposeNumGem_state, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 任意1个法术等级达到2  
      */
@@ -640,7 +645,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::OpenNumBrightBox, Enum_PropelType::add, $num, array($boxId));
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     static function OnOpenNumBrightBox_state($boxId, $num) {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::OpenNumBrightBox_state, Enum_PropelType::add, $num, array($boxId));
         self::CheckActiveTaskConditions($taskEventArg);
@@ -661,7 +666,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::BuyNumDailyShop_state, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 开任意宝箱X次
      */
@@ -717,6 +722,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::UserLevel_X, Enum_PropelType::set, $lv, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
+
     /**
      * 扫荡
      */
@@ -724,7 +730,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::FightSweepGate, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 领取任务奖励
      */
@@ -732,7 +738,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::OnReceiveTaskPrize, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 购买铜钱一次
      */
@@ -740,7 +746,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::BuyGold, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 领取战力榜元宝奖励X次;参数1:无;参数2:次数(数值)
      */
@@ -748,7 +754,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::FightRankPrize_Num, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 封印技能
      */
@@ -756,7 +762,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::CloseSkill, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
     /**
      * 玩家领取X次章节宝箱
      */
@@ -764,7 +770,7 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::ReceiveGateBoxReward, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
-    
+
 // </editor-fold>
 //
 // <editor-fold defaultstate="collapsed" desc="活动任务是否完成的检测-">

+ 27 - 1
Gameserver/App/process/UserProc.php

@@ -450,7 +450,7 @@ class UserProc {
         } else {                                                                # 更新下登录次数记录(任务计数器)
         }
         if ($ret == 1) {                                                        # 连续登录
-        } else if ($ret >= 2) {                                                 # 隔天登录
+        } else if ($ret >= 2) {                                                 # 隔天登录                        
         }
         ctx()->baseInfo->lastLogin = now();                                     # 更新下访问时间
         //TapDBUtil::SOnUserLogin();                                              # 向tapdb上报玩家登录 2023.5.10
@@ -470,7 +470,32 @@ class UserProc {
         //TaskProc::initAchieveData();
         TaskProc::ResetTask();
         PayProc::setFirstRechargeLoginTag();
+        self::ActiveRefershTsDeal();
     }
+    
+    static function ActiveRefershTsDeal() {
+        //一天一刷
+        TaskProc::DailyTaskReset();
+        TaskProc::ClearDay7Task();
+        
+        //一周一刷
+        $weekNum = TimeUtil::totalWeeks();
+        $lastWeekNum = TimeUtil::totalWeeks(ctx()->baseInfo->lastLogin);
+        if($weekNum - $lastWeekNum >= 1){
+            TaskProc::WeekTaskReset();
+        }
+        
+        //两周一刷
+        if($weekNum - $lastWeekNum >= 2){//暂时还没有对应活动
+           
+        }
+        //2天一刷 
+        $curDay = TimeUtil::totalDays(); 
+        $nextDay = TimeUtil::totalDays(ctx()->privateState->nextDayLogin);
+        if($curDay - $nextDay>= 2){
+            ctx()->privateState->nextDayLogin = now();
+        }
+    }      
 
     static function OnLogin_DateDeal() {
         EmailProc::refreshSysMail(req()->zoneid, req()->uid);
@@ -484,6 +509,7 @@ class UserProc {
         TaskProc::OnLogin_Daily();
         TaskProc::OnLogin_day7();
         TaskProc::checkMainTask();
+        FightProc::SubFunDateInit_Config();
     }
 
 //    static function clear() {