C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
// #define TESTING
#if TESTING
using System.Diagnostics;
#endif
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Oxide.Core;
using Oxide.Core.Libraries.Covalence;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Random = UnityEngine.Random;
namespace Oxide.Plugins
{
[Info("Battlepass", "Mevent", "1.37.17")]
public class Battlepass : RustPlugin
{
#region Fields
[PluginReference] private Plugin
ImageLibrary = null,
PlayerDatabase = null,
Notify = null,
UINotify = null,
NoEscape = null;
private const string
Layer = "UI.Battlepass",
ModalLayer = "UI.Battlepass.Modal";
private static Battlepass _instance;
private bool _needUpdate;
private Timer _updateMissions, _refreshCooldown;
private bool _enabledImageLibrary;
private readonly Dictionary<int, ItemConf> _itemById = new Dictionary<int, ItemConf>();
private readonly Dictionary<ulong, List<ItemConf>> _openedCaseItems =
new Dictionary<ulong, List<ItemConf>>();
private List<GeneralMission> _generalMissions = new List<GeneralMission>();
private List<int> _privateMissions = new List<int>();
private readonly List<BasePlayer> _missionPlayers = new List<BasePlayer>();
private DateTime _nextTime;
private readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0);
private enum MissionType
{
Gather,
Kill,
Craft,
Look,
Build,
Upgrade,
Fishing,
LootCrate,
Swipe,
RaidableBases,
RecycleItem,
HackCrate,
PurchaseFromNpc,
ArcticBaseEvent,
GasStationEvent,
SputnikEvent,
ShipwreckEvent,
HarborEvent,
JunkyardEvent,
SatDishEvent,
WaterEvent,
AirEvent,
PowerPlantEvent,
ArmoredTrainEvent,
ConvoyEvent,
SurvivalArena,
KillBoss,
}
private class GeneralMission
{
public int ID;
public MissionConfig Mission;
public GeneralMission(int id, MissionConfig mission)
{
ID = id;
Mission = mission;
}
public void Check(BasePlayer player, ref PlayerData data, MissionType type, Item item = null,
BaseEntity entity = null,
int greade = 0, int itemAmount = -1,
string mode = null,
ItemDefinition definition = null)
{
if (Mission.Type != type || !_config.Missions.ContainsKey(ID)) return;
data.Missions.TryAdd(ID, 0);
if (data.Missions[ID] >= Mission.Amount) return;
var amount = GetMissionAmount(Mission, item, entity, greade, itemAmount, mode, definition);
data.Missions[ID] += amount;
if (data.Missions[ID] >= Mission.Amount)
{
CompleteMission(player, Mission);
if (_config.ResetQuestAfterComplete) data.Missions[ID] = 0;
}
}
}
private enum ItemType
{
Item,
Command,
Plugin
}
#endregion
#region Config
private static Configuration _config;
private class Configuration
{
[JsonProperty(PropertyName = "Команда | Command")]
public string Command = "pass";
[JsonProperty(PropertyName = "Команды для страницы миссий | Commands for Missions page")]
public string[] MissionsCommands = {"passmissions", "pmissions"};
[JsonProperty(PropertyName = "Команды для страницы кейсов | Commands for Cases page")]
public string[] CasesCommands = {"passcase"};
[JsonProperty(PropertyName = "Команды для страницы инвентаря | Commands for Inventory page")]
public string[] InventoryCommands = {"passinv"};
[JsonProperty(PropertyName = "Работать с Notify? | Work with Notify?")]
public bool UseNotify = true;
[JsonProperty(PropertyName = "Право | Permission")]
public string Permission = "battlepass.use";
[JsonProperty(PropertyName = "Фон | Background")]
public string Background = "https://i.imgur.com/Duv8iVm.jpg";
[JsonProperty(PropertyName = "Логотип | Logo")]
public string Logo = "https://i.imgur.com/mhRO2AN.png";
[JsonProperty(PropertyName =
"Сбрасывать квест после его завершения? | Reset the quest after completing it?")]
public bool ResetQuestAfterComplete = false;
[JsonProperty(PropertyName = "Настройки Вайпа | Wipe Settings")]
public WipeSettings Wipe = new WipeSettings
{
Players = false,
Missions = false
};
[JsonProperty(PropertyName = "Валюта 1 | Currency 1")]
public FirstCurrencyClass FirstCurrency = new FirstCurrencyClass
{
Image = "https://i.imgur.com/qhPQblv.png",
UseDefaultCur = true,
AddHook = "Deposit",
BalanceHook = "Balance",
RemoveHook = "Withdraw",
Plug = "Economics",
Rates = new Dictionary<string, float>
{
["battlepass.vip"] = 2f,
["battlepass.premium"] = 3f
}
};
[JsonProperty(PropertyName = "Использовать 2 валюту? | Use 2nd currency?")]
public bool useSecondCur = true;
[JsonProperty(PropertyName = "Валюта 2 | Currency 2")]
public SecondCurrencyClass SecondCurrency = new SecondCurrencyClass
{
Permission = "battlepass.vip",
Image = "https://i.ibb.co/gRbyTFW/image.png",
UseDefaultCur = true,
AddHook = "Deposit",
BalanceHook = "Balance",
RemoveHook = "Withdraw",
Plug = "Economics"
};
[JsonProperty(PropertyName = "Изображение топ награды | Image Top Awards")]
public string AdvanceAwardImg = "https://i.imgur.com/bUDH1sf.png";
[JsonProperty(PropertyName = "Фон для кейсов | Background for cases")]
public string CaseBG = "https://i.imgur.com/tlMMjqc.png";
[JsonProperty(PropertyName = "Кейсы | Cases", ObjectCreationHandling = ObjectCreationHandling.Replace)]
public List<CaseClass> Cases = new List<CaseClass>
{
new CaseClass
{
DisplayName = "Кейс 'Сокровища пиратов'",
Permission = "battlepass.vip",
Image = "https://i.ibb.co/M2bNGcM/tsPPUhg.png",
FCost = 3000,
PCost = 1500,
Items = new List<ItemConf>
{
new ItemConf
{
Title = "Дерево (2000 шт.)",
Chance = 80,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "wood",
Skin = 0,
Amount = 2000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Камень (3000 шт.)",
Chance = 70,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "stones",
Skin = 0,
Amount = 3000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Штурмовая винтовка",
Chance = 50,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "rifle.ak",
Skin = 0,
Amount = 1,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Сера (10000 шт.)",
Chance = 25,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "sulfur",
Skin = 0,
Amount = 10000,
Command = string.Empty,
PluginAward = new PluginAward()
}
}
},
new CaseClass
{
DisplayName = "Легендарный кейс",
Permission = "battlepass.use",
Image = "https://i.ibb.co/XLPg66N/3mtbqji.png",
FCost = 2000,
PCost = 1000,
Items = new List<ItemConf>
{
new ItemConf
{
Title = "Дерево (2000 шт.)",
Chance = 80,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "wood",
Skin = 0,
Amount = 2000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Камень (3000 шт.)",
Chance = 70,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "stones",
Skin = 0,
Amount = 3000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Штурмовая винтовка",
Chance = 50,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "rifle.ak",
Skin = 0,
Amount = 1,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Сера (10000 шт.)",
Chance = 25,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "sulfur",
Skin = 0,
Amount = 10000,
Command = string.Empty,
PluginAward = new PluginAward()
}
}
},
new CaseClass
{
DisplayName = "Кейс мастера",
Permission = "battlepass.use",
Image = "https://i.ibb.co/FBpxMmK/NvHk5Sw.png",
FCost = 1500,
PCost = 750,
Items = new List<ItemConf>
{
new ItemConf
{
Title = "Дерево (2000 шт.)",
Chance = 80,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "wood",
Skin = 0,
Amount = 2000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Камень (3000 шт.)",
Chance = 70,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "stones",
Skin = 0,
Amount = 3000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Штурмовая винтовка",
Chance = 50,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "rifle.ak",
Skin = 0,
Amount = 1,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Сера (10000 шт.)",
Chance = 25,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "sulfur",
Skin = 0,
Amount = 10000,
Command = string.Empty,
PluginAward = new PluginAward()
}
}
},
new CaseClass
{
DisplayName = "Кейс профессионала",
Permission = "battlepass.use",
Image = "https://i.ibb.co/4Y4K8vm/kZyZqy9.png",
FCost = 1000,
PCost = 500,
Items = new List<ItemConf>
{
new ItemConf
{
Title = "Дерево (2000 шт.)",
Chance = 80,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "wood",
Skin = 0,
Amount = 2000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Камень (3000 шт.)",
Chance = 70,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "stones",
Skin = 0,
Amount = 3000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Штурмовая винтовка",
Chance = 50,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "rifle.ak",
Skin = 0,
Amount = 1,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Сера (10000 шт.)",
Chance = 25,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "sulfur",
Skin = 0,
Amount = 10000,
Command = string.Empty,
PluginAward = new PluginAward()
}
}
},
new CaseClass
{
DisplayName = "Кейс любителя",
Permission = "battlepass.use",
Image = "https://i.ibb.co/9yMhCrR/5bur68a.png",
FCost = 500,
PCost = 250,
Items = new List<ItemConf>
{
new ItemConf
{
Title = "Дерево (2000 шт.)",
Chance = 80,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "wood",
Skin = 0,
Amount = 2000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Камень (3000 шт.)",
Chance = 70,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "stones",
Skin = 0,
Amount = 3000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Штурмовая винтовка",
Chance = 50,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "rifle.ak",
Skin = 0,
Amount = 1,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Сера (10000 шт.)",
Chance = 25,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "sulfur",
Skin = 0,
Amount = 10000,
Command = string.Empty,
PluginAward = new PluginAward()
}
}
},
new CaseClass
{
DisplayName = "Кейс новичка",
Permission = "",
Image = "https://i.ibb.co/chhtKTK/9KIoJ2G.png",
FCost = 150,
PCost = 75,
Items = new List<ItemConf>
{
new ItemConf
{
Title = "Дерево (2000 шт.)",
Chance = 80,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "wood",
Skin = 0,
Amount = 2000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Камень (3000 шт.)",
Chance = 70,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "stones",
Skin = 0,
Amount = 3000,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Штурмовая винтовка",
Chance = 50,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "rifle.ak",
Skin = 0,
Amount = 1,
Command = string.Empty,
PluginAward = new PluginAward()
},
new ItemConf
{
Title = "Сера (10000 шт.)",
Chance = 25,
Type = ItemType.Item,
Image = string.Empty,
DisplayName = string.Empty,
Shortname = "sulfur",
Skin = 0,
Amount = 10000,
Command = string.Empty,
PluginAward = new PluginAward()
}
}
}
};
[JsonProperty(PropertyName = "Количество общих миссий в день | Total missions per day")]
public int MissionsCount = 7;
[JsonProperty(PropertyName =
"Раз во сколько часов обновлять миссии? | How many hours are missions updated?")]
public int MissionHours = 24;
[JsonProperty(PropertyName = "Настройка общих миссий | Settings shared missions",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<int, MissionConfig> Missions = new Dictionary<int, MissionConfig>
{
[1] = MissionConfig.CreateDefault(MissionType.Gather, "stones", "Добыть 5000 камней", 5000, 50,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[2] = MissionConfig.CreateDefault(MissionType.Kill, "player", "Убить 3 игроков", 3, 90,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[3] = MissionConfig.CreateDefault(MissionType.Craft, "ammo.rocket.basic", "Скрафтить 15 ракет", 15, 75,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[4] = MissionConfig.CreateDefault(MissionType.Look, "metalspring", "Залутать 10 металлических пружин",
10, 50,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[5] = MissionConfig.CreateDefault(MissionType.Build, "wall.external.high.stone",
"Построить 25 высоких внешних каменных стен для защиты Вашего дома", 25, 100),
[6] = MissionConfig.CreateDefault(MissionType.Upgrade, "foundation.prefab",
"Улучшить 10 фундаментов в металл", 10, 60,
grade: 3),
[7] = MissionConfig.CreateDefault(MissionType.Gather, "wood", "Добыть 10000 дерева", 10000, 50,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[8] = MissionConfig.CreateDefault(MissionType.Craft, "door.hinged.toptier",
"Скрафтите 3 бронированные двери для дома", 3,
85,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[9] = MissionConfig.CreateDefault(MissionType.Fishing, "fish.herring", "Поймать 10 сельдей", 10, 50,
useSecondAward: true, secondAward: 25),
[10] = MissionConfig.CreateDefault(MissionType.Swipe, "keycard_blue",
"Проведите синей карточкой на монументах 10 раз", 10, 50, useSecondAward: true, secondAward: 25),
[11] = MissionConfig.CreateDefault(MissionType.RaidableBases, string.Empty,
"Выиграйте событие RaidableBases 3 раза", 3, 75,
raidMode: "Easy"),
[12] = MissionConfig.CreateDefault(MissionType.RecycleItem, "riflebody",
"Переботайте 15 корпусов винтовки", 15,
50),
[13] = MissionConfig.CreateDefault(MissionType.HackCrate, "codelockedhackablecrate",
"Взломайте 3 запертых ящика", 3, 50),
[14] = MissionConfig.CreateDefault(MissionType.PurchaseFromNpc, "scrap", "Купите 1000 скрапа у ботов",
1000, 50),
[15] = MissionConfig.CreateDefault(MissionType.ArcticBaseEvent, string.Empty,
"Выиграйте \"Artic Base Event\" 3 раза", 3, 100, enabled: false),
[16] = MissionConfig.CreateDefault(MissionType.GasStationEvent, string.Empty,
"Выиграйте \"GasStation Event\" 3 раза", 3, 100, enabled: false),
[17] = MissionConfig.CreateDefault(MissionType.SputnikEvent, string.Empty,
"Выиграйте \"Sputnik Event\" 3 раза", 3, 100, enabled: false),
[18] = MissionConfig.CreateDefault(MissionType.ShipwreckEvent, string.Empty,
"Выиграйте \"Shipwreck Event\" 3 раза", 3, 100, enabled: false),
[19] = MissionConfig.CreateDefault(MissionType.HarborEvent, string.Empty,
"Выиграйте \"Harbor Event\" 3 раза", 3, 100, enabled: false),
[20] = MissionConfig.CreateDefault(MissionType.JunkyardEvent, string.Empty,
"Выиграйте \"Junkyard Event\" 3 раза", 3, 100, enabled: false),
[21] = MissionConfig.CreateDefault(MissionType.SatDishEvent, string.Empty,
"Выиграйте \"Sat Dish Event\" 3 раза", 3, 100, enabled: false),
[22] = MissionConfig.CreateDefault(MissionType.WaterEvent, string.Empty,
"Выиграйте \"Water Event\" 3 раза", 3, 100, enabled: false),
[23] = MissionConfig.CreateDefault(MissionType.AirEvent, string.Empty,
"Выиграйте \"Air Event\" 3 раза", 3, 100, enabled: false),
[24] = MissionConfig.CreateDefault(MissionType.PowerPlantEvent, string.Empty,
"Выиграйте \"Power Plant Event\" 3 раза", 3, 100, enabled: false),
[25] = MissionConfig.CreateDefault(MissionType.ArmoredTrainEvent, string.Empty,
"Выиграйте \"Armored Train Event\" 3 раза", 3, 100, enabled: false),
[26] = MissionConfig.CreateDefault(MissionType.ConvoyEvent, string.Empty,
"Выиграйте \"Convoy Event\" 3 раза", 3, 100, enabled: false),
[27] = MissionConfig.CreateDefault(MissionType.SurvivalArena, string.Empty,
"Выиграйте \"Survival Arena\" 3 раза", 3, 100, enabled: false),
[28] = MissionConfig.CreateDefault(MissionType.KillBoss, string.Empty,
"Убейте босса 5 раз", 5, 75, enabled: false)
};
[JsonProperty(PropertyName = "Настройка вызова дня | Settings challenge of the day",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<int, MissionConfig> PrivateMissions = new Dictionary<int, MissionConfig>
{
[1] = MissionConfig.CreateDefault(MissionType.Gather, "stones", "Добыть 5000 камней", 5000, 50,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[2] = MissionConfig.CreateDefault(MissionType.Kill, "player", "Убить 3 игроков", 3, 90,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[3] = MissionConfig.CreateDefault(MissionType.Craft, "ammo.rocket.basic", "Скрафтить 15 ракет", 15, 75,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[4] = MissionConfig.CreateDefault(MissionType.Look, "metalspring", "Залутать 10 металлических пружин",
10, 50,
useAdvanceAward: true,
advanceAward: ItemConf.CreateItem(1031, "rifle.ak", 1, 1230963555, "Talon AK-47")),
[5] = MissionConfig.CreateDefault(MissionType.Build, "wall.external.high.stone",
"Построить 25 высоких внешних каменных стен для защиты Вашего дома", 25, 100),
[6] = MissionConfig.CreateDefault(MissionType.Upgrade, "foundation.prefab",
"Улучшить 10 фундаментов в металл", 10, 60,
grade: 3),
};
[JsonProperty(PropertyName = "Включить логирование в консоль? | Enable logging to the console?")]
public bool LogToConsole = true;
[JsonProperty(PropertyName = "Включить логирование в файл? | Enable logging to the file?")]
public bool LogToFile = true;
[JsonProperty(PropertyName = "PlayerDatabase")]
public PlayerDatabaseConf PlayerDatabase = new PlayerDatabaseConf(false, "Battlepass");
[JsonProperty(PropertyName = "Настройка лута (для контейнеров хранения)")]
public LootSettings StorageLoot = new LootSettings
{
Enabled = true,
Containers = new Dictionary<string, List<ulong>>
{
["box.wooden.large"] = new List<ulong>
{
2764183607,
624269671
},
["stocking_small_deployed"] = new List<ulong>
{
0
}
}
};
[JsonProperty(PropertyName = "Задержка после вайпа (0 - отключить)")]
public CooldownSettings WipeCooldown = new CooldownSettings
{
Inventory = 0
};
[JsonProperty(PropertyName = "Выдавать предметы из кейса сразу игроку?")]
public bool CaseItemsToPlayer = false;
[JsonProperty(PropertyName = "Выдавать доп.награду в инвентарь игрока?")]
public bool AdRewardToInventory = false;
[JsonProperty(PropertyName = "Оповещать игрока при завершении миссии?")]
public bool NotifyMissionCompleted = true;
[JsonProperty(PropertyName = "Блокировка (NoEscape)")]
public bool BlockNoEscape = false;
[JsonProperty(PropertyName = "Интерфейс")]
public UserInterface UI = new UserInterface
{
Header = new UserInterface.HeaderInfo(),
Colors = new UserInterface.ColorsData(),
Missions = new UserInterface.MissionsScreen(),
Cases = new UserInterface.CasesScreen(),
CaseInfo = new UserInterface.CasesInfoScreen(),
Inventory = new UserInterface.InventoryScreen()
};
[JsonProperty(PropertyName = "Tabs")] public TabsSettings Tabs = new TabsSettings
{
Margin = 0f,
Missions = new TabInterface(true, 0, 256f, 256f,
"https://i.ibb.co/C0jjqLB/f2GN8m7.png",
new UserInterface.InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-105 -75",
OffsetMax = "105 135"
},
new UserInterface.Button
{
AnchorMin = "0.5 0",
AnchorMax = "0.5 0",
OffsetMin = "-105 5",
OffsetMax = "105 35",
Align = TextAnchor.MiddleCenter,
FontSize = 16,
Font = "robotocondensed-bold.ttf",
ButtonColor = new UserInterface.ColorsData.IColor("#000000",
00),
Color = "1 1 1 1",
FadeIn = 0
},
"Mission btn",
"UI_Battlepass missions",
false),
Cases = new TabInterface(true, 1, 256f, 256f,
"https://i.ibb.co/HtFh68D/2lMM2bS.png",
new UserInterface.InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-105 -75",
OffsetMax = "105 135"
},
new UserInterface.Button
{
AnchorMin = "0.5 0",
AnchorMax = "0.5 0",
OffsetMin = "-105 5",
OffsetMax = "105 35",
Align = TextAnchor.MiddleCenter,
Color = "1 1 1 1",
FadeIn = 0,
FontSize = 16,
Font = "robotocondensed-bold.ttf",
ButtonColor = new UserInterface.ColorsData.IColor("#000000",
00)
},
"Cases btn",
"UI_Battlepass cases",
false),
Inventory = new TabInterface(true, 2, 256f, 256f,
"https://i.ibb.co/KLMwgHj/vvJe7KO.png",
new UserInterface.InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-105 -75",
OffsetMax = "105 135"
},
new UserInterface.Button
{
AnchorMin = "0.5 0",
AnchorMax = "0.5 0",
OffsetMin = "-105 5",
OffsetMax = "105 35",
Align = TextAnchor.MiddleCenter,
Color = "1 1 1 1",
FadeIn = 0,
FontSize = 16,
Font = "robotocondensed-bold.ttf",
ButtonColor = new UserInterface.ColorsData.IColor("#000000",
00)
},
"Inventory btn",
"UI_Battlepass inventory",
false),
CustomTabs = new List<TabInterface>
{
new TabInterface(false, 3, 256f, 256f,
"https://i.ibb.co/xDsVSXY/C83Rprq.png",
new UserInterface.InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-105 -75",
OffsetMax = "105 135"
},
new UserInterface.Button
{
AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-105 5", OffsetMax = "105 35",
Align = TextAnchor.MiddleCenter,
FontSize = 16,
ButtonColor = new UserInterface.ColorsData.IColor("#000000", 00)
},
"Leaders",
"leaders",
true)
}
};
public VersionNumber Version;
}
private class TabsSettings
{
[JsonProperty(PropertyName = "Отступ")]
public float Margin;
[JsonProperty(PropertyName = "Миссии")]
public TabInterface Missions;
[JsonProperty(PropertyName = "Кейсы")] public TabInterface Cases;
[JsonProperty(PropertyName = "Ивентарь")]
public TabInterface Inventory;
[JsonProperty(PropertyName = "Пользовательские Вкладки",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public List<TabInterface> CustomTabs;
[JsonIgnore] private List<TabInterface> _tabsList;
[JsonIgnore] public List<TabInterface> Tabs => _tabsList ?? (_tabsList = GetTabs());
private List<TabInterface> GetTabs()
{
var list = new List<TabInterface>
{
Missions,
Cases,
Inventory
};
list.AddRange(CustomTabs);
list.Sort((x, y) => x.Index.CompareTo(y.Index));
return list;
}
}
private class TabInterface
{
[JsonProperty(PropertyName = "Включено")]
public bool Enabled;
[JsonProperty(PropertyName = "Индекс")]
public int Index;
[JsonProperty(PropertyName = "Ширина")]
public float Width;
[JsonProperty(PropertyName = "Высота")]
public float Height;
[JsonProperty(PropertyName = "Изображение")]
public string Image;
[JsonProperty(PropertyName = "Позиция Изображения")]
public UserInterface.InterfacePosition ImagePosition;
[JsonProperty(PropertyName = "Кнопка")]
public UserInterface.Button Button;
[JsonProperty(PropertyName = "Lang Key")]
public string LangKey;
[JsonProperty(PropertyName = "Command")]
public string Command;
[JsonProperty(PropertyName = "Close Menu")]
public bool CloseMenu;
public TabInterface(bool enabled, int index, float width, float height, string image,
UserInterface.InterfacePosition imagePosition, UserInterface.Button button,
string langKey,
string command,
bool closeMenu)
{
Enabled = enabled;
Index = index;
Width = width;
Height = height;
Image = image;
ImagePosition = imagePosition;
Button = button;
LangKey = langKey;
Command = command;
CloseMenu = closeMenu;
}
}
private class WipeSettings
{
[JsonProperty(PropertyName = "Вайп Игроков? | Wipe Players?")]
public bool Players;
[JsonProperty(PropertyName = "Вайп Миссий? | Wipe Missions?")]
public bool Missions;
}
private class UserInterface
{
[JsonProperty(PropertyName = "Header")]
public HeaderInfo Header;
[JsonProperty(PropertyName = "Colors")]
public ColorsData Colors;
[JsonProperty(PropertyName = "Missions")]
public MissionsScreen Missions;
[JsonProperty(PropertyName = "Cases")] public CasesScreen Cases;
[JsonProperty(PropertyName = "Case Page")]
public CasesInfoScreen CaseInfo;
[JsonProperty(PropertyName = "Inventory")]
public InventoryScreen Inventory;
public class InterfacePosition
{
public string AnchorMin;
public string AnchorMax;
public string OffsetMin;
public string OffsetMax;
}
public class Label : InterfacePosition
{
[JsonProperty("FontSize")] public int FontSize = 14;
[JsonProperty("Font")] public string Font = "robotocondensed-bold.ttf";
[JsonConverter(typeof(StringEnumConverter))] [JsonProperty("Align")]
public TextAnchor Align = TextAnchor.UpperLeft;
[JsonProperty("Color")] public string Color = "1 1 1 1";
[JsonProperty("FadeIn")] public float FadeIn;
}
public class Button : Label
{
[JsonProperty(PropertyName = "Button Color")]
public ColorsData.IColor ButtonColor;
}
public class OutlineInfo
{
[JsonProperty(PropertyName = "Color")]
public ColorsData.IColor Color = new ColorsData.IColor("#FFFFFF");
[JsonProperty(PropertyName = "Size")] public string Size = "1.5";
}
public class ColorsData
{
[JsonProperty(PropertyName = "Background Color")]
public IColor BackgroundColor = new IColor("#FFFFFF");
[JsonProperty(PropertyName = "Color 1")]
public IColor Color1 = new IColor("#E54D41");
[JsonProperty(PropertyName = "Color 2")]
public IColor Color2 = new IColor("#BF2E24");
[JsonProperty(PropertyName = "Color 3")]
public IColor Color3 = new IColor("#BD5C22");
[JsonProperty(PropertyName = "Color 4")]
public IColor Color4 = new IColor("#BD5C22", 40);
[JsonProperty(PropertyName = "Color 5")]
public IColor Color5 = new IColor("#000000", 00);
public class IColor
{
[JsonProperty(PropertyName = "HEX")] public string Hex;
[JsonProperty(PropertyName = "Opacity (0 - 100)")]
public float Alpha;
[JsonIgnore] private string _color;
[JsonIgnore]
public string Get
{
get
{
if (string.IsNullOrEmpty(_color))
_color = GetColor();
return _color;
}
}
private string GetColor()
{
if (string.IsNullOrEmpty(Hex)) Hex = "#FFFFFF";
var str = Hex.Trim('#');
if (str.Length != 6) throw new Exception(Hex);
var r = byte.Parse(str.Substring(0, 2), NumberStyles.HexNumber);
var g = byte.Parse(str.Substring(2, 2), NumberStyles.HexNumber);
var b = byte.Parse(str.Substring(4, 2), NumberStyles.HexNumber);
return $"{(double) r / 255} {(double) g / 255} {(double) b / 255} {Alpha / 100}";
}
public IColor()
{
}
public IColor(string hex, float alpha = 100)
{
Hex = hex;
Alpha = alpha;
}
}
}
public class HeaderInfo
{
[JsonProperty(PropertyName = "Height")]
public float Height = 35f;
[JsonProperty(PropertyName = "Logo Position")]
public InterfacePosition Logo = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-350 -9",
OffsetMax = "-250 9"
};
[JsonProperty(PropertyName = "Line")] public InterfacePosition Line = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-240.5 -9",
OffsetMax = "-239.5 9"
};
[JsonProperty(PropertyName = "Player Name")]
public InterfacePosition PlayerName = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-230 -9",
OffsetMax = "80 9"
};
[JsonProperty(PropertyName = "First Currency")]
public InterfacePosition FirstCurrency = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "230 -10",
OffsetMax = "250 10"
};
[JsonProperty(PropertyName = "Balance of First Currency")]
public Label BalanceFirstCurrency = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "0 -10",
OffsetMax = "225 10",
FontSize = 12,
Align = TextAnchor.MiddleRight,
Color = "1 1 1 1",
FadeIn = 0,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Second Currency")]
public InterfacePosition SecondCurrency = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "315 -10",
OffsetMax = "335 10"
};
[JsonProperty(PropertyName = "Balance of Second Currency")]
public Label BalanceSecondCurrency = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "0 -10",
OffsetMax = "310 10",
FontSize = 12,
Align = TextAnchor.MiddleRight,
Color = "1 1 1 1",
FadeIn = 0,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Exit Button")]
public Button Exit = new Button
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "200 295",
OffsetMax = "320 315",
Align = TextAnchor.MiddleRight,
Color = "1 1 1 1",
FadeIn = 0,
FontSize = 16,
Font = "robotocondensed-bold.ttf",
ButtonColor = new ColorsData.IColor("#000000",
00)
};
}
public class MissionsScreen
{
[JsonProperty(PropertyName = "Back")] public Button Back = new Button
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "200 295",
OffsetMax = "320 315",
Align = TextAnchor.MiddleRight, FontSize = 16,
ButtonColor = new ColorsData.IColor("#000000", 00)
};
[JsonProperty(PropertyName = "Private Mission | Progress Bar")]
public InterfacePosition ProgressBar = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 230",
OffsetMax = "-15 235"
};
[JsonProperty(PropertyName = "Private Mission | Progress Title")]
public Label ProgressTitle = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 240",
OffsetMax = "0 255",
Align = TextAnchor.MiddleLeft,
FontSize = 11,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Private Mission | Progress Amount")]
public Label ProgressAmount = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 240",
OffsetMax = "-15 255",
Align = TextAnchor.MiddleRight,
FontSize = 11,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Private Mission | Title")]
public Label PMTitle = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 260",
OffsetMax = "0 290",
Align = TextAnchor.MiddleLeft,
FontSize = 16
};
[JsonProperty(PropertyName = "Private Mission | Title Description")]
public Label PMTitleDescription = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "15 260",
OffsetMax = "320 290",
Align = TextAnchor.MiddleLeft,
FontSize = 16
};
[JsonProperty(PropertyName = "Private Mission | Description")]
public Label PMDescription = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "15 200",
OffsetMax = "325 255",
Align = TextAnchor.UpperLeft,
FontSize = 11,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Private Mission | Title Award")]
public Label PMTitleAward = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "15 195",
OffsetMax = "150 215",
Align = TextAnchor.MiddleLeft,
FontSize = 11,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Private Mission | First Currency Image")]
public InterfacePosition FirstCurrencyImage = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "85 195",
OffsetMax = "105 215"
};
[JsonProperty(PropertyName = "Private Mission | First Currency")]
public Label FirstCurrency = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "55 195",
OffsetMax = "80 215",
Align = TextAnchor.MiddleRight,
FontSize = 11,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Private Mission | Second Currency Image")]
public InterfacePosition SecondCurrencyImage = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "135 195",
OffsetMax = "155 215"
};
[JsonProperty(PropertyName = "Private Mission | Second Currency")]
public Label SecondCurrency = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "100 195",
OffsetMax = "130 215",
Align = TextAnchor.MiddleRight,
FontSize = 11,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Private Mission | Line")]
public InterfacePosition Line1 = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-335 164.5",
OffsetMax = "325 165.5"
};
[JsonProperty(PropertyName = "Title")] public Label Title = new Label
{
AnchorMin = "0.5 0.5", AnchorMax = "0.5 0.5", OffsetMin = "-320 95", OffsetMax = "0 165",
Align = TextAnchor.MiddleLeft,
FontSize = 14
};
[JsonProperty(PropertyName = "Cooldown")]
public Label Cooldown = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-150 95",
OffsetMax = "150 165",
Align = TextAnchor.MiddleCenter,
FontSize = 14,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "Background for missions")]
public InterfacePosition Background = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-355 55",
OffsetMax = "310 55"
};
[JsonProperty(PropertyName = "Pages")] public InterfacePosition Pages = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "315 -115",
OffsetMax = "325 95"
};
}
public class CasesScreen
{
[JsonProperty(PropertyName = "Back")] public Button Back = new Button
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "200 295",
OffsetMax = "320 315",
Align = TextAnchor.MiddleRight, FontSize = 16,
ButtonColor = new ColorsData.IColor("#000000", 00)
};
[JsonProperty(PropertyName = "Title")] public Label Title = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 250",
OffsetMax = "0 290",
Align = TextAnchor.MiddleLeft,
FontSize = 26
};
[JsonProperty(PropertyName = "Up Indent for cases")]
public float CaseUpIdent = 335;
[JsonProperty(PropertyName = "Left Indent for cases")]
public float CaseLeftIdent = 40;
[JsonProperty(PropertyName = "Case Height")]
public float CaseHeight = 195f;
[JsonProperty(PropertyName = "Case Width")]
public float CaseWidth = 205f;
[JsonProperty(PropertyName = "Cases Margin")]
public float CaseMargin = 10f;
[JsonProperty(PropertyName = "Case Image")]
public InterfacePosition CaseImage = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-70 -65",
OffsetMax = "70 75"
};
[JsonProperty(PropertyName = "Case Look Button")]
public Button CaseShow = new Button
{
AnchorMin = "0.5 0", AnchorMax = "0.5 0", OffsetMin = "-58 15", OffsetMax = "58 35",
Align = TextAnchor.MiddleCenter,
FontSize = 12,
ButtonColor = new ColorsData.IColor("#000000", 00)
};
}
public class CasesInfoScreen
{
[JsonProperty(PropertyName = "Amount Awards On Page")]
public int AwardsOnPage = 10;
[JsonProperty(PropertyName = "Back")] public Button Back = new Button
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "200 295",
OffsetMax = "320 315",
Align = TextAnchor.MiddleRight, FontSize = 16,
ButtonColor = new ColorsData.IColor("#000000", 00)
};
[JsonProperty(PropertyName = "Title")] public Label Title = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 250",
OffsetMax = "0 290",
Align = TextAnchor.MiddleLeft,
FontSize = 26
};
[JsonProperty(PropertyName = "Case Title")]
public Label CaseTitle = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 200",
OffsetMax = "0 250",
Align = TextAnchor.MiddleLeft, FontSize = 18
};
[JsonProperty(PropertyName = "Case Image")]
public InterfacePosition CaseImage = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-290 5",
OffsetMax = "-110 185"
};
[JsonProperty(PropertyName = "Buy Amount")]
public Label BuyAmount = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-310 -25",
OffsetMax = "-110 -5",
Align = TextAnchor.MiddleLeft,
FontSize = 12,
Font = "robotocondensed-regular.ttf"
};
[JsonProperty(PropertyName = "First Currency")]
public InterfacePosition FirstCurrency = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-210 -30",
OffsetMax = "-135 0"
};
[JsonProperty(PropertyName = "Second Currency")]
public InterfacePosition SecondCurrency = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-130 -30",
OffsetMax = "-55 0"
};
[JsonProperty(PropertyName = "Awards Title")]
public Label AwardsTitle = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "70 200",
OffsetMax = "270 250",
Align = TextAnchor.MiddleLeft,
FontSize = 18
};
[JsonProperty(PropertyName = "Awards Background")]
public InterfacePosition AwardsBackground = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "70 -70",
OffsetMax = "320 195"
};
[JsonProperty(PropertyName = "Open Button")]
public Button OpenButton = new Button
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-205 -75",
OffsetMax = "-50 -50",
Align = TextAnchor.MiddleCenter,
FontSize = 12,
ButtonColor = new ColorsData.IColor("#000000", 00)
};
[JsonProperty(PropertyName = "Open Button | Outline")]
public OutlineInfo OpenButtonOutline = new OutlineInfo
{
Color = new ColorsData.IColor("#FFFFFF"),
Size = "1"
};
[JsonProperty(PropertyName = "Enter Amount")]
public InterfacePosition EnterAmount = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-235 -75",
OffsetMax = "-210 -50"
};
}
public class InventoryScreen
{
[JsonProperty(PropertyName = "Item Size")]
public int ItemSize = 80;
[JsonProperty(PropertyName = "Items Margin")]
public int Margin = 5;
[JsonProperty(PropertyName = "Items On String")]
public int ItemsOnString = 8;
[JsonProperty(PropertyName = "Lines for items")]
public int Lines = 6;
[JsonIgnore] public int MaxCount => _config.UI.Inventory.Lines * _config.UI.Inventory.ItemsOnString;
[JsonProperty(PropertyName = "Back")] public Label Back = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "200 295",
OffsetMax = "320 315",
Align = TextAnchor.MiddleRight, FontSize = 16
};
[JsonProperty(PropertyName = "Title")] public Label Title = new Label
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-320 250",
OffsetMax = "0 290",
Align = TextAnchor.MiddleLeft,
FontSize = 26
};
[JsonProperty(PropertyName = "Pages")] public InterfacePosition Pages = new InterfacePosition
{
AnchorMin = "0.5 0.5",
AnchorMax = "0.5 0.5",
OffsetMin = "-335 -275",
OffsetMax = "340 -260"
};
}
}
private class CooldownSettings
{
[JsonProperty(PropertyName = "Инвентарь")]
public float Inventory;
}
private class LootSettings
{
[JsonProperty(PropertyName = "Enabled")]
public bool Enabled;
[JsonProperty(PropertyName = "Containers (shortname - skins) [skin 0 = all skins]",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, List<ulong>> Containers;
}
private class PlayerDatabaseConf
{
[JsonProperty(PropertyName = "Enabled")]
public bool Enabled;
[JsonProperty(PropertyName = "Table")] public string Field;
public PlayerDatabaseConf(bool enabled, string field)
{
Enabled = enabled;
Field = field;
}
}
private class CurrencyClass
{
[JsonProperty(PropertyName = "Картинка | Image")]
public string Image;
[JsonProperty(PropertyName = "Использовать встроенную систему? | Use embedded system?")]
public bool UseDefaultCur;
[JsonProperty(PropertyName = "Название плагина | Plugin name")]
public string Plug;
[JsonProperty(PropertyName = "Функция пополнения баланса | Balance add hook")]
public string AddHook;
[JsonProperty(PropertyName = "Функция снятия баланса | Balance remove hook")]
public string RemoveHook;
[JsonProperty(PropertyName = "Функция показа баланса | Balance show hook")]
public string BalanceHook;
}
private class FirstCurrencyClass : CurrencyClass
{
[JsonProperty(PropertyName = "Rates for permissions",
ObjectCreationHandling = ObjectCreationHandling.Replace)]
public Dictionary<string, float> Rates;
public double ShowBalance(BasePlayer player)
{
if (UseDefaultCur) return _instance.GetFirstCurrency(player.userID);
var plugin = _instance?.plugins?.Find(Plug);
if (plugin == null) return 0;
return Math.Round(Convert.ToDouble(plugin.Call(BalanceHook, player.UserIDString)));
}
public void AddBalance(BasePlayer player, int amount)
{
AddBalance(player.UserIDString, amount);
}
public void AddBalance(string player, int amount)
{
if (UseDefaultCur)
{
_instance.AddFirstCurrency(player, amount);
return;
}
var plugin = _instance?.plugins.Find(Plug);
if (plugin == null) return;
switch (Plug)
{
case "Economics":
plugin.Call(AddHook, player, (double) amount);
break;
default:
plugin.Call(AddHook, player, amount);
break;
}
}
public bool RemoveBalance(BasePlayer player, int amount)
{
if (ShowBalance(player) < amount) return false;
if (UseDefaultCur) return _instance.RemoveFirstCurrency(player, amount);
var plugin
// ... [Code preview truncated due to length. Full source in attached file] ...