using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AddWatermark;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LBoL.Base.Extensions;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Cards;
using LBoL.Core.Stations;
using LBoL.Presentation;
using LBoL.Presentation.UI.Panels;
using LBoL.Presentation.UI.Widgets;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
using UnityEngine;
[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 = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("LBoL.Base")]
[assembly: IgnoresAccessChecksTo("LBoL.ConfigData")]
[assembly: IgnoresAccessChecksTo("LBoL.Core")]
[assembly: IgnoresAccessChecksTo("LBoL.EntityLib")]
[assembly: IgnoresAccessChecksTo("LBoL.Presentation")]
[assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")]
[assembly: AssemblyCompany("UnknownReward")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UnknownReward")]
[assembly: AssemblyTitle("UnknownReward")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace UnknownReward
{
[BepInPlugin("intoxicatedkid.unknownreward", "Unknown Reward", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LBoL.exe")]
public class BepinexPlugin : BaseUnityPlugin
{
private static readonly Harmony harmony = PInfo.harmony;
internal static ManualLogSource log;
internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);
internal static IResourceSource embeddedSource = (IResourceSource)new EmbeddedSource(Assembly.GetExecutingAssembly());
internal static DirectorySource directorySource = new DirectorySource("intoxicatedkid.unknownreward", "");
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
EntityManager.RegisterSelf();
harmony.PatchAll();
if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
{
WatermarkWrapper.ActivateWatermark();
}
}
private void OnDestroy()
{
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
public static class PInfo
{
public const string GUID = "intoxicatedkid.unknownreward";
public const string Name = "Unknown Reward";
public const string version = "1.0.2";
public static readonly Harmony harmony = new Harmony("intoxicatedkid.unknownreward");
}
public sealed class UnknownRewardJadeBoxDef : JadeBoxTemplate
{
public override IdContainer GetId()
{
//IL_0006: 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_000e: Unknown result type (might be due to invalid IL or missing references)
return IdContainer.op_Implicit("UnknownRewardJadeBox");
}
public override LocalizationOption LoadLocalization()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
return (LocalizationOption)new DirectLocalization(new Dictionary<string, object>
{
{ "Name", "Unknown Reward" },
{ "Description", "Card from reward is automatically selected.\nIncrease the chance to find Upgraded cards by 25%." }
}, (Locale)0, (Locale)0, false);
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
}
[EntityLogic(typeof(UnknownRewardJadeBoxDef))]
public sealed class UnknownRewardJadeBox : JadeBox
{
[HarmonyPatch(typeof(RewardPanel), "ShowCardSelection")]
private class RewardPanel_ShowCardSelection_Patch
{
private static bool Prefix(RewardPanel __instance, Station station, RewardWidget rewardWidget)
{
if (Singleton<GameMaster>.Instance.CurrentGameRun.JadeBoxes.Any((JadeBox jb) => jb is UnknownRewardJadeBox))
{
List<Card> list = rewardWidget.StationReward.Cards.Where((Card card) => (int)card.Config.Rarity == 2).ToList();
if (list.Count > 0)
{
Card val = CollectionsExtensions.SampleOrDefault<Card>((IEnumerable<Card>)list, Singleton<GameMaster>.Instance.CurrentGameRun.CardRng);
if (val != null)
{
Singleton<GameMaster>.Instance.CurrentGameRun.AddDeckCard(val, true, (VisualSourceData)null);
}
}
else
{
Card val2 = CollectionsExtensions.SampleOrDefault<Card>((IEnumerable<Card>)rewardWidget.StationReward.Cards, Singleton<GameMaster>.Instance.CurrentGameRun.CardRng);
if (val2 != null)
{
Singleton<GameMaster>.Instance.CurrentGameRun.AddDeckCard(val2, true, (VisualSourceData)null);
}
}
__instance._rewardWidgets.Remove(rewardWidget);
Object.Destroy((Object)(object)((Component)rewardWidget).gameObject);
return false;
}
return true;
}
}
protected override void OnAdded()
{
if (CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 0) != null)
{
Stage obj = CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 0);
obj.CardUpgradedChance += 0.25f;
}
if (CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 1) != null)
{
Stage obj2 = CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 1);
obj2.CardUpgradedChance += 0.25f;
}
if (CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 2) != null)
{
Stage obj3 = CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 2);
obj3.CardUpgradedChance += 0.25f;
}
if (CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 3) != null)
{
Stage obj4 = CollectionsExtensions.TryGetValue<Stage>((IReadOnlyList<Stage>)((GameEntity)this).GameRun._stages, 3);
obj4.CardUpgradedChance += 0.25f;
}
}
}
internal class WatermarkWrapper
{
[MethodImpl(MethodImplOptions.NoInlining)]
internal static void ActivateWatermark()
{
API.ActivateWatermark();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}