Automatically calculates item costs based on ingredients

Supported Games
GameServerKingsGameServerKings

Item Cost Calculator will allow administrators to more accurately price items in their shops (e.g. GUI Shop, Server Rewards).

Features

  • Inspects each item in the game, breaks down the components needed to make it, and prices the item based on the values set for components in the config file.
  • Any item could be placed in the config and that is the price it will have, furthermore if that item is a component of a different item it will become part of the multiplier.
  • GatherRateOffset setting that can be set to increase cost based on server gather rates. Setting this value at 2 would double prices. Setting it at 3 would triple prices.. etc.
  • RarityList which is adds the ability to specify additional weight to an item.By adding an items shortname and a numerical value it will add additional cost to the item as a percentage. For example, if a hammer requires 100 wood and wood is set at 1 (in the config materials list) it would cost 100 "currency" to buy. If you added hammer and 50 to the rarityList it would then calculate the price of a hammer at a 50% increase of 150 "currency". Conversly if you added hammer and 0 to the rarityList Its price will not change.

Console Commands

  • costfile shop [language] -- Create its cost data file for GUIShop. You need to put it in the config of GUIShop. If you want to use the language option, you must load the RustTranslationAPI plugin. e.g. costfile shop zh-cn
  • costfile reward [language] -- Create its cost data file for ServerRewards. You need to put it in the reward_data.json of ServerRewards. If you want to use the language option, you must load the RustTranslationAPI plugin. e.g. costfile shop zh-cn
  • costfile ingredients -- Create ingredient lists for items.

Requires administrator to use these commands

Note: This plugin does NOT add items to the shops. So you will still need to go in and add items to the applicable shops. (Just copy & paste...)

Configuration

{
  "GUIShop - Recovery rate (Sell / Buy)": 0.5,
  "GUIShop - Keep decimal": 2,
  "Gather rate offset": 1.0,
  "Materials": {
    "metal.fragments": 1.0,
    "gunpowder": 1.0,
    "metalpipe": 1.0,
    "explosives": 1.0,
    "metal.refined": 1.0,
    "wood": 1.0,
    "riflebody": 1.0,
    "metalspring": 1.0,
    "stones": 1.0,
    "sulfur": 1.0,
    "lowgradefuel": 1.0,
    "bone.fragments": 1.0,
    "cloth": 1.0,
    "targeting.computer": 1.0,
    "cctv.camera": 1.0,
    "metalblade": 1.0,
    "rope": 1.0,
    "gears": 1.0,
    "sewingkit": 1.0,
    "techparts": 1.0,
    "crude.oil": 1.0,
    "glue": 1.0,
    "grenade.beancan": 1.0,
    "stash.small": 1.0,
    "propanetank": 1.0,
    "ladder.wooden.wall": 1.0,
    "tarp": 1.0,
    "fat.animal": 1.0,
    "scrap": 1.0,
    "fuse": 1.0,
    "sheetmetal": 1.0,
    "leather": 1.0,
    "roadsigns": 1.0,
    "charcoal": 1.0,
    "skull.wolf": 1.0,
    "pumpkin": 1.0,
    "syringe.medical": 1.0,
    "semibody": 1.0,
    "smgbody": 1.0,
    "skull.human": 1.0,
    "spear.wooden": 1.0,
    "can.tuna.empty": 1.0
  },
  "Rarity list": {
    "timed.explosive": 50,
    "rifle.bolt": 20,
    "hammer": 0
  },
  "Workbench level multiplier": {  //It is similar to "Rarity list"
    "0": 0.0,
    "1": 0.0,
    "2": 0.0,
    "3": 0.0
  },  
  "Item ingredients override": {
    "horse.shoes.basic": {
      "metal.fragments": 500
    }
  },
  "Item displayNames": {}
  }

API

private double GetItemCost(string shortname)
private double GetItemCost(int itemID)
private double GetItemCost(ItemDefinition itemDefinition)
private Dictionary<string, double> GetItemsCostByShortName()
private Dictionary<int, double> GetItemsCostByID()
private Dictionary<ItemDefinition, double> GetItemsCostByDefinition()

Credits

  • Absolut, the original author of this plugin
  • **Arainrr **, previous maintainer

MIT License


Copyright (c) 2019 Arainrr


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.



14.6K downloads
127 watchers

costsitemsunmaintained