Commit 509601655ec1c6ae972cde43c74dc4594dd5763a
Merge branch 'cn/develop' into cn/publish/preview
Showing
3 changed files
with
49 additions
and
7 deletions
Show diff stats
src/GlobalVar.lua
@@ -424,3 +424,14 @@ SystemBnousType = { | @@ -424,3 +424,14 @@ SystemBnousType = { | ||
424 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 | 424 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
425 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, | 425 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, |
426 | } | 426 | } |
427 | + | ||
428 | +-- 开箱物品类型 | ||
429 | +ItemOccupy = { | ||
430 | + EquipBase = 1, --装备 | ||
431 | + Rune = 2, --铭文 | ||
432 | + Diner = 3, --食材 | ||
433 | + CommonPaster = 4, --贴纸 | ||
434 | + Spark = 5, --火花 | ||
435 | + Other = 6, | ||
436 | + CanUsed = 7, --可使用 | ||
437 | +} | ||
427 | \ No newline at end of file | 438 | \ No newline at end of file |
src/actions/RoleAction.lua
@@ -686,13 +686,17 @@ function _M.openTimeBoxRpc(agent, data) | @@ -686,13 +686,17 @@ function _M.openTimeBoxRpc(agent, data) | ||
686 | local count, runeCount = 0, 0 | 686 | local count, runeCount = 0, 0 |
687 | for itemId, num in pairs(costs) do | 687 | for itemId, num in pairs(costs) do |
688 | local itemIdData = csvdb["itemCsv"][itemId] | 688 | local itemIdData = csvdb["itemCsv"][itemId] |
689 | - if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end | 689 | + local itemRandomData = csvdb["item_randomCsv"][itemId] |
690 | + if not itemIdData or not itemRandomData or costIdData.quality ~= itemIdData.quality then return 7 end | ||
690 | 691 | ||
691 | - if itemIdData.type == ItemType.Rune then runeCount = runeCount + num end | 692 | + local itemRandomOccupy = role:getItemRandomOccupy(itemRandomData) |
693 | + if next(itemRandomOccupy) then | ||
694 | + runeCount = runeCount + (itemRandomOccupy[ItemOccupy.Rune] or 0) * num | ||
695 | + end | ||
692 | count = count + num | 696 | count = count + num |
693 | end | 697 | end |
694 | 698 | ||
695 | - if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开箱 | 699 | + if role:checkRuneFully(runeCount) then return 10 end --开箱子,如果铭文仓库已经满了则不让开铭文箱 |
696 | 700 | ||
697 | if role:getItemCount(costId) < count then return 8 end | 701 | if role:getItemCount(costId) < count then return 8 end |
698 | if not role:checkItemEnough(costs) then return 9 end | 702 | if not role:checkItemEnough(costs) then return 9 end |
src/models/RolePlugin.lua
@@ -2934,11 +2934,13 @@ function RolePlugin.bind(Role) | @@ -2934,11 +2934,13 @@ function RolePlugin.bind(Role) | ||
2934 | self:mylog("hero_action", {desc = desc, int1 = heroType}) | 2934 | self:mylog("hero_action", {desc = desc, int1 = heroType}) |
2935 | end | 2935 | end |
2936 | 2936 | ||
2937 | - function Role:getRuneBatCount() | 2937 | + function Role:getRuneBagCount() |
2938 | local count = 0 | 2938 | local count = 0 |
2939 | for _, rune in pairs(self.runeBag) do | 2939 | for _, rune in pairs(self.runeBag) do |
2940 | if next(rune) then | 2940 | if next(rune) then |
2941 | - count = count + 1 | 2941 | + if rune:getProperty("refer") == 0 then |
2942 | + count = count + 1 | ||
2943 | + end | ||
2942 | end | 2944 | end |
2943 | end | 2945 | end |
2944 | return count or 0 | 2946 | return count or 0 |
@@ -2947,13 +2949,28 @@ function RolePlugin.bind(Role) | @@ -2947,13 +2949,28 @@ function RolePlugin.bind(Role) | ||
2947 | -- 铭文仓库是否满仓 | 2949 | -- 铭文仓库是否满仓 |
2948 | function Role:checkRuneFully(count) | 2950 | function Role:checkRuneFully(count) |
2949 | count = count or 0 | 2951 | count = count or 0 |
2952 | + if count == 0 then return false end | ||
2953 | + | ||
2950 | local page = globalCsv.store_type[ItemType.Rune] | 2954 | local page = globalCsv.store_type[ItemType.Rune] |
2951 | local limit = self:getProperty("bagLimit")[page] | 2955 | local limit = self:getProperty("bagLimit")[page] |
2952 | - return self:getRuneBatCount() + count > limit | 2956 | + return self:getRuneBagCount() + count > limit |
2957 | + end | ||
2958 | + | ||
2959 | + local function checkHasRuneByReward(reward) | ||
2960 | + reward = reward or {} | ||
2961 | + for itemId, _ in pairs(reward) do | ||
2962 | + local itemData = csvdb["itemCsv"][itemId] | ||
2963 | + if itemData and itemData.type == ItemType.Rune then | ||
2964 | + return true | ||
2965 | + end | ||
2966 | + end | ||
2967 | + return false | ||
2953 | end | 2968 | end |
2954 | 2969 | ||
2955 | function Role:checkRuneFullyByReward(reward) | 2970 | function Role:checkRuneFullyByReward(reward) |
2956 | - local count = self:getRuneBatCount() | 2971 | + if not checkHasRuneByReward(reward) then return false end |
2972 | + | ||
2973 | + local count = self:getRuneBagCount() | ||
2957 | local page = globalCsv.store_type[ItemType.Rune] | 2974 | local page = globalCsv.store_type[ItemType.Rune] |
2958 | local limit = self:getProperty("bagLimit")[page] | 2975 | local limit = self:getProperty("bagLimit")[page] |
2959 | if count >= limit then | 2976 | if count >= limit then |
@@ -3001,6 +3018,16 @@ function RolePlugin.bind(Role) | @@ -3001,6 +3018,16 @@ function RolePlugin.bind(Role) | ||
3001 | end | 3018 | end |
3002 | end | 3019 | end |
3003 | 3020 | ||
3021 | + function Role:getItemRandomOccupy(itemRandomData) | ||
3022 | + local itemRandomOccupy = {} | ||
3023 | + if itemRandomData then | ||
3024 | + for typ, n in pairs(itemRandomData.ware:toNumMap() or {}) do | ||
3025 | + itemRandomOccupy[typ] = n | ||
3026 | + end | ||
3027 | + end | ||
3028 | + return itemRandomOccupy | ||
3029 | + end | ||
3030 | + | ||
3004 | 3031 | ||
3005 | end | 3032 | end |
3006 | 3033 |