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

FREE IQWipeBlock : 1.12.15 1.12.15

Нет прав для скачивания
C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using ConVar;
using Oxide.Core;
using Object = System.Object;
using Oxide.Game.Rust.Cui;
using System.Text;
using System.Linq;
using System;
using System.Collections.Generic;
using UnityEngine;
using Oxide.Core.Plugins;
using Newtonsoft.Json;
using Network;
namespace Oxide.Plugins {
    [Info("IQWipeBlock", "Mercury", "1.12.15")]
    [Description("Блокируй по умному с IQWipeBlock")]
    class IQWipeBlock : RustPlugin {
        void UI_Category_More_Popup(BasePlayer player, Configuration.Blocks.BlockElement BlockElement) {
            CuiHelper.DestroyUi(player, IQWIPE_PARENT + "POPUP");
            CuiElementContainer container = new CuiElementContainer();
            Single FadeIn = 0.2f;
            var Interface = config.Interface;
            var BlockMore = BlockElement.BlockMoreList;
            var Block = config.Block;
            container.Add(new CuiPanel {
                RectTransform = {
                    AnchorMin = "0 0", AnchorMax = "1 1"
                }
                , Image = {
                    FadeIn = FadeIn, Color = HexToRustFormat(Interface.BackgroundMoreBlurColor), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                }
            }
            , IQWIPE_PARENT, IQWIPE_PARENT + "POPUP");
            container.Add(new CuiButton {
                FadeOut = 0.2f, RectTransform = {
                    AnchorMin = $"0 0", AnchorMax = $"1 1"
                }
                , Button = {
                    Close = IQWIPE_PARENT + "POPUP", Color = "0 0 0 0"
                }
                , Text = {
                    Text = ""
                }
            }
            , IQWIPE_PARENT + "POPUP", IQWIPE_PARENT + "POPUP" + "BUTTON_CLOSE");
            container.Add(new CuiLabel {
                RectTransform = {
                    AnchorMin = "0.3281249 0.6796", AnchorMax = "0.6927 0.7268518"
                }
                ,  ///
                Text = {
                    FadeIn = FadeIn, Text = GetLang("TITLE_BLOCK_MORE", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter
                }
            }
            , IQWIPE_PARENT + "POPUP", IQWIPE_PARENT + "POPUP_TITLE");
            container.Add(new CuiPanel {
                RectTransform = {
                    AnchorMin = "0.4036451 0.6824123", AnchorMax = "0.5916615 0.6829678"
                }
                , Image = {
                    FadeIn = FadeIn, Color = HexToRustFormat(Interface.Lines)
                }
            }
            , IQWIPE_PARENT + "POPUP", IQWIPE_PARENT + "POPUP_TITLE_LINE");
            container.Add(new CuiPanel {
                RectTransform = {
                    AnchorMin = "0.2432292 0.06944448", AnchorMax = "0.7546 0.6583334"
                }
                ,  ///
                Image = {
                    FadeIn = FadeIn, Color = "0 0 0 0"
                }
            }
            , IQWIPE_PARENT + "POPUP", IQWIPE_PARENT + "POPUP" + "ITEMS_PANEL");
            Int32 ItemCount = 0;
            Single itemMinPosition = 219f;
            Single itemWidth = 0.1f;
            /// Ширина
            Single itemMargin = 0.062f;
            /// Расстояние между
            Int32 itemCount = BlockMore.Count;
            Single itemMinHeight = 0.85f;
            // Сдвиг по вертикали
            Single itemHeight = 0.15f;
            /// Высота
            Int32 ItemTarget = 4;
            if (itemCount > ItemTarget) {
                itemMinPosition = 0.5f - ItemTarget / 2f * itemWidth - (ItemTarget - 1) / 2f * itemMargin;
                itemCount -= ItemTarget;
            }
            else itemMinPosition = 0.5f - itemCount / 2f * itemWidth - (itemCount - 1) / 2f * itemMargin;
            Int32 Count = 0;
            Int32 Items = BlockMore.Count;
            Boolean SkipElement = (Boolean)(BlockMore.Count(x => TimeUnblock(Block.VaribleUnlockMore ? x.Value + BlockElement.TimeBlock : x.Value) > 0) >= 1);
            foreach (var Item in BlockMore.OrderBy(i => i.Value).Take(28)) {
                Int32 ItemValue = Block.VaribleUnlockMore ? Item.Value + BlockElement.TimeBlock : Item.Value;
                String ColorBackground = SkipElement && TimeUnblock(ItemValue) > 0 ? Interface.NextBlockedPanel : TimeUnblock(ItemValue) > 0 ? Interface.BlockedPanel : Interface.UnblockedPanel;
                String LineColor = TimeUnblock(ItemValue) > 0 ? Interface.Lines : Interface.LinesUnblock;
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT + "POPUP" + "ITEMS_PANEL", Name = IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}", Components = {
                        new CuiImageComponent {
                            FadeIn = FadeIn, Color = HexToRustFormat(ColorBackground), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = $"{itemMinPosition} {itemMinHeight}", AnchorMax = $"{itemMinPosition + itemWidth} {itemMinHeight + itemHeight}", OffsetMax = "0 1", OffsetMin = "0 1"
                        }
                        , new CuiOutlineComponent {
                            Color = HexToRustFormat(LineColor), Distance = "-1.35 1.35", UseGraphicAlpha = true
                        }
                    }
                }
                );
                if (SkipElement && TimeUnblock(ItemValue) > 0) {
                    if (Interface.UseProgressiveBackground) {
                        Single ProgressiveX = (Single)((ItemValue - TimeUnblock(ItemValue)) / ItemValue * 1f) >= 1 ? 1 : (Single)((ItemValue - TimeUnblock(ItemValue)) / ItemValue * 1f);
                        container.Add(new CuiPanel {
                            RectTransform = {
                                AnchorMin = "0 0", AnchorMax = $"{ProgressiveX} 1", OffsetMin = "0 0", OffsetMax = "0 -0.03"
                            }
                            , Image = {
                                FadeIn = FadeIn, Color = HexToRustFormat(Interface.UnblockedPanel), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}");
                    }
                }
                // container.Add(new CuiElement
                // {
                //     Parent = IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}",
                //     Name = IQWIPE_PARENT + $"IMG_{ItemCount}",
                //     Components =
                //     {
                //         new CuiRawImageComponent { FadeIn = FadeIn, Png = GetImage($"{Item.Key}_128px") },
                //         new CuiRectTransformComponent{ AnchorMin = "0.03992017 0.04031476", AnchorMax = $"0.9481039 0.9574757"},
                //     }
                // });
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}", Name = IQWIPE_PARENT + $"IMG_{ItemCount}", Components = {
                        new CuiImageComponent() {
                            FadeIn = FadeIn, Color = "1 1 1 1", ItemId = ItemManager.FindItemDefinition(Item.Key).itemid
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0.03992017 0.04031476", AnchorMax = $"0.9481039 0.9574757"
                        }
                        ,
                    }
                }
                );
                if (!config.GeneralSetting.UseShowAllTime) {
                    if (SkipElement && TimeUnblock(ItemValue) > 0) {
                        String TimeLeft = FormatTime(TimeSpan.FromSeconds(TimeUnblock(ItemValue)), player.UserIDString);
                        container.Add(new CuiLabel {
                            RectTransform = {
                                AnchorMin = "0.06480032 0.7686631", AnchorMax = "0.9430439 0.980315"
                            }
                            , Text = {
                                FadeIn = FadeIn, Text = TimeLeft, FontSize = 12, Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}", IQWIPE_PARENT + "UNLOCK_TIME" + itemCount);
                    }
                }
                else {
                    if (TimeUnblock(ItemValue) > 0) {
                        String TimeLeft = FormatTime(TimeSpan.FromSeconds(TimeUnblock(ItemValue)), player.UserIDString);
                        container.Add(new CuiLabel {
                            RectTransform = {
                                AnchorMin = "0.06480032 0.7686631", AnchorMax = "0.9430439 0.980315"
                            }
                            , Text = {
                                FadeIn = FadeIn, Text = TimeLeft, FontSize = 12, Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}", IQWIPE_PARENT + "UNLOCK_TIME" + itemCount);
                    }
                }
                if (!SkipElement && TimeUnblock(ItemValue) > 0) {
                    container.Add(new CuiPanel {
                        RectTransform = {
                            AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 -1", OffsetMax = "0 -1"
                        }
                        , Image = {
                            FadeIn = FadeIn, Color = HexToRustFormat(Interface.BlurBlockedPanel), Material = "assets/content/ui/uibackgroundblur.mat"
                        }
                    }
                    , IQWIPE_PARENT + $"IMG_{ItemCount}", IQWIPE_PARENT + $"IMG_{ItemCount}" + "BLUR");
                    container.Add(new CuiElement {
                        Parent = IQWIPE_PARENT + $"IMG_{ItemCount}" + "BLUR", Name = IQWIPE_PARENT + $"IMG_{ItemCount}" + "BLOCKED", Components = {
                            new CuiImageComponent {
                                FadeIn = FadeIn, Sprite = Interface.SpriteBlocked, Color = HexToRustFormat(Interface.Labels)
                            }
                            , new CuiRectTransformComponent {
                                AnchorMin = "0.33 0.3399995", AnchorMax = $"0.65 0.6599998"
                            }
                            ,
                        }
                    }
                    );
                }
                Count++;
                if (Count != 4 && Items - Count != 0) {
                    container.Add(new CuiPanel {
                        RectTransform = {
                            AnchorMin = "1 0.5", AnchorMax = "1 0.5", OffsetMin = "1.5 -1", OffsetMax = $"41 1"
                        }
                        , Image = {
                            FadeIn = FadeIn, Color = HexToRustFormat(Interface.Lines)
                        }
                    }
                    , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}", IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}");
                    if (TimeUnblock(ItemValue) < 0 || (SkipElement && TimeUnblock(ItemValue) > 0)) {
                        Single ProgressiveX = (Single)((ItemValue - TimeUnblock(ItemValue)) / ItemValue * 1f) >= 1 ? 1 : (Single)((ItemValue - TimeUnblock(ItemValue)) / ItemValue * 1f);
                        container.Add(new CuiPanel {
                            RectTransform = {
                                AnchorMin = "0 0", AnchorMax = $"{ProgressiveX - 0.04} 1", OffsetMin = "0 0", OffsetMax = "0 -0.1"
                            }
                            , Image = {
                                FadeIn = FadeIn, Color = HexToRustFormat(Interface.LinesUnblock)
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}", IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}" + "PROGRESSIVE");
                    }
                }
                if (SkipElement && TimeUnblock(ItemValue) > 0) SkipElement = false;
                if (Count == 4) {
                    Items -= 4;
                    if (Items != 0) {
                        Int32 SizeLine = Items == 1 ? -131 : Items == 2 ? -215 : Items == 3 ? -260 : -293;
                        //
                        container.Add(new CuiPanel {
                            RectTransform = {
                                AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-1 -10", OffsetMax = "1 0"
                            }
                            , Image = {
                                FadeIn = FadeIn, Color = HexToRustFormat(LineColor)
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}", IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}");
                        container.Add(new CuiPanel {
                            RectTransform = {
                                AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = $"{SizeLine} -1", OffsetMax = "2 1"
                            }
                            , Image = {
                                FadeIn = FadeIn, Color = HexToRustFormat(LineColor)
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}", IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}" + "LEFT");
                        container.Add(new CuiPanel {
                            RectTransform = {
                                AnchorMin = "0 0", AnchorMax = "0 0", OffsetMin = "-1 -7", OffsetMax = "1 2"
                            }
                            , Image = {
                                FadeIn = FadeIn, Color = HexToRustFormat(LineColor)
                            }
                        }
                        , IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}" + "LEFT", IQWIPE_PARENT + $"PANEL_ITEM_{ItemCount}" + $"LINE_{ItemCount}" + "LEFT" + "DOWN");
                    }
                    Count = 0;
                }
                ItemCount++;
                itemMinPosition += (itemWidth + itemMargin);
                if (ItemCount % ItemTarget == 0) {
                    itemMinHeight -= (itemHeight + (itemMargin * 0.7f));
                    if (itemCount > ItemTarget) {
                        itemMinPosition = 0.5f - ItemTarget / 2f * itemWidth - (ItemTarget - 1) / 2f * itemMargin;
                        itemCount -= ItemTarget;
                    }
                    else itemMinPosition = 0.5f - itemCount / 2f * itemWidth - (itemCount - 1) / 2f * itemMargin;
                }
            }
            CuiHelper.AddUi(player, container);
        }
        private bool? CanWearItem(PlayerInventory inventory, Item item) {
            BasePlayer player = inventory.gameObject.ToBaseEntity() as BasePlayer;
            if (player == null || !player.userID.IsSteamId() || player.IsNpc) return null;
            if (IsDuel(player.userID.Get())) return null;
            if (!Interface_UI_Block(player, item.info.shortname, "", item.skin)) return false;
            else return null;
        }
        protected override void LoadDefaultConfig() => config = Configuration.GetNewConfiguration();
        [JsonProperty(LanguageEn ? "" : "Дата с информацией о игроках")]
        public Dictionary<UInt64, Boolean> BlockHideInfo = new Dictionary<UInt64, Boolean>();
        [ChatCommand("bpanel")]
        void ChatCommandBlockPanel(BasePlayer player, string cmd, string[] arg) {
            var General = config.GeneralSetting;
            if (!General.UsePanelButton) return;
            HideOrUnHigePanel(player, false);
        }
        private Vector3 GetDropVelocity(StorageContainer container) {
            return container switch {
                AttackHelicopterTurret turret => turret.GetDropVelocity(), AttackHelicopterRockets rockets => rockets.GetDropVelocity(), _ => new Vector3(0f, 0f, 0f)
            }
            ;
        }
        // private void OnPluginLoaded(Plugin plugin)
        // {
        //     if (plugin == null)
        //         return;
        //
        //     NextTick(TogglePickUpHook);
        // }
        //
        // private void TogglePickUpHook()
        // {
        //     Unsubscribe(nameof(CanAcceptItem));
        //     Subscribe(nameof(OnItemAddedToContainer));
        // }
        void OnItemAddedToContainer(ItemContainer container, Item item) {
            if (container == null || item == null) return;
            BasePlayer player = container.playerOwner;
            if (player == null || !player.userID.IsSteamId() || player.IsNpc) return;
            if (IsDuel(player.userID.Get())) return;
            if (IQBackpack && (Boolean)IQBackpack.CallHook("IsSaveItemBackpack", player, item)) return;
            Boolean Status = !Interface_UI_Block(player, item.info.shortname, "", item.skin);
            if (IQRecycler && IQRecycler.Call<Boolean>("IsBlackList", player.userID.Get(), item) && item.HasFlag(global : : Item.Flag.IsLocked) && !Status) return;
            if (Status) {
                if (container == player.inventory.containerWear) {
                    if (player.inventory.containerMain.itemList.Count >= 24) item.DropAndTossUpwards(player.transform.position);
                    else item.MoveToContainer(player.inventory.containerMain);
                }
                else if (container == player.inventory.containerBelt) {
                    if (player.inventory.containerMain.itemList.Count > 24) item.DropAndTossUpwards(player.transform.position);
                    else item.MoveToContainer(player.inventory.containerMain);
                }
                else {
                    if (player.inventory.containerMain.itemList.Count > 24) item.DropAndTossUpwards(player.transform.position);
                }
            }
            SetFlagItem(item, Status);
        }
        [ConsoleCommand("skip.wb")]
        void ConsoleSkipWipeBlock(ConsoleSystem.Arg arg) {
            BasePlayer player = arg.Player();
            if (player != null && !player.IsAdmin) return;
            if (!arg.HasArgs(1)) return;
            Int32 SkipTime = 0;
            if(!Int32.TryParse(arg.Args[0], out SkipTime)) {
                PrintWarning(LanguageEn ? "Syntax error! Syntax : skip.wb Time" : "Ошибка синтаксиса! Синтаксис : skip.wb Time");
                return;
            }
            if(SkipTime < 0) {
                PrintWarning(LanguageEn ? "The time cannot be lower than 0!" : "Время не может быть ниже 0!");
                return;
            }
            SkipTimeBlocked = SkipTime;
            PrintWarning(LanguageEn ? $"You have successfully set the time {SkipTime}" : $"Вы успешно установили время {SkipTime}");
        }
        private bool? CanEquipItem(PlayerInventory inventory, Item item) => CanWearItem(inventory, item);
        private void OnServerInitialized() {
            if(!ImageLibrary) {
                PrintWarning("ImageLibrary не установлен! Плагин выгружен...( https://umod.org/plugins/image-library )");
                Interface.Oxide.UnloadPlugin(this.Name);
                return;
            }
            if (!String.IsNullOrWhiteSpace(config.Interface.BackgroundUrl)) if (!HasImage($"BACKGROUND_{config.Interface.BackgroundUrl}")) AddImage(config.Interface.BackgroundUrl, $"BACKGROUND_{config.Interface.BackgroundUrl}");
            ServerMgr.Instance.InvokeRepeating(CheckAllUnlock, 0f, 60f);
            foreach (AutoTurret turrets in BaseNetworkable.serverEntities.Where(t => t is AutoTurret && !(t is NPCAutoTurret))) OnEntitySpawned(turrets);
            foreach (StorageContainer turrets in BaseNetworkable.serverEntities.Where(t => t is AttackHelicopterTurret or AttackHelicopterRockets)) OnEntitySpawned(turrets);
            foreach (BaseSubmarine submarine in BaseNetworkable.serverEntities.Where(t => t is BaseSubmarine)) OnEntitySpawned(submarine);
            NextTick(() => {
                foreach (BasePlayer player in BasePlayer.activePlayerList) OnPlayerConnected(player);
                Subscribe(nameof(OnItemAddedToContainer));
            }
            );
        }
        private void ValidsItemAttackHelicopter(StorageContainer container, Item item, Boolean AddedOrRemove) {
            if (!AddedOrRemove || item.parent == null || item.parent.uid.Value == 384258468) return;
            BasePlayer player = BasePlayer.FindByID(container.OwnerID);
            if (Interface_UI_Block(player, item.info.shortname, "", item.skin)) {
                if (container.inventory.itemList.Count == 0 || container.inventory.itemList[0] == null) return;
                if (Interface_UI_Block(player, container.inventory.itemList[0].info.shortname, item.info.shortname)) return;
            }
            if (player != null && item.MoveToContainer(player.inventory.containerMain)) return;
            item.Drop(container.transform.position + new Vector3(0f, 1f, 0f), GetDropVelocity(container));
        }
        public enum AlignCategory {
            Left, Middle, Right
        }
        static Double CurrentTime => Facepunch.Math.Epoch.Current;
        private void Init() {
            Unsubscribe(nameof(OnItemAddedToContainer));
            ReadData();
            permission.RegisterPermission(PermissionIgnoreBlock, this);
        }
        private new void LoadDefaultMessages() {
            lang.RegisterMessages(new Dictionary<String, String> {
                ["TITLE_BLOCK"]
                = "<size=35><b>BLOCKED WIPE</b></size>", ["TITLE_CATEGORY_WEAPON_TOOL"] = "<size=16><b>WEAPONS AND TOOLS</b></size>", ["TITLE_CATEGORY_ATTIRE"] = "<size=16><b>EQUIPMENT</b></size>", ["TITLE_CATEGORY_BOOM"] = "<size=16><b>EXPLOSIVES AND AMMUNITION</b></size>", ["TITLE_BLOCK_MORE"] = "<size=17><b>LOCKING ELEMENTS TO THIS ITEM</b></size>", ["TITLE_FORMAT_LOCKED_DAYS"] = "<size=12><b>D</b></size>", ["TITLE_FORMAT_LOCKED_HOURSE"] = "<size=12><b>H</b></size>", ["TITLE_FORMAT_LOCKED_MINUTES"] = "<size=12><b>M</b></size>", ["TITLE_FORMAT_LOCKED_SECONDS"] = "<size=12><b>S</b></size>", ["TITLE_BUTTON_CLOSE"] = "<size=35><b>CLOSE</b></size>", ["TITLE_INFO_BLOCKED"] = "<size=10><b>- BLOCKED</b></size>", ["TITLE_INFO_UNBLOCKED"] = "<size=10><b>- UNBLOCKED</b></size>", ["TITLE_INFO_PREBLOCKED"] = "<size=10><b>- IN THE PROCESS OF UNLOCKING</b></size>", ["TITLE_INFO_MOREBLOCKED"] = "<size=10><b>- ADDITIONAL BLOCKING</b></size>", ["UI_BLOCK_TITLE"] = "<size=18><b>THE ITEM IS TEMPORARILY BLOCKED</b></size>", ["UI_BLOCK_DESCRIPTION_ONE"] = "<size=12><b>This item item is temporarily blocked {0}</b></size>", ["UI_BLOCK_DESCRIPTION_TWO"] = "<size=12><b>This item is temporarily blocked on {0}</b></size>", ["UI_PANEL_BUTTON_TITLE"] = "<size=18><b>TEMPORARY BLOCKING OF ITEMS</b></size>", ["UI_PANEL_BUTTON_DESCRIPTION"] = "<size=13>CLICK TO OPEN THE MENU WITH THE LOCK</size>", ["UI_PANEL_BUTTON_HIDE"] = "<size=11>HIDE THIS WINDOW</size>", ["UI_PANEL_BUTTON_HIDE_ISMENU_OFF"] = "<size=11>HIDE MENU SHORTCUT BUTTONS</size>", ["UI_PANEL_BUTTON_HIDE_ISMENU_ON"] = "<size=11>EXPAND THE QUICK ACCESS BUTTONS TO THE MENU</size>", ["CHAT_ALERT_ALL_USERS_ALL_UNLOCK"] = "Hurray! All items have been unlocked!",
            }
            , this);
            lang.RegisterMessages(new Dictionary<String, String> {
                ["TITLE_BLOCK"]
                = "<size=35><b>БЛОКИРОВКА ПОСЛЕ ВАЙПА</b></size>", ["TITLE_BLOCK_MORE"] = "<size=17><b>БЛОКИРОВКА ЭЛЕМЕНТОВ К ЭТОМУ ПРЕДМЕТУ</b></size>", ["TITLE_CATEGORY_WEAPON_TOOL"] = "<size=16><b>ОРУЖИЕ И ИНСТРУМЕНТЫ</b></size>", ["TITLE_CATEGORY_BOOM"] = "<size=16><b>ВЗРЫВЧАТКА И БОЕПРИПАСЫ</b></size>", ["TITLE_CATEGORY_ATTIRE"] = "<size=16><b>СНАРЯЖЕНИЕ</b></size>", ["TITLE_FORMAT_LOCKED_DAYS"] = "<size=12><b>Д</b></size>", ["TITLE_FORMAT_LOCKED_HOURSE"] = "<size=12><b>Ч</b></size>", ["TITLE_FORMAT_LOCKED_MINUTES"] = "<size=12><b>М</b></size>", ["TITLE_FORMAT_LOCKED_SECONDS"] = "<size=12><b>С</b></size>", ["TITLE_BUTTON_CLOSE"] = "<size=35><b>ЗАКРЫТЬ</b></size>", ["TITLE_INFO_BLOCKED"] = "<size=10><b>- ЗАБЛОКИРОВАНО</b></size>", ["TITLE_INFO_UNBLOCKED"] = "<size=10><b>- РАЗБЛОКИРОВАНО</b></size>", ["TITLE_INFO_PREBLOCKED"] = "<size=10><b>- В ПРОЦЕССЕ РАЗБЛОКИРОВКИ</b></size>", ["TITLE_INFO_MOREBLOCKED"] = "<size=10><b>- ДОПОЛНИТЕЛЬНАЯ БЛОКИРОВКА</b></size>", ["UI_BLOCK_TITLE"] = "<size=18><b>ПРЕДМЕТ ВРЕМЕННО ЗАБЛОКИРОВАН</b></size>", ["UI_BLOCK_DESCRIPTION_ONE"] = "<size=12><b>Данный элемент предмета временно заблокирован {0}</b></size>", ["UI_BLOCK_DESCRIPTION_TWO"] = "<size=12><b>Данный предмет временно заблокирован на {0}</b></size>", ["UI_PANEL_BUTTON_TITLE"] = "<size=18><b>ВРЕМЕННАЯ БЛОКИРОВКА ПРЕДМЕТОВ</b></size>", ["UI_PANEL_BUTTON_DESCRIPTION"] = "<size=13>НАЖМИТЕ ЧТОБЫ ОТКРЫТЬ МЕНЮ С БЛОКИРОВКОЙ</size>", ["UI_PANEL_BUTTON_HIDE"] = "<size=11>СКРЫТЬ ДАННОЕ ОКНО</size>", ["UI_PANEL_BUTTON_HIDE_ISMENU_OFF"] = "<size=11>СКРЫТЬ КНОПКИ БЫСТРОГО ДОСТУПА К МЕНЮ</size>", ["UI_PANEL_BUTTON_HIDE_ISMENU_ON"] = "<size=11>РАСКРЫТЬ КНОПКИ БЫСТРОГО ДОСТУПА К МЕНЮ</size>", ["CHAT_ALERT_ALL_USERS_ALL_UNLOCK"] = "Ура! Все предметы были разблокированы!",
            }
            , this, "ru");
            PrintWarning(LanguageEn ? "Language file uploaded successfully" : "Языковой файл загружен успешно");
        }
        object CanMountEntity(BasePlayer player, MLRS entity) {
            if (player == null || entity == null) return null;
            if (Interface_UI_Block(player, "ammo.rocket.mlrs")) return null;
            else return false;
        }
        Boolean Block_Skin_Controller(Configuration.Blocks.BlockElement BlockInfo, Dictionary<String, Configuration.Blocks.BlockElement> BlockAll, Boolean BlockStatusShortname, UInt64 SkinID = 0) {
            if (BlockStatusShortname && SkinID != 0 && SkinID == BlockInfo.SkinID) return true;
            else if (BlockInfo.SkinID == 0 && SkinID == 0 && BlockStatusShortname) return true;
            else if (BlockStatusShortname && BlockInfo.SkinID == 0 && BlockAll.Count(x => x.Value.SkinID == SkinID) == 0) return true;
            else if(SkinID == 2907425987) return true;
            else if(SkinID == 2908022597) return true;
            else return false;
        }
        object OnMagazineReload(BaseProjectile weapon, IAmmoContainer desiredAmount, BasePlayer player) {
            if (player == null || !player.userID.IsSteamId() || player.IsNpc || weapon == null) return null;
            if (player.inventory == null) return null;
            if (IsDuel(player.userID.Get())) return null;
            weapon.SwitchAmmoTypesIfNeeded(player.inventory);
            weapon.SendNetworkUpdate();
            if (Interface_UI_Block(player, weapon.primaryMagazine.ammoType.shortname)) if (Interface_UI_Block(player, player.GetActiveItem().info.shortname, weapon.primaryMagazine.ammoType.shortname)) return null;
            else return false;
            else return false;
        }
        public void SendChat(string Message, BasePlayer player, Chat.ChatChannel channel = Chat.ChatChannel.Global) {
            var Chat = config.GeneralSetting.ReferenceSettings.ChatSettings;
            if (IQChat) if (Chat.UIAlertUse) IQChat?.Call("API_ALERT_PLAYER_UI", player, Message);
            else IQChat?.Call("API_ALERT_PLAYER", player, Message, Chat.CustomPrefix, Chat.CustomAvatar);
            else player.SendConsoleCommand("chat.add", channel, 0, Message);
        }
        void UI_IQ_WipeBlock(BasePlayer player) {
            CuiHelper.DestroyUi(player, IQWIPE_PARENT);
            CuiElementContainer container = new CuiElementContainer();
            Single FadeIn = 0.2f;
            var Interface = config.Interface;
            container.Add(new CuiPanel {
                CursorEnabled = true, RectTransform = {
                    AnchorMin = "0 0", AnchorMax = "1 1"
                }
                , Image = {
                    FadeIn = FadeIn, Color = HexToRustFormat(Interface.BacgkroundColor)
                }
            }
            , "Overlay", IQWIPE_PARENT);
            if (!String.IsNullOrWhiteSpace(config.Interface.BackgroundUrl)) {
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT, Components = {
                        new CuiRawImageComponent {
                            Png = GetImage($"BACKGROUND_{config.Interface.BackgroundUrl}")
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0 0", AnchorMax = "1 1"
                        }
                        ,
                    }
                }
                );
            }
            container.Add(new CuiPanel {
                RectTransform = {
                    AnchorMin = "0 0", AnchorMax = "1 1"
                }
                , Image = {
                    FadeIn = FadeIn, Color = HexToRustFormat(Interface.BackgroundBlurColor), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                }
            }
            , IQWIPE_PARENT, IQWIPE_PARENT + "BLUR");
            container.Add(new CuiLabel {
                RectTransform = {
                    AnchorMin = "0.15572 0.9231482", AnchorMax = "0.8375002 0.9842593"
                }
                ,  //
                Text = {
                    FadeIn = FadeIn, Text = GetLang("TITLE_BLOCK", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleCenter
                }
            }
            , IQWIPE_PARENT, IQWIPE_PARENT + "TITLE");
            if (Interface.ShowInformationBlocks) {
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT, Name = IQWIPE_PARENT + "INFO_BLOCKED", Components = {
                        new CuiImageComponent {
                            FadeIn = FadeIn, Color = HexToRustFormat(Interface.BlockedPanel), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0.01354169 0.9546172", AnchorMax = "0.03020836 0.9842459", OffsetMax = "0 1", OffsetMin = "0 0.5"
                        }
                        , new CuiOutlineComponent {
                            Color = HexToRustFormat(Interface.Lines), Distance = "-1.35 1.4", UseGraphicAlpha = true
                        }
                    }
                }
                );
                container.Add(new CuiPanel {
                    RectTransform = {
                        AnchorMin = "0 0", AnchorMax = "1 1", OffsetMin = "0 -1", OffsetMax = "0 -1"
                    }
                    , Image = {
                        FadeIn = FadeIn, Color = HexToRustFormat(Interface.BlurBlockedPanel), Material = "assets/content/ui/uibackgroundblur.mat"
                    }
                }
                , IQWIPE_PARENT + "INFO_BLOCKED", IQWIPE_PARENT + "INFO_BLOCKED" + "BLUR");
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT + "INFO_BLOCKED" + "BLUR", Components = {
                        new CuiImageComponent {
                            FadeIn = FadeIn, Sprite = Interface.SpriteBlocked, Color = HexToRustFormat(Interface.Labels)
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = "0.33 0.3399995", AnchorMax = $"0.65 0.6599998"
                        }
                        ,
                    }
                }
                );
                container.Add(new CuiLabel {
                    RectTransform = {
                        AnchorMin = "0.03281251 0.9546172", AnchorMax = "0.1208333 0.9842459"
                    }
                    , Text = {
                        FadeIn = FadeIn, Text = GetLang("TITLE_INFO_BLOCKED", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                    }
                }
                , IQWIPE_PARENT, IQWIPE_PARENT + "TITLE");
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT, Components = {
                        new CuiImageComponent {
                            FadeIn = FadeIn, Color = HexToRustFormat(Interface.UnblockedPanel), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = $"0.01354169 0.9175813", AnchorMax = $"0.03020836 0.94721", OffsetMax = "0 1", OffsetMin = "0 1"
                        }
                        , new CuiOutlineComponent {
                            Color = HexToRustFormat(Interface.LinesUnblock), Distance = "-1.35 1.35", UseGraphicAlpha = true
                        }
                    }
                }
                );
                container.Add(new CuiLabel {
                    RectTransform = {
                        AnchorMin = "0.03281251 0.9175813", AnchorMax = "0.1208333 0.94721"
                    }
                    , Text = {
                        FadeIn = FadeIn, Text = GetLang("TITLE_INFO_UNBLOCKED", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                    }
                }
                , IQWIPE_PARENT, IQWIPE_PARENT + "TITLE");
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT, Components = {
                        new CuiImageComponent {
                            FadeIn = FadeIn, Color = HexToRustFormat(Interface.NextBlockedPanel), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = $"0.1239583 0.9546172", AnchorMax = $"0.1406247 0.9842459", OffsetMax = "0 1", OffsetMin = "0 1"
                        }
                        , new CuiOutlineComponent {
                            Color = HexToRustFormat(Interface.Lines), Distance = "-1.35 1.35", UseGraphicAlpha = true
                        }
                    }
                }
                );
                container.Add(new CuiLabel {
                    RectTransform = {
                        AnchorMin = "0.1432293 0.9546172", AnchorMax = "0.2786458 0.9842459"
                    }
                    , Text = {
                        FadeIn = FadeIn, Text = GetLang("TITLE_INFO_PREBLOCKED", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                    }
                }
                , IQWIPE_PARENT, IQWIPE_PARENT + "TITLE");
                container.Add(new CuiElement {
                    Parent = IQWIPE_PARENT, Components = {
                        new CuiImageComponent {
                            FadeIn = FadeIn, Color = HexToRustFormat(Interface.UnblockedMorePanel), Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat"
                        }
                        , new CuiRectTransformComponent {
                            AnchorMin = $"0.1239583 0.9175813", AnchorMax = $"0.1406247 0.94721", OffsetMax = "0 1", OffsetMin = "0 1"
                        }
                        , new CuiOutlineComponent {
                            Color = HexToRustFormat(Interface.PreBlockedMoreLine), Distance = "-1.35 1.35", UseGraphicAlpha = true
                        }
                    }
                }
                );
                container.Add(new CuiLabel {
                    RectTransform = {
                        AnchorMin = "0.1432293 0.9175813", AnchorMax = "0.2786458 0.94721"
                    }
                    , Text = {
                        FadeIn = FadeIn, Text = GetLang("TITLE_INFO_MOREBLOCKED", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Font = "robotocondensed-bold.ttf", Align = TextAnchor.MiddleLeft
                    }
                }
                , IQWIPE_PARENT, IQWIPE_PARENT + "TITLE");
            }
            container.Add(new CuiButton {
                FadeOut = 0.2f, RectTransform = {
                    AnchorMin = $"0.8151017 0.9231482", AnchorMax = $"0.995831 0.9842593"
                }
                , Button = {
                    Close = IQWIPE_PARENT, Color = "0 0 0 0"
                }
                , Text = {
                    Text = GetLang("TITLE_BUTTON_CLOSE", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Align = TextAnchor.MiddleCenter
                }
            }
            , IQWIPE_PARENT, IQWIPE_PARENT + "BUTTON_CLOSE");
            UI_Category_Show(player, container, Interface, config.Block.BlockWeaponAndTools, config.Interface.CategoryWeaponTools);
            UI_Category_Show(player, container, Interface, config.Block.BlockArmory, config.Interface.CategoryArmory);
            UI_Category_Show(player, container, Interface, config.Block.BlockBoom, config.Interface.CategoryBoom);
            CuiHelper.AddUi(player, container);
            if (config.GeneralSetting.UsePanelButton) HideButtonIsMenu(player);
        }
        void WriteData() {
            Oxide.Core.Interface.Oxide.DataFileSystem.WriteObject("IQWipeBlock/HideStatus", BlockHideInfo);
            Oxide.Core.Interface.Oxide.DataFileSystem.WriteObject("IQWipeBlock/SkipTimeBlocked", SkipTimeBlocked);
        }
        private String ShortnameValidation(String shortname) {
            if (alternativeNames.TryGetValue(shortname, out String alternativeName)) shortname = alternativeName;
            else {
                foreach (String suffix in suffixes) {
                    Int32 index = shortname.IndexOf(suffix, StringComparison.Ordinal);
                    if (index <= 0) continue;
                    shortname = shortname.Substring(0, index);
                    break;
                }
            }
            if (shortname.Equals("wall.external.high.ice")) shortname = shortname.Replace("ice", "stone");
            return shortname;
        }
        void Interface_Button_Panel(BasePlayer player) {
            var Interface = config.Interface;
            var General = config.GeneralSetting;
            if (!General.UsePanelButton) return;
            if (BlockHideInfo[player.userID]) return;
            if (config.Interface.ButtonIsBlock) {
                Int64 TimeBlockMain = config.Block.BlockWeaponAndTools.Union(config.Block.BlockArmory).Union(config.Block.BlockBoom).ToDictionary(x => x.Key, x => x.Value).Sum(s => s.Value.TimeBlock);
                Int64 TimeBlockOther = config.Block.BlockWeaponAndTools.Union(config.Block.BlockArmory).Union(config.Block.BlockBoom).ToDictionary(x => x.Key, x => x.Value).Sum(s => s.Value.BlockMoreList.Sum(z => z.Value));
                Int32 AllTime = Convert.ToInt32(TimeBlockMain + TimeBlockOther);
                if (TimeUnblock(AllTime) <= 0) return;
            }
            CuiHelper.DestroyUi(player, IQWIPE_PARENT_PANEL_BTN);
            CuiElementContainer container = new CuiElementContainer();
            Single FadeIn = 0.2f;
            container.Add(new CuiPanel {
                RectTransform = {
                    AnchorMin = config.Interface.AnchorMinPositionQuickMenu, AnchorMax = config.Interface.AnchorMaxPositionQuickMenu, OffsetMin = config.Interface.OffsetMinPositionQuickMenu, OffsetMax = config.Interface.OffsetMaxPositionQuickMenu
                }
                , Image = {
                    FadeIn = FadeIn, Color = "0 0 0 0"
                }
            }
            , "Hud", IQWIPE_PARENT_PANEL_BTN);
            container.Add(new CuiButton {
                FadeOut = 0.2f, RectTransform = {
                    AnchorMin = $"0.1469697 0.6190471", AnchorMax = $"1 1"
                }
                , Button = {
                    Command = "block", Color = "0 0 0 0"
                }
                , Text = {
                    Text = GetLang("UI_PANEL_BUTTON_TITLE", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Align = TextAnchor.MiddleRight
                }
            }
            , IQWIPE_PARENT_PANEL_BTN, IQWIPE_PARENT_PANEL_BTN + "TITLE_ONE");
            container.Add(new CuiButton {
                FadeOut = 0.2f, RectTransform = {
                    AnchorMin = $"0.2075757 0.3444443", AnchorMax = $"1 0.62668022"
                }
                , Button = {
                    Command = "block", Color = "0 0 0 0"
                }
                , Text = {
                    Text = GetLang("UI_PANEL_BUTTON_DESCRIPTION", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Align = TextAnchor.MiddleRight
                }
            }
            , IQWIPE_PARENT_PANEL_BTN, IQWIPE_PARENT_PANEL_BTN + "TITLE_TWO");
            if (General.UseHidePanelButton) {
                container.Add(new CuiButton {
                    FadeOut = 0.2f, RectTransform = {
                        AnchorMin = $"0.7 0.06666651", AnchorMax = $"1 0.348888022"
                    }
                    , Button = {
                        Command = "iqwb hide.panel.btn false", Color = "0 0 0 0"
                    }
                    , Text = {
                        Text = GetLang("UI_PANEL_BUTTON_HIDE", player.UserIDString), Color = HexToRustFormat(Interface.Labels), Align = TextAnchor.MiddleRight
                    }
                }
                , IQWIPE_PARENT_PANEL_BTN, IQWIPE_PARENT_PANEL_BTN + "TITLE_THREE");
            }
            container.Add(new CuiElement {
                Parent = IQWIPE_PARENT_PANEL_BTN, Name = IQWIPE_PARENT_PANEL_BTN + "ICO", Components = {
                    new CuiImageComponent {
                        FadeIn = FadeIn, Sprite = Interface.SpriteBlockLogo, Color = HexToRustFormat(Interface.Labels)
                    }
                    , new CuiRectTransformComponent {
                        AnchorMin = config.Interface.AnchorMinPositionSpriteLogo, AnchorMax = config.Interface.AnchorMaxPositionSpriteLogo
                    }
                    ,
                }
            }
            );
            CuiHelper.AddUi(player, container);
        }
        public String FormatTime(TimeSpan time, String UserID) {
            Boolean UseFullTime = config.Interface.UseFormatTime;
            String Result = String.Empty;
            String Days = GetLang("TITLE_FORMAT_LOCKED_DAYS", UserID);
            String Hourse = GetLang("TITLE_FORMAT_LOCKED_HOURSE", UserID);
            String Minutes = GetLang("TITLE_FORMAT_LOCKED_MINUTES", UserID);
            String Seconds = GetLang("TITLE_FORMAT_LOCKED_SECONDS", UserID);
            if (!UseFullTime) {
                if (time.Seconds != 0) Result = $"{Format(time.Seconds, Seconds, Seconds, Seconds)}";
                if (time.Minutes != 0) Result = $"{Format(time.Minutes, Minutes, Minutes, Minutes)}";
                if (time.Hours != 0) Result = $"{Format(time.Hours, Hourse, Hourse, Hourse)}";
                if (time.Days != 0) Result = $"{Format(time.Days, Days, Days, Days)}";
            }
            else {
                if (time.Days != 0) Result += $"{Format(time.Days, Days, Days, Days)} ";
                if (time.Hours != 0) Result += $"{Format(time.Hours, Hourse, Hourse, Hourse)} ";
                if (time.Minutes != 0) Result += $"{Format(time.Minutes, Minutes, Minutes, Minutes)} ";
                if (time.Days == 0 && time.Hours == 0 && time.Minutes == 0 && time.Seconds != 0) Result = $"{Format(time.Seconds, Seconds, Seconds, Seconds)} ";
            }
            return Result;
        }
        private object OnWeaponReload(BaseProjectile weapon, BasePlayer player) => OnMagazineReload(weapon, player.inventory, player);
        protected override void SaveConfig() => Config.WriteObject(config);
        ItemContainer.CanAcceptResult? CanAcceptItem(ItemContainer container, Item item, int targetPos) {
            if (item == null || item.info == null || container == null) return null;
            if (container.availableSlots.Count != 0) {
                if (item.parent != null && item.parent.entityOwner != null) {
                    UInt64 NetID = item.parent.entityOwner.net.ID.Value;
                    if (ContainerGetPlayer.ContainsKey(NetID)) {
                        if (Interface_UI_Block(null, container.parent.info.shortname, item.info.shortname, 0, ContainerGetPlayer[NetID])) return null;
                        else return ItemContainer.CanAcceptResult.CannotAccept;
                    }
                }
                BasePlayer ContainerPlayer = item.GetRootContainer() == null ? null : item.GetRootContainer().playerOwner;
                if (ContainerPlayer != null && ContainerPlayer.userID.IsSteamId() && !ContainerPlayer.IsNpc) {
                    if (IsDuel(ContainerPlayer.userID.Get())) return null;
                    if (Interface_UI_Block(ContainerPlayer, container.parent.info.shortname, item.info.shortname)) return null;
                    else return ItemContainer.CanAcceptResult.CannotAccept;
                }
            }
            BasePlayer player = item.GetOwnerPlayer();
            if (player == null || !player.userID.IsSteamId() || player.IsNpc) return null;
            if(IQRecycler && container.entityOwner is Recycler && IQRecycler.Call<Boolean>("IsBlackList", container.entityOwner.OwnerID, item)) return ItemContainer.CanAcceptResult.CannotAccept;
            if (IQBackpack && (Boolean)IQBackpack.CallHook("IsSaveItemBackpack", player, item)) return null;
            if (container.availableSlots.Count == 0) return null;
            if (IsDuel(player.userID.Get())) return null;
            if (Interface_UI_Block(player, container.parent.info.shortname, item.info.shortname)) return null;
            return ItemContainer.CanAcceptResult.CannotAccept;
        }
        public readonly String IQWIPE_PARENT = "UI_IQWIPE_PARENT_MAIN";
        [ChatCommand("block")]
        void ChatCommandBlock(BasePlayer player) {
            if (player == null) return;
            UI_IQ_WipeBlock(player);
        }
        [ConsoleCommand("block")]
        void ConsoleCommandBlock(ConsoleSystem.Arg arg) {
            BasePlayer player = arg.Player();
            if (player == null) return;
            UI_IQ_WipeBlock(player);
        }
        public Boolean HasImage(String imageName) => (Boolean)ImageLibrary?.Call("HasImage", imageName);
        private readonly List<String> suffixes = new() {
            ".ice", ".diver", ".dragon", ".driver"
        }
        ;
        public String GetLang(String LangKey, String userID = null, params object[] args) {
            sb.Clear()
// ... [Code preview truncated due to length. Full source in attached file] ...

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