using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LongerPetNames")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Riintouge")]
[assembly: AssemblyProduct("LongerPetNames")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("31b1e7e9-bb83-4dc0-9081-c829df429812")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace LongerPetNames;
[BepInPlugin("com.riintouge.longerpetnames", "Longer Pet Names", "1.0.1")]
[BepInProcess("valheim.exe")]
public class LongerPetNames : BaseUnityPlugin
{
[HarmonyPatch(typeof(Tameable))]
private class TameablePatch
{
[HarmonyPatch("SetName")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> SetNamePatch(IEnumerable<CodeInstruction> instructionsIn)
{
foreach (CodeInstruction item in instructionsIn)
{
if (item.opcode == OpCodes.Ldc_I4_S && (sbyte)item.operand == 10)
{
item.operand = 100;
}
yield return item;
}
}
}
public static ConfigEntry<bool> LoadOnStart;
private readonly Harmony Harmony = new Harmony("com.riintouge.longerpetnames");
private void Awake()
{
LoadOnStart = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - Core", "LoadOnStart", true, "Whether this plugin loads on game start.");
if (LoadOnStart.Value)
{
Harmony.PatchAll();
}
}
}