Commit 9489e76155dc1b576af2758b361125db9015d3b3
1 parent
84cbc53e
feat: 探索加速、拾荒体力、奖励副本购买次数去除上限
Showing
5 changed files
with
55 additions
and
26 deletions
Show diff stats
src/GlobalVar.lua
@@ -433,7 +433,7 @@ SystemBnousType = { | @@ -433,7 +433,7 @@ SystemBnousType = { | ||
433 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 | 433 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 |
434 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 | 434 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
435 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, | 435 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, |
436 | - ExtraProp = 18, -- 每次探索加速额外获得道具 | 436 | + ExtraProps= 18, -- 每次探索加速额外获得道具 |
437 | AccountLevel = 19, -- 账号等级提升角色等级上限 | 437 | AccountLevel = 19, -- 账号等级提升角色等级上限 |
438 | } | 438 | } |
439 | 439 |
src/actions/AdvAction.lua
@@ -506,14 +506,15 @@ function _M.buyAdvCountRpc(agent , data) | @@ -506,14 +506,15 @@ function _M.buyAdvCountRpc(agent , data) | ||
506 | local msg = MsgPack.unpack(data) | 506 | local msg = MsgPack.unpack(data) |
507 | 507 | ||
508 | local count = msg.count --购买次数 | 508 | local count = msg.count --购买次数 |
509 | - local isEl = msg.isEl -- 是否是无尽模式 | 509 | + local isEl = msg.isEl -- 是否是无尽模式 国服没有 |
510 | local cost | 510 | local cost |
511 | if isEl then | 511 | if isEl then |
512 | if math.illegalNum(count, 1, globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC")) then return end | 512 | if math.illegalNum(count, 1, globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC")) then return end |
513 | cost = {[ItemId.Jade] = count * globalCsv.adv_endless_daily_buy_cost} | 513 | cost = {[ItemId.Jade] = count * globalCsv.adv_endless_daily_buy_cost} |
514 | else | 514 | else |
515 | - if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end | ||
516 | - cost = {[ItemId.Jade] = count * globalCsv.adv_daily_buy_cost} | 515 | + --if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end |
516 | + local advCount = (role.dailyData:getProperty("advBC") + count ) * globalCsv.adv_daily_buy_num | ||
517 | + cost = {[ItemId.Jade] = table.findMinKeyByItem(globalCsv.adv_buy_cost, advCount)} | ||
517 | end | 518 | end |
518 | 519 | ||
519 | 520 |
src/actions/HangAction.lua
@@ -477,24 +477,11 @@ function _M.quickRpc(agent , data) | @@ -477,24 +477,11 @@ function _M.quickRpc(agent , data) | ||
477 | local expCarbonData = hangInfo.expData or {} | 477 | local expCarbonData = hangInfo.expData or {} |
478 | 478 | ||
479 | local curCount = role.dailyData:getProperty("hangQC") + 1 | 479 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
480 | - local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") | 480 | + local curT = curCount * (globalCsv.idle_quickproduce_time / 3600) |
481 | + local costCount = table.findMinKeyByItem(globalCsv.idle_quickproduce_cost, curT) | ||
481 | 482 | ||
482 | - -- 增加今日探索加速次数 | ||
483 | - local maxIdx = #costs | ||
484 | - local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.ExplorationUpSpeed) | ||
485 | - if curCount > maxCount then return end | ||
486 | - | ||
487 | - if curCount > maxIdx then | ||
488 | - for idx = maxIdx+1, curCount do | ||
489 | - costs[idx] = costs[maxIdx] | ||
490 | - end | ||
491 | - end | ||
492 | - | ||
493 | - if not costs[curCount] then return end | ||
494 | - if costs[curCount] > 0 then | ||
495 | - if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end | ||
496 | - role:costItems({[ItemId.Jade] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | ||
497 | - end | 483 | + if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return end |
484 | + role:costItems({[ItemId.Jade] = costCount}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | ||
498 | 485 | ||
499 | role.dailyData:updateProperty({field = "hangQC", value = curCount}) | 486 | role.dailyData:updateProperty({field = "hangQC", value = curCount}) |
500 | 487 | ||
@@ -540,6 +527,14 @@ function _M.quickRpc(agent , data) | @@ -540,6 +527,14 @@ function _M.quickRpc(agent , data) | ||
540 | reward[k] = (reward[k] or 0) + v | 527 | reward[k] = (reward[k] or 0) + v |
541 | end | 528 | end |
542 | 529 | ||
530 | + --每次探索加速额外获得道具 | ||
531 | + local extraProps = role:getBnousExtraProps() | ||
532 | + if next(extraProps) then | ||
533 | + for k, v in pairs(extraProps) do | ||
534 | + reward[k] = (reward[k] or 0) + v | ||
535 | + end | ||
536 | + end | ||
537 | + | ||
543 | local change | 538 | local change |
544 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | 539 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) |
545 | if reward[ItemId.Gold] then | 540 | if reward[ItemId.Gold] then |
@@ -584,13 +579,16 @@ function _M.buyBonusCountRpc(agent, data) | @@ -584,13 +579,16 @@ function _M.buyBonusCountRpc(agent, data) | ||
584 | local bonusC = role.dailyData:getProperty("bonusC") | 579 | local bonusC = role.dailyData:getProperty("bonusC") |
585 | local extraCnt = role.storeData:getBonusExtraFightCount() | 580 | local extraCnt = role.storeData:getBonusExtraFightCount() |
586 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} | 581 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} |
587 | - local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] | ||
588 | - if math.illegalNum(count, 1, lastCount) then return 1 end | 582 | + --local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] |
583 | + --if math.illegalNum(count, 1, lastCount) then return 1 end | ||
584 | + | ||
585 | + local costCount = bonusC[btype]["b"] + count | ||
586 | + local cost = table.findMinKeyByItem(globalCsv.bonus_buy_cost, costCount) | ||
589 | 587 | ||
590 | - if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end | 588 | + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 2 end |
591 | 589 | ||
592 | - role:costItems({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) | ||
593 | - bonusC[btype]["b"] = bonusC[btype]["b"] + count | 590 | + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) |
591 | + bonusC[btype]["b"] = costCount | ||
594 | bonusC[btype]["c"] = bonusC[btype]["c"] - count | 592 | bonusC[btype]["c"] = bonusC[btype]["c"] - count |
595 | 593 | ||
596 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 594 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
src/models/RolePlugin.lua
@@ -3036,6 +3036,11 @@ function RolePlugin.bind(Role) | @@ -3036,6 +3036,11 @@ function RolePlugin.bind(Role) | ||
3036 | return levelBnous[SystemBnousType.AccountLevel] or 0 | 3036 | return levelBnous[SystemBnousType.AccountLevel] or 0 |
3037 | end | 3037 | end |
3038 | 3038 | ||
3039 | + function Role:getBnousExtraProps() | ||
3040 | + local levelBnous = self:getLevelBnous() | ||
3041 | + return levelBnous[SystemBnousType.ExtraProps] or {} | ||
3042 | + end | ||
3043 | + | ||
3039 | function Role:getLevelBnous() | 3044 | function Role:getLevelBnous() |
3040 | local levelBnous = {} | 3045 | local levelBnous = {} |
3041 | local curLevel = self:getProperty("level") | 3046 | local curLevel = self:getProperty("level") |
src/shared/functions.lua
@@ -865,6 +865,31 @@ function table.array2Table(arr) | @@ -865,6 +865,31 @@ function table.array2Table(arr) | ||
865 | return ret | 865 | return ret |
866 | end | 866 | end |
867 | 867 | ||
868 | +function table.findMinKeyByItem(t, item) | ||
869 | + if not t[item] then | ||
870 | + local tk = {} | ||
871 | + for k, v in pairs(t) do | ||
872 | + table.insert(tk, k) | ||
873 | + end | ||
874 | + if next(tk) then | ||
875 | + local max = table.maxkey(tk) | ||
876 | + if item > max then return t[max] end | ||
877 | + | ||
878 | + table.insert(tk, item) | ||
879 | + table.sort(tk) | ||
880 | + local index = 0 | ||
881 | + for i, k in ipairs(tk) do | ||
882 | + if k == item then | ||
883 | + index = i - 1 | ||
884 | + break | ||
885 | + end | ||
886 | + end | ||
887 | + return t[tk[index]] | ||
888 | + end | ||
889 | + else | ||
890 | + return t[item] | ||
891 | + end | ||
892 | +end | ||
868 | 893 | ||
869 | function table.rewardMerge(dest, src) | 894 | function table.rewardMerge(dest, src) |
870 | for k, v in pairs(src) do | 895 | for k, v in pairs(src) do |