--[[ human.db.absAct[id] = { [buyID] = cnt buyID 对应限购次数 } ]] local AbsActLogic = require("absAct.AbsActLogic") local AbsActExcel = require("excel.absAct") local BuyExcel = require("excel.buy") local BuyLogic = require("topup.BuyLogic") local SpecialCustomLogic = require("absAct.SpecialCustomLogic") local SevenDayLogic = require("absAct.SevenDayLogic") local DrumBlastingLogic = require("absAct.DrumBlastingLogic") function isOpen(human, YYInfo, funcConfig) local state, endTime, startTime = AbsActLogic.isStarted(human, funcConfig.funcID) if not state then return end local absAct = human.db.absAct[funcConfig.funcID] if absAct and absAct.dayCnt and absAct.dayCnt <= 0 and #absAct.item <= 0 then return false end return true, endTime, startTime end function isActive(human, YYInfo, funcConfig) return not isOpen(human, YYInfo, funcConfig) end -- 获得剩余双倍次数 function getDoubleCnt(human, funcID, buyID) local config = AbsActExcel.absActivity[funcID] if not config then return 0 end local doubleConfig = AbsActExcel.doubleCharge[config.actId] if not doubleConfig then return 0 end if not doubleConfig.buyId[buyID] then return 0 end AbsActLogic.checkAbsActClean(human, funcID) local absAct = human.db.absAct[funcID] if not absAct then return 0 end local buyItemConfig = BuyExcel.buy[buyID] -- 不是充值,则返回 if buyItemConfig.cmd ~= "topup" then return 0 end absAct.buyID = absAct.buyID or {} absAct.buyID[buyID] = absAct.buyID[buyID] or 2 return absAct.buyID[buyID] end -- 0点重置 function updateDaily(human, funcID) local state, endTime, starTime = AbsActLogic.isStarted(human, funcID) if not state then return end local config = AbsActExcel.absActivity[funcID] if not config then return end local doubleConfig = AbsActExcel.doubleCharge[config.actId] if not doubleConfig then return 0 end -- 过0点则设置为2次双倍 AbsActLogic.checkAbsActClean(human, funcID) local absAct = human.db.absAct[funcID] for buyID,_ in pairs(doubleConfig.buyId) do absAct.buyID = {} absAct.buyID[buyID] = 2 end end -- 回调 -- 从yunyinglogic 里面调用,故无需判断活动是否开起 -- function buyCall(human,id,buyID) local absAct = human.db.absAct[id] absAct.buyID = absAct.buyID or {} absAct.buyID[buyID] = absAct.buyID[buyID] or 2 absAct.buyID[buyID] = absAct.buyID[buyID] - 1 end