Commit a05f7f851998b8364a2e5d9c24b108e92eeba0c3

Authored by liuzujun
2 parents b2ff0064 e82cb5dc

Merge branch 'cn/develop' of 120.26.43.151:wasteland/server into cn/develop

src/GlobalVar.lua
... ... @@ -397,10 +397,16 @@ TeamSystemType = {
397 397 Dinner = 4,
398 398 FriendBattle = 5,
399 399 }
  400 +-- 加速类型
  401 +UpSpeedType = {
  402 + ExplorationUpSpeed = 1, -- 探索加速
  403 + GearUpSpeed = 2, -- 齿轮加速
  404 + Restaurant = 3, -- 餐厅加速
400 405  
  406 +}
401 407 -- 某个功能对其他系统功能的加成类型
402 408 SystemBnousType = {
403   - TowerBuff = 1, -- 电波塔内战斗开始时获得buff
  409 + TowerBuff = 1, -- 电波塔内战斗开始时获得buff or
404 410 CrusadeTask = 2, -- 讨伐电台任务加速
405 411 DinerGet = 3, -- 食材供应商获取速度
406 412 DinerLimit = 4, -- 食材供应商上限
... ... @@ -410,4 +416,11 @@ SystemBnousType = {
410 416 HangTime = 8, -- 挂机时间上限
411 417 PvpTicket = 9, -- 每周额外获得竞技场门票数量
412 418 SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具
  419 + DismantlingMaximum = 11,-- 拆解术式模块运行时间上限
  420 + DismantlingImproved = 12,-- 拆解术式构筑效率提升
  421 + DailyReward = 13,-- 每日签到额外获得道具
  422 + TreasureBaseMaximum = 14, -- 增加宝藏资源值上限
  423 + UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数
  424 + ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加
  425 + ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加,
413 426 }
... ...
src/actions/ActivityAction.lua
... ... @@ -136,7 +136,14 @@ function _M.signRpc(agent, data)
136 136 end
137 137 signs[curDay] = yearMonth
138 138  
139   - local reward, change = role:award(monthData[curDay].item, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}})
  139 + -- 达到一定等级,签到会有额外奖励
  140 + local reward = role:getBnousDaily()
  141 + local change
  142 + local award = monthData[curDay].item:toNumMap() or {}
  143 + for k, v in pairs(award) do
  144 + reward[k] = (reward[k] or 0) + v
  145 + end
  146 + reward, change = role:award(reward, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}})
140 147 role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}})
141 148 role:checkTaskEnter("SignIn")
142 149  
... ...
src/actions/DinerAction.lua
... ... @@ -251,11 +251,20 @@ end
251 251 function _M.expediteSellRpc( agent, data )
252 252 local role = agent.role
253 253 local count = role.dinerData:getProperty("expedite")
254   - local max = #globalCsv.diner_sell_quick_cost
255   - if count > max then
256   - return 1
  254 + local maxIdx = #globalCsv.diner_sell_quick_cost
  255 +
  256 + -- 增加今日餐厅加速次数
  257 + local max = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.Restaurant)
  258 + if count > max then return 1 end
  259 +
  260 + local costs = clone(globalCsv.diner_sell_quick_cost)
  261 + if count > maxIdx then
  262 + for idx = maxIdx+1, count do
  263 + costs[idx] = costs[maxIdx]
  264 + end
257 265 end
258   - local diamond = globalCsv.diner_sell_quick_cost[count]
  266 +
  267 + local diamond = costs[count]
259 268 if diamond > 0 then
260 269 local cost = {[ItemId.Jade] = diamond}
261 270 if not role:checkItemEnough(cost) then
... ...
src/actions/EmailAction.lua
... ... @@ -132,6 +132,8 @@ function _M.drawAllAttachRpc(agent, data)
132 132 role:mylog("mail_action", {desc = "draw_attach", int1 = email:getProperty("emailId"), key1 = email:getProperty("title"), key2 = attachments})
133 133 end
134 134 end
  135 + if role:checkRuneFullyByReward(reward) then return 1 end
  136 +
135 137 reward, change = role:award(reward, {log = {desc = "draw_attach"}})
136 138 SendPacket(actionCodes.Email_drawAllAttachRpc, MsgPack.pack({ids = ids, reward = reward, change = change}))
137 139 return true
... ... @@ -151,8 +153,17 @@ function _M.drawAttachRpc(agent, data)
151 153 local attachments = getEmailAttachments(email)
152 154 if attachments == "" then return end
153 155  
154   - local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = id}})
  156 + local reward, change = {}
  157 + if type(attachments) == "string" then
  158 + for key, v in pairs(attachments:toNumMap()) do
  159 + reward[key] = (reward[key] or 0) + v
  160 + end
  161 + else
  162 + reward = attachments
  163 + end
155 164 if role:checkRuneFullyByReward(reward) then return 1 end
  165 + reward, change = role:award(reward, {log = {desc = "draw_attach", int1 = id}})
  166 +
156 167  
157 168 email:setProperty("status", 2, true)
158 169 email:log(role, 2)
... ...
src/actions/HangAction.lua
... ... @@ -478,6 +478,18 @@ function _M.quickRpc(agent , data)
478 478  
479 479 local curCount = role.dailyData:getProperty("hangQC") + 1
480 480 local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=")
  481 +
  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 +
481 493 if not costs[curCount] then return end
482 494 if costs[curCount] > 0 then
483 495 if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end
... ... @@ -568,7 +580,7 @@ function _M.buyBonusCountRpc(agent, data)
568 580 local bonusC = role.dailyData:getProperty("bonusC")
569 581 local extraCnt = role.storeData:getBonusExtraFightCount()
570 582 bonusC[btype] = bonusC[btype] or {c = 0, b = 0}
571   - local lastCount = globalCsv.bonus_daily_buy_count * coef + extraCnt - bonusC[btype]["b"]
  583 + local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"]
572 584 if math.illegalNum(count, 1, lastCount) then return 1 end
573 585  
574 586 if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end
... ... @@ -666,7 +678,7 @@ function _M.startBonusBattleRpc(agent, data)
666 678 if open and actData then
667 679 coef = tonumber(actData.condition2)
668 680 end
669   - if math.illegalNum(count, 1, globalCsv.bonus_daily_count * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end
  681 + if math.illegalNum(count, 1, (globalCsv.bonus_daily_count + role:getBnousChangeBaseCount()) * coef + extraCnt - bonusC[bonusData.type]["c"]) then return 7 end
670 682  
671 683 bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count
672 684 role.dailyData:updateProperty({field = "bonusC", value = bonusC})
... ...
src/actions/RoleAction.lua
... ... @@ -633,6 +633,7 @@ function _M.openTimeBoxRpc(agent, data)
633 633 else
634 634 local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time
635 635 local unitTime = globalCsv.box_key_time[oldId] * 60
  636 + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime)
636 637 local doneCnt = time == 0 and 0 or math.floor((process + skynet.timex() - time) / unitTime)
637 638 if doneCnt > 0 then
638 639 reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}})
... ... @@ -642,7 +643,7 @@ function _M.openTimeBoxRpc(agent, data)
642 643 if role:getItemCount(itemId) >= limit then return 3 end
643 644  
644 645 boxL[slot] = {id = itemId, process = 0, time = skynet.timex()}
645   - role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600})
  646 + role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600 + role:getBnousDismantlingMaximum()})
646 647 elseif oper == 2 then -- 重置运行时间(可以使用加速)
647 648 local quick = msg.quick
648 649 if not boxL[slot] then return 4 end
... ... @@ -652,6 +653,7 @@ function _M.openTimeBoxRpc(agent, data)
652 653 local stopTime = nowTime
653 654 local itemData = csvdb["itemCsv"][itemId]
654 655 local unitTime = globalCsv.box_key_time[itemId] * 60
  656 + unitTime = unitTime + role:getBnousDismantlingImproved(unitTime)
655 657 if quick then
656 658 stopTime = nowTime + quick
657 659 local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=")
... ... @@ -661,6 +663,8 @@ function _M.openTimeBoxRpc(agent, data)
661 663 else
662 664 stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600)
663 665 end
  666 + stopTime = stopTime + role:getBnousDismantlingMaximum()
  667 +
664 668 role:pushCancel({type = "box", slot = slot})
665 669  
666 670 local doneCnt = math.floor((process + stopTime - time) / unitTime)
... ... @@ -672,21 +676,23 @@ function _M.openTimeBoxRpc(agent, data)
672 676 end
673 677  
674 678 boxL[slot] = {id = itemId, process = (process + stopTime - time) % unitTime, time = nowTime}
675   - role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600})
  679 + role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600 + role:getBnousDismantlingMaximum()})
676 680 elseif oper == 3 then -- 开箱子
677 681 local costId = msg.costId
678 682 local costs = (msg.costs or ""):toNumMap()
679 683 if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end
680 684  
681 685 local costIdData = csvdb["itemCsv"][costId]
682   - local count = 0
  686 + local count, runeCount = 0, 0
683 687 for itemId, num in pairs(costs) do
684 688 local itemIdData = csvdb["itemCsv"][itemId]
685 689 if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end
  690 +
  691 + if itemIdData.type == ItemType.Rune then runeCount = runeCount + num end
686 692 count = count + num
687 693 end
688 694  
689   - if role:checkRuneFully(count) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱
  695 + if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱
690 696  
691 697 if role:getItemCount(costId) < count then return 8 end
692 698 if not role:checkItemEnough(costs) then return 9 end
... ... @@ -701,8 +707,8 @@ function _M.openTimeBoxRpc(agent, data)
701 707 role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}})
702 708 for _ = 1, value do
703 709 for i = 1, 10 do
704   - local num = randomData["num" .. i]
705   - local gift = randomData["gift" .. i]
  710 + local num = randomData["num" .. tostring(i)]
  711 + local gift = randomData["gift" .. tostring(i)]
706 712 if num and gift and num > 0 and gift ~= "" then
707 713 local pool = {}
708 714 for _, temp in ipairs(gift:toArray()) do
... ... @@ -1392,7 +1398,20 @@ end
1392 1398 function _M.goldBuyRpc(agent, data)
1393 1399 local role = agent.role
1394 1400 local curT = role.dailyData:getProperty("goldBuyT")
1395   - local costD = globalCsv.idle_quickMoney_cost[curT]
  1401 +
  1402 + local costs = clone(globalCsv.idle_quickMoney_cost)
  1403 + -- 增加今日齿轮加速次数
  1404 + local maxIdx = #globalCsv.idle_quickMoney_cost
  1405 + local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.GearUpSpeed)
  1406 + if curT > maxCount then return end
  1407 + if curT > maxIdx then
  1408 + for idx = maxIdx+1, curCount do
  1409 + costs[idx] = costs[maxIdx]
  1410 + end
  1411 + end
  1412 +
  1413 + local costD = costs[curT]
  1414 +
1396 1415 if not costD then
1397 1416 return 1
1398 1417 end
... ...
src/models/Role.lua
... ... @@ -76,6 +76,7 @@ Role.schema = {
76 76 expireItem = {"table", {}}, --物品过期检查
77 77 funcOpen = {"table", {}}, --功能是否开放
78 78 funcLv = {"table", {}}, --功能等级
  79 + levelBnous = {"table", {}}, --等级奖励
79 80 -- loveStatus = {"string", ""}, --统计角色的最高 好感度等级 类型相关 -- type=loveL type=loveL
80 81 crown = {"number", 0}, -- 看伴娘
81 82 silent = {"number", 0}, --禁言解禁时间
... ... @@ -354,6 +355,7 @@ function Role:data()
354 355 items = self:getProperty("items"):toNumMap(),
355 356 funcOpen = self:getProperty("funcOpen"),
356 357 funcLv = self:getProperty("funcLv"),
  358 + levelBnous = self:getProperty("levelBnous"),
357 359 -- loveStatus = self:getProperty("loveStatus"):toNumMap(),
358 360 timeReset = self:getProperty("timeReset"),
359 361 diamond = self:getAllDiamond(),
... ...
src/models/RolePlugin.lua
... ... @@ -284,6 +284,7 @@ function RolePlugin.bind(Role)
284 284 newExp = newExp - csvdb["player_expCsv"][level].exp
285 285 level = level + 1
286 286 self:checkTaskEnter("RoleLevelUp", {level = level})
  287 + self:getLevelBnous(level)
287 288 else
288 289 newExp = csvdb["player_expCsv"][level].exp - 1 -- 没有下一级了 经验溢出太多 扣除
289 290 end
... ... @@ -2759,45 +2760,149 @@ function RolePlugin.bind(Role)
2759 2760  
2760 2761 function Role:getBnousCrusade(value)
2761 2762 local towerBnous = self:getTowerBnousActive()
2762   - return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value)
  2763 + local levelValue = self:getDeltaValue(self:getProperty("levelBnous")[SystemBnousType.CrusadeTask], value)
  2764 + local towerValue = self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value)
  2765 + return levelValue + towerValue
2763 2766 end
2764 2767  
2765 2768 function Role:getBnousDiner(type, value)
2766 2769 local towerBnous = self:getTowerBnousActive()
2767 2770 type = type or 1
2768   - local result
  2771 + local result, levelReault
2769 2772 if type == 1 then
2770 2773 result = towerBnous[SystemBnousType.DinerGet]
  2774 + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerGet]
2771 2775 elseif type == 2 then
2772 2776 result = towerBnous[SystemBnousType.DinerLimit]
  2777 + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerLimit]
2773 2778 elseif type == 3 then
2774 2779 result = towerBnous[SystemBnousType.DinerSell]
  2780 + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerSell]
2775 2781 elseif type == 4 then
2776 2782 result = towerBnous[SystemBnousType.DinerPrice]
  2783 + levelReault = self:getProperty("levelBnous")[SystemBnousType.DinerPrice]
2777 2784 end
2778   - return self:getDeltaValue(result, value)
  2785 + return self:getDeltaValue(result, value) + self:getDeltaValue(levelReault, value)
2779 2786 end
2780 2787  
  2788 + local function appendBnous(dstBnous, srcBnous)
  2789 + if not dstBnous or not srcBnous then return end
  2790 + for time, set in pairs(srcBnous) do
  2791 + if not dstBnous[time] then
  2792 + dstBnous[time] = {}
  2793 + end
  2794 + for key, value in pairs(set) do
  2795 + dstBnous[time][key] = (dstBnous[time][key] or 0) + value
  2796 + end
  2797 + end
  2798 + end
2781 2799 function Role:getBnousAdv()
2782 2800 local towerBnous = self:getTowerBnousActive()
  2801 + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.Adv] or {}
  2802 + appendBnous(towerBnous[SystemBnousType.Adv], levelBnous)
2783 2803 return towerBnous[SystemBnousType.Adv] or {}
2784 2804 end
2785 2805  
2786 2806 function Role:getBnousHangTime()
2787 2807 local towerBnous = self:getTowerBnousActive()
2788   - return towerBnous[SystemBnousType.HangTime] or 0
  2808 + local levelBnous = self:getProperty("levelBnous") or {}
  2809 + local tmptime = 0
  2810 + if next(levelBnous) then
  2811 + tmptime = levelBnous[SystemBnousType.HangTime] or 0
  2812 + end
  2813 + return towerBnous[SystemBnousType.HangTime] or 0 + tmptime
2789 2814 end
2790 2815  
2791 2816 function Role:getBnousPvpTicket()
2792 2817 local towerBnous = self:getTowerBnousActive()
  2818 + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.PvpTicket] or {}
  2819 + appendBnous(towerBnous[SystemBnousType.PvpTicket], levelBnous)
2793 2820 return towerBnous[SystemBnousType.PvpTicket] or {}
2794 2821 end
2795 2822  
2796 2823 function Role:getBnousSweep()
2797 2824 local towerBnous = self:getTowerBnousActive()
  2825 + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.SweepReward] or {}
  2826 + appendBnous(towerBnous[SystemBnousType.SweepReward], levelBnous)
2798 2827 return towerBnous[SystemBnousType.SweepReward] or {}
2799 2828 end
2800 2829  
  2830 + function Role:getBnousDismantlingMaximum()
  2831 + return self:getProperty("levelBnous")[SystemBnousType.DismantlingMaximum] or 0
  2832 + end
  2833 +
  2834 + function Role:getBnousDismantlingImproved(value)
  2835 + local result = self:getProperty("levelBnous")[SystemBnousType.DismantlingImproved] or {}
  2836 + return self:getDeltaValue(result, value)
  2837 + end
  2838 +
  2839 + function Role:getBnousDaily()
  2840 + local reward = {}
  2841 + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.DailyReward] or {}
  2842 + for k, v in pairs(levelBnous) do
  2843 + reward[k] = (reward[k] or 0) + v
  2844 + end
  2845 + return reward
  2846 + end
  2847 +
  2848 + function Role:getBnousTreasureBaseMaximum()
  2849 + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.TreasureBaseMaximum] or 0
  2850 + local treasureBase = self.dailyData:getProperty("treasureBase") + levelBnous
  2851 + self.dailyData:updateProperty({field = "treasureBase", value = treasureBase})
  2852 + end
  2853 +
  2854 + --@upType 加速类型 1探索加速, 2齿轮加速, 3餐厅加速
  2855 + function Role:getBnousUpSpeedNum(upType)
  2856 + local levelBnous = self:getProperty("levelBnous")[SystemBnousType.UpSpeedNum] or {}
  2857 + if next(levelBnous) then
  2858 + return levelBnous[upType] or 0
  2859 + end
  2860 + return 0
  2861 + end
  2862 +
  2863 + function Role:getBnousChangeBaseCount()
  2864 + return self:getProperty("levelBnous")[SystemBnousType.ChangeBaseCount] or 0
  2865 + end
  2866 +
  2867 + function Role:getBnousChangeBuyCount()
  2868 + return self:getProperty("levelBnous")[SystemBnousType.ChangeBuyCount] or 0
  2869 + end
  2870 +
  2871 + function Role:getLevelBnous(level)
  2872 + local levelBnous = self:getProperty("levelBnous")
  2873 + local additionData = csvdb["level_additionCsv"][level]
  2874 + if additionData then
  2875 + local effects = additionData.effect:toTableArraySec()
  2876 + for _, effect in pairs(effects) do
  2877 + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4])
  2878 + if not levelBnous[pm1] then
  2879 + levelBnous[pm1] = {}
  2880 + end
  2881 + if pm1 == SystemBnousType.TowerBuff then
  2882 +
  2883 + elseif pm1 == SystemBnousType.Adv then
  2884 + if not levelBnous[pm1][pm4] then
  2885 + levelBnous[pm1][pm4] = {}
  2886 + end
  2887 + levelBnous[pm1][pm4][pm2] = (levelBnous[pm1][pm4][pm2] or 0) + pm3
  2888 + elseif pm1 == SystemBnousType.HangTime or
  2889 + pm1 == SystemBnousType.DismantlingMaximum or
  2890 + pm1 == SystemBnousType.TreasureBaseMaximum or
  2891 + pm1 == SystemBnousType.ChangeBaseCount or
  2892 + pm1 == SystemBnousType.ChangeBuyCount then
  2893 + if type(levelBnous[pm1]) == "table" then
  2894 + levelBnous[pm1] = 0
  2895 + end
  2896 + levelBnous[pm1] = levelBnous[pm1] + pm2
  2897 + else
  2898 + levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3
  2899 + end
  2900 + end
  2901 + end
  2902 + self:updateProperty({field = "levelBnous", value= levelBnous})
  2903 + return levelBnous
  2904 + end
  2905 +
2801 2906 function Role:getPotionLevel(id)
2802 2907 local level = self.dinerData:getProperty("dishTree"):getv(id, 1)
2803 2908 local talentSet = csvdb["diner_talentCsv"][id]
... ... @@ -2844,7 +2949,7 @@ function RolePlugin.bind(Role)
2844 2949 count = count or 0
2845 2950 local page = globalCsv.store_type[ItemType.Rune]
2846 2951 local limit = self:getProperty("bagLimit")[page]
2847   - return self:getRuneBatCount() + count >= limit
  2952 + return self:getRuneBatCount() + count > limit
2848 2953 end
2849 2954  
2850 2955 function Role:checkRuneFullyByReward(reward)
... ... @@ -2895,6 +3000,8 @@ function RolePlugin.bind(Role)
2895 3000 self:sendMail(20, nil, tmpreward)
2896 3001 end
2897 3002 end
  3003 +
  3004 +
2898 3005 end
2899 3006  
2900 3007 return RolePlugin
2901 3008 \ No newline at end of file
... ...