Commit 53b4b8bde8149727336d6dcf5cebfd2c5f64e085
1 parent
ec0d19a2
自动挂机下一关
Showing
6 changed files
with
30 additions
and
6 deletions
Show diff stats
src/actions/GmAction.lua
@@ -472,7 +472,7 @@ function _M.test(role, pms) | @@ -472,7 +472,7 @@ function _M.test(role, pms) | ||
472 | local id = tonum(pms.pm1, 0) | 472 | local id = tonum(pms.pm1, 0) |
473 | --local hero = require ("actions.HeroAction") | 473 | --local hero = require ("actions.HeroAction") |
474 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 474 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
475 | - role.storeData:onBuyPaySignCard(100) | 475 | + print(role:getNextCarbonId(id)) |
476 | return "成功" | 476 | return "成功" |
477 | end | 477 | end |
478 | 478 |
src/actions/HangAction.lua
@@ -270,8 +270,10 @@ function _M.endBattleRpc(agent, data) | @@ -270,8 +270,10 @@ function _M.endBattleRpc(agent, data) | ||
270 | end | 270 | end |
271 | end | 271 | end |
272 | end | 272 | end |
273 | - if hangInfo.carbonId < carbonId then | ||
274 | - hangInfo.carbonId = carbonId | 273 | + local nextCarbonId = role:getNextCarbonId(carbonId) |
274 | + -- 设置挂机关卡 | ||
275 | + if hangInfo.carbonId < nextCarbonId then | ||
276 | + hangInfo.carbonId = nextCarbonId | ||
275 | end | 277 | end |
276 | role:updateProperty({field = "hangInfo", value = hangInfo}) | 278 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
277 | 279 |
src/actions/RoleAction.lua
@@ -173,7 +173,7 @@ function _M.loginRpc( agent, data ) | @@ -173,7 +173,7 @@ function _M.loginRpc( agent, data ) | ||
173 | response.role = role:data() | 173 | response.role = role:data() |
174 | response.result = "SUCCESS" | 174 | response.result = "SUCCESS" |
175 | response.serverTime = now | 175 | response.serverTime = now |
176 | - response.openTime = getServerOpenTs() | 176 | + --response.openTime = getServerOpenTs() |
177 | 177 | ||
178 | local modules = {} | 178 | local modules = {} |
179 | 179 |
src/models/RolePlugin.lua
@@ -1547,6 +1547,28 @@ function RolePlugin.bind(Role) | @@ -1547,6 +1547,28 @@ function RolePlugin.bind(Role) | ||
1547 | return reward, (newVal >= maxCount and newVal - maxCount or newVal) | 1547 | return reward, (newVal >= maxCount and newVal - maxCount or newVal) |
1548 | end | 1548 | end |
1549 | 1549 | ||
1550 | + -- 获取下一个挂机关卡id | ||
1551 | + function Role:getNextCarbonId(curId) | ||
1552 | + local diff = math.floor(curId / 10000) | ||
1553 | + local chapterId = math.floor((curId / 100) % 100) | ||
1554 | + local subId = curId % 100 | ||
1555 | + local nextId = curId + 1 | ||
1556 | + local function makeCarbonId(diff, chapterId, subId) | ||
1557 | + return diff * 10000 + chapterId * 100 + subId | ||
1558 | + end | ||
1559 | + if not csvdb["idle_battleCsv"][nextId] then | ||
1560 | + nextId = makeCarbonId(diff, chapterId + 1, 1) | ||
1561 | + if not csvdb["idle_battleCsv"][nextId] then | ||
1562 | + nextId = makeCarbonId(diff + 1, 1, 1) | ||
1563 | + if not csvdb["idle_battleCsv"][nextId] then | ||
1564 | + nextId = 0 | ||
1565 | + end | ||
1566 | + end | ||
1567 | + end | ||
1568 | + | ||
1569 | + return nextId | ||
1570 | + end | ||
1571 | + | ||
1550 | end | 1572 | end |
1551 | 1573 | ||
1552 | return RolePlugin | 1574 | return RolePlugin |
1553 | \ No newline at end of file | 1575 | \ No newline at end of file |
src/models/Store.lua
@@ -366,7 +366,7 @@ function Store:onBuyPaySignCard(dur) | @@ -366,7 +366,7 @@ function Store:onBuyPaySignCard(dur) | ||
366 | return | 366 | return |
367 | end | 367 | end |
368 | actGoodsFlag[goodsIndex] = 1 | 368 | actGoodsFlag[goodsIndex] = 1 |
369 | - self.owner:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) | 369 | + self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) |
370 | -- 发钱 | 370 | -- 发钱 |
371 | local change | 371 | local change |
372 | local reward, curData = self.owner.activity:getPaySignReward() | 372 | local reward, curData = self.owner.activity:getPaySignReward() |