Przeglądaj źródła

1.周年庆活动 2.优化背包模块代码

gitxsm 2 dni temu
rodzic
commit
3146b58cee

+ 10 - 5
script/common/ProtoID.lua

@@ -1805,26 +1805,31 @@ _ENV[1843]="CG_HEROARTIFACTS_BESKILLREFINE_UPDATE"
 -- _ENV[1846]="CG_LEVELGIFT_GETREWARD"
 -- _ENV[1847]="GC_GUIDE_CTRATE_AWARD"
 -- _ENV[1848]="CG_GUIDE_CTRATE_AWARD_GET"
-
 _ENV[1849]="CG_BATTLEGIFT_QUERY"
 _ENV[1850]="GC_BATTLEGIFT_QUERY"
 _ENV[1851]="CG_BATTLEGIFT_GET"
-
 -- _ENV[1852]="CG_UNION_CREATE_COND_QUERY" -- 1折版本特有功能
 -- _ENV[1853]="GC_UNION_CREATE_COND_QUERY"
-
 _ENV[1854]="GC_POWERRANK_TOPONE_LOGIN"
-
 _ENV[1855]="CG_RECYCLE_QUERY"
 _ENV[1856]="GC_RECYCLE_QUERY"
 _ENV[1857]="CG_RECYCLE_RECYCLEITEM"
 _ENV[1858]="CG_RECYCLE_GET_RECYCLE_LIST"
 _ENV[1859]="GC_RECYCLE_GET_RECYCLE_LIST"
-
 _ENV[1860]="CG_BATTLE_DAILY_PASSLVEL_INFO_QUERY"
 _ENV[1861]="GC_BATTLE_DAILY_PASSLVEL_INFO_QUERY"
 _ENV[1862]="CG_HUNAGJINGTOWER_DAILY_PASSLVEL_INFO_QUERY"
 _ENV[1863]="GC_HUNAGJINGTOWER_DAILY_PASSLVEL_INFO_QUERY"
+_ENV[1864]="CG_ANNIV_ACTIVE_WHEEL_QUERY"
+_ENV[1865]="GC_ANNIV_ACTIVE_WHEEL_QUERY"
+_ENV[1866]="CG_ANNIV_ACTIVE_WHEEL_SINGLE"
+_ENV[1867]="CG_ANNIV_ACTIVE_WHEEL_TEN"
+_ENV[1868]="GC_ANNIV_ACTIVE_WHEEL_RESULT"
+_ENV[1869]="CG_ANNIV_VOUCHER_WHEEL_QUERY"
+_ENV[1870]="GC_ANNIV_VOUCHER_WHEEL_QUERY"
+_ENV[1871]="CG_ANNIV_VOUCHER_WHEEL_SINGLE"
+_ENV[1872]="CG_ANNIV_VOUCHER_WHEEL_TEN"
+_ENV[1873]="GC_ANNIV_VOUCHER_WHEEL_RESULT"
 
 _ENV[1896]="CG_ZHUANPAN_SUBSCRIBE_REWARD_QUERY"
 _ENV[1897]="GC_ZHUANPAN_SUBSCRIBE_REWARD_QUERY"

+ 2 - 2
script/module/absAct/AbsActLogic.lua

@@ -102,7 +102,7 @@ function onLogin(human)
             human.db.absAct[k] = {}
             local f = load("return require(\"" .. v.moduleFn .. "\")")()
             if f and f.genAbsActData then 
-                human.db.absAct[k] = f.genAbsActData(v)
+                human.db.absAct[k] = f.genAbsActData(v, human)
             end
             human.db.absAct[k].finish = realEndTime -- 记录活动结束时间
 
@@ -316,7 +316,7 @@ function actDetailQuery(human, id)
             -- 模块不存在,使用空数据继续
             human.db.absAct[id].finish = realEndTime
         elseif f and f.genAbsActData then
-            human.db.absAct[id] = f.genAbsActData(config)
+            human.db.absAct[id] = f.genAbsActData(config, human)
             human.db.absAct[id].finish = realEndTime -- 记录活动结束时间
         else
             human.db.absAct[id].finish = realEndTime

+ 179 - 0
script/module/absAct/AnniversaryActiveWheel.lua

@@ -0,0 +1,179 @@
+-- 周年活动 - 活跃转转乐
+-- db
+--[=[
+    human.db.absAct[ACT_ID] = {
+        lotteryTimes = 0,  -- 可用抽奖次数(日常/每周达100活跃各+1,可叠加)
+    }
+]=]--
+
+local Msg          = require("core.Msg")
+local Grid         = require("bag.Grid")
+local BagLogic     = require("bag.BagLogic")
+local AbsActLogic  = require("absAct.AbsActLogic")
+local Broadcast    = require("broadcast.Broadcast")
+local Lang         = require("common.Lang")
+local YunYingLogic = require("yunying.YunYingLogic")
+local AbsActExcel  = require("excel.absAct")
+local RewardCfg    = require("excel.anniversaryAct").activeWheel  -- 活跃转转乐奖励配置表
+
+local LOGTYPE = "AnniversaryActiveWheel"
+local ACT_ID  = 7701  -- 活跃转转乐活动ID(按实际分配)
+
+
+local function getData(human)
+    return human.db.absAct[ACT_ID]
+end
+
+local function addTimes(human, val)
+    local d = getData(human)
+    d.lotteryTimes = (d.lotteryTimes or 0) + val
+end
+
+
+local function isOpenAct(human, funcID)
+    return AbsActLogic.isStarted(human, funcID or ACT_ID)
+end
+
+local function updateRedDot(human)
+    YunYingLogic.sendBanner(human)
+    local config = AbsActExcel.absActivity[ACT_ID]
+    YunYingLogic.sendGroupUpdate(YYInfo[ACT_ID], human, config.panelID)
+end
+
+local function doLottery()
+    local totalWeight = 0
+    for _, row in ipairs(RewardCfg) do
+        totalWeight = totalWeight + row.nWeight
+    end
+    if totalWeight <= 0 then return 0 end
+
+    local r, acc = math.random(1, totalWeight), 0
+    for i, row in ipairs(RewardCfg) do
+        acc = acc + row.nWeight
+        if r <= acc then return i end
+    end
+    return 0
+end
+
+local function doMultiLottery(count)
+    local results = {}
+    for _ = 1, count do
+        local idx = doLottery()
+        if idx == 0 then return nil end
+        local row = RewardCfg[idx]
+        results[#results + 1] = { itemId = row.reward[1], itemNum = row.reward[2] }
+    end
+    return results
+end
+
+
+function genAbsActData(config, human)
+    local times = 0
+    local DailyTaskLogic = require("dailyTask.DailyTaskLogic")
+    local isReach = DailyTaskLogic.isReachMaxDailyHuoYue(human)
+    if isReach then
+        times = times + 1
+    end
+
+    isReach = false
+
+    local WeekTaskLogic = require("dailyTask.WeekTaskLogic")
+    isReach = WeekTaskLogic.isReachMaxWeekHuoYue(human)
+    if isReach then
+        times = times + 1
+    end
+
+    return { lotteryTimes = times }
+end
+
+function isRed(human, YYInfo, funcConfig)
+    if not isOpenAct(human, funcConfig and funcConfig.funcID) then return false end
+    local d = getData(human)
+    if not d then return false end
+    return (d.lotteryTimes or 0) > 0
+end
+
+function isOpen(human, YYInfo, funcConfig)
+    return isOpenAct(human, funcConfig and funcConfig.funcID)
+end
+
+function isActive(human, YYInfo, funcConfig)
+    return not isOpen(human, YYInfo, funcConfig)
+end
+
+-- 触发入口:日常/每周任务达100活跃
+function OnHuoYueReach100(human)
+    if not isOpenAct(human) then return end
+    addTimes(human, 1)
+    updateRedDot(human)
+end
+
+
+function ActiveWheel_Query(human)
+    if not isOpenAct(human) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
+
+    local d = getData(human)
+    local _, endTime, startTime = isOpenAct(human)  -- 取活动起止时间
+
+    local msgRet = Msg.gc.GC_ANNIV_ACTIVE_WHEEL_QUERY
+    msgRet.lotteryTimes = d.lotteryTimes or 0
+    msgRet.startTime    = startTime or 0
+    msgRet.endTime      = endTime   or 0
+
+    -- 下发完整奖励配置表,客户端据此渲染转盘格子
+    msgRet.rewardList[0] = 0
+    for i, row in ipairs(RewardCfg) do
+        msgRet.rewardList[0] = i
+        Grid.makeItem(msgRet.rewardList[i].item, row.reward[1], row.reward[2])
+        msgRet.rewardList[i].weight = row.nWeight
+    end
+
+    Msg.send(msgRet, human.fd)
+end
+
+local function doSpin(human, count)
+    if not isOpenAct(human) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
+
+    local d = getData(human)
+    local curTimes = d.lotteryTimes or 0
+    if curTimes < count then
+        return Broadcast.sendErr(human, Lang.JINBI_EXCHANGE_ERR_CNT)
+    end
+
+    local results = doMultiLottery(count)
+    if not results then
+        return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
+    end
+
+    -- 扣除次数
+    d.lotteryTimes = curTimes - count
+
+    for _, res in ipairs(results) do
+        BagLogic.addItem(human, res.itemId, res.itemNum, LOGTYPE)
+    end
+
+    -- 通知客户端抽奖结果(客户端根据此结果播放动画)
+    local msgRet = Msg.gc.GC_ANNIV_ACTIVE_WHEEL_RESULT
+    msgRet.count      = count
+    msgRet.results[0] = 0
+    for i, res in ipairs(results) do
+        msgRet.results[0] = i
+        Grid.makeItem(msgRet.results[i], res.itemId, res.itemNum)
+    end
+    msgRet.lotteryTimes      = d.lotteryTimes
+    Msg.send(msgRet, human.fd)
+
+    updateRedDot(human)
+end
+
+function ActiveWheel_Single(human)
+    doSpin(human, 1)
+end
+
+function ActiveWheel_Ten(human)
+    doSpin(human, 10)
+end

+ 213 - 0
script/module/absAct/AnniversaryVoucherWheel.lua

@@ -0,0 +1,213 @@
+-- 周年活动 - 代金转转乐
+-- db
+--[=[
+    human.db.absAct[ACT_ID] = {
+        lotteryTimes   = 0,  -- 可用抽奖次数(每累充100元+1,可叠加,活动结束清空)
+        totalRecharge  = 0,  -- 活动期间累充总额(跨天持续累加)
+        processedDaily = 0,  -- 本日已从 topupAcountDaily 处理过的金额,跨天由 updateDaily 清零
+    }
+]=]--
+
+local Msg          = require("core.Msg")
+local Grid         = require("bag.Grid")
+local BagLogic     = require("bag.BagLogic")
+local AbsActLogic  = require("absAct.AbsActLogic")
+local Broadcast    = require("broadcast.Broadcast")
+local Lang         = require("common.Lang")
+local YunYingLogic = require("yunying.YunYingLogic")
+local AbsActExcel  = require("excel.absAct")
+local RewardCfg    = require("excel.anniversaryAct").voucherWheel
+local variablesCfg = require("excel.anniversaryAct").var
+
+local LOGTYPE      = "AnniversaryVoucherWheel"
+local ACT_ID       = 7702
+
+
+local function getData(human)
+    return human.db.absAct[ACT_ID]
+end
+
+local function addTimes(human, val)
+    local d = getData(human)
+    d.lotteryTimes = (d.lotteryTimes or 0) + val
+end
+
+
+local function isOpenAct(human, funcID)
+    return AbsActLogic.isStarted(human, funcID or ACT_ID)
+end
+-- 每累充x, 获得1次机会
+local function getRechargeUnit()
+    local cfg = variablesCfg[1]
+    return cfg.rechargeUnit
+end
+
+local function updateRedDot(human)
+    YunYingLogic.sendBanner(human)
+    local config = AbsActExcel.absActivity[ACT_ID]
+    YunYingLogic.sendGroupUpdate(YYInfo[ACT_ID], human, config.panelID)
+end
+
+local function doLottery()
+    local totalWeight = 0
+    for _, row in ipairs(RewardCfg) do
+        totalWeight = totalWeight + row.nWeight
+    end
+    if totalWeight <= 0 then return 0 end
+
+    local r, acc = math.random(1, totalWeight), 0
+    for i, row in ipairs(RewardCfg) do
+        acc = acc + row.nWeight
+        if r <= acc then return i end
+    end
+    return 0
+end
+
+local function doMultiLottery(count)
+    local results = {}
+    for _ = 1, count do
+        local idx = doLottery()
+        if idx == 0 then return nil end
+        local row = RewardCfg[idx]
+        results[#results + 1] = { itemId = row.reward[1], itemNum = row.reward[2] }
+    end
+    return results
+end
+
+
+-- config 为第一参数(框架固定传入),human 为新增第二参数
+function genAbsActData(config, human)
+    local initRecharge = (human and human.db.topupAcountDaily) or 0
+    local rechargeUnit = getRechargeUnit()
+    local initTimes    = math.floor(initRecharge / rechargeUnit)
+    return {
+        lotteryTimes   = initTimes,    -- 活动开启前当天已充的次数直接算入
+        totalRecharge  = initRecharge, -- 以当天已充金额为起点
+        processedDaily = initRecharge, -- 标记已处理到此刻,避免 onCharge 重复计算
+    }
+end
+
+-- 跨天回调(玩家在线或上线时由框架调用一次)
+-- topupAcountDaily 已跨天清零,同步重置 processedDaily,确保 onCharge 计算正确
+function updateDaily(human, funcID)
+    if not isOpenAct(human, funcID) then return end
+    local d = getData(human)
+    if not d then return end
+    d.processedDaily = 0
+end
+
+function isRed(human, YYInfo, funcConfig)
+    if not isOpenAct(human, funcConfig and funcConfig.funcID) then return false end
+    local d = getData(human)
+    if not d then return false end
+    return (d.lotteryTimes or 0) > 0
+end
+
+function isOpen(human, YYInfo, funcConfig)
+    return isOpenAct(human, funcConfig and funcConfig.funcID)
+end
+
+function isActive(human, YYInfo, funcConfig)
+    return not isOpen(human, YYInfo, funcConfig)
+end
+
+
+
+-- 充值回调
+-- 框架在充值成功并更新 topupAcountDaily 后自动调用
+-- 活动开启当天0点起计算,活动开启前当天的充值因 processedDaily=0 会在首次触发时自动补算
+function onCharge(human, price, funcID, buyID, buyNum)
+    if not isOpenAct(human) then return end
+
+    local d          = getData(human)
+    local dailyTotal = human.db.topupAcountDaily  -- 今日0点起累计(已含本次充值)
+    local processed  = d.processedDaily or 0
+
+    local delta = dailyTotal - processed
+    if delta <= 0 then return end
+
+    local oldTotal   = d.totalRecharge or 0
+    local newTotal   = oldTotal + delta
+    d.totalRecharge  = newTotal
+    d.processedDaily = dailyTotal
+
+    local rechargeUnit = getRechargeUnit()
+    local oldTimes = math.floor(oldTotal  / rechargeUnit)
+    local newTimes = math.floor(newTotal  / rechargeUnit)
+    local gained   = newTimes - oldTimes
+
+    if gained > 0 then
+        addTimes(human, gained)
+        updateRedDot(human)
+    end
+end
+
+function VoucherWheel_Query(human)
+    if not isOpenAct(human) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
+
+    local d = getData(human)
+    local _, endTime, startTime = isOpenAct(human)
+
+    local msgRet = Msg.gc.GC_ANNIV_VOUCHER_WHEEL_QUERY
+    msgRet.lotteryTimes  = d.lotteryTimes  or 0
+    msgRet.totalRecharge = d.totalRecharge or 0
+    msgRet.startTime     = startTime or 0
+    msgRet.endTime       = endTime   or 0
+
+    -- 下发完整奖励配置表
+    msgRet.rewardList[0] = 0
+    for i, row in ipairs(RewardCfg) do
+        msgRet.rewardList[0] = i
+        Grid.makeItem(msgRet.rewardList[i].item, row.reward[1], row.reward[2])
+        msgRet.rewardList[i].weight = row.nWeight
+    end
+
+    Msg.send(msgRet, human.fd)
+end
+
+local function doSpin(human, count)
+    if not isOpenAct(human) then
+        return Broadcast.sendErr(human, Lang.YUNYING_ERR_TIME)
+    end
+
+    local d = getData(human)
+    local curTimes = d.lotteryTimes or 0
+    if curTimes < count then
+        return Broadcast.sendErr(human, Lang.JINBI_EXCHANGE_ERR_CNT)
+    end
+
+    local results = doMultiLottery(count)
+    if not results then
+        return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
+    end
+
+    d.lotteryTimes = curTimes - count
+
+    for _, res in ipairs(results) do
+        BagLogic.addItem(human, res.itemId, res.itemNum, LOGTYPE)
+    end
+
+    -- 告知客户端完整结果列表,客户端据此播放动画
+    local msgRet = Msg.gc.GC_ANNIV_VOUCHER_WHEEL_RESULT
+    msgRet.count      = count
+    msgRet.results[0] = 0
+    for i, res in ipairs(results) do
+        msgRet.results[0] = i
+        Grid.makeItem(msgRet.results[i], res.itemId, res.itemNum)
+    end
+    msgRet.lotteryTimes      = d.lotteryTimes
+
+    Msg.send(msgRet, human.fd)
+
+    updateRedDot(human)
+end
+
+function VoucherWheel_Single(human)
+    doSpin(human, 1)
+end
+
+function VoucherWheel_Ten(human)
+    doSpin(human, 10)
+end

+ 24 - 0
script/module/absAct/Handler.lua

@@ -52,6 +52,8 @@ local CommonActCharge = require("absAct.CommonActCharge")
 local CommonActFindTreasure = require("absAct.CommonActFindTreasure")
 local CommonActLoginGift = require("absAct.CommonActLoginGift")
 local CommonActMoneyTree = require("absAct.CommonActMoneyTree")
+local AnniversaryActiveWheel  = require("absAct.AnniversaryActiveWheel")
+local AnniversaryVoucherWheel = require("absAct.AnniversaryVoucherWheel")
 
 function CG_ABS_ACT_DETAIL_QUERY(human, msg)
     -- local Log = require("common.Log")
@@ -537,4 +539,26 @@ end
 
 function CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE(human, msg)
     CommonActMoneyTree.CommonActMoneyTree_EnterLotteryStage(human)
+end
+
+
+
+function CG_ANNIV_ACTIVE_WHEEL_QUERY(human, msg)
+    AnniversaryActiveWheel.ActiveWheel_Query(human)
+end
+function CG_ANNIV_ACTIVE_WHEEL_SINGLE(human, msg)
+    AnniversaryActiveWheel.ActiveWheel_Single(human)
+end
+function CG_ANNIV_ACTIVE_WHEEL_TEN(human, msg)
+    AnniversaryActiveWheel.ActiveWheel_Ten(human)
+end
+----------------------------------------------------周年活动 — 代金转转乐 --------------------------------------------------
+function CG_ANNIV_VOUCHER_WHEEL_QUERY(human, msg)
+    AnniversaryVoucherWheel.VoucherWheel_Query(human)
+end
+function CG_ANNIV_VOUCHER_WHEEL_SINGLE(human, msg)
+    AnniversaryVoucherWheel.VoucherWheel_Single(human)
+end
+function CG_ANNIV_VOUCHER_WHEEL_TEN(human, msg)
+    AnniversaryVoucherWheel.VoucherWheel_Ten(human)
 end

+ 36 - 1
script/module/absAct/Proto.lua

@@ -1692,4 +1692,39 @@ GC_ABS_COMONACT_MONEYTREE_LOTTERY = {
 CG_ABS_COMONACT_MONEYTREE_GET_REWARD = {}
 
 -- 进入摇树阶段
-CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE = {}
+CG_ABS_COMONACT_MONEYTREE_LOTTERY_STAGE = {}
+
+---------------------周年活动 - 活跃转转乐 & 代金转转乐 -------------------
+
+-- 活跃转转乐 查询
+CG_ANNIV_ACTIVE_WHEEL_QUERY = {}
+GC_ANNIV_ACTIVE_WHEEL_QUERY = {
+    {"lotteryTimes",    1,  "short"},         -- 剩余次数
+    {"rewardList",      20, ItemData},        -- 转盘奖励配置表
+}
+
+-- 活跃转转乐 单抽 / 十连
+CG_ANNIV_ACTIVE_WHEEL_SINGLE = {}
+CG_ANNIV_ACTIVE_WHEEL_TEN    = {}
+GC_ANNIV_ACTIVE_WHEEL_RESULT = {
+    {"count",   1,  "byte"},    -- 本次抽取数量
+    {"results", 10, ItemData},  -- 抽奖结果列表(客户端据此播动画)
+    {"lotteryTimes",    1,  "short"},           -- 剩余次数
+}
+
+-- 代金转转乐 查询
+CG_ANNIV_VOUCHER_WHEEL_QUERY = {}
+GC_ANNIV_VOUCHER_WHEEL_QUERY = {
+    {"lotteryTimes",    1,  "short"},           -- 剩余次数
+    {"totalRecharge",   1,  "double"},          -- 活动期间累充金额
+    {"rewardList",      20, ItemData},        -- 转盘奖励配置表
+}
+
+-- 代金转转乐 单抽 / 十连
+CG_ANNIV_VOUCHER_WHEEL_SINGLE = {}
+CG_ANNIV_VOUCHER_WHEEL_TEN    = {}
+GC_ANNIV_VOUCHER_WHEEL_RESULT = {
+    {"count",   1,  "byte"},    -- 本次抽取数量
+    {"results", 10, ItemData},  -- 抽奖结果列表(客户端据此播动画)
+    {"lotteryTimes",    1,  "short"},           -- 剩余次数
+}

+ 36 - 46
script/module/bag/BagLogic.lua

@@ -75,55 +75,45 @@ function addMomentItemList(human, logType, noSend)
 end
 
 -- 通用道具添加 {[1] = {id, cnt}, [2] = {id,cnt}} or {[itemID] = itemCnt}  配表复杂 各自接口下自己for 添加
-function addItemList(human,  list, logType, noSend)
-	if not list or next(list) == nil then return end
-
-	list = Util.copyTable(list)
-
-	if list[1] and list[1][1] then
-		local extraItemList = {}
-		for _, item in ipairs(list) do
-			addItem(human, item[1], item[2], logType, noSend, item[3])
-
-			local extraItemInfo = RoleStorageBox.GetExtraItem(human, item[1], item[2], logType)
-			if extraItemInfo then
-				table.insert(extraItemList, extraItemInfo)
-			end
-		end
-
-		-- 额外道具的处理
-		for _, extraItem in ipairs(extraItemList) do
-			table.insert(list, extraItem)
-			addItem(human, extraItem[1], extraItem[2], logType, noSend, extraItem[3])
-		end
-
-	else
-		local newList
-		for itemID, itemCnt in pairs(list) do
-			-- addItem(human, itemID, itemCnt, logType, noSend)
-
-			local extraItemInfo = RoleStorageBox.GetExtraItem(human, itemID, itemCnt, logType)
-			if extraItemInfo then
-				itemCnt = itemCnt + extraItemInfo[2]
-
-				newList = newList or {}
-				newList[itemID] = {
-					[2] = itemCnt, -- 兼容之前代码, 防止有ID为1的道具
-					[4] = extraItemInfo[4]
-				}
-			end
+function addItemList(human, list, logType, noSend)
+    if not list or next(list) == nil then return end
+
+    local sendList = {}  -- 专门用于展示,不改原始 list
+
+    if list[1] and list[1][1] then
+        -- 顺序列表格式
+        local extraItemList = {}
+        for _, item in ipairs(list) do
+            addItem(human, item[1], item[2], logType, noSend, item[3])
+            table.insert(sendList, item)
+
+            local extraItemInfo = RoleStorageBox.GetExtraItem(human, item[1], item[2], logType)
+            if extraItemInfo then
+                table.insert(extraItemList, extraItemInfo)
+            end
+        end
 
-			addItem(human, itemID, itemCnt, logType, noSend)
-		end
+        for _, extraItem in ipairs(extraItemList) do
+            table.insert(sendList, extraItem)             -- 先加入 sendList
+            addItem(human, extraItem[1], extraItem[2], logType, noSend)  -- 去掉错误的 extraItem[3]
+        end
 
-		if newList then
-			for itemId, itemInfo in pairs(newList) do
-				list[itemId] = itemInfo
-			end
-		end
-	end
+    else
+        -- key-value 格式(相同ID已合并),extra 也合并进同一次 addItem
+        for itemID, itemCnt in pairs(list) do
+            local extraItemInfo = RoleStorageBox.GetExtraItem(human, itemID, itemCnt, logType)
+            if extraItemInfo then
+                local mergedCnt = itemCnt + extraItemInfo[2]
+                addItem(human, itemID, mergedCnt, logType, noSend)
+                sendList[itemID] = { [2] = mergedCnt, [4] = extraItemInfo[4] }
+            else
+                addItem(human, itemID, itemCnt, logType, noSend)
+                sendList[itemID] = itemCnt
+            end
+        end
+    end
 
-	sendItemGetList(human, list, logType)
+    sendItemGetList(human, sendList, logType)
 end
 
 -- 增加装备,道具

+ 25 - 0
script/module/dailyTask/DailyTaskLogic.lua

@@ -16,6 +16,7 @@ local WeekTaskLogic = require("dailyTask.WeekTaskLogic")
 local HonorTaskLogic = require("dailyTask.HonorJourney")
 
 local CommonActMoneyTree
+local AnniversaryActiveWheel
 
 DAILY_TASK_ID_1  = 1  --日常登陆1次 o
 DAILY_TASK_ID_2  = 2  --赠送友情点5次 o
@@ -374,6 +375,13 @@ function isDot(human)
 	return false
 end
 
+local function getMaxDailyHuoYue()
+	local finallyIdx = #DailyTaskExcel.huoYueBox
+	local finallyCfg = DailyTaskExcel.huoYueBox[finallyIdx]
+	return finallyCfg.needHuoYue
+end
+
+
 function onDailyTaskHuoYue(human,sum)
 	if not human.db.dailyTask then return end
 
@@ -387,6 +395,11 @@ function onDailyTaskHuoYue(human,sum)
 	-- 	CommonActMoneyTree = CommonActMoneyTree or require("absAct.CommonActMoneyTree")
 	-- 	CommonActMoneyTree.CompleteHuoYueTask(human)
 	-- end
+
+	if isReachMaxDailyHuoYue(human) then
+		AnniversaryActiveWheel = AnniversaryActiveWheel or require("absAct.AnniversaryActiveWheel")
+		AnniversaryActiveWheel.OnHuoYueReach100(human)
+	end
 end
 
 function onLogin(human)	
@@ -400,4 +413,16 @@ end
 
 function Gm_AddHuoYue(human, nAddNum)
 	onDailyTaskHuoYue(human, nAddNum)
+end
+
+
+function GetDailyHuoYue(human)
+	local num = human.db.dailyTask and human.db.dailyTask.nowHuoYue or 0
+	return num
+end
+
+function isReachMaxDailyHuoYue(human)
+	local curVal = GetDailyHuoYue(human)
+	local maxVal = getMaxDailyHuoYue()
+	return curVal >= maxVal
 end

+ 24 - 0
script/module/dailyTask/WeekTaskLogic.lua

@@ -14,6 +14,8 @@ local ChengjiuDefine = require("chengjiu.ChengjiuDefine")
 local YunYingLogic = require("yunying.YunYingLogic")
 local WeekTaskExcel = require("excel.weekTask")
 
+local AnniversaryActiveWheel
+
 -- weekTask = {
      -- task ={ id  =  isGet,finiscnt,state}
 
@@ -311,12 +313,23 @@ function isDot(human)
 	return false
 end
 
+local function getMaxWeekHuoYue()
+	local finallyIdx = #WeekTaskExcel.huoYueBox
+	local finallyCfg = WeekTaskExcel.huoYueBox[finallyIdx]
+	return finallyCfg.needHuoYue
+end
+
 function onWeekTaskHuoYue(human,sum)
 	if not human.db.weekTask then return end
 	print("当前进入添加活跃度",sum)
 	human.db.weekTask.nowHuoYue = (human.db.weekTask.nowHuoYue or 0) + sum
 
     YunYingLogic.onCallBack(human, "onDailyTask",sum)   
+
+	if isReachMaxWeekHuoYue(human) then
+		AnniversaryActiveWheel = AnniversaryActiveWheel or require("absAct.AnniversaryActiveWheel")
+		AnniversaryActiveWheel.OnHuoYueReach100(human)
+	end
 end
 
 function WeekTaskLogic_Refsh(human)
@@ -339,4 +352,15 @@ end
 
 function onLogin(human)	
 	WeekTaskLogic_Refsh(human)
+end
+
+function GetWeekHuoYue(human)
+	local num = human.db.weekTask and human.db.weekTask.nowHuoYue or 0
+	return num
+end
+
+function isReachMaxWeekHuoYue(human)
+	local curVal = GetWeekHuoYue(human)
+	local maxVal = getMaxWeekHuoYue()
+	return curVal >= maxVal
 end