NewHaven-Server_Rewards icon

Server Rewards

Creates a currency system for dedicated servers, whereby clients can gain currency by logging in and staying logged in and buy customizable loot boxes with earned currency

Last updated 2 years ago
Total downloads 1009
Total rating 0 
Categories Server-side Client-side
Dependency string NewHaven-Server_Rewards-0.6.2
Dependants 7 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.1900 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.1900

README

Server Rewards

This mod was created by and all credit goes to aedenthorn. Uploaded with the Upload permission - You can upload this file to other sites but you must credit me as the creator of the file, as of the 28/05/2022. Everything within the content of this read me is a direct copy from the nexus pages description.

Creates a currency system for dedicated servers, whereby clients can gain currency by logging in and staying logged in and buy customizable loot boxes with earned currency.

This mod has two parts.

First, it creates server records for every Steam player who logs in to the server and rewards them in-game currency in various ways. Second, it provides a store UI on the client populated by the server with loot boxes of different customizable types.

Currency System

The mod allows servers to reward currency in the following ways:

Static daily login reward Incremental consecutive daily login rewards, either looping or one-off Per interval on-line reward (default per minute)

These values are customizable in the config file (only for the server instance).

Currency records are stored on the server in BepInEx/plugins/ServerRewards/PlayerInfo.

There is a config option to set a starting currency for new users.

Admin users can also award currency manually using the in-game console (See console commands, below)

Rewards Store

Clients access the rewards store by pressing a customizable hotkey (default F10).

The reward store is populated with store packages defined by the current server that can be purchased by clients once they have sufficient currency with that server.

Purchasing a rewards package causes rewards items to spawn in front of the player, either on the ground or in a tombstone.

Reward items are determined by the server based on the package's configuration (see below).

Store Packages

Store packages can be created on the server using JSON files, for example:

{ "id": "Shields", "name": "Shields", "price": 50, "type": "Common", "limit": 1, "items": [ "ShieldWood,1,70,choice", "ShieldBronzeBuckler,1,30,choice" ] }

id: must be unique name: the display name, can contain formatting, etc. type: a customizable type, corresponding to an icon image file name (see below). limit: an optional limit per user (set to 0 or omit for unlimited). items: a list of strings with item info (see below).

Store packages should be added to the server in BepInEx/plugins/ServerRewards/StoreInfo.

Reward Items

The items entry in a store package uses the following syntax:

"<name>,<amount>,<percentChance>,<chanceType>"

name: must be a spawn name amount: how many to reward - if it contains a minus sign, it will be taken as a range, e.g. 5-10 will give a random number between 5 and 10 inclusive. percentChance: the chance of awarding this item chanceType: either choice or chance. If choice, you must include enough items in the list to add up to 100% chance and only one of them will be chosen at random, as in the above example. If chance, then it is a straight chance out of 100 for each item and multiple or no items of chance type may be awarded. Both types can be in the same package.

Store Icons

Each package will be displayed with an icon corresponding to its type. There must be a corresponding png file on the client instance with the same name as the type. For example, if you make a package with a type "Common" as in the example, you will need a png file called Common.png.

Store icons are located on the client at BepInEx/plugins/ServerRewards/Assets. The mod comes with four icons: Common, Rare, Epic, and Legendary.

Console Commands

Console is opened by pressing F5. Console commands for this mod include:

serverrewards list users serverrewards list packages serverrewards give <steamIdOrUsername> <currency> serverrewards give all <currency> serverrewards set <steamIdOrUsername> <currency> serverrewards set all <currency> serverrewards givepackage <steamIdOrUsername> <packageName> serverrewards givepackage all <packageName> serverrewards spawn <spawnName>

Console commands must be run by admin users.

Config

A config file BepInEx/config/aedenthorn.ServerRewards.cfg is created after running the game once with this mod.

You can adjust the config values by editing this file using a text editor or in-game using the Config Manager.

To reload the config from the config file, type serverrewards reset into the game's console (F5).

Technical

To install this mod, place the archive contents in the BepInEx/plugins folder. You will need BepInEx.

Code is at https://github.com/aedenthorn/ValheimMods.

If you want to complain or ask for help or help me test my mods, you can visit my Discord server (https://discord.gg/bs6zHuj).