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

FREE XDCobaltLaboratory : 2.3.4 2.3.4

Нет прав для скачивания
C#:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Facepunch;
using Network;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Oxide.Core;
using Oxide.Core.Libraries;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Rust;
using Rust.Modular;
using UnityEngine;
namespace Oxide.Plugins {
    [Info("XDCobaltLaboratory", "DezLife", "2.3.4")]
    public class XDCobaltLaboratory : RustPlugin {
        //Исправлена загрузка стандартной постройки
#region Var
        [PluginReference]
        Plugin CopyPaste, IQChat, NpcSpawn;
        private static XDCobaltLaboratory _;
        private List<uint> Light = new List<uint> {
            3887352222, 1889323056, 630866573, 4027991414, 1392608348, 1748062128
        }
        ;
        private HashSet<Vector3> busyPoints3D = new HashSet<Vector3>();
        private List<BaseEntity> HouseCobaltLab = new List<BaseEntity>();
        private List<ScientistNPC> npcs = new List<ScientistNPC>();
        private NpcZones npcZones = null;
        private List<UInt64> HideUIUser = new List<UInt64>();
        private string PosIvent;
        private HackableLockedCrate CrateEnt;
        private const int MaxRadius = 7;
        private Timer SpawnHouseTime;
        private Timer RemoveHouseTime;
        private Configuration.BuildingPasteSettings.PasteBuild labIndex = null;
        private const bool Ru = true;
        private Coroutine setupBuildingRoutine {
            get;
            set;
        }
        = null;
#endregion
#region Lang
        protected override void LoadDefaultMessages() {
            lang.RegisterMessages(new Dictionary<string, string> {
                ["XD_IVENT_START"]
                = "<color=#008000>[Cobalt Lab Event] </color>Ученые разбили на этом острове свою лабораторию под названием Кобальт, скорее всего там находятся ценные вещи, ведь она охраняется!\nКвадрат: <color=#00FF00>{0}</color>", ["XD_IVENT_STARTUI"] = "Ученые развернули свою Кобальтовую лабораторию!\nКвадрат : {0}", ["XD_IVENT_NOPLAYER"] = "<color=#008000>[Cobalt Lab Event] </color>Ученые закончили свой эксперимент и успешно покинули остров без происшествий", ["XD_IVENT_CRATEHACK"] = "<color=#008000>[Cobalt Lab Event] </color>В лаборатории кобальт <color=#FFD700>{0}</color> начал взлом секретного ящика в квадрате <color=#00FF00>{1}</color>", ["XD_IVENT_CRATEHACKHELP"] = "<color=#008000>[Cobalt Lab Event] </color>В лаборатории кобальт <color=#FFD700>{0}</color> начал взлом секретного ящика в квадрате <color=#00FF00>{1}</color>\nНа это место уже прибыла подмога! Будте осторожней", ["XD_IVENT_CRATEHACKEND"] = "<color=#008000>[Cobalt Lab Event] </color>В лаборатории кобальт был взломан секретный ящик, ученые начинают эвакуацию с острова, у вас осталось <color=#9ACD32>{0} минут</color>, чтобы забрать его!", ["XD_IVENT_CRATELOOTFOUND"] = " <color=#008000>[Cobalt Lab Event] </color>В лаборатории кобальт никто не успел залутать взломанный ящик, лаборатория была эвакуирована и постройка разрушена", ["XD_IVENT_CRATELOOTPLAYER"] = "<color=#008000>[Cobalt Lab Event] </color><color=#FFD700>{0}</color> успешно ограбил лабораторию кобальт и забрал ценные вещи с секретного ящика", ["XD_IVENT_HOUSECOBALT"] = "Cobalt laboratory", ["XD_IVENT_START_DISCORD"] = "Ученые разбили на этом острове свою лабораторию под названием Кобальт,скорее всего там находится ценные вещи, ведь он охраняется!\nКвадрат : {0}", ["XD_IVENT_NOPLAYER_DISCORD"] = "Ученые закончили свой эксперимент и успешно покинули остров без происшествий", ["XD_IVENT_CRATEHACK_DISCORD"] = "В лаборатории кобальт {0} начал взлом секретного ящика в квадрате {1}\nСоберитесь с силами и отбейте его", ["XD_IVENT_CRATEHACKHELP_DISCORD"] = "В лаборатории кобальт {0} начал взлом секретного ящика в квадрате {1}\nСоберитесь с силами и отбейте его\nНа это место уже прибыла подмога! Будте осторожней", ["XD_IVENT_CRATEHACKEND_DISCORD"] = "В лаборатории кобальт был взломан секретный ящик, ученые начинают эвакуацию с острова, у вас осталось {0} минут, чтобы забрать его!", ["XD_IVENT_CRATELOOTFOUND_DISCORD"] = "В лаборатории кобальт никто не успел залутать взломанный ящик, лаборатория была эвакуирована и постройка разрушена", ["XD_IVENT_CRATELOOTPLAYER_DISCORD"] = "{0}  успешно ограбил лабораторию кобальт и забрал ценные вещи с секретного ящика", ["XD_IVENT_CLCONTROLLER_HELI_HELP_DISCORD "] = "Внутри ящика оказалась ловушка с сигналом в службу охраны Cobalt.\nНа защиту вылетел боевой вертолёт\nВы должны сбить его или выжить в течении 5 минут.", ["XD_IVENT_CL_ITEM_SYNTAX"] = "Используйте:\n/cl.items add - добавить лут к существующему\n/cl.items reset - заменить старый лут на новый", ["XD_IVENT_CL_ITEM_ADDED"] = "Вы успешно добавили новые предметы для ящика.\nОбязательно настройте их в конфиге", ["XD_IVENT_CL_ITEM_REPLACED"] = "Вы успешно заменили все предметы на новые.\nОбязательно настройте их в конфиге", ["XD_IVENT_CLBOT_ITEM_SYNTAX"] = "Используйте:\n/cl.botitems add - добавить лут к существующему\n/cl.botitems reset - заменить старый лут на новый", ["XD_IVENT_CLBOT_ITEM_ADDED"] = "Вы успешно добавили новые предметы для npc.\nОбязательно настройте их в конфиге", ["XD_IVENT_CLBOT_ITEM_REPLACED"] = "Вы успешно заменили все предметы на новые.\nОбязательно настройте их в конфиге", ["XD_IVENT_CLCONTROLLER_SYNTAX"] = "Используйте:\n/cl start - Запуск ивента досрочно\n/cl stop - отменить ивент досрочно", ["XD_IVENT_CLCONTROLLER_ACTIVE"] = "Ивент уже активен!", ["XD_IVENT_CLCONTROLLER_STOPADMIN"] = "Ивент окончен досрочно администратором!", ["XD_IVENT_CLCONTROLLER_NOT_ACTIVE"] = "Нет активных ивентов", ["XD_IVENT_CLCONTROLLER_NOT_ENOUGH_PLAYERS"] = "Недостаточно игроков для запуска ивента!", ["XD_IVENT_CLCONTROLLER_BUILDING_ERROR"] = "Ошибка #1 \nПостройка не смогла заспавнится\nОбратитесь к разработчику\nDezLife#1480\nvk.com/dezlife", ["XD_IVENT_CLCONTROLLER_NOT_BUILDING_BOX"] = "Ошибка #3, В постройке не найден ящик", ["XD_IVENT_CLCONTROLLER_THE_POINTS_ARE_ENDED"] = "Все точки закончены!\nНачинаем генерировать новые...", ["XD_IVENT_CLCONTROLLER_LOADING_THE_CONSTRUCTION"] = "Файл постройки не найден!\nНачинаем импортировать...", ["XD_IVENT_CLCONTROLLER_CONSTRUCTION_LOADED"] = "Постройка успешно загружена!", ["XD_IVENT_CLCONTROLLER_ERROR_DOWNLOADING"] = "Ошибка при загрузке постройки!\nПробуем загрузить еще раз", ["XD_IVENT_CLCONTROLLER_ERROR_KEYAUTH"] = "Плагин не смог пройти аунтефикацию на сервере!\n Сверьте версию плагина или свяжитесь с разработчиком\nDezLife#1480\nvk.com/dezlife", ["XD_IVENT_CLCONTROLLER_RETAINED_UPLOAD_ERROR"] = "Повторная загрузка не была успешной\nОбратитесь к разработчику\nDezLife#1480\nvk.com/dezlife", ["XD_IVENT_CLCONTROLLER_HELI_HELP"] = "<color=#008000>[Cobalt Lab Event] </color>Внутри ящика оказалась ловушка с сигналом в службу охраны Cobalt.\nНа защиту вылетел боевой вертолёт\nВы должны сбить его или выжить в течении 5 минут.", ["XD_IVENT_CLCONTROLLER_ENTER_PVP"] = "Вы <color=#ce3f27>вошли</color> в PVP зону, теперь другие игроки <color=#ce3f27>могут</color> наносить вам урон!", ["XD_IVENT_CLCONTROLLER_EXIT_PVP"] = "Вы <color=#738d43>вышли</color> из PVP зоны, теперь другие игроки <color=#738d43>не могут</color> наносить вам урон!", ["XD_IVENT_CLCONTROLLER_NOT_NPSSPAWN"] = "У вас отсутсвует плагин NpcSpawn.Пожалуйста установите его для коректной работы",
            }
            , this, "ru");
            lang.RegisterMessages(new Dictionary<string, string> {
                ["XD_IVENT_START"]
                = "<color=#008000>[Cobalt Lab Event] </color>Scientists have set up their laboratory on this island called Cobalt, most likely there are valuable things there, because it is protected!\nGrid: <color=#00FF00>{0}</color>", ["XD_IVENT_STARTUI"] = "Scientists have deployed their Cobalt Lab!\nGrid : {0}", ["XD_IVENT_NOPLAYER"] = "<color=#008000>[Cobalt Lab Event] </color>The scientists completed their experiment and successfully left the island without incident", ["XD_IVENT_CRATEHACK"] = "<color=#008000>[Cobalt Lab Event] </color>In the cobalt lab <color=#FFD700>{0}</color> started hacking a secret crate in the grid <color=#00FF00>{1}</color>", ["XD_IVENT_CRATEHACKHELP"] = "<color=#008000>[Cobalt Lab Event] </color>In the cobalt lab <color=#FFD700>{0}</color> started hacking a secret crate in the grid <color=#00FF00>{1}</color>\nHelp has already arrived at this place! Be careful", ["XD_IVENT_CRATEHACKEND"] = "<color=#008000>[Cobalt Lab Event] </color>A secret crate has been hacked in the cobalt lab, scientists are beginning to evacuate the island, you have <color=#9ACD32>{0} minutes</color> left to pick it up!", ["XD_IVENT_CRATELOOTFOUND"] = " <color=#008000>[Cobalt Lab Event] </color>In the cobalt laboratory, no one had time to hack the secret crate, the laboratory was evacuated and the building was destroyed", ["XD_IVENT_CRATELOOTPLAYER"] = "<color=#008000>[Cobalt Lab Event] </color><color=#FFD700>{0}</color> successfully robbed the cobalt lab and took valuables from a secret crate", ["XD_IVENT_HOUSECOBALT"] = "Cobalt laboratory", ["XD_IVENT_START_DISCORD"] = "Scientists have set up their laboratory on this island called Cobalt, most likely there are valuable things there, because it is guarded!\nКвадрат : {0}", ["XD_IVENT_NOPLAYER_DISCORD"] = "Scientists finished their experiment and successfully left the island without incident.", ["XD_IVENT_CRATEHACK_DISCORD"] = "In the laboratory, cobalt {0} started breaking into a secret box in square {1}\nGather your strength and fight it off", ["XD_IVENT_CRATEHACKHELP_DISCORD"] = "In the laboratory, cobalt {0} started breaking into a secret box in square {1}\nGather your strength and fight it off\nHelp has already arrived at this place! Be careful", ["XD_IVENT_CRATEHACKEND_DISCORD"] = "A secret box has been broken in the cobalt laboratory, scientists are starting to evacuate the island, you have {0} minutes left to pick it up!", ["XD_IVENT_CRATELOOTFOUND_DISCORD"] = " In the cobalt laboratory, no one had time to patch up the cracked box, the laboratory was evacuated and the building was destroyed", ["XD_IVENT_CRATELOOTPLAYER_DISCORD"] = "{0}  successfully robbed the cobalt laboratory and took valuable items from the secret box", ["XD_IVENT_CLCONTROLLER_HELI_HELP_DISCORD"] = "Inside the box was a trap with a signal to the Cobalt security service.\nA battle helicopter flew to protect the box\nYou need to shoot it down or survive for 5 minutes", ["XD_IVENT_CL_ITEM_SYNTAX"] = "Use:\n/cl.items add - add loot to the existing one\n/cl.items reset - replace old loot with a new one", ["XD_IVENT_CL_ITEM_ADDED"] = "You have successfully added new items to the crate.\nBe sure to configure them in the config", ["XD_IVENT_CL_ITEM_REPLACED"] = "You have successfully replaced all items with new ones.\nBe sure to configure them in the config", ["XD_IVENT_CLBOT_ITEM_SYNTAX"] = "Use:\n/cl.botitems add - add loot to the existing one\n/cl.botitems reset - replace old loot with a new one", ["XD_IVENT_CLBOT_ITEM_ADDED"] = "You have successfully added new items for the npc.\nBe sure to configure them in the config", ["XD_IVENT_CLBOT_ITEM_REPLACED"] = "You have successfully replaced all items with new ones.\nBe sure to configure them in the config", ["XD_IVENT_CLCONTROLLER_SYNTAX"] = "Use:\n/cl start - Launching the event ahead of schedule\n/cl stop - cancel the event ahead of schedule", ["XD_IVENT_CLCONTROLLER_ACTIVE"] = "The event is already active!", ["XD_IVENT_CLCONTROLLER_STOPADMIN"] = "Event ended ahead of schedule by the administrator!", ["XD_IVENT_CLCONTROLLER_NOT_ACTIVE"] = "No active events", ["XD_IVENT_CLCONTROLLER_NOT_ENOUGH_PLAYERS"] = "Not enough players to start the event!", ["XD_IVENT_CLCONTROLLER_BUILDING_ERROR"] = "Error #1 \nThe building could not spawn\nContact the developer\nDezLife#1480\nvk.com/dezlife", ["XD_IVENT_CLCONTROLLER_NOT_BUILDING_BOX"] = "Error #3,No crate found in the building", ["XD_IVENT_CLCONTROLLER_THE_POINTS_ARE_ENDED"] = "All points are completed!\nWe start generating new...", ["XD_IVENT_CLCONTROLLER_LOADING_THE_CONSTRUCTION"] = "Building file not found!\nWe start to import...", ["XD_IVENT_CLCONTROLLER_CONSTRUCTION_LOADED"] = "The building has been loaded successfully!", ["XD_IVENT_CLCONTROLLER_ERROR_DOWNLOADING"] = "Error when loading a building!\nTrying to download again", ["XD_IVENT_CLCONTROLLER_ERROR_KEYAUTH"] = "The plugin did not pass the authentication on the server!\nCheck the plugin version or contact the developer\nDezLife#1480\nvk.com/dezlife", ["XD_IVENT_CLCONTROLLER_RETAINED_UPLOAD_ERROR"] = "Reload was not successful\nContact the developer\nDezLife#1480\nvk.com/dezlife", ["XD_IVENT_CLCONTROLLER_HELI_HELP"] = "<color=#008000>[Cobalt Lab Event] </color>Inside the box was a trap with a signal to the Cobalt security service.\nA battle helicopter flew to protect the box\nYou need to shoot it down or survive for 5 minutes", ["XD_IVENT_CLCONTROLLER_ENTER_PVP"] = "You <color=#ce3f27>entered</color> In the PVP zone, now other players <color=#ce3f27>can</color> do damage to you!", ["XD_IVENT_CLCONTROLLER_EXIT_PVP"] = "You <color=#738d43>exited</color> from the PVP zone, now other players <color=#738d43>can not</color> do damage to you!", ["XD_IVENT_CLCONTROLLER_NOT_NPSSPAWN"] = "You are missing the Npc Spawn plugin.Please install it to work correctly",
            }
            , this);
        }
#endregion
#region Data
        private void LoadDataCopyPaste(Boolean repeat = false) {
            if (!Interface.Oxide.DataFileSystem.ExistsDatafile("copypaste/HouseCobalt")) {
                PrintWarning(GetLang("XD_IVENT_CLCONTROLLER_LOADING_THE_CONSTRUCTION"));
                webrequest.Enqueue($"https://xdquest.skyplugins.ru/api/getbuildinglab/vn4n5n88V34NMnm34", null, (code, response) => {
                    switch (code) {
                        case 200 : {
                            PasteData obj = JsonConvert.DeserializeObject<PasteData>(response);
                            Interface.Oxide.DataFileSystem.WriteObject("copypaste/HouseCobalt", obj);
                            PrintWarning(GetLang("XD_IVENT_CLCONTROLLER_CONSTRUCTION_LOADED"));
                            break;
                        }
                        case 502 : {
                            PrintError(GetLang("XD_IVENT_CLCONTROLLER_ERROR_KEYAUTH"));
                            break;
                        }
                        default : {
                            if (!repeat) {
                                PrintError(GetLang("XD_IVENT_CLCONTROLLER_ERROR_DOWNLOADING"));
                                timer.Once(10f, () => LoadDataCopyPaste(true));
                            }
                            else {
                                PrintError(GetLang("XD_IVENT_CLCONTROLLER_RETAINED_UPLOAD_ERROR"));
                            }
                            return;
                        }
                    }
                }
                , this, RequestMethod.GET);
            }
        }
        public class PasteData {
            public Dictionary<string, object> @default;
            public ICollection<Dictionary<string, object>> entities;
            public Dictionary<string, object> protocol;
        }
#endregion
#region Configuration
        public class LootNpcOrBox {
            [JsonProperty("ShortName")]
            public string Shortname;
            [JsonProperty("SkinID")]
            public ulong SkinID;
            [JsonProperty(Ru ? "Имя предмета" : "Item name")]
            public string DisplayName;
            [JsonProperty(Ru ? "Чертеж?" : "BluePrint")]
            public bool BluePrint;
            [JsonProperty(Ru ? "Минимальное количество" : "Minimal amount")]
            public int MinimalAmount;
            [JsonProperty(Ru ? "Максимальное количество" : "Maximum amount")]
            public int MaximumAmount;
            [JsonProperty(Ru ? "Шанс выпадения предмета" : "Item drop chance")]
            public int DropChance;
            [JsonProperty(Ru ? "Умножать этот предмета на день вайпа ?" : "Multiply this item by wipe day?")]
            public bool wipeCheck;
        }
        private Configuration config;
        private class Configuration {
            [JsonProperty(Ru ? "Настройка запуска и остановки ивента" : "Setting up and stopping an event")]
            public IventController iventController = new IventController();
            [JsonProperty(Ru ? "Настройка уведомлений" : "Configuring notifications")]
            public NotiferSettings notiferSettings = new NotiferSettings();
            [JsonProperty(Ru ? "Настройка радиации в зоне ивента" : "Setting up radiation in the event area")]
            public RadiationConroller radiationConroller = new RadiationConroller();
            [JsonProperty(Ru ? "Отображения ивента на картах" : "Event display on maps")]
            public MapMarkers mapMarkers = new MapMarkers();
            [JsonProperty(Ru ? "Настройка постройки для ивента (CopyPaste) и нпс" : "Setting up buildings for the event (Copypaste) and NPCs")]
            public BuildingPasteSettings pasteSettings = new BuildingPasteSettings();
            [JsonProperty(Ru ? "Настройка лута NPC" : "NPC loot setup")]
            public NpcLootController npcLootController = new NpcLootController();
            [JsonProperty(Ru ? "Настройка ящика" : "Customizing the box")]
            public BoxSetting boxSetting = new BoxSetting();
            [JsonProperty(Ru ? "Награда в виде команды, игроку который 1 открыл груз" : "Reward in the form of a team to the player who 1 opened the cargo")]
            public CommandReward commandReward = new CommandReward();
            [JsonProperty(Ru ? "Настройка подбора позиций для спавна (Для опытных пользователей)" : "Setting up the selection of positions for spawn (For experienced users)")]
            public SpawnPositionGenerateSetting spawnPositionGenerateSetting = new SpawnPositionGenerateSetting();
            internal class RadiationConroller {
                [JsonProperty(Ru ? "Включить радиацию ?" : "Turn on radiation?")]
                public bool radUse = true;
                [JsonProperty(Ru ? "Количество радиационных частиц" : "Number of radiation particles")]
                public int radCount = 20;
                [JsonProperty(Ru ? "Радиус зоны поражения (Не более чем радиус обноружения игроков)" : "Radius of the affected area (No more than the radius of detection of players)")]
                public int radRadius = 20;
            }
            internal class SpawnPositionGenerateSetting {
                [JsonProperty(Ru ? "Разрешить спавн на дорогах ?" : "Allow spawn on the roads ?")]
                public bool spawnOnRoad = true;
                [JsonProperty(Ru ? "Разрешить спавн на реках ?" : "Allow spawn on rivers ?")]
                public bool spawnOnRiver = true;
                [JsonProperty(Ru ? "Радиус обноружения монументов" : "Radius of monument detection")]
                public float monumentFindRadius = 40f;
                [JsonProperty(Ru ? "Радиус обноружения шкафов (Building Block)" : "Detection radius of the tool cupboard (Building Block)")]
                public float buildingBlockFindRadius = 90f;
            }
            public class CommandReward {
                [JsonProperty(Ru ? "Список команд, которые выполняются в консоли (%STEAMID% - игрок который залутает ящик )" : "List of commands that are executed in the console (%STEAMID% - the player who looted the box)")]
                public List<string> Commands = new List<string>();
                [JsonProperty(Ru ? "Сообщения который игрок получит (Здесь можно написать о том , что получил игрок)" : "Messages that the player will receive (Here you can write about what the player received)")]
                public string MessagePlayerReward = "";
            }
            internal class MapMarkers {
                [JsonProperty(Ru ? "Отметить ивент на карте G (Требуется https://umod.org/plugins/marker-manager)" : "Mark the event on the G card (Requires FREE https://umod.org/plugins/marker-manager)")]
                public bool MapUse = true;
                [JsonProperty(Ru ? "Текст для карты G" : "Text for map G")]
                public string MapTxt = "Cobalt lab";
                [JsonProperty(Ru ? "Цвет маркера (без #)" : "Marker color (without #)")]
                public String colorMarker = "f3ecad";
                [JsonProperty(Ru ? "Цвет обводки (без #)" : "Outline color (without #)")]
                public String colorOutline = "ff3535";
            }
            internal class IventController {
                [JsonProperty(Ru ? "Минимальное количество игроков для запуска ивента" : "The minimum number of players to start an event")]
                public int minPlayedPlayers = 0;
                [JsonProperty(Ru ? "Время до начала ивента (Минимальное в секундах)" : "Time before the start of the event (Minimum in seconds)")]
                public int minSpawnIvent = 3000;
                [JsonProperty(Ru ? "Время до начала ивента (Максимальное в секундах)" : "Time before the start of the event (Maximum in seconds)")]
                public int maxSpawnIvent = 7200;
                [JsonProperty(Ru ? "Время до удаления ивента если никто не откроет ящик (Секунды)" : "Time until the event is deleted if no one opens the box (Seconds)")]
                public int timeRemoveHouse = 900;
                [JsonProperty(Ru ? "Время до удаления ивента после того как разблокируется ящик" : "The time until the event is deleted after the box is unlocked")]
                public int timeRemoveHouse2 = 300;
                [JsonProperty(Ru ? "Создавать PVP зону в радиусе ивента ? (Требуется TruePVE)" : "Create a PVP zone within the radius of the event? (Requires TruePVE)")]
                public bool UseZonePVP = false;
                [JsonProperty(Ru ? "Используете ли вы купол" : "Do you use a dome ?")]
                public bool useSphere = false;
                [JsonProperty(Ru ? "Прозрачность купола (чем меньше число тем более он прозрачный.Значения должно быть не более 5)" : "Transparency of the dome (the smaller the number, the more transparent it is.The values should be no more than 5)")]
                public int transperent = 3;
            }
            internal class NpcLootController {
                [JsonProperty(Ru ? "Использовать свой лут в нпс ?" : "Use your loot in NPCs?")]
                public bool useCustomLoot = true;
                [JsonProperty(Ru ? "Настройка лута в NPC (Если выключенно то будет стандартный) /cl.botitems" : "Setting up loot in NPC (if disabled, it will be standard) /cl.botitems")]
                public List<LootNpcOrBox> lootNpcs = new List<LootNpcOrBox>();
                internal class ItemNpc {
                    [JsonProperty("ShortName")]
                    public string ShortName;
                    [JsonProperty("Amount")]
                    public int Amount;
                    [JsonProperty("SkinID (0 - default)")]
                    public ulong SkinID;
                }
            }
            internal class BuildingPasteSettings {
                [JsonProperty(Ru ? "Постройки для спавна.(Если более 1 то выбирается рандомная)" : "Spawn buildings.(If more than 1 then random is selected)")]
                public List<PasteBuild> pasteBuilds = new List<PasteBuild>();
                internal class PasteBuild {
                    [JsonProperty(Ru ? "Настройка высоты постройки (Требуется в настройке, если вы хотите ставить свою постройку)" : "Setting the height of the building (Required in the setting if you want to place your building)")]
                    public int heightBuilding;
                    [JsonProperty(Ru ? "файл в папке /oxide/data/copypaste с вашей постройкой(Если не указать загрузится стандартная)" : "file in the folder /oxide/data/ copypaste with your building (If you do not specify the standard will be loaded)")]
                    public string housepath;
                    [JsonProperty(Ru ? "Колличевство NPC" : "Number of NPCs")]
                    public int countSpawnNpc;
                    [JsonProperty(Ru ? "Спавнить ли подмогу после взлома ящика ? (НПС)" : "Should I spawn help after breaking the box? (NPC)")]
                    public bool helpBot;
                    [JsonProperty(Ru ? "Колличевство нпс (Подмога)" : "Number of NPCs (Help)")]
                    public int helpCount;
                    [JsonProperty(Ru ? "Возможность вылета вертолета в качевстве подмоги" : "The possibility of a helicopter departure as an aid")]
                    public Boolean heliHelp;
                    [JsonProperty(Ru ? "Шанс вылета вертолета(0% - 100%)" : "Helicopter departure chance (0% - 100%)")]
                    public int ChanceHeliHelp;
                    [JsonProperty(Ru ? "Шанс спавна коптера (Если присутствует в постройке)" : "Copter spawn chance (if present in a building)")]
                    public int copterChance;
                    [JsonProperty(Ru ? "Настройка NPC" : "NPC setup")]
                    public NpcConfig npcController = new NpcConfig();
                }
                internal class NpcConfig {
                    [JsonProperty(Ru ? "Рандомные ники нпс" : "Random nicknames npc", ObjectCreationHandling = ObjectCreationHandling.Replace)]
                    public List<string> nameNPC = new List<string> {
                        "Cobalt guard", "Cobalt defense"
                    }
                    ;
                    [JsonProperty(Ru ? "Одежда" : "Wear items", ObjectCreationHandling = ObjectCreationHandling.Replace)]
                    public List<ItemNpc> WearItems = new List<ItemNpc> {
                        new ItemNpc {
                            ShortName = "roadsign.kilt", SkinID = 1121447954, Amount = 1
                        }
                        , new ItemNpc {
                            ShortName = "burlap.shirt", SkinID = 2076298726, Amount = 1
                        }
                        , new ItemNpc {
                            ShortName = "shoes.boots", SkinID = 0, Amount = 1
                        }
                        , new ItemNpc {
                            ShortName = "roadsign.gloves", SkinID = 0, Amount = 1
                        }
                        , new ItemNpc {
                            ShortName = "burlap.trousers", SkinID = 2076292007, Amount = 1
                        }
                        , new ItemNpc {
                            ShortName = "metal.facemask", SkinID = 835028125, Amount = 1
                        }
                        ,
                    }
                    ;
                    [JsonProperty(Ru ? "Быстрые слоты" : "Belt items", ObjectCreationHandling = ObjectCreationHandling.Replace)]
                    public List<NpcBelt> BeltItems = new List<NpcBelt> {
                        new NpcBelt {
                            ShortName = "rifle.lr300", SkinID = 1837473292, Amount = 1, Mods = new List<string> {
                                "weapon.mod.flashlight"
                            }
                        }
                        , new NpcBelt {
                            ShortName = "pistol.semiauto", SkinID = 1557105240, Amount = 1, Mods = new List<string>()
                        }
                        , new NpcBelt {
                            ShortName = "grenade.smoke", SkinID = 0, Amount = 2, Mods = new List<string>()
                        }
                        , new NpcBelt {
                            ShortName = "grenade.f1", SkinID = 0, Amount = 3, Mods = new List<string>()
                        }
                        , new NpcBelt {
                            ShortName = "syringe.medical", SkinID = 0, Amount = 5, Mods = new List<string>()
                        }
                        ,
                    }
                    ;
                    [JsonProperty(Ru ? "Кит" : "Kit")]
                    public string Kit = "";
                    [JsonProperty(Ru ? "Кол-во ХП" : "Health")]
                    public float Health = 150f;
                    [JsonProperty(Ru ? "Дальность патрулирования местности" : "Roam Range")]
                    public float RoamRange = 30f;
                    [JsonProperty(Ru ? "Дальность погони за целью" : "Chase Range")]
                    public float ChaseRange = 90f;
                    [JsonProperty(Ru ? "Множитель радиуса атаки" : "Attack Range Multiplier")]
                    public float AttackRangeMultiplier = 2f;
                    [JsonProperty(Ru ? "Радиус обнаружения цели" : "Sense Range")]
                    public float SenseRange = 50f;
                    [JsonProperty(Ru ? "Время которое npc будет помнить цель (секунды)" : "Target Memory Duration [sec.]")]
                    public float targetDuration = 300f;
                    [JsonProperty(Ru ? "Множитель урона" : "Scale damage")]
                    public float DamageScale = 1f;
                    [JsonProperty(Ru ? "Множитель разброса" : "Aim Cone Scale")]
                    public float AimConeScale = 1f;
                    [JsonProperty(Ru ? "Обнаруживать цель только в углу обзора NPC?" : "Detect the target only in the NPC's viewing vision cone?")]
                    public bool CheckVisionCone = false;
                    [JsonProperty(Ru ? "Угол обзора" : "Vision Cone")]
                    public float VisionCone = 135f;
                    [JsonProperty(Ru ? "Скорость" : "Speed")]
                    public float speed = 7f;
                    [JsonProperty(Ru ? "Отключить радио эфект ?" : "Disable radio effects?")]
                    public bool radioEffect = true;
                    internal class ItemNpc {
                        [JsonProperty("ShortName")]
                        public string ShortName;
                        [JsonProperty("Amount")]
                        public int Amount;
                        [JsonProperty("SkinID (0 - default)")]
                        public ulong SkinID;
                    }
                    internal class NpcBelt {
                        [JsonProperty("ShortName")]
                        public string ShortName;
                        [JsonProperty("Amount")]
                        public int Amount;
                        [JsonProperty("SkinID (0 - default)")]
                        public ulong SkinID;
                        [JsonProperty("Mods")]
                        public List<string> Mods = new List<string>();
                    }
                }
            }
            internal class BoxSetting {
                [JsonProperty(Ru ? "Настройка лута в ящике /cl.items" : "Loot setting in the box /cl.items")]
                public List<LootNpcOrBox> lootBoxes = new List<LootNpcOrBox>();
                [JsonProperty(Ru ? "Время разблокировки ящика (Сек)" : "Box unlocking time (Sec)")]
                public int unBlockTime = 900;
                [JsonProperty(Ru ? "Минимальное количество предметов в ящике" : "Minimal number of items in a drawer")]
                public int minItemCount = 5;
                [JsonProperty(Ru ? "Макcимальное количество предметов в ящике" : "Maximum number of items in a drawer")]
                public int maxItemCount = 10;
                [JsonProperty(Ru ? "умножать количество лута на количество дней с начала вайпа (на 3й день - лута будет в 3 раза больше)" : "multiply the amount of loot by the number of days since the start of the wipe (on the 3rd day - there will be 3 times more loot)")]
                public bool lootWipePlus = false;
                [JsonProperty(Ru ? "Включить сигнализацию ?" : "Turn on the alarm?")]
                public bool signaling = true;
                [JsonProperty(Ru ? "Использовать AlphaLoot для заполнения ящика ?" : "Use AlphaLoot to fill the box?")]
                public bool AlphaLootUse = false;
                [JsonProperty(Ru ? "Использовать EcoLootUI для заполнения ящика ?" : "Use EcoLootUI to fill the box?")]
                public bool EcoLootUIUse = false;
            }
            internal class NotiferSettings {
                [JsonProperty(Ru ? "ВебХук дискорда (Если не нужны уведомления в дискорд, оставьте поле пустым)" : "Discord WebHook (If you do not need discord notifications, leave the field blank)")]
                public string weebHook = string.Empty;
                [JsonProperty(Ru ? "Включить UI Уведомления ?" : "Enable UI Notifications?")]
                public bool useUiNotifi = true;
                [JsonProperty(Ru ? "Скрывать автоматически UI уведомления?" : "Auto hide UI notifications?")]
                public bool hideUiNotifi = true;
                [JsonProperty(Ru ? "Через сколько после показа будет скрываться? (сек)" : "How long after the show will it hide? (sec)")]
                public float hideUiNotifiTime = 15f;
                [JsonProperty(Ru ? "Цвет заднего фона окна UI" : "UI window background color")]
                public string colorBackground = "0.8 0.28 0.2 0.8";
                [JsonProperty(Ru ? "Цвет Кнопки закрытия UI" : "UI Close Button Color")]
                public string colorBtnCloseUi = "0.6784314 0.254902 0.1843137 0.8";
            }
        }
        protected override void LoadConfig() {
            base.LoadConfig();
            try {
                config = Config.ReadObject<Configuration>();
                if (config == null) throw new Exception();
                SaveConfig();
            }
            catch {
                for (var i = 0; i < 3; i++) PrintError("Configuration file is corrupt! Check your config file at https://jsonlint.com/");
                LoadDefaultConfig();
            }
            ValidateConfig();
            SaveConfig();
        }
        private void ValidateConfig() {
            if (config.pasteSettings.pasteBuilds.Count == 0) {
                config.pasteSettings.pasteBuilds = new List<Configuration.BuildingPasteSettings.PasteBuild> {
                    new Configuration.BuildingPasteSettings.PasteBuild {
                        housepath = "", heightBuilding = 0, countSpawnNpc = 8, helpBot = true, helpCount = 4, heliHelp = true, ChanceHeliHelp = 50, copterChance = 50, npcController = new Configuration.BuildingPasteSettings.NpcConfig()
                    }
                }
                ;
            }
            if (config.npcLootController.lootNpcs.Count == 0) {
                config.npcLootController.lootNpcs = new List<LootNpcOrBox> {
                    new LootNpcOrBox {
                        Shortname = "halloween.surgeonsuit", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 70
                    }
                    , new LootNpcOrBox {
                        Shortname = "metal.facemask", SkinID = 1886184322, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 20
                    }
                    , new LootNpcOrBox {
                        Shortname = "door.double.hinged.metal", SkinID = 19110, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 2, DropChance = 60
                    }
                    , new LootNpcOrBox {
                        Shortname = "rifle.bolt", SkinID = 0, DisplayName = "", BluePrint = true, MinimalAmount = 1, MaximumAmount = 1, DropChance = 10
                    }
                    , new LootNpcOrBox {
                        Shortname = "rifle.lr300", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 15
                    }
                    , new LootNpcOrBox {
                        Shortname = "pistol.revolver", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 3, DropChance = 60
                    }
                    , new LootNpcOrBox {
                        Shortname = "supply.signal", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 3, DropChance = 20
                    }
                    , new LootNpcOrBox {
                        Shortname = "explosive.satchel", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 3, DropChance = 5
                    }
                    , new LootNpcOrBox {
                        Shortname = "grenade.smoke", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 20, DropChance = 45
                    }
                    , new LootNpcOrBox {
                        Shortname = "ammo.rifle", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 50, MaximumAmount = 120, DropChance = 35
                    }
                    , new LootNpcOrBox {
                        Shortname = "scrap", SkinID = 0, DisplayName = "", BluePrint = false, MinimalAmount = 100, MaximumAmount = 500, DropChance = 20
                    }
                    , new LootNpcOrBox {
                        Shortname = "giantcandycanedecor", SkinID = 0, DisplayName = "Новый год", BluePrint = false, MinimalAmount = 1, MaximumAmount = 5, DropChance = 70
                    }
                    ,
                }
                ;
            }
            if (config.boxSetting.lootBoxes.Count == 0) {
                config.boxSetting.lootBoxes = new List<LootNpcOrBox> {
                    new LootNpcOrBox {
                        Shortname = "pistol.python", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 60, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "multiplegrenadelauncher", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 15, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "sulfur", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 500, MaximumAmount = 800, DropChance = 40, wipeCheck = true
                    }
                    , new LootNpcOrBox {
                        Shortname = "gunpowder", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 300, MaximumAmount = 400, DropChance = 10, wipeCheck = true
                    }
                    , new LootNpcOrBox {
                        Shortname = "door.hinged.toptier", SkinID = 0UL, DisplayName = "", BluePrint = true, MinimalAmount = 1, MaximumAmount = 1, DropChance = 15, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "wall.external.high.ice", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 5, DropChance = 75, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "ammo.rocket.basic", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 3, DropChance = 25, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "ammo.grenadelauncher.smoke", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 3, MaximumAmount = 10, DropChance = 70, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "ammo.grenadelauncher.he", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 2, MaximumAmount = 5, DropChance = 10, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "metal.facemask", SkinID = 0UL, DisplayName = "", BluePrint = true, MinimalAmount = 1, MaximumAmount = 1, DropChance = 15, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "metal.plate.torso", SkinID = 0UL, DisplayName = "", BluePrint = true, MinimalAmount = 1, MaximumAmount = 1, DropChance = 10, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "clatter.helmet", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 70, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "carburetor3", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 20, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "crankshaft3", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 10, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "techparts", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 5, MaximumAmount = 15, DropChance = 35, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "xmas.lightstring.advanced", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 30, MaximumAmount = 70, DropChance = 45, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "largemedkit", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 3, MaximumAmount = 5, DropChance = 70, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "largemedkit", SkinID = 0UL, DisplayName = "", BluePrint = true, MinimalAmount = 3, MaximumAmount = 5, DropChance = 70, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "metal.fragments", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1000, MaximumAmount = 2000, DropChance = 70, wipeCheck = true
                    }
                    , new LootNpcOrBox {
                        Shortname = "explosives", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 10, MaximumAmount = 50, DropChance = 30, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "autoturret", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 60, wipeCheck = false
                    }
                    , new LootNpcOrBox {
                        Shortname = "explosive.timed", SkinID = 0UL, DisplayName = "", BluePrint = false, MinimalAmount = 1, MaximumAmount = 1, DropChance = 5, wipeCheck = true
                    }
                    ,
                }
                ;
            }
        }
        protected override void SaveConfig() {
            Config.WriteObject(config);
        }
        protected override void LoadDefaultConfig() {
            config = new Configuration();
        }
#endregion
#region SpawnPoint
#region CheckFlat
        private List<Vector3>[] patternPositionsAboveWater = new List<Vector3>[MaxRadius];
        private List<Vector3>[] patternPositionsUnderWater = new List<Vector3>[MaxRadius];
        private const float MaxElevation = 2.5f;
        private readonly Quaternion[] directions = {
            Quaternion.Euler(90, 0, 0), Quaternion.Euler(0, 0, 90), Quaternion.Euler(0, 0, 180)
        }
        ;
        private void FillPatterns() {
            Vector3[] startPositions = {
                new Vector3(1, 0, 1), new Vector3(-1, 0, 1), new Vector3(-1, 0, -1), new Vector3(1, 0, -1)
            }
            ;
            patternPositionsAboveWater[0] = new List<Vector3> {
                new Vector3(0, MaxElevation, 0)
            }
            ;
            for (int loop = 1; loop < MaxRadius; loop++) {
                patternPositionsAboveWater[loop] = new List<Vector3>();
                for (int step = 0; step < loop * 2; step++) {
                    for (int pos = 0; pos < 4; pos++) {
                        Vector3 sPos = startPositions[pos] * step;
                        for (int rot = 0; rot < 3; rot++) {
                            Vector3 rPos = directions[rot] * sPos;
                            rPos.y = -MaxElevation;
                            patternPositionsAboveWater[loop].Add(rPos);
                        }
                    }
                }
            }
            for (int i = 0; i < patternPositionsAboveWater.Length; i++) {
                patternPositionsUnderWater[i] = new List<Vector3>();
                foreach (var vPos in patternPositionsAboveWater[i]) {
                    var rPos = new Vector3(vPos.x, MaxElevation, vPos.z);
                    patternPositionsUnderWater[i].Add(rPos);
                }
            }
        }
        [ConsoleCommand("isflat")]
        private void CmdIsFlat(ConsoleSystem.Arg arg) {
            Vector3 pPos = new Vector3(arg.Player().transform.position.x, TerrainMeta.HeightMap.GetHeight(arg.Player().transform.position), arg.Player().transform.position.z);
            var b = IsFlat(ref pPos);
            arg.Player().Teleport(pPos);
        }
        public bool IsFlat(ref Vector3 position) {
            List<Vector3>[] AboveWater = new List<Vector3>[MaxRadius];
            Array.Copy(patternPositionsAboveWater, AboveWater, patternPositionsAboveWater.Length);
            for (int i = 0; i < AboveWater.Length; i++) {
                for (int j = 0; j < AboveWater[i].Count; j++) {
                    Vector3 pPos = AboveWater[i][j];
                    Vector3 resultAbovePos = new Vector3(pPos.x + position.x, position.y + MaxElevation, pPos.z + position.z);
                    Vector3 resultUnderPos = new Vector3(pPos.x + position.x, position.y - MaxElevation, pPos.z + position.z);
                    if (resultAbovePos.y >= TerrainMeta.HeightMap.GetHeight(resultAbovePos) && resultUnderPos.y <= TerrainMeta.HeightMap.GetHeight(resultUnderPos)) {
                    }
                    else return false;
                }
            }
            return true;
        }
#endregion
#region GenerateSpawnPoint
        private Coroutine FindPositions;
        private void PosValidation(Vector3 pos) {
            if (!IsFlat(ref pos)) return;
            if (TerrainMeta.WaterMap.GetHeight(pos) - TerrainMeta.HeightMap.GetHeight(pos) > 0.5f) return;
            if (!Is3DPointValid(pos, 1 << 8 | 1 << 16 | 1 << 18)) return;
            if (!config.spawnPositionGenerateSetting.spawnOnRiver && ContainsTopology(TerrainTopology.Enum.River | TerrainTopology.Enum.Riverside, pos, 12.5f)) return;
            if (!config.spawnPositionGenerateSetting.spawnOnRoad && ContainsTopology(TerrainTopology.Enum.Road | TerrainTopology.Enum.Roadside, pos, 12.5f)) return;
            if (ContainsTopology(TerrainTopology.Enum.Monument, pos, config.spawnPositionGenerateSetting.monumentFindRadius)) return;
            if (ContainsTopology(TerrainTopology.Enum.Building, pos, 25f)) return;
            if (pos != Vector3.zero) {
                AcceptValue(ref pos);
            }
        }
        private IEnumerator GenerateSpawnPoints() {
            int minPos = (int)(World.Size / -2f);
            int maxPos = (int)(World.Size / 2f);
            int checks = 0;
            
// ... [Code preview truncated due to length. Full source in attached file] ...

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

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

Сверху