Commit b2afd512575a1616399ce6fb6bd7c8c1acb0f707
Merge branch 'cn/develop' of 120.26.43.151:wasteland/server into cn/develop
Showing
5 changed files
with
78 additions
and
1 deletions
Show diff stats
src/actions/AdvAction.lua
| ... | ... | @@ -897,6 +897,11 @@ function _M.wheelSurfRpc(agent, data) |
| 897 | 897 | local costs = {[ItemId.OldCoin] = cost[ctype]} |
| 898 | 898 | if not next(costs) then return 6 end |
| 899 | 899 | |
| 900 | + local tmpcount = 1 | |
| 901 | + if ctype == 2 then | |
| 902 | + tmpcount = 10 | |
| 903 | + end | |
| 904 | + if role:checkRuneFully(tmpcount) then return 6 end | |
| 900 | 905 | |
| 901 | 906 | if not role:checkItemEnough(costs) then return 5 end |
| 902 | 907 | role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) | ... | ... |
src/actions/EmailAction.lua
| ... | ... | @@ -150,6 +150,8 @@ function _M.drawAttachRpc(agent, data) |
| 150 | 150 | if attachments == "" then return end |
| 151 | 151 | |
| 152 | 152 | local reward, change = role:award(attachments, {log = {desc = "draw_attach", int1 = id}}) |
| 153 | + if role:checkRuneFullyByReward(reward) then return 1 end | |
| 154 | + | |
| 153 | 155 | email:setProperty("status", 2, true) |
| 154 | 156 | email:log(role, 2) |
| 155 | 157 | SendPacket(actionCodes.Email_drawAttachRpc, MsgPack.pack({reward = reward, change = change})) | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -677,7 +677,7 @@ function _M.openTimeBoxRpc(agent, data) |
| 677 | 677 | local costId = msg.costId |
| 678 | 678 | local costs = (msg.costs or ""):toNumMap() |
| 679 | 679 | if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end |
| 680 | - | |
| 680 | + | |
| 681 | 681 | local costIdData = csvdb["itemCsv"][costId] |
| 682 | 682 | local count = 0 |
| 683 | 683 | for itemId, num in pairs(costs) do |
| ... | ... | @@ -686,6 +686,8 @@ function _M.openTimeBoxRpc(agent, data) |
| 686 | 686 | count = count + num |
| 687 | 687 | end |
| 688 | 688 | |
| 689 | + if role:checkRuneFully(count) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱 | |
| 690 | + | |
| 689 | 691 | if role:getItemCount(costId) < count then return 8 end |
| 690 | 692 | if not role:checkItemEnough(costs) then return 9 end |
| 691 | 693 | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -881,6 +881,8 @@ function Adv:over(success, rewardRatio, overType) |
| 881 | 881 | reward[itemId] = math.ceil(count * rewardRatio / 100) |
| 882 | 882 | end |
| 883 | 883 | end |
| 884 | + | |
| 885 | + self.owner:checkRuneCount(reward) | |
| 884 | 886 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
| 885 | 887 | |
| 886 | 888 | local backAdvCount | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -2829,6 +2829,72 @@ function RolePlugin.bind(Role) |
| 2829 | 2829 | self:mylog("hero_action", {desc = desc, int1 = heroType}) |
| 2830 | 2830 | end |
| 2831 | 2831 | |
| 2832 | + function Role:getRuneBatCount() | |
| 2833 | + local count = 0 | |
| 2834 | + for _, rune in pairs(self.runeBag) do | |
| 2835 | + if next(rune) then | |
| 2836 | + count = count + 1 | |
| 2837 | + end | |
| 2838 | + end | |
| 2839 | + return count or 0 | |
| 2840 | + end | |
| 2841 | + | |
| 2842 | + -- 铭文仓库是否满仓 | |
| 2843 | + function Role:checkRuneFully(count) | |
| 2844 | + count = count or 0 | |
| 2845 | + local page = globalCsv.store_type[ItemType.Rune] | |
| 2846 | + local limit = self:getProperty("bagLimit")[page] | |
| 2847 | + return self:getRuneBatCount() + count >= limit | |
| 2848 | + end | |
| 2849 | + | |
| 2850 | + function Role:checkRuneFullyByReward(reward) | |
| 2851 | + local count = self:getRuneBatCount() | |
| 2852 | + local page = globalCsv.store_type[ItemType.Rune] | |
| 2853 | + local limit = self:getProperty("bagLimit")[page] | |
| 2854 | + if count >= limit then | |
| 2855 | + return true | |
| 2856 | + end | |
| 2857 | + for itemId, n in pairs(reward) do | |
| 2858 | + local itemData = csvdb["itemCsv"][itemId] | |
| 2859 | + if itemData and itemData.type == ItemType.Rune then | |
| 2860 | + count = count + n | |
| 2861 | + if count > limit then return true end | |
| 2862 | + end | |
| 2863 | + end | |
| 2864 | + return false | |
| 2865 | + end | |
| 2866 | + | |
| 2867 | + -- 把溢出的铭文奖励通过邮件发送 | |
| 2868 | + function Role:checkRuneCount(reward) | |
| 2869 | + local firstMore = false | |
| 2870 | + local count = self:getRuneBatCount() | |
| 2871 | + local page = globalCsv.store_type[ItemType.Rune] | |
| 2872 | + local limit = self:getProperty("bagLimit")[page] | |
| 2873 | + if count >= limit then | |
| 2874 | + firstMore = true | |
| 2875 | + end | |
| 2876 | + | |
| 2877 | + local tmpreward = {} | |
| 2878 | + for itemId, n in pairs(reward) do | |
| 2879 | + local itemData = csvdb["itemCsv"][itemId] | |
| 2880 | + if itemData and itemData.type == ItemType.Rune then | |
| 2881 | + count = count + n | |
| 2882 | + if count > limit then | |
| 2883 | + if not firstMore then | |
| 2884 | + firstMore = true | |
| 2885 | + reward[itemId] = n - (count - limit) | |
| 2886 | + tmpreward[itemId] = count - limit | |
| 2887 | + else | |
| 2888 | + reward[itemId] = nil | |
| 2889 | + tmpreward[itemId] = n | |
| 2890 | + end | |
| 2891 | + end | |
| 2892 | + end | |
| 2893 | + end | |
| 2894 | + if next(tmpreward) then | |
| 2895 | + self:sendMail(20, nil, tmpreward) | |
| 2896 | + end | |
| 2897 | + end | |
| 2832 | 2898 | end |
| 2833 | 2899 | |
| 2834 | 2900 | return RolePlugin |
| 2835 | 2901 | \ No newline at end of file | ... | ... |