diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 8c31c0b..a31c745 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -102,6 +102,35 @@ function RolePlugin.bind(Role) [ItemType.FuncOpen] = function() self:funcOpen(itemId, count, pms) end, + [ItemType.HeroFCommon] = function() + if itemData.use_type == 2 then + local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] + for _i = 1, count do + for i = 1, 10 do + local num = randomData["num" .. i] + local gift = randomData["gift" .. i] + if num and gift and num > 0 and gift ~= "" then + local pool = {} + for _, temp in ipairs(gift:toArray()) do + table.insert(pool, temp:toArray(true, "=")) + end + local needCount = math.min(#pool, num) + for j = 1, needCount do + local idx = math.randWeight(pool, 3) + change[pool[idx][1]] = (change[pool[idx][1]] or 0) + pool[idx][2] + table.remove(pool, idx) + end + end + end + end + change[0] = nil + count = 0 + else + pms.itemId = itemId + pms.count = count + self:addItem(pms) + end + end, } -- 对数量筛查 count = checkItemCount(self, itemId, count) -- libgit2 0.21.2