Commit 55c7c172ba60d62ced6971b76704d73d8673f6cc
1 parent
23847cc0
奖励副本 新机制
Showing
3 changed files
with
62 additions
and
52 deletions
Show diff stats
src/actions/HangAction.lua
| @@ -498,46 +498,44 @@ function _M.buyBonusCountRpc(agent, data) | @@ -498,46 +498,44 @@ function _M.buyBonusCountRpc(agent, data) | ||
| 498 | return true | 498 | return true |
| 499 | end | 499 | end |
| 500 | 500 | ||
| 501 | -local function bonusWinReward(role, bonusData, bwin, count) | 501 | +local function bonusWinReward(role, bonusData, rewardType, count) |
| 502 | count = count or 1 | 502 | count = count or 1 |
| 503 | - local open, actId = role.activity:isOpen("BonusDouble") | ||
| 504 | - local actData = csvdb["activity_ctrlCsv"][actId] | ||
| 505 | - local extraCnt = role.storeData:getBonusExtraFightCount() | ||
| 506 | - | ||
| 507 | - local coef = 1 | ||
| 508 | - if open and actData then | ||
| 509 | - coef = tonumber(actData.condition2) | ||
| 510 | - end | ||
| 511 | - local bonusC = role.dailyData:getProperty("bonusC") | ||
| 512 | - bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | ||
| 513 | - if globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"] < count then return false, 1 end | ||
| 514 | - bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | ||
| 515 | - role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | ||
| 516 | 503 | ||
| 517 | - local reward, change | ||
| 518 | - reward = bonusData.reward:toNumMap() | ||
| 519 | - for itemId, c in pairs(reward) do | ||
| 520 | - reward[itemId] = c * count | ||
| 521 | - end | ||
| 522 | - for i = 1, count do | ||
| 523 | - local chance = bonusData.chance:randWeight(true) | ||
| 524 | - if chance[1] ~= 0 then | ||
| 525 | - reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] | 504 | + local reward, change = {} |
| 505 | + if rewardType == 1 or rewardType == 4 then | ||
| 506 | + for k, v in pairs(bonusData.clear_reward:toNumMap()) do | ||
| 507 | + reward[k] = (reward[k] or 0) + v | ||
| 526 | end | 508 | end |
| 527 | end | 509 | end |
| 528 | 510 | ||
| 529 | - for k, v in pairs(reward) do | ||
| 530 | - reward[k] = v * (coef > 1 and actData.condition or 1) | ||
| 531 | - end | ||
| 532 | - | ||
| 533 | - if bwin then -- 满星 额外奖励 | 511 | + if rewardType == 2 or rewardType == 4 then |
| 534 | for k, v in pairs(bonusData.perfect_reward:toNumMap()) do | 512 | for k, v in pairs(bonusData.perfect_reward:toNumMap()) do |
| 535 | reward[k] = (reward[k] or 0) + v | 513 | reward[k] = (reward[k] or 0) + v |
| 536 | end | 514 | end |
| 537 | end | 515 | end |
| 538 | - reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) | ||
| 539 | - role:checkTaskEnter("BonusPass", {id = id, count = count}) | ||
| 540 | - return true, reward, change | 516 | + |
| 517 | + if rewardType == 3 then | ||
| 518 | + local open, actId = role.activity:isOpen("BonusDouble") | ||
| 519 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
| 520 | + | ||
| 521 | + reward = bonusData.reward:toNumMap() | ||
| 522 | + for itemId, c in pairs(reward) do | ||
| 523 | + reward[itemId] = c * count | ||
| 524 | + end | ||
| 525 | + for i = 1, count do | ||
| 526 | + local chance = bonusData.chance:randWeight(true) | ||
| 527 | + if chance[1] ~= 0 then | ||
| 528 | + reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] | ||
| 529 | + end | ||
| 530 | + end | ||
| 531 | + for k, v in pairs(reward) do | ||
| 532 | + reward[k] = v * (actData.condition > 1 and actData.condition or 1) | ||
| 533 | + end | ||
| 534 | + end | ||
| 535 | + | ||
| 536 | + reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}}) | ||
| 537 | + role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count}) | ||
| 538 | + return reward, change | ||
| 541 | end | 539 | end |
| 542 | 540 | ||
| 543 | function _M.startBonusBattleRpc(agent, data) | 541 | function _M.startBonusBattleRpc(agent, data) |
| @@ -559,23 +557,24 @@ function _M.startBonusBattleRpc(agent, data) | @@ -559,23 +557,24 @@ function _M.startBonusBattleRpc(agent, data) | ||
| 559 | if not bonusData then return 3 end | 557 | if not bonusData then return 3 end |
| 560 | if not role:checkHangPass(bonusData.unlock) then return 4 end | 558 | if not role:checkHangPass(bonusData.unlock) then return 4 end |
| 561 | 559 | ||
| 562 | - local bonusC = role.dailyData:getProperty("bonusC") | ||
| 563 | - bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | ||
| 564 | - | ||
| 565 | - local actData = csvdb["activity_ctrlCsv"][actId] | ||
| 566 | - | ||
| 567 | - local extraCnt = role.storeData:getBonusExtraFightCount() | ||
| 568 | - local coef = 1 | ||
| 569 | - if open and actData then | ||
| 570 | - coef = tonumber(actData.condition2) | ||
| 571 | - end | ||
| 572 | - | ||
| 573 | - if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end | ||
| 574 | 560 | ||
| 575 | local bonusStar = role:getProperty("bonusStar") | 561 | local bonusStar = role:getProperty("bonusStar") |
| 576 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then | 562 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then |
| 577 | - local status, reward, change = bonusWinReward(role, bonusData, nil, count) | ||
| 578 | - if not status then return 10 * (reward or 0) end | 563 | + local bonusC = role.dailyData:getProperty("bonusC") |
| 564 | + bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | ||
| 565 | + | ||
| 566 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
| 567 | + local extraCnt = role.storeData:getBonusExtraFightCount() | ||
| 568 | + local coef = 1 | ||
| 569 | + if open and actData then | ||
| 570 | + coef = tonumber(actData.condition2) | ||
| 571 | + end | ||
| 572 | + if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end | ||
| 573 | + | ||
| 574 | + bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | ||
| 575 | + role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | ||
| 576 | + | ||
| 577 | + local reward, change = bonusWinReward(role, bonusData, 3, count) | ||
| 579 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) | 578 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
| 580 | else | 579 | else |
| 581 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) | 580 | local bTeam = role:getTeamFormatByType(TeamSystemType.BonusBattle) |
| @@ -608,6 +607,7 @@ function _M.endBonusBattleRpc(agent, data) | @@ -608,6 +607,7 @@ function _M.endBonusBattleRpc(agent, data) | ||
| 608 | local reward, change | 607 | local reward, change |
| 609 | 608 | ||
| 610 | local bonusStar = role:getProperty("bonusStar") | 609 | local bonusStar = role:getProperty("bonusStar") |
| 610 | + local oldStar = bonusStar[id] or 0 | ||
| 611 | local curStar = 0 | 611 | local curStar = 0 |
| 612 | if starNum and starNum > 0 then | 612 | if starNum and starNum > 0 then |
| 613 | -- 胜利扣除次数 | 613 | -- 胜利扣除次数 |
| @@ -671,12 +671,23 @@ function _M.endBonusBattleRpc(agent, data) | @@ -671,12 +671,23 @@ function _M.endBonusBattleRpc(agent, data) | ||
| 671 | end | 671 | end |
| 672 | end | 672 | end |
| 673 | local status | 673 | local status |
| 674 | - status, reward, change = bonusWinReward(role, bonusData, curStar >= (1 << #sweepConds) - 1) | ||
| 675 | - if not status then return 10 + (reward or 0) end | 674 | + local rewardType = 0 |
| 675 | + if curStar >= (1 << #sweepConds) - 1 then -- 满星 | ||
| 676 | + rewardType = 2 | ||
| 677 | + if oldStar == 0 then --通关 | ||
| 678 | + rewardType = 4 | ||
| 679 | + end | ||
| 680 | + elseif oldStar == 0 then --通关 | ||
| 681 | + rewardType = 1 | ||
| 682 | + end | ||
| 683 | + | ||
| 684 | + if rewardType ~= 0 then | ||
| 685 | + reward, change = bonusWinReward(role, bonusData, rewardType) | ||
| 686 | + end | ||
| 676 | else | 687 | else |
| 677 | - curStar = 0 | 688 | + curStar = oldStar |
| 678 | end | 689 | end |
| 679 | - if curStar ~= bonusStar[id] then | 690 | + if curStar ~= oldStar then |
| 680 | bonusStar[id] = curStar | 691 | bonusStar[id] = curStar |
| 681 | role:updateProperty({field = "bonusStar", value = bonusStar}) | 692 | role:updateProperty({field = "bonusStar", value = bonusStar}) |
| 682 | end | 693 | end |
src/models/RoleBattle.lua
| @@ -102,7 +102,7 @@ function Role:checkBattle(battleType, params) | @@ -102,7 +102,7 @@ function Role:checkBattle(battleType, params) | ||
| 102 | end | 102 | end |
| 103 | end, | 103 | end, |
| 104 | pvpc = function() | 104 | pvpc = function() |
| 105 | - for slot, hero in pairs(self:getProperty("pvpTSC")) do | 105 | + for slot, hero in pairs(self:getProperty("pvpTSC").heros) do |
| 106 | selflist[slot] = hero.type | 106 | selflist[slot] = hero.type |
| 107 | end | 107 | end |
| 108 | heroscore = self:getProperty("pvpTBVC") | 108 | heroscore = self:getProperty("pvpTBVC") |
| @@ -124,7 +124,7 @@ function Role:checkBattle(battleType, params) | @@ -124,7 +124,7 @@ function Role:checkBattle(battleType, params) | ||
| 124 | pvph = function() | 124 | pvph = function() |
| 125 | for idx, team in pairs(self:getProperty("pvpTSH")) do | 125 | for idx, team in pairs(self:getProperty("pvpTSH")) do |
| 126 | selflist[idx] = selflist[idx] or {} | 126 | selflist[idx] = selflist[idx] or {} |
| 127 | - for slot, hero in pairs(team) do | 127 | + for slot, hero in pairs(team.heros) do |
| 128 | selflist[idx][slot] = hero.type | 128 | selflist[idx][slot] = hero.type |
| 129 | end | 129 | end |
| 130 | end | 130 | end |
src/models/RolePvp.lua
| @@ -233,7 +233,6 @@ function Role:refreshPvpMatch(score, rank, rankKey) | @@ -233,7 +233,6 @@ function Role:refreshPvpMatch(score, rank, rankKey) | ||
| 233 | if low < 0 then | 233 | if low < 0 then |
| 234 | low = 0 | 234 | low = 0 |
| 235 | end | 235 | end |
| 236 | - print(low, heigh) | ||
| 237 | local rangeIds = redisproxy:ZREVRANGE(dbKey, low, heigh) | 236 | local rangeIds = redisproxy:ZREVRANGE(dbKey, low, heigh) |
| 238 | local lastRangeIds = {} | 237 | local lastRangeIds = {} |
| 239 | for idx, one in ipairs(rangeIds) do | 238 | for idx, one in ipairs(rangeIds) do |