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

FREE IQCraftSystem : 1.1.7 1.1.7

Нет прав для скачивания
C#:
using System.Text;
using System.Collections.Generic;
using Oxide.Game.Rust.Cui;
using UnityEngine;
using Oxide.Core.Plugins;
using System;
using Newtonsoft.Json;
using System.Linq;
using ConVar;
using System.Collections;
namespace Oxide.Plugins {
    /*ПЛАГИН БЫЛ ПОФИКШЕН С ПОМОЩЬЮ ПРОГРАММЫ СКАЧАНОЙ С https://discord.gg/dNGbxafuJn */
    [Info("IQCraftSystem", "https://discord.gg/dNGbxafuJn", "1.1.7")]
    [Description("Convenient crafting system")]
    internal class IQCraftSystem : RustPlugin {
        public Boolean IS_Item_Player(BasePlayer player, String Shortname, Int32 Amount, UInt64 SkinID = 0) {
            Int32 ItemAmount = 0;
            foreach (Item ItemRequires in player.inventory.AllItems()) {
                if (ItemRequires == null) continue;
                if (ItemRequires.info.shortname != Shortname) continue;
                if (ItemRequires.skin != SkinID) continue;
                ItemAmount += ItemRequires.amount;
            }
            return ItemAmount >= Amount;
        }
        private void Init() {
            ReadData();
        }
        private readonly String CustomItemShortname = "box.wooden";
        public Boolean DoBalanceIQEconomic(BasePlayer player, Int32 NeededBalance) {
            return GetBalance(player.userID) >= NeededBalance;
        }
        [ChatCommand("craft")]
        private void IQCraftSystemCommand(BasePlayer player) {
            PagePlayers[player] = 0;
            UI_CraftMenu(player);
        }
        protected override void LoadConfig() {
            base.LoadConfig();
            try {
                config = Config.ReadObject<Configuration>();
                if (config == null) LoadDefaultConfig();
            }
            catch {
                PrintWarning(LanguageEn ? "Error reading #57 configuration 'oxide/config/{Name}', creating a new configuration!!" : $"Ошибка чтения #57 конфигурации 'oxide/config/{Name}', создаём новую конфигурацию!!");
                LoadDefaultConfig();
            }
            NextTick(SaveConfig);
        }
        public void SendImage(BasePlayer player, String imageName, UInt64 imageId = 0) {
            ImageLibrary?.Call("SendImage", player, imageName, imageId);
        }
        public Boolean AddImage(String url, String shortname, UInt64 skin = 0) {
            return (Boolean)ImageLibrary?.Call("AddImage", url, shortname, skin);
        }
        private void RemoveBalance(UInt64 userID, Int32 Balance) {
            if (IQEconomic != null) IQEconomic?.Call("API_REMOVE_BALANCE", userID, Balance);
            else if (Economics != null) Economics?.Call("Withdraw", userID, Convert.ToDouble(Balance));
        }
        public static StringBuilder sb = new StringBuilder();
        private void LoadedCategory(BasePlayer player) {
            CuiElementContainer container = new CuiElementContainer();
            Single FadeOut = 0.3f;
            Single FadeIn = 0.3f;
            container.Add(new CuiPanel {
                FadeOut = FadeOut, RectTransform = {
                    AnchorMin = "0.309375 0.8333", AnchorMax = "0.5677084 0.8787"
                }
                ,  //
                Image = {
                    FadeIn = FadeIn, Color = "0 0 0 0"
                }
            }
            , CRAFTSYSTEM_HUD, "CATEGORY_PANEL");
            Int32 Category = 0;
            foreach (CategoryUI Categorys in CategoryList) {
                container.Add(new CuiElement {
                    FadeOut = FadeOut, Parent = "CATEGORY_PANEL", Name = Categorys.PngKey, Components = {
                        new CuiRawImageComponent {
                            FadeIn = FadeIn, Png = GetImage(Categorys.PngKey)
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = $"{0.03225803 + (Category * 0.098)} 0.1224494", AnchorMax = $"{0.09677408 + (Category * 0.098)} 0.7755101"
                        }
                        ,
                    }
                }
                );
                container.Add(new CuiButton {
                    FadeOut = FadeOut, RectTransform = {
                        AnchorMin = "0 0", AnchorMax = "1 1"
                    }
                    , Button = {
                        FadeIn = FadeIn, Command = Categorys.Command, Color = "0 0 0 0"
                    }
                    , Text = {
                        FadeIn = FadeIn, Text = "", Align = TextAnchor.MiddleCenter
                    }
                }
                , Categorys.PngKey, Categorys.PngKey + "BUTTON");
                Category++;
            }
            CuiHelper.AddUi(player, container);
        }
        private class Configuration {
            [JsonProperty(LanguageEn ? "Plugin interface customization" : "Настройка интерфейса плагина")]
            public InterfaceSettings InterfaceSetting = new InterfaceSettings();
            [JsonProperty(LanguageEn ? "Setting up compatible plugins" : "Настройка совместимых плагинов")]
            public ReferencePlugin ReferencePlugins = new ReferencePlugin();
            [JsonProperty(LanguageEn ? "Customization of items that can be crafted" : "Настройка предметов, которые возможно скрафтить")]
            public Dictionary<String, ItemSettings> ItemSetting = new Dictionary<String, ItemSettings>();
            internal class ItemSettings {
                [JsonProperty(LanguageEn ? "Cooldown for crafting an item (If it is not needed, set the value to 0" : "Перезарядка на крафт предмета (Если она не нужна, поставьте значение 0")]
                public Int32 Cooldown;
                [JsonProperty(LanguageEn ? "Permissions to access this craft (leave the field blank - it will be available to everyone)" : "Права для доступа к этому крафту (оставьте поле пустым - будет доступно всем)")]
                public String Permission;
                [JsonProperty(LanguageEn ? "What category does this item belong to: 0 - Weapons, 1 - Tools, 2 - Structures, 3 - Items, 4 - Clothing, 5 - Electricity, 6 - Vehicles, 7 - Fun, 8 - Custom (commands), 9 - Other ( Crafts prefabs and items like Recycler)" : "К какой категории относится данный предмет : 0 - Оружие, 1 - Инструменты, 2 - Конструкции, 3 - Итемы, 4 - Одежда, 5 - Электричество, 6 - Транспорт, 7 - Фановые, 8 - Кастомные(команды), 9 - Иные(Крафтит префабы и предметы по типу Переработчика)")]
                public CategoryItem CategoryItems;
                [JsonProperty(LanguageEn ? "Display name" : "Отображаемое имя")]
                public String DisplayName;
                [JsonProperty(LanguageEn ? "Description (Optional)" : "Описание (Необязательно)")]
                public String Description;
                [JsonProperty(LanguageEn ? "Number of items" : "Количество предметов")]
                public Int32 AmountCraft;
                [JsonProperty(LanguageEn ? "Item HP (Suitable for category: 9 - Other (Crafts prefabs and items like Refiner) and 6 - Vehicles)" : "ХП предмета (Подходит к категории : 9 - Иные(Крафтит префабы и предметы по типу Переработчика) и 6 - Транспорт)")]
                public Int32 HealthItem;
                [JsonProperty(LanguageEn ? "The ability to pick up an item in inventory (true - yes / false - no) (Suitable for category: 9 - Other(Crafts prefabs and items like Recycler))" : "Возможность забрать предмет в инвентарь (true - да/false - нет) (Подходит к категории : 9 - Иные(Крафтит префабы и предметы по типу Переработчика))")]
                public Boolean UsePickUp;
                [JsonProperty(LanguageEn ? "Shortname (Suitable for all categories EXCEPT: 6 - Vehicles and 8 - Custom (commands) and 9 - Others (Crafts prefabs and items like Recycler)" : "Shortname (Подходит ко всем категориям КРОМЕ : 6 - Транспорт и 8 - Кастомные(команды) и 9 - Иные(Крафтит префабы и предметы по типу Переработчика)")]
                public String Shortname;
                [JsonProperty(LanguageEn ? "Skin ID (Suitable for all categories (If you use category 6 - Transport or - 9 - Other, be sure to set the Skin ID for the icon)" : "SkinID (Подходит ко всем категориям (Если вы используете категорию 6 - Транспорт или - 9 - Иные , обязательно устанавливайте SkinID для иконки)")]
                public UInt64 SkinID;
                [JsonProperty(LanguageEn ? "PNG (Only suitable for the category: 6 - Vehicles and 8 - Custom (commands) and 9 - Others (Crafts prefabs and items like Recycler))" : "PNG (Подходит только к категории : 6 - Транспорт и 8 - Кастомные(команды) и 9 - Иные(Крафтит префабы и предметы по типу Переработчика))")]
                public String PNG;
                [JsonProperty(LanguageEn ? "Team (Only applies to category: 8 - Custom (teams) %STEAMID% - will be replaced by the player&#39;s Steam64ID)" : "Команда (Подходит только к категории : 8 - Кастомные(команды) %STEAMID% - заменится на Steam64ID игрока)")]
                public String Command;
                [JsonProperty(LanguageEn ? "Vehicle prefab (Only applies to category 6 - Vehicles)" : "Префаб для транспорта (Подходит только к категории 6 - Транспорт)")]
                public String PrefabNameTransport;
                [JsonProperty(LanguageEn ? "Prefab for items (Only suitable for category 9 - Other (Crafts prefabs and items like Recycler))" : "Префаб для предметов (Подходит только к категории 9 - Иные(Крафтит префабы и предметы по типу Переработчика))")]
                public String PrefabEntity;
                [JsonProperty(LanguageEn ? "What level of workbench is required for crafting, if no workbench is required, set to 0" : "Какой уровень верстака требуется для крафта нужен, если верстак не требуется, установите 0")]
                public Int32 WorkBenchLevel;
                [JsonProperty(LanguageEn ? "IQEconomic/Economics : How much currency is required to craft this item (Set to 0 if not required)" : "IQEconomic/Economics : Сколько требуется валюты для крафта данного предмета(Устновите 0 если не требуется)")]
                public Int32 IQEconomicPrice;
                [JsonProperty(LanguageEn ? "IQPlague Skill : Whether a neutral IQPlague Skill is required to craft this item (true - yes/false - no)" : "IQPlagueSkill : Требуется ли нейтральный навык в IQPlagueSkill для крафта данного предмета(true - да/false - нет)")]
                public Boolean IQPlagueSkillCraft;
                [JsonProperty(LanguageEn ? "IQRank System : Specify the rank required to craft this item (Leave blank if not required)" : "IQRankSystem : Укажите ранг, который требуется для крафта данного предмета(Если не нужно, оставьте поле пустым)")]
                public String IQRankSystemRank;
                [JsonProperty(LanguageEn ? "List of items required for crafting" : "Список предметов требующихся для крафта")]
                public List<ItemForCraft> ItemListForCraft = new List<ItemForCraft>();
                internal class ItemForCraft {
                    [JsonProperty("Shortname")]
                    public String Shortname;
                    [JsonProperty(LanguageEn ? "Amount" : "Количество")]
                    public Int32 Amount;
                    [JsonProperty(LanguageEn ? "Skin ID if required" : "SkinID если требуется")]
                    public UInt64 SkinID;
                    [JsonProperty(LanguageEn ? "PNG for custom items (don&#39;t forget to set Skin ID)" : "PNG для кастомных предметов (не забудьте установить SkinID)")]
                    public String PNG;
                }
            }
            internal class InterfaceSettings {
                [JsonProperty(LanguageEn ? "General settings" : "Основные настройки")]
                public GeneralSettings GeneralSetting = new GeneralSettings();
                [JsonProperty(LanguageEn ? "Category settings" : "Настройка категорий")]
                public CategorySettings CategorySetting = new CategorySettings();
                [JsonProperty(LanguageEn ? "Requirements setup" : "Настройка требований")]
                public RequiresSettings RequiresSetting = new RequiresSettings();
                internal class GeneralSettings {
                    [JsonProperty(LanguageEn ? "Link to the picture of the selected item" : "Ссылка на картинку выбранного предмета")]
                    public String PNGActive;
                    [JsonProperty(LanguageEn ? "Link to a picture of an unselected item" : "Ссылка на картинку не выбранного предмета")]
                    public String PNGInActive;
                    [JsonProperty(LanguageEn ? "Link to the logo in the crafting menu" : "Ссылка на логотип в меню крафта")]
                    public String PNGLogo;
                    [JsonProperty(LanguageEn ? "Link to closing image" : "Ссылка на картинку закрытия")]
                    public String PNGCloseButton;
                    [JsonProperty(LanguageEn ? "HEX Main menu background" : "HEX Заднего фона главного меню")]
                    public String HexBackground;
                    [JsonProperty(LanguageEn ? "HEX Buttons CREATE" : "HEX Кнопки СОЗДАТЬ")]
                    public String HexButtonCreate;
                }
                internal class RequiresSettings {
                    [JsonProperty(LanguageEn ? "HEX : Color if requirement is met" : "HEX : Цвет если требование выполнено")]
                    public String RequiresDoTrueColor;
                    [JsonProperty(LanguageEn ? "HEX : Color if requirement is not met" : "HEX : Цвет если требование не выполнено")]
                    public String RequiresDoFalseColor;
                    [JsonProperty(LanguageEn ? "Complied symbol" : "Символ выполненного требования")]
                    public String RequiresDoTrue;
                    [JsonProperty(LanguageEn ? "HEX : Color if condition is not required" : "HEX : Цвет если условие не требования")]
                    public String RequiresDoFalse;
                    [JsonProperty(LanguageEn ? "PNG : Icon for workbench requirement" : "PNG : Иконка для требования верстака")]
                    public String PNGRequiresWorckbench;
                    [JsonProperty(LanguageEn ? "PNG : Icon for currency requirement from IQEconomic" : "PNG : Иконка для требования валюты с IQEconomic")]
                    public String PNGRequiresIQEconomic;
                    [JsonProperty(LanguageEn ? "PNG : Icon for rank requirement from IQRank System" : "PNG : Иконка для требования ранга с IQRankSystem")]
                    public String PNGRequiresIQRankSystem;
                    [JsonProperty(LanguageEn ? "PNG : Icon for skill requirement with IQPlague Skill" : "PNG : Иконка для требования навыка с IQPlagueSkill")]
                    public String PNGRequiresIQPlagueSkill;
                }
                internal class CategorySettings {
                    [JsonProperty(LanguageEn ? "Adjusting the colors of unselected icons for each category" : "Настройка цветов не выбранных иконок под каждую категорию")]
                    public ColorCategoryIcon ColorCategoryIcons = new ColorCategoryIcon();
                    [JsonProperty(LanguageEn ? "Customize PNG category icons" : "Настройка PNG иконок категорий")]
                    public PNGCategoryIcon PNGCategoryIcons = new PNGCategoryIcon();
                    [JsonProperty(LanguageEn ? "Enabling and disabling categories" : "Включения и отключения категорий")]
                    public TurnedCategory TurnedCategorys = new TurnedCategory();
                    internal class PNGCategoryIcon {
                        [JsonProperty(LanguageEn ? "PNG : All items category icon" : "PNG : Иконка категории всех предметов")]
                        public String PNGAll;
                        [JsonProperty(LanguageEn ? "PNG : Weapon category icon" : "PNG : Иконка категории оружия")]
                        public String PNGWeapon;
                        [JsonProperty(LanguageEn ? "PNG : Tools category icon" : "PNG : Иконка категории инструментов")]
                        public String PNGTools;
                        [JsonProperty(LanguageEn ? "PNG : Design category icon" : "PNG : Иконка категории конструкций")]
                        public String PNGConstruction;
                        [JsonProperty(LanguageEn ? "PNG : Item category icon" : "PNG : Иконка категории предметов")]
                        public String PNGItems;
                        [JsonProperty(LanguageEn ? "PNG : Clothing category icon" : "PNG : Иконка категории одежды")]
                        public String PNGAttirie;
                        [JsonProperty(LanguageEn ? "PNG : Electrical category icon" : "PNG : Иконка категории электрики")]
                        public String PNGElectrical;
                        [JsonProperty(LanguageEn ? "PNG : Transport category icon" : "PNG : Иконка категории транспорта")]
                        public String PNGTransport;
                        [JsonProperty(LanguageEn ? "PNG : Fun category icon" : "PNG : Иконка категории фана")]
                        public String PNGFun;
                        [JsonProperty(LanguageEn ? "PNG : Custom item icon" : "PNG : Иконка кастомных предметов")]
                        public String PNGCustom;
                    }
                    internal class ColorCategoryIcon {
                        [JsonProperty(LanguageEn ? "HEX : The color of the panel with the item category of all items" : "HEX : Цвет панели с предметом категории всех предметов")]
                        public String AllItemsColor;
                        [JsonProperty(LanguageEn ? "HEX : The color of the item panel of the weapon category" : "HEX : Цвет панели с предметом категории оружий")]
                        public String WeaponColor;
                        [JsonProperty(LanguageEn ? "HEX : Color of toolbar item" : "HEX : Цвет панели с предметом категории интсрументов")]
                        public String ToolsColor;
                        [JsonProperty(LanguageEn ? "HEX : Color bar with item category designs" : "HEX : Цвет панели с предметом категории конструкций")]
                        public String ConstructionColor;
                        [JsonProperty(LanguageEn ? "HEX : The color of the bar with the subject of the item category" : "HEX : Цвет панели с предметом категории предметов")]
                        public String ItemsColor;
                        [JsonProperty(LanguageEn ? "HEX : The color of the bar with the garment category item" : "HEX : Цвет панели с предметом категории одежды")]
                        public String AttirieColor;
                        [JsonProperty(LanguageEn ? "HEX : The color of the panel with the electrical category item" : "HEX : Цвет панели с предметом категории электрики")]
                        public String ElectricalColor;
                        [JsonProperty(LanguageEn ? "HEX : The color of the vehicle category item bar" : "HEX : Цвет панели с предметом категории транспорта")]
                        public String TransportColor;
                        [JsonProperty(LanguageEn ? "HEX : The color of the panel with the fan category item" : "HEX : Цвет панели с предметом категории фана")]
                        public String FunColor;
                        [JsonProperty(LanguageEn ? "HEX : Custom item bar color" : "HEX : Цвет панели с предметом категории кастомных предметов")]
                        public String CustomColor;
                    }
                    internal class TurnedCategory {
                        [JsonProperty(LanguageEn ? "Enable weapon category" : "Включить категорию оружие")]
                        public Boolean TurnWeapon;
                        [JsonProperty(LanguageEn ? "Enable tool categories" : "Включить категории инструментов")]
                        public Boolean TurnTools;
                        [JsonProperty(LanguageEn ? "Enable design categories" : "Включить категории конструкций")]
                        public Boolean TurnConstruction;
                        [JsonProperty(LanguageEn ? "Enable item categories" : "Включить категории предметов")]
                        public Boolean TurnItems;
                        [JsonProperty(LanguageEn ? "Enable clothing categories" : "Включить категории одежды")]
                        public Boolean TurnAttirie;
                        [JsonProperty(LanguageEn ? "Enable electrical categories" : "Включить категории электрики")]
                        public Boolean TurnElectrical;
                        [JsonProperty(LanguageEn ? "Enable transport categories" : "Включить категории транспорта")]
                        public Boolean TurnTransport;
                        [JsonProperty(LanguageEn ? "Enable fun categories" : "Включить категории фана")]
                        public Boolean TurnFun;
                        [JsonProperty(LanguageEn ? "Enable custom items" : "Включить кастомных предметов")]
                        public Boolean TurnCustom;
                    }
                }
            }
            internal class ReferencePlugin {
                [JsonProperty(LanguageEn ? "IQChat : Setting up a chat" : "IQChat : Настройка чата")]
                public ChatSettings chatSettings = new ChatSettings();
                internal class ChatSettings {
                    [JsonProperty(LanguageEn ? "IQChat : Custom prefix in the chat" : "IQChat : Кастомный префикс в чате")]
                    public String CustomPrefix = "[IQCraftSystem]";
                    [JsonProperty(LanguageEn ? "IQChat : Custom avatar in the chat(If required)" : "IQChat : Кастомный аватар в чате(Если требуется)")]
                    public String CustomAvatar = "0";
                }
            }
            public static Configuration GetNewConfiguration() {
                return new Configuration {
                    InterfaceSetting = new InterfaceSettings {
                        GeneralSetting = new InterfaceSettings.GeneralSettings {
                            PNGActive = "https://i.imgur.com/46KFe3X.png", PNGInActive = "https://i.imgur.com/31iuKXn.png", PNGLogo = "https://i.imgur.com/K29MfYR.png", PNGCloseButton = "https://i.imgur.com/mirRxLy.png", HexBackground = "#0C0C0C95", HexButtonCreate = "#C35F2FFF",
                        }
                        , RequiresSetting = new InterfaceSettings.RequiresSettings {
                            RequiresDoFalse = "×", RequiresDoTrue = "✓", RequiresDoFalseColor = "#FF3366", RequiresDoTrueColor = "#CCFFCC", PNGRequiresIQEconomic = "https://i.imgur.com/q0UjhJJ.png", PNGRequiresIQPlagueSkill = "https://i.imgur.com/f3isgi4.png", PNGRequiresIQRankSystem = "https://i.imgur.com/0ZFPmrZ.png", PNGRequiresWorckbench = "https://i.imgur.com/bxG5ofY.png",
                        }
                        , CategorySetting = new InterfaceSettings.CategorySettings {
                            PNGCategoryIcons = new InterfaceSettings.CategorySettings.PNGCategoryIcon {
                                PNGAll = "https://i.imgur.com/V1dUiuy.png", PNGWeapon = "https://i.imgur.com/XwDBNoW.png", PNGAttirie = "https://i.imgur.com/F25qevg.png", PNGConstruction = "https://i.imgur.com/WPG9YMb.png", PNGCustom = "https://i.imgur.com/jyobxIs.png", PNGElectrical = "https://i.imgur.com/7bYVThO.png", PNGFun = "https://i.imgur.com/iWQLRa5.png", PNGItems = "https://i.imgur.com/Rucen7r.png", PNGTools = "https://i.imgur.com/XJzPl6z.png", PNGTransport = "https://i.imgur.com/M9BsGiI.png",
                            }
                            , ColorCategoryIcons = new InterfaceSettings.CategorySettings.ColorCategoryIcon {
                                AllItemsColor = "#DECADEFF", AttirieColor = "#59A27AFF", ConstructionColor = "#B4D455FF", CustomColor = "#9077E2FF", ElectricalColor = "#00DDDDFF", FunColor = "#FFAABBFF", ItemsColor = "#FF2288FF", ToolsColor = "#EE3B00FF", TransportColor = "#D395FFFF", WeaponColor = "#7F4EFFFF",
                            }
                            ,
                        }
                        ,
                    }
                    , ItemSetting = new Dictionary<String, ItemSettings> {
                        ["ak47"]
                        = new ItemSettings {
                            CategoryItems = CategoryItem.Weapon, Permission = "iqcraftsystem.ak47", Cooldown = 0, Command = "", AmountCraft = 1, Description = LanguageEn ? "A good weapon for shooting at long and medium distances" : "Хорошее оружие для стрельбы на дальние и средние дистанции", DisplayName = "АК-47", PNG = "", HealthItem = 0, UsePickUp = false, PrefabEntity = "", PrefabNameTransport = "", Shortname = "rifle.ak", SkinID = 0, WorkBenchLevel = 0, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "wood", Amount = 500, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "scrap", Amount = 15, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "explosives", Amount = 1, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["jackhammer"] = new ItemSettings {
                            CategoryItems = CategoryItem.Tools, Permission = "", Cooldown = 5000, Command = "", Description = "", AmountCraft = 1, DisplayName = "Jackhammer", PNG = "", HealthItem = 0, UsePickUp = false, PrefabEntity = "", PrefabNameTransport = "", Shortname = "jackhammer", SkinID = 0, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "wood", Amount = 500, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "scrap", Amount = 15, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "explosives", Amount = 1, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["hazmatsuit"] = new ItemSettings {
                            CategoryItems = CategoryItem.Attirie, Permission = "", Cooldown = 0, Command = "", AmountCraft = 1, Description = "", HealthItem = 0, UsePickUp = false, DisplayName = LanguageEn ? "Hazmatsuit" : "Хазмат", PNG = "", PrefabEntity = "", PrefabNameTransport = "", Shortname = "hazmatsuit", SkinID = 0, WorkBenchLevel = 3, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["floor.ladder.hatch"] = new ItemSettings {
                            CategoryItems = CategoryItem.Construction, Permission = "", Cooldown = 0, Command = "", HealthItem = 0, AmountCraft = 1, UsePickUp = false, Description = LanguageEn ? "It's convenient to jump off and not come back" : "Удобно спргынуть и не вернуться", DisplayName = LanguageEn ? "Hatchway" : "Люк", PNG = "", PrefabEntity = "", PrefabNameTransport = "", Shortname = "floor.ladder.hatch", SkinID = 0, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["privilegy3d"] = new ItemSettings {
                            CategoryItems = CategoryItem.Custom, Permission = "", Cooldown = 0, Command = "say GivePrivilegy", Description = LanguageEn ? "A whole privilege for 3 whole days, the best option" : "Целая привилегия на 3 целых дня, самый лучший вариант", DisplayName = LanguageEn ? "VIP 3 DAYS" : "ПРИВИЛЕГИЯ 3 ДНЯ", PNG = "https://i.imgur.com/vLCj3kO.png", PrefabEntity = "", HealthItem = 0, AmountCraft = 1, UsePickUp = false, PrefabNameTransport = "", Shortname = "", SkinID = 0, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                , new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["turret"] = new ItemSettings {
                            CategoryItems = CategoryItem.Electrical, Permission = "", Cooldown = 0, Command = "", Description = "", DisplayName = LanguageEn ? "Turret" : "Турель", PNG = "", AmountCraft = 1, HealthItem = 0, UsePickUp = false, PrefabEntity = "", PrefabNameTransport = "", Shortname = "autoturret", SkinID = 0, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "metal.refined", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["tree"] = new ItemSettings {
                            CategoryItems = CategoryItem.Entity, Permission = "", Cooldown = 0, AmountCraft = 1, Command = "", HealthItem = 100, UsePickUp = true, Description = LanguageEn ? "Take and plant a tree" : "Возьми и всади дерево", DisplayName = LanguageEn ? "Wood" : "Дерево", PNG = "https://i.imgur.com/XnuUmyZ.png", PrefabEntity = "assets/bundled/prefabs/autospawn/resource/v2_temp_forest/pine_c.prefab", PrefabNameTransport = "", Shortname = "", SkinID = 1337, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "wood", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["firewerk"] = new ItemSettings {
                            CategoryItems = CategoryItem.Fun, Permission = "", Cooldown = 0, HealthItem = 0, AmountCraft = 1, UsePickUp = false, Command = "", Description = LanguageEn ? "Blow up the sky" : "Взорвик небо", DisplayName = LanguageEn ? "Firework" : "Фейверк", PNG = "", PrefabEntity = "", PrefabNameTransport = "", Shortname = "firework.romancandle.red", SkinID = 0, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "wood", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["swetilnik"] = new ItemSettings {
                            CategoryItems = CategoryItem.Items, Permission = "", HealthItem = 0, UsePickUp = false, Cooldown = 0, Command = "", Description = "", AmountCraft = 1, DisplayName = LanguageEn ? "Lamp on the wall" : "Светилка на стенку", PNG = "", PrefabEntity = "", PrefabNameTransport = "", Shortname = "xmas.lightstring", SkinID = 0, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "wood", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        , ["copter"] = new ItemSettings {
                            CategoryItems = CategoryItem.Transport, Permission = "", HealthItem = 0, UsePickUp = false, Cooldown = 0, Command = "", AmountCraft = 1, Description = "", DisplayName = LanguageEn ? "Minicopter" : "Коптер", PNG = "https://i.imgur.com/kC8tfXF.png", PrefabEntity = "", PrefabNameTransport = "assets/content/vehicles/minicopter/minicopter.entity.prefab", Shortname = "", SkinID = 3333, WorkBenchLevel = 1, IQEconomicPrice = 0, IQRankSystemRank = "", IQPlagueSkillCraft = false, ItemListForCraft = new List<ItemSettings.ItemForCraft> {
                                new ItemSettings.ItemForCraft {
                                    Shortname = "wood", Amount = 100, PNG = "", SkinID = 0
                                }
                                ,
                            }
                        }
                        ,
                    }
                    , ReferencePlugins = new ReferencePlugin {
                        chatSettings = new ReferencePlugin.ChatSettings {
                            CustomAvatar = "0", CustomPrefix = "[IQCraftSystem]"
                        }
                    }
                }
                ;
            }
        }
        private IEnumerator DownloadImages() {
            Dictionary<String, Configuration.ItemSettings> Items = config.ItemSetting;
            PrintWarning("AddImages SkyPlugins.ru...");
            foreach (KeyValuePair<String, Configuration.ItemSettings> Item in Items) {
                if (Item.Value.SkinID != 0) {
                    if (!HasImage($"{Item.Value.Shortname}_128px_{Item.Value.SkinID}")) AddImage($"https://api.skyplugins.ru/api/getskin/{Item.Value.SkinID}/128", $"{Item.Value.Shortname}_128px_{Item.Value.SkinID}", Item.Value.SkinID);
                    if (!HasImage($"{Item.Value.Shortname}_256px_{Item.Value.SkinID}")) AddImage($"https://api.skyplugins.ru/api/getskin/{Item.Value.SkinID}/128", $"{Item.Value.Shortname}_256px_{Item.Value.SkinID}", Item.Value.SkinID);
                }
                else {
                    if (!String.IsNullOrWhiteSpace(Item.Value.Shortname)) {
                        if (!HasImage($"{Item.Value.Shortname}_128px")) AddImage($"https://api.skyplugins.ru/api/getimage/{Item.Value.Shortname}/128", $"{Item.Value.Shortname}_128px");
                        if (!HasImage($"{Item.Value.Shortname}_256px")) AddImage($"https://api.skyplugins.ru/api/getimage/{Item.Value.Shortname}/256", $"{Item.Value.Shortname}_256px");
                    }
                }
                foreach (Configuration.ItemSettings.ItemForCraft ItemCraft in Item.Value.ItemListForCraft.Where(x => !String.IsNullOrEmpty(x.Shortname))) {
                    if (ItemCraft.SkinID != 0) {
                        if (!HasImage($"{ItemCraft.Shortname}_128px_{ItemCraft.SkinID}")) AddImage($"https://api.skyplugins.ru/api/getskin/{ItemCraft.SkinID}/128", $"{ItemCraft.Shortname}_128px_{ItemCraft.SkinID}", ItemCraft.SkinID);
                    }
                    else {
                        if (!HasImage($"{ItemCraft.Shortname}_128px")) AddImage($"https://api.skyplugins.ru/api/getimage/{ItemCraft.Shortname}/128", $"{ItemCraft.Shortname}_128px");
                    }
                }
            }
            yield return new WaitForSeconds(0.04f);
            PrintWarning("AddImages SkyPlugins.ru - completed..");
        }
        private void LoadedIcon() {
            PrintWarning(LanguageEn ? "I start loading icons.." : "Начинаю загрузку иконок..");
            Configuration.InterfaceSettings Interface = config.InterfaceSetting;
            Configuration.InterfaceSettings.CategorySettings.PNGCategoryIcon Category = Interface.CategorySetting.PNGCategoryIcons;
            Dictionary<String, Configuration.ItemSettings> Items = config.ItemSetting;
            Configuration.InterfaceSettings.RequiresSettings Requires = Interface.RequiresSetting;
            if (!HasImage($"LOGO_{Interface.GeneralSetting.PNGLogo}")) AddImage(Interface.GeneralSetting.PNGLogo, $"LOGO_{Interface.GeneralSetting.PNGLogo}");
            if (!HasImage($"ACTIVE_ITEM_{Interface.GeneralSetting.PNGActive}")) AddImage(Interface.GeneralSetting.PNGActive, $"ACTIVE_ITEM_{Interface.GeneralSetting.PNGActive}");
            if (!HasImage($"IN_ACTIVE_ITEM_{Interface.GeneralSetting.PNGInActive}")) AddImage(Interface.GeneralSetting.PNGInActive, $"IN_ACTIVE_ITEM_{Interface.GeneralSetting.PNGInActive}");
            if (!HasImage($"CLOSE_BUTTON_{Interface.GeneralSetting.PNGCloseButton}")) AddImage(Interface.GeneralSetting.PNGCloseButton, $"CLOSE_BUTTON_{Interface.GeneralSetting.PNGCloseButton}");
            if (!HasImage($"CATEGORY_{Category.PNGAll}")) AddImage(Category.PNGAll, $"CATEGORY_{Category.PNGAll}");
            if (!HasImage($"CATEGORY_{Category.PNGAttirie}")) AddImage(Category.PNGAttirie, $"CATEGORY_{Category.PNGAttirie}");
            if (!HasImage($"CATEGORY_{Category.PNGConstruction}")) AddImage(Category.PNGConstruction, $"CATEGORY_{Category.PNGConstruction}");
            if (!HasImage($"CATEGORY_{Category.PNGCustom}")) AddImage(Category.PNGCustom, $"CATEGORY_{Category.PNGCustom}");
            if (!HasImage($"CATEGORY_{Category.PNGElectrical}")) AddImage(Category.PNGElectrical, $"CATEGORY_{Category.PNGElectrical}");
            if (!HasImage($"CATEGORY_{Category.PNGFun}")) AddImage(Category.PNGFun, $"CATEGORY_{Category.PNGFun}");
            if (!HasImage($"CATEGORY_{Category.PNGItems}")) AddImage(Category.PNGItems, $"CATEGORY_{Category.PNGItems}");
            if (!HasImage($"CATEGORY_{Category.PNGTools}")) AddImage(Category.PNGTools, $"CATEGORY_{Category.PNGTools}");
            if (!HasImage($"CATEGORY_{Category.PNGTransport}")) AddImage(Category.PNGTransport, $"CATEGORY_{Category.PNGTransport}");
            if (!HasImage($"CATEGORY_{Category.PNGWeapon}")) AddImage(Category.PNGWeapon, $"CATEGORY_{Category.PNGWeapon}");
            if (!HasImage($"REQUIRES_WORKBENCH_{Requires.PNGRequiresWorckbench}")) AddImage(Requires.PNGRequiresWorckbench, $"REQUIRES_WORKBENCH_{Requires.PNGRequiresWorckbench}");
            if (!HasImage($"REQUIRES_IQRANKSYSTEM_{Requires.PNGRequiresIQRankSystem}")) AddImage(Requires.PNGRequiresIQRankSystem, $"REQUIRES_IQRANKSYSTEM_{Requires.PNGRequiresIQRankSystem}");
            if (!HasImage($"REQUIRES_IQPLAGUESKILL_{Requires.PNGRequiresIQPlagueSkill}")) AddImage(Requires.PNGRequiresIQPlagueSkill, $"REQUIRES_IQPLAGUESKILL_{Requires.PNGRequiresIQPlagueSkill}");
            if (!HasImage($"REQUIRES_IQECONOMIC_{Requires.PNGRequiresIQEconomic}")) AddImage(Requires.PNGRequiresIQEconomic, $"REQUIRES_IQECONOMIC_{Requires.PNGRequiresIQEconomic}");
            foreach (KeyValuePair<String, Configuration.ItemSettings> Icon in Items.Where(x => x.Value.CategoryItems == CategoryItem.Custom || x.Value.CategoryItems == CategoryItem.Transport || x.Value.CategoryItems == CategoryItem.Entity)) {
                if (!HasImage($"ITEM_{Icon.Value.PNG}")) AddImage(Icon.Value.PNG, $"ITEM_{Icon.Value.PNG}");
            }
            foreach (KeyValuePair<String, Configuration.ItemSettings> Item in Items) {
                foreach (Configuration.ItemSettings.ItemForCraft ItemCraft in Item.Value.ItemListForCraft) {
                    if (!HasImage($"ITEM_CRAFT_{ItemCraft.PNG}")) AddImage(ItemCraft.PNG, $"ITEM_CRAFT_{ItemCraft.PNG}");
                }
            }
            ServerMgr.Instance.StartCoroutine(DownloadImages());
            PrintWarning(LanguageEn ? "Icon loading is complete" : "Загрузка иконок завершена");
        }
        private void OnPlayerAttack(BasePlayer player, HitInfo info) {
            if (info?.HitEntity == null || player == null) return;
            if (!(info.HitEntity is BaseEntity)) return;
            BaseEntity entity = info.HitEntity;
            if (entity == null || player == null) return;
            if (!HealthCustom.ContainsKey(entity.net.ID.Value)) return;
            HealthCustom[entity.net.ID.Value] -= (Int32)info.damageTypes.Total();
            if (HealthCustom[entity.net.ID.Value] <= 0) entity.Kill();
        }
        private void WriteData() {
            Oxide.Core.Interface.Oxide.DataFileSystem.WriteObject("IQCraftSystem/CraftUsers", DataCrafts);
            Oxide.Core.Interface.Oxide.DataFileSystem.WriteObject("IQCraftSystem/CraftHealth", HealthCustom);
        }
        public class DataCraft {
            [JsonProperty(LanguageEn ? "Item Information" : "Информация о предметах")]
            public Dictionary<String, Int32> CooldownCraft = new Dictionary<String, Int32>();
        }
        private void OnHammerHit(BasePlayer player, HitInfo info) {
            BaseEntity Entity = info.HitEntity;
            if (Entity == null) return;
            if (Entity.OwnerID != player.userID || Entity.skinID == 0 || Entity.skinID < player.userID) return;
            if (!player.CanBuild()) {
                SendChat(player, GetLang("CHAT_PICKUP_ITEM_BUILDING", player.UserIDString));
                return;
            }
            BaseCombatEntity CombatEntity = Entity.GetComponent<BaseCombatEntity>();
            if (CombatEntity != null) {
                if (CombatEntity.SecondsSinceDealtDamage < 30f) {
                    SendChat(player, GetLang("CHAT_PICKUP_ITEM_DAMAGE", player.UserIDString));
                    return;
                }
            }
            LootContainer ContainerEntity = Entity.GetComponent<LootContainer>();
            if (ContainerEntity != null) {
                ContainerEntity.DropItems();
            }
            Single Health = 0;
            if (HealthCustom.ContainsKey(Entity.net.ID.Value)) {
                Health = HealthCustom[Entity.net.ID.Value];
                HealthCustom.Remove(Entity.net.ID.Value);
            }
            Entity.Kill();
            KeyValuePair<String, Configuration.ItemSettings> Item = config.ItemSetting.FirstOrDefault(x => x.Value.SkinID == (Entity.skinID - player.userID));
            if (Item.Value == null) return;
            Item item = ItemManager.CreateByName(CustomItemShortname, 1, Item.Value.SkinID);
            if (!String.IsNullOrWhiteSpace(Item.Value.DisplayName)) item.name = Item.Value.DisplayName;
            player.GiveItem(item);
        }
        private Int32 GetBalance(UInt64 userID) {
            if (IQEconomic != null) return (Int32)IQEconomic?.Call("API_GET_BALANCE", userID);
            else if (Economics != null) return Convert.ToInt32((Double)Economics?.Call("Balance", userID));
            return 0;
        }
        public String GetCooldown(BasePlayer player, String KeyItem) {
            String ResultCooldown = FormatTime(TimeSpan.FromSeconds(GetCooldownTime(DataCrafts[player.userID].CooldownCraft[KeyItem])), player.UserIDString);
            return ResultCooldown;
        }
        private void DestroyItemInfo(BasePlayer player) {
            for (Int32 ItemCount = 0; ItemCount < 15; ItemCount++) {
                CuiHelper.DestroyUi(player, $"REQUIRES_ITEM_AMOUNT_{ItemCount}");
                CuiHelper.DestroyUi(player, $"REQUIRES_ITEM_ICO_{ItemCount}");
                CuiHelper.DestroyUi(player, $"REQUIRES_ITEM_LOGO_{ItemCount}");
                CuiHelper.DestroyUi(player, $"REQUIRES_ITEM_{ItemCount}");
            }
            CuiHelper.DestroyUi(player, "CREATE_ITEM_BUTTON");
            CuiHelper.DestroyUi(player, "REQUIRES_ITEM_LIST_TITLE");
            CuiHelper.DestroyUi(player, "REQUIRES_ITEM_LIST_PANEL");
            CuiHelper.DestroyUi(player, "TITLE_REQUIRES");
            CuiHelper.DestroyUi(player, "WORKBENCH_REQ");
            CuiHelper.DestroyUi(player, "WORKBENCH_REQ_ICON");
            CuiHelper.DestroyUi(player, "IQPLAGUESKILL");
            CuiHelper.DestroyUi(player, "IQPLAGUESKILL_ICON");
            CuiHelper.DestroyUi(player, "IQRANKSYSTEM_REQ_ICON");
            CuiHelper.DestroyUi(player, "IQECONOMIC");
            CuiHelper.DestroyUi(player, "IQECONOMIC_REQ_ICON");
            CuiHelper.DestroyUi(player, "IQRANKSYSTEM");
            CuiHelper.DestroyUi(player, "DESCRIPTION_CRAFT_INFO");
            CuiHelper.DestroyUi(player, "TITLE_CRAFT_INFO");
            CuiHelper.DestroyUi(player, "ICON_CRAFT_INFO");
            CuiHelper.DestroyUi(player, "CRAFT_INFORMATION_PANEL");
        }
        private Boolean IQRankRankReality(String RankKey) {
            return (Boolean)IQRankSystem?.Call("API_IS_RANK_REALITY", RankKey);
        }
        public List<CategoryUI> CategoryList = new List<CategoryUI>();
        public void Register(String Permissions) {
            if (!String.IsNullOrWhiteSpace(Permissions)) {
                if (!permission.PermissionExists(Permissions, this)) permission.RegisterPermission(Permissions, this);
            }
        }
        private void ReadData() {
            DataCrafts = Oxide.Core.Interface.Oxide.DataFileSystem.ReadObject<Hash<UInt64, DataCraft>>("IQCraftSystem/CraftUsers");
            HealthCustom = Oxide.Core.Interface.Oxide.DataFileSystem.ReadObject<Dictionary<UInt64, Int32>>("IQCraftSystem/CraftHealth");
        }
        protected override void SaveConfig() {
            Config.WriteObject(config);
        }
        public Dictionary<UInt64, Int32> HealthCustom = new Dictionary<UInt64, Int32>();
        private void CachingImage(BasePlayer player) {
            Configuration.InterfaceSettings Interface = config.InterfaceSetting;
            Configuration.InterfaceSettings.CategorySettings.PNGCategoryIcon Category = Interface.CategorySetting.PNGCategoryIcons;
       
// ... [Code preview truncated due to length. Full source in attached file] ...

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

Другие ресурсы пользователя 15FPS

Сверху