using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Microsoft.CodeAnalysis;
using P2.GameSystem;
using P2.GameSystem.Actor;
using P2.GameSystem.Actor.Status;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Boss_HP_Multiplier")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Boss HP Multiplier")]
[assembly: AssemblyTitle("Boss_HP_Multiplier")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Boss_HP_Multiplier
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Boss_HP_Multiplier";
public const string PLUGIN_NAME = "Boss HP Multiplier";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BossHPMultiplier
{
[BepInPlugin("com.melonthug.bosshpmultiplier", "Boss HP Multiplier", "1.0.1")]
public class Plugin : BasePlugin
{
public static Plugin Instance;
public static ManualLogSource Logger;
public static readonly Dictionary<string, ConfigEntry<float>> Multipliers = new Dictionary<string, ConfigEntry<float>>();
public static readonly Dictionary<string, string> RealToInternal = new Dictionary<string, string>
{
{ "Dodonga", "unit201_01_01" },
{ "Majidonga", "unit208_01_01" },
{ "Kacchindonga", "unit242_01_01" },
{ "Ciokina", "unit211_01_01" },
{ "Cioking", "unit212_01_01" },
{ "Shookle", "unit213_01_01" },
{ "Shooshookle", "unit214_01_01" },
{ "Gaeen", "unit215_01_01" },
{ "Dogaeen", "unit216_01_01" },
{ "Zaknel", "unit220_01_01" },
{ "Dokaknel", "unit221_01_01" },
{ "Goruru", "unit222_01_01" },
{ "Garuru", "unit223_01_01" },
{ "Mochichichi", "unit224_01_01" },
{ "Fenicchi", "unit225_01_01" },
{ "Manboth", "unit226_01_01" },
{ "Manboroth", "unit227_01_01" },
{ "Centura", "unit228_01_01" },
{ "Darantula", "unit229_01_01" },
{ "Kanogias", "unit230_01_01" },
{ "Ganodias", "unit231_01_01" },
{ "Dettankarmen", "unit232_01_01" },
{ "Zuttankarmen", "unit233_01_01" }
};
public static Dictionary<string, string> InternalToReal;
public override void Load()
{
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
ClassInjector.RegisterTypeInIl2Cpp<CoroutineRunner>();
InternalToReal = RealToInternal.ToDictionary((KeyValuePair<string, string> kv) => kv.Value, (KeyValuePair<string, string> kv) => kv.Key);
foreach (string key in RealToInternal.Keys)
{
Multipliers[key] = ((BasePlugin)this).Config.Bind<float>("Multiplier", key, 1f, "HP multipler for " + key);
}
Logger = ((BasePlugin)this).Log;
Harmony val = new Harmony("com.melonthug.bosshpmultiplier");
val.PatchAll();
Instance = this;
Logger.LogInfo((object)"[Boss HP Multiplier] loaded");
}
}
public class CoroutineRunner : MonoBehaviour
{
private static CoroutineRunner _instance;
public static CoroutineRunner Instance
{
get
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if ((Object)(object)_instance == (Object)null)
{
GameObject val = new GameObject("BossHPMultiplier_CoroutineRunner");
Object.DontDestroyOnLoad((Object)(object)val);
_instance = val.AddComponent<CoroutineRunner>();
}
return _instance;
}
}
public CoroutineRunner(IntPtr handle)
: base(handle)
{
}
public CoroutineRunner()
: base(ClassInjector.DerivedConstructorPointer<CoroutineRunner>())
{
ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this);
}
}
[HarmonyPatch(typeof(ActorObj), "createActorStatus")]
internal class CreateActorStatusHook
{
[CompilerGenerated]
private sealed class <ModifyHP>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ActorStatusObj status;
private ActorObj <actorObj>5__1;
private string <internalName>5__2;
private string <realName>5__3;
private ConfigEntry<float> <multiplier>5__4;
private int <maxHP>5__5;
private int <hp>5__6;
private int <newHP>5__7;
private int <tempMaxHP>5__8;
private int <tempHP>5__9;
private ManualLogSource <>s__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ModifyHP>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<actorObj>5__1 = null;
<internalName>5__2 = null;
<realName>5__3 = null;
<multiplier>5__4 = null;
<>s__10 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
if (status == null)
{
return false;
}
<actorObj>5__1 = status.getActorObj();
if (<actorObj>5__1 == null)
{
return false;
}
<internalName>5__2 = <actorObj>5__1.getArcResourceNode();
if (<internalName>5__2 == null)
{
return false;
}
((BasePlugin)Plugin.Instance).Config.Reload();
if (!Plugin.InternalToReal.TryGetValue(<internalName>5__2, out <realName>5__3))
{
return false;
}
if (!Plugin.Multipliers.TryGetValue(<realName>5__3, out <multiplier>5__4))
{
return false;
}
<maxHP>5__5 = ((GameStatus)status).getMaxHitPoint();
<hp>5__6 = ((GameStatus)status).getHitPoint();
<newHP>5__7 = (int)((float)<maxHP>5__5 * <multiplier>5__4.Value);
((GameStatus)status).setHitPoint(<newHP>5__7);
((GameStatus)status).info_.maxHitPoint = <newHP>5__7;
<tempMaxHP>5__8 = ((GameStatus)status).getMaxHitPoint();
<tempHP>5__9 = ((GameStatus)status).getHitPoint();
<>s__10 = Plugin.Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 5, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Changed ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(<realName>5__3);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'s HP from ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<hp>5__6);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<maxHP>5__5);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<tempHP>5__9);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<tempMaxHP>5__8);
}
<>s__10.LogInfo(val);
<>s__10 = null;
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static void Postfix(string pArcResourceNode, ActorObj __instance)
{
((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ModifyHP(__instance.pActorStatus_)));
}
[IteratorStateMachine(typeof(<ModifyHP>d__1))]
private static IEnumerator ModifyHP(ActorStatusObj status)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ModifyHP>d__1(0)
{
status = status
};
}
}
}