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.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.CastleBuilding;
using ProjectM.CastleBuilding.Placement;
using ProjectM.Gameplay.Systems;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Shared;
using ProjectM.Tiles;
using SemanticVersioning;
using Stunlock.Core;
using Stunlock.Network;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Physics;
using Unity.Transforms;
using UnityEngine;
using VAMP;
using VAMP.Data;
using VAMP.Services;
using VAMP.Utilities;
using VComforts.Database;
using VComforts.Factory;
using VComforts.Initialization;
using VComforts.Managers;
using VComforts.Patches.Connection;
using VComforts.Services;
using VComforts.Systems;
using VComforts.Utils;
using VComforts.VCFCompat;
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("VComforts")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Server side QoL mod")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+1.Branch.main.Sha.a322c9fb3b6e06343e3dfa71f39a27988d15f262.8cba8354f83d7b5124ffcd5d10ec1e760e4b69fa")]
[assembly: AssemblyProduct("VComforts")]
[assembly: AssemblyTitle("VComforts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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]
internal sealed class IsUnmanagedAttribute : Attribute
{
}
[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 VComforts
{
internal static class Extensions
{
public delegate void WithRefHandler<T>(ref T item);
private static EntityManager EntityManager => Core.EntityManager;
public static CastleHeartService CastleHeartService { get; } = new CastleHeartService();
public static RespawnPointSpawnerSystem RespawnPointSpawnerSystem { get; } = new RespawnPointSpawnerSystem();
public static void With<T>(this Entity entity, WithRefHandler<T> action) where T : struct
{
//IL_0000: 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_0014: 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)
T item = entity.Read<T>();
action(ref item);
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
}
public static void AddWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct
{
//IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references)
if (!entity.Has<T>())
{
entity.Add<T>();
}
entity.With(action);
}
public static void HasWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct
{
//IL_0000: 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)
if (entity.Has<T>())
{
entity.With(action);
}
}
public static void Write<T>(this Entity entity, T componentData) where T : struct
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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)
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, componentData);
}
public static T Read<T>(this Entity entity) where T : struct
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).GetComponentData<T>(entity);
}
public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000a: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false);
}
public static DynamicBuffer<T> AddBuffer<T>(this Entity entity) where T : struct
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).AddBuffer<T>(entity);
}
public static bool TryGetComponent<T>(this Entity entity, out T componentData) where T : struct
{
//IL_0007: 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)
componentData = default(T);
if (entity.Has<T>())
{
componentData = entity.Read<T>();
return true;
}
return false;
}
public static bool TryRemove<T>(this Entity entity) where T : struct
{
//IL_0000: 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)
if (entity.Has<T>())
{
entity.Remove<T>();
return true;
}
return false;
}
public static bool Has<T>(this Entity entity) where T : struct
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000f: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).HasComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
}
public static bool TryGetBuffer<T>(this Entity entity, out DynamicBuffer<T> buffer) where T : struct
{
//IL_0001: 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_0010: 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)
buffer = default(DynamicBuffer<T>);
if (entity.Has<T>())
{
buffer = entity.ReadBuffer<T>();
return true;
}
return false;
}
public static bool TryRemoveComponent<T>(this Entity entity) where T : struct
{
//IL_0000: 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)
if (entity.Has<T>())
{
entity.Remove<T>();
return true;
}
return false;
}
public static void Add<T>(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000f: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).AddComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
}
public static void Remove<T>(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000f: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0));
}
public static bool TryGetFollowedPlayer(this Entity entity, out Entity player)
{
//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_0013: 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_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_0024: 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_002e: Unknown result type (might be due to invalid IL or missing references)
player = Entity.Null;
if (entity.Has<Follower>())
{
Entity value = entity.Read<Follower>().Followed._Value;
if (value.IsPlayer())
{
player = value;
return true;
}
}
return false;
}
public static bool TryGetPlayer(this Entity entity, out Entity player)
{
//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_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)
player = Entity.Null;
if (entity.Has<PlayerCharacter>())
{
player = entity;
return true;
}
return false;
}
public static bool IsPlayer(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (entity.Has<VampireTag>())
{
return true;
}
return false;
}
public static bool IsDifferentPlayer(this Entity entity, Entity target)
{
//IL_0000: 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_0012: Unknown result type (might be due to invalid IL or missing references)
if (entity.IsPlayer() && target.IsPlayer() && !((Entity)(ref entity)).Equals(target))
{
return true;
}
return false;
}
public static bool IsFollowingPlayer(this Entity entity)
{
//IL_0000: 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_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)
if (entity.Has<Follower>() && entity.Read<Follower>().Followed._Value.IsPlayer())
{
return true;
}
return false;
}
public static Entity GetBuffTarget(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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)
return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity);
}
public static Entity GetSpellTarget(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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)
return CreateGameplayEventServerUtility.GetSpellTarget(EntityManager, entity);
}
public unsafe static T GetComponentDataAOT<T>(this EntityManager entityManager, Entity entity) where T : unmanaged
{
//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_000e: Unknown result type (might be due to invalid IL or missing references)
TypeIndex typeIndex = TypeManager.GetTypeIndex(Il2CppType.Of<T>());
T* componentDataRawRW = (T*)((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, typeIndex);
return *componentDataRawRW;
}
public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity)
{
//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_0015: 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_0020: 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_002a: 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)
teamEntity = Entity.Null;
if (entity.TryGetComponent<TeamReference>(out TeamReference componentData))
{
Entity value = componentData.Value._Value;
if (value.Exists())
{
teamEntity = value;
return true;
}
}
return false;
}
public static bool Exists(this Entity entity)
{
//IL_0000: 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_0010: Unknown result type (might be due to invalid IL or missing references)
if (entity.HasValue())
{
EntityManager entityManager = EntityManager;
return ((EntityManager)(ref entityManager)).Exists(entity);
}
return false;
}
public static bool HasValue(this Entity entity)
{
//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)
return entity != Entity.Null;
}
public static bool IsDisabled(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return entity.Has<Disabled>();
}
public static bool IsVBlood(this Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return entity.Has<VBloodUnit>();
}
public static ulong GetSteamId(this Entity entity)
{
//IL_0000: 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_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_0025: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData))
{
return componentData.UserEntity.Read<User>().PlatformId;
}
if (entity.TryGetComponent<User>(out User componentData2))
{
return componentData2.PlatformId;
}
return 0uL;
}
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (T item in source)
{
action(item);
}
}
public static PrefabGUID GetPrefabGuid(this Entity entity)
{
//IL_0000: 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_000a: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData))
{
return componentData;
}
return PrefabGUID.Empty;
}
public static string GetNamePrefab(this PrefabGUID prefabGuid)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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)
ServerGameManager serverGameManager = Core.ServerGameManager;
return ((PrefabLookupMap)(ref serverGameManager.PrefabLookupMap)).GetName(prefabGuid);
}
public static string GetPrefabGuidName(this Entity entity)
{
//IL_0000: 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)
if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData))
{
PrefabLookupMap prefabLookupMap = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>()._PrefabLookupMap;
return ((PrefabLookupMap)(ref prefabLookupMap)).GetName(componentData);
}
return "Failed to get name";
}
public static bool IsEmpty(this Entity entity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return ((Entity)(ref entity)).Equals(Entity.Null);
}
public static Entity GetUserEntity(this Entity entity)
{
//IL_0000: 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_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_0028: 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)
if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData))
{
return componentData.UserEntity;
}
if (entity.TryGetComponent<UserOwner>(out UserOwner componentData2))
{
return ((NetworkedEntity)(ref componentData2.Owner)).GetEntityOnServer();
}
return Entity.Null;
}
public static User GetUser(this Entity entity)
{
//IL_0000: 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_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_0027: 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_0019: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData) && componentData.UserEntity.TryGetComponent<User>(out User componentData2))
{
return componentData2;
}
if (entity.TryGetComponent<User>(out componentData2))
{
return componentData2;
}
return User.Empty;
}
public static int GetTerritoryIndex(this Entity entity)
{
//IL_0000: 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)
if (entity.TryGetComponent<CastleTerritory>(out CastleTerritory componentData))
{
return componentData.CastleTerritoryIndex;
}
return -1;
}
public static void Destroy(this Entity entity)
{
//IL_0000: 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)
if (entity.Exists())
{
DestroyUtility.Destroy(EntityManager, entity, (DestroyDebugReason)0, (string)null, 0);
}
}
public static void DestroyBuff(this Entity entity)
{
//IL_0000: 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)
if (entity.Exists())
{
DestroyUtility.Destroy(EntityManager, entity, (DestroyDebugReason)13, (string)null, 0);
}
}
public static NetworkId GetNetworkId(this Entity entity)
{
//IL_0000: 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_000a: Unknown result type (might be due to invalid IL or missing references)
if (entity.TryGetComponent<NetworkId>(out NetworkId componentData))
{
return componentData;
}
return NetworkId.Empty;
}
public static Coroutine Start(this IEnumerator routine)
{
return Core.StartCoroutine(routine);
}
private static EntityQuery BuildEntityQuery(this EntityManager entityManager, ComponentType[] all)
{
//IL_0003: 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_001e: 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)
EntityQueryBuilder val = default(EntityQueryBuilder);
((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
foreach (ComponentType val2 in all)
{
((EntityQueryBuilder)(ref val)).AddAll(val2);
}
return ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val);
}
private static EntityQuery BuildEntityQuery(this EntityManager entityManager, ComponentType[] all, EntityQueryOptions options)
{
//IL_0003: 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_001e: 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_003b: Unknown result type (might be due to invalid IL or missing references)
EntityQueryBuilder val = default(EntityQueryBuilder);
((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
foreach (ComponentType val2 in all)
{
((EntityQueryBuilder)(ref val)).AddAll(val2);
}
((EntityQueryBuilder)(ref val)).WithOptions(options);
return ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val);
}
private static EntityQuery BuildEntityQuery(this EntityManager entityManager, ComponentType[] all, ComponentType[] none, EntityQueryOptions options)
{
//IL_0003: 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_001e: 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_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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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)
EntityQueryBuilder val = default(EntityQueryBuilder);
((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2));
ComponentType[] array = all;
foreach (ComponentType val2 in array)
{
((EntityQueryBuilder)(ref val)).AddAll(val2);
}
array = none;
foreach (ComponentType val3 in array)
{
((EntityQueryBuilder)(ref val)).AddNone(val3);
}
((EntityQueryBuilder)(ref val)).WithOptions(options);
return ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val);
}
private static int[] GenerateDefaultIndices(int length)
{
int[] array = new int[length];
for (int i = 0; i < length; i++)
{
array[i] = i;
}
return array;
}
public static float3 GetPosition(this Entity entity)
{
//IL_0000: 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_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)
if (entity.TryGetComponent<Translation>(out Translation componentData))
{
return componentData.Value;
}
return float3.zero;
}
public static int2 GetCoordinate(this Entity entity)
{
//IL_0000: 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_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)
if (entity.TryGetComponent<TilePosition>(out TilePosition componentData))
{
return componentData.Tile;
}
return int2.zero;
}
}
[BepInPlugin("VComforts", "VComforts", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
public static Harmony Harmony;
public static bool HasInitialized;
public static ManualLogSource LogInstance { get; private set; }
public override void Load()
{
LogInstance = ((BasePlugin)this).Log;
Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
Settings.Initialize(((BasePlugin)this).Config);
if (Application.productName == "VRising")
{
((BasePlugin)this).Log.LogWarning((object)"This plugin is a server-only plugin!");
}
}
public static void Initialize()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
if (!(Application.productName == "VRising") && !HasInitialized)
{
ManualLogSource logInstance = LogInstance;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("VComforts");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
logInstance.LogInfo(val);
if (Commands.Enabled)
{
Commands.Register();
}
else
{
LogInstance.LogInfo((object)"This mod has extra commands for spawning respawnpoints. Install VampireCommandFramework to use them.");
}
HasInitialized = true;
}
}
public override bool Unload()
{
Commands.Unregister();
Harmony harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
HasInitialized = false;
return true;
}
}
public static class Settings
{
public static ConfigEntry<bool> ENABLE_BLOODMIXER_EXTRA_BOTTLE { get; private set; }
public static ConfigEntry<bool> ENABLE_AUTOFISH { get; private set; }
public static ConfigEntry<bool> ENABLE_CARRIAGE_TRACKING { get; private set; }
public static ConfigEntry<bool> ENABLE_LEVEL_BONUS { get; private set; }
public static ConfigEntry<string> LEVEL_BONUS_MULTIPLIER_STRING { get; private set; }
public static List<float> LEVEL_BONUS_MULTIPLIER { get; private set; }
public static ConfigEntry<bool> ENABLE_INVENTORY_BONUS { get; private set; }
public static ConfigEntry<string> BAG_INVENTORY_BONUS_MULTIPLIER_STRING { get; private set; }
public static List<float> BAG_INVENTORY_BONUS_MULTIPLIER { get; private set; }
public static ConfigEntry<bool> ENABLE_CUSTOM_BLOODPOTION_SORTING { get; private set; }
public static ConfigEntry<bool> ENABLE_CUSTOM_BLOODPOTION_SORTING_PLAYER { get; private set; }
public static ConfigEntry<bool> CUSTOM_BLOODPOTION_SORTING_PRIMARYTHENQUALITY { get; private set; }
public static ConfigEntry<bool> ENABLE_RESPAWN_POINTS { get; private set; }
public static ConfigEntry<bool> ENABLE_NONADMIN_RESPAWNPOINT_SPAWNING { get; private set; }
public static ConfigEntry<bool> ENABLE_RESPAWN_POINT_BREAKAGE { get; private set; }
public static ConfigEntry<bool> ENABLE_PREDEFINED_RESPAWN_POINTS { get; private set; }
public static ConfigEntry<int> RESPAWN_POINT_COST_AMOUNT { get; private set; }
public static ConfigEntry<int> RESPAWN_POINT_COST_ITEM_PREFAB { get; private set; }
public static ConfigEntry<int> RESPAWN_POINT_PREFAB { get; private set; }
public static ConfigEntry<int> RESPAWN_TRAVEL_DELAY_PREFAB { get; private set; }
public static ConfigEntry<int> RESPAWN_POINT_LIMIT { get; private set; }
internal static void Initialize(ConfigFile config)
{
ENABLE_BLOODMIXER_EXTRA_BOTTLE = config.Bind<bool>("BloodMixer", "enableBloodmixerExtraBottle", false, "If enabled gives you a glass bottle back when mixing 2 blood potions.");
ENABLE_AUTOFISH = config.Bind<bool>("Fishing", "enableAutoFish", false, "If enabled fish will automatically be caught whenever a splash happens");
ENABLE_CARRIAGE_TRACKING = config.Bind<bool>("Carriage", "enableCarriageTracking", false, "If enabled carriages will be tracked and shown on the map.");
ENABLE_LEVEL_BONUS = config.Bind<bool>("LevelBonus", "enableLevelBonus", false, "If enabled you will get a bonus to your stats based on your level, value defined below.");
LEVEL_BONUS_MULTIPLIER_STRING = config.Bind<string>("LevelBonus", "levelBonusMultiplier", "0.005,0.003,0.0035", "Sets the level bonus multiplier per level for each stat in the following order: resourceYieldBonus, moveSpeedBonus, shapeshiftMoveSpeedBonus");
LEVEL_BONUS_MULTIPLIER = (from s in LEVEL_BONUS_MULTIPLIER_STRING.Value.Split(',')
select float.Parse(s.Trim(), CultureInfo.InvariantCulture)).ToList();
ENABLE_INVENTORY_BONUS = config.Bind<bool>("InventoryBonus", "enableInventoryBonus", false, "If enabled you will get a bonus to your inventory stack size based on your equipped bag, value defined below.");
BAG_INVENTORY_BONUS_MULTIPLIER_STRING = config.Bind<string>("InventoryBonus", "bagInventoryBonusMultiplier", "1.05,1.10,1.15,1.20,1.25,1.30", "Sets the inventory bonus multiplier per level for each bag in the following order: resourceYieldBonus, moveSpeedBonus, shapeshiftMoveSpeedBonus");
BAG_INVENTORY_BONUS_MULTIPLIER = (from s in BAG_INVENTORY_BONUS_MULTIPLIER_STRING.Value.Split(',')
select float.Parse(s.Trim(), CultureInfo.InvariantCulture)).ToList();
ENABLE_CUSTOM_BLOODPOTION_SORTING = config.Bind<bool>("BloodPotionSorting", "enableCustomBloodPotionSorting", false, "If enabled blood potions will be sorted by primary blood type and then by quality.");
ENABLE_CUSTOM_BLOODPOTION_SORTING_PLAYER = config.Bind<bool>("BloodPotionSorting", "enableCustomBloodPotionSortingPlayer", false, "If enabled, blood potions will also use the custom sorting in the player inventory.");
CUSTOM_BLOODPOTION_SORTING_PRIMARYTHENQUALITY = config.Bind<bool>("BloodPotionSorting", "customBloodPotionSortingPrimaryThenQuality", true, "If enabled, blood potions are sorted first by primary blood type (A-Z), then by quality (highest to lowest). If disabled, potions with only a primary blood type are listed first (sorted A-Z, highest quality first), followed by mixed potions (those with a secondary type), also sorted by primary type and quality.");
ENABLE_RESPAWN_POINTS = config.Bind<bool>("Respawn", "enableRespawnPoint", false, "If enabled admins can spawn a custom respawn point by using the command '.rps sp' and user can then use set it as a respawn point using '.rsp set' this will only work when near the respawnpoint.");
ENABLE_NONADMIN_RESPAWNPOINT_SPAWNING = config.Bind<bool>("Respawn", "enableNonAdminRespawnPointSpawning", false, "If enabled non admins can also spawn a respawnpoint limited to X amount defined below.");
ENABLE_PREDEFINED_RESPAWN_POINTS = config.Bind<bool>("Respawn", "enablePredefinedRespawnPoints", false, "If enabled a json file in '\\BepInEx\\config\\Respawns\\respawns.json' can be edited with a list of coordinates where the respawnpoints will be placed, each player will then get ownership of each instance of a respawnpoint at those locations (if a player logs in another instance of the respawnpoint will be created at the same location and vice versa when logging out).");
ENABLE_RESPAWN_POINT_BREAKAGE = config.Bind<bool>("Respawn", "enableRespawnPointBreakage", false, "If enabled respawn points will break after 1 use, best used with 'ENABLE_NONADMIN_RESPAWNPOINT_SPAWNING' as predefined portals will not just respawn. (changes the AB_Interact prefab to the waygate one that creates and explosion which breaks the respawnpoint, PS: do not place respawnpoints near other respawnpoints as they will break each other, I will fix this if I can find a way.)");
RESPAWN_POINT_LIMIT = config.Bind<int>("Respawn", "respawnPointLimit", 1, "Sets the limit of respawn points that can be spawned by non admins. (if 0 it will not limit anything!)");
RESPAWN_POINT_COST_AMOUNT = config.Bind<int>("Respawn", "respawnPointCostAmount", 1, "If above 0, respawn points will cost X amount of prefabitem defined below. (if 0 it will not cost anything)");
RESPAWN_POINT_COST_ITEM_PREFAB = config.Bind<int>("Respawn", "respawnPointCostItemPrefab", 271594022, "Sets the item required in the users inventory to spawn a respawnpoint. (this is the prefab item id)");
RESPAWN_POINT_PREFAB = config.Bind<int>("Respawn", "respawnPointPrefab", -55079755, "Sets the prefab id of the respawn point prefab. (this is TM_Castle_ObjectDecor_GardenLampPost01_Orange) WARNING make sure the prefab has BlueprintData component otherwise players wont be able to respawn due to a client side error when trying to get the BlueprintData of the respawnpoint.");
RESPAWN_TRAVEL_DELAY_PREFAB = config.Bind<int>("Respawn", "respawnAnimationPrefab", 1290990039, "Sets the prefab id of the respawn animation prefab. (this is StoneCoffinSpawn_Travel_Delay) there are 2 others that are usable you can find them in the prefab list on the Vrising modding wiki, make sure the name contains Travel_Delay (AB_Interact_WaypointSpawn_Travel_Delay is not usable as it is already set when 'ENABLE_RESPAWN_POINT_BREAKAGE' is true).");
}
}
public class BuffUtil
{
public static EntityManager entityManager = Core.EntityManager;
public static PrefabGUID InCombat = Prefabs.Buff_InCombat;
public static PrefabGUID InCombat_PvP = Prefabs.Buff_InCombat_PvPVampire;
public static bool IsPlayerInCombat(Entity player)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_000b: 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_0022: Unknown result type (might be due to invalid IL or missing references)
if (!BuffUtility.HasBuff<EntityManager>(entityManager, player, PrefabIdentifier.op_Implicit(InCombat)))
{
return BuffUtility.HasBuff<EntityManager>(entityManager, player, PrefabIdentifier.op_Implicit(InCombat_PvP));
}
return true;
}
public static bool AddBuff(Entity Character, PrefabGUID buffPrefab, int duration = 0, bool immortal = false)
{
//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)
Entity val = default(Entity);
return BuffUtil.BuffEntity(Character, buffPrefab, ref val, (float)duration, immortal);
}
public static void RemoveBuff(Entity Character, PrefabGUID buffPrefab)
{
//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)
BuffUtil.RemoveBuff(Character, buffPrefab);
}
}
public static class ItemUtil
{
public struct InventoryItemInfo
{
public Entity ItemEntity;
public int Amount;
}
private static ManualLogSource _log => Plugin.LogInstance;
private static NativeArray<Entity> GetItems()
{
//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_001b: Expected O, but got Unknown
//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_0030: 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_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)
//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_0071: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = Core.Server.EntityManager;
EntityQueryDesc[] array = new EntityQueryDesc[1];
EntityQueryDesc val = new EntityQueryDesc();
val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2]
{
ComponentType.ReadOnly<LocalToWorld>(),
ComponentType.ReadOnly<ItemPickup>()
});
val.None = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<DestroyTag>() });
array[0] = val;
EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
return ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
}
internal static List<Entity> ClosestItems(Entity entity, float radius)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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)
//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_0023: 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_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_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_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_004a: 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_0051: 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_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_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_0072: Unknown result type (might be due to invalid IL or missing references)
try
{
NativeArray<Entity> items = GetItems();
List<Entity> list = new List<Entity>();
EntityManager entityManager = Core.Server.EntityManager;
LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(entity);
float3 position = ((LocalToWorld)(ref componentData)).Position;
Enumerator<Entity> enumerator = items.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
entityManager = Core.Server.EntityManager;
componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(current);
float3 position2 = ((LocalToWorld)(ref componentData)).Position;
if (Vector3.Distance(float3.op_Implicit(position), float3.op_Implicit(position2)) < radius)
{
list.Add(current);
}
}
return list;
}
catch (Exception)
{
return new List<Entity>();
}
}
public static bool TryGiveItem(EntityManager entityManager, NativeParallelHashMap<PrefabGUID, ItemData>? itemDataMap, Entity recipient, PrefabGUID itemType, int amount, out int remainingitems, bool dropRemainder = false)
{
//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_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)
//IL_0034: 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_003d: 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_004a: 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_0057: 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_0062: 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_0020: 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)
NativeParallelHashMap<PrefabGUID, ItemData> valueOrDefault = itemDataMap.GetValueOrDefault();
if (!itemDataMap.HasValue)
{
valueOrDefault = Core.Server.GetExistingSystemManaged<GameDataSystem>().ItemHashLookupMap;
itemDataMap = valueOrDefault;
}
AddItemResponse val = InventoryUtilitiesServer.TryAddItem(AddItemSettings.Create(entityManager, itemDataMap.Value, false, default(Entity), default(Nullable_Unboxed<int>), false, false, dropRemainder, default(Nullable_Unboxed<int>)), recipient, itemType, amount);
remainingitems = val.RemainingAmount;
return ((AddItemResponse)(ref val)).Success;
}
public static bool AddItemToInventory(Entity recipient, PrefabGUID itemType, int amount, Entity recipientUser = default(Entity))
{
//IL_000b: 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_0019: 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_0028: 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_0034: 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_003b: 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)
try
{
GameDataSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<GameDataSystem>();
InventoryUtilitiesServer.TryAddItem(AddItemSettings.Create(Core.EntityManager, existingSystemManaged.ItemHashLookupMap, false, default(Entity), default(Nullable_Unboxed<int>), false, false, true, default(Nullable_Unboxed<int>)), recipient, itemType, amount);
return true;
}
catch (Exception ex)
{
_log.LogError((object)ex.Message);
return false;
}
}
public static List<InventoryItemInfo> GetInventoryItemInfos(Entity mixer, PrefabGUID valueMixedBloodPotionPrefab)
{
//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_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_002d: 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_0046: 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_0052: Unknown result type (might be due to invalid IL or missing references)
List<InventoryItemInfo> list = new List<InventoryItemInfo>();
int inventorySize = InventoryUtilities.GetInventorySize<EntityManager>(Core.EntityManager, mixer);
InventoryBuffer val = default(InventoryBuffer);
for (int i = 0; i < inventorySize; i++)
{
if (InventoryUtilities.TryGetItemAtSlot<EntityManager>(Core.EntityManager, mixer, i, ref val) && ((PrefabGUID)(ref val.ItemType)).Equals(valueMixedBloodPotionPrefab))
{
list.Add(new InventoryItemInfo
{
ItemEntity = val.ItemEntity._Entity,
Amount = val.Amount
});
}
}
return list;
}
public static bool TryConsumeRequiredItems(ChatCommandContext ctx, out string message)
{
//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_0022: 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_004a: 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_0051: 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_00cb: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_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_0084: 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_009c: 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_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)
try
{
PrefabGUID val = default(PrefabGUID);
((PrefabGUID)(ref val))..ctor(Settings.RESPAWN_POINT_COST_ITEM_PREFAB.Value);
Entity senderCharacterEntity = ctx.Event.SenderCharacterEntity;
int inventorySize = InventoryUtilities.GetInventorySize<EntityManager>(Core.EntityManager, senderCharacterEntity);
int num = Settings.RESPAWN_POINT_COST_AMOUNT.Value;
InventoryBuffer val2 = default(InventoryBuffer);
for (int i = 0; i < inventorySize; i++)
{
if (InventoryUtilities.TryGetItemAtSlot<EntityManager>(Core.EntityManager, senderCharacterEntity, i, ref val2) && val2.ItemType == val)
{
if (val2.Amount >= num)
{
InventoryUtilitiesServer.TryRemoveItemAtIndex(Core.EntityManager, senderCharacterEntity, val2.ItemType, num, i, false);
num = 0;
break;
}
InventoryUtilitiesServer.TryRemoveItemAtIndex(Core.EntityManager, senderCharacterEntity, val2.ItemType, val2.Amount, i, true);
num -= val2.Amount;
}
}
if (num > 0)
{
message = "You do not have enough of " + val.GetNamePrefab() + " to spawn a respawn point.";
AddItemToInventory(senderCharacterEntity, val, Settings.RESPAWN_POINT_COST_AMOUNT.Value - num);
return false;
}
message = string.Empty;
return true;
}
catch (Exception ex)
{
message = "An error occurred while checking inventory: " + ex.Message;
return false;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "VComforts";
public const string PLUGIN_NAME = "VComforts";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace VComforts.Utils
{
public class DelayedUtil
{
public static void RunLevelBuffsDelayed(Entity character)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
Core.StartCoroutine(DelayedHandleLevelBuffs(character));
}
private static IEnumerator DelayedHandleLevelBuffs(Entity character)
{
//IL_0007: 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)
yield return (object)new WaitForSeconds(0.1f);
BonusSystem.HandleLevelBuffs(character);
}
}
public class MapIconUtil
{
public static void SpawnMapIcon(PrefabGUID unitPrefab, float3 position, Entity targetEntity)
{
//IL_0007: 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_000e: Unknown result type (might be due to invalid IL or missing references)
SpawnService.SpawnUnitWithCallback(unitPrefab, position, -1f, (Action<Entity>)delegate(Entity entity)
{
//IL_0000: 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_0008: 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_0029: 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_0030: 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_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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0016: 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_0054: 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_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_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_007c: 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_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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_00ef: 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_00f5: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
if (!entity.Has<MapIconData>())
{
entity.Add<MapIconData>();
}
if (entity.Has<LifeTime>())
{
entity.Remove<LifeTime>();
}
Attach componentData = default(Attach);
((Attach)(ref componentData))..ctor(targetEntity);
entity.Add<Attach>();
entity.Write<Attach>(componentData);
MapIconData componentData2 = entity.Read<MapIconData>();
componentData2.RequiresReveal = false;
entity.Write<MapIconData>(componentData2);
if (!entity.Has<OnlySyncToUsersTag>())
{
entity.Add<OnlySyncToUsersTag>();
}
if (!entity.Has<MapIconTargetEntity>())
{
entity.Add<MapIconTargetEntity>();
}
MapIconTargetEntity componentData3 = entity.Read<MapIconTargetEntity>();
componentData3.TargetEntity = NetworkedEntity.ServerEntity(targetEntity);
componentData3.TargetNetworkId = targetEntity.Read<NetworkId>();
entity.Write<MapIconTargetEntity>(componentData3);
if (!entity.Has<NameableInteractable>())
{
entity.Add<NameableInteractable>();
}
NameableInteractable val = entity.Read<NameableInteractable>();
FixedString64Bytes name = val.Name;
val.Name = new FixedString64Bytes(((object)(FixedString64Bytes)(ref name)).ToString() + "_icon");
entity.Write<NameableInteractable>(val);
if (!entity.Has<PlayerMapIcon>())
{
entity.Add<PlayerMapIcon>();
}
PlayerMapIcon componentData4 = entity.Read<PlayerMapIcon>();
componentData4.UserName = val.Name;
entity.Write<PlayerMapIcon>(componentData4);
entity.Write<LocalToWorld>(targetEntity.Read<LocalToWorld>());
entity.Write<Translation>(targetEntity.Read<Translation>());
});
}
public static void UpdateIcons()
{
//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_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_0018: 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_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_0027: 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_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_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_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_0058: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_00be: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<MapIconTargetEntity>());
EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2);
EntityManager entityManager = Core.EntityManager;
EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2);
Enumerator<Entity> enumerator = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
PrefabGUID val4 = current.Read<PrefabGUID>();
if (!((PrefabGUID)(ref val4)).Equals(Prefabs.MapIcon_POI_Discover_Merchant))
{
continue;
}
Entity parent = current.Read<Attach>().Parent;
if (!parent.GetPrefabGuidName().ToLower().StartsWith("char_carriage"))
{
break;
}
if (parent.Has<NameableInteractable>())
{
NameableInteractable val5 = parent.Read<NameableInteractable>();
if (current.Has<PlayerMapIcon>())
{
PlayerMapIcon componentData = current.Read<PlayerMapIcon>();
componentData.UserName = val5.Name;
current.Write<PlayerMapIcon>(componentData);
}
}
}
}
}
}
namespace VComforts.Systems
{
public static class BonusSystem
{
private const float BaseResourceYield = 1f;
private const float BaseMoveSpeedBonus = 0f;
private const float BaseShapeshiftMoveSpeedBonus = 0f;
private static int GetPlayerLevel(this Equipment equipment)
{
return (int)Math.Round(((Equipment)(ref equipment)).GetFullLevel());
}
public static void HandleLevelBuffs(Entity entity, bool overrideResetLevel = false)
{
//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_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_005e: 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_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_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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_009c: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00db: 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_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: 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_029f: Unknown result type (might be due to invalid IL or missing references)
Equipment equipment = entity.Read<Equipment>();
VampireSpecificAttributes val = entity.Read<VampireSpecificAttributes>();
int playerLevel = equipment.GetPlayerLevel();
if (Settings.LEVEL_BONUS_MULTIPLIER.Count != 3)
{
Plugin.LogInstance.LogError((object)"LEVEL_BONUS_MULTIPLIER must have 3 values!");
return;
}
float num = (float)playerLevel * Settings.LEVEL_BONUS_MULTIPLIER[0];
float num2 = (float)playerLevel * Settings.LEVEL_BONUS_MULTIPLIER[1];
float num3 = (float)playerLevel * Settings.LEVEL_BONUS_MULTIPLIER[2];
PlayerBonusData playerBonusData = BonusTrackerDatabase.Load(entity.GetUser().PlatformId);
if (playerBonusData == null)
{
playerBonusData = new PlayerBonusData
{
OriginalResourceYield = (Mathf.Approximately(val.ResourceYieldModifier._Value, 1f) ? val.ResourceYieldModifier._Value : 1f),
OriginalMoveSpeed = (Mathf.Approximately(val.BonusMovementSpeed._Value, 0f) ? val.BonusMovementSpeed._Value : 0f),
OriginalShapeshiftMoveSpeed = (Mathf.Approximately(val.BonusShapeshiftMovementSpeed._Value, 0f) ? val.BonusShapeshiftMovementSpeed._Value : 0f)
};
}
if (overrideResetLevel)
{
val.ResourceYieldModifier._Value = ((playerBonusData.OriginalResourceYield != 0f) ? playerBonusData.OriginalResourceYield : 1f);
val.BonusMovementSpeed._Value = ((playerBonusData.OriginalMoveSpeed != 0f) ? playerBonusData.OriginalMoveSpeed : 0f);
val.BonusShapeshiftMovementSpeed._Value = ((playerBonusData.OriginalShapeshiftMoveSpeed != 0f) ? playerBonusData.OriginalShapeshiftMoveSpeed : 0f);
BonusTrackerDatabase.Delete(entity.GetUser().PlatformId);
}
else
{
float num4 = playerBonusData.OriginalResourceYield + num;
if (!Mathf.Approximately(val.ResourceYieldModifier._Value, num4) || !Mathf.Approximately(playerBonusData.LastResourceYieldBonus, num))
{
val.ResourceYieldModifier._Value = playerBonusData.OriginalResourceYield + num;
playerBonusData.LastResourceYieldBonus = num;
}
num4 = playerBonusData.OriginalMoveSpeed + num2;
if (!Mathf.Approximately(val.BonusMovementSpeed._Value, num4) || !Mathf.Approximately(playerBonusData.LastMoveSpeedBonus, num2))
{
val.BonusMovementSpeed._Value = playerBonusData.OriginalMoveSpeed + num2;
playerBonusData.LastMoveSpeedBonus = num2;
}
num4 = playerBonusData.OriginalShapeshiftMoveSpeed + num3;
if (!Mathf.Approximately(val.BonusShapeshiftMovementSpeed._Value, num4) || !Mathf.Approximately(playerBonusData.LastShapeshiftMoveSpeedBonus, num3))
{
val.BonusShapeshiftMovementSpeed._Value = playerBonusData.OriginalShapeshiftMoveSpeed + num3;
playerBonusData.LastShapeshiftMoveSpeedBonus = num3;
}
BonusTrackerDatabase.Save(entity.GetUser().PlatformId, playerBonusData);
}
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<VampireSpecificAttributes>(entity, val);
}
public static void HandleInventoryBuffsOld(Entity entity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000a: 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_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_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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_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_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_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_007e: 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)
EntityManager entityManager = Core.EntityManager;
DynamicBuffer<InventoryInstanceElement> buffer = ((EntityManager)(ref entityManager)).GetBuffer<InventoryInstanceElement>(entity, false);
if (Settings.BAG_INVENTORY_BONUS_MULTIPLIER.Count != 6)
{
Plugin.LogInstance.LogError((object)"BAG_INVENTORY_BONUS_MULTIPLIER must have 6 values!");
return;
}
Enumerator<InventoryInstanceElement> enumerator = buffer.GetEnumerator();
while (enumerator.MoveNext())
{
NetworkedEntity externalInventoryEntity = enumerator.Current.ExternalInventoryEntity;
if (((NetworkedEntity)(ref externalInventoryEntity)).GetSyncedEntityOrNull() == Entity.Null)
{
continue;
}
entityManager = Core.EntityManager;
DynamicBuffer<InventoryBuffer> buffer2 = ((EntityManager)(ref entityManager)).GetBuffer<InventoryBuffer>(((NetworkedEntity)(ref externalInventoryEntity)).GetSyncedEntityOrNull(), false);
for (int i = 0; i < buffer2.Length; i++)
{
InventoryBuffer val = buffer2[i];
if (val.MaxAmountOverride != 0)
{
val.MaxAmountOverride = 0;
}
buffer2[i] = val;
}
}
}
public static float GetBagMultiplier(Entity playerCharacter)
{
//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_002a: 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_0035: 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_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)
//IL_0067: 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_00af: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
if (Settings.BAG_INVENTORY_BONUS_MULTIPLIER.Count != 6)
{
Plugin.LogInstance.LogError((object)"BAG_INVENTORY_BONUS_MULTIPLIER must have 6 values! Setting multiplier to 1");
return 1f;
}
EntityManager entityManager = Core.EntityManager;
EquipmentSlot bagSlot = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(playerCharacter).BagSlot;
float result = 1f;
if (bagSlot.IsBroken)
{
return result;
}
if (((NetworkedEntity)(ref bagSlot.SlotEntity)).GetSyncedEntityOrNull() == Entity.Null)
{
return result;
}
if (((PrefabGUID)(ref bagSlot.SlotId)).Equals(Prefabs.Item_NewBag_T01))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[0];
}
else if (((PrefabGUID)(ref bagSlot.SlotId)).Equals(Prefabs.Item_NewBag_T02))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[1];
}
else if (((PrefabGUID)(ref bagSlot.SlotId)).Equals(Prefabs.Item_NewBag_T03))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[2];
}
else if (((PrefabGUID)(ref bagSlot.SlotId)).Equals(Prefabs.Item_NewBag_T04))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[3];
}
else if (((PrefabGUID)(ref bagSlot.SlotId)).Equals(Prefabs.Item_NewBag_T05))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[4];
}
else if (((PrefabGUID)(ref bagSlot.SlotId)).Equals(Prefabs.Item_NewBag_T06))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[5];
}
return result;
}
public static float GetBagMultiplierByPrefab(PrefabGUID prefab)
{
//IL_002a: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
if (Settings.BAG_INVENTORY_BONUS_MULTIPLIER.Count != 6)
{
Plugin.LogInstance.LogError((object)"BAG_INVENTORY_BONUS_MULTIPLIER must have 6 values! Setting multiplier to 1");
return 1f;
}
float result = 1f;
if (((PrefabGUID)(ref prefab)).Equals(Prefabs.Item_NewBag_T01))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[0];
}
else if (((PrefabGUID)(ref prefab)).Equals(Prefabs.Item_NewBag_T02))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[1];
}
else if (((PrefabGUID)(ref prefab)).Equals(Prefabs.Item_NewBag_T03))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[2];
}
else if (((PrefabGUID)(ref prefab)).Equals(Prefabs.Item_NewBag_T04))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[3];
}
else if (((PrefabGUID)(ref prefab)).Equals(Prefabs.Item_NewBag_T05))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[4];
}
else if (((PrefabGUID)(ref prefab)).Equals(Prefabs.Item_NewBag_T06))
{
result = Settings.BAG_INVENTORY_BONUS_MULTIPLIER[5];
}
return result;
}
}
public class RespawnPointSpawnerSystem
{
private readonly RespawnPointFactory _respawnPointFactory = new RespawnPointFactory();
private readonly RespawnPointManager _respawnPointManager = new RespawnPointManager();
public bool SpawnRespawnPoint(float3 position, quaternion rotation, Entity character, Entity user)
{
//IL_0006: 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_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)
return _respawnPointFactory.CreateRespawnPoint(position, rotation, character, user);
}
public bool RemoveRespawnPoint(float3 position, Entity user, bool isAdmin, bool keepAssignedRespawnPoint = false)
{
//IL_0006: 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)
return _respawnPointManager.RemoveRespawnPoint(position, user, isAdmin, keepAssignedRespawnPoint);
}
public bool SetRespawnPoint(float3 position, Entity user, bool isAdmin)
{
//IL_0006: 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)
return _respawnPointManager.SetRespawnPoint(position, user, isAdmin);
}
}
}
namespace VComforts.Services
{
public class CastleHeartService
{
private struct HeartInfo
{
public Entity CastleHeart;
}
private Dictionary<Entity, HeartInfo> fallbackHeart = new Dictionary<Entity, HeartInfo>();
public void GetFallbackCastleHeart(Entity charEntity, out Entity castleHeartEntity)
{
//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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0022: 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_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_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_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_0052: 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_0059: 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_0062: 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_0082: 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_008e: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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)
castleHeartEntity = Entity.Null;
if (fallbackHeart.TryGetValue(charEntity, out var value))
{
castleHeartEntity = value.CastleHeart;
MakeHeartUsableEverywhere(castleHeartEntity);
}
else
{
if (!charEntity.Has<TeamReference>())
{
return;
}
ModifiableEntity value2 = charEntity.Read<TeamReference>().Value;
EntityManager entityManager = Core.EntityManager;
Enumerator<TeamAllies> enumerator = ((EntityManager)(ref entityManager)).GetBuffer<TeamAllies>(ModifiableEntity.op_Implicit(value2), false).GetEnumerator();
while (enumerator.MoveNext())
{
Entity value3 = enumerator.Current.Value;
if (value3.Has<CastleTeamData>())
{
castleHeartEntity = value3.Read<CastleTeamData>().CastleHeart;
MakeHeartUsableEverywhere(castleHeartEntity);
fallbackHeart.TryAdd(charEntity, new HeartInfo
{
CastleHeart = castleHeartEntity
});
break;
}
}
}
static void MakeHeartUsableEverywhere(Entity heartEntity)
{
//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_000e: 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_0016: 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_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_0037: 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_004e: 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)
if (!(heartEntity == Entity.Null))
{
if (heartEntity.Has<SyncBoundingBox>())
{
heartEntity.Remove<SyncBoundingBox>();
}
if (!heartEntity.Has<SyncToUserBitMask>())
{
heartEntity.Add<SyncToUserBitMask>();
heartEntity.Write<SyncToUserBitMask>(new SyncToUserBitMask
{
Value = new UserBitMask128
{
_Value = new int4(-1, -1, -1, -1)
}
});
}
}
}
}
}
}
namespace VComforts.Patches
{
[HarmonyPatch(typeof(BloodMixerSystem_Update), "OnUpdate")]
public class BloodMixerSystem_UpdatePatch
{
private static PrefabGUID glassBottlePrefabGuid = new PrefabGUID(-437611596);
private static Dictionary<Entity, (BloodMixerState prevState, HashSet<Entity> prevPotionEntities)> mixerState = new Dictionary<Entity, (BloodMixerState, HashSet<Entity>)>();
private static void Postfix(BloodMixerSystem_Update __instance)
{
//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_001b: 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_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_002e: 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_003e: 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_0047: 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_004e: 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_0061: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Invalid comparison between Unknown and I4
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
if (Settings.ENABLE_BLOODMIXER_EXTRA_BOTTLE == null || !Settings.ENABLE_BLOODMIXER_EXTRA_BOTTLE.Value)
{
return;
}
EntityManager entityManager = Core.EntityManager;
EntityQuery query = __instance._Query;
Enumerator<Entity> enumerator = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator();
PrefabGUID valueMixedBloodPotionPrefab = default(PrefabGUID);
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
BloodMixerState state = ((EntityManager)(ref entityManager)).GetComponentData<BloodMixer_Shared>(current).State;
((PrefabGUID)(ref valueMixedBloodPotionPrefab))..ctor(2063723255);
List<ItemUtil.InventoryItemInfo> inventoryItemInfos = ItemUtil.GetInventoryItemInfos(current, valueMixedBloodPotionPrefab);
HashSet<Entity> hashSet = new HashSet<Entity>();
foreach (ItemUtil.InventoryItemInfo item in inventoryItemInfos)
{
hashSet.Add(item.ItemEntity);
}
if (mixerState.TryGetValue(current, out (BloodMixerState, HashSet<Entity>) value))
{
var (val, hashSet2) = value;
if ((int)val == 2 && (int)state == 0)
{
bool flag = false;
foreach (Entity item2 in hashSet)
{
if (!hashSet2.Contains(item2))
{
flag = true;
break;
}
}
if (flag)
{
ItemUtil.AddItemToInventory(current, glassBottlePrefabGuid, 1);
}
}
}
mixerState[current] = (state, hashSet);
}
}
}
[HarmonyPatch(typeof(BuffSystem_Spawn_Server), "OnUpdate")]
public static class BuffSystem_Spawn_Server_OnUpdate_Patch
{
private static DateTime _noUpdateBefore = DateTime.MinValue;
private static readonly PrefabGUID MarkerIcon = Prefabs.MapIcon_POI_Discover_Merchant;
private static void Postfix(BuffSystem_Spawn_Server __instance)
{
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: 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_004f: 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_005d: 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_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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_0095: 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_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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_00c7: 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_00d0: 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_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_0442: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0455: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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_045b: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: 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_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: Unknown result type (might be due to invalid IL or missing references)
//IL_0499: Unknown result type (might be due to invalid IL or missing references)
//IL_049e: Unknown result type (might be due to invalid IL or missing references)
//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04b5: 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)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: 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_01bc: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: 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_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_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (mig