{"id":"meowtsun/lootset","name":"lootset","scope":"meowtsun","platform":"roblox","description":"LootSet is an immutable loot container built around table-based configurations rather than raw objects","version":"1.0.0","latest":"1.0.0","versions":["1.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"3213a64a3cccc0f1c61156c1c4fc28557d06127deeb8262bb853a76f821c518b","likes":0,"downloads":0,"install":"forest install meowtsun/lootset","url":"https://forest.dev/p/roblox/meowtsun/lootset","files":"https://api.forest.dev/ai/package/roblox/meowtsun/lootset/files","readme":"# LootSet `1.0.0`\r\n\r\n---\r\n\r\nLootSet is an immutable loot container built around table-based configurations rather than raw objects\r\n\r\n---\r\n\r\n### Installation\r\n\r\n##### Creator Store\r\n\r\nyou can get the module directly from [Creator Store](https://create.roblox.com/store/asset/73521444680703/LootSet)\r\n\r\n##### Releases\r\n\r\nif you need specific versions you can look into [releases](https://github.com/Meowtsun/LootSet/releases)\r\n\r\n##### Wally\r\n\r\nyou can install using Wally `meowtsun/lootset@1.0.0`\r\n\r\n---\r\n\r\n### Overview\r\n\r\n```lua\r\n-- StoneDepositConfig.lua\r\n\r\nlocal LootSet = require(...)\r\nreturn LootSet.new({\r\n\r\n    Wood = LootSet.loot(50, {\r\n        DisplayName = \"Wood\",\r\n        SellPrice = 1,\r\n        StackSize = 99,\r\n    }),\r\n\r\n    Iron = LootSet.loot(15, {\r\n        DisplayName = \"Iron Ingot\",\r\n        SellPrice = 5,\r\n        StackSize = 99,\r\n    }),\r\n\r\n    Diamond = LootSet.loot(3, {\r\n        DisplayName = \"Diamond\",\r\n        SellPrice = 25,\r\n        StackSize = 10,\r\n    }),\r\n\r\n})\r\n```\r\n\r\n```lua\r\n-- other scripts\r\n\r\nlocal config = require(\"StoneDepositConfig.lua\")\r\nlocal asPercentage = true\r\n\r\nprint(config.Iron.DisplayName) -- Iron Ingot\r\nprint(config:GetWeightOf('Iron', asPercentage) -- ~22.06\r\n-- usable as config\r\n\r\nlocal luck = 0\r\nlocal item = config:Roll(luck)\r\nprint(item)\r\nprint(item.DisplayName)\r\nprint(item.StackSize)\r\n-- usable as lootbag, luck & attempts supported\r\n\r\nlocal amount, luck = 300, 20\r\nconfig:Sample('High Luck Test', amount, luck)\r\n-- sampling for testing\r\n```\r\n\r\n---\r\n\r\n### APIs\r\n\r\n`LootSet.new(config: t) -> (LootSet & t)` - give back LootSet object\r\n\r\n`LootSet.loot(weight: number, item: a) -> a` - for assigning loot\r\n\r\n`LootSet:Roll(luck: number?, attempts: number?) -> a` - get random item, luck and attempts can be provided\r\n\r\n`LootSet:Sample(name: string, amount: number, luck: number?, attempts: number?) -> ()` - sample results, prints in output\r\n\r\n`LootSet:GetWeightOf(name: string, usePercentage: boolean?) -> (number)` - get weight of an item, use assigned index\r\n\r\n`ListWeights: (self: LootSet, usePercentage: boolean?) -> {{Weight: number,Item: any}}` - get entire array of items and their weight\r\n","readmeTruncated":false}