Commit e639a6b9d44e88b8a255ad38b0035b167d308be2
1 parent
1199daf9
fix: 挂机图鉴-绑定关卡
1. 绑定的关卡需要已经解锁 2. 通关10120刷新宝鉴 3。 关卡10120是从表获取的数据
Showing
2 changed files
with
55 additions
and
11 deletions
Show diff stats
src/actions/HangAction.lua
| ... | ... | @@ -266,7 +266,7 @@ function _M.endBattleRpc(agent, data) |
| 266 | 266 | -- end |
| 267 | 267 | --end |
| 268 | 268 | |
| 269 | - if role:checkHangPass(carbonId) then | |
| 269 | + if role:checkHangPass(carbonId) then | |
| 270 | 270 | return 4 |
| 271 | 271 | end |
| 272 | 272 | |
| ... | ... | @@ -338,6 +338,12 @@ function _M.endBattleRpc(agent, data) |
| 338 | 338 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time |
| 339 | 339 | --end |
| 340 | 340 | end |
| 341 | + | |
| 342 | + --刷新宝藏图鉴 | |
| 343 | + if isWin and globalCsv.idle_treasure_point and globalCsv.idle_treasure_point == carbonId then | |
| 344 | + role.dailyData:getTreasrueList() | |
| 345 | + end | |
| 346 | + | |
| 341 | 347 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 342 | 348 | |
| 343 | 349 | role:checkBattle("hang", { | ... | ... |
src/models/Daily.lua
| ... | ... | @@ -97,7 +97,7 @@ function Daily:checkUnlock(treaval) |
| 97 | 97 | local treasureC = treaval.unlock:toArray(true, "=") |
| 98 | 98 | local show = false |
| 99 | 99 | if treasureC[1] == 1 then --通关关卡 |
| 100 | - if not self.owner:checkHangPass(treasureC[2]) then show = true end | |
| 100 | + if self.owner:checkHangPass(treasureC[2]) then show = true end | |
| 101 | 101 | elseif treasureC[1] == 2 then --通关拾荒章节=x层 |
| 102 | 102 | local chapterId = treasureC[2] |
| 103 | 103 | local layer = 1 |
| ... | ... | @@ -128,16 +128,22 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList) |
| 128 | 128 | -- check finish |
| 129 | 129 | if curInfo["expire_time"] then |
| 130 | 130 | if curInfo.cool_time > 1 then |
| 131 | - if skynet.timex() >= curInfo["expire_time"] then --已过期 | |
| 131 | + if skynet.timex() >= curInfo["expire_time"] then | |
| 132 | 132 | treasureList[treasureAttr.id] = nil |
| 133 | - elseif skynet.timex() > curInfo["expire_time"] - curInfo.cool_time * oneDay then --未冷却 | |
| 133 | + curInfo = clone(treasureAttr) | |
| 134 | + elseif skynet.timex() >= curInfo["expire_time"] - curInfo.cool_time * oneDay then --未冷却 | |
| 134 | 135 | curInfo = nil |
| 136 | + else | |
| 137 | + curInfo = clone(treasureAttr) | |
| 135 | 138 | end |
| 136 | 139 | else |
| 137 | 140 | if skynet.timex() >= curInfo["expire_time"] then |
| 138 | 141 | treasureList[treasureAttr.id] = nil |
| 139 | 142 | end |
| 143 | + curInfo = clone(treasureAttr) | |
| 140 | 144 | end |
| 145 | + else | |
| 146 | + curInfo = clone(treasureAttr) | |
| 141 | 147 | end |
| 142 | 148 | else |
| 143 | 149 | curInfo = clone(treasureAttr) |
| ... | ... | @@ -158,14 +164,51 @@ function Daily:checkTreasureBase(treasureList, treasureBase, removeId) |
| 158 | 164 | tmptreasure[val.id] = val |
| 159 | 165 | end |
| 160 | 166 | end |
| 161 | - | |
| 167 | + | |
| 162 | 168 | end |
| 163 | 169 | return tmptreasure |
| 164 | 170 | end |
| 165 | 171 | |
| 172 | +--绑定通关关卡 | |
| 173 | +function Daily:checkChapters() | |
| 174 | + local chapters = {} | |
| 175 | + local tmp_chapters = {} | |
| 176 | + local treasureList = self:getProperty("treasureList") | |
| 177 | + if next(treasureList) ~= nil then | |
| 178 | + for id, curInfo in pairs(treasureList) do | |
| 179 | + if curInfo["end_time"] then | |
| 180 | + if skynet.timex() >= curInfo["end_time"] then | |
| 181 | + curInfo = nil | |
| 182 | + end | |
| 183 | + else | |
| 184 | + curInfo = nil | |
| 185 | + end | |
| 186 | + if curInfo ~= nil then | |
| 187 | + tmp_chapters[curInfo.chapter_id] = curInfo | |
| 188 | + end | |
| 189 | + end | |
| 190 | + end | |
| 191 | + | |
| 192 | + for chapter_id, val in pairs(csvdb["idle_battleCsv"]) do | |
| 193 | + if self.owner:checkHangPass(chapter_id) then | |
| 194 | + if next(tmp_chapters) == nil then | |
| 195 | + chapters[chapter_id] = val | |
| 196 | + else | |
| 197 | + if not tmp_chapters[chapter_id] then | |
| 198 | + chapters[chapter_id] = val | |
| 199 | + end | |
| 200 | + end | |
| 201 | + end | |
| 202 | + end | |
| 203 | + return chapters | |
| 204 | +end | |
| 205 | + | |
| 166 | 206 | --权重 |
| 167 | 207 | function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) |
| 168 | 208 | local removeId |
| 209 | + local chapters = self:checkChapters() | |
| 210 | + if next(chapters) == nil then return end | |
| 211 | + | |
| 169 | 212 | while next(tmptreasure) do |
| 170 | 213 | local tmp = self:checkTreasureBase(tmptreasure, treasureBase, removeId) |
| 171 | 214 | local id = math.randWeight(tmp, "weight") --宝藏id |
| ... | ... | @@ -180,8 +223,7 @@ function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) |
| 180 | 223 | else |
| 181 | 224 | break |
| 182 | 225 | end |
| 183 | - | |
| 184 | - local chapterId = math.randWeight(csvdb["idle_battleCsv"], "treasure_weight") --关卡id | |
| 226 | + local chapterId = math.randWeight(chapters, "treasure_weight") --关卡id | |
| 185 | 227 | if not chapterId then |
| 186 | 228 | break |
| 187 | 229 | end |
| ... | ... | @@ -263,7 +305,6 @@ function Daily:buyTreasure(treasureList) |
| 263 | 305 | treasureBase = treasureBase - val.treasure_value |
| 264 | 306 | if treasureBase < 0 then |
| 265 | 307 | treasureBase = treasureBase + val.treasure_value |
| 266 | - print("资源余额不足") | |
| 267 | 308 | return |
| 268 | 309 | else |
| 269 | 310 | boughtTreasurer[id] = val |
| ... | ... | @@ -280,7 +321,6 @@ end |
| 280 | 321 | |
| 281 | 322 | --宝藏图鉴 |
| 282 | 323 | function Daily:getTreasrueList() |
| 283 | - print("宝藏图鉴...") | |
| 284 | 324 | local tmpcsv = csvdb["idle_treasureCsv"] |
| 285 | 325 | local treasureList = self:getProperty("treasureList") --挖宝列表 过期删除 领取奖励删除 跨天更新 |
| 286 | 326 | local tmptreasure = {} |
| ... | ... | @@ -303,7 +343,6 @@ end |
| 303 | 343 | |
| 304 | 344 | --检索挖宝列表 |
| 305 | 345 | function Daily:checkTreasureList(chapterId) |
| 306 | - print("检索挖宝列表") | |
| 307 | 346 | local treasureList = self:getProperty("treasureList") |
| 308 | 347 | local tmptreasure = {} |
| 309 | 348 | for id, val in pairs(treasureList) do |
| ... | ... | @@ -314,7 +353,6 @@ function Daily:checkTreasureList(chapterId) |
| 314 | 353 | end |
| 315 | 354 | |
| 316 | 355 | if next(tmptreasure) == nil then |
| 317 | - print("宝藏列表为空") | |
| 318 | 356 | return nil |
| 319 | 357 | end |
| 320 | 358 | local boughtTreasurer = self:buyTreasure(tmptreasure) | ... | ... |