Decompiled source of Little Guy Companion v1.3.1
LittleGuy.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using BepInEx; using Dungeonator; using FullInspector; using Gungeon; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Cil; using SGUI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LittleGuy")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LittleGuy")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f7ab9b37-be65-43f9-beab-dc74262852bc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 LittleGuy { public class HealOnTakingDamage : BraveBehaviour { public void Start() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (!((Object)(object)((BraveBehaviour)this).healthHaver == (Object)null)) { ((BraveBehaviour)this).healthHaver.OnDamaged += new OnDamagedEvent(HandleDamaged); } } public void HandleDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { ((BraveBehaviour)this).healthHaver.FullHeal(); } } public class HeavyWeightSynergyForBoxingGlove : GunBehaviour { public override void PostProcessProjectile(Projectile projectile) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((GunBehaviour)this).PlayerOwner == (Object)null) && ((GunBehaviour)this).PlayerOwner.HasActiveBonusSynergy(Plugin.heavyweightSynergy, false)) { ProjectileData baseData = projectile.baseData; baseData.damage *= 1.5f; } } } public class HeavyWeightSynergyForLittleGuy : BraveBehaviour { public AIActor ai; public PlayerController p; public float origcontact; public void Start() { ai = ((BraveBehaviour)this).aiActor; if (!((Object)(object)ai == (Object)null)) { p = ai.CompanionOwner; origcontact = ai.CollisionDamage; } } public void Update() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ai == (Object)null)) { if ((Object)(object)p != (Object)null && p.HasActiveBonusSynergy(Plugin.heavyweightSynergy, false)) { ai.CollisionDamage = origcontact * 2f; } else { ai.CollisionDamage = origcontact; } } } } public static class ILTools { public static bool JumpToNext(this ILCursor crs, Func<Instruction, bool> match, int times = 1) { for (int i = 0; i < times; i++) { if (!crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { match })) { return false; } } return true; } public static bool JumpBeforeNext(this ILCursor crs, Func<Instruction, bool> match, int times = 1) { for (int i = 0; i < times; i++) { if (!crs.TryGotoNext((MoveType)((i != times - 1) ? 2 : 0), new Func<Instruction, bool>[1] { match })) { return false; } } return true; } public static IEnumerable MatchAfter(this ILCursor crs, Func<Instruction, bool> match) { Instruction curr = crs.Next; crs.Index = 0; while (crs.JumpToNext(match)) { yield return null; } crs.Next = curr; } public static IEnumerable MatchBefore(this ILCursor crs, Func<Instruction, bool> match) { Instruction curr = crs.Next; crs.Index = 0; while (crs.JumpBeforeNext(match)) { Instruction c = crs.Next; yield return null; crs.Goto(c, (MoveType)2, false); } crs.Next = curr; } public static VariableDefinition DeclareLocal<T>(this ILContext ctx) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown VariableDefinition val = new VariableDefinition(ctx.Import(typeof(T))); ctx.Body.Variables.Add(val); return val; } public static VariableDefinition DeclareLocal<T>(this ILCursor crs) { return crs.Context.DeclareLocal<T>(); } public static bool TryGotoArg(this ILCursor crs, Instruction targetInstr, int argIndex, int instance = 0) { if (argIndex < 0) { return false; } if (instance < 0) { return false; } if (targetInstr == null) { return false; } List<Instruction> argumentInstructions = targetInstr.GetArgumentInstructions(crs.Context, argIndex); if (instance >= argumentInstructions.Count) { return false; } crs.Goto(argumentInstructions[instance], (MoveType)2, false); return true; } public static bool TryGotoArg(this ILCursor crs, int argIndex, int instance = 0) { return crs.TryGotoArg(crs.Next, argIndex, instance); } public static IEnumerable MatchArg(this ILCursor crs, Instruction targetInstr, int argIndex) { if (argIndex < 0 || targetInstr == null) { yield break; } Instruction curr = crs.Next; List<Instruction> argumentInstrs = targetInstr.GetArgumentInstructions(crs.Context, argIndex); foreach (Instruction arg in argumentInstrs) { crs.Goto(arg, (MoveType)2, false); yield return null; } crs.Next = curr; } public static IEnumerable MatchArg(this ILCursor crs, int argIndex) { return crs.MatchArg(crs.Next, argIndex); } private static List<Instruction> GetArgumentInstructions(this Instruction instruction, ILContext context, int argumentIndex) { int num = instruction.InputCount(); int num2 = num - argumentIndex - 1; if (num2 < 0) { return new List<Instruction>(); } List<Instruction> list = instruction.PossiblePreviousInstructions(context); List<Instruction> list2 = new List<Instruction>(); foreach (Instruction item in list) { BacktrackToArg(item, context, num2, list2); } list2.Sort((Instruction a, Instruction b) => context.IndexOf(a).CompareTo(context.IndexOf(b))); return list2; } private static void BacktrackToArg(Instruction current, ILContext ctx, int remainingMoves, List<Instruction> foundArgs) { if (remainingMoves <= 0 && current.OutputCount() > 0) { if (remainingMoves == 0) { foundArgs.Add(current); } return; } remainingMoves -= current.StackDelta(); List<Instruction> list = current.PossiblePreviousInstructions(ctx); foreach (Instruction item in list) { BacktrackToArg(item, ctx, remainingMoves, foundArgs); } } public static int InputCount(this Instruction instr) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected I4, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 if (instr == null) { return 0; } OpCode opCode = instr.OpCode; if ((int)((OpCode)(ref opCode)).FlowControl == 2) { IMethodSignature val = (IMethodSignature)instr.Operand; int num = 0; if ((int)((OpCode)(ref opCode)).Code != 114 && val.HasThis && !val.ExplicitThis) { num++; } if (val.HasParameters) { num += val.Parameters.Count; } if ((int)((OpCode)(ref opCode)).Code == 40) { num++; } return num; } StackBehaviour stackBehaviourPop = ((OpCode)(ref opCode)).StackBehaviourPop; if (1 == 0) { } int result; switch (stackBehaviourPop - 1) { case 0: case 2: case 9: result = 1; break; case 1: case 3: case 4: case 5: case 7: case 8: case 10: case 11: result = 2; break; case 6: case 12: case 13: case 14: case 15: case 16: result = 3; break; default: result = 0; break; } if (1 == 0) { } return result; } public static int OutputCount(this Instruction instr) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected I4, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 if (instr == null) { return 0; } OpCode opCode = instr.OpCode; if ((int)((OpCode)(ref opCode)).FlowControl == 2) { IMethodSignature val = (IMethodSignature)instr.Operand; int num = 0; if ((int)((OpCode)(ref opCode)).Code == 114 || (int)val.ReturnType.MetadataType != 1) { num++; } return num; } StackBehaviour stackBehaviourPush = ((OpCode)(ref opCode)).StackBehaviourPush; if (1 == 0) { } int result; switch (stackBehaviourPush - 20) { case 0: case 2: case 3: case 4: case 5: case 6: result = 1; break; case 1: result = 2; break; default: result = 0; break; } if (1 == 0) { } return result; } public static int StackDelta(this Instruction instr) { return instr.OutputCount() - instr.InputCount(); } public static List<Instruction> PossiblePreviousInstructions(this Instruction instr, ILContext ctx) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) List<Instruction> list = new List<Instruction>(); Enumerator<Instruction> enumerator = ctx.Instrs.GetEnumerator(); try { while (enumerator.MoveNext()) { Instruction current = enumerator.Current; if (Array.IndexOf(current.PossibleNextInstructions(), instr) >= 0) { list.Add(current); } } } finally { ((IDisposable)enumerator).Dispose(); } return list; } public static Instruction[] PossibleNextInstructions(this Instruction instr) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected I4, but got Unknown OpCode opCode = instr.OpCode; FlowControl flowControl = ((OpCode)(ref opCode)).FlowControl; if (1 == 0) { } Instruction[] result; switch ((int)flowControl) { case 2: case 5: result = (Instruction[])(object)new Instruction[1] { instr.Next }; break; case 0: { Instruction branchTarget2 = instr.GetBranchTarget(); result = (Instruction[])(object)((branchTarget2 == null) ? new Instruction[0] : new Instruction[1] { branchTarget2 }); break; } case 3: { Instruction branchTarget = instr.GetBranchTarget(); result = (Instruction[])(object)((branchTarget == null) ? new Instruction[1] { instr.Next } : new Instruction[2] { instr.Next, branchTarget }); break; } default: result = (Instruction[])(object)new Instruction[0]; break; } if (1 == 0) { } return result; } public static Instruction GetBranchTarget(this Instruction branch) { object operand = branch.Operand; Instruction val = (Instruction)((operand is Instruction) ? operand : null); if (val != null) { return val; } object operand2 = branch.Operand; return ((ILLabel)(((operand2 is ILLabel) ? operand2 : null)?)).Target; } public static string InstructionToString(this Instruction c) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009d: Invalid comparison between Unknown and I4 //IL_0063: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) try { return ((object)c).ToString(); } catch { try { OpCode opCode = c.OpCode; OperandType operandType = ((OpCode)(ref opCode)).OperandType; if (((int)operandType == 0 || (int)operandType == 15) ? true : false) { object operand = c.Operand; ILLabel val = (ILLabel)((operand is ILLabel) ? operand : null); if (val != null) { object arg = c.Offset; opCode = c.OpCode; return $"IL_{arg:x4}: {((OpCode)(ref opCode)).Name} IL_{val.Target.Offset:x4}"; } } opCode = c.OpCode; if ((int)((OpCode)(ref opCode)).OperandType == 10 && c.Operand is IEnumerable<ILLabel> source) { object arg2 = c.Offset; opCode = c.OpCode; return string.Format("IL_{0:x4}: {1} {2}", arg2, ((OpCode)(ref opCode)).Name, string.Join(", ", source.Select((ILLabel x) => x.Target.Offset.ToString("x4")).ToArray())); } } catch { } } return "This shouldn't be happening"; } public static T EnumeratorGetField<T>(this object obj, string name) { return (T)obj.GetType().EnumeratorField(name).GetValue(obj); } public static FieldInfo EnumeratorField(this MethodBase method, string name) { return method.DeclaringType.EnumeratorField(name); } public static FieldInfo EnumeratorField(this Type tp, string name) { return tp.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).First((FieldInfo x) => (object)x != null && x.Name != null && (x.Name.Contains("<" + name + ">") || x.Name == name)); } } public class LittleGalDoStuffBehavior : BehaviorBase { private float idleTimer; private bool hadPlayedAnimThisIdle; private bool wasPlayingIdle; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); base.m_aiAnimator.OverrideIdleAnimation = (BraveUtility.RandomBool() ? "idle2" : null); } public override BehaviorResult Update() { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) bool flag = IsPlayingIdle(); if (base.m_aiAnimator.IsPlaying("pet_end")) { base.m_aiActor.ClearPath(); } if (base.m_aiAnimator.IsPlaying("removehelmet")) { base.m_aiActor.ClearPath(); } else if (flag && !base.m_aiActor.CompanionOwner.IsInCombat) { if (!hadPlayedAnimThisIdle) { idleTimer += base.m_deltaTime; if (idleTimer > 8f) { base.m_aiAnimator.PlayUntilFinished("removehelmet", false, (string)null, -1f, false); hadPlayedAnimThisIdle = true; } } } else { idleTimer = 0f; hadPlayedAnimThisIdle = false; } if (flag) { wasPlayingIdle = true; } else { if (wasPlayingIdle) { base.m_aiAnimator.OverrideIdleAnimation = (BraveUtility.RandomBool() ? "idle2" : null); } wasPlayingIdle = false; } return ((BehaviorBase)this).Update(); } public bool IsPlayingIdle() { return base.m_aiAnimator.IsPlaying("idle_right") || base.m_aiAnimator.IsPlaying("idle_left") || base.m_aiAnimator.IsPlaying("idle2_right") || base.m_aiAnimator.IsPlaying("idle2_left"); } } public class LittleGuyFindBehavior : BehaviorBase { private float m_findTimer; private float idleTimer; private bool hadSleptThisIdle; public float FindChance = 0.0475f; public float FindChanceSynergy = 0.07f; public float CChance = 0.189f; public float BChance = 0.063f; public float AChance = 0.017f; public float SChance = 0.015f; public float chanceMult = 0.95f; public float HighTierSynergyMult = 7f; public float CTierSynergyMult = 0.37f; private int failedAttempts; public override void Start() { ((BehaviorBase)this).Start(); if (!((Object)(object)base.m_aiActor.CompanionOwner == (Object)null)) { base.m_aiActor.CompanionOwner.OnRoomClearEvent += HandleRoomCleared; } } public override void Destroy() { if ((Object)(object)base.m_aiActor.CompanionOwner != (Object)null) { base.m_aiActor.CompanionOwner.OnRoomClearEvent -= HandleRoomCleared; } ((BehaviorBase)this).Destroy(); } private IEnumerator DelayedSpawnItem(Vector2 spawnPoint, GameObject item) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(2.84f); LootEngine.SpawnItem(item, Vector2.op_Implicit(spawnPoint), Vector2.down, 1f, true, false, false); } public GameObject GetItemForPlayer(PlayerController player, GenericLootTable tableToUse, ItemQuality targetQuality, List<GameObject> excludedObjects, Predicate<PickupObject> itemselect, bool ignorePlayerTraits = false, Random safeRandom = null, bool bossStyle = false, List<GameObject> additionalExcludedObjects = null, bool forceSynergyCompletion = false, RewardSource rewardSource = 0) { //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Invalid comparison between Unknown and I4 //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Invalid comparison between Unknown and I4 //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) bool flag = false; while ((int)targetQuality >= 0) { if ((int)targetQuality > 0) { flag = true; } List<WeightedGameObject> compiledRawItems = tableToUse.GetCompiledRawItems(); List<KeyValuePair<WeightedGameObject, float>> list = new List<KeyValuePair<WeightedGameObject, float>>(); float num = 0f; List<KeyValuePair<WeightedGameObject, float>> list2 = new List<KeyValuePair<WeightedGameObject, float>>(); float num2 = 0f; for (int i = 0; i < compiledRawItems.Count; i++) { if ((Object)(object)compiledRawItems[i].gameObject == (Object)null) { continue; } PickupObject component = compiledRawItems[i].gameObject.GetComponent<PickupObject>(); if ((Object)(object)component == (Object)null || (bossStyle && component is GungeonMapItem) || (itemselect != null && !itemselect(component))) { continue; } bool flag2 = RewardManager.CheckQualityForItem(component, player, targetQuality, forceSynergyCompletion, rewardSource); if ((component.ItemSpansBaseQualityTiers || component.ItemRespectsHeartMagnificence) && (int)targetQuality != 1 && (int)targetQuality != 0 && (int)targetQuality != 5) { flag2 = true; } if (!ignorePlayerTraits && component is SpiceItem && Object.op_Implicit((Object)(object)player) && player.spiceCount > 0) { flag2 = true; } if ((Object)(object)component == (Object)null || !flag2) { continue; } bool flag3 = true; float num3 = compiledRawItems[i].weight; if ((excludedObjects != null && excludedObjects.Contains(((Component)component).gameObject)) || (additionalExcludedObjects != null && additionalExcludedObjects.Contains(((Component)component).gameObject))) { continue; } if (!component.PrerequisitesMet()) { flag3 = false; } Gun val = (Gun)(object)((component is Gun) ? component : null); if (val != null) { if (val.InfiniteAmmo && !((PickupObject)val).CanBeDropped && (int)((PickupObject)val).quality == -50) { continue; } GunClass gunClass = val.gunClass; if (!ignorePlayerTraits && (int)gunClass > 0) { int num4 = (((Object)(object)player != (Object)null && player.inventory != null) ? player.inventory.ContainsGunOfClass(gunClass, true) : 0); float modifierForClass = LootDataGlobalSettings.Instance.GetModifierForClass(gunClass); num3 *= Mathf.Pow(modifierForClass, (float)num4); } } if (!ignorePlayerTraits) { float multiplierForItem = RewardManager.GetMultiplierForItem(component, player, forceSynergyCompletion); num3 *= multiplierForItem; } bool flag4 = !GameManager.Instance.IsSeeded; EncounterTrackable component2 = ((Component)component).GetComponent<EncounterTrackable>(); if ((Object)(object)component2 != (Object)null && flag4) { int num5 = GameStatsManager.Instance.QueryEncounterableDifferentiator(component2); if (num5 > 0 || GameManager.Instance.ExtantShopTrackableGuids.Contains(component2.EncounterGuid)) { flag3 = false; num2 += num3; KeyValuePair<WeightedGameObject, float> item = new KeyValuePair<WeightedGameObject, float>(compiledRawItems[i], num3); list2.Add(item); } else if (GameStatsManager.Instance.QueryEncounterable(component2) == 0 && GameStatsManager.Instance.QueryEncounterableAnnouncement(component2.EncounterGuid)) { num3 *= 10f; } } if (component.ItemSpansBaseQualityTiers || component.ItemRespectsHeartMagnificence) { if (RewardManager.AdditionalHeartTierMagnificence >= 3f) { num3 *= GameManager.Instance.RewardManager.ThreeOrMoreHeartMagMultiplier; } else if (RewardManager.AdditionalHeartTierMagnificence >= 1f) { num3 *= GameManager.Instance.RewardManager.OneOrTwoHeartMagMultiplier; } } if (flag3) { num += num3; KeyValuePair<WeightedGameObject, float> item2 = new KeyValuePair<WeightedGameObject, float>(compiledRawItems[i], num3); list.Add(item2); } } if (list.Count == 0 && list2.Count > 0) { list = list2; num = num2; } if (num > 0f && list.Count > 0) { float num6 = (ignorePlayerTraits ? ((float)safeRandom.NextDouble()) : Random.value); float num7 = num * num6; for (int j = 0; j < list.Count; j++) { num7 -= list[j].Value; if (num7 <= 0f) { return list[j].Key.gameObject; } } return list[list.Count - 1].Key.gameObject; } targetQuality = (ItemQuality)(targetQuality - 1); if ((int)targetQuality < 0 && !flag) { targetQuality = (ItemQuality)1; } } return null; } private void HandleRoomCleared(PlayerController obj) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) int num = failedAttempts; if (PassiveItem.IsFlagSetAtAll(typeof(BattleStandardItem))) { num += 15; } if ((Object)(object)obj != (Object)null && obj.inventory != null && obj.inventory.AllGuns != null && obj.inventory.AllGuns.Exists((Gun x) => x.IsLuteCompanionBuff)) { num += 15; } if (Random.value * Mathf.Pow(chanceMult, (float)num) >= (base.m_aiActor.CompanionOwner.HasActiveBonusSynergy(Plugin.heavyweightSynergy, false) ? FindChanceSynergy : FindChance)) { failedAttempts++; return; } if (Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)base.m_aiActor).transform.position) != base.m_aiActor.CompanionOwner.CurrentRoom || base.m_aiAnimator.IsPlaying("sleep")) { base.m_aiActor.CompanionWarp(Vector2.op_Implicit(((GameActor)base.m_aiActor.CompanionOwner).CenterPosition)); } float value = Random.value; ItemQuality targetQuality = (ItemQuality)1; bool flag = base.m_aiActor.CompanionOwner.HasActiveBonusSynergy(Plugin.rareLootSynergy, false); float num2 = 1f; if (flag) { num2 = HighTierSynergyMult; } if (value < SChance * num2) { targetQuality = (ItemQuality)5; } else if (value < SChance * num2 + AChance * num2) { targetQuality = (ItemQuality)4; } else if (value < SChance * num2 + AChance * num2 + BChance * num2) { targetQuality = (ItemQuality)3; } else if (value < SChance * num2 + AChance * num2 + BChance * num2 + CChance * (flag ? CTierSynergyMult : 1f)) { targetQuality = (ItemQuality)2; } m_findTimer = 2.6f; base.m_aiAnimator.PlayUntilFinished("find", false, (string)null, -1f, false); GameObject itemForPlayer = GetItemForPlayer(base.m_aiActor.CompanionOwner, GameManager.Instance.RewardManager.ItemsLootTable, targetQuality, null, (PickupObject x) => x is PlayerItem, ignorePlayerTraits: false, null, bossStyle: false, null, forceSynergyCompletion: false, (RewardSource)0); ((MonoBehaviour)GameManager.Instance.Dungeon).StartCoroutine(DelayedSpawnItem(((GameActor)base.m_aiActor).CenterPosition, itemForPlayer)); failedAttempts = 0; AkSoundEngine.PostEvent("Play_PET_dog_bark_01", ((Component)base.m_aiActor).gameObject); } public override BehaviorResult Update() { //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (m_findTimer > 0f) { ((BehaviorBase)this).DecrementTimer(ref m_findTimer, false); base.m_aiActor.ClearPath(); } if ((base.m_aiAnimator.IsPlaying("idle_right") || base.m_aiAnimator.IsPlaying("idle_left")) && !base.m_aiAnimator.IsPlaying("sleep") && !hadSleptThisIdle && !base.m_aiActor.CompanionOwner.IsInCombat) { idleTimer += base.m_deltaTime; if (idleTimer > 8f) { base.m_aiAnimator.PlayUntilFinished("sleep", false, (string)null, -1f, false); hadSleptThisIdle = true; } } else if (base.m_aiAnimator.IsPlaying("sleep")) { base.m_aiActor.ClearPath(); } else if ((!base.m_aiAnimator.IsPlaying("idle_right") && !base.m_aiAnimator.IsPlaying("idle_left") && !base.m_aiAnimator.IsPlaying("sleep")) || base.m_aiActor.CompanionOwner.IsInCombat) { idleTimer = 0f; hadSleptThisIdle = false; } if (base.m_aiAnimator.IsPlaying("pet_end")) { base.m_aiActor.ClearPath(); } return ((BehaviorBase)this).Update(); } } [HarmonyPatch] public class PetOffsetHolder : MonoBehaviour { public Vector2 petOffsetRight; public Vector2 petOffsetLeft; [HarmonyPatch(typeof(CompanionController), "DoPet")] [HarmonyPostfix] public static void ApplyOverridePetOffset_Postfix(CompanionController __instance, PlayerController player) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) PetOffsetHolder component = ((Component)__instance).GetComponent<PetOffsetHolder>(); if (!((Object)(object)component == (Object)null)) { if (((BraveBehaviour)__instance).specRigidbody.UnitCenter.x > ((BraveBehaviour)player).specRigidbody.UnitCenter.x) { __instance.m_petOffset = component.petOffsetRight; } else { __instance.m_petOffset = component.petOffsetLeft; } } } } [BepInPlugin("spapi.etg.littleguy", "Little Guy", "1.3.1")] public class Plugin : BaseUnityPlugin { public const string GUID = "spapi.etg.littleguy"; public static AssetBundle bundle; public static Texture2D lilguybosscard; public static Texture2D lilguybosscard2; public static CustomSynergyType heavyweightSynergy; public static CustomSynergyType rareLootSynergy; public static CustomSynergyType notEnoughSynergy; public static CustomSynergyType wholeZooSynergy; public static GungeonFlags completedSinisterCountdown; public void Awake() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LittleGuy.LittleGuy.Assets.AssetBundles.littleguybundle")) { bundle = AssetBundle.LoadFromStream(stream); } lilguybosscard = bundle.LoadAsset<Texture2D>("little_guy_bosscard_001"); lilguybosscard2 = bundle.LoadAsset<Texture2D>("little_guy_and_gal_bosscard_001"); ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart); new Harmony("spapi.etg.littleguy").PatchAll(); } public void GMStart(GameManager manager) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Expected O, but got Unknown //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Expected O, but got Unknown //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Expected O, but got Unknown //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Expected O, but got Unknown //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Expected O, but got Unknown //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Expected O, but got Unknown //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_0745: Expected O, but got Unknown //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Expected O, but got Unknown //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Expected O, but got Unknown completedSinisterCountdown = ETGModCompatibility.ExtendEnum<GungeonFlags>("spapi.etg.littleguy", "SINISTER_COUNTDOWN_COMPLETE"); bool flag = GameStatsManager.HasInstance && GameStatsManager.Instance.GetFlag(completedSinisterCountdown); StrangeRoot.Init(); ((IEnumerable<AdvancedSynergyEntry>)GameManager.Instance.SynergyManager.synergies).FirstOrDefault((Func<AdvancedSynergyEntry, bool>)((AdvancedSynergyEntry x) => x.bonusSynergies.Contains((CustomSynergyType)372))).OptionalItemIDs.Add(StrangeRoot.rootid); ((IEnumerable<AdvancedSynergyEntry>)GameManager.Instance.SynergyManager.synergies).FirstOrDefault((Func<AdvancedSynergyEntry, bool>)((AdvancedSynergyEntry x) => x.bonusSynergies.Contains((CustomSynergyType)243))).OptionalItemIDs.Add(StrangeRoot.rootid); GameManager.Instance.SynergyManager.synergies = CollectionExtensions.AddRangeToArray<AdvancedSynergyEntry>(GameManager.Instance.SynergyManager.synergies, (AdvancedSynergyEntry[])(object)new AdvancedSynergyEntry[4] { new AdvancedSynergyEntry { NameKey = "#LG_HEAVYWEIGHT", MandatoryItemIDs = new List<int> { StrangeRoot.rootid }, OptionalItemIDs = new List<int> { 133 }, OptionalGunIDs = new List<int> { 539 }, bonusSynergies = new List<CustomSynergyType> { heavyweightSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "HEAVYWEIGHT") }, statModifiers = new List<StatModifier>() }, new AdvancedSynergyEntry { NameKey = "#LG_RARELOOT", MandatoryItemIDs = new List<int> { StrangeRoot.rootid }, OptionalItemIDs = new List<int> { 605, 289 }, bonusSynergies = new List<CustomSynergyType> { rareLootSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "RARE_LOOT") }, statModifiers = new List<StatModifier>() }, new AdvancedSynergyEntry { NameKey = "#LG_NOTENOUGHSPACE", MandatoryItemIDs = new List<int> { StrangeRoot.rootid }, OptionalItemIDs = new List<int> { 155 }, OptionalGunIDs = new List<int> { 169 }, bonusSynergies = new List<CustomSynergyType> { notEnoughSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "NOT_ENOUGH_SPACE") }, statModifiers = new List<StatModifier> { StatModifier.Create((StatType)8, (ModifyMethod)0, 2f) } }, new AdvancedSynergyEntry { NameKey = "#LG_WHOLEZOO", MandatoryItemIDs = new List<int> { StrangeRoot.rootid }, OptionalGunIDs = new List<int> { 369, 176, 599, 406 }, bonusSynergies = new List<CustomSynergyType> { wholeZooSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "WHOLE_ZOO") }, statModifiers = new List<StatModifier> { StatModifier.Create((StatType)5, (ModifyMethod)1, 0.75f), StatModifier.Create((StatType)2, (ModifyMethod)1, 1.1f) }, ActiveWhenGunUnequipped = false } }); Databases.Strings.Synergy.Set("#LG_HEAVYWEIGHT", "Heavy Weight"); Databases.Strings.Synergy.Set("#LG_RARELOOT", "Rare Loot"); Databases.Strings.Synergy.Set("#LG_NOTENOUGHSPACE", "Not Enough Space"); Databases.Strings.Synergy.Set("#LG_WHOLEZOO", "Whole Zoo"); ((Component)PickupObjectDatabase.GetById(539)).gameObject.AddComponent<HeavyWeightSynergyForBoxingGlove>(); ((Component)PickupObjectDatabase.GetById(369)).gameObject.AddComponent<WholeZooSynergy>(); ((Component)PickupObjectDatabase.GetById(176)).gameObject.AddComponent<WholeZooSynergy>(); ((Component)PickupObjectDatabase.GetById(599)).gameObject.AddComponent<WholeZooSynergy>(); ((Component)PickupObjectDatabase.GetById(406)).gameObject.AddComponent<WholeZooSynergy>(); string text = "Little Guy has successfully infiltrated the game."; if (flag) { text = "Little Guy (and Little Gal) have successfully infiltrated the game."; } int num = 48; SGroup val = new SGroup { Size = new Vector2(20000f, (float)num), AutoLayoutPadding = 0f, Background = Color.clear, AutoLayout = (SGroup x) => x.AutoLayoutHorizontal }; float num2 = 0.3f; Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor((byte)93, (byte)174, (byte)13, byte.MaxValue); Color32 val3 = default(Color32); ((Color32)(ref val3))..ctor((byte)177, (byte)202, (byte)19, byte.MaxValue); if (flag) { ((Color32)(ref val3))..ctor((byte)0, (byte)140, (byte)198, byte.MaxValue); } Gradient val4 = new Gradient(); val4.colorKeys = (GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(Color32.op_Implicit(val2), 0f), new GradientColorKey(Color32.op_Implicit(val3), 0.5f), new GradientColorKey(Color32.op_Implicit(val2), 1f) }; Gradient val5 = val4; for (int i = 0; i < text.Length; i++) { char c = text[i]; Color foreground = val5.Evaluate((float)i / (float)(text.Length - 1) / 2f); if (c == ' ') { ((SElement)val).Children.Add((SElement)new SRect(Color.clear) { Size = Vector2.one * 10f }); } else { ((SElement)val).Children.Add((SElement)new SLabel(c.ToString()) { Foreground = foreground, With = { (SModifier)(object)new GradientThingy(val5, (float)i / (float)(text.Length - 1) / 2f) } }); } } ((SElement)val).Children.Add((SElement)new SRect(Color.clear) { Size = Vector2.one * 10f }); if (flag) { Texture2D val6 = bundle.LoadAsset<Texture2D>("gal"); ((SElement)val).Children.Add((SElement)new SLabel { Icon = (Texture)(object)val6, IconScale = Vector2.one * num2, With = { (SModifier)(object)new MovementThingy(0.5f, 2.5f) } }); ((SElement)val).Children.Add((SElement)new SRect(Color.clear) { Size = new Vector2((float)((Texture)val6).width * num2, (float)num) }); } Texture2D val7 = bundle.LoadAsset<Texture2D>("guy"); ((SElement)val).Children.Add((SElement)new SLabel { Icon = (Texture)(object)val7, IconScale = Vector2.one * num2, With = { (SModifier)(object)new MovementThingy(0f, 2.5f) } }); ((SElement)val).Children.Add((SElement)new SRect(Color.clear) { Size = new Vector2((float)((Texture)val7).width * num2, (float)num) }); ((SElement)((ETGModMenu)ETGModConsole.Instance).GUI)[0].Children.Add((SElement)(object)val); } } public class GradientThingy : SModifier { public Gradient gradient; public float offs; public GradientThingy(Gradient gradient, float offs) { this.gradient = gradient; this.offs = offs; ((SModifier)this)..ctor(); } public override void Update() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) base.Elem.Foreground = gradient.Evaluate((Time.realtimeSinceStartup * 0.25f + offs) % 1f); } } public class MovementThingy : SModifier { public float offs; public float amplitude; public MovementThingy(float offs, float amplitude) { this.offs = offs; this.amplitude = amplitude; ((SModifier)this)..ctor(); } public override void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) base.Elem.Position = Vector2Extensions.WithY(base.Elem.Position, Mathf.Sin((Time.realtimeSinceStartup * 0.5f + offs) * (float)Math.PI * 2f) * amplitude); } } public class StayFartherAwayOutsideCombat : BehaviorBase { private CompanionFollowPlayerBehavior follow; public float CombatDistance; public float OutOfCombatDistance; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); if (!((Object)(object)aiActor == (Object)null) && !((Object)(object)((BraveBehaviour)aiActor).behaviorSpeculator == (Object)null) && ((BraveBehaviour)aiActor).behaviorSpeculator.MovementBehaviors != null) { follow = ((BraveBehaviour)aiActor).behaviorSpeculator.MovementBehaviors.OfType<CompanionFollowPlayerBehavior>().FirstOrDefault(); } } public override BehaviorResult Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (follow != null) { follow.IdealRadius = (base.m_aiActor.CompanionOwner.IsInCombat ? CombatDistance : OutOfCombatDistance); } return ((BehaviorBase)this).Update(); } } public class StrangeRoot : CompanionItem { public class LittleGuyEntry : EnemyDatabaseEntry { public override AssetBundle assetBundle => Plugin.bundle; } public static GameObject guy; public static GameObject gal; public static int rootid; public static int rootsid; public static tk2dSpriteCollectionData rootscoll; public GameObject littlegal; public bool hasgal; public float timer = 450f; public float lastSinisterCountdownTime = 450f; public bool doSinisterCooldown; public bool cachedCanBeDropped; public static Dictionary<float, string> sinisterCountdown = new Dictionary<float, string> { { 1f, "1 SECOND" }, { 2f, "2 SECONDS" }, { 3f, "3 SECONDS" }, { 4f, "4 SECONDS" }, { 5f, "5 SECONDS" }, { 6f, "6 SECONDS" }, { 7f, "7 SECONDS" }, { 8f, "8 SECONDS" }, { 9f, "9 SECONDS" }, { 10f, "10 SECONDS" }, { 60f, "1 MINUTE" }, { 180f, "3 MINUTES" }, { 300f, "5 MINUTES" } }; public static void Init() { string name = "Strange Root"; string shortdesc = "Little Guy"; string longdesc = "Grants you two more active item slots and occasionally finds an active item after room completion.\n\nA young fox squire, born in a far-away land ravaged by ruthless diplomacy and warfare. Although he is still too inexperienced for combat, he has gotten used to lugging around the heavy equipment of his former master, and has a great eye for finding loot in the battlefield..."; StrangeRoot strangeRoot = BuildStrangeRoot(name, shortdesc, longdesc, (ItemQuality)4, 2); ((CompanionItem)strangeRoot).CompanionGuid = BuildGuy(); BuildGal(); rootid = ((PickupObject)strangeRoot).PickupObjectId; rootsid = ((tk2dBaseSprite)((Component)strangeRoot).GetComponent<tk2dSprite>()).spriteId; rootscoll = ((tk2dBaseSprite)((Component)strangeRoot).GetComponent<tk2dSprite>()).Collection; } public override void Pickup(PlayerController player) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((CompanionItem)this).Pickup(player); player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Combine(player.OnNewFloorLoaded, new Action<PlayerController>(HandleNewFloorGal)); CreateGal(player); if (!GameStatsManager.Instance.GetFlag(Plugin.completedSinisterCountdown)) { cachedCanBeDropped = ((PickupObject)this).CanBeDropped; doSinisterCooldown = true; ((PickupObject)this).CanBeDropped = false; } } public void HandleNewFloorGal(PlayerController obj) { DestroyGal(); if (!base.PreventRespawnOnFloorLoad) { CreateGal(obj); } } public override void DisableEffect(PlayerController player) { DestroyGal(); if ((Object)(object)player != (Object)null) { player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(HandleNewFloorGal)); } if (doSinisterCooldown && (Object)(object)GameManager.Instance.Dungeon != (Object)null) { RenderSettings.ambientIntensity = GameManager.Instance.Dungeon.TargetAmbientIntensity; Pixelator.Instance.pointLightMultiplier = 1f; } } public override DebrisObject Drop(PlayerController player) { DestroyGal(); player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(HandleNewFloorGal)); return ((CompanionItem)this).Drop(player); } public void DestroyGal() { if (Object.op_Implicit((Object)(object)littlegal)) { Object.Destroy((Object)(object)littlegal); littlegal = null; } } public override void Update() { //IL_02b6: Unknown result type (might be due to invalid IL or missing references) ((CompanionItem)this).Update(); if (!((PassiveItem)this).PickedUp || !((Object)(object)((PassiveItem)this).Owner != (Object)null) || hasgal || !(timer > 0f)) { return; } timer -= BraveTime.DeltaTime; if (doSinisterCooldown) { foreach (KeyValuePair<float, string> item in sinisterCountdown) { if (item.Key >= timer && item.Key < lastSinisterCountdownTime) { lastSinisterCountdownTime = item.Key; GameUIRoot.Instance.notificationController.ForceHide(); GameUIRoot.Instance.notificationController.DoCustomNotification("YOU HAVE", item.Value, ((BraveBehaviour)this).sprite.Collection, ((BraveBehaviour)this).sprite.spriteId, (NotificationColor)2, true, false); AkSoundEngine.PostEvent("Play_WPN_kthulu_blast_01", ((Component)this).gameObject); break; } } } if (timer <= 0f) { Vector3? positionOverride = null; if (((PassiveItem)this).Owner.CurrentRoom != null) { CameraController cam = GameManager.Instance.MainCameraController; DungeonData dungeondata = GameManager.Instance.Dungeon.data; IEnumerable<IntVector2> enumerable = (from r in ((PassiveItem)this).Owner.CurrentRoom.connectedRooms.Concat((IEnumerable<RoomHandler>)(object)new RoomHandler[1] { ((PassiveItem)this).Owner.CurrentRoom }) select r.Cells.Where(delegate(IntVector2 x) { //IL_0006: 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_001a: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Invalid comparison between Unknown and I4 bool flag = dungeondata.CheckInBoundsAndValid(x) && !dungeondata.isTopWall(x.x, x.y) && !dungeondata.isWall(x); bool flag2 = flag; if (flag2) { bool flag3 = !cam.PointIsVisible(Vector2.op_Implicit(((IntVector2)(ref x)).ToVector3())); bool flag4 = flag3; if (!flag4) { bool flag5 = dungeondata.GetRoomFromPosition(x) != null; bool flag6 = flag5; if (flag6) { VisibilityStatus visibility = dungeondata.GetRoomFromPosition(x).visibility; bool flag7 = (((int)visibility == 0 || (int)visibility == 3) ? true : false); flag6 = flag7; } flag4 = flag6; } flag2 = flag4; } return flag2; })).SelectMany((IEnumerable<IntVector2> x) => x); if (enumerable.Any()) { float closest = -1f; CollectionExtensions.Do<IntVector2>(enumerable, (Action<IntVector2>)delegate(IntVector2 x) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) float num2 = Vector3.Distance(((IntVector2)(ref x)).ToVector3(), Vector2.op_Implicit(((GameActor)((PassiveItem)this).Owner).CenterPosition)); if (closest < 0f || num2 < closest) { closest = num2; positionOverride = ((IntVector2)(ref x)).ToVector3(); } }); } } hasgal = true; DestroyGal(); CreateGal(((PassiveItem)this).Owner, positionOverride); if (doSinisterCooldown) { ((PickupObject)this).CanBeDropped = cachedCanBeDropped; RenderSettings.ambientIntensity = GameManager.Instance.Dungeon.TargetAmbientIntensity; Pixelator.Instance.pointLightMultiplier = 1f; doSinisterCooldown = false; GameStatsManager.Instance.SetFlag(Plugin.completedSinisterCountdown, true); } } else if (timer <= 10f && doSinisterCooldown) { float num = 0.5f + Mathf.Ceil(timer) * 0.05f; RenderSettings.ambientIntensity = Mathf.Min(num * GameManager.Instance.Dungeon.TargetAmbientIntensity, RenderSettings.ambientIntensity); Pixelator.Instance.pointLightMultiplier = num; } } public void CreateGal(PlayerController owner, Vector3? overridePosition = null) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (hasgal) { littlegal = Object.Instantiate<GameObject>(((Component)EnemyDatabase.GetOrLoadByGuid("lg_lilgal")).gameObject, (Vector3)(((??)overridePosition) ?? (((BraveBehaviour)owner).transform.position + Vector3.right)), Quaternion.identity); CompanionController orAddComponent = GameObjectExtensions.GetOrAddComponent<CompanionController>(littlegal); orAddComponent.Initialize(owner); if ((Object)(object)((BraveBehaviour)orAddComponent).specRigidbody != (Object)null) { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)orAddComponent).specRigidbody, (int?)null, false); } } } public static StrangeRoot BuildStrangeRoot(string name, string shortdesc, string longdesc, ItemQuality quality, int slotsToAdd) { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) GameObject val = Plugin.bundle.LoadAsset<GameObject>("strangeroot"); StrangeRoot strangeRoot = val.AddComponent<StrangeRoot>(); Databases.Items.SetupItem((PickupObject)(object)strangeRoot, name); tk2dSpriteDefinition currentSpriteDef = ((BraveBehaviour)strangeRoot).sprite.GetCurrentSpriteDef(); if ((Object)(object)currentSpriteDef.material != (Object)null) { currentSpriteDef.material.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTintableTilted"); } if ((Object)(object)currentSpriteDef.materialInst != (Object)null) { currentSpriteDef.materialInst.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTintableTilted"); } tk2dSpriteDefinition val2 = CopyDefinitionFrom(((BraveBehaviour)strangeRoot).sprite.GetCurrentSpriteDef()); if ((Object)(object)val2.material != (Object)null) { val2.material.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTilted"); } if ((Object)(object)val2.materialInst != (Object)null) { val2.materialInst.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTilted"); } tk2dSpriteCollectionData encounterIconCollection = AmmonomiconController.ForceInstance.EncounterIconCollection; encounterIconCollection.spriteDefinitions = CollectionExtensions.AddToArray<tk2dSpriteDefinition>(encounterIconCollection.spriteDefinitions, val2); encounterIconCollection.spriteNameLookupDict = null; encounterIconCollection.InitDictionary(); ((BraveBehaviour)strangeRoot).encounterTrackable.journalData.AmmonomiconSprite = ((BraveBehaviour)strangeRoot).sprite.GetCurrentSpriteDef().name; GunExt.SetShortDescription((PickupObject)(object)strangeRoot, shortdesc); GunExt.SetLongDescription((PickupObject)(object)strangeRoot, longdesc); Game.Items.Add("lg:" + ETGMod.ToID(name), (PickupObject)(object)strangeRoot); Databases.Items.AddSpecific((PickupObject)(object)strangeRoot, false, "ANY"); ((PickupObject)strangeRoot).quality = quality; ((PassiveItem)strangeRoot).passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { StatModifier.Create((StatType)8, (ModifyMethod)0, (float)slotsToAdd) }; return strangeRoot; } public static string BuildGal() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_005a: Expected O, but got Unknown //IL_005c: 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_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01d8: 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_01ed: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Expected O, but got Unknown //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Expected O, but got Unknown //IL_03a6: 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_03c3: Expected O, but got Unknown //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Expected O, but got Unknown //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Expected O, but got Unknown //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Expected O, but got Unknown //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) string text = "lg_lilgal"; GameObject val = Plugin.bundle.LoadAsset<GameObject>("littlegal"); SpeculativeRigidbody val2 = val.AddComponent<SpeculativeRigidbody>(); val2.PixelColliders = new List<PixelCollider> { new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)1, ManualWidth = 8, ManualHeight = 14, ManualOffsetX = 2, ManualOffsetY = 0 }, new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)0, ManualWidth = 10, ManualHeight = 16, ManualOffsetX = 1, ManualOffsetY = 0 } }; AIActor val3 = val.AddComponent<AIActor>(); val3.EnemyGuid = text; val3.CanDropCurrency = false; val3.CollisionDamage = 0.5f; val3.IgnoreForRoomClear = true; val3.IsNormalEnemy = false; val3.MovementSpeed = 6f; ((GameActor)val3).ActorName = "Little Gal"; ((GameActor)val3).DoDustUps = true; ((GameActor)val3).DustUpInterval = 0.125f; ((GameActor)val3).HasShadow = true; val.AddComponent<HitEffectHandler>(); HealthHaver val4 = val.AddComponent<HealthHaver>(); val4.SetHealthMaximum(15000f, (float?)null, true); KnockbackDoer val5 = val.AddComponent<KnockbackDoer>(); val5.shouldBounce = false; val5.weight = 35f; AIAnimator val6 = val.AddComponent<AIAnimator>(); val6.facingType = (FacingType)2; DirectionalAnimation val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "idle"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; val6.IdleAnimation = val7; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "move"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; val6.MoveAnimation = val7; val7 = new DirectionalAnimation(); val7.AnimNames = new string[0]; val7.Prefix = ""; val7.Flipped = (FlipType[])(object)new FlipType[0]; val7.Type = (DirectionType)0; val6.FlightAnimation = val7; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "hit"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; val6.HitAnimation = val7; List<NamedDirectionalAnimation> list = new List<NamedDirectionalAnimation>(); NamedDirectionalAnimation val8 = new NamedDirectionalAnimation(); val8.name = "removehelmet"; NamedDirectionalAnimation obj = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "removehelmet"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj.anim = val7; list.Add(val8); val8 = new NamedDirectionalAnimation(); val8.name = "pet"; NamedDirectionalAnimation obj2 = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "pet"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj2.anim = val7; list.Add(val8); val8 = new NamedDirectionalAnimation(); val8.name = "pet_end"; NamedDirectionalAnimation obj3 = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "pet_end"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj3.anim = val7; list.Add(val8); val8 = new NamedDirectionalAnimation(); val8.name = "idle2"; NamedDirectionalAnimation obj4 = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "idle2"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj4.anim = val7; list.Add(val8); val6.OtherAnimations = list; val.AddComponent<ObjectVisibilityManager>(); BehaviorSpeculator val9 = val.AddComponent<BehaviorSpeculator>(); List<MovementBehaviorBase> list2 = new List<MovementBehaviorBase>(); CompanionFollowPlayerBehavior val10 = new CompanionFollowPlayerBehavior(); val10.CanRollOverPits = false; val10.CatchUpAccelTime = 3f; val10.CatchUpAnimation = ""; val10.CatchUpMaxSpeed = 10f; val10.CatchUpOutAnimation = ""; val10.CatchUpRadius = 8f; val10.CatchUpSpeed = 6f; val10.DisableInCombat = true; val10.IdealRadius = 3f; val10.IdleAnimations = new string[0]; val10.RollAnimation = ""; val10.PathInterval = 0.25f; val10.TemporarilyDisabled = false; list2.Add((MovementBehaviorBase)(object)val10); list2.Add((MovementBehaviorBase)new SeekTargetBehavior { CustomRange = 2f, ExternalCooldownSource = false, LineOfSight = true, PathInterval = 0.25f, ReturnToSpawn = true, SpawnTetherDistance = 0f, StopWhenInRange = true }); val9.MovementBehaviors = list2; val9.OtherBehaviors = new List<BehaviorBase> { (BehaviorBase)(object)new LittleGalDoStuffBehavior() }; val9.TargetBehaviors = new List<TargetBehaviorBase> { (TargetBehaviorBase)new TargetPlayerBehavior { LineOfSight = true, ObjectPermanence = true, PauseOnTargetSwitch = true, PauseTime = 0.25f, Radius = 35f, SearchInterval = 0.25f } }; val9.AttackBehaviors = new List<AttackBehaviorBase>(); ((ISerializedObject)val9).SerializedObjectReferences = new List<Object>(0); ((ISerializedObject)val9).SerializedStateKeys = new List<string> { "OverrideBehaviors", "OtherBehaviors", "TargetBehaviors", "AttackBehaviors", "MovementBehaviors" }; ((ISerializedObject)val9).SerializedStateValues = new List<string> { "", "", "", "", "" }; CompanionController val11 = val.AddComponent<CompanionController>(); val11.CanBePet = true; val11.CanInterceptBullets = true; PetOffsetHolder petOffsetHolder = val.AddComponent<PetOffsetHolder>(); petOffsetHolder.petOffsetLeft = new Vector2(-0.6875f, -0.3125f); petOffsetHolder.petOffsetRight = new Vector2(0.5f, -0.3125f); val.AddComponent<HealOnTakingDamage>(); ((AssetBundleDatabase<AIActor, EnemyDatabaseEntry>)(object)EnemyDatabase.Instance).Entries.Add((EnemyDatabaseEntry)(object)new LittleGuyEntry { difficulty = (PlaceableDifficulty)0, encounterGuid = text, ForcedPositionInAmmonomicon = 0, isInBossTab = false, isNormalEnemy = false, myGuid = text, path = ((Object)val).name, placeableHeight = 1, placeableWidth = 1, unityGuid = text }); Game.Enemies.Add("lg:little_gal", val3); gal = val; return text; } public static string BuildGuy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_005a: Expected O, but got Unknown //IL_005c: 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_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01d8: 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_01ed: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_032b: 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_0348: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Expected O, but got Unknown //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Expected O, but got Unknown //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Expected O, but got Unknown //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) string text = "lg_lilguy"; GameObject val = Plugin.bundle.LoadAsset<GameObject>("littleguy"); SpeculativeRigidbody val2 = val.AddComponent<SpeculativeRigidbody>(); val2.PixelColliders = new List<PixelCollider> { new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)3, ManualWidth = 8, ManualHeight = 14, ManualOffsetX = 6, ManualOffsetY = 0 }, new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)2, ManualWidth = 10, ManualHeight = 16, ManualOffsetX = 5, ManualOffsetY = 0 } }; AIActor val3 = val.AddComponent<AIActor>(); val3.EnemyGuid = text; val3.CanDropCurrency = false; val3.CollisionDamage = 0.5f; val3.IgnoreForRoomClear = true; val3.IsNormalEnemy = false; val3.MovementSpeed = 6f; ((GameActor)val3).ActorName = "Little Guy"; ((GameActor)val3).DoDustUps = true; ((GameActor)val3).DustUpInterval = 0.125f; ((GameActor)val3).HasShadow = true; val.AddComponent<HitEffectHandler>(); HealthHaver val4 = val.AddComponent<HealthHaver>(); val4.SetHealthMaximum(15000f, (float?)null, true); KnockbackDoer val5 = val.AddComponent<KnockbackDoer>(); val5.shouldBounce = false; val5.weight = 35f; AIAnimator val6 = val.AddComponent<AIAnimator>(); val6.facingType = (FacingType)2; DirectionalAnimation val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "idle"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; val6.IdleAnimation = val7; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "move"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; val6.MoveAnimation = val7; val7 = new DirectionalAnimation(); val7.AnimNames = new string[0]; val7.Prefix = ""; val7.Flipped = (FlipType[])(object)new FlipType[0]; val7.Type = (DirectionType)0; val6.FlightAnimation = val7; val7 = new DirectionalAnimation(); val7.AnimNames = new string[0]; val7.Prefix = ""; val7.Flipped = (FlipType[])(object)new FlipType[0]; val7.Type = (DirectionType)0; val6.HitAnimation = val7; List<NamedDirectionalAnimation> list = new List<NamedDirectionalAnimation>(); NamedDirectionalAnimation val8 = new NamedDirectionalAnimation(); val8.name = "find"; NamedDirectionalAnimation obj = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "finditem"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj.anim = val7; list.Add(val8); val8 = new NamedDirectionalAnimation(); val8.name = "sleep"; NamedDirectionalAnimation obj2 = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "sleep"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj2.anim = val7; list.Add(val8); val8 = new NamedDirectionalAnimation(); val8.name = "pet"; NamedDirectionalAnimation obj3 = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "pet"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj3.anim = val7; list.Add(val8); val8 = new NamedDirectionalAnimation(); val8.name = "pet_end"; NamedDirectionalAnimation obj4 = val8; val7 = new DirectionalAnimation(); val7.AnimNames = new string[2] { "", "" }; val7.Prefix = "pet_end"; val7.Flipped = (FlipType[])(object)new FlipType[2]; val7.Type = (DirectionType)2; obj4.anim = val7; list.Add(val8); val6.OtherAnimations = list; val.AddComponent<ObjectVisibilityManager>(); BehaviorSpeculator val9 = val.AddComponent<BehaviorSpeculator>(); List<MovementBehaviorBase> list2 = new List<MovementBehaviorBase>(); CompanionFollowPlayerBehavior val10 = new CompanionFollowPlayerBehavior(); val10.CanRollOverPits = false; val10.CatchUpAccelTime = 3f; val10.CatchUpAnimation = ""; val10.CatchUpMaxSpeed = 10f; val10.CatchUpOutAnimation = ""; val10.CatchUpRadius = 8f; val10.CatchUpSpeed = 6f; val10.DisableInCombat = false; val10.IdealRadius = 3f; val10.IdleAnimations = new string[0]; val10.RollAnimation = ""; val10.PathInterval = 0.25f; val10.TemporarilyDisabled = false; list2.Add((MovementBehaviorBase)(object)val10); val9.MovementBehaviors = list2; val9.OtherBehaviors = new List<BehaviorBase> { (BehaviorBase)(object)new LittleGuyFindBehavior(), (BehaviorBase)(object)new StayFartherAwayOutsideCombat { CombatDistance = 3f, OutOfCombatDistance = 4f } }; ((ISerializedObject)val9).SerializedObjectReferences = new List<Object>(0); ((ISerializedObject)val9).SerializedStateKeys = new List<string> { "OverrideBehaviors", "OtherBehaviors", "TargetBehaviors", "AttackBehaviors", "MovementBehaviors" }; ((ISerializedObject)val9).SerializedStateValues = new List<string> { "", "", "", "", "" }; CompanionController val11 = val.AddComponent<CompanionController>(); val11.CanBePet = true; val.AddComponent<HeavyWeightSynergyForLittleGuy>(); PetOffsetHolder petOffsetHolder = val.AddComponent<PetOffsetHolder>(); petOffsetHolder.petOffsetLeft = new Vector2(-0.8125f, -0.4375f); petOffsetHolder.petOffsetRight = new Vector2(0.625f, -0.4375f); ((AssetBundleDatabase<AIActor, EnemyDatabaseEntry>)(object)EnemyDatabase.Instance).Entries.Add((EnemyDatabaseEntry)(object)new LittleGuyEntry { difficulty = (PlaceableDifficulty)0, encounterGuid = text, ForcedPositionInAmmonomicon = 0, isInBossTab = false, isNormalEnemy = false, myGuid = text, path = ((Object)val).name, placeableHeight = 1, placeableWidth = 1, unityGuid = text }); Game.Enemies.Add("lg:little_guy", val3); guy = val; return text; } public static tk2dSpriteDefinition CopyDefinitionFrom(tk2dSpriteDefinition other) { //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_0009: Unknown result type (might be due to invalid IL or missing references) //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_004e: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: 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_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: 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_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteDefinition val = new tk2dSpriteDefinition { boundsDataCenter = new Vector3 { x = other.boundsDataCenter.x, y = other.boundsDataCenter.y, z = other.boundsDataCenter.z }, boundsDataExtents = new Vector3 { x = other.boundsDataExtents.x, y = other.boundsDataExtents.y, z = other.boundsDataExtents.z }, colliderConvex = other.colliderConvex, colliderSmoothSphereCollisions = other.colliderSmoothSphereCollisions, colliderType = other.colliderType, colliderVertices = other.colliderVertices, collisionLayer = other.collisionLayer, complexGeometry = other.complexGeometry, extractRegion = other.extractRegion, flipped = other.flipped, indices = other.indices, material = new Material(other.material), materialId = other.materialId, materialInst = new Material(other.materialInst), metadata = other.metadata, name = other.name, normals = other.normals, physicsEngine = other.physicsEngine, position0 = new Vector3 { x = other.position0.x, y = other.position0.y, z = other.position0.z }, position1 = new Vector3 { x = other.position1.x, y = other.position1.y, z = other.position1.z }, position2 = new Vector3 { x = other.position2.x, y = other.position2.y, z = other.position2.z }, position3 = new Vector3 { x = other.position3.x, y = other.position3.y, z = other.position3.z }, regionH = other.regionH, regionW = other.regionW, regionX = other.regionX, regionY = other.regionY, tangents = other.tangents, texelSize = new Vector2 { x = other.texelSize.x, y = other.texelSize.y }, untrimmedBoundsDataCenter = new Vector3 { x = other.untrimmedBoundsDataCenter.x, y = other.untrimmedBoundsDataCenter.y, z = other.untrimmedBoundsDataCenter.z }, untrimmedBoundsDataExtents = new Vector3 { x = other.untrimmedBoundsDataExtents.x, y = other.untrimmedBoundsDataExtents.y, z = other.untrimmedBoundsDataExtents.z } }; if (other.uvs != null) { List<Vector2> list = new List<Vector2>(); Vector2[] uvs = other.uvs; foreach (Vector2 val2 in uvs) { list.Add(new Vector2 { x = val2.x, y = val2.y }); } val.uvs = list.ToArray(); } else { val.uvs = null; } if (other.colliderVertices != null) { List<Vector3> list2 = new List<Vector3>(); Vector3[] colliderVertices = other.colliderVertices; foreach (Vector3 val3 in colliderVertices) { list2.Add(new Vector3 { x = val3.x, y = val3.y, z = val3.z }); } val.colliderVertices = list2.ToArray(); } else { val.colliderVertices = null; } return val; } } [HarmonyPatch] public class LittleGuyPatches { public static MethodInfo ccbflg_s_ccb = AccessTools.Method(typeof(LittleGuyPatches), "ChangeCoopBosscardForLittleGuy_Slides_ChangeCoopBosscard", (Type[])null, (Type[])null); public static MethodInfo ccbflg_v_ccb = AccessTools.Method(typeof(LittleGuyPatches), "ChangeCoopBosscardForLittleGuy_Visibility_ChangeCoopBosscard", (Type[])null, (Type[])null); public static MethodInfo dcswlg_cgt = AccessTools.Method(typeof(LittleGuyPatches), "DoCoopSlideWithLittleGuy_ChangeGameType", (Type[])null, (Type[])null); [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] public static void ChangeCoopBosscardForLittleGuy_Slides_Transpiler(ILContext ctx) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(ctx); if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<dfControl>(x, "set_IsVisible"), 2)) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Call, (MethodBase)ccbflg_s_ccb); } } public static void ChangeCoopBosscardForLittleGuy_Slides_ChangeCoopBosscard(IEnumerator enumerator) { if (HasLittleGuy(out var hasgal)) { BossCardUIController val = enumerator.EnumeratorGetField<BossCardUIController>("$this"); bool isVisible = ((dfControl)val.playerSprite).IsVisible; bool isVisible2 = ((dfControl)val.coopSprite).IsVisible; if (!(isVisible && isVisible2)) { dfTextureSprite val2 = (isVisible ? val.coopSprite : val.playerSprite); val2.texture = (Texture)(object)(hasgal ? Plugin.lilguybosscard2 : Plugin.lilguybosscard); ((dfControl)val2).IsVisible = true; ((dfControl)val2).ZOrder = ((dfControl)val.bossSprite).ZOrder + 1; } } } [HarmonyPatch(typeof(BossCardUIController), "ToggleCoreVisiblity")] [HarmonyILManipulator] public static void ChangeCoopBosscardForLittleGuy_Visibility_Transpiler(ILContext ctx) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(ctx); if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<dfControl>(x, "set_IsVisible"), 6)) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Call, (MethodBase)ccbflg_v_ccb); } } public static void ChangeCoopBosscardForLittleGuy_Visibility_ChangeCoopBosscard(BossCardUIController ui) { if (HasLittleGuy(out var hasgal)) { bool isVisible = ((dfControl)ui.playerSprite).IsVisible; bool isVisible2 = ((dfControl)ui.coopSprite).IsVisible; if (!(isVisible && isVisible2)) { dfTextureSprite val = (isVisible ? ui.coopSprite : ui.playerSprite); val.texture = (Texture)(object)(hasgal ? Plugin.lilguybosscard2 : Plugin.lilguybosscard); ((dfControl)val).IsVisible = true; ((dfControl)val).ZOrder = ((dfControl)ui.bossSprite).ZOrder + 1; } } } [HarmonyPatch(typeof(SpawnObjectPlayerItem), "DoSpawn")] [HarmonyPostfix] public static void NotEnoughSynergy_Postfix(SpawnObjectPlayerItem __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (((PickupObject)__instance).PickupObjectId == 155 && !((Object)(object)((PlayerItem)__instance).LastOwner == (Object)null) && ((PlayerItem)__instance).LastOwner.HasActiveBonusSynergy(Plugin.notEnoughSynergy, false) && !((Object)(object)__instance.spawnedPlayerObject == (Object)null) && !((Object)(object)__instance.spawnedPlayerObject.GetComponent<BlackHoleDoer>() == (Object)null)) { BlackHoleDoer component = __instance.spawnedPlayerObject.GetComponent<BlackHoleDoer>(); component.coreDuration += 2f; } } [HarmonyPatch(typeof(CompanionController), "StopPet")] [HarmonyPrefix] public static void PlayPostPetAnim_Prefix(CompanionController __instance) { if (!((Object)(object)__instance.m_pettingDoer