diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 0c9ef2f..4467be1 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -388,6 +388,7 @@ TriggerEventType = { FoodSell = 11, -- 循环卖菜 RuneUp = 12, -- 循环强化符文 CostDiamond = 13, -- 循环消耗钻石 + BuyLimitPack = 14, --购买指定id礼包 触发 } DrawCardType = { diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 37c206b..ffb5400 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -2455,7 +2455,8 @@ function RolePlugin.bind(Role) elseif rechargeData.shop == 3 then -- 礼包商店 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) - --增加购买记录 + self:checkTaskEnter("BuyLimitPack", {id = id}) + --增加购买记录 local buyRecord = self.storeData:getProperty("buyR") or {} buyRecord[id] = (buyRecord[id] or 0) + 1 self.storeData:updateProperty({field = "buyR", value = buyRecord}) diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index 92a0adb..147f3ef 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -116,6 +116,7 @@ local TaskType = { Appoint = 912, -- 触发限时礼包,指定id Rename = 913, -- 重命名 CostJade = 914, -- 消耗虹光玉 + BuyLimitPack = 915, -- 购买指定id礼包触发 --功能未实现 todo AdvShop = 1002, -- 冒险商城 @@ -280,6 +281,7 @@ local StoreListener = { [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, + [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}}, } } diff --git a/src/models/Store.lua b/src/models/Store.lua index e5ca04d..04d0491 100644 --- a/src/models/Store.lua +++ b/src/models/Store.lua @@ -610,56 +610,56 @@ function Store:OnTriggerLimitTimePack(eventType, param) 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 + if not config then return end + + -- 每日循环弹窗 + 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"] = count - end - dayInfo[eventType] = info - self:updateProperty({field = "dayLimitInfo", value = dayInfo}) - if not flag then - return + info["count"] = config.condition - 1 end + else + info["count"] = count end - local rechargeCfg = csvdb["shop_normalCsv"][config.packId] - if rechargeCfg then - limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} - self.owner:log("push_gift", { - gift_id = rechargeCfg.id, --礼包ID - gift_name = rechargeCfg.descId, --礼包名称 - }) - if config.isLoop ~= 0 then - local payR = self:getProperty("payR") - if payR[rechargeCfg.id] then - payR[rechargeCfg.id] = nil - self:updateProperty({field = "payR", value = payR}) - end + dayInfo[eventType] = info + self:updateProperty({field = "dayLimitInfo", value = dayInfo}) + if not flag then + return + end + end + local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId] + if rechargeCfg then + limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} + self.owner:log("push_gift", { + gift_id = rechargeCfg.id, --礼包ID + gift_name = rechargeCfg.descId, --礼包名称 + }) + if config.isLoop ~= 0 then + local payR = self:getProperty("payR") + if payR[rechargeCfg.id] then + payR[rechargeCfg.id] = nil + self:updateProperty({field = "payR", value = payR}) 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 + -- 每日抽卡限时礼包 触发重置 + --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 --if next(result) then -- self:updateProperty({field = "packTrigger", value = triggerRecord}) -- libgit2 0.21.2