Commit b92a81c928e32c2b5615987960a60d6178e1e7bb
1 parent
a29d8377
CB2限时礼包
Showing
5 changed files
with
60 additions
and
33 deletions
Show diff stats
src/GlobalVar.lua
... | ... | @@ -383,6 +383,11 @@ TriggerEventType = { |
383 | 383 | AfterTs = 7, -- 某时间以后 |
384 | 384 | DrawHeroCnt = 8, -- 每日抽卡次数 |
385 | 385 | Appoint = 0, -- 触发指定id礼包 |
386 | + SignIn = 9, -- 签到 | |
387 | + DrawHero = 10, -- 循环抽卡 | |
388 | + FoodSell = 11, -- 循环卖菜 | |
389 | + RuneUp = 12, -- 循环强化符文 | |
390 | + CostDiamond = 13, -- 循环消耗钻石 | |
386 | 391 | } |
387 | 392 | |
388 | 393 | DrawCardType = { | ... | ... |
src/actions/StoreAction.lua
... | ... | @@ -315,7 +315,7 @@ function _M.shopBuyRpc(agent , data) |
315 | 315 | role.storeData:updateProperty({field = "buyR", value = buyRecord}) |
316 | 316 | limitStr = string.format("%s/%s", buyRecord[id], dataSet.limit) |
317 | 317 | end |
318 | - role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, cint1= dataSet.shop}}) | |
318 | + role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, long1= dataSet.shop}}) | |
319 | 319 | |
320 | 320 | local gift = {} |
321 | 321 | for _id, _count in pairs(dataSet.gift:toNumMap()) do | ... | ... |
src/models/RoleTask.lua
... | ... | @@ -272,6 +272,11 @@ local StoreListener = { |
272 | 272 | [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, |
273 | 273 | [TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroCnt, f("count")}}, |
274 | 274 | [TaskType.Appoint] = {{TriggerEventType.Appoint, f("id")}}, |
275 | + [TaskType.SignIn] = {{TriggerEventType.SignIn, 1}}, | |
276 | + [TaskType.DrawHero] = {{TriggerEventType.DrawHero, f("count")}}, | |
277 | + [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, | |
278 | + [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, | |
279 | + [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, | |
275 | 280 | } |
276 | 281 | } |
277 | 282 | ... | ... |
src/models/Store.lua
... | ... | @@ -55,6 +55,7 @@ Store.schema = { |
55 | 55 | |
56 | 56 | dailyShop = {"table", {}}, |
57 | 57 | weekShop = {"table", {}}, |
58 | + dayLimitInfo = {"table", {}}, -- {[id]={count=0, trigger=0}} | |
58 | 59 | } |
59 | 60 | |
60 | 61 | function Store:updateProperty(params) |
... | ... | @@ -80,6 +81,7 @@ function Store:onCrossDay() |
80 | 81 | --self:sendMonthCardEmail() |
81 | 82 | self:deleteExpireLimitGoods() |
82 | 83 | --self:checkPaySignReward() |
84 | + self:resetDayLimitPackTriggerCount() | |
83 | 85 | |
84 | 86 | --刷新商店 |
85 | 87 | self:flushDailyShop() |
... | ... | @@ -219,6 +221,15 @@ function Store:deleteExpireLimitGoods() |
219 | 221 | self:updateProperty({field = "limitTPack", value = limitGoodsList, notNotify = true}) |
220 | 222 | end |
221 | 223 | |
224 | +-- 每日充值循环限时礼包的触发次数 | |
225 | +function Store:resetDayLimitPackTriggerCount() | |
226 | + local dayLimitInfo = self:getProperty("dayLimitInfo") | |
227 | + for k, v in pairs(dayLimitInfo) do | |
228 | + v['trigger'] = nil | |
229 | + end | |
230 | + self:updateProperty({field = "dayLimitInfo", value = dayLimitInfo, notNotify = true}) | |
231 | +end | |
232 | + | |
222 | 233 | -- 发送月卡邮件 |
223 | 234 | function Store:sendMonthCardEmail() |
224 | 235 | local timeNow = skynet.timex() |
... | ... | @@ -591,41 +602,40 @@ function Store:OnTriggerLimitTimePack(eventType, param) |
591 | 602 | local limitPack = self:getProperty("limitTPack") |
592 | 603 | --local payRecord = self:getProperty("payR") |
593 | 604 | local timeNow = skynet.timex() |
594 | - --local find = false | |
595 | - -- 有未过期的限时礼包不再推送 | |
596 | - --for k, v in pairs(limitPack) do | |
597 | - -- if v > timeNow and not payRecord[k] then | |
598 | - -- find = true | |
599 | - -- break | |
600 | - -- end | |
601 | - --end | |
602 | - --if find == true then | |
603 | - -- return | |
604 | - --end | |
605 | - --local hangPass = self.owner:getProperty("hangPass") | |
606 | - --local triggerRecord = self:getProperty("packTrigger") | |
607 | - --local result = {} | |
608 | - --local maxDiff = 0 | |
609 | - -- 取满足限时礼包关卡要求的对应数据 | |
610 | - --for diff, maxCarbonId in pairs(hangPass) do | |
611 | - -- for id, cfg in pairs(csvdb["shop_packCsv"]) do | |
612 | - -- local range = cfg.showRange:toArray(true, "=") | |
613 | - -- local beginRange = range[1] or 0 | |
614 | - -- local endRange = range[2] or 0 | |
615 | - -- if maxCarbonId > beginRange and maxCarbonId <= endRange and cfg.type == eventType then | |
616 | - -- result[diff] = cfg | |
617 | - -- maxDiff = math.max(maxDiff, diff) | |
618 | - -- break | |
619 | - -- end | |
620 | - -- end | |
621 | - --end | |
605 | + | |
622 | 606 | local config = nil |
623 | 607 | for id, cfg in pairs(csvdb["shop_packCsv"]) do |
624 | - if cfg.type == eventType and cfg.condition == param then | |
608 | + if cfg.type == eventType and (cfg.condition == param or cfg.isLoop ~= 0) then | |
625 | 609 | config = cfg |
610 | + break | |
626 | 611 | end |
627 | 612 | end |
628 | 613 | if config ~= nil then |
614 | + -- 每日循环弹窗 | |
615 | + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} | |
616 | + if typeMap[eventType] then | |
617 | + local dayInfo = self:getProperty("dayLimitInfo") | |
618 | + local info = dayInfo[eventType] or {} | |
619 | + local count = (info["count"] or 0) + param | |
620 | + local triggerCount = info["trigger"] or 0 | |
621 | + local flag = nil | |
622 | + if count >= config.condition then | |
623 | + if triggerCount < config.triggerLimit then | |
624 | + info["trigger"] = triggerCount + 1 | |
625 | + info["count"] = 0 | |
626 | + flag = true | |
627 | + else | |
628 | + info["count"] = config.condition - 1 | |
629 | + end | |
630 | + else | |
631 | + info["count"] = count | |
632 | + end | |
633 | + dayInfo[eventType] = info | |
634 | + self:updateProperty({field = "dayLimitInfo", value = dayInfo}) | |
635 | + if not flag then | |
636 | + return | |
637 | + end | |
638 | + end | |
629 | 639 | local rechargeCfg = csvdb["shop_normalCsv"][config.packId] |
630 | 640 | if rechargeCfg then |
631 | 641 | limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} |
... | ... | @@ -633,14 +643,21 @@ function Store:OnTriggerLimitTimePack(eventType, param) |
633 | 643 | gift_id = rechargeCfg.id, --礼包ID |
634 | 644 | gift_name = rechargeCfg.descId, --礼包名称 |
635 | 645 | }) |
636 | - -- 每日抽卡限时礼包 触发重置 | |
637 | - if eventType == TriggerEventType.DrawHeroCnt then | |
646 | + if config.isLoop ~= 0 then | |
638 | 647 | local payR = self:getProperty("buyR") |
639 | 648 | if payR[rechargeCfg.id] then |
640 | 649 | payR[rechargeCfg.id] = nil |
641 | 650 | self:updateProperty({field = "buyR", value = payR}) |
642 | 651 | end |
643 | 652 | end |
653 | + -- 每日抽卡限时礼包 触发重置 | |
654 | + --if eventType == TriggerEventType.DrawHeroCnt then | |
655 | + -- local payR = self:getProperty("buyR") | |
656 | + -- if payR[rechargeCfg.id] then | |
657 | + -- payR[rechargeCfg.id] = nil | |
658 | + -- self:updateProperty({field = "buyR", value = payR}) | |
659 | + -- end | |
660 | + --end | |
644 | 661 | self:updateProperty({field = "limitTPack", value = limitPack}) |
645 | 662 | end |
646 | 663 | end | ... | ... |