using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ArtifactOfOrder")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtifactOfOrder")]
[assembly: AssemblyTitle("ArtifactOfOrder")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = 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 ArtifactOfOrder
{
internal static class OrderHooks
{
[CompilerGenerated]
private static class <>O
{
public static Action<Run> <0>__OnRunStartGlobal;
public static hook_GenerateDrop <1>__OnGenerateDrop;
public static hook_GetRandomPickupIndex <2>__OnChestGetRandomPickupIndex;
public static hook_SetPickupIndex <3>__OnSetPickupIndex;
public static hook_CreatePickupDroplet_PickupIndex_Vector3_Vector3 <4>__OnCreatePickupDroplet;
public static hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3 <5>__OnCreateUniquePickupDroplet;
public static hook_CreatePickup <6>__OnCreatePickup;
}
private static bool _registered;
internal static void Register()
{
//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_0052: Expected O, but got Unknown
//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_0073: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_00aa: 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: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
if (!_registered)
{
_registered = true;
Run.onRunStartGlobal += OnRunStartGlobal;
object obj = <>O.<1>__OnGenerateDrop;
if (obj == null)
{
hook_GenerateDrop val = OnGenerateDrop;
<>O.<1>__OnGenerateDrop = val;
obj = (object)val;
}
PickupDropTable.GenerateDrop += (hook_GenerateDrop)obj;
object obj2 = <>O.<2>__OnChestGetRandomPickupIndex;
if (obj2 == null)
{
hook_GetRandomPickupIndex val2 = OnChestGetRandomPickupIndex;
<>O.<2>__OnChestGetRandomPickupIndex = val2;
obj2 = (object)val2;
}
ChestBehavior.GetRandomPickupIndex += (hook_GetRandomPickupIndex)obj2;
object obj3 = <>O.<3>__OnSetPickupIndex;
if (obj3 == null)
{
hook_SetPickupIndex val3 = OnSetPickupIndex;
<>O.<3>__OnSetPickupIndex = val3;
obj3 = (object)val3;
}
ShopTerminalBehavior.SetPickupIndex += (hook_SetPickupIndex)obj3;
object obj4 = <>O.<4>__OnCreatePickupDroplet;
if (obj4 == null)
{
hook_CreatePickupDroplet_PickupIndex_Vector3_Vector3 val4 = OnCreatePickupDroplet;
<>O.<4>__OnCreatePickupDroplet = val4;
obj4 = (object)val4;
}
PickupDropletController.CreatePickupDroplet_PickupIndex_Vector3_Vector3 += (hook_CreatePickupDroplet_PickupIndex_Vector3_Vector3)obj4;
object obj5 = <>O.<5>__OnCreateUniquePickupDroplet;
if (obj5 == null)
{
hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3 val5 = OnCreateUniquePickupDroplet;
<>O.<5>__OnCreateUniquePickupDroplet = val5;
obj5 = (object)val5;
}
PickupDropletController.CreatePickupDroplet_UniquePickup_Vector3_Vector3 += (hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3)obj5;
object obj6 = <>O.<6>__OnCreatePickup;
if (obj6 == null)
{
hook_CreatePickup val6 = OnCreatePickup;
<>O.<6>__OnCreatePickup = val6;
obj6 = (object)val6;
}
GenericPickupController.CreatePickup += (hook_CreatePickup)obj6;
Plugin.LogSource.LogInfo((object)"Artifact of Order hooks registered.");
}
}
private static void OnRunStartGlobal(Run run)
{
Plugin.LogSource.LogInfo((object)"Artifact of Order received Run.onRunStartGlobal.");
OrderRunState.Initialize(run);
}
private static PickupIndex OnGenerateDrop(orig_GenerateDrop orig, PickupDropTable self, Xoroshiro128Plus rng)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
PickupIndex pickupIndex = orig.Invoke(self, rng);
return OrderRunState.ReplacePickup(pickupIndex);
}
private static PickupIndex OnChestGetRandomPickupIndex(orig_GetRandomPickupIndex orig, ChestBehavior self)
{
//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
PickupIndex pickupIndex = orig.Invoke(self);
return OrderRunState.ReplacePickup(pickupIndex);
}
private static void OnSetPickupIndex(orig_SetPickupIndex orig, ShopTerminalBehavior self, PickupIndex newPickupIndex, bool newHidden)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, OrderRunState.ReplacePickup(newPickupIndex), newHidden);
}
private static void OnCreatePickupDroplet(orig_CreatePickupDroplet_PickupIndex_Vector3_Vector3 orig, PickupIndex pickupIndex, Vector3 position, Vector3 velocity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(OrderRunState.ReplacePickup(pickupIndex), position, velocity);
}
private static void OnCreateUniquePickupDroplet(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3 orig, UniquePickup pickup, Vector3 position, Vector3 velocity)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(OrderRunState.ReplacePickup(pickup), position, velocity);
}
private static GenericPickupController OnCreatePickup(orig_CreatePickup orig, ref CreatePickupInfo createPickupInfo)
{
//IL_0003: 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_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((CreatePickupInfo)(ref createPickupInfo)).pickupIndex = OrderRunState.ReplacePickup(((CreatePickupInfo)(ref createPickupInfo)).pickupIndex);
((CreatePickupInfo)(ref createPickupInfo)).pickup = OrderRunState.ReplacePickup(((CreatePickupInfo)(ref createPickupInfo)).pickup);
return orig.Invoke(ref createPickupInfo);
}
}
internal static class OrderRunState
{
private static readonly ItemTier[] SupportedTiers;
private static readonly Dictionary<ItemTier, PickupIndex> SelectedPickups;
private static bool _active;
private static ulong _seed;
internal static void Initialize(Run run)
{
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
SelectedPickups.Clear();
_active = false;
_seed = 0uL;
if ((Object)(object)run == (Object)null || !((NetworkBehaviour)run).isServer)
{
return;
}
bool flag = (Object)(object)OrderArtifact.ArtifactDef != (Object)null && (Object)(object)RunArtifactManager.instance != (Object)null && RunArtifactManager.instance.IsArtifactEnabled(OrderArtifact.ArtifactDef);
Plugin.LogSource.LogInfo((object)$"Artifact of Order initialize check: artifactEnabled={flag}, seed={run.seed}, isServer={((NetworkBehaviour)run).isServer}.");
if (flag)
{
if (Plugin.ItemsPerTier.Value != 1)
{
Plugin.LogSource.LogWarning((object)$"ItemsPerTier is set to {Plugin.ItemsPerTier.Value}, but the current implementation supports exactly 1. Clamping to 1.");
}
_active = true;
_seed = (Plugin.UseSeededRng.Value ? run.seed : ((ulong)DateTime.UtcNow.Ticks));
Xoroshiro128Plus rng = new Xoroshiro128Plus(_seed);
ItemTier[] supportedTiers = SupportedTiers;
foreach (ItemTier tier in supportedTiers)
{
TrySelectForTier(run, tier, rng);
}
if (Plugin.EnableLunar.Value)
{
TrySelectForTier(run, (ItemTier)3, rng);
}
if (Plugin.EnableVoid.Value)
{
TrySelectForTier(run, (ItemTier)6, rng);
TrySelectForTier(run, (ItemTier)7, rng);
TrySelectForTier(run, (ItemTier)8, rng);
TrySelectForTier(run, (ItemTier)9, rng);
}
ApplySelectionsToRun(run);
BroadcastSelections();
Plugin.LogSource.LogInfo((object)"Artifact of Order applied run drop list replacements.");
}
}
internal static PickupIndex ReplacePickup(PickupIndex pickupIndex)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_003a: 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_0031: 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_0051: 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_0054: Unknown result type (might be due to invalid IL or missing references)
if (!_active || !((PickupIndex)(ref pickupIndex)).isValid)
{
return pickupIndex;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
if (pickupDef == null)
{
return pickupIndex;
}
PickupIndex value;
return (SelectedPickups.TryGetValue(pickupDef.itemTier, out value) && ((PickupIndex)(ref value)).isValid) ? value : pickupIndex;
}
internal static UniquePickup ReplacePickup(UniquePickup pickup)
{
//IL_001e: 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_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_001a: 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_0041: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_0046: 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)
if (!_active || !((UniquePickup)(ref pickup)).isValid)
{
return pickup;
}
PickupIndex val = ReplacePickup(pickup.pickupIndex);
return (((PickupIndex)(ref val)).isValid && val != pickup.pickupIndex) ? ((UniquePickup)(ref pickup)).WithPickupIndex(val) : pickup;
}
private static void TrySelectForTier(Run run, ItemTier tier, Xoroshiro128Plus rng)
{
//IL_0002: 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_0041: 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_0053: 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_0021: Unknown result type (might be due to invalid IL or missing references)
List<PickupIndex> candidatesForTier = GetCandidatesForTier(run, tier);
if (candidatesForTier.Count == 0)
{
Plugin.LogSource.LogWarning((object)$"Artifact of Order found no valid pickups for tier {tier}. Leaving vanilla behavior for that tier.");
return;
}
PickupIndex val = rng.NextElementUniform<PickupIndex>(candidatesForTier);
SelectedPickups[tier] = val;
Plugin.LogSource.LogInfo((object)$"Artifact of Order selected {GetPickupDisplayName(val)} for {tier}.");
}
private static List<PickupIndex> GetCandidatesForTier(Run run, ItemTier tier)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
List<PickupIndex> runDropList = GetRunDropList(run, tier);
if (runDropList == null || runDropList.Count == 0)
{
return new List<PickupIndex>();
}
return runDropList.Where(IsValidCandidate).Distinct().ToList();
}
private static bool IsValidCandidate(PickupIndex pickupIndex)
{
//IL_0018: 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_0029: Invalid comparison between Unknown and I4
//IL_003e: 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)
if (!((PickupIndex)(ref pickupIndex)).isValid)
{
return false;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
if (pickupDef == null || (int)pickupDef.itemIndex == -1)
{
return false;
}
ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
if ((Object)(object)itemDef == (Object)null)
{
return false;
}
ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier);
if (itemDef.hidden || (Object)(object)itemTierDef == (Object)null || !itemTierDef.isDroppable)
{
return false;
}
return !itemDef.ContainsTag((ItemTag)10) && !itemDef.ContainsTag((ItemTag)14) && !itemDef.ContainsTag((ItemTag)9) && !itemDef.ContainsTag((ItemTag)25);
}
private static void ApplySelectionsToRun(Run run)
{
//IL_001b: 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)
foreach (KeyValuePair<ItemTier, PickupIndex> selectedPickup in SelectedPickups)
{
List<PickupIndex> runDropList = GetRunDropList(run, selectedPickup.Key);
if (runDropList != null)
{
runDropList.Clear();
runDropList.Add(selectedPickup.Value);
}
}
}
private static List<PickupIndex>? GetRunDropList(Run run, ItemTier tier)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected I4, but got Unknown
if (1 == 0)
{
}
List<PickupIndex> result = (int)tier switch
{
0 => run.availableTier1DropList,
1 => run.availableTier2DropList,
2 => run.availableTier3DropList,
4 => run.availableBossDropList,
3 => run.availableLunarItemDropList,
6 => run.availableVoidTier1DropList,
7 => run.availableVoidTier2DropList,
8 => run.availableVoidTier3DropList,
9 => run.availableVoidBossDropList,
_ => null,
};
if (1 == 0)
{
}
return result;
}
private static void BroadcastSelections()
{
//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_0021: Expected O, but got Unknown
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = BuildSelectionMessage(),
paramTokens = Array.Empty<string>()
});
}
private static string BuildSelectionMessage()
{
//IL_0021: 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_003a: 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_008d: Unknown result type (might be due to invalid IL or missing references)
List<string> list = new List<string> { "<style=cIsUtility>Artifact of Order selections:</style>" };
ItemTier[] supportedTiers = SupportedTiers;
foreach (ItemTier val in supportedTiers)
{
if (SelectedPickups.TryGetValue(val, out var value))
{
list.Add(GetTierLabel(val) + ": " + GetPickupDisplayName(value));
}
}
if (Plugin.EnableLunar.Value && SelectedPickups.TryGetValue((ItemTier)3, out var value2))
{
list.Add("Lunar: " + GetPickupDisplayName(value2));
}
if (Plugin.EnableVoid.Value)
{
AppendVoidLine(list, (ItemTier)6, "Void (Common)");
AppendVoidLine(list, (ItemTier)7, "Void (Uncommon)");
AppendVoidLine(list, (ItemTier)8, "Void (Legendary)");
AppendVoidLine(list, (ItemTier)9, "Void (Boss)");
}
return string.Join("\n", list);
}
private static void AppendVoidLine(List<string> lines, ItemTier tier, string label)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (SelectedPickups.TryGetValue(tier, out var value))
{
lines.Add(label + ": " + GetPickupDisplayName(value));
}
}
private static string GetTierLabel(ItemTier tier)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected I4, but got Unknown
if (1 == 0)
{
}
string result = (int)tier switch
{
0 => "Common",
1 => "Uncommon",
2 => "Legendary",
4 => "Boss",
_ => ((object)(ItemTier)(ref tier)).ToString(),
};
if (1 == 0)
{
}
return result;
}
private static string GetPickupDisplayName(PickupIndex pickupIndex)
{
//IL_0001: 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)
//IL_0074: Invalid comparison between Unknown and I4
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
if (pickupDef == null)
{
return ((object)(PickupIndex)(ref pickupIndex)).ToString();
}
if (!string.IsNullOrWhiteSpace(pickupDef.nameToken))
{
string @string = Language.GetString(pickupDef.nameToken);
if (!string.IsNullOrWhiteSpace(@string) && @string != pickupDef.nameToken)
{
return @string;
}
}
if ((int)pickupDef.itemIndex != -1)
{
ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
if ((Object)(object)itemDef != (Object)null)
{
string string2 = Language.GetString(itemDef.nameToken);
if (!string.IsNullOrWhiteSpace(string2) && string2 != itemDef.nameToken)
{
return string2;
}
}
}
return pickupDef.internalName ?? ((object)(PickupIndex)(ref pickupIndex)).ToString();
}
static OrderRunState()
{
ItemTier[] array = new ItemTier[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
SupportedTiers = (ItemTier[])(object)array;
SelectedPickups = new Dictionary<ItemTier, PickupIndex>();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.spencersmerdon.artifactoforder", "Artifact of Order", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "com.spencersmerdon.artifactoforder";
public const string PluginName = "Artifact of Order";
public const string PluginVersion = "1.0.0";
internal static Plugin Instance { get; private set; }
internal static ManualLogSource LogSource => ((BaseUnityPlugin)Instance).Logger;
internal static ConfigEntry<bool> EnableLunar { get; private set; }
internal static ConfigEntry<bool> EnableVoid { get; private set; }
internal static ConfigEntry<int> ItemsPerTier { get; private set; }
internal static ConfigEntry<bool> UseSeededRng { get; private set; }
private void Awake()
{
Instance = this;
BindConfig();
OrderArtifact.Register();
OrderHooks.Register();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Artifact of Order initialized.");
}
private void BindConfig()
{
EnableLunar = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableLunar", false, "Include Lunar items in the Artifact of Order pool.");
EnableVoid = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableVoid", true, "Include Void items in the Artifact of Order pool.");
ItemsPerTier = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ItemsPerTier", 1, "How many items are selected per tier. Current implementation supports 1 and will clamp higher values.");
UseSeededRng = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UseSeededRNG", true, "Use the run seed for deterministic Artifact of Order selections.");
}
}
internal static class OrderArtifact
{
internal static ArtifactDef ArtifactDef { get; private set; }
internal static void Register()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
LanguageAPI.Add("ARTIFACT_OF_ORDER_NAME", "Artifact of Order");
LanguageAPI.Add("ARTIFACT_OF_ORDER_DESCRIPTION", "Only one item of each tier exists. Order governs all drops.");
ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
ArtifactDef.cachedName = "ARTIFACT_OF_ORDER";
ArtifactDef.nameToken = "ARTIFACT_OF_ORDER_NAME";
ArtifactDef.descriptionToken = "ARTIFACT_OF_ORDER_DESCRIPTION";
ArtifactDef.smallIconSelectedSprite = CreateIconSprite(Color32.op_Implicit(new Color32((byte)193, (byte)164, (byte)98, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)66, (byte)52, (byte)28, byte.MaxValue)));
ArtifactDef.smallIconDeselectedSprite = CreateIconSprite(Color32.op_Implicit(new Color32((byte)92, (byte)92, (byte)92, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)38, (byte)38, (byte)38, byte.MaxValue)));
ContentAddition.AddArtifactDef(ArtifactDef);
try
{
ArtifactCodeAPI.AddCode(ArtifactDef, 0uL, 1uL, 2uL, 3uL);
}
catch (Exception ex)
{
Plugin.LogSource.LogWarning((object)("Artifact code registration failed; artifact will still be selectable from the lobby. " + ex.Message));
}
}
private static Sprite CreateIconSprite(Color borderColor, Color fillColor)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false)
{
filterMode = (FilterMode)0,
wrapMode = (TextureWrapMode)1
};
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(63.5f, 63.5f);
Color[] array = (Color[])(object)new Color[16384];
for (int i = 0; i < 128; i++)
{
for (int j = 0; j < 128; j++)
{
float num = Mathf.Abs((float)j - val2.x);
float num2 = Mathf.Abs((float)i - val2.y);
float num3 = num + num2;
bool flag = num3 <= 34f;
bool flag2 = num3 > 34f && num3 <= 48f;
array[i * 128 + j] = (flag2 ? borderColor : (flag ? fillColor : Color.clear));
}
}
val.SetPixels(array);
val.Apply(false, true);
return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f));
}
}
}