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,7 +266,7 @@ function _M.endBattleRpc(agent, data) | ||
| 266 | -- end | 266 | -- end |
| 267 | --end | 267 | --end |
| 268 | 268 | ||
| 269 | - if role:checkHangPass(carbonId) then | 269 | + if role:checkHangPass(carbonId) then |
| 270 | return 4 | 270 | return 4 |
| 271 | end | 271 | end |
| 272 | 272 | ||
| @@ -338,6 +338,12 @@ function _M.endBattleRpc(agent, data) | @@ -338,6 +338,12 @@ function _M.endBattleRpc(agent, data) | ||
| 338 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time | 338 | -- hangInfo.bossTime = skynet.timex() + cfg.idle_time |
| 339 | --end | 339 | --end |
| 340 | end | 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 | role:updateProperty({field = "hangInfo", value = hangInfo}) | 347 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
| 342 | 348 | ||
| 343 | role:checkBattle("hang", { | 349 | role:checkBattle("hang", { |
src/models/Daily.lua
| @@ -97,7 +97,7 @@ function Daily:checkUnlock(treaval) | @@ -97,7 +97,7 @@ function Daily:checkUnlock(treaval) | ||
| 97 | local treasureC = treaval.unlock:toArray(true, "=") | 97 | local treasureC = treaval.unlock:toArray(true, "=") |
| 98 | local show = false | 98 | local show = false |
| 99 | if treasureC[1] == 1 then --通关关卡 | 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 | elseif treasureC[1] == 2 then --通关拾荒章节=x层 | 101 | elseif treasureC[1] == 2 then --通关拾荒章节=x层 |
| 102 | local chapterId = treasureC[2] | 102 | local chapterId = treasureC[2] |
| 103 | local layer = 1 | 103 | local layer = 1 |
| @@ -128,16 +128,22 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList) | @@ -128,16 +128,22 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList) | ||
| 128 | -- check finish | 128 | -- check finish |
| 129 | if curInfo["expire_time"] then | 129 | if curInfo["expire_time"] then |
| 130 | if curInfo.cool_time > 1 then | 130 | if curInfo.cool_time > 1 then |
| 131 | - if skynet.timex() >= curInfo["expire_time"] then --已过期 | 131 | + if skynet.timex() >= curInfo["expire_time"] then |
| 132 | treasureList[treasureAttr.id] = nil | 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 | curInfo = nil | 135 | curInfo = nil |
| 136 | + else | ||
| 137 | + curInfo = clone(treasureAttr) | ||
| 135 | end | 138 | end |
| 136 | else | 139 | else |
| 137 | if skynet.timex() >= curInfo["expire_time"] then | 140 | if skynet.timex() >= curInfo["expire_time"] then |
| 138 | treasureList[treasureAttr.id] = nil | 141 | treasureList[treasureAttr.id] = nil |
| 139 | end | 142 | end |
| 143 | + curInfo = clone(treasureAttr) | ||
| 140 | end | 144 | end |
| 145 | + else | ||
| 146 | + curInfo = clone(treasureAttr) | ||
| 141 | end | 147 | end |
| 142 | else | 148 | else |
| 143 | curInfo = clone(treasureAttr) | 149 | curInfo = clone(treasureAttr) |
| @@ -158,14 +164,51 @@ function Daily:checkTreasureBase(treasureList, treasureBase, removeId) | @@ -158,14 +164,51 @@ function Daily:checkTreasureBase(treasureList, treasureBase, removeId) | ||
| 158 | tmptreasure[val.id] = val | 164 | tmptreasure[val.id] = val |
| 159 | end | 165 | end |
| 160 | end | 166 | end |
| 161 | - | 167 | + |
| 162 | end | 168 | end |
| 163 | return tmptreasure | 169 | return tmptreasure |
| 164 | end | 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 | function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) | 207 | function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) |
| 168 | local removeId | 208 | local removeId |
| 209 | + local chapters = self:checkChapters() | ||
| 210 | + if next(chapters) == nil then return end | ||
| 211 | + | ||
| 169 | while next(tmptreasure) do | 212 | while next(tmptreasure) do |
| 170 | local tmp = self:checkTreasureBase(tmptreasure, treasureBase, removeId) | 213 | local tmp = self:checkTreasureBase(tmptreasure, treasureBase, removeId) |
| 171 | local id = math.randWeight(tmp, "weight") --宝藏id | 214 | local id = math.randWeight(tmp, "weight") --宝藏id |
| @@ -180,8 +223,7 @@ function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) | @@ -180,8 +223,7 @@ function Daily:checkTreasureWeight(treasureList, tmptreasure, treasureBase) | ||
| 180 | else | 223 | else |
| 181 | break | 224 | break |
| 182 | end | 225 | end |
| 183 | - | ||
| 184 | - local chapterId = math.randWeight(csvdb["idle_battleCsv"], "treasure_weight") --关卡id | 226 | + local chapterId = math.randWeight(chapters, "treasure_weight") --关卡id |
| 185 | if not chapterId then | 227 | if not chapterId then |
| 186 | break | 228 | break |
| 187 | end | 229 | end |
| @@ -263,7 +305,6 @@ function Daily:buyTreasure(treasureList) | @@ -263,7 +305,6 @@ function Daily:buyTreasure(treasureList) | ||
| 263 | treasureBase = treasureBase - val.treasure_value | 305 | treasureBase = treasureBase - val.treasure_value |
| 264 | if treasureBase < 0 then | 306 | if treasureBase < 0 then |
| 265 | treasureBase = treasureBase + val.treasure_value | 307 | treasureBase = treasureBase + val.treasure_value |
| 266 | - print("资源余额不足") | ||
| 267 | return | 308 | return |
| 268 | else | 309 | else |
| 269 | boughtTreasurer[id] = val | 310 | boughtTreasurer[id] = val |
| @@ -280,7 +321,6 @@ end | @@ -280,7 +321,6 @@ end | ||
| 280 | 321 | ||
| 281 | --宝藏图鉴 | 322 | --宝藏图鉴 |
| 282 | function Daily:getTreasrueList() | 323 | function Daily:getTreasrueList() |
| 283 | - print("宝藏图鉴...") | ||
| 284 | local tmpcsv = csvdb["idle_treasureCsv"] | 324 | local tmpcsv = csvdb["idle_treasureCsv"] |
| 285 | local treasureList = self:getProperty("treasureList") --挖宝列表 过期删除 领取奖励删除 跨天更新 | 325 | local treasureList = self:getProperty("treasureList") --挖宝列表 过期删除 领取奖励删除 跨天更新 |
| 286 | local tmptreasure = {} | 326 | local tmptreasure = {} |
| @@ -303,7 +343,6 @@ end | @@ -303,7 +343,6 @@ end | ||
| 303 | 343 | ||
| 304 | --检索挖宝列表 | 344 | --检索挖宝列表 |
| 305 | function Daily:checkTreasureList(chapterId) | 345 | function Daily:checkTreasureList(chapterId) |
| 306 | - print("检索挖宝列表") | ||
| 307 | local treasureList = self:getProperty("treasureList") | 346 | local treasureList = self:getProperty("treasureList") |
| 308 | local tmptreasure = {} | 347 | local tmptreasure = {} |
| 309 | for id, val in pairs(treasureList) do | 348 | for id, val in pairs(treasureList) do |
| @@ -314,7 +353,6 @@ function Daily:checkTreasureList(chapterId) | @@ -314,7 +353,6 @@ function Daily:checkTreasureList(chapterId) | ||
| 314 | end | 353 | end |
| 315 | 354 | ||
| 316 | if next(tmptreasure) == nil then | 355 | if next(tmptreasure) == nil then |
| 317 | - print("宝藏列表为空") | ||
| 318 | return nil | 356 | return nil |
| 319 | end | 357 | end |
| 320 | local boughtTreasurer = self:buyTreasure(tmptreasure) | 358 | local boughtTreasurer = self:buyTreasure(tmptreasure) |