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

FREE XDCobaltLaboratory : 2.5.6 2.5.6

Нет прав для скачивания
C#:
using Oxide.Game.Rust.Cui;
using Oxide.Core.Libraries;
using Oxide.Core;
using System.Text;
using Rust;
using Random = Oxide.Core.Random;
using System.Collections.Generic;
using System;
using System.Collections;
using UnityEngine;
using Oxide.Plugins.XDCobaltLaboratoryExtensionMethods;
using System.Globalization;
using Oxide.Core.Plugins;
using Newtonsoft.Json;
using Facepunch;
using Newtonsoft.Json.Linq;
using Network;
namespace Oxide.Plugins.XDCobaltLaboratoryExtensionMethods {
    public static class ExtensionMethods {
        public static bool Any<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) {
            using (IEnumerator<TSource> enumerator = source.GetEnumerator()) {
                while (enumerator.MoveNext()) {
                    if (predicate(enumerator.Current)) {
                        return true;
                    }
                }
            }
            return false;
        }
        public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) {
            using (IEnumerator<TSource> enumerator = source.GetEnumerator()) {
                while (enumerator.MoveNext()) {
                    if (predicate(enumerator.Current)) {
                        return enumerator.Current;
                    }
                }
            }
            return default(TSource);
        }
        public static HashSet<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> predicate) {
            HashSet<TResult> result = new HashSet<TResult>();
            using (IEnumerator<TSource> enumerator = source.GetEnumerator()) {
                while (enumerator.MoveNext()) {
                    result.Add(predicate(enumerator.Current));
                }
            }
            return result;
        }
        public static List<TResult> Select<TSource, TResult>(this IList<TSource> source, Func<TSource, TResult> predicate) {
            List<TResult> result = new List<TResult>();
            for (int i = 0; i < source.Count; i++) {
                TSource element = source[i];
                result.Add(predicate(element));
            }
            return result;
        }
        public static List<TSource> ToList<TSource>(this IEnumerable<TSource> source) {
            List<TSource> result = new List<TSource>();
            using (IEnumerator<TSource> enumerator = source.GetEnumerator()) {
                while (enumerator.MoveNext()) {
                    result.Add(enumerator.Current);
                }
            }
            return result;
        }
        public static TSource Min<TSource>(this IEnumerable<TSource> source, Func<TSource, float> predicate) {
            TSource result = source.ElementAt(0);
            float resultValue = predicate(result);
            using (IEnumerator<TSource> enumerator = source.GetEnumerator()) {
                while (enumerator.MoveNext()) {
                    TSource element = enumerator.Current;
                    float elementValue = predicate(element);
                    if (elementValue < resultValue) {
                        result = element;
                        resultValue = elementValue;
                    }
                }
            }
            return result;
        }
        public static TSource ElementAt<TSource>(this IEnumerable<TSource> source, int index) {
            int movements = 0;
            using (IEnumerator<TSource> enumerator = source.GetEnumerator()) {
                while (enumerator.MoveNext()) {
                    if (movements == index) {
                        return enumerator.Current;
                    }
                    movements++;
                }
            }
            return default(TSource);
        }
    }
}
namespace Oxide.Plugins {
    [Info("XDCobaltLaboratory", "DezLife", "2.5.6")]
    internal class XDCobaltLaboratory : RustPlugin {
        private HackableLockedCrate CrateEnt;
        private Configuration config;
        static float GetGroundPosition(Vector3 pos) {
            float y = TerrainMeta.HeightMap.GetHeight(pos);
            RaycastHit hit;
            if (Physics.Raycast(new Vector3(pos.x, pos.y + 200f, pos.z), Vector3.down, out hit, Mathf.Infinity, LayerMask.GetMask(new[] {
                "Terrain", "World", "Default", "Construction", "Deployed"
            }
            )) && !hit.collider.name.Contains("rock_cliff")) {
                return Mathf.Max(hit.point.y, y);
            }
            return y;
        }
        private List<BaseEntity> HouseCobaltLab = new List<BaseEntity>();
        private void SendChatPlayer(string Message, BasePlayer player, ConVar.Chat.ChatChannel channel = ConVar.Chat.ChatChannel.Global) {
            if (IQChat) {
                IQChat?.Call("API_ALERT_PLAYER", player, Message);
            }
            else {
                player?.SendConsoleCommand("chat.add", channel, 0, Message);
            }
        }
        private const bool Ru = true;
        void Unsubscribes() {
            foreach (string hook in hooks) {
                Unsubscribe(hook);
            }
        }
        void Subscribes() {
            foreach (string hook in hooks) {
                if ((hook == "CanEntityTakeDamage" || hook == "OnEntityDeath") && !config.iventController.UseZonePVP) {
                    continue;
                }
                if (hook == "CanUILootSpawn" && config.boxSetting.TypeLootTable != 3) {
                    continue;
                }
                Subscribe(hook);
            }
        }
        private void ValidateConfig() {
            if (config.pasteSettings.pasteBuilds.Count == 0) {
                config.pasteSettings.pasteBuilds = new List<Configuration.BuildingPasteSettings.PasteBuild> {
                    new Configuration.BuildingPasteSettings.PasteBuild {
                        housepath = "HouseCobalt", heightBuilding = 0, copterChance = 50, NpcPressets = new HashSet<Configuration.BuildingPasteSettings.PresetConfig> {
                            new Configuration.BuildingPasteSettings.PresetConfig {
                                Min = 3, Max = 7, helpBot = true, helpCount = 3, Config = new Configuration.BuildingPasteSettings.NpcConfig {
                                    Name = "Cobalt Defense", Health = 230f, RoamRange = 35f, ChaseRange = 10f, AttackRangeMultiplier = 3f, SenseRange = 50f, MemoryDuration = 40f, DamageScale = 2f, AimConeScale = 1f, CheckVisionCone = false, VisionCone = 135f, Speed = 8f, DisableRadio = false, Stationary = false, IsRemoveCorpse = false, WearItems = new HashSet<Configuration.BuildingPasteSettings.NpcConfig.NpcWear> {
                                        new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "roadsign.kilt", SkinID = 1121447954
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "burlap.shirt", SkinID = 2076298726
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "shoes.boots", SkinID = 0
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "roadsign.gloves", SkinID = 0
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "burlap.trousers", SkinID = 2076292
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "metal.facemask", SkinID = 835028125
                                        }
                                    }
                                    , BeltItems = new HashSet<Configuration.BuildingPasteSettings.NpcConfig.NpcBelt> {
                                        new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "rifle.lr300", Amount = 1, SkinID = 1837473292, Mods = new HashSet<string> {
                                                "weapon.mod.flashlight"
                                            }
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "pistol.semiauto", Amount = 1, SkinID = 1557105240, Mods = new HashSet<string>()
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "syringe.medical", Amount = 10, SkinID = 0, Mods = new HashSet<string>()
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "grenade.smoke", Amount = 3, SkinID = 0, Mods = new HashSet<string>()
                                        }
                                    }
                                    , Kit = ""
                                }
                                , TypeLootTable = 1, OwnLootTable = new Configuration.LootTableConfig {
                                    Min = 1, Max = 1, UseCount = true, Items =new List<Configuration.ItemConfig> {
                                        new Configuration.ItemConfig {
                                            ShortName = "scrap", MinAmount = 5, MaxAmount = 10, Chance = 50f, IsBluePrint = false, SkinID = 0, Name = ""
                                        }
                                        , new Configuration.ItemConfig {
                                            ShortName = "supply.signal", MinAmount = 1, MaxAmount = 1, Chance = 20f, IsBluePrint = false, SkinID = 0, Name = ""
                                        }
                                        , new Configuration.ItemConfig {
                                            ShortName = "syringe.medical", MinAmount = 1, MaxAmount = 2, Chance = 70.0f, IsBluePrint = false, SkinID = 0, Name = ""
                                        }
                                    }
                                }
                            }
                            , new Configuration.BuildingPasteSettings.PresetConfig {
                                Min = 1, Max = 3, helpBot = false, helpCount = 0, Config = new Configuration.BuildingPasteSettings.NpcConfig {
                                    Name = "Cobalt Guard", Health = 150f, RoamRange = 30.0f, ChaseRange = 90f, AttackRangeMultiplier = 2.0f, SenseRange = 50.0f, MemoryDuration = 30f, DamageScale = 1f, AimConeScale = 1f, CheckVisionCone = false, VisionCone = 135f, Speed = 7f, DisableRadio = true, Stationary = false, IsRemoveCorpse = false, WearItems = new HashSet<Configuration.BuildingPasteSettings.NpcConfig.NpcWear> {
                                        new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "roadsign.kilt", SkinID = 1121447954
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "burlap.shirt", SkinID = 2076298726
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "shoes.boots", SkinID = 0
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "roadsign.gloves", SkinID = 0
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "burlap.trousers", SkinID = 2076292007
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcWear {
                                            ShortName = "metal.facemask", SkinID = 835028125
                                        }
                                    }
                                    , BeltItems = new HashSet<Configuration.BuildingPasteSettings.NpcConfig.NpcBelt> {
                                        new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "rifle.lr300", Amount = 1, SkinID = 1837473292, Mods = new HashSet<string> {
                                                "weapon.mod.flashlight"
                                            }
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "pistol.semiauto", Amount = 1, SkinID = 1557105240, Mods = new HashSet<string>()
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "syringe.medical", Amount = 10, SkinID = 0, Mods = new HashSet<string>()
                                        }
                                        , new Configuration.BuildingPasteSettings.NpcConfig.NpcBelt {
                                            ShortName = "grenade.f1", Amount = 3, SkinID = 0, Mods = new HashSet<string>()
                                        }
                                    }
                                    , Kit = ""
                                }
                                , TypeLootTable = 1, OwnLootTable = new Configuration.LootTableConfig {
                                    Min = 1, Max = 1, UseCount = true, Items =new List<Configuration.ItemConfig> {
                                        new Configuration.ItemConfig {
                                            ShortName = "scrap", MinAmount = 5, MaxAmount = 10, Chance = 50f, IsBluePrint = false, SkinID = 0, Name = ""
                                        }
                                        , new Configuration.ItemConfig {
                                            ShortName = "supply.signal", MinAmount = 1, MaxAmount = 1, Chance = 20f, IsBluePrint = false, SkinID = 0, Name = ""
                                        }
                                        , new Configuration.ItemConfig {
                                            ShortName = "syringe.medical", MinAmount = 1, MaxAmount = 2, Chance = 70.0f, IsBluePrint = false, SkinID = 0, Name = ""
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                ;
            }
            if (config.boxSetting.OwnLootTable.Items.Count == 0) {
                config.boxSetting.OwnLootTable.Items = new List<Configuration.ItemConfig> {
                    new Configuration.ItemConfig {
                        ShortName = "pistol.python", SkinID = 0, Name = "", IsBluePrint = false, MinAmount = 1, MaxAmount = 1, Chance = 60,
                    }
                    , new Configuration.ItemConfig {
                        ShortName = "multiplegrenadelauncher", SkinID = 0, Name = "", IsBluePrint = false, MinAmount = 1, MaxAmount = 1, Chance = 15,
                    }
                    , new Configuration.ItemConfig {
                        ShortName = "sulfur", SkinID = 0, Name = "", IsBluePrint = false, MinAmount = 500, MaxAmount = 800, Chance = 40,
                    }
                    , new Configuration.ItemConfig {
                        ShortName = "wall.external.high.ice", SkinID = 0, Name = "", IsBluePrint = false, MinAmount = 1, MaxAmount = 5, Chance = 75,
                    }
                    ,
                }
                ;
            }
        }
        object CanUILootSpawn(LootContainer container) {
            if (container == null || CrateEnt == null) {
                return null;
            }
            if (container == CrateEnt) {
                if (config.boxSetting.TypeLootTable == 3) {
                    return null;
                }
                else {
                    return true;
                }
            }
            else {
                return null;
            }
        }
        private void LoadDataCopyPaste() {
            foreach (var building in config.pasteSettings.pasteBuilds) {
                if (!Interface.Oxide.DataFileSystem.ExistsDatafile("copypaste/" + building.housepath)) {
                    PrintError(GetLang("XD_EVENT_BUILDING_NOTFOUND", null, building.housepath));
                    NextTick(() => {
                        Interface.Oxide.UnloadPlugin(Name);
                    }
                    );
                    return;
                }
            }
        }
        private object GetSpawnPoints() {
            if (busyPoints3D.ToList().Count <= 3) {
                if (FindPositions == null) {
                    PrintWarning(GetLang("XD_IVENT_CLCONTROLLER_THE_POINTS_ARE_ENDED"));
                    busyPoints3D.Clear();
                    FindPositions = ServerMgr.Instance.StartCoroutine(GenerateSpawnPoints());
                    GenerateIvent();
                }
                return Vector3.zero;
            }
            Vector3 targetPos = busyPoints3D.ToList().GetRandom();
            if (targetPos == Vector3.zero) {
                busyPoints3D.Remove(targetPos);
                return GetSpawnPoints();
            }
            bool valid = Is3DPointValid(targetPos, 1 << 8 | 1 << 9 | 1 << 17 | 1 << 21);
            if (!valid || !HasBuildingPrivilege(targetPos, config.spawnPositionGenerateSetting.buildingBlockFindRadius)) {
                busyPoints3D.Remove(targetPos);
                return GetSpawnPoints();
            }
            busyPoints3D.Remove(targetPos);
            ClearArea(ref targetPos);
            return targetPos;
        }
        Vector3 RandomCircle(Vector3 center, float radius, int npcCount, int i) {
            float ang = 360 / npcCount * i;
            Vector3 pos;
            pos.x = center.x + radius * Mathf.Sin(ang * Mathf.Deg2Rad);
            pos.z = center.z + radius * Mathf.Cos(ang * Mathf.Deg2Rad);
            pos.y = center.y;
            pos.y = GetGroundPosition(pos);
            return pos;
        }
        private void OnCorpsePopulate(ScientistNPC entity, NPCPlayerCorpse corpse) {
            if (entity == null) {
                return;
            }
            if (npcs.Contains(entity)) {
                npcs.Remove(entity);
                Configuration.BuildingPasteSettings.PresetConfig preset = labIndex.NpcPressets.FirstOrDefault(x => x.Config.Name == entity.displayName);
                NextTick(() => {
                    if (corpse == null) {
                        return;
                    }
                    ItemContainer container = corpse.containers[0];
                    if (preset.TypeLootTable == 0) {
                        for (int i = container.itemList.Count - 1; i >= 0; i--) {
                            Item item = container.itemList[i];
                            if (preset.Config.WearItems.Any(x => x.ShortName == item.info.shortname)) {
                                item.RemoveFromContainer();
                                item.Remove();
                            }
                        }
                        return;
                    }
                    if (preset.TypeLootTable == 2) {
                        if (preset.Config.IsRemoveCorpse && !corpse.IsDestroyed) {
                            corpse.Kill();
                        }
                        return;
                    }
                    for (int i = container.itemList.Count - 1; i >= 0; i--) {
                        Item item = container.itemList[i];
                        item.RemoveFromContainer();
                        item.Remove();
                    }
                    if (preset.TypeLootTable == 1) {
                        AddToContainerItem(container, preset.OwnLootTable);
                    }
                    if (preset.Config.IsRemoveCorpse && !corpse.IsDestroyed) {
                        corpse.Kill();
                    }
                }
                );
            }
        }
        private readonly Quaternion[] directions = {
            Quaternion.Euler(90, 0, 0), Quaternion.Euler(0, 0, 90), Quaternion.Euler(0, 0, 180)
        }
        ;
        public class Fields {
            public string name {
                get;
                set;
            }
            public string value {
                get;
                set;
            }
            public bool inline {
                get;
                set;
            }
            public Fields(string name, string value, bool inline) {
                this.name = name;
                this.value = value;
                this.inline = inline;
            }
        }
        private class Configuration {
            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 RadiationConroller {
                [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;
                [JsonProperty(Ru ? "Включить радиацию ?" : "Turn on radiation?")]
                public bool radUse = true;
            }
            [JsonProperty(Ru ? "Настройка подбора позиций для спавна (Для опытных пользователей)" : "Setting up the selection of positions for spawn (For experienced users)")]
            public SpawnPositionGenerateSetting spawnPositionGenerateSetting = new SpawnPositionGenerateSetting();
            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 = "";
            }
            [JsonProperty(Ru ? "Настройка радиации в зоне ивента" : "Setting up radiation in the event area")]
            public RadiationConroller radiationConroller = new RadiationConroller();
            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";
            }
            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 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` с вашей постройкой" : "The names of the file in the folder `/oxide/data/copypaste` with your building")]
                    public string housepath;
                    [JsonProperty(Ru ? "Шанс спавна коптера (Если присутствует в постройке)" : "Copter spawn chance (if present in a building)")]
                    public int copterChance;
                    [JsonProperty(Ru ? "Настройка NPC" : "NPCs setting")]
                    public HashSet<PresetConfig> NpcPressets;
                }
                public class PresetConfig {
                    [JsonProperty(Ru ? "Минимальное кол-во" : "Minimum")]
                    public int Min;
                    [JsonProperty(Ru ? "Максимальное кол-во" : "Maximum")]
                    public int Max;
                    [JsonProperty(Ru ? "Появятся ли они в качестве помощи после взлома запертого ящика?" : "Will they spawn as help after hacking locked crate?")]
                    public bool helpBot;
                    [JsonProperty(Ru ? "Колличевство нпс (Подмога)" : "Number of NPCs (Help)")]
                    public int helpCount;
                    [JsonProperty(Ru ? "Настройки NPC" : "NPCs setting")]
                    public NpcConfig Config;
                    [JsonProperty(Ru ? "Какую таблицу предметов необходимо использовать? (0 - стандартную; 1 - собственную; 2 - AlphaLoot;" : "Which loot table should the plugin use? (0 - default; 1 - own; 2 - AlphaLoot;")]
                    public int TypeLootTable;
                    [JsonProperty(Ru ? "Собственная таблица предметов (если тип таблицы предметов - 1)" : "Own loot table (if the loot table type is 1)")]
                    public LootTableConfig OwnLootTable = new LootTableConfig();
                }
                internal class NpcConfig {
                    [JsonProperty(Ru ? "Название" : "Name")]
                    public string Name;
                    [JsonProperty(Ru ? "Кол-во ХП" : "Health")]
                    public float Health;
                    [JsonProperty(Ru ? "Дальность патрулирования местности" : "Roam Range")]
                    public float RoamRange;
                    [JsonProperty(Ru ? "Дальность погони за целью" : "Chase Range")]
                    public float ChaseRange;
                    [JsonProperty(Ru ? "Множитель радиуса атаки" : "Attack Range Multiplier")]
                    public float AttackRangeMultiplier;
                    [JsonProperty(Ru ? "Радиус обнаружения цели" : "Sense Range")]
                    public float SenseRange;
                    [JsonProperty(Ru ? "Длительность памяти цели [sec.]" : "Target Memory Duration [sec.]")]
                    public float MemoryDuration;
                    [JsonProperty(Ru ? "Множитель урона" : "Scale damage")]
                    public float DamageScale;
                    [JsonProperty(Ru ? "Множитель разброса" : "Aim Cone Scale")]
                    public float AimConeScale;
                    [JsonProperty(Ru ? "Обнаруживать цель только в углу обзора NPC? [true/false]" : "Detect the target only in the NPC's viewing vision cone? [true/false]")]
                    public bool CheckVisionCone;
                    [JsonProperty(Ru ? "Угол обзора" : "Vision Cone")]
                    public float VisionCone;
                    [JsonProperty(Ru ? "Скорость" : "Speed")]
                    public float Speed;
                    [JsonProperty(Ru ? "Отключать эффекты рации? [true/false]" : "Disable radio effects? [true/false]")]
                    public bool DisableRadio;
                    [JsonProperty(Ru ? "Это стационарный NPC? [true/false]" : "Is this a stationary NPC? [true/false]")]
                    public bool Stationary;
                    [JsonProperty(Ru ? "Удалять труп после смерти? (рекомендуется использовать значение true для повышения производительности) [true/false]" : "Remove a corpse after death? (it is recommended to use the true value to improve performance) [true/false]")]
                    public bool IsRemoveCorpse;
                    [JsonProperty(Ru ? "Одежда" : "Wear items")]
                    public HashSet<NpcWear> WearItems;
                    [JsonProperty(Ru ? "Быстрые слоты" : "Belt items")]
                    public HashSet<NpcBelt> BeltItems;
                    [JsonProperty(Ru ? "Kit" : "Kit")]
                    public string Kit;
                    internal class NpcBelt {
                        [JsonProperty("ShortName")]
                        public string ShortName;
                        [JsonProperty(Ru ? "Кол-во" : "Amount")]
                        public int Amount;
                        [JsonProperty("SkinID (0 - default)")]
                        public ulong SkinID;
                        [JsonProperty(Ru ? "Модификации на оружие" : "Mods")]
                        public HashSet<string> Mods;
                    }
                    internal class NpcWear {
                        [JsonProperty("ShortName")]
                        public string ShortName;
                        [JsonProperty("SkinID (0 - default)")]
                        public ulong SkinID;
                    }
                }
            }
            [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 ? "Отображения ивента на картах" : "Event display on maps")]
            public MapMarkers mapMarkers = new MapMarkers();
            [JsonProperty(Ru ? "Настройка ящика" : "Customizing the box")]
            public BoxSetting boxSetting = new BoxSetting();
            [JsonProperty(Ru ? "Настройка постройки для ивента (CopyPaste) и нпс" : "Setting up buildings for the event (Copypaste) and NPCs")]
            public BuildingPasteSettings pasteSettings = new BuildingPasteSettings();
            [JsonProperty(Ru ? "Настройка запуска и остановки ивента" : "Setting up and stopping an event")]
            public IventController iventController = new IventController();
            internal class BoxSetting {
                [JsonProperty(Ru ? "Время разблокировки ящиков [sec.]" : "Time to unlock the Crates [sec.]")]
                public float UnlockTime = 900f;
                [JsonProperty(Ru ? "Какую таблицу лута необходимо использовать? (0 - стандартную; 1 - собственную; 2 - AlphaLoot; 3 - EcoLootUI; " : "Which loot table should the plugin use? (0 - default; 1 - own; 2 - AlphaLoot; 3 - EcoLootUI;")]
                public int TypeLootTable = 0;
                [JsonProperty(Ru ? "Собственная таблица предметов (если тип таблицы предметов - 1)" : "Own loot table (if the loot table type is 1)")]
                public LootTableConfig OwnLootTable = new LootTableConfig();
                [JsonProperty(Ru ? "Включить сигнализацию при взломе запертого язика ?" : "Turn on the alarm when breaking into a locked box ?")]
                public bool signaling = true;
            }
            [JsonProperty(Ru ? "Настройка уведомлений" : "Configuring notifications")]
            public NotiferSettings notiferSettings = new NotiferSettings();
            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 ItemConfig {
                [JsonProperty("ShortName")]
                public string ShortName;
                [JsonProperty(Ru ? "Минимальное кол-во" : "Minimum")]
                public int MinAmount;
                [JsonProperty(Ru ? "Максимальное кол-во" : "Maximum")]
                public int MaxAmount;
                [JsonProperty(Ru ? "Шанс выпадения предмета [0.0-100.0]" : "Chance [0.0-100.0]")]
                public float Chance;
                [JsonProperty(Ru ? "Это чертеж? [true/false]" : "Is this a blueprint? [true/false]")]
                public bool IsBluePrint;
                [JsonProperty("SkinID (0 - default)")]
                public ulong SkinID;
                [JsonProperty(Ru ? "Название (empty - default)" : "Name (empty - default)")]
                public string Name;
                [JsonProperty(Ru ? "Умножать количество предмета на количество дней с начала вайпа (на 3й день - лута будет в 3 раза больше)" : "Multiply the amount of the item by the number of days since the beginning of the wipe (on the 3rd day, the loot will be 3 times more)")]
                public bool lootWipePlus = false;
            }
            public class LootTableConfig {
                [JsonProperty(Ru ? "Минимальное кол-во элементов" : "Minimum numbers of items")]
                public int Min;
                [JsonProperty(Ru ? "Максимальное кол-во элементов" : "Maximum numbers of items")]
                public int Max;
                [JsonProperty(Ru ? "Использовать минимальное и максимальное значение? [true/false]" : "Use minimum and maximum values? [true/false]")]
                public bool UseCount;
                [JsonProperty(Ru ? "Список предметов" : "List of items")]
                public List<ItemConfig> Items = new List<ItemConfig>();
            }
        }
        private bool Is3DPointValid(Vector3 point, int layer) {
            List<Collider> colliders = Pool.GetList<Collider>();
            Vis.Colliders(point, 25f, colliders, layer, QueryTriggerInteraction.Collide);
            int count = colliders.Count;
            foreach (Collider collider in colliders) {
                if (collider == null || collider.transform == null) {
                    count--;
                    continue;
                }
                if (collider.name.Contains("SafeZone")) {
                    count = int.MaxValue;
                    continue;
                }
                BaseEntity e = collider.ToBaseEntity();
                if (IsAsset(collider.name) && (e == null || e.name.Contains("/treessource/"))) {
                    count = int.MaxValue;
                    break;
                }
                if (e.IsValid()) {
                    if (e is BasePlayer) {
                        BasePlayer player = e as BasePlayer;
                        if (player.IsSleeping()) {
                            count--;
                        }
                        else if (player.IsNpc || player.IsFlying) {
                            count--;
                        }
                        else {
                            count = int.MaxValue;
                            break;
                        }
                    }
                    else if (e.OwnerID.IsSteamId()) {
                        count--;
                    }
                    else if (e.IsNpc || e is SleepingBag) {
                        count--;
                    }
                    else if (e is BaseOven) {
                        if (e.bounds.size.Max() > 1.6f) {
                            count = int.MaxValue;
                            break;
                        }
                        else {
                            count--;
                        }
                    }
                    else if (e is PlayerCorpse) {
                        PlayerCorpse corpse = e as PlayerCorpse;
                        if (corpse.playerSteamID == 0 || corpse.playerSteamID.IsSteamId()) {
                            count = int.MaxValue;
                            break;
                        }
                        else {
                            count--;
                        }
                    }
                    else if (e is DroppedItemContainer && e.prefabID != 545786656) {
                        DroppedItemContainer backpack = e as DroppedItemContainer;
                        if (backpack.playerSteamID == 0 || backpack.playerSteamID.IsSteamId()) {
                            count = int.MaxValue;
                            break;
                        }
                        else {
                            count--;
                        }
                    }
                    else if (e.OwnerID == 0) {
                        if (e is BuildingBlock) {
                            count = int.MaxValue;
                            break;
                        }
                        else {
                            count--;
                        }
                    }
                    else {
                        count = int.MaxValue;
                        break;
                    }
                }
                else if (collider.gameObject.layer == (int)Layer.World) {
                    if (collider.name.Contains("rock_") || collider.name.Contains("formation_", CompareOptions.OrdinalIgnoreCase)) {
                        float height = GetRockHeight(collider.transform.position);
                        if (height > 2f) {
                            count = int.MaxValue;
                            break;
                        }
                        else {
                            count--;
                        }
                    }
                    else if (!config.spawnPositionGenerateSetting.spawnOnRoad && collider.name.StartsWith("road_")) {
                        count = int.MaxValue;
                        break;
                    }
                    else if (collider.name.StartsWith("ice_sheet")) {
                        count = int.MaxValue;
                        break;
                    }
                    else {
                        count--;
                    }
                }
                else if (collider.gameObject.layer == (int)Layer.Water) {
                    if (!config.spawnPositionGenerateSetting.spawnOnRiver && collider.name.StartsWith("River Mesh")) {
                        count = int.MaxValue;
                        break;
                    }
                    count--;
                }
                else {
                    count--;
                }
            }
            Pool.FreeList(ref colliders);
            return count == 0;
        }
        private void StartIvent() {
            if (!NpcSpawn) {
                PrintError(GetLang("XD_IVENT_CLCONTROLLER_NOT_NPSSPAWN"));
                Interface.Oxide.UnloadPlugin(Name);
                return;
            }
            if (BasePlayer.activePlayerList.Count < config.iventController.minPlayedPlayers) {
                Puts(GetLang("XD_IVENT_CLCONTROLLER_NOT_ENOUGH_PLAYERS"));
                GenerateIvent();
                return;
            }
            if (RemoveHouseTime != null) {
                RemoveHouseTime.Destroy();
            }
            if (SpawnHouseTime != null) {
                SpawnHouseTime.Destroy();
            }
            Subscribes();
            labIndex = config.pasteSettings.pasteBuilds[0];
            if (config.pasteSettings.pasteBuilds.Count > 1) {
                labIndex = config.pasteSettings.pasteBuilds.GetRandom();
            }
            GenerateBuilding(labIndex);
        }
        public class FancyMessage {
            public string content {
                get;
                set;
            }
            public bool tts {
                get;
                set;
            }
            public Embeds[] embeds {
                get;
                set;
            }
            public class Embeds {
                public string title {
                    get;
                    set;
                }
                public int color {
                    get;
                    set;
                }
                public List<Fields> fields {
                    get;
                    set;
                }
                public Embeds(string title, int color, List<Fields> fields) {
                    this.title = title;
                    this.color = color;
                    this.fields = fields;
                }
            }
            public FancyMessage(string content, bool tts, Embeds[] embeds) {
                this.content = content;
                this.tts = tts;
                this.embeds = embeds;
            }
            public string toJSON() {
                return JsonConvert.SerializeObject(this);
            }
        }
        private bool IsAsset(string value) {
            foreach (string asset in assets) {
                if (value.Contains(asset)) {
                    return true;
                }
            }
            return false;
        }
        protected override void LoadConfig() {
            base.LoadConfig();
            try {
                config = Config.ReadObject<Configuration>();
                if (config == null) {
                    throw new Exception();
                }
                SaveConfig();
            }
            catch {
                for (int i = 0; i < 3; i++) {
                    PrintError("Configuration file is corrupt! Check your config file at https://jsonlint.com/");
                }
                LoadDefaultConfig();
            }
            ValidateConfig();
            SaveConfig();
        }
        private void GenerateMapMarker(Vector3 pos) {
            if (config.mapMarkers.MapUse) {
                Interface.CallHook("API_CreateMarker", pos, "xdcobaltlab", 0, 3f, 0.3f, config.mapMarkers.MapTxt, config.mapMarkers.colorMarker, config.mapMarkers.colorOutline);
            }
        }
        private object CanPopulateLoot(LootContainer container) {
            if (container == null || CrateEnt == null) {
                return null;
            }
            if (container == CrateEnt) {
                if (config.boxSetting.TypeLootTable == 2) {
                    return null;
                }
                else {
                    return true;
                }
            }
            else {
                return null;
            }
        }
        private const float MaxElevation = 2.5f;
        private static string GetGridString(Vector3 position) {
            return PhoneController.PositionToGridCoord(position);
        }
        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>В л
// ... [Code preview truncated due to length. Full source in attached file] ...

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

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

Сверху