using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ServantForge.Systems;
using ServantForge.Utils;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using VampireCommandFramework;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ServantForge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Increase MaxServantProficiency for a cost.")]
[assembly: AssemblyFileVersion("0.1.10.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e.973bcfb7eb72e2644030042aaef5060b887d85b3")]
[assembly: AssemblyProduct("ServantForge")]
[assembly: AssemblyTitle("ServantForge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.10.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ServantForge
{
[BepInPlugin("ServantForge", "ServantForge", "0.1.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ServantForgePlugin : BasePlugin
{
private Harmony _harmony;
public static ManualLogSource LogInstance { get; private set; }
public override void Load()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
LogInstance = ((BasePlugin)this).Log;
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ServantForge");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loading...");
}
log.LogInfo(val);
ServantForgeConfig.Initialize(((BasePlugin)this).Config);
_harmony = new Harmony("ServantForge");
_harmony.PatchAll();
CommandRegistry.RegisterAll();
ManualLogSource log2 = ((BasePlugin)this).Log;
val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ServantForge");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.1.10");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log2.LogInfo(val);
}
public override bool Unload()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
CommandRegistry.UnregisterAssembly();
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ServantForge");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is unloaded!");
}
log.LogInfo(val);
return true;
}
}
public static class ReloadConfigCommand
{
[Command("servantreload", null, null, "Reloads the ServantForge configuration.", null, true)]
public static void HandleReloadCommand(ChatCommandContext ctx)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
try
{
ServantForgeConfig.ReloadConfig();
ctx.Reply("<color=#00FF00>ServantForge config reloaded successfully!</color>");
}
catch (Exception ex)
{
ctx.Reply("<color=#FF0000>ServantForge config reload failed:</color> " + ex.Message);
if (ServantForgePlugin.LogInstance != null)
{
ManualLogSource logInstance = ServantForgePlugin.LogInstance;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(49, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error reloading ServantForge config via command: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logInstance.LogError(val);
}
}
}
}
internal static class ServantForgeConfig
{
private static ConfigFile _currentConfigFile;
public static ConfigEntry<float> ProficiencyIncrement { get; private set; }
public static ConfigEntry<float> MaxProficiency { get; private set; }
public static ConfigEntry<int> CostItemGUID { get; private set; }
public static ConfigEntry<int> CostItemAmount { get; private set; }
public static ConfigEntry<string> CostItemName { get; private set; }
public static void Initialize(ConfigFile config)
{
_currentConfigFile = config;
ProficiencyIncrement = _currentConfigFile.Bind<float>("ServantForge", "ProficiencyIncrement", 0.06f, "How much proficiency to add per purchase (e.g., 0.06 = +6%).");
MaxProficiency = _currentConfigFile.Bind<float>("ServantForge", "MaxProficiency", 0.44f, "Max servant proficiency (e.g., default is 0.44 = 44%).");
CostItemGUID = _currentConfigFile.Bind<int>("ServantForge", "CostItemGUID", -598100816, "PrefabGUID for the cost item to remove.");
CostItemAmount = _currentConfigFile.Bind<int>("ServantForge", "CostItemAmount", 300, "How many of that item must be removed each time.");
CostItemName = _currentConfigFile.Bind<string>("ServantForge", "CostItemName", "Thistle", "Friendly display name for the cost item (e.g., Thistle).");
}
public static void ReloadConfig()
{
if (_currentConfigFile != null)
{
_currentConfigFile.Reload();
if (ServantForgePlugin.LogInstance != null)
{
ServantForgePlugin.LogInstance.LogInfo((object)"ServantForge configuration reloaded.");
}
}
else if (ServantForgePlugin.LogInstance != null)
{
ServantForgePlugin.LogInstance.LogError((object)"ServantForge configuration could not be reloaded: ConfigFile reference is null.");
}
}
}
public static class UpgradeServantCommand
{
private const float MaxBlood = 100f;
private const string ColorHexSuccess = "00FF00";
private const string ColorHexError = "FF0000";
[Command("upgradeservant", "us", "Upgrades a fully converted servant's expertise, for a cost.", null, null, false)]
public static void OnUpgradeServant(ChatCommandContext ctx)
{
//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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Expected O, but got Unknown
//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_004c: 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)
//IL_0054: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Invalid comparison between Unknown and I4
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: 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_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
try
{
EntityManager entityManager = VWorldUtils.EntityManager;
if (!((EntityManager)(ref entityManager)).HasComponent<EntityAimData>(ctx.Event.SenderCharacterEntity))
{
ReplyColored(ctx, "Cannot read your aim/cursor data.", "FF0000");
return;
}
EntityAimData componentData = ((EntityManager)(ref entityManager)).GetComponentData<EntityAimData>(ctx.Event.SenderCharacterEntity);
float3 aimPosition = componentData.AimPosition;
Entity val = FindClosestTile<ServantCoffinstation>(entityManager, aimPosition, 2.5f);
if (val == Entity.Null)
{
ReplyColored(ctx, "No servant coffin at your cursor.", "FF0000");
return;
}
ServantCoffinstation componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<ServantCoffinstation>(val);
if ((int)componentData2.State != 7)
{
ReplyColored(ctx, "Servant is not fully converted yet.", "FF0000");
return;
}
float value = ServantForgeConfig.ProficiencyIncrement.Value;
float value2 = ServantForgeConfig.MaxProficiency.Value;
int value3 = ServantForgeConfig.CostItemGUID.Value;
int value4 = ServantForgeConfig.CostItemAmount.Value;
string value5 = ServantForgeConfig.CostItemName.Value;
float servantProficiency = componentData2.ServantProficiency;
if (servantProficiency >= value2)
{
ReplyColored(ctx, "You can't upgrade the servant's Expertise anymore!", "FF0000");
return;
}
PrefabGUID itemGuid = default(PrefabGUID);
((PrefabGUID)(ref itemGuid))..ctor(value3);
if (!ServantInventorySystem.HasEnoughItem(ctx.Event.SenderCharacterEntity, itemGuid, value4))
{
ReplyColored(ctx, $"You need {value4} {value5}.", "FF0000");
return;
}
if (!ServantInventorySystem.TryRemoveItem(ctx.Event.SenderCharacterEntity, itemGuid, value4))
{
ReplyColored(ctx, $"Failed to remove {value4} {value5} from your inventory.", "FF0000");
return;
}
float num = value2 - servantProficiency;
float num2 = ((num < value) ? num : value);
componentData2.ServantProficiency += num2;
componentData2.ServantProficiency = math.min(componentData2.ServantProficiency, value2);
componentData2.BloodQuality = componentData2.ServantProficiency / value2 * 100f;
((EntityManager)(ref entityManager)).SetComponentData<ServantCoffinstation>(val, componentData2);
Entity entityOnServer = ((NetworkedEntity)(ref componentData2.ConnectedServant)).GetEntityOnServer();
if (entityOnServer != Entity.Null && ((EntityManager)(ref entityManager)).HasComponent<ServantPower>(entityOnServer))
{
ServantPower componentData3 = ((EntityManager)(ref entityManager)).GetComponentData<ServantPower>(entityOnServer);
float num3 = value2 - componentData3.Expertise;
if (num3 > 0f)
{
float num4 = ((num3 < num2) ? num3 : num2);
componentData3.Expertise = math.min(componentData3.Expertise + num4, value2);
((EntityManager)(ref entityManager)).SetComponentData<ServantPower>(entityOnServer, componentData3);
}
}
float value6 = num2 * 100f;
ReplyColored(ctx, $"Your servant's Expertise has been upgraded by {value6:F1}%!", "00FF00");
}
catch (Exception ex)
{
ReplyColored(ctx, "Error in .upgradeservant", "FF0000");
if (ServantForgePlugin.LogInstance != null)
{
ManualLogSource logInstance = ServantForgePlugin.LogInstance;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error in .upgradeservant: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
logInstance.LogError(val2);
}
}
}
private static Entity FindClosestTile<T>(EntityManager em, float3 aimPos, float maxDist) where T : struct
{
//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_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_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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_0076: 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_00a5: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
EntityQuery val = ((EntityManager)(ref em)).CreateEntityQuery(Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[3]
{
ComponentType.ReadOnly<TilePosition>(),
ComponentType.ReadOnly<Translation>(),
ComponentType.ReadOnly<T>()
}));
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Entity result = Entity.Null;
float num = maxDist * maxDist;
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
float3 value = ((EntityManager)(ref em)).GetComponentData<Translation>(current).Value;
float num2 = math.distancesq(aimPos, value);
if (num2 < num)
{
num = num2;
result = current;
}
}
val2.Dispose();
return result;
}
private static void ReplyColored(ChatCommandContext ctx, string message, string hex)
{
ctx.Reply($"<color=#{hex}>{message}</color>");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ServantForge";
public const string PLUGIN_NAME = "ServantForge";
public const string PLUGIN_VERSION = "0.1.10";
}
}
namespace ServantForge.Utils
{
internal static class VWorldUtils
{
private static World? _serverWorld;
private static EntityManager? _entityManager;
public static World Server
{
get
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
if (_serverWorld != null && _serverWorld.IsCreated)
{
return _serverWorld;
}
_serverWorld = GetWorld("Server");
if (_serverWorld == null || !_serverWorld.IsCreated)
{
_entityManager = null;
if (ServantForgePlugin.LogInstance != null)
{
ServantForgePlugin.LogInstance.LogError((object)"Server world is not available or not created.");
}
throw new Exception("Server world is not available or not created.");
}
_entityManager = _serverWorld.EntityManager;
return _serverWorld;
}
}
public static EntityManager EntityManager
{
get
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0040: Unknown result type (might be due to invalid IL or missing references)
if (_entityManager.HasValue && _serverWorld != null && _serverWorld.IsCreated)
{
return _entityManager.Value;
}
return Server.EntityManager;
}
}
private static World? GetWorld(string name)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current.Name == name)
{
return current;
}
}
if (ServantForgePlugin.LogInstance != null)
{
ManualLogSource logInstance = ServantForgePlugin.LogInstance;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("World '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' not found.");
}
logInstance.LogWarning(val);
}
return null;
}
public static bool IsServerWorldReady()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
try
{
return Server != null && Server.IsCreated;
}
catch (Exception ex)
{
if (ServantForgePlugin.LogInstance != null)
{
ManualLogSource logInstance = ServantForgePlugin.LogInstance;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Server world check failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logInstance.LogError(val);
}
return false;
}
}
}
}
namespace ServantForge.Systems
{
public static class ServantInventorySystem
{
public static bool HasEnoughItem(Entity playerEntity, PrefabGUID itemGuid, int neededAmount)
{
//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_0008: 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_003c: 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_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_0054: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = VWorldUtils.EntityManager;
Entity val = default(Entity);
if (!InventoryUtilities.TryGetInventoryEntity<EntityManager>(entityManager, playerEntity, ref val, 0))
{
return false;
}
if (!((EntityManager)(ref entityManager)).HasBuffer<InventoryBuffer>(val))
{
return false;
}
DynamicBuffer<InventoryBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<InventoryBuffer>(val, false);
int num = 0;
Enumerator<InventoryBuffer> enumerator = buffer.GetEnumerator();
while (enumerator.MoveNext())
{
InventoryBuffer current = enumerator.Current;
if (current.ItemType == itemGuid)
{
num += current.Amount;
if (num >= neededAmount)
{
return true;
}
}
}
return num >= neededAmount;
}
public static bool TryRemoveItem(Entity playerEntity, PrefabGUID itemGuid, int amountToRemove)
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (amountToRemove <= 0)
{
return true;
}
EntityManager entityManager = VWorldUtils.EntityManager;
return InventoryUtilitiesServer.TryRemoveItem(entityManager, playerEntity, itemGuid, amountToRemove);
}
}
}