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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ProjectM;
using ScarletCore;
using ScarletCore.Data;
using ScarletCore.Services;
using ScarletCore.Systems;
using ScarletCore.Utils;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
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("ScarletBrazier")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("ScarletBrazier")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+5176b6a81d40267256347d50020909fd1695f341")]
[assembly: AssemblyProduct("ScarletBrazier")]
[assembly: AssemblyTitle("ScarletBrazier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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;
}
}
}
namespace ScarletBrazier
{
[BepInPlugin("ScarletBrazier", "ScarletBrazier", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
[CommandGroup("brazier", null)]
public class BrazierCommands
{
[Command("enable", "Enables free braziers globally", null, null, null, true)]
public static void Enable(ChatCommandContext ctx)
{
Settings.Set<bool>("EnableGlobally", true);
SetAllBraziersFree();
ctx.Reply(RichTextFormatter.Format("~Free Braziers~ have been enabled globally! All braziers now work without needing bones as fuel.", (List<string>)null));
}
[Command("disable", "Disables free braziers globally", null, null, null, true)]
public static void Disable(ChatCommandContext ctx)
{
Settings.Set<bool>("EnableGlobally", false);
ClearAllBraziers();
ctx.Reply(RichTextFormatter.Format("~Free Braziers~ have been disabled globally. Braziers returned to normal operation.", (List<string>)null));
}
[Command("force", "Forces all braziers to be free", null, null, null, true)]
public static void Force(ChatCommandContext ctx)
{
SetAllBraziersFree();
ctx.Reply(RichTextFormatter.Format("All ~Braziers~ have been forced to be free! They now burn indefinitely without fuel.", (List<string>)null));
}
[Command("spawninvisible", "si", null, null, null, true)]
public static void SpawnInvisible(ChatCommandContext ctx)
{
//IL_0002: 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_0038: 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_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_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_0063: 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_00af: 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)
//IL_00c5: 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)
PlayerData val = default(PlayerData);
if (!PlayerService.TryGetById(ctx.User.PlatformId, ref val))
{
ctx.Reply(RichTextFormatter.Format("Player not found.", (List<string>)null));
return;
}
float3 position = val.Position;
Entity val2 = SpawnerService.ImmediateSpawn(new PrefabGUID(1756900697), position, 0f, 0f, 0f, default(Entity));
ECSExtensions.With<Bonfire>(val2, (WithRefHandler<Bonfire>)delegate(ref Bonfire bonfire)
{
bonfire.IsActive = true;
bonfire.BurnTime = 31536000f;
});
ECSExtensions.With<Interactable>(val2, (WithRefHandler<Interactable>)delegate(ref Interactable interactable)
{
interactable.Disabled = true;
});
BuffService.TryApplyBuff(val2, new PrefabGUID(1880224358), -1f);
BuffService.TryApplyBuff(val2, new PrefabGUID(227784838), -1f);
ctx.Reply(RichTextFormatter.Format("Spawned an invisible brazier at your location.", (List<string>)null));
}
}
private static Harmony _harmony;
public const string ENABLE_GLOBALLY = "EnableGlobally";
public static Harmony Harmony => _harmony;
public static Plugin Instance { get; private set; }
public static ManualLogSource LogInstance { get; private set; }
public static Settings Settings { get; private set; }
public static Database Database { get; private set; }
public override void Load()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
Instance = this;
LogInstance = ((BasePlugin)this).Log;
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ScarletBrazier");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.1");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
_harmony = new Harmony("ScarletBrazier");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
Settings = new Settings("ScarletBrazier", (BasePlugin)(object)Instance);
LoadSettings();
GameSystems.OnInitialize((Action)delegate
{
if (Settings.Get<bool>("EnableGlobally"))
{
SetAllBraziersFree();
}
else
{
ClearAllBraziers();
}
});
CommandRegistry.RegisterAll();
}
public override bool Unload()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
CommandRegistry.UnregisterAssembly();
return true;
}
public static void ReloadSettings()
{
Settings.Dispose();
LoadSettings();
}
public static void LoadSettings()
{
Settings.Section("General").Add<bool>("EnableGlobally", true, "If true, all braziers will work for free without needing bones as fuel.");
}
public static void SetAllBraziersFree()
{
//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_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_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_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_003c: 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_0044: 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_0056: 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)
EntityManager entityManager = GameSystems.EntityManager;
EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Bonfire>() });
Enumerator<Entity> enumerator = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (!ECSExtensions.IsNull(current) && ECSExtensions.Exists(current) && ECSExtensions.Has<Bonfire>(current))
{
ECSExtensions.With<Bonfire>(current, (WithRefHandler<Bonfire>)delegate(ref Bonfire bonfire)
{
bonfire.IsActive = true;
bonfire.BurnTime = 31536000f;
});
}
}
}
public static void ClearAllBraziers()
{
//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_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_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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//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_0042: 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_004e: 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_006c: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = GameSystems.EntityManager;
EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Bonfire>() });
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (!ECSExtensions.IsNull(current) && ECSExtensions.Exists(current) && ECSExtensions.Has<Bonfire>(current))
{
ECSExtensions.With<Bonfire>(current, (WithRefHandler<Bonfire>)delegate(ref Bonfire bonfire)
{
bonfire.IsActive = false;
bonfire.BurnTime = 60f;
});
}
}
}
catch (Exception ex)
{
ManualLogSource logInstance = LogInstance;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error while clearing braziers: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
}
logInstance.LogError(val3);
LogInstance.LogDebug((object)ex.StackTrace);
}
finally
{
val2.Dispose();
}
}
}
[HarmonyPatch(typeof(SetTeamOnSpawnSystem), "OnUpdate")]
public static class SetTeamOnSpawnSystemPatch
{
[HarmonyPostfix]
public static void Postfix(SetTeamOnSpawnSystem __instance)
{
//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_002d: 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_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_004c: 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_008c: 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_0067: 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)
if (Plugin.Settings.Get<bool>("EnableGlobally"))
{
return;
}
EntityQuery _query_57018132_ = __instance.__query_57018132_0;
Enumerator<Entity> enumerator = ((EntityQuery)(ref _query_57018132_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (ECSExtensions.IsNull(current) || !ECSExtensions.Exists(current) || !ECSExtensions.Has<Bonfire>(current) || !ECSExtensions.Has<PrefabGUID>(current))
{
continue;
}
PrefabGUID val = ECSExtensions.Read<PrefabGUID>(current);
if (((PrefabGUID)(ref val)).GuidHash == 1756900697)
{
ECSExtensions.With<Bonfire>(current, (WithRefHandler<Bonfire>)delegate(ref Bonfire bonfire)
{
bonfire.IsActive = true;
bonfire.BurnTime = 31536000f;
});
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ScarletBrazier";
public const string PLUGIN_NAME = "ScarletBrazier";
public const string PLUGIN_VERSION = "1.0.1";
}
}