Commit 9f21cb8e2899ed40c68133618d30ff5f2b002980

Authored by zhangqijia
1 parent 68f7a264

fix: 修改触发礼包逻辑

触发礼包不走shop_normal了,直接从shop_pack读到shop_recharge
src/GlobalVar.lua
... ... @@ -388,6 +388,7 @@ TriggerEventType = {
388 388 FoodSell = 11, -- 循环卖菜
389 389 RuneUp = 12, -- 循环强化符文
390 390 CostDiamond = 13, -- 循环消耗钻石
  391 + BuyLimitPack = 14, --购买指定id礼包 触发
391 392 }
392 393  
393 394 DrawCardType = {
... ...
src/models/RolePlugin.lua
... ... @@ -2455,7 +2455,8 @@ function RolePlugin.bind(Role)
2455 2455 elseif rechargeData.shop == 3 then -- 礼包商店
2456 2456 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2457 2457  
2458   - --增加购买记录
  2458 + self:checkTaskEnter("BuyLimitPack", {id = id})
  2459 + --增加购买记录
2459 2460 local buyRecord = self.storeData:getProperty("buyR") or {}
2460 2461 buyRecord[id] = (buyRecord[id] or 0) + 1
2461 2462 self.storeData:updateProperty({field = "buyR", value = buyRecord})
... ...
src/models/RoleTask.lua
... ... @@ -116,6 +116,7 @@ local TaskType = {
116 116 Appoint = 912, -- 触发限时礼包,指定id
117 117 Rename = 913, -- 重命名
118 118 CostJade = 914, -- 消耗虹光玉
  119 + BuyLimitPack = 915, -- 购买指定id礼包触发
119 120  
120 121 --功能未实现 todo
121 122 AdvShop = 1002, -- 冒险商城
... ... @@ -280,6 +281,7 @@ local StoreListener = {
280 281 [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}},
281 282 [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}},
282 283 [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}},
  284 + [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}},
283 285 }
284 286 }
285 287  
... ...
src/models/Store.lua
... ... @@ -610,56 +610,56 @@ function Store:OnTriggerLimitTimePack(eventType, param)
610 610 break
611 611 end
612 612 end
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
  613 + if not config then return end
  614 +
  615 + -- 每日循环弹窗
  616 + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1}
  617 + if typeMap[eventType] then
  618 + local dayInfo = self:getProperty("dayLimitInfo")
  619 + local info = dayInfo[eventType] or {}
  620 + local count = (info["count"] or 0) + param
  621 + local triggerCount = info["trigger"] or 0
  622 + local flag = nil
  623 + if count >= config.condition then
  624 + if triggerCount < config.triggerLimit then
  625 + info["trigger"] = triggerCount + 1
  626 + info["count"] = 0
  627 + flag = true
630 628 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
  629 + info["count"] = config.condition - 1
637 630 end
  631 + else
  632 + info["count"] = count
638 633 end
639   - local rechargeCfg = csvdb["shop_normalCsv"][config.packId]
640   - if rechargeCfg then
641   - limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
642   - self.owner:log("push_gift", {
643   - gift_id = rechargeCfg.id, --礼包ID
644   - gift_name = rechargeCfg.descId, --礼包名称
645   - })
646   - if config.isLoop ~= 0 then
647   - local payR = self:getProperty("payR")
648   - if payR[rechargeCfg.id] then
649   - payR[rechargeCfg.id] = nil
650   - self:updateProperty({field = "payR", value = payR})
651   - end
  634 + dayInfo[eventType] = info
  635 + self:updateProperty({field = "dayLimitInfo", value = dayInfo})
  636 + if not flag then
  637 + return
  638 + end
  639 + end
  640 + local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId]
  641 + if rechargeCfg then
  642 + limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
  643 + self.owner:log("push_gift", {
  644 + gift_id = rechargeCfg.id, --礼包ID
  645 + gift_name = rechargeCfg.descId, --礼包名称
  646 + })
  647 + if config.isLoop ~= 0 then
  648 + local payR = self:getProperty("payR")
  649 + if payR[rechargeCfg.id] then
  650 + payR[rechargeCfg.id] = nil
  651 + self:updateProperty({field = "payR", value = payR})
652 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
661   - self:updateProperty({field = "limitTPack", value = limitPack})
662 653 end
  654 + -- 每日抽卡限时礼包 触发重置
  655 + --if eventType == TriggerEventType.DrawHeroCnt then
  656 + -- local payR = self:getProperty("buyR")
  657 + -- if payR[rechargeCfg.id] then
  658 + -- payR[rechargeCfg.id] = nil
  659 + -- self:updateProperty({field = "buyR", value = payR})
  660 + -- end
  661 + --end
  662 + self:updateProperty({field = "limitTPack", value = limitPack})
663 663 end
664 664 --if next(result) then
665 665 -- self:updateProperty({field = "packTrigger", value = triggerRecord})
... ...