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

FREE Kits : 2.1.9 2.1.9

Нет прав для скачивания
C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
// #define TESTING
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
using Facepunch;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Oxide.Core;
using Oxide.Core.Libraries;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Oxide.Plugins.KitsExtensionMethods;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
#if CARBON
using Carbon.Base;
using Carbon.Modules;
#endif
namespace Oxide.Plugins {
    [Info("Kits", "Mevent", "2.1.9")]
    public class Kits : RustPlugin {
#region Fields
        [PluginReference]
        private Plugin ImageLibrary = null, ServerPanel = null, CopyPaste = null, Notify = null, UINotify = null, NoEscape = null;
        private static Kits _instance;
        private const string PERM_ADMIN = "Kits.admin", Layer = "UI.Kits", InfoLayer = "UI.Kits.Info", EditingLayer = "UI.Kits.Editing", ModalLayer = "UI.Kits.Modal", CategoryAll = "all";
        private bool _enabledImageLibrary;
#if CARBON
        private ImageDatabaseModule imageDatabase;
#endif
        private const bool LangRu = false;
        private readonly Dictionary<ulong, Dictionary<string, object>> _kitEditing = new();
        private readonly Dictionary<ulong, Dictionary<string, object>> _itemEditing = new();
        private readonly Dictionary<string, List<(int itemID, string shortName)>> _itemsCategories = new();
        private (bool spStatus, int categoryID) _serverPanelCategory = (false, -1);
        // key - use serverPanel, value - category id
        private int _lastKitID;
#endregion
#region Config
        private Configuration _config;
        private class Configuration {
            [JsonProperty(PropertyName = LangRu ? "Автовайп" : "Automatic wipe on wipe")]
            public bool AutoWipe = false;
            [JsonProperty(PropertyName = LangRu ? "Сохранять выданные наборы (с помощью команды kits.givekit) при вайпе?" : "Save given kits (via the kits.givekit command) on wipe?")]
            public bool SaveGivenKitsOnWipe = false;
            [JsonProperty(PropertyName = LangRu ? "Стандартный Цвет Набора" : "Default Kit Color")]
            public string KitColor = "#A0A935";
            [JsonProperty(PropertyName = LangRu ? "Работать с Notify?" : "Work with Notify?")]
            public bool UseNotify = true;
            [JsonProperty(PropertyName = LangRu ? "Работать с NoEscape? (Raid/Combat block)" : "Use NoEscape? (Raid/Combat block)")]
            public bool UseNoEscape = false;
            [JsonProperty(PropertyName = LangRu ? "Использовать блокировку рейда?" : "Use Raid Blocked?")]
            public bool UseRaidBlock = true;
            [JsonProperty(PropertyName = LangRu ? "Использовать блокировку комбата?" : "Use Combat Blocked?")]
            public bool UseCombatBlock = true;
            [JsonProperty(PropertyName = LangRu ? "Могут ли администраторы редактировать предметы? (по флаг)" : "Can admins edit? (by flag)")]
            public bool FlagAdmin = true;
            [JsonProperty(PropertyName = LangRu ? "Whitelist для NoEscape" : "Whitelist for NoEscape", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public List<string> NoEscapeWhiteList = new() {
                "kit name 1", "kit name 2"
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Команды" : "Commands", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public string[] Commands = {
                "kit", "kits"
            }
            ;
            [JsonProperty(PropertyName = "Economy")]
            public EconomyConf Economy = new() {
                Type = EconomyConf.EconomyType.Plugin, AddHook = "Deposit", BalanceHook = "Balance", RemoveHook = "Withdraw", Plug = "Economics", ShortName = "scrap", DisplayName = string.Empty, Skin = 0
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Настройки Редкости" : "Rarity Settings", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public List<RarityColor> RarityColors = new() {
                new RarityColor(40, "#A0A935")
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Авто наборы" : "Auto Kits", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public List<string> AutoKits = new() {
                "autokit", "autokit_vip", "autokit_premium"
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Получение автонабора 1 раз?" : "Getting an auto kit 1 time?")]
            public bool OnceAutoKit = false;
            [JsonProperty(PropertyName = LangRu ? "Разрешить включать/выключать автокиты?" : "Allow to enable/disable autokit?")]
            public bool UseChangeAutoKit = false;
            [JsonProperty(PropertyName = LangRu ? "Разрешение для включения/выключения автокитов" : "Permission to enable/disable autokit")]
            public string ChangeAutoKitPermission = "kits.changeautokit";
            [JsonProperty(PropertyName = LangRu ? "Игнорировать проверку автокита?" : "Ignore auto-kit checking?")]
            public bool IgnoreAutoKitChecking = true;
            [JsonProperty(PropertyName = LangRu ? "Обновлять меню наборов во время операций с разрешениями?" : "Update the kits menu during permissions operations?")]
            public bool OnPermissionsUpdate = false;
            [JsonProperty(PropertyName = "Logs")]
            public LogInfo Logs = new() {
                Console = true, File = true
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Показывать оповещение об отсутвии прав?" : "Show No Permission Description?")]
            public bool ShowNoPermDescription = true;
            [JsonProperty(PropertyName = LangRu ? "Показывать все наборы?" : "Show All Kits?")]
            public bool ShowAllKits = false;
            [JsonProperty(PropertyName = LangRu ? "Показывать набор, когда закончилось количество использований?" : "Show the kit when the number of uses is up?")]
            public bool ShowUsesEnd = false;
            [JsonProperty(PropertyName = "CopyPaste Parameters", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public List<string> CopyPasteParameters = new() {
                "deployables", "true", "inventories", "true"
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Блокировка в Building Block?" : "Block in Building Block?")]
            public bool BlockBuilding = false;
            [JsonProperty(PropertyName = LangRu ? "NPC Наборы" : "NPC Kits", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public Dictionary<string, NpcKitsData> NpcKits = new() {
                ["1234567"]
                = new NpcKitsData {
                    Description = "Free Kits", Kits = new List<string> {
                        "kit_one", "kit_two"
                    }
                }
                , ["7654321"] = new NpcKitsData {
                    Description = "VIPs Kits", Kits = new List<string> {
                        "kit_three", "kit_four"
                    }
                }
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Описание" : "Description")]
            public MenuDescription Description = new() {
                AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "0 -55", OffsetMax = "0 -5", Enabled = true, Color = new IColor("#0E0E10", 100), FontSize = 18, Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter, TextColor = new IColor("#FFFFFF", 100), Description = string.Empty
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Информация о наборе" : "Info Kit Description")]
            public DescriptionSettings InfoKitDescription = new() {
                AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-125 -55", OffsetMax = "125 -5", Enabled = true, Color = new IColor("#0E0E10", 100), FontSize = 18, Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter, TextColor = new IColor("#FFFFFF", 100)
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Интерфейс" : "Interface")]
            public UserInterface UI = UserInterface.GenerateFullscreenTemplateOldStyle();
            [JsonProperty(PropertyName = LangRu ? "Интерфейс для меню" : "Menu UI")]
            public UserInterface MenuUI = UserInterface.GenerateMenuTemplateRustV1();
            [JsonProperty(PropertyName = LangRu ? "Пользовательские названия для наборов" : "Custom Title for Kits")]
            public CustomTitles CustomTitles = new() {
                Enabled = false, KitTitles = new Dictionary<string, CustomTitles.KitTitle> {
                    ["custom_kit"]
                    = new() {
                        Enabled = false, Titles = new Dictionary<string, CustomTitles.TitleConf> {
                            ["NoPermissionDescription"]
                            = new() {
                                Enabled = false, Messages = new Dictionary<string, string> {
                                    ["en"]
                                    = "You don't have permission to get this kit", ["fr"] = "Vous n'avez pas l'autorisation d'obtenir ce kit"
                                }
                            }
                            , ["KitAvailable"] = new() {
                                Enabled = false, Messages = new Dictionary<string, string> {
                                    ["en"]
                                    = "KIT AVAILABLE\nTO RECEIVE", ["fr"] = "KIT DISPONIBLE\nPOUR RECEVOIR"
                                }
                            }
                        }
                    }
                    , ["second_custom_kit"] = new() {
                        Enabled = false, Titles = new Dictionary<string, CustomTitles.TitleConf> {
                            ["NoPermissionDescription"]
                            = new() {
                                Enabled = false, Messages = new Dictionary<string, string> {
                                    ["en"]
                                    = "You don't have permission to get this kit", ["fr"] = "Vous n'avez pas l'autorisation d'obtenir ce kit"
                                }
                            }
                            , ["KitAvailable"] = new() {
                                Enabled = false, Messages = new Dictionary<string, string> {
                                    ["en"]
                                    = "KIT AVAILABLE\nTO RECEIVE", ["fr"] = "KIT DISPONIBLE\nPOUR RECEVOIR"
                                }
                            }
                        }
                    }
                }
            }
            ;
            [JsonProperty(PropertyName = LangRu ? "Наборы, скрытые в интерфейсе" : "Kits hidden in the interface", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public string[] KitsHidden = {
                "Enter the name of the kit here", "Example of a string for the second kit"
            }
            ;
            public VersionNumber Version;
        }
        private class LogoConf : InterfacePosition {
            [JsonProperty(PropertyName = LangRu ? "Включено" : "Enabled")]
            public bool Enabled;
            [JsonProperty(PropertyName = LangRu ? "Изображение" : "Image")]
            public string Image;
        }
        private class CustomTitles {
            [JsonProperty(PropertyName = LangRu ? "Включено" : "Enabled")]
            public bool Enabled;
            [JsonProperty(PropertyName = LangRu ? "Названия наборов (название набора – настройки)" : "Kit Titles (kit name – settings)", ObjectCreationHandling = ObjectCreationHandling.Replace)]
            public Dictionary<string, KitTitle> KitTitles = new();
            public class TitleConf {
                [JsonProperty(PropertyName = LangRu ? "Включено" : "Enabled")]
                public bool Enabled;
                [JsonProperty(PropertyName = LangRu ? "Текст (язык - текст)" : "Text (language - text)", ObjectCreationHandling = ObjectCreationHandling.Replace)]
                public Dictionary<string, string> Messages = new();
                public string GetMessage(BasePlayer player = null) {
                    if (Messages.Count == 0) throw new Exception("The use of custom titles is enabled, but there are no messages!");
                    var userLang = "en";
                    if (player != null) userLang = _instance.lang.GetLanguage(player.UserIDString);
                    return Messages.TryGetValue(userLang, out var message) ? message : Messages.TryGetValue("en", out message) ? message : Messages.ElementAt(0).Value;
                }
            }
            public class KitTitle {
                [JsonProperty(PropertyName = LangRu ? "Включено" : "Enabled")]
                public bool Enabled;
                [JsonProperty(PropertyName = LangRu ? "Название (ключ – настройки)" : "Titles (key – settings)", ObjectCreationHandling = ObjectCreationHandling.Replace)]
                public Dictionary<string, TitleConf> Titles = new();
            }
        }
        private class EconomyConf {
#region Fields
            [JsonProperty(PropertyName = "Type (Plugin/Item)")]
            [JsonConverter(typeof(StringEnumConverter))]
            public EconomyType Type;
            [JsonProperty(PropertyName = "Plugin name")]
            public string Plug;
            [JsonProperty(PropertyName = "Balance add hook")]
            public string AddHook;
            [JsonProperty(PropertyName = "Balance remove hook")]
            public string RemoveHook;
            [JsonProperty(PropertyName = "Balance show hook")]
            public string BalanceHook;
            [JsonProperty(PropertyName = "ShortName")]
            public string ShortName;
            [JsonProperty(PropertyName = "Display Name (empty - default)")]
            public string DisplayName;
            [JsonProperty(PropertyName = "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.UserIDString)));
                    }
                    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 "BankSystem" : case "ServerRewards" : case "IQEconomic" : plugin.Call(AddHook, player.UserIDString, (int) amount);
                            break;
                            default : plugin.Call(AddHook, player.UserIDString, 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 "BankSystem" : case "ServerRewards" : case "IQEconomic" : plugin.Call(RemoveHook, player.UserIDString, (int) amount);
                            break;
                            default : plugin.Call(RemoveHook, player.UserIDString, 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 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 static void Take(List<Item> itemList, string shortname, ulong skinId, int iAmount) {
                if (iAmount == 0) return;
                var list = Pool.Get<List<Item>>();
                var num1 = 0;
                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);
            }
            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;
            }
#endregion
#region Classes
            public enum EconomyType {
                Plugin, Item
            }
#endregion
        }
        private enum InterfaceStyle {
            OldStyle, NewRust
        }
        private class UserInterface {
#region Fields
            [JsonProperty(PropertyName = LangRu ? "Стиль" : "Style")]
            [JsonConverter(typeof(StringEnumConverter))]
            public InterfaceStyle Style;
            [JsonProperty(PropertyName = LangRu ? "Показать категории" : "Show Categories")]
            public bool ShowCategories;
            [JsonProperty(PropertyName = LangRu ? "Высота" : "Height")]
            public float Height;
            [JsonProperty(PropertyName = LangRu ? "Ширина" : "Width")]
            public float Width;
            [JsonProperty(PropertyName = LangRu ? "Высота набора" : "Kit Height")]
            public float KitHeight;
            [JsonProperty(PropertyName = LangRu ? "Ширина набора" : "Kit Width")]
            public float KitWidth;
            [JsonProperty(PropertyName = LangRu ? "Отступ" : "Margin")]
            public float Margin;
            [JsonProperty(PropertyName = LangRu ? "Кол-во наборов на строке" : "Kits On String")]
            public int KitsOnString;
            [JsonProperty(PropertyName = LangRu ? "Кол-во строк" : "Strings")]
            public int Strings;
            [JsonProperty(PropertyName = LangRu ? "Отступ по слева" : "Left Indent")]
            public float LeftIndent;
            [JsonProperty(PropertyName = LangRu ? "Отступ по вертикали" : "Y Indent")]
            public float YIndent;
            [JsonProperty(PropertyName = LangRu ? "Настройки доступности набора" : "Kit Available Settings")]
            public InterfacePosition KitAvailable;
            [JsonProperty(PropertyName = LangRu ? "Настройки количества набора" : "Kit Amount Settings")]
            public KitAmountSettings KitAmount = new();
            [JsonProperty(PropertyName = LangRu ? "Настройки КД набора" : "Kit Cooldown Settings")]
            public InterfacePosition KitCooldown = new();
            [JsonProperty(PropertyName = LangRu ? "Настройки продажи" : "Kit Sale Settings")]
            public InterfacePosition KitSale = new();
            [JsonProperty(PropertyName = LangRu ? "Настройка КД набора (с количеством)" : "Kit Cooldown Settings (with amount)")]
            public InterfacePosition KitAmountCooldown;
            [JsonProperty(PropertyName = LangRu ? "Настройки отсутствия прав" : "No Permission Settings")]
            public InterfacePosition NoPermission;
            [JsonProperty(PropertyName = LangRu ? "Закрывать интерфейс после получения набора?" : "Close the interface after receiving a kit?")]
            public bool CloseAfterReceive;
            [JsonProperty(PropertyName = LangRu ? "Настройки логотипа" : "Logo Settings")]
            public LogoConf Logo;
            [JsonProperty(LangRu ? "Главный фон" : "Main background")]
            public ImageSettings MainBackground = new();
            [JsonProperty(LangRu ? "Главная панель" : "Main panel")]
            public ImageSettings MainPanel = new();
            [JsonProperty(PropertyName = LangRu ? "Настройки заголовка" : "Header Settings")]
            public KitsPanelHeaderUI HeaderPanel = new();
            [JsonProperty(PropertyName = LangRu ? "Настройки панели китов" : "Kits Panel Settings")]
            public KitsPanelContentUI ContentPanel = new();
            [JsonProperty(PropertyName = LangRu ? "Настройки кита" : "Kit Settings")]
            public KitsPanelKitUI KitPanel = new();
            [JsonProperty(PropertyName = LangRu ? "Настройки категорий" : "Category Settings")]
            public KitsCategoryUI Categories = new();
            [JsonProperty(PropertyName = LangRu ? "Цвет 1" : "Color 1")]
            public IColor ColorOne = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет 2" : "Color 2")]
            public IColor ColorTwo = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет 3" : "Color 3")]
            public IColor ColorThree = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет 4" : "Color 4")]
            public IColor ColorFour = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет 5" : "Color 5")]
            public IColor ColorFive = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет Red" : "Color Red")]
            public IColor ColorRed = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет White" : "Color White")]
            public IColor ColorWhite = IColor.CreateWhite();
            [JsonProperty(PropertyName = LangRu ? "Цвет фона" : "Background Color")]
            public IColor ColorBackground = IColor.CreateWhite();
#endregion
#region Classes
            public class KitsCategoryUI {
                [JsonProperty(PropertyName = "Background")]
                public InterfacePosition Background = new();
                [JsonProperty(PropertyName = "Category Height")]
                public float Height;
                [JsonProperty(PropertyName = "Category Width")]
                public float Width;
                [JsonProperty(PropertyName = "Category Margin")]
                public float Margin;
                [JsonProperty(PropertyName = "Categories Scroll Minimal Width")]
                public float CategoriesScrollMinWidth;
                [JsonProperty(PropertyName = "Active Category")]
                public ButtonSettings ActiveCategory = new();
                [JsonProperty(PropertyName = "Inactive Category")]
                public ButtonSettings InactiveCategory = new();
            }
            public class KitsPanelHeaderUI {
                [JsonProperty(PropertyName = "Background")]
                public ImageSettings Background = new();
                [JsonProperty(PropertyName = "Title")]
                public TextSettings Title = new();
                [JsonProperty(PropertyName = "Show Line?")]
                public bool ShowLine;
                [JsonProperty(PropertyName = "Line")]
                public ImageSettings Line = new();
                [JsonProperty(PropertyName = "Close Button")]
                public ButtonSettings ButtonClose = new();
            }
            public class KitsPanelContentUI {
                [JsonProperty(PropertyName = "Background")]
                public ImageSettings Background = new();
                [JsonProperty(PropertyName = "Button Back")]
                public ButtonSettings ButtonBack = new();
                [JsonProperty(PropertyName = "Button Next")]
                public ButtonSettings ButtonNext = new();
                [JsonProperty(PropertyName = "Button Create Kit")]
                public ButtonSettings ButtonCreateKit = new();
                [JsonProperty(PropertyName = "Show All Kits Checkbox")]
                public CheckBoxSettings CheckboxShowAllKits = new();
            }
            public class KitsPanelKitUI {
                [JsonProperty(PropertyName = "Background")]
                public ImageSettings Background = new();
                [JsonProperty(PropertyName = "Show Name?")]
                public bool ShowName;
                [JsonProperty(PropertyName = "Kit Name")]
                public TextSettings KitName = new();
                [JsonProperty(PropertyName = "Show Number?")]
                public bool ShowNumber;
                [JsonProperty(PropertyName = "Kit Number")]
                public TextSettings KitNumber = new();
                [JsonProperty(PropertyName = "Kit Image")]
                public InterfacePosition KitImage = new();
                [JsonProperty(PropertyName = "Kit Button Take")]
                public ButtonSettings KitButtonTake = new();
                [JsonProperty(PropertyName = "Kit Button Take (when show info)")]
                public ButtonSettings KitButtonTakeWhenShowInfo = new();
                [JsonProperty(PropertyName = "Kit Button Info")]
                public ButtonSettings KitButtonInfo = new();
                [JsonProperty(PropertyName = "Show Line?")]
                public bool ShowLine;
                [JsonProperty(PropertyName = "Kit Line")]
                public InterfacePosition KitLine = new();
                [JsonProperty(PropertyName = "Display Kit Contents")]
                public bool DisplayKitContents;
                [JsonProperty(PropertyName = LangRu ? "Настройки содержимого" : "Contents Settings")]
                public ContentsSettings Contents = new();
            }
            public class ContentsSettings {
                [JsonProperty(PropertyName = "Size")]
                public float Size = 40f;
                [JsonProperty(PropertyName = "Margin")]
                public float Margin = 5f;
                [JsonProperty(PropertyName = "Up Indent")]
                public float UpIndent = 35f;
                [JsonProperty(PropertyName = "Item Background")]
                public ImageSettings ItemBackground = new();
                [JsonProperty(PropertyName = "Item Image")]
                public InterfacePosition ItemImage = new();
                [JsonProperty(PropertyName = "Item Amount")]
                public TextSettings ItemAmount = new();
                [JsonProperty(PropertyName = "Kit Cooldown Settings")]
                public ButtonSettings KitCooldown = new();
                [JsonProperty(PropertyName = "Kit Cooldown With Amount Settings")]
                public ButtonSettings KitCooldownWithAmount = new();
                [JsonProperty(PropertyName = "Kit Amount Settings")]
                public TextSettings KitAmount = new();
                [JsonProperty(PropertyName = "Kit Sale Settings")]
                public ButtonSettings KitSale = new();
            }
#endregion
#region Templates
            public static UserInterface GenerateFullscreenTemplateOldStyle() {
                return new UserInterface() {
                    Style = InterfaceStyle.OldStyle, Height = 455, Width = 640, KitHeight = 165, KitWidth = 135f, Margin = 10f, KitsOnString = 4, Strings = 2, LeftIndent = 35, YIndent = -50f, KitAvailable = new InterfacePosition {
                        AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -100", OffsetMax = "0 -75"
                    }
                    , KitAmount = new KitAmountSettings {
                        AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-125", OffsetMax = "-120", Width = 115
                    }
                    , KitCooldown = new InterfacePosition {
                        AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-32.5 -125", OffsetMax = "32.5 -105"
                    }
                    , KitSale = new InterfacePosition {
                        AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-32.5 -115", OffsetMax = "32.5 -95"
                    }
                    , KitAmountCooldown = new InterfacePosition {
                        AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -120", OffsetMax = "0 -95"
                    }
                    , NoPermission = new InterfacePosition {
                        AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -100", OffsetMax = "0 -75"
                    }
                    , CloseAfterReceive = true, Logo = new LogoConf {
                        AnchorMin = "0 0.5", AnchorMax = "0 0.5", OffsetMin = "10 -20", OffsetMax = "50 20", Enabled = false, Image = string.Empty
                    }
                    , MainBackground = new ImageSettings() {
                        AnchorMin = "0 0", AnchorMax = "1 1", Color = new IColor("#191919", 90), Sprite = "assets/content/ui/UI.Background.TileTex.psd", Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat", CursorEnabled = true
                    }
                    , MainPanel = new ImageSettings() {
                        AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-320 -225", OffsetMax = "320 230", Color = new IColor("#0E0E10", 100), Material = "assets/content/ui/uibackgroundblur.mat"
                    }
                    , HeaderPanel = new KitsPanelHeaderUI() {
                        Background = new ImageSettings {
                            AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -50", OffsetMax = "0 0", Color = new IColor("#161617", 100),
                        }
                        , Title = new TextSettings() {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "10 0", OffsetMax = "0 0", Align = TextAnchor.MiddleLeft, IsBold = true, FontSize = 14, Color = IColor.CreateWhite()
                        }
                        , ButtonClose = new ButtonSettings {
                            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-35 -37.5", OffsetMax = "-10 -12.5", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 10, Color = IColor.CreateWhite(), ButtonColor = new IColor("#4B68FF", 100),
                        }
                    }
                    , ContentPanel = new KitsPanelContentUI {
                        Background = new ImageSettings {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 -50", Color = IColor.CreateTransparent()
                        }
                        , ButtonBack = new ButtonSettings() {
                            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-132.5 -32.5", OffsetMax = "-72.5 -10", Align = TextAnchor.MiddleCenter, IsBold = false, FontSize = 10, Color = new IColor("#FFFFFF", 100), ButtonColor = new IColor("#161617", 100),
                        }
                        , ButtonNext = new ButtonSettings() {
                            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-70 -32.5", OffsetMax = "-10 -10", Align = TextAnchor.MiddleCenter, IsBold = false, FontSize = 10, Color = new IColor("#FFFFFF", 100), ButtonColor = new IColor("#4B68FF", 100),
                        }
                        , ButtonCreateKit = new ButtonSettings() {
                            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-237.5 -32.5", OffsetMax = "-142.5 -10", Align = TextAnchor.MiddleCenter, IsBold = false, FontSize = 10, Color = new IColor("#FFFFFF", 100), ButtonColor = new IColor("#4B68FF", 100),
                        }
                        , CheckboxShowAllKits = new CheckBoxSettings() {
                            Background = new ImageSettings {
                                AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "35 -25", OffsetMax = "45 -15", Color = IColor.CreateTransparent()
                            }
                            , CheckboxButton = new ButtonSettings {
                                AnchorMin = "0 0.5", AnchorMax = "0 0.5", OffsetMin = "5 -7", OffsetMax = "19 7", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 10, Color = IColor.CreateWhite(), ButtonColor = IColor.CreateTransparent(),
                            }
                            , CheckboxColor = new IColor("#4B68FF", 100), CheckboxSize = 2f, Title = new TextSettings {
                                AnchorMin = "1 0", AnchorMax = "1 1", OffsetMin = "4 -4", OffsetMax = "104 4", IsBold = true, FontSize = 10, Align = TextAnchor.MiddleLeft, Color = IColor.CreateWhite()
                            }
                        }
                        ,
                    }
                    , KitPanel = new KitsPanelKitUI {
                        Background = new ImageSettings {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 30", OffsetMax = "0 0", Color = new IColor("#161617", 100)
                        }
                        , ShowName = true, KitName = new TextSettings() {
                            AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-45 -75", OffsetMax = "45 0", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 16, Color = IColor.CreateWhite(),
                        }
                        , ShowNumber = true, KitNumber = new TextSettings() {
                            AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-45 -75", OffsetMax = "45 0", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 60, Color = new IColor("#303030", 100),
                        }
                        , KitImage = new InterfacePosition {
                            AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-32 -75", OffsetMax = "32 -11"
                        }
                        , KitButtonTake = new ButtonSettings {
                            AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -165", OffsetMax = "0 -140", Align = TextAnchor.MiddleCenter, IsBold = false, FontSize = 10, Color = IColor.CreateWhite(), ButtonColor = new IColor("#161617", 100),
                        }
                        , KitButtonTakeWhenShowInfo = new ButtonSettings {
                            AnchorMin = "0 1", AnchorMax = "0 1", OffsetMin = "0 -165", OffsetMax = "105 -140", Align = TextAnchor.MiddleCenter, IsBold = false, FontSize = 10, Color = IColor.CreateWhite(), ButtonColor = new IColor("#161617", 100),
                        }
                        , KitButtonInfo = new ButtonSettings {
                            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-25 -165", OffsetMax = "0 -140", Align = TextAnchor.MiddleCenter, IsBold = false, FontSize = 10, Color = IColor.CreateWhite(), ButtonColor = new IColor("#161617", 100),
                        }
                        , ShowLine = true, KitLine = new InterfacePosition {
                            AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "0 0", OffsetMax = "0 2"
                        }
                    }
                    , Categories = new KitsCategoryUI(), ColorOne = new IColor("#161617", 100), ColorTwo = new IColor("#0E0E10", 100), ColorThree = new IColor("#4B68FF", 100), ColorFour = new IColor("#303030", 100), ColorFive = new IColor("#0E0E10", 98), ColorRed = new IColor("#FF4B4B", 100), ColorWhite = new IColor("#FFFFFF", 100), ColorBackground = new IColor("#0E0E10", 100),
                }
                ;
            }
            public static UserInterface GenerateFullscreenTemplateRust() {
                return new UserInterface() {
                    Style = InterfaceStyle.NewRust, Height = 455,  // Width = 816,
                    Width = 688, KitHeight = 238, KitWidth = 160, Margin = 16, KitsOnString = 4, Strings = 2,  // LeftIndent = 64,
                    LeftIndent = 40, YIndent = -10, KitAvailable = new InterfacePosition {
                        AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 0"
                    }
                    , KitAmount = new KitAmountSettings {
                        AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "0", OffsetMax = "4", Width = 140
                    }
                    , KitCooldown = new InterfacePosition {
                        AnchorMin = "0 0.5", AnchorMax = "1 0.5", OffsetMin = "0 -10", OffsetMax = "0 20"
                    }
                    , KitSale = new InterfacePosition {
                        AnchorMin = "0 0.5", AnchorMax = "1 0.5", OffsetMin = "0 -10", OffsetMax = "0 20"
                    }
                    , KitAmountCooldown = new InterfacePosition {
                        AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 4", OffsetMax = "0 0"
                    }
                    , NoPermission = new InterfacePosition {
                        AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 0"
                    }
                    , CloseAfterReceive = true, Logo = new LogoConf {
                        AnchorMin = "0 0.5", AnchorMax = "0 0.5", OffsetMin = "10 -20", OffsetMax = "50 20", Enabled = false, Image = string.Empty
                    }
                    , MainBackground = new ImageSettings() {
                        AnchorMin = "0 0", AnchorMax = "1 1", Color = new IColor("#191919", 90), Sprite = "assets/content/ui/UI.Background.TileTex.psd", Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat", CursorEnabled = true
                    }
                    , MainPanel = new ImageSettings() {
                        AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-384 -295", OffsetMax = "384 295", Color = new IColor("#191919", 50), Material = "assets/content/ui/uibackgroundblur.mat"
                    }
                    , HeaderPanel = new KitsPanelHeaderUI {
                        Background = new ImageSettings {
                            AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "0 -50", OffsetMax = "0 0", Color = new IColor("#494949"), Sprite = "assets/content/ui/UI.Background.Transparent.LinearLTR.tga"
                        }
                        , Title = new TextSettings() {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "20 0", OffsetMax = "0 0", Align = TextAnchor.MiddleLeft, IsBold = true, FontSize = 18, Color = new IColor("#E2DBD3")
                        }
                        , ButtonClose = new ButtonSettings {
                            AnchorMin = "1 1", AnchorMax = "1 1", OffsetMin = "-40 -40", OffsetMax = "0 0", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 10, ImageColor = new IColor("#E2DBD3"), ButtonColor = new IColor("#D74933"), UseCustomPositionImage = true, ImagePosition = new InterfacePosition {
                                AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-9 -9", OffsetMax = "9 9"
                            }
                            , Image = "assets/icons/close.png", Material = "assets/content/ui/namefontmaterial.mat",
                        }
                    }
                    , ContentPanel = new KitsPanelContentUI {
                        Background = new ImageSettings {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 -50", Color = IColor.CreateTransparent()
                        }
                        , ButtonBack = new ButtonSettings() {
                            AnchorMin = "0 0.5", AnchorMax = "0 0.5", OffsetMin = "5 -2", OffsetMax = "35 28", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 14, Color = new IColor("#E2DBD3", 100), ButtonColor = new IColor("#696969", 30), Material = "assets/content/ui/namefontmaterial.mat"
                        }
                        , ButtonNext = new ButtonSettings() {
                            AnchorMin = "1 0.5", AnchorMax = "1 0.5", OffsetMin = "-35 -2", OffsetMax = "-5 28", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 14, Color = new IColor("#FFFFFF", 100), ButtonColor = new IColor("#D74933", 100), Material = "assets/content/ui/namefontmaterial.mat"
                        }
                        , ButtonCreateKit = new ButtonSettings() {
                            AnchorMin = "1 0", AnchorMax = "1 0", OffsetMin = "-120 8", OffsetMax = "-40 32", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 12, Color = new IColor("#71B8ED", 100), ButtonColor = new IColor("#71B8ED", 5), Material = "assets/content/ui/namefontmaterial.mat"
                        }
                        , CheckboxShowAllKits = new CheckBoxSettings() {
                            Background = new ImageSettings {
                                AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "40 10", OffsetMax = "60 30", Color = IColor.CreateTransparent()
                            }
                            , CheckboxButton = new ButtonSettings {
                                AnchorMin = "0 0.5", AnchorMax = "0 0.5", OffsetMin = "0 -7", OffsetMax = "14 7", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 10, Color = IColor.CreateWhite(), ButtonColor = IColor.CreateTransparent(),
                            }
                            , CheckboxColor = new IColor("#38393F"), CheckboxSize = 3f, Title = new TextSettings {
                                AnchorMin = "1 0", AnchorMax = "1 1", OffsetMin = "5 -4", OffsetMax = "105 4", IsBold = true, FontSize = 10, Align = TextAnchor.MiddleLeft, Color = IColor.CreateWhite()
                            }
                        }
                        ,
                    }
                    , KitPanel = new KitsPanelKitUI {
                        Background = new ImageSettings {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 0", OffsetMax = "0 0", Color = new IColor("#696969", 10), Material = "assets/content/ui/namefontmaterial.mat", Sprite = "assets/content/ui/UI.Background.Tile.psd",
                        }
                        , ShowName = true, KitName = new TextSettings() {
                            AnchorMin = "0 1", AnchorMax = "1 1", OffsetMin = "10 -35", OffsetMax = "-10 -5", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 18, Color = new IColor("#E2DBD3", 100),
                        }
                        , ShowNumber = true, KitNumber = new TextSettings() {
                            AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-60 -155", OffsetMax = "60 -35", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 60, Color = new IColor("#E2DBD3", 20),
                        }
                        , KitImage = new InterfacePosition {
                            AnchorMin = "0.5 1", AnchorMax = "0.5 1", OffsetMin = "-60 -155", OffsetMax = "60 -35",
                        }
                        , KitButtonTake = new ButtonSettings {
                            AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-70 10", OffsetMax = "70 38", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 13, Color = new IColor("#E2DBD3", 100), ButtonColor = new IColor("#D74933", 100), Material = "assets/content/ui/namefontmaterial.mat", Sprite = "assets/content/ui/UI.Background.Tile.psd"
                        }
                        , KitButtonTakeWhenShowInfo = new ButtonSettings {
                            AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-70 10", OffsetMax = "40 38", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 13, Color = new IColor("#E2DBD3", 100), ButtonColor = new IColor("#D74933", 100), Material = "assets/content/ui/namefontmaterial.mat", Sprite = "assets/content/ui/UI.Background.Tile.psd"
                        }
                        , KitButtonInfo = new ButtonSettings {
                            AnchorMin = "0 0", AnchorMax = "1 0", OffsetMin = "125 10", OffsetMax = "-10 38", Align = TextAnchor.MiddleCenter, IsBold = true, FontSize = 13, Color = new IColor("#E2DBD3", 100), ButtonColor = new IColor("#F19F39", 60), Material = "assets/content/ui/namefontmaterial.mat", Sprite = "assets/content/ui/UI.Background.Tile.psd"
                        }
                        ,
                    }
                    , Categories = new KitsCategoryUI(), ColorOne = new IColor("#E2DBD3", 100), ColorTwo = new IColor("#D74933", 100), ColorThree = new IColor("#8B8B8B", 15), ColorFour = new IColor("#38393F", 50), ColorFive = new IColor("#E2DBD3", 20), ColorRed = new IColor("#FF4B4B", 100), ColorWhite = new IColor("#FFFFFF", 100), ColorBackground = IColor.CreateTransparent()
                }
                ;
            }
            public static UserInterface GenerateFullscreenTemplateWithCategoriesRust() {
                return new UserInterface() {
                    Style = InterfaceStyle.NewRust, Height = 455,
// ... [Code preview truncated due to length. Full source in attached file] ...

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