using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BestKillfeed.Services;
using BestKillfeed.Utils;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using Stunlock.Core;
using Stunlock.Network;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using VampireCommandFramework;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Irozer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Only the best of the best")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BestKillfeed")]
[assembly: AssemblyTitle("BestKillfeed")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BestKillfeed
{
public static class Core
{
public static World Server { get; } = GetWorld("Server") ?? throw new Exception("Server World not found. Did you install the mod on the server?");
public static EntityManager EntityManager => Server.EntityManager;
public static PrefabCollectionSystem PrefabCollection { get; } = Server.GetExistingSystemManaged<PrefabCollectionSystem>();
private static World GetWorld(string name)
{
Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current.Name == name)
{
return current;
}
}
return null;
}
public static void LogException(Exception e, [CallerMemberName] string caller = null)
{
Debug.LogError(Object.op_Implicit($"[BestKillfeed] Exception in {caller}: {e.Message}\n{e.StackTrace}"));
}
}
public static class KillfeedSettings
{
private static ConfigFile config;
public static ConfigEntry<bool> EnableBountySystem;
public static ConfigEntry<int> BountyStreakThreshold;
public static ConfigEntry<string> KillerNameColor;
public static ConfigEntry<string> VictimNameColor;
public static ConfigEntry<string> ClanTagColor;
public static ConfigEntry<string> AllowedLevelColor;
public static ConfigEntry<string> ForbiddenLevelColor;
public static ConfigEntry<string> KillMessageFormat;
public static ConfigEntry<int> MaxLevelGapNormal;
public static ConfigEntry<int> MaxLevelGapHigh;
public static void Init(string configPath)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
config = new ConfigFile(Path.Combine(configPath, "killfeed.cfg"), true);
EnableBountySystem = config.Bind<bool>("Bounty", "EnableBountySystem", true, "Enable or disable the bounty system.");
BountyStreakThreshold = config.Bind<int>("Bounty", "BountyStreakThreshold", 5, "Kill streak required to place a bounty.");
KillerNameColor = config.Bind<string>("Colors", "KillerNameColor", "#ffffff", "Color of the killer's name.");
VictimNameColor = config.Bind<string>("Colors", "VictimNameColor", "#ffffff", "Color of the victim's name.");
ClanTagColor = config.Bind<string>("Colors", "ClanTagColor", "#888888", "Color of the clan tags.");
AllowedLevelColor = config.Bind<string>("Colors", "AllowedLevelColor", "#55ff55", "Color for allowed kills (fair level difference).");
ForbiddenLevelColor = config.Bind<string>("Colors", "ForbiddenLevelColor", "#ff5555", "Color for forbidden kills (too high level difference).");
KillMessageFormat = config.Bind<string>("Message", "KillMessageFormat", "<color={ClanTagColor}>[{KillerClan}]</color><color={KillerNameColor}>{Killer}</color>[<color={LevelColor}>{KillerLevel}</color>] killed <color={ClanTagColor}>[{VictimClan}]</color><color={VictimNameColor}>{Victim}</color>[<color={LevelColor}>{VictimLevel}</color>]", "Killfeed message format. Available placeholders: {Killer}, {Victim}, {KillerClan}, {VictimClan}, {KillerLevel}, {VictimLevel}, {LevelColor}, {KillerNameColor}, {VictimNameColor}, {ClanTagColor}");
MaxLevelGapNormal = config.Bind<int>("Restrictions", "MaxLevelGapNormal", 15, "Maximum level difference allowed for fair kills when killer is below level 91.");
MaxLevelGapHigh = config.Bind<int>("Restrictions", "MaxLevelGapHigh", 10, "Maximum level difference allowed for fair kills when killer is level 91 or higher.");
}
}
[BepInPlugin("com.tonpseudo.bestkillfeed", "BestKillfeed", "1.0.0")]
public class Plugin : BasePlugin
{
private Harmony _harmony;
public static ManualLogSource Logger;
public static Plugin Instance { get; private set; }
public override void Load()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
string text = Path.Combine(Paths.ConfigPath, "Bestkillfeed");
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
Instance = this;
Logger = ((BasePlugin)this).Log;
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("aa.BestKillfeed");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loading...");
}
log.LogInfo(val);
((BasePlugin)this).Log.LogInfo((object)"BestKillfeed chargé.");
CommandRegistry.RegisterAll();
KillfeedSettings.Init(text);
_harmony = new Harmony("com.tonpseudo.bestkillfeed");
_harmony.PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "aa.BestKillfeed";
public const string PLUGIN_NAME = "BestKillfeed";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BestKillfeed.Utils
{
public static class KillCache
{
private static readonly Dictionary<Entity, Entity> DownedBy = new Dictionary<Entity, Entity>();
public static void SetDowner(Entity victim, Entity killer)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
DownedBy[victim] = killer;
}
public static Entity? GetDowner(Entity victim)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (!DownedBy.TryGetValue(victim, out var value))
{
return null;
}
return value;
}
public static void Clear(Entity victim)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
DownedBy.Remove(victim);
}
}
public static class VWorld
{
public static World Server
{
get
{
Enumerator<World> enumerator = World.All.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current.Name == "Server")
{
return current;
}
}
return null;
}
}
public static EntityManager ServerEntityManager => Server.EntityManager;
}
}
namespace BestKillfeed.Services
{
public class BountyService
{
private static BountyService _instance;
private readonly Dictionary<Entity, Entity> _bountyIcons = new Dictionary<Entity, Entity>();
private readonly HashSet<string> activeBounties = new HashSet<string>();
private static Entity mapIconProxyPrefab;
public static PrefabGUID mapIconPrefab = new PrefabGUID(-1060998155);
public static EntityQuery mapIconProxyQuery;
public static BountyService Instance => _instance ?? (_instance = new BountyService());
public bool HasBounty(string playerName)
{
return activeBounties.Contains(playerName);
}
public static void AddIcon(Entity targetPlayerEntity)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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_00f7: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
if (!Core.PrefabCollection._PrefabGuidToEntityMap.TryGetValue(mapIconPrefab, ref mapIconProxyPrefab))
{
Plugin.Logger.LogError((object)"Failed to find MapIcon_ProxyObject_POI_Unknown Prefab entity");
return;
}
EntityManager entityManager = Core.EntityManager;
Entity val = ((EntityManager)(ref entityManager)).Instantiate(mapIconProxyPrefab);
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).AddComponent<MapIconTargetEntity>(val);
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).AddBuffer<AttachMapIconsToEntity>(val);
entityManager = Core.EntityManager;
NetworkId componentData = ((EntityManager)(ref entityManager)).GetComponentData<NetworkId>(targetPlayerEntity);
MapIconTargetEntity val2 = default(MapIconTargetEntity);
val2.TargetEntity = NetworkedEntity.op_Implicit(targetPlayerEntity);
val2.TargetNetworkId = componentData;
MapIconTargetEntity val3 = val2;
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<MapIconTargetEntity>(val, val3);
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent<SyncToUserBitMask>(val);
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent<SyncToUserBuffer>(val);
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent<OnlySyncToUsersTag>(val);
entityManager = Core.EntityManager;
DynamicBuffer<AttachMapIconsToEntity> buffer = ((EntityManager)(ref entityManager)).GetBuffer<AttachMapIconsToEntity>(val, false);
buffer.Clear();
buffer.Add(new AttachMapIconsToEntity
{
Prefab = mapIconPrefab
});
Instance._bountyIcons[targetPlayerEntity] = val;
}
public static void RemoveIcon(Entity targetPlayerEntity)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (Instance._bountyIcons.TryGetValue(targetPlayerEntity, out var value))
{
EntityManager entityManager = Core.EntityManager;
if (((EntityManager)(ref entityManager)).Exists(value))
{
entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(value);
}
Instance._bountyIcons.Remove(targetPlayerEntity);
}
}
public void RestoreBountyIconIfNeeded(string playerName, Entity playerEntity)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
if (HasBounty(playerName))
{
AddIcon(playerEntity);
Debug.Log(Object.op_Implicit("[BestKillfeed] Icon restored for " + playerName));
}
}
public void PlaceBounty(string playerName)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if (!activeBounties.Contains(playerName))
{
activeBounties.Add(playerName);
FixedString512Bytes val = FixedString512Bytes.op_Implicit("<color=#ff5555>A bounty has been placed on " + playerName + " for a 5 killstreak!</color>");
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, ref val);
Debug.Log(Object.op_Implicit("[BestKillfeed] Bounty placed on " + playerName));
}
}
public void RemoveBounty(string playerName)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (activeBounties.Remove(playerName))
{
FixedString512Bytes val = FixedString512Bytes.op_Implicit("<color=#ffaa55>The bounty on " + playerName + " has been lifted!</color>");
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, ref val);
Debug.Log(Object.op_Implicit("[BestKillfeed] Bounty removed from " + playerName));
}
}
}
public class LevelService
{
public static LevelService Instance = new LevelService();
private static readonly string ConfigPath = Path.Combine(Paths.ConfigPath, "Bestkillfeed");
private static readonly string MaxLevelsPath = Path.Combine(ConfigPath, "MaxLevels.json");
internal Dictionary<string, int> maxPlayerLevels = new Dictionary<string, int>();
public LevelService()
{
Load();
}
public int GetMaxLevel(string playerName)
{
if (!maxPlayerLevels.TryGetValue(playerName, out var value))
{
return 0;
}
return value;
}
public void UpdatePlayerLevel(Entity userEntity)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = Core.Server.EntityManager;
if (!((EntityManager)(ref entityManager)).HasComponent<User>(userEntity))
{
return;
}
User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
Entity entity = componentData.LocalCharacter._Entity;
if (((EntityManager)(ref entityManager)).HasComponent<Equipment>(entity))
{
Equipment componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(entity);
int num = Mathf.RoundToInt(ModifiableFloat.op_Implicit(componentData2.ArmorLevel) + ModifiableFloat.op_Implicit(componentData2.SpellLevel) + ModifiableFloat.op_Implicit(componentData2.WeaponLevel));
string text = ((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString();
if (!maxPlayerLevels.TryGetValue(text, out var value) || num > value)
{
maxPlayerLevels[text] = num;
Save();
Debug.Log(Object.op_Implicit($"[BestKillfeed] New max level detected for {text}: {num}"));
}
}
}
private void Load()
{
if (!File.Exists(MaxLevelsPath))
{
return;
}
try
{
string json = File.ReadAllText(MaxLevelsPath);
maxPlayerLevels = JsonSerializer.Deserialize<Dictionary<string, int>>(json) ?? new Dictionary<string, int>();
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[LevelService] Failed to load max levels: {value}"));
}
}
internal void Save()
{
try
{
if (!Directory.Exists(ConfigPath))
{
Directory.CreateDirectory(ConfigPath);
}
string contents = JsonSerializer.Serialize(maxPlayerLevels, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(MaxLevelsPath, contents);
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[LevelService] Failed to save max levels: {value}"));
}
}
public bool HasEntry(string playerName)
{
return maxPlayerLevels.ContainsKey(playerName);
}
public void InitPlayerLevel(string playerName)
{
if (maxPlayerLevels.Count == 0)
{
Load();
}
if (!maxPlayerLevels.ContainsKey(playerName))
{
maxPlayerLevels[playerName] = 0;
Save();
}
}
}
public class StatsService
{
private static readonly string ConfigPath = Path.Combine(Paths.ConfigPath, "Bestkillfeed");
private static readonly string PlayerStatsPath = Path.Combine(ConfigPath, "PlayerStats.json");
private Dictionary<string, PlayerStats> playerStats = new Dictionary<string, PlayerStats>();
private static StatsService _instance;
public static StatsService Instance => _instance ?? (_instance = new StatsService());
private StatsService()
{
Load();
}
public void IncrementKill(string playerName, Entity playerEntity)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if (!string.IsNullOrWhiteSpace(playerName))
{
if (!this.playerStats.ContainsKey(playerName))
{
this.playerStats[playerName] = new PlayerStats();
}
PlayerStats playerStats = this.playerStats[playerName];
playerStats.Kills++;
playerStats.CurrentStreak++;
if (playerStats.CurrentStreak > playerStats.MaxStreak)
{
playerStats.MaxStreak = playerStats.CurrentStreak;
}
if (KillfeedSettings.EnableBountySystem.Value && playerStats.CurrentStreak == KillfeedSettings.BountyStreakThreshold.Value && !BountyService.Instance.HasBounty(playerName))
{
BountyService.Instance.PlaceBounty(playerName);
BountyService.AddIcon(playerEntity);
}
Save();
}
}
public void IncrementDeath(string playerName, Entity playerEntity)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
if (!string.IsNullOrWhiteSpace(playerName))
{
if (!playerStats.ContainsKey(playerName))
{
playerStats[playerName] = new PlayerStats();
}
PlayerStats obj = playerStats[playerName];
obj.Deaths++;
obj.CurrentStreak = 0;
if (BountyService.Instance.HasBounty(playerName))
{
BountyService.Instance.RemoveBounty(playerName);
BountyService.RemoveIcon(playerEntity);
}
Save();
}
}
public PlayerStats GetStats(string playerName)
{
if (!playerStats.TryGetValue(playerName, out var value))
{
return new PlayerStats();
}
return value;
}
public Dictionary<string, PlayerStats> GetAllStats()
{
return playerStats;
}
private void Load()
{
try
{
if (!File.Exists(PlayerStatsPath))
{
playerStats = new Dictionary<string, PlayerStats>();
return;
}
string json = File.ReadAllText(PlayerStatsPath);
playerStats = JsonSerializer.Deserialize<Dictionary<string, PlayerStats>>(json) ?? new Dictionary<string, PlayerStats>();
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[StatsService] Failed to load stats: {value}"));
playerStats = new Dictionary<string, PlayerStats>();
}
}
private void Save()
{
try
{
string contents = JsonSerializer.Serialize(playerStats, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(PlayerStatsPath, contents);
}
catch (Exception value)
{
Debug.LogError(Object.op_Implicit($"[StatsService] Failed to save stats: {value}"));
}
}
}
public class PlayerStats
{
public int Kills { get; set; }
public int Deaths { get; set; }
public int CurrentStreak { get; set; }
public int MaxStreak { get; set; }
}
}
namespace BestKillfeed.Patches
{
[HarmonyPatch(typeof(DeathEventListenerSystem), "OnUpdate")]
public static class KillfeedPatch
{
public static void Postfix(DeathEventListenerSystem __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = Core.Server.EntityManager;
EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<DeathEvent>() });
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (!((EntityManager)(ref entityManager)).HasComponent<DeathEvent>(current))
{
continue;
}
DeathEvent componentData = ((EntityManager)(ref entityManager)).GetComponentData<DeathEvent>(current);
Entity died = componentData.Died;
Entity val3 = (Entity)(((??)KillCache.GetDowner(died)) ?? componentData.Killer);
KillCache.Clear(died);
if (!((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(died) || !((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(val3))
{
continue;
}
Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(died).UserEntity;
Entity userEntity2 = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(val3).UserEntity;
if (((EntityManager)(ref entityManager)).HasComponent<User>(userEntity) && ((EntityManager)(ref entityManager)).HasComponent<User>(userEntity2))
{
User componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
User componentData3 = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity2);
string text = ((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString();
string text2 = ((object)(FixedString64Bytes)(ref componentData3.CharacterName)).ToString();
if (!string.IsNullOrWhiteSpace(text) && !string.IsNullOrWhiteSpace(text2) && !(text == text2))
{
LevelService.Instance.UpdatePlayerLevel(userEntity2);
LevelService.Instance.UpdatePlayerLevel(userEntity);
StatsService.Instance.IncrementKill(text2, val3);
StatsService.Instance.IncrementDeath(text, died);
int maxLevel = LevelService.Instance.GetMaxLevel(text2);
int maxLevel2 = LevelService.Instance.GetMaxLevel(text);
string newValue = TruncateClan(GetClanName(entityManager, componentData3));
string newValue2 = TruncateClan(GetClanName(entityManager, componentData2));
bool num = IsKillAllowed(maxLevel, maxLevel2);
_ = KillfeedSettings.AllowedLevelColor.Value;
string newValue3 = (num ? KillfeedSettings.AllowedLevelColor.Value : KillfeedSettings.ForbiddenLevelColor.Value);
string value = KillfeedSettings.KillerNameColor.Value;
string value2 = KillfeedSettings.VictimNameColor.Value;
string value3 = KillfeedSettings.ClanTagColor.Value;
FixedString512Bytes val4 = FixedString512Bytes.op_Implicit(KillfeedSettings.KillMessageFormat.Value.Replace("{Killer}", text2).Replace("{Victim}", text).Replace("{KillerClan}", newValue)
.Replace("{VictimClan}", newValue2)
.Replace("{KillerLevel}", maxLevel.ToString())
.Replace("{VictimLevel}", maxLevel2.ToString())
.Replace("{LevelColor}", newValue3)
.Replace("{KillerNameColor}", value)
.Replace("{VictimNameColor}", value2)
.Replace("{ClanTagColor}", value3));
ServerChatUtils.SendSystemMessageToAllClients(entityManager, ref val4);
}
}
}
val2.Dispose();
}
private static string GetClanName(EntityManager entityManager, User user)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Entity entity = user.ClanEntity._Entity;
if (entity != Entity.Null && ((EntityManager)(ref entityManager)).HasComponent<ClanTeam>(entity))
{
ClanTeam componentData = ((EntityManager)(ref entityManager)).GetComponentData<ClanTeam>(entity);
return ((object)(FixedString64Bytes)(ref componentData.Name)).ToString();
}
return "-";
}
private static string TruncateClan(string name)
{
if (!string.IsNullOrEmpty(name))
{
if (name.Length > 3)
{
return name.Substring(0, 3).ToUpper();
}
return name;
}
return "---";
}
private static bool IsKillAllowed(int killerLevel, int victimLevel)
{
int num = killerLevel - victimLevel;
if (killerLevel >= 91)
{
return num <= KillfeedSettings.MaxLevelGapHigh.Value;
}
return num <= KillfeedSettings.MaxLevelGapNormal.Value;
}
}
[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserConnected")]
public static class PlayerConnectPatch
{
public static void Postfix(ServerBootstrapSystem __instance, NetConnectionId netConnectionId)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
try
{
EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
int num = default(int);
if (!__instance._NetEndPointToApprovedUserIndex.TryGetValue(netConnectionId, ref num))
{
return;
}
Il2CppReferenceArray<ServerClient> approvedUsersLookup = __instance._ApprovedUsersLookup;
if (num < 0 || num >= ((Il2CppArrayBase<ServerClient>)(object)approvedUsersLookup).Length)
{
return;
}
Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)approvedUsersLookup)[num].UserEntity;
if (((EntityManager)(ref entityManager)).HasComponent<User>(userEntity))
{
User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
string text = ((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString();
if (!string.IsNullOrWhiteSpace(text))
{
LevelService.Instance.UpdatePlayerLevel(userEntity);
Debug.Log(Object.op_Implicit("[BestKillfeed] Player " + text + " connected. Level updated."));
}
}
}
catch (Exception ex)
{
Debug.LogError(Object.op_Implicit("[BestKillfeed] Error during OnUserConnected: " + ex.Message + "\n" + ex.StackTrace));
}
}
}
[HarmonyPatch(typeof(Destroy_TravelBuffSystem), "OnUpdate")]
public class PlayerCreationPatch
{
public static void Postfix(Destroy_TravelBuffSystem __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = ((ComponentSystemBase)__instance).EntityManager;
EntityQuery _query_615927226_ = __instance.__query_615927226_0;
NativeArray<Entity> val = ((EntityQuery)(ref _query_615927226_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Enumerator<Entity> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current);
if (((PrefabGUID)(ref componentData)).GuidHash != 722466953)
{
continue;
}
Entity owner = ((EntityManager)(ref entityManager)).GetComponentData<EntityOwner>(current).Owner;
if (!((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(owner))
{
continue;
}
Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(owner).UserEntity;
if (((EntityManager)(ref entityManager)).HasComponent<User>(userEntity))
{
User componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
string text = ((object)(FixedString64Bytes)(ref componentData2.CharacterName)).ToString();
if (!string.IsNullOrWhiteSpace(text))
{
LevelService.Instance.InitPlayerLevel(text);
Debug.Log(Object.op_Implicit("[BestKillfeed] New player detected: " + text + ". Level initialized to 0."));
}
}
}
val.Dispose();
}
}
[HarmonyPatch(typeof(VampireDownedServerEventSystem), "OnUpdate")]
public static class VampireDownedPatch
{
public static void Prefix(VampireDownedServerEventSystem __instance)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = Core.Server.EntityManager;
EntityQuery _query_1174204813_ = __instance.__query_1174204813_0;
NativeArray<Entity> val = ((EntityQuery)(ref _query_1174204813_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Enumerator<Entity> enumerator = val.GetEnumerator();
Entity val2 = default(Entity);
Entity val3 = default(Entity);
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (VampireDownedServerEventSystem.TryFindRootOwner(current, 1, entityManager, ref val2) && VampireDownedServerEventSystem.TryFindRootOwner(((EntityManager)(ref entityManager)).GetComponentData<VampireDownedBuff>(current).Source, 1, entityManager, ref val3) && ((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(val2) && ((EntityManager)(ref entityManager)).HasComponent<PlayerCharacter>(val3))
{
Entity userEntity = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(val2).UserEntity;
Entity userEntity2 = ((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(val3).UserEntity;
if (((EntityManager)(ref entityManager)).HasComponent<User>(userEntity) && ((EntityManager)(ref entityManager)).HasComponent<User>(userEntity2))
{
User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity);
((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString();
componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity2);
((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString();
KillCache.SetDowner(val2, val3);
}
}
}
val.Dispose();
}
}
}
namespace BestKillfeed.Commands
{
internal class LeaderboardCommand
{
[Command("leaderboard", "lb", null, "Displays the player leaderboard by kills", null, false)]
public static void HandleCommand(ChatCommandContext ctx, string arg = null)
{
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
int num = 10;
int value = 1;
if (!string.IsNullOrWhiteSpace(arg) && int.TryParse(arg, out var result))
{
value = result;
}
List<KeyValuePair<string, PlayerStats>> list = (from kv in StatsService.Instance.GetAllStats()
orderby kv.Value.Kills descending
select kv).ToList();
int num2 = (int)Math.Ceiling((double)list.Count / (double)num);
value = Math.Clamp(value, 1, num2);
string text = $"<color=#ffaa00>--- Leaderboard (Page {value}/{num2}) ---</color>";
ctx.Reply(text);
int num3 = (value - 1) * num;
for (int i = num3; i < Math.Min(num3 + num, list.Count); i++)
{
string key = list[i].Key;
PlayerStats value2 = list[i].Value;
string value3 = key;
int value4 = i + 1;
string text2 = $"<color=#aaaaaa>#{value4}</color> <color=#ffffff>{value3}</color> - Kills: <color=#55ff55>{value2.Kills}</color> / Deaths: <color=#ff5555>{value2.Deaths}</color> / Max Streak: <color=#55aaff>{value2.MaxStreak}</color>";
ctx.Reply(text2);
}
User user = ctx.Event.User;
string playerName = ((object)(FixedString64Bytes)(ref user.CharacterName)).ToString();
PlayerStats stats = StatsService.Instance.GetStats(playerName);
int num4 = list.FindIndex((KeyValuePair<string, PlayerStats> kv) => kv.Key == playerName) + 1;
if (num4 > 0)
{
string text3 = $"<color=#ffaa00>#{num4}</color> <color=#ffffff>{playerName}</color> - Kills: <color=#55ff55>{stats.Kills}</color> / Deaths: <color=#ff5555>{stats.Deaths}</color> / Current Streak: <color=#ff5555>{stats.CurrentStreak}</color> / Max Streak: <color=#55aaff>{stats.MaxStreak}</color>";
ctx.Reply(text3);
}
}
}
internal class PlayerInfo
{
public static class PlayerInfoCommand
{
[Command("playerinfo", "pi", null, "Displays information about a player.", null, false)]
public static void HandleCommand(ChatCommandContext ctx, string arg)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_003b: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: 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_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: 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_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
LevelService instance = LevelService.Instance;
World serverWorld = GetServerWorld();
if (serverWorld == null)
{
ctx.Reply("Server world is not available.");
return;
}
EntityManager entityManager = serverWorld.EntityManager;
EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<PlayerCharacter>() });
NativeArray<Entity> val3 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Entity val4 = Entity.Null;
User val5 = default(User);
bool flag = false;
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(current);
bool num = ((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString().ToLower().Contains(arg.ToLower());
bool flag2 = componentData.PlatformId.ToString() == arg;
if (!(num || flag2))
{
continue;
}
val4 = current;
val5 = componentData;
Enumerator<Entity> enumerator2 = val3.GetEnumerator();
while (enumerator2.MoveNext())
{
Entity current2 = enumerator2.Current;
if (((EntityManager)(ref entityManager)).GetComponentData<PlayerCharacter>(current2).UserEntity == current)
{
flag = true;
break;
}
}
instance.UpdatePlayerLevel(current);
break;
}
if (val4 == Entity.Null)
{
ctx.Reply("No player found.");
val2.Dispose();
val3.Dispose();
return;
}
string value = "No clan";
Entity entity = val5.ClanEntity._Entity;
List<string> list = new List<string>();
if (entity != Entity.Null && ((EntityManager)(ref entityManager)).HasComponent<ClanTeam>(entity))
{
ClanTeam componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<ClanTeam>(entity);
value = ((object)(FixedString64Bytes)(ref componentData2.Name)).ToString();
if (((EntityManager)(ref entityManager)).HasComponent<SyncToUserBuffer>(entity))
{
Enumerator<SyncToUserBuffer> enumerator3 = ((EntityManager)(ref entityManager)).GetBuffer<SyncToUserBuffer>(entity, false).GetEnumerator();
while (enumerator3.MoveNext())
{
SyncToUserBuffer current3 = enumerator3.Current;
if (((EntityManager)(ref entityManager)).Exists(current3.UserEntity) && ((EntityManager)(ref entityManager)).HasComponent<User>(current3.UserEntity))
{
User componentData3 = ((EntityManager)(ref entityManager)).GetComponentData<User>(current3.UserEntity);
instance.UpdatePlayerLevel(current3.UserEntity);
string value2 = (componentData3.IsConnected ? "#00FF00" : "#FF0000");
int maxLevel = instance.GetMaxLevel(((object)(FixedString64Bytes)(ref componentData3.CharacterName)).ToString());
list.Add($"<color={value2}>{componentData3.CharacterName} [{maxLevel}]</color>");
}
}
}
}
int maxLevel2 = instance.GetMaxLevel(((object)(FixedString64Bytes)(ref val5.CharacterName)).ToString());
string value3 = (flag ? "#00FF00" : "#FF0000");
string value4 = $"<color={value3}>{val5.CharacterName} [{maxLevel2}]</color>";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine();
stringBuilder.AppendLine("--- <color=#FFD700>Player Info</color> ---");
StringBuilder stringBuilder2 = stringBuilder;
StringBuilder stringBuilder3 = stringBuilder2;
StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(29, 1, stringBuilder2);
handler.AppendLiteral("<color=#FFFF00>Name:</color> ");
handler.AppendFormatted(value4);
stringBuilder3.AppendLine(ref handler);
stringBuilder2 = stringBuilder;
StringBuilder stringBuilder4 = stringBuilder2;
handler = new StringBuilder.AppendInterpolatedStringHandler(52, 1, stringBuilder2);
handler.AppendLiteral("<color=#FFFF00>Clan:</color> <color=#FFFFFF>");
handler.AppendFormatted(value);
handler.AppendLiteral("</color>");
stringBuilder4.AppendLine(ref handler);
if (list.Count > 0)
{
string value5 = string.Join(" - ", list);
stringBuilder2 = stringBuilder;
StringBuilder stringBuilder5 = stringBuilder2;
handler = new StringBuilder.AppendInterpolatedStringHandler(37, 1, stringBuilder2);
handler.AppendLiteral("<color=#FFFF00>Clan Members:</color> ");
handler.AppendFormatted(value5);
stringBuilder5.AppendLine(ref handler);
}
ctx.Reply(stringBuilder.ToString());
val2.Dispose();
val3.Dispose();
}
private static World? GetServerWorld()
{
Enumerator<World> enumerator = World.All.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current.Name == "Server")
{
return current;
}
}
return null;
}
}
}
}