C#:
using Facepunch;
using Facepunch.Utility;
using HarmonyLib;
using Mono.Cecil;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Oxide.Core;
using Oxide.Core.Configuration;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Rust;
using Rust.Ai.Gen2;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml.Linq;
using UnityEngine;
using UnityEngine.Tilemaps;
using WebSocketSharp;
/* Ideas
* Vehiclular combatant - more damage to vehicles (maybe including bradley and heli?)
* Add heli as XP source.
* Add CUI option to enable/disable components that are shredded by the shredder perk.
* Add an XP cap for certain sources (quests, building etc).-
* Colour the pump bar based on xp progression for the level
* Possible buff for healing percentage when using medical deviucs with whitelist or blacklist
* Add a dictionary to override the yield for certain ore types.
*
* Fishing bait skill?
* - Look at harmony patching GetFish method.
*
*
* Crafting xp for tea stations
*
* Shield stamina
* Bee damage removal (see how hazmat handles it)
* - DamageType Bee damage - Prevent it?
*
* Look at making the shield block while on the players back.
*
* Timers for ultimate cooldowns. Picture of the skill with a timer over it when active.
* - Could look at having them inside of the skill tree menu when opened - Shows the time that the skill will be available again.
* - Might be worth attaching to the background of the tree so it's always there.
*
* Reload speeds
* - Instant reload (IO) or tiered reload speeds (hooks reload animation and adds a timer to reload instead based on weapon type).
*
* Loot detective
* - A skill that is command based, that will show a player all nearby StorageContainers that are not empty.
* - Can lock to RaidableBases only
* - Configurable time to display containers
* - Increasing skill level increases range
* - Cooldown time via config.
*/
/* 1.7.3
* Added command: givexpdebt <target> <amount> - gives xp debt to the specified player.
* Added config option to delete data for players who have not logged in for x amount of days.
* Updated the tree UI to display nodes that require permissions to unlock rather than reinstantiating the playerData.
* Fixed an issue with Wolf2 not working with xp event.
* Fixed an NRE related to the RadiationProtection_Patch.
* Removed the skin id/url option from config and made it so skills will prioritize skin id, will use url if skin value is 0, and will use a default png if both are invalid.
* Patched for Feb forced wipe.
* Fixed a rare bug in OnPlayerConnected that causes buffs to duplicate under very specific circumstances.
*/
namespace Oxide.Plugins {
[Info("Skill Tree", "imthenewguy", "1.7.3")]
[Description("Skills on a tree!")]
class SkillTree : RustPlugin {
#region Config
private Configuration config;
public class Configuration {
[JsonProperty("General settings")]
public GeneralSettings general_settings = new GeneralSettings();
public class GeneralSettings {
[JsonProperty("Skill points per level")]
public int points_per_level = 2;
[JsonProperty("Modified skill points per level based on permissions [must be higher than default]")]
public Dictionary<string, int> points_per_level_override = new Dictionary<string, int>();
[JsonProperty("Maximum points a player can spend [default]")]
public int max_skill_points = 200;
[JsonProperty("Modified max skill points based on permissions [must be higher than default]")]
public Dictionary<string, int> max_skill_points_override = new Dictionary<string, int>();
[JsonProperty("Maximum level a player can get to")]
public int max_player_level = 100;
[JsonProperty("Settings for respecing skill points [Disabled, All, Tree]")]
public RespecType respecType = RespecType.All;
[JsonProperty("Cost per point to respec [default]")]
public double respec_cost = 30;
[JsonProperty("Cost per point to respec based on permissions [must be lower than default]")]
public Dictionary<string, double> respec_cost_override = new Dictionary<string, double>();
[JsonProperty("Respec cost cap [0 = no limit]")]
public double respec_cost_cap = 0;
[JsonProperty("Permission based level requirement override")]
public Dictionary<string, PermOverride> level_requirement_override = new Dictionary<string, PermOverride>(StringComparer.InvariantCultureIgnoreCase);
[JsonProperty("Permission based point requirement override")]
public Dictionary<string, PermOverride> point_requirement_override = new Dictionary<string, PermOverride>(StringComparer.InvariantCultureIgnoreCase);
[JsonProperty("Currency type to respec [scrap, economics, srp, shoppystock, custom]")]
public string respec_currency = "scrap";
[JsonProperty("ShoppyStock currency info [if currency type is set to shoppystock]")]
public ShoppyStockInfo shoppyStockInfo = new ShoppyStockInfo();
public class ShoppyStockInfo {
[JsonProperty("Shop name")]
public string shopName;
}
[JsonProperty("If currency is set to custom, what are the details of the item")]
public CustomCurrency respec_currency_custom = new CustomCurrency();
[JsonProperty("Multiplier increase after each respec [0.2 = a 20% increase in the cost to respec each time. 0 = no increase] [resets on wipe or data reset]")]
public float respec_multiplier = 0;
[JsonProperty("Maximum value that the respec multiplier can get to [0 = no limit]")]
public float respec_multiplier_max = 0;
[JsonProperty("List of rewards the player receives based on level")]
public Dictionary<int, LevelReward> level_rewards = new Dictionary<int, LevelReward>();
[JsonProperty("Require players to have specific tree permissions to open them")]
public bool require_tree_perms = false;
[JsonProperty("Show the quick navigation buttons to the player")]
public bool show_navigation_buttons = true;
[JsonProperty("Drop bag on death")]
public bool drop_bag_on_death = true;
[JsonProperty("XP pump bar settings")]
public PumpBar pump_bar_settings = new PumpBar();
[JsonProperty("Redownload all images when the plugin reloads if using URL?")]
public bool replace_on_reload = false;
[JsonProperty("Use skin id for extra pockets icon? [true = skin, false = url]")]
public bool useSkinForExtraPockets = true;
}
[JsonProperty("Base yield settings")]
public BaseYieldSettings base_yield_settings = new BaseYieldSettings();
public class BaseYieldSettings {
[JsonProperty("Allow Skill Tree to adjust the base amount of resource received? Buffs will base their modifiers off of the amended base amount.")]
public bool adjust_base_yield = false;
[JsonProperty("Yield types multipliers [1.0 = vanilla]")]
public Dictionary<YieldTypes, float> multipliers = new Dictionary<YieldTypes, float>();
}
[JsonProperty("Buff settings")]
public BuffSettings buff_settings = new BuffSettings();
public class BuffSettings {
[JsonProperty("Should we remove permissions from permission buffs when the player disconnects from the server or the plugin unloads? [Recommended]")]
public bool removePermissionsOnDisconnect = true;
[JsonProperty("Should yield bonus skills be additive [if true, yields will modify the item.amount value, rather than giving additional items]")]
public bool additiveYields = true;
[JsonProperty("Minimum components for the component perk")]
public int min_components = 1;
[JsonProperty("Maximum components for the component perk")]
public int max_components = 1;
[JsonProperty("Minimum electrical components for the electrical component perk")]
public int min_electrical_components = 1;
[JsonProperty("Maximum electrical components for the electrical component perk")]
public int max_electrical_components = 1;
[JsonProperty("Minimum additional scrap to be added to crates and barrels")]
public int min_extra_scrap = 1;
[JsonProperty("Maximum additional scrap to be added to crates and barrels")]
public int max_extra_scrap = 2;
[JsonProperty("PVP Buff Critical damage modifier. Picks a random value between 0 and the declared value, and += the damage% onto the hit")]
public float pvp_critical_modifier = 0.3f;
[JsonProperty("Should the LootPickup buff only work with melee weapons?")]
public bool lootPickupBuffMeleeOnly = false;
[JsonProperty("Should we have a maximum distance for the loot pickup buff [0 = unlimited]?")]
public float loot_pickup_buff_max_distance = 0;
[JsonProperty("Allow the LootPickup buff to work with road-side signs?")]
public bool allow_roadsigns_magnet = false;
[JsonProperty("Allow the Barrel Smasher buff to work with road-side signs?")]
public bool allow_roadsigns_smasher = false;
[JsonProperty("List of animals for animal resist ability", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public HashSet<string> animals = new HashSet<string>();
[JsonProperty("Delay for HealthRegen perk after taking damage")]
public float health_regen_combat_delay = 5f;
[JsonProperty("Delay between attempts at tracking animals")]
public float track_delay = 10f;
[JsonProperty("List of skins that the rationer perk will not refund")]
public HashSet<ulong> no_refund_item_skins = new HashSet<ulong>();
[JsonProperty("Bag cooldown time")]
public float bag_cooldown_time = 10f;
[JsonProperty("Bag prefab")]
public string bag_prefab = "assets/prefabs/deployable/large wood storage/box.wooden.large.prefab";
[JsonProperty("Allow the Harvest Grown Yield to increase the amount of clones a player receives?")]
public bool clone_yield = true;
[JsonProperty("Primitive weapons for the primitive weapons ability", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public HashSet<string> primitive_weapons = new HashSet<string>();
[JsonProperty("Harvesting yield blacklist [items listed here will not be affected by the harvesting yield perks]")]
public HashSet<string> harvest_yield_blacklist = new HashSet<string>();
[JsonProperty("List of items that the Durability perk will not work with")]
public HashSet<string> durability_blacklist = new HashSet<string>();
[JsonProperty("Force all modified extended weapons to unload their ammo when the plugin unloads/hook all users with the buff log off?")]
public bool force_unload_extended_mag_weapons_unload = false;
[JsonProperty("Prevent flyhack kicks when a player lands?")]
public bool prevent_flyhack_kick_fall_damage = false;
[JsonProperty("Automatically apply the boat turbo when a player mounts the boat? [Disables the turbo command]")]
public bool boat_turbo_on_mount = false;
[JsonProperty("Distance in front of player for nodes to spawn when the Node_Spawn_Chance buff procs?")]
public float Node_Spawn_Chance_dist = 2;
[JsonProperty("Cooldown between hits for the vehicle mechanic buff? [0 = no cooldown]")]
public float Vehicle_Mechanic_Cooldown = 0;
[JsonProperty("Forager settings")]
public ForagerSettings forager_settings = new ForagerSettings();
public class ForagerSettings {
[JsonProperty("Command to use the ability")]
public string command = "forage";
[JsonProperty("Distance to search for map collectibles")]
public float distance = 100f;
[JsonProperty("Time that the locations are displayed on the screen")]
public float time_on_screen = 60f;
[JsonProperty("Usage cooldown")]
public float cooldown = 60f;
[JsonProperty("Black list of shortnames for collecibles that won't be displayed")]
public HashSet<string> blacklist = new HashSet<string>();
[JsonProperty("Display colours")]
public Dictionary<string, float[]> displayColours = new Dictionary<string, float[]>();
[JsonProperty("Show distance?")]
public bool show_distance = false;
}
[JsonProperty("Tea looter settings")]
public TeaLooterSettings tea_looter_settings = new TeaLooterSettings();
public class TeaLooterSettings {
[JsonProperty("Minimum stack of tea that the player will receive when the Tea Looter buff procs?")]
public int min_tea = 1;
[JsonProperty("Maximum stack of tea that the player will receive when the Tea Looter buff procs?")]
public int max_tea = 1;
[JsonProperty("Tea looter table [shortname : drop weight]")]
public Dictionary<string, int> TeaDropTable = new Dictionary<string, int>(StringComparer.InvariantCultureIgnoreCase);
[JsonProperty("Containers that tea can be found in")]
public HashSet<string> containers = new HashSet<string>();
}
[JsonProperty("Sonar settings")]
public SonarSettings sonar_settings = new SonarSettings();
public class SonarSettings {
[JsonProperty("Command to use the ability")]
public string command = "sonar";
[JsonProperty("Distance to search for underwater entities")]
public float distance = 300f;
[JsonProperty("Time that the locations are displayed on the screen")]
public float time_on_screen = 10f;
[JsonProperty("Usage cooldown")]
public float cooldown = 10f;
public bool show_tugboats = true;
public bool show_dive_sites = true;
public bool show_sharks = true;
public bool show_scientists = true;
public bool show_players = false;
[JsonProperty("Show distance?")]
public bool show_distance = false;
}
[JsonProperty("Raid perk settings")]
public RaidTreeSettings raid_perk_settings = new RaidTreeSettings();
public class RaidTreeSettings {
[JsonProperty("Automatically pass raidable base checks if the plugin is unloaded?")]
public bool default_pass = true;
[JsonProperty("Settings for trap_damage_reduction")]
public TrapDamageReductionSettings trap_damage_reduction_settings = new TrapDamageReductionSettings();
public class TrapDamageReductionSettings {
[JsonProperty("Traps blacklist - will ignore the buff")]
public HashSet<string> blacklist = new HashSet<string>();
[JsonProperty("Only allow this buff to work with raidable base traps")]
public bool raidable_bases_only = false;
}
[JsonProperty("Settings for trap_damage_increase")]
public TrapDamageIncreaseSettings trap_damage_increase_settings = new TrapDamageIncreaseSettings();
public class TrapDamageIncreaseSettings {
[JsonProperty("Traps blacklist - will ignore the buff")]
public HashSet<string> blacklist = new HashSet<string>();
[JsonProperty("Only allow this buff to work with raidable base traps")]
public bool raidable_bases_only = false;
}
[JsonProperty("Settings for Personal_Explosive_Reduction")]
public PersonalExplosiveReductionSettings personal_explosive_reduction_settings = new PersonalExplosiveReductionSettings();
public class PersonalExplosiveReductionSettings {
[JsonProperty("Prefabs blacklist - will ignore the buff")]
public HashSet<string> blacklist = new HashSet<string>();
[JsonProperty("Work with fire explosives such as molotov's and incin rockets?")]
public bool fire_damage_reduction = true;
}
[JsonProperty("Settings for Double_Explosion_chance")]
public DoubleExplosionChanceSettings Double_Explosion_chance_settings = new DoubleExplosionChanceSettings();
public class DoubleExplosionChanceSettings {
[JsonProperty("Prefabs black - will not trigger with items listed here")]
public HashSet<string> blacklist = new HashSet<string>();
[JsonProperty("Only allow this buff to work with raidable base?")]
public bool raidable_bases_only = false;
}
[JsonProperty("Settings for Explosion_Radius")]
public ExpolosionRadiusSettings Explosion_Radius_settings = new ExpolosionRadiusSettings();
public class ExpolosionRadiusSettings {
[JsonProperty("Prefabs blacklist - will ignore the buff")]
public HashSet<string> blacklist = new HashSet<string>();
[JsonProperty("Add the difference to the minimum explosion radius")]
public bool add_to_minimum = true;
[JsonProperty("Only allow this buff to work with raidable base?")]
public bool raidable_bases_only = false;
}
[JsonProperty("Settings for Lock_Picker")]
public LockPickerSettings Lock_Picker_settings = new LockPickerSettings();
public class LockPickerSettings {
[JsonProperty("Command required for the player to activate their lockpick ability")]
public string pick_command = "picklock";
[JsonProperty("Time after the command has been used before the ability use expires [seconds]")]
public float time = 30;
[JsonProperty("Delay before the Lock_Picker ability can be used again [seconds]")]
public float use_delay = 600;
[JsonProperty("Only allow this buff to work with raidable base?")]
public bool raidable_bases_only = false;
[JsonProperty("Damage the player receives when they fail an attempt")]
public float damage_per_fail = 0;
[JsonProperty("Show the pick lock timer when activating the ability")]
public bool show_timer = true;
[JsonProperty("How often should the timer update")]
public int timer_tick_rate = 1;
[JsonProperty("Set the lock to unlocked when successfully picking a lock? [false will open the entity but keep it locked]")]
public bool unlock_entity = false;
}
[JsonProperty("Settings for Dudless_Explosive")]
public DudlessExplosiveSettings Dudless_Explosiv_settings = new DudlessExplosiveSettings();
public class DudlessExplosiveSettings {
[JsonProperty("Only allow this buff to work with raidable base?")]
public bool raidable_bases_only = false;
}
[JsonProperty("Settings for Trap_Spotter")]
public TrapSpotterSettings Trap_Spotter_settings = new TrapSpotterSettings();
public class TrapSpotterSettings {
[JsonProperty("Max distance from the player to search for traps")]
public float distance = 20f;
[JsonProperty("Cooldown between uses [seconds]")]
public float cooldown = 60f;
[JsonProperty("Time that the traps will be displayed for [seconds]")]
public float time_on_screen = 60f;
[JsonProperty("Show the names of each trap prefab")]
public bool show_names = true;
[JsonProperty("Command to perform the search")]
public string command = "traps";
[JsonProperty("Only allow this buff to work with raidable base?")]
public bool raidable_bases_only = false;
[JsonProperty("Colours that the traps will be displayed in")]
public Dictionary<string, float[]> trap_colours = new Dictionary<string, float[]>();
}
[JsonProperty("Settings for Loot_Spotter")]
public LootSpotterSettings Loot_Spotter_settings = new LootSpotterSettings();
public class LootSpotterSettings {
[JsonProperty("Cooldown between uses [seconds]")]
public float cooldown = 60f;
[JsonProperty("Time that the traps will be displayed for [seconds]")]
public float time_on_screen = 60f;
[JsonProperty("Text colour")]
public (float, float, float) text_col = (1, 0, 0);
[JsonProperty("Show the names of each container prefab")]
public bool show_names = true;
[JsonProperty("Command to perform the search")]
public string command = "crates";
[JsonProperty("Only allow this buff to work with raidable base?")]
public bool raidable_bases_only = true;
public Color GetColour() {
return new Color(text_col.Item1, text_col.Item2, text_col.Item3);
}
}
}
[JsonProperty("Underwater Breathing settings")]
public UnderwaterBreathingSettings underwaterSettings = new UnderwaterBreathingSettings();
public class UnderwaterBreathingSettings {
public string anchor_min = "1 1";
public string anchor_max = "1 1";
public string offset_min = "-48 -48";
public string offset_max = "-12 -12";
}
[JsonProperty("Allow the UnderwaterDamageBonus to function in PVP")]
public bool UnderwaterDamageBonus_pvp = true;
[JsonProperty("Base the crafting xp on the time it takes to craft the item? [false will use blueprint craft time]")]
public bool timeBasedCraftingXP = true;
[JsonProperty("Comfort settings")]
public ComfortSettings comfortSettings = new ComfortSettings();
public class ComfortSettings {
[JsonProperty("How often should we update comfort levels for nearby team members [seconds]")]
public float Interval = 5;
[JsonProperty("Distance that team members receive comfort from")]
public float Distance = 10;
}
[JsonProperty("Mobile Workbench settings")]
public MobileWorkbenchSettings mobileWorkbenchSettings = new MobileWorkbenchSettings();
public class MobileWorkbenchSettings {
[JsonProperty("How often should we run the update cycle for workbenches [seconds]")]
public float Interval = 5;
[JsonProperty("Distance that team members can access workbench from")]
public float Distance = 10;
[JsonProperty("Position in the map where the workbenches spawn [default 0,0,0]")]
public Vector3 MapSpawnPosition = Vector3.zero;
}
[JsonProperty("Tea Share settings")]
public TeaShareSettings teaShareSettings = new TeaShareSettings();
public class TeaShareSettings {
[JsonProperty("Distance that team members can receive tea buffs from")]
public float Distance = 10;
}
[JsonProperty("Metabolism Share settings")]
public MetabolismShareSettings metabolismShareSettings = new MetabolismShareSettings();
public class MetabolismShareSettings {
[JsonProperty("Distance that team members can receive calory and hydration from")]
public float Distance = 10;
}
[JsonProperty("Heal Share settings")]
public HealShareSettings healShareSettings = new HealShareSettings();
public class HealShareSettings {
[JsonProperty("Distance that team members can receive healing from")]
public float Distance = 10;
}
[JsonProperty("XP Share settings")]
public XPShareSettings xpShareSettings = new XPShareSettings();
public class XPShareSettings {
[JsonProperty("Distance that team members can receive xp from")]
public float Distance = 10;
[JsonProperty("Base the percentage using modified xp [true] or the base xp amount [false]")]
public bool modifiedXP = false;
}
[JsonProperty("Double Bandage Heal Cooldown [seconds]")]
public float Double_Bandage_Heal_Cooldown = 0;
[JsonProperty("Wounded Resist Cooldown [seconds]")]
public float Wounded_Resist_Cooldown = 0;
[JsonProperty("Harvesting luck settings")]
public HarvestingLuckSettings harvesting_luck_settings = new HarvestingLuckSettings();
public class HarvestingLuckSettings {
[JsonProperty("Allow the harvesting luck buff to work with player grown collectibles [uses its own drop table]?")]
public bool Harvesting_luck_works_with_grown = true;
[JsonProperty("List of entities that won't trigger the buff")]
public HashSet<string> blacklist = new HashSet<string>();
}
[JsonProperty("Awareness settings")]
public AwarenessSettings awareness_settings = new AwarenessSettings();
public class AwarenessSettings {
[JsonProperty("How often should awareness update?")]
public float updateRate = 5;
[JsonProperty("Show corpse locations?")]
public bool corpse = true;
[JsonProperty("Show bag locations?")]
public bool bag = true;
[JsonProperty("Show dropped item locations?")]
public bool droppedItem = true;
[JsonProperty("Show animal locations?")]
public bool animals = true;
[JsonProperty("Show Human Npc locations?")]
public bool humanNPC = true;
[JsonProperty("Blacklist of item shortnames that will not show up")]
public HashSet<string> blacklist = new HashSet<string>();
}
[JsonProperty("SharkSkinner blacklist [item shortname]")]
public HashSet<string> SharkSkinnerblacklist = new HashSet<string>();
[JsonProperty("ShieldReflect Settings")]
public ShieldReflectSettings shield_ReflectSettings = new ShieldReflectSettings();
public class ShieldReflectSettings {
[JsonProperty("Maximum distance the buff will work from [-1 = no max]")]
public float maxDistance = -1;
[JsonProperty("Bullet damage reflection modifier [1 = 100%]")]
public float bulletReflectMod = 1f;
[JsonProperty("Arrow damage reflection modifier [1 = 100%]")]
public float arrowReflectMod = 1f;
}
}
[JsonProperty("Chat command settings")]
public ChatCommands chat_commands = new ChatCommands();
public class ChatCommands {
[JsonProperty("Use mouse 3 to toggle the boat turbo (performance heavy on high pop servers). Set false to use a chat command instead")]
public bool use_input_key_boat = false;
[JsonProperty("Chat command for turbo")]
public string turbo_cmd = "turbo";
[JsonProperty("Chat commands to open the skill tree", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public List<string> chat_cmd = new List<string>() {
"st", "skilltree", "skills"
}
;
[JsonProperty("Chat/console commands to open the score board", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public List<string> score_chat_cmd = new List<string>() {
"score", "scoreboard"
}
;
[JsonProperty("Chat command for tracking an animal with the AnimalTracker buff")]
public string track_animal_cmd = "track";
}
[JsonProperty("XP settings")]
public XPSettings xp_settings = new XPSettings();
public class XPSettings {
[JsonProperty("XP Loss settings")]
public XPLossSettings xp_loss_settings = new XPLossSettings();
public class XPLossSettings {
[JsonProperty("Allow players to lose xp when they die?")]
public bool allow_xp_loss = true;
[JsonProperty("Allow players to go into xp debt if they lose more xp than their level would allow?")]
public bool allow_xp_debt = true;
[JsonProperty("Xp loss type [PercentageOfCurrentLevel, PercentageOfTotalXp, XpValue]")]
public XPLossType xp_loss_type = XPLossType.PercentageOfCurrentLevel;
[JsonProperty("Death penalty grace period - players won't lose xp if they die again within the specified time [seconds]")]
public float no_xp_loss_time = 0;
[JsonProperty("XP loss values [if percentage, 1.0 = 100%. If XpValue, 100.0 = 100xp]")]
public XP_Loss_Amounts xp_loss_table = new XP_Loss_Amounts();
public class XP_Loss_Amounts {
public float PVP = 0.1f;
public float Heli = 0.2f;
public float Bradley = 0.2f;
public float Scientist = 0.2f;
public float Animal = 0.2f;
public float Suicide = 0.2f;
public float Fire = 0.2f;
public float Cold = 0.2f;
public float Fall = 0.2f;
public float Traps = 0.2f;
public float Codelock = 0.2f;
public float Drowned = 0.2f;
public float Radiation = 0.2f;
public float Hunger = 0.2f;
public float Thirst = 0.2f;
}
[JsonProperty("Prevent xp loss when a player is offline?")]
public bool prevent_offline_xp_loss = true;
[JsonProperty("Permission based modifiers [1.0 = no reduced amount]")]
public Dictionary<string, double> xp_loss_override = new Dictionary<string, double>();
}
[JsonProperty("Permissions to adjust xp gain modifiers (skilltree.<perm>) [1.0 is default modifier]")]
public Dictionary<string, double> xp_perm_modifier = new Dictionary<string, double>();
[JsonProperty("How long should the xp be displayed for")]
public float xp_display_time = 1f;
[JsonProperty("Colour of the xp text when unmodified")]
public string xp_display_col_unmodified = "FFFFFF";
[JsonProperty("Colour of the xp text when modified")]
public string xp_display_col_modified = "00b6ff";
[JsonProperty("Colour of the xp text when modified by Skill Tree: XP Event")]
public string xp_display_col_xp_event_modified = "c900ff";
[JsonProperty("Prevent XP loss when dying at an event hosted by EventManager")]
public bool prevent_xp_loss = true;
[JsonProperty("Enable xp drop hud for players by default")]
public bool enable_xp_drop_by_default = true;
[JsonProperty("Restrict XP gain to the tools listed in their respective tools list?")]
public bool white_listed_tools_only = false;
[JsonProperty("Require grown plants to be ripe to provide xp")]
public bool ripe_required = true;
[JsonProperty("Give xp for crafting ingredients? [Requires Cooking.cs]")]
public bool cooking_award_xp_ingredients = false;
[JsonProperty("Whitelist - List of items to award crafting xp")]
public HashSet<string> craft_xp_whitelist = new HashSet<string>();
[JsonProperty("Blacklist - List of items that will not award crafting xp")]
public HashSet<string> craft_xp_blacklist = new HashSet<string>();
[JsonProperty("Use LootDefender to handle the XP for BradleyAPC")]
public bool UseLootDefender = true;
[JsonProperty("Allow players with god mode to receive xp?")]
public bool allow_godemode_xp = true;
[JsonProperty("Cooldown for awarding xp after using a swipe card")]
public float swipe_card_xp_cooldown = 0;
[JsonProperty("Decimal places for the xp to be rounded to")]
public int xp_rounding = 2;
[JsonProperty("Maximum amount of pending xp a player can accumulate [0 = no limit]")]
public int pending_xp_cap = 0;
[JsonProperty("List of meals that will not provide xp [Requires Cooking.cs]")]
public HashSet<string> cooking_black_list = new HashSet<string>();
[JsonProperty("Scale the xp based on the scale of the entity?")]
public bool scaleXP = true;
[JsonProperty("Experience sources - Set xp value to 0 to disable for that type", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public XPSources xp_sources = new XPSources();
[JsonProperty("Night time settings")]
public NightTimeGains night_settings = new NightTimeGains();
public class NightTimeGains {
[JsonProperty("Modifier for xp gained at night [1.0 = standard]")]
public float night_xp_gain_modifier = 1f;
[JsonProperty("Modifier for woodcutting yield at night [1.0 = standard]")]
public float night_woodcutting_yield_modifier = 1f;
[JsonProperty("Modifier for mining yield at night [1.0 = standard]")]
public float night_mining_yield_modifier = 1f;
[JsonProperty("Modifier for skinning yield at night [1.0 = standard]")]
public float night_skinning_yield_modifier = 1f;
[JsonProperty("Modifier for harvesting yield at night [1.0 = standard]")]
public float night_harvesting_yield_modifier = 1f;
[JsonProperty("Should the harvesting yield increase include player-grown plants?")]
public bool include_grown_harvesting = false;
[JsonProperty("Send all players a gametip when night time bonuses start?")]
public bool announce_at_night = false;
[JsonProperty("How many seconds should we show the gametip for?")]
public float announcement_duration = 8;
}
[JsonProperty("Allow players to move their XP bar?")]
public bool allow_move_xp_bar = true;
[JsonProperty("Force the cursor to appear when moving the XP bar?")]
public bool force_cursor_on_move = true;
[JsonProperty("Should the givexp console command search for offline players as well?")]
public bool givexp_offline = false;
[JsonProperty("Should the givesp console command search for offline players as well?")]
public bool givesp_offline = false;
[JsonProperty("Should the givexpdebt console command search for offline players as well?")]
public bool givexpdebt_offline = false;
[JsonProperty("XP Cap Settings")]
public XPCapSettings xPCapSettings = new XPCapSettings();
public class XPCapSettings {
[JsonProperty("Daily xp cap [0 = no cap]")]
public double cap = 0;
[JsonProperty("What time should the cap reset each day [hh:mm AM/PM]")]
public string resetTime = "06:00 AM";
}
}
[JsonProperty("Prestige settings")]
public PrestigeSettings prestige_settings = new PrestigeSettings();
public class PrestigeSettings {
[JsonProperty("Allow players to reset their progresss and gain Prestige levels?")]
public bool enabled = false;
[JsonProperty("Ignore the level reward bonuses if the player has prestige levels?")]
public bool ignore_level_rewards = false;
[JsonProperty("Remove players from lower level prestige groups?")]
public bool remove_from_lower_groups = false;
[JsonProperty("Run reset commands for level rewards when the player prestiges?")]
public bool run_level_rewards_reset_on_Prestige = false;
[JsonProperty("Show the prestige button before the player achieves the level? (they won't be able to accept the rank up until max level)")]
public bool show_button_before_level = true;
[JsonProperty("Should the player keep excess skill points outside of what they received from leveling/starting points?")]
public bool should_keep_excess_points = false;
[JsonProperty("Should we apply the xp bonus multiplicatively? [false = additively]")]
public bool apply_bonus_multiplicatively = false;
[JsonProperty("Prestige levels")]
public Dictionary<int, PrestigeInfo> levels = new Dictionary<int, PrestigeInfo>();
public class PrestigeInfo {
[JsonProperty("Permissions [name : perm]")]
public Dictionary<string, string> perms;
[JsonProperty("Commands to run when the player prestiges ({id} = userid. {name} = player name) [description : command]")]
public Dictionary<string, string> commands;
[JsonProperty("Additional benefits descriptions")]
public List<string> additionalBenfitsDescription = new List<string>();
[JsonProperty("Format for BetterChat title showing the prestige level. {0} is the colour value and {1} is the player prestige value")]
public string better_title_format = "<color=#{0}>[Pr.{1}]</color>";
[JsonProperty("Colour for BetterChat xp titles")]
public string better_title_default_col = "d109ec";
[JsonProperty("Skin ID that will be displayed when ranking up")]
public ulong RankUpPic;
[JsonProperty("Rank title")]
public string rankTitle;
[JsonProperty("XP modifier")]
public float xp_mod = 1;
public PrestigeInfo(Dictionary<string, string> perms, ulong RankUpPic, string title) {
this.perms = perms;
this.RankUpPic = RankUpPic;
this.rankTitle = title;
}
}
public void Initialize() {
if (levels != null && levels.Count > 0) {
foreach (var level in levels) {
if (string.IsNullOrEmpty(level.Value.rankTitle)) level.Value.rankTitle = $"Prestige Rank {level.Key}";
}
return;
}
levels = new Dictionary<int, PrestigeInfo>() {
[1]
= new PrestigeInfo(new Dictionary<string, string>() {
["Your perm title"]
= "yourperm.use"
}
, 3165843865, "Prestige Rank 1"), [2] = new PrestigeInfo(new Dictionary<string, string>() {
["Your perm title"]
= "yourperm.use"
}
, 3165843987, "Prestige Rank 2"), [3] = new PrestigeInfo(new Dictionary<string, string>() {
["Your perm title"]
= "yourperm.use"
}
, 3165844049, "Prestige Rank 3")
}
;
}
public int HighestLevel() {
if (levels == null) return 0;
var result = 0;
foreach (var level in levels.Keys) {
if (level > result) result = level;
}
return result;
}
}
[JsonProperty("Wipe and plugin update settings")]
public WipeUpdate wipe_update_settings = new WipeUpdate();
public class WipeUpdate {
/* Wipe xp/level -
* Refund points -
* Prestige
* Extra pockets
* Pending xp
* Rested xp
* Xp debt
*/
[JsonConverter(typeof(StringEnumConverter))]
public enum WipeType {
None, Reset, Refund
}
[JsonProperty("Automatically wipe player data after x days if they have not logged in? [0 = off] [only checks on wipe]")]
public int wipe_after_days = 0;
[JsonProperty("Wipe all player data files [setting true will ignore all below settings that handle data reset]?")]
public bool wipe_everything = false;
[JsonProperty("How should we handle xp, levels and skills when the server wipes [None, Reset, Refund]?")]
public WipeType xp_wipe_type = WipeType.Refund;
[JsonProperty("Should we wipe prestige levels?")]
public bool prestige_wipe = false;
[JsonProperty("Wipe xp debt?")]
public bool xp_debt_wipe = true;
[JsonProperty("Wipe respec multiplier?")]
public bool respec_multiplier_wipe = true;
[JsonProperty("Reset pending xp pools on wipe?")]
public bool reset_pending_xp_on_wipe = true;
[JsonProperty("Erase ExtraPockets storage on wipe")]
public bool erase_ExtraPockets_on_wipe = true;
[JsonProperty("Give the player with the highest xp bonus skill points next wipe")]
public bool bonus_skill_points = false;
[JsonProperty("How many skill points should they receive for winning?")]
public int bonus_skill_points_amount = 5;
[JsonProperty("Automatically add new trees from the default config?")]
public bool auto_update_trees = true;
[JsonProperty("Automatically add new nodes from the default config?")]
public bool auto_update_nodes = true;
[JsonProperty("Starting skill points")]
public int starting_skill_points = 0;
[JsonProperty("Dictionary of permission based overrides for starting skill points")]
public Dictionary<string, int> starting_skill_point_overrides = new Dictionary<string, int>();
}
[JsonProperty("Rested XP Settings")]
public RestXPSettings rested_xp_settings = new RestXPSettings();
public class RestXPSettings {
[JsonProperty("Give players who have been offline a bonus to xp gain when they log in next?")]
public bool rested_xp_enabled = true;
[JsonProperty("Rested xp pool to accumulate per hour offline")]
public double rested_xp_per
// ... [Code preview truncated due to length. Full source in attached file] ...