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

FREE AnimalFarm : 1.3.7 1.3.7

Нет прав для скачивания
C#:
using System.Collections.Generic;
using UnityEngine.Assertions;
using System.Collections;
using Oxide.Core.Configuration;
using Newtonsoft.Json;
using UnityEngine.AI;
using Oxide.Core.Plugins;
using UnityEngine;
using System.Linq;
using Oxide.Core;
using System;
using System.Globalization;
using VLB;
using Rust;
using Facepunch;
using Oxide.Game.Rust.Cui;
using ProtoBuf;
using UnityEngine.Pool;
using Rust.Ai.Gen2;
using HarmonyLib;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
namespace Oxide.Plugins {
    [Info("Animal Farm", "Razor", "1.3.7")]
    [Description("Animal farm plugin")]
    public class AnimalFarm : RustPlugin {
        private static AnimalFarm _;
        FarmData pcdData;
        private DynamicConfigFile PCDDATA;
        CoopData coopData;
        private DynamicConfigFile COOPDATA;
        private const string theAdmin = "animalfarm.admin";
        private const string theBoar = "animalfarm.gatherboar";
        private const string theBear = "animalfarm.gatherbear";
        private const string theWolf = "animalfarm.gatherwolf";
        private const string theStag = "animalfarm.gatherstag";
        private const string theTiger = "animalfarm.gathertiger";
        private const string thePanther = "animalfarm.gatherpanther";
        private const string theCrocodile = "animalfarm.gathercrocodile";
        private const string theChicken = "animalfarm.chickencoop";
        private const string storageAdapter = "assets/prefabs/deployable/playerioents/industrialadaptors/storageadaptor.deployed.prefab";
        private const string spliter = "assets/prefabs/deployable/playerioents/fluidsplitter/fluidsplitter.prefab";
        private const string chickencCoop = "assets/prefabs/deployable/chickencoop/chickencoop.deployed.prefab";
        private const string trough = "assets/prefabs/deployable/hitch & trough/hitchtrough.deployed.prefab";
        private const string fence = "assets/prefabs/building/wall.frame.fence/wall.frame.fence.prefab";
        private const string hopperPrefab = "assets/prefabs/deployable/hopper/hopper.deployed.prefab";
        private const string waterbarel = "assets/prefabs/deployable/liquidbarrel/waterbarrel.prefab";
        private const string frame = "assets/prefabs/building core/wall.frame/wall.frame.prefab";
        private const string bearCorpse = "assets/rust.ai/agents/bear/bear.corpse.prefab";
        private const string boarCorpse = "assets/rust.ai/agents/boar/boar.corpse.prefab";
        private const string stagCorpse = "assets/rust.ai/agents/stag/stag.corpse.prefab";
        private const string wolfCorpse = "assets/rust.ai/agents/wolf/wolf.corpse.prefab";
        private const string boar = "assets/rust.ai/agents/boar/boar.prefab";
        private const string stag = "assets/rust.ai/agents/stag/stag.prefab";
        private const string bear = "assets/rust.ai/agents/bear/bear.prefab";
        private const string wolf = "assets/rust.ai/agents/wolf/wolf.prefab";
        //Gen2
        private const string pantherCorpse = "assets/rust.ai/agents/panther/panther.corpse.prefab";
        private const string tigerCorpse = "assets/rust.ai/agents/tiger/tiger.corpse.prefab";
        private const string crocodileCorpse = "assets/rust.ai/agents/crocodile/crocodile.corpse.prefab";
        private const string panther = "assets/rust.ai/agents/panther/panther.prefab";
        private const string tiger = "assets/rust.ai/agents/tiger/tiger.prefab";
        private const string crocodile = "assets/rust.ai/agents/crocodile/crocodile.prefab";
        private const string PoolShortname = "abovegroundpool.deployed";
        private static ulong CustomSkin = 8675309;
        private static GestureConfig gestureConfig = null;
        public static ProtectionProperties newProtectionFull = null;
        private static float[] protectionSettingsFull = new float[] {
            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
        }
        ;
        private List<ulong> didGather = new List<ulong>();
        private static ulong SecretKey;
        public bool LoadedAlready = false;
        public static bool reloading = false;
        private static ulong itemSkin {
            get;
            set;
        }
        private static ulong itemSkinStag {
            get;
            set;
        }
        private static ulong itemSkinBear {
            get;
            set;
        }
        private static ulong itemSkinWolf {
            get;
            set;
        }
        private static ulong itemSkinTiger {
            get;
            set;
        }
        private static ulong itemSkinPanther {
            get;
            set;
        }
        private static ulong itemSkinCrocodile {
            get;
            set;
        }
        private static Dictionary<ulong, itemLimits> playerLimits = new Dictionary<ulong, itemLimits>();
        public class itemLimits {
            public int coop;
            public int pFarm;
        }
#region Loading/Unloading
        private void OnServerSave() {
            SaveData();
            SaveDataCoop();
        }
        private void OnNewSave(string filename) {
            pcdData.PlayerFarms = new Dictionary<ulong, PCDInfo>();
            coopData.PlayerCoops = new Dictionary<ulong, coopInfo>();
            SaveData();
            SaveDataCoop();
        }
        private void Init() {
            _ = this;
            playerLimits = new Dictionary<ulong, itemLimits>();
            SecretKey = (ulong)UnityEngine.Random.Range(41234564, 9999999999999999);
            PCDDATA = Interface.Oxide.DataFileSystem.GetFile($"{Name}/Farm_Data");
            COOPDATA = Interface.Oxide.DataFileSystem.GetFile($"{Name}/Coop_Data");
            LoadData();
            itemSkin = configData.settingsBaby.skinID;
            itemSkinStag = configData.settingsBabyStag.skinIDStag;
            itemSkinBear = configData.settingsBabyBear.skinID;
            itemSkinWolf = configData.settingsBabyWolf.skinID;
            itemSkinTiger = configData.settingsBabyTiger.skinID;
            itemSkinPanther = configData.settingsBabyPanther.skinID;
            itemSkinCrocodile = configData.settingsBabyCrocodile.skinID;
            newProtectionFull = ScriptableObject.CreateInstance<ProtectionProperties>();
            permission.RegisterPermission(theAdmin, this);
            if (configData.settings.requirePerm) RegusterGatherPerms();
            permission.RegisterPermission(theChicken, this);
        }
        private void RegusterGatherPerms() {
            permission.RegisterPermission(theBoar, this);
            permission.RegisterPermission(theBear, this);
            permission.RegisterPermission(theStag, this);
            permission.RegisterPermission(theWolf, this);
            permission.RegisterPermission(theTiger, this);
            permission.RegisterPermission(thePanther, this);
            permission.RegisterPermission(theCrocodile, this);
        }
        private void OnServerInitialized() {
            if (!LoadedAlready) {
                ServerMgr.Instance.StartCoroutine(ReInItFarms());
            }
            GenerateGestureConfig();
        }
        private void OnSaveLoad(Dictionary<BaseEntity, ProtoBuf.Entity> entities) {
            LoadedAlready = true;
            PrintWarning("Loading farms on save load");
            ServerMgr.Instance.StartCoroutine(ReInItFarms());
        }
        IEnumerator ReInItFarms() {
            bool running = true;
            Dictionary<ulong, PCDInfo> initFarms = new Dictionary<ulong, PCDInfo>(pcdData.PlayerFarms);
            int total = 0;
            while (initFarms.Count > 0 && running && _ != null) {
                PrintWarning($"Starting to initialized all farms in load order!");
                foreach (var farm in initFarms) {
                    yield return new WaitForSeconds(0.01f);
                    if (_ == null) break;
                    HitchTrough theFarm = FindEntity(farm.Key) as HitchTrough;
                    if (theFarm == null) pcdData.PlayerFarms.Remove(farm.Key);
                    else {
                        total++;
                        if (!playerLimits.ContainsKey(theFarm.OwnerID)) playerLimits.Add(theFarm.OwnerID, new itemLimits() {
                            pFarm = 1
                        }
                        );
                        else playerLimits[theFarm.OwnerID].pFarm++;
                        List<AnimalState> tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Boars.Values);
                        pcdData.PlayerFarms[farm.Key].Boars.Clear();
                        FarmBehavior controler = theFarm.gameObject.AddComponent<FarmBehavior>();
                        controler.IsFoundation = farm.Value.IsFoundation;
                        foreach (var pig in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyPig(pig.health, pig.name, pig.state, pig.Hydration, pig.Energy, pig.Stamina, farm.Value.IsFoundation, pig.Age);
                        }
                        tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Stags.Values);
                        pcdData.PlayerFarms[farm.Key].Stags.Clear();
                        foreach (var stag in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyStag(stag.health, stag.name, stag.state, stag.Hydration, stag.Energy, stag.Stamina, farm.Value.IsFoundation, stag.Age);
                        }
                        tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Bears.Values);
                        pcdData.PlayerFarms[farm.Key].Bears.Clear();
                        foreach (var bears in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyBear(bears.health, bears.name, bears.state, bears.Hydration, bears.Energy, bears.Stamina, farm.Value.IsFoundation, bears.Age);
                        }
                        tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Wolf.Values);
                        pcdData.PlayerFarms[farm.Key].Wolf.Clear();
                        foreach (var wolfs in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyWolf(wolfs.health, wolfs.name, wolfs.state, wolfs.Hydration, wolfs.Energy, wolfs.Stamina, farm.Value.IsFoundation, wolfs.Age);
                        }
                        tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Tigers.Values);
                        pcdData.PlayerFarms[farm.Key].Tigers.Clear();
                        foreach (var tiger in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyTiger(tiger.health, tiger.name, tiger.state, tiger.Hydration, tiger.Energy, tiger.Stamina, farm.Value.IsFoundation, tiger.Age);
                        }
                        tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Panthers.Values);
                        pcdData.PlayerFarms[farm.Key].Panthers.Clear();
                        foreach (var Panther in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyPanther(Panther.health, Panther.name, Panther.state, Panther.Hydration, Panther.Energy, Panther.Stamina, farm.Value.IsFoundation, Panther.Age);
                        }
                        tempEntity = Pool.Get<List<AnimalState>>();
                        tempEntity.AddRange(pcdData.PlayerFarms[farm.Key].Crocodiles.Values);
                        pcdData.PlayerFarms[farm.Key].Crocodiles.Clear();
                        foreach (var Crocodile in tempEntity) {
                            yield return new WaitForSeconds(0.01f);
                            if (_ == null) continue;
                            controler.BuyCrocodile(Crocodile.health, Crocodile.name, Crocodile.state, Crocodile.Hydration, Crocodile.Energy, Crocodile.Stamina, farm.Value.IsFoundation, Crocodile.Age);
                        }
                        Pool.FreeUnmanaged(ref tempEntity);
                    }
                }
                running = false;
            }
            SaveData();
            PrintWarning($"Finished initialize of {total} animal farms!");
            List<ulong> tempList = Pool.Get<List<ulong>>();
            tempList.AddRange(coopData.PlayerCoops.Keys);
            total = 0;
            foreach (var theID in tempList) {
                global : : ChickenCoop found = FindEntity(theID) as global : : ChickenCoop;
                if (found != null) {
                    total++;
                    if (!playerLimits.ContainsKey(found.OwnerID)) playerLimits.Add(found.OwnerID, new itemLimits() {
                        coop = 1
                    }
                    );
                    else playerLimits[found.OwnerID].coop++;
                    found.gameObject.AddComponent<CoopBehavior>();
                }
                else coopData.PlayerCoops.Remove(theID);
            }
            SaveDataCoop();
            Pool.FreeUnmanaged(ref tempList);
            PrintWarning($"Finished initialize of {total} chickencoops!");
        }
        private void Unload() {
            reloading = true;
            foreach (var controler in FarmBehavior._allFarms) UnityEngine.Object.DestroyImmediate(controler);
            foreach (var controlerC in CoopBehavior._allCoops) UnityEngine.Object.DestroyImmediate(controlerC.Value);
            SaveData();
            SaveDataCoop();
            foreach (BasePlayer player in BasePlayer.activePlayerList) {
                CloseUiStats(player);
                CloseUi(player);
            }
            _ = null;
        }
        private void GenerateGestureConfig() {
            FarmableAnimal entity = GameManager.server.CreateEntity("assets/prefabs/deployable/chickencoop/simplechicken.entity.prefab") as FarmableAnimal;
            if (entity != null) {
                entity.Spawn();
                gestureConfig = ScriptableObject.CreateInstance<GestureConfig>();
                if (entity.PettingGesture != null) {
                    CopyFields<GestureConfig>(entity.PettingGesture, gestureConfig);
                    entity?.Kill();
                }
            }
        }
#endregion
#region Config
        private ConfigData configData;
        class ConfigData {
            [JsonProperty(PropertyName = "Chicken Coop Settings")]
            public SettingsCoop settingsCoop {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Farm Settings")]
            public Settings settings {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Boar Baby Settings")]
            public SettingsBaby settingsBaby {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Stag Baby Settings")]
            public SettingsBabyStag settingsBabyStag {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Bear Baby Settings")]
            public SettingsBabyBear settingsBabyBear {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Wolf Baby Settings")]
            public SettingsBabyWolf settingsBabyWolf {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Tiger Baby Settings")]
            public SettingsBabyTiger settingsBabyTiger {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Panther Baby Settings")]
            public SettingsBabyPanther settingsBabyPanther {
                get;
                set;
            }
            [JsonProperty(PropertyName = "Crocodile Baby Settings")]
            public SettingsBabyCrocodile settingsBabyCrocodile {
                get;
                set;
            }
            public class SettingsCoop {
                [JsonProperty(PropertyName = "Total chickens animals allowed in the coop. Default UI will only show 4")]
                public int maxAnimals {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Chickens hatch time minutes")]
                public int ChickenHatchTimeMinutes {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Add storage adapter to coop")]
                public bool addAdapter {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Add water adapter to coop")]
                public bool addWater {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Allow auto hatching of eggs")]
                public bool autoHatch {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Player may have how many modifyed coops -1 = unlimited")]
                public int totalAllowed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Only use custom item to place coop")]
                public bool customOnly {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Coop item skin")]
                public ulong skin {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Coop item name")]
                public string name {
                    get;
                    set;
                }
            }
            public class Settings {
                [JsonProperty(PropertyName = "Farm item skinID")]
                public ulong skin {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Farm item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Total farm animals allowed in the farm")]
                public int maxAnimals {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Add storage adapter to trough")]
                public bool addAdapter {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Add hopper to trough")]
                public bool addHopper {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Require permissions for gatheringr")]
                public bool requirePerm {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Player may have how many farms -1 = unlimited")]
                public int totalAllowed {
                    get;
                    set;
                }
            }
            public class SettingsBaby {
                [JsonProperty(PropertyName = "Chance to get baby boar from gathering")]
                public int chance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Boar item skinID")]
                public ulong skinID {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Boar item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Boar groth minutes")]
                public int boarGrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Boar can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Boar breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Boar breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Boar dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Boar gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public class SettingsBabyStag {
                [JsonProperty(PropertyName = "Chance to get baby stag from gathering")]
                public int chanceStag {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Stag item skinID")]
                public ulong skinIDStag {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Stag item name")]
                public string nameStag {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Stag groth minutes")]
                public int stagGrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Stag can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Stag breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Stag breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Stag dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Stag gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public class SettingsBabyBear {
                [JsonProperty(PropertyName = "Chance to get baby bear from gathering")]
                public int chance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Bear item skinID")]
                public ulong skinID {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Bear item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Bear groth minutes")]
                public int GrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Bear can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Bear breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Bear breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Bear dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Bear gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public class SettingsBabyWolf {
                [JsonProperty(PropertyName = "Chance to get baby wolf from gathering")]
                public int chance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Wolf item skinID")]
                public ulong skinID {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Wolf item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Wolf groth minutes")]
                public int GrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Wolf can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Wolf breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Wolf breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Wolf dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Wolf gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public class SettingsBabyTiger {
                [JsonProperty(PropertyName = "Chance to get baby tiger from gathering")]
                public int chance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Tiger item skinID")]
                public ulong skinID {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Tiger item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Tiger groth minutes")]
                public int GrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Tiger can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Tiger breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Tiger breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Tiger dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Tiger gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public class SettingsBabyPanther {
                [JsonProperty(PropertyName = "Chance to get baby Panther from gathering")]
                public int chance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Panther item skinID")]
                public ulong skinID {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Panther item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Panther groth minutes")]
                public int GrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Panther can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Panther breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Pantherger breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Panther dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Panther gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public class SettingsBabyCrocodile {
                [JsonProperty(PropertyName = "Chance to get baby Crocodile from gathering")]
                public int chance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Crocodile item skinID")]
                public ulong skinID {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Crocodile item name")]
                public string name {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Baby Crocodile groth minutes")]
                public int GrothTick {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Crocodile can breed.")]
                public bool canBreed {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Crocodile breed chance.")]
                public int breedChance {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Crocodile breed cooldown minutes.")]
                public int breedCooldown {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Crocodile dung amount.")]
                public int dung {
                    get;
                    set;
                }
                [JsonProperty(PropertyName = "Crocodile gather age and items.")]
                public Dictionary<int, List<ItemResourceDispenser>> ResourceDispenser {
                    get;
                    set;
                }
            }
            public Oxide.Core.VersionNumber Version {
                get;
                set;
            }
        }
        protected override void LoadConfig() {
            base.LoadConfig();
            configData = Config.ReadObject<ConfigData>();
            if (configData.Version < Version) UpdateConfigValues();
            Config.WriteObject(configData, true);
        }
        protected override void LoadDefaultConfig() => configData = GetBaseConfig();
        private ConfigData GetBaseConfig() {
            return new ConfigData {
                settingsCoop = new ConfigData.SettingsCoop {
                    maxAnimals = 4, ChickenHatchTimeMinutes = 2, addAdapter = false, addWater = false, autoHatch = false, totalAllowed = -1, customOnly = false, skin = 3461239631, name = "Industrial Chicken Coop"
                }
                , settings = new ConfigData.Settings {
                    skin = 3458119788, name = "Animal Farm", maxAnimals = 10, addAdapter = true, addHopper = true, requirePerm = false, totalAllowed = -1
                }
                , settingsBaby = new ConfigData.SettingsBaby {
                    chance = 10, skinID = 3458077515, name = "A Baby Boar", boarGrothTick = 30, canBreed = true, breedChance = 100, breedCooldown = 180, dung = 2, ResourceDispenser = new Dictionary<int, List<ItemResourceDispenser>>() {
                        {
                            1, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 1, shortname = "meat.boar"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 5, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 5, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 1, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            2, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 3, shortname = "meat.boar"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 15, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 8, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 2, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            3, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 6, shortname = "meat.boar"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 50, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 15, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 12, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 5, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            4, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 7, shortname = "meat.boar"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 25, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 16, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 7, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            5, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 8, shortname = "meat.boar"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 50, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 40, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "cloth"
                                }
                            }
                        }
                    }
                }
                , settingsBabyStag = new ConfigData.SettingsBabyStag {
                    chanceStag = 10, skinIDStag = 3458079161, nameStag = "A Baby Stag", stagGrothTick = 30, canBreed = true, breedChance = 100, breedCooldown = 180, dung = 2, ResourceDispenser = new Dictionary<int, List<ItemResourceDispenser>>() {
                        {
                            1, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 1, shortname = "deermeat.raw"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 5, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 2, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 5, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            2, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 1, shortname = "deermeat.raw"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 4, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 15, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            3, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 2, shortname = "deermeat.raw"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 6, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 15, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            4, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 3, shortname = "deermeat.raw"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 30, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 8, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 30, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            5, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 4, shortname = "deermeat.raw"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 50, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 10, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 50, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 25, shortname = "cloth"
                                }
                            }
                        }
                    }
                }
                , settingsBabyBear = new ConfigData.SettingsBabyBear {
                    chance = 10, skinID = 3458078401, name = "A Baby Bear", GrothTick = 30, canBreed = true, breedChance = 100, breedCooldown = 180, dung = 2, ResourceDispenser = new Dictionary<int, List<ItemResourceDispenser>>() {
                        {
                            1, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 1, shortname = "bearmeat"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 25, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 20, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 5, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            2, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 5, shortname = "bearmeat"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 50, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 40, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 40, shortname = "leather"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 15, shortname = "cloth"
                                }
                            }
                        }
                        , {
                            3, new List<ItemResourceDispenser>() {
                                new ItemResourceDispenser() {
                                    amount = 10, shortname = "bearmeat"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 75, shortname = "bone.fragments"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 60, shortname = "fat.animal"
                                }
                                , new ItemResourceDispenser() {
                                    amount = 60, shortname = "leather"
                              
// ... [Code preview truncated due to length. Full source in attached file] ...

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