diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 6bbaadb..0c9ef2f 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -383,6 +383,11 @@ TriggerEventType = { AfterTs = 7, -- 某时间以后 DrawHeroCnt = 8, -- 每日抽卡次数 Appoint = 0, -- 触发指定id礼包 + SignIn = 9, -- 签到 + DrawHero = 10, -- 循环抽卡 + FoodSell = 11, -- 循环卖菜 + RuneUp = 12, -- 循环强化符文 + CostDiamond = 13, -- 循环消耗钻石 } DrawCardType = { diff --git a/src/actions/StoreAction.lua b/src/actions/StoreAction.lua index 8c91abc..a7b132f 100644 --- a/src/actions/StoreAction.lua +++ b/src/actions/StoreAction.lua @@ -315,7 +315,7 @@ function _M.shopBuyRpc(agent , data) role.storeData:updateProperty({field = "buyR", value = buyRecord}) limitStr = string.format("%s/%s", buyRecord[id], dataSet.limit) end - role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, cint1= dataSet.shop}}) + role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, long1= dataSet.shop}}) local gift = {} for _id, _count in pairs(dataSet.gift:toNumMap()) do diff --git a/src/csvdata b/src/csvdata index 55a28d1..9f69bf3 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 55a28d125f25a0d0b60e5a8cc74b40664aa98f8f +Subproject commit 9f69bf315cfda09d5630d41da958e3f7476ac4fd diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index 245623c..b957211 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -272,6 +272,11 @@ local StoreListener = { [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, [TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroCnt, f("count")}}, [TaskType.Appoint] = {{TriggerEventType.Appoint, f("id")}}, + [TaskType.SignIn] = {{TriggerEventType.SignIn, 1}}, + [TaskType.DrawHero] = {{TriggerEventType.DrawHero, f("count")}}, + [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, + [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, + [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, } } diff --git a/src/models/Store.lua b/src/models/Store.lua index 2834e0a..010280f 100644 --- a/src/models/Store.lua +++ b/src/models/Store.lua @@ -55,6 +55,7 @@ Store.schema = { dailyShop = {"table", {}}, weekShop = {"table", {}}, + dayLimitInfo = {"table", {}}, -- {[id]={count=0, trigger=0}} } function Store:updateProperty(params) @@ -80,6 +81,7 @@ function Store:onCrossDay() --self:sendMonthCardEmail() self:deleteExpireLimitGoods() --self:checkPaySignReward() + self:resetDayLimitPackTriggerCount() --刷新商店 self:flushDailyShop() @@ -219,6 +221,15 @@ function Store:deleteExpireLimitGoods() self:updateProperty({field = "limitTPack", value = limitGoodsList, notNotify = true}) end +-- 每日充值循环限时礼包的触发次数 +function Store:resetDayLimitPackTriggerCount() + local dayLimitInfo = self:getProperty("dayLimitInfo") + for k, v in pairs(dayLimitInfo) do + v['trigger'] = nil + end + self:updateProperty({field = "dayLimitInfo", value = dayLimitInfo, notNotify = true}) +end + -- 发送月卡邮件 function Store:sendMonthCardEmail() local timeNow = skynet.timex() @@ -591,41 +602,40 @@ function Store:OnTriggerLimitTimePack(eventType, param) local limitPack = self:getProperty("limitTPack") --local payRecord = self:getProperty("payR") local timeNow = skynet.timex() - --local find = false - -- 有未过期的限时礼包不再推送 - --for k, v in pairs(limitPack) do - -- if v > timeNow and not payRecord[k] then - -- find = true - -- break - -- end - --end - --if find == true then - -- return - --end - --local hangPass = self.owner:getProperty("hangPass") - --local triggerRecord = self:getProperty("packTrigger") - --local result = {} - --local maxDiff = 0 - -- 取满足限时礼包关卡要求的对应数据 - --for diff, maxCarbonId in pairs(hangPass) do - -- for id, cfg in pairs(csvdb["shop_packCsv"]) do - -- local range = cfg.showRange:toArray(true, "=") - -- local beginRange = range[1] or 0 - -- local endRange = range[2] or 0 - -- if maxCarbonId > beginRange and maxCarbonId <= endRange and cfg.type == eventType then - -- result[diff] = cfg - -- maxDiff = math.max(maxDiff, diff) - -- break - -- end - -- end - --end + local config = nil for id, cfg in pairs(csvdb["shop_packCsv"]) do - if cfg.type == eventType and cfg.condition == param then + if cfg.type == eventType and (cfg.condition == param or cfg.isLoop ~= 0) then config = cfg + break end end if config ~= nil then + -- 每日循环弹窗 + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} + if typeMap[eventType] then + local dayInfo = self:getProperty("dayLimitInfo") + local info = dayInfo[eventType] or {} + local count = (info["count"] or 0) + param + local triggerCount = info["trigger"] or 0 + local flag = nil + if count >= config.condition then + if triggerCount < config.triggerLimit then + info["trigger"] = triggerCount + 1 + info["count"] = 0 + flag = true + else + info["count"] = config.condition - 1 + end + else + info["count"] = count + end + dayInfo[eventType] = info + self:updateProperty({field = "dayLimitInfo", value = dayInfo}) + if not flag then + return + end + end local rechargeCfg = csvdb["shop_normalCsv"][config.packId] if rechargeCfg then limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} @@ -633,14 +643,21 @@ function Store:OnTriggerLimitTimePack(eventType, param) gift_id = rechargeCfg.id, --礼包ID gift_name = rechargeCfg.descId, --礼包名称 }) - -- 每日抽卡限时礼包 触发重置 - if eventType == TriggerEventType.DrawHeroCnt then + if config.isLoop ~= 0 then local payR = self:getProperty("buyR") if payR[rechargeCfg.id] then payR[rechargeCfg.id] = nil self:updateProperty({field = "buyR", value = payR}) end end + -- 每日抽卡限时礼包 触发重置 + --if eventType == TriggerEventType.DrawHeroCnt then + -- local payR = self:getProperty("buyR") + -- if payR[rechargeCfg.id] then + -- payR[rechargeCfg.id] = nil + -- self:updateProperty({field = "buyR", value = payR}) + -- end + --end self:updateProperty({field = "limitTPack", value = limitPack}) end end -- libgit2 0.21.2