Bläddra i källkod

周活动-古玉消耗,抽卡奖励

SCFC 1 år sedan
förälder
incheckning
91fd18b945

+ 6 - 0
script/common/ProtoID.lua

@@ -1278,6 +1278,12 @@ _ENV[1277]="CG_WEEKLOOP_ACT_HEROGETSIMPLIFYINFO"
 _ENV[1278]="GC_WEEKLOOP_ACT_HEROGETSIMPLIFYINFO"
 _ENV[1279]="CG_WEEKLOOP_ACT_HEROCHOSEHERO"
 _ENV[1280]="CG_WEEKLOOP_ACT_HERPGETPRIZE"
+_ENV[1281]="CG_WEEKLOOP_ACT_GUYUQUERY"
+_ENV[1282]="GC_WEEKLOOP_ACT_GUYUQUERY"
+_ENV[1283]="CG_WEEKLOOP_ACT_GUYUGETPRIZE"
+_ENV[1284]="CG_WEEKLOOP_ACT_CARDQUERY"
+_ENV[1285]="GC_WEEKLOOP_ACT_CARDQUERY"
+_ENV[1286]="CG_WEEKLOOP_ACT_CARDGETPRIZE"
 _ENV[1301]="CG_XIANZHI_SHOP_QUERY"
 _ENV[1302]="GC_XIANZHI_SHOP_QUERY"
 _ENV[1303]="CG_XIANZHI_SHOP_BUY"

+ 7 - 1
script/common/Util.lua

@@ -627,4 +627,10 @@ local function print_lua_table(lua_table, indent)
 	end
 end
 
-table.print_lua_table = print_lua_table
+table.print_lua_table = print_lua_table
+
+-- 打印当前堆栈
+function PrintNowStackTrace()
+	local stackTrace = debug.traceback("", 2)
+	print("[PrintNowStackTrace] 堆栈信息 "..stackTrace)
+end

+ 23 - 0
script/module/WeekendLoopActivity/Handler.lua

@@ -1,5 +1,7 @@
 local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
 local WeekLoopActHeroStar = require("WeekendLoopActivity.WeekendLoopActHeroStar")
+local WeekLoopActGuYu = require("WeekendLoopActivity.WeekendLoopActUseGuYu")
+local WeekLoopActCard = require("WeekendLoopActivity.WeekendLoopActCard")
 
 -- 请求英雄升星活动信息
 function CG_WEEKLOOP_ACT_HEROQUERY(human, msg)
@@ -19,4 +21,25 @@ end
 -- 英雄升星 - 领取奖励
 function CG_WEEKLOOP_ACT_HERPGETPRIZE(huamn, msg)
     WeekLoopActHeroStar.WeekActHeroStar_GetPrize(huamn)
+end
+
+
+----------------------------------------- 古玉相关协议请求开始 -------------------------------------
+-- 古玉消费 - 请求古玉信息
+function CG_WEEKLOOP_ACT_GUYUQUERY(human, msg)
+    WeekLoopActGuYu.WeekActGuYu_Query(human)
+end
+
+-- 古玉消费 - 请求古玉奖励
+function CG_WEEKLOOP_ACT_GUYUGETPRIZE(human, msg)
+    WeekLoopActGuYu.WeekActGuYu_GetPrize(human)
+end
+
+----------------------------------------- 抽卡协议请求开始 -------------------------------------
+function CG_WEEKLOOP_ACT_CARDQUERY(human, msg)
+    WeekLoopActCard.WeekActCard_Query(human)
+end
+
+function CG_WEEKLOOP_ACT_CARDGETPRIZE(human, msg)
+    WeekLoopActCard.WeekActCard_GetPrize(human)
 end

+ 45 - 1
script/module/WeekendLoopActivity/Proto.lua

@@ -66,4 +66,48 @@ CG_WEEKLOOP_ACT_HEROCHOSEHERO =
 -- 英雄升星 - 领取奖励
 CG_WEEKLOOP_ACT_HERPGETPRIZE = {}
 
--- 回复 GC_WEEKLOOP_ACT_HEROQUERY
+-- 回复 GC_WEEKLOOP_ACT_HEROQUERY
+
+----------------------------------------- 古玉消费协议开始 -------------------------------------
+GuYuPrize = {
+    {"nGuYu",           1,      "int"},         -- 需要古玉数量
+    {"nID",             1,      "int"},         -- 奖励编号
+    {"nState",          1,      "byte"},        -- 0 不可领取 1 - 可领取 2- 已领取
+    {"item",            5,      ItemData},      -- 奖励信息
+}
+
+-- 请求消费古玉-信息
+CG_WEEKLOOP_ACT_GUYUQUERY = {}
+
+-- 请求消费古玉-信息回包
+GC_WEEKLOOP_ACT_GUYUQUERY = {
+    {"nGuYu",       1,    "int"},            -- 当前累计古玉
+    {"list",        17,   GuYuPrize},        -- 奖励信息
+}
+
+-- 请求领取古玉信息
+CG_WEEKLOOP_ACT_GUYUGETPRIZE = {}
+
+----------------------------------------- 抽卡相关协议开始 -------------------------------------
+CardPrize = 
+{
+    {"nNum",            1,          "int"},         -- 需要抽卡次数
+    {"nState",          1,          "byte"},        -- 0 不可领取 1 - 可领取 2- 已领取
+    {"item",            5,          ItemData},      -- 奖励信息
+    {"desc",            1,          "string"},      -- 描述
+    {"nID",             1,          "int"},         -- 奖励编号
+}
+
+-- 请求抽卡信息
+CG_WEEKLOOP_ACT_CARDQUERY = {}
+
+-- 请求抽卡信息 - 回包
+GC_WEEKLOOP_ACT_CARDQUERY = 
+{
+    {"byType",           1,          "byte"},       -- 当前抽卡类型
+    {"nNowNum",          1,          "int"},        -- 当前抽卡次数
+    {"list",             15,          CardPrize},   -- 奖励配置
+}
+
+-- 请求领取抽卡奖励
+CG_WEEKLOOP_ACT_CARDGETPRIZE = {}

+ 427 - 0
script/module/WeekendLoopActivity/WeekendLoopActCard.lua

@@ -0,0 +1,427 @@
+--------------------------------
+-- 文件名       :  WeekendLoopActCard.lua
+-- 文件说明     :  周末冲刺活动-抽卡
+-- 创建时间     :   2024/12/03
+-- 创建人       :   FC
+--------------------------------
+local Util = require("common.Util")
+local Lang = require("common.Lang")
+local Broadcast = require("broadcast.Broadcast")
+local MailExcel = require("excel.mail")
+local Msg = require("core.Msg")
+local ObjHuman = require("core.ObjHuman")
+local WeekLoopActDef = require("WeekendLoopActivity.WeekendLoopActDefine")
+local WeekLoopActCof = require("excel.WeekLoopAct")
+local CommonDB = require("common.CommonDB")
+local MailManager = require("mail.MailManager")
+local Grid = require("bag.Grid")
+local HeroGrid = require("hero.HeroGrid")
+local HeroLogic = require("hero.HeroLogic")
+local BagLogic = require("bag.BagLogic")
+local Log = require("common.Log")
+local HeroExcel = require("excel.hero")
+local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
+
+----------------------------------------- 内部处理开始 -------------------------------------
+tCardPrize = nil
+
+-- 写日志
+local function WeekActCard_WriteLog(human, szFuncName, sztext)
+    Log.write(Log.LOGID_OSS_WEEKLOOP_ACT, szFuncName..sztext.." _id = "..human.db._id.." name = "..human.db.name)
+end
+
+-- 下发数据
+local function WeekActCard_SendData(tMsgData, fd)
+    Msg.send(tMsgData, fd)
+end
+
+-- 获取配置
+local function WeekActCard_GetConfig()
+    if not WeekLoopActCof then
+        return nil
+    end
+
+    return WeekLoopActCof.Card
+end
+
+-- 获取配置
+local function WeekActCard_GetConfigByType(nType)
+    if not tCardPrize or not tCardPrize[nType] then
+        return nil
+    end
+
+    return tCardPrize[nType]
+end
+
+-- 初始化抽卡类型
+local function WeekActCard_ResetCardType(human)
+    if not human then
+        print("[WeekActCard_ResetCardType] 参数不正确")
+        return false
+    end
+
+    if not human.db.nWeekCardType then
+        human.db.nWeekCardType = 1
+    else
+        -- math.fmod()
+        local nLen = (human.db.nWeekCardType + 1) % WeekLoopActDef.WEEKACT_CARD_TYPE_LEN
+        human.db.nWeekCardType = (0 == nLen) and WeekLoopActDef.WEEKACT_CARD_TYPE_LEN or nLen
+    end
+
+    return true
+end
+
+-- 获取抽卡类型
+local function WeekActCard_GetCardType(human)
+    if not human then
+        print("[WeekActCard_SetHeroID] 参数不正确")
+        return -1
+    end
+
+    if not human.db.nWeekCardType then
+        local bRet = WeekActCard_ResetCardType(human)
+        if false == bRet then
+            WeekActCard_WriteLog(human, "[WeekActCard_GetCardType]", "获取抽卡类型,不存在对应字段,重新初始化失败")
+            return -1
+        end
+
+        WeekActCard_WriteLog(human, "[WeekActCard_GetCardType]", "获取抽卡类型,不存在对应字段,初始化顺序有问题, 重新初始化成功")
+    end
+
+    return human.db.nWeekCardType
+end
+
+-- 通过人物抽卡类型获取配置
+local function WeekActCard_GetConfigByHuman(human)
+    if not human then
+        return nil
+    end
+
+    local nNowType = WeekActCard_GetCardType(human)
+    if -1 >= nNowType then
+        return nil
+    end
+
+    return WeekActCard_GetConfigByType(nNowType)
+end
+
+-- 初始化奖励信息
+local function WeekActCard_ResetPrize(human)
+    if not human then
+        return false
+    end
+
+    local nNowType = WeekActCard_GetCardType()
+    if -1 >= nNowType then
+        print("[WeekActCard_ResetPrize] 获取抽卡类型失败")
+        return false
+    end
+
+    local tConfig = WeekActCard_GetConfigByType(nNowType)
+    if not tConfig then
+        return false
+    end
+
+    if not human.db.tWeekCardPrize then
+        human.db.tWeekCardPrize = {}
+    end
+
+    for nID, v in pairs(tConfig) do
+        human.db.tWeekCardPrize[nID] = WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+    
+    return true
+end
+
+-- 获取奖励表
+local function WeekActCard_GetDBPrize(human)
+    if not human then
+        return nil
+    end
+
+    if not human.db.tWeekGuYuPrize then
+        return nil
+    end
+    
+    return human.db.tWeekGuYuPrize
+end
+
+-- 获取奖励ID状态
+local function WeekActCard_GetPrizeStatus(human, nID)
+    if not human then
+        return WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+
+    local tPrize = WeekActCard_GetDBPrize(human)
+    if not tPrize or not tPrize[nID] then
+        return WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+    
+    return tPrize[nID]
+end
+
+-- 设置奖励ID状态
+local function WeekActCard_SetPrizeStatus(human, nID, nStatus)
+    if not human then
+        return false
+    end
+
+    local tPrize = WeekActCard_GetDBPrize(human)
+    if not tPrize or not tPrize[nID] then
+        return false
+    end
+
+    tPrize[nID] = nStatus
+
+    return true
+end
+
+-- 初始化抽卡数量
+local function WeekActCard_ResetCardNum(human)
+    if not human then
+        print("[WeekActCard_ResetCardNum] 参数不正确")
+        return false
+    end
+
+    human.db.nWeekCardNum = 0
+
+    return true
+end
+
+-- 获取抽卡数量
+local function WeekActCard_GetCardNum(human)
+    if not human then
+        print("[WeekActCard_SetHeroID] 参数不正确")
+        return -1
+    end
+
+    if not human.db.nWeekCardNum then
+        local bRet = WeekActCard_ResetCardNum(human)
+        if false == bRet then
+           WeekActCard_WriteLog(human, "[WeekActCard_GetGuYuNum]", "获取抽卡数量,不存在对应字段,重新初始化失败")
+            return -1
+        end
+
+       WeekActCard_WriteLog(human, "[WeekActCard_GetGuYuNum]", "获取抽卡数量,不存在对应字段,初始化顺序有问题, 重新初始化成功")
+    end
+
+    return human.db.nWeekCardNum
+end
+
+-- 设置抽卡数量
+local function WeekActCard_SetCardNum(human, nValue)
+    if not human then
+        print("[WeekActCard_SetCardNum] 参数不正确")
+        return
+    end
+
+    local nNowCard = WeekActCard_GetCardNum(human)
+    if -1 >= nNowCard then
+       WeekActCard_WriteLog(human, "[WeekActCard_SetCardNum]", "获取古玉数量失败")
+        return
+    end
+
+    local nNewGuYu = nNowCard + nValue
+    if 0 > nNewGuYu then
+        nNewGuYu = 0
+    end
+
+    human.db.nWeekCardNum = nNewGuYu
+end
+
+----------------------------------------- 外部调用 -------------------------------------
+function Init()
+    tCardPrize = {}
+    local tConfig = WeekActCard_GetConfig()
+    if not tConfig then
+        return false
+    end
+
+    for nID, v in pairs(tConfig) do
+        local nType = v.nType
+        if not tCardPrize[nType] then
+            tCardPrize[nType] = {}
+        end
+
+        local nTrueID = nID % WeekLoopActDef.WEEKACT_CARD_PRIZEID_LEN
+        tCardPrize[nType][nTrueID] = v
+    end
+
+    return true
+end
+
+-- 重置数据
+function WeekActCard_ResetData(human)
+    if not human then
+        return
+    end
+
+    -- 先更新抽卡类型
+    WeekActCard_ResetCardType(human)
+
+    -- 重置抽卡数量
+    WeekActCard_ResetCardNum(human)
+
+    -- 重置奖励信息
+    if false == WeekActCard_ResetPrize(human) then
+        print("[WeekActCard_ResetData] 重置抽卡奖励数据失败")
+        return
+    end
+
+    WeekActCard_WriteLog(human, "[WeekActCard_ResetData]", "抽卡奖励相关重置完成")
+
+    print("[WeekActCard_ResetData] 抽卡 数据重置结束 ")
+end
+
+-- 是否有红点
+function isRed(human)
+    local tPrize = WeekActCard_GetConfigByHuman(human)
+    if not tPrize then
+        return false
+    end
+
+    for nID, v in pairs(tPrize) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActCard_GetPrizeStatus(human, nID) then
+            return true
+        end
+    end
+
+    return false
+end
+
+-- 抽卡回调
+function WeekActCard_UseCard(human, nAddNum, nType)
+    if not human or 0 >= nAddNum then
+        return
+    end
+
+    local nNowType = WeekActCard_GetCardType(human)
+    if nNowType ~= nType then
+        return
+    end
+
+    local DBID = human.db._id
+    local szName = human.db.name
+    local tConfig = WeekActCard_GetConfigByHuman(human)
+    if not tConfig then
+        print("[WeekActCard_UseCard] 获取不到配置 DBID = "..DBID.." name = "..szName)
+        return
+    end
+
+    WeekActCard_SetCardNum(human, nAddNum)
+    
+    local nNowCard = WeekActCard_GetCardNum(human)
+    if -1 >= nNowCard then
+        WeekActCard_WriteLog(human, "[WeekActCard_UseCard]", "获取玩家当前抽卡次数失败 nAddNum = "..nAddNum)
+        print("[WeekActCard_UseCard] 获取不到抽卡次数 DBID = "..DBID.." name = "..szName.." nAddNum = "..nAddNum)
+        return
+    end
+
+    local bChange = false
+    for nID, v in pairs(tConfig) do
+        local nStatus = WeekActCard_GetPrizeStatus(human, nID)
+        if nNowCard >= v.nNum and WeekLoopActDef.WEEKACT_STATE_NONE == nStatus then
+            bChange = true
+            WeekActCard_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_CANGET)
+        end
+    end
+
+    if true == bChange then
+        WeekActCard_Query(human)
+        WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
+    end
+end
+
+----------------------------------------- 客户端请求 -------------------------------------
+-- 客户端请求-抽卡信息
+function WeekActCard_Query(human)
+    if not human then
+        return
+    end
+
+    local DBID = human.db._id
+    local szName = human.db.name
+
+    local tConfig = WeekActCard_GetConfigByHuman(human)
+    if not tConfig then
+        print("[WeekActCard_Query] 获取不到配置 DBID = "..DBID.." name = "..szName)
+        return
+    end
+
+    local tMsgData = Msg.gc.GC_WEEKLOOP_ACT_CARDQUERY
+    tMsgData.byType = WeekActCard_GetCardType(human)
+    tMsgData.nNowNum = WeekActCard_GetCardNum(human)
+    tMsgData.list[0] = 0
+
+    for nID, v in pairs(tConfig) do
+        tMsgData.list[0] = tMsgData.list[0] + 1
+        local tData = tMsgData.list[tMsgData.list[0]]
+        tData.nNum = v.nNum
+        tData.nID = nID
+        tData.desc = v.szdesc
+        tData.nState = WeekActCard_GetPrizeStatus(human, nID)
+
+        tData.item[0] = #v.prize
+
+        for nIndex, tItem in ipairs(v.prize) do
+            local nGoodsID = tItem[1]
+            local nGoodsNum = tItem[2]
+
+            Grid.makeItem(tData.item[nIndex], nGoodsID, nGoodsNum)
+        end
+    end
+
+    WeekActCard_SendData(tMsgData, human.fd)
+end
+
+-- 客户端请求领取奖励
+function WeekActCard_GetPrize(human)
+    if not human then
+        return
+    end
+
+    local DBID = human.db._id
+    local szName = human.db.name
+
+    local tConfig = WeekActCard_GetConfigByHuman()
+    if not tConfig then
+        print("[WeekActCard_GetPrize] 获取不到配置 DBID = "..DBID.." name = "..szName)
+        return
+    end
+
+    local tItemList = {}
+    for nID, v in pairs(tConfig) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActCard_GetPrizeStatus(human, nID) then
+            if false == WeekActCard_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_FINISH) then
+                print("[WeekActCard_GetPrize] 奖励领取失败 nID = "..nID)
+                WeekActCard_WriteLog(human, "[WeekActCard_GetPrize]", "领取奖励, 设置奖励状态失败 nID = "..nID)
+                break
+            end
+
+            for _, data in ipairs(v.prize) do
+                local nItemID = data[1]
+                local nItemNum = data[2]
+
+                tItemList[nItemID] = tItemList[nItemID] or 0
+                tItemList[nItemID] = tItemList[nItemID] + nItemNum
+            end
+        end
+    end
+
+    if nil ~= _G.next(tItemList) then
+        local tGoodsInfo = {}
+        for k, v in pairs(tItemList) do
+            table.insert(tGoodsInfo, {k,v})
+
+            -- 获取奖励写日志
+            WeekActCard_WriteLog(human, "[WeekActCard_GetPrize]", "玩家获取奖励 nGoodsID = "..k.." nGoodsNum = "..v)
+        end
+
+        BagLogic.addItemList(human, tGoodsInfo, "week_loop_act")
+
+        BagLogic.sendItemGetList(human, tItemList, "week_loop_act")
+    end
+
+    WeekActCard_Query(human)
+    WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
+end

+ 8 - 1
script/module/WeekendLoopActivity/WeekendLoopActDefine.lua

@@ -31,4 +31,11 @@ TWEEKACT_HEROSTAR_RARITY =
 {
     [4] =   1,
     [5] =   1,
-}
+}
+
+WEEKACT_CARD_TYPE_LEN = 3   -- 抽卡轮询长度
+WEEKACT_CARD_PRIZEID_LEN = 10   -- 抽卡ID长度
+
+WEEKACT_CARD_TYPE_HIGH = 1      -- 高级召唤
+WEEKACT_CARD_TYPE_TIANMING = 2  -- 天命召唤
+WEEKACT_CARD_TYPE_FINDSTAR = 3  -- 寻星

+ 16 - 15
script/module/WeekendLoopActivity/WeekendLoopActHeroStar.lua

@@ -179,6 +179,22 @@ function WeekActHeroStar_End(human)
     print("[WeekActHeroStar_End] 英雄升星 活动结束处理完成")
 end
 
+-- 是否有红点
+function isRed(human)
+    local tPrize = WeekActHeroStar_GetConfig()
+    if not tPrize then
+        return false
+    end
+
+    for nID, v in pairs(tPrize) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActHeroStar_GetPrizeStatus(human, nID) then
+            return true
+        end
+    end
+
+    return false
+end
+
 ----------------------------------------- 客户端请求 -------------------------------------
 -- 请求英雄升星活动信息
 function WeekActHeroStar_Query(human)
@@ -345,19 +361,4 @@ function WeekActHeroStar_HeroStarUp(human, nHeroID, nStar)
 
     WeekActHeroStar_Query(human)
     WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
-end
-
-function isRed(human)
-    local tPrize = WeekActHeroStar_GetConfig()
-    if not tPrize then
-        return false
-    end
-
-    for nID, v in pairs(tPrize) do
-        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActHeroStar_GetPrizeStatus(human, nID) then
-            return true
-        end
-    end
-
-    return false
 end

+ 93 - 5
script/module/WeekendLoopActivity/WeekendLoopActManager.lua

@@ -23,6 +23,8 @@ local WeekLoopActDef = require("WeekendLoopActivity.WeekendLoopActDefine")
 local WeekLoopActCof = require("excel.WeekLoopAct")
 local WeekLoopActHeroStar = require("WeekendLoopActivity.WeekendLoopActHeroStar")
 local YunYingLogic = require("yunying.YunYingLogic")
+local WeekLoopActGuYu = require("WeekendLoopActivity.WeekendLoopActUseGuYu")
+local weekLoopActCard = require("WeekendLoopActivity.WeekendLoopActCard")
 
 -- 活动信息
 tWeekActInfo = nil
@@ -130,7 +132,10 @@ local function WeekLoopACT_ResetData(human)
         return
     end
 
+    -- 这里实际上应该 遍历modulefunc
     WeekLoopActHeroStar.WeekActHeroStar_ResetData(human)
+    WeekLoopActGuYu.WeekActGuYu_ResetData(human)
+    weekLoopActCard.WeekActCard_ResetData(human)
 end
 
 -- 各个子活动处理结束数据
@@ -281,7 +286,18 @@ function WeekLoopACT_Init()
 
     for nID, v in pairs(WeekLoopActCof.WeekLoopAct) do
         local moduleFn = load("return require(\"" .. v.moduleFn .. "\")")()
-        tWeekActModuel[nID] = moduleFn
+        if moduleFn then
+            tWeekActModuel[nID] = moduleFn
+            if moduleFn.Init then
+                local bRet = moduleFn.Init()
+                if false == bRet then
+                    print("[WeekLoopACT_Init] 初始化模块数据失败 nID ".. nID)
+                end
+            end
+        else
+            print("[WeekLoopACT_Init] 加载模块失败 nID ".. nID)
+        end
+
     end
 end
 
@@ -341,6 +357,7 @@ function onLogin(human, funcID)
     end
 end
 
+-- 英雄星级改变回调
 function onHeroStarChange(human, funcID, parameter, parameter2)
     if not human or "table" ~= type(parameter) then
         return
@@ -367,10 +384,81 @@ function isActive(human, YYInfo, funcConfig)
 end
 
 function isRed(human, YYInfo, funcConfig)
-    local bRet = WeekLoopActHeroStar.isRed(human)
-    if bRet then
-        return bRet
+    local bRet = false
+    for id, v in pairs(WeekLoopActCof.WeekLoopAct) do
+        if tWeekActModuel[id] and tWeekActModuel[id].isRed then
+            bRet = tWeekActModuel[id].isRed(human)
+            if true == bRet then
+                break
+            end
+        end
+    end
+
+    return bRet
+end
+
+-- 消耗古玉回调
+function onDecZuanshi(human, funcID, parameter, parameter2)
+    if not human or "number" ~= type(parameter) then
+        return
+    end
+
+    if false == WeekLoopACT_IsRun() then
+        return
     end
 
-    return false
+    local nGuYu = math.abs(parameter)
+    if 0 >= nGuYu then
+        return
+    end
+
+    WeekLoopActGuYu.WeekActGuYu_UseGuYu(human, nGuYu)
+end
+
+-- 高级召唤回调
+function onDrawCard(human, funcID, parameter, parameter2)
+    if not human or "number" ~= type(parameter) then
+        return
+    end
+
+    if false == WeekLoopACT_IsRun() then
+        return
+    end
+
+    weekLoopActCard.WeekActCard_UseCard(human, parameter, WeekLoopActDef.WEEKACT_CARD_TYPE_HIGH)
+end
+
+-- 天命召唤回调
+function onTMDrawCard(human, funcID, parameter, parameter2)
+    if not human or "number" ~= type(parameter) then
+        return
+    end
+
+    if false == WeekLoopACT_IsRun() then
+        return
+    end
+
+    weekLoopActCard.WeekActCard_UseCard(human, parameter, WeekLoopActDef.WEEKACT_CARD_TYPE_TIANMING)
+end
+
+-- 寻星回调
+function onFindStar(human, funcID, parameter, parameter2)
+    if not human or "number" ~= type(parameter) then
+        return
+    end
+
+    if false == WeekLoopACT_IsRun() then
+        return
+    end
+
+    weekLoopActCard.WeekActCard_UseCard(human, parameter, WeekLoopActDef.WEEKACT_CARD_TYPE_FINDSTAR)
+end
+
+-- GM 命令
+function GMResetWeekAct(human)
+    if WeekLoopACT_IsRun() then
+        WeekLoopACT_EndAllAct(human)
+
+        WeekLoopACT_BeginAllAct(human)
+    end
 end

+ 332 - 0
script/module/WeekendLoopActivity/WeekendLoopActUseGuYu.lua

@@ -0,0 +1,332 @@
+--------------------------------
+-- 文件名       :  WeekendLoopActUseGuYu.lua
+-- 文件说明     :  周末冲刺活动-消费古玉
+-- 创建时间     :   2024/12/02
+-- 创建人       :   FC
+--------------------------------
+
+local Util = require("common.Util")
+local Lang = require("common.Lang")
+local Broadcast = require("broadcast.Broadcast")
+local MailExcel = require("excel.mail")
+local Msg = require("core.Msg")
+local ObjHuman = require("core.ObjHuman")
+local WeekLoopActDef = require("WeekendLoopActivity.WeekendLoopActDefine")
+local WeekLoopActCof = require("excel.WeekLoopAct")
+local CommonDB = require("common.CommonDB")
+local MailManager = require("mail.MailManager")
+local Grid = require("bag.Grid")
+local HeroGrid = require("hero.HeroGrid")
+local HeroLogic = require("hero.HeroLogic")
+local BagLogic = require("bag.BagLogic")
+local Log = require("common.Log")
+local HeroExcel = require("excel.hero")
+local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
+
+----------------------------------------- 内部处理开始 -------------------------------------
+-- 写日志
+local function WeekActGuYu_WriteLog(human, szFuncName, sztext)
+    Log.write(Log.LOGID_OSS_WEEKLOOP_ACT, szFuncName..sztext.." _id = "..human.db._id.." name = "..human.db.name)
+end
+
+-- 下发数据
+local function WeekActGuYu_SendData(tMsgData, fd)
+    Msg.send(tMsgData, fd)
+end
+
+-- 获取配置
+local function WeekActGuYu_GetConfig()
+    if not WeekLoopActCof then
+        return nil
+    end
+
+    return WeekLoopActCof.GuYu
+end
+
+-- 初始化古玉数量
+local function WeekActHeroStar_ResetGuYuNum(human)
+    if not human then
+        print("[WeekActHeroStar_SetHeroID] 参数不正确")
+        return false
+    end
+
+    human.db.nWeekUseGuYu = 0
+
+    return true
+end
+
+-- 获取古玉数量
+local function WeekActHeroStar_GetGuYuNum(human)
+    if not human then
+        print("[WeekActHeroStar_SetHeroID] 参数不正确")
+        return -1
+    end
+
+    if not human.db.nWeekUseGuYu then
+        local bRet = WeekActHeroStar_ResetGuYuNum(human)
+        if false == bRet then
+            WeekActGuYu_WriteLog(human, "[WeekActHeroStar_GetGuYuNum]", "获取古玉数量,不存在对应字段,重新初始化失败")
+            return -1
+        end
+
+        WeekActGuYu_WriteLog(human, "[WeekActHeroStar_GetGuYuNum]", "获取古玉数量,不存在对应字段,初始化顺序有问题, 重新初始化成功")
+    end
+
+    return human.db.nWeekUseGuYu
+end
+
+-- 设置古玉数量
+local function WeekActHeroStar_SetGuYuNum(human, nValue)
+    if not human then
+        print("[WeekActHeroStar_SetHeroID] 参数不正确")
+        return
+    end
+
+    local nNowGuYu = WeekActHeroStar_GetGuYuNum(human)
+    if -1 >= nNowGuYu then
+        WeekActGuYu_WriteLog(human, "[WeekActHeroStar_SetGuYuNum]", "获取古玉数量失败")
+        return
+    end
+
+    local nNewGuYu = nNowGuYu + nValue
+    if 0 > nNewGuYu then
+        nNewGuYu = 0
+    end
+
+    human.db.nWeekUseGuYu = nNewGuYu
+end
+
+-- 初始化奖励信息
+local function WeekActGuYu_ResetPrize(human)
+    if not human then
+        return false
+    end
+
+    local tConfig = WeekActGuYu_GetConfig()
+    if not tConfig then
+        return false
+    end
+
+    if not human.db.tWeekGuYuPrize then
+        human.db.tWeekGuYuPrize = {}
+    end
+
+    for nID, v in pairs(tConfig) do
+        human.db.tWeekGuYuPrize[nID] = WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+    
+    return true
+end
+
+-- 获取奖励表
+local function WeekActGuYu_GetDBPrize(human)
+    if not human then
+        return nil
+    end
+
+    if not human.db.tWeekGuYuPrize then
+        return nil
+    end
+    
+    return human.db.tWeekGuYuPrize
+end
+
+-- 获取奖励ID状态
+local function WeekActGuYu_GetPrizeStatus(human, nID)
+    if not human then
+        return WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+
+    local tPrize = WeekActGuYu_GetDBPrize(human)
+    if not tPrize or not tPrize[nID] then
+        print("[WeekActGuYu_GetPrizeStatus] 不存在对应的ID nID = "..nID)
+        return WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+    
+    return tPrize[nID]
+end
+
+-- 设置奖励ID状态
+local function WeekActGuYu_SetPrizeStatus(human, nID, nStatus)
+    if not human then
+        return false
+    end
+
+    local tPrize = WeekActGuYu_GetDBPrize(human)
+    if not tPrize or not tPrize[nID] then
+        return false
+    end
+
+    tPrize[nID] = nStatus
+
+    return true
+end
+
+
+----------------------------------------- 外部调用 -------------------------------------
+-- 重置数据
+function WeekActGuYu_ResetData(human)
+    if not human then
+        return
+    end
+
+    -- 重置奖励信息
+    if false == WeekActGuYu_ResetPrize(human) then
+        print("[WeekActGuYu_ResetData] 重置古玉奖励数据失败")
+        return
+    end
+
+    -- 重置消耗古玉数量
+    WeekActHeroStar_ResetGuYuNum(human)
+
+    WeekActGuYu_WriteLog(human, "[WeekActGuYu_ResetData]", "古玉奖励相关重置完成")
+
+    print("[WeekActGuYu_ResetData] 古玉 数据重置结束 ")
+end
+
+-- 是否有红点
+function isRed(human)
+    local tPrize = WeekActGuYu_GetConfig()
+    if not tPrize then
+        return false
+    end
+
+    for nID, v in pairs(tPrize) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActGuYu_GetPrizeStatus(human, nID) then
+            return true
+        end
+    end
+
+    return false
+end
+
+-- 消耗古玉回调
+function WeekActGuYu_UseGuYu(human, nGuYu)
+    if not human or 0 >= nGuYu then
+        return
+    end
+
+    local DBID = human.db._id
+    local szName = human.db.name
+    local tConfig = WeekActGuYu_GetConfig()
+    if not tConfig then
+        print("[WeekActGuYu_UseGuYu] 获取不到配置 DBID = "..DBID.." name = "..szName)
+        return
+    end
+
+    WeekActHeroStar_SetGuYuNum(human, nGuYu)
+  
+    local nNowGuYu = WeekActHeroStar_GetGuYuNum(human)
+    print("[onDecZuanshi] 消耗古玉回调开始 nNowGuYu = "..nNowGuYu)
+
+    local bChange = false
+    for nID, v in pairs(tConfig) do
+        local nStatus = WeekActGuYu_GetPrizeStatus(human, nID)
+        print("[onDecZuanshi] 消耗古玉回调开始 nNowGuYu = "..nNowGuYu.." nStatus = "..nStatus)
+        
+        if nNowGuYu >= v.guyu and WeekLoopActDef.WEEKACT_STATE_NONE == nStatus then
+            bChange = true
+            WeekActGuYu_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_CANGET)
+        end
+    end
+
+    print("[onDecZuanshi] 古玉回调处理完成 nNowGuYu = "..nNowGuYu)
+
+    if true == bChange then
+        print("[onDecZuanshi] 古玉回调处理完成 开始请求 nNowGuYu = "..nNowGuYu)
+        WeekActGuYu_Query(human)
+        WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
+    end
+end
+
+----------------------------------------- 客户端请求 -------------------------------------
+-- 客户端请求-古玉信息
+function WeekActGuYu_Query(human)
+    if not human then
+        return
+    end
+
+    local DBID = human.db._id
+    local szName = human.db.name
+
+    local tConfig = WeekActGuYu_GetConfig()
+    if not tConfig then
+        print("[WeekActGuYu_Query] 获取不到配置 DBID = "..DBID.." name = "..szName)
+        return
+    end
+
+    local tMsgData = Msg.gc.GC_WEEKLOOP_ACT_GUYUQUERY
+    tMsgData.nGuYu = WeekActHeroStar_GetGuYuNum(human)
+    tMsgData.list[0] = 0
+
+    for nID, v in pairs(tConfig) do
+        tMsgData.list[0] = tMsgData.list[0] + 1
+        local tData = tMsgData.list[tMsgData.list[0]]
+        tData.nID = nID
+        tData.nGuYu = v.guyu
+        tData.nState = WeekActGuYu_GetPrizeStatus(human, nID)
+
+        tData.item[0] = #v.prize
+
+        for nIndex, tItem in ipairs(v.prize) do
+            local nGoodsID = tItem[1]
+            local nGoodsNum = tItem[2]
+
+            Grid.makeItem(tData.item[nIndex], nGoodsID, nGoodsNum)
+        end
+    end
+
+    WeekActGuYu_SendData(tMsgData, human.fd)
+end
+
+-- 客户端请求领取奖励
+function WeekActGuYu_GetPrize(human)
+    if not human then
+        return
+    end
+
+    local DBID = human.db._id
+    local szName = human.db.name
+
+    local tConfig = WeekActGuYu_GetConfig()
+    if not tConfig then
+        print("[WeekActGuYu_GetPrize] 获取不到配置 DBID = "..DBID.." name = "..szName)
+        return
+    end
+
+    local tItemList = {}
+    for nID, v in pairs(tConfig) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActGuYu_GetPrizeStatus(human, nID) then
+            if false == WeekActGuYu_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_FINISH) then
+                print("[WeekActGuYu_GetPrize] 奖励领取失败 nID = "..nID)
+                WeekActGuYu_WriteLog(human, "[WeekActHeroStar_GetPrize]", "领取奖励, 设置奖励状态失败 nID = "..nID)
+                break
+            end
+
+            for _, data in ipairs(v.prize) do
+                local nItemID = data[1]
+                local nItemNum = data[2]
+
+                tItemList[nItemID] = tItemList[nItemID] or 0
+                tItemList[nItemID] = tItemList[nItemID] + nItemNum
+            end
+        end
+    end
+
+    if nil ~= _G.next(tItemList) then
+        local tGoodsInfo = {}
+        for k, v in pairs(tItemList) do
+            table.insert(tGoodsInfo, {k,v})
+
+            -- 获取奖励写日志
+            WeekActGuYu_WriteLog(human, "[WeekActHeroStar_GetPrize]", "玩家获取奖励 nGoodsID = "..k.." nGoodsNum = "..v)
+        end
+
+        BagLogic.addItemList(human, tGoodsInfo, "week_loop_act")
+
+        BagLogic.sendItemGetList(human, tItemList, "week_loop_act")
+    end
+
+    WeekActGuYu_Query(human)
+    WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
+end

+ 5 - 0
script/module/chat/Gm.lua

@@ -19,6 +19,7 @@ local CombatDefine = require("combat.CombatDefine")
 local ItemDefine = require("bag.ItemDefine")
 local MiddleConnect = require("middle.MiddleConnect")
 local BuyLogic = require("topup.BuyLogic")
+local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
 
 d3 = {}
 
@@ -1838,3 +1839,7 @@ function d3.merge(human,value)
 		InnerMsg.sendMsg(0, msgRet)]]
 	end	
 end
+
+function d3.resetweek(human)
+	WeekendLoopActManger.GMResetWeekAct(human)
+end

+ 5 - 0
script/module/role/RoleDBLogic.lua

@@ -412,6 +412,11 @@ function createDefaultRole(account)
 		nWeekLoopEndMail = nil,					-- 周循环活动结束处理奖励标识
 		nWeekHeroID = nil,						-- 周活动-升星英雄ID
 		tWeekHeroPrize = nil,					-- 周活动-升星奖励信息
+		nWeekUseGuYu = nil,						-- 周活动消耗古玉数量
+		tWeekGuYuPrize = nil,					-- 周活动-古玉奖励信息
+		nWeekCardType = nil,					-- 周活动-抽卡当前类型
+		nWeekCardNum = nil,						-- 周活动-抽卡数量
+		tWeekCardPrize = nil,					-- 周活动-抽卡奖励信息
 
         mergeInfo = {},   --融合信息 {mergeStartTime: 0 , mergeTime: 0, mergeEndTime: 0, heroId: 0}
 		gift = {

+ 3 - 0
script/module/zhuanpan/ZhuanpanLogic.lua

@@ -14,6 +14,7 @@ local HeroExcel = require("excel.hero").hero
 local ChatPaoMaLogic = require("chat.ChatPaoMaLogic")
 local VipLogic = require("vip.VipLogic")
 local EquipLogic = require("equip.EquipLogic")
+local YunYingLogic = require("yunying.YunYingLogic")
 
 DEFAULT_ZHUANPAN_TYPE_NORMAL 		= 1     -- 基础转盘
 DEFAULT_ZHUANPAN_TYPE_GAOJI  		= 2     -- 高级转盘
@@ -404,6 +405,8 @@ function getReward(human, mainType, cnt)
 
 
     query(human, mainType)
+
+    YunYingLogic.onCallBack(human, "onFindStar", cnt)
 end
 
 -- 购买许愿珠