misticos
Modify loot on the server

Supported Games
GameServerKingsGameServerKings

This plugin is a loot system for your server. You can modify content of all the containers and do whatever you want!

WARNING! This plugin restores all the containers' loot after it's unload.

Permissions

  • lootplus.lootsave - Permission for lootsave command.
  • lootplus.lootrefill - Permission for lootrefill command.
  • lootplus.loadconfig - Permission for lootconfig command.

Commands

  • lootsave - Fill your inventory with items you want to be in the container and use this command. You need to look at the container/etc.
  • lootrefill - Refill all loot, without any kind of restarts, etc.
  • lootconfig - Load the config without refilling all loot, restarting the plugin, etc. Helpful for enabling debug without spam on plugin load.

All commands can be easily changed in the configuration.

Localization

English

{
  "In-Game Only": "Please, use this only while you're in the game",
  "No Permission": "You don't have enough permissions",
  "No Loot Container": "Please, look at the loot container in 10m",
  "Loot Container Saved": "You have saved this loot container data to configuration",
  "Loot Refill Started": "Loot refill process just started",
  "Config Loaded": "Your configuration was loaded"
}

Configuration

Default Configuration

{
  "Refill Loot On Plugin Load": true,
  "Container Loot Save Command": "lootsave",
  "Container Refill Command": "lootrefill",
  "Load Config Command": "lootconfig",
  "Containers": [
    {
      "Entity Shortnames": [
        {
          "Shortname": "entity.shortname",
          "Enable Regex": false,
          "Exclude": false,
          "API Shortname": false
        }
      ],
      "Process Corpses": true,
      "Process Loot Containers": true,
      "Monument Prefabs": [
        ""
      ],
      "Shuffle Items": true,
      "Allow Duplicate Items": false,
      "Allow Duplicate Items With Different Skins": true,
      "Remove Container": false,
      "Item Container Indexes": [
        0
      ],
      "Replace Items": true,
      "Add Items": false,
      "Modify Items": false,
      "Modify Ignores Blueprint State": false,
      "Fill With Default Items": false,
      "Online Condition": {
        "Minimal Online": -1,
        "Maximal Online": -1
      },
      "Maximal Failures To Add An Item": 5,
      "Capacity": [
        {
          "Capacity": 3,
          "Chance": 1
        }
      ],
      "Items": [
        {
          "Item Shortnames": [
            {
              "Shortname": "item.shortname",
              "Rarity": "global",
              "Category": "global",
              "Enable Regex": false,
              "Exclude": false
            }
          ],
          "Item Name (Empty To Ignore)": "",
          "Is Blueprint": false,
          "Allow Stacking": true,
          "Ignore Max Stack": true,
          "Ignore Max Condition": true,
          "Remove Item": false,
          "Replace Item With Default Loot": false,
          "Conditions": [
            {
              "Minimal Condition": 75.0,
              "Maximal Condition": 100.0,
              "Max Condition Of Item": -1.0,
              "Condition Rate": -1.0,
              "Max Condition Rate": -1.0,
              "Chance": 1
            }
          ],
          "Skins": [
            {
              "Skin": 0,
              "Chance": 1
            }
          ],
          "Amount": [
            {
              "Minimal Amount": 3,
              "Maximal Amount": 3,
              "Rate": -1.0,
              "Chance": 1
            }
          ],
          "Chance": 1
        }
      ]
    }
  ],
  "Debug": false
}

How-To

Refill Loot On Plugin Load is whether to refill loot on plugin load. Disable to prevent unnecessary changes and performance improvement but only on a test server. On your real server you should turn it on.

Container is a configuration entry that describes a group that can contain different containers that match specified shortnames, regex and etc.

Entity Shortnames are entries that let you select certain containers or exclude in case you do not need some. Use "global" to include all containers.

Process Corpses is whether this container should process corpses at all. Notice that it always ignores players' corpses.

Process Loot Containers is whther this container should process loot containers (not all containers tho).

Monument Prefabs is a list of monument prefabs. Notice that some of them cannot be detected because of in-game limitations.

Shuffle Items is whether to shuffle items. Should be enabled in case you want to randomize items order, else there may be less specific items than stated in configuration.

Allow Duplicate Items is whether to allow duplicate items when any added or no.

Allow Duplicate Items lets same items with different skips be added.

Remove Container is whether to remove container.

Item Container Indexes are container indexes used mostly for corpses. Your main inventory is 0, clothes container is 1 and belt is 2.

Replace Items is a mode toggle for replacing items completely in a container.

Add Items is a mode toggle for simply adding items to existing ones in a container.

Modify Items is a mode toggle for modifying existing loot.

Modify Ignores Blueprint State is whether modify should ignore blueprint states (no need for duplicate items with Is Blueprint true and false).

Fill With Default Items is whether the container should be filled with default items. Use with Replace to refill whole container and with Add to refill only empty slots.

Online Condition is an option to limit this container usage to a specific online, for example you can add a specific item to barrels when online is low and only to elite crates when you have high online.

Maximal Failures To Add An Item is a number of maximal failures. Increase it if something does not work, usually numbers up to a few hundreds are fine.

Capacity is a setting for capacity in a container. When using Add mode, it adds slots and with Replace it replaces number of free slots completely.

Item is an entry in a container that describes a certain group of items that match specified regex and etc..

Item Shortnames are entries that allow you to specify what items you want to change or add or exclude by providing their shortname, rarity and category. Use "global" to include all items, rarities or categories.

Item Name is a custom item name.

Is Blueprint is whether this item is a blueprint or not.

Allow Stacking is whether to allow stacking or not when adding an item.

Ignore Max Stack is whether to ignore max stack on this item or not when modifying or adding an item.

Ignore Max Condition is whether to exceed or not the in-game condition limits when you add or modify an item.

Remove Item lets you simply remove an item in Modify mode.

Replace Item With Default Loot replaces an item you want in Modify mode with a random item from default loot.

Conditions are settings for this item conditions that can be randomized when necessary. You can specify minimal and maximal condition so that it is random, change item's maximal condition and use rates on both. Use -1 to prevent it from being changed.

Skins are item skins.

Amount is an amount of this item that can be random if you provide different minimal and maximal amounts. Use -1 to ignore and not change it.

How do chances work?

Chances work like weights. They are a ratio, for example stones with chance 4 and wood with chance 1. This means it will spawn stones in 4 crates and wood in 1 out of 5.

For Developers

API

// Fill container with items in container with specified API shortname
void FillContainer(ItemContainer container, string apiShortname)

MIT License


Copyright (c) 2018-2021 misticos


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.