Commit c19289495fdf749ccfc85b62087f4361e1c92ce9
1 parent
e6845afa
勋章兑换增加不能兑换的碎片判断
Showing
1 changed file
with
8 additions
and
3 deletions
Show diff stats
src/actions/RoleAction.lua
@@ -528,14 +528,19 @@ function _M.saleItemRpc(agent, data) | @@ -528,14 +528,19 @@ function _M.saleItemRpc(agent, data) | ||
528 | local role = agent.role | 528 | local role = agent.role |
529 | local msg = MsgPack.unpack(data) | 529 | local msg = MsgPack.unpack(data) |
530 | local backs = msg.backs | 530 | local backs = msg.backs |
531 | - if not backs then return end | 531 | + if not backs or not next(backs) then return 0 end |
532 | + | ||
533 | + for itemId, count in pairs(backs) do | ||
534 | + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return 1 end | ||
535 | + if globalCsv.unit_paster_ban[itemId] then return 2 end | ||
536 | + local itemData = csvdb["itemCsv"][itemId] | ||
537 | + if itemData.sell_effect == "" then return 3 end | ||
538 | + end | ||
532 | 539 | ||
533 | local reward = {} | 540 | local reward = {} |
534 | local fragCount = 0 | 541 | local fragCount = 0 |
535 | for itemId, count in pairs(backs) do | 542 | for itemId, count in pairs(backs) do |
536 | - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | ||
537 | local itemData = csvdb["itemCsv"][itemId] | 543 | local itemData = csvdb["itemCsv"][itemId] |
538 | - if itemData.sell_effect == "" then return end | ||
539 | if itemData.type == ItemType.HeroFragment or itemData.type == ItemType.HeroFCommon then | 544 | if itemData.type == ItemType.HeroFragment or itemData.type == ItemType.HeroFCommon then |
540 | fragCount = fragCount + count | 545 | fragCount = fragCount + count |
541 | end | 546 | end |