Browse Source

Merge branch 'dev' into tap

wanggangzero 5 months ago
parent
commit
de33c60cf9

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

@@ -208,6 +208,11 @@ class CmdCode {
      * 一键领取
      */
     const cmd_task_prizesAllreceived = 6206;
+    
+    /**
+     * 观看广告 通知后端
+     */
+    const cmd_task_lookGuangGao = 6207;
 // </editor-fold>
 //
 // <editor-fold defaultstate="collapsed" desc="背包操作码 - 64xx">

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-17 10:12:28
+ // 日期: 2024-12-17 17:52:35
 ////////////////////
 
 /**

+ 7 - 2
Gameserver/App/model/Const/sm_equip_position.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-21 11:05:54
+ // 日期: 2024-12-17 10:29:52
 ////////////////////
 
 
@@ -24,7 +24,12 @@ class sm_equip_position
     public $name;
 
     /**
-    * @var Int32 装备部位id1 2 3 4 5 6 default(1) 
+    * @var Int32 装备部位id1:武器
+    *  2:头盔
+    *  3:手套
+    *  4:盔甲
+    *  5:饰品
+    *  6:鞋子 default(1) 
     */
     public $position;
 

+ 1 - 1
Gameserver/App/model/Const/sm_evolve.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-11-29 16:35:54
+ // 日期: 2024-12-17 15:05:55
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_fun_unlock.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-13 13:57:12
+ // 日期: 2024-12-17 17:35:55
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_glc2.php

@@ -8,7 +8,7 @@
 
 
 /**
- * Static Model sm_glc2 全局参数2
+ * Static Model glc2 全局参数2
  */
 class sm_glc2
 {

+ 2 - 2
Gameserver/App/model/Const/sm_globalsettings.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-17 09:33:54
+ // 日期: 2024-12-17 14:34:30
 ////////////////////
 
 
@@ -139,7 +139,7 @@ class sm_globalsettings
     public $BuyTiliCost;
 
     /**
-    * @var Int32 每日扫荡最大次数  
+    * @var Int32 每日免费扫荡最大次数  
     */
     public $sweepMaxNum;
 

+ 1 - 1
Gameserver/App/model/Const/sm_item.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-17 10:10:19
+ // 日期: 2024-12-17 15:03:37
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_predicate.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-13 16:15:17
+ // 日期: 2024-12-17 15:38:46
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_waveItem.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-17 09:41:22
+ // 日期: 2024-12-17 17:10:09
 ////////////////////
 
 

+ 1 - 1
Gameserver/App/model/Const/sm_waves.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-12-17 09:41:22
+ // 日期: 2024-12-17 17:10:09
 ////////////////////
 
 

+ 2 - 0
Gameserver/App/model/User/Enum_ActiveTaskCmdType.php

@@ -10,6 +10,7 @@ class Enum_ActiveTaskCmdType extends Enum {
     const DailyLogin = 101;       //每日登录游戏    
     const OnLogin_X = 102;       //登录第X天
     const OnReceiveTaskPrize = 103;       //领取任务奖励
+    const ReName = 104;       //改名字
     
     const PassGate_X = 201;       //通关第X关
     const FightNumMainGate = 202;       //参与主线关卡1次
@@ -60,5 +61,6 @@ class Enum_ActiveTaskCmdType extends Enum {
     const BuyGold = 906;               //购买铜钱一次
     const OpenNumBrightBox_state = 907;       //开启1次宝箱(宝石宝箱 装备宝箱) 状态类
     const BuyNumDailyShop_state = 908;       //每日商店购买物品1次 状态类
+    const LookGuanggao = 909;       //观看任意广告即可获得
          
 }

+ 16 - 7
Gameserver/App/model/User/Info_Gates.php

@@ -17,18 +17,19 @@ class Info_Gates extends Object_ext {
 
     /**
      * 当前剧情选择的关卡
+     * @var int 
      */
     public $CurrentGateId = 0;
 
     /**
      * 已解锁剧情关卡的最大id
-     * @var type
+     * @var int
      */
     public $UnlockedGatesMaxId = 0;
 
     /**
      * 最大通关id
-     * @var type
+     * @var int
      */
     public $maxPassGateId = 0;
 
@@ -40,13 +41,13 @@ class Info_Gates extends Object_ext {
 
     /**
      * 挑战功能领取记录
-     * @var type
+     * @var []
      */
     public $GatesChallengeRecord = null;
 
     /**
      * 进化解锁记录
-     * @var type
+     * @var []
      */
     #[ArrayType]
     public $evolveUnlockRecord = array();
@@ -54,33 +55,41 @@ class Info_Gates extends Object_ext {
     /**
      * 巡逻领取奖励的时间
      * @var int
+     * @deprecated since version 巡逻没有用着
      */
     public $xunluo_StartTs = 0;
 
     /**
      * 快速巡逻的购买记录
      * @var int
+     * @deprecated since version 巡逻没有用着
      */
     public $xunluo_quick_buyRecord = 0;
 
     /**
      * 进化左边解锁最大值得记录
-     * @var type
+     * @var int
      */
     public $evolveMaxId_left = 0;
 
     /**
      * 进化右边解锁最大值得记录
-     * @var type
+     * @var int
      */
     public $evolveMaxId_right = 0;
 
     /**
      * 扫荡
-     * @var type
+     * @var int
      */
     public $fightSweepNum = 0;
 
+    /**
+     * 扫荡 下次扫荡时间戳
+     * @var int
+     */
+    public $fightSweepTs = 0;
+
     /**
      * 挑战关卡信息
      * @var Ins_TowerGateInfo

+ 4 - 2
Gameserver/App/process/ActiveProc.php

@@ -147,7 +147,9 @@ class ActiveProc {
 
         if (ctx()->privateState->lotteryNum_free > GameConfig::glc2()->activity_lottery_FreeNum && ctx()->privateState->lotteryNum_free <= GameConfig::glc2()->activity_lottery_FreeNum + GameConfig::glc2()->activity_lottery_GuanggaoNum) {
             my_Assert(now() - ctx()->privateData(true)->activity_lottery_guanggaoTs >= GameConfig::glc2()->activity_lottery_GuanggaoDownTs, ErrCode::user_shop_DownTsLimit);
-            ctx()->privateData(true)->activity_lottery_guanggaoTs = now();                
+            ctx()->privateData(true)->activity_lottery_guanggaoTs = now();  
+            
+            TaskProc::OnLookGuanggao();
         }
 
         if (ctx()->privateState->lotteryNum < glc()->activity_lottery_allNum) {
@@ -184,7 +186,7 @@ class ActiveProc {
                     'reward_equip' => StoreProc::$reward_equip,
                     'gold' => ctx()->baseInfo->gold,
                     'cash' => ctx()->baseInfo->cash,
-                    'lotteryNum' => ctx()->privateState->lotteryNum,
+                    'privateState' => ctx()->privateState,
                     'indexReward' => $rewardList,
         ));
     }

+ 13 - 6
Gameserver/App/process/FightProc.php

@@ -255,7 +255,7 @@ class FightProc {
      */
     public static function FightSweep() {
         //list($gateId) = req()->paras;
-// 2024.12.17 扫荡修改: 前3次免费, 后面可以一直看广告免费.
+// 2024.12.17 扫荡修改: 前3次免费, 后面可以一直看广告免费.(特权月卡可以免广告, 结合到一起, 特权月卡就可以一直刷了.)
 
         $passGateId = ctx()->gates->maxPassGateId();                            # 最高通关关卡id
         my_Assert($passGateId != 0, ErrCode::gate_NoSweep);                     # 还没有通关关卡
@@ -270,11 +270,15 @@ class FightProc {
 //            $max = glc()->sweepMaxNum;
 //            my_Assert(ctx()->gates->fightSweepNum < $max, ErrCode::gate_SweepMaxNum_limit);
 //        }
-
-        ctx()->gates->fightSweepNum += 1;
-        ctx()->baseInfo->Consume_tili($costTili);
-        ctx()->privateData(true)->battlePass_tili += $costTili;
-
+        if (ctx()->gates->fightSweepNum < glc()->sweepMaxNum) {
+            ctx()->gates->fightSweepTs = now();                                 # 前三次无冷却
+        } else {
+            ctx()->gates->fightSweepTs = now(60);                               # 下次扫荡时间戳(广告时需要间隔)
+        }
+        ctx()->gates->fightSweepNum += 1;                                       # 增加扫荡次数记录
+        ctx()->baseInfo->Consume_tili($costTili);                               # 扣除体力
+        ctx()->privateData(true)->battlePass_tili += $costTili;                 # 增加体力消耗记录
+# 发放扫荡奖励↓
         $wavesArr = GameConfig::waves_getItemArray($passGateId);
         $count = count($wavesArr);
         $wavesMo = $wavesArr[$count - 1];
@@ -329,6 +333,7 @@ class FightProc {
                 }
             }
         }
+# 奖励逻辑结束.
 
         TaskProc::OnFightSweepGate();
         UserProc::updateUserInfo();
@@ -341,6 +346,7 @@ class FightProc {
             'maxXp' => ctx()->baseInfo->maxXp,
             'level' => ctx()->baseInfo->level,
             'fightSweepNum' => ctx()->gates->fightSweepNum,
+            'fightSweepTs' => ctx()->gates->fightSweepTs,
             //'prizeArr' => $prizeArr,
             'store' => ctx()->store,
             'task' => ctx()->task,
@@ -434,6 +440,7 @@ class FightProc {
     public static function FightDailyClear() {
         //ctx()->gates->xunluo_quick_buyRecord = 0;
         ctx()->gates->fightSweepNum = 0;
+        ctx()->gates->fightSweepTs = now();
         ctx()->gates()->TowerGateInfo()->RefreshSkillTimes = 0;
         ctx()->gates()->TowerGateInfo()->TodayChanNum = glc()->tower_daily_chanceNum;
 

+ 10 - 0
Gameserver/App/process/ShopProc.php

@@ -66,6 +66,8 @@ class ShopProc {
             ctx()->privateData(true)->guanggaoGetTiliNum += 1;
 
             ctx()->privateData(true)->guanggaoGetTili_ts = now();
+            
+            TaskProc::OnLookGuanggao();
         } else {
             $maxNum = glc()->BuyTili_DailyMaxNum;
             my_Assert(ctx()->privateState->buyTiliNum < $maxNum, ErrCode::user_shop_buyTiliNumLimit);
@@ -239,6 +241,8 @@ class ShopProc {
                 }
                 ctx()->privateState->dailyShop_GuangGaoNum += 1;
                 ctx()->privateState->dailyShop_GuangGaoTs = now();
+                
+                TaskProc::OnLookGuanggao();
             }
         } else {
             my_Assert(!in_array($typeId, ctx()->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
@@ -299,12 +303,14 @@ class ShopProc {
                 $buyNum = 1;
                 my_Assert(now() - ctx()->privateState->lastFreeGetTs_ShopBoxCommon_equip >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
                 ctx()->privateState->lastFreeGetTs_ShopBoxCommon_equip = now();
+                TaskProc::OnLookGuanggao();
             }
         } else if ($mo->type == 4) {
             if ($buyNum == 0) {
                 $buyNum = 1;
                 my_Assert(now() - ctx()->privateState->lastFreeGetTs_ShopBoxBright_equip >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
                 ctx()->privateState->lastFreeGetTs_ShopBoxBright_equip = now();
+                TaskProc::OnLookGuanggao();
             }
                         
         }
@@ -408,12 +414,14 @@ class ShopProc {
                 $buyNum = 1;
                 my_Assert(now() - ctx()->privateState->lastFreeGetTs_ShopBoxCommon >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
                 ctx()->privateState->lastFreeGetTs_ShopBoxCommon = now();
+                TaskProc::OnLookGuanggao();
             }
         } else if ($mo->type == 2) {
             if ($buyNum == 0) {
                 $buyNum = 1;
                 my_Assert(now() - ctx()->privateState->lastFreeGetTs_ShopBoxBright >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
                 ctx()->privateState->lastFreeGetTs_ShopBoxBright = now();
+                TaskProc::OnLookGuanggao();
             }
                         
         }
@@ -559,6 +567,8 @@ class ShopProc {
             //收费买
             if ($typeId == 1 && ctx()->privateState->goldShop_GuangGaoNum < $mo->guanggaoNum) {
                 ctx()->privateState->goldShop_GuangGaoNum += 1;
+                
+                TaskProc::OnLookGuanggao();
             } else {
                 my_Assert(ctx()->baseInfo->cash >= $mo->price, ErrCode::notenough_cash_msg);
                 ctx()->baseInfo->Consume_Cash($mo->price);

+ 32 - 0
Gameserver/App/process/TaskProc.php

@@ -34,10 +34,25 @@ class TaskProc {
                 return TaskProc::receiveActivePointBoxReward();
             case CmdCode::cmd_task_prizesAllreceived:                           # 6206 任务奖励一键领取
                 return TaskProc::taskPrizesAllreceived();
+            case CmdCode::cmd_task_lookGuangGao:                                # 6207 观看广告 通知后端
+                return TaskProc::LookGuangGao();               
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+    
+    /**
+     * 6207 观看广告 通知后端
+     * @return type
+     */
+    public static function LookGuangGao() {
+        //list($type) = req()->paras;
+        TaskProc::OnLookGuanggao();
+        
+        UserProc::updateUserInfo();
+        return Resp::ok(array("task" => ctx()->task,                 
+        ));
+    }
 
     /**
      *  6206 任务奖励一键领取
@@ -475,6 +490,15 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::DailyLogin, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
+    
+    /**
+     * 改名字
+     */
+    static function OnReName() {
+        $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::ReName, Enum_PropelType::add, 1, array());
+        self::CheckActiveTaskConditions($taskEventArg);
+    }
+
 
     /**
      * 登录第X天
@@ -696,6 +720,14 @@ class TaskProc {
         $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::BuyTiliOrLookGuanggao, Enum_PropelType::add, 1, array());
         self::CheckActiveTaskConditions($taskEventArg);
     }
+    
+    /**
+     * 观看广告
+     */
+    static function OnLookGuanggao() {
+        $taskEventArg = new Ins_TaskEventArgs(Enum_ActiveTaskCmdType::LookGuanggao, Enum_PropelType::add, 1, array());
+        self::CheckActiveTaskConditions($taskEventArg);
+    }
 
     /**
      * 任意充值X次

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

@@ -65,7 +65,9 @@ class UserProc {
             ctx()->base()->name = $newName;
             self::updateUserInfo();                                                 # 回存数据
             FightProc::UpdateRankUserName(req()->uid, $newName);                    # 刷新排行榜上的昵称
-            return Resp::ok();
+            TaskProc::OnReName();
+            
+            return Resp::ok(array("task"=> ctx()->task));
         }
         return Resp::err(ErrCode::err_db);
     }