Commit 764e5296fc6825282b892094ada6dac0bbfe72e3
1 parent
cc87434b
冒险抽奖保底
Showing
4 changed files
with
35 additions
and
1 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -59,6 +59,7 @@ actionCodes = { | @@ -59,6 +59,7 @@ actionCodes = { | ||
| 59 | Adv_chooseArtifactRpc = 165, | 59 | Adv_chooseArtifactRpc = 165, |
| 60 | Adv_wearArtifactRpc = 166, | 60 | Adv_wearArtifactRpc = 166, |
| 61 | Adv_upArtifactRpc = 167, | 61 | Adv_upArtifactRpc = 167, |
| 62 | + Adv_repayWheelSurfRpc = 168, | ||
| 62 | 63 | ||
| 63 | Hero_loadInfos = 201, | 64 | Hero_loadInfos = 201, |
| 64 | Hero_updateProperty = 202, | 65 | Hero_updateProperty = 202, |
src/actions/AdvAction.lua
| @@ -544,6 +544,9 @@ function _M.wheelSurfRpc(agent, data) | @@ -544,6 +544,9 @@ function _M.wheelSurfRpc(agent, data) | ||
| 544 | if not role:checkItemEnough(costs) then return end | 544 | if not role:checkItemEnough(costs) then return end |
| 545 | role:costItems(costs) | 545 | role:costItems(costs) |
| 546 | role:addAdvLvExp(costs[ItemId.OldCoin] or 0) | 546 | role:addAdvLvExp(costs[ItemId.OldCoin] or 0) |
| 547 | + local advDrawB = role:getProperty("advDrawB") | ||
| 548 | + advDrawB[ptype] = (advDrawB[ptype] or 0) + count | ||
| 549 | + role:updateProperty({field = "advDrawB", value = advDrawB}) | ||
| 547 | -- 随机池子 | 550 | -- 随机池子 |
| 548 | local pool = drawData.weight:randWeight() | 551 | local pool = drawData.weight:randWeight() |
| 549 | local reward = {} | 552 | local reward = {} |
| @@ -557,6 +560,34 @@ function _M.wheelSurfRpc(agent, data) | @@ -557,6 +560,34 @@ function _M.wheelSurfRpc(agent, data) | ||
| 557 | SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) | 560 | SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) |
| 558 | return true | 561 | return true |
| 559 | end | 562 | end |
| 563 | +function _M.repayWheelSurfRpc(agent, data) | ||
| 564 | + local role = agent.role | ||
| 565 | + local msg = MsgPack.unpack(data) | ||
| 566 | + | ||
| 567 | + local ptype = msg.ptype | ||
| 568 | + | ||
| 569 | + if ptype == 2 and not role:isFuncOpen(FuncOpenType.AdvEndless) then | ||
| 570 | + return | ||
| 571 | + end | ||
| 572 | + | ||
| 573 | + local drawTypeData = csvdb["adv_wheelsurfCsv"][ptype] | ||
| 574 | + if not drawTypeData then return end | ||
| 575 | + local drawData = drawTypeData[role:getAdvWheelSurfLv(ptype)] | ||
| 576 | + if not drawData then return end | ||
| 577 | + | ||
| 578 | + local advDrawB = role:getProperty("advDrawB") | ||
| 579 | + if (advDrawB[ptype] or 0) < globalCsv.adv_draw_back_cond then | ||
| 580 | + return | ||
| 581 | + end | ||
| 582 | + advDrawB[ptype] = advDrawB[ptype] - globalCsv.adv_draw_back_cond | ||
| 583 | + role:updateProperty({field = "advDrawB", value = advDrawB}) | ||
| 584 | + local gift = drawData["pool3"]:randWeight(true) | ||
| 585 | + local reward = {[gift[1]] = gift[2]} | ||
| 586 | + reward = role:award(reward) | ||
| 587 | + | ||
| 588 | + SendPacket(actionCodes.Adv_repayWheelSurfRpc, MsgPack.pack({reward = reward})) | ||
| 589 | + return true | ||
| 590 | +end | ||
| 560 | 591 | ||
| 561 | function _M.finishAchievRpc(agent, data) | 592 | function _M.finishAchievRpc(agent, data) |
| 562 | local role = agent.role | 593 | local role = agent.role |
src/models/Role.lua
| @@ -68,6 +68,7 @@ Role.schema = { | @@ -68,6 +68,7 @@ Role.schema = { | ||
| 68 | advAFOpen = {"table", {}}, -- 解锁的神器 {[id] = 1} | 68 | advAFOpen = {"table", {}}, -- 解锁的神器 {[id] = 1} |
| 69 | advAFGet = {"table", {}}, -- 当前拥有的神器 {[id] = 等级} | 69 | advAFGet = {"table", {}}, -- 当前拥有的神器 {[id] = 等级} |
| 70 | advAFWear = {"table", {}}, -- 当前拥有的神器 {[slot] = id} | 70 | advAFWear = {"table", {}}, -- 当前拥有的神器 {[slot] = id} |
| 71 | + advDrawB = {"table", {}}, -- 冒险抽奖回馈 {[1] = 0, [2] = 100} -- 池子类型 = 点数 | ||
| 71 | 72 | ||
| 72 | --挂机相关 | 73 | --挂机相关 |
| 73 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | 74 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
| @@ -248,6 +249,7 @@ function Role:data() | @@ -248,6 +249,7 @@ function Role:data() | ||
| 248 | advElM = self:getProperty("advElM"), | 249 | advElM = self:getProperty("advElM"), |
| 249 | advAFGet = self:getProperty("advAFGet"), | 250 | advAFGet = self:getProperty("advAFGet"), |
| 250 | advAFWear = self:getProperty("advAFWear"), | 251 | advAFWear = self:getProperty("advAFWear"), |
| 252 | + advDrawB = self:getProperty("advDrawB"), | ||
| 251 | 253 | ||
| 252 | hangPass = self:getProperty("hangPass"), | 254 | hangPass = self:getProperty("hangPass"), |
| 253 | hangTeam = self:getProperty("hangTeam"), | 255 | hangTeam = self:getProperty("hangTeam"), |