using System;
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.Configuration;
using BepInEx.Logging;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using HarmonyLib;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Cards;
using LBoL.Core.Units;
using LBoL.EntityLib.Cards.Character.Sakuya;
using LBoL.Presentation;
using LBoL.Presentation.UI;
using LBoL.Presentation.Units;
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("WidePlayer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WidePlayer")]
[assembly: AssemblyTitle("WidePlayer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace WidePlayer
{
[BepInPlugin("intoxicatedkid.wideplayer", "Wide Player", "1.1.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LBoL.exe")]
public class BepinexPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(BattleController), "EndPlayerTurn")]
private class BattleController_EndPlayerTurn_Patch
{
private static void Postfix(BattleController __instance)
{
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
if (Singleton<GameMaster>.Instance.CurrentGameRun == null || (!WidePlayer.Value && !LongPlayer.Value && !ThinPlayer.Value && !ShortPlayer.Value) || ((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id == "AyaPlayerUnit" || ((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id == "LongPlayerUnit")
{
return;
}
float num = Math.Max(Math.Min((float)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).MaxHp / Math.Max(PlayerUnitConfig.FromId(((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id).MaxHp, 50f), WidePlayer.Value ? 20f : 1f), ThinPlayer.Value ? 0.2f : 1f);
float num2 = Math.Max(Math.Min((float)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).MaxHp / Math.Max(PlayerUnitConfig.FromId(((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id).MaxHp, 50f), LongPlayer.Value ? 20f : 1f), ShortPlayer.Value ? 0.2f : 1f);
if (WideCards.Value && WidePlayer.Value && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => c is ExtraTurnEveryone))
{
num += 1f;
}
if (WideCards.Value && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => c is KnifeAim))
{
if (ThinPlayer.Value)
{
num -= 0.5f;
}
if (ShortPlayer.Value)
{
num2 -= 0.5f;
}
}
if (WideDeck.Value)
{
if (WidePlayer.Value)
{
num += 0.025f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Count;
}
if (LongPlayer.Value)
{
num2 += 0.025f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Count;
}
}
if (WideExhibits.Value)
{
if (WidePlayer.Value)
{
num += 0.05f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count;
}
if (LongPlayer.Value)
{
num2 += 0.05f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count;
}
}
if (WideRequests.Value)
{
if (WidePlayer.Value)
{
num += 0.15f * (float)PuzzleFlags.GetPuzzleLevel(Singleton<GameMaster>.Instance.CurrentGameRun.Puzzles);
}
if (LongPlayer.Value)
{
num2 += 0.15f * (float)PuzzleFlags.GetPuzzleLevel(Singleton<GameMaster>.Instance.CurrentGameRun.Puzzles);
}
}
if (WideTeammates.Value && Singleton<GameMaster>.Instance.CurrentGameRun.Battle != null)
{
if (WidePlayer.Value)
{
num += 0.1f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Battle.HandZone.Count((Card c) => (int)c.CardType == 5 && c.Summoned);
}
if (LongPlayer.Value)
{
num2 += 0.1f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Battle.HandZone.Count((Card c) => (int)c.CardType == 5 && c.Summoned);
}
}
TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).GetView<UnitView>()).transform, new Vector3(Math.Max(num, 0.2f), Math.Max(num2, 0.2f)), 0f), (Ease)1), true), true));
}
}
[HarmonyPatch(typeof(Unit), "SetMaxHp")]
private class Unit_SetMaxHp_Patch
{
private static void Postfix(Unit __instance)
{
//IL_038c: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
if (Singleton<GameMaster>.Instance.CurrentGameRun == null || !(__instance is PlayerUnit) || (!WidePlayer.Value && !LongPlayer.Value && !ThinPlayer.Value && !ShortPlayer.Value) || ((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id == "AyaPlayerUnit" || ((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id == "LongPlayerUnit")
{
return;
}
float num = Math.Max(Math.Min((float)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).MaxHp / Math.Max(PlayerUnitConfig.FromId(((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id).MaxHp, 50f), WidePlayer.Value ? 20f : 1f), ThinPlayer.Value ? 0.2f : 1f);
float num2 = Math.Max(Math.Min((float)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).MaxHp / Math.Max(PlayerUnitConfig.FromId(((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id).MaxHp, 50f), LongPlayer.Value ? 20f : 1f), ShortPlayer.Value ? 0.2f : 1f);
if (WideCards.Value && WidePlayer.Value && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => c is ExtraTurnEveryone))
{
num += 1f;
}
if (WideCards.Value && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => c is KnifeAim))
{
if (ThinPlayer.Value)
{
num -= 0.5f;
}
if (ShortPlayer.Value)
{
num2 -= 0.5f;
}
}
if (WideDeck.Value)
{
if (WidePlayer.Value)
{
num += 0.025f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Count;
}
if (LongPlayer.Value)
{
num2 += 0.025f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Count;
}
}
if (WideExhibits.Value)
{
if (WidePlayer.Value)
{
num += 0.05f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count;
}
if (LongPlayer.Value)
{
num2 += 0.05f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count;
}
}
if (WideRequests.Value)
{
if (WidePlayer.Value)
{
num += 0.15f * (float)PuzzleFlags.GetPuzzleLevel(Singleton<GameMaster>.Instance.CurrentGameRun.Puzzles);
}
if (LongPlayer.Value)
{
num2 += 0.15f * (float)PuzzleFlags.GetPuzzleLevel(Singleton<GameMaster>.Instance.CurrentGameRun.Puzzles);
}
}
if (WideTeammates.Value && Singleton<GameMaster>.Instance.CurrentGameRun.Battle != null)
{
if (WidePlayer.Value)
{
num += 0.1f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Battle.HandZone.Count((Card c) => (int)c.CardType == 5 && c.Summoned);
}
if (LongPlayer.Value)
{
num2 += 0.1f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Battle.HandZone.Count((Card c) => (int)c.CardType == 5 && c.Summoned);
}
}
TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).GetView<UnitView>()).transform, new Vector3(Math.Max(num, 0.2f), Math.Max(num2, 0.2f)), 0f), (Ease)1), true), true));
}
}
[HarmonyPatch(typeof(UiManager), "EnterGameRun")]
private class UiManager_EnterGameRun_Patch
{
private static void Postfix(UiManager __instance)
{
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
if (Singleton<GameMaster>.Instance.CurrentGameRun == null || (!WidePlayer.Value && !LongPlayer.Value && !ThinPlayer.Value && !ShortPlayer.Value) || ((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id == "AyaPlayerUnit" || ((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id == "LongPlayerUnit")
{
return;
}
float num = Math.Max(Math.Min((float)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).MaxHp / Math.Max(PlayerUnitConfig.FromId(((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id).MaxHp, 50f), WidePlayer.Value ? 20f : 1f), ThinPlayer.Value ? 0.2f : 1f);
float num2 = Math.Max(Math.Min((float)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).MaxHp / Math.Max(PlayerUnitConfig.FromId(((GameEntity)Singleton<GameMaster>.Instance.CurrentGameRun.Player).Id).MaxHp, 50f), LongPlayer.Value ? 20f : 1f), ShortPlayer.Value ? 0.2f : 1f);
if (WideCards.Value && WidePlayer.Value && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => c is ExtraTurnEveryone))
{
num += 1f;
}
if (WideCards.Value && Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Any((Card c) => c is KnifeAim))
{
if (ThinPlayer.Value)
{
num -= 0.5f;
}
if (ShortPlayer.Value)
{
num2 -= 0.5f;
}
}
if (WideDeck.Value)
{
if (WidePlayer.Value)
{
num += 0.025f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Count;
}
if (LongPlayer.Value)
{
num2 += 0.025f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.BaseDeck.Count;
}
}
if (WideExhibits.Value)
{
if (WidePlayer.Value)
{
num += 0.05f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count;
}
if (LongPlayer.Value)
{
num2 += 0.05f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Player.Exhibits.Count;
}
}
if (WideRequests.Value)
{
if (WidePlayer.Value)
{
num += 0.15f * (float)PuzzleFlags.GetPuzzleLevel(Singleton<GameMaster>.Instance.CurrentGameRun.Puzzles);
}
if (LongPlayer.Value)
{
num2 += 0.15f * (float)PuzzleFlags.GetPuzzleLevel(Singleton<GameMaster>.Instance.CurrentGameRun.Puzzles);
}
}
if (WideTeammates.Value && Singleton<GameMaster>.Instance.CurrentGameRun.Battle != null)
{
if (WidePlayer.Value)
{
num += 0.1f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Battle.HandZone.Count((Card c) => (int)c.CardType == 5 && c.Summoned);
}
if (LongPlayer.Value)
{
num2 += 0.1f * (float)Singleton<GameMaster>.Instance.CurrentGameRun.Battle.HandZone.Count((Card c) => (int)c.CardType == 5 && c.Summoned);
}
}
TweenExtensions.WaitForCompletion((Tween)(object)TweenSettingsExtensions.SetAutoKill<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetUpdate<TweenerCore<Vector3, Vector3, VectorOptions>>(TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOScale(((Component)((Unit)Singleton<GameMaster>.Instance.CurrentGameRun.Player).GetView<UnitView>()).transform, new Vector3(Math.Max(num, 0.2f), Math.Max(num2, 0.2f)), 0f), (Ease)1), true), true));
}
}
private static readonly Harmony harmony = PInfo.harmony;
internal static ManualLogSource log;
public static ConfigEntry<bool> WidePlayer;
public static ConfigEntry<bool> LongPlayer;
public static ConfigEntry<bool> ThinPlayer;
public static ConfigEntry<bool> ShortPlayer;
public static ConfigEntry<bool> WideCards;
public static ConfigEntry<bool> WideDeck;
public static ConfigEntry<bool> WideExhibits;
public static ConfigEntry<bool> WideRequests;
public static ConfigEntry<bool> WideTeammates;
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
WidePlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("A. Size Up", "Wide Player", true, "Player gets wider when maximum life is higher than default.");
LongPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("A. Size Up", "Long Player", false, "Player gets longer when maximum life is higher than default.");
ThinPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("B. Size Down", "Thin Player", false, "Player gets thinner when maximum life is lower than default.");
ShortPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("B. Size Down", "Short Player", false, "Player gets shorter when maximum life is lower than default.");
WideCards = ((BaseUnityPlugin)this).Config.Bind<bool>("C. Additional Modifier", "Wide Cards", false, "Some cards in the library can now affect the player's size. Related configs needs to be enabled.\nList of cards that affect size can be found in README.md");
WideDeck = ((BaseUnityPlugin)this).Config.Bind<bool>("C. Additional Modifier", "Wide Deck", false, "Each card in the library increases player's size by 2.5%. Wide Player or Tall Player needs to be enabled.");
WideExhibits = ((BaseUnityPlugin)this).Config.Bind<bool>("C. Additional Modifier", "Wide Exhibits", false, "Each exhibit in player's possession increases player's size by 5%. Wide Player or Tall Player needs to be enabled.");
WideRequests = ((BaseUnityPlugin)this).Config.Bind<bool>("C. Additional Modifier", "Wide Requests", false, "Each request increases player's size by 15%. Wide Player or Tall Player needs to be enabled.");
WideTeammates = ((BaseUnityPlugin)this).Config.Bind<bool>("C. Additional Modifier", "Wide Teammates", false, "Each summoned teammate in the hand increases player's size by 10%. Wide Player or Tall Player needs to be enabled.");
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.wideplayer";
public const string Name = "Wide Player";
public const string version = "1.1.2";
public static readonly Harmony harmony = new Harmony("intoxicatedkid.wideplayer");
}
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)
{
}
}
}