using System;
using System.Collections.Generic;
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 Bloodstone.API;
using Bloody.Core.Helper.v1;
using BloodyShop.Server.Core;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
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("SteedForge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Created a Steed with high stats that can be purchased.")]
[assembly: AssemblyFileVersion("0.1.10.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e")]
[assembly: AssemblyProduct("SteedForge")]
[assembly: AssemblyTitle("SteedForge")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public static class MainConfig
{
public static ConfigEntry<float> DefaultSpeed { get; private set; }
public static ConfigEntry<float> DefaultAcceleration { get; private set; }
public static ConfigEntry<float> DefaultRotation { get; private set; }
public static ConfigEntry<string> CurrencyName { get; private set; }
public static ConfigEntry<int> RequiredCurrencyGUID { get; private set; }
public static ConfigEntry<int> CurrencyCost { get; private set; }
public static void Init(ConfigFile config)
{
DefaultSpeed = config.Bind<float>("Horse", "DefaultSpeed", 11f, "Default maximum speed for the spawned horse.");
DefaultAcceleration = config.Bind<float>("Horse", "DefaultAcceleration", 7f, "Default acceleration for the spawned horse.");
DefaultRotation = config.Bind<float>("Horse", "DefaultRotation", 14f, "Default rotation speed for the spawned horse.");
CurrencyName = config.Bind<string>("Currency", "CurrencyName", "Silver Coin", "The name of the currency required for upgrades.");
RequiredCurrencyGUID = config.Bind<int>("Currency", "RequiredCurrencyGUID", -949672483, "The GUID of the required currency.");
CurrencyCost = config.Bind<int>("Currency", "CurrencyCost", 500, "The cost in currency for the upgrade.");
}
}
namespace SteedForge
{
public static class Commands
{
[Command("upgradehorse", "uh", null, "Upgrade the stats of a tamed vampire horse you are near", null, false)]
public static void UpgradeHorse(ChatCommandContext ctx)
{
//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_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_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_0073: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: 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_021f: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = VWorld.Server.EntityManager;
float value = MainConfig.DefaultSpeed.Value;
float value2 = MainConfig.DefaultAcceleration.Value;
float value3 = MainConfig.DefaultRotation.Value;
int value4 = MainConfig.CurrencyCost.Value;
string value5 = MainConfig.CurrencyName.Value;
PrefabGUID val = default(PrefabGUID);
((PrefabGUID)(ref val))..ctor(MainConfig.RequiredCurrencyGUID.Value);
LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(ctx.Event.SenderCharacterEntity);
float3 position = ((LocalToWorld)(ref componentData)).Position;
List<Entity> list = FindNearbyHorses(entityManager, position, 2f);
if (list.Count == 0)
{
ctx.Reply("<color=yellow>[FS] No Vampiric Steed found within range.</color>");
return;
}
if (list.Count > 1)
{
ctx.Reply("<color=red>[FS] Too many Vampiric Steeds detected nearby. No stealing! Please move the other horses away.</color>");
return;
}
Entity val2 = list[0];
if (((EntityManager)(ref entityManager)).HasComponent<Mountable>(val2))
{
Mountable componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<Mountable>(val2);
if (AreFloatsEqual(componentData2.MaxSpeed, value) && AreFloatsEqual(componentData2.Acceleration, value2) && AreFloatsEqual(componentData2.RotationSpeed, value3 * 10f))
{
ctx.Reply("<color=yellow>[FS] The Vampiric Steed already has the maximum stats. No upgrade applied.</color>");
return;
}
User user = ctx.Event.User;
string text = ((object)(FixedString64Bytes)(ref user.CharacterName)).ToString();
if (!InventorySystem.verifyHaveSuficientPrefabsInInventory(text, val, value4))
{
ctx.Reply($"<color=red>[FS] You need {value4} {value5} to upgrade your Vampiric Steed.</color>");
}
else if (!InventorySystem.getPrefabFromInventory(text, val, value4))
{
ctx.Reply("<color=red>[FS] Failed to deduct the required items from your inventory.</color>");
}
else
{
componentData2.MaxSpeed = value;
componentData2.Acceleration = value2;
componentData2.RotationSpeed = value3 * 10f;
((EntityManager)(ref entityManager)).SetComponentData<Mountable>(val2, componentData2);
ctx.Reply($"<color=green>[FS] The Vampiric Steed has been upgraded for {value4} {value5}!</color>");
}
}
else
{
ctx.Reply("<color=red>[FS] Failed to upgrade the stats. The targeted entity does not have the required components.</color>");
}
}
private static List<Entity> FindNearbyHorses(EntityManager entityManager, float3 playerPosition, float hoverRadius)
{
//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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_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_0052: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_0095: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[2]
{
ComponentType.ReadOnly<PrefabGUID>(),
ComponentType.ReadOnly<LocalToWorld>()
});
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
List<Entity> list = new List<Entity>();
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (!((EntityManager)(ref entityManager)).HasComponent<PrefabGUID>(current))
{
continue;
}
PrefabGUID componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(current);
if (((PrefabGUID)(ref componentData)).GuidHash == -1502865710)
{
LocalToWorld componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(current);
float3 position = ((LocalToWorld)(ref componentData2)).Position;
if (math.distancesq(playerPosition, position) <= hoverRadius * hoverRadius)
{
list.Add(current);
}
}
}
val2.Dispose();
return list;
}
private static bool AreFloatsEqual(float value1, float value2, float epsilon = 0.0001f)
{
return math.abs(value1 - value2) < epsilon;
}
}
public static class HorseDb
{
public static readonly PrefabGUID NormalHorsePrefab = Prefabs.CHAR_Mount_Horse;
public static readonly PrefabGUID SpectralHorsePrefab = Prefabs.CHAR_Mount_Horse_Spectral;
}
[BepInPlugin("SteedForge", "SteedForge", "0.1.10")]
public class Plugin : BasePlugin
{
private Harmony _harmony;
public override void Load()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("SteedForge");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.1.10");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
MainConfig.Init(((BasePlugin)this).Config);
((BasePlugin)this).Log.LogInfo((object)"Configuration initialized successfully!");
_harmony = new Harmony("SteedForge");
_harmony.PatchAll();
CommandRegistry.RegisterAll();
((BasePlugin)this).Log.LogInfo((object)"Commands registered successfully!");
}
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>("SteedForge");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is unloaded.");
}
log.LogInfo(val);
return true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SteedForge";
public const string PLUGIN_NAME = "SteedForge";
public const string PLUGIN_VERSION = "0.1.10";
}
}