Просмотр исходного кода

Merge branch 'Thailand' of https://gitee.com/wangwenfan/congkong into Thailand

zhanwencai 1 год назад
Родитель
Сommit
d80c5ea332
47 измененных файлов с 3328 добавлено и 46 удалено
  1. 3 0
      docs/开服流程.txt
  2. 1 0
      script/Main.lua
  3. 11 1
      script/common/CommonDB.lua
  4. 8 0
      script/common/CommonDefine.lua
  5. 628 0
      script/common/CommonRankDB.lua
  6. 1 0
      script/common/DB.lua
  7. 2 0
      script/common/LogDefine.lua
  8. 16 1
      script/common/ProtoID.lua
  9. 7 1
      script/common/Util.lua
  10. 3 0
      script/core/ObjHuman.lua
  11. 49 0
      script/excel/ssecy/WeekLoopAct.lua
  12. 34 0
      script/excel/ssecy/drawCardNew.lua
  13. 56 0
      script/excel/ssecy/realm.lua
  14. 30 0
      script/module/WeekendLoopActivity/Handler.lua
  15. 79 1
      script/module/WeekendLoopActivity/Proto.lua
  16. 451 0
      script/module/WeekendLoopActivity/WeekendLoopActCard.lua
  17. 18 1
      script/module/WeekendLoopActivity/WeekendLoopActDefine.lua
  18. 16 15
      script/module/WeekendLoopActivity/WeekendLoopActHeroStar.lua
  19. 163 6
      script/module/WeekendLoopActivity/WeekendLoopActManager.lua
  20. 108 0
      script/module/WeekendLoopActivity/WeekendLoopActRank.lua
  21. 332 0
      script/module/WeekendLoopActivity/WeekendLoopActUseGuYu.lua
  22. 52 0
      script/module/absAct/DailyFixedTaskLogic.lua
  23. 74 0
      script/module/absAct/DrumBlastingLogic.lua
  24. 6 0
      script/module/absAct/MangHeLogic.lua
  25. 59 1
      script/module/chat/Gm.lua
  26. 5 0
      script/module/combat/CombatDefine.lua
  27. 1 1
      script/module/combat/CombatLogic.lua
  28. 11 0
      script/module/combat/CombatPosLogic.lua
  29. 1 1
      script/module/copy/DragonNestLogic.lua
  30. 39 0
      script/module/hero/HeroLogic.lua
  31. 4 1
      script/module/hero/HeroTenZhiHuan.lua
  32. 59 0
      script/module/monster/MonsterGrid.lua
  33. 11 0
      script/module/racialTrial/Handler.lua
  34. 46 0
      script/module/racialTrial/Proto.lua
  35. 566 0
      script/module/racialTrial/RacialTrialLogic.lua
  36. 1 0
      script/module/role/Proto.lua
  37. 4 0
      script/module/role/RoleAttr.lua
  38. 7 0
      script/module/role/RoleDBLogic.lua
  39. 4 0
      script/module/role/RoleLogic.lua
  40. 12 0
      script/module/roleSystem/Handler.lua
  41. 22 0
      script/module/roleSystem/Proto.lua
  42. 197 0
      script/module/roleSystem/RoleRealmLogic.lua
  43. 1 0
      script/module/roleSystem/RoleSystemDefine.lua
  44. 90 4
      script/module/skin/SkinLogic.lua
  45. 6 2
      script/module/xianzhi/XianzhiLogic.lua
  46. 1 1
      script/module/zhuanpan/Handler.lua
  47. 33 9
      script/module/zhuanpan/ZhuanpanLogic.lua

+ 3 - 0
docs/开服流程.txt

@@ -38,6 +38,9 @@ sh timed_task.sh   --核心开服脚本 svr_install.sh
 
 at -l
 at 10:00 11/12/2024  -- 再11月12号早上十点启动 
+81 是早上9点
+cd /server && sh timed_task.sh
+ctrl + d保存退出
 at -r 删除定时任务
 
 step1 修改服务状态

+ 1 - 0
script/Main.lua

@@ -374,6 +374,7 @@ local function initAfterStart()
     require("present.OpenServerRankDB").initAfterStart()
     require("absAct.AbsActBillboardMiddleLogic").initAfterStart()
     require("mozhu.MoZhuDB").initAfterStart()
+    require("common.CommonRankDB").initAfterStart()
     math.randomseed(os.time())
 end 
 

+ 11 - 1
script/common/CommonDB.lua

@@ -34,6 +34,7 @@ KEY_OPEN_SERVER_TOPUP_TOP = "openServerTopupTop"		-- 开服充值排名活动
 KEY_CIYUAN_MOZHU = "ciyuanMoZhu"                        -- 次元魔蛛
 KEY_YJ_TIME = "yjTreasureTime"                          -- 遗迹探险时间
 KEY_CDK_BATCH = "cdkBatchIdx"                           -- CDK批次序号
+KEY_WEEKLOOP_CARD_BATCH = "weekLoopCardBatch"			-- 周活动-抽卡批次
 
 db = db or {
 	serverStartTime = nil,								-- 开服时间
@@ -54,7 +55,8 @@ db = db or {
 	workMan = {},                                       -- 打工人活动
 	ciyuanMoZhu = nil,                                  -- 次元魔蛛 
     yjTreasureTime = nil,                               -- 遗迹探险时间
-	cdkBatchIdx = nil,
+	cdkBatchIdx = nil,									-- CDK批次序号
+	weekLoopCardBatch = nil,							-- 周活动-抽卡批次
 }
 
 function init()
@@ -352,4 +354,12 @@ end
 
 function setYjTreasureEndTime(time)
 	updateValue(KEY_YJ_TIME, time)
+end
+
+function getWeekCardBatch()
+	return db.weekLoopCardBatch or 0
+end
+
+function setWeekCardBatch(nValue)
+	updateValue(KEY_WEEKLOOP_CARD_BATCH, nValue)
 end

+ 8 - 0
script/common/CommonDefine.lua

@@ -29,3 +29,11 @@ DISCONNECT_MSG[DISCONNECT_BANUSER] = Lang.DISCONNECT_BANUSER
 DISCONNECT_MSG[DISCONNECT_BANIP] = Lang.DISCONNECT_IP
 DISCONNECT_MSG[DISCONNECT_FCM_CHILD] = ""
 DISCONNECT_MSG[DISCONNECT_FCM_HEALTH] = ""
+
+
+------------------ 通用排行榜类型定义开始 ---------------------------
+COMMONRANK_TYPE_MIN = 1             -- 最小类型
+COMMONRANK_TYPE_WEEKRANK = 1        -- 周活动排行榜类型
+
+COMMONRANK_TYPE_MAX = COMMONRANK_TYPE_WEEKRANK            -- 最大类型
+------------------ 通用排行榜类型定义结束 ---------------------------

+ 628 - 0
script/common/CommonRankDB.lua

@@ -0,0 +1,628 @@
+--------------------------------
+-- 文件名       :  CommonRankDB.lua
+-- 文件说明     :  通用排行榜DB数据
+-- 创建时间     :   2024/12/09
+-- 创建人       :   FC
+--------------------------------
+
+local Msg = require("core.Msg")
+local Timer = require("core.Timer")
+local DB = require("common.DB")
+local CommonDB = require("common.CommonDB")
+local CommonDefine = require("common.CommonDefine")
+local Log = require("common.Log")
+local LuaMongo = _G.lua_mongo
+local Util = require("common.Util")
+local Grid = require("bag.Grid")
+local OpenAct = require("present.OpenAct")
+local RoleDBLogic = require("role.RoleDBLogic")
+local YunYingLogic = require("yunying.YunYingLogic")
+local MailManager = require("mail.MailManager")
+local MailExcel = require("excel.mail")
+local OpenActExcel = require("excel.openAct")
+local WeekLoopActCof = require("excel.WeekLoopAct")
+local WeekLoopActDef = require("WeekendLoopActivity.WeekendLoopActDefine")
+
+--[[
+	开服活动排行DB操作,封装了一些公共处理方法
+    db字段只是缓存排名好的数据(只是内存数据)
+    Coomondb = {
+        [rankType] = {                  -- 排名类型
+            rankType = xxx,             -- 排名类型
+            uuid2rank = {               -- 根据UUID获取名次   
+                [uuid] = rank,          -- 玩家uuid = 排行名次
+                ...
+            },        
+            sendUuid2rank = {           -- 根据UUID获取发送名次
+                [uuid] = rank,          -- 玩家uuid = 真实发送的排行名次
+                ...
+            },
+            rank2data = {               -- 根据名次获取DATA
+                [rank] = {              -- 排行名次 = 玩家排名数据
+                   uuid = xxx,          -- 玩家uuid
+                   rankType = xxx,      -- 排名类型
+                   value = xxx,         -- 排名值
+                   time = xxx,          -- 排名值更新时间
+                   _id = xxx,           -- db记录中的uuid
+                },      
+                ...
+            },
+            sendRank2data = {           -- 根据名次获取发送DATA
+                [rank] = {              -- 排行名次 = 真实发送玩家排名数据
+                   uuid = xxx,          -- 玩家uuid
+                   rankType = xxx,      -- 排名类型
+                   value = xxx,         -- 排名值
+                   time = xxx,          -- 排名值更新时间
+                   _id = xxx,           -- db记录中的uuid
+                },      
+                ...
+            }
+        },
+        ...
+    }
+
+	DB:
+        db_common_rank = {     -- 开服排行类活动
+            [uuid] = {
+                uuid = xxx,             -- 玩家uuid
+                rankType= xxx,          -- 排名类型
+                value = xxx,            -- 排行值
+                time = xxx,             -- 排行值更新时间
+            }
+        }
+	local:
+        CommonDB_GetConfig()              -- 得到指定排名类型的活动配置
+        getMinRankValue()				-- 得到排行榜中最低上榜条件数
+        getMaxRank()				    -- 得到活动最多排名名次
+        getRankNeedValue()			    -- 得到排行榜中名次对应需要达到的条件数
+        getRankInfo()					-- 得到指定排行榜指定名次的配置信息
+        getRewardInfoByRank()           -- 获取奖励信息
+        getBoard()                      -- 获取指定排名类型DB数据
+        getRank()                       -- 获取指定排名类型、指定用户的排名
+        getSendRank()                   -- 获取指定排名类型、指定用户的发送排名
+        cmpRank()                       -- 排名算法
+        updateRank()                    -- 更新排名
+        updateData()                    -- 更新数据
+        loadBoard()                     -- 加载排行榜
+        resertBoard()                   -- 重置排行数据
+        initBoard()                     -- 初始排行榜
+        getDBData()                     -- 根据类型+uuid从db中取data
+        updateDBData()                  -- 更新DB数据
+        billboardSet()                  -- 设置排名数据
+        getMailID()                     -- 获取发送奖励的邮件ID
+        getRewardInfoByInfo()			-- 得到指定排行榜指定配置信息的奖励信息
+        rewardSend()					-- 奖励发送
+        wrapOpenServerRankRewardList    -- 包装档位奖励详情数据
+	public:
+		initAfterStart()			    -- 启动就初始化	
+		getMaxSendRank()				-- 得到最大发送排行名次数据
+		wrapOpenServerRankList()		-- 包装档位名次数据
+		wrapOwnerData()					-- 包装自己名次数据
+        rewardQuery()                   -- 发送奖励详情
+		onValueAdd()					-- 排行值增加回调
+        onValueSet()                    -- 排行值设置回调
+		onRewardSend()					-- 奖励发送回调
+--]]
+
+
+WeekAct_RankName = "WeekAct_ChargeRank"
+
+MAX_SEND_RANK = 10						-- 最大发送排名数
+MAX_SEND_WEEKACTRANK = 21               -- 周活动排行榜发送排名数
+
+Coomondb = Coomondb or {}                  			-- [rankType] = board
+CoomonQueryForData = {rankType = 1, uuid = 1} -- 通过排名类型和玩家uuid查找DB数据
+CoomonQueryByUuid = {_id = 1}                 -- 通过DB的uuid更新DB数据
+CoomonQueryByRankType = {rankType = 1}        -- 通过排名类型查找DB数据
+
+
+local function CommonDB_GetConfig(rankType)
+    if CommonDefine.COMMONRANK_TYPE_WEEKRANK == rankType  then
+        return WeekLoopActCof.Rank
+    end
+
+    return nil
+end
+
+-- 得到排行榜中最低上榜条件数
+local MIN_RANK_VALUES
+local function getMinRankValue(rankType)
+	MIN_RANK_VALUES = MIN_RANK_VALUES or {}
+	if MIN_RANK_VALUES[rankType] then return MIN_RANK_VALUES[rankType] end
+
+    local tWeekRankConfig = CommonDB_GetConfig(rankType)
+    if not tWeekRankConfig then return end
+
+    -- 这里后续有排行榜类型,保持命名一致
+    local minRankValue
+    for _,info in ipairs(tWeekRankConfig) do
+        if not minRankValue or minRankValue > info.nMoney then 
+            minRankValue = info.nMoney
+        end
+    end
+
+	MIN_RANK_VALUES[rankType] = minRankValue
+	return MIN_RANK_VALUES[rankType]
+end
+
+--local MAX_RANKS
+local function getMaxRank(rankType)
+    return 200
+end
+
+ -- 得到排行榜中名次对应需要达到的条件数
+local RANK_NEED_VALUES
+local function getRankNeedValue(rankType, rank)
+	RANK_NEED_VALUES = RANK_NEED_VALUES or {}
+
+	local minRankValue = getMinRankValue(rankType)
+	if RANK_NEED_VALUES[rankType] then 
+		local nValue = nil
+        for _, tData in ipairs(RANK_NEED_VALUES[rankType]) do
+            if tData.nMinRank <= rank and tData.nMaxRank >= rank then
+                nValue = tData.nValue
+                break
+            end
+        end
+
+        return nValue or minRankValue
+	end
+
+    local tWeekRankConfig = CommonDB_GetConfig(rankType)
+    if not tWeekRankConfig then return end
+
+	RANK_NEED_VALUES[rankType] = {}
+
+    local nValue = nil
+    for _, info in pairs(tWeekRankConfig) do
+        local nMinRank = info.ranks[1]
+        local nMaxRank = info.ranks[2]
+        table.insert(RANK_NEED_VALUES[rankType], {nMinRank = nMinRank, nMaxRank = nMaxRank, nValue = info.nMoney})
+
+        if nMinRank <= rank and nMaxRank >= rank then
+            nValue = info.nMoney
+        end
+    end
+ 
+	return nValue or minRankValue
+end
+
+-- 得到指定排行榜指定名次的配置信息
+local function getRankInfo(rankType, rank)
+    local tWeekRankConfig = CommonDB_GetConfig(rankType)
+    if not tWeekRankConfig then return end
+
+    local rankInfo
+    for _,info in pairs(tWeekRankConfig) do
+		if rank >= info.ranks[1] and rank <= info.ranks[2] then
+			rankInfo = info
+			break
+		end
+    end
+ 
+	return rankInfo
+end
+
+-- 获取奖励信息
+local function getRewardInfoByRank(rankType, rank)
+    local tWeekRankConfig = CommonDB_GetConfig(rankType)
+    if not tWeekRankConfig then return end
+
+	local rewardInfo
+    for _,info in pairs(tWeekRankConfig) do
+        if rank >= info.ranks[1] and rank <= info.ranks[2] then
+            rewardInfo = info.prize
+            break
+        end
+    end
+
+	return rewardInfo
+end
+
+-- 获取指定排名类型DB数据
+local function getBoard(rankType)
+    return Coomondb[rankType]
+end
+
+-- -- 获取指定排名类型、指定用户的排名
+local function getRank(rankType, uuid)
+    local board = getBoard(rankType)
+    if not board then return end
+
+    return board.uuid2rank[uuid]
+end
+
+-- 获取指定排名类型、指定用户的发送排名
+local function getSendRank(rankType, uuid)
+    local board = getBoard(rankType)
+    if not board then return end
+
+    return board.sendUuid2rank[uuid]
+end
+
+-- 排名算法
+local function cmpRank(rankType, data1, data2)
+    if data1.value ~= data2.value then
+        return data1.value > data2.value
+    end
+
+    return data1.time < data2.time
+end
+
+-- 更新排名
+local function updateRank(board)
+    if not board then return end
+
+    -- 清空普通排名和发送排名玩家数据
+    for uuid in pairs(board.uuid2rank) do
+        board.uuid2rank[uuid] = nil
+        board.sendUuid2rank[uuid] = nil
+    end
+
+    -- 设置普通排名
+    for rank, data in ipairs(board.rank2data) do
+		board.uuid2rank[data.uuid] = rank
+	end
+
+    -- 清空发送排名
+    for rank in ipairs(board.sendRank2data) do
+        board.sendRank2data[rank] = nil
+    end
+
+    local minRankValue = getMinRankValue(board.rankType)                -- 排名最小需要的排名值
+    local aleadyRankCnt = 0                                             -- 已经排好的玩家数
+    local maxRank = getMaxRank(board.rankType)                          -- 最多排名玩家数量
+    for rank = 1, maxRank do
+        local rankNeedValue = getRankNeedValue(board.rankType, rank)    -- 取当前排名需要的排名值
+
+        local rank2data = board.rank2data[aleadyRankCnt + 1]            -- 当前排的玩家
+        if rank2data then                                               -- 还有玩家需要排
+            if rank2data.value >= rankNeedValue then                    -- 达到排名值,可以排名
+    		    board.sendUuid2rank[rank2data.uuid] = rank              -- 设置玩家发送排名
+    		    board.sendRank2data[rank] = rank2data                   -- 设置发送排名数据
+    		    aleadyRankCnt = aleadyRankCnt + 1                       -- 排名玩家数量+1
+            elseif rankNeedValue <= minRankValue then                   -- 未达到排名值 且 当前排名值 小于等于 最小需要的排名值了,则后面的玩家都不需要排了
+                    break
+             else                                                       -- 未到达最低排名值,当前名次未有玩家达到
+                board.sendRank2data[rank] = -1
+            end
+        else                                                            -- 没玩家排了直接停止
+            break
+        end
+    end
+end
+
+-- 更新数据
+local function updateData(rankType, data)
+    local board = getBoard(rankType)
+    if not board then return end
+
+    local uuid = data.uuid
+    local oldRank = getRank(rankType, uuid) or (#board.rank2data + 1)
+    board.rank2data[oldRank] = data
+
+    -- 向后比较(data.value 减少时),往排名低方向->
+    for i = oldRank + 1, #board.rank2data do
+        local data1 = board.rank2data[i - 1]
+        local data2 = board.rank2data[i]
+        if cmpRank(rankType, data1, data2) then
+            break
+        end
+        board.rank2data[i - 1] = data2
+        board.rank2data[i] = data1
+    end
+
+    -- 向前比较(data.value 增加时),往排名高方向<-
+    for i = oldRank - 1, 1, -1 do
+        local data1 = board.rank2data[i]
+        local data2 = board.rank2data[i + 1]
+        if cmpRank(rankType, data1, data2) then
+            break
+        end
+        board.rank2data[i] = data2
+        board.rank2data[i + 1] = data1
+    end  
+
+    local maxRank = getMaxRank(rankType)
+    board.rank2data[maxRank + 1] = nil  
+    return true
+end
+
+-- 加载排行榜
+local function loadBoard()
+    local cnt = 0
+    LuaMongo.find(DB.db_common_rank, nil)
+    while true do
+        local data = {}
+        if not LuaMongo.next(data) then
+            break
+        end
+
+        cnt = cnt + 1
+        if cnt % 1000 == 0 then
+            _G.collectgarbage("step", 100000)
+        end
+        updateData(data.rankType, data)
+    end
+
+    for _, board in pairs(Coomondb) do
+        updateRank(board)
+    end
+end
+
+-- 重置排行数据
+local function resertBoard(board)
+    board.uuid2rank = {}        -- 根据UUID获取名次   
+    board.sendUuid2rank = {}    -- 根据UUID获取发送名次   
+    board.rank2data = {}        -- 根据名次获取DATA
+    board.sendRank2data = {}    -- 根据名次获取发送DATA
+end
+
+-- 初始排行榜
+local function initBoard(rankType)
+    local board = {}
+    resertBoard(board)
+    board.rankType = rankType
+    Coomondb[rankType] = board
+end
+
+-- 根据类型+uuid从db中取data
+local function getDBData(rankType, uuid)
+    CoomonQueryForData.rankType = rankType
+    CoomonQueryForData.uuid = uuid
+
+    local data = {}
+    LuaMongo.find(DB.db_common_rank, CoomonQueryForData)
+    return LuaMongo.next(data) and data
+end
+
+-- 更新DB数据
+local function updateDBData(data)
+    local oldData = getDBData(data.rankType, data.uuid)
+    if oldData then
+        CoomonQueryByUuid._id = oldData._id
+        LuaMongo.update(DB.db_common_rank, CoomonQueryByUuid, data)
+    else
+        LuaMongo.insert(DB.db_common_rank, data)
+    end
+end
+
+-- 设置排名数据
+local function billboardSet(data)
+    local board = getBoard(data.rankType)
+    if not board then return end
+
+    updateData(data.rankType, data)
+    updateRank(board)
+    updateDBData(data)
+end
+
+-- 获取发送奖励的邮件ID
+local function getMailID(rankType, rankInfo)
+    if CommonDefine.COMMONRANK_TYPE_WEEKRANK == rankType then
+        return WeekLoopActDef.WEEKACT_RANK_MAILID
+    end
+
+	return WeekLoopActDef.WEEKACT_RANK_MAILID
+end
+
+-- 得到指定排行榜指定配置信息的奖励信息
+local function getRewardInfoByInfo(rankType, rankInfo)
+    if CommonDefine.COMMONRANK_TYPE_WEEKRANK == rankType then
+        return rankInfo.prize
+    end
+
+	return rankInfo.prize
+end
+
+-- 奖励发送
+MAIL_SEND_CACHE = MAIL_SEND_CACHE or nil
+local function rewardSend(rankType)
+	local board = getBoard(rankType)
+    if not board then return end
+
+    MAIL_SEND_CACHE = MAIL_SEND_CACHE or {}
+    MAIL_SEND_CACHE[rankType] = {}  
+
+    local mailID = getMailID()
+
+    for rank, rankData in ipairs(board.sendRank2data) do
+        if rankData and rankData ~= -1 then
+            local rankInfo = getRankInfo(rankType, rank)
+            if rankInfo then
+                MAIL_SEND_CACHE[rankType][rank] = rankData.uuid
+                --mailID = getMailID(rankType, rankInfo)
+            --[[
+	        local mailID = getMailID(rankType, rankInfo)
+		    local rewardInfo = getRewardInfoByInfo(rankType, rankInfo)
+			        
+		    local mailConfig = MailExcel.mail[mailID]
+		    local title = mailConfig.title
+		    local senderName = mailConfig.senderName
+		    local content = mailConfig.content		
+			        			
+		    MailManager.add(MailManager.SYSTEM, rankData.uuid, 
+						title, Util.format(content, rank), rewardInfo, senderName)   --]]
+            end                      	
+        end
+    end
+
+    Timer.addLater(10, CommonDB_SendPrize, mailID, rankType)
+
+    -- 把内存中的数据重置,并移除DB中数据
+    resertBoard(board)
+    CoomonQueryByRankType.rankType = rankType
+    LuaMongo.remove(DB.db_common_rank, CoomonQueryByRankType)
+end
+
+-- 包装档位奖励详情数据
+local function wrapOpenServerRankRewardList(rankType, net, info)
+    net.minRank = info.ranks[1]
+    net.maxRank = info.ranks[2]
+
+    local rewardInfo = info.prize
+
+ 	local len = 0
+	for index,itemInfo in ipairs(rewardInfo) do
+		len = len + 1
+		Grid.makeItem(net.items[index], itemInfo[1], itemInfo[2])
+	end
+
+	net.items[0] = len
+end
+
+-- 启动就初始化
+function initAfterStart()
+    if _G.is_middle == true then return end
+
+    for nType = CommonDefine.COMMONRANK_TYPE_MIN, CommonDefine.COMMONRANK_TYPE_MAX do
+        initBoard(nType)
+        print("[initAfterStart] 初始化排行榜 nType = "..nType)
+    end
+
+    loadBoard()
+end
+ 
+-- 得到最大发送排行名次数据
+function getMaxSendRank(rankType)
+    if CommonDefine.COMMONRANK_TYPE_WEEKRANK == rankType then
+        return MAX_SEND_WEEKACTRANK
+    end
+
+    return MAX_SEND_RANK
+end
+
+-- 包装档位名次数据
+function wrapOpenServerRankList(rankType, net, rank)
+	local board = getBoard(rankType)
+	local sendRankData = board.sendRank2data[rank]
+
+	net.rank = rank
+	net.rankNeedValue = getRankNeedValue(rankType, rank)
+	if sendRankData and sendRankData ~= -1 then
+		local userDB = RoleDBLogic.getDb(sendRankData.uuid)
+		net.uid = sendRankData.uuid
+		net.name = userDB.name
+		net.head = userDB.head
+		net.rankValue = sendRankData.value
+		net.headFrame = userDB.headFrame
+	else
+		net.uid = "-1"
+		net.name = ""
+		net.head = -1
+		net.rankValue = 0
+		net.headFrame = -1
+	end
+ 	
+ 	local rewardInfo = getRewardInfoByRank(rankType, rank)
+ 	local len = 0
+ 	if rewardInfo then
+		for index,itemInfo in ipairs(rewardInfo) do
+			len = len + 1
+			Grid.makeItem(net.items[index], itemInfo[1], itemInfo[2])
+		end
+ 	end
+	net.items[0] = len
+end
+
+-- 包装自己名次数据
+function wrapOwnerData(rankType, net, uuid)
+	local maxRank = getMaxRank(rankType)
+	local sendRank = getSendRank(rankType, uuid)
+	local board = getBoard(rankType)
+	local rankData
+    if sendRank then
+        rankData = board.sendRank2data[sendRank]
+    else
+        local rank = getRank(rankType, uuid)
+        rankData = rank and board.rank2data[rank]
+    end
+
+	net.rank = sendRank or -1
+	net.rankValue = rankData and rankData.value or 0
+
+ 	local len = 0
+ 	if sendRank then
+ 		local rewardInfo = getRewardInfoByRank(rankType, sendRank)
+		for index,itemInfo in ipairs(rewardInfo) do
+			len = len + 1
+			Grid.makeItem(net.items[index], itemInfo[1], itemInfo[2])
+		end
+ 	end
+	net.items[0] = len
+end
+
+-- 发送奖励详情
+function rewardQuery(human, rankType)
+    local tWeekRankConfig = CommonDB_GetConfig(rankType)
+ 
+	local msgRet = Msg.gc.GC_OPEN_SERVER_RANK_REWARD_QUERY
+	msgRet.type = rankType
+
+    local len = 0
+    for _,info in ipairs(tWeekRankConfig) do
+        len = len + 1
+        wrapOpenServerRankRewardList(rankType, msgRet.list[len], info)
+    end
+    msgRet.list[0] = len
+
+    Msg.send(msgRet, human.fd)
+end
+
+-- 排行值增加回调
+function onValueAdd(human, rankType, value)
+ 	local dbData = getDBData(rankType, human.db._id) or {}
+    local tValue = (dbData.value or 0) + value
+    onValueSet(human, rankType, tValue)
+end
+
+-- 排行值设置回调
+function onValueSet(human, rankType, tValue)
+ 	local dbData = getDBData(rankType, human.db._id) or {}
+	dbData.value = tValue
+	dbData.time = os.time()
+	dbData.rankType = rankType
+	dbData.uuid = human.db._id
+	billboardSet(dbData)
+end
+
+-- 奖励发送回调
+function onRewardSend(nRankType)
+    local openDay = CommonDB.getServerOpenDay()
+    if not openDay then return end
+
+    rewardSend(nRankType)
+end
+
+-- 定时器 邮件分开发,预防崩溃
+function CommonDB_SendPrize(mailID, rankType)
+    if mailID and MAIL_SEND_CACHE and MAIL_SEND_CACHE[rankType] then
+        local mailConfig = MailExcel.mail[mailID]   
+	    local title = mailConfig.title
+	    local senderName = mailConfig.senderName
+	    local content = mailConfig.content	    
+        local mailSends = MAIL_SEND_CACHE[rankType] 
+
+        for rank,uuid in pairs(mailSends) do
+            local rankInfo = getRankInfo(rankType, rank)
+            if rankInfo then
+                local rewardInfo = getRewardInfoByInfo(rankType, rankInfo)
+			    if rewardInfo then	
+		            MailManager.add(MailManager.SYSTEM, uuid, 
+						        title, Util.format(content, rank), rewardInfo, senderName)           
+                end        
+            end
+        end
+
+        MAIL_SEND_CACHE[rankType] = nil
+    end
+
+    --[[
+    -- 发完奖励后,把内存中的数据重置,并移除DB中数据
+    local board = getBoard(rankType)
+    if board then 
+        resertBoard(board)
+        CoomonQueryByRankType.rankType = rankType
+        LuaMongo.remove(DB.db_common_rank, CoomonQueryByRankType)  
+    end--]]
+end

+ 1 - 0
script/common/DB.lua

@@ -33,6 +33,7 @@ db_war_report =			    Config.DB_NAME .. ".war_report"   	    -- 战报[跨服记
 db_openServer_billboard =   Config.DB_NAME .. ".openServer_billboard"-- 开服排行类活动
 db_lost_temple          =   Config.DB_NAME .. ".lost_temple"         -- 神庙
 db_cdk =                    Config.DB_NAME .. ".cdk"                 -- cdk信息 当前最大批次 每个批次具体信息
+db_common_rank			= 	Config.DB_NAME .. ".common_rank"         -- 通用排行榜
 -- 加db第一步 请先确认是否要建对应字段的索引 第二步请确认合服逻辑是否要修改 
 
 function init()

+ 2 - 0
script/common/LogDefine.lua

@@ -253,6 +253,8 @@ DEFINE = {
 	newhero_reward			= 703,			 -- 新英雄礼包
 	xianzhi_buy             = 704,           -- 先知商店购买
 	upgradeGem			 	= 750, 			 --宝石升级
+	realmUpgrade			= 751,			 --境界提升
+	racialTrial				= 752,			-- 种族挑战
 }
 
 

+ 16 - 1
script/common/ProtoID.lua

@@ -1278,6 +1278,14 @@ _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[1287]="CG_WEEKLOOP_ACT_RANK_QUERY"
+_ENV[1288]="GC_WEEKLOOP_ACT_RANK_QUERY"
 _ENV[1301]="CG_XIANZHI_SHOP_QUERY"
 _ENV[1302]="GC_XIANZHI_SHOP_QUERY"
 _ENV[1303]="CG_XIANZHI_SHOP_BUY"
@@ -1285,4 +1293,11 @@ _ENV[1304]="GC_XIANZHI_SHOP_BUY"
 _ENV[1310]="CG_HERO_GEM_LEVELUP_QUERY"
 _ENV[1311]="GC_HERO_GEM_LEVELUP_QUERY"
 _ENV[1312]="CG_HERO_GEM_UPGRADEGEM"
-_ENV[1313]="GC_HERO_GEM_UPGRADEGEM"
+_ENV[1313]="GC_HERO_GEM_UPGRADEGEM"
+_ENV[1320]="CG_ROLE_REALM_QUERY"
+_ENV[1321]="GC_ROLE_REALM_QUERY"
+_ENV[1322]="CG_ROLE_REALM_UPGRADE"
+_ENV[1325]="CG_RACIALTRIAL_ENTRANCE_QUERY"
+_ENV[1326]="GC_RACIALTRIAL_ENTRANCE_QUERY"
+_ENV[1327]="CG_RACIALTRIAL_LEVEL_QUERY"
+_ENV[1328]="GC_RACIALTRIAL_LEVEL_QUERY"

+ 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

+ 3 - 0
script/core/ObjHuman.lua

@@ -85,6 +85,7 @@ local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
 local LostTempleLogic = require("lostTemple.lostTempleLogic")
 local WarOrder = require("shop.WarOrder")
 local OpenServerActPowerUp = require("present.OpenServerActPowerUp")
+local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
 
 fds				= fds or {}				-- fd->obj_id,包括创角中+游戏中
 onlineAccount 	= onlineAccount or {} 	-- account->human,包括创角中+游戏中
@@ -677,6 +678,7 @@ function onLogin(human, isNew)
 	LianyuLogic.onLogin(human)
 	MoshouLogic.onLogin(human)
     TopupLogic.checkKf(human)
+	RacialTrialLogic.onLogin(human)
 	-- 最后执行离线发货
 	BuyLogic.onLogin(human)
 	GiftLogic.onLogin(human)
@@ -756,6 +758,7 @@ function updateDaily(human, isGm)
     JjcLadderLogic.updateDaily(human)
     UnionRedBagLogic.updateDaily(human)
 	JjcGodWarLogic.updateDaily(human)
+	RacialTrialLogic.updateDaily(human)
 
 	-- 红点 发送  理论放最后
 	RoleSystemLogic.onLogin(human)

+ 49 - 0
script/excel/ssecy/WeekLoopAct.lua

@@ -0,0 +1,49 @@
+(function()WeekLoopAct={
+[1]={name="限时英雄升星",icon=1,sortID=1,panelID=9101,moduleFn="WeekendLoopActivity.WeekendLoopActHeroStar"},
+[2]={name="限时钻石消费",icon=1,sortID=1,panelID=9102,moduleFn="WeekendLoopActivity.WeekendLoopActUseGuYu"},
+[3]={name="限时高级召唤",icon=1,sortID=1,panelID=9103,moduleFn="WeekendLoopActivity.WeekendLoopActCard"}}end)();
+(function()HeroStarUp={
+[6]={prize={{102,150},{801005,5},{101,50000}}},
+[7]={prize={{102,200},{118,10},{111,20000}}},
+[8]={prize={{102,250},{177,500},{101,100000}}},
+[9]={prize={{102,300},{134,500},{111,40000}}},
+[10]={prize={{102,350},{120,5},{101,200000}}},
+[11]={prize={{102,400},{565,1},{111,80000}}},
+[12]={prize={{102,450},{135,5},{101,500000}}},
+[13]={prize={{102,500},{1009,1},{111,200000}}},
+[14]={prize={{102,550},{124,5},{101,1000000}}},
+[15]={prize={{102,600},{80004,1},{111,400000}}}}end)();
+(function()GuYu={
+[1]={guyu=10000,prize={{101,30000},{111,10000},{1011,5}}},
+[2]={guyu=20000,prize={{101,60000},{111,20000},{1011,10}}},
+[3]={guyu=30000,prize={{101,90000},{111,30000},{1011,15}}},
+[4]={guyu=40000,prize={{101,120000},{111,40000},{1011,20}}},
+[5]={guyu=50000,prize={{101,150000},{111,50000},{1011,25}}},
+[6]={guyu=75000,prize={{101,180000},{111,60000},{1011,30},{120,5}}},
+[7]={guyu=100000,prize={{101,210000},{111,70000},{1011,35},{120,10}}}}end)();
+(function()Card={
+[1]={nType=1,nNum=10,prize={{102,100},{101,100000},{111,30000}},szdesc="累计高级召唤10次"},
+[2]={nType=1,nNum=50,prize={{102,150},{101,200000},{111,60000}},szdesc="累计高级召唤50次"},
+[3]={nType=1,nNum=100,prize={{102,200},{118,10},{134,500}},szdesc="累计高级召唤100次"},
+[4]={nType=1,nNum=200,prize={{102,250},{80003,1},{134,1000},{120,3}},szdesc="累计高级召唤200次"},
+[5]={nType=1,nNum=300,prize={{102,300},{565,1},{114,5},{120,7}},szdesc="累计高级召唤300次"},
+[6]={nType=1,nNum=400,prize={{102,400},{565,3},{1009,2},{120,10}},szdesc="累计高级召唤500次"},
+[11]={nType=2,nNum=10,prize={{102,100},{101,100000},{111,30000}},szdesc="累计寻星5次"},
+[12]={nType=2,nNum=30,prize={{102,150},{101,200000},{111,60000}},szdesc="累计寻星10次"},
+[13]={nType=2,nNum=50,prize={{102,200},{118,10},{134,500}},szdesc="累计寻星20次"},
+[14]={nType=2,nNum=80,prize={{102,250},{80003,1},{134,1000},{124,1}},szdesc="累计寻星40次"},
+[15]={nType=2,nNum=110,prize={{102,300},{565,1},{114,5},{124,3}},szdesc="累计寻星70次"},
+[16]={nType=2,nNum=150,prize={{102,400},{565,3},{1009,2},{124,6}},szdesc="累计寻星100次"},
+[21]={nType=3,nNum=5,prize={{102,100},{101,100000},{111,30000}},szdesc="累计天命召唤2次"},
+[22]={nType=3,nNum=10,prize={{102,150},{101,200000},{111,60000}},szdesc="累计天命召唤5次"},
+[23]={nType=3,nNum=20,prize={{102,200},{118,10},{134,500}},szdesc="累计天命召唤10次"},
+[24]={nType=3,nNum=30,prize={{102,250},{80003,1},{134,1000},{1011,35}},szdesc="累计天命召唤20次"},
+[25]={nType=3,nNum=40,prize={{102,300},{565,1},{114,5},{1011,65}},szdesc="累计天命召唤30次"},
+[26]={nType=3,nNum=50,prize={{102,400},{565,3},{1009,2},{1011,100}},szdesc="累计天命召唤50次"}}end)();
+(function()Rank={
+[1]={ranks={1,1},nMoney=100,prize={{101,30000},{111,10000}}},
+[2]={ranks={2,2},nMoney=70,prize={{101,30000},{111,10000}}},
+[3]={ranks={3,3},nMoney=50,prize={{101,30000},{111,10000}}},
+[4]={ranks={4,10},nMoney=20,prize={{101,30000},{111,10000}}},
+[5]={ranks={11,20},nMoney=10,prize={{101,30000},{111,10000}}},
+[6]={ranks={21,999999},nMoney=1,prize={{101,30000},{111,10000}}}}end)();

+ 34 - 0
script/excel/ssecy/drawCardNew.lua

@@ -0,0 +1,34 @@
+(function()drawCard={
+[2]={name="高级召唤",pool={{1,104001,104002,104003,105004,105005,105006,105007,105008,105010,105011,204001,204002,204003,205004,205005,205006,205007,205009,205011,205012,304001,304002,304003,305004,305005,305006,305007,305008,305009,305010,404001,404002,405003,405004,405005,405006,405007,504001,504002,505003,505004,505005,505006,505007}},item1={118,1},item2={118,10},zuanshi1=200,zuanshi2=2000}}end)();
+(function()drawLevel={
+[1]={drawCnt=10},
+[2]={drawCnt=40},
+[3]={drawCnt=120},
+[4]={drawCnt=270},
+[5]={drawCnt=570},
+[6]={drawCnt=1070},
+[7]={drawCnt=1870},
+[8]={drawCnt=3070},
+[9]={drawCnt=4770},
+[10]={drawCnt=7070},
+[11]={drawCnt=10070},
+[12]={drawCnt=14070},
+[13]={drawCnt=19570},
+[14]={drawCnt=27070},
+[15]={drawCnt=37070}}end)();
+(function()drawProbability={
+[1]={level=0,weight={{9500,1},{500,2},{0,3},{0,4},{0,5},{0,6},{0,7}}},
+[2]={level=1,weight={{9000,1},{1000,2},{0,3},{0,4},{0,5},{0,6},{0,7}}},
+[3]={level=2,weight={{8500,1},{1200,2},{300,3},{0,4},{0,5},{0,6},{0,7}}},
+[4]={level=3,weight={{8000,1},{1500,2},{300,3},{200,4},{0,5},{0,6},{0,7}}},
+[5]={level=4,weight={{7500,1},{1800,2},{450,3},{250,4},{0,5},{0,6},{0,7}}},
+[6]={level=5,weight={{7000,1},{2000,2},{650,3},{250,4},{100,5},{0,6},{0,7}}},
+[7]={level=6,weight={{6000,1},{2400,2},{1000,3},{400,4},{175,5},{25,6},{0,7}}},
+[8]={level=7,weight={{5500,1},{2600,2},{1200,3},{450,4},{200,5},{50,6},{0,7}}},
+[9]={level=8,weight={{5000,1},{2800,2},{1400,3},{503,4},{220,5},{75,6},{2,7}}},
+[10]={level=9,weight={{4500,1},{3000,2},{1600,3},{556,4},{240,5},{100,6},{4,7}}},
+[11]={level=10,weight={{4000,1},{3000,2},{1880,3},{709,4},{280,5},{125,6},{6,7}}},
+[12]={level=11,weight={{3500,1},{3000,2},{2000,3},{942,4},{400,5},{150,6},{8,7}}},
+[13]={level=12,weight={{3000,1},{2500,2},{2400,3},{1215,4},{700,5},{175,6},{10,7}}},
+[14]={level=13,weight={{2800,1},{2500,2},{2400,3},{1218,4},{870,5},{200,6},{12,7}}},
+[15]={level=14,weight={{2800,1},{2500,2},{2200,3},{1221,4},{1040,5},{225,6},{14,7}}}}end)();

+ 56 - 0
script/excel/ssecy/realm.lua

@@ -0,0 +1,56 @@
+(function()Sheet1={
+[1]={level=1,name="新手勇者",itemId=1011,itemCnt=11,attrs={{101,7},{102,0},{103,70},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[2]={level=2,name="初级勇者",itemId=1011,itemCnt=23,attrs={{101,13},{102,0},{103,130},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[3]={level=3,name="成熟勇者",itemId=1011,itemCnt=41,attrs={{101,23},{102,0},{103,230},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[4]={level=4,name="F-级勇者",itemId=1011,itemCnt=65,attrs={{101,37},{102,0},{103,370},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[5]={level=5,name="F级勇者",itemId=1011,itemCnt=95,attrs={{101,55},{102,0},{103,550},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[6]={level=6,name="F+级勇者",itemId=1011,itemCnt=131,attrs={{101,77},{102,0},{103,770},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[7]={level=7,name="E-级勇者",itemId=1011,itemCnt=173,attrs={{101,103},{102,0},{103,1030},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[8]={level=8,name="E级勇者",itemId=1011,itemCnt=221,attrs={{101,133},{102,0},{103,1330},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[9]={level=9,name="E+级勇者",itemId=1011,itemCnt=275,attrs={{101,167},{102,0},{103,1670},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[10]={level=10,name="D-级勇者",itemId=1011,itemCnt=335,attrs={{101,205},{102,0},{103,2050},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[11]={level=11,name="D级勇者",itemId=1011,itemCnt=401,attrs={{101,247},{102,0},{103,2470},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[12]={level=12,name="D+级勇者",itemId=1011,itemCnt=473,attrs={{101,293},{102,0},{103,2930},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[13]={level=13,name="C-级勇者",itemId=1011,itemCnt=551,attrs={{101,343},{102,0},{103,3430},{104,0},{201,0},{202,0},{203,0},{204,0}}},
+[14]={level=14,name="C级勇者",itemId=1011,itemCnt=635,attrs={{101,397},{102,8},{103,3970},{104,5},{201,0},{202,0},{203,0},{204,0}}},
+[15]={level=15,name="C+级勇者",itemId=1011,itemCnt=725,attrs={{101,455},{102,10},{103,4550},{104,7},{201,0},{202,0},{203,0},{204,0}}},
+[16]={level=16,name="B-级勇者",itemId=1011,itemCnt=821,attrs={{101,517},{102,11},{103,5170},{104,7},{201,0},{202,0},{203,0},{204,0}}},
+[17]={level=17,name="B级勇者",itemId=1011,itemCnt=923,attrs={{101,583},{102,12},{103,5830},{104,8},{201,0},{202,0},{203,0},{204,0}}},
+[18]={level=18,name="B+级勇者",itemId=1011,itemCnt=1031,attrs={{101,653},{102,14},{103,6530},{104,9},{201,0},{202,0},{203,0},{204,0}}},
+[19]={level=19,name="A-级勇者",itemId=1011,itemCnt=1145,attrs={{101,727},{102,15},{103,7270},{104,10},{201,0},{202,0},{203,0},{204,0}}},
+[20]={level=20,name="A级勇者",itemId=1011,itemCnt=1265,attrs={{101,805},{102,17},{103,8050},{104,11},{201,0},{202,0},{203,0},{204,0}}},
+[21]={level=21,name="A+级勇者",itemId=1011,itemCnt=1391,attrs={{101,887},{102,18},{103,8870},{104,12},{201,0},{202,0},{203,0},{204,0}}},
+[22]={level=22,name="特A-级勇者",itemId=1011,itemCnt=1523,attrs={{101,973},{102,20},{103,9730},{104,14},{201,0},{202,0},{203,0},{204,0}}},
+[23]={level=23,name="特A级勇者",itemId=1011,itemCnt=1661,attrs={{101,1063},{102,22},{103,10630},{104,15},{201,0},{202,0},{203,0},{204,0}}},
+[24]={level=24,name="特A+级勇者",itemId=1011,itemCnt=1805,attrs={{101,1157},{102,24},{103,11570},{104,16},{201,10},{202,10},{203,10},{204,10}}},
+[25]={level=25,name="S-级勇者",itemId=1011,itemCnt=1955,attrs={{101,1255},{102,26},{103,12550},{104,18},{201,10},{202,10},{203,10},{204,10}}},
+[26]={level=26,name="S级勇者",itemId=1011,itemCnt=2111,attrs={{101,1357},{102,28},{103,13570},{104,19},{201,10},{202,10},{203,10},{204,10}}},
+[27]={level=27,name="S+级勇者",itemId=1011,itemCnt=2273,attrs={{101,1463},{102,30},{103,14630},{104,21},{201,10},{202,10},{203,10},{204,10}}},
+[28]={level=28,name="特S-级勇者",itemId=1011,itemCnt=2441,attrs={{101,1573},{102,32},{103,15730},{104,22},{201,10},{202,10},{203,10},{204,10}}},
+[29]={level=29,name="特S级勇者",itemId=1011,itemCnt=2615,attrs={{101,1687},{102,34},{103,16870},{104,23},{201,10},{202,10},{203,10},{204,10}}},
+[30]={level=30,name="特S+级勇者",itemId=1011,itemCnt=2795,attrs={{101,1805},{102,37},{103,18050},{104,25},{201,10},{202,10},{203,10},{204,10}}},
+[31]={level=31,name="英雄级勇者",itemId=1011,itemCnt=2981,attrs={{101,1927},{102,39},{103,19270},{104,27},{201,10},{202,10},{203,10},{204,10}}},
+[32]={level=32,name="金刚级勇者",itemId=1011,itemCnt=3173,attrs={{101,2053},{102,42},{103,20530},{104,29},{201,20},{202,20},{203,20},{204,20}}},
+[33]={level=33,name="无畏级勇者",itemId=1011,itemCnt=3371,attrs={{101,2183},{102,44},{103,21830},{104,30},{201,20},{202,20},{203,20},{204,20}}},
+[34]={level=34,name="史诗级勇者",itemId=1011,itemCnt=3575,attrs={{101,2317},{102,47},{103,23170},{104,32},{201,20},{202,20},{203,20},{204,20}}},
+[35]={level=35,name="传说级勇者",itemId=1011,itemCnt=3785,attrs={{101,2455},{102,50},{103,24550},{104,35},{201,20},{202,20},{203,20},{204,20}}},
+[36]={level=36,name="战神级勇者",itemId=1011,itemCnt=4001,attrs={{101,2597},{102,52},{103,25970},{104,36},{201,20},{202,20},{203,20},{204,20}}},
+[37]={level=37,name="神话级勇者",itemId=1011,itemCnt=4223,attrs={{101,2743},{102,55},{103,27430},{104,38},{201,20},{202,20},{203,20},{204,20}}},
+[38]={level=38,name="神明级勇者",itemId=1011,itemCnt=4451,attrs={{101,2893},{102,58},{103,28930},{104,40},{201,20},{202,20},{203,20},{204,20}}},
+[39]={level=39,name="弑神者",itemId=1011,itemCnt=4685,attrs={{101,3047},{102,61},{103,30470},{104,42},{201,20},{202,20},{203,20},{204,20}}},
+[40]={level=40,name="英雄级弑神者",itemId=1011,itemCnt=4925,attrs={{101,3205},{102,65},{103,32050},{104,45},{201,20},{202,20},{203,20},{204,20}}},
+[41]={level=41,name="金刚级弑神者",itemId=1011,itemCnt=5171,attrs={{101,3367},{102,68},{103,33670},{104,47},{201,30},{202,30},{203,30},{204,30}}},
+[42]={level=42,name="无畏级弑神者",itemId=1011,itemCnt=5423,attrs={{101,3533},{102,71},{103,35330},{104,49},{201,30},{202,30},{203,30},{204,30}}},
+[43]={level=43,name="史诗级弑神者",itemId=1011,itemCnt=5681,attrs={{101,3703},{102,75},{103,37030},{104,52},{201,30},{202,30},{203,30},{204,30}}},
+[44]={level=44,name="传说级弑神者",itemId=1011,itemCnt=5945,attrs={{101,3877},{102,78},{103,38770},{104,54},{201,30},{202,30},{203,30},{204,30}}},
+[45]={level=45,name="战神级弑神者",itemId=1011,itemCnt=6215,attrs={{101,4055},{102,82},{103,40550},{104,57},{201,30},{202,30},{203,30},{204,30}}},
+[46]={level=46,name="神话级弑神者",itemId=1011,itemCnt=6491,attrs={{101,4237},{102,85},{103,42370},{104,59},{201,30},{202,30},{203,30},{204,30}}},
+[47]={level=47,name="神明级弑神者",itemId=1011,itemCnt=6773,attrs={{101,4423},{102,89},{103,44230},{104,62},{201,30},{202,30},{203,30},{204,30}}},
+[48]={level=48,name="大天使",itemId=1011,itemCnt=7061,attrs={{101,4613},{102,93},{103,46130},{104,65},{201,40},{202,40},{203,40},{204,40}}},
+[49]={level=49,name="权天使",itemId=1011,itemCnt=7355,attrs={{101,4807},{102,97},{103,48070},{104,67},{201,40},{202,40},{203,40},{204,40}}},
+[50]={level=50,name="能天使",itemId=1011,itemCnt=7655,attrs={{101,5005},{102,101},{103,50050},{104,70},{201,40},{202,40},{203,40},{204,40}}},
+[51]={level=51,name="力天使",itemId=1011,itemCnt=7961,attrs={{101,5207},{102,105},{103,52070},{104,73},{201,40},{202,40},{203,40},{204,40}}},
+[52]={level=52,name="主天使",itemId=1011,itemCnt=8273,attrs={{101,5413},{102,109},{103,54130},{104,76},{201,40},{202,40},{203,40},{204,40}}},
+[53]={level=53,name="座天使",itemId=1011,itemCnt=8591,attrs={{101,5623},{102,113},{103,56230},{104,79},{201,40},{202,40},{203,40},{204,40}}},
+[54]={level=54,name="智天使",itemId=1011,itemCnt=8915,attrs={{101,5837},{102,117},{103,58370},{104,81},{201,40},{202,40},{203,40},{204,40}}},
+[55]={level=55,name="炽天使",itemId=1011,itemCnt=9245,attrs={{101,6055},{102,122},{103,60550},{104,85},{201,50},{202,50},{203,50},{204,50}}}}end)();

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

@@ -1,5 +1,9 @@
 local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
 local WeekLoopActHeroStar = require("WeekendLoopActivity.WeekendLoopActHeroStar")
+local WeekLoopActGuYu = require("WeekendLoopActivity.WeekendLoopActUseGuYu")
+local WeekLoopActCard = require("WeekendLoopActivity.WeekendLoopActCard")
+local WeekLoopActRank = require("WeekendLoopActivity.WeekendLoopActRank")
+
 
 -- 请求英雄升星活动信息
 function CG_WEEKLOOP_ACT_HEROQUERY(human, msg)
@@ -19,4 +23,30 @@ 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
+
+----------------------------------------- 排行榜协议请求开始 -------------------------------------
+function CG_WEEKLOOP_ACT_RANK_QUERY(human, msg)
+    WeekLoopActRank.WeekActRank_Query(human)
 end

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

@@ -66,4 +66,82 @@ 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 = {}
+
+----------------------------------------- 累计充值相关协议开始 -------------------------------------
+WeekLoopActRankList = {
+    {"rank",                1,         "int"},      -- 名次(-1未上榜)
+    {"rankNeedValue",       1,         "int"},      -- 上榜条件值
+    {"items",               5,         ItemData},   -- 排行名次奖励列表    
+    {"uid",                 1,         "string"},   -- 用户id(未上榜为"")
+    {"name",                1,         "string"},   -- 角色名(未上榜为"")
+    {"head",                1,         "int"},      -- 头像(未上榜为-1)  
+    {"rankValue",           1,         "int"},      -- 当前排名值     
+    {"headFrame",           1,         "int"},      -- 头像框(未上榜为-1)     
+}
+
+WeekLoopActOnwerData = {
+    {"rank",             1,          "int"},        -- 名次(-1未上榜)
+    {"rankValue",        1,          "int"},        -- 当前排名值
+    {"items",            5,         ItemData},      -- 档位奖励列表(未上榜没有奖励) 
+}
+
+-- WeekLoopActRankPrizeList = {
+--     {"minRank",             1,          "int"},     -- 最小排名
+--     {"maxRank",             1,          "int"},     -- 最大排名
+--     {"rankNeedValue",       1,          "int"},     -- 上榜条件值
+--     {"items",               5,          ItemData},  -- 档位区间奖励列表
+-- } 
+
+-- 排行榜查询
+CG_WEEKLOOP_ACT_RANK_QUERY = {}
+
+-- 排行榜查询 - 回包
+GC_WEEKLOOP_ACT_RANK_QUERY = {                  
+    {"list",            22,         WeekLoopActRankList},            -- 排行名次列表
+    {"ownerData",       1,          WeekLoopActOnwerData},           -- 自己排名数据
+}

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

@@ -0,0 +1,451 @@
+--------------------------------
+-- 文件名       :  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_GetCardType] 参数不正确")
+        return -1
+    end
+
+    return WeekendLoopActManger.WeekLoopACT_GetCardBatch()
+    -- 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(human)
+    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.tWeekCardPrize then
+        return nil
+    end
+    
+    return human.db.tWeekCardPrize
+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
+        print("[WeekActCard_SetPrizeStatus] 获取不到对应的奖励表 "..nID.." nStatus = "..nStatus)
+        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_GetCardNum] 参数不正确")
+        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)
+    print("[WeekActCard_UseCard] nNowType = "..nNowType.." nType = "..nType)
+    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
+            local bRet = WeekActCard_SetPrizeStatus(human, nID, WeekLoopActDef.WEEKACT_STATE_CANGET)
+            if false == bRet then
+                print("[WeekActCard_UseCard] 设置失败 nID = "..nID.." nStatus = "..nStatus.." num = "..v.nNum)
+            end
+        end
+    end
+
+    if true == bChange then
+        WeekActCard_Query(human)
+        WeekendLoopActManger.WeekLoopACT_SendActInfo(human)
+    end
+end
+
+-- 获取名称
+function GetName(human)
+    if not human then
+        return WeekLoopActDef.TWEEKACT_CARD_PANELID_NAME[1]
+    end
+
+    local nNowCardType = WeekActCard_GetCardType(human)
+    if -1 >= nNowCardType then
+        return WeekLoopActDef.TWEEKACT_CARD_PANELID_NAME[1]
+    end
+
+    if not WeekLoopActDef.TWEEKACT_CARD_PANELID_NAME[nNowCardType] then
+        return WeekLoopActDef.TWEEKACT_CARD_PANELID_NAME[1]
+    end
+
+    return WeekLoopActDef.TWEEKACT_CARD_PANELID_NAME[nNowCardType]
+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(human)
+    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

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

@@ -13,6 +13,7 @@ WEEKACT_STATE_NONE    =   0       -- 不可领取
 WEEKACT_STATE_CANGET  =   1       -- 可领取
 WEEKACT_STATE_FINISH  =   2       -- 已领取
 
+-- 升星邮件ID
 WEEKACT_HEROSTAR_MAILID = 7009
 WEEKACT_HEROSTAR_HREOLEN = 30
 
@@ -39,4 +40,20 @@ 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_FINDSTAR = 2  -- 寻星
+WEEKACT_CARD_TYPE_TIANMING = 3  -- 天命召唤
+
+WEEKACT_CARD_PANELID = 9103
+TWEEKACT_CARD_PANELID_NAME = {
+    [1] = "การอัญเชิญระดับสูงแบบจำกัดเวลา",
+    [2] = "การค้นหาดาวแบบจำกัดเวลา",
+    [3] = "การอัญเชิญโชคชะตาแบบจำกัดเวลา",
+}
+
+WEEKACT_RANK_MAILID = 7010

+ 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)
@@ -346,18 +362,3 @@ 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

+ 163 - 6
script/module/WeekendLoopActivity/WeekendLoopActManager.lua

@@ -23,6 +23,10 @@ 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")
+local weekLoopActRank = require("WeekendLoopActivity.WeekendLoopActRank")
+local CommonDB = require("common.CommonDB")
 
 -- 活动信息
 tWeekActInfo = nil
@@ -30,6 +34,7 @@ tWeekActInfo = nil
 --     nStartTime = nil,       -- 开始时间
 --     nEendTime = nil,        -- 结束时间
 --     isRun = nil,            -- 是否在活动中
+--     nCardBatch = nil,       -- 抽卡批次
 -- }
 
 -- 加载的模块
@@ -68,7 +73,13 @@ function WeekLoopACT_SendActInfo(human)
         if tWeekActModuel[id] and tWeekActModuel[id].isRed then
             bRed = tWeekActModuel[id].isRed(human)
         end
-
+        
+        -- 特殊处理的命名
+        if WeekLoopActDef.WEEKACT_CARD_PANELID == v.panelID and tWeekActModuel[id] and tWeekActModuel[id].GetName then
+            tActData.name = tWeekActModuel[id].GetName(human)
+        end
+        
+        print("[WeekLoopACT_SendActInfo] name = "..tActData.name)
         tActData.nRed = bRed and 1 or 0
     end
 
@@ -130,7 +141,10 @@ local function WeekLoopACT_ResetData(human)
         return
     end
 
+    -- 这里实际上应该 遍历modulefunc
     WeekLoopActHeroStar.WeekActHeroStar_ResetData(human)
+    WeekLoopActGuYu.WeekActGuYu_ResetData(human)
+    weekLoopActCard.WeekActCard_ResetData(human)
 end
 
 -- 各个子活动处理结束数据
@@ -184,6 +198,9 @@ local function WeekLoopACT_Begin()
     for uuid, human in pairs(ObjHuman.onlineUuid) do
         WeekLoopACT_BeginAllAct(human)
     end
+
+    -- 清理排行榜数据
+    weekLoopActRank.WeekActRank_ResetData()
 end
 
 -- 活动结束
@@ -192,6 +209,36 @@ local function WeekLoopACT_End()
     for uuid, human in pairs(ObjHuman.onlineUuid) do
         WeekLoopACT_EndAllAct(human)
     end
+
+    -- 排行榜直接处理
+    weekLoopActRank.WeekActRank_End()
+end
+
+-- 获取抽卡批次
+function WeekLoopACT_GetCardBatch()
+    local nNowCardBatch = CommonDB.getWeekCardBatch()
+    -- 第一次初始化,设置为2,解决玩家批次不正确的问题
+    if 0 == nNowCardBatch then
+        nNowCardBatch = 2
+        CommonDB.setWeekCardBatch(2)
+    end
+
+    print("[WeekLoopACT_GetCardBatch] nNowCardBatch = "..nNowCardBatch)
+    return nNowCardBatch
+end
+
+-- 设置新的批次
+local function WeekLoopACT_SetCardBatch()
+    local nNowCardBatch = CommonDB.getWeekCardBatch()
+    if nil == nNowCardBatch then
+        print("[WeekLoopACT_SetCardBatch] 获取不到批次")
+        CommonDB.setWeekCardBatch(1)
+        return
+    end
+
+    local nLen = (nNowCardBatch + 1) % WeekLoopActDef.WEEKACT_CARD_TYPE_LEN
+    nNowCardBatch = (0 == nLen) and WeekLoopActDef.WEEKACT_CARD_TYPE_LEN or nLen
+    CommonDB.setWeekCardBatch(nNowCardBatch)
 end
 
 ----------------------------------------- 外部调用开始 -------------------------------------
@@ -226,6 +273,7 @@ function onZeroAll(funcID)
 
         local nEndTime = os.time(tEndDate)
         tWeekActInfo.nEendTime = nEndTime
+        tWeekActInfo.nCardBatch = WeekLoopACT_GetCardBatch()
 
         -- 活动开始
         WeekLoopACT_Begin()
@@ -234,8 +282,12 @@ function onZeroAll(funcID)
     elseif WeekLoopActDef.WEEKACT_ENDDAY == tDate.wday then
         print("[WeekLoopACT_onZeroAll] 周末活动结束打印")
  
+        -- 活动结束
         WeekLoopACT_End()
 
+        -- 设置新的批次
+        WeekLoopACT_SetCardBatch()
+
         tWeekActInfo = nil
     end
 end
@@ -274,6 +326,7 @@ function WeekLoopACT_Init()
             tCalDate.sec = 0
 
             tWeekActInfo.nEendTime = os.time(tCalDate)
+            tWeekActInfo.nCardBatch = WeekLoopACT_GetCardBatch()
 
             print("[WeekLoopACT_Init] 时间打印 nStartTime = ".. tWeekActInfo.nStartTime.." nEendTime = "..tWeekActInfo.nEendTime)
         end
@@ -281,7 +334,19 @@ 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
+            print("[WeekLoopACT_Init] 加载模块成功 name = "..v.name)
+        else
+            print("[WeekLoopACT_Init] 加载模块失败 nID ".. nID)
+        end
+
     end
 end
 
@@ -341,6 +406,7 @@ function onLogin(human, funcID)
     end
 end
 
+-- 英雄星级改变回调
 function onHeroStarChange(human, funcID, parameter, parameter2)
     if not human or "table" ~= type(parameter) then
         return
@@ -367,10 +433,101 @@ 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
+
+    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
 
-    return false
+    if false == WeekLoopACT_IsRun() then
+        return
+    end
+
+    print("[onDrawCard] 高级召唤回调 parameter = "..parameter)
+    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
+
+    print("[onDrawCard] 天命召唤回调 parameter = "..parameter)
+
+    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
+    
+    print("[onDrawCard] 寻星回调 parameter = "..parameter)
+
+    weekLoopActCard.WeekActCard_UseCard(human, parameter, WeekLoopActDef.WEEKACT_CARD_TYPE_FINDSTAR)
+end
+
+-- GM 命令
+function GMResetWeekAct(human)
+    if WeekLoopACT_IsRun() then
+        WeekLoopACT_EndAllAct(human)
+
+        WeekLoopACT_SetCardBatch()
+        WeekLoopACT_BeginAllAct(human)
+    end
+end
+
+function onCharge(human, price, funcID, buyID)
+    if not human then
+        return
+    end
+
+    if false == WeekLoopACT_IsRun() then
+        return
+    end
+
+    print("[onCharge] 玩家充值回调开始 name = "..human.db.name.." price = "..price)
+
+    weekLoopActRank.onCharge(human, price, funcID, buyID)
 end

+ 108 - 0
script/module/WeekendLoopActivity/WeekendLoopActRank.lua

@@ -0,0 +1,108 @@
+--------------------------------
+-- 文件名       :  WeekendLoopActRank.lua
+-- 文件说明     :  周末冲刺-排行榜
+-- 创建时间     :   2024/12/09
+-- 创建人       :   FC
+--------------------------------
+
+local Msg = require("core.Msg")
+local Util = require("common.Util")
+local Lang = require("common.Lang")
+local CommonRankDB = require("common.CommonRankDB")
+local OpenServerRankDB = require("present.OpenServerRankDB")
+local Broadcast = require("broadcast.Broadcast")
+local OpenAct = require("present.OpenAct")
+local YunYingLogic = require("yunying.YunYingLogic")
+local DrawCardLogic = require("drawCard.DrawCardLogic")
+local CommonDefine = require("common.CommonDefine")
+
+--[[
+    local:
+
+	public:
+    	query()					            -- 发送活动信息
+        onCharge()			                -- 充值回调
+        WeekActRank_ResetData(human)        -- 重置玩家身上的充值
+        WeekActRank_ResetDBData()           -- 重置排行榜数据
+--]]
+
+----------------------------------------- 内部处理开始 -------------------------------------
+-- 重置
+function WeekActRank_ResetCharge(human)
+    -- if not human then
+    --     return
+    -- end
+
+    -- human.db.nWeekCharge = 0
+end
+
+-- 获取充值额度
+function WeekActRank_GetCharge(human)
+    -- if not human then
+    --     return 0
+    -- end
+
+    -- if not human.db.nWeekCharge then
+    --     WeekActRank_ResetCharge(human)
+    -- end
+
+    -- return human.db.nWeekCharge
+end
+
+-- 设置充值额度
+function WeekActRank_GetCharge(human, nVal)
+    -- if not human or 0 >= nVal then
+    --     return
+    -- end
+
+    -- if not human.db.nWeekCharge then
+    --     WeekActRank_ResetCharge(human)
+    -- end
+
+    -- human.db.nWeekCharge = human.db.nWeekCharge + nVal
+end
+
+
+----------------------------------------- 外部调用 -------------------------------------
+function WeekActRank_ResetData(human)
+    if not human then
+        return
+    end
+    
+    --WeekActRank_ResetCharge(human)
+end
+
+function WeekActRank_ResetDBData()
+    -- CommonRankDB.ResetData() 
+end
+
+-- 活动结束
+function WeekActRank_End()
+    CommonRankDB.onRewardSend(CommonDefine.COMMONRANK_TYPE_WEEKRANK)
+end
+
+-- 充值回调
+function onCharge(human, price, funcID, buyID)
+    CommonRankDB.onValueAdd(human, CommonDefine.COMMONRANK_TYPE_WEEKRANK, price)
+end
+
+----------------------------------------- 外部调用 -------------------------------------
+
+-- 客户端请求
+function WeekActRank_Query(human)
+    local nRankType = CommonDefine.COMMONRANK_TYPE_WEEKRANK
+	local maxSendRank = CommonRankDB.getMaxSendRank(nRankType)
+
+	local msgRet = Msg.gc.GC_WEEKLOOP_ACT_RANK_QUERY
+	
+	CommonRankDB.wrapOwnerData(nRankType, msgRet.ownerData, human.db._id)
+	
+    for rank = 1,maxSendRank do
+		CommonRankDB.wrapOpenServerRankList(nRankType, msgRet.list[rank], rank)
+	end
+    
+	msgRet.list[0] = maxSendRank
+
+	Msg.send(msgRet, human.fd)
+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

+ 52 - 0
script/module/absAct/DailyFixedTaskLogic.lua

@@ -120,6 +120,17 @@ end
 
 function onLogin(human,funcID)
     taskActive(human, 1, funcID,1)
+
+    --特殊处理下活动没开前充值、完成了活跃度任务,任务开启后没玩法完成
+    local nowHuoYue =  human.db.dailyTask.nowHuoYue or 0
+    if nowHuoYue > 0 then
+        specailFunc(human, 2, funcID, nowHuoYue)
+    end
+
+    local topupAcountDaily = human.db.topupAcountDaily
+    if topupAcountDaily and topupAcountDaily > 0 then
+        specailFunc(human, 3, funcID, topupAcountDaily)
+    end
 end
 
 function onCharge(human,parameter,funcID)
@@ -134,6 +145,47 @@ function onZhanBuBuyCard(human, funcID, parameter)
     taskActive(human, 4, funcID, parameter)
 end
 
+--特殊处理下活动没开前充值、完成了活跃度任务,任务开启后没玩法完成
+function specailFunc(human, type, id, cnt)
+    local state, endTime, starTime = AbsActLogic.isStarted(human, id)
+    if not state then return end
+
+    local absConfig = AbsActExcel.absActivity[id]
+    if not absConfig then return end
+    
+    AbsActLogic.checkAbsActClean(human, id)
+    local absAct = human.db.absAct[id]
+    if not absAct then
+        return
+    end
+    absAct.task = absAct.task or {}
+    local nowDay = Util.diffDay(starTime) + 1
+    local config = AbsActExcel.dailyFixedTask
+
+    local len = #config
+
+    for i = 1,len do
+        if config[i].day == nowDay and config[i].actId == absConfig.actId and type == config[i].type then
+            absAct.task[i] = absAct.task[i] or {} 
+            absAct.task[i].cnt = absAct.task[i].cnt or 0
+            if absAct.task[i].state and absAct.task[i].cnt > 0 then --只处理一次
+                break
+            end
+            absAct.task[i].cnt = cnt
+            --absAct.task[i].cnt = absAct.task[i].cnt + cnt
+            if absAct.task[i].cnt >= config[i].needCnt then
+                absAct.task[i].state = 1
+                break
+            end
+        end
+    end
+    
+    YunYingLogic.sendBanner(human)
+    YunYingLogic.updateIcon(YYInfo[id], human)
+    YunYingLogic.sendGroupUpdate(YYInfo[id], human, absConfig.panelID)
+end
+
+
 -- 每日任务激活
 function taskActive(human, type, id, cnt)
     local state, endTime, starTime = AbsActLogic.isStarted(human, id)

+ 74 - 0
script/module/absAct/DrumBlastingLogic.lua

@@ -374,6 +374,80 @@ function updateDaily(human,id)
     human.db.absAct[id] = absAct
 end
 
+ -- 因为玩家在活动未开启前完成了活跃度任务,活动开启后没法完成活跃度任务,所以在玩家上线时,做一次更新活跃度数据操作
+function specialFunc(human, id)
+    AbsActLogic.checkAbsActClean(human, id)
+    local state, endTime, starTime = AbsActLogic.isStarted(human, id)
+    -- 活動未開啓
+    if not state or os.time() > endTime then 
+        return
+    end
+    
+    local absConfig = AbsActExcel.absActivity[id]
+    if not absConfig then return end
+
+    local absActData = human.db.absAct[id]
+    if not absActData then 
+        return
+    end
+
+    initDB(human,id)
+    local nowHuoYue = human.db.dailyTask and human.db.dailyTask.nowHuoYue or 0
+    if nowHuoYue > 0 then
+        local nowDay = Util.diffDay(starTime) + 1
+        local actType = 1
+        -- ������������������
+        local singleData
+        local isChange = false
+        local taskConfig = AbsActExcel.drum
+        for k = 1,#taskConfig do
+            if taskConfig[k].type == actType and taskConfig[k].day == nowDay then
+                local taskID = k
+                human.db.absAct[id].drum[taskID] = human.db.absAct[id].drum[taskID] or {}
+                singleData = human.db.absAct[id].drum[taskID]
+                singleData.cnt = singleData.cnt or 0
+                singleData.state = singleData.state or 0
+                if singleData.cnt > 0 then 
+                    break 
+                end
+                singleData.cnt = nowHuoYue
+                isChange = true
+
+                -- if human.db.absAct[id].drum[taskID].state ~= 0 and cnt < 0 then
+                --     human.db.absAct[id].drum[taskID].cnt = human.db.absAct[id].drum[taskID].cnt - cnt
+                -- end
+                local config = AbsActExcel.drum[taskID]
+                -- ��������
+                if singleData.cnt >= config.needCnt and singleData.state == 0 then
+                    singleData.state = 1
+                    -- �ж��Ƿ���������
+                    for i = 1,#config.blasting do
+                        local blastingID = config.blasting[i]
+                        local blastingConfig = AbsActExcel.blasting[blastingID]
+                        human.db.absAct[id].blasting[blastingID] = human.db.absAct[id].blasting[blastingID] or {}
+                        human.db.absAct[id].blasting[blastingID].cnt = human.db.absAct[id].blasting[blastingID].cnt or 0
+                        human.db.absAct[id].blasting[blastingID].state = human.db.absAct[id].blasting[blastingID].state or 0
+                        human.db.absAct[id].blasting[blastingID].cnt = human.db.absAct[id].blasting[blastingID].cnt + 1
+                        if human.db.absAct[id].blasting[blastingID].cnt >= 3 and human.db.absAct[id].blasting[blastingID].state ~= 2 then
+                            human.db.absAct[id].blasting[blastingID].state = 1
+                        end
+                    end
+                end
+            end
+        end
+        
+        if isChange then
+            YunYingLogic.sendBanner(human)
+            YunYingLogic.sendGroupUpdate(YYInfo[id], human, absConfig.panelID)
+        end
+    end
+end
+
+function onLogin(human, id)
+    specialFunc(human, id)
+end
+
+
 function isRed(human, YYInfo, funcConfig)
     local state = AbsActLogic.isStarted(human, funcConfig.funcID)
     if not state then return end

+ 6 - 0
script/module/absAct/MangHeLogic.lua

@@ -407,6 +407,12 @@ function onDailyTask(human, id)
 end
 
 
+function onLogin(human,funcID)
+    -- 因为玩家在活动未开启前完成了活跃度任务,活动开启后没法完成活跃度任务,所以在玩家上线时,通过onDailyTask()做一次更新活跃度数据操作
+    onDailyTask(human, funcID)
+end
+
+
 function onCharge(human, price, id)
    local state = AbsActLogic.isStarted(human, id)
    if not state then return end

+ 59 - 1
script/module/chat/Gm.lua

@@ -23,6 +23,7 @@ local WarOrder = require("shop.WarOrder")
 local GiftLogic = require("topup.GiftLogic")
 local HeroSkinLogic = require("present.HeroSkinLogic")
 local DrawCardLogic = require("drawCard.DrawCardLogic")
+local WeekendLoopActManger = require("WeekendLoopActivity.WeekendLoopActManager")
 
 d3 = {}
 
@@ -123,6 +124,12 @@ function d3.heroadd(human,val)
         local heroGrid = require("hero.HeroGrid").createHeroGrid(id , star)
         if not heroGrid then break end
         
+		local skinLogic = require("skin.SkinLogic")
+		local skinOn = skinLogic.checkHeroSkinById(human,id)
+		if skinOn then
+			heroGrid.skinOn = skinOn
+		end
+		
         local attrConfig = require("hero.HeroDefine").getAttrConfig(id, heroGrid.star)
         if not attrConfig then return end
         local quality = require("hero.HeroGrid").getMaxQualityByLv(heroGrid.star, lv)
@@ -764,11 +771,27 @@ function d3.buy(human,val)
 	msg.money = checkMoney
 	ApiLogic.CHARGE_CODE_HIS = {}
 	print("cccc:",val)
-    BuyLogic.buy(human,val)
+	local buyData = {buyID = val, price = checkMoney}
+    BuyLogic.buy(human, buyData)
         --PlatformHandler.CG_TENCENT_BUY(human,msg)
 	--AdminLogic.adminFunction.tencentPay(msg)
 end
 
+function d3.buyCharge(human, val)
+	local BuyExcel = require("excel.buy")
+	local buyConf = BuyExcel.buy[val]
+	if not buyConf then
+		return
+	end
+
+	local tOJsonInput = {}
+	tOJsonInput.buyID = buyConf.id
+	tOJsonInput.id = buyConf.id
+	tOJsonInput.price = buyConf.THA
+	tOJsonInput.money = buyConf.THA
+	BuyLogic.charge(human, tOJsonInput)
+	print("[buyCharge] val = "..val)
+end
 
 function d3.gol(human)
     local AdminLogic = require("AdminLogic")
@@ -1924,3 +1947,38 @@ function d3.guaji(human,value)
 	gmFuc(human, value)
 end
 
+function d3.resetweek(human)
+	WeekendLoopActManger.GMResetWeekAct(human)
+end
+
+function d3.savedb(human)
+	ObjHuman.GM_SaveDB(human)
+end
+
+
+------种族试炼------------
+---开启某个种族的试炼,value为种族
+function d3.zzkq(human, value)
+	local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
+	RacialTrialLogic.GmOpenTrial(human, value)
+end
+
+--某个种族关卡的跳关
+function d3.zztg(human, value)
+	local pos = string.find(value, " ", 1, true)
+	if pos == nil then return end
+	local camp = tonumber(string.sub(value, 1, pos - 1))
+	local levelCnt = tonumber(string.sub(value,pos+1,#value))
+	local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
+	RacialTrialLogic.GmSetlevel(human, camp, levelCnt)
+end
+
+--z增加某个种族关卡的每日奖励次数
+function d3.zzjl(human, value)
+	local pos = string.find(value, " ", 1, true)
+	if pos == nil then return end
+	local camp = tonumber(string.sub(value, 1, pos - 1))
+	local levelCnt = tonumber(string.sub(value,pos+1,#value))
+	local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
+	RacialTrialLogic.GmAddDailyAwardCnt(human, camp, levelCnt)
+end

+ 5 - 0
script/module/combat/CombatDefine.lua

@@ -184,6 +184,11 @@ COMBAT_TYPE21 = 21 --英雄展示
 COMBAT_TYPE22 = 22 --英雄展示
 COMABT_TYPE23 = 23 --次元魔蛛
 COMBAT_TYPE24 = 24 --失落神庙
+COMBAT_TYPE25 = 25 --种族试炼-妖族
+COMBAT_TYPE26 = 26 --种族试炼-人族
+COMBAT_TYPE27 = 27 --种族试炼-兽族
+COMBAT_TYPE28 = 28 --种族试炼-仙魔族
+
 COMBAT_TYPE_MAX = 24 --阵容最大数
 --对象类型
 COMBAT_OBJ_TYPE1 = 1 --玩家 

+ 1 - 1
script/module/combat/CombatLogic.lua

@@ -1046,7 +1046,7 @@ function sendCombatFinish(human, combatInfo)
 	if CombatDefine.COMBAT_TYPE1 == combatInfo.type then
 		msgRet.data.nBattleType = human.db.battleType
 		if true == combatInfo.isWin and BattleLogic.BattleLogic_IsLastLevels(human, human.db.battleType) then
-			msgRet.data.param = "0"
+			msgRet.data.param = "0|0|0"
 		end
 	end
 

+ 11 - 0
script/module/combat/CombatPosLogic.lua

@@ -110,6 +110,17 @@ local function checkUpdatePos(human, msg)
         return
     end
 
+
+	if msg.type == CombatDefine.COMBAT_TYPE25 or  msg.type == CombatDefine.COMBAT_TYPE26 or
+		msg.type == CombatDefine.COMBAT_TYPE27 or msg.type == CombatDefine.COMBAT_TYPE28 then
+			local moduleFn = CombatLogic.getModule(msg.type)
+			if moduleFn and moduleFn.checkUpdatePos then
+				if not moduleFn.checkUpdatePos(human, msg) then
+					return false
+				end
+			end
+		end
+
     local posList = getPosList(msg.formation)
     local heroList = Util.split(msg.heroList, ",")
     local helpList = Util.split(msg.helpList, ",", true)

+ 1 - 1
script/module/copy/DragonNestLogic.lua

@@ -191,7 +191,7 @@ function fontNextItem(msgRet, human)
                 if human.db.dragonCopy.historyGet and human.db.dragonCopy.historyGet[k] then
                     beiShu = 1
                 else
-                    beiShu = 5
+                    beiShu = 3
                 end
             end
             beiShu = beiShu or 1

+ 39 - 0
script/module/hero/HeroLogic.lua

@@ -245,6 +245,7 @@ function sendHeroBagList(human)
 		end
 	end
 
+	SkinLogic.OnLoginCheckEquipSkin(human)
 	print(" human onLogin  maxZDL is : ",  human.maxZDL.zhandouli)
 end
 
@@ -2138,3 +2139,41 @@ function resetHero(human, heroID, heroIndex)
 
 	checkChangeMaxZDL(human, heroGrid)
 end
+
+-- 对所有英雄操作一次装备皮肤
+function AllHeroEquipSkin(human)
+    if not human then
+        return
+    end
+
+	local nHeroLen = human.db.heroBag[0]
+	if 0 >= nHeroLen then
+		return
+	end
+
+	local tEquipSkin = {}
+	for i = 1, nHeroLen, 1 do
+		local heroGrid = human.db.heroBag[i]
+		if heroGrid then
+			local nID = heroGrid.id
+			-- 不存在去查表
+			if not tEquipSkin[nID] then
+				local bHaveSkin = false
+				local skinOn = heroGrid.skinOn
+
+				if skinOn then
+					heroGrid.skinOn = skinOn
+					bHaveSkin = true
+				else
+					skinOn = -1
+				end
+
+				tEquipSkin[nID] = {bHaveSkin = bHaveSkin, skinOn = skinOn}
+			else
+				if true == tEquipSkin[nID].bHaveSkin then
+					heroGrid.skinOn = tEquipSkin[nID].skinOn
+				end
+			end
+		end
+	end
+end

+ 4 - 1
script/module/hero/HeroTenZhiHuan.lua

@@ -17,6 +17,7 @@ local HeroEquip = require("hero.HeroEquip")
 local HeroDefine = require("hero.HeroDefine")
 local FenjieLogic = require("hecheng.FenjieLogic")
 local FuwenLogic = require("fuwen.FuwenLogic")
+local SkinLogic = require("skin.SkinLogic")
 
 MATERIAL1_NEED_STAR = 10                -- 材料1,需要10星以上的英雄
 MATERIAL2_NEED_STAR = 5                 -- 材料2,需要5星的英雄
@@ -128,7 +129,7 @@ function zhihuan(human, material2ID, heroIndexList)
             end
             material1Star = math.max(material1Star, material1Config.star)
         end
-    end   
+    end
 
     local config = UpNeedExcel.zhihuan[material1Star]
     if not config then 
@@ -191,6 +192,8 @@ function zhihuan(human, material2ID, heroIndexList)
         end
     end
 
+    SkinLogic.OnLoginCheckEquipSkin(human, true)
+
     -- 发送给前端用来显示获得的英雄
     local msgRet = Msg.gc.GC_HERO_TEN_ZHIHUAN
     HeroGrid.makeHeroSimple(msgRet.heroSimple, newHeroGrid, newIndex, human)

+ 59 - 0
script/module/monster/MonsterGrid.lua

@@ -0,0 +1,59 @@
+local monsterConfig = require("excel.monster")
+local RoleAttr = require("role.RoleAttr")
+local RoleDefine = require("role.RoleDefine")
+
+
+-- 创建一个怪物grid
+function createMonsterObj(monsterId, attrId, refreshData, deleteData)
+	local monsterCfg = monsterConfig.monster[monsterId]
+	if not monsterCfg then 
+		--assert(nil, "not monster id "..id)
+		return
+	end
+	local Obj = {}
+
+    --暂时加这些,后续有需要再加
+	Obj.id = monsterId
+	Obj.lv = 1
+    Obj.quality = 0
+    Obj.power = 0
+    Obj.star = monsterCfg.star or 0
+	Obj.icon = monsterCfg.head or 0
+	Obj.camp = monsterCfg.camp or 0
+	Obj.body = monsterCfg.body or 0
+    Obj.head = monsterCfg.head or 0
+
+
+    for k, v in pairs(refreshData or {}) do
+        Obj[k] = v
+    end
+
+    for key in pairs(deleteData or {}) do
+        Obj[key] = nil
+    end
+
+    local attrs = RoleAttr.calcMonsterConf(monsterId, attrId)
+    Obj.power = attrs[RoleDefine.ZHANDOULI]
+
+	return Obj
+end
+
+-- 根据monsterOutID创建怪物obj List
+function createMonsterObjListByMonsterOutID(monsterOutID)
+    if not monsterOutID then return end
+
+    local singleCfg = monsterConfig.monsterOut[monsterOutID]
+    local member = singleCfg.member
+    local attrIds = singleCfg.attrID
+
+    local objList = {}
+    for k, v in ipairs(member) do
+        local monsterID = v[1]
+        local monsterLv = v[2]
+        local attrId = attrIds[k]
+        local refreshData = {lv = monsterLv}
+        local obj = createMonsterObj(monsterID, attrId, refreshData)
+        objList[k] = obj
+    end
+    return objList
+end

+ 11 - 0
script/module/racialTrial/Handler.lua

@@ -0,0 +1,11 @@
+local RacialTrialLogic = require("racialTrial.RacialTrialLogic")
+
+
+function CG_RACIALTRIAL_ENTRANCE_QUERY(human,msg)
+	RacialTrialLogic.entranceQuery(human, msg)
+end
+
+
+function CG_RACIALTRIAL_LEVEL_QUERY(human,msg)
+	RacialTrialLogic.stageQuery(human, msg.camp)
+end

+ 46 - 0
script/module/racialTrial/Proto.lua

@@ -0,0 +1,46 @@
+local ItemData = require("bag.Proto").ItemData
+
+
+OPEN_DATA = {
+	{"isOpen",                  1,        "byte"},    -- 开启状态, 0-未开启, 1-开启
+	{"camp",                	1,        "int"},		--种族
+	{"openWdays",               6,        "byte"},   -- 每周开启时间,1代表周一...  7代表周天
+}
+
+--种族试炼入口界面查询
+CG_RACIALTRIAL_ENTRANCE_QUERY = {}
+GC_RACIALTRIAL_ENTRANCE_QUERY = {
+	{"list",                  4,        OPEN_DATA}, --index 1~4, 代表妖,人,兽,仙魔
+}
+
+
+
+MONSTER_DATA = {
+	{"lv",                  		1,        "short"},
+	{"body",                		1,        "int"},
+	{"camp",                		1,        "int"},
+}
+
+LEVEL_DATA = {
+	{"monsterData",                 5,        MONSTER_DATA},    -- 当前关卡的怪物数据
+	{"power",                		1,        "int"},			--推荐战力
+	{"isPass",                		1,        "byte"},			--是否已经通关,1-已经通关, 0-未通关,不能挑战,  2-未通关,可以挑战,3-当日没有奖励次数了,但是还是需要显示挑战button
+	{"reward",                  	3,        ItemData},    	-- 当前关卡的奖励
+	{"levelIdex",                	1,        "int"},			--当前关卡数
+}
+
+SINGLE_LEVEL_DATA = {
+	{"dailyAwardCnt",             1,        "int"},    -- 每日可领取奖励次数/通关次数
+	{"stageData",            	  7,        LEVEL_DATA}, --多层数据
+}
+
+
+
+--关卡信息查询
+CG_RACIALTRIAL_LEVEL_QUERY = {
+	{"camp",                 1,        "byte"},    -- 种族类型
+}
+GC_RACIALTRIAL_LEVEL_QUERY = {
+	{"data",                  1,        SINGLE_LEVEL_DATA}, --单个种族的关卡数据
+
+}

+ 566 - 0
script/module/racialTrial/RacialTrialLogic.lua

@@ -0,0 +1,566 @@
+--种族试炼
+--db
+--[=[
+    key 为种族类型
+    human.db.RacialTrial = {
+        [1] = {
+            lv = nil,               --已经通关的层数
+            dailyAwardCnt = nil,    --每日可领取奖励次数/每日可通关次数
+        },
+        [2] = {
+            lv = nil,
+            dailyAwardCnt = nil,
+        }
+    }
+]=]--
+
+local Msg = require("core.Msg")
+local Util = require("common.Util")
+local BagLogic = require("bag.BagLogic")
+local CombatDefine = require("combat.CombatDefine")
+local CombatLogic = require("combat.CombatLogic")
+local HeroLogic = require("hero.HeroLogic")
+local HeroConfig = require("excel.hero")
+local MonsterCfg = require("excel.monster")
+local Grid = require("bag.Grid")
+local MonsterGrid = require("monster.MonsterGrid")
+
+--开启玩法的等级要求
+local openCondLevel =  0
+--每日最多可领奖次数
+local dailyAwardTimes = 0
+--种族试炼关卡数据,key为种族,value为该种族的关卡配置
+local racialCfg = {
+    --[camp] = {},
+    --[camp] = {},
+}
+
+--日志Tag
+local RACIALTRIALLOG = "racialTrial"
+
+
+--种族 - 关卡开启时间映射表
+--1-妖族, 2-人族, 3-兽族,4-仙、魔族
+local RACIAL_OPENTIME = {
+    [1] = {1,5,7},
+    [2] = {2,5,7},
+    [3] = {3,6,7},
+    [4] = {4,6,7},
+}
+
+--战斗类型 - 种族映射表
+local COMBATTYPE_CAMP = {
+    [CombatDefine.COMBAT_TYPE25] = 1,
+    [CombatDefine.COMBAT_TYPE26] = 2,
+    [CombatDefine.COMBAT_TYPE27] = 3,
+    [CombatDefine.COMBAT_TYPE28] = {4,5},
+}
+
+local function updateCondValue()
+    local cfg = require("excel.shilianTower")
+    if not cfg then
+        return
+    end
+    local condCfg = cfg.main[1]
+    openCondLevel = condCfg.openlv
+    dailyAwardTimes = condCfg.maxrewardnum
+end
+
+--生成配置
+local function generateCfg()
+    local cfg = require("excel.shilianTower")
+    if not cfg then
+        return
+    end
+
+    local stageCfg = cfg.shilianTower
+    racialCfg = { [1] = {}, [2] = {}, [3] = {}, [4] = {}}
+    local n1,n2,n3,n4 = 0,0,0,0
+    for _, v in ipairs(stageCfg) do
+        if v.raceID == 101 then
+            n1 = n1 + 1
+            racialCfg[1][n1] = v
+        elseif v.raceID == 102 then
+            n2 = n2 + 1
+            racialCfg[2][n2] = v
+        elseif v.raceID == 103 then
+            n3 = n3 + 1
+            racialCfg[3][n3] = v
+        elseif v.raceID == 104 then
+            n4 = n4 + 1
+            racialCfg[4][n4] = v
+        end
+    end
+end
+
+--初始化数据
+local function initData(human, camp)
+    human.db.RacialTrial = human.db.RacialTrial or {}
+    human.db.RacialTrial[camp] = {
+        lv = 0,
+        dailyAwardCnt = dailyAwardTimes
+    }
+
+end
+
+
+--检测上阵英雄
+function checkUpdatePos(human, msg)
+    local combatType = msg.type
+    local condi_camp  = COMBATTYPE_CAMP[combatType]
+    if not condi_camp then
+        return false
+    end
+    local heroList = Util.split(msg.heroList, ",")
+    for i = 1, CombatDefine.COMBAT_HERO_CNT do
+        local uuid = heroList[i] or ""
+        if uuid ~= "0" and uuid ~= "" then
+            local heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
+            if not heroGrid then
+                return false
+            end
+
+            --种族检测
+            local heroCfg = HeroConfig.hero[heroGrid.id]
+            if type(condi_camp) == "table" then
+                local bl = false
+                for _, camp in ipairs(condi_camp) do
+                    if camp == heroCfg.camp then
+                        bl = true
+                        break
+                    end
+                end
+                if not bl then
+                    return false
+                end
+            else
+                if condi_camp ~= heroCfg.camp then
+                    return false
+                end
+            end
+        end
+
+    end
+    return true
+end
+
+--红点检测
+function isDot(human,config)
+    if human.db.lv < config.dotLv then
+        return false
+    end
+
+    local wday = Util.getWeekDay()
+    --转成大家熟悉的表示法
+    if wday == 1 then
+        wday = 7
+    else
+        wday = wday - 1
+    end
+
+    --入口的红点
+    if config.id == 1210 then
+        --如果当天一个试炼都没有开启,则入口也不显示红点
+        local bl = false
+        for _, v in ipairs(RACIAL_OPENTIME) do
+            for _, v2 in ipairs(v) do
+                if v2 == wday then
+                    bl = true
+                    break
+                end
+            end
+            if bl then
+                break
+            end
+        end
+
+        if not bl then
+            return false
+        end
+
+        if human.db.RacialTrial then
+            local num = 0
+            for camp, v in pairs(human.db.RacialTrial) do
+                local campCfg = racialCfg[camp]
+                if v.dailyAwardCnt <= 0 or v.lv >= #campCfg then
+                    num = num + 1
+                end
+            end
+            if num >= #RACIAL_OPENTIME then
+                return false
+            end
+        end
+    else
+        --具体某个种族关卡的红点
+        local camp = 0
+        if config.id == 1211 then
+            camp = 1
+        elseif config.id == 1212 then
+            camp = 2
+        elseif config.id == 1213 then
+            camp = 3
+        elseif config.id == 1214 then
+            camp = 4
+        else
+            return false
+        end
+
+        --开启判断
+        local bl = false
+        local openDays = RACIAL_OPENTIME[camp]
+        for _, v in ipairs(openDays) do
+            if v == wday then
+                bl = true
+                break
+            end
+        end
+        if not bl then
+            return false
+        end
+
+        --当日奖励次数和最大关卡判断
+        if human.db.RacialTrial and human.db.RacialTrial[camp] then
+            local dailyAwardCnt = human.db.RacialTrial[camp].dailyAwardCnt
+            local lv = human.db.RacialTrial[camp].lv
+            local campCfg = racialCfg[camp]
+    
+            if dailyAwardCnt <= 0 or lv >= #campCfg then
+                return false
+            end
+        end
+    end
+
+    return true
+end
+
+--0点更新
+function updateDaily(human)
+    updateCondValue()
+    if human.db.lv < openCondLevel then
+        return
+    end
+
+    if not next(racialCfg) then
+        generateCfg()
+    end
+
+    --重置每日领奖次数/每日通关次数
+    if human.db and human.db.RacialTrial then
+        for _, v in pairs(human.db.RacialTrial) do
+            v.dailyAwardCnt = dailyAwardTimes
+        end
+    end
+end
+
+function onLogin(human)
+    updateCondValue()
+    if human.db.lv < openCondLevel then
+        return
+    end
+
+    if not next(racialCfg) then
+        generateCfg()
+    end
+end
+
+--GM 修改某个种族的关卡, levelCnt表示要往前/后打多少关,但是不增加每日领奖次数
+function GmSetlevel(human, camp, levelCnt)
+    if not camp or not levelCnt then
+        return
+    end
+
+    local singleRacialCfg = racialCfg[camp]
+    if not singleRacialCfg then
+        return
+    end
+
+    if not human.db.RacialTrial or not human.db.RacialTrial[camp] then
+        initData(human, camp)
+    end
+
+    local racialTrialData = human.db.RacialTrial[camp]
+    if levelCnt > 0 then
+        local startIdx = racialTrialData.lv
+        if startIdx + levelCnt > #singleRacialCfg then
+            levelCnt = #singleRacialCfg - startIdx
+        end
+        local endIdx = startIdx + levelCnt
+        for i= startIdx+1, endIdx do
+            local rewardCfg = singleRacialCfg[i].reward
+            for _,v in ipairs(rewardCfg) do
+                BagLogic.addItem(human, v[1], v[2], RACIALTRIALLOG)
+            end
+        end
+    end
+    racialTrialData.lv = math.max(racialTrialData.lv + levelCnt, 0)
+end
+
+--GM 开启某个种族的试炼
+function GmOpenTrial(human, camp)
+    if not camp then
+        return
+    end
+    local wdDays = RACIAL_OPENTIME[camp]
+    if not wdDays then
+        return
+    end
+
+    local wday = Util.getWeekDay()
+    if wday == 1 then
+        wday = 7
+    else
+        wday = wday - 1
+    end
+    wdDays[#wdDays+1] = wday
+end
+
+--增加某个种族试炼关卡的每次奖励次数/通关数
+function GmAddDailyAwardCnt(human, camp, num)
+    if not camp or not num then
+        return
+    end
+
+    if not human.db.RacialTrial or not human.db.RacialTrial[camp] then
+        initData(human, camp)
+    end
+
+    local racialTrialData = human.db.RacialTrial[camp]
+    racialTrialData.dailyAwardCnt = math.max(racialTrialData.dailyAwardCnt + num, 0)
+end
+
+
+--------------------------------------------------战斗相关------------------------------------
+function getCombatMonsterOutID(human, side, args, combatType)
+    if side ~= CombatDefine.DEFEND_SIDE then
+        return
+    end
+
+    local camp = COMBATTYPE_CAMP[combatType]
+    if type(camp) == "table" then
+        camp = camp[1]
+    end
+    if not camp then
+        return
+    end
+
+    local nowLelvel = 0
+    if human.db.RacialTrial and human.db.RacialTrial[camp] then
+        nowLelvel =  human.db.RacialTrial[camp].lv
+    end
+
+    local config = racialCfg[camp][nowLelvel+1]
+    if not config then
+        return
+    end
+    return config.monsterOutID, config.zhandouli
+end
+
+function fight(human, args, combatType)
+    local camp = COMBATTYPE_CAMP[combatType]
+    if type(camp) == "table" then
+        camp = camp[1]
+    end
+    if not camp then
+        return
+    end
+
+    if human.db.RacialTrial and human.db.RacialTrial[camp] then
+        local data = human.db.RacialTrial[camp]
+
+        --当日没有挑战次数了
+        if data.dailyAwardCnt and data.dailyAwardCnt <= 0 then
+            return
+        end
+
+        --已经到最高层
+        local campCfg = racialCfg[camp]
+        if data.lv and data.lv >= #campCfg then
+            return
+        end
+    end
+
+    CombatLogic.combatBegin(human, nil, nil, combatType)
+end
+
+--战斗结束,未将战斗数据下发客户端前的处理
+function onFightEnd(human, result, combatType, param1, combatInfo)
+    --没赢就不需要处理
+    if CombatDefine.RESULT_WIN ~= result then
+        return
+    end
+
+    local camp = COMBATTYPE_CAMP[combatType]
+    if type(camp) == "table" then
+        camp = camp[1]
+    end
+    if not camp then
+        return
+    end
+
+    if not human.db.RacialTrial or not human.db.RacialTrial[camp] then
+        --胜利才更新数据
+        initData(human, camp)
+    end
+
+
+    local data = human.db.RacialTrial[camp]
+    data.lv = data.lv + 1
+    data.dailyAwardCnt =  data.dailyAwardCnt - 1
+
+    local singleRacialCfg = racialCfg[camp]
+    local rewardCfg = singleRacialCfg[data.lv].reward
+    if not rewardCfg then
+        return
+    end
+
+    --已经到最高层或者当日可挑战次数已用完则不能继续挑战
+    combatInfo.endParam = "1"
+    if data.lv >= #singleRacialCfg or data.dailyAwardCnt <= 0 then
+        combatInfo.endParam = "0"
+    end
+
+    --发放奖励
+    combatInfo.rewardItem = {}
+    for i=1, #rewardCfg do
+        local itemID = rewardCfg[i][1]
+        local itemCnt = rewardCfg[i][2]
+        combatInfo.rewardItem[i] = combatInfo.rewardItem[i] or {}
+        combatInfo.rewardItem[i] = {itemID, itemCnt}
+        BagLogic.addItem(human, itemID, itemCnt, RACIALTRIALLOG)
+    end
+end
+
+--------------------------------------------------Respone------------------------------------
+
+--入口查询
+function entranceQuery(human)
+    if human.db.lv < openCondLevel then
+        return
+    end
+
+    local wday = Util.getWeekDay()
+    --转成大家熟悉的表示法
+    if wday == 1 then
+        wday = 7
+    else
+        wday = wday - 1
+    end
+
+    local msgRet = Msg.gc.GC_RACIALTRIAL_ENTRANCE_QUERY
+    msgRet.list[0] = #RACIAL_OPENTIME
+
+    for k,v in ipairs(RACIAL_OPENTIME) do
+        msgRet.list[k].isOpen = 0
+        msgRet.list[k].camp = k
+        for _, day in ipairs(v) do
+            if wday == day then
+                msgRet.list[k].isOpen = 1
+                msgRet.list[k].openWdays[0] = 0
+                break
+            end
+        end
+        if msgRet.list[k].isOpen == 0 then
+            msgRet.list[k].openWdays[0] = #v
+            for idx, val in ipairs(v) do
+                msgRet.list[k].openWdays[idx] = val
+            end
+        end
+    end
+    Msg.send(msgRet, human.fd)
+end
+
+--单个种族关卡数据查询
+function stageQuery(human, camp_m)
+    if not camp_m then
+        return
+    end
+
+    if human.db.lv < openCondLevel then
+        return
+    end
+
+    local nowLv = 0
+    local dailyAwardCnt = dailyAwardTimes
+    if human.db.RacialTrial and human.db.RacialTrial[camp_m] then
+        nowLv = human.db.RacialTrial[camp_m].lv
+        dailyAwardCnt = human.db.RacialTrial[camp_m].dailyAwardCnt
+    end
+
+    local msgRet = Msg.gc.GC_RACIALTRIAL_LEVEL_QUERY
+    msgRet.data.dailyAwardCnt = dailyAwardCnt
+
+    --正常显示(当前关卡-1  ~  当前关卡+5) 的关卡
+    local startIdx = nowLv - 1
+    local endIdx = nowLv + 5
+
+    --0层和第一层的的处理
+    if nowLv <= 0 or nowLv == 1 then
+        startIdx = 1
+        endIdx = startIdx + 5
+    end
+
+    local singleRecailCfg = racialCfg[camp_m]
+    local levelMaxCnt = #singleRecailCfg
+
+    --已经打到最高层的处理
+    if nowLv >= levelMaxCnt then
+        startIdx = nowLv - 5
+        endIdx = nowLv
+    end
+
+    --当前关卡前面不够5层的处理
+    if levelMaxCnt - nowLv < 5 then
+        local subLevel = levelMaxCnt - nowLv
+        startIdx = startIdx - subLevel + 1
+        endIdx = levelMaxCnt
+    end
+    
+    local stageData = msgRet.data.stageData
+    stageData[0] = 0
+    local cnt = 0
+    for i = startIdx, endIdx do
+        local singleCfg = singleRecailCfg[i]
+        if not singleCfg then
+            return
+        end
+        cnt = cnt + 1
+        if i <= nowLv then
+            stageData[cnt].isPass = 1
+        elseif i == nowLv + 1 and dailyAwardCnt > 0 then --只能一关一关的挑战
+            stageData[cnt].isPass = 2
+        elseif i == nowLv + 1 and dailyAwardCnt <= 0 then --当日没有奖励次数了,但是还是需要显示挑战button
+            stageData[cnt].isPass = 3
+        else
+            stageData[cnt].isPass = 0
+        end
+
+        stageData[cnt].power = 0
+        stageData[cnt].levelIdex = i
+
+        --奖励
+        stageData[cnt].reward[0] = #singleCfg.reward
+        for k, v in ipairs(singleCfg.reward) do
+            Grid.makeItem(stageData[cnt].reward[k], v[1], v[2])
+        end
+
+        --怪物数据
+        local objList = MonsterGrid.createMonsterObjListByMonsterOutID(singleCfg.monsterOutID)
+        if not objList then
+            return
+        end
+        stageData[cnt].monsterData[0] = #objList
+
+        local power = 0
+        for idx, monster in ipairs(objList) do
+            stageData[cnt].monsterData[idx] = {
+                lv = monster.lv,
+                body = monster.body,
+                camp = monster.camp,
+            }
+            power = power + (monster.power or 0)
+        end
+        stageData[cnt].power = power
+    end
+    stageData[0] = cnt
+    Msg.send(msgRet, human.fd)
+end

+ 1 - 0
script/module/role/Proto.lua

@@ -36,6 +36,7 @@ RoleBase = {
     {"serverName", 1, "string"},	    -- 蓝钻信息
     {"createTime", 1, "int"},
     {"signInCnt", 1, "int"},
+	{"realmName", 1, "string"},	    	-- 境界名称
 }
 
 ChenghaoNet = {

+ 4 - 0
script/module/role/RoleAttr.lua

@@ -36,6 +36,7 @@ local ItemDefine = require("bag.ItemDefine")
 local EquipLogic = require("equip.EquipLogic")
 local CombatPosLogic = require("combat.CombatPosLogic")
 local CombatDefine = require("combat.CombatDefine")
+local RoleRealmLogic = require("roleSystem.RoleRealmLogic")
 
 -- 计算人数属性
 function doCalc(human)
@@ -147,6 +148,9 @@ function calcHeroGrid(heroGrid, index, human)
 	UnionLivenessLogic.doCalcHero(human, HERO_OTHER_ATTRS) --公会活跃等级
 	ChengjiuLogic.doCalcHero(human, HERO_OTHER_ATTRS) --成就属性加成
 	MoshouLogic.doCalcHero(human, heroGrid, HERO_OTHER_ATTRS) -- 魔兽	
+
+	RoleRealmLogic.doCalcHero(human, HERO_OTHER_ATTRS) --境界
+
 	--不同模块在英雄属性计算 end	
 	
 	-- 计算评分

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

@@ -405,6 +405,13 @@ function createDefaultRole(account)
 		nWeekLoopEndMail = nil,					-- 周循环活动结束处理奖励标识
 		nWeekHeroID = nil,						-- 周活动-升星英雄ID
 		tWeekHeroPrize = nil,					-- 周活动-升星奖励信息
+		nWeekUseGuYu = nil,						-- 周活动消耗古玉数量
+		tWeekGuYuPrize = nil,					-- 周活动-古玉奖励信息
+		nWeekCardType = nil,					-- 周活动-抽卡当前类型
+		nWeekCardNum = nil,						-- 周活动-抽卡数量
+		tWeekCardPrize = nil,					-- 周活动-抽卡奖励信息
+		realmLv = nil,							--境界
+		RacialTrial = nil,						--种族试炼
 		gift = {
 			unlock = {},
 			online = {}

+ 4 - 0
script/module/role/RoleLogic.lua

@@ -25,6 +25,8 @@ local RoleHeadLogic = require("role.RoleHeadLogic")
 local UnionExcel = require("excel.union")
 local FilterUtil = require("common.FilterUtil")
 local Broadcast = require("broadcast.Broadcast")
+local RoleRealmLogic = require("roleSystem.RoleRealmLogic")
+
 
 FieldRoleBase = {identity=1, name=1, lv=1, vipLv=1, systemSet=1, head=1, headFrame=1, body=1, chenghao=1, unionUuid=1, zhandouli=1, blue=1, yellow=1,birthday = 1,sex = 1,signature = 1}
 local FAKE_HUMAN = {db = nil}
@@ -104,6 +106,8 @@ function getRoleBase(human, net, combatType, isMinNet)
     net.yellow.year = (db and db.yellow and db.yellow.year) and 1 or 0
     net.yellow.lux = (db and db.yellow and db.yellow.lux) and 1 or 0
 
+    net.realmName = RoleRealmLogic.getRealmName(human)
+
     if isMinNet then
        clear2MinNet(db, net)
     end

+ 12 - 0
script/module/roleSystem/Handler.lua

@@ -1,5 +1,7 @@
 local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
 
+local RoleRealmLogic = require("roleSystem.RoleRealmLogic")
+
 function CG_ROLESYSTEM_QUERY(human, msg)
 	
 end
@@ -11,3 +13,13 @@ end
 function CG_ROLESYSTEM_OPEN(human, msg)
    RoleSystemLogic.open(human, msg.id)
 end
+
+
+
+function CG_ROLE_REALM_QUERY(human, msg)
+   RoleRealmLogic.query(human)
+end
+
+function CG_ROLE_REALM_UPGRADE(human, msg)
+   RoleRealmLogic.realmUpgrade(human)
+end

+ 22 - 0
script/module/roleSystem/Proto.lua

@@ -1,3 +1,6 @@
+local ItemData = require("bag.Proto").ItemData
+local Attr = require("role.Proto").Attr
+
 RoleSystemNet = {
 	{"id",			1,	"short"},
 	{"isOpen",		1,	"byte"},--1:开启 0 未开启
@@ -32,4 +35,23 @@ CG_ROLESYSTEM_OPEN = {
 
 GC_ROLESYSTEM_OPEN = {
      {"id",			50,	"short"},
+}
+
+--境界查询
+CG_ROLE_REALM_QUERY = {
+
+}
+
+
+GC_ROLE_REALM_QUERY = {
+	{"nowRealmName",		 1,  "string"}, --当前境界名称
+	{"nowAttrs",			 9,	  Attr},	--当前境界属性加成
+	{"nextRealmName",		 1,  "string"}, --下一境界名称
+    {"nextAttrs",			 9,	  Attr},	--下一境界属性加成
+    {"itemData", 			 1,  ItemData},	--提升下一境界消耗道具
+}
+
+--提升境界
+CG_ROLE_REALM_UPGRADE = {
+
 }

+ 197 - 0
script/module/roleSystem/RoleRealmLogic.lua

@@ -0,0 +1,197 @@
+--境界系统
+--[=[
+    数据库存储数据: human.db.realmLv
+    只存境界等级,境界的属性加成等则是实时计算
+]=]--
+
+local Msg = require("core.Msg")
+local BagLogic = require("bag.BagLogic")
+local realmConfig = require("excel.realm").Sheet1
+local Grid = require("bag.Grid")
+local RoleAttr = require("role.RoleAttr")
+local RoleDefine = require("role.RoleDefine")
+local ObjHuman = require("core.ObjHuman")
+local Util = require("common.Util")
+local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
+local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
+
+local REALM_UPGRADE_LOG = "realmUpgrade"
+
+--加万分比的属性
+local sp_attr = {
+    [201] = 1,
+    [202] = 1,
+    [203] = 1,
+    [204] = 1
+}
+
+local function calAttrSum(tbl, lv)
+    for i = 1, lv do
+        local cfg = realmConfig[i]
+        if cfg and cfg.attrs then
+            for k,v in ipairs(cfg.attrs) do
+                local id = v[1]
+                local value = v[2]
+                tbl[k] = tbl[k] or {}
+                tbl[k].key = id
+                if sp_attr[id] then
+                    tbl[k].value = (tbl[k].value or 0) + (value / 100)
+                else
+                    tbl[k].value = (tbl[k].value or 0) + value
+                end
+            end
+        end
+    end
+end
+
+
+
+local function sendToclient(human)
+    local realmLv = human.db and human.db.realmLv or 0
+    local msgRet = Util.copyTable(Msg.gc.GC_ROLE_REALM_QUERY)
+
+    local bl = false
+    if realmLv <= 0 then
+        bl = true
+        msgRet.nowRealmName = ""
+    end
+
+
+    local nowRealmCfg = bl and realmConfig[1] or realmConfig[realmLv]
+    if not nowRealmCfg then
+        return
+    end
+    if not bl then
+        msgRet.nowRealmName = nowRealmCfg.name
+    end
+    
+    local attrsCfg = nowRealmCfg.attrs
+    msgRet.nowAttrs[0] = #attrsCfg
+
+    if bl then
+        for k,v in ipairs(attrsCfg) do
+            msgRet.nowAttrs[k] = msgRet.nowAttrs[k] or {}
+            msgRet.nowAttrs[k].key = v[1] or 0
+            msgRet.nowAttrs[k].value = 0
+        end
+    else
+        calAttrSum(msgRet.nowAttrs, realmLv)
+    end
+
+    local itemId, itemCnt, nextRealmCfg
+    if realmLv < #realmConfig then
+        nextRealmCfg = realmConfig[realmLv + 1]
+        if not nextRealmCfg then
+            return
+        end
+        itemCnt = nextRealmCfg.itemCnt
+        calAttrSum(msgRet.nextAttrs, realmLv+1)
+    else
+        nextRealmCfg = realmConfig[realmLv]
+        itemCnt = 0
+        calAttrSum(msgRet.nextAttrs, realmLv)
+    end
+    itemId = nextRealmCfg.itemId
+    Grid.makeItem(msgRet.itemData, itemId, itemCnt)
+
+    msgRet.nextRealmName = nextRealmCfg.name
+
+    msgRet.nextAttrs[0] = #nextRealmCfg.attrs
+
+    Msg.send(msgRet, human.fd)
+
+    if BagLogic.getItemCnt(human, itemId) < itemCnt then
+        RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_303)
+    end
+end
+
+
+--境界对属性加成
+function doCalcHero(human, attrs)
+    if not human then
+        return
+    end
+    local realmLv =  human.db and human.db.realmLv or 0
+    if realmLv <= 0 then
+        return
+    end
+    for i=1, realmLv do
+        local singleCfg = realmConfig[i]
+        if singleCfg and singleCfg.attrs then
+            for _, v in ipairs(singleCfg.attrs) do
+                if v[2] > 0 then
+                    RoleAttr.updateValue(v[1], v[2], attrs)
+                end
+            end
+        end
+    end
+end
+
+--获取境界名字
+function getRealmName(human)
+    local name = ""
+    if  human.db and human.db.realmLv then
+        local singleCfg = realmConfig[human.db.realmLv]
+        if singleCfg and singleCfg.name then
+            name = singleCfg.name
+        end
+    end
+    return name
+end
+
+--红点判断
+function isDot(human)
+    local realmLv = human.db.realmLv or 0
+    if realmLv >= #realmConfig then
+        return false
+    end
+
+    local singleCfg = realmConfig[1]
+    if realmLv > 0 then
+        singleCfg = realmConfig[realmLv + 1]
+    end
+    if not singleCfg then
+        return false
+    end
+    local itemId = singleCfg.itemId
+    local itemCnt = singleCfg.itemCnt
+    if BagLogic.getItemCnt(human, itemId) < itemCnt then
+        return false
+    end
+    return true
+end
+
+
+--查询
+function query(human)
+    sendToclient(human)
+end
+
+--提升境界
+function realmUpgrade(human)
+    local realmLv = human.db.realmLv or 0
+
+    if realmLv >= #realmConfig then
+        return
+    end
+
+    realmLv = realmLv + 1
+    local singleCfg = realmConfig[realmLv]
+    if not singleCfg then
+        return
+    end
+
+    local itemId = singleCfg.itemId
+    local itemCnt = singleCfg.itemCnt
+    if not BagLogic.checkItemCnt(human, itemId, itemCnt) then
+        RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_303)
+        return
+    end
+
+    BagLogic.delItem(human, itemId, itemCnt, REALM_UPGRADE_LOG)
+    human.db.realmLv = realmLv
+    sendToclient(human)
+    RoleAttr.cleanHeroAttrCache(human)
+    RoleAttr.doCalc(human)
+    ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
+end

+ 1 - 0
script/module/roleSystem/RoleSystemDefine.lua

@@ -17,6 +17,7 @@ ROLE_SYS_ID_206 =  206  -- 主界面下-背包
 ROLE_SYS_ID_207 =  207  -- 战斗模块-羁绊
 ROLE_SYS_ID_301 =  301  -- 主界面下-英雄
 ROLE_SYS_ID_302 =  302  -- 主界面下-共鸣
+ROLE_SYS_ID_303 =  303  -- 境界系统
 ROLE_SYS_ID_401 =  401  -- 主界面下-召唤-普通友情高级
 ROLE_SYS_ID_402 =  402  -- 主界面下-召唤-先知召唤
 ROLE_SYS_ID_501 =  501  -- 主界面下-寻星502

+ 90 - 4
script/module/skin/SkinLogic.lua

@@ -365,20 +365,25 @@ function skinQuery(human)
        
     end
     msgRet.data[0] = cnt
+    msgRet.isEnd = 1
+    local bSend = false
     local maxLen = #msgRet.list -- 每次最多只能传30个
     cnt = 0
     for id in pairs(SkinExcel) do
         cnt = cnt + 1
         skinNetGen(human,msgRet.list[cnt],id)
-        --[[if cnt >= maxLen then
+        if cnt >= maxLen then
             msgRet.list[0] = maxLen
             cnt = 0
-            msgRet.isEnd = 1
             Msg.send(msgRet,human.fd)
-        end]]
+            msgRet.isEnd = 2
+            bSend = true
+        end
     end
     msgRet.list[0] = cnt
-    msgRet.isEnd = 2
+    if bSend then
+        msgRet.isEnd = 3
+    end
     Msg.send(msgRet,human.fd)
 end
 
@@ -491,4 +496,85 @@ function onFightBegin(human)
             obj.isSysAttrChange = true
         end
     end
+end
+
+-- 登录检测英雄皮肤装备数据
+function OnLoginCheckEquipSkin(human, bSyncClient)
+    if not human then
+        return
+    end
+
+    local skinBag = human.db.skinBag
+    if not skinBag then
+        return
+    end
+
+    -- 检测的英雄
+    local tCheckHero = {}
+    for i = 1,#skinBag do 
+        local data = skinBag[i]
+        local nSkinID = data.id
+
+        local tConfig = SkinExcel[nSkinID]
+        if not tConfig then
+            print("[OnLoginCheckEquipSkin] 严重问题, 找不到对应皮肤的配置 nSkinID = "..nSkinID)
+            break
+        end
+
+        local nHeroID = tConfig.heroId
+        tCheckHero[nHeroID] = tCheckHero[nHeroID] or {}
+
+        -- 找所有皮肤中是否有装备着的
+        local bEquip, nNowSkinID = false, 0
+        for nHaveSkinID, v in pairs(tCheckHero[nHeroID]) do
+            if v == 1 then
+                bEquip = true
+                nNowSkinID = nHaveSkinID
+                break
+            end
+        end
+
+        if data.state == 1 then
+            if false == bEquip then
+                tCheckHero[nHeroID][nSkinID] = 1            -- 装备标识
+
+                -- 所有英雄进行装备皮肤
+                local heroIdxList = HeroLogic.getHeroListById(human, nHeroID)
+                for _,idx in ipairs(heroIdxList) do
+                    human.db.heroBag[idx].skinOn = nSkinID
+                    RoleHeadLogic.setHead(human,tConfig.head,RoleHeadLogic.HEAD_TYPE_1)
+                    if tConfig.body ~= 0 then
+                        RoleHeadLogic.setHead(human,tConfig.body,RoleHeadLogic.HEAD_TYPE_3)
+                    end
+                end
+                print("[OnLoginCheckEquipSkin] 对玩家英雄设置了皮肤 nSkinID = "..nSkinID.." nHeroID = "..nHeroID)
+            else
+                tCheckHero[nHeroID][nSkinID] = 0            -- 未装备标识
+                data.state = 0
+                print("[OnLoginCheckEquipSkin] 同一个英雄穿上了两个皮肤!! 进行修正 nHeroID = "
+                .. nHeroID.." nNowSkinID = "..nNowSkinID .. " nSkinID = "..nSkinID)
+            end
+        else
+            tCheckHero[nHeroID][nSkinID] = 0            -- 未装备标识
+            if false == bEquip then
+                local heroIdxList = HeroLogic.getHeroListById(human, nHeroID)
+                local heroCfg = HeroExcel[nHeroID]
+    
+                for _,idx in ipairs(heroIdxList) do
+                    -- 脱下皮肤 并且还原默认身体 icon和head
+                    human.db.heroBag[idx].skinOn = nil
+                    --local defaultHead = RoleHeadLogic.getDefaultHead(human)
+                    RoleHeadLogic.setHead(human,heroCfg.head,RoleHeadLogic.HEAD_TYPE_1)
+    
+                    RoleHeadLogic.setHead(human,heroCfg.body,RoleHeadLogic.HEAD_TYPE_3)
+                end
+                print("[OnLoginCheckEquipSkin] 对玩家英雄设置取消了皮肤 nHeroID = "..nHeroID.." nSkinID = "..nSkinID)
+            end
+        end
+    end
+
+    if bSyncClient then
+        skinQuery(human)
+        print("[OnLoginCheckEquipSkin] 同步数据结束")
+    end
 end

+ 6 - 2
script/module/xianzhi/XianzhiLogic.lua

@@ -25,6 +25,9 @@ local YunYingLogic = require("yunying.YunYingLogic")
 
 
 local xianzhiOutPutId = 126
+local xianzhiDelitem_Normal = 100
+local xianzhiDelitem_Special = 300
+
 
 local function makeShopElem(human,config)
 
@@ -170,11 +173,11 @@ function zhihuanQuery(human, heroID, heroIndex)
 	local star = heroConfig.star
     if heroConfig.grade ~= 4 or star ~= 5 then return end
 
+	local needItemCnt = xianzhiDelitem_Normal
 	if camp == 4 or camp == 5 then 
-		return 
+		needItemCnt = xianzhiDelitem_Special
 	end
 	
-	local needItemCnt = 100
 	-- 判断消耗
 	local needItemID = ItemDefine.ITEM_XIANZHI_ZHUFU_ID
 	local nowItemCnt = BagLogic.getItemCnt(human, needItemID)
@@ -189,6 +192,7 @@ function zhihuanQuery(human, heroID, heroIndex)
 	local nextHero = zhihuanHero(star, camp,heroGrid.id)
 	if not nextHero then 
 		-- 没有置换目标
+		print("[zhihuanQuery] 没有获取到置换目标 star = "..star.." camp = "..camp.." id = "..heroGrid.id)
 		return 
 	end
 	-- 新ID不等于旧ID

+ 1 - 1
script/module/zhuanpan/Handler.lua

@@ -7,7 +7,7 @@ end
 
 -- 刷新
 function CG_ZHUANPAN_REFRESH(human, msg)
-	ZhuanpanLogic.refresh(human, msg.type, true)
+	ZhuanpanLogic.refresh(human, msg.type, true, true)
 end
 
 -- 抽奖

+ 33 - 9
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     -- 高级转盘
@@ -78,14 +79,18 @@ function query(human, mainType)
 	local oldCnt = getCntByType(human, mainType)
 
 	local oldLuck 
+	local tOldStatus = nil
 	if	human.db.zhuanpan and human.db.zhuanpan[mainType] then 
 		oldLuck = human.db.zhuanpan[mainType].luck
+		if human.db.zhuanpan[mainType].luckStatus then
+			tOldStatus = Util.copyTable(human.db.zhuanpan[mainType].luckStatus)			
+		end
 	end
 	-- 更新 
 	update(human, mainType)
 	
 	-- 初始化
-	initDB(human, mainType, oldCnt,oldLuck)
+	initDB(human, mainType, oldCnt,oldLuck, tOldStatus)
 
     local zuanpan = human.db.zhuanpan[mainType]	
 	
@@ -203,21 +208,25 @@ function query(human, mainType)
 	Msg.send(msgRet, human.fd)
 end
 
-function refresh(human, mainType, needTime)
+function refresh(human, mainType, needTime, bRefreshLuck)
 	if not ZhuanpanExcel[mainType] then
 		return
 	end	
 	
     local oldCnt = getCntByType(human, mainType)
 	local oldLuck 
+	local tOldStatus = nil
 	if	human.db.zhuanpan and human.db.zhuanpan[mainType] then 
 		oldLuck = human.db.zhuanpan[mainType].luck
+		if human.db.zhuanpan[mainType].luckStatus and not bRefreshLuck then
+			tOldStatus = Util.copyTable(human.db.zhuanpan[mainType].luckStatus)			
+		end
 	end
     -- 更新 
 	update(human, mainType)
 	
 	-- 初始化
-	initDB(human, mainType, oldCnt,oldLuck)
+	initDB(human, mainType, oldCnt,oldLuck,tOldStatus)
 	
 	-- 判断是否免费
     if needTime then
@@ -289,14 +298,18 @@ function getReward(human, mainType, cnt)
 	
 	local oldCnt = getCntByType(human, mainType)
 	local oldLuck 
-	if	human.db.zhuanpan and human.db.zhuanpan[mainType] then 
+	local tOldStatus = nil
+	if human.db.zhuanpan and human.db.zhuanpan[mainType] then 
 		oldLuck = human.db.zhuanpan[mainType].luck
+		if human.db.zhuanpan[mainType].luckStatus then
+			tOldStatus = Util.copyTable(human.db.zhuanpan[mainType].luckStatus)			
+		end
 	end
 	-- 更新 
 	update(human, mainType)
 	
 	-- 初始化
-	initDB(human, mainType, oldCnt,oldLuck)
+	initDB(human, mainType, oldCnt,oldLuck, tOldStatus)
 	
 	local zhuanpan = human.db.zhuanpan[mainType]
 	if not BagLogic.checkItemCnt(human, needItemID, needItemCnt) then
@@ -404,6 +417,8 @@ function getReward(human, mainType, cnt)
 
 
     query(human, mainType)
+
+    YunYingLogic.onCallBack(human, "onFindStar", cnt)
 end
 
 -- 购买许愿珠
@@ -501,7 +516,7 @@ function getLuckDrawSingle(human, mainType)
 	end	
 end
 
-function initDB(human, mainType, cnt,oldluck)
+function initDB(human, mainType, cnt, oldluck, tOldStatus)
 	if human.db.zhuanpan ~= nil and 
        human.db.zhuanpan[mainType] ~= nil then 
 		return 
@@ -515,7 +530,12 @@ function initDB(human, mainType, cnt,oldluck)
 	human.db.zhuanpan[mainType].cnt = cnt
 	human.db.zhuanpan[mainType].luck = oldluck
 	human.db.zhuanpan[mainType].free = 1
-	human.db.zhuanpan[mainType].luckStatus = {}
+	if tOldStatus then
+		human.db.zhuanpan[mainType].luckStatus = tOldStatus
+	else
+		human.db.zhuanpan[mainType].luckStatus = {}
+	end
+	
 	addRandomReward(human, mainType)
 end
 
@@ -644,10 +664,14 @@ end
 
 function getFree(human)
 	local oldLuck 
-	if	human.db.zhuanpan and human.db.zhuanpan[DEFAULT_ZHUANPAN_TYPE_NORMAL] then 
+	local tOldStatus = nil
+	if human.db.zhuanpan and human.db.zhuanpan[DEFAULT_ZHUANPAN_TYPE_NORMAL] then 
 		oldLuck = human.db.zhuanpan[DEFAULT_ZHUANPAN_TYPE_NORMAL].luck
+		if human.db.zhuanpan[DEFAULT_ZHUANPAN_TYPE_NORMAL].luckStatus then
+			tOldStatus = Util.copyTable(human.db.zhuanpan[DEFAULT_ZHUANPAN_TYPE_NORMAL].luckStatus)			
+		end
 	end
-    initDB(human,DEFAULT_ZHUANPAN_TYPE_NORMAL,nil,oldLuck)
+    initDB(human,DEFAULT_ZHUANPAN_TYPE_NORMAL,nil, oldLuck,tOldStatus)
     if human.db.zhuanpan[DEFAULT_ZHUANPAN_TYPE_NORMAL].free ~= 1 then
         return
     end