SetNet.Loot
1.2.0
dotnet add package SetNet.Loot --version 1.2.0
NuGet\Install-Package SetNet.Loot -Version 1.2.0
<PackageReference Include="SetNet.Loot" Version="1.2.0" />
<PackageVersion Include="SetNet.Loot" Version="1.2.0" />
<PackageReference Include="SetNet.Loot" />
paket add SetNet.Loot --version 1.2.0
#r "nuget: SetNet.Loot, 1.2.0"
#:package SetNet.Loot@1.2.0
#addin nuget:?package=SetNet.Loot&version=1.2.0
#tool nuget:?package=SetNet.Loot&version=1.2.0
<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>
SetNet.Loot
Server-authoritative weighted loot tables for SetNet.
Define drop tables — guaranteed entries plus a number of weighted draws — and roll them on the server, where clients never see the weights or the RNG. Drops are granted through the shared SetNet.Inventory hub. Most loot is server-triggered (a mob dies, a chest is looted in game logic); a gated client-open path handles loot boxes. Added by composition — no base class.
Install
dotnet add package SetNet
dotnet add package SetNet.Inventory
dotnet add package SetNet.Loot
Usage
Call InventoryRuntime.Enable() and LootRuntime.Enable() once at startup.
// server
InventoryRuntime.Enable(); LootRuntime.Enable();
var inventory = server.UseInventory();
var loot = server.UseLoot(inventory).Define(new LootTable("goblin", rolls: 2, entries: new[]
{
new LootEntry("gold", 5, weight: 0, guaranteed: true), // always drops
new LootEntry("dagger", 1, weight: 10),
new LootEntry("potion", 2, weight: 30),
new LootEntry("gem", 1, weight: 1), // rare
}));
// game logic when the goblin dies:
var drops = await loot.RollAndGrantAsync(playerKey, "goblin");
Client-opened containers (opt in with a policy):
var loot = server.UseLoot(inventory, new LootOptions
{
CanOpen = (playerKey, tableId) => PlayerHoldsKeyFor(playerKey, tableId)
});
// client
var loot = client.UseLoot();
var drops = await loot.OpenAsync("crate"); // throws LootException if not permitted
PlayReveal(drops);
API
Server: server.UseLoot(InventoryServer, LootOptions?) → LootServer — Define(LootTable), Roll(tableId), RollAndGrantAsync(playerKey, tableId).
Client: client.UseLoot() → LootClient — OpenAsync(tableId).
Options: CanOpen (default denies client opens), Seed (reproducible rolls for tests).
InventoryRuntime.Enable() + LootRuntime.Enable() — one-time bootstrap.
Notes
- Rides the unified SetNet.Protocol messaging layer on the
Channels.Lootchannel (all modules share one envelope wire type,65447) — no per-module wire ids to reserve. Serializer-agnostic: the control protocol is hand-framedbyte[], your payloads use yourSetNetSerializer. - RNG stays server-side. Clients can't inspect or predict drops. Set
LootOptions.Seedonly in tests. - Client opens are denied by default. Supply a
CanOpenpolicy that verifies the player actually holds the container/key; otherwise roll from server game logic withRollAndGrantAsync. - Guaranteed entries drop once per roll; weighted entries are drawn
Rollstimes by relative weight, and identical items merge into one stack.
Documentation & source
- 🐙 https://github.com/Povstalez/SetNet — full catalog in docs/MODULES.md
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- SetNet (>= 1.2.0)
- SetNet.Inventory (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 93 | 8/5/2026 |