cyzhao 3 hónapja
szülő
commit
e4b85cc8e8

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

@@ -202,6 +202,23 @@ class CmdCode {
      * 元宝商城购买
      */
     const cmd_active_YanBaoBuyItemActive_drawReward = 6113;
+    
+    /**
+     * 
+     */
+    const active_FlipCardLottery_DrawCardReward = 6114;
+
+    /**
+     * 
+     */
+    const active_FlipCardLottery_BuyTickets = 6115;
+    
+    /**
+     * 
+     */
+    const active_FlipCardLottery_DrawGrandReward = 6116;
+
+
 // </editor-fold>
 // <editor-fold defaultstate="collapsed" desc="任务操作码 - 62xx">
 

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

@@ -667,6 +667,11 @@ class ErrCode {
      * 连续在线礼包缺少配置数据
      */
     const onlinegift_constno_err = 3517;
+    
+    /**
+     * 抽奖券购买数量超出上限
+     */
+    const active_flipCardLotteru_buyNumLimit = 3518;
 // </editor-fold>
 //
 //   // <editor-fold defaultstate="collapsed" desc="    task 3600    ">

+ 1 - 1
Gameserver/App/configs/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-02-11 14:37:45
+ // 日期: 2025-02-12 14:32:11
 ////////////////////
 
 namespace loyalsoft;

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-02-11 14:37:45
+ // 日期: 2025-02-13 17:11:43
 ////////////////////
 
 /**

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-02-07 18:21:59
+ // 日期: 2025-02-13 16:42:11
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-02-07 18:21:59
+ // 日期: 2025-02-13 16:42:11
 ////////////////////
 
 

+ 0 - 5
Gameserver/App/model/Const/sm_activity_flipCardLottery_lineIds.php

@@ -23,11 +23,6 @@ class sm_activity_flipCardLottery_lineIds
     */
     public $lineId;
 
-    /**
-    * @var Int32 概率  
-    */
-    public $per;
-
     /**
     * @var String 所属当前行下的卡牌id集合  
     */

+ 53 - 3
Gameserver/App/model/Const/sm_activity_flipcardlottery_grandreward.php

@@ -23,20 +23,70 @@ class sm_activity_flipcardlottery_grandreward
     */
     public $typeId;
 
+    /**
+    * @var Int32 概率  
+    */
+    public $per;
+
+    /**
+    * @var String 奖励信息  
+    */
+    public $reward_1;
+
+    /**
+    * @var Int32 该大奖所属轮次开始次数  
+    */
+    public $flipCount_start_1;
+
+    /**
+    * @var Int32 该大奖所属轮次结束次数  
+    */
+    public $flipCount_end_1;
+
+    /**
+    * @var String 奖励信息  
+    */
+    public $reward_2;
+
+    /**
+    * @var Int32 该大奖所属轮次开始次数  
+    */
+    public $flipCount_start_2;
+
+    /**
+    * @var Int32 该大奖所属轮次结束次数  
+    */
+    public $flipCount_end_2;
+
+    /**
+    * @var String 奖励信息  
+    */
+    public $reward_3;
+
+    /**
+    * @var Int32 该大奖所属轮次开始次数  
+    */
+    public $flipCount_start_3;
+
+    /**
+    * @var Int32 该大奖所属轮次结束次数  
+    */
+    public $flipCount_end_3;
+
     /**
     * @var String 奖励信息  
     */
-    public $reward;
+    public $reward_4;
 
     /**
     * @var Int32 该大奖所属轮次开始次数  
     */
-    public $flipCount_start;
+    public $flipCount_start_4;
 
     /**
     * @var Int32 该大奖所属轮次结束次数  
     */
-    public $flipCount_end;
+    public $flipCount_end_4;
 
 }
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-01-13 17:51:58
+ // 日期: 2025-02-13 16:42:24
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-02-11 14:28:07
+ // 日期: 2025-02-12 11:59:37
 ////////////////////
 
 
@@ -68,5 +68,15 @@ class sm_glc2
     */
     public $FlipCardLotteryNum_Daily;
 
+    /**
+    * @var Int32 购买一个抽奖券消耗的元宝数量  
+    */
+    public $FlipCardLottery_Yuanbao_BuyOneTickets;
+
+    /**
+    * @var Int32 金蛇献瑞 购买抽奖券最大数量限制  
+    */
+    public $FlipCardLottery_BuyTickets_MaxNumLimit;
+
 }
 

+ 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 
- // 日期: 2025-01-24 15:09:33
+ // 日期: 2025-02-12 15:22:00
 ////////////////////
 
 

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

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2025-02-08 11:54:00
+ // 日期: 2025-02-13 15:59:33
 ////////////////////
 
 

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

@@ -69,4 +69,28 @@ class Enum_SubFunType {
      */
     const Day7_Sign_NewPlayer = 12;
     
+    /**
+     * 累计奖励
+     */
+    const Lottory_Accumulate = 13;
+    /**
+     * 兑换
+     */
+    const Lottory_Exchange = 14;
+
+    /**
+     * 在线礼包
+     */
+    const OnlineInfos = 15;
+
+    /**
+     * 元宝购买限时贩售活动
+     */
+    const YuanBaoBuyItemInfos = 16;
+
+    /**
+     * 金蛇献瑞
+     */
+    const FlipCardLottery = 17;
+    
 }

+ 29 - 0
Gameserver/App/model/User/Info_PrivateState.php

@@ -489,6 +489,35 @@ class Info_PrivateState extends Object_ext {
      * @var type
      */
     public $YuanbaoBuy_RefershTs = 0;
+    
+    /**
+     * 金蛇奖数据记录
+     */
+    #[ArrayType]
+    public $flipCard_RewardRecord = array();
+
+    /**
+     * 金蛇大奖数据
+     */
+    #[ArrayType]
+    public $flipCard_randGrandReward = array();
+
+    /**
+     * 金蛇献瑞 从活动开启算总的重置次数
+     * @var type
+     */
+    public $flipCardNum_all = 0;
+    /**
+     * 金蛇献瑞 每日重置次数
+     * @var type
+     */
+    public $flipCardNum_daily = 0;
+    
+    /**
+     * 结束时间
+     * @var type
+     */
+    public $flipCardLottery_endTs = 0;
 
     public function initialize() {      
         $this->onlineGiftts = 1;

+ 286 - 19
Gameserver/App/process/ActiveProc.php

@@ -47,68 +47,334 @@ class ActiveProc {
             case CmdCode::cmd_active_getTodayOnlineInfos:                       # 6111 查询当天在线时长信息
                 return self::GetTodayOnlineInfos();
             case CmdCode::cmd_active_draw_onlinegift:                           # 6112 领取在线(时长)礼包
-                return self::DrawOnlineGift();    
+                return self::DrawOnlineGift();
             case CmdCode::cmd_active_YanBaoBuyItemActive_drawReward:
                 return self::YanBaoBuyItemActive_drawReward();
+            case CmdCode::active_FlipCardLottery_DrawCardReward:                # 6114 金蛇献瑞抽奖
+                return self::FlipCardLottery_DrawReward();
+            case CmdCode::active_FlipCardLottery_BuyTickets:                    # 6115 金蛇献瑞购买抽奖券
+                return self::FlipCardLottery_BuyTickets();
+            case CmdCode::active_FlipCardLottery_DrawGrandReward:               # 6116 领取大奖信息
+                return self::FlipCardLottery_DrawGrandReward();    
             default:
                 Err(ErrCode::cmd_err);
         }
     }
+
+    /**
+     * 每日重置数据
+     */
+    public static function ResetActiveInfos() {
+        ctx()->privateState->flipCardNum_daily = 0;
+        ActiveProc::DailyResetDay7Task();
+        self::ClearOnlineGiftTs();
+        ActiveProc::ClearYanBaoBuyItemActive_drawReward();
+    }
+
+    /**
+     * 重置金蛇数据
+     */
+    public static function ClearFlipCardInfo() {
+        //活动结束
+        $mo = GameConfig::subfun_unlock_getItem(Enum_SubFunType::FlipCardLottery);
+        if (now() >= $mo->startTs && now() < $mo->endTs && $mo->endTs != ctx()->privateState->flipCardLottery_endTs) {//当活动重启再次开启的时候再重置数据
+            ctx()->privateState->flipCardLottery_endTs = $mo->endTs;
+            ctx()->privateState->flipCardNum_all = 0;
+            //初始化大奖
+            ctx()->privateState->flipCard_RewardRecord = array();
+            ctx()->privateData(true)->flipCard_randGrandReward = self::RandGrandReward();
+        }
+    }
     
+    /**
+     * 6116 领取大奖信息
+     * @return type
+     */
+    public static function FlipCardLottery_DrawGrandReward() {
+        //list() = req()->paras;                                                # 提取参数
+        $lineArr = array();
+        $list = ctx()->privateState->flipCard_randGrandReward;
+        $index = 0;
+        foreach ($list as $id) {
+            $mo = GameConfig::activity_flipCardLottery_lineIds_getItem($index);
+            $s = explode(',', $mo->cardIds);
+            $tag = true;
+            foreach ($s as $cId) {
+                if (!self::isExistCard($cId)) {
+                    $tag = false;
+                    break;
+                }
+            }
+            
+            if($tag){
+                $lineArr[] = $id;
+            }
+            
+            $index += 1;
+        }
+        
+        if (count($lineArr) >= GameConfig::glc2()->FlipCardLottery_ResetNum) {
+            ctx()->privateState->flipCard_RewardRecord = array();
+            ctx()->privateData(true)->flipCard_randGrandReward = self::RandGrandReward();
+        }
+        
+        return Resp::ok(array(
+                    'gold' => ctx()->baseInfo->gold,
+                    'cash' => ctx()->baseInfo->cash,
+                    'store' => ctx()->store,
+                    'heros' => ctx()->heros,
+                    'privateState' => ctx()->privateState,                                             
+                    'reward_equip'=> StoreProc::$reward_equip,
+                    'reward_Gem'=> StoreProc::$reward_Gem,
+                    'reward'=> StoreProc::$reward,           
+        ));
+        
+    }
+    
+
+    /*
+     * 6114 金蛇献瑞抽奖
+     */
+
+    public static function FlipCardLottery_DrawReward() {
+        //list() = req()->paras;                                                  # 提取参数
+        //my_Assert(!in_array($id, ctx()->privateState->flipCard_RewardRecord) , ErrCode::active_hasgetted);              
+        my_Assert(ctx()->privateState->flipCardNum_daily < GameConfig::glc2()->FlipCardLotteryNum_Daily, ErrCode::active_lotteryNumLimit);
+
+        $cardId = self::RandCardReward();
+        $rewards = GameConfig::glc2()->FlipCardLottery_CardRewards;
+        $str = explode(';', $rewards);
+        $per = 0;
+        foreach ($str as $key => $value) {
+            $s = explode(',', $value);
+            $per += $s[2];
+        }
+
+        $randNum = rand(1, $per);
+        $start = 0;
+        $end = 0;
+        $rewardStr = "";
+        foreach ($str as $key => $value) {
+            $s = explode(',', $value);
+            $end += $s[2];
+            if ($randNum >= $start && $randNum < $end) {
+                $rewardStr = $cardId . "-" . $s[0] . "-" . $s[1];
+                StoreProc::AddMultiItemInStore($s[0] . "," . $s[1]);
+                break;
+            }
+            $start = $end;
+        }
+
+        ctx()->privateData(true)->flipCard_RewardRecord[] = $rewardStr;
+        ctx()->privateData(true)->flipCardNum_daily += 1;
+        ctx()->privateData(true)->flipCardNum_all += 1;
+
+        $dic = GameConfig::activity_flipCardLottery_lineIds();
+        $lineList = array();
+
+        $curUnlockLine = 999;
+        foreach ($dic as $id => $mo) {
+            $s = explode(',', $mo->cardIds);
+            $tag = true;
+            foreach ($s as $cId) {
+                if (!self::isExistCard($cId)) {
+                    $tag = false;
+                    break;
+                }
+            }
+
+            if ($tag) {
+                $lineList[] = $id;
+                if (in_array($cardId, $s)) {
+                    $curUnlockLine = $id;
+                }
+            }
+        }
+
+        //$grandReward = array();
+
+
+        return Resp::ok(array(
+                    'gold' => ctx()->baseInfo->gold,
+                    'cash' => ctx()->baseInfo->cash,
+                    'store' => ctx()->store,
+                    'heros' => ctx()->heros,
+                    'privateState' => ctx()->privateState,
+                    'cardReward' => $rewardStr,
+                    //'grandReward' => $grandReward,
+                    'curUnlockLine'=> $curUnlockLine,
+//                    'reward_equip'=> StoreProc::$reward_equip,
+                    'cardId' => $cardId,
+        ));
+    }
+
+    public static function isExistCard($id) {
+        foreach (ctx()->privateData(true)->flipCard_RewardRecord as $key => $value) {
+            $arr = explode('-', $value);
+            if ($arr[0] == $id) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * 初始化大奖信息 12个大奖在数组的位置对应了 界面上 0-12个位置
+     * @return type
+     */
+    public static function RandGrandReward() {
+        $lineList = array();
+        $dic = GameConfig::activity_flipcardlottery_grandreward();     
+        foreach ($dic as $id => $mo) {
+            $lineList[] = $id;
+        }
+
+        $typeIdArr = array();
+        $num = count($lineList);
+        for ($i = 0; $i < $num; $i++) {
+            $rand = rand(0, count($lineList) - 1);
+            $typeIdArr[] = $lineList[$rand];
+            StlUtil::arrayRemoveAt($lineList, $rand);
+        }
+        return $typeIdArr;
+    }
+
+    /**
+     * 随机抽取一个卡牌
+     * @return int
+     */
+    public static function RandCardReward() {
+        $randGrandReward = ctx()->privateState->flipCard_randGrandReward;
+
+        $cId = 0;
+        while (true) {
+            $perNum = 0; //大奖总概率
+            foreach ($randGrandReward as $id) {
+                $perNum += GameConfig::activity_flipcardlottery_grandreward_getItem($id)->per;
+            }
+
+            $rand = rand(1, $perNum);
+            $start = 0;
+            $end = 0;
+            $lineId = null;
+            $grandId = null;
+            $index = 0;
+            foreach ($randGrandReward as $id) {
+                $mo = GameConfig::activity_flipcardlottery_grandreward_getItem($id);
+                $end += $mo->per;
+                if ($rand >= $start && $rand < $end) {
+                    $lineId = $index;
+                    $grandId = $id;
+                    break;
+                }
+                $start = $end;
+                $index += 1;
+            }
+            if ($lineId != null && $grandId != null) {
+                $lineMo = GameConfig::activity_flipCardLottery_lineIds_getItem($lineId);
+                $str = explode(',', $lineMo->cardIds);
+                $cardArr = array();
+                $isExistNoFlip = false;
+                foreach ($str as $cardId) {
+                    if (!self::isExistCard($cardId)) {
+                        $cardArr[] = $cardId;
+                        $isExistNoFlip = true;
+                    }
+                }
+
+                if ($isExistNoFlip) {
+                    $n = rand(0, count($cardArr) - 1);
+                    $cId = $cardArr[$n];
+                    break;
+                } else {
+                    StlUtil::arrayRemove($randGrandReward, $grandId);
+                }
+            } else {
+                break;
+            }
+        }
+
+        return $cId;
+    }
+
+    /*
+     *  6115 金蛇献瑞购买抽奖券
+     */
+
+    public static function FlipCardLottery_BuyTickets() {
+        list($num) = req()->paras;                                              # 提取参数
+
+        my_Assert($num <= GameConfig::glc2()->FlipCardLottery_BuyTickets_MaxNumLimit, ErrCode::active_flipCardLotteru_buyNumLimit);
+        $cash = $num * GameConfig::glc2()->FlipCardLottery_Yuanbao_BuyOneTickets;
+        my_Assert($cash >= ctx()->baseInfo->cash, ErrCode::notenough_cash_msg);
+
+        ctx()->base(true)->Consume_Cash($cash);
+        $str = '802,' . $num;
+        StoreProc::AddMultiItemInStore($str);
+
+        return Resp::ok(array(
+                    'cash' => ctx()->baseInfo->cash,
+                    'store' => ctx()->store,
+                    'reward' => StoreProc::$reward,
+        ));
+    }
+
     /**
      * [6112] 领取连续在线礼包
      */
     static function YanBaoBuyItemActive_drawReward() {
         list($typeId) = req()->paras;                                           # 提取参数: 礼包的编号
-                                                  
+
         $Mo = GameConfig::activity_cashmall_getItem($typeId);                   # 常量数据
         my_Assert(null != $Mo, ErrCode::err_const_no);                          # 防御找不到配置数据
-        
+
         my_Assert(ctx()->baseInfo->cash >= explode(',', $Mo->cost)[1], ErrCode::notenough_cash_msg);
         ctx()->baseInfo->Consume_Cash(explode(',', $Mo->cost)[1]);
-        
+
         $rewardArr = ctx()->privateState->YuanbaoBuy_RewardRecord;
         $count = array_count_values($rewardArr)[$typeId];
         my_Assert($count < $Mo->limitNum, ErrCode::user_shop_LimitNum);
-        
+
 //        my_Assert(!in_array($typeId, ctx()->privateData()->YuanbaoBuy_RewardRecord), #           # 判断礼包ID是否已经领取
 //                ErrCode::active_hasgetted);
         $err = StoreProc::AddMultiItemInStore($Mo->reward);                     # 发放奖励
         my_Assert(ErrCode::ok == $err, $err);                                   # 发放奖励失败
         ctx()->privateData(true)->YuanbaoBuy_RewardRecord[] = $typeId;          # 记录已领礼包ID
-                   
+
         UserProc::updateUserInfo();                                             # 回写用户数据
-        return Resp::ok(array(                   
+        return Resp::ok(array(
                     "reward" => StoreProc::$reward,
                     "reward_Gem" => StoreProc::$reward_Gem,
                     "reward_equip" => StoreProc::$reward_equip,
                     'gold' => ctx()->base()->gold,
-                    'cash' => ctx()->base()->cash,                  
+                    'cash' => ctx()->base()->cash,
                     'store' => ctx()->store(),
                     'heros' => ctx()->heros()
         ));                                                                     # 设置返回值
-    }  
-    
+    }
+
     public static function GetTodayOnlineInfos() {
         return Resp::ok(array(
                     'onlineGiftts' => ctx()->privateState->onlineGiftts,
-                    'onlineGiftIDs' => ctx()->privateState->onlineGiftIDs,                 
-        )); 
+                    'onlineGiftIDs' => ctx()->privateState->onlineGiftIDs,
+        ));
     }
-     
+
     /**
      * 清理/重置 在线礼包时间戳
      */
     public static function ClearOnlineGiftTs() {
         ctx()->privateState->onlineGiftts = 1;
-        ctx()->privateState->onlineGiftIDs = array();       
+        ctx()->privateState->onlineGiftIDs = array();
+
+        ctx()->privateState->flipCardNum_daily = 0;
     }
-    
+
     /**
      * 清理/重置 元宝商城购买记录
      */
     public static function ClearYanBaoBuyItemActive_drawReward() {
-        ctx()->privateState->YuanbaoBuy_RewardRecord = array();         
+        ctx()->privateState->YuanbaoBuy_RewardRecord = array();
     }
 
     /**
@@ -116,12 +382,12 @@ class ActiveProc {
      */
     static function DrawOnlineGift() {
         list($giftid) = req()->paras;                                                  # 提取参数: 礼包的编号
-                                                  
+
         $giftData = GameConfig::activity_onlinegift_getItem($giftid);           # 在线礼包常量数据
         my_Assert(null != $giftData, ErrCode::onlinegift_constno_err);          # 防御找不到配置数据
 //        my_Assert($privateState->onlineGiftts + 30 >= $giftData->onlineSec, #        # 时间未到,不可以领取
 //                ErrCode::onlinegift_timenotenough);
-        my_Assert(ctx()->privateState->onlineGiftts >= $giftData->onlineSec ,   #
+        my_Assert(ctx()->privateState->onlineGiftts >= $giftData->onlineSec, #
                 ErrCode::active_day7_expired);
         my_default_Arr(ctx()->privateData()->onlineGiftIDs);                    # 防御未初始化领取记录
         my_Assert(!in_array($giftid, ctx()->privateData()->onlineGiftIDs), #           # 判断礼包ID是否已经领取
@@ -131,7 +397,7 @@ class ActiveProc {
         ctx()->privateData(true)->onlineGiftIDs[] = $giftid;                               # 记录已领礼包ID
         //$privateState->onlineGiftts = 0;                                        #每次领取奖励则时间重新计算
 
-        
+
         UserProc::updateUserInfo();                                             # 回写用户数据
         return Resp::ok(array(
                     'onlineGiftts' => ctx()->privateState->onlineGiftts,
@@ -736,4 +1002,5 @@ class ActiveProc {
                     'reward_equip' => StoreProc::$reward_equip,
         ));
     }
+
 }

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

@@ -507,9 +507,9 @@ class UserProc {
         TaskProc::ResetTask();
         PayProc::setFirstRechargeLoginTag();
         self::ActiveRefershTsDeal();
-        ActiveProc::DailyResetDay7Task();
-        ActiveProc::ClearOnlineGiftTs();
-        ActiveProc::ClearYanBaoBuyItemActive_drawReward();
+        
+        ActiveProc::ResetActiveInfos();
+        
     }
 
     static function ActiveRefershTsDeal() {