using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using FinishZone.Services;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.Physics;
using ProjectM.Scripting;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("FinishZone")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Server-side V Rising mod for creating customizable finish zones and manually giving reward sets to players.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FinishZone")]
[assembly: AssemblyTitle("FinishZone")]
[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 FinishZone
{
internal static class Core
{
private static bool _hasInitialized;
private static World _server;
private static EntityManager _entityManager;
private static ServerScriptMapper _serverScriptMapper;
private static MonoBehaviour _monoBehaviour;
public static World Server
{
get
{
object obj = _server;
if (obj == null)
{
obj = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");
_server = (World)obj;
}
return (World)obj;
}
}
public static EntityManager EntityManager => (!(_entityManager == default(EntityManager))) ? _entityManager : (_entityManager = Server.EntityManager);
public static ServerScriptMapper ServerScriptMapper => _serverScriptMapper ?? (_serverScriptMapper = Server.GetExistingSystemManaged<ServerScriptMapper>());
public static ServerGameManager ServerGameManager => ServerScriptMapper.GetServerGameManager();
public static ManualLogSource Log => Plugin.PluginLog;
public static FinishzoneService FinishzonesService { get; private set; }
public static void LogException(Exception e, [CallerMemberName] string caller = null)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ManualLogSource log = Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 5, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failure in ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(caller);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nMessage: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Inner:");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.Message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n\nStack: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nInner Stack: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.StackTrace);
}
log.LogError(val);
}
internal static void InitializeAfterLoaded()
{
//IL_0032: 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)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
if (!_hasInitialized)
{
_server = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");
_entityManager = _server.EntityManager;
_serverScriptMapper = _server.GetExistingSystemManaged<ServerScriptMapper>();
FinishzonesService = new FinishzoneService();
FinishzonesService.Initialize();
RewardsService.Initialize();
_hasInitialized = true;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("InitializeAfterLoaded");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" completed");
}
log.LogInfo(val);
}
}
internal static World GetWorld(string name)
{
Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current != null && current.Name == name)
{
return current;
}
}
return null;
}
public static Coroutine StartCoroutine(IEnumerator routine)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if ((Object)(object)_monoBehaviour == (Object)null)
{
GameObject val = new GameObject("FinishZone");
_monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>();
Object.DontDestroyOnLoad((Object)(object)val);
}
return _monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
}
public static void StopCoroutine(Coroutine coroutine)
{
if (!((Object)(object)_monoBehaviour == (Object)null))
{
_monoBehaviour.StopCoroutine(coroutine);
}
}
}
public static class ECSExtensions
{
public delegate void ActionRef<T>(ref T item);
public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct
{
//IL_0037: 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_0040: 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_0042: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
byte[] array = StructureToByteArray(componentData);
int num = Marshal.SizeOf<T>();
fixed (byte* ptr = array)
{
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num);
}
}
public static void With<T>(this Entity entity, ActionRef<T> action) where T : struct
{
//IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references)
T item = entity.ReadRW<T>();
action(ref item);
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
}
public unsafe static T ReadRW<T>(this Entity entity) where T : struct
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0017: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
void* componentDataRawRW = ((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, val.TypeIndex);
return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRW));
}
public static byte[] StructureToByteArray<T>(T structure) where T : struct
{
int num = Marshal.SizeOf(structure);
byte[] array = new byte[num];
IntPtr intPtr = Marshal.AllocHGlobal(num);
Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true);
Marshal.Copy(intPtr, array, 0, num);
Marshal.FreeHGlobal(intPtr);
return array;
}
public unsafe static T Read<T>(this Entity entity) where T : struct
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0017: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex);
return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO));
}
public static bool Has<T>(this Entity entity)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0017: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
return ((EntityManager)(ref entityManager)).HasComponent(entity, val);
}
public static string LookupName(this PrefabGUID prefabGuid)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_002a: 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_0032: Unknown result type (might be due to invalid IL or missing references)
PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>();
NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = existingSystemManaged._PrefabLookupMap.GuidToEntityMap;
object result;
if (!guidToEntityMap.ContainsKey(prefabGuid))
{
result = "GUID Not Found";
}
else
{
PrefabLookupMap prefabLookupMap = existingSystemManaged._PrefabLookupMap;
result = ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid) + " PrefabGuid(" + ((PrefabGUID)(ref prefabGuid)).GuidHash + ")";
}
return (string)result;
}
public static void Add<T>(this Entity entity)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0017: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).AddComponent(entity, val);
}
public static void Remove<T>(this Entity entity)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0017: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent(entity, val);
}
}
internal static class Helper
{
public static Entity AddItemToInventory(Entity recipient, PrefabGUID guid, int amount)
{
//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_0014: 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_0017: 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_001d: 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_0039: 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_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)
try
{
ServerGameManager serverGameManager = Core.Server.GetExistingSystemManaged<ServerScriptMapper>()._ServerGameManager;
AddItemResponse val = ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(recipient, guid, amount);
return val.NewEntity;
}
catch (Exception e)
{
Core.LogException(e, "AddItemToInventory");
}
return default(Entity);
}
public static PrefabGUID GetPrefabGUID(Entity entity)
{
//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_000a: 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_0010: 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_0022: 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)
EntityManager entityManager = Core.EntityManager;
PrefabGUID componentData = default(PrefabGUID);
try
{
componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity);
return componentData;
}
catch
{
((PrefabGUID)(ref componentData))..ctor(0);
}
return componentData;
}
public static NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
{
//IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_001a: 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_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_002e: 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_0031: 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_004d: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_006b: 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_0071: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_003a: 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_0041: 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)
EntityQueryOptions val = (EntityQueryOptions)0;
if (includeAll)
{
val = (EntityQueryOptions)(val | 0xC3);
}
if (includeDisabled)
{
val = (EntityQueryOptions)(val | 2);
}
if (includeSpawn)
{
val = (EntityQueryOptions)(val | 0x40);
}
if (includePrefab)
{
val = (EntityQueryOptions)(val | 1);
}
if (includeDestroyed)
{
val = (EntityQueryOptions)(val | 0x80);
}
EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0));
EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions(val);
EntityManager entityManager = Core.EntityManager;
EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3);
return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
}
public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
{
//IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_001a: 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_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_002e: 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_0031: 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_004d: 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_0061: 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_0070: 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_0079: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_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_009e: 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_0040: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
EntityQueryOptions val = (EntityQueryOptions)0;
if (includeAll)
{
val = (EntityQueryOptions)(val | 0xC3);
}
if (includeDisabled)
{
val = (EntityQueryOptions)(val | 2);
}
if (includeSpawn)
{
val = (EntityQueryOptions)(val | 0x40);
}
if (includePrefab)
{
val = (EntityQueryOptions)(val | 1);
}
if (includeDestroyed)
{
val = (EntityQueryOptions)(val | 0x80);
}
EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0));
val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0));
EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions(val);
EntityManager entityManager = Core.EntityManager;
EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3);
return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
}
public static Entity GetCharacterFromUser(User user)
{
//IL_0013: 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_0009: 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_001b: Unknown result type (might be due to invalid IL or missing references)
try
{
return ((NetworkedEntity)(ref user.LocalCharacter)).GetEntityOnServer();
}
catch
{
return Entity.Null;
}
}
public static string ReadUserName(User user, Entity userEntity)
{
//IL_0067: 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)
try
{
string text = ((object)(FixedString64Bytes)(ref user.CharacterName)).ToString();
return string.IsNullOrWhiteSpace(text) ? $"User#{userEntity.Index}" : text;
}
catch
{
return $"User#{userEntity.Index}";
}
}
public static void NotifyUser(EntityManager em, Entity userEntity, string message)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_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)
//IL_003d: 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)
try
{
if (!(userEntity == Entity.Null) && ((EntityManager)(ref em)).Exists(userEntity))
{
User componentData = ((EntityManager)(ref em)).GetComponentData<User>(userEntity);
FixedString512Bytes val = default(FixedString512Bytes);
((FixedString512Bytes)(ref val))..ctor(message ?? string.Empty);
ServerChatUtils.SendSystemMessageToClient(em, componentData, ref val);
}
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(40, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[RewardsService] Failed to notify user: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
log.LogError(val2);
}
}
}
[BepInPlugin("FinishZone", "FinishZone", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
internal static Harmony Harmony;
internal static ManualLogSource PluginLog;
public static ManualLogSource LogInstance { get; private set; }
public override void Load()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
if (!(Application.productName != "VRisingServer"))
{
PluginLog = ((BasePlugin)this).Log;
LogInstance = ((BasePlugin)this).Log;
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("FinishZone");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
Harmony = new Harmony("FinishZone");
Harmony.PatchAll(Assembly.GetExecutingAssembly());
CommandRegistry.RegisterAll();
}
}
public override bool Unload()
{
CommandRegistry.UnregisterAssembly();
Harmony harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
return true;
}
internal static bool HasLoaded()
{
World world = Core.GetWorld("Server");
if (world == null)
{
return false;
}
PrefabCollectionSystem existingSystemManaged = world.GetExistingSystemManaged<PrefabCollectionSystem>();
return existingSystemManaged != null && existingSystemManaged.SpawnableNameToPrefabGuidDictionary.Count > 0;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "FinishZone";
public const string PLUGIN_NAME = "FinishZone";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace FinishZone.Services
{
internal static class FinisherService
{
private sealed record FinishRecord(string Zone, string PlayerName);
private static readonly string CONFIG_DIR = Path.Combine(Paths.ConfigPath, "FinishZone");
private static readonly string LOG_FILE = Path.Combine(CONFIG_DIR, "finish_log.csv");
private const int LINE_LIMIT = 200;
public static bool TryGetWinnerMessages(out List<string> messages, out string error)
{
messages = new List<string>();
error = string.Empty;
try
{
if (!File.Exists(LOG_FILE))
{
error = "<color=red>File not found:</color> finish_log.csv";
return false;
}
List<string> list = (from l in File.ReadAllLines(LOG_FILE)
where !string.IsNullOrWhiteSpace(l)
select l).Skip(1).ToList();
if (list.Count == 0)
{
error = "<color=yellow>No data found in finish_log.csv</color>";
return false;
}
List<FinishRecord> list2 = new List<FinishRecord>();
foreach (string item in list)
{
string[] array = item.Split(',', 5);
if (array.Length >= 5)
{
string zone = array[1].Trim();
string playerName = array[3].Trim();
string text = array[4].Trim();
if (text.Equals("true", StringComparison.OrdinalIgnoreCase))
{
list2.Add(new FinishRecord(zone, playerName));
}
}
}
if (list2.Count == 0)
{
error = "<color=yellow>No winners found.</color>";
return false;
}
messages.Add("<color=yellow>Event Winners List</color>");
IOrderedEnumerable<IGrouping<string, FinishRecord>> orderedEnumerable = from r in list2
group r by r.Zone into g
orderby g.Key
select g;
foreach (IGrouping<string, FinishRecord> item2 in orderedEnumerable)
{
string text2 = "<color=green>" + item2.Key + "</color>: ";
string text3 = text2;
foreach (string item3 in item2.Select((FinishRecord g) => g.PlayerName))
{
string text4 = ((text3 == text2) ? string.Empty : ", ") + "<color=white>" + item3 + "</color>";
if ((text3 + text4).Length > 200)
{
messages.Add(text3);
text3 = "<color=white>" + item3 + "</color>";
}
else
{
text3 += text4;
}
}
if (!string.IsNullOrWhiteSpace(text3))
{
messages.Add(text3);
}
}
return true;
}
catch (Exception ex)
{
error = "<color=red>Error reading finish_log.csv:</color> " + ex.Message;
return false;
}
}
}
internal class FinishzoneService
{
internal class FinishZoneModel
{
public float3 Position { get; set; }
public float Radius { get; set; }
public float VerticalLimit { get; set; } = 1f;
public string Message { get; set; } = string.Empty;
public PrefabGUID RewardPrefab { get; set; }
public string RewardName { get; set; } = string.Empty;
public int RewardAmount { get; set; }
public bool ZoneEnabled { get; set; } = true;
}
private sealed class FinishZonesConfigDto
{
public bool ModEnabled { get; set; } = true;
public float LoopIntervalSeconds { get; set; } = 1f;
public Dictionary<string, ZoneDto> Zones { get; set; } = new Dictionary<string, ZoneDto>(StringComparer.OrdinalIgnoreCase);
}
private sealed class ZoneDto
{
public float[] Position { get; set; } = new float[3];
public float Radius { get; set; }
public float VerticalLimit { get; set; } = 1f;
public string Message { get; set; } = string.Empty;
public int RewardPrefab { get; set; }
public string RewardName { get; set; } = string.Empty;
public int RewardAmount { get; set; }
public bool ZoneEnabled { get; set; } = true;
}
private static bool _initialized;
private static bool _loaded;
private static readonly string CONFIG_DIR = Path.Combine(Paths.ConfigPath, "FinishZone");
private static readonly string CONFIG_FILE = Path.Combine(CONFIG_DIR, "finishzones.json");
private static readonly string LOG_FILE = Path.Combine(CONFIG_DIR, "finish_log.csv");
private static readonly TimeSpan CooldownDuration = TimeSpan.FromMinutes(10.0);
private const float DEFAULT_LOOP_INTERVAL = 1f;
private const float DEFAULT_VERTICAL_LIMIT = 1f;
private const string DEFAULT_MESSAGE = "";
public static readonly PrefabGUID DefaultRewardPrefab = new PrefabGUID(576389135);
public const string DefaultRewardName = "Greater Stygian Shards";
public const int DefaultRewardAmount = 1000;
private static readonly Dictionary<string, FinishZoneModel> _zones = new Dictionary<string, FinishZoneModel>();
private static readonly HashSet<string> _finished = new HashSet<string>();
private static readonly Dictionary<string, DateTime> _cooldown = new Dictionary<string, DateTime>();
private static bool _modEnabled = true;
private static float _loopIntervalSeconds = 1f;
private static Coroutine _loopCoroutine;
public void Initialize()
{
if (!_initialized)
{
_initialized = true;
EnsureZoneFileExists();
LoadZones();
LoadLog();
_loaded = true;
RefreshLoopState();
Core.Log.LogInfo((object)"[FinishZoneService] Initialized.");
}
}
private static void EnsureLoaded()
{
if (!_loaded)
{
EnsureZoneFileExists();
LoadZones();
LoadLog();
_loaded = true;
RefreshLoopState();
}
}
public static void ReloadZones()
{
EnsureZoneFileExists();
LoadZones();
LoadLog();
_loaded = true;
RefreshLoopState();
Core.Log.LogInfo((object)"[FinishZoneService] Reloaded zones from file.");
}
public static bool TryUpsertZone(string id, float3 position, float radius, out string error)
{
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
EnsureLoaded();
if (string.IsNullOrWhiteSpace(id))
{
error = "<color=red>Zone id is required.</color>";
return false;
}
if (radius <= 0f)
{
error = "<color=red>Radius must be greater than 0.</color>";
return false;
}
if (radius > 30f)
{
error = "<color=red>Radius must be less than 30.</color>";
return false;
}
if (_zones.ContainsKey(id))
{
error = $"<color=red>Finish zone {id} already exists. Use <color=green>.finish update {id} {radius}</color> to update.</color>";
return false;
}
_zones[id] = new FinishZoneModel
{
Position = position,
Radius = radius,
VerticalLimit = 1f,
Message = "",
RewardPrefab = DefaultRewardPrefab,
RewardName = "Greater Stygian Shards",
RewardAmount = 1000,
ZoneEnabled = true
};
try
{
SaveZones();
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] SaveZones failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
error = "<color=red>Failed to save finishzones.json</color>";
return false;
}
error = string.Empty;
return true;
}
public static bool TryUpdateZone(string id, float3 position, float radius, out string error)
{
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
EnsureLoaded();
if (string.IsNullOrWhiteSpace(id))
{
error = "<color=red>Zone id is required.</color>";
return false;
}
if (radius <= 0f)
{
error = "<color=red>Radius must be greater than 0.</color>";
return false;
}
if (radius > 30f)
{
error = "<color=red>Radius must be less than 30.</color>";
return false;
}
if (!_zones.TryGetValue(id, out var value))
{
error = "<color=red>Finish zone " + id + " not found.</color>";
return false;
}
_zones[id] = new FinishZoneModel
{
Position = position,
Radius = radius,
VerticalLimit = ((value.VerticalLimit > 0f) ? value.VerticalLimit : 1f),
Message = (value.Message ?? ""),
RewardPrefab = value.RewardPrefab,
RewardName = (string.IsNullOrWhiteSpace(value.RewardName) ? "Greater Stygian Shards" : value.RewardName),
RewardAmount = value.RewardAmount,
ZoneEnabled = value.ZoneEnabled
};
try
{
SaveZones();
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] SaveZones failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
error = "<color=red>Failed to save finishzones.json</color>";
return false;
}
error = string.Empty;
return true;
}
public static bool TrySetZoneEnabled(string id, bool enabled, out string error)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
EnsureLoaded();
if (string.IsNullOrWhiteSpace(id))
{
error = "<color=red>Zone id is required.</color>";
return false;
}
if (!_zones.TryGetValue(id, out var value))
{
error = "<color=red>Finish zone " + id + " not found.</color>";
return false;
}
value.ZoneEnabled = enabled;
try
{
SaveZones();
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] SaveZones failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
error = "<color=red>Failed to save finishzones.json</color>";
return false;
}
error = string.Empty;
return true;
}
public static bool TrySetModEnabled(bool enabled, out string error)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
EnsureLoaded();
_modEnabled = enabled;
try
{
SaveZones();
RefreshLoopState();
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] SaveZones failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
error = "<color=red>Failed to save finishzones.json</color>";
return false;
}
error = string.Empty;
return true;
}
public static bool TryRemoveZone(string id, out string error)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
EnsureLoaded();
if (string.IsNullOrWhiteSpace(id))
{
error = "<color=red>Zone id is required.</color>";
return false;
}
if (!_zones.Remove(id))
{
error = "<color=red>Finish zone " + id + " not found.</color>";
return false;
}
try
{
SaveZones();
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] SaveZones failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
error = "<color=red>Failed to save finishzones.json</color>";
return false;
}
error = string.Empty;
return true;
}
public static IReadOnlyDictionary<string, FinishZoneModel> GetZonesSnapshot()
{
EnsureLoaded();
return new Dictionary<string, FinishZoneModel>(_zones);
}
public static bool IsModEnabled()
{
EnsureLoaded();
return _modEnabled;
}
public static float GetLoopInterval()
{
EnsureLoaded();
return _loopIntervalSeconds;
}
private static void RefreshLoopState()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
if (_modEnabled)
{
if (_loopCoroutine == null)
{
_loopCoroutine = Core.StartCoroutine(FinishLoop());
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(45, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] Loop started. Interval: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_loopIntervalSeconds, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s");
}
log.LogInfo(val);
}
}
else if (_loopCoroutine != null)
{
Core.StopCoroutine(_loopCoroutine);
_loopCoroutine = null;
Core.Log.LogInfo((object)"[FinishZoneService] Loop stopped.");
}
}
private static IEnumerator FinishLoop()
{
bool flag = default(bool);
while (true)
{
try
{
UpdateZones();
}
catch (Exception ex2)
{
Exception ex = ex2;
ManualLogSource log = Core.Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] Loop error: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
float waitSeconds = ((_loopIntervalSeconds > 0f) ? _loopIntervalSeconds : 1f);
yield return (object)new WaitForSeconds(waitSeconds);
}
}
private static void UpdateZones()
{
//IL_0476: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Expected O, but got Unknown
//IL_006c: 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_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)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: 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_008c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_00bf: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Expected O, but got Unknown
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Expected O, but got Unknown
if (!_modEnabled || _zones.Count == 0)
{
return;
}
KeyValuePair<string, FinishZoneModel>[] array = _zones.Where((KeyValuePair<string, FinishZoneModel> kv) => kv.Value.ZoneEnabled).ToArray();
if (array.Length == 0)
{
return;
}
NativeArray<Entity> entitiesByComponentTypes = Helper.GetEntitiesByComponentTypes<User, LocalToWorld>();
try
{
Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator();
float2 val3 = default(float2);
bool flag2 = default(bool);
FixedString512Bytes val5 = default(FixedString512Bytes);
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
User val = current.Read<User>();
if (!val.IsConnected || val.IsAdmin)
{
continue;
}
Entity entity = val.LocalCharacter._Entity;
if (!TryGetCharacterPosition(entity, out var pos))
{
continue;
}
ulong platformId = val.PlatformId;
string text = ((object)(FixedString64Bytes)(ref val.CharacterName)).ToString();
KeyValuePair<string, FinishZoneModel>[] array2 = array;
foreach (KeyValuePair<string, FinishZoneModel> keyValuePair in array2)
{
keyValuePair.Deconstruct(out var key, out var value);
string text2 = key;
FinishZoneModel finishZoneModel = value;
float3 val2 = pos - finishZoneModel.Position;
if (math.abs(val2.y) > finishZoneModel.VerticalLimit)
{
continue;
}
((float2)(ref val3))..ctor(val2.x, val2.z);
float num = math.lengthsq(val3);
if (num > finishZoneModel.Radius * finishZoneModel.Radius)
{
continue;
}
string text3 = $"{text2}:{platformId}";
if (!CanTrigger(text3))
{
continue;
}
_cooldown[text3] = DateTime.UtcNow;
bool flag = !_finished.Contains(text3);
if (flag)
{
_finished.Add(text3);
}
string text4 = finishZoneModel.Message ?? string.Empty;
PrefabGUID rewardPrefab = finishZoneModel.RewardPrefab;
string text5 = (string.IsNullOrWhiteSpace(finishZoneModel.RewardName) ? "Greater Stygian Shards" : finishZoneModel.RewardName);
int rewardAmount = finishZoneModel.RewardAmount;
ManualLogSource log = Core.Log;
BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(54, 3, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[FinishZoneService] ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" reached finish zone ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text2);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" first time: ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(flag.ToString().ToLower());
}
log.LogInfo(val4);
string text6 = string.Empty;
if (flag && rewardAmount > 0)
{
text6 = $" <color=yellow>Received:</color> <color=#87CEFA>{rewardAmount} {text5}</color>. ";
}
string text7 = $"<color=white>{text}</color> <color=green>has completed {text2}.</color>" + text6 + "<color=yellow>" + text4 + "</color>";
((FixedString512Bytes)(ref val5))..ctor(text7);
ServerChatUtils.SendSystemMessageToAllClients(Core.EntityManager, ref val5);
if (flag && rewardAmount > 0)
{
try
{
Helper.AddItemToInventory(entity, rewardPrefab, rewardAmount);
ManualLogSource log2 = Core.Log;
val4 = new BepInExInfoLogInterpolatedStringHandler(47, 4, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[FinishZoneService] Gave ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(rewardAmount);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text5);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((PrefabGUID)(ref rewardPrefab)).GuidHash);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(") to ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" successfully.");
}
log2.LogInfo(val4);
}
catch (Exception ex)
{
ManualLogSource log3 = Core.Log;
BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[FinishZoneService] Failed to give reward: ");
((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(ex.Message);
}
log3.LogError(val6);
}
}
LogFinish(text2, platformId, text, flag);
}
}
}
finally
{
entitiesByComponentTypes.Dispose();
}
}
private static bool TryGetCharacterPosition(Entity charEnt, out float3 pos)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_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_0021: 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_0047: 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_004d: 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)
pos = float3.zero;
if (!(charEnt == Entity.Null))
{
EntityManager entityManager = Core.EntityManager;
if (((EntityManager)(ref entityManager)).Exists(charEnt))
{
if (!charEnt.Has<LocalToWorld>())
{
return false;
}
LocalToWorld val = charEnt.Read<LocalToWorld>();
pos = ((LocalToWorld)(ref val)).Position;
return true;
}
}
return false;
}
private static bool CanTrigger(string key)
{
if (_cooldown.TryGetValue(key, out var value))
{
return DateTime.UtcNow - value > CooldownDuration;
}
return true;
}
private static void EnsureZoneFileExists()
{
Directory.CreateDirectory(CONFIG_DIR);
if (!File.Exists(CONFIG_FILE))
{
FinishZonesConfigDto value = new FinishZonesConfigDto();
string contents = JsonSerializer.Serialize(value, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(CONFIG_FILE, contents);
Core.Log.LogInfo((object)"[FinishZoneService] Created default finishzones.json");
}
}
private static void LoadZones()
{
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Expected O, but got Unknown
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Expected O, but got Unknown
//IL_00f0: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
try
{
if (!File.Exists(CONFIG_FILE))
{
Core.Log.LogWarning((object)"[FinishZoneService] No finishzones.json found.");
return;
}
string json = File.ReadAllText(CONFIG_FILE);
FinishZonesConfigDto finishZonesConfigDto = JsonSerializer.Deserialize<FinishZonesConfigDto>(json) ?? new FinishZonesConfigDto();
_modEnabled = finishZonesConfigDto.ModEnabled;
_loopIntervalSeconds = ((finishZonesConfigDto.LoopIntervalSeconds > 0f) ? finishZonesConfigDto.LoopIntervalSeconds : 1f);
_zones.Clear();
foreach (KeyValuePair<string, ZoneDto> zone in finishZonesConfigDto.Zones)
{
ZoneDto zoneDto = zone.Value ?? new ZoneDto();
float[] array = zoneDto.Position ?? new float[3];
float verticalLimit = ((zoneDto.VerticalLimit > 0f) ? zoneDto.VerticalLimit : 1f);
PrefabGUID rewardPrefab = (PrefabGUID)((zoneDto.RewardPrefab != 0) ? new PrefabGUID(zoneDto.RewardPrefab) : DefaultRewardPrefab);
string rewardName = (string.IsNullOrWhiteSpace(zoneDto.RewardName) ? "Greater Stygian Shards" : zoneDto.RewardName);
int rewardAmount = ((zoneDto.RewardAmount != 0) ? zoneDto.RewardAmount : 1000);
_zones[zone.Key] = new FinishZoneModel
{
Position = new float3((array.Length != 0) ? array[0] : 0f, (array.Length > 1) ? array[1] : 0f, (array.Length > 2) ? array[2] : 0f),
Radius = zoneDto.Radius,
VerticalLimit = verticalLimit,
Message = (zoneDto.Message ?? string.Empty),
RewardPrefab = rewardPrefab,
RewardName = rewardName,
RewardAmount = rewardAmount,
ZoneEnabled = zoneDto.ZoneEnabled
};
}
ManualLogSource log = Core.Log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(63, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] Loaded ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_zones.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" zones. ModEnabled: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_modEnabled);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" LoopInterval: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_loopIntervalSeconds, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s");
}
log.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource log2 = Core.Log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[FinishZoneService] LoadZones error: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
log2.LogError(val2);
}
}
private static void SaveZones()
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
Directory.CreateDirectory(CONFIG_DIR);
FinishZonesConfigDto finishZonesConfigDto = new FinishZonesConfigDto
{
ModEnabled = _modEnabled,
LoopIntervalSeconds = ((_loopIntervalSeconds > 0f) ? _loopIntervalSeconds : 1f),
Zones = new Dictionary<string, ZoneDto>(_zones.Count)
};
foreach (KeyValuePair<string, FinishZoneModel> zone in _zones)
{
FinishZoneModel value = zone.Value;
Dictionary<string, ZoneDto> zones = finishZonesConfigDto.Zones;
string key = zone.Key;
ZoneDto zoneDto = new ZoneDto
{
Position = new float[3]
{
value.Position.x,
value.Position.y,
value.Position.z
},
Radius = value.Radius,
VerticalLimit = ((value.VerticalLimit > 0f) ? value.VerticalLimit : 1f),
Message = (value.Message ?? string.Empty)
};
PrefabGUID rewardPrefab = value.RewardPrefab;
zoneDto.RewardPrefab = ((PrefabGUID)(ref rewardPrefab)).GuidHash;
zoneDto.RewardName = value.RewardName ?? string.Empty;
zoneDto.RewardAmount = value.RewardAmount;
zoneDto.ZoneEnabled = value.ZoneEnabled;
zones[key] = zoneDto;
}
string contents = JsonSerializer.Serialize(finishZonesConfigDto, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(CONFIG_FILE, contents);
}
private static void LoadLog()
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Expected O, but got Unknown
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
bool flag = default(bool);
try
{
if (!File.Exists(LOG_FILE))
{
Core.Log.LogInfo((object)"[FinishZoneService] No finish_log.csv found.");
return;
}
_finished.Clear();
string[] array = File.ReadAllLines(LOG_FILE);
string[] array2 = array;
foreach (string text in array2)
{
if (!text.StartsWith("time"))
{
string[] array3 = text.Split(',');
if (array3.Length >= 5 && array3[4].Equals("true", StringComparison.OrdinalIgnoreCase))
{
_finished.Add(array3[1] + ":" + array3[2]);
}
}
}
ManualLogSource log = Core.Log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] Loaded ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_finished.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" completed entries.");
}
log.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource log2 = Core.Log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[FinishZoneService] LoadLog error: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
log2.LogError(val2);
}
}
private static void LogFinish(string zoneId, ulong steamId, string name, bool firstTime)
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
try
{
Directory.CreateDirectory(CONFIG_DIR);
bool flag = !File.Exists(LOG_FILE);
using StreamWriter streamWriter = new StreamWriter(LOG_FILE, append: true);
if (flag)
{
streamWriter.WriteLine("servertime,finishzone,steamid,playername,firsttime");
}
streamWriter.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff},{zoneId},{steamId},{name},{firstTime.ToString().ToLower()}");
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag2 = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneService] Log error: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
}
internal static class RewardsService
{
public sealed class RewardEntry
{
public int Item { get; set; }
public int Amount { get; set; }
}
private static class CsvLogger
{
internal static void LogRow(string setName, string playerName, string adminName)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
try
{
EnsureLogFileExists();
string s = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
string text = string.Join(",", Csv(s), Csv(setName), Csv(playerName), Csv(adminName));
lock (_sync)
{
File.AppendAllText(LOG_FILE, text + Environment.NewLine, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
}
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(50, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RewardsService] Failed to write rewards_log.csv: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
private static string Csv(string s)
{
if (string.IsNullOrEmpty(s))
{
return "";
}
return (s.IndexOfAny(new char[4] { ',', '"', '\r', '\n' }) >= 0) ? ("\"" + s.Replace("\"", "\"\"") + "\"") : s;
}
}
private static bool _initialized;
private static readonly object _sync = new object();
private static readonly string CONFIG_DIR = Path.Combine(Paths.ConfigPath, "FinishZone");
private static readonly string CONFIG_FILE = Path.Combine(CONFIG_DIR, "rewards.json");
private static readonly string LOG_FILE = Path.Combine(CONFIG_DIR, "rewards_log.csv");
private static readonly Dictionary<string, List<RewardEntry>> _sets = new Dictionary<string, List<RewardEntry>>(StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<int, string> _labelCache = new Dictionary<int, string>();
private static readonly object _labelLock = new object();
public static void Initialize()
{
ReloadFromDisk(out var _);
}
public static Dictionary<string, List<RewardEntry>> GetAllSetsDetailed()
{
return new Dictionary<string, List<RewardEntry>>(_sets);
}
public static bool TryGetSet(string name, out List<RewardEntry> entries)
{
if (_sets.TryGetValue(name, out var value) && value != null && value.Count > 0)
{
entries = value;
return true;
}
entries = new List<RewardEntry>();
return false;
}
public static void AddSet(string name, int itemGuidHash, int amount)
{
if (!_sets.TryGetValue(name, out var value))
{
value = new List<RewardEntry>();
_sets[name] = value;
}
bool flag = false;
for (int i = 0; i < value.Count; i++)
{
RewardEntry rewardEntry = value[i];
if (rewardEntry.Item == itemGuidHash)
{
long value2 = (long)rewardEntry.Amount + (long)amount;
rewardEntry.Amount = (int)Math.Clamp(value2, -2147483648L, 2147483647L);
value[i] = rewardEntry;
flag = true;
break;
}
}
if (!flag)
{
value.Add(new RewardEntry
{
Item = itemGuidHash,
Amount = amount
});
}
SaveToDisk();
}
public static bool RemoveSet(string name)
{
bool flag = _sets.Remove(name);
if (flag)
{
SaveToDisk();
}
return flag;
}
public static bool ReloadFromDisk(out int setCount)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
try
{
Directory.CreateDirectory(CONFIG_DIR);
EnsureConfigFileExists();
EnsureLogFileExists();
string json = File.ReadAllText(CONFIG_FILE, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
Dictionary<string, List<RewardEntry>> dictionary = JsonSerializer.Deserialize<Dictionary<string, List<RewardEntry>>>(json);
_sets.Clear();
if (dictionary != null)
{
foreach (KeyValuePair<string, List<RewardEntry>> item in dictionary)
{
_sets[item.Key] = item.Value ?? new List<RewardEntry>();
}
}
setCount = _sets.Count;
return true;
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(48, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RewardsService] Failed to reload rewards.json: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
setCount = 0;
return false;
}
}
public static bool GiveRewardsToPlayer(ChatCommandContext ctx, string setName, string playerToken = "")
{
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Expected O, but got Unknown
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//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_0110: 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_007f: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00d1: 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)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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)
if (string.IsNullOrWhiteSpace(setName))
{
ctx.Reply("<color=red>Set name is required.</color>");
return false;
}
if (!TryGetSet(setName.Trim(), out var entries) || entries.Count == 0)
{
ctx.Reply("<color=yellow>Set not found:</color> " + setName);
return false;
}
EntityManager entityManager = Core.EntityManager;
Entity targetUserEntity;
Entity targetCharacter;
string displayName;
if (string.IsNullOrWhiteSpace(playerToken))
{
targetUserEntity = ctx.Event.SenderUserEntity;
targetCharacter = ctx.Event.SenderCharacterEntity;
if (targetUserEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(targetUserEntity))
{
ctx.Reply("<color=red>Could not find your player entity.</color>");
return false;
}
if (targetCharacter == Entity.Null || !((EntityManager)(ref entityManager)).Exists(targetCharacter))
{
ctx.Reply("<color=red>Could not find your character.</color>");
return false;
}
User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(targetUserEntity);
displayName = Helper.ReadUserName(componentData, targetUserEntity);
}
else if (!TryFindPlayer(entityManager, playerToken.Trim(), out targetUserEntity, out targetCharacter, out displayName))
{
ctx.Reply("<color=red>Player not found:</color> " + playerToken);
return false;
}
int num = 0;
bool flag = default(bool);
foreach (RewardEntry item in entries)
{
if (item.Amount <= 0)
{
continue;
}
try
{
Helper.AddItemToInventory(targetCharacter, new PrefabGUID(item.Item), item.Amount);
num++;
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(45, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RewardsService] Failed to give item ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(item.Item);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" x");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(item.Amount);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(displayName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
if (num <= 0)
{
ctx.Reply($"<color=red>Failed to give reward set</color> <color=white>{setName}</color> <color=red>to</color> <color=white>{displayName}</color>.");
return false;
}
string adminName;
try
{
User componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<User>(ctx.Event.SenderUserEntity);
adminName = Helper.ReadUserName(componentData2, ctx.Event.SenderUserEntity);
}
catch
{
adminName = $"User#{ctx.Event.SenderUserEntity.Index}";
}
ctx.Reply($"Gave reward set <color=white>{setName}</color> to <color=white>{displayName}</color>.");
Helper.NotifyUser(entityManager, targetUserEntity, "You received reward set <color=white>" + setName + "</color>.");
CsvLogger.LogRow(setName.Trim(), displayName, adminName);
return true;
}
private static bool TryFindPlayer(EntityManager em, string needle, out Entity targetUserEntity, out Entity targetCharacter, out string displayName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_0071: 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_0078: 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_008a: 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_009d: 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_00b9: 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_00c2: 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_00c9: 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_00cd: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: 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_0178: Unknown result type (might be due to invalid IL or missing references)
targetUserEntity = Entity.Null;
targetCharacter = Entity.Null;
displayName = string.Empty;
string text = needle?.Trim() ?? string.Empty;
if (text.Length == 0)
{
return false;
}
string text2 = text.ToLowerInvariant();
int result;
bool flag = int.TryParse(text2, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
NativeArray<Entity> entitiesByComponentType = Helper.GetEntitiesByComponentType<User>();
int num = -1;
Entity val = Entity.Null;
Entity val2 = Entity.Null;
string text3 = string.Empty;
try
{
Enumerator<Entity> enumerator = entitiesByComponentType.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (!((EntityManager)(ref em)).HasComponent<User>(current))
{
continue;
}
User componentData = ((EntityManager)(ref em)).GetComponentData<User>(current);
Entity characterFromUser = Helper.GetCharacterFromUser(componentData);
if (!(characterFromUser == Entity.Null))
{
string text4 = Helper.ReadUserName(componentData, current);
string text5 = text4.ToLowerInvariant();
int num2 = -1;
if (text5.StartsWith(text2))
{
num2 = 2;
}
else if (text5.Contains(text2))
{
num2 = 1;
}
else if (flag && current.Index == result)
{
num2 = 1;
}
if (num2 >= 0 && (num2 > num || (num2 == num && text4.Length < text3.Length)))
{
num = num2;
val = current;
val2 = characterFromUser;
text3 = text4;
}
}
}
}
finally
{
if (entitiesByComponentType.IsCreated)
{
entitiesByComponentType.Dispose();
}
}
if (num < 0)
{
return false;
}
targetUserEntity = val;
targetCharacter = val2;
displayName = text3;
return true;
}
public static string ResolveItemLabel(PrefabGUID guid, string fallbackInput)
{
int guidHash = ((PrefabGUID)(ref guid)).GuidHash;
lock (_labelLock)
{
if (_labelCache.TryGetValue(guidHash, out var value))
{
return value;
}
}
string text = (string.IsNullOrWhiteSpace(fallbackInput) ? ((PrefabGUID)(ref guid)).GuidHash.ToString(CultureInfo.InvariantCulture) : fallbackInput.Trim());
lock (_labelLock)
{
_labelCache[guidHash] = text;
}
return text;
}
private static void EnsureConfigFileExists()
{
if (!File.Exists(CONFIG_FILE))
{
File.WriteAllText(CONFIG_FILE, GetDefaultJson(), new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
}
}
private static void EnsureLogFileExists()
{
if (_initialized)
{
return;
}
lock (_sync)
{
if (!_initialized)
{
Directory.CreateDirectory(CONFIG_DIR);
if (!File.Exists(LOG_FILE))
{
File.WriteAllText(LOG_FILE, "time,setname,playername,adminname" + Environment.NewLine, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
}
_initialized = true;
}
}
}
private static void SaveToDisk()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
try
{
Directory.CreateDirectory(CONFIG_DIR);
string contents = JsonSerializer.Serialize(_sets, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(CONFIG_FILE, contents, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
}
catch (Exception ex)
{
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(46, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RewardsService] Failed to save rewards.json: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
private static string GetDefaultJson()
{
Dictionary<string, List<RewardEntry>> value = new Dictionary<string, List<RewardEntry>>(StringComparer.OrdinalIgnoreCase)
{
["Winner"] = new List<RewardEntry>
{
new RewardEntry
{
Item = -1461326411,
Amount = 20
},
new RewardEntry
{
Item = -1021407417,
Amount = 20
}
},
["Potion"] = new List<RewardEntry>
{
new RewardEntry
{
Item = 429052660,
Amount = 10
},
new RewardEntry
{
Item = 800879747,
Amount = 10
}
},
["Buff"] = new List<RewardEntry>
{
new RewardEntry
{
Item = 1510182325,
Amount = 1
},
new RewardEntry
{
Item = -1568756102,
Amount = 1
},
new RewardEntry
{
Item = 541321301,
Amount = 1
},
new RewardEntry
{
Item = -38051433,
Amount = 1
},
new RewardEntry
{
Item = 970650569,
Amount = 1
}
}
};
return JsonSerializer.Serialize(value, new JsonSerializerOptions
{
WriteIndented = true
});
}
}
}
namespace FinishZone.Patches
{
[HarmonyPatch(typeof(ServerBootstrapSystem), "OnUpdate")]
public static class InitializationPatch
{
private static bool _initialized;
[HarmonyPostfix]
public static void OneShot_AfterServerBootstrap()
{
if (!_initialized && Plugin.HasLoaded())
{
_initialized = true;
Core.InitializeAfterLoaded();
}
}
}
}
namespace FinishZone.Commands
{
internal static class FinisherCommands
{
[Command("finishers", "winners", null, "Show the finishers of each event.", null, false)]
public static void ShowWinners(ChatCommandContext ctx)
{
if (!FinisherService.TryGetWinnerMessages(out var messages, out var error))
{
ctx.Reply(error);
return;
}
foreach (string item in messages)
{
ctx.Reply(item);
}
}
}
[CommandGroup("finish", null)]
internal static class FinishzoneCommands
{
[Command("add", "a", null, "Add a new finish zone.", null, true)]
public static void Add(ChatCommandContext ctx, string id, float radius)
{
//IL_0007: 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_0032: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
if (ctx.Event.SenderCharacterEntity == Entity.Null)
{
ctx.Reply("<color=red>Character not ready.</color>");
return;
}
if (!TryGetCommandPosition(ctx.Event.SenderCharacterEntity, out var pos))
{
ctx.Reply("<color=red>Could not read your position.</color>");
return;
}
if (!FinishzoneService.TryUpsertZone(id, pos, radius, out var error))
{
ctx.Reply(error);
return;
}
ctx.Reply($"<color=green>Added finish zone</color> <color=white>{id}</color> <color=yellow>Radius: {radius}</color>");
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 5, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneCommands] Added zone ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(id);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(radius);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" at (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(pos.x, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(pos.y, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(pos.z, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
log.LogInfo(val);
}
[Command("update", "u", null, "Update an existing finish zone.", null, true)]
public static void Update(ChatCommandContext ctx, string id, float radius)
{
//IL_0007: 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_0032: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
if (ctx.Event.SenderCharacterEntity == Entity.Null)
{
ctx.Reply("<color=red>Character not ready.</color>");
return;
}
if (!TryGetCommandPosition(ctx.Event.SenderCharacterEntity, out var pos))
{
ctx.Reply("<color=red>Could not read your position.</color>");
return;
}
if (!FinishzoneService.TryUpdateZone(id, pos, radius, out var error))
{
ctx.Reply(error);
return;
}
ctx.Reply($"<color=green>Updated finish zone</color> <color=white>{id}</color> <color=yellow>Radius: {radius}</color>");
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(45, 5, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneCommands] Updated zone ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(id);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(radius);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" at (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(pos.x, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(pos.y, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(pos.z, "0.##");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
log.LogInfo(val);
}
[Command("remove", "rm", null, "Remove a finish zone.", null, true)]
public static void Remove(ChatCommandContext ctx, string id)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
if (!FinishzoneService.TryRemoveZone(id, out var error))
{
ctx.Reply(error);
return;
}
ctx.Reply("<color=yellow>Removed finish zone </color><color=white>" + id + "</color>");
ManualLogSource log = Core.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[FinishZoneCommands] Removed zone ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(id);
}
log.LogInfo(val);
}
[Command("enable", "en", null, "Enable FinishZone mod.", null, true)]
public static void EnableMod(ChatCommandContext ctx)
{
if (!FinishzoneService.TrySetModEnabled(enabled: true, out var error))
{
ctx.Reply(error);
}
else
{
ctx.Reply("<color=green>FinishZone mod enabled.</color>");
}
}
[Command("disable", "dis", null, "Disable FinishZone mod.", null, true)]
public static void DisableMod(ChatCommandContext ctx)
{
if (!FinishzoneService.TrySetModEnabled(enabled: false, out var error))
{
ctx.Reply(error);
}
else
{
ctx.Reply("<color=yellow>FinishZone mod disabled.</color>");
}
}
[Command("on", null, null, "Enable a finish zone.", null, true)]
public static void On(ChatCommandContext ctx, string id)
{
if (!FinishzoneService.TrySetZoneEnabled(id, enabled: true, out var error))
{
ctx.Reply(error);
}
else
{
ctx.Reply("<color=green>Enabled finish zone </color><color=white>" + id + "</color>");
}
}
[Command("off", null, null, "Disable a finish zone.", null, true)]
public static void Off(ChatCommandContext ctx, string id)
{
if (!FinishzoneService.TrySetZoneEnabled(id, enabled: false, out var error))
{
ctx.Reply(error);
}
else
{
ctx.Reply("<color=yellow>Disabled finish zone </color><color=white>" + id + "</color>");
}
}
[Command("reload", "rl", null, "Reload finish zones from file.", null, true)]
public static void Reload(ChatCommandContext ctx)
{
FinishzoneService.ReloadZones();
ctx.Reply("<color=green>Finish zones reloaded successfully.</color>");
}
[Command("list", "l", null, "Show all finish zones.", null, true)]
public static void List(ChatCommandContext ctx)
{
//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)
IReadOnlyDictionary<string, FinishzoneService.FinishZoneModel> zonesSnapshot = FinishzoneService.GetZonesSnapshot();
string value = (FinishzoneService.IsModEnabled() ? "enabled" : "disabled");
float loopInterval = FinishzoneService.GetLoopInterval();
if (zonesSnapshot.Count == 0)
{
ctx.Reply($"<color=yellow>No finish zones found.</color> <color=white>Mod: {value}, Loop Interval: {loopInterval:0.##}</color>");
return;
}
StringBuilder stringBuilder = new StringBuilder();
StringBuilder stringBuilder2 = stringBuilder;
StringBuilder stringBuilder3 = stringBuilder2;
StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(83, 2, stringBuilder2);
handler.AppendLiteral("<color=yellow>Finish zones list</color> <color=white>Mod: ");
handler.AppendFormatted(value);
handler.AppendLiteral(", Loop Interval: ");
handler.AppendFormatted(loopInterval, "0.##");
handler.AppendLiteral("</color>");
stringBuilder3.AppendLine(ref handler);
int num = 1;
foreach (KeyValuePair<string, FinishzoneService.FinishZoneModel> item in zonesSnapshot)
{
string key = item.Key;
FinishzoneService.FinishZoneModel value2 = item.Value;
object obj;
if (value2.RewardAmount <= 0)
{
obj = "none";
}
else
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(4, 3);
defaultInterpolatedStringHandler.AppendFormatted(value2.RewardAmount);
defaultInterpolatedStringHandler.AppendLiteral(" ");
defaultInterpolatedStringHandler.AppendFormatted(value2.RewardName);
defaultInterpolatedStringHandler.AppendLiteral(" (");
PrefabGUID rewardPrefab = value2.RewardPrefab;
defaultInterpolatedStringHandler.AppendFormatted(((PrefabGUID)(ref rewardPrefab)).GuidHash);
defaultInterpolatedStringHandler.AppendLiteral(")");
obj = defaultInterpolatedStringHandler.ToStringAndClear();
}
string value3 = (string)obj;
string value4 = (value2.ZoneEnabled ? "enabled" : "disabled");
stringBuilder2 = stringBuilder;
StringBuilder stringBuilder4 = stringBuilder2;
handler = new StringBuilder.AppendInterpolatedStringHandler(82, 7, stringBuilder2);
handler.AppendLiteral("[");
handler.AppendFormatted(num);
handler.AppendLiteral("] <color=white>");
handler.AppendFormatted(key);
handler.AppendLiteral("</color> Status: ");
handler.AppendFormatted(value4);
handler.AppendLiteral(", Radius: ");
handler.AppendFormatted(value2.Radius);
handler.AppendLiteral(", Vertical Limit: ");
handler.AppendFormatted(value2.VerticalLimit);
handler.AppendLiteral(", Reward: ");
handler.AppendFormatted(value3);
handler.AppendLiteral(", Message: ");
handler.AppendFormatted(value2.Message);
stringBuilder4.AppendLine(ref handler);
num++;
}
ctx.Reply(stringBuilder.ToString());
}
private static bool TryGetCommandPosition(Entity charEnt, out float3 pos)
{
//IL_0002: 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_0009: 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_001d: 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_0043: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
pos = default(float3);
if (!(charEnt == Entity.Null))
{
EntityManager entityManager = Core.EntityManager;
if (((EntityManager)(ref entityManager)).Exists(charEnt))
{
if (!charEnt.Has<LocalToWorld>())
{
return false;
}
LocalToWorld val = charEnt.Read<LocalToWorld>();
pos = ((LocalToWorld)(ref val)).Position;
return true;
}
}
return false;
}
}
[CommandGroup("rewards", null)]
internal static class RewardsCommands
{
[Command("add", "a", null, "Add an item to a reward set.", null, true)]
public static void Add(ChatCommandContext ctx, string setname = "", string prefabGuidToken = "", string amountToken = "")
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(setname) || string.IsNullOrWhiteSpace(prefabGuidToken) || string.IsNullOrWhiteSpace(amountToken))
{
ShowUsage(ctx);
return;
}
if (!int.TryParse(prefabGuidToken, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
{
ctx.Reply("<color=red>PrefabGUID must be a valid integer.</color>");
return;
}
if (!int.TryParse(amountToken, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2) || result2 <= 0)
{
ctx.Reply("<color=red>Amount must be >= 1.</color>");
return;
}
PrefabGUID guid = default(PrefabGUID);
((PrefabGUID)(ref guid))..ctor(result);
string value = RewardsService.ResolveItemLabel(guid, prefabGuidToken);
RewardsService.AddSet(setname.Trim(), result, result2);
ctx.Reply($"Added <color=#87CEFA>{value}</color> × <color=#FFD700>{result2}</color> to reward set <color=white>{setname}</color>.");
}
[Command("remove", "rm", null, "Remove a reward set.", null, true)]
public static void Remove(ChatCommandContext ctx, string setname = "")
{
if (string.IsNullOrWhiteSpace(setname))
{
ShowUsage(ctx);
}
else if (RewardsService.RemoveSet(setname.Trim()))
{
ctx.Reply("Removed reward set <color=white>" + setname + "</color>.");
}
else
{
ctx.Reply("<color=yellow>Set not found:</color> " + setname);
}
}
[Command("give", "g", null, "Give a reward set to a player or yourself.", null, true)]
public static void Give(ChatCommandContext ctx, string setname = "", string player = "")
{
if (string.IsNullOrWhiteSpace(setname))
{
ShowUsage(ctx);
}
else
{
RewardsService.GiveRewardsToPlayer(ctx, setname, player);
}
}
[Command("reload", "rl", null, "Reload rewards.json from disk.", null, true)]
public static void Reload(ChatCommandContext ctx)
{
if (RewardsService.ReloadFromDisk(out var setCount))
{
ctx.Reply($"Reloaded <color=white>{setCount}</color> reward sets.");
}
else
{
ctx.Reply("<color=red>Failed to reload rewards.json</color>");
}
}
[Command("list", "l", null, "List all reward sets.", null, true)]
public static void List(ChatCommandContext ctx)
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
Dictionary<string, List<RewardsService.RewardEntry>> allSetsDetailed = RewardsService.GetAllSetsDetailed();
if (allSetsDetailed.Count == 0)
{
ctx.Reply("<color=yellow>No reward sets found.</color>");
return;
}
ctx.Reply("<color=yellow>Available reward sets:</color>");
PrefabGUID guid = default(PrefabGUID);
foreach (KeyValuePair<string, List<RewardsService.RewardEntry>> item in allSetsDetailed)
{
string text = "<color=#87CEFA>" + item.Key + "</color>: ";
bool flag = false;
foreach (RewardsService.RewardEntry item2 in item.Value)
{
((PrefabGUID)(ref guid))..ctor(item2.Item);
string value = RewardsService.ResolveItemLabel(guid, ((PrefabGUID)(ref guid)).GuidHash.ToString());
if (flag)
{
text += ", ";
}
text += $"{value} × {item2.Amount}";
flag = true;
}
if (!flag)
{
text += " (empty)";
}
ctx.Reply(text);
}
}
[Command("help", "h", null, "Show usage for .rewards", null, true)]
public static void Help(ChatCommandContext ctx)
{
ShowUsage(ctx);
}
private static void ShowUsage(ChatCommandContext ctx)
{
ctx.Reply("<color=yellow>Usage:</color>\n.rewards add <setname> <prefabguid> <amount>\n.rewards remove <setname>\n.rewards give <setname> <player>\n.rewards reload\n.rewards list");
}
}
}