Procházet zdrojové kódy

周活动-英雄升星

SCFC před 1 rokem
rodič
revize
f537e2d6fb

+ 1 - 0
script/common/Log.lua

@@ -64,6 +64,7 @@ function init()
     --[[遗迹探险插入DB]] LOGID_OSS_YJTX_DB = lua_log.reg("log/oss_yjtx_db", "",0)
     --[[竟技场-王者争霸]] LOGID_JJC_GODWAR = lua_log.reg("log/jjc_godwar","",0)
     --[[开服活动]] LOGID_OSS_OPENSERVER_ACT = lua_log.reg("log/oss_openserver_act","",300)
+    --[[周循环活动]] LOGID_OSS_WEEKLOOP_ACT = lua_log.reg("log/week_loop_act","",300)
 end
 init()
 

+ 1 - 0
script/common/LogDefine.lua

@@ -244,6 +244,7 @@ DEFINE = {
     abs_sign_reward = 248,                   -- 浪漫邂逅签到礼包
     abs_sign_gift = 249,                     -- 浪漫邂逅购买礼包
 	open_server_PowerUpPrize = 250,			 -- 开服活动-战力冲刺
+	week_loop_act			= 251,			 -- 周活动
 	abs_totalReach          = 500,           -- 周期性活动累计
     abs_singleReach         = 501,           -- 周期性活动单次
     draw_ad_reward         = 601,           -- 观看广告送召唤券

+ 7 - 0
script/common/ProtoID.lua

@@ -1271,6 +1271,13 @@ _ENV[1270]="CG_PRESENT_OPEN_POWERUP_QUERY"
 _ENV[1271]="GC_PRESENT_OPEN_POWERUP_QUERY"
 _ENV[1272]="CG_PRESENT_OPEN_POWERUP_GETPRIZE"
 _ENV[1273]="GC_PRESENT_OPEN_POWERUP_GETPRIZE"
+_ENV[1274]="GC_WEEKLOOP_ACT_ALLINFO"
+_ENV[1275]="CG_WEEKLOOP_ACT_HEROQUERY"
+_ENV[1276]="GC_WEEKLOOP_ACT_HEROQUERY"
+_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[1301]="CG_XIANZHI_SHOP_QUERY"
 _ENV[1302]="GC_XIANZHI_SHOP_QUERY"
 _ENV[1303]="CG_XIANZHI_SHOP_BUY"

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

@@ -0,0 +1,22 @@
+local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
+local WeekLoopActHeroStar = require("WeekendLoopActivity.WeekendLoopActHeroStar")
+
+-- 请求英雄升星活动信息
+function CG_WEEKLOOP_ACT_HEROQUERY(human, msg)
+    WeekLoopActHeroStar.WeekActHeroStar_Query(human)
+end
+
+-- 英雄升星- 请求所有英雄简略信息
+function CG_WEEKLOOP_ACT_HEROGETSIMPLIFYINFO(human, msg)
+    WeekLoopActHeroStar.WeekActHeroStar_GetAllHeroInfo(human)
+end
+
+-- 英雄升星 - 选择英雄
+function CG_WEEKLOOP_ACT_HEROCHOSEHERO(human, msg)
+    WeekLoopActHeroStar.WeekActHeroStar_ChoseHero(human, msg.nID)
+end
+
+-- 英雄升星 - 领取奖励
+function CG_WEEKLOOP_ACT_HERPGETPRIZE(huamn, msg)
+    WeekLoopActHeroStar.WeekActHeroStar_GetPrize(huamn)
+end

+ 69 - 0
script/module/WeekendLoopActivity/Proto.lua

@@ -0,0 +1,69 @@
+local ItemData = require("bag.Proto").ItemData
+local HeroSimple = require("hero.Proto").HeroSimple
+
+tActInfo = 
+{
+    {"ID",          1,      "short"},           -- 子活动ID
+    {"name",        1,      "string"},          -- 子活动名
+    {"nSortID",	    1,		"short"},		    -- 排序id
+    {"nPanelID",	1,		"short"},		    -- 面板id
+	{"nIcon",		1,		"int"},			    -- 活动图标
+    {"nRed",        1,      "byte"},            -- 是否有红点 1 存在 0 不存在
+}
+
+-- 玩家登录主动下发活动信息(活动开启时)
+GC_WEEKLOOP_ACT_ALLINFO = {
+    {"nStartTime",       1,     "int"},     -- 开启时间
+    {"nEendTime",        1,     "int"},     -- 结束时间
+    {"tActID",          10,     tActInfo},   -- 活动信息
+}
+
+---------------------- 英雄升星 ----------------------
+HeroPrize = {
+    {"nID",             1,      "int"},        -- 奖励编号
+    {"nState",          1,      "byte"},        -- 0 不可领取 1 - 可领取 2- 已领取
+    {"item",            5,      ItemData},      -- 奖励信息
+}
+
+SimplifyHero = {
+    {"id",			1,		"int"},	 	        --id
+	{"icon",        1,      "int"},   	        --头像
+	{"camp",        1,      "byte"},	        --阵营
+	{"star",        1,      "byte"},            --星级
+	{"grade",       1,      "byte"},	        --品阶:初始为0
+    {"name",		1,		"string"},	        -- 英雄名
+}
+
+-- 请求英雄升星活动信息
+CG_WEEKLOOP_ACT_HEROQUERY = {}
+
+
+-- 英雄升星 - 活动信息回复协议
+GC_WEEKLOOP_ACT_HEROQUERY = 
+{
+    {"list",        17,   HeroPrize},        -- 奖励信息
+    {"HeroData",    2,   HeroSimple},       -- 英雄信息
+}
+
+-- 英雄升星- 请求所有英雄简略信息
+CG_WEEKLOOP_ACT_HEROGETSIMPLIFYINFO = {
+}
+
+-- 英雄升星- 请求所有英雄简略信息-回复
+GC_WEEKLOOP_ACT_HEROGETSIMPLIFYINFO = 
+{
+    {"tHeroData",   40,     HeroSimple},  -- 简略英雄信息
+}
+
+-- 英雄升星 - 选择英雄
+CG_WEEKLOOP_ACT_HEROCHOSEHERO = 
+{
+    {"nID",     1,      "int"},             -- 英雄ID
+}
+
+-- 回复 GC_WEEKLOOP_ACT_HEROQUERY
+
+-- 英雄升星 - 领取奖励
+CG_WEEKLOOP_ACT_HERPGETPRIZE = {}
+
+-- 回复 GC_WEEKLOOP_ACT_HEROQUERY

+ 34 - 0
script/module/WeekendLoopActivity/WeekendLoopActDefine.lua

@@ -0,0 +1,34 @@
+--------------------------------
+-- 文件名       :  WeekendLoopActDefine.lua
+-- 文件说明     :  周末冲刺-活动通用定义
+-- 创建时间     :   2024/11/25
+-- 创建人       :   FC
+--------------------------------
+
+WEEKACT_OPENDAY = 7         -- 开启日期 周六
+WEEKACT_ENDDAY =  4         -- 结束日期 周三
+WEEKACT_TIME = 0            -- 开启结束时间
+
+WEEKACT_STATE_NONE    =   0       -- 不可领取
+WEEKACT_STATE_CANGET  =   1       -- 可领取
+WEEKACT_STATE_FINISH  =   2       -- 已领取
+
+WEEKACT_HEROSTAR_MAILID = 7009
+WEEKACT_HEROSTAR_HREOLEN = 30
+
+-- 忽略下发的英雄ID
+TWEEKACT_HEROSTAR_IGNORE = 
+{
+    [8] = 1,
+    [9] = 1,
+    [88] = 1,
+    [888] = 1,
+    [8888] = 1,
+}
+
+-- 下发的英雄稀有度要求
+TWEEKACT_HEROSTAR_RARITY = 
+{
+    [4] =   1,
+    [5] =   1,
+}

+ 363 - 0
script/module/WeekendLoopActivity/WeekendLoopActHeroStar.lua

@@ -0,0 +1,363 @@
+--------------------------------
+-- 文件名       :  WeekendLoopActHeroStar.lua
+-- 文件说明     :  周末冲刺活动-英雄升星
+-- 创建时间     :   2024/11/26
+-- 创建人       :   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 WeekActHeroStar_SendData(tMsgData, fd)
+    Msg.send(tMsgData, fd)
+end
+
+-- 获取配置
+local function WeekActHeroStar_GetConfig()
+    if not WeekLoopActCof then
+        return nil
+    end
+
+    return WeekLoopActCof.HeroStarUp
+end
+
+-- 获取选择的英雄ID
+local function WeekActHeroStar_GetHeroID(human)
+    if not human then
+        return -1
+    end
+
+    if not human.db.nWeekHeroID then
+        return -1
+    end
+    
+    return human.db.nWeekHeroID
+end
+
+-- 设置英雄ID
+local function WeekActHeroStar_SetHeroID(human, nHeroID)
+    if not human or not nHeroID then
+        print("[WeekActHeroStar_SetHeroID] 设置英雄ID失败 nHeroID = "..nHeroID)
+        return
+    end
+
+    human.db.nWeekHeroID = nHeroID
+end
+
+-- 初始化奖励信息
+local function WeekActHeroStar_ResetPrize(human)
+    if not human then
+        return false
+    end
+
+    local tConfig = WeekActHeroStar_GetConfig()
+    if not tConfig then
+        return false
+    end
+
+    if not human.db.tWeekHeroPrize then
+        human.db.tWeekHeroPrize = {}
+    end
+
+    for nID, v in pairs(tConfig) do
+        human.db.tWeekHeroPrize[nID] = WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+    
+    return true
+end
+
+-- 获取奖励表
+local function WeekActHeroStar_GetDBPrize(human)
+    if not human then
+        return nil
+    end
+
+    if not human.db.tWeekHeroPrize then
+        return nil
+    end
+    
+    return human.db.tWeekHeroPrize
+end
+
+-- 获取奖励ID状态
+local function WeekActHeroStar_GetPrizeStatus(human, nID)
+    if not human then
+        return WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+
+    local tPrize = WeekActHeroStar_GetDBPrize(human)
+    if not tPrize or not tPrize[nID] then
+        return WeekLoopActDef.WEEKACT_STATE_NONE
+    end
+    
+    return human.db.tWeekHeroPrize[nID]
+end
+
+-- 设置奖励ID状态
+local function WeekActHeroStar_SetPrizeStatus(human, nID, nStatus)
+    if not human then
+        return false
+    end
+
+    local tPrize = WeekActHeroStar_GetDBPrize(human)
+    if not tPrize or not tPrize[nID] then
+        return false
+    end
+
+    tPrize[nID] = nStatus
+
+    return true
+end
+
+----------------------------------------- 外部调用 -------------------------------------
+-- 重置数据
+function WeekActHeroStar_ResetData(human)
+    if not human then
+        return
+    end
+
+    if false == WeekActHeroStar_ResetPrize(human) then
+        print("[WeekActHeroStar_ResetData] 重置英雄升星数据失败")
+        return
+    end
+
+    WeekActHeroStar_SetHeroID(human, 0)
+
+    print("[WeekActHeroStar_ResetData] 英雄升星 数据重置结束 ")
+end
+
+-- 活动结束
+function WeekActHeroStar_End(human)
+    if not human then
+        return
+    end
+
+    print("[WeekActHeroStar_End] 英雄升星 活动结束处理开始")
+
+    local tPrize = WeekActHeroStar_GetDBPrize(human)
+    local tPrizeConfig = WeekActHeroStar_GetConfig()
+    if not tPrize or not tPrizeConfig then
+        return
+    end
+
+    local tMailConfig = MailExcel.mail[WeekLoopActDef.WEEKACT_HEROSTAR_MAILID]
+    if not tMailConfig then
+        return
+    end
+
+    local items = { }
+    for nID, v in pairs(tPrizeConfig) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == tPrize[nID] then
+            for _, data in pairs(v.prize) do
+                items[#items + 1] = { data[1], data[2] }
+            end
+            WeekActHeroStar_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_FINISH)
+        end
+    end
+
+    local title = tMailConfig.title
+    local content = tMailConfig.content
+    local senderName = tMailConfig.senderName
+    MailManager.add(MailManager.SYSTEM, human.db._id, title, content, items, senderName)
+
+    print("[WeekActHeroStar_End] 英雄升星 活动结束处理完成")
+end
+
+----------------------------------------- 客户端请求 -------------------------------------
+-- 请求英雄升星活动信息
+function WeekActHeroStar_Query(human)
+    if not human then
+        return
+    end
+
+    local tPrizeConfig = WeekActHeroStar_GetConfig()
+    local tPrize = WeekActHeroStar_GetDBPrize(human)
+
+    if not tPrizeConfig or not tPrize then
+        return
+    end
+    
+    local tMsgData = Msg.gc.GC_WEEKLOOP_ACT_HEROQUERY
+
+    -- 奖励信息
+    tMsgData.list[0] = 0
+    for nID, v in pairs(tPrizeConfig) do
+        tMsgData.list[0] = tMsgData.list[0] + 1
+
+        local tPrizeData = tMsgData.list[tMsgData.list[0]]
+        tPrizeData.nID = nID
+        tPrizeData.nState = WeekActHeroStar_GetPrizeStatus(human, nID)
+
+        local nPrizeLne = #v.prize
+        tPrizeData.item[0] = nPrizeLne
+        --print("[WeekActHeroStar_Query] nItemLen = "..tPrizeData.item[0].." nID = "..nID)
+
+        for j = 1, nPrizeLne do
+            local nGoodsID = v.prize[j][1]
+            local nGoodsNum = v.prize[j][2]
+
+            --print("[WeekActHeroStar_Query] nGoodsID = "..nGoodsID.. " nGoodsNum = "..nGoodsNum)
+            Grid.makeItem(tPrizeData.item[j], nGoodsID, nGoodsNum)
+        end
+    end
+    --print("[WeekActHeroStar_Query] ListLen = ".. tMsgData.list[0])
+
+    local nChoseHeroID = WeekActHeroStar_GetHeroID(human)
+    if 0 < nChoseHeroID then
+        tMsgData.HeroData[0] = 1
+        HeroGrid.makeHeroSimpleByID(tMsgData.HeroData[1], nChoseHeroID)
+    else
+        tMsgData.HeroData[0] = 0
+    end
+
+    WeekActHeroStar_SendData(tMsgData, human.fd)
+    print("[WeekActHeroStar_Query] 消息发送完成 ")
+end
+
+-- 英雄升星- 请求所有英雄简略信息
+function WeekActHeroStar_GetAllHeroInfo(human)
+    if not human then
+        return
+    end
+
+    local tMsgData = Msg.gc.GC_WEEKLOOP_ACT_HEROGETSIMPLIFYINFO
+
+	local tHeroData = HeroExcel.hero
+	tMsgData.tHeroData[0] = 0
+
+	print("[getACTHeroInfo] 获取数据开始 ")
+
+    for nID, v in pairs(tHeroData) do
+        if not WeekLoopActDef.TWEEKACT_HEROSTAR_IGNORE[nID] then
+            -- ssr 和 ur
+            if WeekLoopActDef.TWEEKACT_HEROSTAR_RARITY[v.grade] then
+                tMsgData.tHeroData[0] = tMsgData.tHeroData[0] + 1
+
+                HeroGrid.makeHeroSimpleByID(tMsgData.tHeroData[tMsgData.tHeroData[0]], nID)
+            end
+        end
+    end
+   
+    WeekActHeroStar_SendData(tMsgData, human.fd)
+end
+
+-- 英雄升星 - 选择英雄
+function WeekActHeroStar_ChoseHero(human, nID)
+    if not human or 0 >= nID then
+        return
+    end
+
+    WeekActHeroStar_SetHeroID(human, nID)
+
+    WeekActHeroStar_Query(human)
+end
+
+
+-- 请求领取奖励
+function WeekActHeroStar_GetPrize(human)
+    if not human then
+        return
+    end
+
+    local tPrize = WeekActHeroStar_GetConfig()
+    if not tPrize then
+        return
+    end
+
+    local tItemList = {}
+    for nID, v in pairs(tPrize) do
+        if WeekLoopActDef.WEEKACT_STATE_CANGET == WeekActHeroStar_GetPrizeStatus(human, nID) then
+            if false == WeekActHeroStar_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_FINISH) then
+                print("[WeekActHeroStar_GetPrize] 奖励领取失败 nID = "..nID)
+                Log.write(Log.LOGID_OSS_WEEKLOOP_ACT, "[WeekActHeroStar_GetPrize] 设置奖励状态失败 nID = "..nID.." _id = "..human.db._id.." "..human.db.name)
+                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})
+
+            -- 获取奖励写日志
+            Log.write(Log.LOGID_OSS_WEEKLOOP_ACT, "[WeekActHeroStar_GetPrize] 玩家获取到奖励 name = "
+                    ..human.db.name.." _id = "..human.db._id.." nGoodsID = "..k.." nGoodsNum = "..v)
+        end
+
+        BagLogic.addItemList(human, tGoodsInfo, "week_loop_act")
+
+        BagLogic.sendItemGetList(human, tItemList, "week_loop_act")
+    end
+
+    WeekActHeroStar_Query(human)
+    WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
+end
+
+-- 英雄升星
+function WeekActHeroStar_HeroStarUp(human, nHeroID, nStar)
+    if not human or 0 >= nHeroID or 0 >= nStar then
+        return
+    end
+
+    local nChoseHeroID = WeekActHeroStar_GetHeroID(human)
+    local tConfig = WeekActHeroStar_GetConfig()
+    if -1 >= nChoseHeroID or not tConfig then
+        return
+    end
+
+    if nHeroID ~= nChoseHeroID then
+        return
+    end
+
+    for nID, v in pairs(tConfig) do
+        if nID == nStar then
+            local nStatus = WeekActHeroStar_GetPrizeStatus(human, nID)
+            if WeekLoopActDef.WEEKACT_STATE_NONE == nStatus then
+                WeekActHeroStar_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_CANGET)
+            end
+        end
+    end
+
+    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

+ 376 - 0
script/module/WeekendLoopActivity/WeekendLoopActManager.lua

@@ -0,0 +1,376 @@
+--------------------------------
+-- 文件名       :  WeekendLoopActManger.lua
+-- 文件说明     :  周末冲刺-活动模板管理
+-- 创建时间     :   2024/11/25
+-- 创建人       :   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 MailManager = require("mail.MailManager")
+local BagLogic = require("bag.BagLogic")
+local Grid = require("bag.Grid")
+local PanelDefine = require("broadcast.PanelDefine")
+local CommonDB = require("common.CommonDB")
+local BuyLogic = require("topup.BuyLogic")
+local GuideLogic = require("guide.GuideLogic")
+local Log = require("common.Log")
+local WeekLoopActDef = require("WeekendLoopActivity.WeekendLoopActDefine")
+local WeekLoopActCof = require("excel.WeekLoopAct")
+local WeekLoopActHeroStar = require("WeekendLoopActivity.WeekendLoopActHeroStar")
+local YunYingLogic = require("yunying.YunYingLogic")
+
+-- 活动信息
+tWeekActInfo = nil
+-- {
+--     nStartTime = nil,       -- 开始时间
+--     nEendTime = nil,        -- 结束时间
+--     isRun = nil,            -- 是否在活动中
+-- }
+
+-- 加载的模块
+tWeekActModuel = {}
+
+----------------------------------------- 内部处理开始 -------------------------------------
+-- 下发数据
+local function WeekLoopACT_SendData(tMsgData, fd)
+    Msg.send(tMsgData, fd)
+end
+
+-- 下发活动数据
+function WeekLoopACT_SendActInfo(human)
+    if not human or not tWeekActInfo then
+        return
+    end
+
+    print("[WeekLoopACT_SendActInfo] 下发活动数据 开始 ")
+
+    local tMsgData = Msg.gc.GC_WEEKLOOP_ACT_ALLINFO
+    tMsgData.nStartTime = tWeekActInfo.nStartTime
+    tMsgData.nEendTime = tWeekActInfo.nEendTime
+
+    tMsgData.tActID[0] = #WeekLoopActCof.WeekLoopAct
+
+    local nIndex = 1
+    for id, v in pairs(WeekLoopActCof.WeekLoopAct) do
+        local tActData = tMsgData.tActID[nIndex]
+        nIndex = nIndex + 1
+        tActData.ID = id
+        tActData.name = v.name
+        tActData.nSortID = v.sortID
+        tActData.nIcon = v.icon
+        tActData.nPanelID = v.panelID
+        local bRed = false
+        if tWeekActModuel[id] and tWeekActModuel[id].isRed then
+            bRed = tWeekActModuel[id].isRed(human)
+        end
+
+        tActData.nRed = bRed and 1 or 0
+    end
+
+    YunYingLogic.sendBanner(human)
+    WeekLoopACT_SendData(tMsgData, human.fd)
+
+    print("[WeekLoopACT_SendActInfo] 下发活动数据 结束 ")
+end
+
+-- 获取记录在人物身上的结束时间
+local function WeekLoopACT_GetHumanEndTime(human)
+    if not human then
+        return -1
+    end
+
+    if not human.db.nWeekLoopEndTime then
+        return -1
+    end
+
+    return human.db.nWeekLoopEndTime
+end
+
+-- 设置记录在人物身上的结束时间
+local function WeekLoopACT_SetHumanEndTime(human, nTime)
+    if not human or 0 >= nTime then
+        return
+    end
+
+    human.db.nWeekLoopEndTime = nTime
+end
+
+-- 获取记录在人物身上的奖励处理标识
+local function WeekLoopACT_GetHumanEndMail(human)
+    if not human then
+        return true
+    end
+
+    -- 没有 则认为未参加上一次活动
+    if not human.db.nWeekLoopEndMail then
+        print("[WeekLoopACT_GetHumanEndMail] 没有参加活动")
+        return true
+    end
+
+    return human.db.nWeekLoopEndMail
+end
+
+-- 设置记录在人物身上的奖励处理标识
+local function WeekLoopACT_SetHumanEndMail(human, nValue)
+    if not human or not nValue then
+        return
+    end
+
+    human.db.nWeekLoopEndMail = nValue
+end
+
+-- 各个子活动重置活动数据
+local function WeekLoopACT_ResetData(human)
+    if not human then
+        return
+    end
+
+    WeekLoopActHeroStar.WeekActHeroStar_ResetData(human)
+end
+
+-- 各个子活动处理结束数据
+local function WeekLoopACT_HandleEndData(human)
+    if not human then
+        return
+    end
+
+    WeekLoopActHeroStar.WeekActHeroStar_End(human)
+end
+
+-- 所有活动初始化数据开始
+local function WeekLoopACT_BeginAllAct(human)
+    if not human or not tWeekActInfo then
+        return
+    end
+
+    local nEndTime = tWeekActInfo.nEendTime
+    
+    print("[WeekLoopACT_BeginAllAct] 所有活动初始化数据开始 ")
+
+    -- 设置时间
+    WeekLoopACT_SetHumanEndTime(human, nEndTime)
+    -- 设置标记
+    WeekLoopACT_SetHumanEndMail(human, false)
+
+    -- 各个子活动重置数据
+    WeekLoopACT_ResetData(human)
+
+    -- 最后下发活动数据
+    WeekLoopACT_SendActInfo(human)
+
+    print("[WeekLoopACT_BeginAllAct] 所有活动初始化数据结束 ")
+end
+
+-- 结束所有活动
+local function WeekLoopACT_EndAllAct(human)
+    -- 各个子活动处理数据
+    WeekLoopACT_HandleEndData(human)
+
+    WeekLoopACT_SetHumanEndMail(human, true)
+end
+
+-- 活动开始
+local function WeekLoopACT_Begin()
+    if not tWeekActInfo then
+        return
+    end
+
+    -- 遍历在线玩家
+    for uuid, human in pairs(ObjHuman.onlineUuid) do
+        WeekLoopACT_BeginAllAct(human)
+    end
+end
+
+-- 活动结束
+local function WeekLoopACT_End()
+    -- 遍历在线玩家
+    for uuid, human in pairs(ObjHuman.onlineUuid) do
+        WeekLoopACT_EndAllAct(human)
+    end
+end
+
+----------------------------------------- 外部调用开始 -------------------------------------
+function onZeroAll(funcID)
+    local nNowTime = os.time()
+    local tDate = os.date("*t",nNowTime)
+    
+    local nOpenServerDay = CommonDB.getServerOpenDay()
+    if nOpenServerDay < 7 then
+        return
+    end
+
+    if WeekLoopActDef.WEEKACT_TIME ~= tDate.hour then
+        return
+    end
+
+    print("[WeekLoopACT_onZeroAll] 进入定时处理")
+
+    if WeekLoopActDef.WEEKACT_OPENDAY == tDate.wday then
+        print("[WeekLoopACT_onZeroAll] 周末活动开始打印")
+
+        tWeekActInfo = {}
+        tWeekActInfo.isRun = true
+        tWeekActInfo.nStartTime = nNowTime
+
+        -- 计算过期时间,转成0时0分
+        local nNextTime = nNowTime + 4 * 86400
+        local tEndDate = os.date("*t",nNextTime)
+        tEndDate.hour = 0
+        tEndDate.min = 0
+        tEndDate.sec = 0
+
+        local nEndTime = os.time(tEndDate)
+        tWeekActInfo.nEendTime = nEndTime
+
+        -- 活动开始
+        WeekLoopACT_Begin()
+
+        print("[WeekLoopACT_onZeroAll] 时间打印 nStartTime = ".. tWeekActInfo.nStartTime.." nEendTime = "..tWeekActInfo.nEendTime)
+    elseif WeekLoopActDef.WEEKACT_ENDDAY == tDate.wday then
+        print("[WeekLoopACT_onZeroAll] 周末活动结束打印")
+ 
+        WeekLoopACT_End()
+
+        tWeekActInfo = nil
+    end
+end
+
+-- 起服初始化
+function WeekLoopACT_Init()
+    local nNowTime = os.time()
+    local tDate = os.date("*t",nNowTime)
+
+    local nOpenServerDay = CommonDB.getServerOpenDay()
+    if nOpenServerDay < 7 then
+        return
+    end
+
+    print("[WeekLoopACT_Init] 起服初始化 wday = "..tDate.wday.." m = "..tDate.month.." d = "..tDate.day.." h = "..tDate.hour)
+
+    -- 等于星期六 或者 小于星期三
+    if WeekLoopActDef.WEEKACT_OPENDAY == tDate.wday or  WeekLoopActDef.WEEKACT_ENDDAY > tDate.wday then
+        if not tWeekActInfo then
+            tWeekActInfo = {}
+            tWeekActInfo.isRun = true
+            
+            local nDiffDay = WeekLoopActDef.WEEKACT_OPENDAY == tDate.wday and 0 or tDate.wday
+
+            local nTime = nNowTime - nDiffDay * 86400
+            local tCalDate = os.date("*t",nTime)
+            tCalDate.hour = 0
+            tCalDate.min = 0
+            tCalDate.sec = 0
+            tWeekActInfo.nStartTime = os.time(tCalDate)
+
+            local nEndTime =  tWeekActInfo.nStartTime + 4 * 86400
+            tCalDate = os.date("*t",nEndTime)
+            tCalDate.hour = 0
+            tCalDate.min = 0
+            tCalDate.sec = 0
+
+            tWeekActInfo.nEendTime = os.time(tCalDate)
+
+            print("[WeekLoopACT_Init] 时间打印 nStartTime = ".. tWeekActInfo.nStartTime.." nEendTime = "..tWeekActInfo.nEendTime)
+        end
+    end
+
+    for nID, v in pairs(WeekLoopActCof.WeekLoopAct) do
+        local moduleFn = load("return require(\"" .. v.moduleFn .. "\")")()
+        tWeekActModuel[nID] = moduleFn
+    end
+end
+
+-- 是否还在活动期间
+function WeekLoopACT_IsRun()
+    if not tWeekActInfo then
+        return false
+    end
+
+    return tWeekActInfo.isRun
+end
+
+-- 玩家登录
+function onLogin(human, funcID)
+    if not human then
+        return
+    end
+
+    local nOpenServerDay = CommonDB.getServerOpenDay()
+    if nOpenServerDay < 7 then
+        print("[onLogin] 玩家登录,当前服务器开放时间不足,直接返回 nOpenServerDay = "..nOpenServerDay)
+        return
+    end
+
+    local nLastEndTime = WeekLoopACT_GetHumanEndTime(human)
+    local nState = WeekLoopACT_GetHumanEndMail(human)
+
+    local nSendMail = nState and 1 or 0
+    print("[onLogin] 玩家登录 nSendMail = "..nSendMail)
+
+    -- 未开始
+    if false == WeekLoopACT_IsRun() then
+        if true == nState or -1 >= nLastEndTime then
+            return
+        end
+
+        WeekLoopACT_EndAllAct(human)
+        
+        return
+    end
+
+    -- 当前活动开启,记录的结束时间比当前开始的时间都小说明是新活动
+    if nLastEndTime < tWeekActInfo.nStartTime then
+        if false == nState then
+            -- 处理上一次的奖励数据
+            WeekLoopACT_HandleEndData(human)
+        end
+
+        WeekLoopACT_BeginAllAct(human)
+        
+        return
+    end
+
+    -- 下发活动基础数据
+    if true == WeekLoopACT_IsRun() then
+        WeekLoopACT_SendActInfo(human)
+    end
+end
+
+function onHeroStarChange(human, funcID, parameter, parameter2)
+    if not human or "table" ~= type(parameter) then
+        return
+    end
+
+    if false == WeekLoopACT_IsRun() then
+        return
+    end
+
+    WeekLoopActHeroStar.WeekActHeroStar_HeroStarUp(human, parameter[1], parameter[2])
+end
+
+-- 是否开启
+function isOpen(human, YYInfo, funcConfig)
+    local bRet = WeekLoopACT_IsRun()
+    local nRet = bRet and 1 or 0
+    print("WeekLoopACT_isOpen 结束 nRet = "..nRet)
+    return bRet
+end
+
+-- 
+function isActive(human, YYInfo, funcConfig)
+    return not isOpen(human, YYInfo, funcConfig)
+end
+
+function isRed(human, YYInfo, funcConfig)
+    local bRet = WeekLoopActHeroStar.isRed(human)
+    if bRet then
+        return bRet
+    end
+
+    return false
+end

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

@@ -408,6 +408,11 @@ function createDefaultRole(account)
 
         isTip  = nil ,                         --钻石加速孵化今日是否提示
 
+		nWeekLoopEndTime =  nil,				-- 周循环活动结束时间戳
+		nWeekLoopEndMail = nil,					-- 周循环活动结束处理奖励标识
+		nWeekHeroID = nil,						-- 周活动-升星英雄ID
+		tWeekHeroPrize = nil,					-- 周活动-升星奖励信息
+
         mergeInfo = {},   --融合信息 {mergeStartTime: 0 , mergeTime: 0, mergeEndTime: 0, heroId: 0}
 		gift = {
 			unlock = {},

+ 2 - 0
script/module/yunying/YunYingLogic.lua

@@ -37,6 +37,7 @@ local MiddleConnect = require("middle.MiddleConnect")
 local InnerMsg = require("core.InnerMsg")
 local AbsReachRankDB = require("absAct.AbsReachRankDB")
 local OpenServerActPowerUp = require("present.OpenServerActPowerUp")
+local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
 
 ID2YYInfo = ID2YYInfo or { } -- 每个id是一个主界面上方运营活动大图标入口
 PANELID2OPENLV = PANELID2OPENLV or { }
@@ -183,6 +184,7 @@ function init()
     -- 活动初始化后 才能去实始化ABS排名活动
     AbsReachRankDB.init()
     OpenServerActPowerUp.Init()
+    WeekendLoopActManger.WeekLoopACT_Init()
 end