Decompiled source of FastTravel v1.0.6

BepInEx/plugins/Fast Travel.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Fast Travel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Fast Travel")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e6fbab1a-b697-431c-b170-1d67681da41b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.Recks.fasttravelspellbook", "Fast Travel Spellbook", "1.0.6")]
public class FastTravelSpellbookPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerControl), "Start")]
	public class PlayerControl_Start_Patch
	{
		private static void Postfix()
		{
			TeachSpell("Portal to Azure");
			TeachSpell("Portal to Braxonian");
			TeachSpell("Portal to Ripper's Keep");
			TeachSpell("Portal to Silkengrass");
			TeachSpell("Portal to Soluna's Landing");
		}

		private static void TeachSpell(string spellName)
		{
			Spell val = ((IEnumerable<Spell>)GameData.SpellDatabase.SpellDatabase).FirstOrDefault((Func<Spell, bool>)((Spell s) => s.SpellName == spellName));
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)("Spell '" + spellName + "' not found!"));
				return;
			}
			CastSpell mySpells = GameData.PlayerControl.Myself.MySpells;
			if (!mySpells.KnownSpells.Contains(val))
			{
				mySpells.KnownSpells.Add(val);
				Debug.Log((object)("Added spell '" + val.SpellName + "' to player's spellbook."));
			}
			else
			{
				Debug.Log((object)("Player already knows spell '" + val.SpellName + "'."));
			}
		}
	}

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.Recks.fasttravelspellbook");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Fast Travel Spellbook Mod Loaded.");
	}
}