From 041ee0b2b3df6727fef3a6c9490b918cc7c5ca4f Mon Sep 17 00:00:00 2001 From: zqj <582132116@qq.com> Date: Mon, 7 Jun 2021 14:06:29 +0800 Subject: [PATCH] fix: 挂机图鉴的bug --- src/actions/HangAction.lua | 4 ++-- src/models/Daily.lua | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 0de3f91..3671973 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -128,8 +128,8 @@ local function checkReward(role, isTreasure, carbonId) --挂机得到的宝藏加入到挂机奖励 if isTreasure or false == true then local treasureList= role.dailyData:checkTreasureList(carbonId or hangInfo.carbonId) or {} - if next(treasureList) ~= nil then - for id, val in pairs(treasureList) do + if next(treasureList) then + for _, val in pairs(treasureList) do local award = val.award:toNumMap() for k,v in pairs(award) do items[k] = (items[k] or 0) + v diff --git a/src/models/Daily.lua b/src/models/Daily.lua index 9faae0e..485ef26 100644 --- a/src/models/Daily.lua +++ b/src/models/Daily.lua @@ -170,26 +170,25 @@ function Daily:checkChapters() local chapters = {} local tmp_chapters = {} local treasureList = self:getProperty("treasureList") - if next(treasureList) ~= nil then - for id, curInfo in pairs(treasureList) do - if curInfo["end_time"] then - if skynet.timex() < curInfo["end_time"] then - tmp_chapters[curInfo.chapter_id] = curInfo - end + if next(treasureList) then + for _, curInfo in pairs(treasureList) do + if curInfo["expire_time"] or not curInfo["end_time"] then + tmp_chapters[curInfo.chapter_id] = curInfo end end end - + local hangInfo = self.owner:getProperty("hangInfo") or {} for chapter_id, val in pairs(csvdb["idle_battleCsv"]) do - if self.owner:checkHangPass(chapter_id) then - if next(tmp_chapters) == nil then - chapters[chapter_id] = val - else - if not tmp_chapters[chapter_id] then + if chapter_id ~= hangInfo.carbonId then + if self.owner:checkHangPass(chapter_id) then + if next(tmp_chapters) and not tmp_chapters[chapter_id] then + chapters[chapter_id] = val + else chapters[chapter_id] = val end end end + end return chapters end -- libgit2 0.21.2