using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GlobalSettings;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using Needleforge;
using Needleforge.Data;
using QueenCrest.Components;
using QueenCrest.Patches;
using QueenCrest.Utils;
using TeamCherry.Localization;
using TeamCherry.NestedFadeGroup;
using TeamCherry.SharedUtils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("QueenCrest")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: AssemblyInformationalVersion("0.1.3+88f27507d197cb63801339473e61fe096c2a1adc")]
[assembly: AssemblyProduct("QueenCrest")]
[assembly: AssemblyTitle("QueenCrest")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/kaycodes13/QueenCrest")]
[assembly: NeutralResourcesLanguage("EN")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace QueenCrest
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("io.github.kaycodes13.queencrest", "QueenCrest", "0.1.3")]
public class QueenCrestPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static HudCoroutine <0>__HudCoroutine;
public static Action<FsmInt, FsmInt, FsmFloat, PlayMakerFSM> <1>__EnableMultibinder;
public static Action <2>__EnableReaperBindEffect;
public static Action <3>__Setup;
}
internal const string YenId = "Yen";
internal static readonly LocalisedString YenName = new LocalisedString("Mods.io.github.kaycodes13.queencrest", "CREST_NAME");
internal static readonly LocalisedString YenDesc = new LocalisedString("Mods.io.github.kaycodes13.queencrest", "CREST_DESC");
public const string Id = "io.github.kaycodes13.queencrest";
private Harmony Harmony { get; } = new Harmony("io.github.kaycodes13.queencrest");
internal static ManualLogSource Log { get; private set; }
internal static CrestData YenCrest { get; private set; }
private static Color AdminGreen { get; } = Color32.op_Implicit(new Color32((byte)89, byte.MaxValue, (byte)152, byte.MaxValue));
internal static Color AttackColor { get; } = Color.Lerp(Color.white, AdminGreen, 0.3f);
public static string Name => "QueenCrest";
public static string Version => "0.1.3";
private void Awake()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.kaycodes13.queencrest) has loaded!"));
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0.5f, 0.44f);
Sprite val2 = ResourceUtils.LoadEmbeddedPngAsSprite("Crest.png", val);
Sprite val3 = ResourceUtils.LoadEmbeddedPngAsSprite("CrestSilhouette.png", val);
Sprite val4 = ResourceUtils.LoadEmbeddedPngAsSprite("CrestGlow.png", val, 140f);
float num = 0.5f - val.y;
Rect rect = val2.rect;
float num2 = num * (((Rect)(ref rect)).height / val2.pixelsPerUnit);
YenCrest = NeedleforgePlugin.AddCrest("Yen", YenName, YenDesc, val2, val3, val4);
YenCrest.AddSkillSlot((AttackToolBinding)1, new Vector2(-0.9f, 1.85f + num2), false);
YenCrest.AddSkillSlot((AttackToolBinding)2, new Vector2(0.93f, 1.93f + num2), false);
YenCrest.AddRedSlot((AttackToolBinding)0, new Vector2(2.1f, 0.13f + num2), false);
YenCrest.AddYellowSlot(new Vector2(-2.1f, 0.13f + num2), false);
YenCrest.AddBlueSlot(new Vector2(-1.94f, -1.67f + num2), false);
YenCrest.AddBlueSlot(new Vector2(1.94f, -1.67f + num2), false);
YenCrest.AddBlueSlot(new Vector2(0f, -2.95f + num2), false);
YenCrest.ApplyAutoSlotNavigation(true, 60f, (Vector2?)new Vector2(1.25f, 0.75f));
YenCrest.HudFrame.Preset = (VanillaCrest)2;
HudFrameData hudFrame = YenCrest.HudFrame;
object obj = <>O.<0>__HudCoroutine;
if (obj == null)
{
HudCoroutine val5 = Bind.HudCoroutine;
<>O.<0>__HudCoroutine = val5;
obj = (object)val5;
}
hudFrame.Coroutine = (HudCoroutine)obj;
YenCrest.BindEvent = Bind.EnableMultibinder;
YenCrest.BindCompleteEvent = Bind.EnableReaperBindEffect;
Harmony.PatchAll(typeof(Bind));
YenCrest.Moveset.OnInitialized += Moveset.Setup;
Harmony.PatchAll(typeof(EvaOptOut));
}
private void OnDestroy()
{
Harmony.UnpatchSelf();
}
}
}
namespace QueenCrest.Utils
{
internal static class ResourceUtils
{
public static Sprite LoadEmbeddedPngAsSprite(string filename, Vector2? pivot = null, float pixelsPerUnit = 100f)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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)
Texture2D val = LoadEmbeddedPngAsTexture2D(filename);
((Object)val).name = filename;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), (Vector2)(((??)pivot) ?? new Vector2(0.5f, 0.5f)), pixelsPerUnit);
}
public static Texture2D LoadEmbeddedPngAsTexture2D(string filename)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_0070: Expected O, but got Unknown
string filename2 = filename;
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string name = executingAssembly.GetManifestResourceNames().First((string x) => x.EndsWith(filename2));
byte[] array;
using (Stream stream = executingAssembly.GetManifestResourceStream(name))
{
using BinaryReader binaryReader = new BinaryReader(stream);
array = binaryReader.ReadBytes((int)stream.Length);
}
Texture2D val = new Texture2D(1, 1);
ImageConversion.LoadImage(val, array);
return val;
}
}
}
namespace QueenCrest.Patches
{
internal static class Bind
{
[CompilerGenerated]
private sealed class <HudCoroutine>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public BindOrbHudFrame hudInstance;
private HeroController <hc>5__2;
private bool <wasInReaperMode>5__3;
private float <effectTime>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HudCoroutine>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<hc>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<hc>5__2 = HeroController.instance;
<wasInReaperMode>5__3 = false;
<effectTime>5__4 = 0f;
break;
case 1:
<>1__state = -1;
break;
case 2:
<>1__state = -1;
break;
}
if (<hc>5__2.IsPaused())
{
<>2__current = null;
<>1__state = 1;
return true;
}
NestedFadeGroupBase reaperModeEffect = hudInstance.reaperModeEffect;
if (Object.op_Implicit((Object)(object)reaperModeEffect))
{
if (!<wasInReaperMode>5__3 && <hc>5__2.reaperState.IsInReaperMode)
{
((Component)reaperModeEffect).gameObject.SetActive(false);
((Component)reaperModeEffect).gameObject.SetActive(true);
reaperModeEffect.AlphaSelf = 1f;
<effectTime>5__4 = 0f;
}
else if (<wasInReaperMode>5__3 && !<hc>5__2.reaperState.IsInReaperMode)
{
<effectTime>5__4 = reaperModeEffect.FadeTo(0f, hudInstance.reaperModeEffectFadeOutTime, (AnimationCurve)null, false, (Action<bool>)null);
}
if (<effectTime>5__4 > 0f)
{
<effectTime>5__4 -= Time.deltaTime;
if (<effectTime>5__4 <= 0f)
{
((Component)reaperModeEffect).gameObject.SetActive(false);
}
}
}
<wasInReaperMode>5__3 = <hc>5__2.reaperState.IsInReaperMode;
<>2__current = null;
<>1__state = 2;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly ProbabilityInt[] silkOrbDrops;
private static int GetRandomOrbDrops()
{
return Probability.GetRandomItemByProbability<ProbabilityInt, int>(silkOrbDrops, (float[])null);
}
[IteratorStateMachine(typeof(<HudCoroutine>d__2))]
internal static IEnumerator HudCoroutine(BindOrbHudFrame hudInstance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HudCoroutine>d__2(0)
{
hudInstance = hudInstance
};
}
internal static void EnableMultibinder(FsmInt value, FsmInt amount, FsmFloat time, PlayMakerFSM _)
{
if (((ToolBase)Gameplay.MultibindTool).IsEquipped)
{
value.Value = 2;
amount.Value = 2;
time.Value = 0.8f;
}
}
internal static void EnableReaperBindEffect()
{
if (QueenCrestPlugin.YenCrest.IsEquipped)
{
HeroController instance = HeroController.instance;
instance.reaperState.IsInReaperMode = true;
instance.reaperState.ReaperModeDurationLeft = Gameplay.ReaperModeDuration;
if (Object.op_Implicit((Object)(object)instance.reaperModeEffect))
{
((Component)instance.reaperModeEffect).gameObject.SetActive(false);
((Component)instance.reaperModeEffect).gameObject.SetActive(true);
}
}
}
[HarmonyPatch(typeof(HealthManager), "TakeDamage", new Type[] { typeof(HitInstance) })]
[HarmonyPostfix]
private unsafe static void SpawnSilkOrbs(HealthManager __instance, ref HitInstance hitInstance)
{
//IL_0016: 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_0036: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected I4, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
if (!QueenCrestPlugin.YenCrest.IsEquipped)
{
return;
}
HeroController instance = HeroController.instance;
if (((int)hitInstance.AttackType != 0 && ((int)hitInstance.AttackType != 16 || !hitInstance.IsNailTag)) || (int)__instance.enemyType == 3 || (int)__instance.enemyType == 6 || __instance.DoNotGiveSilk || (int)hitInstance.SilkGeneration == 2 || !instance.ReaperState.IsInReaperMode)
{
return;
}
ReaperBundleTiers reaperBundles = __instance.reaperBundles;
int num = (int)reaperBundles switch
{
0 => GetRandomOrbDrops(),
1 => 1,
2 => 0,
_ => throw new Exception("Something has gone terribly wrong."),
};
if (num != 0)
{
int cardinalDirection = DirectionUtils.GetCardinalDirection(((HitInstance)(ref hitInstance)).GetActualDirection(((Component)__instance).transform, (TargetType)0));
float item = 0f;
float item2 = 360f;
float num3;
if ((Object)(object)__instance.flingSilkOrbsAimObject != (Object)null)
{
Vector3 position = __instance.flingSilkOrbsAimObject.transform.position;
Vector3 position2 = ((Component)__instance).transform.position;
float num2 = position.x - position2.x;
num3 = Mathf.Atan2(position.y - position2.y, num2) * (180f / MathF.PI);
item = num3 - 45f;
item2 = num3 + 45f;
}
else if (!__instance.flingSilkOrbsDown)
{
(item, item2, num3) = cardinalDirection switch
{
0 => (315f, 415f, 0f),
1 => (45f, 135f, 90f),
2 => (125f, 225f, 180f),
3 => (225f, 315f, 270f),
_ => (item, item2, 0f),
};
}
else
{
item = 225f;
item2 = 315f;
num3 = 270f;
}
Config val = default(Config);
val.Prefab = Gameplay.ReaperBundlePrefab;
val.AmountMin = num;
val.AmountMax = num;
val.SpeedMin = 25f;
val.SpeedMax = 50f;
val.AngleMin = item;
val.AngleMax = item2;
FlingUtils.SpawnAndFling(val, ((Component)__instance).transform, __instance.effectOrigin, (List<GameObject>)null, -1f);
GameObject reapHitEffectPrefab = Effects.ReapHitEffectPrefab;
if (Object.op_Implicit((Object)(object)reapHitEffectPrefab))
{
object obj = DirectionUtils.GetCardinalDirection(num3) switch
{
1 => (Vector2.one, 90f),
2 => (new Vector2(-1f, 1f), 0f),
3 => (new Vector2(1f, -1f), 90f),
_ => (Vector2.one, 0f),
};
Vector2 item3 = ((ValueTuple<Vector2, float>*)(&obj))->Item1;
float item4 = ((ValueTuple<Vector2, float>*)(&obj))->Item2;
GameObject val2 = ObjectPoolExtensions.Spawn(reapHitEffectPrefab, ((Component)__instance).transform.TransformPoint(__instance.effectOrigin));
Extensions.SetRotation2D(val2.transform, item4);
val2.transform.localScale = Extensions.ToVector3(item3, val2.transform.localScale.z);
}
}
}
static Bind()
{
//IL_0008: 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_001f: Expected O, but got Unknown
//IL_0020: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0039: Expected O, but got Unknown
//IL_003a: Expected O, but got Unknown
ProbabilityInt[] array = new ProbabilityInt[2];
ProbabilityInt val = new ProbabilityInt
{
Value = 1
};
((ProbabilityBase<int>)val).Probability = 0.7f;
array[0] = val;
ProbabilityInt val2 = new ProbabilityInt
{
Value = 2
};
((ProbabilityBase<int>)val2).Probability = 0.3f;
array[1] = val2;
silkOrbDrops = (ProbabilityInt[])(object)array;
}
}
internal static class EvaOptOut
{
[HarmonyPatch(typeof(CountCrestUnlockPoints), "OnEnter")]
[HarmonyPrefix]
private static void SubtractQueenSlots(CountCrestUnlockPoints __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
ToolCrestList val = ScriptableObject.CreateInstance<ToolCrestList>();
foreach (ToolCrest item in (NamedScriptableObjectList<ToolCrest>)(ToolCrestList)__instance.CrestList.Value)
{
if (item.name != QueenCrestPlugin.YenCrest.name)
{
((NamedScriptableObjectList<ToolCrest>)(object)val).Add(item);
}
}
__instance.CrestList.Value = (Object)(object)val;
}
}
internal static class Moveset
{
private static GameObject? animLibObj;
internal static void Setup()
{
EditHeroConfig();
CreateMissingAttacks();
}
private static void EditHeroConfig()
{
HeroConfigNeedleforge heroConfig = QueenCrestPlugin.YenCrest.Moveset.HeroConfig;
HeroControllerConfig heroConfig2 = ToolItemManager.GetCrestByName("Witch").HeroConfig;
heroConfig.SetChargedSlashFields((int?)heroConfig2.chargeSlashChain, (float?)heroConfig2.chargeSlashLungeSpeed, (float?)heroConfig2.chargeSlashLungeDeceleration, (bool?)heroConfig2.chargeSlashRecoils, (bool?)null);
((HeroControllerConfig)heroConfig).heroAnimOverrideLib = GetOrCreateAnimationLibrary();
}
private static void CreateMissingAttacks()
{
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
HeroController instance = HeroController.instance;
_ = QueenCrestPlugin.YenCrest.Moveset.HeroConfig;
ConfigGroup configGroup = QueenCrestPlugin.YenCrest.Moveset.ConfigGroup;
ConfigGroup val = instance.configs.First((ConfigGroup x) => ((Object)x.Config).name == "Whip");
ConfigGroup val2 = instance.configs.First((ConfigGroup x) => ((Object)x.Config).name == "Default");
GameObject val3 = Object.Instantiate<GameObject>(val.ChargeSlash, configGroup.ActiveRoot.transform);
tk2dSpriteAnimator[] components = val3.GetComponents<tk2dSpriteAnimator>();
for (int i = 0; i < components.Length; i++)
{
components[i].Library = GetOrCreateAnimationLibrary();
}
configGroup.ChargeSlash = val3;
configGroup.AlternateSlashObject = Object.Instantiate<GameObject>(val2.AlternateSlashObject, configGroup.ActiveRoot.transform);
TintRendererGroupConditionally tintRendererGroupConditionally = configGroup.ActiveRoot.AddComponent<TintRendererGroupConditionally>();
tintRendererGroupConditionally.Condition = () => (int)HeroController.instance.NailImbuement.CurrentElement == 0;
((TintRendererGroup)tintRendererGroupConditionally).Color = QueenCrestPlugin.AttackColor;
}
private static tk2dSpriteAnimation GetOrCreateAnimationLibrary()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
if (Object.op_Implicit((Object)(object)animLibObj))
{
return animLibObj.GetComponent<tk2dSpriteAnimation>();
}
tk2dSpriteAnimation heroAnimOverrideLib = HeroController.instance.configs.First((ConfigGroup c) => ((Object)c.Config).name == "Whip").Config.heroAnimOverrideLib;
animLibObj = new GameObject("Yen_AnimLib")
{
hideFlags = (HideFlags)61
};
Object.DontDestroyOnLoad((Object)(object)animLibObj);
tk2dSpriteAnimation obj = animLibObj.AddComponent<tk2dSpriteAnimation>();
obj.clips = heroAnimOverrideLib.clips.Where((tk2dSpriteAnimationClip x) => x.name.Contains("Charged")).ToArray();
obj.isValid = false;
obj.ValidateLookup();
return obj;
}
}
}
namespace QueenCrest.Components
{
internal class TintRendererGroupConditionally : TintRendererGroup
{
public Func<bool> Condition { get; set; } = () => true;
private void UpdateTint()
{
if (Condition())
{
((TintRendererGroup)this).UpdateTint();
}
}
private void Update()
{
UpdateTint();
}
private void OnEnable()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
base.sprites.Clear();
base.others.Clear();
base.particles.Clear();
base.meshRenderers.Clear();
((TintRendererGroup)this).GetComponentsInChildrenRecursively(((Component)this).transform);
if (base.meshRenderers.Count > 0)
{
base.block = new MaterialPropertyBlock();
}
UpdateTint();
}
}
}