C#:
using Facepunch;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Rust;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;
using ru = Oxide.Game.Rust;
namespace Oxide.Plugins {
[Info("ArenaTournament", "https://topplugin.ru/resources/arenatournament.519/", "1.0.71")]
[Description("Турнир на выбывание | Knockout tournament")]
public class ArenaTournament : RustPlugin {
const bool fermensEN = false;
const bool debug = false;
#region Config
private PluginConfig config;
protected override void LoadDefaultConfig() {
config = new PluginConfig();
}
protected override void LoadConfig() {
base.LoadConfig();
config = Config.ReadObject<PluginConfig>();
}
protected override void SaveConfig() {
Config.WriteObject(config);
}
class IITEM {
[JsonProperty(PropertyName = fermensEN ? "Name" : "Название")]
public string name;
[JsonProperty(PropertyName = "Shortname")]
public string shortname;
[JsonProperty(PropertyName = fermensEN ? "SkinID" : "СкинID")]
public ulong skin;
[JsonProperty(PropertyName = fermensEN ? "Amount" : "Количество")]
public int amount;
[JsonProperty(PropertyName = fermensEN ? "Blueprint [true/false]" : "Рецепт [true/false]")]
public bool blueprintTarget;
}
class SkinTeam {
[JsonProperty(PropertyName = fermensEN ? "SkinId for team #1" : "Скин для команды #1")]
public ulong skinteam1;
[JsonProperty(PropertyName = fermensEN ? "SkinId for team #2" : "Скин для команды #2")]
public ulong skinteam2;
}
class GUNITEM {
[JsonProperty(PropertyName = fermensEN ? "Shortname <weapon>" : "Shortname <оружия>")]
public string shortname;
[JsonProperty(PropertyName = fermensEN ? "SkinID <weapon>" : "СкинID <оружия>")]
public ulong skin;
[JsonProperty(PropertyName = fermensEN ? "Wear [shortname|skinID]" : "Одежда [shortname|cкинID]")]
public Dictionary<string, SkinTeam> wear = new Dictionary<string, SkinTeam>();
[JsonProperty(PropertyName = fermensEN ? "Modules for weapons [shortname]" : "Модули на оружия [shortname]")]
public List<string> moduls = new List<string>();
[JsonProperty(PropertyName = fermensEN ? "Additional Items [shortname|amount]" : "Дополнительные предметы [shortname|количество]")]
public Dictionary<string, int> additional = new Dictionary<string, int>();
}
class Reward {
[JsonProperty(PropertyName = fermensEN ? "Command sent | message to player" : "Отправляемая команда | сообщение игроку")]
public Dictionary<string, string> commands = new Dictionary<string, string>();
[JsonProperty(PropertyName = fermensEN ? "Items" : "Предметы")]
public List<IITEM> iTEMs = new List<IITEM>();
}
class SPEC {
[JsonProperty(PropertyName = fermensEN ? "Wear [shortname|cкинID]" : "Одежда [shortname|скин]")]
public Dictionary<string, ulong> wears = new Dictionary<string, ulong>();
[JsonProperty(PropertyName = fermensEN ? "Additional Items [shortname|amount]" : "Дополнительные предметы [shortname|количество]")]
public Dictionary<string, int> additional = new Dictionary<string, int>();
}
private class CurrentEvent {
[JsonProperty(PropertyName = fermensEN ? "Position [coordinates]" : "Позиция [координаты]")]
public Vector3 position;
[JsonProperty(PropertyName = fermensEN ? "Arena radius" : "Радиус арены")]
public float radius;
[JsonProperty(PropertyName = fermensEN ? "Weapons" : "Оружия")]
public List<GUNITEM> weapons = new List<GUNITEM>();
[JsonProperty(PropertyName = fermensEN ? "Spectators" : "Зрители")]
public SPEC sPEC;
[JsonProperty(PropertyName = fermensEN ? "Awards [place|award]" : "Награды [место|награда]")]
public Dictionary<int, Reward> reward;
[JsonProperty(PropertyName = fermensEN ? "<xVSx> Tournament Modes" : "Режимы турниров <xVSx>")]
public List<int> vs = new List<int>();
//[JsonProperty(PropertyName = "")]
//public bool wound;
}
private class ArenaSetting {
public List<Vector3> spectators = new List<Vector3>();
public List<Vector3> duelers1 = new List<Vector3>();
public List<Vector3> duelers2 = new List<Vector3>();
}
class UIRegistration {
public string anchormin {
get;
set;
}
= "0.5 0";
public string anchormax {
get;
set;
}
= "0.5 0";
public string offsetmin {
get;
set;
}
= "-440 48";
public string offsetmax {
get;
set;
}
= "-267 130";
public string background_color {
get;
set;
}
= "0.2313726 0.2313726 0.2313726 0.3882353";
public string button_color {
get;
set;
}
= "0 0 0 0.7058824";
public string text_color {
get;
set;
}
= "0 0 0 0.7058824";
}
private class PluginConfig {
#region ARENAS
[JsonProperty(fermensEN ? "Tournament arenas" : "Турнирные арены")]
public Dictionary<string, CurrentEvent> currentEvent {
get;
set;
}
= new Dictionary<string, CurrentEvent> {
{
"ater", new CurrentEvent {
weapons = new List<GUNITEM> {
{
new GUNITEM {
shortname = "rifle.ak", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.muzzlebrake", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "rifle.ak.ice", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.muzzlebrake", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "lmg.m249", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.muzzlebrake", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "rifle.semiauto", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.muzzlebrake", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "rifle.bolt", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.small.scope", 1
}
, {
"weapon.mod.8x.scope", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "rifle.l96", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.small.scope", 1
}
, {
"weapon.mod.8x.scope", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "rifle.m39", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.small.scope", 1
}
, {
"weapon.mod.8x.scope", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "rifle.lr300", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "smg.mp5", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.muzzleboost", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "pistol.m92", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "shotgun.spas12", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "smg.thompson", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.muzzleboost", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "shotgun.waterpipe", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"grenade.f1", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"pants", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"metal.plate.torso", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"shoes.boots", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
}
}
}
, {
new GUNITEM {
shortname = "pistol.semiauto", moduls = new List<string> {
}
, skin = 0, additional = new Dictionary<string, int> {
{
"syringe.medical", 5
}
, {
"weapon.mod.holosight", 1
}
, {
"weapon.mod.simplesight", 1
}
, {
"weapon.mod.silencer", 1
}
, {
"weapon.mod.lasersight", 1
}
}
, wear = new Dictionary<string, SkinTeam> {
{
"metal.facemask", new SkinTeam {
skinteam1 = 0, skinteam2 = 0
}
}
, {
"hoodie", new SkinTeam {
skinteam1 = 954947279, skinteam2 = 971807764
}
}
, {
"roadsign.gloves", new SkinTeam {
skintea
// ... [Code preview truncated due to length. Full source in attached file] ...