using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HG.BlendableTypes; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.Projectile; using RoR2; using RoR2.Projectile; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EnlargedSurvivor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("EnlargedSurvivor")] [assembly: AssemblyTitle("EnlargedSurvivor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 EnlargedSurvivor { [BepInPlugin("dileppy.enlargedsurvivor", "EnlargedSurvivor", "1.0.2")] public class EnlargedSurvivorPlugin : BaseUnityPlugin { public enum SizeTier { Large, ExtraLarge, Colossal } private struct TierValues { public float size; public float move; public float jump; public float damage; public float attackSpeed; public float rewardMult; public TierValues(float s, float m, float j, float d, float a, float r) { size = s; move = m; jump = j; damage = d; attackSpeed = a; rewardMult = r; } } private class EnlargedMarker : MonoBehaviour { public Vector3 baseScale; } public const string PluginGUID = "dileppy.enlargedsurvivor"; public const string PluginName = "EnlargedSurvivor"; public const string PluginVersion = "1.0.2"; private const string BiggerBulletsGUID = "dileppy.biggerbullets"; private const string ShrunkenSurvivorGUID = "dileppy.shrunkensurvivor"; private static bool biggerBulletsPresent; private static readonly Dictionary Defaults = new Dictionary { { SizeTier.Large, new TierValues(1.4f, 1.1f, 1.1f, 1.3f, 0.85f, 0.9f) }, { SizeTier.ExtraLarge, new TierValues(1.8f, 1.2f, 1.15f, 1.7f, 0.7f, 0.75f) }, { SizeTier.Colossal, new TierValues(2.5f, 1.35f, 1.25f, 2.5f, 0.55f, 0.6f) } }; public static ConfigEntry Tier; public static ConfigEntry EnlargeProjectiles; public static ConfigEntry UseCustomValues; public static ConfigEntry CustomSize; public static ConfigEntry CustomMove; public static ConfigEntry CustomJump; public static ConfigEntry CustomDamage; public static ConfigEntry CustomAttackSpeed; public static ConfigEntry CustomReward; public static ConfigEntry PenaltyRewards; public static ConfigEntry CompensateTargeting; public static ConfigEntry CameraPullBack; public static ConfigEntry TinyWeapon; public static ConfigEntry WeaponScale; public static ConfigEntry DebugLogging; private void Awake() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Expected O, but got Unknown Tier = ((BaseUnityPlugin)this).Config.Bind("General", "SizeTier", SizeTier.Large, "How enlarged you are. Large=140%, ExtraLarge=180%, Colossal=250%. Bigger = more damage and speed, but slower fire rate and less gold/XP."); EnlargeProjectiles = ((BaseUnityPlugin)this).Config.Bind("General", "EnlargeProjectiles", true, "Also physically enlarge your projectiles to match your size. Automatically disabled if BiggerBullets is installed (it takes over bullet sizing)."); PenaltyRewards = ((BaseUnityPlugin)this).Config.Bind("Challenge", "PenaltyRewards", true, "Reduce gold and XP earned per kill when enlarged: -10% (Large), -25% (ExtraLarge), -40% (Colossal). Being huge is comfortable - it shouldn't also be a farming exploit."); CompensateTargeting = ((BaseUnityPlugin)this).Config.Bind("Challenge", "CompensateTargeting", false, "Being huge makes you easier to hit. Enable this to add a max HP bonus (+15%/+30%/+50%) per tier to compensate."); CameraPullBack = ((BaseUnityPlugin)this).Config.Bind("Fun", "CameraPullBack", 0.6f, new ConfigDescription("How much the camera pulls back from your enlarged survivor (0=normal, 1=fully scaled). Makes enemies look like ants beneath you.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); TinyWeapon = ((BaseUnityPlugin)this).Config.Bind("Fun", "TinyWeapon", true, "Scale the weapon bone DOWN relative to your enormous body, so your giant survivor brandishes a comically tiny gun."); WeaponScale = ((BaseUnityPlugin)this).Config.Bind("Fun", "WeaponScale", 0.45f, new ConfigDescription("How tiny the weapon looks relative to the enlarged body.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 1f), Array.Empty())); UseCustomValues = ((BaseUnityPlugin)this).Config.Bind("Custom", "UseCustomValues", false, "Ignore the tier presets and use the Custom* values below instead."); CustomSize = ((BaseUnityPlugin)this).Config.Bind("Custom", "CustomSize", 1.8f, new ConfigDescription("Model size multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 5f), Array.Empty())); CustomMove = ((BaseUnityPlugin)this).Config.Bind("Custom", "CustomMove", 1.2f, new ConfigDescription("Move speed multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 3f), Array.Empty())); CustomJump = ((BaseUnityPlugin)this).Config.Bind("Custom", "CustomJump", 1.15f, new ConfigDescription("Jump power multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 3f), Array.Empty())); CustomDamage = ((BaseUnityPlugin)this).Config.Bind("Custom", "CustomDamage", 1.7f, new ConfigDescription("Damage multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 5f), Array.Empty())); CustomAttackSpeed = ((BaseUnityPlugin)this).Config.Bind("Custom", "CustomAttackSpeed", 0.7f, new ConfigDescription("Attack speed multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 1f), Array.Empty())); CustomReward = ((BaseUnityPlugin)this).Config.Bind("Custom", "CustomReward", 0.75f, new ConfigDescription("Gold/XP reward multiplier", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 1f), Array.Empty())); DebugLogging = ((BaseUnityPlugin)this).Config.Bind("Advanced", "DebugLogging", false, "Log applied multipliers to the console for verification."); if (Chainloader.PluginInfos.ContainsKey("dileppy.shrunkensurvivor")) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"EnlargedSurvivor: ShrunkenSurvivor is also installed. Running both simultaneously will produce unpredictable results. Use one at a time."); } biggerBulletsPresent = Chainloader.PluginInfos.ContainsKey("dileppy.biggerbullets"); if (biggerBulletsPresent) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"EnlargedSurvivor: BiggerBullets detected - deferring all bullet sizing to it."); } CharacterBody.Start += new hook_Start(CharacterBody_Start); CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats); ProjectileController.Start += new hook_Start(ProjectileController_Start); DeathRewards.OnKilledServer += new hook_OnKilledServer(DeathRewards_OnKilledServer); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} v{1} loaded. Tier={2}", "EnlargedSurvivor", "1.0.2", Tier.Value)); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown CharacterBody.Start -= new hook_Start(CharacterBody_Start); CharacterBody.RecalculateStats -= new hook_RecalculateStats(CharacterBody_RecalculateStats); ProjectileController.Start -= new hook_Start(ProjectileController_Start); DeathRewards.OnKilledServer -= new hook_OnKilledServer(DeathRewards_OnKilledServer); } private TierValues Current() { if (UseCustomValues.Value) { return new TierValues(CustomSize.Value, CustomMove.Value, CustomJump.Value, CustomDamage.Value, CustomAttackSpeed.Value, CustomReward.Value); } return Defaults[Tier.Value]; } private static bool IsPlayer(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.master)) { return Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController); } return false; } private static void ApplyAbsoluteScale(GameObject go, float factor) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)go)) { return; } Scene scene = go.scene; if (((Scene)(ref scene)).IsValid()) { EnlargedMarker enlargedMarker = go.GetComponent(); if (!Object.op_Implicit((Object)(object)enlargedMarker)) { enlargedMarker = go.AddComponent(); enlargedMarker.baseScale = go.transform.localScale; } go.transform.localScale = enlargedMarker.baseScale * factor; } } private void CharacterBody_Start(orig_Start orig, CharacterBody self) { //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //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) orig.Invoke(self); if (!IsPlayer(self)) { return; } try { TierValues tierValues = Current(); ModelLocator modelLocator = self.modelLocator; if (Object.op_Implicit((Object)(object)modelLocator) && Object.op_Implicit((Object)(object)modelLocator.modelTransform)) { ApplyAbsoluteScale(((Component)modelLocator.modelTransform).gameObject, tierValues.size); if (TinyWeapon.Value && WeaponScale.Value < 0.999f) { string[] array = new string[15] { "gun", "weapon", "pistol", "rifle", "musket", "launcher", "crossbow", "bow", "sword", "blade", "hammer", "cleaver", "knife", "railgun", "shotgun" }; Transform[] componentsInChildren = ((Component)modelLocator.modelTransform).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { string text = ((Object)val).name.ToLowerInvariant(); string[] array2 = array; foreach (string value in array2) { if (text.Contains(value)) { ApplyAbsoluteScale(((Component)val).gameObject, WeaponScale.Value); if (DebugLogging.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("EnlargedSurvivor: tiny-weapon scaled bone '" + ((Object)val).name + "'")); } break; } } } } if (DebugLogging.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"EnlargedSurvivor: enlarged {self.GetDisplayName()} to {tierValues.size:P0}"); } } if (!(CameraPullBack.Value > 0.001f)) { return; } CameraTargetParams component = ((Component)self).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.cameraParams)) { float num = Mathf.Lerp(1f, tierValues.size, CameraPullBack.Value); CharacterCameraParams val2 = Object.Instantiate(component.cameraParams); val2.data.idealLocalCameraPos = BlendableVector3.op_Implicit(component.cameraParams.data.idealLocalCameraPos.value * num); val2.data.pivotVerticalOffset = BlendableFloat.op_Implicit(component.cameraParams.data.pivotVerticalOffset.value * num); component.cameraParams = val2; if (DebugLogging.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"EnlargedSurvivor: camera pulled back to {num:P0}"); } } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"EnlargedSurvivor: model enlarge failed: {arg}"); } } private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (IsPlayer(self)) { TierValues tierValues = Current(); self.moveSpeed *= tierValues.move; self.jumpPower *= tierValues.jump; self.damage *= tierValues.damage; self.attackSpeed *= tierValues.attackSpeed; if (CompensateTargeting.Value && !UseCustomValues.Value) { float num = Tier.Value switch { SizeTier.Large => 1.15f, SizeTier.ExtraLarge => 1.3f, SizeTier.Colossal => 1.5f, _ => 1f, }; self.maxHealth *= num; } } } private void ProjectileController_Start(orig_Start orig, ProjectileController self) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!EnlargeProjectiles.Value || biggerBulletsPresent || !Object.op_Implicit((Object)(object)self.owner)) { return; } CharacterBody component = self.owner.GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !IsPlayer(component)) { return; } try { float size = Current().size; ApplyAbsoluteScale(((Component)self).gameObject, size); if (Object.op_Implicit((Object)(object)self.ghost)) { ApplyAbsoluteScale(((Component)self.ghost).gameObject, size); } ProjectileDamage component2 = ((Component)self).GetComponent(); if (Object.op_Implicit((Object)(object)component2) && (Object)(object)((Component)self).GetComponent() != (Object)null) { component2.damage = component2.damage / ((Component)self).transform.localScale.x * size; } if (DebugLogging.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"EnlargedSurvivor: enlarged projectile {((Object)((Component)self).gameObject).name} to {size:P0}"); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"EnlargedSurvivor: projectile enlarge failed: {arg}"); } } private void DeathRewards_OnKilledServer(orig_OnKilledServer orig, DeathRewards self, DamageReport damageReport) { if (PenaltyRewards.Value && !UseCustomValues.Value && (Object)(object)damageReport?.attackerBody != (Object)null && IsPlayer(damageReport.attackerBody)) { float rewardMult = Current().rewardMult; self.goldReward = (uint)((float)self.goldReward * rewardMult); self.expReward = (uint)((float)self.expReward * rewardMult); } orig.Invoke(self, damageReport); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "EnlargedSurvivor"; public const string PLUGIN_NAME = "EnlargedSurvivor"; public const string PLUGIN_VERSION = "1.0.2"; } }