C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Network;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Configuration;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using Rust;
using UnityEngine;
namespace Oxide.Plugins {
[Info("StudyTree", "Ryamkk", "1.0.9")]
public class StudyTree : RustPlugin {
private static StudyTree Instance;
private GameObject FileManagerObject;
private FileManager m_FileManager;
private bool ImageInit = false;
private bool WorkbenchLevelOneUpdate;
private bool WorkbenchLevelTwoUpdate;
private bool WorkbenchLevelThreeUpdate;
[JsonProperty("Основной слой первого верстака")]
private string LayerWorkbenchLevelOne = "StudyTree.WorkbenchLevelOne";
[JsonProperty("Основной слой второго верстака")]
private string LayerWorkbenchLevelTwo = "StudyTree.WorkbenchLevelTwo";
[JsonProperty("Основной слой третьего верстака")]
private string LayerWorkbenchLevelThree = "StudyTree.WorkbenchLevelThree";
[JsonProperty("Цвет заднего фона")]
public string BackgroundСolor = "#212121";
[JsonProperty("Цвет фона картинки")]
public string BackgroundColorClipArt = "#1E1D1C";
[JsonProperty("Цвет заблокированного предмета")]
public string LockedItemColor = "#4D4D4D";
[JsonProperty("Цвет разблокированного предмета")]
public string UnlockedItemColor = "#718a43";
#region Задаём цену изучения для shortname
[JsonProperty("Названия предмета и цена изучения на третьем верстаке")]
public Dictionary<string, int> StudyItemsList = new Dictionary<string, int>() {
["hat.miner"]
= 20, ["tshirt"] = 20, ["shirt.collared"] = 75, ["tshirt.long"] = 20, ["pants"] = 75, ["riot.helmet"] = 75, ["bucket.helmet"] = 75, ["jacket.snow"] = 20, ["jacket"] = 20, ["hammer.salvaged"] = 75, ["salvaged.cleaver"] = 75, ["mace"] = 75, ["trap.bear"] = 75, ["flameturret"] = 75, ["guntrap"] = 75, ["ammo.pistol"] = 75, ["weapon.mod.silencer"] = 75, ["shotgun.waterpipe"] = 75, ["pistol.revolver"] = 75, ["weapon.mod.flashlight"] = 75, ["shotgun.double"] = 125, ["explosive.satchel"] = 125, ["grenade.beancan"] = 75, ["barricade.woodwire"] = 75, ["water.catcher.small"] = 20, ["shutter.metal.embrasure.b"] = 20, ["shutter.metal.embrasure.a"] = 20, ["floor.grill"] = 75, ["wall.window.bars.metal"] = 75, ["watchtower.wood"] = 75, ["ladder.wooden.wall"] = 125, ["bed"] = 75, ["dropbox"] = 75, ["wall.external.high"] = 125, ["gates.external.high.wood"] = 125, ["wall.frame.garagedoor"] = 75, ["hazmatsuit"] = 125, ["coffeecan.helmet"] = 75, ["shoes.boots"] = 75, ["syringe.medical"] = 75, ["roadsign.jacket"] = 75, ["hoodie"] = 75, ["largemedkit"] = 75, ["roadsign.kilt"] = 75, ["roadsign.gloves"] = 20, ["heavy.plate.helmet"] = 125, ["heavy.plate.jacket"] = 125, ["heavy.plate.pants"] = 125, ["longsword"] = 75, ["axe.salvaged"] = 125, ["icepick.salvaged"] = 125, ["chainsaw"] = 125, ["flamethrower"] = 125, ["trap.landmine"] = 125, ["ammo.shotgun"] = 75, ["ammo.shotgun.slug"] = 75, ["shotgun.pump"] = 125, ["ammo.shotgun.fire"] = 75, ["pistol.semiauto"] = 125, ["grenade.f1"] = 75, ["weapon.mod.muzzlebrake"] = 125, ["weapon.mod.muzzleboost"] = 125, ["pistol.python"] = 125, ["ammo.pistol.fire"] = 125, ["ammo.pistol.hv"] = 125, ["smg.thompson"] = 125, ["smg.2"] = 125, ["rifle.semiauto"] = 125, ["ammo.rifle"] = 125, ["ammo.rocket.fire"] = 125, ["water.catcher.large"] = 75, ["wall.frame.cell.gate"] = 75, ["barricade.concrete"] = 20, ["wall.frame.cell"] = 75, ["barricade.metal"] = 125, ["locker"] = 75, ["wall.external.high.stone"] = 500, ["small.oil.refinery"] = 75, ["floor.ladder.hatch"] = 125, ["furnace.large"] = 125, ["generator.wind.scrap"] = 125, ["autoturret"] = 500, ["wall.window.bars.toptier"] = 125, ["door.hinged.toptier"] = 500, ["door.double.hinged.toptier"] = 500, ["gates.external.high.stone"] = 500, ["metal.facemask"] = 500, ["metal.plate.torso"] = 500, ["weapon.mod.lasersight"] = 125, ["ammo.rifle.hv"] = 125, ["ammo.rifle.incendiary"] = 125, ["smg.mp5"] = 500, ["weapon.mod.holosight"] = 125, ["weapon.mod.small.scope"] = 125, ["ammo.rifle.explosive"] = 125, ["rifle.ak"] = 500, ["rifle.bolt"] = 500, ["rocket.launcher"] = 500, ["ammo.rocket.hv"] = 125, ["explosives"] = 500, ["explosive.timed"] = 500, ["ammo.rocket.basic"] = 125
}
;
#endregion
#region Задаём картинку для shortname
[JsonProperty("Картинки для графического интерфейса плагина")]
private Dictionary<string, string> StudyImageList = new Dictionary<string, string>() {
["hat.miner"]
= "https://rustlabs.com/img/items180/hat.miner.png", ["tshirt"] = "https://rustlabs.com/img/items180/tshirt.png", ["shirt.collared"] = "https://rustlabs.com/img/items180/shirt.collared.png", ["tshirt.long"] = "https://rustlabs.com/img/items180/tshirt.long.png", ["pants"] = "https://rustlabs.com/img/items180/pants.png", ["riot.helmet"] = "https://rustlabs.com/img/items180/riot.helmet.png", ["bucket.helmet"] = "https://rustlabs.com/img/items180/bucket.helmet.png", ["jacket.snow"] = "https://rustlabs.com/img/items180/jacket.snow.png", ["jacket"] = "https://rustlabs.com/img/items180/jacket.png", ["hammer.salvaged"] = "https://rustlabs.com/img/items180/hammer.salvaged.png", ["salvaged.cleaver"] = "https://rustlabs.com/img/items180/salvaged.cleaver.png", ["mace"] = "https://rustlabs.com/img/items180/mace.png", ["trap.bear"] = "https://rustlabs.com/img/items180/trap.bear.png", ["flameturret"] = "https://rustlabs.com/img/items180/flameturret.png", ["guntrap"] = "https://rustlabs.com/img/items180/guntrap.png", ["ammo.pistol"] = "https://rustlabs.com/img/items180/ammo.pistol.png", ["weapon.mod.silencer"] = "https://rustlabs.com/img/items180/weapon.mod.silencer.png", ["shotgun.waterpipe"] = "https://rustlabs.com/img/items180/shotgun.waterpipe.png", ["pistol.revolver"] = "https://rustlabs.com/img/items180/pistol.revolver.png", ["weapon.mod.flashlight"] = "https://rustlabs.com/img/items180/weapon.mod.flashlight.png", ["shotgun.double"] = "https://rustlabs.com/img/items180/shotgun.double.png", ["explosive.satchel"] = "https://rustlabs.com/img/items180/explosive.satchel.png", ["grenade.beancan"] = "https://rustlabs.com/img/items180/grenade.beancan.png", ["barricade.woodwire"] = "https://rustlabs.com/img/items180/barricade.woodwire.png", ["water.catcher.small"] = "https://rustlabs.com/img/items180/water.catcher.small.png", ["shutter.metal.embrasure.b"] = "https://rustlabs.com/img/items180/shutter.metal.embrasure.b.png", ["shutter.metal.embrasure.a"] = "https://rustlabs.com/img/items180/shutter.metal.embrasure.a.png", ["floor.grill"] = "https://rustlabs.com/img/items180/floor.grill.png", ["wall.window.bars.metal"] = "https://rustlabs.com/img/items180/wall.window.bars.metal.png", ["watchtower.wood"] = "https://rustlabs.com/img/items180/watchtower.wood.png", ["ladder.wooden.wall"] = "https://rustlabs.com/img/items180/ladder.wooden.wall.png", ["bed"] = "https://rustlabs.com/img/items180/bed.png", ["dropbox"] = "https://rustlabs.com/img/items180/dropbox.png", ["wall.external.high"] = "https://rustlabs.com/img/items180/wall.external.high.png", ["gates.external.high.wood"] = "https://rustlabs.com/img/items180/gates.external.high.wood.png", ["wall.frame.garagedoor"] = "https://rustlabs.com/img/items180/wall.frame.garagedoor.png", ["hazmatsuit"] = "https://rustlabs.com/img/items180/hazmatsuit.png", ["coffeecan.helmet"] = "https://rustlabs.com/img/items180/coffeecan.helmet.png", ["shoes.boots"] = "https://rustlabs.com/img/items180/shoes.boots.png", ["syringe.medical"] = "https://rustlabs.com/img/items180/syringe.medical.png", ["roadsign.jacket"] = "https://rustlabs.com/img/items180/roadsign.jacket.png", ["hoodie"] = "https://rustlabs.com/img/items180/hoodie.png", ["largemedkit"] = "https://rustlabs.com/img/items180/largemedkit.png", ["roadsign.kilt"] = "https://rustlabs.com/img/items180/roadsign.kilt.png", ["roadsign.gloves"] = "https://rustlabs.com/img/items180/roadsign.gloves.png", ["heavy.plate.helmet"] = "https://rustlabs.com/img/items180/heavy.plate.helmet.png", ["heavy.plate.jacket"] = "https://rustlabs.com/img/items180/heavy.plate.jacket.png", ["heavy.plate.pants"] = "https://rustlabs.com/img/items180/heavy.plate.pants.png", ["longsword"] = "https://rustlabs.com/img/items180/longsword.png", ["axe.salvaged"] = "https://rustlabs.com/img/items180/axe.salvaged.png", ["icepick.salvaged"] = "https://rustlabs.com/img/items180/icepick.salvaged.png", ["chainsaw"] = "https://rustlabs.com/img/items180/chainsaw.png", ["flamethrower"] = "https://rustlabs.com/img/items180/flamethrower.png", ["trap.landmine"] = "https://rustlabs.com/img/items180/trap.landmine.png", ["ammo.shotgun"] = "https://rustlabs.com/img/items180/ammo.shotgun.png", ["ammo.shotgun.slug"] = "https://rustlabs.com/img/items180/ammo.shotgun.slug.png", ["shotgun.pump"] = "https://rustlabs.com/img/items180/shotgun.pump.png", ["ammo.shotgun.fire"] = "https://rustlabs.com/img/items180/ammo.shotgun.fire.png", ["pistol.semiauto"] = "https://rustlabs.com/img/items180/pistol.semiauto.png", ["grenade.f1"] = "https://rustlabs.com/img/items180/grenade.f1.png", ["weapon.mod.muzzlebrake"] = "https://rustlabs.com/img/items180/weapon.mod.muzzlebrake.png", ["weapon.mod.muzzleboost"] = "https://rustlabs.com/img/items180/weapon.mod.muzzleboost.png", ["pistol.python"] = "https://rustlabs.com/img/items180/pistol.python.png", ["ammo.pistol.fire"] = "https://rustlabs.com/img/items180/ammo.pistol.fire.png", ["ammo.pistol.hv"] = "https://rustlabs.com/img/items180/ammo.pistol.hv.png", ["smg.thompson"] = "https://rustlabs.com/img/items180/smg.thompson.png", ["smg.2"] = "https://rustlabs.com/img/items180/smg.2.png", ["rifle.semiauto"] = "https://rustlabs.com/img/items180/rifle.semiauto.png", ["ammo.rifle"] = "https://rustlabs.com/img/items180/ammo.rifle.png", ["ammo.rocket.fire"] = "https://rustlabs.com/img/items180/ammo.rocket.fire.png", ["water.catcher.large"] = "https://rustlabs.com/img/items180/water.catcher.large.png", ["wall.frame.cell.gate"] = "https://rustlabs.com/img/items180/wall.frame.cell.gate.png", ["barricade.concrete"] = "https://rustlabs.com/img/items180/barricade.concrete.png", ["wall.frame.cell"] = "https://rustlabs.com/img/items180/wall.frame.cell.png", ["barricade.metal"] = "https://rustlabs.com/img/items180/barricade.metal.png", ["locker"] = "https://rustlabs.com/img/items180/locker.png", ["wall.external.high.stone"] = "https://rustlabs.com/img/items180/wall.external.high.stone.png", ["small.oil.refinery"] = "https://rustlabs.com/img/items180/small.oil.refinery.png", ["floor.ladder.hatch"] = "https://rustlabs.com/img/items180/floor.ladder.hatch.png", ["furnace.large"] = "https://rustlabs.com/img/items180/furnace.large.png", ["generator.wind.scrap"] = "https://rustlabs.com/img/items180/generator.wind.scrap.png", ["autoturret"] = "https://rustlabs.com/img/items180/autoturret.png", ["wall.window.bars.toptier"] = "https://rustlabs.com/img/items180/wall.window.bars.toptier.png", ["door.hinged.toptier"] = "https://rustlabs.com/img/items180/door.hinged.toptier.png", ["door.double.hinged.toptier"] = "https://rustlabs.com/img/items180/door.double.hinged.toptier.png", ["gates.external.high.stone"] = "https://rustlabs.com/img/items180/gates.external.high.stone.png", ["metal.facemask"] = "https://rustlabs.com/img/items180/metal.facemask.png", ["metal.plate.torso"] = "https://rustlabs.com/img/items180/metal.plate.torso.png", ["weapon.mod.lasersight"] = "https://rustlabs.com/img/items180/weapon.mod.lasersight.png", ["ammo.rifle.hv"] = "https://rustlabs.com/img/items180/ammo.rifle.hv.png", ["ammo.rifle.incendiary"] = "https://rustlabs.com/img/items180/ammo.rifle.incendiary.png", ["smg.mp5"] = "https://rustlabs.com/img/items180/smg.mp5.png", ["weapon.mod.holosight"] = "https://rustlabs.com/img/items180/weapon.mod.holosight.png", ["weapon.mod.small.scope"] = "https://rustlabs.com/img/items180/weapon.mod.small.scope.png", ["ammo.rifle.explosive"] = "https://rustlabs.com/img/items180/ammo.rifle.explosive.png", ["rifle.ak"] = "https://rustlabs.com/img/items180/rifle.ak.png", ["rifle.bolt"] = "https://rustlabs.com/img/items180/rifle.bolt.png", ["rocket.launcher"] = "https://rustlabs.com/img/items180/rocket.launcher.png", ["ammo.rocket.hv"] = "https://rustlabs.com/img/items180/ammo.rocket.hv.png", ["explosives"] = "https://rustlabs.com/img/items180/explosives.png", ["explosive.timed"] = "https://rustlabs.com/img/items180/explosive.timed.png", ["ammo.rocket.basic"] = "https://rustlabs.com/img/items180/ammo.rocket.basic.png", ["scrap"] = "https://rustlabs.com/img/items180/scrap.png", ["close"] = "https://cdn.discordapp.com/attachments/970815614417506305/978148719855796234/close.png", ["unlock"] = "https://cdn.discordapp.com/attachments/970815614417506305/978151657907036190/unlock.png"
}
;
#endregion
#region Создание и инициализация дата файла на игрока
[JsonProperty("Дата файл изучений игроков")]
public Dictionary<ulong, StudyTreeData> StudyTreeUser = new Dictionary<ulong, StudyTreeData>();
public class StudyTreeData {
[JsonProperty("Beancan Grenade")]
public bool BeancanGrenade;
[JsonProperty("Gas Mask")]
public bool GasMask;
[JsonProperty("Snap Trap")]
public bool SnapTrap;
[JsonProperty("Shotgun Trap")]
public bool ShotgunTrap;
[JsonProperty("Flame Turret")]
public bool FlameTurret;
[JsonProperty("Pistol Bullet")]
public bool PistolBullet;
[JsonProperty("Fire Arrow")]
public bool FireArrow;
[JsonProperty("Silencer")]
public bool Silencer;
[JsonProperty("Weapon Flashlight")]
public bool WeaponFlashlight;
[JsonProperty("Waterpipe Shotgun")]
public bool WaterpipeShotgun;
[JsonProperty("Double Barrel Shotgun")]
public bool DoubleBarrelShotgun;
[JsonProperty("Salvaged Cleaver")]
public bool SalvagedCleaver;
[JsonProperty("Mace")]
public bool Mace;
[JsonProperty("Revolver")]
public bool Revolver;
[JsonProperty("Salvaged Sword")]
public bool SalvagedSword;
[JsonProperty("Pickaxe")]
public bool Pickaxe;
[JsonProperty("Satchel Charge")]
public bool SatchelCharge;
[JsonProperty("Hatchet")]
public bool Hatchet;
[JsonProperty("Salvaged Hammer")]
public bool SalvagedHammer;
[JsonProperty("Binoculars")]
public bool Binoculars;
[JsonProperty("RF Transmitter")]
public bool RFTransmitter;
[JsonProperty("Snow Jacket")]
public bool SnowJacket;
[JsonProperty("Riot Helmet")]
public bool RiotHelmet;
[JsonProperty("Tank Top")]
public bool TankTop;
[JsonProperty("Shirt")]
public bool Shirt;
[JsonProperty("Jacket")]
public bool Jacket;
[JsonProperty("Miners Hat")]
public bool MinersHat;
[JsonProperty("Bucket Helmet")]
public bool BucketHelmet;
[JsonProperty("Longsleeve T-Shirt")]
public bool LongsleeveTShirt;
[JsonProperty("Pants")]
public bool Pants;
[JsonProperty("T-Shirt")]
public bool TShirt;
[JsonProperty("Reactive Target")]
public bool ReactiveTarget;
[JsonProperty("Fridge")]
public bool Fridge;
[JsonProperty("Drop Box")]
public bool DropBox;
[JsonProperty("Chair")]
public bool Chair;
[JsonProperty("Ceiling Light")]
public bool CeilingLight;
[JsonProperty("Bed")]
public bool Bed;
[JsonProperty("Wooden Ladder")]
public bool WoodenLadder;
[JsonProperty("Small Water Catcher")]
public bool SmallWaterCatcher;
[JsonProperty("High External Wooden Wall")]
public bool HighExternalWoodenWall;
[JsonProperty("High External Wooden Gate")]
public bool HighExternalWoodenGate;
[JsonProperty("Barbed Wooden Barricade")]
public bool BarbedWoodenBarricade;
[JsonProperty("Reinforced Glass Window")]
public bool ReinforcedGlassWindow;
[JsonProperty("Metal Window Bars")]
public bool MetalWindowBars;
[JsonProperty("Metal Vertical Embrasure")]
public bool MetalVerticalEmbrasure;
[JsonProperty("Metal horizontal Embrasure")]
public bool MetalHorizontalEmbrasure;
[JsonProperty("Sandbag Barricade")]
public bool SandbagBarricade;
[JsonProperty("Watch Tower")]
public bool WatchTower;
[JsonProperty("Garage Door")]
public bool GarageDoor;
[JsonProperty("Chainlink Fence")]
public bool ChainlinkFence;
[JsonProperty("Floor Grill")]
public bool FloorGrill;
[JsonProperty("Chainsaw")]
public bool Chainsaw;
[JsonProperty("Auto Turret")]
public bool AutoTurret;
[JsonProperty("12 Gauge Slug")]
public bool Gauge12Slug;
[JsonProperty("12 Gauge Incendiary Shell")]
public bool Gauge12IncendiaryShell;
[JsonProperty("Incendiary Rocket")]
public bool IncendiaryRocket;
[JsonProperty("HV Pistol Ammo")]
public bool HVPistolAmmo;
[JsonProperty("Incendiary Pistol Ammo")]
public bool IncendiaryPistolAmmo;
[JsonProperty("SAM Ammo")]
public bool SAMAmmo;
[JsonProperty("12 Gauge Buckshot")]
public bool Gauge12Buckshot;
[JsonProperty("5.56 Rifle Ammo")]
public bool Rifle556Ammo;
[JsonProperty("Custom SMG")]
public bool CustomSMG;
[JsonProperty("Muzzle Brake")]
public bool MuzzleBrake;
[JsonProperty("Muzzle Boost")]
public bool MuzzleBoost;
[JsonProperty("Thompson")]
public bool Thompson;
[JsonProperty("Pump Shotgun")]
public bool PumpShotgun;
[JsonProperty("Semi-Automatic Rifle")]
public bool SemiAutomaticRifle;
[JsonProperty("Semi-Automatic Pistol")]
public bool SemiAutomaticPistol;
[JsonProperty("F1 Grenade")]
public bool F1Grenade;
[JsonProperty("Longsword")]
public bool Longsword;
[JsonProperty("Flame Thrower")]
public bool FlameThrower;
[JsonProperty("Python Revolver")]
public bool PythonRevolver;
[JsonProperty("Large Medkit")]
public bool LargeMedkit;
[JsonProperty("Medical Syringe")]
public bool MedicalSyringe;
[JsonProperty("Salvaged Icepick")]
public bool SalvagedIcepick;
[JsonProperty("Сhainsaw")]
public bool Сhainsaw;
[JsonProperty("Salveged Axe")]
public bool SalvegedAxe;
[JsonProperty("Road Sing Jacket")]
public bool RoadSingJacket;
[JsonProperty("Road Sing Kilt")]
public bool RoadSingKilt;
[JsonProperty("Coffee Can Helmet")]
public bool CoffeeCanHelmet;
[JsonProperty("Boots")]
public bool Boots;
[JsonProperty("Roadsing Gloves")]
public bool RoadsingGloves;
[JsonProperty("Hoodie")]
public bool Hoodie;
[JsonProperty("Heavy Plate Pants")]
public bool HeavyPlatePants;
[JsonProperty("Heavy Plate Jacket")]
public bool HeavyPlateJacket;
[JsonProperty("Hazmat Suit")]
public bool HazmatSuit;
[JsonProperty("Heavy Plate Helmet")]
public bool HeavyPlateHelmet;
[JsonProperty("Search Light")]
public bool SearchLight;
[JsonProperty("Wind Turbine")]
public bool WindTurbine;
[JsonProperty("Small Oil Refinery")]
public bool SmallOilRefinery;
[JsonProperty("Locker")]
public bool Locker;
[JsonProperty("Large Furnace")]
public bool LargeFurnace;
[JsonProperty("High External Stone Wall")]
public bool HighExternalStoneWall;
[JsonProperty("Metal Barricade")]
public bool MetalBarricade;
[JsonProperty("Large Water Catcher")]
public bool LargeWaterCatcher;
[JsonProperty("Prison Cell Wall")]
public bool PrisonCellWall;
[JsonProperty("Prison Cell Gate")]
public bool PrisonCellGate;
[JsonProperty("Concrete Barricade")]
public bool ConcreteBarricade;
[JsonProperty("Ladder Hatch")]
public bool LadderHatch;
[JsonProperty("Land Mine")]
public bool LandMine;
[JsonProperty("RF Pager")]
public bool RFPager;
[JsonProperty("RF Receiver")]
public bool RFReceiver;
[JsonProperty("Large Rechargable Battery")]
public bool LargeRechargableBattery;
[JsonProperty("HBHF Sensor")]
public bool HBHFSensor;
[JsonProperty("RF Broadcaster")]
public bool RFBroadcaster;
[JsonProperty("Incendiary 5.56 Rifle Ammo")]
public bool Incendiary556RifleAmmo;
[JsonProperty("HV 5.56 Rifle Ammo")]
public bool HV556RifleAmmo;
[JsonProperty("High Velocity Rocket")]
public bool HighVelocityRocket;
[JsonProperty("Rocket")]
public bool Rocket;
[JsonProperty("Timed Explosive Charge")]
public bool TimedExplosiveCharge;
[JsonProperty("Metal Chest Plate")]
public bool MetalChestPlate;
[JsonProperty("Metal Facemask")]
public bool MetalFacemask;
[JsonProperty("Explosives")]
public bool Explosives;
[JsonProperty("High External Stone Gate")]
public bool HighExternalStoneGate;
[JsonProperty("Armored Door")]
public bool ArmoredDoor;
[JsonProperty("Armored Double Door")]
public bool ArmoredDoubleDoor;
[JsonProperty("Reinforced Window Bars")]
public bool ReinforcedWindowBars;
[JsonProperty("4x Zoom Scope")]
public bool Zoom4xScope;
[JsonProperty("Rocket Launcher")]
public bool RocketLauncher;
[JsonProperty("Weapon Lasersight")]
public bool WeaponLasersight;
[JsonProperty("Holosight")]
public bool Holosight;
[JsonProperty("Bolt Action Rifle")]
public bool BoltActionRifle;
[JsonProperty("Assault Rifle")]
public bool AssaultRifle;
[JsonProperty("MP5A4")]
public bool MP5A4;
[JsonProperty("Explosive 5.56 Rifle Ammo")]
public bool Explosive556RifleAmmo;
}
void ReadData() {
StudyTreeUser = Interface.Oxide.DataFileSystem.ReadObject<Dictionary<ulong, StudyTreeData>>("StudyTree/StudyTreeData");
}
void WriteData() {
Interface.Oxide.DataFileSystem.WriteObject("StudyTree/StudyTreeData", StudyTreeUser);
}
void RegisteredDataUser(BasePlayer player) {
if (!StudyTreeUser.ContainsKey(player.userID)) {
StudyTreeUser.Add(player.userID, new StudyTreeData {
BeancanGrenade = false, GasMask = false, SnapTrap = false, ShotgunTrap = false, FlameTurret = false, PistolBullet = false, FireArrow = false, Silencer = false, WeaponFlashlight = false, WaterpipeShotgun = false, DoubleBarrelShotgun = false, SalvagedCleaver = false, Mace = false, Revolver = false, SalvagedSword = false, Pickaxe = false, SatchelCharge = false, Hatchet = false, SalvagedHammer = false, Binoculars = false, RFTransmitter = false, SnowJacket = false, RiotHelmet = false, TankTop = false, Shirt = false, Jacket = false, MinersHat = false, BucketHelmet = false, LongsleeveTShirt = false, Pants = false, TShirt = false, ReactiveTarget = false, Fridge = false, DropBox = false, Chair = false, CeilingLight = false, Bed = false, WoodenLadder = false, SmallWaterCatcher = false, HighExternalWoodenWall = false, HighExternalWoodenGate = false, BarbedWoodenBarricade = false, ReinforcedGlassWindow = false, MetalWindowBars = false, MetalVerticalEmbrasure = false, MetalHorizontalEmbrasure = false, SandbagBarricade = false, WatchTower = false, GarageDoor = false, ChainlinkFence = false, FloorGrill = false, Chainsaw = false, AutoTurret = false, Gauge12Slug = false, Gauge12IncendiaryShell = false, IncendiaryRocket = false, HVPistolAmmo = false, IncendiaryPistolAmmo = false, SAMAmmo = false, Gauge12Buckshot = false, Rifle556Ammo = false, CustomSMG = false, MuzzleBrake = false, MuzzleBoost = false, Thompson = false, PumpShotgun = false, SemiAutomaticRifle = false, SemiAutomaticPistol = false, F1Grenade = false, Longsword = false, FlameThrower = false, PythonRevolver = false, LargeMedkit = false, MedicalSyringe = false, SalvagedIcepick = false, Сhainsaw = false, SalvegedAxe = false, RoadSingJacket = false, RoadSingKilt = false, CoffeeCanHelmet = false, Boots = false, RoadsingGloves = false, Hoodie = false, HeavyPlatePants = false, HeavyPlateJacket = false, HazmatSuit = false, HeavyPlateHelmet = false, SearchLight = false, WindTurbine = false, SmallOilRefinery = false, Locker = false, LargeFurnace = false, HighExternalStoneWall = false, MetalBarricade = false, LargeWaterCatcher = false, PrisonCellWall = false, PrisonCellGate = false, ConcreteBarricade = false, LadderHatch = false, LandMine = false, RFPager = false, RFReceiver = false, LargeRechargableBattery = false, HBHFSensor = false, RFBroadcaster = false, Incendiary556RifleAmmo = false, HV556RifleAmmo = false, HighVelocityRocket = false, Rocket = false, TimedExplosiveCharge = false, MetalChestPlate = false, MetalFacemask = false, Explosives = false, HighExternalStoneGate = false, ArmoredDoor = false, ArmoredDoubleDoor = false, ReinforcedWindowBars = false, Zoom4xScope = false, RocketLauncher = false, WeaponLasersight = false, Holosight = false, BoltActionRifle = false, AssaultRifle = false, MP5A4 = false, Explosive556RifleAmmo = false
}
);
}
}
#endregion
#region Хуки и вспомогательные классы для работы плагина
void InitFileManager() {
FileManagerObject = new GameObject("StudyTree_FileManagerObject");
m_FileManager = FileManagerObject.AddComponent<FileManager>();
}
private void OnServerInitialized() {
Instance = this;
ReadData();
InitFileManager();
ServerMgr.Instance.StartCoroutine(LoadImages());
foreach (var player in BasePlayer.activePlayerList) {
RegisteredDataUser(player);
}
}
IEnumerator LoadImages() {
int i = 0;
int lastpercent = -1;
foreach (var name in StudyImageList.Keys.ToList()) {
yield return m_FileManager.StartCoroutine(m_FileManager.LoadFile(name, StudyImageList[name]));
if (m_FileManager.GetPng(name) == null) yield return new WaitForSeconds(3);
StudyImageList[name] = m_FileManager.GetPng(name);
int percent = (int) (i / (float) StudyImageList.Keys.ToList().Count * 100);
if (percent % 20 == 0 && percent != lastpercent) {
Puts($"Идёт загрузка изображений, загружено: {percent}%");
lastpercent = percent;
}
i++;
}
ImageInit = true;
m_FileManager.SaveData();
PrintWarning("Успешно загружено {0} изображения", i);
}
void OnPlayerInit(BasePlayer player) {
RegisteredDataUser(player);
}
private void Unload() {
WriteData();
UnityEngine.Object.Destroy(FileManagerObject);
foreach (BasePlayer player in BasePlayer.activePlayerList) {
player.SetFlag(BaseEntity.Flags.Reserved3, false);
CuiHelper.DestroyUi(player, LayerWorkbenchLevelOne);
CuiHelper.DestroyUi(player, LayerWorkbenchLevelTwo);
CuiHelper.DestroyUi(player, LayerWorkbenchLevelThree);
CuiHelper.DestroyUi(player, "PanalUI");
CuiHelper.DestroyUi(player, "InfoPanalUI");
}
}
#endregion
#region Записываем изучение, когда игрок изучает предмет с помощью чертежа.private void OnItemAction(Item item, string action, BasePlayer player)
{
if (player == null || item == null) return;
if (action != "study") return;
if (item.blueprintTargetDef.shortname == "hat.miner") {
StudyTreeUser[player.userID].MinersHat = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "tshirt") {
StudyTreeUser[player.userID].TShirt = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shirt.collared") {
StudyTreeUser[player.userID].Shirt = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "tshirt.long") {
StudyTreeUser[player.userID].LongsleeveTShirt = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "pants") {
StudyTreeUser[player.userID].Pants = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "riot.helmet") {
StudyTreeUser[player.userID].RiotHelmet = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "bucket.helmet") {
StudyTreeUser[player.userID].GasMask = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "jacket.snow") {
StudyTreeUser[player.userID].SnowJacket = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "jacket") {
StudyTreeUser[player.userID].Jacket = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "hammer.salvaged") {
StudyTreeUser[player.userID].SalvagedHammer = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "salvaged.cleaver") {
StudyTreeUser[player.userID].SalvagedCleaver = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "mace") {
StudyTreeUser[player.userID].Mace = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "trap.bear") {
StudyTreeUser[player.userID].SnapTrap = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "flameturret") {
StudyTreeUser[player.userID].FlameTurret = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "guntrap") {
StudyTreeUser[player.userID].ShotgunTrap = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.pistol") {
StudyTreeUser[player.userID].PistolBullet = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.silencer") {
StudyTreeUser[player.userID].Silencer = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shotgun.waterpipe") {
StudyTreeUser[player.userID].WaterpipeShotgun = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "pistol.revolver") {
StudyTreeUser[player.userID].Revolver = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.flashlight") {
StudyTreeUser[player.userID].WeaponFlashlight = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shotgun.double") {
StudyTreeUser[player.userID].DoubleBarrelShotgun = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "explosive.satchel") {
StudyTreeUser[player.userID].SatchelCharge = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "grenade.beancan") {
StudyTreeUser[player.userID].BeancanGrenade = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "barricade.woodwire") {
StudyTreeUser[player.userID].BarbedWoodenBarricade = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "water.catcher.small") {
StudyTreeUser[player.userID].SmallWaterCatcher = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shutter.metal.embrasure.b") {
StudyTreeUser[player.userID].MetalVerticalEmbrasure = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shutter.metal.embrasure.a") {
StudyTreeUser[player.userID].MetalHorizontalEmbrasure = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "floor.grill") {
StudyTreeUser[player.userID].FloorGrill = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.window.bars.metal") {
StudyTreeUser[player.userID].MetalWindowBars = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "watchtower.wood") {
StudyTreeUser[player.userID].WatchTower = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ladder.wooden.wall") {
StudyTreeUser[player.userID].WoodenLadder = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "bed") {
StudyTreeUser[player.userID].Bed = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "dropbox") {
StudyTreeUser[player.userID].DropBox = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.external.high") {
StudyTreeUser[player.userID].HighExternalWoodenWall = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "gates.external.high.wood") {
StudyTreeUser[player.userID].HighExternalWoodenGate = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.frame.garagedoor") {
StudyTreeUser[player.userID].GarageDoor = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "hazmatsuit") {
StudyTreeUser[player.userID].HazmatSuit = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "coffeecan.helmet") {
StudyTreeUser[player.userID].CoffeeCanHelmet = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shoes.boots") {
StudyTreeUser[player.userID].Boots = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "syringe.medical") {
StudyTreeUser[player.userID].MedicalSyringe = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "roadsign.jacket") {
StudyTreeUser[player.userID].RoadSingJacket = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "hoodie") {
StudyTreeUser[player.userID].Hoodie = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "largemedkit") {
StudyTreeUser[player.userID].LargeMedkit = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "roadsign.kilt") {
StudyTreeUser[player.userID].RoadSingKilt = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "roadsign.gloves") {
StudyTreeUser[player.userID].RoadsingGloves = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "heavy.plate.helmet") {
StudyTreeUser[player.userID].HeavyPlateHelmet = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "heavy.plate.jacket") {
StudyTreeUser[player.userID].HeavyPlateJacket = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "heavy.plate.pants") {
StudyTreeUser[player.userID].HeavyPlatePants = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "longsword") {
StudyTreeUser[player.userID].Longsword = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "axe.salvaged") {
StudyTreeUser[player.userID].SalvegedAxe = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "icepick.salvaged") {
StudyTreeUser[player.userID].SalvagedIcepick = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "chainsaw") {
StudyTreeUser[player.userID].Chainsaw = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "flamethrower") {
StudyTreeUser[player.userID].FlameThrower = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "trap.landmine") {
StudyTreeUser[player.userID].LandMine = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.shotgun") {
StudyTreeUser[player.userID].Gauge12Buckshot = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.shotgun.slug") {
StudyTreeUser[player.userID].Gauge12Slug = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "shotgun.pump") {
StudyTreeUser[player.userID].PumpShotgun = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.shotgun.fire") {
StudyTreeUser[player.userID].Gauge12IncendiaryShell = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "pistol.semiauto") {
StudyTreeUser[player.userID].SemiAutomaticPistol = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "grenade.f1") {
StudyTreeUser[player.userID].F1Grenade = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.muzzlebrake") {
StudyTreeUser[player.userID].MuzzleBrake = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.muzzleboost") {
StudyTreeUser[player.userID].MuzzleBoost = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "pistol.python") {
StudyTreeUser[player.userID].PythonRevolver = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.pistol.fire") {
StudyTreeUser[player.userID].IncendiaryPistolAmmo = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.pistol.hv") {
StudyTreeUser[player.userID].HVPistolAmmo = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "smg.thompson") {
StudyTreeUser[player.userID].Thompson = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "smg.2") {
StudyTreeUser[player.userID].CustomSMG = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "rifle.semiauto") {
StudyTreeUser[player.userID].SemiAutomaticRifle = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.rifle") {
StudyTreeUser[player.userID].Rifle556Ammo = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.rocket.fire") {
StudyTreeUser[player.userID].IncendiaryRocket = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "water.catcher.large") {
StudyTreeUser[player.userID].LargeWaterCatcher = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.frame.cell.gate") {
StudyTreeUser[player.userID].PrisonCellGate = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "barricade.concrete") {
StudyTreeUser[player.userID].ConcreteBarricade = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.frame.cell") {
StudyTreeUser[player.userID].PrisonCellWall = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "barricade.metal") {
StudyTreeUser[player.userID].MetalBarricade = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "locker") {
StudyTreeUser[player.userID].Locker = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.external.high.stone") {
StudyTreeUser[player.userID].HighExternalStoneWall = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "small.oil.refinery") {
StudyTreeUser[player.userID].SmallOilRefinery = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "floor.ladder.hatch") {
StudyTreeUser[player.userID].LadderHatch = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "furnace.large") {
StudyTreeUser[player.userID].LargeFurnace = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "generator.wind.scrap") {
StudyTreeUser[player.userID].WindTurbine = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "autoturret") {
StudyTreeUser[player.userID].AutoTurret = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "wall.window.bars.toptier") {
StudyTreeUser[player.userID].ReinforcedWindowBars = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "door.hinged.toptier") {
StudyTreeUser[player.userID].ArmoredDoor = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "door.double.hinged.toptier") {
StudyTreeUser[player.userID].ArmoredDoubleDoor = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "gates.external.high.stone") {
StudyTreeUser[player.userID].HighExternalStoneGate = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "metal.facemask") {
StudyTreeUser[player.userID].MetalFacemask = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "metal.plate.torso") {
StudyTreeUser[player.userID].MetalChestPlate = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.lasersight") {
StudyTreeUser[player.userID].WeaponLasersight = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.rifle.hv") {
StudyTreeUser[player.userID].HV556RifleAmmo = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.rifle.incendiary") {
StudyTreeUser[player.userID].Incendiary556RifleAmmo = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "smg.mp5") {
StudyTreeUser[player.userID].MP5A4 = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.holosight") {
StudyTreeUser[player.userID].Holosight = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "weapon.mod.small.scope") {
StudyTreeUser[player.userID].Zoom4xScope = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "ammo.rifle.explosive") {
StudyTreeUser[player.userID].Explosive556RifleAmmo = true;
WriteData();
}
if (item.blueprintTargetDef.shortname == "rifle.ak") {
StudyTreeUser[player.userID].AssaultRifle = true;
WriteData();
// ... [Code preview truncated due to length. Full source in attached file] ...