Commit b454725afc7b8d10c46cceaa346eb09980a3508f

Authored by zhangqijia
1 parent 81941afd

feat: 英雄精进触发礼包, 修复月卡购买的一些bug

@@ -389,6 +389,7 @@ TriggerEventType = { @@ -389,6 +389,7 @@ TriggerEventType = {
389 RuneUp = 12, -- 循环强化符文 389 RuneUp = 12, -- 循环强化符文
390 CostDiamond = 13, -- 循环消耗钻石 390 CostDiamond = 13, -- 循环消耗钻石
391 BuyLimitPack = 14, --购买指定id礼包 触发 391 BuyLimitPack = 14, --购买指定id礼包 触发
  392 + HeroTalent = 15, --英雄精进 触发礼包
392 } 393 }
393 394
394 DrawCardType = { 395 DrawCardType = {
src/actions/HeroAction.lua
@@ -212,7 +212,7 @@ function _M.talentRpc(agent, data) @@ -212,7 +212,7 @@ function _M.talentRpc(agent, data)
212 talent = talent:setv(1, curLevel + 1) 212 talent = talent:setv(1, curLevel + 1)
213 end 213 end
214 curStage = talent:getv(0, 1) 214 curStage = talent:getv(0, 1)
215 - role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage}) 215 + role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage, count = 1})
216 216
217 hero:updateProperty({field = "talent", value = talent}) 217 hero:updateProperty({field = "talent", value = talent})
218 218
src/models/RoleTask.lua
@@ -282,6 +282,7 @@ local StoreListener = { @@ -282,6 +282,7 @@ local StoreListener = {
282 [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, 282 [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}},
283 [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, 283 [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}},
284 [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}}, 284 [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}},
  285 + [TaskType.HeroTalent] = {{TriggerEventType.HeroTalent, f("count")}},
285 } 286 }
286 } 287 }
287 288
src/models/Store.lua
@@ -96,8 +96,15 @@ function Store:refreshWeekData(notify) @@ -96,8 +96,15 @@ function Store:refreshWeekData(notify)
96 self:flushWeekShop() 96 self:flushWeekShop()
97 end 97 end
98 98
  99 +
  100 +local function getSMonthCardPeriods(self, id)
  101 + local smonthCards = self:getProperty("smonthCards") or {}
  102 + local smonthCard = smonthCards[id] or {}
  103 + return smonthCard["periods"] or 0
  104 +end
  105 +
99 local function getCardItemDailyReward(self, id) 106 local function getCardItemDailyReward(self, id)
100 - local cur_ex = self:getSMonthCardPeriods(self, id) 107 + local cur_ex = getSMonthCardPeriods(self, id)
101 if cur_ex == 0 then return nil, nil end 108 if cur_ex == 0 then return nil, nil end
102 cur_ex = cur_ex - 1 109 cur_ex = cur_ex - 1
103 110
@@ -293,8 +300,8 @@ end @@ -293,8 +300,8 @@ end
293 function Store:getSMonthCardDailyReward(id) 300 function Store:getSMonthCardDailyReward(id)
294 if not id then return nil end 301 if not id then return nil end
295 302
296 - local before_ex = self:getSMonthCardPeriods(self, id)  
297 - local reward, change, cur_ex= getCardItemDailyReward(id) 303 + local before_ex = getSMonthCardPeriods(self, id)
  304 + local reward, change, cur_ex= getCardItemDailyReward(self, id)
298 305
299 --今日特刊奖励已经领取 306 --今日特刊奖励已经领取
300 self:updateProperty({field = "smonthCardReceive", value = 1}) 307 self:updateProperty({field = "smonthCardReceive", value = 1})
@@ -330,14 +337,8 @@ function Store:firstBuySMonthCard(id) @@ -330,14 +337,8 @@ function Store:firstBuySMonthCard(id)
330 return nil 337 return nil
331 end 338 end
332 339
333 -function Store:getSMonthCardPeriods(id)  
334 - local smonthCards = self:getProperty("smonthCards") or {}  
335 - local smonthCard = smonthCards[id] or {}  
336 - return smonthCard["periods"] or 0  
337 -end  
338 -  
339 function Store:isSMonthCardExpired(id) 340 function Store:isSMonthCardExpired(id)
340 - return self:getSMonthCardPeriods(id) == 0 341 + return getSMonthCardPeriods(self, id) == 0
341 end 342 end
342 343
343 function Store:buySMonthCardLimit(buylimit) 344 function Store:buySMonthCardLimit(buylimit)
@@ -627,7 +628,7 @@ function Store:OnTriggerLimitTimePack(eventType, param) @@ -627,7 +628,7 @@ function Store:OnTriggerLimitTimePack(eventType, param)
627 if not config then return end 628 if not config then return end
628 629
629 -- 每日循环弹窗 630 -- 每日循环弹窗
630 - local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} 631 + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1, [TriggerEventType.HeroTalent] = 1}
631 if typeMap[eventType] then 632 if typeMap[eventType] then
632 local dayInfo = self:getProperty("dayLimitInfo") 633 local dayInfo = self:getProperty("dayLimitInfo")
633 local info = dayInfo[eventType] or {} 634 local info = dayInfo[eventType] or {}