Valheim

File information

Last updated

Original upload

Created by

aedenthorn

Uploaded by

aedenthorn

Virus scan

Safe to use

Tags for this mod

About this mod

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.

Permissions and credits
Changelogs
Donations
This mod was created in conjunction with Exiled Island, a Role-Playing community with a modded Valheim server. It was their idea and they helped a lot in the testing. If you want to play on a server where this mod is already up and running, visit their discord server: https://discord.gg/eW9wAMJ2N7

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. The mod comes with four sample reward packages, created by the Exiled Island admin.


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.

Click here for a list of all my mods for Valheim.