C#:
//Requires: ArenaStatistics
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using Oxide.Core.Plugins;
using UnityEngine;
using System.Linq;
using System.Globalization;
///Скачано с дискорд сервера Rust Edit [PRO+]
///discord.gg/9vyTXsJyKR
namespace Oxide.Plugins {
[Info("ArenaUI", "discord.gg/9vyTXsJyKR", "2.0.9")]
[Description("Manages and provides user interface for event games")]
public class ArenaUI : RustPlugin {
#region Fields
[PluginReference]
private Plugin ImageLibrary;
public static ArenaUI Instance {
get;
private set;
}
public static ConfigData Configuration {
get;
set;
}
#endregion
#region Oxide Hooks
protected override void LoadDefaultMessages() {
lang.RegisterMessages(Messages, this);
}
private void OnServerInitialized() {
Instance = this;
cmd.AddChatCommand(Configuration.Commands.EventCommand, this, CmdEventMenu);
cmd.AddChatCommand(Configuration.Commands.StatisticsCommand, this, CmdEventStatistics);
cmd.AddChatCommand(Configuration.Commands.AdminCommand, this, CmdEventAdmin);
cmd.AddChatCommand(Configuration.Commands.LeaveCommand, this, CmdEventLeave);
timer.In(5f, RegisterImages);
}
private void Unload() {
foreach (BasePlayer player in BasePlayer.activePlayerList) DestroyAllUI(player);
Instance = null;
Configuration = null;
}
#endregion
#region UI Menus
public enum MenuTab {
Event, Statistics, Admin
}
public enum AdminTab {
None, EditEvent, CreateEvent, DeleteEvent, Selector
}
public enum StatisticTab {
Personal, Global, Leaders
}
public enum SelectionType {
Field, Event, Player
}
private const float ELEMENT_HEIGHT = 0.035f;
#region UI Images
private const string DEATH_BACKGROUND = "arenaui.death_background";
private const string DEFAULT_EVENT_ICON = "arenaui.default_event_icon";
private const string SERVER_BANNER = "arenaui.server_banner";
private const string SMALL_LOGO = "arenaui.server_logo_small";
private const string EXIT_ICON = "arenaui.exit_icon";
private const string RETURN_ICON = "arenaui.return_icon";
private const string RESPAWN_ICON = "arenaui.respawn_icon";
private const string STATISTICS_ICON = "arenaui.statistics_icon";
private const string EVENTS_ICON = "arenaui.events_icon";
private const string ADMIN_ICON = "arenaui.admin_icon";
internal const string UI_MENU = "arenaui.menu";
internal const string UI_TIMER = "arenaui.timer";
internal const string UI_SCORES = "arenaui.scores";
internal const string UI_POPUP = "arenaui.popup";
internal const string UI_DEATH = "arenaui.death";
internal const string UI_RESPAWN = "arenaui.respawn";
internal const string UI_SPECTATE = "arenaui.spectate";
internal const string UI_CLASS_SELECT = "arenaui.classselect";
internal const string UI_TEAM_SELECT = "arenaui.teamselect";
private Hash<string, string> _imageIDs = new Hash<string, string>();
private void RegisterImages() {
if (!ImageLibrary) return;
Dictionary<string, string> loadOrder = new Dictionary<string, string> {
[DEATH_BACKGROUND]
= Configuration.Images.DeathBackground, [DEFAULT_EVENT_ICON] = Configuration.Images.DefaultEventIcon, [SERVER_BANNER] = Configuration.Images.ServerBanner, [SMALL_LOGO] = Configuration.Images.ServerLogo, [EXIT_ICON] = Configuration.Images.ExitIcon, [RETURN_ICON] = Configuration.Images.ReturnIcon, [RESPAWN_ICON] = Configuration.Images.RespawnIcon, [STATISTICS_ICON] = Configuration.Images.StatisticsIcon, [EVENTS_ICON] = Configuration.Images.EventsIcon, [ADMIN_ICON] = Configuration.Images.AdminIcon,
}
;
foreach (ArenaEx.IEventPlugin eventPlugin in Arena.Instance.EventModes.Values) loadOrder.Add($"Event.{eventPlugin.EventName}", eventPlugin.EventIcon);
foreach (Arena.EventConfig eventConfig in Arena.Instance.Events.events.Values) {
if (!string.IsNullOrEmpty(eventConfig.EventIcon)) loadOrder.Add(eventConfig.EventName, eventConfig.EventIcon);
}
ImageLibrary.CallHook("ImportImageList", "ArenaUI", loadOrder, 0UL, true, null);
}
internal void AddImage(string imageName, string url) => ImageLibrary.Call("AddImage", url, imageName);
internal string GetImage(string name) {
string result;
if (!_imageIDs.TryGetValue(name, out result)) result = _imageIDs[name] = (string)ImageLibrary.Call("GetImage", name);
return result;
}
#endregion
#region Match Menu
private void OpenMatchMenu(Arena.BaseEventPlayer eventPlayer) {
CuiElementContainer container = UI.Container(UI_MENU, Configuration.Menu.Background.Get, new UI4(0.01f, 0.8f, 0.12f, 0.99f), true);
UI.Image(container, UI_MENU, GetImage(SMALL_LOGO), new UI4(0, 0.34f, 1, 1));
UI.Button(container, UI_MENU, Configuration.Menu.Button.Get, Message("UI.LeaveEvent", eventPlayer.Player.userID), 15, new UI4(0, 0.17f, 1, 0.32f), "arenaui.leaveevent");
UI.Button(container, UI_MENU, Configuration.Menu.Button.Get, Message("UI.Close", eventPlayer.Player.userID), 15, new UI4(0, 0, 1, 0.15f), "arenaui.close");
eventPlayer.AddUI(UI_MENU, container);
}
public static void ShowHelpText(Arena.BaseEventPlayer eventPlayer) {
CuiElementContainer container = UI.Container(UI_DEATH, Configuration.Menu.Background.Get, new UI4(0.343f, 0, 0.641f, 0.015f));
UI.Label(container, UI_DEATH, string.Format(Message("UI.Help", eventPlayer.Player.userID), $"/{Configuration.Commands.EventCommand}", $"/{Configuration.Commands.LeaveCommand}"), 10, UI4.Full);
eventPlayer.DestroyUI(UI_DEATH);
eventPlayer.AddUI(UI_DEATH, container);
}
#endregion
#region Event Menu
private readonly GridAlignment CategoryGrid = new GridAlignment(5, 0.025f, 0.18f, 0.0125f, 0.82f, 0.32f, 0.075f);
private void OpenEventMenu(BasePlayer player, string eventType, string eventName, int page) {
CuiElementContainer container = UI.Container(UI_MENU, Configuration.Menu.Background.Get, new UI4(0.1f, 0.1f, 0.9f, 0.9f), true);
UI.Image(container, UI_MENU, GetImage(SERVER_BANNER), new UI4(0f, 0.86f, 1f, 1f));
AddImageIcon(container, GetImage(EXIT_ICON), Message("UI.Exit", player.userID), new UI4(0.945f, 0.905f, 0.99f, 0.985f), "arenaui.close");
AddImageIcon(container, GetImage(STATISTICS_ICON), Message("UI.Leaders", player.userID), new UI4(0.01f, 0.905f, 0.055f, 0.985f), "arenaui.statistics 0 0 0");
if (permission.UserHasPermission(player.UserIDString, Arena.ADMIN_PERMISSION)) AddImageIcon(container, GetImage(ADMIN_ICON), Message("UI.Admin", player.userID), new UI4(0.06f, 0.905f, 0.115f, 0.985f), "arenaui.admin");
if (string.IsNullOrEmpty(eventType)) SelectEventButtons(player, container, page);
else if (string.IsNullOrEmpty(eventName)) CreateEventGrid(player, container, eventType, page);
else CreateEventView(player, container, eventName, page);
CuiHelper.DestroyUi(player, UI_MENU);
CuiHelper.AddUi(player, container);
}
private void AddImageIcon(CuiElementContainer container, string icon, string text, UI4 dimensions, string command) {
UI.Button(container, UI_MENU, icon, dimensions, command);
UI.Label(container, UI_MENU, text, 10, new UI4(dimensions.xMin, dimensions.yMin - 0.03f, dimensions.xMax, dimensions.yMin), TextAnchor.UpperCenter);
}
#region Event Type Selector
private void SelectEventButtons(BasePlayer player, CuiElementContainer container, int page) {
List<ArenaEx.IEventPlugin> list = Facepunch.Pool.GetList<ArenaEx.IEventPlugin>();
Arena.GetRegisteredEvents(list);
if (Configuration.HideUnused) {
for (int i = list.Count - 1; i >= 0; i--) {
ArenaEx.IEventPlugin eventMode = list[i];
if (!Arena.HasActiveEventsOfType(eventMode.EventName)) list.Remove(eventMode);
}
}
int max = Mathf.Min(list.Count, (page + 1) * 10);
int count = 0;
for (int i = page * 10; i < max; i++) {
CreatePluginEntry(player, container, list[i], count);
count += 1;
}
if (page > 0) UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "◀\n\n◀\n\n◀", 16, new UI4(0.005f, 0.35f, 0.02f, 0.58f), $"arenaui.categoryview {page - 1}");
if (max < list.Count) UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "▶\n\n▶\n\n▶", 16, new UI4(0.98f, 0.35f, 0.995f, 0.58f), $"arenaui.categoryview {page + 1}");
Facepunch.Pool.FreeList(ref list);
}
private void CreatePluginEntry(BasePlayer player, CuiElementContainer container, ArenaEx.IEventPlugin eventPlugin, int index) {
UI4 position = CategoryGrid.Evaluate(index);
UI.Button(container, UI_MENU, GetImage($"Event.{eventPlugin.EventName}"), position, $"arenaui.gridview page {CommandSafe(eventPlugin.EventName)} 0");
UI.Label(container, UI_MENU, eventPlugin.EventName.ToUpper(), 16, new UI4(position.xMin, position.yMin - 0.04f, position.xMax, position.yMin));
}
#region Event Selector Commands
[ConsoleCommand("arenaui.categoryview")]
private void ccmdArenaCategoryView(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Connection.player as BasePlayer;
if (player == null) return;
OpenEventMenu(player, string.Empty, string.Empty, arg.GetInt(0));
}
#endregion
#endregion
#region Grid View
private readonly GridAlignment EventGrid = new GridAlignment(5, 0.025f, 0.18f, 0.0125f, 0.8f, 0.32f, 0.1f);
private void CreateEventGrid(BasePlayer player, CuiElementContainer container, string eventType, int page) {
List<Arena.BaseEventGame> list = Facepunch.Pool.GetList<Arena.BaseEventGame>();
Arena.GetEventsOfType(eventType, list);
AddImageIcon(container, GetImage(RETURN_ICON), Message("UI.Return", player.userID), new UI4(0.89f, 0.905f, 0.94f, 0.985f), "arenaui.categoryview 0");
if (list.Count == 0) {
UI.Label(container, UI_MENU, Message("UI.NoEventsAvailable", player.userID), 14, new UI4(0.015f, 0.8f, 0.99f, 0.86f), TextAnchor.MiddleLeft);
Facepunch.Pool.FreeList(ref list);
return;
}
int max = Mathf.Min(list.Count, (page + 1) * 10);
int count = 0;
for (int i = page * 10; i < max; i++) {
CreateEventEntry(player, container, list[i], count);
count += 1;
}
if (page > 0) UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "◀\n\n◀\n\n◀", 16, new UI4(0.005f, 0.35f, 0.02f, 0.58f), $"arenaui.gridview page {CommandSafe(eventType)} {page - 1}");
if (max < list.Count) UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "▶\n\n▶\n\n▶", 16, new UI4(0.98f, 0.35f, 0.995f, 0.58f), $"arenaui.gridview page {CommandSafe(eventType)} {page + 1}");
Facepunch.Pool.FreeList(ref list);
}
private void CreateEventEntry(BasePlayer player, CuiElementContainer container, Arena.BaseEventGame eventGame, int index) {
UI4 position = EventGrid.Evaluate(index);
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(position.xMin, position.yMax, position.xMax, position.yMax + 0.04f));
UI.Label(container, UI_MENU, eventGame.Config.EventName, 14, new UI4(position.xMin, position.yMax, position.xMax, position.yMax + 0.035f));
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, position);
string imageId = string.IsNullOrEmpty(eventGame.Config.EventIcon) ? GetImage(DEFAULT_EVENT_ICON) : GetImage(eventGame.Config.EventName);
UI.Image(container, UI_MENU, imageId, new UI4(position.xMin + 0.005f, position.yMin + 0.035f, position.xMax - 0.005f, position.yMax - 0.0075f));
UI.Label(container, UI_MENU, string.Format(Arena.Message("Info.Event.Status", player.userID), eventGame.Status), 14, new UI4(position.xMin + 0.005f, position.yMin, position.xMax, position.yMin + 0.035f), TextAnchor.MiddleLeft);
UI.Button(container, UI_MENU, Configuration.Menu.Button.Get, "View Event", 14, new UI4(position.xMin, position.yMin - 0.035f, position.xMax, position.yMin), $"arenaui.gridview inspect {CommandSafe(eventGame.Config.EventType)} {CommandSafe(eventGame.Config.EventName)}");
}
#region Grid Commands
[ConsoleCommand("arenaui.gridview")]
private void ccmdArenaGridView(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Connection.player as BasePlayer;
if (player == null) return;
switch (arg.GetString(0).ToLower()) {
case "page" : OpenEventMenu(player, CommandSafe(arg.GetString(1), true), string.Empty, arg.GetInt(2));
return;
case "inspect" : OpenEventMenu(player, CommandSafe(arg.GetString(1), true), CommandSafe(arg.GetString(2), true), 0);
return;
default : break;
}
}
[ConsoleCommand("arenaui.eventview")]
private void ccmdArenaEventView(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Connection.player as BasePlayer;
if (player == null) return;
OpenEventMenu(player, CommandSafe(arg.GetString(0), true), CommandSafe(arg.GetString(1), true), arg.GetInt(2));
}
#endregion
#endregion
private void CreateEventView(BasePlayer player, CuiElementContainer container, string eventName, int page) {
Arena.BaseEventGame eventGame;
if (Arena.Instance.ActiveEvents.TryGetValue(eventName, out eventGame)) {
AddImageIcon(container, GetImage(RETURN_ICON), Message("UI.Return", player.userID), new UI4(0.89f, 0.905f, 0.94f, 0.985f), $"arenaui.gridview page {CommandSafe(eventGame.Config.EventType)} 0");
UI.Panel(container, UI_MENU, Configuration.Menu.Button.Get, new UI4(0.005f, 0.82f, 0.499f, 0.86f));
UI.Panel(container, UI_MENU, Configuration.Menu.Button.Get, new UI4(0.501f, 0.82f, 0.995f, 0.86f));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.005f, 0.816f, 0.499f, 0.819f));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.501f, 0.816f, 0.995f, 0.819f));
UI.Label(container, UI_MENU, Message("UI.Event.Current", player.userID), 13, new UI4(0.01f, 0.82f, 0.499f, 0.86f), TextAnchor.MiddleLeft);
#region Current Event Info
int i = 0;
CreateListEntryLeft(container, Message("UI.Event.Name", player.userID), eventGame.Config.EventName, GetVerticalPos(i += 1, 0.816f));
CreateListEntryLeft(container, Message("UI.Event.Type", player.userID), eventGame.Config.EventType, GetVerticalPos(i += 1, 0.816f));
if (!string.IsNullOrEmpty(eventGame.Config.Description)) {
int lines = 0;
CreateDescriptionEntryLeft(container, eventGame.Config.Description, i, out lines);
i += lines;
}
CreateListEntryLeft(container, Message("UI.Event.Status", player.userID), eventGame.Status.ToString(), GetVerticalPos(i += 1, 0.816f));
if (eventGame.Config.RoundsToPlay > 1) CreateListEntryLeft(container, Message("UI.Event.Rounds", player.userID), $"{eventGame.RoundNumber} / {eventGame.Config.RoundsToPlay}", GetVerticalPos(i += 1, 0.816f));
CreateListEntryLeft(container, Message("UI.Event.Players", player.userID), string.Format(Message("UI.Players.Format", player.userID), eventGame.eventPlayers.Count, eventGame.Config.MaximumPlayers, eventGame.joiningSpectators.Count), GetVerticalPos(i += 1, 0.816f));
if (eventGame.Config.UseEventBots && eventGame.Config.MaximumBots > 0) CreateListEntryLeft(container, Message("UI.Event.Bots", player.userID), $"{eventGame.GetNPCPlayerCount()} / {eventGame.Config.MaximumBots}", GetVerticalPos(i += 1, 0.816f));
if (eventGame.Config.TimeLimit > 0) CreateListEntryLeft(container, Message("UI.Event.TimeLimit", player.userID), $"{eventGame.Config.TimeLimit} seconds", GetVerticalPos(i += 1, 0.816f));
if (eventGame.Config.ScoreLimit > 0) CreateListEntryLeft(container, Message("UI.Event.ScoreLimit", player.userID), eventGame.Config.ScoreLimit.ToString(), GetVerticalPos(i += 1, 0.816f));
if (eventGame.Config.AllowClassSelection && (eventGame.GetAvailableKits(Arena.Team.A).Count > 1 || eventGame.GetAvailableKits(Arena.Team.B).Count > 1)) CreateListEntryLeft(container, Message("UI.Event.ClassSelection", player.userID), Message("UI.Enabled", player.userID), GetVerticalPos(i += 1, 0.816f));
List<KeyValuePair<string, object>> additionalEventDetails = Facepunch.Pool.GetList<KeyValuePair<string, object>>();
eventGame.GetAdditionalEventDetails(ref additionalEventDetails, player.userID);
for (int y = 0; y < additionalEventDetails.Count; y++) {
KeyValuePair<string, object> kvp = additionalEventDetails[y];
CreateListEntryLeft(container, kvp.Key, kvp.Value.ToString(), GetVerticalPos(i += 1, 0.816f));
}
Facepunch.Pool.FreeList(ref additionalEventDetails);
if (eventGame.Config.Rewards.WinAmount > 0) {
CreateListEntryLeft(container, Message("UI.Event.WinReward", player.userID), string.Format(Message("UI.Reward.Format", player.userID), eventGame.Config.Rewards.WinAmount, Message($"UI.Reward.{eventGame.Config.Rewards.Type}", player.userID)), GetVerticalPos(i += 1, 0.816f));
}
if (eventGame.Config.Rewards.KillAmount > 0) {
CreateListEntryLeft(container, Message("UI.Event.KillReward", player.userID), string.Format(Message("UI.Reward.Format", player.userID), eventGame.Config.Rewards.KillAmount, Message($"UI.Reward.{eventGame.Config.Rewards.Type}", player.userID)), GetVerticalPos(i += 1, 0.816f));
}
if (eventGame.Config.Rewards.HeadshotAmount > 0) {
CreateListEntryLeft(container, Message("UI.Event.HeadshotReward", player.userID), string.Format(Message("UI.Reward.Format", player.userID), eventGame.Config.Rewards.HeadshotAmount, Message($"UI.Reward.{eventGame.Config.Rewards.Type}", player.userID)), GetVerticalPos(i += 1, 0.816f));
}
float yMin = GetVerticalPos(i += 1, 0.816f);
if (!string.IsNullOrEmpty(eventGame.Config.Permission) && !permission.UserHasPermission(player.UserIDString, eventGame.Config.Permission)) {
UI.Button(container, UI_MENU, Configuration.Menu.Button.Get, Message("UI.Event.VIP", player.userID), 13, new UI4(0.3805f, yMin, 0.499f, yMin + ELEMENT_HEIGHT), "");
}
else {
if (eventGame.Plugin.IsTeamEvent && eventGame.Plugin.CanSelectTeam) {
UI.Button(container, UI_MENU, string.IsNullOrEmpty(eventGame.Config.TeamConfigA.Color) ? Configuration.Menu.Highlight.Get : UI.Color(eventGame.TeamA.Color, 1f), string.Format(Message("UI.Event.Join.Team", player.userID), eventGame.Config.TeamName(Arena.Team.A), eventGame.GetTeamCount(Arena.Team.A)), 12, new UI4(0.2585f, yMin, 0.378f, yMin + ELEMENT_HEIGHT), $"arenaui.joinevent {CommandSafe(eventGame.Config.EventName)} 0");
UI.Button(container, UI_MENU, string.IsNullOrEmpty(eventGame.Config.TeamConfigB.Color) ? Configuration.Menu.Highlight.Get : UI.Color(eventGame.TeamB.Color, 1f), string.Format(Message("UI.Event.Join.Team", player.userID), eventGame.Config.TeamName(Arena.Team.B), eventGame.GetTeamCount(Arena.Team.B)), 12, new UI4(0.3805f, yMin, 0.499f, yMin + ELEMENT_HEIGHT), $"arenaui.joinevent {CommandSafe(eventGame.Config.EventName)} 1");
}
else UI.Button(container, UI_MENU, Configuration.Menu.Button.Get, Message("UI.Event.Enter", player.userID), 13, new UI4(0.3805f, yMin, 0.499f, yMin + ELEMENT_HEIGHT), $"arenaui.joinevent {CommandSafe(eventGame.Config.EventName)}");
}
#endregion
#region Current Event Scores
UI.Label(container, UI_MENU, Message("UI.Event.CurrentScores", player.userID), 13, new UI4(0.506f, 0.82f, 0.995f, 0.86f), TextAnchor.MiddleLeft);
if (eventGame.scoreData.Count > 0) {
int j = 0;
const int ELEMENTS_PER_PAGE = 20;
if (eventGame.scoreData.Count > (ELEMENTS_PER_PAGE * page) + ELEMENTS_PER_PAGE) UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "> > >", 10, new UI4(0.911f, 0.0075f, 0.995f, 0.0375f), $"arenaui.eventview {CommandSafe(eventGame.Config.EventType)} {CommandSafe(eventGame.Config.EventName)} {page + 1}");
if (page > 0) UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "< < <", 10, new UI4(0.005f, 0.0075f, 0.089f, 0.0375f), $"arenaui.eventview {CommandSafe(eventGame.Config.EventType)} {CommandSafe(eventGame.Config.EventName)} {page - 1}");
if (eventGame.Plugin.IsTeamEvent) {
CreateScoreEntryRight(container, Message("UI.Event.TeamScore", player.userID), string.Format(Message("UI.Score.Team", player.userID), eventGame.Config.TeamName(Arena.Team.A), eventGame.GetTeamScore(Arena.Team.A)), string.Format(Message("UI.Score.Team", player.userID), eventGame.Config.TeamName(Arena.Team.B), eventGame.GetTeamScore(Arena.Team.B)), GetVerticalPos(j += 1, 0.816f));
}
for (int k = page * ELEMENTS_PER_PAGE; k < (page * ELEMENTS_PER_PAGE) + ELEMENTS_PER_PAGE;
k++) {
if (k >= eventGame.scoreData.Count) break;
Arena.ScoreEntry scoreEntry = eventGame.scoreData[k];
string score1, score2;
eventGame.Plugin.FormatScoreEntry(scoreEntry, player.userID, out score1, out score2);
string name = eventGame.Plugin.IsTeamEvent ? $"({(scoreEntry.team == Arena.Team.A ? eventGame.Plugin.TeamAName : eventGame.Plugin.TeamBName)}) {scoreEntry.displayName}" : scoreEntry.displayName;
CreateScoreEntryRight(container, name, score1, score2, GetVerticalPos(j += 1, 0.816f));
}
}
else UI.Label(container, UI_MENU, Message("UI.Event.NoScoresRecorded", player.userID), 13, new UI4(0.506f, 0.806f, 0.88f, 0.816f), TextAnchor.MiddleLeft);
#endregion
}
}
#region Helpers
private void CreateListEntryLeft(CuiElementContainer container, string key, string value, float yMin) {
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.005f, yMin, 0.38f, yMin + ELEMENT_HEIGHT));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.3805f, yMin, 0.499f, yMin + ELEMENT_HEIGHT));
UI.Label(container, UI_MENU, key, 12, new UI4(0.01f, yMin, 0.38f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Label(container, UI_MENU, value, 12, new UI4(0.3805f, yMin, 0.494f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleRight);
}
private void CreateDescriptionEntryLeft(CuiElementContainer container, string description, int currentLine, out int lines) {
lines = Mathf.Max(Mathf.CeilToInt((float)description.Length / 120f), 1);
float height = (ELEMENT_HEIGHT * lines) + (0.005f * (lines - 1));
float yMin = GetVerticalPos(currentLine + lines, 0.816f);
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.005f, yMin, 0.499f, yMin + height));
UI.Label(container, UI_MENU, description, 12, new UI4(0.01f, yMin, 0.494f, yMin + height), TextAnchor.MiddleLeft);
}
private void CreateListEntryRight(CuiElementContainer container, string key, string value, float yMin) {
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.501f, yMin, 0.88f, yMin + ELEMENT_HEIGHT));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.8805f, yMin, 0.995f, yMin + ELEMENT_HEIGHT));
UI.Label(container, UI_MENU, key, 12, new UI4(0.506f, yMin, 0.88f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Label(container, UI_MENU, value, 12, new UI4(0.8805f, yMin, 0.99f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleRight);
}
private void CreateScoreEntryRight(CuiElementContainer container, string displayName, string score1, string score2, float yMin) {
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.501f, yMin, 0.748f, yMin + ELEMENT_HEIGHT));
UI.Label(container, UI_MENU, displayName, 12, new UI4(0.506f, yMin, 0.748f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
if (!string.IsNullOrEmpty(score1)) {
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.7485f, yMin, 0.8725f, yMin + ELEMENT_HEIGHT));
UI.Label(container, UI_MENU, score1, 12, new UI4(0.7535f, yMin, 0.8675f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleRight);
}
else UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.7485f, yMin, 0.8725f, yMin + ELEMENT_HEIGHT));
if (!string.IsNullOrEmpty(score2)) {
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.875f, yMin, 0.995f, yMin + ELEMENT_HEIGHT));
UI.Label(container, UI_MENU, score2, 12, new UI4(0.88f, yMin, 0.99f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleRight);
}
else UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.875f, yMin, 0.995f, yMin + ELEMENT_HEIGHT));
}
private void CreateSplitEntryRight(CuiElementContainer container, string key, string value, float yMin) {
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.501f, yMin, 0.748f, yMin + ELEMENT_HEIGHT));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.7485f, yMin, 0.995f, yMin + ELEMENT_HEIGHT));
UI.Label(container, UI_MENU, key, 12, new UI4(0.506f, yMin, 0.748f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Label(container, UI_MENU, value, 12, new UI4(0.7485f, yMin, 0.99f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleRight);
}
#endregion
#endregion
#region Event Creation
private Hash<ulong, Arena.EventConfig> _eventCreators = new Hash<ulong, Arena.EventConfig>();
private void OpenAdminMenu(BasePlayer player, AdminTab adminTab, SelectorArgs selectorArgs = default(SelectorArgs), int page = 0) {
CuiElementContainer container = UI.Container(UI_MENU, Configuration.Menu.Background.Get, new UI4(0.1f, 0.1f, 0.9f, 0.9f), true);
UI.Image(container, UI_MENU, GetImage(SERVER_BANNER), new UI4(0f, 0.86f, 1f, 1f));
AddImageIcon(container, GetImage(EXIT_ICON), Message("UI.Exit", player.userID), new UI4(0.945f, 0.905f, 0.99f, 0.985f), "arenaui.close");
AddImageIcon(container, GetImage(EVENTS_ICON), Message("UI.Events", player.userID), new UI4(0.01f, 0.905f, 0.06f, 0.985f), "arenaui.categoryview 0");
CreateAdminOptions(player, container, adminTab, selectorArgs, page);
CuiHelper.DestroyUi(player, UI_MENU);
CuiHelper.AddUi(player, container);
}
private void CreateAdminOptions(BasePlayer player, CuiElementContainer container, AdminTab adminTab, SelectorArgs selectorArgs, int page) {
UI.Panel(container, UI_MENU, Configuration.Menu.Button.Get, new UI4(0.005f, 0.82f, 0.175f, 0.86f));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.005f, 0.816f, 0.175f, 0.819f));
UI.Panel(container, UI_MENU, Configuration.Menu.Button.Get, new UI4(0.177f, 0.82f, 0.995f, 0.86f));
UI.Panel(container, UI_MENU, Configuration.Menu.Highlight.Get, new UI4(0.177f, 0.816f, 0.995f, 0.819f));
UI.Label(container, UI_MENU, Message("UI.Admin.Title", player.userID), 13, new UI4(0.01f, 0.82f, 0.175f, 0.86f), TextAnchor.MiddleLeft);
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.005f, 0.0075f, 0.175f, 0.811f));
UI.Panel(container, UI_MENU, Configuration.Menu.Panel.Get, new UI4(0.177f, 0.0075f, 0.995f, 0.811f));
int i = 1;
float yMin = GetVerticalPos(i, 0.811f);
UI.Button(container, UI_MENU, adminTab == AdminTab.CreateEvent ? Configuration.Menu.Highlight.Get : Configuration.Menu.Button.Get, Message("UI.Admin.Create", player.userID), 12, new UI4(0.01f, yMin, 0.17f, yMin + ELEMENT_HEIGHT), "arenaui.create");
yMin = GetVerticalPos(i += 1, 0.811f);
UI.Button(container, UI_MENU, adminTab == AdminTab.EditEvent ? Configuration.Menu.Highlight.Get : Configuration.Menu.Button.Get, Message("UI.Admin.Edit", player.userID), 12, new UI4(0.01f, yMin, 0.17f, yMin + ELEMENT_HEIGHT), $"arenaui.eventselector {(int)AdminTab.EditEvent}");
yMin = GetVerticalPos(i += 1, 0.811f);
UI.Button(container, UI_MENU, adminTab == AdminTab.DeleteEvent ? Configuration.Menu.Highlight.Get : Configuration.Menu.Button.Get, Message("UI.Admin.Delete", player.userID), 12, new UI4(0.01f, yMin, 0.17f, yMin + ELEMENT_HEIGHT), $"arenaui.eventselector {(int)AdminTab.DeleteEvent}");
yMin = GetVerticalPos(i += 1, 0.811f);
switch (adminTab) {
case AdminTab.EditEvent : case AdminTab.DeleteEvent : OpenEventSelector(player, container, UI_MENU, selectorArgs, page);
break;
case AdminTab.CreateEvent : EventCreatorMenu(player, container, UI_MENU);
break;
case AdminTab.Selector : OpenSelector(player, container, UI_MENU, selectorArgs, page);
break;
default : break;
}
}
private void EventCreatorMenu(BasePlayer player, CuiElementContainer container, string panel) {
Arena.EventConfig eventConfig;
_eventCreators.TryGetValue(player.userID, out eventConfig);
int i = 0;
if (eventConfig == null || string.IsNullOrEmpty(eventConfig.EventType)) {
UI.Label(container, UI_MENU, "Select an event type", 13, new UI4(0.182f, 0.82f, 0.99f, 0.86f), TextAnchor.MiddleLeft);
foreach (ArenaEx.IEventPlugin eventPlugin in Arena.Instance.EventModes.Values) {
float yMin = GetVerticalPos(i += 1, 0.811f);
UI.Button(container, panel, Configuration.Menu.Button.Get, eventPlugin.EventName, 12, new UI4(0.182f, yMin, 0.3f, yMin + ELEMENT_HEIGHT), $"arenaui.create {CommandSafe(eventPlugin.EventName)}");
}
}
else {
UI.Label(container, UI_MENU, $"Creating Event ({eventConfig.EventType})", 13, new UI4(0.182f, 0.82f, 0.99f, 0.86f), TextAnchor.MiddleLeft);
UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "Save", 12, new UI4(0.925f, 0.82f, 0.995f, 0.86f), "arenaui.saveevent");
UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "Dispose", 12, new UI4(0.85f, 0.82f, 0.92f, 0.86f), "arenaui.disposeevent");
AddInputField(container, panel, i += 1, "Event Name", "eventName", eventConfig.EventName);
AddInputField(container, panel, i += 1, "Description", "description", eventConfig.Description);
AddInputField(container, panel, i += 1, "Permission", "permission", eventConfig.Permission);
AddInputField(container, panel, i += 1, "Event Icon", "eventIcon", eventConfig.EventIcon);
AddSelectorField(container, panel, i += 1, "Zone ID", "zoneID", eventConfig.ZoneID, "GetZoneIDs");
if (eventConfig.Plugin.IsTeamEvent) {
AddSelectorField(container, panel, i += 1, $"{eventConfig.Plugin.TeamAName} Spawnfile", "teamASpawnfile", eventConfig.TeamConfigA.Spawnfile, "GetSpawnfileNames");
AddSelectorField(container, panel, i += 1, $"{eventConfig.Plugin.TeamAName} Kit(s)", "teamAKits", GetSelectorLabel(eventConfig.TeamConfigA.Kits), "GetAllKits", eventConfig.AllowClassSelection);
AddInputField(container, panel, i += 1, $"{eventConfig.Plugin.TeamAName} Color (Hex)", "teamAColor", eventConfig.TeamConfigA.Color);
AddSelectorField(container, panel, i += 1, $"{eventConfig.Plugin.TeamAName} Clothing", "teamAClothing", eventConfig.TeamConfigA.Clothing, "GetAllKits", false);
AddSelectorField(container, panel, i += 1, $"{eventConfig.Plugin.TeamBName} Spawnfile", "teamBSpawnfile", eventConfig.TeamConfigB.Spawnfile, "GetSpawnfileNames");
AddSelectorField(container, panel, i += 1, $"{eventConfig.Plugin.TeamBName} Kit(s)", "teamBKits", GetSelectorLabel(eventConfig.TeamConfigB.Kits), "GetAllKits", eventConfig.AllowClassSelection);
AddInputField(container, panel, i += 1, $"{eventConfig.Plugin.TeamBName} Color (Hex)", "teamBColor", eventConfig.TeamConfigB.Color);
AddSelectorField(container, panel, i += 1, $"{eventConfig.Plugin.TeamBName} Clothing", "teamBClothing", eventConfig.TeamConfigB.Clothing, "GetAllKits", false);
}
else {
AddSelectorField(container, panel, i += 1, "Spawnfile", "teamASpawnfile", eventConfig.TeamConfigA.Spawnfile, "GetSpawnfileNames");
AddSelectorField(container, panel, i += 1, "Kit(s)", "teamAKits", GetSelectorLabel(eventConfig.TeamConfigA.Kits), "GetAllKits", eventConfig.AllowClassSelection);
}
if (eventConfig.Plugin.CanUseClassSelector) AddToggleField(container, panel, i += 1, "Use Class Selector", "useClassSelector", eventConfig.AllowClassSelection);
if (eventConfig.Plugin.UseTimeLimit) AddInputField(container, panel, i += 1, "Time Limit (seconds)", "timeLimit", eventConfig.TimeLimit);
if (eventConfig.Plugin.UseScoreLimit) AddInputField(container, panel, i += 1, "Score Limit", "scoreLimit", eventConfig.ScoreLimit);
if (!eventConfig.Plugin.IsRoundBased) AddInputField(container, panel, i += 1, "Rounds To Play", "roundsToPlay", eventConfig.RoundsToPlay);
AddInputField(container, panel, i += 1, "Minimum Players", "minimumPlayers", eventConfig.MinimumPlayers);
AddInputField(container, panel, i += 1, "Maximum Players", "maximumPlayers", eventConfig.MaximumPlayers);
AddSelectorField(container, panel, i += 1, "Reward Type", "rewardType", eventConfig.Rewards.Type, "GetRewardTypes", false);
AddInputField(container, panel, i += 1, "Kill Amount", "killAmount", eventConfig.Rewards.KillAmount);
AddInputField(container, panel, i += 1, "Headshot Amount", "headshotAmount", eventConfig.Rewards.HeadshotAmount);
AddInputField(container, panel, i += 1, "Win Amount", "winAmount", eventConfig.Rewards.WinAmount);
//AddToggleField(container, panel, i += 1, "Use Bots", "useEventBots", eventConfig.UseEventBots);
//AddInputField(container, panel, i += 1, "Maximum Bots", "maximumBots", eventConfig.MaximumBots);
List<Arena.EventParameter> eventParameters = eventConfig.Plugin.AdditionalParameters;
for (int y = 0; y < eventParameters?.Count; y++) {
Arena.EventParameter eventParameter = eventParameters[y];
switch (eventParameter.Input) {
case Arena.EventParameter.InputType.InputField : {
string parameter = eventConfig.GetParameter<string>(eventParameter.Field);
AddInputField(container, panel, i += 1, eventParameter.Name, eventParameter.Field, string.IsNullOrEmpty(parameter) ? null : parameter);
break;
}
case Arena.EventParameter.InputType.Toggle : {
bool parameter = eventConfig.GetParameter<bool>(eventParameter.Field);
AddToggleField(container, panel, i += 1, eventParameter.Name, eventParameter.Field, parameter);
break;
}
case Arena.EventParameter.InputType.Selector : {
string parameter = eventConfig.GetParameter<string>(eventParameter.Field);
AddSelectorField(container, panel, i += 1, eventParameter.Name, eventParameter.Field, parameter, eventParameter.SelectorHook);
}
break;
}
}
}
}
private void AddInputField(CuiElementContainer container, string panel, int index, string title, string fieldName, object currentValue) {
float yMin = GetVerticalPos(index >= 21 ? index - 20 : index, 0.811f);
float hMin = index >= 21 ? 0.59f : 0.182f;
UI.Label(container, panel, title, 12, new UI4(hMin, yMin, hMin + 0.118f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Panel(container, panel, Configuration.Menu.Button.Get, new UI4(hMin + 0.118f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT));
string label = GetInputLabel(currentValue);
if (!string.IsNullOrEmpty(label)) {
UI.Label(container, panel, label, 12, new UI4(hMin + 0.123f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Button(container, panel, Configuration.Menu.Highlight.Get, "X", 12, new UI4(hMin + 0.38f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT), $"arenaui.clear {fieldName}");
}
else UI.Input(container, panel, string.Empty, 12, $"arenaui.creator {fieldName}", new UI4(hMin + 0.123f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT));
}
private void AddToggleField(CuiElementContainer container, string panel, int index, string title, string fieldName, bool currentValue) {
float yMin = GetVerticalPos(index >= 21 ? index - 20 : index, 0.811f);
float hMin = index >= 21 ? 0.59f : 0.182f;
UI.Label(container, panel, title, 12, new UI4(hMin, yMin, hMin + 0.118f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Toggle(container, panel, Configuration.Menu.Button.Get, 12, new UI4(hMin + 0.118f, yMin, hMin + 0.138f, yMin + ELEMENT_HEIGHT), $"arenaui.creator {fieldName} {!currentValue}", currentValue);
}
private void AddSelectorField(CuiElementContainer container, string panel, int index, string title, string fieldName, string currentValue, string hook, bool allowMultiple = false) {
float yMin = GetVerticalPos(index >= 21 ? index - 20 : index, 0.811f);
float hMin = index >= 21 ? 0.59f : 0.182f;
UI.Label(container, panel, title, 12, new UI4(hMin, yMin, hMin + 0.118f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Panel(container, panel, Configuration.Menu.Button.Get, new UI4(hMin + 0.118f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT));
if (!string.IsNullOrEmpty(currentValue)) UI.Label(container, panel, currentValue.ToString(), 12, new UI4(hMin + 0.123f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT), TextAnchor.MiddleLeft);
UI.Button(container, panel, Configuration.Menu.Highlight.Get, "Select", 12, new UI4(hMin + 0.35f, yMin, hMin + 0.4f, yMin + ELEMENT_HEIGHT), $"arenaui.fieldselector {CommandSafe(title)} {fieldName} {hook} {allowMultiple}");
}
private string GetSelectorLabel(IEnumerable<object> list) => list.Count() == 0 ? "Nothing Selected" : list.Count() > 1 ? "Multiple Selected" : list.ElementAt(0).ToString();
private string GetInputLabel(object obj) {
if (obj is string) return string.IsNullOrEmpty(obj as string) ? null : obj.ToString();
else if (obj is int) return (int)obj <= 0 ? null : obj.ToString();
else if (obj is float) return (float)obj <= 0 ? null : obj.ToString();
return null;
}
#region Selector
private void OpenEventSelector(BasePlayer player, CuiElementContainer container, string panel, SelectorArgs args, int page) {
UI.Label(container, UI_MENU, args.Title, 13, new UI4(0.182f, 0.82f, 0.99f, 0.86f), TextAnchor.MiddleLeft);
int i = 0;
foreach (KeyValuePair<string, Arena.EventConfig> kvp in Arena.Instance.Events.events) {
UI.Button(container, panel, Configuration.Menu.Button.Get, $"{kvp.Key} <size=8>({kvp.Value.EventType})</size>", 11, GetGridLayout(i, 0.182f, 0.772f, 0.1578f, 0.035f, 5, 20), $"{args.Callback} {CommandSafe(kvp.Key)}");
i++;
}
}
private void OpenSelector(BasePlayer player, CuiElementContainer container, string panel, SelectorArgs args, int page) {
UI.Label(container, UI_MENU, args.Title, 13, new UI4(0.182f, 0.82f, 0.99f, 0.86f), TextAnchor.MiddleLeft);
UI.Button(container, UI_MENU, Configuration.Menu.Highlight.Get, "Back", 12, new UI4(0.925f, 0.82f, 0.995f, 0.86f), "arenaui.closeselector");
string[] array = Interface.CallHook(args.Hook) as string[];
if (array != null) {
Arena.EventConfig eventConfig;
_eventCreators.TryGetValue(player.userID, out eventConfig);
string stringValue = eventConfig.GetString(args.FieldName);
List<string> listValue = eventConfig?.GetList(args.FieldName);
int count = 0;
for (int i = page * 200; i < Mathf.Min((page + 1) * 200, array.Length);
i++) {
string option = array[i];
string color = ((stringValue?.Equals(option, StringComparison.OrdinalIgnoreCase) ?? false) || (listValue?.Contains(option) ?? false)) ? Configuration.Menu.Highlight.Get : Configuration.Menu.Button.Get;
UI.Button(container, panel, color, array[i], 11, GetGridLayout(count), $"arenaui.select {CommandSafe(args.Title)} {args.FieldName} {args.Hook} {args.AllowMultiple} {CommandSafe(option)}");
count += 1;
}
}
else {
UI.Label(container, UI_MENU, "No options available for selection", 13, new UI4(0.182f, 0.770f, 0.99f, 0.811f), TextAnchor.MiddleLeft);
}
}
private UI4 GetGridLayout(int index, float xMin = 0.182f, float yMin = 0.772f, float width = 0.0764f, float height = 0.035f, int columns = 10, int rows = 20) {
int columnNumber = index == 0 ? 0 : Mathf.FloorToInt(index / (float)columns);
int rowNumber = index - (columnNumber * columns);
float x = xMin + ((width + 0.005f) * rowNumber);
float y = yMin - ((height + 0.0075f) * columnNumber);
return new UI4(x, y, x + width, y + height);
}
#endregion
#region Creator Commands
[ConsoleCommand("arenaui.admin")]
private void ccmdAdminMenu(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Player();
if (player == null) return;
if (player.IsAdmin || permission.UserHasPermission(player.UserIDString, Arena.ADMIN_PERMISSION)) OpenAdminMenu(player, AdminTab.None);
}
[ConsoleCommand("arenaui.create")]
private void ccmdCreateEvent(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Player();
if (player == null) return;
if (player.IsAdmin || permission.UserHasPermission(player.UserIDString, Arena.ADMIN_PERMISSION)) {
if (arg.HasArgs(1)) {
Arena.EventConfig eventConfig;
if (!_eventCreators.TryGetValue(player.userID, out eventConfig)) {
string eventName = CommandSafe(arg.GetString(0), true);
ArenaEx.IEventPlugin eventPlugin = Arena.Instance.GetPlugin(eventName);
if (eventPlugin == null) return;
_eventCreators[player.userID] = eventConfig = new Arena.EventConfig(eventName, eventPlugin);
}
}
OpenAdminMenu(player, AdminTab.CreateEvent);
}
}
[ConsoleCommand("arenaui.saveevent")]
private void ccmdSaveEvent(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Player();
if (player == null) return;
if (player.IsAdmin || permission.UserHasPermission(player.UserIDString, Arena.ADMIN_PERMISSION)) {
Arena.EventConfig eventConfig;
if (!_eventCreators.TryGetValue(player.userID, out eventConfig)) return;
object success = Arena.Instance.ValidateEventConfig(eventConfig);
if (success == null) {
Arena.SaveEventConfig(eventConfig);
if (!string.IsNullOrEmpty(eventConfig.EventIcon)) AddImage(eventConfig.EventName, eventConfig.EventIcon);
_eventCreators.Remove(player.userID);
OpenAdminMenu(player, AdminTab.None);
CreateMenuPopup(player, $"Successfully saved event {eventConfig.EventName}");
}
else CreateMenuPopup(player, (string)success);
}
}
[ConsoleCommand("arenaui.disposeevent")]
private void ccmdDisposeEvent(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Player();
if (player == null) return;
_eventCreators.Remove(player.userID);
if (player.IsAdmin || permission.UserHasPermission(player.UserIDString, Arena.ADMIN_PERMISSION)) {
OpenAdminMenu(player, AdminTab.None);
CreateMenuPopup(player, "Cancelled event creation");
}
}
[ConsoleCommand("arenaui.clear")]
private void ccmdClearField(ConsoleSystem.Arg arg) {
BasePlayer player = arg.Player();
if (player == null) return;
Arena.EventConfig eventConfig;
if (!_eventCreators.TryGetValue(player.userID, out eventConfig)) return;
string fieldName = arg.GetString(0);
switch (fieldName) {
case "eventName" : eventConfig.EventName = string.Empt
// ... [Code preview truncated due to length. Full source in attached file] ...