Commit 8e892c718da5d6b41e29480307897c17022cb38c
1 parent
598bd73f
挑战关卡活动打完再扣门票
Showing
4 changed files
with
19 additions
and
3 deletions
Show diff stats
src/actions/ActivityAction.lua
| @@ -472,9 +472,10 @@ function _M.startBattleRpc(agent, data) | @@ -472,9 +472,10 @@ function _M.startBattleRpc(agent, data) | ||
| 472 | -- check cost | 472 | -- check cost |
| 473 | local changeFlag = false | 473 | local changeFlag = false |
| 474 | local ticket = actData["ticket"] | 474 | local ticket = actData["ticket"] |
| 475 | + local num = 0 -- cost num | ||
| 475 | if battleCfg.type ~= "" then | 476 | if battleCfg.type ~= "" then |
| 476 | role.activity:getBattleTicket(actid) | 477 | role.activity:getBattleTicket(actid) |
| 477 | - local num = battleCfg.type:toArray(true, "=")[3] | 478 | + num = battleCfg.type:toArray(true, "=")[3] |
| 478 | if count and count > 0 then | 479 | if count and count > 0 then |
| 479 | if battleCfg.rank == 0 then | 480 | if battleCfg.rank == 0 then |
| 480 | return 7 | 481 | return 7 |
| @@ -490,7 +491,6 @@ function _M.startBattleRpc(agent, data) | @@ -490,7 +491,6 @@ function _M.startBattleRpc(agent, data) | ||
| 490 | if ticket < num then | 491 | if ticket < num then |
| 491 | return 6 | 492 | return 6 |
| 492 | end | 493 | end |
| 493 | - actData["ticket"] = ticket - num | ||
| 494 | changeFlag = true | 494 | changeFlag = true |
| 495 | end | 495 | end |
| 496 | 496 | ||
| @@ -524,6 +524,7 @@ function _M.startBattleRpc(agent, data) | @@ -524,6 +524,7 @@ function _M.startBattleRpc(agent, data) | ||
| 524 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) | 524 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) |
| 525 | 525 | ||
| 526 | bi["sum"] = bi["sum"] + bi["top"] | 526 | bi["sum"] = bi["sum"] + bi["top"] |
| 527 | + actData["ticket"] = ticket - num | ||
| 527 | actData[id] = bi | 528 | actData[id] = bi |
| 528 | changeFlag = true | 529 | changeFlag = true |
| 529 | 530 | ||
| @@ -654,6 +655,11 @@ function _M.endBattleRpc(agent, data) | @@ -654,6 +655,11 @@ function _M.endBattleRpc(agent, data) | ||
| 654 | end | 655 | end |
| 655 | 656 | ||
| 656 | if battleCfg.rank ~= 0 then | 657 | if battleCfg.rank ~= 0 then |
| 658 | + -- 消耗门票 | ||
| 659 | + role.activity:getBattleTicket(actid) | ||
| 660 | + local num = battleCfg.type:toArray(true, "=")[3] | ||
| 661 | + actData["ticket"] = math.max(actData["ticket"] - num, 0) | ||
| 662 | + | ||
| 657 | -- 更新排行榜 最高伤害 | 663 | -- 更新排行榜 最高伤害 |
| 658 | battleInfo["top"] = math.max(battleInfo["top"] or 0, dmg) | 664 | battleInfo["top"] = math.max(battleInfo["top"] or 0, dmg) |
| 659 | battleInfo["sum"] = (battleInfo["sum"] or 0) + dmg | 665 | battleInfo["sum"] = (battleInfo["sum"] or 0) + dmg |
src/models/Activity.lua
src/models/RolePlugin.lua
| @@ -1579,7 +1579,12 @@ function RolePlugin.bind(Role) | @@ -1579,7 +1579,12 @@ function RolePlugin.bind(Role) | ||
| 1579 | local rechargeRecord = self:getProperty("payR") or {} | 1579 | local rechargeRecord = self:getProperty("payR") or {} |
| 1580 | if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then | 1580 | if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then |
| 1581 | return "" | 1581 | return "" |
| 1582 | - end | 1582 | + end |
| 1583 | + | ||
| 1584 | + --判断是否是活动商品 | ||
| 1585 | + local actCfg = csvdb["activity_ctrlCsv"][rechargeData.actid] | ||
| 1586 | + if not actCfg then return "" end | ||
| 1587 | + if not self.activity:isOpenById(rechargeData.actid, "ActShopGoods") then return "" end | ||
| 1583 | 1588 | ||
| 1584 | local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId) | 1589 | local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId) |
| 1585 | if orderId then | 1590 | if orderId then |
src/models/Store.lua
| @@ -298,6 +298,8 @@ function Store:resetStoreReored(resetId) | @@ -298,6 +298,8 @@ function Store:resetStoreReored(resetId) | ||
| 298 | end | 298 | end |
| 299 | end | 299 | end |
| 300 | end | 300 | end |
| 301 | + else | ||
| 302 | + payRecord[k] = nil | ||
| 301 | end | 303 | end |
| 302 | end | 304 | end |
| 303 | self:updateProperty({field = "payR", value = payRecord}) | 305 | self:updateProperty({field = "payR", value = payRecord}) |
| @@ -307,6 +309,8 @@ function Store:resetStoreReored(resetId) | @@ -307,6 +309,8 @@ function Store:resetStoreReored(resetId) | ||
| 307 | if config.resetTime == resetId then | 309 | if config.resetTime == resetId then |
| 308 | buyRecord[k] = nil | 310 | buyRecord[k] = nil |
| 309 | end | 311 | end |
| 312 | + else | ||
| 313 | + buyRecord[k] = nil | ||
| 310 | end | 314 | end |
| 311 | end | 315 | end |
| 312 | self:updateProperty({field = "buyR", value = buyRecord}) | 316 | self:updateProperty({field = "buyR", value = buyRecord}) |