Иконка ресурса

FREE Skills : 1.32.11 1.32.11

Нет прав для скачивания
C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
#define USE_HARMONY
// #define TESTING
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Facepunch;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Oxide.Core;
using Oxide.Core.Libraries;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Rust;
using UnityEngine;
using Analytics = Facepunch.Rust.Analytics;
using Random = UnityEngine.Random;
using Time = UnityEngine.Time;
using HarmonyLib;
#if CARBON
using Carbon.Base;
using Carbon.Modules;
#endif
namespace Oxide.Plugins;
[Info("Skills", "Mevent", "1.32.11")]
[Description("Adds a system of skills")]
public class Skills : RustPlugin {
#region Fields
    [PluginReference]
    private Plugin ImageLibrary = null, Notifications = null, EventHelper = null, Battles = null, Duel = null, Duelist = null, ArenaTournament = null, Notify = null, UINotify = null;
    private const bool LangRu = false;
    private static Skills _instance;
#if CARBON
    private ImageDatabaseModule imageDatabase;
#endif
    private bool _enabledImageLibrary;
    private const string Layer = "Com.Mevent.Main", PERM_Bypass = "skills.bypass", PERM_Wipe = "skills.wipe";
    private HashSet<ulong> _lootedContainers = new();
    private readonly Dictionary<ulong, float> _timeSinceLastMetabolism = new();
    private enum SkillType {
        Wood, Stones, Metal, Sulfur, Attack, Secure, Regeneration, Metabolism, ComponentsRates, StandUpChance, CraftSpeed, FastOven, Kits, None, Cloth, Butcher, Scrap, RecyclerSpeed, TransferWipe, MixingTableSpeed, Gather, CraftRates, CombatMedic, SafeFall, Durability  //RecyclerChance,
        //PowerEffieciency
    }
    private readonly Dictionary<ulong, ulong> _playerByOven = new();
#endregion
#region Config
    private static Configuration _config;
    private class Configuration {
        [JsonProperty(PropertyName = LangRu ? "Разрешение (пример: skills.use)" : "Permission (example: skills.use)")]
        public string Permission = string.Empty;
        [JsonProperty(PropertyName = LangRu ? "Команда для открытия меню с навыками" : "Command")]
        public string Command = "skills";
        [JsonProperty(PropertyName = LangRu ? "Автоматический сброс данных?" : "Auto wipe?")]
        public bool Wipe = true;
        [JsonProperty(PropertyName = LangRu ? "Разрешить использование оповещений через плагин Notify?" : "Work with Notify?")]
        public bool UseNotify = true;
        [JsonProperty(PropertyName = LangRu ? "Сохранять информацию о луте в файлах данных?" : "Store the data on the looted containers in the data-files?")]
        public bool StoreContainers = false;
        [JsonProperty(PropertyName = LangRu ? "Настройки экономики" : "Economy")]
        public EconomyConf Economy = new() {
            Type = EconomyType.Plugin, AddHook = "Deposit", BalanceHook = "Balance", RemoveHook = "Withdraw", Plug = "Economics", ShortName = "scrap", DisplayName = string.Empty, Skin = 0
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Уведомление о максимальном уровне" : "Maximum level notify")]
        public INotify MaxLevel = new() {
            Image = "warning", Url = "https://i.ibb.co/wBn7JzM/image.png", Delay = 0.9f
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Уведомление о нехватке денег" : "Out of balance notify")]
        public INotify NotMoney = new() {
            Image = "warning", Url = "https://i.ibb.co/wBn7JzM/image.png", Delay = 0.9f
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Фон" : "Background")]
        public IPanel Background = new() {
            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 0", Image = string.Empty, Color = new IColor("#0D1F4E", 95), isRaw = false, Sprite = "Assets/Content/UI/UI.Background.Tile.psd", Material = "Assets/Icons/IconMaterial.mat"
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Заголовок" : "Title")]
        public IText Title = new() {
            AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-150 300", OffsetMax = "150 360", Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter, FontSize = 38, Color = new IColor("#FFFFFF", 100)
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Назад" : "Back")]
        public IText Back = new() {
            AnchorMin = "0 0.5", AnchorMax = "0 0.5", OffsetMin = "0 -40", OffsetMax = "65 40", Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter, FontSize = 60, Color = new IColor("#FFFFFF", 100)
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Далее" : "Next")]
        public IText Next = new() {
            AnchorMin = "1 0.5", AnchorMax = "1 0.5", OffsetMin = "-65 -40", OffsetMax = "0 40", Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter, FontSize = 60, Color = new IColor("#FFFFFF", 100)
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Баланс" : "Balance")]
        public IText BalanceText = new() {
            AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-150 0", OffsetMax = "150 75", Font = "robotocondensed-regular.ttf", Align = TextAnchor.MiddleCenter, FontSize = 24, Color = new IColor("#FFFFFF", 100)
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Включить иконку баланса" : "Enable Balance Icon")]
        public bool EnableBalanceIcon = false;
        [JsonProperty(PropertyName = LangRu ? "Иконка баланса" : "Balance Icon")]
        public BalanceIcon BalanceIcon = new() {
            OffsetMinY = 20, OffsetMaxY = 55, Length = 35
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Закрыть" : "Close")]
        public IText CloseLabel = new() {
            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-35 -35", OffsetMax = "-5 -5", Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter, FontSize = 24, Color = new IColor("#FFFFFF", 100)
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Панель навыка" : "Skill Panel")]
        public SkillPanel SkillPanel = new() {
            Background = new SIPanel {
                Image = string.Empty, Color = new IColor("#1D3676", 98), isRaw = false, Sprite = "Assets/Content/UI/UI.Background.Tile.psd", Material = "Assets/Icons/IconMaterial.mat", HeightCorrect = 5
            }
            , Image = new InterfacePosition {
                AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "10 10", OffsetMax = "160 160"
            }
            , Title = new IText {
                AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "165 135", OffsetMax = "-5 160", Align = TextAnchor.MiddleLeft, FontSize = 20, Font = "robotocondensed-bold.ttf", Color = new IColor("#FFFFFF", 100)
            }
            , Description = new IText {
                AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "165 30", OffsetMax = "-5 130", Align = TextAnchor.UpperLeft, FontSize = 14, Font = "robotocondensed-regular.ttf", Color = new IColor("#FFFFFF", 100)
            }
            , Button = new IButton {
                AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-105 10", OffsetMax = "-10 30", AColor = new IColor("#B5FFC9", 100), DColor = new IColor("#B5FFC9", 25), TextUi = new IText {
                    AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 0", Align = TextAnchor.MiddleCenter, FontSize = 14, Font = "robotocondensed-regular.ttf", Color = new IColor("#1D3676", 100)
                }
            }
            , DescriptionButton = new DescriptionButton {
                Enabled = false, AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-105 35", OffsetMax = "-10 55", AColor = new IColor("#B5FFC9", 100), DColor = new IColor("#B5FFC9", 25), TextUi = new IText {
                    AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 0", Align = TextAnchor.MiddleCenter, FontSize = 14, Font = "robotocondensed-regular.ttf", Color = new IColor("#1D3676", 100)
                }
            }
            , Cost = new IText {
                AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-150 10", OffsetMax = "-110 30", Align = TextAnchor.MiddleRight, FontSize = 14, Font = "robotocondensed-regular.ttf", Color = new IColor("#FFFFFF", 100)
            }
            , AddCost = "$", EnableCostImage = false, AddCostImage = new IPanel {
                AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-130 10", OffsetMax = "-110 30", Color = new IColor("#FFFFFF", 100), isRaw = true, Image = "https://i.ibb.co/yfBv8F5/image.png", Sprite = string.Empty, Material = string.Empty
            }
            , Stages = new IProgress {
                AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "160 10", OffsetMax = "160 10", Height = 20, Width = 10, Margin = 5, AColor = new IColor("#8C70D6", 100), DColor = new IColor("#8C70D6", 25)
            }
            , Count = 6, Height = 170, Width = 565, Margin = 20, ShowAllStages = true
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Навыки" : "Skills", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<SkillEntry> Skills = new() {
            new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Wood).Image("https://gspics.org/images/2020/09/02/xz6Fy.png").Title("Woodman", "Дровосек").Description("It's in charge of the tree mining\nWhen you learn the skill, the rate increases by x1", "Отвечает за добычу дерева.\nПри изучении навыка рейт добычи увеличивается на 1.").AddStage(1, new StageConf(string.Empty, 10, 133, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Stones).Image("https://gspics.org/images/2020/09/02/xz9mX.png").Title("Stone Miner", "Камнедобыча").Description("It's in charge of the stones mining\nWhen you learn the skill, the rate increases by x1", "Отвечает за добычу камня.\nПри изучении навыка рейт добычи увеличивается на 1.").AddStage(1, new StageConf(string.Empty, 10, 133, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Metal).Image("https://gspics.org/images/2020/09/02/xznT3.png").Title("Metal Miner", "Чернорабочий").Description("It's in charge of the metal ore mining\nWhen you learn the skill, the rate increases by x1" , "Отвечает за добычу железной руды.\nПри изучении навыка рейт добычи увеличивается на 1.").AddStage(1, new StageConf(string.Empty, 10, 133, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Sulfur).Image("https://gspics.org/images/2020/09/02/xz4te.png").Title("Sulfure Miner", "Серодобытчик").Description("It's in charge of the sulfur ore mining\nWhen you learn the skill, the rate increases by x1" , "Отвечает за добычу серной руды.\nПри изучении навыка рейт добычи увеличивается на 1.").AddStage(1, new StageConf(string.Empty, 10, 133, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Attack).Image("https://gspics.org/images/2020/09/02/xzXza.png").Title("Attack", "Нападение").Description("Changes the damage of any weapon\nWhen you learn the skill, you'll increase your damage by 15%." , "Изменяет величину урона любого оружия.\nПри изучении навыка урон увеличивается на 15%.").AddStage(1, new StageConf(string.Empty, 20, 5, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 35, 10, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 50, 15, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Secure).Image("https://gspics.org/images/2020/09/02/xzAfi.png").Title("Secure", "Защита").Description("Changes the damage of any weapon\nWhen you learn the skill, you'll increase your protection by 15%." , "Изменяет величину урона любого оружия.\nПри изучении навыка ваша защита увеличится на 15%.").AddStage(1, new StageConf(string.Empty, 20, 5, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 35, 10, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 50, 15, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Regeneration).Image("https://gspics.org/images/2020/09/02/xzGrO.png").Title("Regeneration", "Регенерация").Description("Speed health regeneration\nWhen you learn the skill, you'll increase the rate of regeneration by 50%." , "Скоростная регенерация здоровья.\nПри изучении навыка, скорость регенерации увеличится на 90%.").AddStage(1, new StageConf(string.Empty, 10, 0.5f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 1, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 2, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Metabolism).Image("https://gspics.org/images/2020/09/02/xzWdI.png").Title("Metabolism", "Метаболизм").Description("Changes the restoration of thirst and hunger\nWhen you learn the skill, you will get calories and hydration" , "Изменяет восстановление жажды и голода.\nПри изучении навыка вы получите восполнение калорий и гидратации.").AddStage(1, new StageConf(string.Empty, 10, 0.5f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 1, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 2, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.ComponentsRates).Image("https://gspics.org/images/2020/09/02/xz15L.png").Title("Rates to components", "Рейты на компоненты").Description("Changes the rates of extractive components\nWhen we learn the skill, the components found will be x4" , "Изменяет рейты добываемых компонентов.\nПосле изучения этого навыка найденные компоненты будут в четыре раза больше.").AddStage(1, new StageConf(string.Empty, 10, 2, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 3, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 4, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.StandUpChance).Image("https://gspics.org/images/2020/09/02/xzTDD.png").Title("Increased chance to stand", "Увеличение шанса встать").Description("It's a bigger chance to get up when you're wounded\nWhen you learn the skill, the chance goes up from standard 20% to 50%." , "Увеличивает шанс подняться, когда вы ранены.\nПосле изучения этой способности шанс встать увеличивается с 20% до 50%.").AddStage(1, new StageConf(string.Empty, 10, 30, 40, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 40, 50, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 50, 60, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.CraftSpeed).Image("https://i.ibb.co/0fB889w/fAti1Cj.png").Title("Craft Speed", "Скорость крафта").Description("Speeds up your craft.\nWhen you learn the skill, you can craft items in almost instant", "Ускоряет процесс крафта.\nПосле изучения этого навыка вы сможете крафтить почти моментально.").AddStage(1, new StageConf(string.Empty, 10, 30, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 40, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 50, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Kits).Image("https://i.ibb.co/Tt8KxCT/Log7sQR.png").Title("Kits Speed", "Ускорение наборов").Description("Accelerates the delay between receiving kits", "Уменьшает задержку между получением наборов.").AddStage(1, new StageConf(string.Empty, 10, 30, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 40, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 50, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.FastOven).Image("https://i.ibb.co/PMBpNyf/IifHk5l.png").Title("Fast Oven", "Ускорение печей").Description("Accelerating furnace melting", "Увеличивает скорость плавки в печах.").Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.None).Image("https://i.ibb.co/6wdxmN8/RqdcAm0.png").Title("Sorting", "Сортировка").Description("With each stage, you discover new types of sorting" , "На каждом этапе открываются новые виды сортировки.").AddStage(1, new StageConf(string.Empty, 25, 0, 0, new List<string>(), new List<string>(), new List<string> {
                "furnacesplitter.use"
            }
            , new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 40, 0, 0, new List<string>(), new List<string>(), new List<string> {
                "activesort.use"
            }
            , new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.None).ID(1).Image("https://i.ibb.co/Lv7DxLd/S4xulmj.png").Title("Teleportation", "Телепортация").Description("You teleport faster with each stage" , "Вы телепортируетесь быстрее с каждым этапом.").AddStage(1, new StageConf(string.Empty, 30, 0, 0, new List<string>(), new List<string>(), new List<string> {
                "nteleportation.vip"
            }
            , new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 50, 0, 0, new List<string>(), new List<string>(), new List<string> {
                "nteleportation.premium"
            }
            , new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 50, 0, 0, new List<string>(), new List<string>(), new List<string> {
                "nteleportation.deluxe"
            }
            , new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Cloth).Image("https://i.ibb.co/6tvGfSP/5fixMch.png").Title("Cannabis Picker", "Сборщик конопли").Description("It's in charge of the collection of cloth\nWhen you learn the skill, the rate increases by x1" , "Отвечает за сбор ткани.\nИзучив способность, рейт добычи увеличивается на x1.").AddStage(1, new StageConf(string.Empty, 10, 133, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Butcher).Image("https://i.ibb.co/5jr1cXC/4WlHK7u.png").Title("Butcher", "Мясник").Description("It's in charge of the animals prey\nWhen you learn the skill, the rate increases by x1" , "Отвечает за добычу животных.\nИзучив способность, рейт добычи увеличивается на x1.").AddStage(1, new StageConf(string.Empty, 10, 133, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Scrap).Image("https://i.ibb.co/0CsgThq/SEvG4EU.png").Title("Scrap", "Черный копатель").Description("Changes scrap mining rates\nWhen we learn the skill, the components found will be x4" , "Изменяет рейты добычи скрапа.\nИзучив способность, найденный скрап будет x4.").AddStage(1, new StageConf(string.Empty, 10, 2, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 3, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 4, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.RecyclerSpeed).Image("https://i.ibb.co/py5bK98/31k3bM0.png").Title("Recycler Speed", "Скорость Переработчика").Description("Changes rate of recycling components\nWhen we learn the skill, the components will be recycler 2 times faster" , "Изменение скорости переработки компонентов.\nИзучив способность, компоненты будут перерабатываться в 2 раза быстрее.").AddStage(1, new StageConf(string.Empty, 10, 4, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 3, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 2.5f, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.TransferWipe).Image("https://i.ibb.co/Gs5XvvK/W23JZVo.png").Title("Transfer Wipe", "Защита от вайпа").Description("Transferring Skills to the Next Wipe\nWhen we learn this skill, skills will be carried over to the next wipe" , "Перенос способностей на следующий вайп.\nИзучив способность, все способности будут перенесены в следующий вайп.").AddStage(1, new StageConf(string.Empty, 100, 0, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.MixingTableSpeed).Image("https://i.ibb.co/0JJyt4H/W6uHKeU.png").Title("Mixing Table Speed", "Скорость стола для смешивания").Description("Changes rate of mixing recipes\nWhen we learn the skill, the recipes will be mixed instantly" , "Изменение скорости смешивания рецептов.\nИзучив способность, рецепты будут смешиваться моментально.").AddStage(1, new StageConf(string.Empty, 10, 0.8f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 15, 0.45f, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 20, 0f, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Gather).ShortName("blue.berry|red.berry|white.berry|yellow.berry|green.berry|black.berry").ID(3490432).Image("https://i.ibb.co/J26dBz9/D8RsOS3.png").Title("Berry Hunter", "Охотник за ягодами").Description("It's in charge of picking blueberries\nWhen you learn the skill, the rate increases by x1" , "Увеличивает количество собираемых ягод.\nКогда вы изучите этот навык, рейт увеличится на x1.").AddStage(1, new StageConf(string.Empty, 10, 133f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 164f, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200f, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.CraftRates).Image("https://i.ibb.co/G5r1dQs/jnH4ELO.png").Title("Craft Rates", "Улучшенный крафт").Description("Item crafting rates\nIf you learn this skill, you will have an increased chance of getting an increased amount of an item when crafting" , "Рейты крафта предметов.\nЕсли вы изучите этот навык, у вас будет повышенный шанс получить увеличенное количество предмета при его крафте.").AddStage(1, new StageConf(string.Empty, 10, 140f, 10, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 160f, 20, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 40, 200f, 30, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.CombatMedic).Image("https://i.ibb.co/hyhpcfZ/combat-medic.png").Title("Combat Medic", "Боевой медик").Description("Fast recovery of health in battle.\nBy learning this skill, you increase the amount of healing health you receive when using bandages." , "Быстрое восстановление здоровья в бою.\nИзучая этот навык, вы увеличиваете количество исцеляющего здоровья, которое получаете при использовании бинтов.").AddStage(1, new StageConf(string.Empty, 10, 40f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 60f, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 60, 100f, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.SafeFall).Image("https://i.ibb.co/0hJs2sJ/safe-fall.png").Title("Safe Fall", "Безопасное падение").Description("Reduces fall damage.\nBy learning this skill, you reduce the likelihood of serious injury when falling from height." , "Уменьшает повреждения при падении.\nОвладев этим навыком, вы уменьшите вероятность серьезных травм при падении с высоты.").AddStage(1, new StageConf(string.Empty, 10, 40f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 60f, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 60, 100f, 0, new List<RequiredSkillStage>())).Build(), new SkillEntry.SkillBuilder().Enabled(true).Type(SkillType.Durability).Image("https://i.ibb.co/QryPdjN/durability.png").Title("Durability", "Стойкость").Description("Allows you to reduce the breakage of items during use.\nBy learning this skill, your items will break less when used." , "Позволяет уменьшить поломку предметов во время использования.\nОвладев этим навыком, ваши предметы будут меньше ломаться при использовании.").AddStage(1, new StageConf(string.Empty, 10, 40f, 0, new List<RequiredSkillStage>())).AddStage(2, new StageConf(string.Empty, 25, 60f, 0, new List<RequiredSkillStage>())).AddStage(3, new StageConf(string.Empty, 60, 100f, 0, new List<RequiredSkillStage>())).Build()
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Животные" : "Animals", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> Animals = new() {
            "chicken.corpse", "boar.corpse", "bear.corpse", "wolf.corpse", "stag.corpse", "polarbear.corpse"
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Черный список печей" : "Ovens Black List", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> OvensBlackList = new() {
            "entity shortnameprefab 1", "entity shortnameprefab 2"
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Черный список контейнеров" : "Containers Black List", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> ContainersBlackList = new() {
            "entity prefab name 1", "entity prefab name 2"
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Черный список для навыка атаки" : "Blacklist for Attack skill", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> AttackBlackList = new() {
            "entity prefab name 1", "entity prefab name 2"
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Черный список оружия для навыка атаки" : "Weapon blacklist for Attack skill", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> WeaponAttackBlackList = new() {
            "entity shortname name 1", "entity shortname name 2"
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Дополнительные настройки для навыка Быстроой Печи" : "Additional settings for the Fast Oven skill")]
        public FastOvenSkill FastOven = new() {
            Stages = new Dictionary<int, FastOvenStage> {
                [1]
                = new() {
                    Permission = string.Empty, Cost = 10, Rates = new Dictionary<string, float> {
                        {
                            "ore", 1
                        }
                        , {
                            "meat", 1
                        }
                        , {
                            "hq.metal.ore", 1
                        }
                        , {
                            "wood", 1
                        }
                        , {
                            "*", 1
                        }
                    }
                    , RequiredSkillStages = new List<RequiredSkillStage> {
                        new() {
                            ID = 0, Type = SkillType.CraftSpeed, Stage = 1, RequireSkill = false
                        }
                    }
                }
                , [2] = new() {
                    Permission = string.Empty, Cost = 15, Rates = new Dictionary<string, float> {
                        {
                            "ore", 2
                        }
                        , {
                            "meat", 2
                        }
                        , {
                            "hq.metal.ore", 2
                        }
                        , {
                            "wood", 2
                        }
                        , {
                            "*", 2
                        }
                    }
                    , RequiredSkillStages = new List<RequiredSkillStage>()
                }
                , [3] = new() {
                    Permission = string.Empty, Cost = 20, Rates = new Dictionary<string, float> {
                        {
                            "ore", 3
                        }
                        , {
                            "meat", 3
                        }
                        , {
                            "hq.metal.ore", 3
                        }
                        , {
                            "wood", 3
                        }
                        , {
                            "*", 3
                        }
                    }
                    , RequiredSkillStages = new List<RequiredSkillStage>()
                }
            }
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Дополнительные настройки для навыка Компоненты Рейты" : "Additional settings for the Components Rates skill")]
        public ComponentsRatesSkill ComponentsRates = new() {
            AllowedCategories = new List<ItemCategory> {
                ItemCategory.Component
            }
            , AllowedItems = new List<string> {
                "targeting.computer", "cctv.camera"
            }
            , BlockList = new List<string> {
                "glue", "techparts"
            }
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Настройка Дополнительных Кнопок" : "Additional Buttons Settings")]
        public AdditionalButtonsSettings AdditionalButtons = new() {
            Buttons = new List<AdditionalButtonsSettings.AdditinalButton> {
                new(false, "https://i.ibb.co/X8btTQV/C83Rprq.png", "leaders", true)
            }
            , UI = new AdditionalButtonsSettings.ButtonsUI {
                SideIndent = 45, UpIndent = 5, Size = 30, Margin = 5
            }
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Дополнительные настройки для скилла Transfer Wipe" : "Additional settings for the Transfer Wipe skill")]
        public TransferWipeSkill TransferWipe = new() {
            ResetSingle = false
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Дополнительные настройки для скилла Craft Rates" : "Additional settings for the Craft Rates skill")]
        public CraftRatesSkill CraftRates = new() {
            AllowedList = new List<string> {
                "gunpowder", "lowgradefuel", "rock"
            }
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Дополнительные настройки для скилла CombatMedic" : "Additional settings for the CombatMedic skill")]
        public CombatMedicSkill CombatMedic = new() {
            AllowedItems = new Dictionary<string, bool> {
                ["bandage"]
                = true, ["syringe.medical"] = true, ["largemedkit"] = true
            }
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Игнорировать скилл Attack на дуэли?" : "Ignore Attack skill on duels?")]
        public bool IgnoreAttackSkillOnDuel = true;
        [JsonProperty(PropertyName = LangRu ? "Игнорировать скилл Secure на дуэли?" : "Ignore Secure skill on duels?")]
        public bool IgnoreSecureSkillOnDuel = true;
        [JsonProperty(PropertyName = LangRu ? "Настройка Оповещений" : "Broadcasting Settings")]
        public Broadcasting Broadcasting = new() {
            UseLearnSkill = true
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Настройка логирования" : "Logging Settings")]
        public LoggingSettings Logging = new() {
            UsePlayerActionLogging = true
        }
        ;
        [JsonProperty(PropertyName = LangRu ? "Использовать бонусный режим для навыков добычи?" : "Use bonus mode for mining skills?")]
        public bool UseBonusMode = false;
        [JsonProperty(PropertyName = LangRu ? "Черный список предметов для навыка Durability" : "Blacklist of items for Durability skills", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public HashSet<string> DurabilityBlacklist = new() {
            "keycard_blue", "keycard_red", "keycard_green"
        }
        ;
        public VersionNumber Version;
    }
    private class LoggingSettings {
        [JsonProperty(PropertyName = LangRu ? "Использовать логирование действий игороков?" : "Use player action logging?")]
        public bool UsePlayerActionLogging;
    }
    private class Broadcasting {
        [JsonProperty(PropertyName = LangRu ? "Включить оповещения при изучении навыка?" : "Enable broadcast when learning a skill?")]
        public bool UseLearnSkill;
        public void LearnSkill(BasePlayer player, SkillEntry skill, int stage) {
            if (!UseLearnSkill) return;
            foreach (var target in BasePlayer.activePlayerList) {
                if (target.EqualNetID(player)) continue;
                target.ChatMessage(_instance.Msg(target, BroadcastLearnSkill).Replace("{username}", player.displayName).Replace("{skill_name}", skill.Title).Replace("{stage}", stage.ToString()));
            }
        }
    }
    private class TransferWipeSkill {
        [JsonProperty(PropertyName = LangRu ? "Сброс после однократного использования?" : "Reset after a single use?")]
        public bool ResetSingle;
    }
    private class ComponentsRatesSkill {
        [JsonProperty(PropertyName = LangRu ? "Разрешенные категории" : "Allowed Categories", ObjectCreationHandling = ObjectCreationHandling.Replace, ItemConverterType = typeof(StringEnumConverter))]
        public List<ItemCategory> AllowedCategories = new();
        [JsonProperty(PropertyName = LangRu ? "Разрешенные предметы" : "Allowed Items", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> AllowedItems = new();
        [JsonProperty(PropertyName = LangRu ? "Блок-лист компонентов (shortname)" : "Components Block List (shortname)", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> BlockList = new();
    }
    private class AdditionalButtonsSettings {
        [JsonProperty(PropertyName = LangRu ? "Кнопки" : "Buttons", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<AdditinalButton> Buttons = new();
        [JsonProperty(PropertyName = LangRu ? "Настройка Интерфейса" : "Interface Settings")]
        public ButtonsUI UI;
        public class AdditinalButton {
            [JsonProperty(PropertyName = LangRu ? "Включено" : "Enabled")]
            public bool Enabled;
            [JsonProperty(PropertyName = LangRu ? "Изображение" : "Image")]
            public string Image;
            [JsonProperty(PropertyName = LangRu ? "Команда" : "Command")]
            public string Command;
            [JsonProperty(PropertyName = LangRu ? "Закрыть меню" : "Close Menu")]
            public bool CloseMenu;
            public AdditinalButton(bool enabled, string image, string command, bool closeMenu) {
                Enabled = enabled;
                Image = image;
                Command = command;
                CloseMenu = closeMenu;
            }
        }
        public class ButtonsUI {
            [JsonProperty(PropertyName = LangRu ? "Боковой отступ" : "Side Indent")]
            public float SideIndent;
            [JsonProperty(PropertyName = LangRu ? "Отступ вверху" : "Up Indent")]
            public float UpIndent;
            [JsonProperty(PropertyName = LangRu ? "Расстояние между" : "Margin")]
            public float Margin;
            [JsonProperty(PropertyName = LangRu ? "Размер" : "Size")]
            public float Size;
        }
    }
    private class BalanceIcon {
        [JsonProperty(PropertyName = LangRu ? "Минимальное смещение по оси Y" : "Offset Min Y")]
        public float OffsetMinY;
        [JsonProperty(PropertyName = LangRu ? "Максимальное смещение по оси Y" : "Offset Max Y")]
        public float OffsetMaxY;
        [JsonProperty(PropertyName = LangRu ? "Длина" : "Length")]
        public float Length;
    }
    private class INotify {
        [JsonProperty(PropertyName = LangRu ? "Ключ изображения" : "Image Key")]
        public string Image;
        [JsonProperty(PropertyName = LangRu ? "Ссылка на изображение" : "Image Url")]
        public string Url;
        [JsonProperty(PropertyName = LangRu ? "Время показа" : "Show Time")]
        public float Delay;
    }
    private enum EconomyType {
        Plugin, Item
    }
    private class EconomyConf {
#region Fields
        [JsonProperty(PropertyName = LangRu ? "Тип (Plugin/Item)" : "Type (Plugin/Item)")]
        [JsonConverter(typeof(StringEnumConverter))]
        public EconomyType Type;
        [JsonProperty(PropertyName = LangRu ? "Название используемого плагина экономики" : "Plugin name")]
        public string Plug;
        [JsonProperty(PropertyName = LangRu ? "Функция пополнения баланса" : "Balance add hook")]
        public string AddHook;
        [JsonProperty(PropertyName = LangRu ? "Функция снятия баланса" : "Balance remove hook")]
        public string RemoveHook;
        [JsonProperty(PropertyName = LangRu ? "Функция отображения баланса" : "Balance show hook")]
        public string BalanceHook;
        [JsonProperty(PropertyName = LangRu ? "Краткое имя предмета" : "ShortName")]
        public string ShortName;
        [JsonProperty(PropertyName = LangRu ? "Пользовательское название предмета (пусто - стандартное)" : "Display Name (empty - default)")]
        public string DisplayName;
        [JsonProperty(PropertyName = LangRu ? "Идентификатор скина предмета" : "Skin")]
        public ulong Skin;
#endregion
#region Public Methods
        public double ShowBalance(BasePlayer player) {
            switch (Type) {
                case EconomyType.Plugin : {
                    var plugin = _instance?.plugins?.Find(Plug);
                    if (plugin == null) return 0;
                    return Math.Round(Convert.ToDouble(plugin.Call(BalanceHook, player.userID.Get())), 2);
                }
                case EconomyType.Item : {
                    return PlayerItemsCount(player, ShortName, Skin);
                }
                default : return 0;
            }
        }
        public void AddBalance(BasePlayer player, double amount) {
            switch (Type) {
                case EconomyType.Plugin : {
                    var plugin = _instance?.plugins?.Find(Plug);
                    if (plugin == null) return;
                    switch (Plug) {
                        case "Economics" : plugin.Call(AddHook, player.userID.Get(), amount);
                        break;
                        default : plugin.Call(AddHook, player.userID.Get(), (int) amount);
                        break;
                    }
                    break;
                }
                case EconomyType.Item : {
                    var am = (int) amount;
                    var item = ToItem(am);
                    if (item == null) return;
                    player.GiveItem(item);
                    break;
                }
            }
        }
        public bool RemoveBalance(BasePlayer player, double amount) {
            switch (Type) {
                case EconomyType.Plugin : {
                    if (ShowBalance(player) < amount) return false;
                    var plugin = _instance?.plugins.Find(Plug);
                    if (plugin == null) return false;
                    switch (Plug) {
                        case "Economics" : plugin.Call(RemoveHook, player.userID.Get(), amount);
                        break;
                        default : plugin.Call(RemoveHook, player.userID.Get(), (int) amount);
                        break;
                    }
                    return true;
                }
                case EconomyType.Item : {
                    var playerItems = Pool.Get<List<Item>>();
                    player.inventory.GetAllItems(playerItems);
                    var am = (int) amount;
                    if (ItemCount(playerItems, ShortName, Skin) < am) {
                        Pool.Free(ref playerItems);
                        return false;
                    }
                    Take(playerItems, ShortName, Skin, am);
                    Pool.Free(ref playerItems);
                    return true;
                }
                default : return false;
            }
        }
#endregion
#region Private Methods
        private Item ToItem(int amount) {
            var item = ItemManager.CreateByName(ShortName, amount, Skin);
            if (item == null) {
                Debug.LogError($"Error creating item with ShortName: '{ShortName}'");
                return null;
            }
            if (!string.IsNullOrEmpty(DisplayName)) item.name = DisplayName;
            return item;
        }
        private int PlayerItemsCount(BasePlayer player, string shortname, ulong skin) {
            var items = Pool.Get<List<Item>>();
            player.inventory.GetAllItems(items);
            var result = ItemCount(items, shortname, skin);
            Pool.Free(ref items);
            return result;
        }
        private int ItemCount(List<Item> items, string shortname, ulong skin) {
            return items.FindAll(item => item.info.shortname == shortname && !item.isBroken && (skin == 0 || item.skin == skin)).Sum(item => item.amount);
        }
        private void Take(IEnumerable<Item> itemList, string shortname, ulong skinId, int iAmount) {
            var num1 = 0;
            if (iAmount == 0) return;
            var list = Pool.Get<List<Item>>();
            foreach (var item in itemList) {
                if (item.info.shortname != shortname || (skinId != 0 && item.skin != skinId) || item.isBroken) continue;
                var num2 = iAmount - num1;
                if (num2 <= 0) continue;
                if (item.amount > num2) {
                    item.MarkDirty();
                    item.amount -= num2;
                    break;
                }
                if (item.amount <= num2) {
                    num1 += item.amount;
                    list.Add(item);
                }
                if (num1 == iAmount) break;
            }
            foreach (var obj in list) obj.RemoveFromContainer();
            Pool.FreeUnmanaged(ref list);
        }
#endregion
    }
    private class CombatMedicSkill {
        [JsonProperty(PropertyName = LangRu ? "Список предметов, на которые будет действовать скилл" : "List of items affected by the skill", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public Dictionary<string, bool> AllowedItems = new();
    }
    private class CraftRatesSkill {
        [JsonProperty(PropertyName = LangRu ? "Список разрешенных предметов" : "Allowed List", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<string> AllowedList = new();
    }
    private class FastOvenSkill : ISkill {
#region Fields
        [JsonProperty(PropertyName = LangRu ? "Работа с кострами" : "Work with campfires")]
        public bool WorkWithCampfires = true;
        [JsonProperty(PropertyName = LangRu ? "Множитель угля" : "Charcoal multiplier")]
        public float CharcoalMultiplier = 2;
        [JsonProperty(PropertyName = LangRu ? "Перестаньте сжигать пищу" : "Stop burning food")]
        public bool StopBurningFood = true;
        [JsonProperty(PropertyName = LangRu ? "Уровни" : "Stages", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public Dictionary<int, FastOvenStage> Stages;
#endregion
#region Public Methods
        public FastOvenStage GetStage(BasePlayer player) {
            if (player == null) return null;
            var skillData = PlayerData.GetOrLoad(player.UserIDString)?.GetSkillData(SkillType.FastOven);
            if (skillData == null) return null;
            return Stages.GetValueOrDefault(skillData.Stage);
        }
        public Dictionary<int, IStage> GetStages(string userid) {
            return Stages.Where(x => x.Value.HasAccess(userid)).ToDictionary(x => x.Key, y => (IStage) y.Value);
        }
#endregion
    }
    private class FastOvenStage : IStage {
#region Fields
        [JsonProperty(PropertyName = LangRu ? "Разрешение (пример: skills.vip)" : "Permission (ex: skills.vip)")]
        public string Permission;
        [JsonProperty(PropertyName = LangRu ? "Стоимость" : "Cost")]
        public float Cost;
        [JsonProperty(PropertyName = LangRu ? "Рейты" : "Rates", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public Dictionary<string, float> Rates = new();
        [JsonProperty(PropertyName = LangRu ? "Требуемые стадии скиллов" : "Required skill stages", ObjectCreationHandling = ObjectCreationHandling.Replace)]
        public List<RequiredSkillStage> RequiredSkillStages = new();
#endregion
#region Public Methods
        public float GetCost() {
            return Cost;
        }
        public bool HasAccess(string userid) {
            return _config.SkillPanel.ShowAllStages || HasPermissions(userid);
        }
        public bool HasPermissions(string userid) {
            return string.IsNullOrEmpty(Permission) || _instance.permission.UserHasPermission(userid, Permission);
        }
        public List<RequiredSkillStage> GetRequiredSkillStages() {
            return RequiredSkillStages;
        }
#endregion
    }
    private class SkillEntry : ISkill {
#region Fields
        [JsonProperty(PropertyName = LangRu ? "Включено" : "Enabled")]
        public bool Enabled;
        [JsonProperty(PropertyName = LangRu ? "Разрешение" : "Permission")]
        public string Permission = string.Empty;
        [JsonProperty(PropertyName = LangRu ? "Тип" : "Type")]
        [JsonConverter(typeof(StringEnumConverter))]
        public SkillType Type;
        [JsonProperty(PropertyName = LangRu ? "ИД (для None)" : "ID (for None)")]
        public int ID;
        [JsonProperty(PropertyName = LangRu ? "Изображение" : "Image")]
        public string Image;
        [JsonProperty(PropertyName = LangRu ? "Название" : "Title")]
        public string Title;
        [JsonProperty(PropertyName = LangRu? "Локализация названия" : "Title localization")]
        public Localization Titl
// ... [Code preview truncated due to length. Full source in attached file] ...

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху