Commit f0de8a60203678f3488f9a117425f8656a5eb84f
1 parent
47343863
挖宝跨天,前一天天正在挖的宝被刷掉的bug ——没在挖的宝才刷新,资源值重置
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
src/models/Daily.lua
@@ -33,6 +33,7 @@ Daily.schema = { | @@ -33,6 +33,7 @@ Daily.schema = { | ||
33 | curPool = {"number", 0}, -- 属性卡池当前索引 | 33 | curPool = {"number", 0}, -- 属性卡池当前索引 |
34 | drawHeroCnt = {"number", 0}, -- 每日抽卡次数 | 34 | drawHeroCnt = {"number", 0}, -- 每日抽卡次数 |
35 | 35 | ||
36 | + treasureBase = {"number", 0}, -- 资源值 | ||
36 | treasureList = {"table", {}}, --挂机图鉴 | 37 | treasureList = {"table", {}}, --挂机图鉴 |
37 | } | 38 | } |
38 | 39 | ||
@@ -142,8 +143,6 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList) | @@ -142,8 +143,6 @@ function Daily:checkTreasureExpired(treasureAttr, treasureList) | ||
142 | end | 143 | end |
143 | curInfo = clone(treasureAttr) | 144 | curInfo = clone(treasureAttr) |
144 | end | 145 | end |
145 | - else | ||
146 | - curInfo = clone(treasureAttr) | ||
147 | end | 146 | end |
148 | else | 147 | else |
149 | curInfo = clone(treasureAttr) | 148 | curInfo = clone(treasureAttr) |
@@ -303,7 +302,7 @@ end | @@ -303,7 +302,7 @@ end | ||
303 | 302 | ||
304 | function Daily:buyTreasure(treasureList) | 303 | function Daily:buyTreasure(treasureList) |
305 | local boughtTreasurer = {} | 304 | local boughtTreasurer = {} |
306 | - local treasureBase = globalCsv.idle_treasure_base | 305 | + local treasureBase = self:getProperty("treasureBase") |
307 | for id, val in pairs(treasureList) do | 306 | for id, val in pairs(treasureList) do |
308 | treasureBase = treasureBase - val.treasure_value | 307 | treasureBase = treasureBase - val.treasure_value |
309 | if treasureBase < 0 then | 308 | if treasureBase < 0 then |
@@ -313,7 +312,7 @@ function Daily:buyTreasure(treasureList) | @@ -313,7 +312,7 @@ function Daily:buyTreasure(treasureList) | ||
313 | boughtTreasurer[id] = val | 312 | boughtTreasurer[id] = val |
314 | end | 313 | end |
315 | end | 314 | end |
316 | - --self:updateProperty({field = "treasureBase", value = treasureBase}) | 315 | + self:updateProperty({field = "treasureBase", value = treasureBase}) |
317 | return boughtTreasurer | 316 | return boughtTreasurer |
318 | end | 317 | end |
319 | 318 | ||
@@ -340,6 +339,7 @@ function Daily:getTreasrueList() | @@ -340,6 +339,7 @@ function Daily:getTreasrueList() | ||
340 | 339 | ||
341 | self:checkTreasureWeight(treasureList, tmptreasure, treasureBase) | 340 | self:checkTreasureWeight(treasureList, tmptreasure, treasureBase) |
342 | self:updateProperty({field = "treasureList", value = treasureList}) | 341 | self:updateProperty({field = "treasureList", value = treasureList}) |
342 | + self:updateProperty({field = "treasureBase", value = treasureBase}) | ||
343 | return treasureList | 343 | return treasureList |
344 | end | 344 | end |
345 | 345 |