SetNet.Loot 1.2.0

dotnet add package SetNet.Loot --version 1.2.0
                    
NuGet\Install-Package SetNet.Loot -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SetNet.Loot" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetNet.Loot" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="SetNet.Loot" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SetNet.Loot --version 1.2.0
                    
#r "nuget: SetNet.Loot, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SetNet.Loot@1.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SetNet.Loot&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=SetNet.Loot&version=1.2.0
                    
Install as a Cake Tool

<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?)LootServerDefine(LootTable), Roll(tableId), RollAndGrantAsync(playerKey, tableId). Client: client.UseLoot()LootClientOpenAsync(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.Loot channel (all modules share one envelope wire type, 65447) — no per-module wire ids to reserve. Serializer-agnostic: the control protocol is hand-framed byte[], your payloads use your SetNetSerializer.
  • RNG stays server-side. Clients can't inspect or predict drops. Set LootOptions.Seed only in tests.
  • Client opens are denied by default. Supply a CanOpen policy that verifies the player actually holds the container/key; otherwise roll from server game logic with RollAndGrantAsync.
  • Guaranteed entries drop once per roll; weighted entries are drawn Rolls times by relative weight, and identical items merge into one stack.

Documentation & source

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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