using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using HoldfastGame;
using RyLib;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using uLink;
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace EasierAdmin;
public enum Weapon
{
Musket_Land_Pattern_Musket_Brown_Bess,
Musket_Charleville_Musket_IXXIII_Standard_Year,
Musket_Russian_Musket_Pattern_1808,
Musket_Spanish_Escopeta_Musket,
Musket_Ottoman_Tufenk_Musket,
Musket_Boutet_Musket,
Musket_Iroquois_Musket,
Musket_Barbary,
Rifle_Baker_Rifle_Pattern_1800,
Rifle_Russian_Rifle_Pattern_1806,
Rifle_Sporting_Rifle,
Rifle_Long_Rifle,
Carbine_Elliot_Carbine,
Carbine_Charleville_Cavalry_Carbine_IXXIII,
Carbine_Russian_Cuirassier_Carbine,
Carbine_Sporting_Carbine,
Blunderbuss_French_Blunderbuss,
Blunderbuss_Nock_Gun_Blunderbuss,
Pistol_Land_Pattern_Pistol,
Pistol_French_Pistol_XIII,
Pistol_Russian_1809_Pistol,
Pistol_Le_Page_Pistol,
Pistol_Nelson,
Frontlines_Webley_Revolver_MKIV,
Frontlines_Modele_1892_Revolver,
Frontlines_M1917_Revolver,
Frontlines_Mauser_C78_Revolver,
Frontlines_LeeEnfield_MKIII,
Frontlines_Mauser_Gewehr_98,
Frontlines_Lebel_Model_1886,
Sword_British_Officer_Sword,
Sword_American_Officer_Sword,
Sword_Dragoon_Sword,
Sword_1796_Pattern_Light_Sabre,
Sword_Russian_Hussar_Sword,
Sword_An_XI_Light_Sabre,
Sword_Sabre_Briquet,
Sword_British_Hanger,
Sword_French_Hanger,
Sword_1804_Pattern_Naval_Cutlass,
Sword_Claymore,
Sword_Scimitar,
Sword_Yatagan_Sword,
Sword_Napoleons_Sword,
Sword_Battle_Axe,
Sword_War_Hammer,
Sword_Tomahawk,
Axe2H_British_2Handed_Axe,
Axe2H_Sapper_2Handed_Axe,
Axe1H_Carpenter_Axe,
Axe2H_The_Log,
Spontoon_Pitchfork,
Spontoon_Halberd,
Spontoon_British_Spontoon,
Spontoon_British_Boarding_Pike,
Knife_British_Dagger,
Knife_French_Knife,
Frontlines_British_Trench_Club,
Frontlines_1918_Trench_Knife,
Sword_Frying_Pan,
Sword_Frying_Pan_Gold,
Sword_Whiskey_Bottle,
Sword_Rum_Bottle,
Sword_Peg_Leg
}
[BepInPlugin("com.llstarlessll.easieradmin", "Easier Admin", "1.3.0")]
[BepInDependency("com.ryannlt.rylib", "1.2.0")]
public class EasierAdminPlugin : BaseUnityPlugin
{
private class Hotkey
{
public string Name;
public ConfigEntry<KeyboardShortcut> Key;
public Action Run;
}
private class Alert
{
public float Until;
public string Text;
}
private struct P
{
public int Id;
public string Name;
public string Tag;
public FactionCountry Faction;
public PlayerClass Class;
public bool Bot;
public bool Alive;
}
public const string Guid = "com.llstarlessll.easieradmin";
private static EasierAdminPlugin I;
private ConfigEntry<Weapon> pick;
private ConfigEntry<bool> keepGiving;
private ConfigEntry<bool> includeBots;
private ConfigEntry<string>[] loadouts;
private ConfigEntry<float> runSpeed;
private ConfigEntry<float> jumpForce;
private ConfigEntry<float> explosionSize;
private ConfigEntry<float> explosionKnock;
private ConfigEntry<float> ragdoll;
private ConfigEntry<bool> explosive;
private ConfigEntry<bool> infiniteAmmo;
private ConfigEntry<bool> godMode;
private ConfigEntry<bool> fallDamage;
private ConfigEntry<bool> allowFiring;
private ConfigEntry<bool> allowArty;
private ConfigEntry<string> schedCommand;
private ConfigEntry<int> schedDelay;
private ConfigEntry<string>[] broadcasts;
private ConfigEntry<string>[] macroText;
private ConfigEntry<string>[] slayReasons;
private ConfigEntry<string> regTag;
private ConfigEntry<string> regMessage;
private ConfigEntry<bool> teamCount;
private readonly List<Hotkey> hotkeys = new List<Hotkey>();
private Hotkey listening;
private float listenUntil;
private ConfigEntry<bool> fWeapons;
private ConfigEntry<bool> fFun;
private ConfigEntry<bool> fAdmin;
private ConfigEntry<bool> fPlayers;
private ConfigEntry<bool> fHotkeys;
private ConfigEntry<bool> fRowGive;
private ConfigEntry<bool> fRowLoadout;
private ConfigEntry<bool> fRowStrip;
private ConfigEntry<bool> fRowSlay;
private ConfigEntry<bool> fKillLog;
private ConfigEntry<bool> fFeedback;
private readonly Dictionary<string, KeyValuePair<float, string>> pendingSet = new Dictionary<string, KeyValuePair<float, string>>();
private List<P> cache = new List<P>();
private float cacheAt;
private bool suppress;
private readonly HashSet<int> wasAlive = new HashSet<int>();
private readonly List<KeyValuePair<float, int>> pendingGive = new List<KeyValuePair<float, int>>();
private readonly List<KeyValuePair<float, string>> scheduled = new List<KeyValuePair<float, string>>();
private float nextPoll;
private ConfigEntry<float> dmgScale;
private ConfigEntry<float> walkSpeed;
private ConfigEntry<float> horseJump;
private ConfigEntry<float> cannonLoad;
private ConfigEntry<bool> allowBlock;
private ConfigEntry<bool> bulletDrop;
private ConfigEntry<bool> infRange;
private ConfigEntry<bool> horseAll;
private ConfigEntry<bool> firstPerson;
private ConfigEntry<bool> fAlerts;
private ConfigEntry<string> alertWords;
private ConfigEntry<string> watchNames;
private ConfigEntry<bool> fWarn;
private ConfigEntry<bool> shareWarns;
private ConfigEntry<int> warnMax;
private ConfigEntry<string> warnReason;
private ConfigEntry<string> warnStore;
private ConfigEntry<bool> fFic;
private ConfigEntry<bool> ficAlert;
private ConfigEntry<float> ficMeleeRange;
private ConfigEntry<float> ficShooterMin;
private static readonly List<Alert> alerts = new List<Alert>();
private static readonly Dictionary<string, int> warns = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<string, int> ficCount = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
private static int offerId = -1;
private static string offerName;
private static string offerText;
private static string offerReason;
private static bool offerWarn;
private static float offerUntil;
private ConfigEntry<bool> fTk;
private ConfigEntry<bool> tkAlert;
private ConfigEntry<bool> tkArty;
private ConfigEntry<int> tkMax;
private ConfigEntry<string> tkStore;
private static readonly Dictionary<string, int> tks = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
private static readonly KeyCode[] Mods;
private static KeyCode[] allKeys;
private static int kickArmId;
private static float kickArmUntil;
private static string ficTag;
private static bool Admin => ClientRemoteConsoleAccessManager.loggedOn;
private void Awake()
{
I = this;
BindConfig();
ResetFunDisplay();
AddHotkeys();
BuildMenu();
Patch();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Easier Admin 1.3.0 loaded (by llstarlessll)");
}
private void BindConfig()
{
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Expected O, but got Unknown
//IL_0781: Unknown result type (might be due to invalid IL or missing references)
//IL_078b: Expected O, but got Unknown
//IL_086c: Unknown result type (might be due to invalid IL or missing references)
//IL_0876: Expected O, but got Unknown
//IL_08aa: Unknown result type (might be due to invalid IL or missing references)
//IL_08b4: Expected O, but got Unknown
//IL_0940: Unknown result type (might be due to invalid IL or missing references)
//IL_094a: Expected O, but got Unknown
pick = ((BaseUnityPlugin)this).Config.Bind<Weapon>("Weapons", "Weapon", Weapon.Spontoon_Pitchfork, "The weapon the Give buttons hand out.");
keepGiving = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons", "KeepGivingOnRespawn", false, "While on, every player who respawns is given the chosen weapon (only while you are in the server).");
includeBots = ((BaseUnityPlugin)this).Config.Bind<bool>("Weapons", "IncludeBots", false, "Also give weapons to bots.");
loadouts = new ConfigEntry<string>[3];
string[] array = new string[3] { "Spontoon_Pitchfork,Pistol_Land_Pattern_Pistol", "Sword_1796_Pattern_Light_Sabre", "Sword_Frying_Pan" };
for (int i = 0; i < 3; i++)
{
loadouts[i] = ((BaseUnityPlugin)this).Config.Bind<string>("Loadouts", "Loadout" + (i + 1), array[i], "Weapons for loadout " + (i + 1) + ", comma separated weapon names.");
}
runSpeed = Fun("RunSpeed", 1f, "characterRunSpeed", "Run speed multiplier (1 = normal).");
jumpForce = Fun("JumpForce", 1f, "characterJumpForce", "Jump force multiplier (1 = normal).");
explosionSize = Fun("ExplosionSize", 1f, "explosionScaleMultiplier", "Explosion size multiplier (1 = normal).");
explosionKnock = Fun("ExplosionKnockback", 1f, "explosionKnockbackForceMultiplier", "Explosion knockback multiplier (1 = normal).");
ragdoll = Fun("RagdollForce", 1f, "ragdollForceMultiplier", "Ragdoll force multiplier (1 = normal).");
explosive = FunB("ExplosiveFirearms", def: false, "characterExplosiveFirearms", "Every shot explodes.");
infiniteAmmo = FunB("InfiniteAmmo", def: false, "characterInfiniteFirearmAmmo", "Infinite firearm ammo.");
godMode = FunB("GodMode", def: false, "characterGodMode", "Nobody can be hurt.");
fallDamage = FunB("FallDamage", def: true, "characterFallDamageEnabled", "Fall damage on or off.");
allowFiring = FunB("AllowFiring", def: true, "allowFiring", "Players may fire.");
allowArty = FunB("AllowArtilleryFiring", def: true, "allowArtyFiring", "Artillery may fire.");
schedCommand = ((BaseUnityPlugin)this).Config.Bind<string>("Scheduler", "Command", "broadcast CHARGE!", "rc command(s) to run later, without the rc. Separate several with ;");
schedDelay = ((BaseUnityPlugin)this).Config.Bind<int>("Scheduler", "DelaySeconds", 60, new ConfigDescription("Seconds from now.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 1800), Array.Empty<object>()));
broadcasts = new ConfigEntry<string>[3];
string[] array2 = new string[3] { "Lines raise in 1 minute!", "No firing until LIVE!", "Thanks for playing! Next battle soon." };
for (int j = 0; j < 3; j++)
{
broadcasts[j] = ((BaseUnityPlugin)this).Config.Bind<string>("Admin", "Broadcast" + (j + 1), array2[j], "Broadcast template " + (j + 1) + ".");
}
macroText = new ConfigEntry<string>[2];
macroText[0] = ((BaseUnityPlugin)this).Config.Bind<string>("Admin", "Macro1", "set characterGodMode false; set allowFiring true; broadcast LIVE!", "Macro 1 (Go live): rc commands separated by ;");
macroText[1] = ((BaseUnityPlugin)this).Config.Bind<string>("Admin", "Macro2", "ac 30", "Macro 2 (All charge): rc commands separated by ;");
slayReasons = new ConfigEntry<string>[3];
string[] array3 = new string[3] { "Out of line", "Firing before LIVE", "Teamkilling" };
for (int k = 0; k < 3; k++)
{
slayReasons[k] = ((BaseUnityPlugin)this).Config.Bind<string>("Admin", "SlayReason" + (k + 1), array3[k], "Reason for quick slay button " + (k + 1) + " on the player row.");
}
fWeapons = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "WeaponsPage", true, "Show the Weapons page.");
fFun = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "FunSettingsPage", true, "Show the Fun Settings page.");
fAdmin = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "AdminPage", true, "Show the Admin page.");
fPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "PlayersPage", true, "Show the Players page.");
fHotkeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "Hotkeys", true, "Hotkeys on or off (the Hotkeys page hides when off).");
fRowGive = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "RowGiveWeapon", true, "Give weapon button on player rows and the kill log.");
fRowLoadout = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "RowGiveLoadout", true, "Give loadout 1 button on player rows and the kill log.");
fRowStrip = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "RowStripWeapons", true, "Strip weapons button on player rows and the kill log.");
fRowSlay = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "RowQuickSlays", true, "The three quick slay buttons on player rows and the kill log.");
fKillLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "KillLogActions", true, "Turn on the kill log action panel (also shared with other RyLib mods).");
fFeedback = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "ConfirmMessages", true, "Send yourself a private message confirming each action (given to X players, scheduled, and so on).");
regTag = ((BaseUnityPlugin)this).Config.Bind<string>("Players", "RegimentTag", "", "Regiment tag to message.");
regMessage = ((BaseUnityPlugin)this).Config.Bind<string>("Players", "RegimentMessage", "Please listen to the admins.", "Message for the regiment.");
teamCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Players", "ShowTeamCount", false, "Show a live team count box on screen.");
dmgScale = Fun("WeaponDamage", 1f, "characterWeaponDamageScale", "Weapon damage multiplier (1 = normal).");
walkSpeed = Fun("WalkSpeed", 1f, "characterWalkSpeed", "Walk speed multiplier (1 = normal).");
horseJump = Fun("HorseJump", 1f, "vehicleJumpHeightMultiplier", "Horse jump height multiplier (1 = normal).");
cannonLoad = Fun("CannonLoading", 1f, "cannonLoadingSpeedMultiplier", "Cannon, rocket and machine gun loading speed (1 = normal).");
allowBlock = FunB("AllowBlocking", def: true, "allowBlocking", "Players can block with melee weapons.");
bulletDrop = FunB("BulletDrop", def: true, "characterWeaponFirearmApplyDrop", "Bullets drop over distance.");
infRange = FunB("InfiniteRange", def: false, "characterWeaponInfiniteRange", "Firearms hit at any range.");
horseAll = FunB("HorseForEveryone", def: false, "vehicleHorseForAll", "Everyone spawns with a horse.");
firstPerson = FunB("ForceFirstPerson", def: false, "forceFirstPersonMode", "Everyone has to play in first person.");
fAlerts = ((BaseUnityPlugin)this).Config.Bind<bool>("ChatAlerts", "On", true, "Highlight chat messages that mention admin, a watched player or one of your words.");
alertWords = ((BaseUnityPlugin)this).Config.Bind<string>("ChatAlerts", "Words", "admin, report, help, tk, teamkill, rambo, fic, hack, cheat", "Words that trigger an alert, comma separated (capitals don't matter).");
watchNames = ((BaseUnityPlugin)this).Config.Bind<string>("ChatAlerts", "WatchedPlayers", "", "Player names to watch, comma separated. Anything they say is highlighted.");
fWarn = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "On", true, "Warn button on player rows and the kill log.");
warnMax = ((BaseUnityPlugin)this).Config.Bind<int>("Warnings", "MaxWarnings", 3, new ConfigDescription("At this many warnings you are offered a one-click slay or kick.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
warnReason = ((BaseUnityPlugin)this).Config.Bind<string>("Warnings", "Reason", "Follow the event rules", "Reason sent with each warning.");
shareWarns = ((BaseUnityPlugin)this).Config.Bind<bool>("Warnings", "ShareInAdminChat", false, "Also post each warning and kick in admin chat (only logged-in admins see it) so other admins' Easier Admin keeps the same count. Off by default.");
warnStore = ((BaseUnityPlugin)this).Config.Bind<string>("Warnings", "Tonight", "", "Saved warning counts for tonight (filled in by Easier Admin).");
fFic = ((BaseUnityPlugin)this).Config.Bind<bool>("FIC", "On", true, "Tag kill log rows where someone shot into a melee their own side was in (firing in charge).");
ficAlert = ((BaseUnityPlugin)this).Config.Bind<bool>("FIC", "Alert", true, "Also show an on-screen alert for each possible FIC.");
ficMeleeRange = ((BaseUnityPlugin)this).Config.Bind<float>("FIC", "MeleeRange", 3f, new ConfigDescription("A teammate of the shooter this close (metres) to the victim counts as being in melee with them.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 8f), Array.Empty<object>()));
ficShooterMin = ((BaseUnityPlugin)this).Config.Bind<float>("FIC", "ShooterDistance", 4f, new ConfigDescription("The shooter must be at least this far (metres) from the victim, so point-blank fights in the melee itself don't count.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>()));
fTk = ((BaseUnityPlugin)this).Config.Bind<bool>("Teamkills", "On", true, "Count teamkills per player for the night and tag them in the kill log.");
tkAlert = ((BaseUnityPlugin)this).Config.Bind<bool>("Teamkills", "Alert", true, "Show an on-screen alert for every teamkill.");
tkArty = ((BaseUnityPlugin)this).Config.Bind<bool>("Teamkills", "CountArtillery", false, "Also count teamkills by artillery, rockets, explosions and horses (off: only shots and melee).");
tkMax = ((BaseUnityPlugin)this).Config.Bind<int>("Teamkills", "Limit", 3, new ConfigDescription("At this many teamkills you are offered a one-click warn, slay or kick.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
tkStore = ((BaseUnityPlugin)this).Config.Bind<string>("Teamkills", "Tonight", "", "Saved teamkill counts for tonight (filled in by Easier Admin).");
LoadWarns();
LoadCounts(tkStore, tks);
}
private void AddHotkeys()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
HK("Macro1", "Run macro 1 (Go live)", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), delegate
{
RunMacro(0);
});
HK("Macro2", "Run macro 2 (All charge)", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), delegate
{
RunMacro(1);
});
HK("GiveWeaponToAll", "Give the chosen weapon to everyone", new KeyboardShortcut((KeyCode)292, Array.Empty<KeyCode>()), delegate
{
GiveAll(new string[1] { pick.Value.ToString() });
});
for (int num = 0; num < 3; num++)
{
int k = num;
HK("GiveLoadout" + (k + 1), "Give loadout " + (k + 1) + " to everyone", KeyboardShortcut.Empty, delegate
{
GiveAll(Split(loadouts[k].Value));
});
}
HK("ToggleKeepGiving", "Turn keep giving on respawn on or off", KeyboardShortcut.Empty, delegate
{
keepGiving.Value = !keepGiving.Value;
Tell("Keep giving on respawn: " + ((!keepGiving.Value) ? "OFF" : "ON"));
});
HK("StripAll", "Strip everyone's weapons", KeyboardShortcut.Empty, StripAll);
for (int num2 = 0; num2 < 3; num2++)
{
int k2 = num2;
HK("Broadcast" + (k2 + 1), "Send broadcast template " + (k2 + 1), KeyboardShortcut.Empty, delegate
{
Rc("broadcast " + broadcasts[k2].Value);
});
}
HK("ToggleGodMode", "Turn god mode on or off", KeyboardShortcut.Empty, delegate
{
godMode.Value = !godMode.Value;
});
HK("ToggleFiring", "Turn allow firing on or off", KeyboardShortcut.Empty, delegate
{
allowFiring.Value = !allowFiring.Value;
});
HK("ToggleTeamCount", "Show or hide the team count", KeyboardShortcut.Empty, delegate
{
teamCount.Value = !teamCount.Value;
});
}
private void HK(string key, string name, KeyboardShortcut def, Action run)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<KeyboardShortcut> key2 = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", key, def, name + ". Set it in game: P menu > Easier Admin > Hotkeys page. AdminHelper uses F6, [ and ].");
hotkeys.Add(new Hotkey
{
Name = name,
Key = key2,
Run = run
});
}
private static void Tell(string text)
{
ClientComponentReferenceManager clientInstance = ClientComponentReferenceManager.ClientInstance;
((BaseUnityPlugin)I).Logger.LogInfo((object)text);
if (I.fFeedback.Value && !((Object)(object)clientInstance == (Object)null) && !((Object)(object)clientInstance.clientRoundPlayerManager == (Object)null) && clientInstance.clientRoundPlayerManager.LocalPlayer != null && Admin)
{
clientInstance.pMenuPanel.ManualConsoleExecute("rc serverAdmin privateMessage " + ((RoundPlayer)clientInstance.clientRoundPlayerManager.LocalPlayer).NetworkPlayerID + " " + text);
}
}
private unsafe static string KeyText(KeyboardShortcut k)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return ((int)((KeyboardShortcut)(ref k)).MainKey != 0) ? ((object)(*(KeyboardShortcut*)(&k))/*cast due to .constrained prefix*/).ToString() : "not set";
}
private ConfigEntry<float> Fun(string key, float def, string rcName, string desc)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
ConfigEntry<float> e = ((BaseUnityPlugin)this).Config.Bind<float>("FunSettings", key, def, new ConfigDescription(desc, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
e.SettingChanged += delegate
{
if (!suppress && Admin)
{
pendingSet[rcName] = new KeyValuePair<float, string>(Time.unscaledTime + 0.4f, "set " + rcName + " " + e.Value.ToString("0.##", CultureInfo.InvariantCulture));
}
};
return e;
}
private ConfigEntry<bool> FunB(string key, bool def, string rcName, string desc)
{
ConfigEntry<bool> e = ((BaseUnityPlugin)this).Config.Bind<bool>("FunSettings", key, def, desc);
e.SettingChanged += delegate
{
if (!suppress && Admin)
{
Rc("set " + rcName + " " + ((!e.Value) ? "false" : "true"));
}
};
return e;
}
private void BuildMenu()
{
HeaderTab val = PMenu.Header("com.llstarlessll.easieradmin", "Easier Admin", "hui-p-tab-admin");
Page val2 = val.Page("com.llstarlessll.easieradmin", "Weapons", "hui-p-slay", true, (Func<bool>)(() => fWeapons.Value));
val2.Section("com.llstarlessll.easieradmin", "Give a weapon", (Action<Section>)delegate(Section s)
{
s.Button("Give to everyone", (Action)delegate
{
GiveAll(new string[1] { pick.Value.ToString() });
}, "hui-p-tab-players", "Gives the chosen weapon to every living player.");
s.ConfirmButton("Take from everyone", (Action)delegate
{
TakeAll(pick.Value.ToString());
}, "hui-p-slay", "Takes the chosen weapon away from every living player.");
s.ConfirmButton("Strip everyone", (Action)StripAll, "hui-p-slay", "Removes every weapon from every living player (they keep their fists).");
s.Toggle("Keep giving on respawn", keepGiving, "hui-p-tab-players");
s.Toggle("Include bots", includeBots, (string)null);
s.Dropdown<Weapon>("Weapon", pick, (Func<Weapon, string>)((Weapon w) => Nice(w.ToString())));
});
val2.Section("com.llstarlessll.easieradmin", "Loadouts", (Action<Section>)delegate(Section s)
{
for (int i = 0; i < 3; i++)
{
int k2 = i;
s.Button("Give loadout " + (k2 + 1) + " to all", (Action)delegate
{
GiveAll(Split(loadouts[k2].Value));
}, "hui-p-tab-players");
}
for (int num2 = 0; num2 < 3; num2++)
{
s.TextField("Loadout " + (num2 + 1), loadouts[num2]);
}
});
Page val3 = val.Page("com.llstarlessll.easieradmin", "Fun Settings", "hui-p-menu-ray-gun", true, (Func<bool>)(() => fFun.Value));
val3.Section("com.llstarlessll.easieradmin", "Game settings", (Action<Section>)delegate(Section s)
{
s.Toggle("Explosive firearms", explosive, (string)null);
s.Toggle("Infinite ammo", infiniteAmmo, (string)null);
s.Toggle("God mode", godMode, (string)null);
s.Toggle("Fall damage", fallDamage, (string)null);
s.Toggle("Allow firing", allowFiring, (string)null);
s.Toggle("Allow artillery", allowArty, (string)null);
s.ConfirmButton("Reset to default", (Action)ResetFun, (string)null, "Sends rc set default and puts every setting back.");
s.Button("Apply all to server", (Action)ApplyAllFun, (string)null, "Sends every switch and slider as shown here, so the server matches the page (the page cannot read the server's current settings).");
s.Slider("Run speed", runSpeed, 0.2f, 5f, 0.1f, "0.0");
s.Slider("Jump force", jumpForce, 0.2f, 10f, 0.1f, "0.0");
s.Slider("Explosion size", explosionSize, 0.2f, 10f, 0.1f, "0.0");
s.Slider("Explosion knockback", explosionKnock, 0f, 10f, 0.1f, "0.0");
s.Slider("Ragdoll force", ragdoll, 0f, 10f, 0.1f, "0.0");
});
val3.Section("com.llstarlessll.easieradmin", "More game settings", (Action<Section>)delegate(Section s)
{
s.Toggle("Allow blocking", allowBlock, (string)null);
s.Toggle("Bullet drop", bulletDrop, (string)null);
s.Toggle("Infinite range", infRange, (string)null);
s.Toggle("Horse for everyone", horseAll, (string)null);
s.Toggle("Force first person", firstPerson, (string)null);
s.Slider("Weapon damage", dmgScale, 0.1f, 5f, 0.1f, "0.0");
s.Slider("Walk speed", walkSpeed, 0.2f, 5f, 0.1f, "0.0");
s.Slider("Horse jump", horseJump, 0.2f, 5f, 0.1f, "0.0");
s.Slider("Cannon loading speed", cannonLoad, 0.2f, 5f, 0.1f, "0.0");
});
val3.Section("com.llstarlessll.easieradmin", "Scheduled commands", (Action<Section>)delegate(Section s)
{
s.Button("Schedule", (Action)delegate
{
Schedule(schedCommand.Value, schedDelay.Value);
}, (string)null, "Runs the command after the delay (only while you are in the server).");
s.ConfirmButton("Cancel all", (Action)delegate
{
scheduled.Clear();
Tell("Easier Admin: scheduled commands cancelled.");
}, (string)null);
s.TextField("Command (no rc)", schedCommand);
s.Slider("Delay (seconds)", schedDelay, 5, 1800);
});
Page val4 = val.Page("com.llstarlessll.easieradmin", "Admin", "hui-p-tab-admin", true, (Func<bool>)(() => fAdmin.Value));
val4.Section("com.llstarlessll.easieradmin", "Macros", (Action<Section>)delegate(Section s)
{
s.Button("Run macro 1", (Action)delegate
{
RunMacro(0);
}, (string)null);
s.Button("Run macro 2", (Action)delegate
{
RunMacro(1);
}, (string)null);
s.TextField("Macro 1", macroText[0]);
s.TextField("Macro 2", macroText[1]);
});
val4.Section("com.llstarlessll.easieradmin", "Broadcasts", (Action<Section>)delegate(Section s)
{
for (int i = 0; i < 3; i++)
{
int k2 = i;
s.Button("Send " + (k2 + 1), (Action)delegate
{
Rc("broadcast " + broadcasts[k2].Value);
}, (string)null);
}
for (int num2 = 0; num2 < 3; num2++)
{
s.TextField("Template " + (num2 + 1), broadcasts[num2]);
}
});
val4.Section("com.llstarlessll.easieradmin", "Quick slay reasons (player row buttons Slay reason 1, 2, 3)", (Action<Section>)delegate(Section s)
{
for (int i = 0; i < 3; i++)
{
s.TextField("Reason " + (i + 1), slayReasons[i]);
}
});
val4.Section("com.llstarlessll.easieradmin", "Warnings (Warn button on player rows and the kill log)", (Action<Section>)delegate(Section s)
{
s.Button("Show tonight's warnings", (Action)ShowWarns, "hui-p-tab-admin", "Sends you a private message with every player warned tonight.");
s.ConfirmButton("Reset warnings", (Action)delegate
{
warns.Clear();
SaveWarns();
Tell("Warnings reset.");
}, (string)null);
s.Toggle("Share warnings in admin chat", shareWarns, (string)null);
s.Slider("Warnings before slay / kick", warnMax, 1, 10);
s.TextField("Warning reason", warnReason);
});
val4.Section("com.llstarlessll.easieradmin", "Chat alerts", (Action<Section>)delegate(Section s)
{
s.Toggle("Chat alerts", fAlerts, "hui-p-tab-admin");
s.Button("Clear alerts", (Action)delegate
{
alerts.Clear();
}, (string)null);
s.TextField("Alert words", alertWords);
s.TextField("Watched players", watchNames);
});
val4.Section("com.llstarlessll.easieradmin", "FIC tags in the kill log", (Action<Section>)delegate(Section s)
{
s.Toggle("Tag possible FIC kills", fFic, "hui-p-slay");
s.Toggle("On-screen alert", ficAlert, (string)null);
s.Button("Show FIC count this round", (Action)delegate
{
Tell((ficCount.Count != 0) ? ("Possible FIC: " + string.Join(", ", (from keyValuePair in ficCount
orderby keyValuePair.Value descending
select keyValuePair.Key + " " + keyValuePair.Value).ToArray())) : "No possible FIC kills yet.");
}, (string)null);
s.Button("Reset FIC count", (Action)delegate
{
ficCount.Clear();
Tell("FIC count reset.");
}, (string)null);
s.Slider("Melee range (m)", ficMeleeRange, 1f, 8f, 0.5f, "0.0");
s.Slider("Shooter at least (m)", ficShooterMin, 0f, 20f, 0.5f, "0.0");
});
val4.Section("com.llstarlessll.easieradmin", "Teamkill tracker", (Action<Section>)delegate(Section s)
{
s.Toggle("Count teamkills", fTk, "hui-p-slay");
s.Toggle("Alert on every teamkill", tkAlert, (string)null);
s.Toggle("Count artillery and explosions", tkArty, (string)null);
s.Button("Show tonight's teamkills", (Action)delegate
{
Tell((tks.Count != 0) ? ("Teamkills tonight: " + string.Join(", ", (from keyValuePair in tks
orderby keyValuePair.Value descending
select keyValuePair.Key + " " + keyValuePair.Value).ToArray())) : "No teamkills tonight.");
}, "hui-p-tab-admin");
s.ConfirmButton("Reset teamkills", (Action)delegate
{
tks.Clear();
SaveCounts(tkStore, tks);
Tell("Teamkill counts reset.");
}, (string)null);
s.Slider("Teamkills before warn / slay / kick", tkMax, 1, 10);
});
Page val5 = val.Page("com.llstarlessll.easieradmin", "Players", "hui-p-tab-players", true, (Func<bool>)(() => fPlayers.Value));
val5.Section("com.llstarlessll.easieradmin", "Regiment messages", (Action<Section>)delegate(Section s)
{
s.Button("Message regiment", (Action)delegate
{
MessageRegiment(regMessage.Value);
}, "hui-p-players-regiment");
s.Button("Ask to swap sides", (Action)delegate
{
MessageRegiment((regTag.Value ?? "").Trim() + " please swap sides for the remainder of the event!!");
}, "hui-p-players-regiment");
s.TextField("Regiment tag", regTag);
s.TextField("Message", regMessage);
});
val5.Section("com.llstarlessll.easieradmin", "Team count", (Action<Section>)delegate(Section s)
{
s.Toggle("Show team count", teamCount, "hui-p-tab-players");
});
ModTab val6 = PMenu.ModTab("com.llstarlessll.easieradmin", "Easier Admin", "hui-p-tab-admin", true, (Func<bool>)null);
Page val7 = val.Page("com.llstarlessll.easieradmin", "Hotkeys", "hui-p-tab-admin", true, (Func<bool>)(() => fHotkeys.Value));
val7.Section("com.llstarlessll.easieradmin", "Click an action, then press its key (Esc cancels, Backspace clears)", (Action<Section>)delegate(Section s)
{
foreach (Hotkey hotkey in hotkeys)
{
Hotkey hk = hotkey;
s.Button(hk.Name, (Action)delegate
{
StartListening(hk);
}, (string)null, "Hold Ctrl, Shift or Alt with the key for a combination.");
}
s.Button("Show my hotkeys", (Action)ShowHotkeys, "hui-p-tab-admin", "Sends you a private message listing every hotkey.");
s.ConfirmButton("Reset hotkeys", (Action)delegate
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
foreach (Hotkey hotkey2 in hotkeys)
{
hotkey2.Key.Value = (KeyboardShortcut)((ConfigEntryBase)hotkey2.Key).DefaultValue;
}
Tell("Hotkeys reset to defaults.");
}, (string)null);
});
val6.Section("com.llstarlessll.easieradmin", "Pages", (Action<Section>)delegate(Section s)
{
s.Toggle("Weapons page", fWeapons, (string)null);
s.Toggle("Fun Settings page", fFun, (string)null);
s.Toggle("Admin page", fAdmin, (string)null);
s.Toggle("Players page", fPlayers, (string)null);
s.Toggle("Hotkeys", fHotkeys, (string)null);
});
val6.Section("com.llstarlessll.easieradmin", "Player row and kill log buttons", (Action<Section>)delegate(Section s)
{
s.Toggle("Give weapon", fRowGive, (string)null);
s.Toggle("Give loadout 1", fRowLoadout, (string)null);
s.Toggle("Strip weapons", fRowStrip, (string)null);
s.Toggle("Quick slays", fRowSlay, (string)null);
s.Toggle("Kill log actions", fKillLog, (string)null);
});
val6.Section("com.llstarlessll.easieradmin", "Messages", (Action<Section>)delegate(Section s)
{
s.Toggle("Confirm messages", fFeedback, (string)null);
});
val6.Section("com.llstarlessll.easieradmin", "About", (Action<Section>)delegate(Section s)
{
s.Button("About Easier Admin", (Action)delegate
{
Tell("Easier Admin 1.3.0 by llstarlessll (Discord)");
}, (string)null);
});
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Give weapon", (StockRowButton)3, (Action<int>)delegate(int id)
{
Give(new int[1] { id }, new string[1] { pick.Value.ToString() });
Tell("Gave " + Nice(pick.Value.ToString()) + " to player " + id + ".");
}, (Func<bool>)(() => fRowGive.Value));
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Give loadout 1", (StockRowButton)3, (Action<int>)delegate(int id)
{
Give(new int[1] { id }, Split(loadouts[0].Value));
Tell("Gave loadout 1 to player " + id + ".");
}, (Func<bool>)(() => fRowLoadout.Value));
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Strip weapons", (StockRowButton)2, (Action<int>)delegate(int id)
{
Rc("carbonPlayers dropAllWeapons " + id);
Tell("Stripped the weapons of player " + id + ".");
}, (Func<bool>)(() => fRowStrip.Value));
for (int num = 0; num < 3; num++)
{
int k = num;
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Slay (reason " + (k + 1) + ")", (StockRowButton)0, (Action<int>)delegate(int id)
{
Rc("serverAdmin slay " + id + " " + slayReasons[k].Value);
Tell("Slew player " + id + ": " + slayReasons[k].Value);
}, (Func<bool>)(() => fRowSlay.Value));
}
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Warn", (StockRowButton)2, (Action<int>)Warn, (Func<bool>)(() => fWarn.Value));
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Kick (warnings)", (StockRowButton)7, (Action<int>)delegate(int id)
{
KickWarned(id);
}, (Func<bool>)(() => fWarn.Value));
PlayerRow.AddAction("com.llstarlessll.easieradmin", "Watch in chat", (StockRowButton)6, (Action<int>)WatchToggle, (Func<bool>)(() => fAlerts.Value));
KillLog.EnableActions("com.llstarlessll.easieradmin", (Func<bool>)(() => fKillLog.Value));
}
private static void Rc(string cmd)
{
Rc(new string[1] { cmd });
}
private static void Rc(IEnumerable<string> cmds)
{
ClientComponentReferenceManager clientInstance = ClientComponentReferenceManager.ClientInstance;
if ((Object)(object)clientInstance == (Object)null || (Object)(object)clientInstance.pMenuPanel == (Object)null)
{
((BaseUnityPlugin)I).Logger.LogWarning((object)"not in a server");
return;
}
List<string> list = cmds.Where((string x) => !string.IsNullOrEmpty(x)).ToList();
for (int num = 0; num < list.Count; num += 8)
{
clientInstance.pMenuPanel.ManualConsoleExecute("rc " + string.Join(" ; ", list.Skip(num).Take(8).ToArray()));
}
}
private static List<P> Players()
{
List<P> list = new List<P>();
ClientComponentReferenceManager clientInstance = ClientComponentReferenceManager.ClientInstance;
if ((Object)(object)clientInstance == (Object)null || (Object)(object)clientInstance.clientRoundPlayerManager == (Object)null)
{
return list;
}
ClientRoundPlayerManager clientRoundPlayerManager = clientInstance.clientRoundPlayerManager;
HashSet<int> seen = new HashSet<int>();
foreach (ClientRoundPlayerProxy roundPlayers in clientRoundPlayerManager.roundPlayersList)
{
Add(list, seen, (RoundPlayer)(object)roundPlayers);
}
Add(list, seen, (RoundPlayer)(object)clientRoundPlayerManager.LocalPlayer);
return list;
}
private static void Add(List<P> r, HashSet<int> seen, RoundPlayer p)
{
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
if (p != null && seen.Add(p.NetworkPlayerID))
{
RoundPlayerInformation playerRoundInformation = p.PlayerRoundInformation;
PlayerInitialDetails val = playerRoundInformation?.InitialDetails;
r.Add(new P
{
Id = p.NetworkPlayerID,
Name = ((val == null) ? ("Player " + p.NetworkPlayerID) : ((!string.IsNullOrEmpty(val.DisplayName)) ? val.DisplayName : val.Name)),
Tag = ((val == null) ? "" : (val.RegimentTag ?? "")),
Faction = (FactionCountry)((p.PlayerStartData != null) ? ((int)p.PlayerStartData.Faction) : 0),
Class = (PlayerClass)((p.PlayerStartData != null) ? ((int)p.PlayerStartData.ClassType) : 0),
Bot = (playerRoundInformation?.IsCarbonPlayer ?? false),
Alive = ((Object)(object)p.PlayerBase != (Object)null && p.PlayerBase.SpawnedAndAlive)
});
}
}
private static IEnumerable<int> Targets()
{
return from p in Players()
where p.Alive && (I.includeBots.Value || !p.Bot)
select p.Id;
}
private static string[] Valid(string[] weapons)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
List<string> list = new List<string>();
List<string> list2 = new List<string>();
foreach (string text in weapons)
{
try
{
list.Add(((object)(WeaponType)Enum.Parse(typeof(WeaponType), text.Trim(), ignoreCase: true)/*cast due to .constrained prefix*/).ToString());
}
catch
{
list2.Add(text);
}
}
if (list2.Count > 0)
{
Tell("Unknown weapon name(s), skipped: " + string.Join(", ", list2.ToArray()));
}
return list.ToArray();
}
private static void Give(IEnumerable<int> ids, string[] weapons)
{
weapons = Valid(weapons);
List<string> list = new List<string>();
foreach (int id in ids)
{
string[] array = weapons;
foreach (string text in array)
{
list.Add("carbonPlayers pickupWeapon " + id + " " + text.Trim());
}
}
Rc(list);
}
private static void GiveAll(string[] weapons)
{
List<int> list = Targets().ToList();
weapons = Valid(weapons);
if (weapons.Length == 0)
{
Tell("Nothing to give: the loadout is empty or has no valid weapon names.");
return;
}
Give(list, weapons);
Tell("Gave " + string.Join(", ", weapons.Select(Nice).ToArray()) + " to " + list.Count + " living players.");
}
private static void TakeAll(string weapon)
{
List<int> list = Targets().ToList();
Rc(list.Select((int id) => "carbonPlayers dropWeapon " + id + " " + weapon));
Tell("Took " + Nice(weapon) + " from " + list.Count + " living players.");
}
private static void StripAll()
{
List<int> list = Targets().ToList();
Rc(list.Select((int id) => "carbonPlayers dropAllWeapons " + id));
Tell("Stripped the weapons of " + list.Count + " living players.");
}
private static void MessageRegiment(string text)
{
string tag = (I.regTag.Value ?? "").Trim();
if (tag.Length == 0)
{
Tell("Set a regiment tag first.");
return;
}
List<int> list = (from p in Players()
where !p.Bot && string.Equals(p.Tag.Trim(), tag, StringComparison.OrdinalIgnoreCase)
select p.Id).ToList();
Rc(list.Select((int id) => "serverAdmin privateMessage " + id + " " + text));
Tell((list.Count != 0) ? ("Messaged " + list.Count + " players in " + tag + ".") : ("Nobody wearing the tag " + tag + " is in the server."));
}
private void StartListening(Hotkey h)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
listening = h;
listenUntil = Time.unscaledTime + 10f;
Tell("Press the key for: " + h.Name + " (now " + KeyText(h.Key.Value) + "). Esc cancels, Backspace clears.");
}
private void ShowHotkeys()
{
string[] array = (from h in hotkeys.Where(delegate(Hotkey h)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
KeyboardShortcut value = h.Key.Value;
return (int)((KeyboardShortcut)(ref value)).MainKey != 0;
})
select KeyText(h.Key.Value) + " = " + h.Name).ToArray();
Tell((array.Length != 0) ? ("Hotkeys: " + string.Join(" | ", array)) : "No hotkeys set.");
}
private void Listen()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Invalid comparison between Unknown and I4
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Invalid comparison between Unknown and I4
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Invalid comparison between Unknown and I4
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Invalid comparison between Unknown and I4
if (Time.unscaledTime > listenUntil)
{
Tell("Hotkey not changed (no key pressed).");
listening = null;
}
else
{
if (!Input.anyKeyDown)
{
return;
}
if (Input.GetKeyDown((KeyCode)27))
{
Tell("Hotkey not changed.");
listening = null;
return;
}
if (Input.GetKeyDown((KeyCode)8))
{
listening.Key.Value = KeyboardShortcut.Empty;
Tell(listening.Name + ": cleared.");
listening = null;
return;
}
if (allKeys == null)
{
allKeys = (KeyCode[])Enum.GetValues(typeof(KeyCode));
}
KeyCode[] array = allKeys;
KeyboardShortcut val2 = default(KeyboardShortcut);
foreach (KeyCode val in array)
{
if ((int)val == 0 || (int)val == 323 || (int)val == 324 || Mods.Contains(val) || !Input.GetKeyDown(val))
{
continue;
}
List<KeyCode> list = new List<KeyCode>();
if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
{
list.Add((KeyCode)306);
}
if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
{
list.Add((KeyCode)304);
}
if (Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307))
{
list.Add((KeyCode)308);
}
((KeyboardShortcut)(ref val2))..ctor(val, list.ToArray());
foreach (Hotkey hotkey in hotkeys)
{
if (hotkey != listening && ((object)hotkey.Key.Value/*cast due to .constrained prefix*/).Equals((object?)val2))
{
hotkey.Key.Value = KeyboardShortcut.Empty;
Tell(KeyText(val2) + " was on '" + hotkey.Name + "', moved it.");
}
}
if ((int)val == 287 || (int)val == 91 || (int)val == 93)
{
Tell(string.Concat("Note: ", val, " is also used by AdminHelper."));
}
listening.Key.Value = val2;
Tell(listening.Name + " = " + KeyText(val2));
listening = null;
break;
}
}
}
private static bool Typing()
{
EventSystem current = EventSystem.current;
GameObject val = ((!((Object)(object)current != (Object)null)) ? null : current.currentSelectedGameObject);
return (Object)(object)val != (Object)null && ((Object)(object)val.GetComponent<InputField>() != (Object)null || (Object)(object)val.GetComponent<TMP_InputField>() != (Object)null);
}
private void RunMacro(int i)
{
string[] array = Split(macroText[i].Value, ';');
if (array.Length == 0)
{
Tell("Macro " + (i + 1) + " is empty.");
return;
}
Rc(array);
Tell("Ran macro " + (i + 1) + ".");
}
private void Schedule(string cmd, int delay)
{
if (string.IsNullOrEmpty((cmd ?? "").Trim()))
{
Tell("Type a command first.");
return;
}
scheduled.Add(new KeyValuePair<float, string>(Time.time + (float)delay, cmd));
Tell("Scheduled in " + delay + " s: " + cmd);
}
private void ResetFunDisplay()
{
suppress = true;
try
{
ConfigEntry<float>[] array = new ConfigEntry<float>[9] { runSpeed, jumpForce, explosionSize, explosionKnock, ragdoll, dmgScale, walkSpeed, horseJump, cannonLoad };
foreach (ConfigEntry<float> val in array)
{
val.Value = (float)((ConfigEntryBase)val).DefaultValue;
}
ConfigEntry<bool>[] array2 = new ConfigEntry<bool>[11]
{
explosive, infiniteAmmo, godMode, fallDamage, allowFiring, allowArty, allowBlock, bulletDrop, infRange, horseAll,
firstPerson
};
foreach (ConfigEntry<bool> val2 in array2)
{
val2.Value = (bool)((ConfigEntryBase)val2).DefaultValue;
}
}
finally
{
suppress = false;
}
}
private void ApplyAllFun()
{
CultureInfo invariantCulture = CultureInfo.InvariantCulture;
List<string> list = new List<string>();
list.Add("set characterRunSpeed " + runSpeed.Value.ToString("0.##", invariantCulture));
list.Add("set characterJumpForce " + jumpForce.Value.ToString("0.##", invariantCulture));
list.Add("set explosionScaleMultiplier " + explosionSize.Value.ToString("0.##", invariantCulture));
list.Add("set explosionKnockbackForceMultiplier " + explosionKnock.Value.ToString("0.##", invariantCulture));
list.Add("set ragdollForceMultiplier " + ragdoll.Value.ToString("0.##", invariantCulture));
list.Add("set characterExplosiveFirearms " + ((!explosive.Value) ? "false" : "true"));
list.Add("set characterInfiniteFirearmAmmo " + ((!infiniteAmmo.Value) ? "false" : "true"));
list.Add("set characterGodMode " + ((!godMode.Value) ? "false" : "true"));
list.Add("set characterFallDamageEnabled " + ((!fallDamage.Value) ? "false" : "true"));
list.Add("set allowFiring " + ((!allowFiring.Value) ? "false" : "true"));
list.Add("set allowArtyFiring " + ((!allowArty.Value) ? "false" : "true"));
list.Add("set characterWeaponDamageScale " + dmgScale.Value.ToString("0.##", invariantCulture));
list.Add("set characterWalkSpeed " + walkSpeed.Value.ToString("0.##", invariantCulture));
list.Add("set vehicleJumpHeightMultiplier " + horseJump.Value.ToString("0.##", invariantCulture));
list.Add("set cannonLoadingSpeedMultiplier " + cannonLoad.Value.ToString("0.##", invariantCulture));
list.Add("set allowBlocking " + ((!allowBlock.Value) ? "false" : "true"));
list.Add("set characterWeaponFirearmApplyDrop " + ((!bulletDrop.Value) ? "false" : "true"));
list.Add("set characterWeaponInfiniteRange " + ((!infRange.Value) ? "false" : "true"));
list.Add("set vehicleHorseForAll " + ((!horseAll.Value) ? "false" : "true"));
list.Add("set forceFirstPersonMode " + ((!firstPerson.Value) ? "false" : "true"));
Rc(list);
Tell("Sent every fun setting to the server.");
}
private void ResetFun()
{
Rc("set default");
suppress = true;
try
{
ConfigEntry<float>[] array = new ConfigEntry<float>[9] { runSpeed, jumpForce, explosionSize, explosionKnock, ragdoll, dmgScale, walkSpeed, horseJump, cannonLoad };
foreach (ConfigEntry<float> val in array)
{
val.Value = (float)((ConfigEntryBase)val).DefaultValue;
}
ConfigEntry<bool>[] array2 = new ConfigEntry<bool>[11]
{
explosive, infiniteAmmo, godMode, fallDamage, allowFiring, allowArty, allowBlock, bulletDrop, infRange, horseAll,
firstPerson
};
foreach (ConfigEntry<bool> val2 in array2)
{
val2.Value = (bool)((ConfigEntryBase)val2).DefaultValue;
}
}
finally
{
suppress = false;
}
Tell("Game settings reset to default.");
}
private static string[] Split(string s, char sep = ',')
{
return (from x in (s ?? "").Split(sep)
select x.Trim() into x
where x.Length > 0
select x).ToArray();
}
private static string Nice(string w)
{
return w.Replace("Frontlines_", "WW1 ").Replace("Spontoon_", "").Replace("Sword_", "")
.Replace("Axe2H_", "")
.Replace("Axe1H_", "")
.Replace("_", " ");
}
private static string Short(string s)
{
return (s.Length <= 14) ? s : s.Substring(0, 14);
}
private static string NameOf(int id)
{
return Players().FirstOrDefault((P x) => x.Id == id).Name ?? ("Player " + id);
}
private static string Today()
{
return DateTime.Now.AddHours(-6.0).ToString("yyyy-MM-dd");
}
private void LoadWarns()
{
warns.Clear();
string[] array = (warnStore.Value ?? "").Split('|');
if (array.Length < 2 || array[0] != Today())
{
return;
}
string[] array2 = array[1].Split(';');
foreach (string text in array2)
{
int num = text.LastIndexOf('=');
if (num > 0 && int.TryParse(text.Substring(num + 1), out var result))
{
warns[text.Substring(0, num)] = result;
}
}
}
private static void SaveWarns()
{
I.warnStore.Value = Today() + "|" + string.Join(";", warns.Select((KeyValuePair<string, int> k) => k.Key.Replace(";", "").Replace("|", "").Replace("=", "") + "=" + k.Value).ToArray());
}
private static void LoadCounts(ConfigEntry<string> store, Dictionary<string, int> d)
{
d.Clear();
string[] array = (store.Value ?? "").Split('|');
if (array.Length < 2 || array[0] != Today())
{
return;
}
string[] array2 = array[1].Split(';');
foreach (string text in array2)
{
int num = text.LastIndexOf('=');
if (num > 0 && int.TryParse(text.Substring(num + 1), out var result))
{
d[text.Substring(0, num)] = result;
}
}
}
private static void SaveCounts(ConfigEntry<string> store, Dictionary<string, int> d)
{
store.Value = Today() + "|" + string.Join(";", d.Select((KeyValuePair<string, int> k) => k.Key.Replace(";", "").Replace("|", "").Replace("=", "") + "=" + k.Value).ToArray());
}
private static void ShowWarns()
{
Tell((warns.Count != 0) ? ("Warnings tonight: " + string.Join(", ", (from k in warns
orderby k.Value descending
select k.Key + " " + k.Value).ToArray())) : "No warnings tonight.");
}
private void Warn(int id)
{
if ((warnStore.Value ?? "").Split('|')[0] != Today())
{
warns.Clear();
}
string text = NameOf(id);
warns.TryGetValue(text, out var value);
value++;
warns[text] = value;
SaveWarns();
int value2 = warnMax.Value;
Rc("serverAdmin privateMessage " + id + " Admin warning " + value + "/" + value2 + ": " + warnReason.Value);
AdminChat("[EA] WARN " + value + "/" + value2 + " " + text + " (#" + id + "): " + warnReason.Value);
Tell("Warned " + text + " (" + Ordinal(value) + " warning).");
if (value >= value2)
{
Offer(id, text, value);
}
}
private static string Ordinal(int n)
{
int num = n % 100;
string text = ((num >= 11 && num <= 13) ? "th" : ((n % 10 == 1) ? "st" : ((n % 10 == 2) ? "nd" : ((n % 10 != 3) ? "th" : "rd"))));
return n + text;
}
private static void Offer(int id, string name, int n)
{
offerId = id;
offerName = name;
offerUntil = Time.unscaledTime + 30f;
offerWarn = false;
offerText = "<b>" + name + "</b> has had their <b>" + Ordinal(n) + "</b> warning. Slay or kick?";
offerReason = "Too many warnings: " + I.warnReason.Value;
AddAlert("<color=#ff6a5a><b>" + Ordinal(n) + " warning</b></color> " + name);
}
private static void OfferTk(int id, string name, int n)
{
offerId = id;
offerName = name;
offerUntil = Time.unscaledTime + 30f;
offerWarn = I.fWarn.Value;
offerText = "<b>" + name + "</b> has <b>" + n + "</b> teamkills tonight. Warn, slay or kick?";
offerReason = "Teamkilling (" + n + " teamkills)";
}
private void KickWarned(int id)
{
string text = NameOf(id);
warns.TryGetValue(text, out var value);
if (value < warnMax.Value)
{
Tell(text + " has " + value + " of " + warnMax.Value + " warnings. Warn first, or kick from the normal Kick button.");
return;
}
if (kickArmId != id || Time.unscaledTime > kickArmUntil)
{
kickArmId = id;
kickArmUntil = Time.unscaledTime + 5f;
Tell("Click Kick (warnings) again within 5 seconds to kick " + text + ".");
AddAlert("Click <b>Kick (warnings)</b> again to kick " + text);
return;
}
kickArmId = -1;
Rc("serverAdmin kick " + id + " " + value + " warnings: " + warnReason.Value);
AdminChat("[EA] KICKED " + text + " after " + value + " warnings");
Tell("Kicked " + text + ".");
}
private static void AdminChat(string text)
{
if (!I.shareWarns.Value)
{
return;
}
try
{
NetworkView localNetworkView = uLinkNetworkConnectionsCollection.LocalNetworkView;
BitStream val = localNetworkView.ObtainBitstreamForRPC();
SendChatMessagePacket.WriteBitStream(val, text, 12);
localNetworkView.SendRPCToServer("scm", val);
}
catch (Exception ex)
{
((BaseUnityPlugin)I).Logger.LogWarning((object)("admin chat: " + ex.Message));
}
}
private void WatchToggle(int id)
{
string name = NameOf(id);
List<string> list = Split(watchNames.Value).ToList();
if (list.Any((string x) => string.Equals(x, name, StringComparison.OrdinalIgnoreCase)))
{
list.RemoveAll((string x) => string.Equals(x, name, StringComparison.OrdinalIgnoreCase));
Tell("Stopped watching " + name + " in chat.");
}
else
{
list.Add(name);
Tell("Watching " + name + " in chat.");
}
watchNames.Value = string.Join(", ", list.ToArray());
}
private static void AddAlert(string text)
{
alerts.Insert(0, new Alert
{
Until = Time.unscaledTime + 25f,
Text = DateTime.Now.ToString("HH:mm") + " " + text
});
if (alerts.Count > 6)
{
alerts.RemoveAt(alerts.Count - 1);
}
}
private static string Clean(string s)
{
return Regex.Replace(s ?? "", "<[^>]*>", "");
}
private static void ChatPrefix(int playerID, ref string textEntry, TextChatEntryType entryType, TextChatChannel channel)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)I == (Object)null || !Admin || string.IsNullOrEmpty(textEntry))
{
return;
}
string text = Clean(textEntry);
if ((int)channel == 12 && text.Contains("[EA] WARN "))
{
Match match = Regex.Match(text, "\\[EA\\] WARN (\\d+)/(\\d+) (.+?) \\(#(\\d+)\\)");
if (match.Success && playerID != LocalId())
{
int num = int.Parse(match.Groups[1].Value);
string value = match.Groups[3].Value;
warns.TryGetValue(value, out var value2);
if (num > value2)
{
warns[value] = num;
SaveWarns();
}
if (num >= int.Parse(match.Groups[2].Value))
{
Offer(int.Parse(match.Groups[4].Value), value, num);
}
}
}
else
{
if (!I.fAlerts.Value || (int)entryType != 0 || playerID < 0 || playerID == LocalId())
{
return;
}
string sender = NameOf(playerID);
string input = text.ToLowerInvariant();
string text2 = null;
if (Split(I.watchNames.Value).Any((string w) => string.Equals(w, sender, StringComparison.OrdinalIgnoreCase)))
{
text2 = "watched";
}
if (text2 == null)
{
string[] array = Split(I.alertWords.Value);
foreach (string text3 in array)
{
if (Regex.IsMatch(input, "(^|\\W)" + Regex.Escape(text3.ToLowerInvariant()) + "($|\\W)"))
{
text2 = text3;
break;
}
}
}
if (text2 != null)
{
textEntry = "<mark=#ffcc3355><color=#ffe08a>" + textEntry + "</color></mark>";
AddAlert(string.Concat("<color=#ffcc33>", sender, "</color> (", channel, "): ", (text.Length <= 90) ? text : (text.Substring(0, 90) + "...")));
}
}
}
catch (Exception ex)
{
((BaseUnityPlugin)I).Logger.LogWarning((object)("chat alert: " + ex.Message));
}
}
private static int LocalId()
{
ClientComponentReferenceManager clientInstance = ClientComponentReferenceManager.ClientInstance;
return (!((Object)(object)clientInstance != (Object)null) || !((Object)(object)clientInstance.clientRoundPlayerManager != (Object)null) || clientInstance.clientRoundPlayerManager.LocalPlayer == null) ? (-2) : ((RoundPlayer)clientInstance.clientRoundPlayerManager.LocalPlayer).NetworkPlayerID;
}
private static void ScorePrefix(ClientRoundPlayer killer, ClientRoundPlayer victim, ScorableAction scorableAction)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Invalid comparison between Unknown and I4
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
ficTag = null;
try
{
if ((Object)(object)I == (Object)null || !Admin || killer == null || victim == null || killer == victim)
{
return;
}
PlayerKilledPlayerScorableAction val = (PlayerKilledPlayerScorableAction)(object)((scorableAction is PlayerKilledPlayerScorableAction) ? scorableAction : null);
if (val == null)
{
return;
}
bool flag = ((RoundPlayer)killer).PlayerStartData != null && ((RoundPlayer)victim).PlayerStartData != null && ((RoundPlayer)killer).PlayerStartData.Faction == ((RoundPlayer)victim).PlayerStartData.Faction;
if (val.TeamKill || flag)
{
if (I.fTk.Value)
{
TrackTk(killer, victim, val);
}
}
else
{
if (!I.fFic.Value || (int)val.KilledMethod != 1 || ((RoundPlayer)killer).PlayerStartData == null || ((RoundPlayer)victim).PlayerStartData == null || (Object)(object)((RoundPlayer)victim).PlayerTransform == (Object)null || (Object)(object)((RoundPlayer)killer).PlayerTransform == (Object)null)
{
return;
}
Vector3 position = ((RoundPlayer)victim).PlayerTransform.position;
float num = ((!(val.Distance > 0f)) ? Vector3.Distance(((RoundPlayer)killer).PlayerTransform.position, position) : val.Distance);
if (num < I.ficShooterMin.Value)
{
return;
}
ClientComponentReferenceManager clientInstance = ClientComponentReferenceManager.ClientInstance;
ClientRoundPlayerManager clientRoundPlayerManager = clientInstance.clientRoundPlayerManager;
FactionCountry faction = ((RoundPlayer)killer).PlayerStartData.Faction;
float value = I.ficMeleeRange.Value;
string text = null;
float num2 = value;
foreach (RoundPlayer item in clientRoundPlayerManager.roundPlayersList.Cast<RoundPlayer>().Concat((IEnumerable<RoundPlayer>)(object)new RoundPlayer[1] { (RoundPlayer)clientRoundPlayerManager.LocalPlayer }))
{
if (item != null && (object)item != killer && (object)item != victim && !((Object)(object)item.PlayerBase == (Object)null) && item.PlayerBase.SpawnedAndAlive && item.PlayerStartData != null && item.PlayerStartData.Faction == faction && !((Object)(object)item.PlayerTransform == (Object)null))
{
float num3 = Vector3.Distance(item.PlayerTransform.position, position);
if (num3 <= num2)
{
num2 = num3;
text = PName(item);
}
}
}
if (text != null)
{
string text2 = PName((RoundPlayer)(object)killer);
ficCount.TryGetValue(text2, out var value2);
ficCount[text2] = value2 + 1;
ficTag = " <color=#ff4a3d><b>[FIC?]</b></color>";
if (I.ficAlert.Value)
{
AddAlert("<color=#ff4a3d><b>FIC?</b></color> " + text2 + " shot " + PName((RoundPlayer)(object)victim) + " at " + num.ToString("0") + " m, " + text + " was " + num2.ToString("0.0") + " m from them (" + (value2 + 1) + " this round)");
}
}
}
}
catch (Exception ex)
{
((BaseUnityPlugin)I).Logger.LogWarning((object)("fic: " + ex.Message));
}
}
private static void TrackTk(ClientRoundPlayer killer, ClientRoundPlayer victim, PlayerKilledPlayerScorableAction a)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Invalid comparison between Unknown and I4
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Invalid comparison between Unknown and I4
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
if ((int)a.KilledMethod == 1 || (int)a.KilledMethod == 2 || I.tkArty.Value)
{
if ((I.tkStore.Value ?? "").Split('|')[0] != Today())
{
tks.Clear();
}
string text = PName((RoundPlayer)(object)killer);
tks.TryGetValue(text, out var value);
value++;
tks[text] = value;
SaveCounts(I.tkStore, tks);
ficTag = " <color=#ff9a3d><b>[TK " + value + "]</b></color>";
string text2 = (((int)a.KilledMethod == 1) ? "shot" : (((int)a.KilledMethod != 2) ? ((object)a.KilledMethod/*cast due to .constrained prefix*/).ToString() : "melee"));
if (I.tkAlert.Value)
{
AddAlert("<color=#ff9a3d><b>Teamkill</b></color> " + text + " killed " + PName((RoundPlayer)(object)victim) + " (" + text2 + ", " + Ordinal(value) + " tonight)");
}
if (value >= I.tkMax.Value)
{
OfferTk(((RoundPlayer)killer).NetworkPlayerID, text, value);
}
}
}
private static string PName(RoundPlayer p)
{
PlayerInitialDetails val = ((p.PlayerRoundInformation == null) ? null : p.PlayerRoundInformation.InitialDetails);
return (val == null) ? ("Player " + p.NetworkPlayerID) : ((!string.IsNullOrEmpty(val.DisplayName)) ? val.DisplayName : val.Name);
}
private static void KillLogPrefix(ref string killerName)
{
if (ficTag != null)
{
killerName += ficTag;
ficTag = null;
}
}
private void Patch()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
Harmony h = new Harmony("com.llstarlessll.easieradmin");
TryPatch(h, typeof(ClientChatHandler), "AddChatEntry", new Type[5]
{
typeof(int),
typeof(string),
typeof(TextChatEntryType),
typeof(TextChatChannel),
typeof(string)
}, "ChatPrefix");
TryPatch(h, typeof(ScoreLogUI), "DisplayScore", null, "ScorePrefix");
TryPatch(h, typeof(UIAdminPlayerKillLogPanel), "AddKillLog", null, "KillLogPrefix");
}
private void TryPatch(Harmony h, Type t, string method, Type[] args, string prefix)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
try
{
MethodInfo methodInfo = ((args == null) ? AccessTools.Method(t, method, (Type[])null, (Type[])null) : AccessTools.Method(t, method, args, (Type[])null));
h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(EasierAdminPlugin), prefix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not hook " + t.Name + "." + method + " (that feature is off): " + ex.Message));
}
}
private void Update()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!Admin)
{
return;
}
if (listening != null)
{
Listen();
}
else if (fHotkeys.Value && !Typing())
{
foreach (Hotkey hotkey in hotkeys)
{
KeyboardShortcut value = hotkey.Key.Value;
if ((int)((KeyboardShortcut)(ref value)).MainKey != 0)
{
KeyboardShortcut value2 = hotkey.Key.Value;
if (((KeyboardShortcut)(ref value2)).IsDown())
{
hotkey.Run();
break;
}
}
}
}
float time = Time.time;
if (pendingSet.Count > 0)
{
foreach (string item in pendingSet.Keys.ToList())
{
if (Time.unscaledTime >= pendingSet[item].Key)
{
Rc(pendingSet[item].Value);
pendingSet.Remove(item);
}
}
}
for (int num = scheduled.Count - 1; num >= 0; num--)
{
if (time >= scheduled[num].Key)
{
Rc(Split(scheduled[num].Value, ';'));
scheduled.RemoveAt(num);
}
}
if (time >= nextPoll)
{
nextPoll = time + 0.5f;
HashSet<int> hashSet = new HashSet<int>();
foreach (P item2 in Players())
{
if (item2.Alive && (includeBots.Value || !item2.Bot))
{
hashSet.Add(item2.Id);
}
}
if (keepGiving.Value)
{
foreach (int item3 in hashSet)
{
if (!wasAlive.Contains(item3))
{
pendingGive.Add(new KeyValuePair<float, int>(time + 1f, item3));
}
}
}
wasAlive.Clear();
foreach (int item4 in hashSet)
{
wasAlive.Add(item4);
}
}
for (int num2 = pendingGive.Count - 1; num2 >= 0; num2--)
{
if (time >= pendingGive[num2].Key)
{
Give(new int[1] { pendingGive[num2].Value }, new string[1] { pick.Value.ToString() });
pendingGive.RemoveAt(num2);
}
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("update: " + ex.Message));
}
}
private void OnGUI()
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Expected O, but got Unknown
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
if (!Admin)
{
return;
}
try
{
DrawAlerts();
}
catch
{
}
if (!teamCount.Value)
{
return;
}
try
{
if (Time.unscaledTime >= cacheAt)
{
cache = (from p in Players()
where p.Alive
select p).ToList();
cacheAt = Time.unscaledTime + 0.5f;
}
List<P> source = cache;
List<string> list = new List<string>();
foreach (IGrouping<FactionCountry, P> item in from p in source
group p by p.Faction)
{
list.Add(string.Concat("<b>", item.Key, ": ", item.Count(), "</b>"));
list.Add(" " + string.Join(", ", (from p in item
group p by p.Class into g
orderby g.Count() descending
select string.Concat(g.Key, " ", g.Count())).ToArray()));
string[] array = (from g in (from p in item
where p.Tag.Length > 0
group p by p.Tag into g
orderby g.Count() descending
select g).Take(4)
select g.Key + " " + g.Count()).ToArray();
if (array.Length > 0)
{
list.Add(" " + string.Join(", ", array));
}
}
GUIStyle val = new GUIStyle(GUI.skin.box);
val.alignment = (TextAnchor)0;
val.richText = true;
val.fontSize = 13;
val.wordWrap = true;
GUIStyle val2 = val;
GUI.Box(new Rect(10f, 120f, 360f, (float)(20 + 18 * list.Count)), "Team count\n" + string.Join("\n", list.ToArray()), val2);
}
catch
{
}
}
private void DrawAlerts()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Expected O, but got Unknown
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
float now = Time.unscaledTime;
alerts.RemoveAll((Alert a) => a.Until < now);
float num = 460f;
float num2 = (float)Screen.width - num - 14f;
float num3 = 70f;
GUIStyle val = new GUIStyle(GUI.skin.box);
val.alignment = (TextAnchor)0;
val.richText = true;
val.fontSize = 13;
val.wordWrap = true;
val.padding = new RectOffset(8, 8, 6, 6);
GUIStyle val2 = val;
if (offerId >= 0 && now < offerUntil)
{
GUI.Box(new Rect(num2, num3, num, 64f), offerText, val2);
float num4 = num2 + 8f;
float num5 = ((!offerWarn) ? 136 : 104);
if (offerWarn && GUI.Button(new Rect(num4, num3 + 32f, num5, 24f), "Warn"))
{
int id = offerId;
offerId = -1;
string value = warnReason.Value;
try
{
warnReason.Value = "Teamkilling";
Warn(id);
}
finally
{
warnReason.Value = value;
}
}
if (offerWarn)
{
num4 += num5 + 6f;
}
if (GUI.Button(new Rect(num4, num3 + 32f, num5, 24f), "Slay"))
{
Rc("serverAdmin slay " + offerId + " " + offerReason);
Tell("Slew " + offerName + ".");
offerId = -1;
}
num4 += num5 + 6f;
if (GUI.Button(new Rect(num4, num3 + 32f, num5, 24f), "Kick"))
{
Rc("serverAdmin kick " + offerId + " " + offerReason);
AdminChat("[EA] KICKED " + offerName + ": " + offerReason);
Tell("Kicked " + offerName + ".");
offerId = -1;
}
num4 += num5 + 6f;
if (GUI.Button(new Rect(num4, num3 + 32f, num5, 24f), "Dismiss"))
{
offerId = -1;
}
num3 += 72f;
}
else if (offerId >= 0)
{
offerId = -1;
}
if (alerts.Count != 0)
{
string text = string.Join("\n", alerts.Select((Alert a) => a.Text).ToArray());
float num6 = val2.CalcHeight(new GUIContent(text), num);
GUI.Box(new Rect(num2, num3, num, num6), text, val2);
}
}
static EasierAdminPlugin()
{
KeyCode[] array = new KeyCode[6];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
Mods = (KeyCode[])(object)array;
kickArmId = -1;
}
}