using System;
using System.Collections;
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.ConfigData;
using LBoL.Core;
using LBoL.Core.Adventures;
using LBoL.EntityLib.Adventures;
using LBoL.Presentation;
using LBoL.Presentation.Effect;
using LBoL.Presentation.UI.Widgets;
using LBoL.Presentation.Units;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
using StSStuffMod;
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("StSJadebox")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StSJadebox")]
[assembly: AssemblyTitle("StSJadebox")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace StSJadebox
{
[BepInPlugin("neo.lbol.gameplay.StSJadeBox", "StS Jade Box(es)", "0.5.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[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("neo.lbol.gameplay.StSJadeBox", "");
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 = "neo.lbol.gameplay.StSJadeBox";
public const string Name = "StS Jade Box(es)";
public const string version = "0.5.2";
public static readonly Harmony harmony = new Harmony("neo.lbol.gameplay.StSJadeBox");
}
public sealed class StSTermsOfServiceJadeboxDef : JadeBoxTemplate
{
[HarmonyPatch(typeof(Debut), "ExchangeExhibit")]
private class BanExhibitSwap_Patch
{
private static bool Prefix(ref IEnumerator __result, Debut __instance, int optionIndex)
{
GameRunController currentGameRun = Singleton<GameMaster>.Instance.CurrentGameRun;
IReadOnlyList<JadeBox> jadeBoxes = currentGameRun.JadeBoxes;
if (jadeBoxes != null && jadeBoxes.Count > 0 && currentGameRun.JadeBoxes.Any((JadeBox jb) => jb is StSCursedManaJadebox))
{
UnitView val = GameDirector.Enemies[0];
val.Chat(StringDecorator.Decorate("Fufufu.. That's against the |Terms of Service|. You knew that, didn't you? Don't be cheeky now~"), 6f, (CloudType)3, 0f);
switch (((GameEntity)GameDirector.Player.Unit).Id)
{
case "Reimu":
if (Random.Range(0f, 1f) < 0.7f)
{
GameDirector.Player.Chat("Tsk..", 2f, (CloudType)2, 2f);
}
else
{
GameDirector.Player.Chat("Stingy hag..", 2.5f, (CloudType)0, 2f);
}
break;
case "Marisa":
GameDirector.Player.Chat("You think I've read them? \u00af\\_(ツ)_/\u00af", 3f, (CloudType)2, 2f);
break;
case "Sakuya":
if (Random.Range(0f, 1f) < 0.97f)
{
GameDirector.Player.Chat("My apologies.", 2.5f, (CloudType)2, 2f);
break;
}
GameDirector.Player.Chat("Time stop DEEZNUTS!!!", 2.5f, (CloudType)2, 2f);
__result = DelayTimeEffect(3f, __instance, optionIndex);
break;
case "Cirno":
if (Random.Range(0f, 1f) < 0.5f)
{
GameDirector.Player.Chat("???", 2f, (CloudType)2, 2f);
}
else
{
GameDirector.Player.Chat("Cirno does not understand..", 2.5f, (CloudType)2, 2f);
}
break;
default:
GameDirector.Player.Chat("...", 2f, (CloudType)2, 2f);
break;
}
return false;
}
return true;
}
private static IEnumerator DelayTimeEffect(float delay, Debut __instance, int optionIndex)
{
yield return (object)new WaitForSeconds(delay);
EffectManager.CreateEffect("ExtraTime", ((Component)GameDirector.Player).transform, 0f, (float?)null, false, true);
AudioManager.PlaySfx("ExtraTurnLaunch");
yield return (object)new WaitForSeconds(0.7f);
((Adventure)__instance).GameRun.LoseExhibit(((Adventure)__instance).GameRun.Player.Exhibits[0], false, true);
yield return ((Adventure)__instance).GameRun.GainExhibitRunner(__instance._exhibit, true, new VisualSourceData
{
SourceType = (VisualSourceType)3,
Index = optionIndex
});
}
}
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("StSCursedManaJadebox");
}
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", "Terms of Service" },
{ "Description", "Lose your starting Exhibit. Gain |Fussion Hammer|, |Coffee Dripper| and |Sozu|." }
}, (Locale)0, (Locale)0, false);
}
public override JadeBoxConfig MakeConfig()
{
return ((JadeBoxTemplate)this).DefaultConfig();
}
}
[EntityLogic(typeof(StSTermsOfServiceJadeboxDef))]
public sealed class StSCursedManaJadebox : JadeBox
{
protected override void OnGain(GameRunController gameRun)
{
gameRun.LoseExhibit(((GameEntity)this).GameRun.Player.Exhibits[0], false, true);
((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(GainExhibits(gameRun));
}
private IEnumerator GainExhibits(GameRunController gameRun)
{
HashSet<Type> stsExhibits = new HashSet<Type>
{
typeof(StSFusionHammer),
typeof(StSCoffeeDripper),
typeof(StSSozu)
};
foreach (Type et in stsExhibits)
{
yield return gameRun.GainExhibitRunner(Library.CreateExhibit(et), false, (VisualSourceData)null);
}
gameRun.ExhibitPool.RemoveAll((Type e) => stsExhibits.Contains(e));
}
}
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)
{
}
}
}