using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("FabricatorStandalone")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FabricatorStandalone")]
[assembly: AssemblyTitle("FabricatorStandalone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace FabricatorStandalone;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.RiskOfBrainrot.Fabricators", "Fabricators", "1.0.0")]
public class FabricatorPlugin : BaseUnityPlugin
{
public const string guid = "com.RiskOfBrainrot.Fabricators";
public const string teamName = "RiskOfBrainrot";
public const string modName = "Fabricators";
public const string version = "1.0.0";
public static BasicPickupDropTable doubleChestDropTable;
public static float fabricatorEjectVelocity = 1f;
public static int fabricatorCommonFirstCost = 30;
public static int fabricatorUncommonFirstCost = 60;
public static int fabricatorSecondCost = 30;
public int doubleChestWeight = 15;
public static DirectorCard fabricatorCommonDirectorCard;
public static InteractableSpawnCard fabricatorCommonSpawnCard;
public static GameObject fabricatorCommonPrefab;
public static DirectorCard fabricatorUncommonDirectorCard => fabricatorCommonDirectorCard;
public static InteractableSpawnCard fabricatorUncommonSpawnCard => fabricatorCommonSpawnCard;
public static GameObject fabricatorUncommonPrefab => fabricatorCommonPrefab;
public void Awake()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
LanguageAPI.Add("CASINOCHEST_NAME", "Fabricator Chest");
LanguageAPI.Add("CASINOCHEST_CONTEXT", "Use Fabricator Chest");
LanguageAPI.Add("CASINOCHEST_DESCRIPTION", "Costs gold to activate and will show a single item. Pay twice to get two copies of the shown item, or once to get two Scrap.");
FabricatorPlugin.LoadAsync<GameObject>(RoR2_Base_CasinoChest.CasinoChest_prefab, (Action<GameObject>)delegate(GameObject casinoChest)
{
fabricatorCommonPrefab = casinoChest;
PurchaseInteraction val = default(PurchaseInteraction);
if (casinoChest.TryGetComponent<PurchaseInteraction>(ref val))
{
val.saleStarCompatible = false;
}
RouletteChestController val2 = default(RouletteChestController);
if (casinoChest.TryGetComponent<RouletteChestController>(ref val2))
{
val2.dropCount = 2;
}
});
fabricatorCommonSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)RoR2_Base_CasinoChest.iscCasinoChest_asset).WaitForCompletion();
fabricatorCommonDirectorCard = DirectorCards.BuildDirectorCard(fabricatorCommonSpawnCard, doubleChestWeight, 0);
FabricatorPlugin.LoadAsync<BasicPickupDropTable>(RoR2_Base_CasinoChest.dtCasinoChest_asset, (Action<BasicPickupDropTable>)delegate(BasicPickupDropTable dropTable)
{
doubleChestDropTable = dropTable;
doubleChestDropTable.tier1Weight = 1f;
doubleChestDropTable.tier2Weight = 0f;
doubleChestDropTable.tier3Weight = 0f;
doubleChestDropTable.equipmentWeight = 0f;
});
AddDoubleChestToStage1();
Hooks.Init();
}
public static AssetReferenceT<T> LoadAsync<T>(string guid, Action<T> callback) where T : Object
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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)
AssetReferenceT<T> val = new AssetReferenceT<T>(guid);
AsyncOperationHandle<T> handle2 = AssetAsyncReferenceManager<T>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
if (callback == null)
{
return val;
}
if (handle2.IsDone)
{
onCompleted(handle2);
return val;
}
handle2.Completed += onCompleted;
return val;
void onCompleted(AsyncOperationHandle<T> handle)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
if (handle.Result == null || (int)handle.Status != 1)
{
Debug.LogError((object)$"Failed to load asset [{handle.DebugName}] : {handle.OperationException}");
}
else
{
callback(handle.Result);
}
}
}
public static void AddDoubleChestToStage1()
{
Helpers.AddNewInteractableToStage(fabricatorCommonDirectorCard, (InteractableCategory)2, (Stage)2, "");
Helpers.AddNewInteractableToStage(fabricatorCommonDirectorCard, (InteractableCategory)2, (Stage)4, "");
Helpers.AddNewInteractableToStage(fabricatorCommonDirectorCard, (InteractableCategory)2, (Stage)67108864, "");
}
}
public static class Hooks
{
public static void Init()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
Cycling.OnEnter += new hook_OnEnter(DoubleChestOnInteract);
RouletteChestController.GetPickupForTime += new hook_GetPickupForTime(DoubleChestScrap);
RouletteChestController.EjectPickupServer += new hook_EjectPickupServer(DoubleChestDoubleLoot);
}
public static void DoubleChestDoubleLoot(orig_EjectPickupServer orig, RouletteChestController self, UniquePickup pickup)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0096: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: 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)
if (!((UniquePickup)(ref pickup)).Equals(UniquePickup.none))
{
Vector3 val = self.ejectionTransform.rotation * self.localEjectionVelocity;
float num = 60f;
float num2 = num * 2f / (float)(self.dropCount + 1);
for (int i = 0; i < self.dropCount; i++)
{
float num3 = ((self.dropCount == 1) ? 0f : (num2 * (float)(i + 1) - num));
Vector3 val2 = ((self.dropCount == 1) ? val : Util.ApplySpread(val, 0f, 0f, 1f, 1f, num3, 0f));
PickupDropletController.CreatePickupDroplet(pickup, self.ejectionTransform.position, val2 + new Vector3(FabricatorPlugin.fabricatorEjectVelocity, 0f, 0f), false, false);
}
}
}
public static UniquePickup DoubleChestScrap(orig_GetPickupForTime orig, RouletteChestController self, FixedTimeStamp time)
{
//IL_0045: 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_004b: 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_002e: 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)
float num = 5f;
if (!(num > self.bonusTime))
{
return new UniquePickup(PickupCatalog.FindPickupIndex(Items.ScrapWhite.itemIndex));
}
self.bonusTime += 0.01f;
return orig.Invoke(self, time);
}
public static void DoubleChestOnInteract(orig_OnEnter orig, Cycling self)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
RouletteChestController component = ((EntityState)self).gameObject.GetComponent<RouletteChestController>();
component.maxEntries = 2;
component.bonusTime = 3f;
orig.Invoke(self);
if ((Object)(object)component == (Object)null)
{
Debug.Log((object)"auuuuuh fuck :3");
return;
}
PurchaseInteraction purchaseInteraction = component.purchaseInteraction;
if ((Object)(object)purchaseInteraction == (Object)null)
{
Debug.Log((object)"purchase interaction null 3:");
return;
}
purchaseInteraction.costType = (CostTypeIndex)1;
purchaseInteraction.cost = Run.instance.GetDifficultyScaledCost(FabricatorPlugin.fabricatorSecondCost, Stage.instance.entryDifficultyCoefficient);
purchaseInteraction.saleStarCompatible = false;
}
}
public static class Spawnlists
{
public static void Init()
{
SpawnCards.Init();
}
public static void AddMonsterCardToSpawnlist(DirectorCardCategorySelection categorySelection, DirectorCard directorCard, MonsterCategory monsterCategory)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected I4, but got Unknown
categorySelection.AddCard((int)monsterCategory, directorCard);
}
}
public static class SpawnCards
{
public static bool initialized;
public static void Init()
{
if (!initialized)
{
initialized = true;
DirectorCards.Init();
}
}
}
public static class DirectorCards
{
public static bool initialized;
public static bool logCardInfo;
public static void Init()
{
if (!initialized)
{
initialized = true;
}
}
public static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard)
{
return BuildDirectorCard(spawnCard, 1, 0, (MonsterSpawnDistance)0);
}
public static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard, int weight, int minStages, MonsterSpawnDistance spawnDistance)
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0022: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
return new DirectorCard
{
spawnCard = (SpawnCard)(object)spawnCard,
selectionWeight = weight,
preventOverhead = false,
minimumStageCompletions = minStages,
spawnDistance = spawnDistance
};
}
public static DirectorCard BuildDirectorCard(InteractableSpawnCard spawnCard, int weight, int minStages)
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0023: Expected O, but got Unknown
return new DirectorCard
{
spawnCard = (SpawnCard)(object)spawnCard,
selectionWeight = weight,
preventOverhead = false,
minimumStageCompletions = minStages
};
}
}