Commit 993def2f7e37f5d2a1a49fbb30f2100991b1d625
1 parent
eb87ab7d
碎片直接转换为其他碎片
Showing
1 changed file
with
29 additions
and
0 deletions
Show diff stats
src/models/RolePlugin.lua
| @@ -102,6 +102,35 @@ function RolePlugin.bind(Role) | @@ -102,6 +102,35 @@ function RolePlugin.bind(Role) | ||
| 102 | [ItemType.FuncOpen] = function() | 102 | [ItemType.FuncOpen] = function() |
| 103 | self:funcOpen(itemId, count, pms) | 103 | self:funcOpen(itemId, count, pms) |
| 104 | end, | 104 | end, |
| 105 | + [ItemType.HeroFCommon] = function() | ||
| 106 | + if itemData.use_type == 2 then | ||
| 107 | + local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] | ||
| 108 | + for _i = 1, count do | ||
| 109 | + for i = 1, 10 do | ||
| 110 | + local num = randomData["num" .. i] | ||
| 111 | + local gift = randomData["gift" .. i] | ||
| 112 | + if num and gift and num > 0 and gift ~= "" then | ||
| 113 | + local pool = {} | ||
| 114 | + for _, temp in ipairs(gift:toArray()) do | ||
| 115 | + table.insert(pool, temp:toArray(true, "=")) | ||
| 116 | + end | ||
| 117 | + local needCount = math.min(#pool, num) | ||
| 118 | + for j = 1, needCount do | ||
| 119 | + local idx = math.randWeight(pool, 3) | ||
| 120 | + change[pool[idx][1]] = (change[pool[idx][1]] or 0) + pool[idx][2] | ||
| 121 | + table.remove(pool, idx) | ||
| 122 | + end | ||
| 123 | + end | ||
| 124 | + end | ||
| 125 | + end | ||
| 126 | + change[0] = nil | ||
| 127 | + count = 0 | ||
| 128 | + else | ||
| 129 | + pms.itemId = itemId | ||
| 130 | + pms.count = count | ||
| 131 | + self:addItem(pms) | ||
| 132 | + end | ||
| 133 | + end, | ||
| 105 | } | 134 | } |
| 106 | -- 对数量筛查 | 135 | -- 对数量筛查 |
| 107 | count = checkItemCount(self, itemId, count) | 136 | count = checkItemCount(self, itemId, count) |