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.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using IssaPlugin.Items; using IssaPlugin.Network; using IssaPlugin.Overlays; using IssaPlugin.Patches; using Microsoft.CodeAnalysis; using Mirror; using Unity.Collections; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Localization; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("IssaPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.37.0")] [assembly: AssemblyInformationalVersion("0.0.37+705789c3dbe8b09d98f4e6e3d4ee3d6b8e300d6b")] [assembly: AssemblyProduct("My first plugin")] [assembly: AssemblyTitle("IssaPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.37.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 IssaPlugin { public class AC130Config { private const string Section = "AC130"; private const string MaydaySection = "AC130Mayday"; public ConfigEntry Uses { get; private set; } public ConfigEntry GiveKey { get; private set; } public ConfigEntry OrbitRadius { get; private set; } public ConfigEntry OrbitSpeed { get; private set; } public ConfigEntry Altitude { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry CameraPitch { get; private set; } public ConfigEntry CameraDistance { get; private set; } public ConfigEntry FireCooldown { get; private set; } public ConfigEntry RocketAngularJitter { get; private set; } public ConfigEntry BoostMultiplier { get; private set; } public ConfigEntry AltitudeOffsetMax { get; private set; } public ConfigEntry AltitudeAdjustSpeed { get; private set; } public ConfigEntry ZoomFov { get; private set; } public ConfigEntry ZoomSpeed { get; private set; } public ConfigEntry ApproachDistance { get; private set; } public ConfigEntry ApproachSpeed { get; private set; } public ConfigEntry BaseFov { get; private set; } public ConfigEntry YawLimit { get; private set; } public ConfigEntry PitchLimit { get; private set; } public ConfigEntry MouseSensitivity { get; private set; } public ConfigEntry HeavyFireCooldown { get; private set; } public ConfigEntry HeavyShotsBeforeReload { get; private set; } public ConfigEntry HeavyReloadTime { get; private set; } public ConfigEntry MaydayEnabled { get; private set; } public ConfigEntry MaydayKey { get; private set; } public ConfigEntry MaydayDiveSteepRate { get; private set; } public ConfigEntry MaydayInitialDiveAngle { get; private set; } public ConfigEntry MaydayMaxDiveAngle { get; private set; } public ConfigEntry MaydayPullInfluence { get; private set; } public ConfigEntry MaydayRollSpeed { get; private set; } public ConfigEntry MaydaySpeed { get; private set; } public ConfigEntry MaydayDrift { get; private set; } public ConfigEntry MaydayCenterBias { get; private set; } public ConfigEntry MaydayCamYawLimit { get; private set; } public ConfigEntry MaydayCamPitchLimit { get; private set; } public ConfigEntry MaydayShakeBase { get; private set; } public ConfigEntry MaydayShakeMax { get; private set; } public ConfigEntry MaydayExplosionScale { get; private set; } public ConfigEntry MaydayExplosionDuration { get; private set; } public ConfigEntry MaydayRollTurnRate { get; private set; } public ConfigEntry HitsToMayday { get; private set; } public ConfigEntry RocketProximityFuse { get; private set; } public ConfigEntry ApplyCoffeeBoostAfterwards { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public ConfigEntry HeavyRocketExplosionScale { get; private set; } public AC130Config(ConfigFile cfg, GlobalConfig global) { Uses = cfg.Bind("AC130", "Uses", 1f, "Number of AC130 uses per pickup."); GiveKey = cfg.Bind("AC130", "GiveKey", (Key)104, "Key to press to add the AC130 to your inventory."); OrbitRadius = cfg.Bind("AC130", "OrbitRadius", 100f, "Radius in units of the circle the gunship flies around the map centre."); OrbitSpeed = cfg.Bind("AC130", "OrbitSpeed", 6f, "Degrees per second at which the gunship orbits the map centre."); Altitude = cfg.Bind("AC130", "Altitude", 140f, "Height above the map centre the gunship flies at."); Duration = cfg.Bind("AC130", "Duration", 20f, "How many seconds the AC130 remains active before leaving."); CameraPitch = cfg.Bind("AC130", "CameraPitch", 80f, "Camera pitch angle in degrees during the AC130 (0 = horizontal, 90 = straight down)."); CameraDistance = cfg.Bind("AC130", "CameraDistance", 80f, "Camera distance addition from the gunship pivot during the AC130."); FireCooldown = cfg.Bind("AC130", "FireCooldown", 0.35f, "Minimum seconds between rocket fires."); HeavyFireCooldown = cfg.Bind("AC130", "HeavyFireCooldown", 3f, "Minimum seconds between heavy (big shot) rocket fires."); HeavyShotsBeforeReload = cfg.Bind("AC130", "HeavyShotsBeforeReload", 3f, "Number of big shots before the heavy rocket must reload."); HeavyReloadTime = cfg.Bind("AC130", "HeavyReloadTime", 8f, "Time in seconds for the heavy rocket to reload after depleting all big shots."); RocketAngularJitter = cfg.Bind("AC130", "RocketAngularJitter", 0.5f, "Random angular jitter in degrees applied to each rocket fired from the AC130."); BoostMultiplier = cfg.Bind("AC130", "BoostMultiplier", 2.25f, "Multiplier applied to orbit speed when holding Left Shift."); AltitudeOffsetMax = cfg.Bind("AC130", "AltitudeOffsetMax", 80f, "Maximum units the player can raise the gunship from its base altitude using Q/E."); AltitudeAdjustSpeed = cfg.Bind("AC130", "AltitudeAdjustSpeed", 10f, "Units per second the gunship rises or descends when holding Q or E."); ZoomFov = cfg.Bind("AC130", "ZoomFov", 20f, "Field of view when right-click zooming in the AC130. Lower values zoom in more (default camera FOV is typically 60)."); ZoomSpeed = cfg.Bind("AC130", "ZoomSpeed", 8f, "Speed at which the camera lerps to and from the zoomed FOV when right-clicking."); ApproachDistance = cfg.Bind("AC130", "ApproachDistance", 200f, "How far away the AC130 spawns and flies in from before reaching the orbit point."); ApproachSpeed = cfg.Bind("AC130", "ApproachSpeed", 60f, "Speed in units per second at which the AC130 flies in and out."); BaseFov = cfg.Bind("AC130", "BaseFov", 60f, "Base field of view for the AC130 camera."); YawLimit = cfg.Bind("AC130", "YawLimit", 40f, "How many degrees left/right the player can pan from the map centre."); PitchLimit = cfg.Bind("AC130", "PitchLimit", 30f, "How many degrees up/down the player can pan from the map centre."); MouseSensitivity = cfg.Bind("AC130", "MouseSensitivity", 0.15f, "How sensitive the player's mouse is to panning the camera."); ApplyCoffeeBoostAfterwards = cfg.Bind("AC130", "ApplyCoffeeBoostAfterwards", true, "Give the user of an AC130 a max coffee boost after the AC130 ends to make up for the time they spent sitting in the AC130, not golfing."); MaydayEnabled = cfg.Bind("AC130Mayday", "Enabled", true, "Whether the manual mayday self-destruct hotkey is available."); MaydayKey = cfg.Bind("AC130Mayday", "Key", (Key)27, "Hotkey to manually trigger mayday (self-destruct) while in an AC130 session."); MaydayDiveSteepRate = cfg.Bind("AC130Mayday", "DiveSteepRate", 8f, "Degrees per second at which the dive pitch steepens toward vertical."); MaydayInitialDiveAngle = cfg.Bind("AC130Mayday", "InitialDiveAngle", 20f, "Starting pitch angle (degrees below horizontal) when mayday begins."); MaydayMaxDiveAngle = cfg.Bind("AC130Mayday", "MaxDiveAngle", 85f, "Maximum pitch angle (degrees below horizontal) the dive steepens to."); MaydayPullInfluence = cfg.Bind("AC130Mayday", "PullInfluence", 6f, "Degrees per second of pitch influence the player has when holding W/S during mayday."); MaydayRollSpeed = cfg.Bind("AC130Mayday", "RollSpeed", 45f, "Degrees per second the player can roll the gunship with A/D during mayday."); MaydaySpeed = cfg.Bind("AC130Mayday", "Speed", 80f, "Forward speed of the gunship during the mayday dive in units per second."); MaydayDrift = cfg.Bind("AC130Mayday", "Drift", 3f, "Maximum random lateral drift added to the dive direction per second."); MaydayCenterBias = cfg.Bind("AC130Mayday", "CenterBias", 0.4f, "Lerp strength per second toward map centre during the dive. Higher = tighter spiral, lower = nearly straight. Default 0.4."); MaydayCamYawLimit = cfg.Bind("AC130Mayday", "CamYawLimit", 25f, "How many degrees left/right the player can look during mayday."); MaydayCamPitchLimit = cfg.Bind("AC130Mayday", "CamPitchLimit", 15f, "How many degrees up/down the player can look during mayday."); MaydayShakeBase = cfg.Bind("AC130Mayday", "ShakeBase", 0.3f, "Camera shake intensity at the start of the mayday dive."); MaydayShakeMax = cfg.Bind("AC130Mayday", "ShakeMax", 2.5f, "Maximum camera shake intensity at the end of the dive."); MaydayExplosionScale = cfg.Bind("AC130Mayday", "ExplosionScale", 4f, "Explosion scale multiplier for the mayday crash. Affects blast radius, knockback, and VFX size."); MaydayExplosionDuration = cfg.Bind("AC130Mayday", "ExplosionDuration", 12f, "How long (seconds) the crash explosion VFX lingers before being destroyed."); MaydayRollTurnRate = cfg.Bind("AC130Mayday", "RollTurnRate", 45f, "Degrees per second of yaw the aircraft gains when fully banked (90° roll). Controls how tightly rolling steers the plane left/right."); HitsToMayday = cfg.Bind("AC130Mayday", "HitsToMayday", 1f, "Number of rocket hits required to force the gunship into mayday. Only counts hits during an active session. Set to 0 to disable."); RocketProximityFuse = cfg.Bind("AC130Mayday", "RocketProximityFuse", 4f, "Distance in metres at which a homing rocket detonates near the gunship. Must be less than 5 m so the explosion's overlap sphere (radius 5 m) still reaches the gunship and registers the hit."); ExplosionScale = cfg.Bind("Explosions", "AC130Scale", 2.25f, "Multiplier for AC130 rocket explosions. Affects blast radius, knockback, and VFX size."); HeavyRocketExplosionScale = cfg.Bind("Explosions", "AC130HeavyRocketScale", 5f, "Multiplier for AC130 heavy (big shot) rocket explosions. Affects blast radius, knockback, and VFX size."); } } public class AK47Config { private const string Section = "AK47"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry FireRate { get; private set; } public ConfigEntry Inaccuracy { get; private set; } public ConfigEntry MaxAimingDistance { get; private set; } public ConfigEntry MaxShotDistance { get; private set; } public ConfigEntry ScreenShakeIntensity { get; private set; } public AK47Config(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("AK47", "GiveKey", (Key)80, "Debug key to add the Sub-Machine Gun to your inventory."); Uses = cfg.Bind("AK47", "Uses", 10f, "Total bullets per Sub-Machine Gun pickup. Each shot consumes one use."); FireRate = cfg.Bind("AK47", "FireRate", 0.04f, "Seconds between each bullet in the burst."); Inaccuracy = cfg.Bind("AK47", "Inaccuracy", 5f, "Random spread angle (degrees) applied to each bullet. Higher = less accurate."); MaxAimingDistance = cfg.Bind("AK47", "MaxAimingDistance", 500f, "Max distance used when computing the aim point for each bullet."); MaxShotDistance = cfg.Bind("AK47", "MaxShotDistance", 500f, "Max raycast distance for each bullet."); ScreenShakeIntensity = cfg.Bind("AK47", "ScreenShakeIntensity", 0.25f, "Intensity of the screen shake when firing the AK47. 0 disables it. Higher values shake more."); } } public class BaseballBatConfig { private const string Section = "BaseballBat"; public ConfigEntry PowerMultiplier { get; private set; } public ConfigEntry GolfBallPowerMultiplier { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry GiveKey { get; private set; } public BaseballBatConfig(ConfigFile cfg, GlobalConfig global) { PowerMultiplier = cfg.Bind("BaseballBat", "PowerMultiplier", 2.5f, "Multiplier applied to swing power for non-golf-ball hits (e.g. golf carts)."); GolfBallPowerMultiplier = cfg.Bind("BaseballBat", "GolfBallPowerMultiplier", 1.25f, "Multiplier applied to swing power specifically for golf ball hits."); Uses = cfg.Bind("BaseballBat", "Uses", 99f, "Number of swings before the bat is consumed. Set high for near-infinite use."); GiveKey = cfg.Bind("BaseballBat", "GiveKey", (Key)100, "Key to press to add the baseball bat to your inventory."); } } public class BearConfig { private const string Section = "Bear"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Count { get; private set; } public ConfigEntry SpawnRadius { get; private set; } public ConfigEntry SessionDuration { get; private set; } public ConfigEntry WalkSpeed { get; private set; } public ConfigEntry RunSpeed { get; private set; } public ConfigEntry ChargeSpeed { get; private set; } public ConfigEntry TurnSpeed { get; private set; } public ConfigEntry WanderRadius { get; private set; } public ConfigEntry ChargeRange { get; private set; } public ConfigEntry AttackRange { get; private set; } public ConfigEntry AttackCooldown { get; private set; } public ConfigEntry AttackAnimationDuration { get; private set; } public ConfigEntry SpawnAnimationDuration { get; private set; } public ConfigEntry DeathAnimationDuration { get; private set; } public ConfigEntry StunDuration { get; private set; } public ConfigEntry EnrageDuration { get; private set; } public ConfigEntry EnrageSpeedMultiplier { get; private set; } public ConfigEntry MaxHP { get; private set; } public ConfigEntry DamageDuelingPistol { get; private set; } public ConfigEntry DamageElephantGun { get; private set; } public ConfigEntry DamageRocketDirect { get; private set; } public ConfigEntry DamageRocketExplosion { get; private set; } public ConfigEntry DamageGolfClub { get; private set; } public ConfigEntry DamageBaseballBat { get; private set; } public ConfigEntry DamageOrbitalLaser { get; private set; } public ConfigEntry MeleeKnockbackForce { get; private set; } public ConfigEntry BatKnockbackForce { get; private set; } public ConfigEntry MaxClimbHeight { get; private set; } public ConfigEntry TargetLockDuration { get; private set; } public ConfigEntry TargetStealThreshold { get; private set; } public ConfigEntry TargetAbandonDistance { get; private set; } public ConfigEntry AggroStealThreshold { get; private set; } public ConfigEntry AggroDuration { get; private set; } public ConfigEntry MeleeHitRange { get; private set; } public ConfigEntry FriendlyFire { get; private set; } public ConfigEntry AttackFinishedPlayers { get; private set; } public BearConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Bear", "GiveKey", (Key)89, "Debug key to add the Bear item to your inventory."); Uses = cfg.Bind("Bear", "Uses", 1f, "Number of uses per Bear item pickup."); Count = cfg.Bind("Bear", "BearCount", 2f, "Number of bears spawned per item use."); SpawnRadius = cfg.Bind("Bear", "SpawnRadius", 15f, "Radius around the player within which bears spawn."); SessionDuration = cfg.Bind("Bear", "SessionDuration", 60f, "Seconds before all remaining bears are forcibly despawned."); WalkSpeed = cfg.Bind("Bear", "WalkSpeed", 4f, "Bear movement speed while wandering or obstructed (units/sec)."); RunSpeed = cfg.Bind("Bear", "RunSpeed", 9f, "Bear movement speed while pursuing a target (units/sec)."); ChargeSpeed = cfg.Bind("Bear", "ChargeSpeed", 14f, "Bear movement speed during the committed charge phase (units/sec)."); TurnSpeed = cfg.Bind("Bear", "TurnSpeed", 6f, "How quickly the bear rotates to face its movement direction."); WanderRadius = cfg.Bind("Bear", "WanderRadius", 12f, "Radius of the area the bear wanders within when idle."); ChargeRange = cfg.Bind("Bear", "ChargeRange", 10f, "Distance at which the bear commits to a charge attack (units)."); AttackRange = cfg.Bind("Bear", "AttackRange", 2.8f, "Distance at which the bear's attack swing connects (units)."); AttackCooldown = cfg.Bind("Bear", "AttackCooldown", 1.8f, "Seconds between the end of one attack and the start of the next pursuit."); AttackAnimationDuration = cfg.Bind("Bear", "AttackAnimationDuration", 1.2f, "Total duration of the attack animation. Hit is applied at 55% of this value."); SpawnAnimationDuration = cfg.Bind("Bear", "SpawnAnimationDuration", 2f, "Duration of the Buff/spawn-in animation before the bear begins hunting."); DeathAnimationDuration = cfg.Bind("Bear", "DeathAnimationDuration", 2.5f, "How long the death animation plays before the bear is destroyed."); StunDuration = cfg.Bind("Bear", "StunDuration", 2f, "Seconds the bear is stunned after being hit by an explosion."); EnrageDuration = cfg.Bind("Bear", "EnrageDuration", 5f, "Seconds the bear runs at enrage speed after recovering from a stun."); EnrageSpeedMultiplier = cfg.Bind("Bear", "EnrageSpeedMultiplier", 1.5f, "Speed multiplier applied to RunSpeed during enrage."); MaxHP = cfg.Bind("Bear", "MaxHP", 100f, "Maximum HP for a bear. Each hit reduces HP by the weapon's damage value; bear dies at 0."); DamageDuelingPistol = cfg.Bind("Bear", "DamageDuelingPistol", 25f, "HP damage dealt to a bear by a dueling pistol shot."); DamageElephantGun = cfg.Bind("Bear", "DamageElephantGun", 50f, "HP damage dealt to a bear by an elephant gun shot."); DamageRocketDirect = cfg.Bind("Bear", "DamageRocketDirect", 100f, "HP damage dealt to a bear by a direct rocket hit (explosion centre within 1.5 units)."); DamageRocketExplosion = cfg.Bind("Bear", "DamageRocketExplosion", 35f, "HP damage dealt to a bear by rocket splash damage (not a direct hit)."); DamageGolfClub = cfg.Bind("Bear", "DamageGolfClub", 25f, "HP damage dealt to a bear by a golf club swing."); DamageBaseballBat = cfg.Bind("Bear", "DamageBaseballBat", 40f, "HP damage dealt to a bear by a baseball bat swing."); DamageOrbitalLaser = cfg.Bind("Bear", "DamageOrbitalLaser", 100f, "HP damage dealt to a bear by the orbital laser."); MeleeKnockbackForce = cfg.Bind("Bear", "MeleeKnockbackForce", 12f, "Impulse force applied to a bear's rigidbody when hit by a golf club swing."); BatKnockbackForce = cfg.Bind("Bear", "BatKnockbackForce", 22f, "Impulse force applied to a bear's rigidbody when hit by a baseball bat swing."); MaxClimbHeight = cfg.Bind("Bear", "MaxClimbHeight", 6f, "Max height difference (units) before a target is considered unreachable."); TargetLockDuration = cfg.Bind("Bear", "TargetLockDuration", 8f, "Minimum seconds a bear keeps its target before re-evaluating."); TargetStealThreshold = cfg.Bind("Bear", "TargetStealThreshold", 12f, "A new candidate must be this many units closer to steal the lock after the timer expires."); TargetAbandonDistance = cfg.Bind("Bear", "TargetAbandonDistance", 65f, "If the locked target moves beyond this distance the lock is dropped immediately."); AggroStealThreshold = cfg.Bind("Bear", "AggroStealThreshold", 4f, "A player who hit the bear can steal the lock if at least this many units closer (lower bar than normal steal)."); AggroDuration = cfg.Bind("Bear", "AggroDuration", 15f, "How long (seconds) aggro on a specific player lasts after they hit the bear."); MeleeHitRange = cfg.Bind("Bear", "MeleeHitRange", 2.5f, "Radius (units) around the swing hitbox centre that counts as a golf-club/bat hit on a bear."); FriendlyFire = cfg.Bind("Bear", "FriendlyFire", false, "If false, bears will not target or attack the player who summoned them."); AttackFinishedPlayers = cfg.Bind("Bear", "AttackFinishedPlayers", false, "If true, bears will target players who have already holed out. If false, bears ignore them."); } } public class BlackHoleGrenadeConfig { private const string Section = "BlackHoleGrenade"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry ThrowSpeed { get; private set; } public ConfigEntry MaxThrowSpeed { get; private set; } public ConfigEntry LobAngle { get; private set; } public ConfigEntry GraceTime { get; private set; } public ConfigEntry SuckDuration { get; private set; } public ConfigEntry SuckRadius { get; private set; } public ConfigEntry SuckForce { get; private set; } public ConfigEntry MaxSuckForce { get; private set; } public ConfigEntry SpitForce { get; private set; } public ConfigEntry SpitVfxScale { get; private set; } public ConfigEntry KnockdownRadius { get; private set; } public ConfigEntry ExcludeThrower { get; private set; } public ConfigEntry BonusGolfCartForceMultiplier { get; private set; } public ConfigEntry AffectsGolfBalls { get; private set; } public ConfigEntry ElectroShieldPreventsEffect { get; private set; } public BlackHoleGrenadeConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("BlackHoleGrenade", "GiveKey", (Key)91, "Debug key to add the Black Hole Grenade to your inventory."); Uses = cfg.Bind("BlackHoleGrenade", "Uses", 1f, "Number of uses per Black Hole Grenade pickup."); ThrowSpeed = cfg.Bind("BlackHoleGrenade", "ThrowSpeed", 20f, "Initial throw speed in m/s."); MaxThrowSpeed = cfg.Bind("BlackHoleGrenade", "MaxThrowSpeed", 30f, "Server-side clamp on throw speed to prevent exploits."); LobAngle = cfg.Bind("BlackHoleGrenade", "LobAngle", 0.4f, "Upward component added to the throw direction to create an arc. 0 = flat, 1 = 45° upward."); GraceTime = cfg.Bind("BlackHoleGrenade", "GraceTime", 0.35f, "Seconds after throwing before the grenade can stick to the ground."); SuckDuration = cfg.Bind("BlackHoleGrenade", "SuckDuration", 6f, "How many seconds the suction phase lasts before spitting."); SuckRadius = cfg.Bind("BlackHoleGrenade", "SuckRadius", 35f, "Radius in units of the suction field."); SuckForce = cfg.Bind("BlackHoleGrenade", "SuckForce", 8f, "Suction acceleration (m/s²) applied at the outer edge of the suction field."); MaxSuckForce = cfg.Bind("BlackHoleGrenade", "MaxSuckForce", 40f, "Suction acceleration (m/s²) applied right at the center of the black hole."); SpitForce = cfg.Bind("BlackHoleGrenade", "SpitForce", 35f, "Speed (m/s) at which objects and players are ejected during the spit phase."); SpitVfxScale = cfg.Bind("BlackHoleGrenade", "SpitVfxScale", 3f, "Scale of the explosion VFX played on all clients when the black hole collapses."); KnockdownRadius = cfg.Bind("BlackHoleGrenade", "KnockdownRadius", 15f, "Distance from the black hole at which a player gets knocked down. Must be less than SuckRadius. Set to 0 to disable."); ExcludeThrower = cfg.Bind("BlackHoleGrenade", "ExcludeThrower", true, "If true, the player who threw the grenade is not affected by suction or spit."); BonusGolfCartForceMultiplier = cfg.Bind("BlackHoleGrenade", "BonusGolfCartForceMultiplier", 2f, "Additional force multiplier applied to golf carts."); AffectsGolfBalls = cfg.Bind("BlackHoleGrenade", "AffectsGolfBalls", true, "If true, the black hole grenade sucks in and spits out golf balls. Set to false to leave golf balls unaffected."); ElectroShieldPreventsEffect = cfg.Bind("BlackHoleGrenade", "ElectroShieldPreventsEffect", true, "If true, a player with an active electro shield is immune to the black hole's suction pull and spit ejection."); } } public class DonutConfig { private const string Section = "Donut"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Speed { get; private set; } public ConfigEntry Altitude { get; private set; } public ConfigEntry TerrainFollowSpeed { get; private set; } public ConfigEntry TurnSpeed { get; private set; } public ConfigEntry CameraPitch { get; private set; } public ConfigEntry CameraDistance { get; private set; } public ConfigEntry MouseSensitivity { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry LaserUses { get; private set; } public ConfigEntry LaserAnticipationDuration { get; private set; } public ConfigEntry LaserCooldown { get; private set; } public ConfigEntry HitsToDestroy { get; private set; } public ConfigEntry CrashImpactForce { get; private set; } public ConfigEntry CrashDownwardForce { get; private set; } public ConfigEntry CrashTorque { get; private set; } public ConfigEntry CrashExplosionScale { get; private set; } public DonutConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Donut", "GiveKey", (Key)86, "Debug key to add the Donut to your inventory."); Uses = cfg.Bind("Donut", "Uses", 1f, "Number of Donut uses per pickup."); Speed = cfg.Bind("Donut", "Speed", 30f, "Horizontal movement speed of the Donut in units per second."); Altitude = cfg.Bind("Donut", "Altitude", 20f, "Height above terrain the Donut hovers at."); TerrainFollowSpeed = cfg.Bind("Donut", "TerrainFollowSpeed", 5f, "How quickly the Donut adjusts its altitude to match terrain changes (lerp speed)."); TurnSpeed = cfg.Bind("Donut", "TurnSpeed", 8f, "How quickly the Donut rotates to face the movement direction (Slerp speed)."); CameraPitch = cfg.Bind("Donut", "CameraPitch", 60f, "Camera pitch angle in degrees during the Donut session (0 = horizontal, 90 = straight down)."); CameraDistance = cfg.Bind("Donut", "CameraDistance", 40f, "Camera distance addition from the Donut during the session."); MouseSensitivity = cfg.Bind("Donut", "MouseSensitivity", 0.2f, "Mouse X sensitivity for rotating the Donut orbit camera."); Duration = cfg.Bind("Donut", "Duration", 30f, "How many seconds the Donut session lasts before automatically ending."); LaserUses = cfg.Bind("Donut", "LaserUses", 3f, "How many orbital laser strikes the player can fire during a Donut session."); LaserAnticipationDuration = cfg.Bind("Donut", "LaserAnticipationDuration", 1.5f, "Seconds of anticipation before the orbital laser fires. The laser tracks the Donut during this window."); LaserCooldown = cfg.Bind("Donut", "LaserCooldown", 3f, "Minimum seconds between orbital laser fires."); HitsToDestroy = cfg.Bind("Donut", "HitsToDestroy", 1f, "Rocket hits required to shoot down the Donut. Set to 0 to make it invincible."); CrashImpactForce = cfg.Bind("Donut", "CrashImpactForce", 500f, "Impulse force applied to the Donut in the direction of the rocket hit when shot down."); CrashDownwardForce = cfg.Bind("Donut", "CrashDownwardForce", 15f, "Impulse force applied to the Donut in the downward direction."); CrashTorque = cfg.Bind("Donut", "CrashTorque", 1.2f, "Magnitude of the random tumble torque applied to the Donut when shot down."); CrashExplosionScale = cfg.Bind("Donut", "CrashExplosionScale", 4f, "Explosion scale multiplier for when a Donut crashes. Affects blast radius, knockback, and VFX size."); } } public class DroneSwarmConfig { private const string Section = "DroneSwarm"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry BaseDroneCount { get; private set; } public ConfigEntry PerPlayerScalingFactor { get; private set; } public ConfigEntry Altitude { get; private set; } public ConfigEntry WanderRadius { get; private set; } public ConfigEntry WanderSpeed { get; private set; } public ConfigEntry WanderTurnRate { get; private set; } public ConfigEntry AltitudeVariance { get; private set; } public ConfigEntry CircleTimeMin { get; private set; } public ConfigEntry CircleTimeMax { get; private set; } public ConfigEntry DiveSpeed { get; private set; } public ConfigEntry DiveAcceleration { get; private set; } public ConfigEntry HomingStopDistance { get; private set; } public ConfigEntry ArrivalRadius { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public ConfigEntry FriendlyFire { get; private set; } public ConfigEntry AttackFinishedPlayers { get; private set; } public ConfigEntry MaxSessionDuration { get; private set; } public DroneSwarmConfig(ConfigFile cfg, GlobalConfig global) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown GiveKey = cfg.Bind("DroneSwarm", "GiveKey", (Key)77, "Debug key to add the Drone Swarm item to your inventory."); Uses = cfg.Bind("DroneSwarm", "Uses", 1f, "Number of uses per Drone Swarm pickup."); BaseDroneCount = cfg.Bind("DroneSwarm", "BaseDroneCount", 15f, "Number of drones spawned per use. Keep at or below 12 to avoid network overhead."); PerPlayerScalingFactor = cfg.Bind("DroneSwarm", "PerPlayerScalingFactor", 0.1f, new ConfigDescription("Increase the DroneCount as: DroneCount = BaseDroneCount * (1 + [NumPlayers * PerPlayerScalingFactor]). Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); Altitude = cfg.Bind("DroneSwarm", "Altitude", 300f, "Height (metres) at which drones circle above the player centroid."); WanderRadius = cfg.Bind("DroneSwarm", "WanderRadius", 150f, "Maximum distance (metres) from the wander centre a drone waypoint may be placed."); WanderSpeed = cfg.Bind("DroneSwarm", "WanderSpeed", 125f, "Cruise speed (metres/second) while drones are wandering before they dive."); WanderTurnRate = cfg.Bind("DroneSwarm", "WanderTurnRate", 45f, "Maximum steering rate (degrees/second) while wandering. Lower = lazier, wider arcs. Higher = tighter turns."); AltitudeVariance = cfg.Bind("DroneSwarm", "AltitudeVariance", 25f, "Half-range (metres) of random altitude variation added to each waypoint. Drones pick altitudes between Altitude ± AltitudeVariance."); CircleTimeMin = cfg.Bind("DroneSwarm", "CircleTimeMin", 3f, "Minimum seconds a drone circles before diving (randomised per drone)."); CircleTimeMax = cfg.Bind("DroneSwarm", "CircleTimeMax", 30f, "Maximum seconds a drone circles before diving (randomised per drone)."); DiveSpeed = cfg.Bind("DroneSwarm", "DiveSpeed", 20f, "Initial dive speed in metres per second."); DiveAcceleration = cfg.Bind("DroneSwarm", "DiveAcceleration", 40f, "How many metres per second the dive speed increases each second."); HomingStopDistance = cfg.Bind("DroneSwarm", "HomingStopDistance", 75f, "Distance from the target (metres) at which the drone stops tracking and flies straight, giving the target a chance to dodge. Set to 0 to always home."); ArrivalRadius = cfg.Bind("DroneSwarm", "ArrivalRadius", 3f, "Distance from the aim point (metres) at which the drone detonates."); ExplosionScale = cfg.Bind("DroneSwarm", "ExplosionScale", 1.05f, "Scale multiplier for the drone impact explosion radius and force."); FriendlyFire = cfg.Bind("DroneSwarm", "FriendlyFire", false, "If true, drones may target the player who summoned them."); AttackFinishedPlayers = cfg.Bind("DroneSwarm", "AttackFinishedPlayers", false, "If true, drones may target players who have already holed out."); MaxSessionDuration = cfg.Bind("DroneSwarm", "MaxSessionDuration", 60f, "Safety cap (seconds) after which any remaining drones are force-destroyed."); } } public class ExplosiveGolfBallsConfig { private const string Section = "ExplosiveGolfBalls"; public ConfigEntry Uses { get; private set; } public ConfigEntry LockOnOnly { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public ConfigEntry GiveKey { get; private set; } public ExplosiveGolfBallsConfig(ConfigFile cfg, GlobalConfig global) { Uses = cfg.Bind("ExplosiveGolfBalls", "Uses", 3f, "Number of swings that will produce an exploding ball."); LockOnOnly = cfg.Bind("ExplosiveGolfBalls", "LockOnOnly", true, "When true, the explosion only triggers on lock-on (overcharge) shots."); ExplosionScale = cfg.Bind("ExplosiveGolfBalls", "ExplosionScale", 1f, "Scale multiplier applied to the explosion radius and force."); GiveKey = cfg.Bind("ExplosiveGolfBalls", "GiveKey", (Key)0, "Debug key to add Explosive Golf Balls to your inventory."); } } public class FlamethrowerConfig { private const string Section = "Flamethrower"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry FuelPerUse { get; private set; } public ConfigEntry BurnDuration { get; private set; } public ConfigEntry BurnRequestInterval { get; private set; } public FlamethrowerConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Flamethrower", "GiveKey", (Key)98, "Hotkey to give yourself a Flamethrower (debug/testing)."); Uses = cfg.Bind("Flamethrower", "Uses", 1f, "Number of fuel canisters per Flamethrower pickup. Each canister provides FuelPerUse seconds of fire."); FuelPerUse = cfg.Bind("Flamethrower", "FuelPerUse", 3f, "Seconds of continuous fire provided by each fuel canister."); BurnDuration = cfg.Bind("Flamethrower", "BurnDuration", 4f, "Seconds a hit player stays on fire after the last flamethrower contact. Resets on each new hit."); BurnRequestInterval = cfg.Bind("Flamethrower", "BurnRequestInterval", 0.5f, "Minimum seconds between burn-request messages sent per victim while the flame collider overlaps them."); } } public class FreezeConfig { private const string Section = "FreezeWorld"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry Friction { get; private set; } public ConfigEntry Bounciness { get; private set; } public ConfigEntry CartSidewaysStiffness { get; private set; } public ConfigEntry GripRadius { get; private set; } public ConfigEntry AffectsUser { get; private set; } public FreezeConfig(ConfigFile cfg, GlobalConfig global) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown GiveKey = cfg.Bind("FreezeWorld", "GiveKey", (Key)105, "Debug key to add the Freeze World item to your inventory."); Uses = cfg.Bind("FreezeWorld", "Uses", 1f, "Number of uses per Freeze World pickup."); Duration = cfg.Bind("FreezeWorld", "Duration", 15f, "Seconds the world stays frozen before physics and visuals are restored."); Friction = cfg.Bind("FreezeWorld", "Friction", 0.05f, "Surface friction applied to all physics contacts during a freeze (0 = frictionless)."); Bounciness = cfg.Bind("FreezeWorld", "Bounciness", 0.2f, new ConfigDescription("Surface bounciness applied to all physics contacts during a freeze.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); CartSidewaysStiffness = cfg.Bind("FreezeWorld", "CartSidewaysStiffness", 0.15f, "Sideways friction stiffness for golf cart wheel colliders while frozen (0 = no grip, 1 = normal). Lower values cause more drift."); GripRadius = cfg.Bind("FreezeWorld", "GripRadius", 1.5f, "Distance (metres) from the local player's own ball within which normal traction is restored, allowing them to stop and take a shot."); AffectsUser = cfg.Bind("FreezeWorld", "AffectsUser", false, "Whether the player who activates Freeze World is themselves affected by its ice physics and movement restrictions. Defaults to false (activator is immune)."); } } public class GlobalConfig { private readonly Dictionary> _itemEnabledEntries = new Dictionary>(); private readonly Dictionary> _itemWarningEnabledEntries = new Dictionary>(); public const int PoolAhead = 0; public const int PoolLead = 1; public const int PoolBehind50 = 2; public const int PoolBehind125 = 3; public const int PoolBehind200 = 4; public const int PoolMobility = 5; private static readonly (int pool, string suffix)[] PoolSuffixes = new(int, string)[6] { (1, "Lead"), (2, "Behind50"), (3, "Behind125"), (4, "Behind200"), (0, "Ahead"), (5, "Mobility") }; private readonly Dictionary<(int itemType, int pool), ConfigEntry> _poolWeightEntries = new Dictionary<(int, int), ConfigEntry>(); public ConfigEntry CustomItemSpawnsEnabled { get; private set; } public ConfigEntry CustomItemSpawnRate { get; private set; } public ConfigEntry AllowHotkeyItemGiving { get; private set; } public ConfigEntry BloodEffectsEnabled { get; private set; } public ConfigEntry NumInventorySlots { get; private set; } public ConfigEntry FirstPlaceStarEnabled { get; private set; } public ConfigEntry FirstPlaceStarHeight { get; private set; } public ConfigEntry SpawnConfigUIKey { get; private set; } public ConfigEntry WarningsEnabled { get; private set; } public ConfigEntry WarningDuration { get; private set; } public ConfigEntry WarningShowForSelf { get; private set; } public ConfigEntry WarningSymbolEnabled { get; private set; } public ConfigEntry WarningPrefabScale { get; private set; } public ConfigEntry WarningSymbolAlpha { get; private set; } public ConfigEntry WarningPiPScale { get; private set; } public bool GetItemEnabled(ItemType itemType) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected I4, but got Unknown ConfigEntry value; return !_itemEnabledEntries.TryGetValue((int)itemType, out value) || value.Value; } public void SetItemEnabled(ItemType itemType, bool enabled) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown if (_itemEnabledEntries.TryGetValue((int)itemType, out var value)) { value.Value = enabled; } } public bool GetItemWarningEnabled(ItemType itemType) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected I4, but got Unknown ConfigEntry value; return WarningsEnabled.Value && _itemWarningEnabledEntries.TryGetValue((int)itemType, out value) && value.Value; } public float GetItemPoolWeight(ItemType itemType, int poolIndex) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected I4, but got Unknown ConfigEntry value; return _poolWeightEntries.TryGetValue(((int)itemType, poolIndex), out value) ? value.Value : 0f; } public void SetItemPoolWeight(ItemType itemType, int poolIndex, float value) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected I4, but got Unknown if (_poolWeightEntries.TryGetValue(((int)itemType, poolIndex), out var value2)) { value2.Value = value; } } public GlobalConfig(ConfigFile cfg) { CustomItemSpawnsEnabled = cfg.Bind("IssaPlugin", "Enabled", true, "Master kill-switch for allowing custom items to be spawned without having to set all spawn weights to 0."); CustomItemSpawnRate = cfg.Bind("IssaPlugin", "CustomItemSpawnRate", 0.5f, "Global multiplier applied to every custom item's spawn weight. 1.0 = default, 0.5 = half as frequent, 0.0 = never spawn."); AllowHotkeyItemGiving = cfg.Bind("IssaPlugin", "AllowHotkeyItemGiving", false, "Whether non-host clients can use item hotkeys to give themselves items. The host is always exempt."); BloodEffectsEnabled = cfg.Bind("IssaPlugin", "BloodEffectsEnabled", true, "Whether blood splatter effects are shown when players are hit by guns. Each client sets this independently."); NumInventorySlots = cfg.Bind("IssaPlugin", "NumInventorySlots", 6f, "Change the number of inventory slots available."); FirstPlaceStarEnabled = cfg.Bind("IssaPlugin", "FirstPlaceStarEnabled", false, "Show a gold star above the first-place player so they are easy to spot."); FirstPlaceStarHeight = cfg.Bind("IssaPlugin", "FirstPlaceStarHeight", 1.5f, "Height in Unity units above the player's origin at which the gold star appears."); SpawnConfigUIKey = cfg.Bind("UI", "SpawnConfigUIKey", (Key)27, "Hotkey that opens/closes the Spawn Config GUI panel. The panel lets the host adjust per-pool spawn weights at runtime."); Reg(cfg, _itemEnabledEntries, 100, "BaseballBatEnabled", "Baseball Bat"); Reg(cfg, _itemEnabledEntries, 101, "StealthBomberEnabled", "Stealth Bomber"); Reg(cfg, _itemEnabledEntries, 102, "PredatorMissileEnabled", "Predator Missile"); Reg(cfg, _itemEnabledEntries, 103, "AC130Enabled", "AC-130 Gunship"); Reg(cfg, _itemEnabledEntries, 104, "FreezeEnabled", "Freeze World"); Reg(cfg, _itemEnabledEntries, 105, "LowGravityEnabled", "Low Gravity"); Reg(cfg, _itemEnabledEntries, 106, "SniperRifleEnabled", "Sniper Rifle"); Reg(cfg, _itemEnabledEntries, 107, "DonutEnabled", "Donut"); Reg(cfg, _itemEnabledEntries, 108, "JavelinEnabled", "Javelin"); Reg(cfg, _itemEnabledEntries, 109, "StickyGrenadeEnabled", "Sticky Grenade"); Reg(cfg, _itemEnabledEntries, 110, "BearEnabled", "Bear"); Reg(cfg, _itemEnabledEntries, 111, "NukeEnabled", "Nuke"); Reg(cfg, _itemEnabledEntries, 112, "BlackHoleGrenadeEnabled", "Black Hole Grenade"); Reg(cfg, _itemEnabledEntries, 113, "PlaceableWallEnabled", "Placeable Wall"); Reg(cfg, _itemEnabledEntries, 114, "AK47Enabled", "AK-47"); Reg(cfg, _itemEnabledEntries, 115, "HarrierEnabled", "Harrier Jet"); Reg(cfg, _itemEnabledEntries, 116, "PositionSwapEnabled", "Position Swap"); Reg(cfg, _itemEnabledEntries, 117, "PoisonJarEnabled", "Poison Jar"); Reg(cfg, _itemEnabledEntries, 118, "DroneSwarmEnabled", "Drone Swarm"); Reg(cfg, _itemEnabledEntries, 119, "RedBullEnabled", "Red Bull"); Reg(cfg, _itemEnabledEntries, 120, "SuperDonutEnabled", "Super Donut"); Reg(cfg, _itemEnabledEntries, 121, "GravityGunEnabled", "Gravity Gun"); Reg(cfg, _itemEnabledEntries, 122, "RocketTetherEnabled", "Rocket Tether"); Reg(cfg, _itemEnabledEntries, 123, "JetpackEnabled", "Jetpack"); Reg(cfg, _itemEnabledEntries, 124, "TeleporterEnabled", "Teleporter"); Reg(cfg, _itemEnabledEntries, 125, "SpinachEnabled", "Spinach"); Reg(cfg, _itemEnabledEntries, 126, "FlamethrowerEnabled", "Flamethrower"); Reg(cfg, _itemEnabledEntries, 127, "RocketTetherGrenadeEnabled", "Rocket Tether Grenade"); WarningsEnabled = cfg.Bind("Warnings", "Enabled", true, "Master toggle for all item-use warning banners and PiP cameras."); WarningDuration = cfg.Bind("Warnings", "Duration", 5f, "How long (seconds) each warning banner and PiP camera is displayed."); WarningShowForSelf = cfg.Bind("Warnings", "ShowForSelf", false, "If true, the warning banner and PiP also appear for the player who used the item. Useful for testing."); WarningSymbolEnabled = cfg.Bind("Warnings", "WarningSymbolEnabled", true, "If true, the warning particle effect is shown. Each client can disable it locally."); WarningPrefabScale = cfg.Bind("Warnings", "WarningSymbolScale", 0.75f, "Controls the size of the warning prefab."); WarningSymbolAlpha = cfg.Bind("Warnings", "WarningSymbolAlpha", 0.5f, "Controls the alpha channel of the start color of the warning prefab."); WarningPiPScale = cfg.Bind("Warnings", "PiPScale", 1f, "Scale multiplier for the PiP camera box (base size 320x180). Valid range: 0.5 (160x90) to 2.0 (640x360)."); RegWarn(cfg, _itemWarningEnabledEntries, 100, "BaseballBatWarning", "Baseball Bat", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 101, "BomberWarning", "Stealth Bomber", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 102, "MissileWarning", "Predator Missile", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 103, "AC130Warning", "AC-130 Gunship", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 104, "FreezeWarning", "Freeze World", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 105, "LowGravityWarning", "Low Gravity", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 106, "SniperRifleWarning", "Sniper Rifle", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 107, "DonutWarning", "Donut", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 108, "JavelinWarning", "Javelin", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 109, "StickyGrenadeWarning", "Sticky Grenade", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 110, "BearWarning", "Bear", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 111, "NukeWarning", "Nuke", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 112, "BlackHoleGrenadeWarning", "Black Hole Grenade", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 113, "PlaceableWallWarning", "Placeable Wall", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 114, "AK47Warning", "AK-47", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 115, "HarrierWarning", "Harrier Jet", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 116, "PositionSwapWarning", "Position Swap", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 117, "PoisonJarWarning", "Poison Jar", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 118, "DroneSwarmWarning", "Drone Swarm", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 119, "RedBullWarning", "Red Bull", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 120, "SuperDonutWarning", "Super Donut", defaultOn: true); RegWarn(cfg, _itemWarningEnabledEntries, 121, "GravityGunWarning", "Gravity Gun", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 122, "RocketTetherWarning", "Rocket Tether", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 123, "JetpackWarning", "Jetpack", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 124, "TeleporterWarning", "Teleporter", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 125, "SpinachWarning", "Spinach", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 126, "FlamethrowerWarning", "Flamethrower", defaultOn: false); RegWarn(cfg, _itemWarningEnabledEntries, 127, "RocketTetherGrenadeWarning", "Rocket Tether Grenade", defaultOn: false); BindAllItemPoolWeights(cfg); static void Reg(ConfigFile c, Dictionary> map, int id, string key, string label) { map[id] = c.Bind("ItemEnabled", key, true, "Whether the " + label + " is enabled and can spawn."); } static void RegWarn(ConfigFile c, Dictionary> map, int id, string key, string label, bool defaultOn) { map[id] = c.Bind("ItemWarnings", key, defaultOn, "Show a warning to all other players when " + label + " is used."); } } private void BindAllItemPoolWeights(ConfigFile cfg) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected I4, but got Unknown foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { (int, string)[] poolSuffixes = PoolSuffixes; for (int i = 0; i < poolSuffixes.Length; i++) { var (num, text) = poolSuffixes[i]; _poolWeightEntries[((int)allItem.ItemType, num)] = cfg.Bind("ItemBoxSpawns", allItem.ConfigKeyPrefix + "Weight" + text, allItem.GetDefaultPoolWeight(num), "Spawn weight for " + allItem.DisplayName + " in the '" + text + "' pool. 0 = never spawns in this pool."); } } } } public class GravityGunConfig { private const string Section = "GravityGun"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry LockOnRange { get; private set; } public ConfigEntry LockOnConeAngleDeg { get; private set; } public ConfigEntry TetherRadius { get; private set; } public ConfigEntry TetherDuration { get; private set; } public ConfigEntry SpringForce { get; private set; } public ConfigEntry MaxPullSpeed { get; private set; } public ConfigEntry InputSendInterval { get; private set; } public GravityGunConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("GravityGun", "GiveKey", (Key)78, "Hotkey to give yourself a Gravity Gun (debug/testing)."); Uses = cfg.Bind("GravityGun", "Uses", 1f, "Number of uses per Gravity Gun pickup."); LockOnRange = cfg.Bind("GravityGun", "LockOnRange", 45f, "Maximum distance (units) at which the Gravity Gun can lock onto a target."); LockOnConeAngleDeg = cfg.Bind("GravityGun", "LockOnConeAngleDeg", 40f, "Half-angle (degrees) of the aim cone used to filter lock-on candidates."); TetherRadius = cfg.Bind("GravityGun", "TetherRadius", 20f, "Distance (units) at which the target orbits the wielder while tethered."); TetherDuration = cfg.Bind("GravityGun", "TetherDuration", 5f, "Maximum tether duration in seconds before automatic release."); SpringForce = cfg.Bind("GravityGun", "SpringForce", 12f, "Spring stiffness coefficient; higher values pull the target faster."); MaxPullSpeed = cfg.Bind("GravityGun", "MaxPullSpeed", 18f, "Maximum velocity change (m/s) applied to the target per physics tick."); InputSendInterval = cfg.Bind("GravityGun", "InputSendInterval", 0.05f, "Interval (seconds) between aim-tick messages sent to the server (~20 Hz)."); } } public class HarrierConfig { private const string Section = "HarrierJet"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Altitude { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry FireInterval { get; private set; } public ConfigEntry ApproachDistance { get; private set; } public ConfigEntry ApproachSpeed { get; private set; } public ConfigEntry DriftSpeed { get; private set; } public ConfigEntry HoverRadius { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public ConfigEntry RocketJitter { get; private set; } public ConfigEntry FriendlyFire { get; private set; } public ConfigEntry HitsToDestroy { get; private set; } public ConfigEntry CrashExplosionScale { get; private set; } public HarrierConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("HarrierJet", "GiveKey", (Key)93, "Debug key to add the Harrier Jet to your inventory."); Uses = cfg.Bind("HarrierJet", "Uses", 1f, "Number of Harrier Jet uses per pickup."); Altitude = cfg.Bind("HarrierJet", "Altitude", 175f, "Height above the map centre the Harrier hovers at while attacking."); Duration = cfg.Bind("HarrierJet", "Duration", 30f, "How many seconds the Harrier remains on-station before flying out."); FireInterval = cfg.Bind("HarrierJet", "FireInterval", 2.5f, "Seconds between each autonomous rocket fired by the Harrier."); ApproachDistance = cfg.Bind("HarrierJet", "ApproachDistance", 600f, "How far away the Harrier spawns before flying in to its hover point."); ApproachSpeed = cfg.Bind("HarrierJet", "ApproachSpeed", 100f, "Speed in units per second during fly-in and fly-out."); DriftSpeed = cfg.Bind("HarrierJet", "DriftSpeed", 8f, "Units per second the Harrier drifts toward the player concentration centroid."); HoverRadius = cfg.Bind("HarrierJet", "HoverRadius", 30f, "Maximum distance the Harrier can drift from its initial hover centre."); ExplosionScale = cfg.Bind("HarrierJet", "ExplosionScale", 1.5f, "Scale multiplier applied to each rocket explosion from the Harrier."); RocketJitter = cfg.Bind("HarrierJet", "RocketJitter", 4f, "Angular spread in degrees applied to each rocket. Higher = less accurate."); FriendlyFire = cfg.Bind("HarrierJet", "FriendlyFire", false, "If false, the Harrier will not target the player who summoned it."); HitsToDestroy = cfg.Bind("HarrierJet", "HitsToDestroy", 3f, "Number of direct rocket hits required to shoot down the Harrier. Set to 0 to make it invincible."); CrashExplosionScale = cfg.Bind("HarrierJet", "CrashExplosionScale", 3f, "Scale multiplier for the explosion spawned when the Harrier crashes into the ground."); } } public class HunterDroneConfig { private const string Section = "HunterDrone"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry LaunchSpeed { get; private set; } public ConfigEntry Acceleration { get; private set; } public ConfigEntry HomingStopDistance { get; private set; } public ConfigEntry ArrivalRadius { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public ConfigEntry ArmDelay { get; private set; } public ConfigEntry FriendlyFire { get; private set; } public ConfigEntry AttackFinishedPlayers { get; private set; } public ConfigEntry MaxFlightDistance { get; private set; } public ConfigEntry MaxSpeed { get; private set; } public ConfigEntry MaxActiveDrones { get; private set; } public HunterDroneConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("HunterDrone", "GiveKey", (Key)80, "Debug key to add the Hunter Drone item to your inventory."); Uses = cfg.Bind("HunterDrone", "Uses", 1f, "Number of uses per Hunter Drone pickup."); LaunchSpeed = cfg.Bind("HunterDrone", "LaunchSpeed", 90f, "Initial flight speed of the drone in metres per second."); Acceleration = cfg.Bind("HunterDrone", "Acceleration", 25f, "How many metres per second the drone's speed increases each second."); HomingStopDistance = cfg.Bind("HunterDrone", "HomingStopDistance", 10f, "Distance from the target (metres) at which the drone locks its aim point and flies straight, giving the target a brief chance to dodge. Set to 0 to always track the target."); ArrivalRadius = cfg.Bind("HunterDrone", "ArrivalRadius", 0.5f, "Distance from the aim point (metres) at which the drone detonates."); ExplosionScale = cfg.Bind("HunterDrone", "ExplosionScale", 1.2f, "Scale multiplier for the drone impact explosion radius and force."); ArmDelay = cfg.Bind("HunterDrone", "ArmDelay", 0f, "Seconds after launch before the drone starts checking for collision. Prevents the drone from detonating on the thrower immediately after being thrown."); FriendlyFire = cfg.Bind("HunterDrone", "FriendlyFire", false, "If true, the drone may target the player who threw it."); AttackFinishedPlayers = cfg.Bind("HunterDrone", "AttackFinishedPlayers", false, "If true, the drone may target players who have already holed out."); MaxFlightDistance = cfg.Bind("HunterDrone", "MaxFlightDistance", 500f, "Maximum distance in metres the drone may travel before self-detonating. Acts as a safety valve when no target exists or the drone misses."); MaxSpeed = cfg.Bind("HunterDrone", "MaxSpeed", 300f, "Maximum flight speed in metres per second. Caps the speed gained through Acceleration so the drone cannot tunnel through targets at extreme velocity."); MaxActiveDrones = cfg.Bind("HunterDrone", "MaxActiveDrones", 5f, "Maximum number of hunter drones a single player may have in flight at once."); } } public class JavelinConfig { private const string Section = "Javelin"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry ApexHeight { get; private set; } public ConfigEntry AscentSpeed { get; private set; } public ConfigEntry DiveSpeed { get; private set; } public ConfigEntry DiveAcceleration { get; private set; } public ConfigEntry ArrivalRadius { get; private set; } public ConfigEntry Timeout { get; private set; } public ConfigEntry ExplosionVfxDuration { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public JavelinConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Javelin", "GiveKey", (Key)87, "Debug key to add the Javelin to your inventory."); Uses = cfg.Bind("Javelin", "Uses", 1f, "Number of Javelin uses per pickup."); ApexHeight = cfg.Bind("Javelin", "ApexHeight", 80f, "How many units above the launch point the rocket climbs before turning."); AscentSpeed = cfg.Bind("Javelin", "AscentSpeed", 35f, "Speed in units per second during the upward climb phase."); DiveSpeed = cfg.Bind("Javelin", "DiveSpeed", 55f, "Initial speed in units per second when the rocket begins its dive."); DiveAcceleration = cfg.Bind("Javelin", "DiveAcceleration", 25f, "Additional speed gained per second during the dive phase."); ArrivalRadius = cfg.Bind("Javelin", "ArrivalRadius", 3f, "Distance from the target position at which the rocket detonates."); Timeout = cfg.Bind("Javelin", "Timeout", 20f, "Maximum seconds before the rocket force-detonates if it hasn't hit yet."); ExplosionVfxDuration = cfg.Bind("Javelin", "ExplosionVfxDuration", 5f, "Seconds before the Javelin explosion VFX prefab is destroyed on each client."); ExplosionScale = cfg.Bind("Explosions", "JavelinScale", 3.5f, "Multiplier for Javelin explosions. Affects blast radius, knockback, and VFX size."); } } public class JetpackConfig { private const string Section = "Jetpack"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry FuelPerUse { get; private set; } public ConfigEntry ThrustForce { get; private set; } public ConfigEntry UseJumpToActivate { get; private set; } public JetpackConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Jetpack", "GiveKey", (Key)69, "Hotkey to give yourself a Jetpack (debug/testing)."); Uses = cfg.Bind("Jetpack", "Uses", 1f, "Number of fuel canisters per Jetpack pickup. Each canister provides JetpackFuelPerUse seconds of thrust."); FuelPerUse = cfg.Bind("Jetpack", "FuelPerUse", 1f, "Seconds of thrust provided by each fuel canister. When exhausted, one use is consumed."); ThrustForce = cfg.Bind("Jetpack", "ThrustForce", 35f, "Upward acceleration (m/s²) applied each physics step while thrusting. Uses ForceMode.Acceleration."); UseJumpToActivate = cfg.Bind("Jetpack", "UseJumpToActivate", true, "When enabled, pressing Space (Jump) activates the jetpack even if it is not the active item. The fuel gauge is visible whenever the jetpack is in inventory."); } } public class LowGravityConfig { private const string Section = "LowGravity"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry Scale { get; private set; } public LowGravityConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("LowGravity", "GiveKey", (Key)84, "Debug key to add the Low Gravity item to your inventory."); Uses = cfg.Bind("LowGravity", "Uses", 1f, "Number of uses per Low Gravity pickup."); Duration = cfg.Bind("LowGravity", "Duration", 20f, "Seconds the reduced gravity lasts before physics is restored."); Scale = cfg.Bind("LowGravity", "GravityScale", 0.25f, "Fraction of normal gravity applied during the effect (e.g. 0.25 = 25%). Affects golf balls (Rigidbody) and player fall/jump height equally, since PlayerMovement reads Physics.gravity directly."); } } public static class ModConfig { public static GlobalConfig Global { get; private set; } public static BaseballBatConfig BaseballBat { get; private set; } public static StealthBomberConfig StealthBomber { get; private set; } public static PredatorMissileConfig PredatorMissile { get; private set; } public static AC130Config AC130 { get; private set; } public static FreezeConfig Freeze { get; private set; } public static LowGravityConfig LowGravity { get; private set; } public static SniperRifleConfig SniperRifle { get; private set; } public static DonutConfig Donut { get; private set; } public static JavelinConfig Javelin { get; private set; } public static StickyGrenadeConfig StickyGrenade { get; private set; } public static BearConfig Bear { get; private set; } public static NukeConfig Nuke { get; private set; } public static BlackHoleGrenadeConfig BlackHoleGrenade { get; private set; } public static PlaceableWallConfig PlaceableWall { get; private set; } public static AK47Config AK47 { get; private set; } public static HarrierConfig Harrier { get; private set; } public static PositionSwapConfig PositionSwap { get; private set; } public static PoisonJarConfig PoisonJar { get; private set; } public static DroneSwarmConfig DroneSwarm { get; private set; } public static RedBullConfig RedBull { get; private set; } public static SuperDonutConfig SuperDonut { get; private set; } public static GravityGunConfig GravityGun { get; private set; } public static RocketTetherConfig RocketTether { get; private set; } public static JetpackConfig Jetpack { get; private set; } public static TeleporterConfig Teleporter { get; private set; } public static SpinachConfig Spinach { get; private set; } public static FlamethrowerConfig Flamethrower { get; private set; } public static RocketTetherGrenadeConfig RocketTetherGrenade { get; private set; } public static WindStormConfig WindStorm { get; private set; } public static HunterDroneConfig HunterDrone { get; private set; } public static UfoAbductionConfig UfoAbduction { get; private set; } public static MoonConfig Moon { get; private set; } public static ShapeShifterConfig ShapeShifter { get; private set; } public static SuperShapeShifterConfig SuperShapeShifter { get; private set; } public static ExplosiveGolfBallsConfig ExplosiveGolfBalls { get; private set; } public static void Initialize(ConfigFile cfg) { Global = new GlobalConfig(cfg); BaseballBat = new BaseballBatConfig(cfg, Global); StealthBomber = new StealthBomberConfig(cfg, Global); PredatorMissile = new PredatorMissileConfig(cfg, Global); AC130 = new AC130Config(cfg, Global); Freeze = new FreezeConfig(cfg, Global); LowGravity = new LowGravityConfig(cfg, Global); SniperRifle = new SniperRifleConfig(cfg, Global); Donut = new DonutConfig(cfg, Global); Javelin = new JavelinConfig(cfg, Global); StickyGrenade = new StickyGrenadeConfig(cfg, Global); Bear = new BearConfig(cfg, Global); Nuke = new NukeConfig(cfg, Global); BlackHoleGrenade = new BlackHoleGrenadeConfig(cfg, Global); PlaceableWall = new PlaceableWallConfig(cfg, Global); AK47 = new AK47Config(cfg, Global); Harrier = new HarrierConfig(cfg, Global); PositionSwap = new PositionSwapConfig(cfg, Global); PoisonJar = new PoisonJarConfig(cfg, Global); DroneSwarm = new DroneSwarmConfig(cfg, Global); RedBull = new RedBullConfig(cfg, Global); SuperDonut = new SuperDonutConfig(cfg, Global); GravityGun = new GravityGunConfig(cfg, Global); RocketTether = new RocketTetherConfig(cfg, Global); Jetpack = new JetpackConfig(cfg, Global); Teleporter = new TeleporterConfig(cfg, Global); Spinach = new SpinachConfig(cfg, Global); Flamethrower = new FlamethrowerConfig(cfg, Global); RocketTetherGrenade = new RocketTetherGrenadeConfig(cfg, Global); WindStorm = new WindStormConfig(cfg, Global); HunterDrone = new HunterDroneConfig(cfg, Global); UfoAbduction = new UfoAbductionConfig(cfg, Global); Moon = new MoonConfig(cfg, Global); ShapeShifter = new ShapeShifterConfig(cfg, Global); SuperShapeShifter = new SuperShapeShifterConfig(cfg, Global); ExplosiveGolfBalls = new ExplosiveGolfBallsConfig(cfg, Global); } public static bool GetItemEnabled(ItemType itemType) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Global.GetItemEnabled(itemType); } public static void SetItemEnabled(ItemType itemType, bool enabled) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Global.SetItemEnabled(itemType, enabled); } public static float GetItemPoolWeight(ItemType t, int pool) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Global.GetItemPoolWeight(t, pool); } public static void SetItemPoolWeight(ItemType t, int pool, float v) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Global.SetItemPoolWeight(t, pool, v); } public static bool GetItemWarningEnabled(ItemType itemType) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Global.GetItemWarningEnabled(itemType); } } public class MoonConfig { private const string Section = "Moon"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry ApproachDuration { get; private set; } public ConfigEntry SpawnDistance { get; private set; } public ConfigEntry SpawnHeight { get; private set; } public ConfigEntry ImpactHeight { get; private set; } public ConfigEntry SuckDuration { get; private set; } public ConfigEntry PullForce { get; private set; } public ConfigEntry MaxPullSpeed { get; private set; } public ConfigEntry PullRadius { get; private set; } public ConfigEntry PullAffectsGolfBalls { get; private set; } public ConfigEntry PullAffectsWielder { get; private set; } public ConfigEntry ExplosionForce { get; private set; } public ConfigEntry ExplosionRadius { get; private set; } public ConfigEntry InitialScale { get; private set; } public ConfigEntry FinalScale { get; private set; } public ConfigEntry FlyAwayDuration { get; private set; } public ConfigEntry DuskEnabled { get; private set; } public ConfigEntry DuskFadeDuration { get; private set; } public MoonConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Moon", "GiveKey", (Key)0, "Hotkey to give yourself a Majora's Moon (debug/testing)."); Uses = cfg.Bind("Moon", "Uses", 1f, "Number of uses per Moon pickup."); ApproachDuration = cfg.Bind("Moon", "ApproachDuration", 30f, "Seconds for the moon to travel from spawn to above the course."); SpawnDistance = cfg.Bind("Moon", "SpawnDistance", 300f, "Horizontal distance (units) from the hole at which the moon spawns."); SpawnHeight = cfg.Bind("Moon", "SpawnHeight", 1025f, "Height (units) above ground at which the moon spawns."); ImpactHeight = cfg.Bind("Moon", "ImpactHeight", 350f, "Height (units) above the hole where the moon stops before pulling players in."); SuckDuration = cfg.Bind("Moon", "SuckDuration", 8f, "Seconds the moon hovers at impact height while pulling all players upward."); PullForce = cfg.Bind("Moon", "PullForce", 550f, "Peak upward pull force (m/s²) applied to the local player during the suck phase."); MaxPullSpeed = cfg.Bind("Moon", "MaxPullSpeed", 999f, "Maximum velocity (m/s) toward the moon allowed during the suck phase."); PullRadius = cfg.Bind("Moon", "PullRadius", 999f, "Distance (units) at which pull force begins to fall off quadratically."); ExplosionForce = cfg.Bind("Moon", "ExplosionForce", 999f, "Peak velocity change (m/s) applied to non-player Rigidbodies at the moon's impact point."); ExplosionRadius = cfg.Bind("Moon", "ExplosionRadius", 250f, "Radius (units) within which the explosion force affects nearby Rigidbodies."); PullAffectsGolfBalls = cfg.Bind("Moon", "PullAffectsGolfBalls", false, "If true, the moon's suck phase pulls nearby golf balls toward it."); PullAffectsWielder = cfg.Bind("Moon", "PullAffectsWielder", false, "If true, the player who used the Moon item is also pulled toward it."); InitialScale = cfg.Bind("Moon", "InitialScale", 0.01f, "Initial scale of the moon."); FinalScale = cfg.Bind("Moon", "FinalScale", 3f, "Final scale of the moon."); FlyAwayDuration = cfg.Bind("Moon", "FlyAwayDuration", 5f, "Seconds the moon takes to fly back to its spawn point after the session ends. Set to 0 to destroy it instantly."); DuskEnabled = cfg.Bind("Moon", "DuskEnabled", true, "If true, the sky shifts to a dusk palette while the moon is active."); DuskFadeDuration = cfg.Bind("Moon", "DuskFadeDuration", 3f, "Seconds to fade the sky in/out when the moon session begins or ends."); } } public class NukeConfig { private const string Section = "Nuke"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry DropHeight { get; private set; } public ConfigEntry DropSpeed { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public ConfigEntry SkyBlastForce { get; private set; } public ConfigEntry SkyBlastRadius { get; private set; } public ConfigEntry SkyBlastVerticalBias { get; private set; } public ConfigEntry ExplosionVfxDuration { get; private set; } public ConfigEntry ExplosionVfxScale { get; private set; } public ConfigEntry ExcludeThrower { get; private set; } public NukeConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Nuke", "GiveKey", (Key)90, "Debug key to add the Nuke to your inventory."); Uses = cfg.Bind("Nuke", "Uses", 1f, "Number of uses per Nuke pickup."); DropHeight = cfg.Bind("Nuke", "DropHeight", 300f, "Units above the map centre at which the nuke bomb spawns."); DropSpeed = cfg.Bind("Nuke", "DropSpeed", 80f, "Downward speed of the falling nuke bomb in units per second."); SkyBlastForce = cfg.Bind("Nuke", "SkyBlastForce", 350f, "Extra upward impulse force applied to all rigidbodies within SkyBlastRadius after detonation. Stacks on top of the standard explosion knockback."); SkyBlastRadius = cfg.Bind("Nuke", "SkyBlastRadius", 350f, "Radius (units) of the secondary sky blast. Should be large enough to cover the whole map so no one escapes."); SkyBlastVerticalBias = cfg.Bind("Nuke", "SkyBlastVerticalBias", 0.7f, "Controls how much of the sky blast force goes upward versus outward (0 = all outward, 1 = all straight up). The horizontal direction is still relative to the explosion point, so players are pushed away from the blast site."); ExplosionVfxDuration = cfg.Bind("Nuke", "ExplosionVfxDuration", 8f, "Seconds before the nuke explosion VFX prefab is destroyed on each client."); ExplosionVfxScale = cfg.Bind("Nuke", "ExplosionVfxScale", 5f, "Uniform scale applied to the nuke explosion VFX transform on each client. Increase this to make the particle systems appear larger."); ExcludeThrower = cfg.Bind("Nuke", "ExcludeThrower", true, "If true, the sky blast does not apply force to the player who activated the nuke."); ExplosionScale = cfg.Bind("Explosions", "NukeScale", 6f, "Explosion scale multiplier for the Nuke's detonation rocket. Affects blast radius, knockback force, and VFX size."); } } public class PlaceableWallConfig { private const string Section = "PlaceableWall"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry MaxPlacementDistance { get; private set; } public ConfigEntry MinHoleDistance { get; private set; } public ConfigEntry HealthPoints { get; private set; } public ConfigEntry VelocityImpactFactor { get; private set; } public ConfigEntry TorsionMultiplier { get; private set; } public ConfigEntry RotationStep { get; private set; } public ConfigEntry DebrisLifetime { get; private set; } public ConfigEntry RocketExplosionForce { get; private set; } public ConfigEntry DamageGolfClub { get; private set; } public ConfigEntry DamageBaseballBat { get; private set; } public PlaceableWallConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("PlaceableWall", "GiveKey", (Key)92, "Debug key to add the Placeable Wall to your inventory."); Uses = cfg.Bind("PlaceableWall", "Uses", 1f, "Number of wall placements per pickup."); MaxPlacementDistance = cfg.Bind("PlaceableWall", "MaxPlacementDistance", 20f, "Maximum distance (units) from the player's camera at which a wall can be placed."); MinHoleDistance = cfg.Bind("PlaceableWall", "MinHoleDistance", 3f, "Minimum XZ distance (units) from the hole centre that a wall may be placed. Prevents blocking the hole entirely. Set to 0 to disable the check."); HealthPoints = cfg.Bind("PlaceableWall", "HealthPoints", 3f, "Number of golf club or baseball bat hits required to destroy the wall. Rocket hits always destroy in one shot."); VelocityImpactFactor = cfg.Bind("PlaceableWall", "VelocityImpactFactor", 2.5f, "Degree to which the velocity of an object colliding with the placeable wall will damage it. Default: 2.5."); TorsionMultiplier = cfg.Bind("PlaceableWall", "TorsionMultiplier", 0.002f, "Degree to which torque (spin) damages the bricks of the placeable wall. Default: 0.002."); RotationStep = cfg.Bind("PlaceableWall", "RotationStep", 45f, "Degrees the wall rotates per scroll-wheel tick during the placement preview. Scroll up rotates clockwise, scroll down rotates counter-clockwise."); DebrisLifetime = cfg.Bind("PlaceableWall", "DebrisLifetime", 30f, "Seconds before detached wall debris (bricks/pillars) are automatically destroyed."); RocketExplosionForce = cfg.Bind("PlaceableWall", "RocketExplosionForce", 600f, "Impulse force (per brick) applied by a rocket explosion to detached wall debris."); DamageGolfClub = cfg.Bind("PlaceableWall", "DamageGolfClub", 1f, "Damage dealt to a wall chunk per golf club swing."); DamageBaseballBat = cfg.Bind("PlaceableWall", "DamageBaseballBat", 2f, "Damage dealt to a wall chunk per baseball bat swing."); } } public class PoisonJarConfig { private const string JarSection = "PoisonJar"; private const string OverlaySection = "PoisonOverlay"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry ThrowSpeed { get; private set; } public ConfigEntry LobAngle { get; private set; } public ConfigEntry Radius { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry GhostEnabled { get; private set; } public ConfigEntry GhostOffsetX { get; private set; } public ConfigEntry GhostOffsetY { get; private set; } public ConfigEntry GhostAlpha { get; private set; } public ConfigEntry RollFreq1 { get; private set; } public ConfigEntry RollAmp1 { get; private set; } public ConfigEntry RollFreq2 { get; private set; } public ConfigEntry RollAmp2 { get; private set; } public ConfigEntry RollFreq3 { get; private set; } public ConfigEntry RollAmp3 { get; private set; } public ConfigEntry FovFreq1 { get; private set; } public ConfigEntry FovAmp1 { get; private set; } public ConfigEntry FovFreq2 { get; private set; } public ConfigEntry FovAmp2 { get; private set; } public ConfigEntry VigPulseFreq1 { get; private set; } public ConfigEntry VigPulseFreq2 { get; private set; } public ConfigEntry VigBaseAlpha { get; private set; } public ConfigEntry VigPulseAmp1 { get; private set; } public ConfigEntry VigPulseAmp2 { get; private set; } public ConfigEntry TintBaseAlpha { get; private set; } public ConfigEntry TintPulseAmp { get; private set; } public ConfigEntry TintPulseFreq { get; private set; } public ConfigEntry AimNoiseEnabled { get; private set; } public ConfigEntry AimNoiseYawAmp { get; private set; } public ConfigEntry AimNoiseYawFreq { get; private set; } public ConfigEntry AimNoisePitchAmp { get; private set; } public ConfigEntry AimNoisePitchFreq { get; private set; } public PoisonJarConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("PoisonJar", "GiveKey", (Key)82, "Debug key to add the Poison Jar to your inventory."); Uses = cfg.Bind("PoisonJar", "Uses", 1f, "Number of uses per Poison Jar pickup."); ThrowSpeed = cfg.Bind("PoisonJar", "ThrowSpeed", 18f, "Initial throw speed in metres per second."); LobAngle = cfg.Bind("PoisonJar", "LobAngle", 0.35f, "Upward component added to the throw direction (0 = flat, 1 = 45° up)."); Radius = cfg.Bind("PoisonJar", "Radius", 2f, "Radius in metres of the poison AoE. Also scales the splash VFX."); Duration = cfg.Bind("PoisonJar", "Duration", 10f, "How long (seconds) the poison visual lasts on affected players."); GhostEnabled = cfg.Bind("PoisonOverlay", "GhostEnabled", true, "Enable the double-vision ghost image."); GhostOffsetX = cfg.Bind("PoisonOverlay", "GhostOffsetX", 0.04f, "Horizontal ghost offset as a fraction of screen width (e.g. 0.04 = 4%)."); GhostOffsetY = cfg.Bind("PoisonOverlay", "GhostOffsetY", 0.01f, "Vertical ghost offset as a fraction of screen height."); GhostAlpha = cfg.Bind("PoisonOverlay", "GhostAlpha", 0.35f, "Opacity of the ghost image (0–1)."); RollFreq1 = cfg.Bind("PoisonOverlay", "RollFreq1", 1f, "Primary lean frequency (Hz)."); RollAmp1 = cfg.Bind("PoisonOverlay", "RollAmp1", 4.5f, "Primary lean amplitude (degrees)."); RollFreq2 = cfg.Bind("PoisonOverlay", "RollFreq2", 0.28f, "Slow drift frequency (Hz)."); RollAmp2 = cfg.Bind("PoisonOverlay", "RollAmp2", 12f, "Slow drift amplitude (degrees)."); RollFreq3 = cfg.Bind("PoisonOverlay", "RollFreq3", 1.35f, "Subtle tremor frequency (Hz)."); RollAmp3 = cfg.Bind("PoisonOverlay", "RollAmp3", 5f, "Subtle tremor amplitude (degrees)."); FovFreq1 = cfg.Bind("PoisonOverlay", "FovFreq1", 0.5f, "Primary FOV breathing frequency (Hz)."); FovAmp1 = cfg.Bind("PoisonOverlay", "FovAmp1", 5f, "Primary FOV breathing amplitude (degrees)."); FovFreq2 = cfg.Bind("PoisonOverlay", "FovFreq2", 1.2f, "Secondary FOV breathing frequency (Hz)."); FovAmp2 = cfg.Bind("PoisonOverlay", "FovAmp2", 8f, "Secondary FOV breathing amplitude (degrees)."); VigPulseFreq1 = cfg.Bind("PoisonOverlay", "VigPulseFreq1", 1.2f, "Vignette primary pulse frequency (Hz)."); VigPulseFreq2 = cfg.Bind("PoisonOverlay", "VigPulseFreq2", 6f, "Vignette secondary pulse frequency (Hz)."); VigBaseAlpha = cfg.Bind("PoisonOverlay", "VigBaseAlpha", 0.5f, "Vignette base opacity (0–1)."); VigPulseAmp1 = cfg.Bind("PoisonOverlay", "VigPulseAmp1", 0.15f, "Vignette primary pulse amplitude."); VigPulseAmp2 = cfg.Bind("PoisonOverlay", "VigPulseAmp2", 0.08f, "Vignette secondary pulse amplitude."); TintBaseAlpha = cfg.Bind("PoisonOverlay", "TintBaseAlpha", 0.1f, "Full-screen tint base opacity (0–1)."); TintPulseAmp = cfg.Bind("PoisonOverlay", "TintPulseAmp", 0.05f, "Full-screen tint pulse amplitude."); TintPulseFreq = cfg.Bind("PoisonOverlay", "TintPulseFreq", 3f, "Full-screen tint pulse frequency (Hz)."); AimNoiseEnabled = cfg.Bind("PoisonOverlay", "AimNoiseEnabled", true, "If true, adds sinusoidal yaw and pitch drift to make aiming harder while poisoned."); AimNoiseYawAmp = cfg.Bind("PoisonOverlay", "AimNoiseYawAmp", 2.5f, "Yaw (horizontal) aim drift amplitude in degrees."); AimNoiseYawFreq = cfg.Bind("PoisonOverlay", "AimNoiseYawFreq", 0.8f, "Yaw aim drift frequency in Hz."); AimNoisePitchAmp = cfg.Bind("PoisonOverlay", "AimNoisePitchAmp", 1.5f, "Pitch (vertical) aim drift amplitude in degrees."); AimNoisePitchFreq = cfg.Bind("PoisonOverlay", "AimNoisePitchFreq", 1.1f, "Pitch aim drift frequency in Hz."); } } public class PositionSwapConfig { private const string Section = "PositionSwap"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Delay { get; private set; } public PositionSwapConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("PositionSwap", "GiveKey", (Key)81, "Debug key to add the Position Swap item to your inventory."); Uses = cfg.Bind("PositionSwap", "Uses", 1f, "Number of uses per Position Swap pickup."); Delay = cfg.Bind("PositionSwap", "Delay", 3f, "Seconds between selecting a swap target and the swap executing. During this time a warning orb appears under both players."); } } public class PredatorMissileConfig { private const string Section = "PredatorMissile"; public ConfigEntry Altitude { get; private set; } public ConfigEntry FallSpeed { get; private set; } public ConfigEntry SteerSpeed { get; private set; } public ConfigEntry Timeout { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry GiveKey { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public PredatorMissileConfig(ConfigFile cfg, GlobalConfig global) { Altitude = cfg.Bind("PredatorMissile", "Altitude", 175f, "Height above the player where the missile spawns."); FallSpeed = cfg.Bind("PredatorMissile", "FallSpeed", 50f, "Downward speed of the missile in units per second."); SteerSpeed = cfg.Bind("PredatorMissile", "SteerSpeed", 35f, "Horizontal steering speed when directing the missile."); Timeout = cfg.Bind("PredatorMissile", "Timeout", 15f, "Maximum seconds before the missile auto-detonates."); Uses = cfg.Bind("PredatorMissile", "Uses", 1f, "Number of missile uses per pickup."); GiveKey = cfg.Bind("PredatorMissile", "GiveKey", (Key)102, "Key to press to add the predator missile to your inventory."); ExplosionScale = cfg.Bind("Explosions", "PredatorMissileScale", 3f, "Multiplier for Predator Missile explosions. Affects blast radius, knockback, and VFX size."); } } public class RedBullConfig { private const string Section = "RedBull"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry ExtraSpeedMultiplier { get; private set; } public ConfigEntry JumpBonus { get; private set; } public ConfigEntry DispenserChance { get; private set; } public RedBullConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("RedBull", "GiveKey", (Key)79, "Hotkey to give yourself a Red Bull (debug/testing)."); Uses = cfg.Bind("RedBull", "Uses", 1f, "Number of uses per Red Bull item."); Duration = cfg.Bind("RedBull", "Duration", 10f, "How long the Red Bull speed and jump boost lasts (seconds)."); ExtraSpeedMultiplier = cfg.Bind("RedBull", "ExtraSpeedMultiplier", 1.625f, "Additional speed multiplier applied on top of the coffee speed-boost factor while Red Bull is active."); JumpBonus = cfg.Bind("RedBull", "JumpBonus", 10f, "Extra upward velocity (m/s) added to each jump while Red Bull is active."); DispenserChance = cfg.Bind("RedBull", "DispenserChance", 0.25f, "Probability (0–1) that the coffee dispenser gives a Red Bull instead of a coffee. 0 = never, 1 = always."); } } public class RocketTetherConfig { private const string Section = "RocketTether"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry LockOnRange { get; private set; } public ConfigEntry LockOnConeAngleDeg { get; private set; } public ConfigEntry TetherDuration { get; private set; } public ConfigEntry SpringForce { get; private set; } public ConfigEntry MaxPullSpeed { get; private set; } public ConfigEntry NaturalLength { get; private set; } public ConfigEntry RocketSpeed { get; private set; } public ConfigEntry ExplosionForce { get; private set; } public ConfigEntry ExplosionRadius { get; private set; } public RocketTetherConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("RocketTether", "GiveKey", (Key)79, "Hotkey to give yourself a Rocket Tether (debug/testing)."); Uses = cfg.Bind("RocketTether", "Uses", 1f, "Number of uses per Rocket Tether pickup."); LockOnRange = cfg.Bind("RocketTether", "LockOnRange", 40f, "Maximum distance (units) at which the Rocket Tether can lock onto a target."); LockOnConeAngleDeg = cfg.Bind("RocketTether", "LockOnConeAngleDeg", 60f, "Full angle (degrees) of the aim cone used to filter lock-on candidates."); TetherDuration = cfg.Bind("RocketTether", "TetherDuration", 8f, "Duration in seconds before the tether automatically disconnects."); SpringForce = cfg.Bind("RocketTether", "SpringForce", 5f, "Spring stiffness coefficient; multiplied by stretch distance to compute pull speed."); MaxPullSpeed = cfg.Bind("RocketTether", "MaxPullSpeed", 20f, "Maximum velocity change (m/s) applied to each player per physics tick."); NaturalLength = cfg.Bind("RocketTether", "NaturalLength", 5f, "Distance (units) below which no force is applied. Set >0 for a rope with slack."); RocketSpeed = cfg.Bind("RocketTether", "RocketSpeed", 35f, "Upward speed (m/s) of the rocket during its flight."); ExplosionForce = cfg.Bind("RocketTether", "ExplosionForce", 100f, "Peak velocity change (m/s, VelocityChange) applied at the explosion centre."); ExplosionRadius = cfg.Bind("RocketTether", "ExplosionRadius", 50f, "Radius (units) within which the explosion affects nearby players."); } } public class RocketTetherGrenadeConfig { private const string Section = "RocketTetherGrenade"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry ExcludeThrower { get; private set; } public ConfigEntry ThrowSpeed { get; private set; } public ConfigEntry LobAngle { get; private set; } public ConfigEntry BlastRadius { get; private set; } public ConfigEntry MaxVictims { get; private set; } public ConfigEntry TetherDuration { get; private set; } public ConfigEntry RocketSpeed { get; private set; } public ConfigEntry SpringForce { get; private set; } public ConfigEntry MaxPullSpeed { get; private set; } public ConfigEntry NaturalLength { get; private set; } public ConfigEntry ExplosionForce { get; private set; } public ConfigEntry ExplosionRadius { get; private set; } public RocketTetherGrenadeConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("RocketTetherGrenade", "GiveKey", (Key)0, "Hotkey to give yourself a Rocket Tether Grenade (debug/testing)."); Uses = cfg.Bind("RocketTetherGrenade", "Uses", 1f, "Number of uses per Rocket Tether Grenade pickup."); ThrowSpeed = cfg.Bind("RocketTetherGrenade", "ThrowSpeed", 18f, "Initial speed (m/s) of the thrown grenade."); LobAngle = cfg.Bind("RocketTetherGrenade", "LobAngle", 0.4f, "Upward angle added to the camera forward direction when throwing (0 = flat, 1 = straight up)."); BlastRadius = cfg.Bind("RocketTetherGrenade", "BlastRadius", 12f, "Radius (units) within which players are tethered on landing."); MaxVictims = cfg.Bind("RocketTetherGrenade", "MaxVictims", 4f, "Maximum number of players that can be simultaneously tethered by one grenade."); ExcludeThrower = cfg.Bind("RocketTetherGrenade", "ExcludeThrower", true, "If true, the thrower cannot tether themselves with a grenade."); TetherDuration = cfg.Bind("RocketTetherGrenade", "TetherDuration", 6f, "Duration (seconds) before each victim's rocket explodes."); RocketSpeed = cfg.Bind("RocketTetherGrenade", "RocketSpeed", 35f, "Upward speed (m/s) of each victim's rocket during its flight."); SpringForce = cfg.Bind("RocketTetherGrenade", "SpringForce", 5f, "Spring stiffness coefficient; multiplied by stretch distance to compute pull speed."); MaxPullSpeed = cfg.Bind("RocketTetherGrenade", "MaxPullSpeed", 20f, "Maximum velocity change (m/s) applied to each victim per physics tick."); NaturalLength = cfg.Bind("RocketTetherGrenade", "NaturalLength", 5f, "Distance (units) below which no pull force is applied (rope slack)."); ExplosionForce = cfg.Bind("RocketTetherGrenade", "ExplosionForce", 80f, "Peak velocity change (m/s, VelocityChange) at each victim's explosion centre."); ExplosionRadius = cfg.Bind("RocketTetherGrenade", "ExplosionRadius", 50f, "Radius (units) within which each victim's explosion affects nearby players."); } } public class ShapeShifterConfig { private const string Section = "ShapeShifter"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry SpawnWeight { get; private set; } public ConfigEntry PhysicsAngularDamping { get; private set; } public ConfigEntry PhysicsHitSpinFactor { get; private set; } public ConfigEntry ShapeCubeEnabled { get; private set; } public ConfigEntry ShapeDiskEnabled { get; private set; } public ConfigEntry ShapeCylinderEnabled { get; private set; } public ConfigEntry ShapeConeEnabled { get; private set; } public ConfigEntry ShapePyramidEnabled { get; private set; } public ConfigEntry ShapeAcornEnabled { get; private set; } public ConfigEntry ShapeIsosphereEnabled { get; private set; } public ShapeShifterConfig(ConfigFile cfg, GlobalConfig global) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown GiveKey = cfg.Bind("ShapeShifter", "GiveKey", (Key)0, "Hotkey to give yourself a Shape Shifter (debug/testing)."); Uses = cfg.Bind("ShapeShifter", "Uses", 1f, "Number of uses per Shape Shifter pickup."); Duration = cfg.Bind("ShapeShifter", "Duration", 20f, "Seconds the target player's golf ball remains a cube."); SpawnWeight = cfg.Bind("ShapeShifter", "SpawnWeight", 5f, "Relative spawn weight for the Shape Shifter item in the item pool."); PhysicsAngularDamping = cfg.Bind("ShapeShifter", "PhysicsAngularDamping", 0.002f, new ConfigDescription("Angular damping override while the cube effect is active. Lower = more tumbling. The game normally resets this each frame; this patch overrides it after the reset.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); PhysicsHitSpinFactor = cfg.Bind("ShapeShifter", "PhysicsHitSpinFactor", 5f, new ConfigDescription("Multiplier for the angular impulse applied when a cubed ball is hit. Higher = cube starts tumbling more immediately instead of sliding flat. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 20f), Array.Empty())); ShapeCubeEnabled = cfg.Bind("ShapeShifter.Shapes", "Cube", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); ShapeDiskEnabled = cfg.Bind("ShapeShifter.Shapes", "Disk", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); ShapeCylinderEnabled = cfg.Bind("ShapeShifter.Shapes", "Cylinder", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); ShapeConeEnabled = cfg.Bind("ShapeShifter.Shapes", "Cone", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); ShapePyramidEnabled = cfg.Bind("ShapeShifter.Shapes", "Pyramid", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); ShapeAcornEnabled = cfg.Bind("ShapeShifter.Shapes", "Acorn", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); ShapeIsosphereEnabled = cfg.Bind("ShapeShifter.Shapes", "Isosphere", true, "Whether this shape can be randomly selected by the Shape Shifter and Super Shape Shifter."); } } public class SniperRifleConfig { private const string Section = "SniperRifle"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry MaxAimingDistance { get; private set; } public ConfigEntry MaxShotDistance { get; private set; } public ConfigEntry ScopedInaccuracy { get; private set; } public ConfigEntry HipFireInaccuracy { get; private set; } public ConfigEntry ZoomFov { get; private set; } public ConfigEntry ZoomSpeed { get; private set; } public ConfigEntry ShotDuration { get; private set; } public ConfigEntry MinZoomFov { get; private set; } public ConfigEntry MaxZoomFov { get; private set; } public ConfigEntry ScrollSensitivity { get; private set; } public ConfigEntry ScreenShakeIntensity { get; private set; } public SniperRifleConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("SniperRifle", "GiveKey", (Key)85, "Debug key to add the Sniper Rifle to your inventory."); Uses = cfg.Bind("SniperRifle", "Uses", 3f, "Number of shots per Sniper Rifle pickup."); MaxAimingDistance = cfg.Bind("SniperRifle", "MaxAimingDistance", 1000f, "Maximum distance (units) the aim-point raycast travels when computing where the barrel points."); MaxShotDistance = cfg.Bind("SniperRifle", "MaxShotDistance", 1000f, "Maximum distance (units) the bullet raycast travels before missing."); ScopedInaccuracy = cfg.Bind("SniperRifle", "ScopedInaccuracy", 0.05f, "Maximum random angular deviation (degrees) when firing while scoped. Lower = more precise."); HipFireInaccuracy = cfg.Bind("SniperRifle", "HipFireInaccuracy", 3f, "Maximum random angular deviation (degrees) when firing from the hip (not scoped)."); ZoomFov = cfg.Bind("SniperRifle", "ZoomFov", 15f, "Camera field of view while the scope is active. Lower values zoom in more."); ZoomSpeed = cfg.Bind("SniperRifle", "ZoomSpeed", 10f, "Speed at which the camera lerps to and from the scoped FOV."); ShotDuration = cfg.Bind("SniperRifle", "ShotDuration", 0.6f, "Seconds the shot animation plays before the item use state resets."); MinZoomFov = cfg.Bind("SniperRifle", "MinZoomFov", 5f, "Minimum FOV reachable by scrolling in (maximum zoom). Lower = more zoomed."); MaxZoomFov = cfg.Bind("SniperRifle", "MaxZoomFov", 40f, "Maximum FOV reachable by scrolling out (minimum zoom). Must be above MinZoomFov."); ScrollSensitivity = cfg.Bind("SniperRifle", "ScrollSensitivity", 5f, "FOV units changed per scroll notch. Higher values zoom faster."); ScreenShakeIntensity = cfg.Bind("SniperRifle", "ScreenShakeIntensity", 0.65f, "Intensity of the screen shake when firing the Sniper Rifle. 0 disables it. Higher values shake more."); } } public class SpinachConfig { private const string Section = "Spinach"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry PowerMultiplier { get; private set; } public ConfigEntry GolfBallPowerMultiplier { get; private set; } public ConfigEntry Duration { get; private set; } public SpinachConfig(ConfigFile cfg, GlobalConfig global) { Duration = cfg.Bind("Spinach", "Duration", 30f, "Duration in seconds of the spinach."); PowerMultiplier = cfg.Bind("Spinach", "PowerMultiplier", 3f, "Swing power multiplier for non-golf-ball hits (e.g. golf carts)."); GolfBallPowerMultiplier = cfg.Bind("Spinach", "GolfBallPowerMultiplier", 1.65f, "Swing power multiplier specifically for golf ball hits."); Uses = cfg.Bind("Spinach", "Uses", 1f, "Number of uses"); GiveKey = cfg.Bind("Spinach", "GiveKey", (Key)99, "Key to press to get the spinach item."); } } public class StealthBomberConfig { private const string Section = "StealthBomber"; public ConfigEntry Altitude { get; private set; } public ConfigEntry Speed { get; private set; } public ConfigEntry RocketInterval { get; private set; } public ConfigEntry Spread { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry GiveKey { get; private set; } public ConfigEntry WaitTime { get; private set; } public ConfigEntry StripLength { get; private set; } public ConfigEntry RocketAngularJitter { get; private set; } public ConfigEntry RocketSpawnDepth { get; private set; } public ConfigEntry TargetingZoomSpeed { get; private set; } public ConfigEntry TargetMoveSpeed { get; private set; } public ConfigEntry TargetRotateSpeed { get; private set; } public ConfigEntry ApproachDistance { get; private set; } public ConfigEntry HitsToDestroy { get; private set; } public ConfigEntry CrashImpactForce { get; private set; } public ConfigEntry CrashDownwardForce { get; private set; } public ConfigEntry CrashTorque { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public StealthBomberConfig(ConfigFile cfg, GlobalConfig global) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown Altitude = cfg.Bind("StealthBomber", "Altitude", 60f, "Height above the map the bombing run flies at."); Speed = cfg.Bind("StealthBomber", "Speed", 35f, "Speed of the bombing run in units per second."); ApproachDistance = cfg.Bind("StealthBomber", "ApproachDistance", 300f, "How far away the bomber visual spawns from the targeting strip in units."); RocketInterval = cfg.Bind("StealthBomber", "RocketInterval", 0.75f, "Seconds between each rocket drop during a bombing run."); Spread = cfg.Bind("StealthBomber", "Spread", 25f, new ConfigDescription("Random lateral spread in units for each rocket's drop position.", (AcceptableValueBase)(object)new AcceptableValueRange(25f, 100f), Array.Empty())); Uses = cfg.Bind("StealthBomber", "Uses", 1f, "Number of bombing runs per pickup."); GiveKey = cfg.Bind("StealthBomber", "GiveKey", (Key)101, "Key to press to add the stealth bomber to your inventory."); WaitTime = cfg.Bind("StealthBomber", "WaitTime", 1.5f, "Seconds to wait before starting the bombing run."); StripLength = cfg.Bind("StealthBomber", "StripLength", 300f, "Length of the targeting strip in units."); TargetingZoomSpeed = cfg.Bind("StealthBomber", "TargetingZoomSpeed", 5f, "Speed at which the camera zooms in/out during bomber targeting."); RocketAngularJitter = cfg.Bind("StealthBomber", "RocketAngularJitter", 0.8f, "Random angular jitter in degrees for each rocket's rotation."); RocketSpawnDepth = cfg.Bind("StealthBomber", "RocketSpawnDepth", 5f, "How far below the bomber (in units) rockets spawn, to avoid colliding with the bomber on creation."); TargetMoveSpeed = cfg.Bind("StealthBomber", "TargetMoveSpeed", 50f, "How fast the targeting strip moves with WASD."); TargetRotateSpeed = cfg.Bind("StealthBomber", "TargetRotateSpeed", 90f, "Rotation speed of the targeting strip in degrees per second (Q/E)."); HitsToDestroy = cfg.Bind("StealthBomber", "HitsToDestroy", 1f, "Rocket hits required to shoot down the bomber and cancel its run. Set to 0 to make it invincible."); CrashImpactForce = cfg.Bind("StealthBomber", "CrashImpactForce", 500f, "Impulse force applied to the stealth bomber in the direction of the rocket hit when shot down."); CrashDownwardForce = cfg.Bind("StealthBomber", "CrashDownwardForce", 15f, "Impulse force applied to the stealth bomber in the downward direction."); CrashTorque = cfg.Bind("StealthBomber", "CrashTorque", 1.2f, "Magnitude of the random tumble torque applied to the stealth bomber when shot down."); ExplosionScale = cfg.Bind("Explosions", "StealthBomberScale", 1.5f, "Multiplier for Stealth Bomber rocket explosions. Affects blast radius, knockback, and VFX size."); } } public class StickyGrenadeConfig { private const string Section = "StickyGrenade"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry ThrowSpeed { get; private set; } public ConfigEntry MaxThrowSpeed { get; private set; } public ConfigEntry LobAngle { get; private set; } public ConfigEntry FuseTime { get; private set; } public ConfigEntry GraceTime { get; private set; } public ConfigEntry StickRadius { get; private set; } public ConfigEntry ExplosionScale { get; private set; } public StickyGrenadeConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("StickyGrenade", "GiveKey", (Key)88, "Debug key to add the StickyGrenade grenade to your inventory."); Uses = cfg.Bind("StickyGrenade", "Uses", 2f, "Number of StickyGrenade grenades per pickup."); ThrowSpeed = cfg.Bind("StickyGrenade", "ThrowSpeed", 22f, "Initial speed in units per second when the grenade is thrown."); MaxThrowSpeed = cfg.Bind("StickyGrenade", "MaxThrowSpeed", 35f, "Server-side cap on throw speed to prevent exploits."); LobAngle = cfg.Bind("StickyGrenade", "LobAngle", 0.25f, "Upward component added to the throw direction for a natural lob arc. 0 = perfectly flat, 1 = 45 degrees upward."); FuseTime = cfg.Bind("StickyGrenade", "FuseTime", 3.5f, "Seconds from when the grenade sticks until it detonates."); GraceTime = cfg.Bind("StickyGrenade", "GraceTime", 0.35f, "Seconds after throwing before the grenade can stick to anything. Prevents the grenade from immediately sticking to the thrower."); StickRadius = cfg.Bind("StickyGrenade", "StickRadius", 0.55f, "Radius of the overlap sphere used to detect stick targets each FixedUpdate."); ExplosionScale = cfg.Bind("Explosions", "StickyGrenadeScale", 4f, "Multiplier for StickyGrenade explosions. Affects blast radius, knockback, and VFX size."); } } public class SuperDonutConfig { private const string Section = "SuperDonut"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public SuperDonutConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("SuperDonut", "GiveKey", (Key)78, "Hotkey to give yourself a Super Donut (debug/testing)."); Uses = cfg.Bind("SuperDonut", "Uses", 1f, "Number of Super Donut uses per pickup."); } } public class SuperShapeShifterConfig { private const string Section = "SuperShapeShifter"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry SpawnWeight { get; private set; } public ConfigEntry AffectSelf { get; private set; } public SuperShapeShifterConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("SuperShapeShifter", "GiveKey", (Key)0, "Hotkey to give yourself a Super Shape Shifter (debug/testing)."); Uses = cfg.Bind("SuperShapeShifter", "Uses", 1f, "Number of uses per Super Shape Shifter pickup."); Duration = cfg.Bind("SuperShapeShifter", "Duration", 20f, "Seconds all other players' golf balls remain cubes."); SpawnWeight = cfg.Bind("SuperShapeShifter", "SpawnWeight", 3f, "Relative spawn weight for the Super Shape Shifter item in the item pool."); AffectSelf = cfg.Bind("SuperShapeShifter", "AffectSelf", false, "If true, the activating player's own ball is also cubed."); } } public class TeleporterConfig { private const string Section = "Teleporter"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry TargetMoveSpeed { get; private set; } public ConfigEntry SprintMultiplier { get; private set; } public ConfigEntry MarkerRadius { get; private set; } public TeleporterConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("Teleporter", "GiveKey", (Key)68, "Hotkey to give yourself a Teleporter (debug/testing). Key.None = disabled."); Uses = cfg.Bind("Teleporter", "Uses", 1f, "Number of uses per Teleporter pickup."); TargetMoveSpeed = cfg.Bind("Teleporter", "TargetMoveSpeed", 60f, "Speed (units/second) at which the target marker moves during the targeting phase."); SprintMultiplier = cfg.Bind("Teleporter", "SprintMultiplier", 3f, "Speed multiplier applied while holding Shift during the targeting phase."); MarkerRadius = cfg.Bind("Teleporter", "MarkerRadius", 1f, "Radius (units) of the circular target marker disc shown in the targeting UI."); } } public class UfoAbductionConfig { private const string Section = "UfoAbduction"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry LockOnRange { get; private set; } public ConfigEntry LockOnConeAngleDeg { get; private set; } public ConfigEntry ApproachDuration { get; private set; } public ConfigEntry AbductionDuration { get; private set; } public ConfigEntry AscentDuration { get; private set; } public ConfigEntry HoverHeight { get; private set; } public ConfigEntry DropHeight { get; private set; } public ConfigEntry SpringForce { get; private set; } public ConfigEntry MaxPullSpeed { get; private set; } public ConfigEntry NaturalLength { get; private set; } public ConfigEntry ExplosionForce { get; private set; } public ConfigEntry ExplosionRadius { get; private set; } public ConfigEntry AscentDriftAmplitude { get; private set; } public ConfigEntry AscentDriftFrequency { get; private set; } public ConfigEntry DropoffSelectionTimeout { get; private set; } public UfoAbductionConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("UfoAbduction", "GiveKey", (Key)0, "Hotkey to give yourself a UFO Abduction (debug/testing)."); Uses = cfg.Bind("UfoAbduction", "Uses", 1f, "Number of uses per UFO Abduction pickup."); LockOnRange = cfg.Bind("UfoAbduction", "LockOnRange", 100f, "Maximum targeting distance (units)."); LockOnConeAngleDeg = cfg.Bind("UfoAbduction", "LockOnConeAngleDeg", 60f, "Full aim-cone angle (degrees) for lock-on."); ApproachDuration = cfg.Bind("UfoAbduction", "ApproachDuration", 10f, "Seconds for UFO to fly over the target before beginning abduction."); AbductionDuration = cfg.Bind("UfoAbduction", "AbductionDuration", 3f, "Seconds the UFO hovers and beams the victim upward."); AscentDuration = cfg.Bind("UfoAbduction", "AscentDuration", 5f, "Transit duration — seconds for UFO to fly to the drop zone."); HoverHeight = cfg.Bind("UfoAbduction", "HoverHeight", 20f, "Height (units) above victim's position where the UFO hovers during abduction."); DropHeight = cfg.Bind("UfoAbduction", "DropHeight", 20f, "Height (units) above the chosen destination from which the UFO releases the victim."); SpringForce = cfg.Bind("UfoAbduction", "SpringForce", 75f, "Spring stiffness pulling the victim toward the UFO."); MaxPullSpeed = cfg.Bind("UfoAbduction", "MaxPullSpeed", 15f, "Maximum velocity change (m/s) applied to the victim per physics tick."); NaturalLength = cfg.Bind("UfoAbduction", "NaturalLength", 10f, "Distance below the UFO at which no pull force is applied."); ExplosionForce = cfg.Bind("UfoAbduction", "ExplosionForce", 200f, "Peak velocity change (m/s) applied at the explosion centre."); ExplosionRadius = cfg.Bind("UfoAbduction", "ExplosionRadius", 60f, "Radius (units) within which the explosion affects nearby players."); AscentDriftAmplitude = cfg.Bind("UfoAbduction", "AscentDriftAmplitude", 20f, "No longer used. Kept for backward compatibility."); AscentDriftFrequency = cfg.Bind("UfoAbduction", "AscentDriftFrequency", 1f, "No longer used. Kept for backward compatibility."); DropoffSelectionTimeout = cfg.Bind("UfoAbduction", "DropoffSelectionTimeout", 20f, "Seconds the wielder has to select a drop zone before the abduction is cancelled."); } } public class WindStormConfig { private const string Section = "WindStorm"; public ConfigEntry GiveKey { get; private set; } public ConfigEntry Uses { get; private set; } public ConfigEntry Duration { get; private set; } public ConfigEntry StormSpeed { get; private set; } public ConfigEntry ExcludeActivator { get; private set; } public ConfigEntry DirectionChangeInterval { get; private set; } public ConfigEntry DirectionChangeRange { get; private set; } public ConfigEntry AffectPlayers { get; private set; } public ConfigEntry PlayerWindFactor { get; private set; } public WindStormConfig(ConfigFile cfg, GlobalConfig global) { GiveKey = cfg.Bind("WindStorm", "GiveKey", (Key)0, "Debug key to add the Wind Storm item to your inventory."); Uses = cfg.Bind("WindStorm", "Uses", 1f, "Number of uses per Wind Storm pickup."); Duration = cfg.Bind("WindStorm", "Duration", 15f, "Seconds the wind storm lasts before wind returns to normal."); StormSpeed = cfg.Bind("WindStorm", "StormSpeed", 150f, "Wind speed (km/h) applied during the storm. The base game High preset maxes out at 99 km/h."); ExcludeActivator = cfg.Bind("WindStorm", "ExcludeActivator", true, "When true, the player who activates the storm is immune — their ball is unaffected by the storm wind. When false, everyone including the activator is hit by the storm."); DirectionChangeInterval = cfg.Bind("WindStorm", "DirectionChangeInterval", 2f, "Seconds between each wind direction shift during the storm. Smaller values produce more turbulent, rapidly-changing gusts."); DirectionChangeRange = cfg.Bind("WindStorm", "DirectionChangeRange", 45f, "Maximum degrees the wind direction can shift each interval (random walk). E.g. 45 means the angle changes by a random amount in [-45, +45] per tick."); AffectPlayers = cfg.Bind("WindStorm", "AffectPlayers", true, "When true, storm wind is applied as a force to knocked-out player bodies. Set false to limit the effect to golf balls only."); PlayerWindFactor = cfg.Bind("WindStorm", "PlayerWindFactor", 0.15f, "Strength of wind applied to players as a fraction of the storm wind vector. 0.1 is a noticeable nudge; 0.5 noticeably impedes movement."); } } public class ItemConfigSyncer : MonoBehaviour { private const float SyncInterval = 5f; private IEnumerator Start() { while (true) { yield return (object)new WaitForSeconds(5f); if (NetworkServer.active) { Broadcast(); } } } internal static void Broadcast() { if (!NetworkServer.active || !NetworkClient.active) { return; } ConfigFile config = ((BaseUnityPlugin)IssaPluginPlugin.Instance).Config; List list = new List(config.Count); List list2 = new List(config.Count); foreach (KeyValuePair item in config) { if (!(item.Value.SettingType == typeof(Key))) { list.Add(item.Key.Section + "::" + item.Key.Key); list2.Add(item.Value.GetSerializedValue() ?? string.Empty); } } NetworkServer.SendToAll(new ItemConfigSyncMessage { Keys = list.ToArray(), Values = list2.ToArray() }, 0, false); IssaPluginPlugin.Log.LogDebug((object)$"[ItemConfigSyncer] Broadcast {list.Count} config entries to all clients."); } internal static void BroadcastToConnection(NetworkConnectionToClient conn) { if (!NetworkServer.active || !NetworkClient.active) { return; } ConfigFile config = ((BaseUnityPlugin)IssaPluginPlugin.Instance).Config; List list = new List(config.Count); List list2 = new List(config.Count); foreach (KeyValuePair item in config) { if (!(item.Value.SettingType == typeof(Key))) { list.Add(item.Key.Section + "::" + item.Key.Key); list2.Add(item.Value.GetSerializedValue() ?? string.Empty); } } ((NetworkConnection)conn).Send(new ItemConfigSyncMessage { Keys = list.ToArray(), Values = list2.ToArray() }, 0); IssaPluginPlugin.Log.LogDebug((object)$"[ItemConfigSyncer] Sent {list.Count} config entries to joining client conn={conn.connectionId}."); } internal static void HandleConfigSync(ItemConfigSyncMessage msg) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if (NetworkServer.active) { return; } ConfigFile config = ((BaseUnityPlugin)IssaPluginPlugin.Instance).Config; string[] keys = msg.Keys; int num = ((keys != null) ? keys.Length : 0); int num2 = 0; for (int i = 0; i < num; i++) { string[] array = msg.Keys[i].Split(new string[1] { "::" }, 2, StringSplitOptions.None); if (array.Length == 2) { ConfigDefinition val = new ConfigDefinition(array[0], array[1]); if (config.ContainsKey(val)) { config[val].SetSerializedValue(msg.Values[i]); num2++; } } } IssaPluginPlugin.Log.LogDebug((object)$"[ItemConfigSyncer] Applied {num2}/{num} config entries from host."); } } public class SpawnWeightsSyncer : MonoBehaviour { private const float SyncInterval = 5f; private static SpawnWeightsMessage _lastSent = new SpawnWeightsMessage { ItemPoolWeights = null }; private static int _lastEnabledHash; private static readonly MethodInfo ServerUpdateSpawnChanceValueMethod = AccessTools.Method(typeof(MatchSetupRules), "ServerUpdateSpawnChanceValue", (Type[])null, (Type[])null); private static readonly FieldInfo SpawnChanceWeightsField = AccessTools.Field(typeof(MatchSetupRules), "spawnChanceWeights"); private IEnumerator Start() { while (true) { yield return (object)new WaitForSeconds(5f); if (NetworkServer.active) { BroadcastWeightsIfChanged(); } } } internal static void ForceServerSync() { _lastSent = new SpawnWeightsMessage { ItemPoolWeights = null }; if (NetworkServer.active) { BroadcastWeightsIfChanged(); } } internal static void SyncToConnection(NetworkConnectionToClient conn) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected I4, but got Unknown if (!NetworkServer.active || !NetworkClient.active) { return; } foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { allItem.ResetServerWeights(); } Dictionary dictionary = new Dictionary(ItemRegistry.AllItems.Count); foreach (CustomItemDefinition allItem2 in ItemRegistry.AllItems) { float[] array = new float[6]; for (int i = 0; i < 6; i++) { array[i] = allItem2.GetPoolWeight(i); } dictionary[(int)allItem2.ItemType] = array; } SpawnWeightsMessage spawnWeightsMessage = new SpawnWeightsMessage { CustomItemSpawnsEnabled = ModConfig.Global.CustomItemSpawnsEnabled.Value, ItemPoolWeights = dictionary }; MatchSetupRulesPatches.EffectiveWeights.Clear(); ItemSpawnerSettings[] array2 = Resources.FindObjectsOfTypeAll(); foreach (ItemSpawnerSettings val in array2) { val.ResetRuntimeData(); } ReapplyBaseGameWeights(); _lastSent = new SpawnWeightsMessage { ItemPoolWeights = null }; ((NetworkConnection)conn).Send(spawnWeightsMessage, 0); IssaPluginPlugin.Log.LogDebug((object)$"[SpawnWeights] Synced to joining client conn={conn.connectionId}."); } private static void BroadcastWeightsIfChanged() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected I4, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected I4, but got Unknown if (!NetworkClient.active) { return; } foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { allItem.ResetServerWeights(); } Dictionary dictionary = new Dictionary(ItemRegistry.AllItems.Count); foreach (CustomItemDefinition allItem2 in ItemRegistry.AllItems) { float[] array = new float[6]; for (int i = 0; i < 6; i++) { array[i] = allItem2.GetPoolWeight(i); } dictionary[(int)allItem2.ItemType] = array; } SpawnWeightsMessage spawnWeightsMessage = new SpawnWeightsMessage { CustomItemSpawnsEnabled = ModConfig.Global.CustomItemSpawnsEnabled.Value, ItemPoolWeights = dictionary }; int num = 0; foreach (CustomItemDefinition allItem3 in ItemRegistry.AllItems) { if (allItem3.Enabled) { num ^= allItem3.ItemType; } } if (ShouldBroadcast(spawnWeightsMessage, num)) { _lastSent = spawnWeightsMessage; _lastEnabledHash = num; MatchSetupRulesPatches.EffectiveWeights.Clear(); ItemSpawnerSettings[] array2 = Resources.FindObjectsOfTypeAll(); foreach (ItemSpawnerSettings val in array2) { val.ResetRuntimeData(); } ReapplyBaseGameWeights(); NetworkServer.SendToAll(spawnWeightsMessage, 0, false); IssaPluginPlugin.Log.LogDebug((object)$"[SpawnWeights] Synced: {spawnWeightsMessage}"); } } private static void ReapplyBaseGameWeights() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } MatchSetupRules val = Object.FindAnyObjectByType(); if ((Object)(object)val == (Object)null || !(SpawnChanceWeightsField.GetValue(val) is IDictionary dictionary)) { return; } foreach (ItemPoolId key in dictionary.Keys) { if (!ItemRegistry.IsCustomItem(key.itemType)) { ServerUpdateSpawnChanceValueMethod.Invoke(val, new object[1] { key }); } } } private static bool ShouldBroadcast(SpawnWeightsMessage newMsg, int enabledHash) { if (newMsg.ItemPoolWeights == null || _lastSent.ItemPoolWeights == null) { return true; } if (enabledHash != _lastEnabledHash) { return true; } if (newMsg.CustomItemSpawnsEnabled != _lastSent.CustomItemSpawnsEnabled) { return true; } if (newMsg.ItemPoolWeights.Count != _lastSent.ItemPoolWeights.Count) { return true; } foreach (var (key, array2) in newMsg.ItemPoolWeights) { if (!_lastSent.ItemPoolWeights.TryGetValue(key, out var value)) { return true; } for (int i = 0; i < 6; i++) { if (array2[i] != value[i]) { return true; } } } return false; } internal static void HandleSpawnWeights(SpawnWeightsMessage msg) { if (NetworkServer.active) { return; } ModConfig.Global.CustomItemSpawnsEnabled.Value = msg.CustomItemSpawnsEnabled; foreach (var (key, array2) in msg.ItemPoolWeights) { if (ItemRegistry.CustomItemDefinitionMap.TryGetValue(key, out var value)) { for (int i = 0; i < array2.Length && i < 6; i++) { value.SetServerPoolWeight(i, array2[i]); } } } IssaPluginPlugin.Log.LogDebug((object)$"[SpawnWeights] Received from host: {msg}"); } } public class AC130Overlay : MonoBehaviour { private static Texture2D _bgTex; private static Texture2D _vignetteRingTex; private static Texture2D _scanlineTex; private static Texture2D _noiseTex; private GUIStyle _titleStyle; private GUIStyle _instructionStyle; private GUIStyle _cornerStyle; private GUIStyle _timerStyle; private GUIStyle _maydayStyle; private float _noiseTimer; private Color32[] _noisePixels; private static Vector3 _crosshairWorld; private static float _elapsed; private static float _duration; private static bool _maydayActive; private static bool _heavyMode; private static int _heavyShotsLeft; private static int _heavyMaxShots; private static bool _heavyReloading; private static float _heavyReloadProgress; private GUIStyle _modeStyle; private GUIStyle _heavyAmmoStyle; private static Texture2D _glassCrackTex; private static bool _glassCrackGenerated; private const float ScanlineSpacing = 3f; private const float NoiseUpdateRate = 0.1f; private AC130NetworkBridge _localBridge; private AC130NetworkBridge LocalBridge { get { if ((Object)(object)_localBridge != (Object)null) { return _localBridge; } PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { _localBridge = ((Component)localPlayerMovement).GetComponent(); } return _localBridge; } } public static void UpdateAimInfo(Vector3 crosshairWorld, float elapsed, float duration) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _crosshairWorld = crosshairWorld; _elapsed = elapsed; _duration = duration; } public static void SetMaydayActive(bool active) { _maydayActive = active; if (active && !_glassCrackGenerated) { _glassCrackTex = GenerateGlassCrack(Screen.width, Screen.height); } } public static void UpdateHeavyRocketInfo(bool heavyMode, int shotsLeft, int maxShots, bool reloading, float reloadProgress) { _heavyMode = heavyMode; _heavyShotsLeft = shotsLeft; _heavyMaxShots = maxShots; _heavyReloading = reloading; _heavyReloadProgress = reloadProgress; } private void OnGUI() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) AC130NetworkBridge localBridge = LocalBridge; bool flag = (Object)(object)localBridge != (Object)null && localBridge.LocalSessionActive; bool flag2 = (Object)(object)localBridge != (Object)null && localBridge.LocalMaydayActive; if (!flag && !flag2) { return; } float num = Screen.width; float num2 = Screen.height; EnsureTextures(num, num2); EnsureStyles(); GUI.color = new Color(0f, 0f, 0f, 0.18f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_scanlineTex, (ScaleMode)0); GUI.color = Color.white; GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_vignetteRingTex, (ScaleMode)0); _noiseTimer += Time.deltaTime; if (_noiseTimer >= 0.1f) { RegenerateNoise(); _noiseTimer = 0f; } GUI.color = new Color(1f, 1f, 1f, 0.04f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_noiseTex, (ScaleMode)0); GUI.color = Color.white; if (Random.value < 0.08f) { int num3 = Random.Range(1, 4); for (int i = 0; i < num3; i++) { float num4 = Random.Range(0f, num2); float num5 = Random.Range(1f, 5f); float num6 = Random.Range(num * 0.2f, num * 0.85f); float num7 = Random.Range(0f, num - num6); float num8 = Random.Range(0.04f, 0.18f); GUI.color = new Color(0.9f, 1f, 0.9f, num8); GUI.DrawTexture(new Rect(num7, num4, num6, num5), (Texture)(object)Texture2D.whiteTexture); } GUI.color = Color.white; } if (Random.value < 0.03f) { float num9 = Random.Range(0f, num2); GUI.color = new Color(0.8f, 1f, 0.8f, 0.12f); GUI.DrawTexture(new Rect(0f, num9, num, Random.Range(2f, 8f)), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } float num10 = 60f; float thick = 3f; DrawCornerBracket(0f, 0f, num10, thick, leftSide: true, topSide: true); DrawCornerBracket(num - num10, 0f, num10, thick, leftSide: false, topSide: true); DrawCornerBracket(0f, num2 - num10, num10, thick, leftSide: true, topSide: false); DrawCornerBracket(num - num10, num2 - num10, num10, thick, leftSide: false, topSide: false); if (flag2) { DrawMaydayOverlay(num, num2); } else { DrawGunshipOverlay(num, num2); } } private void DrawGunshipOverlay(float w, float h) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0264: 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_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: 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_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: 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_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) Mouse current = Mouse.current; Vector2 val = (Vector2)((current != null) ? ((InputControl)(object)((Pointer)current).position).ReadValue() : new Vector2(w / 2f, h / 2f)); float x = val.x; float num = h - val.y; float num2 = 28f; float num3 = 10f; float num4 = 22f; GUI.color = new Color(0f, 1f, 0.2f, 0.85f); GUI.DrawTexture(new Rect(x - num2 - num3, num - 1f, num2, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x + num3, num - 1f, num2, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 1f, num - num2 - num3, 2f, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 1f, num + num3, 2f, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num4, num - 1f, num4 * 0.6f, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x + num4 * 0.4f, num - 1f, num4 * 0.6f, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 1f, num - num4, 2f, num4 * 0.6f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 1f, num + num4 * 0.4f, 2f, num4 * 0.6f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; float num5 = Mathf.Max(0f, _duration - _elapsed); GUI.Label(new Rect(16f, 12f, 320f, 28f), $"{DateTime.UtcNow:HH:mm:ss}Z", _cornerStyle); GUI.Label(new Rect(16f, 40f, 320f, 28f), "SYS: ARMED", _cornerStyle); GUI.Label(new Rect(16f, 68f, 320f, 28f), "MODE: GUNSHIP", _cornerStyle); GUI.Label(new Rect(16f, 96f, 420f, 28f), $"TGT: ({_crosshairWorld.x:F0}, {_crosshairWorld.z:F0})", _cornerStyle); bool flag = num5 <= 10f; _timerStyle.normal.textColor = (flag ? new Color(1f, 0.2f, 0.2f) : new Color(0f, 1f, 0.2f, 0.9f)); GUI.Label(new Rect(w - 240f, 12f, 220f, 34f), $"TIME: {num5:F1}s", _timerStyle); string text = (_heavyMode ? "MODE: BIG SHOT" : "MODE: REGULAR"); _modeStyle.normal.textColor = (_heavyMode ? new Color(1f, 0.45f, 0f, 1f) : new Color(0f, 1f, 0.2f, 0.9f)); GUI.Label(new Rect(w - 240f, 48f, 220f, 30f), text, _modeStyle); if (_heavyMode) { if (_heavyReloading) { GUI.Label(new Rect(w - 240f, 80f, 220f, 26f), "RELOADING", _heavyAmmoStyle); float num6 = 200f; float num7 = 8f; float num8 = w - 230f; float num9 = 108f; GUI.color = new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(new Rect(num8, num9, num6, num7), (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(1f, 0.45f, 0f, 0.85f); GUI.DrawTexture(new Rect(num8, num9, num6 * _heavyReloadProgress, num7), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } else { float num10 = 14f; float num11 = 5f; float num12 = (float)_heavyMaxShots * (num10 + num11) - num11; float num13 = w - 230f + (200f - num12) / 2f; float num14 = 84f; for (int i = 0; i < _heavyMaxShots; i++) { float num15 = num13 + (float)i * (num10 + num11); GUI.color = ((i < _heavyShotsLeft) ? new Color(1f, 0.45f, 0f, 0.9f) : new Color(0.3f, 0.3f, 0.3f, 0.5f)); GUI.DrawTexture(new Rect(num15, num14, num10, num10), (Texture)(object)Texture2D.whiteTexture); } GUI.color = Color.white; } } if ((Object)(object)_bgTex != (Object)null) { GUI.DrawTexture(new Rect(0f, h - 92f, w, 92f), (Texture)(object)_bgTex); } GUI.Label(new Rect(0f, h - 90f, w, 42f), "AC-130 GUNSHIP", _titleStyle); GUI.Label(new Rect(0f, h - 48f, w, 38f), "1: Regular 2: Big Shot | Aim: Mouse | Click: Shoot | Q/E: Raise/Lower | Shift: Speed Up | Space: Exit", _instructionStyle); } private void DrawMaydayOverlay(float w, float h) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01a0: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(0.15f + _noiseTimer * 0.02f); GUI.color = new Color(0.8f, 0f, 0f, num); GUI.DrawTexture(new Rect(0f, 0f, w, h), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; if ((Object)(object)_glassCrackTex != (Object)null) { GUI.color = new Color(1f, 1f, 1f, 0.55f); GUI.DrawTexture(new Rect(0f, 0f, w, h), (Texture)(object)_glassCrackTex, (ScaleMode)0); GUI.color = Color.white; } GUI.Label(new Rect(16f, 12f, 420f, 28f), $"{DateTime.UtcNow:HH:mm:ss}Z", _cornerStyle); GUI.Label(new Rect(16f, 40f, 420f, 28f), "SYS: CRITICAL FAILURE", _cornerStyle); GUI.Label(new Rect(16f, 68f, 420f, 28f), "MODE: MAYDAY", _cornerStyle); if ((int)(Time.unscaledTime * 4f) % 2 == 0) { GUI.Label(new Rect(0f, h * 0.3f, w, 70f), "⚠ MAYDAY MAYDAY MAYDAY ⚠", _maydayStyle); } if ((Object)(object)_bgTex != (Object)null) { GUI.DrawTexture(new Rect(0f, h - 92f, w, 92f), (Texture)(object)_bgTex); } GUI.Label(new Rect(0f, h - 90f, w, 42f), "GOING DOWN", _titleStyle); GUI.Label(new Rect(0f, h - 48f, w, 38f), "W/S: Pull Up/Down | A/D: Roll", _instructionStyle); } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide) { //IL_0015: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0f, 1f, 0.2f, 0.9f); float num = (leftSide ? x : (x + size - thick)); GUI.DrawTexture(new Rect(num, y, thick, size), (Texture)(object)Texture2D.whiteTexture); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(x, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void EnsureTextures(float w, float h) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bgTex == (Object)null) { _bgTex = new Texture2D(1, 1); _bgTex.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.6f)); _bgTex.Apply(); } int w2 = Mathf.Max(1, (int)w / 4); int h2 = Mathf.Max(1, (int)h / 4); if ((Object)(object)_vignetteRingTex == (Object)null) { _vignetteRingTex = GenerateVignette(w2, h2); } if ((Object)(object)_scanlineTex == (Object)null) { _scanlineTex = GenerateScanlines(w2, h2); } int w3 = Mathf.Max(1, (int)w / 8); int h3 = Mathf.Max(1, (int)h / 8); if ((Object)(object)_noiseTex == (Object)null) { _noiseTex = GenerateNoise(w3, h3); } } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_02ab: Unknown result type (might be due to invalid IL or missing references) if (_titleStyle == null) { _titleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _titleStyle.normal.textColor = new Color(1f, 0.5f, 0f); } if (_instructionStyle == null) { _instructionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 22, fontStyle = (FontStyle)1 }; _instructionStyle.normal.textColor = Color.white; } if (_cornerStyle == null) { _cornerStyle = new GUIStyle(GUI.skin.label) { fontSize = 24, fontStyle = (FontStyle)1 }; _cornerStyle.normal.textColor = new Color(0f, 1f, 0.2f, 0.9f); } if (_timerStyle == null) { _timerStyle = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1, alignment = (TextAnchor)5 }; _timerStyle.normal.textColor = new Color(0f, 1f, 0.2f, 0.9f); } if (_maydayStyle == null) { _maydayStyle = new GUIStyle(GUI.skin.label) { fontSize = 42, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; _maydayStyle.normal.textColor = new Color(1f, 0.1f, 0.1f, 1f); } if (_modeStyle == null) { _modeStyle = new GUIStyle(GUI.skin.label) { fontSize = 22, fontStyle = (FontStyle)1, alignment = (TextAnchor)5 }; _modeStyle.normal.textColor = new Color(0f, 1f, 0.2f, 0.9f); } if (_heavyAmmoStyle == null) { _heavyAmmoStyle = new GUIStyle(GUI.skin.label) { fontSize = 20, fontStyle = (FontStyle)1, alignment = (TextAnchor)5 }; _heavyAmmoStyle.normal.textColor = new Color(1f, 0.45f, 0f, 1f); } } private static Texture2D GenerateVignette(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); float num = (float)w / 2f; float num2 = (float)h / 2f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num2) * ((float)i - num2)); float num5 = Mathf.Clamp01(num4 / num3); float num6 = Mathf.Pow(num5, 1.8f) * 0.85f; array[i * w + j] = new Color(0f, 0f, 0f, num6); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D GenerateScanlines(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { float num = ((i % 3 == 0) ? 1f : 0f); for (int j = 0; j < w; j++) { array[i * w + j] = new Color(0f, 0f, 0f, num); } } val.SetPixels(array); val.Apply(); return val; } private Texture2D GenerateNoise(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Texture2D result = new Texture2D(w, h, (TextureFormat)4, false); _noisePixels = (Color32[])(object)new Color32[w * h]; RegenerateNoise(); return result; } private void RegenerateNoise() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _noisePixels.Length; i++) { byte b = (byte)Random.Range(0, 256); _noisePixels[i] = new Color32(b, b, b, byte.MaxValue); } if ((Object)(object)_noiseTex != (Object)null) { _noiseTex.SetPixels32(_noisePixels); _noiseTex.Apply(false, false); } } private static Texture2D GenerateGlassCrack(int w, int h) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) _glassCrackGenerated = true; Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[w * h]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32((byte)200, (byte)200, byte.MaxValue, (byte)0); } int x = Random.Range(w / 3, 2 * w / 3); int y = Random.Range(h / 3, 2 * h / 3); int num = Random.Range(3, 6); int num2 = Mathf.CeilToInt(Mathf.Sqrt((float)(w * w + h * h))); int num3 = num2 / 2; int num4 = num2; for (int j = 0; j < num; j++) { float angle = 360f / (float)num * (float)j + Random.Range(-25f, 25f); DrawCrackLine(array, w, h, x, y, angle, Random.Range(num3, num4), 2); } val.SetPixels32(array); val.Apply(); return val; } private static void DrawCrackLine(Color32[] pixels, int w, int h, int x, int y, float angle, int length, int depth) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (depth <= 0 || length <= 0) { return; } float num = x; float num2 = y; float num3 = Mathf.Cos(angle * (MathF.PI / 180f)); float num4 = Mathf.Sin(angle * (MathF.PI / 180f)); for (int i = 0; i < length; i++) { int num5 = Mathf.RoundToInt(num); int num6 = Mathf.RoundToInt(num2); if (num5 < 0 || num5 >= w || num6 < 0 || num6 >= h) { break; } pixels[num6 * w + num5] = new Color32((byte)200, (byte)210, byte.MaxValue, (byte)220); num += num3; num2 += num4; if (Random.value < 3f / (float)length) { float angle2 = angle + Random.Range(-50f, 50f); DrawCrackLine(pixels, w, h, num5, num6, angle2, (int)((float)length * Random.Range(0.3f, 0.5f)), depth - 1); } angle += Random.Range(-1f, 1f); num3 = Mathf.Cos(angle * (MathF.PI / 180f)); num4 = Mathf.Sin(angle * (MathF.PI / 180f)); } } } public class LightFader : MonoBehaviour { public enum OnLifeEnd { DoNothing, Disable, Destroy } [Header("Seconds to dim the light")] public float life = 0.5f; public OnLifeEnd onLifeEnd = OnLifeEnd.Destroy; private Light li; private float initIntensity; private void Start() { li = ((Component)this).GetComponent(); if ((Object)(object)li != (Object)null) { initIntensity = li.intensity; } } private void Update() { if (!((Object)(object)li != (Object)null)) { return; } Light obj = li; obj.intensity -= initIntensity * (Time.deltaTime / life); if (li.intensity <= 0f) { switch (onLifeEnd) { case OnLifeEnd.DoNothing: break; case OnLifeEnd.Disable: ((Behaviour)li).enabled = false; break; case OnLifeEnd.Destroy: Object.Destroy((Object)(object)li); break; } } } } [BepInPlugin("com.scusemua.IssaPlugin", "IssaPlugin", "0.0.37")] public class IssaPluginPlugin : BaseUnityPlugin { private Harmony _harmony; private bool _itemNamesRegistered; public static IssaPluginPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)this); return; } Instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"IssaPlugin 0.0.37 is now loading..."); ModConfig.Initialize(((BaseUnityPlugin)this).Config); AssetLoader.Load(); _harmony = new Harmony("com.scusemua.IssaPlugin"); _harmony.PatchAll(typeof(IssaPluginPlugin).Assembly); Log.LogInfo((object)"Harmony patches applied."); CourseManager.MatchStateChanged += OnMatchStateChanged; ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); Log.LogInfo((object)"IssaPlugin by Scusemua has loaded."); } private void OnDestroy() { CourseManager.MatchStateChanged -= OnMatchStateChanged; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } AssetLoader.Unload(); Log.LogInfo((object)"IssaPlugin unloaded."); } private void Update() { //IL_0046: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) if (!_itemNamesRegistered) { _itemNamesRegistered = ItemRegistry.RegisterCustomItemNames(); } Keyboard current = Keyboard.current; if (current == null) { return; } foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { if ((int)allItem.GiveKey != 0 && ((ButtonControl)current[allItem.GiveKey]).wasPressedThisFrame) { ItemHelper.GiveItemToLocalPlayer(allItem.ItemType, allItem.MaxUses, allItem.DisplayName); } } PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory != (Object)null) { ItemType effectivelyEquippedItem = localPlayerInventory.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem == ItemRegistry.JavelinItemType) { NetworkIdentity localPlayer = NetworkClient.localPlayer; ((localPlayer != null) ? ((Component)localPlayer).GetComponent() : null)?.ClientUpdateLockOn(); } } if (((ButtonControl)current[(Key)103]).wasPressedThisFrame) { DebugDummies.ToggleDebugDummies(); } } private void OnMatchStateChanged(MatchState previousState, MatchState currentState) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0024: Invalid comparison between Unknown and I4 Log.LogDebug((object)$"[MatchState] {previousState} → {currentState}"); if ((int)currentState != 1) { return; } if (NetworkServer.active) { NetworkBridgeBase[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (NetworkBridgeBase networkBridgeBase in array) { networkBridgeBase.ServerHoleCleanup(); } } NetworkIdentity localPlayer = NetworkClient.localPlayer; if ((Object)(object)localPlayer != (Object)null) { NetworkBridgeBase[] components = ((Component)localPlayer).GetComponents(); foreach (NetworkBridgeBase networkBridgeBase2 in components) { networkBridgeBase2.ClientHoleCleanup(); } } StealthBomberItem.CancelTargeting(); TeleporterItem.CancelTargeting(); GunshipLockOnDetectionPatch.ResetTargetingState(); Log.LogInfo((object)"[MatchState] Hole transition cleanup complete."); } } internal static class PluginInfo { public const string PLUGIN_GUID = "com.scusemua.IssaPlugin"; public const string PLUGIN_NAME = "IssaPlugin"; public const string PLUGIN_VERSION = "0.0.37"; } public static class MyPluginInfo { public const string PLUGIN_GUID = "IssaPlugin"; public const string PLUGIN_NAME = "My first plugin"; public const string PLUGIN_VERSION = "0.0.37"; } } namespace IssaPlugin.Overlays { public class BearHealthBarOverlay : MonoBehaviour { private readonly Dictionary _bearHPs = new Dictionary(); private readonly List _toRemove = new List(); private Texture2D _solidTex; private GUIStyle _labelStyle; private Camera _camera; private const float BarWidth = 80f; private const float BarHeight = 8f; private const float LabelH = 14f; private static readonly Color BackColour = new Color(0.1f, 0.1f, 0.1f, 0.75f); private static readonly Color HealthHigh = new Color(0.15f, 0.85f, 0.15f, 0.9f); private static readonly Color HealthMid = new Color(0.9f, 0.75f, 0.1f, 0.9f); private static readonly Color HealthLow = new Color(0.9f, 0.15f, 0.1f, 0.9f); public static BearHealthBarOverlay Instance { get; private set; } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) Instance = this; _solidTex = new Texture2D(1, 1, (TextureFormat)4, false); _solidTex.SetPixel(0, 0, Color.white); _solidTex.Apply(); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if ((Object)(object)_solidTex != (Object)null) { Object.Destroy((Object)(object)_solidTex); } } public static void HandleBearHPUpdate(BearHPUpdateMessage msg) { if (!((Object)(object)Instance == (Object)null)) { Instance._bearHPs[msg.BearNetId] = (msg.CurrentHP, msg.MaxHP); } } private void OnGUI() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0144: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_028a: Unknown result type (might be due to invalid IL or missing references) if (_bearHPs.Count == 0) { return; } if ((Object)(object)_camera == (Object)null) { _camera = Camera.main; } Camera camera = _camera; if ((Object)(object)camera == (Object)null) { return; } EnsureStyles(); _toRemove.Clear(); foreach (KeyValuePair bearHP in _bearHPs) { uint key = bearHP.Key; var (num, num2) = bearHP.Value; if (!NetworkClient.spawned.TryGetValue(key, out var value) || (Object)(object)value == (Object)null) { _toRemove.Add(key); continue; } Vector3 val = ((Component)value).transform.position + Vector3.up * 2.6f; Vector3 val2 = camera.WorldToScreenPoint(val); if (!(val2.z < 0f) && !(val2.x < -80f) && !(val2.x > (float)Screen.width + 80f) && !(val2.y < -8f) && !(val2.y > (float)Screen.height + 8f)) { float num3 = val2.x - 40f; float num4 = (float)Screen.height - val2.y - 4f; float num5 = ((num2 > 0f) ? Mathf.Clamp01(num / num2) : 0f); GUI.color = BackColour; GUI.DrawTexture(new Rect(num3 - 1f, num4 - 1f, 82f, 10f), (Texture)(object)_solidTex); GUI.color = ((num5 > 0.5f) ? Color.Lerp(HealthMid, HealthHigh, (num5 - 0.5f) * 2f) : Color.Lerp(HealthLow, HealthMid, num5 * 2f)); GUI.DrawTexture(new Rect(num3, num4, 80f * num5, 8f), (Texture)(object)_solidTex); GUI.color = Color.white; int num6 = Mathf.CeilToInt(num); int num7 = Mathf.RoundToInt(num2); GUI.Label(new Rect(num3, num4 + 8f + 1f, 80f, 14f), $"{num6}/{num7}", _labelStyle); } } foreach (uint item in _toRemove) { _bearHPs.Remove(item); } } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 9, fontStyle = (FontStyle)1 }; _labelStyle.normal.textColor = new Color(1f, 1f, 1f, 0.9f); } } } public class BearOverlay : MonoBehaviour { private bool _active; private int _totalBears; private int _aliveBears; private float _startTime; private float _sessionDuration; private Texture2D _solidTex; private GUIStyle _warningStyle; private GUIStyle _countStyle; private GUIStyle _timerStyle; private GUIStyle _labelStyle; private float _time; private float _deltaTime; private float _sw; private float _sh; private float _killFlashAlpha; private const float KillFlashDecay = 3.5f; private static readonly Color BearBrown = new Color(0.55f, 0.27f, 0.07f, 1f); private static readonly Color BearBrownDim = new Color(0.55f, 0.27f, 0.07f, 0.45f); private static readonly Color WarningRed = new Color(0.9f, 0.15f, 0.05f, 1f); private static readonly Color DeadGrey = new Color(0.25f, 0.25f, 0.25f, 0.55f); public static BearOverlay Instance { get; private set; } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) Instance = this; _solidTex = new Texture2D(1, 1, (TextureFormat)4, false); _solidTex.SetPixel(0, 0, Color.white); _solidTex.Apply(); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if ((Object)(object)_solidTex != (Object)null) { Object.Destroy((Object)(object)_solidTex); } } private void Update() { _sw = Screen.width; _sh = Screen.height; _time = Time.time; _deltaTime = Time.deltaTime; if (_killFlashAlpha > 0f) { _killFlashAlpha -= _deltaTime * 3.5f; } } public void SetActive(bool active, int bearCount, float sessionDuration) { _active = active; _totalBears = bearCount; _aliveBears = bearCount; _startTime = Time.time; _sessionDuration = sessionDuration; } public void DecrementBearCount() { _aliveBears = Mathf.Max(0, _aliveBears - 1); _killFlashAlpha = 1f; } public void Deactivate() { _active = false; } private void OnGUI() { //IL_00c5: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) if (_active) { EnsureStyles(); float num = ((_sw > 0f) ? _sw : ((float)Screen.width)); float num2 = ((_sh > 0f) ? _sh : ((float)Screen.height)); float num3 = _time - _startTime; float num4 = Mathf.Max(0f, _sessionDuration - num3); bool flag = num4 <= 10f; if (_killFlashAlpha > 0f) { GUI.color = new Color(BearBrown.r, BearBrown.g, BearBrown.b, Mathf.Clamp01(_killFlashAlpha) * 0.3f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_solidTex); GUI.color = Color.white; } float pulse = 0.6f + 0.4f * Mathf.Sin(_time * 3f); DrawCornerWarnings(num, num2, pulse); DrawBearPips(num, num2); _timerStyle.normal.textColor = (flag ? new Color(WarningRed.r, WarningRed.g, WarningRed.b, 0.7f + 0.3f * Mathf.Sin(_time * 8f)) : new Color(BearBrown.r, BearBrown.g, BearBrown.b, 0.85f)); int num5 = Mathf.CeilToInt(num4); GUI.Label(new Rect(num - 200f, 12f, 185f, 32f), $"⏱ {num5 / 60:D2}:{num5 % 60:D2}", _timerStyle); DrawBottomBar(num, num2); } } private void DrawBearPips(float sw, float sh) { //IL_0135: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) if (_totalBears <= 0) { return; } float num = (float)_totalBears * 36f + (float)(_totalBears - 1) * 8f; float num2 = sw * 0.5f - num * 0.5f; float num3 = 14f; for (int i = 0; i < _totalBears; i++) { if (i < _aliveBears) { float num4 = (0.055f + (float)i * 0.015f) % 1f; float num5 = 0.75f + 0.25f * Mathf.Sin(_time * 2.5f + (float)i * 1.1f); _countStyle.normal.textColor = Color.HSVToRGB(num4, 0.7f, num5); } else { _countStyle.normal.textColor = DeadGrey; } GUI.Label(new Rect(num2 + (float)i * 44f, num3, 36f, 36f), "\ud83d\udc3b", _countStyle); } _labelStyle.normal.textColor = BearBrownDim; string text = ((_aliveBears == 0) ? "ALL BEARS DEFEATED" : string.Format("{0} BEAR{1} ACTIVE", _aliveBears, (_aliveBears == 1) ? "" : "S")); GUI.Label(new Rect(0f, num3 + 36f + 2f, sw, 20f), text, _labelStyle); } private void DrawCornerWarnings(float sw, float sh, float pulse) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) Color c = default(Color); ((Color)(ref c))..ctor(BearBrown.r, BearBrown.g, BearBrown.b, pulse * 0.9f); DrawCornerBracket(0f, 0f, 48f, 3f, leftSide: true, topSide: true, c); DrawCornerBracket(sw - 48f, 0f, 48f, 3f, leftSide: false, topSide: true, c); DrawCornerBracket(0f, sh - 48f, 48f, 3f, leftSide: true, topSide: false, c); DrawCornerBracket(sw - 48f, sh - 48f, 48f, 3f, leftSide: false, topSide: false, c); GUI.color = new Color(BearBrown.r, BearBrown.g, BearBrown.b, pulse * 0.35f); DrawRect(4f, 12f, 28f, 2f); DrawRect(4f, 19f, 20f, 2f); DrawRect(4f, 26f, 14f, 2f); DrawRect(sw - 32f, sh - 14f, 28f, 2f); DrawRect(sw - 24f, sh - 21f, 20f, 2f); DrawRect(sw - 18f, sh - 28f, 14f, 2f); GUI.color = Color.white; } private void DrawBottomBar(float sw, float sh) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(BearBrown.r, BearBrown.g, BearBrown.b, 0.55f); DrawRect(0f, sh - 36f, sw, 36f); GUI.color = Color.white; _warningStyle.normal.textColor = new Color(1f, 0.9f, 0.75f, 0.9f); GUI.Label(new Rect(0f, sh - 34f, sw, 18f), "BEAR ATTACK", _warningStyle); GUI.Label(new Rect(0f, sh - 18f, sw, 16f), "Weapons kill bears | Bears hunt all players", _labelStyle); } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide, Color c) { //IL_0001: 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) GUI.color = c; float x2 = (leftSide ? x : (x + size - thick)); DrawRect(x2, y, thick, size); float y2 = (topSide ? y : (y + size - thick)); DrawRect(x, y2, size, thick); GUI.color = Color.white; } private void DrawRect(float x, float y, float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(x, y, w, h), (Texture)(object)_solidTex); } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_009b: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) if (_warningStyle == null) { _warningStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; _warningStyle.normal.textColor = Color.white; } if (_countStyle == null) { _countStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 26, fontStyle = (FontStyle)1 }; _countStyle.normal.textColor = BearBrown; } if (_timerStyle == null) { _timerStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)5, fontSize = 20, fontStyle = (FontStyle)1 }; _timerStyle.normal.textColor = BearBrown; } if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 12, fontStyle = (FontStyle)1 }; _labelStyle.normal.textColor = BearBrownDim; } } } public class BomberOverlay : MonoBehaviour { private static Texture2D _bgTex; private static Texture2D _vignetteRingTex; private static Texture2D _scanlineTex; private static Texture2D _noiseTex; private GUIStyle _titleStyle; private GUIStyle _instructionStyle; private GUIStyle _cornerStyle; private Material _greyscaleMat; private float _noiseTimer; private const float ScanlineSpacing = 3f; private const float NoiseUpdateRate = 0.04f; private const float VisualArtifactChance = 0.08f; private const float FullWidthScanlineSurgeChance = 0.035f; private MissileNetworkBridge _localMissileBridge; private static Color32[] _noisePixels; private MissileNetworkBridge LocalMissileBridge { get { if ((Object)(object)_localMissileBridge != (Object)null) { return _localMissileBridge; } PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { _localMissileBridge = ((Component)localPlayerMovement).GetComponent(); } return _localMissileBridge; } } private bool LocalIsSteering => (Object)(object)LocalMissileBridge != (Object)null && LocalMissileBridge.IsSteering; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown _greyscaleMat = new Material(Shader.Find("Hidden/Internal-GUITextureClip")); } private bool ShouldShowOverlay() { return StealthBomberItem.IsTargeting || LocalIsSteering; } private void OnRenderImage(RenderTexture src, RenderTexture dest) { Graphics.Blit((Texture)(object)src, dest); } private void OnGUI() { //IL_0051: 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_0079: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0395: 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_03de: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) if (!StealthBomberItem.IsTargeting && !LocalIsSteering) { return; } float num = Screen.width; float num2 = Screen.height; EnsureTextures(num, num2); EnsureStyles(); GUI.color = new Color(0f, 0f, 0f, 0.18f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_scanlineTex, (ScaleMode)0); GUI.color = Color.white; GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_vignetteRingTex, (ScaleMode)0); _noiseTimer += Time.deltaTime; if (_noiseTimer >= 0.04f) { RegenerateNoise(); _noiseTimer = 0f; } GUI.color = new Color(1f, 1f, 1f, 0.04f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_noiseTex, (ScaleMode)0); GUI.color = Color.white; if (Random.value < 0.08f) { int num3 = Random.Range(1, 4); for (int i = 0; i < num3; i++) { float num4 = Random.Range(0f, num2); float num5 = Random.Range(1f, 5f); float num6 = Random.Range(num * 0.2f, num * 0.85f); float num7 = Random.Range(0f, num - num6); float num8 = Random.Range(0.04f, 0.18f); GUI.color = new Color(0.9f, 1f, 0.9f, num8); GUI.DrawTexture(new Rect(num7, num4, num6, num5), (Texture)(object)Texture2D.whiteTexture); } GUI.color = Color.white; } if (Random.value < 0.035f) { float num9 = Random.Range(0f, num2); GUI.color = new Color(0.8f, 1f, 0.8f, 0.12f); GUI.DrawTexture(new Rect(0f, num9, num, Random.Range(2f, 8f)), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } float num10 = 60f; float thick = 3f; DrawCornerBracket(0f, 0f, num10, thick, leftSide: true, topSide: true); DrawCornerBracket(num - num10, 0f, num10, thick, leftSide: false, topSide: true); DrawCornerBracket(0f, num2 - num10, num10, thick, leftSide: true, topSide: false); DrawCornerBracket(num - num10, num2 - num10, num10, thick, leftSide: false, topSide: false); float num11 = 20f; float num12 = 6f; float num13 = num / 2f; float num14 = num2 / 2f; GUI.color = new Color(0f, 1f, 0.2f, 0.85f); GUI.DrawTexture(new Rect(num13 - num11 - num12, num14 - 1f, num11, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num13 + num12, num14 - 1f, num11, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num13 - 1f, num14 - num11 - num12, 2f, num11), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num13 - 1f, num14 + num12, 2f, num11), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(16f, 12f, 300f, 24f), FormatTimestamp(), _cornerStyle); GUI.Label(new Rect(16f, 34f, 300f, 24f), "SYS: ARMED", _cornerStyle); GUI.Label(new Rect(16f, 56f, 300f, 24f), "MODE: TARGETING", _cornerStyle); if (StealthBomberItem.IsTargeting) { GUI.DrawTexture(new Rect(0f, num2 - 80f, num, 80f), (Texture)(object)_bgTex); GUI.Label(new Rect(0f, num2 - 75f, num, 35f), "STEALTH BOMBER TARGETING", _titleStyle); GUI.Label(new Rect(0f, num2 - 42f, num, 30f), "WASD: Move | Q/E: Rotate | Click / Enter: Confirm | Space: Cancel", _instructionStyle); } else if (LocalIsSteering) { GUI.DrawTexture(new Rect(0f, num2 - 80f, num, 80f), (Texture)(object)_bgTex); GUI.Label(new Rect(0f, num2 - 75f, num, 35f), "PREDATOR MISSILE TARGETING", _titleStyle); GUI.Label(new Rect(0f, num2 - 42f, num, 30f), "WASD: Move", _instructionStyle); } } private static string FormatTimestamp() { DateTime utcNow = DateTime.UtcNow; return $"{utcNow:HH:mm:ss}Z"; } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide) { //IL_001c: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0f, 1f, 0.2f, 0.9f); GUI.color = color; float num = (leftSide ? x : (x + size - thick)); GUI.DrawTexture(new Rect(num, y, thick, size), (Texture)(object)Texture2D.whiteTexture); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(x, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void EnsureTextures(float w, float h) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bgTex == (Object)null) { _bgTex = new Texture2D(1, 1); _bgTex.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.6f)); _bgTex.Apply(); } if ((Object)(object)_vignetteRingTex == (Object)null) { _vignetteRingTex = GenerateVignette((int)w, (int)h); } if ((Object)(object)_scanlineTex == (Object)null) { _scanlineTex = GenerateScanlines((int)w, (int)h); } if ((Object)(object)_noiseTex == (Object)null) { _noiseTex = GenerateNoise((int)(w / 4f), (int)(h / 4f)); } } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) if (_titleStyle == null) { _titleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 26, fontStyle = (FontStyle)1 }; _titleStyle.normal.textColor = new Color(1f, 0.5f, 0f); } if (_instructionStyle == null) { _instructionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1 }; _instructionStyle.normal.textColor = Color.white; } if (_cornerStyle == null) { _cornerStyle = new GUIStyle(GUI.skin.label) { fontSize = 20, fontStyle = (FontStyle)1 }; _cornerStyle.normal.textColor = new Color(0f, 1f, 0.2f, 0.9f); } } private static Texture2D GenerateVignette(int w, int h) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_00a8: 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) int num = w / 4; int num2 = h / 4; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; float num3 = (float)num / 2f; float num4 = (float)num2 / 2f; float num5 = num3 * num3 + num4 * num4; Color32[] array = (Color32[])(object)new Color32[num * num2]; for (int i = 0; i < num2; i++) { float num6 = (float)i - num4; for (int j = 0; j < num; j++) { float num7 = (float)j - num3; float num8 = Mathf.Clamp01((num7 * num7 + num6 * num6) / num5); float num9 = Mathf.Sqrt(num8); float num10 = Mathf.Pow(num9, 1.8f) * 0.85f; array[i * num + j] = new Color32((byte)0, (byte)0, (byte)0, (byte)(num10 * 255f)); } } val.SetPixels32(array); val.Apply(false); return val; } private static Texture2D GenerateScanlines(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[w * h]; Color32 val2 = default(Color32); for (int i = 0; i < h; i++) { byte b = (byte)((i % 3 == 0) ? byte.MaxValue : 0); ((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, b); for (int j = 0; j < w; j++) { array[i * w + j] = val2; } } val.SetPixels32(array); val.Apply(false); return val; } private static Texture2D GenerateNoise(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); RegenerateNoise(val, w, h); return val; } private void RegenerateNoise() { RegenerateNoise(_noiseTex, ((Texture)_noiseTex).width, ((Texture)_noiseTex).height); } private static void RegenerateNoise(Texture2D tex, int w, int h) { //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) int num = w * h; if (_noisePixels == null || _noisePixels.Length != num) { _noisePixels = (Color32[])(object)new Color32[num]; } for (int i = 0; i < num; i++) { byte b = (byte)(Random.value * 255f); _noisePixels[i] = new Color32(b, b, b, byte.MaxValue); } tex.SetPixels32(_noisePixels); tex.Apply(false); } } public static class DonutOverlay { private static GameObject _go; private static DonutOverlayRenderer _renderer; public static void SetActive(bool active, int totalLaserUses) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (active) { if ((Object)(object)_go == (Object)null) { _go = new GameObject("DonutOverlay"); Object.DontDestroyOnLoad((Object)(object)_go); _renderer = _go.AddComponent(); } _renderer.TotalLaserUses = totalLaserUses; _renderer.RemainingLaserUses = totalLaserUses; _renderer.TimeRemaining = ModConfig.Donut.Duration.Value; _go.SetActive(true); } else if ((Object)(object)_go != (Object)null) { _go.SetActive(false); } } public static void UpdateLaserUses(int remaining) { if ((Object)(object)_renderer != (Object)null) { _renderer.RemainingLaserUses = remaining; } } public static void UpdateTimeRemaining(float seconds) { if ((Object)(object)_renderer != (Object)null) { _renderer.TimeRemaining = seconds; } } public static void TriggerLaserFlash() { if ((Object)(object)_renderer != (Object)null) { _renderer.TriggerFlash(); } } } internal class DonutOverlayRenderer : MonoBehaviour { public int TotalLaserUses; public int RemainingLaserUses; public float TimeRemaining; private GUIStyle _labelStyle; private GUIStyle _titleStyle; private GUIStyle _instructionStyle; private GUIStyle _dotStyle; private GUIStyle _cornerStyle; private GUIStyle _chargeStyle; private Texture2D _bgTex; private Texture2D _vignetteTex; private Texture2D _noiseTex; private Texture2D _scanlineTex; private float _flashAlpha; private const float FlashDecayRate = 4f; private float _noiseTimer; private Color32[] _noisePixels; private const float NoiseUpdateRate = 0.05f; private int _prevRemainingUses = -1; private float _rechargeFlashTimer; private readonly float RechargeFlashDuration = ModConfig.Donut.LaserCooldown.Value; private float _sw; private float _sh; private float _time; private float _deltaTime; private string _timestampStr = ""; private int _lastTimestampSecond = -1; private static readonly Color PinkMain = new Color(1f, 0.18f, 0.72f, 1f); private static readonly Color PinkDim = new Color(1f, 0.18f, 0.72f, 0.55f); private static readonly Color PinkBright = new Color(1f, 0.55f, 0.92f, 1f); private static readonly Color Orange = new Color(1f, 0.55f, 0f, 1f); private static readonly Color TimerLowColor = new Color(1f, 0.2f, 0.2f, 1f); private static readonly string[] FlavourLines = new string[6] { "GLAZING: ACTIVE", "SPRINKLES: ARMED", "CALORIES: INFINITE", "SUGAR RUSH: CRITICAL", "ICING: HOT PINK", "PASTRY DRIVE: ONLINE" }; public void TriggerFlash() { _flashAlpha = 1f; } private void Awake() { int num = Mathf.Max(1, Screen.width / 4); int num2 = Mathf.Max(1, Screen.height / 4); _noisePixels = (Color32[])(object)new Color32[num * num2]; } private void Update() { _sw = Screen.width; _sh = Screen.height; _time = Time.time; _deltaTime = Time.deltaTime; if (_flashAlpha > 0f) { _flashAlpha -= _deltaTime * 4f; } _noiseTimer += _deltaTime; if (_noiseTimer >= 0.05f) { RegenerateNoise(); _noiseTimer = 0f; } if (_prevRemainingUses > 0 && RemainingLaserUses < _prevRemainingUses) { _rechargeFlashTimer = RechargeFlashDuration; } _prevRemainingUses = RemainingLaserUses; if (_rechargeFlashTimer > 0f) { _rechargeFlashTimer -= _deltaTime; } DateTime utcNow = DateTime.UtcNow; if (utcNow.Second != _lastTimestampSecond) { _timestampStr = $"{utcNow:HH:mm:ss}Z"; _lastTimestampSecond = utcNow.Second; } } private void OnGUI() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_039d: 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_03c4: Unknown result type (might be due to invalid IL or missing references) EnsureTextures(); EnsureStyles(); float num = ((_sw > 0f) ? _sw : ((float)Screen.width)); float num2 = ((_sh > 0f) ? _sh : ((float)Screen.height)); GUI.color = Color.white; GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_vignetteTex, (ScaleMode)0); GUI.color = new Color(1f, 0.3f, 0.8f, 0.035f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_noiseTex, (ScaleMode)0); GUI.color = new Color(0f, 0f, 0f, 0.12f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_scanlineTex, (ScaleMode)0); GUI.color = Color.white; float num3 = 60f; float thick = 3f; DrawCornerBracket(0f, 0f, num3, thick, leftSide: true, topSide: true); DrawCornerBracket(num - num3, 0f, num3, thick, leftSide: false, topSide: true); DrawCornerBracket(0f, num2 - num3, num3, thick, leftSide: true, topSide: false); DrawCornerBracket(num - num3, num2 - num3, num3, thick, leftSide: false, topSide: false); int num4 = (int)(_time / 2.5f) % FlavourLines.Length; GUI.Label(new Rect(16f, 12f, 360f, 24f), _timestampStr, _cornerStyle); GUI.Label(new Rect(16f, 34f, 360f, 24f), "SYS: GLAZED", _cornerStyle); GUI.Label(new Rect(16f, 56f, 360f, 24f), "MODE: ANNIHILATION", _cornerStyle); GUI.Label(new Rect(16f, 78f, 360f, 24f), FlavourLines[num4], _cornerStyle); int num5 = Mathf.CeilToInt(Mathf.Max(0f, TimeRemaining)); bool flag = num5 <= 10; _labelStyle.normal.textColor = (flag ? TimerLowColor : PinkBright); _labelStyle.alignment = (TextAnchor)5; _labelStyle.fontSize = 26; GUI.Label(new Rect(num - 240f, 12f, 220f, 32f), $"TIME {num5 / 60:D2}:{num5 % 60:D2}", _labelStyle); _labelStyle.alignment = (TextAnchor)4; _labelStyle.fontSize = 22; _labelStyle.normal.textColor = Color.white; DrawChargeBar(num, num2); DrawLaserDots(num, num2); GUI.DrawTexture(new Rect(0f, num2 - 56f, num, 56f), (Texture)(object)_bgTex); GUI.Label(new Rect(0f, num2 - 55f, num, 30f), "DONUT OF ANNIHILATION", _titleStyle); GUI.Label(new Rect(0f, num2 - 28f, num, 24f), "Click: Fire Laser | Space: Exit", _instructionStyle); if (_flashAlpha > 0f) { GUI.color = new Color(1f, 0.2f, 0.8f, Mathf.Clamp01(_flashAlpha) * 0.55f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } } private void DrawDonutCrosshair(float cx, float cy) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_022e: 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_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) float num = 36f; float num2 = 8f; float num3 = 20f; float num4 = 14f; float num5 = 2f; float num6 = 0.65f + 0.25f * Mathf.Sin(_time * 4f); GUI.color = new Color(PinkMain.r, PinkMain.g, PinkMain.b, num6); float num7 = num + num2; GUI.DrawTexture(new Rect(cx - num5 * 0.5f, cy - num7, num5, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx - num5 * 0.5f, cy + num, num5, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx + num, cy - num5 * 0.5f, num2, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx - num7, cy - num5 * 0.5f, num2, num5), (Texture)(object)Texture2D.whiteTexture); float num8 = num * 0.707f; float len = num2 * 0.707f; DrawDiagTick(cx + num8, cy - num8, 1f, -1f, len, num5); DrawDiagTick(cx - num8, cy - num8, -1f, -1f, len, num5); DrawDiagTick(cx + num8, cy + num8, 1f, 1f, len, num5); DrawDiagTick(cx - num8, cy + num8, -1f, 1f, len, num5); float num9 = num7 + 4f; GUI.DrawTexture(new Rect(cx - num3 - num9, cy - num5 * 0.5f, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx + num9, cy - num5 * 0.5f, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx - num5 * 0.5f, cy - num3 - num9, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx - num5 * 0.5f, cy + num9, num5, num3), (Texture)(object)Texture2D.whiteTexture); float num10 = (num4 + 4f) * 0.3f; GUI.DrawTexture(new Rect(cx - num4 - num10 * 2f, cy - num5 * 0.5f, num10, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx + num4 + num10 * 0.3f, cy - num5 * 0.5f, num10, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx - num5 * 0.5f, cy - num4 - num10 * 2f, num5, num10), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(cx - num5 * 0.5f, cy + num4 + num10 * 0.3f, num5, num10), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private static void DrawDiagTick(float x, float y, float dx, float dy, float len, float thick) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(x - thick, y - thick, thick * 2f, thick * 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x + dx * len * 0.5f - thick, y + dy * len * 0.5f - thick, thick * 2f, thick * 2f), (Texture)(object)Texture2D.whiteTexture); } private void DrawChargeBar(float sw, float sh) { //IL_004f: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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) //IL_0195: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) bool flag = RemainingLaserUses > 0; bool flag2 = _rechargeFlashTimer > 0f; float num = sw * 0.35f; float num2 = 8f; float num3 = (sw - num) * 0.5f; float num4 = sh - 75f; GUI.color = new Color(0f, 0f, 0f, 0.55f); GUI.DrawTexture(new Rect(num3 - 2f, num4 - 2f, num + 4f, num2 + 4f), (Texture)(object)Texture2D.whiteTexture); if (flag2) { float num5 = 1f - _rechargeFlashTimer / RechargeFlashDuration; GUI.color = new Color(Orange.r, Orange.g, Orange.b, 0.85f); GUI.DrawTexture(new Rect(num3, num4, num * (1f - num5), num2), (Texture)(object)Texture2D.whiteTexture); _chargeStyle.normal.textColor = Orange; GUI.Label(new Rect(0f, num4 - 26f, sw, 24f), "RECHARGING...", _chargeStyle); } else if (flag) { float num6 = 0.75f + 0.25f * Mathf.Sin(_time * 6f); GUI.color = new Color(PinkMain.r, PinkMain.g, PinkMain.b, num6); GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)Texture2D.whiteTexture); float num7 = 0.7f + 0.3f * Mathf.Sin(_time * 5f); _chargeStyle.normal.textColor = new Color(PinkBright.r, PinkBright.g, PinkBright.b, num7); GUI.Label(new Rect(0f, num4 - 26f, sw, 24f), "◆ LASER READY ◆", _chargeStyle); } else { GUI.color = new Color(0.3f, 0.3f, 0.3f, 0.5f); GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)Texture2D.whiteTexture); _chargeStyle.normal.textColor = new Color(0.6f, 0.6f, 0.6f, 0.9f); GUI.Label(new Rect(0f, num4 - 26f, sw, 24f), "NO CHARGES", _chargeStyle); } GUI.color = Color.white; } private void DrawLaserDots(float sw, float sh) { //IL_011e: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) float num = 60f; float num2 = 10f; float num3 = (float)TotalLaserUses * num + (float)(TotalLaserUses - 1) * num2; float num4 = sw * 0.5f - num3 * 0.5f; float num5 = sh - 160f; for (int i = 0; i < TotalLaserUses; i++) { if (i < RemainingLaserUses) { float num6 = (_time * 0.4f + (float)i * (1f / (float)TotalLaserUses)) % 1f; _dotStyle.normal.textColor = Color.HSVToRGB(num6, 0.7f, 1f); } else { _dotStyle.normal.textColor = new Color(0.25f, 0.25f, 0.25f); } GUI.Label(new Rect(num4 + (float)i * (num + num2), num5, num, num), "●", _dotStyle); } _labelStyle.fontSize = 13; _labelStyle.normal.textColor = PinkDim; _labelStyle.fontSize = 22; _labelStyle.normal.textColor = Color.white; } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) GUI.color = PinkMain; float num = (leftSide ? x : (x + size - thick)); GUI.DrawTexture(new Rect(num, y, thick, size), (Texture)(object)Texture2D.whiteTexture); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(x, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void EnsureTextures() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) float num = ((_sw > 0f) ? _sw : ((float)Screen.width)); float num2 = ((_sh > 0f) ? _sh : ((float)Screen.height)); if ((Object)(object)_bgTex == (Object)null) { _bgTex = new Texture2D(1, 1); _bgTex.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.65f)); _bgTex.Apply(); } if ((Object)(object)_vignetteTex == (Object)null) { _vignetteTex = GeneratePinkVignette((int)num, (int)num2); } if ((Object)(object)_noiseTex == (Object)null) { _noiseTex = GenerateNoise((int)(num / 4f), (int)(num2 / 4f)); } if ((Object)(object)_scanlineTex == (Object)null) { _scanlineTex = GenerateScanlines((int)num, (int)num2); } } private static Texture2D GeneratePinkVignette(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); float num = (float)w / 2f; float num2 = (float)h / 2f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = (float)j - num; float num5 = (float)i - num2; float num6 = Mathf.Clamp01(Mathf.Sqrt(num4 * num4 + num5 * num5) / num3); float num7 = Mathf.Pow(num6, 1.7f) * 0.9f; float num8 = Mathf.Pow(num6, 3f) * 0.35f; array[i * w + j] = new Color(num8 * 0.9f, 0f, num8 * 0.6f, num7); } } val.SetPixels(array); val.Apply(); return val; } private static Texture2D GenerateScanlines(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { float num = ((i % 3 == 0) ? 1f : 0f); for (int j = 0; j < w; j++) { array[i * w + j] = new Color(0f, 0f, 0f, num); } } val.SetPixels(array); val.Apply(); return val; } private Texture2D GenerateNoise(int w, int h) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if (_noisePixels == null || _noisePixels.Length != w * h) { _noisePixels = (Color32[])(object)new Color32[w * h]; } Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); RegenerateNoise(val); return val; } private void RegenerateNoise() { RegenerateNoise(_noiseTex); } private void RegenerateNoise(Texture2D tex) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _noisePixels.Length; i++) { byte b = (byte)Random.Range(0, 256); _noisePixels[i] = new Color32(b, (byte)((float)(int)b * 0.4f), (byte)((float)(int)b * 0.85f), byte.MaxValue); } tex.SetPixels32(_noisePixels); tex.Apply(false, false); } private void EnsureStyles() { //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_001e: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005e: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01bd: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) if (_labelStyle == null) { GUIStyle val = new GUIStyle { fontSize = 22, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; val.alignment = (TextAnchor)4; _labelStyle = val; } if (_titleStyle == null) { _titleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 24, fontStyle = (FontStyle)1 }; _titleStyle.normal.textColor = PinkBright; } if (_dotStyle == null) { _dotStyle = new GUIStyle { fontSize = 26, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; } if (_instructionStyle == null) { _instructionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 16, fontStyle = (FontStyle)1 }; _instructionStyle.normal.textColor = new Color(1f, 1f, 1f, 0.75f); } if (_cornerStyle == null) { _cornerStyle = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1 }; _cornerStyle.normal.textColor = PinkMain; } if (_chargeStyle == null) { _chargeStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1 }; _chargeStyle.normal.textColor = PinkBright; } } } public class DroneSwarmOverlay : MonoBehaviour { private bool _active; private int _totalDrones; private int _aliveDrones; private Texture2D _solidTex; private GUIStyle _warningStyle; private const int _warningStyleFontSize = 24; private GUIStyle _pipStyle; private const int _pipStyleFontSize = 36; private GUIStyle _labelStyle; private const int _labelStyleFontSize = 20; private float _time; private float _deltaTime; private float _sw; private float _sh; private float _killFlashAlpha; private const float KillFlashDecay = 3.5f; private static readonly Color DroneBlue = new Color(0.1f, 0.6f, 0.9f, 1f); private static readonly Color DroneBlueDim = new Color(0.1f, 0.6f, 0.9f, 0.45f); private static readonly Color DeadGrey = new Color(0.25f, 0.25f, 0.25f, 0.55f); private static readonly Color WarningCyan = new Color(0.2f, 0.9f, 0.95f, 1f); public static DroneSwarmOverlay Instance { get; private set; } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) Instance = this; _solidTex = new Texture2D(1, 1, (TextureFormat)4, false); _solidTex.SetPixel(0, 0, Color.white); _solidTex.Apply(); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if ((Object)(object)_solidTex != (Object)null) { Object.Destroy((Object)(object)_solidTex); } } private void Update() { _sw = Screen.width; _sh = Screen.height; _time = Time.time; _deltaTime = Time.deltaTime; if (_killFlashAlpha > 0f) { _killFlashAlpha -= _deltaTime * 3.5f; } } public void SetActive(bool active, int droneCount) { _active = active; _totalDrones = droneCount; _aliveDrones = droneCount; } public void DecrementDroneCount() { _aliveDrones = Mathf.Max(0, _aliveDrones - 1); _killFlashAlpha = 1f; } public void Deactivate() { _active = false; } private void OnGUI() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (_active) { EnsureStyles(); float num = ((_sw > 0f) ? _sw : ((float)Screen.width)); float num2 = ((_sh > 0f) ? _sh : ((float)Screen.height)); if (_killFlashAlpha > 0f) { GUI.color = new Color(DroneBlue.r, DroneBlue.g, DroneBlue.b, Mathf.Clamp01(_killFlashAlpha) * 0.25f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_solidTex); GUI.color = Color.white; } float pulse = 0.5f + 0.5f * Mathf.Sin(_time * 4f); DrawCornerBrackets(num, num2, pulse); DrawDronePips(num, num2); DrawBottomBar(num, num2); } } private void DrawDronePips(float sw, float sh) { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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) if (_totalDrones <= 0) { return; } float num = (float)_totalDrones * 34f + (float)(_totalDrones - 1) * 6f; float num2 = sw * 0.5f - num * 0.5f; float num3 = 14f; for (int i = 0; i < _totalDrones; i++) { if (i < _aliveDrones) { float num4 = 0.75f + 0.25f * Mathf.Sin(_time * 3f + (float)i * 0.8f); _pipStyle.normal.textColor = new Color(DroneBlue.r * num4, DroneBlue.g, DroneBlue.b, 1f); } else { _pipStyle.normal.textColor = DeadGrey; } GUI.Label(new Rect(num2 + (float)i * 40f, num3, 34f, 34f), "▲", _pipStyle); } _labelStyle.normal.textColor = DroneBlueDim; string text = ((_aliveDrones == 0) ? "ALL DRONES DESTROYED" : string.Format("{0} DRONE{1} ACTIVE", _aliveDrones, (_aliveDrones == 1) ? "" : "S")); GUI.Label(new Rect(0f, num3 + 34f + 2f, sw, 20f), text, _labelStyle); } private void DrawCornerBrackets(float sw, float sh, float pulse) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00a6: Unknown result type (might be due to invalid IL or missing references) Color c = default(Color); ((Color)(ref c))..ctor(DroneBlue.r, DroneBlue.g, DroneBlue.b, pulse * 0.85f); DrawCornerBracket(0f, 0f, 44f, 2f, leftSide: true, topSide: true, c); DrawCornerBracket(sw - 44f, 0f, 44f, 2f, leftSide: false, topSide: true, c); DrawCornerBracket(0f, sh - 44f, 44f, 2f, leftSide: true, topSide: false, c); DrawCornerBracket(sw - 44f, sh - 44f, 44f, 2f, leftSide: false, topSide: false, c); } private void DrawBottomBar(float sw, float sh) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(DroneBlue.r, DroneBlue.g, DroneBlue.b, 0.5f); DrawRect(0f, sh - 75f, sw, 75f); GUI.color = Color.white; _warningStyle.normal.textColor = new Color(0.85f, 0.97f, 1f, 0.95f); GUI.Label(new Rect(0f, sh - 55f, sw, 24f), "DRONE SWARM", _warningStyle); _labelStyle.normal.textColor = DroneBlueDim; GUI.Label(new Rect(0f, sh - 25f, sw, 20f), "Drones are circling overhead. Watch out!", _labelStyle); } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide, Color c) { //IL_0001: 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) GUI.color = c; float x2 = (leftSide ? x : (x + size - thick)); DrawRect(x2, y, thick, size); float y2 = (topSide ? y : (y + size - thick)); DrawRect(x, y2, size, thick); GUI.color = Color.white; } private void DrawRect(float x, float y, float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(x, y, w, h), (Texture)(object)_solidTex); } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_009b: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (_warningStyle == null) { _warningStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 24, fontStyle = (FontStyle)1 }; _warningStyle.normal.textColor = Color.white; } if (_pipStyle == null) { _pipStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 36, fontStyle = (FontStyle)1 }; _pipStyle.normal.textColor = DroneBlue; } if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 20, fontStyle = (FontStyle)1 }; _labelStyle.normal.textColor = DroneBlueDim; } } } internal static class EffectBarLayout { public const float BarHeight = 28f; public const float BarWidthFraction = 0.375f; private const float BarGap = 6f; private const float BottomMargin = 52f; public static float GetBarWidth() { return (float)Screen.width * 0.375f; } public static float GetBarX() { return ((float)Screen.width - GetBarWidth()) * 0.5f; } public static float GetBarY(int slot) { return (float)Screen.height - 52f - (float)slot * 34f; } } public class FirstPlaceStarOverlay : MonoBehaviour { private const float CheckInterval = 0.5f; private GameObject _starInstance; private ulong _currentFirstPlaceGuid; private float _checkTimer; private void Update() { if (!ModConfig.Global.FirstPlaceStarEnabled.Value) { if ((Object)(object)_starInstance != (Object)null && _starInstance.activeSelf) { HideStar(); } return; } _checkTimer -= Time.deltaTime; if (!(_checkTimer > 0f)) { _checkTimer = 0.5f; RefreshStar(); } } private void OnDestroy() { if ((Object)(object)_starInstance != (Object)null) { Object.Destroy((Object)(object)_starInstance); } } private void RefreshStar() { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) MatchState matchState = CourseManager.MatchState; int num = default(int); int num2 = default(int); if (((int)matchState != 2 && (int)matchState != 3 && (int)matchState != 4 && (int)matchState != 5 && (int)matchState != 6) || CourseManager.CountActivePlayers(ref num, ref num2) < 1) { HideStar(); return; } ulong playerGuid; try { playerGuid = CourseManager.GetFirstPlaceState().playerGuid; } catch { HideStar(); return; } if (playerGuid == _currentFirstPlaceGuid) { if ((Object)(object)_starInstance != (Object)null) { _starInstance.SetActive(true); _starInstance.transform.localPosition = new Vector3(0f, ModConfig.Global.FirstPlaceStarHeight.Value, 0f); } return; } _currentFirstPlaceGuid = playerGuid; PlayerInfo value; if (playerGuid == 0L || (Object)(object)AssetLoader.GoldStarPrefab == (Object)null) { HideStar(); } else if (!PlayerInfo.playerInfoPerPlayerGuid.TryGetValue(playerGuid, out value) || (Object)(object)value == (Object)null) { HideStar(); } else { AttachStarTo(value); } } private void AttachStarTo(PlayerInfo playerInfo) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_starInstance == (Object)null) { _starInstance = Object.Instantiate(AssetLoader.GoldStarPrefab); Collider[] componentsInChildren = _starInstance.GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { val.enabled = false; } } Transform val2 = (((Object)(object)playerInfo.HeadBone != (Object)null) ? playerInfo.HeadBone : ((Component)playerInfo).transform); float value = ModConfig.Global.FirstPlaceStarHeight.Value; _starInstance.transform.SetParent(val2, false); _starInstance.transform.localPosition = new Vector3(0f, value, 0f); _starInstance.transform.localRotation = Quaternion.identity; _starInstance.SetActive(true); } private void HideStar() { _currentFirstPlaceGuid = 0uL; if (!((Object)(object)_starInstance == (Object)null)) { _starInstance.transform.SetParent((Transform)null, false); _starInstance.SetActive(false); } } } public class FreezeOverlay : MonoBehaviour { private bool _frozen; private float _startTime; private float _duration; private Texture2D _frostTexture; private Texture2D _barBgTexture; private Texture2D _barFillTexture; private int _cachedBarW = -1; private static readonly Color FillColor = new Color(0.3f, 0.7f, 1f, 0.9f); private static readonly Color BgColor = new Color(0f, 0f, 0f, 0.55f); private GUIStyle _labelStyle; public static FreezeOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } DestroyBarTextures(); if ((Object)(object)_frostTexture != (Object)null) { Object.Destroy((Object)(object)_frostTexture); } } private void Start() { _frostTexture = GenerateFrostTexture(256, 256); } public void SetFrozen(bool frozen, float duration = 0f) { _frozen = frozen; if (frozen) { _duration = duration; _startTime = Time.time; } } private void OnGUI() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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) //IL_0140: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_018d: Expected O, but got Unknown if (!_frozen) { return; } if ((Object)(object)_frostTexture != (Object)null) { GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_frostTexture, (ScaleMode)0); } if (_duration <= 0f) { return; } int num = (int)EffectBarLayout.GetBarWidth(); if (num != _cachedBarW) { RebuildBarTextures(num); } if (!((Object)(object)_barBgTexture == (Object)null) && !((Object)(object)_barFillTexture == (Object)null)) { float num2 = Time.time - _startTime; float num3 = Mathf.Clamp01(1f - num2 / _duration); float num4 = Mathf.Max(0f, _duration - num2); float barWidth = EffectBarLayout.GetBarWidth(); float num5 = 28f; float barX = EffectBarLayout.GetBarX(); float barY = EffectBarLayout.GetBarY(0); GUI.DrawTexture(new Rect(barX, barY, barWidth, num5), (Texture)(object)_barBgTexture); GUI.BeginGroup(new Rect(barX, barY, barWidth * num3, num5)); GUI.DrawTexture(new Rect(0f, 0f, barWidth, num5), (Texture)(object)_barFillTexture); GUI.EndGroup(); if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; } _labelStyle.normal.textColor = Color.white; GUI.Label(new Rect(barX, barY, barWidth, num5), $"Freeze Time Remaining: {num4:F1}s", _labelStyle); } } private void RebuildBarTextures(int barW) { //IL_0013: 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) DestroyBarTextures(); int num = 28; int radius = num / 3; _barBgTexture = GenerateRoundedRectTexture(barW, num, radius, BgColor); _barFillTexture = GenerateRoundedRectTexture(barW, num, radius, FillColor); _cachedBarW = barW; } private void DestroyBarTextures() { if ((Object)(object)_barBgTexture != (Object)null) { Object.Destroy((Object)(object)_barBgTexture); _barBgTexture = null; } if ((Object)(object)_barFillTexture != (Object)null) { Object.Destroy((Object)(object)_barFillTexture); _barFillTexture = null; } _cachedBarW = -1; } private static Texture2D GenerateRoundedRectTexture(int w, int h, int radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { array[i * w + j] = (IsInsideRoundedRect(j, i, w, h, radius) ? color : Color.clear); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static bool IsInsideRoundedRect(int x, int y, int w, int h, int r) { bool flag = x < r; bool flag2 = x >= w - r; bool flag3 = y < r; bool flag4 = y >= h - r; if (!(flag || flag2) || !(flag3 || flag4)) { return true; } int num = (flag ? r : (w - 1 - r)); int num2 = (flag3 ? r : (h - 1 - r)); float num3 = x - num; float num4 = y - num2; return num3 * num3 + num4 * num4 <= (float)(r * r); } private static Texture2D GenerateFrostTexture(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); float num = (float)w * 0.5f; float num2 = (float)h * 0.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num2) * ((float)i - num2)) / num3; float num5 = Mathf.Pow(Mathf.Clamp01(num4), 0.5f) * 0.825f; array[i * w + j] = new Color(0.1f, 0.25f, 1f, num5); } } val.SetPixels(array); val.Apply(); return val; } } public class GravityGunOverlay : MonoBehaviour { private GUIStyle _titleStyle; private GUIStyle _instructionStyle; private GUIStyle _labelStyle; private GUIStyle _timerStyle; private float _sw; private float _sh; private float _time; private bool _sessionActive; private float _sessionElapsed; private float _sessionDuration; private bool _hasTarget; private bool _aimingIn; private Vector3 _targetScreenPos; private GolfCartInfo[] _cachedCarts = Array.Empty(); private float _cartCacheTime = float.MinValue; private const float CartCacheInterval = 1f; private float _sessionStartTime; private bool _wasSessionActive; private float _busyUntil; public NetworkIdentity BestTargetIdentity { get; private set; } public static GravityGunOverlay Instance { get; private set; } private void OnEnable() { Instance = this; } private void OnDisable() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (!((Object)(object)localPlayerInfo == (Object)null) && !((Object)(object)localPlayerInfo.Inventory == (Object)null)) { _sw = Screen.width; _sh = Screen.height; _time = Time.time; GravityGunNetworkBridge gravityGunNetworkBridge = ((localPlayerInfo != null) ? ((Component)localPlayerInfo).GetComponent() : null); _sessionActive = (Object)(object)gravityGunNetworkBridge != (Object)null && gravityGunNetworkBridge.LocalSessionActive; if (_sessionActive && !_wasSessionActive) { _sessionStartTime = _time; _sessionDuration = ModConfig.GravityGun.TetherDuration.Value; } _wasSessionActive = _sessionActive; if (_sessionActive) { _sessionElapsed = _time - _sessionStartTime; _hasTarget = false; } else { _sessionElapsed = 0f; UpdateLockOnTarget(); } } } private void UpdateLockOnTarget() { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) _hasTarget = false; BestTargetIdentity = null; PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory == (Object)null || localPlayerInventory.GetEffectivelyEquippedItem(true) != ItemRegistry.GravityGunItemType) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } float num = Mathf.Cos(ModConfig.GravityGun.LockOnConeAngleDeg.Value * 0.5f * (MathF.PI / 180f)); float num2 = ModConfig.GravityGun.LockOnRange.Value * ModConfig.GravityGun.LockOnRange.Value; Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; float num3 = -1f; Transform val = null; NetworkIdentity bestTargetIdentity = null; List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if ((Object)(object)item == (Object)null) { continue; } NetworkIdentity component = ((Component)item).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } Vector3 val2 = ((Component)item).transform.position - position; if (!(((Vector3)(ref val2)).sqrMagnitude > num2)) { float num4 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized); if (!(num4 < num) && !(num4 <= num3)) { num3 = num4; val = ((Component)item).transform; bestTargetIdentity = component; } } } } if (_time - _cartCacheTime >= 1f) { _cachedCarts = Object.FindObjectsByType((FindObjectsSortMode)0); _cartCacheTime = _time; } GolfCartInfo[] cachedCarts = _cachedCarts; foreach (GolfCartInfo val3 in cachedCarts) { if ((Object)(object)val3 == (Object)null || !((Component)val3).gameObject.activeInHierarchy) { continue; } NetworkIdentity component2 = ((Component)val3).GetComponent(); if ((Object)(object)component2 == (Object)null) { continue; } Vector3 val4 = ((Component)val3).transform.position - position; if (!(((Vector3)(ref val4)).sqrMagnitude > num2)) { float num5 = Vector3.Dot(forward, ((Vector3)(ref val4)).normalized); if (!(num5 < num) && !(num5 <= num3)) { num3 = num5; val = ((Component)val3).transform; bestTargetIdentity = component2; } } } if (!((Object)(object)val == (Object)null)) { BestTargetIdentity = bestTargetIdentity; Vector3 val5 = main.WorldToScreenPoint(val.position); if (!(val5.z <= 0f)) { _targetScreenPos = new Vector3(val5.x, _sh - val5.y, 0f); _hasTarget = true; } } } private void OnGUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null || (Object)(object)localPlayerInfo.Inventory == (Object)null || localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.GravityGunItemType || _sw <= 0f || _sh <= 0f) { return; } EnsureStyles(); if (_sessionActive) { DrawActiveHUD(); } else if (_time < _busyUntil) { DrawBusyMessage(); } else if (_hasTarget) { DrawLockOnReticle(); } if (Mouse.current == null || !Mouse.current.rightButton.isPressed) { if (_aimingIn) { FixLookRotationAfterScope(); } _aimingIn = false; } else { _aimingIn = true; CorrectAimRotation(); } } public void ShowBusy() { _busyUntil = Time.time + 2.5f; } private void DrawBusyMessage() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) float num = _sh - 12f - 42f; _instructionStyle.normal.textColor = new Color(1f, 0.6f, 0.1f, 0.9f); GUI.Label(new Rect(0f, num, _sw, 42f), "GRAVITY GUN ALREADY IN USE", _instructionStyle); _instructionStyle.normal.textColor = Color.white; } private void DrawActiveHUD() { //IL_0057: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, _sessionDuration - _sessionElapsed); bool flag = num <= 3f; Color c = (flag ? new Color(1f, 0.25f, 0.25f, 0.9f) : new Color(0.2f, 0.85f, 1f, 0.9f)); float num2 = 50f; float thick = 3f; DrawCornerBracket(0f, 0f, num2, thick, leftSide: true, topSide: true, c); DrawCornerBracket(_sw - num2, 0f, num2, thick, leftSide: false, topSide: true, c); DrawCornerBracket(0f, _sh - num2, num2, thick, leftSide: true, topSide: false, c); DrawCornerBracket(_sw - num2, _sh - num2, num2, thick, leftSide: false, topSide: false, c); float num3 = _sh - 12f - 42f; float num4 = num3 - 10f - 10f; float num5 = num4 - 10f - 42f; _titleStyle.normal.textColor = (flag ? new Color(1f, 0.25f, 0.25f, 0.7f + 0.3f * Mathf.Sin(_time * 6f)) : new Color(0.2f, 0.85f, 1f, 0.9f)); GUI.Label(new Rect(0f, num5, _sw, 42f), "GRAVITY GUN ACTIVE", _titleStyle); float num6 = 280f; float num7 = (_sw - num6) * 0.5f; float num8 = ((_sessionDuration > 0f) ? Mathf.Clamp01(num / _sessionDuration) : 0f); GUI.color = new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(new Rect(num7, num4, num6, 10f), (Texture)(object)Texture2D.whiteTexture); Color color = (flag ? new Color(1f, 0.3f, 0.3f, 0.85f) : new Color(0.2f, 0.85f, 1f, 0.85f)); GUI.color = color; GUI.DrawTexture(new Rect(num7, num4, num6 * num8, 10f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; _timerStyle.normal.textColor = (flag ? new Color(1f, 0.3f, 0.3f, 0.9f) : new Color(0.2f, 0.85f, 1f, 0.9f)); GUI.Label(new Rect(num7 + num6 + 8f, num4 - 14f, 80f, 38f), $"{num:F1}s", _timerStyle); GUI.Label(new Rect(0f, num3, _sw, 42f), "Left-click to Release the Tether Line", _instructionStyle); } private void DrawLockOnReticle() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) if (!_aimingIn) { return; } float x = _targetScreenPos.x; float y = _targetScreenPos.y; float num = 24f; float num2 = 36f; float num3 = 4f; Color val = default(Color); ((Color)(ref val))..ctor(0.2f, 0.85f, 1f, 0.85f); GUI.color = val; float num4 = num; float num5 = num2 - num; GUI.DrawTexture(new Rect(x - num2, y - num3 * 0.5f, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x + num4, y - num3 * 0.5f, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num3 * 0.5f, y - num2, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num3 * 0.5f, y + num4, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 2f, y - 2f, 4f, 4f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; _labelStyle.normal.textColor = val; string text = "LOCK ON"; if ((Object)(object)BestTargetIdentity != (Object)null) { PlayerInfo componentInParent = ((Component)BestTargetIdentity).GetComponentInParent(); object obj; if (componentInParent == null) { obj = null; } else { PlayerId playerId = componentInParent.PlayerId; obj = ((playerId != null) ? playerId.PlayerName : null); } string text2 = (string)obj; if (!string.IsNullOrEmpty(text2)) { text = "LOCK ON\n" + text2; } } GUI.Label(new Rect(x - 200f, y + num2 + 4f, 400f, 76f), text, _labelStyle); } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide, Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_004f: Unknown result type (might be due to invalid IL or missing references) GUI.color = c; float num = (leftSide ? x : (x + size - thick)); GUI.DrawTexture(new Rect(num, y, thick, size), (Texture)(object)Texture2D.whiteTexture); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(x, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void CorrectAimRotation() { //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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Movement : null) == (Object)null) { return; } Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (!(((Vector3)(ref forward)).sqrMagnitude < 0.01f)) { ((Component)localPlayerInfo.Movement).transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized) * Quaternion.Euler(0f, 65f, 0f); } } } private void FixLookRotationAfterScope() { //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_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) if (!((Object)(object)Camera.main != (Object)null)) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (localPlayerInfo != null) { PlayerMovement movement = localPlayerInfo.Movement; if (movement != null) { Transform transform = ((Component)movement).transform; Vector3 forward = ((Component)Camera.main).transform.forward; transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized); } } } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_011e: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) if (_titleStyle == null) { _titleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _titleStyle.normal.textColor = new Color(0.2f, 0.85f, 1f, 0.9f); } if (_instructionStyle == null) { _instructionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _instructionStyle.normal.textColor = Color.white; } if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 28, fontStyle = (FontStyle)1, wordWrap = false }; _labelStyle.normal.textColor = new Color(0.2f, 0.85f, 1f, 0.85f); } if (_timerStyle == null) { _timerStyle = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1 }; _timerStyle.normal.textColor = new Color(0.2f, 0.85f, 1f, 0.9f); } } } public class GunCrosshairOverlay : MonoBehaviour { private Material _mat; private Camera _camera; private const int Segments = 64; private const float LineWidth = 2f; private const float ShadowOffset = 1f; private bool _aimingIn; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown _mat = new Material(Shader.Find("Hidden/Internal-Colored")) { hideFlags = (HideFlags)61 }; _mat.SetInt("_SrcBlend", 5); _mat.SetInt("_DstBlend", 10); _mat.SetInt("_Cull", 0); _mat.SetInt("_ZWrite", 0); } private void OnDestroy() { if ((Object)(object)_mat != (Object)null) { Object.Destroy((Object)(object)_mat); } } private void OnGUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //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_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Inventory : null) == (Object)null) { return; } ItemType effectivelyEquippedItem = localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true); bool flag = effectivelyEquippedItem == ItemRegistry.AK47ItemType; bool flag2 = effectivelyEquippedItem == ItemRegistry.FlamethrowerItemType; bool flag3 = effectivelyEquippedItem == ItemRegistry.HunterDroneItemType; if (!flag && !flag2 && !flag3) { return; } float radius; if (flag) { if (Mouse.current == null || !Mouse.current.rightButton.isPressed) { if (_aimingIn) { FixLookRotationAfterScope(); } _aimingIn = false; return; } _aimingIn = true; float value = ModConfig.AK47.Inaccuracy.Value; if (value <= 0f || (Object)(object)_mat == (Object)null) { return; } if (_camera == null) { _camera = Camera.main; } float num = (((Object)(object)_camera != (Object)null) ? _camera.fieldOfView : 60f); radius = (float)Screen.height / 2f * Mathf.Tan(value * (MathF.PI / 180f)) / Mathf.Tan(num / 2f * (MathF.PI / 180f)); } else if (flag3) { if (Mouse.current == null || !Mouse.current.rightButton.isPressed || (Object)(object)_mat == (Object)null) { return; } radius = 20f; } else { if ((Object)(object)_mat == (Object)null) { return; } radius = 15f; } float num2 = (float)Screen.width / 2f; float num3 = (float)Screen.height / 2f; GL.PushMatrix(); GL.LoadPixelMatrix(); _mat.SetPass(0); DrawRing(num2 + 1f, num3 - 1f, radius, new Color(0f, 0f, 0f, 0.6f)); DrawRing(num2, num3, radius, new Color(1f, 1f, 1f, 0.9f)); GL.PopMatrix(); if (flag || flag3) { CorrectAimRotation(); } } private void FixLookRotationAfterScope() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (_camera == null) { _camera = Camera.main; } if (!((Object)(object)_camera != (Object)null)) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (localPlayerInfo != null) { PlayerMovement movement = localPlayerInfo.Movement; if (movement != null) { Transform transform = ((Component)movement).transform; Vector3 forward = ((Component)_camera).transform.forward; transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized); } } } private void LateUpdate() { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Inventory : null) == (Object)null || Mouse.current == null || !Mouse.current.rightButton.isPressed) { return; } ItemType effectivelyEquippedItem = localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem == ItemRegistry.AK47ItemType || effectivelyEquippedItem == ItemRegistry.HunterDroneItemType) { CorrectAimRotation(); } else if (effectivelyEquippedItem == ItemRegistry.FlamethrowerItemType) { if (Mouse.current.leftButton.isPressed) { CorrectAimRotation(5f); } else { CorrectAimRotation(65f); } } } private void CorrectAimRotation(float yDegrees = 0f) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Movement : null) == (Object)null) { return; } if (_camera == null) { _camera = Camera.main; } Camera camera = _camera; if (!((Object)(object)camera == (Object)null)) { Vector3 forward = ((Component)camera).transform.forward; forward.y = 0f; if (!(((Vector3)(ref forward)).sqrMagnitude < 0.01f)) { ((Component)localPlayerInfo.Movement).transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized) * Quaternion.Euler(0f, yDegrees, 0f); } } } private static void DrawRing(float cx, float cy, float radius, Color color) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) float num = radius + 1f; float num2 = Mathf.Max(0f, radius - 1f); float num3 = MathF.PI / 32f; GL.Begin(7); GL.Color(color); for (int i = 0; i < 64; i++) { float num4 = (float)i * num3; float num5 = (float)(i + 1) * num3; float num6 = Mathf.Cos(num4); float num7 = Mathf.Sin(num4); float num8 = Mathf.Cos(num5); float num9 = Mathf.Sin(num5); GL.Vertex3(cx + num6 * num, cy + num7 * num, 0f); GL.Vertex3(cx + num8 * num, cy + num9 * num, 0f); GL.Vertex3(cx + num8 * num2, cy + num9 * num2, 0f); GL.Vertex3(cx + num6 * num2, cy + num7 * num2, 0f); } GL.End(); } } public class HitNotificationOverlay : MonoBehaviour { private const float Lifetime = 4f; private const int MaxToasts = 5; private readonly List<(string Text, float ExpireTime)> _toasts = new List<(string, float)>(); private GUIStyle _style; public static HitNotificationOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { float now = Time.time; _toasts.RemoveAll(((string Text, float ExpireTime) t) => t.ExpireTime <= now); } public void AddNotification(string message) { if (_toasts.Count >= 5) { _toasts.RemoveAt(0); } _toasts.Add((message, Time.time + 4f)); } private void OnGUI() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (_toasts.Count != 0) { EnsureStyle(); float num = Screen.width; float time = Time.time; for (int i = 0; i < _toasts.Count; i++) { (string Text, float ExpireTime) tuple = _toasts[i]; string item = tuple.Text; float item2 = tuple.ExpireTime; float num2 = item2 - time; float num3 = ((num2 < 1f) ? num2 : 1f); _style.normal.textColor = new Color(1f, 0.95f, 0.6f, num3); GUI.Label(new Rect(num - 310f - 14f, 60f + (float)i * 22f, 310f, 22f), item, _style); } } } private void EnsureStyle() { //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_0028: 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_003e: Expected O, but got Unknown if (_style == null) { _style = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)5, fontSize = 13, fontStyle = (FontStyle)1 }; } } } public class ItemWarningOverlay : MonoBehaviour { private class WarningEntry { public string Text; public float ExpiryTime; public GameObject ParticleInstance; public bool ShowPiP; public uint TrackedNetId; public int ItemTypeValue; public Camera PiPCamera; public RenderTexture PiPTexture; public GameObject PiPCameraGo; public bool IsPollingForBomber; public bool TargetLost; public Vector3 LastKnownPosition; public float PostDetonationTimer; } private const int PiPWidth = 320; private const int PiPHeight = 180; private const float PiPMargin = 16f; private const float PostDetonationDuration = 2.5f; private const float BannerWidth = 640f; private const float BannerHeight = 48f; private const float BannerSpacing = 6f; private const float BannerStartY = 0.26f; private static readonly int TypeBomber = (int)ItemRegistry.StealthBomberItemType; private static readonly int TypeAC130 = (int)ItemRegistry.AC130ItemType; private static readonly int TypeDonut = (int)ItemRegistry.DonutItemType; private static readonly int TypeNuke = (int)ItemRegistry.NukeItemType; private static readonly int TypeHarrier = (int)ItemRegistry.HarrierItemType; private readonly List _warnings = new List(); private GUIStyle _bannerStyle; private GUIStyle _shadowStyle; private GUIStyle _pipLabelStyle; private Texture2D _solidTex; private bool _stylesReady; public static ItemWarningOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } foreach (WarningEntry warning in _warnings) { CleanupEntry(warning); } _warnings.Clear(); } public static void HandleWarningMessage(ItemWarningMessage msg) { Instance?.AddWarning(msg); } private void AddWarning(ItemWarningMessage msg) { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01cc: 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_01f7: Unknown result type (might be due to invalid IL or missing references) bool flag = !ModConfig.Global.WarningShowForSelf.Value && (Object)(object)NetworkClient.localPlayer != (Object)null && NetworkClient.localPlayer.netId == msg.SenderNetId; float value = ModConfig.Global.WarningDuration.Value; WarningEntry warningEntry = new WarningEntry(); warningEntry.Text = "WARNING: " + msg.PlayerName + " has deployed " + msg.ItemDisplayName + "!"; warningEntry.ExpiryTime = Time.time + value; warningEntry.TrackedNetId = msg.TrackedNetId; warningEntry.ItemTypeValue = msg.ItemTypeValue; warningEntry.ShowPiP = !flag && SupportsPiP(msg.ItemTypeValue); WarningEntry warningEntry2 = warningEntry; if (!flag && ModConfig.Global.WarningSymbolEnabled.Value && (Object)(object)AssetLoader.WarningParticlePrefab != (Object)null) { GameObject val = Object.Instantiate(AssetLoader.WarningParticlePrefab); Camera main = Camera.main; if ((Object)(object)main != (Object)null) { val.transform.SetParent(((Component)main).transform, false); float num = 2.5f * Mathf.Tan(main.fieldOfView * 0.5f * (MathF.PI / 180f)); float num2 = num * 0.76f; val.transform.localPosition = new Vector3(0f, num2, 2.5f); val.transform.localRotation = Quaternion.identity; float value2 = ModConfig.Global.WarningPrefabScale.Value; val.transform.localScale = new Vector3(value2, value2, value2); ParticleSystem component = val.GetComponent(); if ((Object)(object)component != (Object)null) { MainModule main2 = component.main; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 1f, 1f, ModConfig.Global.WarningSymbolAlpha.Value); ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(val2); } } warningEntry2.ParticleInstance = val; } if (warningEntry2.ShowPiP) { if (msg.ItemTypeValue == TypeBomber) { warningEntry2.IsPollingForBomber = true; TryAttachBomberCamera(warningEntry2); } else if (msg.TrackedNetId != 0) { TryAttachNetIdCamera(warningEntry2); } } _warnings.Add(warningEntry2); } private void LateUpdate() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01db: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; for (int num = _warnings.Count - 1; num >= 0; num--) { WarningEntry warningEntry = _warnings[num]; if (warningEntry.IsPollingForBomber && (Object)(object)warningEntry.PiPCameraGo == (Object)null) { TryAttachBomberCamera(warningEntry); } if ((Object)(object)warningEntry.PiPCameraGo != (Object)null && !warningEntry.TargetLost) { Transform piPTarget = GetPiPTarget(warningEntry); if ((Object)(object)piPTarget != (Object)null) { warningEntry.LastKnownPosition = piPTarget.position; PositionPiPCamera(warningEntry.PiPCameraGo.transform, piPTarget, warningEntry.ItemTypeValue); } else if (warningEntry.ItemTypeValue == TypeNuke) { warningEntry.TargetLost = true; warningEntry.PostDetonationTimer = 2.5f; warningEntry.ExpiryTime = Mathf.Max(warningEntry.ExpiryTime, time + 2.5f + 0.5f); } else { DestroyPiPCamera(warningEntry); } } if (warningEntry.TargetLost && warningEntry.ItemTypeValue == TypeNuke && (Object)(object)warningEntry.PiPCameraGo != (Object)null) { warningEntry.PostDetonationTimer -= Time.deltaTime; if (warningEntry.PostDetonationTimer <= 0f) { DestroyPiPCamera(warningEntry); } else { float num2 = 1f - warningEntry.PostDetonationTimer / 2.5f; float num3 = Mathf.Lerp(25f, 90f, num2); Transform transform = warningEntry.PiPCameraGo.transform; Vector3 val = transform.position - warningEntry.LastKnownPosition; Vector3 val2 = ((Vector3)(ref val)).normalized; if (val2 == Vector3.zero) { val2 = Vector3.up; } transform.position = warningEntry.LastKnownPosition + val2 * num3; transform.LookAt(warningEntry.LastKnownPosition); } } if (time >= warningEntry.ExpiryTime) { CleanupEntry(warningEntry); _warnings.RemoveAt(num); } } } private void OnGUI() { //IL_0066: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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) if (_warnings.Count == 0) { return; } EnsureStyles(); float num = Screen.width; float num2 = Screen.height; float num3 = (num - 640f) * 0.5f; float num4 = num2 * 0.26f; for (int i = 0; i < _warnings.Count; i++) { float num5 = num4 + (float)i * 54f; DrawBanner(new Rect(num3, num5, 640f, 48f), _warnings[i].Text); } Rect val = default(Rect); for (int num6 = _warnings.Count - 1; num6 >= 0; num6--) { WarningEntry warningEntry = _warnings[num6]; if (!((Object)(object)warningEntry.PiPCamera == (Object)null) && !((Object)(object)warningEntry.PiPTexture == (Object)null)) { float num7 = Mathf.Clamp(ModConfig.Global.WarningPiPScale.Value, 0.5f, 2f); float num8 = 320f * num7; float num9 = 180f * num7; float num10 = num - num8 - 16f; float num11 = 16f; ((Rect)(ref val))..ctor(num10, num11, num8, num9); Color color = GUI.color; GUI.color = new Color(1f, 0.85f, 0.1f, 0.9f); GUI.DrawTexture(new Rect(((Rect)(ref val)).x - 3f, ((Rect)(ref val)).y - 3f, ((Rect)(ref val)).width + 6f, ((Rect)(ref val)).height + 6f), (Texture)(object)_solidTex); GUI.color = color; GUI.DrawTexture(val, (Texture)(object)warningEntry.PiPTexture, (ScaleMode)2); GUI.Label(new Rect(num10 + 4f, num11 + 4f, 312f, 22f), warningEntry.Text, _pipLabelStyle); break; } } } private static bool SupportsPiP(int itemTypeValue) { return itemTypeValue == TypeBomber || itemTypeValue == TypeAC130 || itemTypeValue == TypeDonut || itemTypeValue == TypeNuke || itemTypeValue == TypeHarrier; } private void TryAttachBomberCamera(WarningEntry entry) { if (!((Object)(object)StealthBomberItem.ActiveBomberVisual == (Object)null)) { AllocatePiPCamera(entry); entry.IsPollingForBomber = false; } } private void TryAttachNetIdCamera(WarningEntry entry) { if (NetworkClient.spawned.TryGetValue(entry.TrackedNetId, out var value) && !((Object)(object)value == (Object)null)) { AllocatePiPCamera(entry); } } private void AllocatePiPCamera(WarningEntry entry) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (!((Object)(object)entry.PiPCameraGo != (Object)null)) { GameObject val = new GameObject("[IssaMod] PiP Camera"); Object.DontDestroyOnLoad((Object)(object)val); RenderTexture val2 = new RenderTexture(320, 180, 16, (RenderTextureFormat)7); val2.Create(); Camera val3 = val.AddComponent(); val3.targetTexture = val2; val3.fieldOfView = 60f; val3.nearClipPlane = 0.3f; val3.farClipPlane = 2000f; Camera main = Camera.main; val3.cullingMask = ((main != null) ? main.cullingMask : (-1)); Camera main2 = Camera.main; val3.depth = ((main2 != null) ? main2.depth : 0f) - 1f; entry.PiPCamera = val3; entry.PiPTexture = val2; entry.PiPCameraGo = val; } } private static void PositionPiPCamera(Transform camT, Transform target, int itemTypeValue) { //IL_0046: 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_0055: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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) if (itemTypeValue == TypeNuke) { camT.position = target.position + new Vector3(0f, 20f, -10f); camT.LookAt(target.position); return; } Vector3 val = Vector3.up * 1.5f; Vector3 val2 = default(Vector3); if (itemTypeValue == TypeBomber) { ((Vector3)(ref val2))..ctor(0f, 6f, -22f); } else if (itemTypeValue == TypeAC130) { ((Vector3)(ref val2))..ctor(0f, 8f, -22f); } else if (itemTypeValue == TypeDonut) { ((Vector3)(ref val2))..ctor(0f, 12f, -18f); } else if (itemTypeValue == TypeHarrier) { ((Vector3)(ref val2))..ctor(0f, 10f, -28f); } else { ((Vector3)(ref val2))..ctor(0f, 10f, -20f); } camT.position = target.position + target.TransformDirection(val2); camT.LookAt(target.position + val); } private static Transform GetPiPTarget(WarningEntry entry) { if (entry.ItemTypeValue == TypeBomber) { GameObject activeBomberVisual = StealthBomberItem.ActiveBomberVisual; return (activeBomberVisual != null) ? activeBomberVisual.transform : null; } if (entry.TrackedNetId == 0) { return null; } NetworkIdentity value; return (NetworkClient.spawned.TryGetValue(entry.TrackedNetId, out value) && (Object)(object)value != (Object)null) ? ((Component)value).transform : null; } private static void DestroyPiPCamera(WarningEntry entry) { if ((Object)(object)entry.PiPCamera != (Object)null) { entry.PiPCamera.targetTexture = null; entry.PiPCamera = null; } if ((Object)(object)entry.PiPTexture != (Object)null) { entry.PiPTexture.Release(); Object.Destroy((Object)(object)entry.PiPTexture); entry.PiPTexture = null; } if ((Object)(object)entry.PiPCameraGo != (Object)null) { Object.Destroy((Object)(object)entry.PiPCameraGo); entry.PiPCameraGo = null; } } private static void CleanupEntry(WarningEntry entry) { DestroyPiPCamera(entry); if ((Object)(object)entry.ParticleInstance != (Object)null) { Object.Destroy((Object)(object)entry.ParticleInstance); entry.ParticleInstance = null; } } private void DrawBanner(Rect rect, string text) { //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_001b: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.65f); GUI.DrawTexture(rect, (Texture)(object)_solidTex); GUI.color = color; GUI.Label(new Rect(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, _shadowStyle); GUI.Label(rect, text, _bannerStyle); } private void EnsureStyles() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0025: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown if (!_stylesReady) { _solidTex = new Texture2D(1, 1); _solidTex.SetPixel(0, 0, Color.white); _solidTex.Apply(); GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val.normal.textColor = new Color(1f, 0.9f, 0.1f, 1f); _bannerStyle = val; GUIStyle val2 = new GUIStyle(_bannerStyle); val2.normal.textColor = new Color(0f, 0f, 0f, 0.85f); _shadowStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1 }; val3.normal.textColor = new Color(1f, 0.9f, 0.1f, 1f); _pipLabelStyle = val3; _stylesReady = true; } } } public class JetpackOverlay : MonoBehaviour { private Texture2D _barBgTexture; private Texture2D _barFillTexture; private int _cachedBarW = -1; private static readonly Color FillColor = new Color(1f, 0.55f, 0.05f, 0.9f); private static readonly Color BgColor = new Color(0f, 0f, 0f, 0.55f); private GUIStyle _labelStyle; public static JetpackOverlay Instance { get; private set; } public static bool IsEquippedLocally { get; private set; } public static void OnLocalEquip() { IsEquippedLocally = true; } public static void OnLocalUnequip() { IsEquippedLocally = false; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; IsEquippedLocally = false; } DestroyBarTextures(); } private void OnGUI() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0127: Expected O, but got Unknown if (!IsEquippedLocally) { return; } int num = (int)EffectBarLayout.GetBarWidth(); if (num != _cachedBarW) { RebuildBarTextures(num); } if (!((Object)(object)_barBgTexture == (Object)null) && !((Object)(object)_barFillTexture == (Object)null)) { float fuelFraction = JetpackItem.FuelFraction; float barWidth = EffectBarLayout.GetBarWidth(); float num2 = 28f; float barX = EffectBarLayout.GetBarX(); int slot = (FreezeItem.IsFrozen ? 1 : 0) + (LowGravityItem.IsActive ? 1 : 0) + (WindStormOverlay.IsActive ? 1 : 0); float barY = EffectBarLayout.GetBarY(slot); GUI.DrawTexture(new Rect(barX, barY, barWidth, num2), (Texture)(object)_barBgTexture); GUI.BeginGroup(new Rect(barX, barY, barWidth * fuelFraction, num2)); GUI.DrawTexture(new Rect(0f, 0f, barWidth, num2), (Texture)(object)_barFillTexture); GUI.EndGroup(); if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; } _labelStyle.normal.textColor = Color.white; string text = $"Jetpack Fuel Remaining {fuelFraction * ModConfig.Jetpack.FuelPerUse.Value:F1}s"; GUI.Label(new Rect(barX, barY, barWidth, num2), text, _labelStyle); } } private void RebuildBarTextures(int barW) { //IL_0013: 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) DestroyBarTextures(); int num = 28; int radius = num / 3; _barBgTexture = GenerateRoundedRectTexture(barW, num, radius, BgColor); _barFillTexture = GenerateRoundedRectTexture(barW, num, radius, FillColor); _cachedBarW = barW; } private void DestroyBarTextures() { if ((Object)(object)_barBgTexture != (Object)null) { Object.Destroy((Object)(object)_barBgTexture); _barBgTexture = null; } if ((Object)(object)_barFillTexture != (Object)null) { Object.Destroy((Object)(object)_barFillTexture); _barFillTexture = null; } _cachedBarW = -1; } private static Texture2D GenerateRoundedRectTexture(int w, int h, int radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { array[i * w + j] = (IsInsideRoundedRect(j, i, w, h, radius) ? color : Color.clear); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static bool IsInsideRoundedRect(int x, int y, int w, int h, int r) { bool flag = x < r; bool flag2 = x >= w - r; bool flag3 = y < r; bool flag4 = y >= h - r; if (!(flag || flag2) || !(flag3 || flag4)) { return true; } int num = (flag ? r : (w - 1 - r)); int num2 = (flag3 ? r : (h - 1 - r)); float num3 = x - num; float num4 = y - num2; return num3 * num3 + num4 * num4 <= (float)(r * r); } } public class LowGravityOverlay : MonoBehaviour { private bool _active; private float _startTime; private float _duration; private Texture2D _vignetteTexture; private Texture2D _barBgTexture; private Texture2D _barFillTexture; private int _cachedBarW = -1; private static readonly Color FillColor = new Color(0.5f, 0.15f, 0.9f, 0.9f); private static readonly Color BgColor = new Color(0f, 0f, 0f, 0.55f); private GUIStyle _labelStyle; public static LowGravityOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } DestroyBarTextures(); if ((Object)(object)_vignetteTexture != (Object)null) { Object.Destroy((Object)(object)_vignetteTexture); } } private void Start() { _vignetteTexture = GenerateVignetteTexture(256, 256); } public void SetActive(bool active, float duration = 0f) { _active = active; if (active) { _duration = duration; _startTime = Time.time; } } private void OnGUI() { //IL_003d: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown if (!_active) { return; } if ((Object)(object)_vignetteTexture != (Object)null) { GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_vignetteTexture, (ScaleMode)0); } if (_duration <= 0f) { return; } int num = (int)EffectBarLayout.GetBarWidth(); if (num != _cachedBarW) { RebuildBarTextures(num); } if (!((Object)(object)_barBgTexture == (Object)null) && !((Object)(object)_barFillTexture == (Object)null)) { float num2 = Time.time - _startTime; float num3 = Mathf.Clamp01(1f - num2 / _duration); float num4 = Mathf.Max(0f, _duration - num2); float barWidth = EffectBarLayout.GetBarWidth(); float num5 = 28f; float barX = EffectBarLayout.GetBarX(); int slot = (FreezeItem.IsFrozen ? 1 : 0); float barY = EffectBarLayout.GetBarY(slot); GUI.DrawTexture(new Rect(barX, barY, barWidth, num5), (Texture)(object)_barBgTexture); GUI.BeginGroup(new Rect(barX, barY, barWidth * num3, num5)); GUI.DrawTexture(new Rect(0f, 0f, barWidth, num5), (Texture)(object)_barFillTexture); GUI.EndGroup(); if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; } _labelStyle.normal.textColor = Color.white; GUI.Label(new Rect(barX, barY, barWidth, num5), $"Low Gravity Time Remaining: {num4:F1}s", _labelStyle); } } private void RebuildBarTextures(int barW) { //IL_0013: 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) DestroyBarTextures(); int num = 28; int radius = num / 3; _barBgTexture = GenerateRoundedRectTexture(barW, num, radius, BgColor); _barFillTexture = GenerateRoundedRectTexture(barW, num, radius, FillColor); _cachedBarW = barW; } private void DestroyBarTextures() { if ((Object)(object)_barBgTexture != (Object)null) { Object.Destroy((Object)(object)_barBgTexture); _barBgTexture = null; } if ((Object)(object)_barFillTexture != (Object)null) { Object.Destroy((Object)(object)_barFillTexture); _barFillTexture = null; } _cachedBarW = -1; } private static Texture2D GenerateRoundedRectTexture(int w, int h, int radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { array[i * w + j] = (IsInsideRoundedRect(j, i, w, h, radius) ? color : Color.clear); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static bool IsInsideRoundedRect(int x, int y, int w, int h, int r) { bool flag = x < r; bool flag2 = x >= w - r; bool flag3 = y < r; bool flag4 = y >= h - r; if (!(flag || flag2) || !(flag3 || flag4)) { return true; } int num = (flag ? r : (w - 1 - r)); int num2 = (flag3 ? r : (h - 1 - r)); float num3 = x - num; float num4 = y - num2; return num3 * num3 + num4 * num4 <= (float)(r * r); } private static Texture2D GenerateVignetteTexture(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); float num = (float)w * 0.5f; float num2 = (float)h * 0.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num2) * ((float)i - num2)) / num3; float num5 = Mathf.Pow(Mathf.Clamp01(num4), 0.6f) * 0.55f; array[i * w + j] = new Color(0.35f, 0.1f, 0.8f, num5); } } val.SetPixels(array); val.Apply(); return val; } } public class PlayerBoxOverlay : MonoBehaviour { private static Texture2D _redTex; private static Texture2D _greenTex; private const float BoxWidth = 40f; private const float BoxHeight = 56f; private const float BorderThickness = 2f; private static string[] _playerNames = new string[20] { "Lucy", "Charlie", "Daisy", "Ethan", "Fiona", "Harry", "Isabella", "Jack", "Kate", "Liam", "Mia", "Noah", "Olivia", "Patrick", "Quinn", "Ryan", "Bob", "Tony", "Ashley", "George" }; private AC130NetworkBridge _localAC130Bridge; private MissileNetworkBridge _localMissileBridge; private PlayerInfo _cachedLocalPlayerInfo; private string _localPlayerLabel; private AC130NetworkBridge LocalAC130Bridge { get { if ((Object)(object)_localAC130Bridge != (Object)null) { return _localAC130Bridge; } PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { _localAC130Bridge = ((Component)localPlayerMovement).GetComponent(); } return _localAC130Bridge; } } private MissileNetworkBridge LocalMissileBridge { get { if ((Object)(object)_localMissileBridge != (Object)null) { return _localMissileBridge; } PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { _localMissileBridge = ((Component)localPlayerMovement).GetComponent(); } return _localMissileBridge; } } private bool ShouldShowGUI() { return StealthBomberItem.IsTargeting || ((Object)(object)LocalMissileBridge != (Object)null && LocalMissileBridge.IsSteering) || ((Object)(object)LocalAC130Bridge != (Object)null && (LocalAC130Bridge.LocalSessionActive || LocalAC130Bridge.LocalMaydayActive)); } private void OnGUI() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) if (!ShouldShowGUI()) { return; } AC130NetworkBridge localAC130Bridge = LocalAC130Bridge; Camera val = (((Object)(object)localAC130Bridge != (Object)null && localAC130Bridge.LocalSessionActive) ? (localAC130Bridge.LocalGunshipCamera ?? GameManager.Camera) : GameManager.Camera); if ((Object)(object)val == (Object)null) { return; } EnsureTextures(); float screenH = Screen.height; PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { if ((Object)(object)localPlayerInfo != (Object)(object)_cachedLocalPlayerInfo) { _cachedLocalPlayerInfo = localPlayerInfo; _localPlayerLabel = localPlayerInfo.PlayerId.PlayerName + " (YOU)"; } DrawTargetBox(val, ((Component)localPlayerInfo).transform.position + Vector3.up * 1f, screenH, _greenTex); DrawTargetName(val, ((Component)localPlayerInfo).transform.position + Vector3.up * 1f, screenH, _localPlayerLabel); } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (!((Object)(object)item == (Object)null)) { DrawTargetBox(val, ((Component)item).transform.position + Vector3.up * 1f, screenH, _redTex); DrawTargetName(val, ((Component)item).transform.position + Vector3.up * 1f, screenH, item.PlayerId.PlayerName); } } } for (int i = 0; i < DebugDummies.DebugDummiesList.Count; i++) { GameObject val2 = DebugDummies.DebugDummiesList[i]; if (!((Object)(object)val2 == (Object)null)) { DrawTargetBox(val, val2.transform.position + Vector3.up * 1f, screenH, _redTex); DrawTargetName(val, val2.transform.position + Vector3.up * 1f, screenH, _playerNames[i % _playerNames.Length]); } } } private static void EnsureTextures() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0024: 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_0057: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_redTex == (Object)null) { _redTex = new Texture2D(1, 1); _redTex.SetPixel(0, 0, Color.red); _redTex.Apply(); } if ((Object)(object)_greenTex == (Object)null) { _greenTex = new Texture2D(1, 1); _greenTex.SetPixel(0, 0, Color.green); _greenTex.Apply(); } } private static void DrawTargetName(Camera cam, Vector3 worldPos, float screenH, string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001f: 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_004d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cam.WorldToScreenPoint(worldPos); if (!(val.z <= 0f)) { float num = val.x - 20f; float num2 = screenH - val.y - 28f; GUI.Label(new Rect(num, num2 - 20f, 160f, 24f), name); } } private static void DrawTargetBox(Camera cam, Vector3 worldPos, float screenH, Texture2D tex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_006a: 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_009a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cam.WorldToScreenPoint(worldPos); if (!(val.z <= 0f)) { float num = val.x - 20f; float num2 = screenH - val.y - 28f; float num3 = 2f; GUI.DrawTexture(new Rect(num, num2, 40f, num3), (Texture)(object)tex); GUI.DrawTexture(new Rect(num, num2 + 56f - num3, 40f, num3), (Texture)(object)tex); GUI.DrawTexture(new Rect(num, num2, num3, 56f), (Texture)(object)tex); GUI.DrawTexture(new Rect(num + 40f - num3, num2, num3, 56f), (Texture)(object)tex); } } } public class RocketTetherOverlay : MonoBehaviour { private GUIStyle _titleStyle; private GUIStyle _instructionStyle; private GUIStyle _labelStyle; private GUIStyle _timerStyle; private float _sw; private float _sh; private float _time; private bool _sessionActive; private TetherSessionState _activeSession; private bool _hasTarget; private bool _aimingIn; private Vector3 _targetScreenPos; private float _busyUntil; public NetworkIdentity BestTargetIdentity { get; private set; } public static RocketTetherOverlay Instance { get; private set; } private void OnEnable() { Instance = this; } private void OnDisable() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (!((Object)(object)localPlayerInfo == (Object)null) && !((Object)(object)localPlayerInfo.Inventory == (Object)null)) { _sw = Screen.width; _sh = Screen.height; _time = Time.time; NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); _sessionActive = num != 0 && RocketTetherClientLogic.TryGetSessionForVictim(num, out _activeSession); if (_sessionActive) { _hasTarget = false; } else { UpdateLockOnTarget(); } } } private void UpdateLockOnTarget() { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0141: Unknown result type (might be due to invalid IL or missing references) _hasTarget = false; BestTargetIdentity = null; PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory == (Object)null || localPlayerInventory.GetEffectivelyEquippedItem(true) != ItemRegistry.RocketTetherItemType) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } float num = Mathf.Cos(ModConfig.RocketTether.LockOnConeAngleDeg.Value * 0.5f * (MathF.PI / 180f)); float num2 = ModConfig.RocketTether.LockOnRange.Value * ModConfig.RocketTether.LockOnRange.Value; Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; float num3 = -1f; Transform val = null; NetworkIdentity bestTargetIdentity = null; List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if ((Object)(object)item == (Object)null) { continue; } NetworkIdentity component = ((Component)item).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } Vector3 val2 = ((Component)item).transform.position - position; if (!(((Vector3)(ref val2)).sqrMagnitude > num2)) { float num4 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized); if (!(num4 < num) && !(num4 <= num3)) { num3 = num4; val = ((Component)item).transform; bestTargetIdentity = component; } } } } if (!((Object)(object)val == (Object)null)) { BestTargetIdentity = bestTargetIdentity; Vector3 val3 = main.WorldToScreenPoint(val.position); if (!(val3.z <= 0f)) { _targetScreenPos = new Vector3(val3.x, _sh - val3.y, 0f); _hasTarget = true; } } } private void OnGUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0048: 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 ((int)Event.current.type != 7) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null || (Object)(object)localPlayerInfo.Inventory == (Object)null || (localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.RocketTetherItemType && !_sessionActive) || _sw <= 0f || _sh <= 0f) { return; } EnsureStyles(); if (_sessionActive) { DrawActiveHUD(); } else if (_time < _busyUntil) { DrawBusyMessage(); } else if (_hasTarget) { DrawLockOnReticle(); } if (Mouse.current == null || !Mouse.current.rightButton.isPressed) { if (_aimingIn) { FixLookRotationAfterScope(); } _aimingIn = false; } else { _aimingIn = true; CorrectAimRotation(); } } public void ShowBusy() { _busyUntil = Time.time + 2.5f; } private void DrawBusyMessage() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) float num = _sh - 12f - 42f; _instructionStyle.normal.textColor = new Color(1f, 0.5f, 0.1f, 0.9f); GUI.Label(new Rect(0f, num, _sw, 42f), "ROCKET TETHER LINKER ALREADY IN USE", _instructionStyle); _instructionStyle.normal.textColor = Color.white; } private void DrawActiveHUD() { //IL_0083: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0185: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0255: 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_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) float num = _activeSession?.Duration ?? 0f; float num2 = _time - (_activeSession?.StartTime ?? _time); float num3 = Mathf.Max(0f, num - num2); bool flag = num3 <= 3f; Color c = (flag ? new Color(1f, 0.25f, 0.25f, 0.9f) : new Color(1f, 0.55f, 0.1f, 0.9f)); float num4 = 50f; float thick = 3f; DrawCornerBracket(0f, 0f, num4, thick, leftSide: true, topSide: true, c); DrawCornerBracket(_sw - num4, 0f, num4, thick, leftSide: false, topSide: true, c); DrawCornerBracket(0f, _sh - num4, num4, thick, leftSide: true, topSide: false, c); DrawCornerBracket(_sw - num4, _sh - num4, num4, thick, leftSide: false, topSide: false, c); float num5 = _sh - 12f - 10f; float num6 = num5 - 10f - 42f; _titleStyle.normal.textColor = (flag ? new Color(1f, 0.25f, 0.25f, 0.7f + 0.3f * Mathf.Sin(_time * 6f)) : new Color(1f, 0.55f, 0.1f, 0.9f)); GUI.Label(new Rect(0f, num6, _sw, 42f), "TETHERED TO ROCKET", _titleStyle); float num7 = 280f; float num8 = (_sw - num7) * 0.5f; float num9 = ((num > 0f) ? Mathf.Clamp01(num3 / num) : 0f); GUI.color = new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(new Rect(num8, num5, num7, 10f), (Texture)(object)Texture2D.whiteTexture); Color color = (flag ? new Color(1f, 0.3f, 0.3f, 0.85f) : new Color(1f, 0.55f, 0.1f, 0.85f)); GUI.color = color; GUI.DrawTexture(new Rect(num8, num5, num7 * num9, 10f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; _timerStyle.normal.textColor = (flag ? new Color(1f, 0.3f, 0.3f, 0.9f) : new Color(1f, 0.55f, 0.1f, 0.9f)); GUI.Label(new Rect(num8 + num7 + 8f, num5 - 14f, 80f, 38f), $"{num3:F1}s", _timerStyle); } private void DrawLockOnReticle() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) if (!_aimingIn) { return; } float x = _targetScreenPos.x; float y = _targetScreenPos.y; float num = 24f; float num2 = 36f; float num3 = 4f; Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.55f, 0.1f, 0.85f); GUI.color = val; float num4 = num; float num5 = num2 - num; GUI.DrawTexture(new Rect(x - num2, y - num3 * 0.5f, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x + num4, y - num3 * 0.5f, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num3 * 0.5f, y - num2, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num3 * 0.5f, y + num4, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 2f, y - 2f, 4f, 4f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; _labelStyle.normal.textColor = val; string text = "LOCK ON"; if ((Object)(object)BestTargetIdentity != (Object)null) { PlayerInfo componentInParent = ((Component)BestTargetIdentity).GetComponentInParent(); object obj; if (componentInParent == null) { obj = null; } else { PlayerId playerId = componentInParent.PlayerId; obj = ((playerId != null) ? playerId.PlayerName : null); } string text2 = (string)obj; if (!string.IsNullOrEmpty(text2)) { text = "LOCK ON\n" + text2; } } GUI.Label(new Rect(x - 200f, y + num2 + 4f, 400f, 76f), text, _labelStyle); } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide, Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_004f: Unknown result type (might be due to invalid IL or missing references) GUI.color = c; float num = (leftSide ? x : (x + size - thick)); GUI.DrawTexture(new Rect(num, y, thick, size), (Texture)(object)Texture2D.whiteTexture); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(x, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void CorrectAimRotation() { //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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Movement : null) == (Object)null) { return; } Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (!(((Vector3)(ref forward)).sqrMagnitude < 0.01f)) { ((Component)localPlayerInfo.Movement).transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized) * Quaternion.Euler(0f, 65f, 0f); } } } private void FixLookRotationAfterScope() { //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_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) if (!((Object)(object)Camera.main != (Object)null)) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (localPlayerInfo != null) { PlayerMovement movement = localPlayerInfo.Movement; if (movement != null) { Transform transform = ((Component)movement).transform; Vector3 forward = ((Component)Camera.main).transform.forward; transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized); } } } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_011e: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) if (_titleStyle == null) { _titleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _titleStyle.normal.textColor = new Color(1f, 0.55f, 0.1f, 0.9f); } if (_instructionStyle == null) { _instructionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _instructionStyle.normal.textColor = Color.white; } if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 28, fontStyle = (FontStyle)1, wordWrap = false }; _labelStyle.normal.textColor = new Color(1f, 0.55f, 0.1f, 0.85f); } if (_timerStyle == null) { _timerStyle = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1 }; _timerStyle.normal.textColor = new Color(1f, 0.55f, 0.1f, 0.9f); } } } public class PoisonOverlay : MonoBehaviour { private bool _manualActive; private float _poisonEndTime = -1f; private bool _wasActive; private bool _isActive; private float _time; private Camera _mainCam; private float _baseFov; private float _baseRollZ; private bool _camStateStored; private Texture2D _vignetteTex; private Texture2D _tintTex; private Camera _ghostCam; private RenderTexture _ghostTex; private int _ghostTexW; private int _ghostTexH; private const Key ToggleKey = (Key)24; public static PoisonOverlay Instance { get; private set; } private bool IsActive => _manualActive || Time.realtimeSinceStartup < _poisonEndTime; private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } RestoreCamera(); DestroyGhostCamera(); if ((Object)(object)_vignetteTex != (Object)null) { Object.Destroy((Object)(object)_vignetteTex); } if ((Object)(object)_tintTex != (Object)null) { Object.Destroy((Object)(object)_tintTex); } } public void ActivatePoison(float duration) { float num = Time.realtimeSinceStartup + duration; if (num > _poisonEndTime) { _poisonEndTime = num; } } private void Update() { Keyboard current = Keyboard.current; if (current != null && ((ButtonControl)current[(Key)24]).wasPressedThisFrame) { _manualActive = !_manualActive; } _isActive = IsActive; if (_isActive && !_wasActive) { _time = 0f; _camStateStored = false; } else if (!_isActive && _wasActive) { RestoreCamera(); DestroyGhostCamera(); } _wasActive = _isActive; if (_isActive) { _time += Time.deltaTime; } } private void LateUpdate() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) if (!_isActive) { return; } if (!_camStateStored) { _mainCam = Camera.main; if ((Object)(object)_mainCam == (Object)null) { return; } _baseFov = _mainCam.fieldOfView; _baseRollZ = ((Component)_mainCam).transform.eulerAngles.z; _camStateStored = true; } Camera mainCam = _mainCam; if (!((Object)(object)mainCam == (Object)null)) { float z = _baseRollZ + Mathf.Sin(_time * ModConfig.PoisonJar.RollFreq1.Value) * ModConfig.PoisonJar.RollAmp1.Value + Mathf.Sin(_time * ModConfig.PoisonJar.RollFreq2.Value) * ModConfig.PoisonJar.RollAmp2.Value + Mathf.Sin(_time * ModConfig.PoisonJar.RollFreq3.Value) * ModConfig.PoisonJar.RollAmp3.Value; Vector3 eulerAngles = ((Component)mainCam).transform.eulerAngles; eulerAngles.z = z; if (ModConfig.PoisonJar.AimNoiseEnabled.Value) { eulerAngles.y += Mathf.Sin(_time * ModConfig.PoisonJar.AimNoiseYawFreq.Value) * ModConfig.PoisonJar.AimNoiseYawAmp.Value; eulerAngles.x += Mathf.Sin(_time * ModConfig.PoisonJar.AimNoisePitchFreq.Value + 1.3f) * ModConfig.PoisonJar.AimNoisePitchAmp.Value; } ((Component)mainCam).transform.eulerAngles = eulerAngles; float num = Mathf.Sin(_time * ModConfig.PoisonJar.FovFreq1.Value) * ModConfig.PoisonJar.FovAmp1.Value + Mathf.Sin(_time * ModConfig.PoisonJar.FovFreq2.Value) * ModConfig.PoisonJar.FovAmp2.Value; mainCam.fieldOfView = _baseFov + num; if (ModConfig.PoisonJar.GhostEnabled.Value) { EnsureGhostCamera(mainCam); ((Component)_ghostCam).transform.SetPositionAndRotation(((Component)mainCam).transform.position, ((Component)mainCam).transform.rotation); _ghostCam.fieldOfView = mainCam.fieldOfView; _ghostCam.cullingMask = mainCam.cullingMask; _ghostCam.nearClipPlane = mainCam.nearClipPlane; _ghostCam.farClipPlane = mainCam.farClipPlane; _ghostCam.Render(); } } } private void RestoreCamera() { //IL_0028: 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_0041: Unknown result type (might be due to invalid IL or missing references) if (_camStateStored) { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Vector3 eulerAngles = ((Component)main).transform.eulerAngles; eulerAngles.z = _baseRollZ; ((Component)main).transform.eulerAngles = eulerAngles; main.fieldOfView = _baseFov; } _mainCam = null; _camStateStored = false; } } private void OnGUI() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) if (_isActive) { float num = Screen.width; float num2 = Screen.height; EnsureTextures(); if (ModConfig.PoisonJar.GhostEnabled.Value && (Object)(object)_ghostTex != (Object)null) { float num3 = ModConfig.PoisonJar.GhostOffsetX.Value * num; float num4 = ModConfig.PoisonJar.GhostOffsetY.Value * num2; GUI.color = new Color(1f, 1f, 1f, ModConfig.PoisonJar.GhostAlpha.Value); GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)_ghostTex); GUI.color = Color.white; } if ((Object)(object)_tintTex != (Object)null) { float num5 = ModConfig.PoisonJar.TintBaseAlpha.Value + ModConfig.PoisonJar.TintPulseAmp.Value * Mathf.Sin(_time * ModConfig.PoisonJar.TintPulseFreq.Value); GUI.color = new Color(1f, 1f, 1f, num5); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_tintTex); GUI.color = Color.white; } if ((Object)(object)_vignetteTex != (Object)null) { float num6 = ModConfig.PoisonJar.VigBaseAlpha.Value + ModConfig.PoisonJar.VigPulseAmp1.Value * Mathf.Sin(_time * ModConfig.PoisonJar.VigPulseFreq1.Value) + ModConfig.PoisonJar.VigPulseAmp2.Value * Mathf.Sin(_time * ModConfig.PoisonJar.VigPulseFreq2.Value); GUI.color = new Color(1f, 1f, 1f, num6); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_vignetteTex, (ScaleMode)0); GUI.color = Color.white; } } } private void EnsureGhostCamera(Camera src) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //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_00d7: Expected O, but got Unknown int width = Screen.width; int height = Screen.height; if ((Object)(object)_ghostTex != (Object)null && (_ghostTexW != width || _ghostTexH != height)) { _ghostCam.targetTexture = null; Object.Destroy((Object)(object)_ghostTex); _ghostTex = null; } if ((Object)(object)_ghostTex == (Object)null) { _ghostTex = new RenderTexture(width, height, 24); _ghostTexW = width; _ghostTexH = height; if ((Object)(object)_ghostCam != (Object)null) { _ghostCam.targetTexture = _ghostTex; } } if ((Object)(object)_ghostCam == (Object)null) { GameObject val = new GameObject("PoisonGhostCamera") { hideFlags = (HideFlags)61 }; _ghostCam = val.AddComponent(); ((Behaviour)_ghostCam).enabled = false; _ghostCam.targetTexture = _ghostTex; } } private void DestroyGhostCamera() { if ((Object)(object)_ghostCam != (Object)null) { _ghostCam.targetTexture = null; Object.Destroy((Object)(object)((Component)_ghostCam).gameObject); _ghostCam = null; } if ((Object)(object)_ghostTex != (Object)null) { Object.Destroy((Object)(object)_ghostTex); _ghostTex = null; } } private void EnsureTextures() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_tintTex == (Object)null) { _tintTex = new Texture2D(1, 1); _tintTex.SetPixel(0, 0, new Color(0.9f, 0.5f, 0.1f, 1f)); _tintTex.Apply(); } if ((Object)(object)_vignetteTex == (Object)null) { _vignetteTex = GenerateGreenVignette(128, 128); } } private static Texture2D GenerateGreenVignette(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); float num = (float)w / 2f; float num2 = (float)h / 2f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num2) * ((float)i - num2)) / num3; float num5 = Mathf.Pow(Mathf.Clamp01(num4), 1.4f) * 0.8f; array[i * w + j] = new Color(0.35f, 0.85f, 0.05f, num5); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } } public class PositionSwapOverlay : MonoBehaviour { private bool _isChooserOpen; private bool _isPendingSwap; private float _pendingCountdown; private string _cancelNotification; private float _cancelNotificationTimer; private readonly List _cachedPlayers = new List(); private const float PanelWidth = 500f; private const float RowHeight = 42f; private const float HeaderH = 48f; private const float TipH = 22f; private const float Padding = 14f; private const float ButtonW = 84f; private const float ButtonH = 30f; private bool _areStylesReady; private Texture2D _panelBgTex; private Texture2D _swapOnTex; private Texture2D _swapHovTex; private Texture2D _cancelBgTex; private Texture2D _cancelHovTex; private GUIStyle _panelStyle; private GUIStyle _titleStyle; private GUIStyle _tipStyle; private GUIStyle _rowStyle; private GUIStyle _subStyle; private GUIStyle _swapBtnStyle; private GUIStyle _cancelStyle; private GUIStyle _countdownStyle; private GUIStyle _notifStyle; public static PositionSwapOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } Object.Destroy((Object)(object)_panelBgTex); Object.Destroy((Object)(object)_swapOnTex); Object.Destroy((Object)(object)_swapHovTex); Object.Destroy((Object)(object)_cancelBgTex); Object.Destroy((Object)(object)_cancelHovTex); } private void Update() { if (_isPendingSwap) { _pendingCountdown -= Time.deltaTime; if (_pendingCountdown < 0f) { _pendingCountdown = 0f; } } if (_cancelNotificationTimer > 0f) { _cancelNotificationTimer -= Time.deltaTime; if (_cancelNotificationTimer <= 0f) { _cancelNotification = null; } } } public void OpenChooser() { _isChooserOpen = true; _isPendingSwap = false; RefreshPlayerList(); } private void RefreshPlayerList() { _cachedPlayers.Clear(); List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { _cachedPlayers.AddRange(remotePlayers); } } public void OnSwapWarning(uint initiatorNetId, uint targetNetId, float delay) { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; NetworkIdentity val = ((localPlayerInfo != null) ? ((Component)localPlayerInfo).GetComponent() : null); if ((Object)(object)val != (Object)null && val.netId == initiatorNetId) { _isChooserOpen = false; _isPendingSwap = true; _pendingCountdown = delay; } } public void OnSwapExecuted(uint initiatorNetId, uint targetNetId) { _isChooserOpen = false; _isPendingSwap = false; } public void ForceClose() { _isChooserOpen = false; _isPendingSwap = false; } public void OnSwapCancelled(uint initiatorNetId, PositionSwapCancelReason reason) { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; NetworkIdentity val = ((localPlayerInfo != null) ? ((Component)localPlayerInfo).GetComponent() : null); if (!((Object)(object)val == (Object)null) && val.netId == initiatorNetId) { _isChooserOpen = false; _isPendingSwap = false; if (reason == PositionSwapCancelReason.PlayerEnteredGolfCart) { _cancelNotification = "Swap cancelled — user or arget got in a golf cart"; _cancelNotificationTimer = 3f; } } } private void OnGUI() { EnsureStyles(); if (_isChooserOpen || _isPendingSwap) { if (_isPendingSwap) { DrawCountdown(); } else { DrawChooser(); } } if (_cancelNotification != null) { DrawCancelNotification(); } } private void DrawChooser() { //IL_005e: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_02bc: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(1, _cachedPlayers.Count); float num2 = 84f + 42f * (float)num + 14f + 30f + 14f; float num3 = ((float)Screen.width - 500f) * 0.5f; float num4 = ((float)Screen.height - num2) * 0.5f; GUI.Box(new Rect(num3, num4, 500f, num2), GUIContent.none, _panelStyle); float num5 = num4 + 7f; GUI.Label(new Rect(num3, num5, 500f, 48f), "Position Swap — Choose Target", _titleStyle); num5 += 48f; GUI.Label(new Rect(num3, num5, 500f, 22f), "Select a player to swap positions with (pause for a cursor)", _tipStyle); num5 += 36f; if (_cachedPlayers.Count == 0) { GUI.Label(new Rect(num3 + 14f, num5, 472f, 42f), "No other players in the session.", _rowStyle); num5 += 42f; } else { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; Vector3 val = ((localPlayerInfo != null) ? ((Component)localPlayerInfo).transform.position : Vector3.zero); GolfHole mainHole = GolfHoleManager.MainHole; Vector3? val2 = ((mainHole != null) ? new Vector3?(((Component)mainHole).transform.position) : ((Vector3?)null)); float num6 = 380f; foreach (PlayerInfo cachedPlayer in _cachedPlayers) { GolfCartSeat activeGolfCartSeat = cachedPlayer.ActiveGolfCartSeat; bool flag = ((GolfCartSeat)(ref activeGolfCartSeat)).IsValid(); float num7 = Vector3.Distance(val, ((Component)cachedPlayer).transform.position); string playerName = cachedPlayer.PlayerId.PlayerName; string text; if (flag) { text = $"{Mathf.RoundToInt(num7)}m away · In a golf cart"; } else { string arg = (val2.HasValue ? $"{Mathf.RoundToInt(Vector3.Distance(val2.Value, ((Component)cachedPlayer).transform.position))}m to hole" : "? to hole"); text = $"{Mathf.RoundToInt(num7)}m away · {arg}"; } float num8 = num5 + 6f; GUI.Label(new Rect(num3 + 14f, num5, num6, 23.1f), playerName, _rowStyle); GUI.Label(new Rect(num3 + 14f, num5 + 21.84f, num6, 20.16f), text, _subStyle); GUI.enabled = !flag; if (GUI.Button(new Rect(num3 + 14f + num6 + 8f, num8, 84f, 30f), flag ? "In cart" : "SWAP", _swapBtnStyle)) { NetworkIdentity component = ((Component)cachedPlayer).GetComponent(); if ((Object)(object)component != (Object)null) { PositionSwapRequestMessage positionSwapRequestMessage = new PositionSwapRequestMessage { TargetNetId = component.netId }; PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; positionSwapRequestMessage.EquippedSlotIndex = ((localPlayerInventory != null) ? localPlayerInventory.EquippedItemIndex : (-1)); NetworkClient.Send(positionSwapRequestMessage, 0); _isChooserOpen = false; } } GUI.enabled = true; num5 += 42f; } } num5 += 14f; float num9 = 110f; if (GUI.Button(new Rect(num3 + (500f - num9) * 0.5f, num5, num9, 30f), "Cancel", _cancelStyle)) { _isChooserOpen = false; } } private void DrawCancelNotification() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) float num = ((float)Screen.width - 420f) * 0.5f; float num2 = (float)Screen.height * 0.12f; float num3 = Mathf.Clamp01(_cancelNotificationTimer); GUI.color = new Color(1f, 1f, 1f, num3); GUI.Box(new Rect(num, num2, 420f, 52f), GUIContent.none, _panelStyle); GUI.Label(new Rect(num, num2, 420f, 52f), _cancelNotification, _notifStyle); GUI.color = Color.white; } private void DrawCountdown() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) float num = ((float)Screen.width - 360f) * 0.5f; float num2 = (float)Screen.height * 0.18f; GUI.Box(new Rect(num, num2, 360f, 76f), GUIContent.none, _panelStyle); string text = ((_pendingCountdown > 0.05f) ? $"Swapping in {_pendingCountdown:F1}s..." : "Swapping!"); GUI.Label(new Rect(num, num2, 360f, 76f), text, _countdownStyle); } private void EnsureStyles() { //IL_002c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0131: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //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_01cf: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0207: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: 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_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Expected O, but got Unknown if (!_areStylesReady) { _areStylesReady = true; _panelBgTex = Tex(new Color(0.06f, 0.06f, 0.16f, 0.93f)); _swapOnTex = Tex(new Color(0.15f, 0.5f, 0.9f, 1f)); _swapHovTex = Tex(new Color(0.25f, 0.65f, 1f, 1f)); _cancelBgTex = Tex(new Color(0.4f, 0.1f, 0.1f, 1f)); _cancelHovTex = Tex(new Color(0.6f, 0.15f, 0.15f, 1f)); GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = _panelBgTex; _panelStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 21, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val2.normal.textColor = Color.white; _titleStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 15, alignment = (TextAnchor)4 }; val3.normal.textColor = new Color(0.6f, 0.6f, 0.6f); _tipStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)6 }; val4.normal.textColor = Color.white; _rowStyle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.label) { fontSize = 15, alignment = (TextAnchor)0 }; val5.normal.textColor = new Color(0.65f, 0.75f, 0.95f); _subStyle = val5; GUIStyle val6 = new GUIStyle(GUI.skin.button) { fontSize = 15, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val6.normal.background = _swapOnTex; val6.normal.textColor = Color.white; val6.hover.background = _swapHovTex; val6.hover.textColor = Color.white; _swapBtnStyle = val6; GUIStyle val7 = new GUIStyle(GUI.skin.button) { fontSize = 15, alignment = (TextAnchor)4 }; val7.normal.background = _cancelBgTex; val7.normal.textColor = Color.white; val7.hover.background = _cancelHovTex; val7.hover.textColor = Color.white; _cancelStyle = val7; GUIStyle val8 = new GUIStyle(GUI.skin.label) { fontSize = 22, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val8.normal.textColor = new Color(1f, 0.9f, 0.3f); _countdownStyle = val8; GUIStyle val9 = new GUIStyle(GUI.skin.label) { fontSize = 17, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val9.normal.textColor = new Color(1f, 0.55f, 0.2f); _notifStyle = val9; } } private static Texture2D Tex(Color col) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, col); val.Apply(); return val; } } public class SniperScopeOverlay : MonoBehaviour { private OrbitCameraModule _orbitModule; private float _savedBaseFov; private bool _fovSaved; private float _currentFovOffset; private bool _prevScoped; private float _targetZoomFov; private Texture2D _solidTex; public static SniperScopeOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } RestoreFov(); if ((Object)(object)_solidTex != (Object)null) { Object.Destroy((Object)(object)_solidTex); } } private void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) _solidTex = new Texture2D(1, 1, (TextureFormat)4, false); _solidTex.SetPixel(0, 0, Color.white); _solidTex.Apply(); } private void LateUpdate() { if (SniperRifleItem.IsScoped) { CorrectAimRotation(); } } private void CorrectAimRotation() { //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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Movement : null) == (Object)null) { return; } Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (!(((Vector3)(ref forward)).sqrMagnitude < 0.01f)) { ((Component)localPlayerInfo.Movement).transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized) * Quaternion.Euler(0f, 5f, 0f); } } } private void FixLookRotationAfterScope() { //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_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) if (!((Object)(object)Camera.main != (Object)null)) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (localPlayerInfo != null) { PlayerMovement movement = localPlayerInfo.Movement; if (movement != null) { Transform transform = ((Component)movement).transform; Vector3 forward = ((Component)Camera.main).transform.forward; transform.rotation = Quaternion.LookRotation(((Vector3)(ref forward)).normalized); } } } private void Update() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; bool flag = (Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Inventory : null) != (Object)null && localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.SniperRifleItemType; int num; if (flag) { Mouse current = Mouse.current; num = ((current != null && current.rightButton.isPressed) ? 1 : 0); } else { num = 0; } bool flag2 = (byte)num != 0; SniperRifleItem.IsScoped = flag2; if (flag && flag2 && !_prevScoped) { PlayerMovement movement = localPlayerInfo.Movement; Vector3 val = (Vector3)((movement != null) ? ((Component)movement).transform.eulerAngles : default(Vector3)); Camera main = Camera.main; Vector3 val2 = (Vector3)((main != null) ? ((Component)main).transform.eulerAngles : default(Vector3)); localPlayerInfo.PlayerAudio.PlayItemAimForAllClients((ItemType)3); CorrectAimRotation(); } if (flag && !flag2 && _prevScoped) { PlayerMovement movement2 = localPlayerInfo.Movement; Vector3 val3 = (Vector3)((movement2 != null) ? ((Component)movement2).transform.eulerAngles : default(Vector3)); FixLookRotationAfterScope(); } _prevScoped = flag2; if ((Object)(object)_orbitModule == (Object)null) { CameraModuleController.TryGetOrbitModule(ref _orbitModule); } if ((Object)(object)_orbitModule == (Object)null) { return; } if (flag2 && !_fovSaved) { _savedBaseFov = ((CameraModule)_orbitModule).FieldOfView; _targetZoomFov = ModConfig.SniperRifle.ZoomFov.Value; _fovSaved = true; } if (flag2) { Mouse current2 = Mouse.current; float num2 = ((current2 != null) ? ((InputControl)(object)current2.scroll).ReadValue().y : 0f); if (num2 != 0f) { _targetZoomFov -= num2 / 120f * ModConfig.SniperRifle.ScrollSensitivity.Value; _targetZoomFov = Mathf.Clamp(_targetZoomFov, ModConfig.SniperRifle.MinZoomFov.Value, ModConfig.SniperRifle.MaxZoomFov.Value); } } float num3 = (flag2 ? (_targetZoomFov - _savedBaseFov) : 0f); _currentFovOffset = Mathf.Lerp(_currentFovOffset, num3, Time.deltaTime * ModConfig.SniperRifle.ZoomSpeed.Value); _orbitModule.SetFovOffset(_currentFovOffset); if (!flag2 && _fovSaved && Mathf.Abs(_currentFovOffset) < 0.05f) { _orbitModule.SetFovOffset(0f); _fovSaved = false; } } private void OnGUI() { if (SniperRifleItem.IsScoped && !((Object)(object)_solidTex == (Object)null)) { DrawScope(); } } private void DrawRect(float x, float y, float w, float h, Color color) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0042: Unknown result type (might be due to invalid IL or missing references) if (!(w <= 0f) && !(h <= 0f)) { Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(new Rect(x, y, w, h), (Texture)(object)_solidTex); GUI.color = color2; } } private void DrawHLine(float x, float cy, float length, float thick, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) DrawRect(x, cy - thick * 0.5f, length, thick, color); } private void DrawVLine(float cx, float y, float length, float thick, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) DrawRect(cx - thick * 0.5f, y, thick, length, color); } private void DrawDot(float cx, float cy, float r) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) DrawRect(cx - r, cy - r, r * 2f, r * 2f, Color.white); } private void RestoreFov() { if (_fovSaved) { OrbitCameraModule orbitModule = _orbitModule; if (orbitModule != null) { orbitModule.SetFovOffset(0f); } _fovSaved = false; SniperRifleItem.IsScoped = false; } } private void DrawScope() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AssetLoader.SniperScopeTexture != (Object)null) { float num = (float)Mathf.Min(Screen.width, Screen.height) * 0.8f; GUI.DrawTexture(new Rect((float)Screen.width / 2f - num / 2f, (float)Screen.height / 2f - num / 2f, num, num), (Texture)(object)AssetLoader.SniperScopeTexture); return; } float num2 = Screen.width; float num3 = Screen.height; float num4 = num2 * 0.5f; float num5 = num3 * 0.5f; float num6 = num3 * 0.45f; DrawRect(0f, 0f, num4 - num6, num3, Color.black); DrawRect(num4 + num6, 0f, num2 - (num4 + num6), num3, Color.black); DrawRect(num4 - num6, 0f, num6 * 2f, num5 - num6, Color.black); DrawRect(num4 - num6, num5 + num6, num6 * 2f, num3 - (num5 + num6), Color.black); float num7 = num6 * 0.06f; float num8 = num6 * 0.3f; float num9 = Mathf.Max(2f, num2 / 600f); DrawHLine(num4 - num7 - num8, num5, num8, num9 + 2f, Color.black); DrawHLine(num4 + num7, num5, num8, num9 + 2f, Color.black); DrawVLine(num4, num5 - num7 - num8, num8, num9 + 2f, Color.black); DrawVLine(num4, num5 + num7, num8, num9 + 2f, Color.black); DrawHLine(num4 - num7 - num8, num5, num8, num9, Color.white); DrawHLine(num4 + num7, num5, num8, num9, Color.white); DrawVLine(num4, num5 - num7 - num8, num8, num9, Color.white); DrawVLine(num4, num5 + num7, num8, num9, Color.white); float num10 = num7 + num8 * 0.5f; float r = num9 * 1.5f; DrawDot(num4 - num10, num5, r); DrawDot(num4 + num10, num5, r); DrawDot(num4, num5 - num10, r); DrawDot(num4, num5 + num10, r); } } public class SpawnConfigUI : MonoBehaviour { private bool _visible; private bool _workingEnabled; private float _workingRate; private bool[] _workingItemEnabled; private float[,] _workingPoolWeights; private readonly Dictionary _textBuffers = new Dictionary(); private Vector2 _scrollPos; private Rect _windowRect = new Rect(40f, 40f, 1360f, 740f); private static readonly (int pool, string label)[] PoolColumns = new(int, string)[6] { (1, "Lead"), (2, "Beh.50"), (3, "Beh.125"), (4, "Beh.200"), (0, "Ahead"), (5, "Mob.") }; private static readonly (string label, float defaultWeight)[] TierDefs = new(string, float)[5] { ("Common", 15f), ("Uncommon", 10f), ("Rare", 5f), ("Epic", 3f), ("Legendary", 1f) }; private int[] _itemTierIndex; private bool[] _tierExpanded; private GUIStyle _styleHeader; private GUIStyle _styleItemRow; private GUIStyle _styleTierHeader; private GUIStyle _styleIconBox; private GUIStyle _styleReadOnly; private GUIStyle _styleColHeader; private GUIStyle _styleTooltip; private bool _stylesInitialised; public static SpawnConfigUI Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)this); } else { Instance = this; } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current != null && ((ButtonControl)current[ModConfig.Global.SpawnConfigUIKey.Value]).wasPressedThisFrame) { Toggle(); } } public void Toggle() { if (_visible) { Close(); } else { Open(); } } public void Open() { _visible = true; InitWorkingCopy(); IssaPluginPlugin.Log.LogInfo((object)"[SpawnConfigUI] Opened."); } public void Close() { _visible = false; IssaPluginPlugin.Log.LogInfo((object)"[SpawnConfigUI] Closed."); } private void InitWorkingCopy() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) _workingEnabled = ModConfig.Global.CustomItemSpawnsEnabled.Value; _workingRate = ModConfig.Global.CustomItemSpawnRate.Value; IReadOnlyList allItems = ItemRegistry.AllItems; _workingItemEnabled = new bool[allItems.Count]; _workingPoolWeights = new float[allItems.Count, 6]; _textBuffers.Clear(); _textBuffers["rate"] = _workingRate.ToString("F2"); for (int i = 0; i < allItems.Count; i++) { _workingItemEnabled[i] = allItems[i].Enabled; for (int j = 0; j < 6; j++) { _workingPoolWeights[i, j] = ModConfig.GetItemPoolWeight(allItems[i].ItemType, j); _textBuffers[$"{i}_{j}"] = _workingPoolWeights[i, j].ToString("F1"); } } _itemTierIndex = new int[allItems.Count]; for (int k = 0; k < allItems.Count; k++) { _itemTierIndex[k] = GetTierIndex(allItems[k].DefaultPoolWeight); } if (_tierExpanded == null || _tierExpanded.Length != TierDefs.Length) { _tierExpanded = new bool[TierDefs.Length]; for (int l = 0; l < TierDefs.Length; l++) { _tierExpanded[l] = true; } } for (int m = 0; m < TierDefs.Length; m++) { for (int n = 0; n < 6; n++) { float num = TierDefs[m].defaultWeight; for (int num2 = 0; num2 < allItems.Count; num2++) { if (_itemTierIndex[num2] == m) { num = _workingPoolWeights[num2, n]; break; } } _textBuffers[$"t{m}_{n}"] = num.ToString("F1"); } } } private static int GetTierIndex(float defaultWeight) { for (int i = 0; i < TierDefs.Length - 1; i++) { if (defaultWeight >= TierDefs[i].defaultWeight) { return i; } } return TierDefs.Length - 1; } private void ResetToDefaults() { _workingEnabled = true; _workingRate = 0.5f; IReadOnlyList allItems = ItemRegistry.AllItems; _textBuffers["rate"] = _workingRate.ToString("F2"); for (int i = 0; i < allItems.Count; i++) { _workingItemEnabled[i] = true; for (int j = 0; j < 6; j++) { _workingPoolWeights[i, j] = allItems[i].GetDefaultPoolWeight(j); _textBuffers[$"{i}_{j}"] = _workingPoolWeights[i, j].ToString("F1"); } } for (int k = 0; k < TierDefs.Length; k++) { for (int l = 0; l < 6; l++) { float num = TierDefs[k].defaultWeight; for (int m = 0; m < allItems.Count; m++) { if (_itemTierIndex[m] == k) { num = _workingPoolWeights[m, l]; break; } } _textBuffers[$"t{k}_{l}"] = num.ToString("F1"); } } } private void ApplyAndSync() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) ModConfig.Global.CustomItemSpawnsEnabled.Value = _workingEnabled; ModConfig.Global.CustomItemSpawnRate.Value = _workingRate; IReadOnlyList allItems = ItemRegistry.AllItems; for (int i = 0; i < allItems.Count; i++) { ModConfig.SetItemEnabled(allItems[i].ItemType, _workingItemEnabled[i]); for (int j = 0; j < 6; j++) { ModConfig.SetItemPoolWeight(allItems[i].ItemType, j, _workingPoolWeights[i, j]); } } SpawnWeightsSyncer.ForceServerSync(); ItemConfigSyncer.Broadcast(); } private void OnGUI() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0062: 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_007d: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (_visible && _workingItemEnabled != null) { if (!_stylesInitialised) { InitStyles(); } if ((int)Event.current.type == 4 || (int)Event.current.type == 5) { Event.current.Use(); } _windowRect = GUI.Window(829376, _windowRect, new WindowFunction(DrawWindow), ""); } } private void DrawWindow(int id) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_0433: 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_0452: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Expected O, but got Unknown //IL_051e: Unknown result type (might be due to invalid IL or missing references) bool active = NetworkServer.active; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("⚙ Item Spawn Config", _styleHeader, Array.Empty()); GUILayout.FlexibleSpace(); if (!active) { GUILayout.Label(" ⚠ Read-only (host controls config)", _styleReadOnly, Array.Empty()); } if (GUILayout.Button("✕ Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { Close(); } GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(1f) }); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); GUI.enabled = active; bool workingEnabled = GUILayout.Toggle(_workingEnabled, new GUIContent(" Custom items enabled", "Master switch for all custom items. When off, no custom items will appear in the item pool."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); if (active) { _workingEnabled = workingEnabled; } GUILayout.Space(20f); GUILayout.Label(new GUIContent("Global rate multiplier:", "Scales the spawn weight of ALL custom items. 1.0 = normal, 0.5 = half as frequent."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); _workingRate = DrawFloatField("rate", _workingRate, active, 0f, 10f, 70); GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(1f) }); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Item Name", _styleColHeader, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }); GUILayout.Label("On", _styleColHeader, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }); GUILayout.Space(4f); (int, string)[] poolColumns = PoolColumns; for (int i = 0; i < poolColumns.Length; i++) { string item = poolColumns[i].Item2; GUILayout.Label(item, _styleColHeader, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); } GUILayout.EndHorizontal(); GUILayout.Space(2f); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(1f) }); GUILayout.Space(2f); _scrollPos = GUILayout.BeginScrollView(_scrollPos, Array.Empty()); IReadOnlyList allItems = ItemRegistry.AllItems; for (int j = 0; j < TierDefs.Length; j++) { bool flag = false; for (int k = 0; k < allItems.Count; k++) { if (_itemTierIndex[k] == j) { flag = true; break; } } if (!flag) { continue; } DrawTierHeader(j, allItems, active); if (!_tierExpanded[j]) { continue; } for (int l = 0; l < allItems.Count; l++) { if (_itemTierIndex[l] == j) { DrawItemRow(l, allItems[l], active); } } } GUILayout.EndScrollView(); GUILayout.Space(4f); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(1f) }); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("Cancel", "Discard unsaved changes and close."), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(100f), GUILayout.Height(28f) })) { Close(); } GUILayout.Space(10f); GUI.enabled = active; GUI.backgroundColor = (Color)(active ? new Color(0.9f, 0.6f, 0.2f) : Color.white); if (GUILayout.Button(new GUIContent("↺ Reset to Defaults", active ? "Reset all weights, enabled flags, and global rate to their coded defaults. Does not save until you click Apply & Sync." : "Only the host can reset values."), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(160f), GUILayout.Height(28f) })) { ResetToDefaults(); } GUI.backgroundColor = Color.white; GUILayout.Space(10f); GUI.enabled = active; GUI.backgroundColor = (Color)(active ? new Color(0.3f, 0.9f, 0.3f) : Color.white); if (GUILayout.Button(new GUIContent("✔ Apply & Sync", active ? "Save changes and broadcast to all clients." : "Only the host can apply changes."), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(28f) })) { ApplyAndSync(); Close(); } GUI.backgroundColor = Color.white; GUI.enabled = true; GUILayout.EndHorizontal(); GUI.DragWindow(); DrawTooltipInWindow(); } private void DrawItemRow(int i, CustomItemDefinition def, bool isHost) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected I4, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown GUILayout.BeginHorizontal(_styleItemRow, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }); if ((Object)(object)def.Icon != (Object)null) { GUILayout.Box(new GUIContent((Texture)(object)def.Icon.texture, def.DisplayName), _styleIconBox, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(28f) }); } else { GUILayout.Box(new GUIContent("?", def.DisplayName), _styleIconBox, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(28f) }); } GUILayout.Space(4f); GUILayout.Label(new GUIContent(def.DisplayName, $"ItemType {(int)def.ItemType}"), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(128f), GUILayout.Height(28f) }); GUILayout.Space(4f); GUI.enabled = isHost; bool flag = GUILayout.Toggle(_workingItemEnabled[i], new GUIContent("", "When off, " + def.DisplayName + " never spawns regardless of pool weights."), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(20f), GUILayout.Height(28f) }); if (isHost) { _workingItemEnabled[i] = flag; } GUI.enabled = true; GUILayout.Space(10f); (int, string)[] poolColumns = PoolColumns; for (int j = 0; j < poolColumns.Length; j++) { int item = poolColumns[j].Item1; _workingPoolWeights[i, item] = DrawFloatField($"{i}_{item}", _workingPoolWeights[i, item], isHost, 0f, 999f, 50); GUILayout.Space(4f); } GUILayout.EndHorizontal(); } private void DrawTierHeader(int t, IReadOnlyList items, bool isHost) { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown GUILayout.BeginHorizontal(_styleTierHeader, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }); string text = (_tierExpanded[t] ? "▼" : "▶"); if (GUILayout.Button(text, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(26f) })) { _tierExpanded[t] = !_tierExpanded[t]; } GUILayout.Space(4f); GUILayout.Label(TierDefs[t].label, _styleHeader, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(128f) }); GUILayout.Space(4f); GUI.enabled = isHost; bool flag = true; for (int i = 0; i < items.Count; i++) { if (_itemTierIndex[i] == t && !_workingItemEnabled[i]) { flag = false; break; } } bool flag2 = GUILayout.Toggle(flag, new GUIContent("", "Enable / disable all " + TierDefs[t].label + " items at once."), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(20f), GUILayout.Height(26f) }); if (isHost && flag2 != flag) { for (int j = 0; j < items.Count; j++) { if (_itemTierIndex[j] == t) { _workingItemEnabled[j] = flag2; } } } GUI.enabled = true; GUILayout.Space(10f); (int, string)[] poolColumns = PoolColumns; for (int k = 0; k < poolColumns.Length; k++) { int item = poolColumns[k].Item1; string key = $"t{t}_{item}"; if (!_textBuffers.ContainsKey(key)) { _textBuffers[key] = TierDefs[t].defaultWeight.ToString("F1"); } if (isHost) { string text2 = _textBuffers[key]; string text3 = GUILayout.TextField(text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }); if (text3 != text2) { _textBuffers[key] = text3; if (float.TryParse(text3, out var result)) { float num = Mathf.Clamp(result, 0f, 999f); for (int l = 0; l < items.Count; l++) { if (_itemTierIndex[l] == t) { _workingPoolWeights[l, item] = num; _textBuffers[$"{l}_{item}"] = num.ToString("F1"); } } } } } else { GUILayout.Label(_textBuffers[key], _styleReadOnly, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }); } GUILayout.Space(4f); } GUILayout.EndHorizontal(); } private void DrawTooltipInWindow() { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) string tooltip = GUI.tooltip; if (!string.IsNullOrEmpty(tooltip)) { Vector2 mousePosition = Event.current.mousePosition; float num = 320f; GUIContent val = new GUIContent(tooltip); float num2 = _styleTooltip.CalcHeight(val, num) + 10f; float num3 = Mathf.Min(mousePosition.x + 14f, ((Rect)(ref _windowRect)).width - num - 8f); float num4 = Mathf.Min(mousePosition.y + 18f, ((Rect)(ref _windowRect)).height - num2 - 8f); GUI.Box(new Rect(num3, num4, num, num2), tooltip, _styleTooltip); } } private float DrawFloatField(string key, float value, bool editable, float min, float max, int width) { if (!_textBuffers.ContainsKey(key)) { _textBuffers[key] = value.ToString("0.##"); } if (editable) { string text = GUILayout.TextField(_textBuffers[key], (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)width) }); if (text != _textBuffers[key]) { _textBuffers[key] = text; if (float.TryParse(text, out var result)) { value = Mathf.Clamp(result, min, max); } } } else { GUILayout.Label(value.ToString("0.##"), _styleReadOnly, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((float)width) }); } return value; } private void InitStyles() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008a: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //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_00b9: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0110: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_016d: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown _styleHeader = new GUIStyle(GUI.skin.label) { fontSize = 15, fontStyle = (FontStyle)1 }; _styleColHeader = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, fontSize = 11, alignment = (TextAnchor)4 }; _styleItemRow = new GUIStyle(GUI.skin.box) { padding = new RectOffset(4, 4, 2, 2), margin = new RectOffset(0, 0, 1, 1) }; GUIStyle val = new GUIStyle(GUI.skin.box) { padding = new RectOffset(4, 4, 2, 2), margin = new RectOffset(0, 0, 3, 1) }; val.normal.background = MakeTex(2, 2, new Color(0.22f, 0.22f, 0.28f, 1f)); _styleTierHeader = val; _styleIconBox = new GUIStyle(GUI.skin.box) { padding = new RectOffset(2, 2, 2, 2) }; GUIStyle val2 = new GUIStyle(GUI.skin.label); val2.normal.textColor = new Color(0.65f, 0.65f, 0.65f); _styleReadOnly = val2; GUIStyle val3 = new GUIStyle(GUI.skin.box) { wordWrap = true, padding = new RectOffset(8, 8, 6, 6), fontSize = 12, alignment = (TextAnchor)0 }; val3.normal.background = MakeTex(2, 2, new Color(0.08f, 0.08f, 0.08f, 0.92f)); val3.normal.textColor = new Color(0.95f, 0.95f, 0.85f); _styleTooltip = val3; _stylesInitialised = true; } private static Texture2D MakeTex(int w, int h, Color col) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_002c: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(w, h); val.SetPixels(array); val.Apply(); return val; } } public class SpinachOverlay : MonoBehaviour { private bool _active; private float _startTime; private float _duration; private Texture2D _barBgTexture; private Texture2D _barFillTexture; private int _cachedBarW = -1; private static readonly Color FillColor = new Color(0.15f, 0.85f, 0.2f, 0.9f); private static readonly Color BgColor = new Color(0f, 0f, 0f, 0.55f); private GUIStyle _labelStyle; public static SpinachOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } DestroyBarTextures(); } public void SetActive(bool active, float duration = 0f) { _active = active; if (active) { _duration = duration; _startTime = Time.time; } } private void OnGUI() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0169: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown if (!_active) { return; } int num = (int)EffectBarLayout.GetBarWidth(); if (num != _cachedBarW) { RebuildBarTextures(num); } if ((Object)(object)_barBgTexture == (Object)null || (Object)(object)_barFillTexture == (Object)null) { return; } float num2 = Time.time - _startTime; float num3 = Mathf.Clamp01(1f - num2 / _duration); if (num3 <= 0f) { _active = false; return; } float num4 = Mathf.Max(0f, _duration - num2); float barWidth = EffectBarLayout.GetBarWidth(); float num5 = 28f; float barX = EffectBarLayout.GetBarX(); NetworkIdentity localPlayer = NetworkClient.localPlayer; PlayerInventory val = ((localPlayer != null) ? ((Component)localPlayer).GetComponent() : null); bool flag = (Object)(object)val != (Object)null && val.GetEffectivelyEquippedItem(true) == ItemRegistry.JetpackItemType; int slot = (FreezeItem.IsFrozen ? 1 : 0) + (LowGravityItem.IsActive ? 1 : 0) + (WindStormOverlay.IsActive ? 1 : 0) + (flag ? 1 : 0); float barY = EffectBarLayout.GetBarY(slot); GUI.DrawTexture(new Rect(barX, barY, barWidth, num5), (Texture)(object)_barBgTexture); GUI.BeginGroup(new Rect(barX, barY, barWidth * num3, num5)); GUI.DrawTexture(new Rect(0f, 0f, barWidth, num5), (Texture)(object)_barFillTexture); GUI.EndGroup(); if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; } _labelStyle.normal.textColor = Color.white; GUI.Label(new Rect(barX, barY, barWidth, num5), $"Spinach Time Remaining: {num4:F1}s", _labelStyle); } private void RebuildBarTextures(int barW) { //IL_0013: 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) DestroyBarTextures(); int num = 28; int radius = num / 3; _barBgTexture = GenerateRoundedRectTexture(barW, num, radius, BgColor); _barFillTexture = GenerateRoundedRectTexture(barW, num, radius, FillColor); _cachedBarW = barW; } private void DestroyBarTextures() { if ((Object)(object)_barBgTexture != (Object)null) { Object.Destroy((Object)(object)_barBgTexture); _barBgTexture = null; } if ((Object)(object)_barFillTexture != (Object)null) { Object.Destroy((Object)(object)_barFillTexture); _barFillTexture = null; } _cachedBarW = -1; } private static Texture2D GenerateRoundedRectTexture(int w, int h, int radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { array[i * w + j] = (IsInsideRoundedRect(j, i, w, h, radius) ? color : Color.clear); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static bool IsInsideRoundedRect(int x, int y, int w, int h, int r) { bool flag = x < r; bool flag2 = x >= w - r; bool flag3 = y < r; bool flag4 = y >= h - r; if (!(flag || flag2) || !(flag3 || flag4)) { return true; } int num = (flag ? r : (w - 1 - r)); int num2 = (flag3 ? r : (h - 1 - r)); float num3 = x - num; float num4 = y - num2; return num3 * num3 + num4 * num4 <= (float)(r * r); } } public class TeleporterOverlay : MonoBehaviour { private static Texture2D _bgTex; private static Texture2D _vignetteRingTex; private static Texture2D _scanlineTex; private static Texture2D _noiseTex; private GUIStyle _titleStyle; private GUIStyle _instructionStyle; private GUIStyle _cornerStyle; private float _noiseTimer; private const float NoiseUpdateRate = 0.04f; private const float VisualArtifactChance = 0.07f; private const float FullWidthScanlineSurgeChance = 0.03f; private void OnGUI() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0085: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_043b: 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_0485: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) if (!TeleporterItem.IsTargeting) { return; } float num = Screen.width; float num2 = Screen.height; EnsureTextures(num, num2); EnsureStyles(); GUI.color = new Color(0f, 0.4f, 1f, 0.12f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_scanlineTex, (ScaleMode)0); GUI.color = Color.white; GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_vignetteRingTex, (ScaleMode)0); _noiseTimer += Time.deltaTime; if (_noiseTimer >= 0.04f) { RegenerateNoise(); _noiseTimer = 0f; } GUI.color = new Color(1f, 1f, 1f, 0.03f); GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_noiseTex, (ScaleMode)0); GUI.color = Color.white; if (Random.value < 0.07f) { int num3 = Random.Range(1, 4); for (int i = 0; i < num3; i++) { float num4 = Random.Range(0f, num2); float num5 = Random.Range(1f, 5f); float num6 = Random.Range(num * 0.15f, num * 0.75f); float num7 = Random.Range(0f, num - num6); GUI.color = new Color(0.3f, 0.7f, 1f, Random.Range(0.04f, 0.16f)); GUI.DrawTexture(new Rect(num7, num4, num6, num5), (Texture)(object)Texture2D.whiteTexture); } GUI.color = Color.white; } if (Random.value < 0.03f) { float num8 = Random.Range(0f, num2); GUI.color = new Color(0.3f, 0.7f, 1f, 0.1f); GUI.DrawTexture(new Rect(0f, num8, num, Random.Range(2f, 8f)), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } float num9 = 60f; float thick = 3f; DrawCornerBracket(0f, 0f, num9, thick, leftSide: true, topSide: true); DrawCornerBracket(num - num9, 0f, num9, thick, leftSide: false, topSide: true); DrawCornerBracket(0f, num2 - num9, num9, thick, leftSide: true, topSide: false); DrawCornerBracket(num - num9, num2 - num9, num9, thick, leftSide: false, topSide: false); float num10 = 20f; float num11 = 6f; float num12 = num / 2f; float num13 = num2 / 2f; GUI.color = new Color(0.2f, 0.6f, 1f, 0.9f); GUI.DrawTexture(new Rect(num12 - num10 - num11, num13 - 1f, num10, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num12 + num11, num13 - 1f, num10, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num12 - 1f, num13 - num10 - num11, 2f, num10), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num12 - 1f, num13 + num11, 2f, num10), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num12 - 2f, num13 - 2f, 4f, 4f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(16f, 12f, 300f, 24f), DateTime.UtcNow.ToString("HH:mm:ss") + "Z", _cornerStyle); GUI.Label(new Rect(16f, 34f, 300f, 24f), "SYS: ARMED", _cornerStyle); GUI.Label(new Rect(16f, 56f, 300f, 24f), "MODE: TELEPORT TARGETING", _cornerStyle); GUI.DrawTexture(new Rect(0f, num2 - 80f, num, 80f), (Texture)(object)_bgTex); GUI.Label(new Rect(0f, num2 - 75f, num, 35f), "TELEPORTER TARGETING", _titleStyle); GUI.Label(new Rect(0f, num2 - 42f, num, 30f), "WASD: Move Target | Scroll: Zoom | Click / Enter: Confirm | Space: Cancel | Shift: Move Faster", _instructionStyle); } private void DrawCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide) { //IL_0015: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.2f, 0.6f, 1f, 0.9f); float num = (leftSide ? x : (x + size - size)); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(num, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); float num3 = (leftSide ? x : (x + size - thick)); float num4 = (topSide ? y : (y + size - size)); GUI.DrawTexture(new Rect(num3, num4, thick, size), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void EnsureTextures(float w, float h) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_004a: 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_0095: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_025a: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(1, (int)w); int num2 = Mathf.Max(1, (int)h); if ((Object)(object)_bgTex == (Object)null) { _bgTex = new Texture2D(1, 1); _bgTex.SetPixel(0, 0, new Color(0f, 0.05f, 0.15f, 0.82f)); _bgTex.Apply(); } if ((Object)(object)_scanlineTex == (Object)null || ((Texture)_scanlineTex).width != num) { _scanlineTex = new Texture2D(num, num2); Color[] array = (Color[])(object)new Color[num * num2]; for (int i = 0; i < num2; i++) { Color val = (Color)((i % 3 == 0) ? new Color(0f, 0.3f, 0.8f, 0.15f) : Color.clear); for (int j = 0; j < num; j++) { array[i * num + j] = val; } } _scanlineTex.SetPixels(array); _scanlineTex.Apply(); } if ((Object)(object)_vignetteRingTex == (Object)null || ((Texture)_vignetteRingTex).width != num) { _vignetteRingTex = new Texture2D(num, num2); Color[] array2 = (Color[])(object)new Color[num * num2]; float num3 = (float)num * 0.5f; float num4 = (float)num2 * 0.5f; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); for (int k = 0; k < num2; k++) { for (int l = 0; l < num; l++) { float num6 = (float)l - num3; float num7 = (float)k - num4; float num8 = Mathf.Sqrt(num6 * num6 + num7 * num7) / num5; float num9 = Mathf.Clamp01((num8 - 0.55f) / 0.45f) * 0.7f; array2[k * num + l] = new Color(0f, 0f, 0.05f, num9); } } _vignetteRingTex.SetPixels(array2); _vignetteRingTex.Apply(); } if ((Object)(object)_noiseTex == (Object)null) { _noiseTex = new Texture2D(256, 256); } } private void RegenerateNoise() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_noiseTex == (Object)null)) { int width = ((Texture)_noiseTex).width; int height = ((Texture)_noiseTex).height; Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { float value = Random.value; array[i] = new Color(value, value, value, Random.Range(0.01f, 0.06f)); } _noiseTex.SetPixels(array); _noiseTex.Apply(); } } private void EnsureStyles() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0034: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown if (_titleStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val.normal.textColor = new Color(0.4f, 0.8f, 1f); _titleStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)4 }; val2.normal.textColor = new Color(0.7f, 0.9f, 1f); _instructionStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1 }; val3.normal.textColor = new Color(0.3f, 0.7f, 1f, 0.85f); _cornerStyle = val3; } } } public class UfoAbductionOverlay : MonoBehaviour { private GUIStyle _titleStyle; private GUIStyle _labelStyle; private GUIStyle _timerStyle; private GUIStyle _instructionStyle; private GUIStyle _pipLabelStyle; private GUIStyle _targetingTitleStyle; private GUIStyle _targetingInstructionStyle; private GUIStyle _targetingCornerStyle; private static Texture2D _targetingBgTex; private static Texture2D _targetingScanlineTex; private static Texture2D _targetingNoiseTex; private float _targetingNoiseTimer; private const float TargetingNoiseUpdateRate = 0.04f; private float _sw; private float _sh; private float _time; private bool _victimSessionActive; private UfoAbductionSessionState _activeSession; private bool _wielderSessionActive; private bool _hasTarget; private Vector3 _targetScreenPos; private float _busyUntil; private bool _beingTargeted; private float _abortedUntil; public NetworkIdentity BestTargetIdentity { get; private set; } public static UfoAbductionOverlay Instance { get; private set; } private void OnEnable() { Instance = this; } private void OnDisable() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void ShowBeingTargeted() { _beingTargeted = true; } public void ClearBeingTargeted() { _beingTargeted = false; } public void ShowAborted() { _abortedUntil = Time.time + 2.5f; } public void ShowBusy() { _busyUntil = Time.time + 2.5f; } private void Update() { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (!((Object)(object)localPlayerInfo == (Object)null) && !((Object)(object)localPlayerInfo.Inventory == (Object)null)) { _sw = Screen.width; _sh = Screen.height; _time = Time.time; NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); _victimSessionActive = num != 0 && UfoAbductionClientLogic.TryGetSession(num, out _activeSession); _wielderSessionActive = num != 0 && !_victimSessionActive && UfoAbductionClientLogic.TryGetSessionForWielder(num, out var _); if (_victimSessionActive) { _beingTargeted = false; } if (_victimSessionActive || _wielderSessionActive) { _hasTarget = false; } else { UpdateLockOnTarget(); } } } private void UpdateLockOnTarget() { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_0141: Unknown result type (might be due to invalid IL or missing references) _hasTarget = false; BestTargetIdentity = null; PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory == (Object)null || localPlayerInventory.GetEffectivelyEquippedItem(true) != ItemRegistry.UfoAbductionItemType) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } float num = Mathf.Cos(ModConfig.UfoAbduction.LockOnConeAngleDeg.Value * 0.5f * (MathF.PI / 180f)); float num2 = ModConfig.UfoAbduction.LockOnRange.Value * ModConfig.UfoAbduction.LockOnRange.Value; Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; float num3 = -1f; Transform val = null; NetworkIdentity bestTargetIdentity = null; List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if ((Object)(object)item == (Object)null) { continue; } NetworkIdentity component = ((Component)item).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } Vector3 val2 = ((Component)item).transform.position - position; if (!(((Vector3)(ref val2)).sqrMagnitude > num2)) { float num4 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized); if (!(num4 < num) && !(num4 <= num3)) { num3 = num4; val = ((Component)item).transform; bestTargetIdentity = component; } } } } if ((Object)(object)val == (Object)null && (remotePlayers == null || remotePlayers.Count == 0)) { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component2 = ((Component)localPlayerInfo).GetComponent(); if ((Object)(object)component2 != (Object)null) { Vector3 val3 = ((Component)localPlayerInfo).transform.position - position; if (((Vector3)(ref val3)).sqrMagnitude <= num2) { float num5 = Vector3.Dot(forward, ((Vector3)(ref val3)).normalized); if (num5 >= num) { val = ((Component)localPlayerInfo).transform; bestTargetIdentity = component2; } } } } } if (!((Object)(object)val == (Object)null)) { BestTargetIdentity = bestTargetIdentity; Vector3 val4 = main.WorldToScreenPoint(val.position); if (!(val4.z <= 0f)) { _targetScreenPos = new Vector3(val4.x, _sh - val4.y, 0f); _hasTarget = true; } } } private void OnGUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null || (Object)(object)localPlayerInfo.Inventory == (Object)null || _sw <= 0f || _sh <= 0f) { return; } EnsureStyles(); RenderTexture activePipTexture = UfoAbductionClientLogic.GetActivePipTexture(); if ((Object)(object)activePipTexture != (Object)null && activePipTexture.IsCreated()) { DrawPipView(activePipTexture); } if (localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.UfoAbductionItemType || _victimSessionActive || _wielderSessionActive || _beingTargeted || !(_time >= _abortedUntil)) { if (UfoAbductionTargeting.IsSelectingDropoff) { DrawDropoffTargetingOverlay(); } else if (_beingTargeted && !_victimSessionActive) { DrawBeingTargetedHUD(); } else if (_time < _abortedUntil) { DrawAbortedMessage(); } else if (_victimSessionActive) { DrawActiveHUD(); } else if (_wielderSessionActive) { DrawWielderHUD(); } else if (_time < _busyUntil) { DrawBusyMessage(); } else if (_hasTarget) { DrawLockOnReticle(); } } } private void DrawPipView(RenderTexture tex) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) float num = _sw - 320f - 16f; float num2 = 16f; GUI.color = new Color(0.3f, 1f, 0.5f, 0.85f); GUI.DrawTexture(new Rect(num - 2f, num2 - 2f, 324f, 184f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.DrawTexture(new Rect(num, num2, 320f, 180f), (Texture)(object)tex, (ScaleMode)0, false); _pipLabelStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); GUI.Label(new Rect(num, num2 + 180f + 3f, 320f, 22f), "ABDUCTION IN PROGRESS", _pipLabelStyle); } private void DrawDropoffTargetingOverlay() { //IL_001c: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) EnsureTargetingTextures(); GUI.color = new Color(0f, 0.4f, 0f, 0.12f); GUI.DrawTexture(new Rect(0f, 0f, _sw, _sh), (Texture)(object)_targetingScanlineTex, (ScaleMode)0); _targetingNoiseTimer += Time.deltaTime; if (_targetingNoiseTimer >= 0.04f) { RegenerateTargetingNoise(); _targetingNoiseTimer = 0f; } GUI.color = new Color(1f, 1f, 1f, 0.03f); GUI.DrawTexture(new Rect(0f, 0f, _sw, _sh), (Texture)(object)_targetingNoiseTex, (ScaleMode)0); GUI.color = Color.white; float num = 60f; float thick = 3f; DrawTargetingCornerBracket(0f, 0f, num, thick, leftSide: true, topSide: true); DrawTargetingCornerBracket(_sw - num, 0f, num, thick, leftSide: false, topSide: true); DrawTargetingCornerBracket(0f, _sh - num, num, thick, leftSide: true, topSide: false); DrawTargetingCornerBracket(_sw - num, _sh - num, num, thick, leftSide: false, topSide: false); float num2 = 20f; float num3 = 6f; float num4 = _sw / 2f; float num5 = _sh / 2f; GUI.color = new Color(0.2f, 1f, 0.4f, 0.9f); GUI.DrawTexture(new Rect(num4 - num2 - num3, num5 - 1f, num2, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num4 + num3, num5 - 1f, num2, 2f), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num4 - 1f, num5 - num2 - num3, 2f, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num4 - 1f, num5 + num3, 2f, num2), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(num4 - 2f, num5 - 2f, 4f, 4f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(16f, 12f, 300f, 24f), DateTime.UtcNow.ToString("HH:mm:ss") + "Z", _targetingCornerStyle); GUI.Label(new Rect(16f, 34f, 300f, 24f), "SYS: ARMED", _targetingCornerStyle); GUI.Label(new Rect(16f, 56f, 300f, 24f), "MODE: ABDUCTION TARGETING", _targetingCornerStyle); GUI.DrawTexture(new Rect(0f, _sh - 80f, _sw, 80f), (Texture)(object)_targetingBgTex); GUI.Label(new Rect(0f, _sh - 75f, _sw, 35f), "UFO ABDUCTION — SELECT DROP ZONE", _targetingTitleStyle); GUI.Label(new Rect(0f, _sh - 42f, _sw, 30f), "WASD: Move | Scroll: Zoom | Click / Enter: Confirm | Space / RMB: Cancel", _targetingInstructionStyle); } private void DrawTargetingCornerBracket(float x, float y, float size, float thick, bool leftSide, bool topSide) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) GUI.color = new Color(0.2f, 1f, 0.4f, 0.9f); float num = (leftSide ? x : (x + size - size)); float num2 = (topSide ? y : (y + size - thick)); GUI.DrawTexture(new Rect(num, num2, size, thick), (Texture)(object)Texture2D.whiteTexture); float num3 = (leftSide ? x : (x + size - thick)); float num4 = (topSide ? y : (y + size - size)); GUI.DrawTexture(new Rect(num3, num4, thick, size), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; } private void DrawBeingTargetedHUD() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) float num = _sh - 12f - 42f; float num2 = 0.7f + 0.3f * Mathf.Sin(_time * 4f); _titleStyle.normal.textColor = new Color(1f, 0.6f, 0.2f, num2); GUI.Label(new Rect(0f, num, _sw, 42f), "YOU ARE BEING TARGETED", _titleStyle); _titleStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); } private void DrawAbortedMessage() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) float num = _sh - 12f - 42f; _instructionStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); GUI.Label(new Rect(0f, num, _sw, 42f), "UFO ABDUCTION CANCELLED", _instructionStyle); _instructionStyle.normal.textColor = Color.white; } private void DrawWielderHUD() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) float num = _sh - 12f - 42f; _titleStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); GUI.Label(new Rect(0f, num, _sw, 42f), "UFO ABDUCTION ACTIVE", _titleStyle); } private void DrawBusyMessage() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) float num = _sh - 12f - 42f; _instructionStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); GUI.Label(new Rect(0f, num, _sw, 42f), "UFO ABDUCTION ALREADY IN PROGRESS", _instructionStyle); _instructionStyle.normal.textColor = Color.white; } private void DrawActiveHUD() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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) //IL_022e: 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) if (_activeSession != null) { float totalDuration = _activeSession.TotalDuration; float num = _time - _activeSession.StartTime; float num2 = Mathf.Max(0f, totalDuration - num); bool flag = num2 <= 3f; string text; Color val = default(Color); if (num < _activeSession.ApproachDuration) { text = "UFO INCOMING"; ((Color)(ref val))..ctor(0.3f, 1f, 0.5f, 0.9f); } else if (num < _activeSession.ApproachDuration + _activeSession.AbductionDuration) { text = "BEING ABDUCTED"; val = (flag ? new Color(1f, 0.25f, 0.25f, 0.9f) : new Color(0.3f, 1f, 0.5f, 0.9f)); } else { text = "IN TRANSIT"; ((Color)(ref val))..ctor(1f, 0.25f, 0.25f, 0.7f + 0.3f * Mathf.Sin(_time * 6f)); } float num3 = _sh - 12f - 10f; float num4 = num3 - 10f - 42f; _titleStyle.normal.textColor = val; GUI.Label(new Rect(0f, num4, _sw, 42f), text, _titleStyle); float num5 = 280f; float num6 = (_sw - num5) * 0.5f; float num7 = ((totalDuration > 0f) ? Mathf.Clamp01(num2 / totalDuration) : 0f); GUI.color = new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(new Rect(num6, num3, num5, 10f), (Texture)(object)Texture2D.whiteTexture); GUI.color = val; GUI.DrawTexture(new Rect(num6, num3, num5 * num7, 10f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; _timerStyle.normal.textColor = val; GUI.Label(new Rect(num6 + num5 + 8f, num3 - 14f, 80f, 38f), $"{num2:F1}s", _timerStyle); } } private void DrawLockOnReticle() { //IL_0047: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) float x = _targetScreenPos.x; float y = _targetScreenPos.y; float num = 28f; float num2 = 42f; float num3 = 4f; Color val = default(Color); ((Color)(ref val))..ctor(0.3f, 1f, 0.5f, 0.85f); GUI.color = val; float num4 = num; float num5 = num2 - num; GUI.DrawTexture(new Rect(x - num2, y - num3 * 0.5f, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x + num4, y - num3 * 0.5f, num5, num3), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num3 * 0.5f, y - num2, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - num3 * 0.5f, y + num4, num3, num5), (Texture)(object)Texture2D.whiteTexture); GUI.DrawTexture(new Rect(x - 3f, y - 3f, 6f, 6f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; _labelStyle.normal.textColor = val; string text = "LOCK ON"; if ((Object)(object)BestTargetIdentity != (Object)null) { PlayerInfo componentInParent = ((Component)BestTargetIdentity).GetComponentInParent(); object obj; if (componentInParent == null) { obj = null; } else { PlayerId playerId = componentInParent.PlayerId; obj = ((playerId != null) ? playerId.PlayerName : null); } string text2 = (string)obj; if (!string.IsNullOrEmpty(text2)) { text = "LOCK ON\n" + text2; } } GUI.Label(new Rect(x - 200f, y + num2 + 4f, 400f, 76f), text, _labelStyle); } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00cb: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_017d: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Expected O, but got Unknown if (_titleStyle == null) { _titleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _titleStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); } if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 28, fontStyle = (FontStyle)1, wordWrap = false }; _labelStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.85f); } if (_timerStyle == null) { _timerStyle = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1 }; _timerStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); } if (_instructionStyle == null) { _instructionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 32, fontStyle = (FontStyle)1 }; _instructionStyle.normal.textColor = Color.white; } if (_pipLabelStyle == null) { _pipLabelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)1, fontSize = 13, fontStyle = (FontStyle)1 }; _pipLabelStyle.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.9f); } if (_targetingTitleStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val.normal.textColor = new Color(0.4f, 1f, 0.6f); _targetingTitleStyle = val; } if (_targetingInstructionStyle == null) { GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)4 }; val2.normal.textColor = new Color(0.7f, 1f, 0.8f); _targetingInstructionStyle = val2; } if (_targetingCornerStyle == null) { GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1 }; val3.normal.textColor = new Color(0.3f, 1f, 0.5f, 0.85f); _targetingCornerStyle = val3; } } private void EnsureTargetingTextures() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(1, (int)_sw); int num2 = Mathf.Max(1, (int)_sh); if ((Object)(object)_targetingBgTex == (Object)null) { _targetingBgTex = new Texture2D(1, 1); _targetingBgTex.SetPixel(0, 0, new Color(0f, 0.08f, 0.04f, 0.82f)); _targetingBgTex.Apply(); } if ((Object)(object)_targetingScanlineTex == (Object)null || ((Texture)_targetingScanlineTex).width != num) { _targetingScanlineTex = new Texture2D(num, num2); Color[] array = (Color[])(object)new Color[num * num2]; for (int i = 0; i < num2; i++) { Color val = (Color)((i % 3 == 0) ? new Color(0f, 0.5f, 0.1f, 0.15f) : Color.clear); for (int j = 0; j < num; j++) { array[i * num + j] = val; } } _targetingScanlineTex.SetPixels(array); _targetingScanlineTex.Apply(); } if (_targetingNoiseTex == null) { _targetingNoiseTex = new Texture2D(256, 256); } } private void RegenerateTargetingNoise() { //IL_0065: 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) if (!((Object)(object)_targetingNoiseTex == (Object)null)) { int width = ((Texture)_targetingNoiseTex).width; int height = ((Texture)_targetingNoiseTex).height; Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { float value = Random.value; array[i] = new Color(value * 0.3f, value, value * 0.4f, Random.Range(0.01f, 0.06f)); } _targetingNoiseTex.SetPixels(array); _targetingNoiseTex.Apply(); } } } public class VoteOverlay : MonoBehaviour { private const float PanelWidth = 520f; private const float RowHeight = 36f; private const float HeaderH = 52f; private const float TipH = 22f; private const float TimerH = 28f; private const float SubmitH = 46f; private const float Padding = 14f; private const float ButtonW = 54f; private const float ButtonH = 28f; private const float ButtonGap = 4f; private Vector2 _scrollPos; private bool _stylesReady; private GUIStyle _panelStyle; private GUIStyle _titleStyle; private GUIStyle _tipStyle; private GUIStyle _timerStyle; private GUIStyle _waitStyle; private GUIStyle _itemStyle; private GUIStyle _yesOn; private GUIStyle _yesOff; private GUIStyle _noOn; private GUIStyle _noOff; private GUIStyle _submitStyle; private void OnGUI() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected I4, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0330: 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) if (!VoteManager.VoteActive) { return; } EnsureStyles(); int count = ItemRegistry.AllItems.Count; float num = 190f; float num2 = 36f * (float)count; float num3 = (float)Screen.height * 0.9f - num; float num4 = Mathf.Min(num2, num3); float num5 = num + num4; float num6 = ((float)Screen.width - 520f) * 0.5f; float num7 = ((float)Screen.height - num5) * 0.5f; GUI.Box(new Rect(num6, num7, 520f, num5), GUIContent.none, _panelStyle); float num8 = num7 + 7f; GUI.Label(new Rect(num6, num8, 520f, 52f), "Vote: Enable Custom Items?", _titleStyle); num8 += 52f; GUI.Label(new Rect(num6, num8, 520f, 22f), "Press Escape to pause the game and show your cursor", _tipStyle); num8 += 22f; bool localVoteSubmitted = VoteManager.LocalVoteSubmitted; string text = (localVoteSubmitted ? "Waiting for other players..." : $"Time remaining: {Mathf.CeilToInt(VoteManager.VoteTimeRemaining)}s"); GUI.Label(new Rect(num6, num8, 520f, 28f), text, localVoteSubmitted ? _waitStyle : _timerStyle); num8 += 42f; float num9 = 372f; float num10 = ((num4 < num2) ? 16f : 0f); Rect val = default(Rect); ((Rect)(ref val))..ctor(num6, num8, 520f, num4); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, 520f - num10, num2); _scrollPos = GUI.BeginScrollView(val, _scrollPos, val2); float num11 = 0f; foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { int key = (int)allItem.ItemType; bool value; bool flag = VoteManager.LocalVotes.TryGetValue(key, out value) && value; float num12 = num11 + 4f; float num13 = 14f; float num14 = 14f + num9 + 8f; GUI.Label(new Rect(num13, num11, num9, 36f), allItem.DisplayName, _itemStyle); if (!localVoteSubmitted) { if (GUI.Button(new Rect(num14, num12, 54f, 28f), "YES", flag ? _yesOn : _yesOff)) { VoteManager.LocalVotes[key] = true; } if (GUI.Button(new Rect(num14 + 54f + 4f, num12, 54f, 28f), "NO", (!flag) ? _noOn : _noOff)) { VoteManager.LocalVotes[key] = false; } } else { GUI.Label(new Rect(num14, num12, 54f, 28f), "YES", flag ? _yesOn : _yesOff); GUI.Label(new Rect(num14 + 54f + 4f, num12, 54f, 28f), "NO", (!flag) ? _noOn : _noOff); } num11 += 36f; } GUI.EndScrollView(); num8 += num4 + 14f; if (!localVoteSubmitted) { float num15 = 140f; if (GUI.Button(new Rect(num6 + (520f - num15) * 0.5f, num8, num15, 46f), "Submit Vote", _submitStyle)) { VoteManager.SubmitLocalVotes(); } } } private void EnsureStyles() { //IL_002d: 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_006b: 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_00a9: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //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_0150: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_0233: Expected O, but got Unknown //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0293: 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_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Expected O, but got Unknown //IL_02df: 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_02ed: 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_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Expected O, but got Unknown //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0444: 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_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Expected O, but got Unknown if (!_stylesReady) { _stylesReady = true; Texture2D background = Tex(new Color(0.06f, 0.06f, 0.14f, 0.93f)); Texture2D background2 = Tex(new Color(0.1f, 0.55f, 0.1f, 1f)); Texture2D background3 = Tex(new Color(0.15f, 0.7f, 0.15f, 1f)); Texture2D background4 = Tex(new Color(0.55f, 0.1f, 0.1f, 1f)); Texture2D background5 = Tex(new Color(0.7f, 0.15f, 0.15f, 1f)); Texture2D background6 = Tex(new Color(0.28f, 0.28f, 0.28f, 0.85f)); Texture2D background7 = Tex(new Color(0.15f, 0.35f, 0.75f, 1f)); Texture2D background8 = Tex(new Color(0.25f, 0.5f, 1f, 1f)); GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = background; _panelStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 20, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val2.normal.textColor = Color.white; _titleStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 11, alignment = (TextAnchor)4 }; val3.normal.textColor = new Color(0.6f, 0.6f, 0.6f); _tipStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)4 }; val4.normal.textColor = new Color(0.85f, 0.85f, 0.85f); _timerStyle = val4; GUIStyle val5 = new GUIStyle(_timerStyle); val5.normal.textColor = new Color(1f, 0.85f, 0.3f); _waitStyle = val5; GUIStyle val6 = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)3 }; val6.normal.textColor = Color.white; _itemStyle = val6; GUIStyle val7 = new GUIStyle(GUI.skin.button) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val7.normal.background = background2; val7.normal.textColor = Color.white; val7.hover.background = background3; val7.hover.textColor = Color.white; _yesOn = val7; GUIStyle val8 = new GUIStyle(GUI.skin.button) { fontSize = 12, alignment = (TextAnchor)4 }; val8.normal.background = background6; val8.normal.textColor = new Color(0.6f, 0.6f, 0.6f); val8.hover.background = background2; val8.hover.textColor = Color.white; _yesOff = val8; GUIStyle val9 = new GUIStyle(GUI.skin.button) { fontSize = 12, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val9.normal.background = background4; val9.normal.textColor = Color.white; val9.hover.background = background5; val9.hover.textColor = Color.white; _noOn = val9; GUIStyle val10 = new GUIStyle(GUI.skin.button) { fontSize = 12, alignment = (TextAnchor)4 }; val10.normal.background = background6; val10.normal.textColor = new Color(0.6f, 0.6f, 0.6f); val10.hover.background = background4; val10.hover.textColor = Color.white; _noOff = val10; GUIStyle val11 = new GUIStyle(GUI.skin.button) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val11.normal.background = background7; val11.normal.textColor = Color.white; val11.hover.background = background8; val11.hover.textColor = Color.white; _submitStyle = val11; } } private static Texture2D Tex(Color col) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, col); val.Apply(); return val; } } public class WindStormOverlay : MonoBehaviour { private bool _active; private float _startTime; private float _duration; private Texture2D _vignetteTexture; private Texture2D _barBgTexture; private Texture2D _barFillTexture; private int _cachedBarW = -1; private static readonly Color FillColor = new Color(0.35f, 0.65f, 0.85f, 0.9f); private static readonly Color BgColor = new Color(0f, 0f, 0f, 0.55f); private GUIStyle _labelStyle; public static WindStormOverlay Instance { get; private set; } public static bool IsActive => (Object)(object)Instance != (Object)null && Instance._active; private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } DestroyBarTextures(); if ((Object)(object)_vignetteTexture != (Object)null) { Object.Destroy((Object)(object)_vignetteTexture); } } private void Start() { _vignetteTexture = GenerateStormVignetteTexture(256, 256); } public void SetActive(bool active, float duration = 0f) { _active = active; if (active) { _duration = duration; _startTime = Time.time; } } private void OnGUI() { //IL_003d: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown if (!_active) { return; } if ((Object)(object)_vignetteTexture != (Object)null) { GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)_vignetteTexture, (ScaleMode)0); } if (_duration <= 0f) { return; } int num = (int)EffectBarLayout.GetBarWidth(); if (num != _cachedBarW) { RebuildBarTextures(num); } if (!((Object)(object)_barBgTexture == (Object)null) && !((Object)(object)_barFillTexture == (Object)null)) { float num2 = Time.time - _startTime; float num3 = Mathf.Clamp01(1f - num2 / _duration); float num4 = Mathf.Max(0f, _duration - num2); float barWidth = EffectBarLayout.GetBarWidth(); float num5 = 28f; float barX = EffectBarLayout.GetBarX(); int slot = (FreezeItem.IsFrozen ? 1 : 0) + (LowGravityItem.IsActive ? 1 : 0); float barY = EffectBarLayout.GetBarY(slot); GUI.DrawTexture(new Rect(barX, barY, barWidth, num5), (Texture)(object)_barBgTexture); GUI.BeginGroup(new Rect(barX, barY, barWidth * num3, num5)); GUI.DrawTexture(new Rect(0f, 0f, barWidth, num5), (Texture)(object)_barFillTexture); GUI.EndGroup(); if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; } _labelStyle.normal.textColor = Color.white; GUI.Label(new Rect(barX, barY, barWidth, num5), $"Wind Storm Time Remaining: {num4:F1}s", _labelStyle); } } private void RebuildBarTextures(int barW) { //IL_0013: 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) DestroyBarTextures(); int num = 28; int radius = num / 3; _barBgTexture = GenerateRoundedRectTexture(barW, num, radius, BgColor); _barFillTexture = GenerateRoundedRectTexture(barW, num, radius, FillColor); _cachedBarW = barW; } private void DestroyBarTextures() { if ((Object)(object)_barBgTexture != (Object)null) { Object.Destroy((Object)(object)_barBgTexture); _barBgTexture = null; } if ((Object)(object)_barFillTexture != (Object)null) { Object.Destroy((Object)(object)_barFillTexture); _barFillTexture = null; } _cachedBarW = -1; } private static Texture2D GenerateRoundedRectTexture(int w, int h, int radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { array[i * w + j] = (IsInsideRoundedRect(j, i, w, h, radius) ? color : Color.clear); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static bool IsInsideRoundedRect(int x, int y, int w, int h, int r) { bool flag = x < r; bool flag2 = x >= w - r; bool flag3 = y < r; bool flag4 = y >= h - r; if (!(flag || flag2) || !(flag3 || flag4)) { return true; } int num = (flag ? r : (w - 1 - r)); int num2 = (flag3 ? r : (h - 1 - r)); float num3 = x - num; float num4 = y - num2; return num3 * num3 + num4 * num4 <= (float)(r * r); } private static Texture2D GenerateStormVignetteTexture(int w, int h) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); float num = (float)w * 0.5f; float num2 = (float)h * 0.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { float num4 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num2) * ((float)i - num2)) / num3; float num5 = Mathf.Pow(Mathf.Clamp01(num4), 0.7f) * 0.35f; array[i * w + j] = new Color(0.2f, 0.3f, 0.45f, num5); } } val.SetPixels(array); val.Apply(); return val; } } } namespace IssaPlugin.Network { public struct ItemConfigSyncMessage : NetworkMessage { public string[] Keys; public string[] Values; } public static class ItemConfigSyncSerialization { public static void Write(NetworkWriter w, ItemConfigSyncMessage msg) { string[] keys = msg.Keys; int num = ((keys != null) ? keys.Length : 0); NetworkWriterExtensions.WriteInt(w, num); for (int i = 0; i < num; i++) { NetworkWriterExtensions.WriteString(w, msg.Keys[i]); NetworkWriterExtensions.WriteString(w, msg.Values[i] ?? string.Empty); } } public static ItemConfigSyncMessage Read(NetworkReader r) { int num = NetworkReaderExtensions.ReadInt(r); string[] array = new string[num]; string[] array2 = new string[num]; for (int i = 0; i < num; i++) { array[i] = NetworkReaderExtensions.ReadString(r); array2[i] = NetworkReaderExtensions.ReadString(r); } return new ItemConfigSyncMessage { Keys = array, Values = array2 }; } } public static class ItemWarningBroadcaster { public static void Broadcast(string playerName, ItemType itemType, string displayName, uint trackedNetId = 0u, uint senderNetId = 0u) { //IL_0001: 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_0033: Expected I4, but got Unknown if (ModConfig.GetItemWarningEnabled(itemType)) { NetworkServer.SendToAll(new ItemWarningMessage { PlayerName = playerName, ItemDisplayName = displayName, ItemTypeValue = (int)itemType, TrackedNetId = trackedNetId, SenderNetId = senderNetId }, 0, false); IssaPluginPlugin.Log.LogInfo((object)("[Warning] Broadcast: " + playerName + " used " + displayName + " " + $"(trackedNetId={trackedNetId}, senderNetId={senderNetId})")); } } } public struct ItemWarningMessage : NetworkMessage { public string PlayerName; public string ItemDisplayName; public int ItemTypeValue; public uint TrackedNetId; public uint SenderNetId; } public static class ItemWarningMessageSerialization { public static void WriteItemWarningMessage(NetworkWriter writer, ItemWarningMessage msg) { NetworkWriterExtensions.WriteString(writer, msg.PlayerName); NetworkWriterExtensions.WriteString(writer, msg.ItemDisplayName); NetworkWriterExtensions.WriteInt(writer, msg.ItemTypeValue); NetworkWriterExtensions.WriteUInt(writer, msg.TrackedNetId); NetworkWriterExtensions.WriteUInt(writer, msg.SenderNetId); } public static ItemWarningMessage ReadItemWarningMessage(NetworkReader reader) { return new ItemWarningMessage { PlayerName = NetworkReaderExtensions.ReadString(reader), ItemDisplayName = NetworkReaderExtensions.ReadString(reader), ItemTypeValue = NetworkReaderExtensions.ReadInt(reader), TrackedNetId = NetworkReaderExtensions.ReadUInt(reader), SenderNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public struct SpawnWeightsMessage : NetworkMessage { public bool CustomItemSpawnsEnabled; public Dictionary ItemPoolWeights; public override string ToString() { if (ItemPoolWeights == null) { return "SpawnWeightsMessage{null}"; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"CustomItemSpawnsEnabled={CustomItemSpawnsEnabled} "); foreach (KeyValuePair itemPoolWeight in ItemPoolWeights) { itemPoolWeight.Deconstruct(out var key, out var value); int num = key; float[] array = value; string text = ItemRegistry.GetDefinition((ItemType)num)?.DisplayName ?? num.ToString(); stringBuilder.Append(text + "=["); for (int i = 0; i < array.Length; i++) { if (i > 0) { stringBuilder.Append(','); } stringBuilder.Append(array[i].ToString("F1")); } stringBuilder.Append("] "); } return stringBuilder.ToString(); } } public static class SpawnWeightsMessageSerialization { public static void WriteSpawnWeightsMessage(NetworkWriter writer, SpawnWeightsMessage msg) { NetworkWriterExtensions.WriteBool(writer, msg.CustomItemSpawnsEnabled); int num = msg.ItemPoolWeights?.Count ?? 0; NetworkWriterExtensions.WriteInt(writer, num); if (msg.ItemPoolWeights == null) { return; } foreach (var (num3, array2) in msg.ItemPoolWeights) { NetworkWriterExtensions.WriteInt(writer, num3); for (int i = 0; i < 6; i++) { NetworkWriterExtensions.WriteFloat(writer, (i < array2.Length) ? array2[i] : 0f); } } } public static SpawnWeightsMessage ReadSpawnWeightsMessage(NetworkReader reader) { bool customItemSpawnsEnabled = NetworkReaderExtensions.ReadBool(reader); int num = NetworkReaderExtensions.ReadInt(reader); Dictionary dictionary = new Dictionary(num); for (int i = 0; i < num; i++) { int key = NetworkReaderExtensions.ReadInt(reader); float[] array = new float[6]; for (int j = 0; j < 6; j++) { array[j] = NetworkReaderExtensions.ReadFloat(reader); } dictionary[key] = array; } return new SpawnWeightsMessage { CustomItemSpawnsEnabled = customItemSpawnsEnabled, ItemPoolWeights = dictionary }; } } public class VoteManager : MonoBehaviour { private bool _voteInProgress; private float _voteEndTime; private readonly Dictionary> _receivedVotes = new Dictionary>(); private readonly HashSet _pendingConnections = new HashSet(); public static readonly Dictionary LocalVotes = new Dictionary(); public static VoteManager Instance { get; private set; } public static bool VoteActive { get; private set; } public static float VoteTimeRemaining { get; private set; } public static bool LocalVoteSubmitted { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)this); } else { Instance = this; } } private void Update() { if (VoteActive) { VoteTimeRemaining = Mathf.Max(0f, _voteEndTime - Time.time); } if (NetworkServer.active && _voteInProgress && Time.time >= _voteEndTime) { TallyAndBroadcast(); } } public void StartVote(float timeout) { if (!NetworkServer.active) { IssaPluginPlugin.Log.LogWarning((object)"[Vote] Only the host can start a vote."); return; } if (_voteInProgress) { IssaPluginPlugin.Log.LogWarning((object)"[Vote] A vote is already in progress."); return; } _voteInProgress = true; _voteEndTime = Time.time + timeout; _receivedVotes.Clear(); _pendingConnections.Clear(); foreach (NetworkConnectionToClient value in NetworkServer.connections.Values) { _pendingConnections.Add(value.connectionId); } IssaPluginPlugin.Log.LogInfo((object)$"[Vote] Starting with {timeout}s timeout, {_pendingConnections.Count} player(s)."); NetworkServer.SendToAll(new VoteStartMessage { TimeoutSeconds = timeout }, 0, false); } internal void HandleVoteSubmit(NetworkConnectionToClient conn, VoteSubmitMessage msg) { if (_voteInProgress) { int connectionId = conn.connectionId; _receivedVotes[connectionId] = msg.Votes; _pendingConnections.Remove(connectionId); IssaPluginPlugin.Log.LogInfo((object)$"[Vote] Vote from connection {connectionId} received. Pending: {_pendingConnections.Count}"); if (_pendingConnections.Count == 0) { TallyAndBroadcast(); } } } private void TallyAndBroadcast() { if (_voteInProgress) { _voteInProgress = false; Dictionary results = VoteTally.Compute(_receivedVotes, ItemRegistry.AllItems.Select((CustomItemDefinition i) => (int)i.ItemType), (int key) => ItemRegistry.GetDefinition((ItemType)key)?.Enabled ?? false); ApplyResults(results); SpawnWeightsSyncer.ForceServerSync(); VoteActive = false; LocalVoteSubmitted = false; NetworkServer.SendToAll(new VoteResultsMessage { Results = results }, 0, false); IssaPluginPlugin.Log.LogInfo((object)"[Vote] Tallied and broadcast results."); } } internal static void HandleVoteStart(VoteStartMessage msg) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected I4, but got Unknown LocalVotes.Clear(); foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { LocalVotes[(int)allItem.ItemType] = allItem.Enabled; } LocalVoteSubmitted = false; VoteActive = true; if ((Object)(object)Instance != (Object)null && !NetworkServer.active) { Instance._voteEndTime = Time.time + msg.TimeoutSeconds; } IssaPluginPlugin.Log.LogInfo((object)$"[Vote] Vote started! Timeout: {msg.TimeoutSeconds}s"); } internal static void HandleVoteResults(VoteResultsMessage msg) { VoteActive = false; LocalVoteSubmitted = false; if (!NetworkServer.active) { ApplyResults(msg.Results); } IssaPluginPlugin.Log.LogInfo((object)"[Vote] Results received and applied."); } private static void ApplyResults(Dictionary results) { foreach (var (num2, flag2) in results) { ModConfig.SetItemEnabled((ItemType)num2, flag2); IssaPluginPlugin.Log.LogInfo((object)$"[Vote] Item {num2} → enabled={flag2}"); } } public static void SubmitLocalVotes() { if (VoteActive && !LocalVoteSubmitted) { LocalVoteSubmitted = true; NetworkClient.Send(new VoteSubmitMessage { Votes = new Dictionary(LocalVotes) }, 0); } } } public struct VoteStartMessage : NetworkMessage { public float TimeoutSeconds; } public struct VoteSubmitMessage : NetworkMessage { public Dictionary Votes; } public struct VoteResultsMessage : NetworkMessage { public Dictionary Results; } public static class VoteMessageSerialization { public static void WriteVoteStartMessage(NetworkWriter writer, VoteStartMessage msg) { NetworkWriterExtensions.WriteFloat(writer, msg.TimeoutSeconds); } public static VoteStartMessage ReadVoteStartMessage(NetworkReader reader) { return new VoteStartMessage { TimeoutSeconds = NetworkReaderExtensions.ReadFloat(reader) }; } public static void WriteVoteSubmitMessage(NetworkWriter writer, VoteSubmitMessage msg) { NetworkWriterExtensions.WriteInt(writer, msg.Votes.Count); foreach (var (num2, flag2) in msg.Votes) { NetworkWriterExtensions.WriteInt(writer, num2); NetworkWriterExtensions.WriteBool(writer, flag2); } } public static VoteSubmitMessage ReadVoteSubmitMessage(NetworkReader reader) { int num = NetworkReaderExtensions.ReadInt(reader); Dictionary dictionary = new Dictionary(num); for (int i = 0; i < num; i++) { dictionary.Add(NetworkReaderExtensions.ReadInt(reader), NetworkReaderExtensions.ReadBool(reader)); } return new VoteSubmitMessage { Votes = dictionary }; } public static void WriteVoteResultsMessage(NetworkWriter writer, VoteResultsMessage msg) { NetworkWriterExtensions.WriteInt(writer, msg.Results.Count); foreach (var (num2, flag2) in msg.Results) { NetworkWriterExtensions.WriteInt(writer, num2); NetworkWriterExtensions.WriteBool(writer, flag2); } } public static VoteResultsMessage ReadVoteResultsMessage(NetworkReader reader) { int num = NetworkReaderExtensions.ReadInt(reader); Dictionary dictionary = new Dictionary(num); for (int i = 0; i < num; i++) { dictionary.Add(NetworkReaderExtensions.ReadInt(reader), NetworkReaderExtensions.ReadBool(reader)); } return new VoteResultsMessage { Results = dictionary }; } } internal static class VoteTally { public static Dictionary Compute(IReadOnlyDictionary> votes, IEnumerable itemKeys, Func fallback) { Dictionary dictionary = new Dictionary(); foreach (int itemKey in itemKeys) { int num = 0; int num2 = 0; foreach (Dictionary value2 in votes.Values) { if (value2.TryGetValue(itemKey, out var value)) { num2++; if (value) { num++; } } } int num3 = num2 - num; if (num2 == 0 || num == num3) { dictionary[itemKey] = fallback(itemKey); } else { dictionary[itemKey] = num > num3; } } return dictionary; } } } namespace IssaPlugin.Patches { public class LowGravityHandler : MonoBehaviour { private bool _applied; private Vector3 _savedGravity; private void OnDestroy() { if (_applied) { Restore(); } } private void Update() { if (LowGravityItem.IsActive && !_applied) { Apply(); } else if (!LowGravityItem.IsActive && _applied) { Restore(); } } private void Apply() { //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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) _applied = true; _savedGravity = Physics.gravity; float value = ModConfig.LowGravity.Scale.Value; Physics.gravity = new Vector3(_savedGravity.x, _savedGravity.y * value, _savedGravity.z); IssaPluginPlugin.Log.LogInfo((object)($"[LowGravity] Gravity applied. Scale={value:F2}, " + $"Physics.gravity.y={Physics.gravity.y:F3}")); } private void Restore() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) _applied = false; Physics.gravity = _savedGravity; IssaPluginPlugin.Log.LogInfo((object)$"[LowGravity] Gravity restored. Physics.gravity.y={Physics.gravity.y:F3}"); } } [HarmonyPatch] internal static class HitWithGolfSwingInternalPatch { internal static bool BatActive; internal static bool RecentHit; internal static bool WasRocketDriver; internal static float TotalMultiplier = 1f; private static float _originalMaxPowerSwingHitSpeed; private static float _originalMinPowerRocketDriverSwingHitSpeed; private static float _originalMaxPowerRocketDriverSwingHitSpeed; private static float _originalMinPowerRocketDriverPuttHitSpeed; private static float _originalMaxPowerRocketDriverPuttHitSpeed; private static float _pendingMultiplier = 1f; private static readonly FieldInfo MaxPowerSwingHitSpeedField = AccessTools.Field(typeof(SwingHittableSettings), "k__BackingField"); private static readonly FieldInfo MinPowerRocketDriverSwingHitSpeedField = AccessTools.Field(typeof(SwingHittableSettings), "k__BackingField"); private static readonly FieldInfo MaxPowerRocketDriverSwingHitSpeedField = AccessTools.Field(typeof(SwingHittableSettings), "k__BackingField"); private static readonly FieldInfo MinPowerRocketDriverPuttHitSpeedField = AccessTools.Field(typeof(SwingHittableSettings), "k__BackingField"); private static readonly FieldInfo MaxPowerRocketDriverPuttHitSpeedField = AccessTools.Field(typeof(SwingHittableSettings), "k__BackingField"); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Hittable), "HitWithGolfSwingInternal", (Type[])null, (Type[])null); } private static IEnumerator TrackVelocityAfterHit(Rigidbody rb) { float elapsed = 0f; while (elapsed < 5f) { yield return null; elapsed += Time.deltaTime; if ((Object)(object)rb == (Object)null) { yield break; } } RecentHit = false; TotalMultiplier = 1f; } private static void Prefix(Hittable __instance, PlayerGolfer hitter, float power, Vector3 worldDirection, bool isPutt, SwingType swingType) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) BatActive = false; WasRocketDriver = false; _pendingMultiplier = 1f; bool flag = (int)swingType == 2; if ((Object)(object)hitter == (Object)null) { return; } PlayerInventory inventory = hitter.PlayerInfo.Inventory; bool flag2 = ((NetworkBehaviour)hitter).isLocalPlayer && SpinachBehaviour.IsActive; if (inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.BaseballBatItemType && !flag2) { return; } bool isGolfBall = __instance.AsEntity.IsGolfBall; float num = 1f; if (inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.BaseballBatItemType) { BatActive = true; float num2 = (isGolfBall ? ModConfig.BaseballBat.GolfBallPowerMultiplier.Value : ModConfig.BaseballBat.PowerMultiplier.Value); num = num2 - 1f; if (num <= 0f) { num = 1f; } } if (flag2) { float num3 = (isGolfBall ? ModConfig.Spinach.GolfBallPowerMultiplier.Value : ModConfig.Spinach.PowerMultiplier.Value); float num4 = num3 - 1f; if (num4 <= 0f) { num4 = 1f; } num *= num4; } float num5 = (_pendingMultiplier = 1f + num); WasRocketDriver = flag; if ((Object)(object)__instance.SwingSettings != (Object)null) { if (flag) { _originalMinPowerRocketDriverSwingHitSpeed = __instance.SwingSettings.MinPowerRocketDriverSwingHitSpeed; _originalMaxPowerRocketDriverSwingHitSpeed = __instance.SwingSettings.MaxPowerRocketDriverSwingHitSpeed; _originalMinPowerRocketDriverPuttHitSpeed = __instance.SwingSettings.MinPowerRocketDriverPuttHitSpeed; _originalMaxPowerRocketDriverPuttHitSpeed = __instance.SwingSettings.MaxPowerRocketDriverPuttHitSpeed; MinPowerRocketDriverSwingHitSpeedField.SetValue(__instance.SwingSettings, _originalMinPowerRocketDriverSwingHitSpeed * num5); MaxPowerRocketDriverSwingHitSpeedField.SetValue(__instance.SwingSettings, _originalMaxPowerRocketDriverSwingHitSpeed * num5); MinPowerRocketDriverPuttHitSpeedField.SetValue(__instance.SwingSettings, _originalMinPowerRocketDriverPuttHitSpeed * num5); MaxPowerRocketDriverPuttHitSpeedField.SetValue(__instance.SwingSettings, _originalMaxPowerRocketDriverPuttHitSpeed * num5); } else { _originalMaxPowerSwingHitSpeed = __instance.SwingSettings.MaxPowerSwingHitSpeed; MaxPowerSwingHitSpeedField.SetValue(__instance.SwingSettings, _originalMaxPowerSwingHitSpeed * num5); } } IssaPluginPlugin.Log.LogInfo((object)$"[BatSpinach Prefix] bat={BatActive} spinach={flag2} rocketDriver={flag} N={num5:F2} power={power} isPutt={isPutt}"); } private static void Postfix(Hittable __instance, PlayerGolfer hitter) { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (_pendingMultiplier > 1f && (Object)(object)__instance.SwingSettings != (Object)null) { if (WasRocketDriver) { MinPowerRocketDriverSwingHitSpeedField.SetValue(__instance.SwingSettings, _originalMinPowerRocketDriverSwingHitSpeed); MaxPowerRocketDriverSwingHitSpeedField.SetValue(__instance.SwingSettings, _originalMaxPowerRocketDriverSwingHitSpeed); MinPowerRocketDriverPuttHitSpeedField.SetValue(__instance.SwingSettings, _originalMinPowerRocketDriverPuttHitSpeed); MaxPowerRocketDriverPuttHitSpeedField.SetValue(__instance.SwingSettings, _originalMaxPowerRocketDriverPuttHitSpeed); } else { MaxPowerSwingHitSpeedField.SetValue(__instance.SwingSettings, _originalMaxPowerSwingHitSpeed); } } if (_pendingMultiplier <= 1f || !__instance.AsEntity.HasRigidbody) { return; } Rigidbody rigidbody = __instance.AsEntity.Rigidbody; TotalMultiplier = _pendingMultiplier; RecentHit = true; ManualLogSource log = IssaPluginPlugin.Log; object arg = TotalMultiplier; object arg2 = rigidbody.linearVelocity; Vector3 linearVelocity = rigidbody.linearVelocity; log.LogInfo((object)$"[BatSpinach Postfix] N={arg:F2} vel={arg2} (mag={((Vector3)(ref linearVelocity)).magnitude:F2})"); ((MonoBehaviour)IssaPluginPlugin.Instance).StartCoroutine(TrackVelocityAfterHit(rigidbody)); if (BatActive && __instance.AsEntity.IsGolfBall && (Object)(object)hitter != (Object)null && ((NetworkBehaviour)hitter).isLocalPlayer) { PlayerInventory inventory = hitter.PlayerInfo.Inventory; int equippedItemIndex = inventory.EquippedItemIndex; if (equippedItemIndex >= 0) { IssaPluginPlugin.Log.LogInfo((object)"[HitWithGolfSwingInternalPatch PostFix] ConsumeItemAtSlot called!"); ItemHelper.ConsumeItemAtSlot(inventory, equippedItemIndex); } } } } [HarmonyPatch] internal static class HitWithSwingProjectilePatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Hittable), "HitWithSwingProjectile", (Type[])null, (Type[])null); } private static void Prefix(Hittable __instance, Vector3 localHitPosition, Vector3 worldHitDirection, float normalizedHitSpeed, Hittable hitter, bool wasHoming, PlayerGolfer responsiblePlayer) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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 (HitWithGolfSwingInternalPatch.RecentHit) { Rigidbody val = (__instance.AsEntity.HasRigidbody ? __instance.AsEntity.Rigidbody : null); IssaPluginPlugin.Log.LogInfo((object)string.Format("[SwingProjectileHit] worldHitDir={0} normalizedHitSpeed={1:F3} currentVel={2}", worldHitDirection, normalizedHitSpeed, ((val != null) ? ((object)val.linearVelocity/*cast due to .constrained prefix*/).ToString() : null) ?? "no rb")); } } } [HarmonyPatch] internal static class ApplyAirDampingStablePatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Hittable), "ApplyAirDamping", (Type[])null, (Type[])null); } private static bool Prefix(Hittable __instance, float defaultLinearAirDragFactor, float rocketDriverSwingLinearAirDragFactor, float jumboBurgerGiantSwingLinearAirDragFactor, bool shouldApplyWind) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (!HitWithGolfSwingInternalPatch.RecentHit) { return true; } if (!__instance.AsEntity.IsGolfBall || !__instance.AsEntity.HasRigidbody) { return true; } float totalMultiplier = HitWithGolfSwingInternalPatch.TotalMultiplier; if (totalMultiplier <= 1f) { return true; } Rigidbody rigidbody = __instance.AsEntity.Rigidbody; Vector3 linearVelocity = rigidbody.linearVelocity; float sqrMagnitude = ((Vector3)(ref linearVelocity)).sqrMagnitude; float num = (HitWithGolfSwingInternalPatch.WasRocketDriver ? rocketDriverSwingLinearAirDragFactor : defaultLinearAirDragFactor); float num2 = num / (totalMultiplier * totalMultiplier); float fixedDeltaTime = Time.fixedDeltaTime; float num3 = num2 * sqrMagnitude * fixedDeltaTime; float num4 = num3 / (1f + num3); rigidbody.linearVelocity -= linearVelocity * num4; return false; } } [HarmonyPatch] internal static class OnFinishedSwingingPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerGolfer), "OnFinishedSwinging", (Type[])null, (Type[])null); } private static void Postfix(PlayerGolfer __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).isLocalPlayer) { return; } PlayerInventory inventory = __instance.PlayerInfo.Inventory; if (inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.BaseballBatItemType) { int equippedItemIndex = inventory.EquippedItemIndex; if (equippedItemIndex >= 0) { IssaPluginPlugin.Log.LogInfo((object)"[OnFinishedSwingingPatch PostFix] ConsumeItemAtSlot called!"); ItemHelper.ConsumeItemAtSlot(inventory, equippedItemIndex); } } } } internal class BearOrbitalLaserTracker : MonoBehaviour { public readonly HashSet HitBears = new HashSet(); } [HarmonyPatch(typeof(OrbitalLaser), "OnBUpdate")] internal static class BearOrbitalLaserHitPatch { private static readonly FieldInfo _stateField = AccessTools.Field(typeof(OrbitalLaser), "state"); private static void Postfix(OrbitalLaser __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013c: 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_0144: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } OrbitalLaserState val = (OrbitalLaserState)_stateField.GetValue(__instance); if ((int)val != 3) { return; } BearOrbitalLaserTracker bearOrbitalLaserTracker = ((Component)__instance).GetComponent(); if ((Object)(object)bearOrbitalLaserTracker == (Object)null) { bearOrbitalLaserTracker = ((Component)__instance).gameObject.AddComponent(); } Vector3 networktargetPosition = __instance.NetworktargetPosition; float orbitalLaserExplosionMaxRange = GameManager.ItemSettings.OrbitalLaserExplosionMaxRange; Collider[] array = Physics.OverlapSphere(networktargetPosition, orbitalLaserExplosionMaxRange, -1, (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val2 in array2) { BearHitReceiver componentInParent = ((Component)val2).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && bearOrbitalLaserTracker.HitBears.Add(((Component)componentInParent).gameObject)) { float value = ModConfig.Bear.DamageOrbitalLaser.Value; IssaPluginPlugin.Log.LogInfo((object)($"[Bear] Orbital laser hit bear at {((Component)componentInParent).transform.position} " + $"— {value} damage.")); NetworkServer.SendToAll(new BearHitVfxMessage { HitPoint = ((Component)componentInParent).transform.position + Vector3.up * 1f, AttackerOrigin = networktargetPosition }, 0, false); componentInParent.DealDamage(value); } } } } [HarmonyPatch(typeof(Rocket), "ServerExplode")] internal static class BearRocketExplosionPatch { private static readonly HashSet _notifiedBears = new HashSet(); private static FieldInfo _launcherField; private static bool _launcherFieldSearched; private static readonly string[] LauncherFieldCandidates = new string[5] { "launcher", "_launcher", "launcherInfo", "playerInfo", "_playerInfo" }; private static void Prefix(Rocket __instance) { if (!NetworkServer.active) { return; } if (!_launcherFieldSearched) { _launcherFieldSearched = true; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; string[] launcherFieldCandidates = LauncherFieldCandidates; foreach (string text in launcherFieldCandidates) { FieldInfo field = typeof(Rocket).GetField(text, bindingAttr); if (field != null && (field.FieldType == typeof(PlayerInfo) || field.FieldType.IsSubclassOf(typeof(PlayerInfo)))) { _launcherField = field; IssaPluginPlugin.Log.LogInfo((object)("[BearRocketPatch] Found launcher field: '" + text + "'")); break; } } if (_launcherField == null) { IssaPluginPlugin.Log.LogWarning((object)"[BearRocketPatch] Could not find Rocket launcher field. Bear aggro will not track rocket attackers. Check decompiled Rocket source and update LauncherFieldCandidates."); } } object? obj = _launcherField?.GetValue(__instance); PlayerInfo currentAttacker = (PlayerInfo)((obj is PlayerInfo) ? obj : null); BearExplosionAttackerContext.CurrentAttacker = currentAttacker; } private static void Postfix(Rocket __instance, Vector3 worldPosition) { //IL_0014: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } try { Collider[] array = Physics.OverlapSphere(worldPosition, 8f, -1, (QueryTriggerInteraction)2); _notifiedBears.Clear(); Collider[] array2 = array; foreach (Collider val in array2) { BearHitReceiver componentInParent = ((Component)val).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && _notifiedBears.Add(((Component)componentInParent).gameObject)) { float num = Vector3.Distance(worldPosition, ((Component)componentInParent).transform.position); bool flag = num < 1.5f; float num2 = (flag ? ModConfig.Bear.DamageRocketDirect.Value : ModConfig.Bear.DamageRocketExplosion.Value); IssaPluginPlugin.Log.LogInfo((object)(string.Format("[Bear] Rocket {0} at {1} ", flag ? "direct hit" : "splash", worldPosition) + $"(dist={num:F1}) — {num2} damage.")); componentInParent.DealDamage(num2); } } } finally { BearExplosionAttackerContext.CurrentAttacker = null; } } } [HarmonyPatch(typeof(VfxManager), "PlayElephantGunMissForAllClients")] internal static class ElephantGunBearHitPatch { private static void Postfix(PlayerInventory shootingPlayer, Vector3 direction) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !((Object)(object)shootingPlayer == (Object)null)) { BearWeaponHitHelper.TryHitBearAlongRay(shootingPlayer.PlayerInfo, shootingPlayer.GetElephantGunBarrelEndPosition(), direction, ModConfig.Bear.DamageElephantGun.Value); } } } [HarmonyPatch(typeof(VfxManager), "PlayDuelingPistolMissForAllClients")] internal static class DuelingPistolBearHitPatch { private static void Postfix(PlayerInventory shootingPlayer, Vector3 direction) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !((Object)(object)shootingPlayer == (Object)null)) { BearWeaponHitHelper.TryHitBearAlongRay(shootingPlayer.PlayerInfo, shootingPlayer.GetDuelingPistolBarrelEndPosition(), direction, ModConfig.Bear.DamageDuelingPistol.Value); } } } [HarmonyPatch] internal static class BearSwingClientDetectionPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerGolfer), "ReleaseSwingChargeInternal", (Type[])null, (Type[])null); } private static void Postfix(PlayerGolfer __instance) { if (((NetworkBehaviour)__instance).isLocalPlayer) { ((MonoBehaviour)__instance).StartCoroutine(BearSwingDetectionRoutine(__instance)); } } private static IEnumerator BearSwingDetectionRoutine(PlayerGolfer golfer) { yield return (object)new WaitForSeconds(GameManager.GolfSettings.SwingHitStartTime); float hitWindowDuration = GameManager.GolfSettings.SwingHitEndTime - GameManager.GolfSettings.SwingHitStartTime; float elapsed = 0f; HashSet hitBears = new HashSet(); while (golfer.IsSwinging && elapsed < hitWindowDuration) { Vector3 swingCenter = ((Component)golfer).transform.TransformPoint(GameManager.GolfSettings.SwingHitBoxLocalCenter); Collider[] colliders = Physics.OverlapSphere(swingCenter, ModConfig.Bear.MeleeHitRange.Value, -1, (QueryTriggerInteraction)2); Collider[] array = colliders; foreach (Collider col in array) { BearMarker marker = ((Component)col).GetComponentInParent(); if (!((Object)(object)marker == (Object)null)) { NetworkIdentity ni = ((Component)marker).GetComponent(); if (!((Object)(object)ni == (Object)null) && hitBears.Add(ni.netId)) { NetworkClient.Send(new BearSwingHitMessage { BearNetId = ni.netId }, 0); } } } elapsed += Time.deltaTime; yield return null; } } } [HarmonyPatch(typeof(PlayerGolfer), "OnFinishedSwinging")] internal static class GolfClubBearHitPatch { private static void Postfix(PlayerGolfer __instance) { if (!NetworkServer.active) { return; } PlayerInfo playerInfo = __instance.PlayerInfo; if ((Object)(object)playerInfo == (Object)null) { BearNetworkBridge.SwingHitPairs.Clear(); return; } HashSet hashSet = new HashSet(); foreach (var swingHitPair in BearNetworkBridge.SwingHitPairs) { if ((Object)(object)swingHitPair.Item1 == (Object)(object)playerInfo) { hashSet.Add(swingHitPair.Item2); } } BearMeleeHitHelper.HitBearsInSwingRange(__instance, hashSet, "golf club (fallback)"); BearNetworkBridge.SwingHitPairs.RemoveWhere(((PlayerInfo, GameObject) pair) => (Object)(object)pair.Item1 == (Object)(object)playerInfo); } } internal static class BearMeleeHitHelper { private static readonly HashSet _compoundDedup = new HashSet(); internal static void HitBearsInSwingRange(PlayerGolfer swinger, HashSet skipSet, string label) { //IL_0031: 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) //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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) PlayerInfo playerInfo = swinger.PlayerInfo; if ((Object)(object)playerInfo == (Object)null) { return; } PlayerInventory inventory = playerInfo.Inventory; bool flag = ((inventory != null) ? new ItemType?(inventory.GetEffectivelyEquippedItem(true)) : ((ItemType?)null)) == (ItemType?)ItemRegistry.BaseballBatItemType; float num = (flag ? ModConfig.Bear.DamageBaseballBat.Value : ModConfig.Bear.DamageGolfClub.Value); float force = (flag ? ModConfig.Bear.BatKnockbackForce.Value : ModConfig.Bear.MeleeKnockbackForce.Value); Vector3 val = ((Component)swinger).transform.TransformPoint(GameManager.GolfSettings.SwingHitBoxLocalCenter); Collider[] array = Physics.OverlapSphere(val, ModConfig.Bear.MeleeHitRange.Value, -1, (QueryTriggerInteraction)2); _compoundDedup.Clear(); Collider[] array2 = array; foreach (Collider val2 in array2) { BearHitReceiver componentInParent = ((Component)val2).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && _compoundDedup.Add(((Component)componentInParent).gameObject) && (skipSet == null || !skipSet.Contains(((Component)componentInParent).gameObject))) { Vector3 val3 = ((Component)componentInParent).transform.position - ((Component)playerInfo).transform.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; val3 = normalized + Vector3.up * 0.5f; normalized = ((Vector3)(ref val3)).normalized; BearExplosionAttackerContext.CurrentAttacker = playerInfo; componentInParent.DealDamage(num); BearExplosionAttackerContext.CurrentAttacker = null; componentInParent.Behaviour?.ApplyMeleeKnockback(normalized, force); NetworkServer.SendToAll(new BearHitVfxMessage { HitPoint = ((Component)componentInParent).transform.position + Vector3.up * 1f, AttackerOrigin = ((Component)playerInfo).transform.position }, 0, false); IssaPluginPlugin.Log.LogInfo((object)("[Bear] Hit by " + (flag ? "baseball bat" : label) + " " + $"from {playerInfo.PlayerId.PlayerName} for {num} damage.")); } } } } internal static class BearWeaponHitHelper { private const float MaxGunRange = 300f; internal static void TryHitBearAlongRay(PlayerInfo attacker, Vector3 origin, Vector3 direction, float damage) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0016: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!(direction == Vector3.zero) && Physics.Raycast(origin, direction, ref val, 300f, -1, (QueryTriggerInteraction)1)) { BearHitReceiver componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null)) { BearExplosionAttackerContext.CurrentAttacker = attacker; componentInParent.DealDamage(damage); BearExplosionAttackerContext.CurrentAttacker = null; NetworkServer.SendToAll(new BearHitVfxMessage { HitPoint = ((RaycastHit)(ref val)).point, AttackerOrigin = origin }, 0, false); IssaPluginPlugin.Log.LogInfo((object)$"[Bear] Hit by gun shot from {((attacker != null) ? attacker.PlayerId.PlayerName : null)} for {damage} damage."); } } } } [HarmonyPatch(typeof(VfxManager), "PlayElephantGunHitInternal")] internal static class ElephantGunBloodSplatterPatch { private static void Postfix(PlayerInventory shootingPlayer, ref GunShotHitVfxData hitData) { //IL_0038: 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_003f: 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) if (!hitData.hitElectromagnetShield && !((Object)(object)hitData.hitHittable == (Object)null) && hitData.hitHittable.AsEntity.IsPlayer) { Vector3 elephantGunBarrelEndPosition = shootingPlayer.GetElephantGunBarrelEndPosition(); BloodSplatterHelper.SpawnBloodSplatter(((GunShotHitVfxData)(ref hitData)).GetHitPoint(), elephantGunBarrelEndPosition); } } } [HarmonyPatch(typeof(VfxManager), "PlayDuelingPistolHitInternal")] internal static class DuelingPistolBloodSplatterPatch { private static void Postfix(PlayerInventory shootingPlayer, ref GunShotHitVfxData hitData) { //IL_0038: 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_003f: 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) if (!hitData.hitElectromagnetShield && !((Object)(object)hitData.hitHittable == (Object)null) && hitData.hitHittable.AsEntity.IsPlayer) { Vector3 duelingPistolBarrelEndPosition = shootingPlayer.GetDuelingPistolBarrelEndPosition(); BloodSplatterHelper.SpawnBloodSplatter(((GunShotHitVfxData)(ref hitData)).GetHitPoint(), duelingPistolBarrelEndPosition); } } } internal static class BloodSplatterHelper { private const float Lifetime = 3f; internal static void SpawnBloodSplatter(Vector3 hitPoint, Vector3 barrelEnd) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0055: Unknown result type (might be due to invalid IL or missing references) if (!ModConfig.Global.BloodEffectsEnabled.Value) { return; } GameObject bloodSplatterPrefab = AssetLoader.BloodSplatterPrefab; if (!((Object)(object)bloodSplatterPrefab == (Object)null)) { Vector3 val = hitPoint - barrelEnd; Vector3 val2 = ((Vector3)(ref val)).normalized; if (val2 == Vector3.zero) { val2 = Vector3.forward; } GameObject val3 = Object.Instantiate(bloodSplatterPrefab, hitPoint, Quaternion.LookRotation(val2)); Object.Destroy((Object)(object)val3, 3f); } } } [HarmonyPatch] internal static class CoffeeDispenserRedBullPatch { private static readonly FieldInfo ItemTypeField = AccessTools.Field(typeof(PhysicalItem), "itemType"); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PhysicalItem), "OnStartServer", (Type[])null, (Type[])null); } private static void Postfix(PhysicalItem __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((int)(ItemType)ItemTypeField.GetValue(__instance) == 1 && Random.value < ModConfig.RedBull.DispenserChance.Value) { ItemTypeField.SetValue(__instance, ItemRegistry.RedBullItemType); ((MonoBehaviour)__instance).StartCoroutine(BroadcastVisualSwap(((NetworkBehaviour)__instance).netId)); IssaPluginPlugin.Log.LogInfo((object)"[CoffeeDispenser] Red Bull can substituted."); } } private static IEnumerator BroadcastVisualSwap(uint netId) { yield return null; NetworkServer.SendToAll(new CoffeeDispenserRedBullMessage { NetId = netId }, 0, false); } } internal static class CoffeeDispenserClientHandlers { private static readonly FieldInfo ItemTypeField = AccessTools.Field(typeof(PhysicalItem), "itemType"); public static void HandleVisualSwap(CoffeeDispenserRedBullMessage msg) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_01a5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.spawned.TryGetValue(msg.NetId, out var value)) { IssaPluginPlugin.Log.LogWarning((object)$"[CoffeeDispenser] Visual swap: object {msg.NetId} not found on client."); return; } PhysicalItem component = ((Component)value).GetComponent(); if ((Object)(object)component == (Object)null) { return; } ItemTypeField.SetValue(component, ItemRegistry.RedBullItemType); if ((Object)(object)AssetLoader.RedBullHandheldPrefab == (Object)null) { return; } MeshFilter[] componentsInChildren = AssetLoader.RedBullHandheldPrefab.GetComponentsInChildren(); MeshFilter[] componentsInChildren2 = ((Component)component).GetComponentsInChildren(); int num = Mathf.Min(componentsInChildren.Length, componentsInChildren2.Length); for (int i = 0; i < num; i++) { float num2; Bounds bounds; Vector3 size; if (!((Object)(object)componentsInChildren2[i].sharedMesh != (Object)null)) { num2 = 0f; } else { bounds = componentsInChildren2[i].sharedMesh.bounds; size = ((Bounds)(ref bounds)).size; num2 = ((Vector3)(ref size)).magnitude; } float num3 = num2; float num4; if (!((Object)(object)componentsInChildren[i].sharedMesh != (Object)null)) { num4 = 0f; } else { bounds = componentsInChildren[i].sharedMesh.bounds; size = ((Bounds)(ref bounds)).size; num4 = ((Vector3)(ref size)).magnitude; } float num5 = num4; componentsInChildren2[i].sharedMesh = componentsInChildren[i].sharedMesh; MeshRenderer component2 = ((Component)componentsInChildren[i]).GetComponent(); MeshRenderer component3 = ((Component)componentsInChildren2[i]).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null) { ((Renderer)component3).sharedMaterials = ((Renderer)component2).sharedMaterials; } if (num3 > 0.001f && num5 > 0.001f) { Transform transform = ((Component)componentsInChildren2[i]).transform; transform.localScale *= num3 / num5; } } for (int j = num; j < componentsInChildren2.Length; j++) { MeshRenderer component4 = ((Component)componentsInChildren2[j]).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Renderer)component4).enabled = false; } } } } internal static class DevConsoleCommands { [CCommand("giveCustomItem", "Give a custom mod item. Usage: giveCustomItem ", false, false)] private static void GiveCustomItem(string itemName) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (int.TryParse(itemName, out var result)) { CustomItemDefinition definition = ItemRegistry.GetDefinition((ItemType)result); if (definition == null) { Debug.LogWarning((object)$"[giveCustomItem] Item ID {result} is not a recognised custom item."); } else { ItemHelper.GiveItemToLocalPlayer(definition.ItemType, definition.MaxUses, "giveCustomItem"); } return; } foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { string[] consoleAliases = allItem.ConsoleAliases; foreach (string b in consoleAliases) { if (string.Equals(itemName, b, StringComparison.OrdinalIgnoreCase)) { ItemHelper.GiveItemToLocalPlayer(allItem.ItemType, allItem.MaxUses, "giveCustomItem"); return; } } } string text = string.Join(", ", ItemRegistry.AllItems.SelectMany((CustomItemDefinition d) => d.ConsoleAliases)); Debug.LogWarning((object)("[giveCustomItem] Unknown item \"" + itemName + "\". Valid names: " + text + " (or an integer item-type ID).")); } [CCommand("vote", "Start a custom-item enable/disable vote. Usage: vote ", false, false)] private static void StartVote(string timeoutStr) { if (!float.TryParse(timeoutStr, out var result) || result <= 0f) { Debug.LogWarning((object)("[vote] Invalid timeout \"" + timeoutStr + "\". Must be a positive number.")); } else if ((Object)(object)VoteManager.Instance == (Object)null) { Debug.LogWarning((object)"[vote] VoteManager is not initialised."); } else { VoteManager.Instance.StartVote(result); } } [CCommand("spawnConfigUI", "Open or close the Spawn Config GUI panel.", false, false)] private static void ToggleSpawnConfigUI() { if ((Object)(object)SpawnConfigUI.Instance == (Object)null) { Debug.LogWarning((object)"[spawnConfigUI] SpawnConfigUI is not initialised yet."); } else { SpawnConfigUI.Instance.Toggle(); } } } [HarmonyPatch(typeof(BNetworkManager), "OnPlayerConfirmedCheatingDetected")] internal static class SuppressCheatKickPatch { private static bool Prefix() { return false; } } [HarmonyPatch(typeof(Entity), "GetNetworkedPointVelocity")] internal static class EntityGetNetworkedPointVelocityPatch { private static readonly PropertyInfo NetworkRigidbodyProp = AccessTools.Property(typeof(Entity), "NetworkRigidbody"); private static bool Prefix(Entity __instance, Vector3 worldPoint, ref Vector3 __result) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.Rigidbody != (Object)null && NetworkRigidbodyProp?.GetValue(__instance) == null) { __result = __instance.Rigidbody.GetPointVelocity(worldPoint); return false; } return true; } } [HarmonyPatch] internal static class ServerExplodeScalePatch { private static readonly Collider[] overlappingColliderBuffer = (Collider[])(object)new Collider[100]; private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Rocket), "ServerExplode", (Type[])null, (Type[])null); } private static void Postfix(Rocket __instance, Vector3 worldPosition) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) float scale = ExplosionScaler.GetScale(__instance); ExplosionScaler.Unregister(__instance); if (scale <= 0f || Mathf.Approximately(scale, 1f)) { return; } float rocketExplosionRange = GameManager.ItemSettings.RocketExplosionRange; float num = rocketExplosionRange * scale; IssaPluginPlugin.Log.LogInfo((object)($"[Explosion] Custom rocket scale={scale:F2}, " + $"baseRange={rocketExplosionRange:F1}, scaledRange={num:F1}")); NetworkServer.SendToAll(new ScaledExplosionVfxMessage { Position = worldPosition, Scale = scale }, 0, false); int num2 = LayerMask.op_Implicit(GameManager.LayerSettings.RocketHittablesMask); int num3 = Physics.OverlapSphereNonAlloc(worldPosition, num, overlappingColliderBuffer, num2, (QueryTriggerInteraction)1); float num4 = (scale - 1f) * 25f; HashSet hashSet = new HashSet(); for (int i = 0; i < num3; i++) { Collider val = overlappingColliderBuffer[i]; Rigidbody componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && hashSet.Add(componentInParent)) { componentInParent.AddExplosionForce(num4, worldPosition, num, 0.3f, (ForceMode)2); } } IssaPluginPlugin.Log.LogInfo((object)($"[Explosion] Bonus force={num4:F1} applied to " + $"{hashSet.Count} rigidbodies within {num:F1}m")); } } [HarmonyPatch] internal static class ExplosiveGolfBallsSwingPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Hittable), "HitWithGolfSwingInternal", (Type[])null, (Type[])null); } private static void Postfix(Hittable __instance, PlayerGolfer hitter, Hittable homingTargetHittable) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)hitter == (Object)null || !__instance.AsEntity.IsGolfBall) { return; } PlayerInfo playerInfo = hitter.PlayerInfo; PlayerInventory val = ((playerInfo != null) ? playerInfo.Inventory : null); if (!((Object)(object)val == (Object)null)) { int num = ItemRegistry.FindSlotIndex(val, ItemRegistry.ExplosiveGolfBallsItemType); bool flag = (Object)(object)homingTargetHittable != (Object)null; if (num >= 0 && !((Object)(object)((Component)__instance).GetComponent() != (Object)null) && (!ModConfig.ExplosiveGolfBalls.LockOnOnly.Value || flag)) { ItemHelper.ConsumeItemAtSlot(val, num); ExplosiveGolfBallsBehaviour explosiveGolfBallsBehaviour = ((Component)__instance).gameObject.AddComponent(); explosiveGolfBallsBehaviour.Hitter = hitter; explosiveGolfBallsBehaviour.ExplosionScale = ModConfig.ExplosiveGolfBalls.ExplosionScale.Value; IssaPluginPlugin.Log.LogInfo((object)$"[ExplosiveGolfBalls] Postfix: behaviour attached. scale={explosiveGolfBallsBehaviour.ExplosionScale}"); } } } } [HarmonyPatch] internal static class FizzyFacepunchClientSendPatch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("Mirror.FizzySteam.FizzyFacepunch"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[FizzyPatch] Mirror.FizzySteam.FizzyFacepunch not found — patch skipped."); return null; } MethodInfo methodInfo = AccessTools.Method(type, "ClientSend", (Type[])null, (Type[])null); if (methodInfo == null) { IssaPluginPlugin.Log.LogWarning((object)"[FizzyPatch] FizzyFacepunch.ClientSend not found — patch skipped."); } return methodInfo; } private static Exception Finalizer(Exception __exception) { if (__exception is NullReferenceException) { IssaPluginPlugin.Log.LogDebug((object)"[FizzyPatch] Suppressed NullReferenceException in FizzyFacepunch.ClientSend (transport connection was null — normal during connect/disconnect transitions)."); return null; } return __exception; } } [HarmonyPatch] internal static class FlamethrowerMovementPatch { private static readonly MethodBase TargetMb; private static readonly FieldInfo MoveVector2dField; private static float _panicAngle; private static float _panicAngleChangeRate; private static float _panicDirectionTimer; static FlamethrowerMovementPatch() { Type type = AccessTools.TypeByName("PlayerMovement"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[Flamethrower] PlayerMovement type not found — panic movement patch skipped."); return; } TargetMb = AccessTools.Method(type, "ProcessMovementInput", (Type[])null, (Type[])null); if (TargetMb == null) { IssaPluginPlugin.Log.LogWarning((object)"[Flamethrower] PlayerMovement.ProcessMovementInput not found — panic movement patch skipped."); return; } MoveVector2dField = AccessTools.Field(type, "moveVector2d"); if (MoveVector2dField == null) { IssaPluginPlugin.Log.LogWarning((object)"[Flamethrower] PlayerMovement.moveVector2d not found — panic movement patch skipped."); } IssaPluginPlugin.Log.LogInfo((object)"[Flamethrower] Panic movement patch ready."); } private static MethodBase TargetMethod() { return TargetMb; } private static void Prefix(object __instance) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (!FlamethrowerNetworkBridge.LocalPlayerIsBurning || MoveVector2dField == null) { return; } NetworkBehaviour val = (NetworkBehaviour)((__instance is NetworkBehaviour) ? __instance : null); if (!((Object)(object)val == (Object)null) && val.isLocalPlayer) { _panicDirectionTimer -= Time.deltaTime; if (_panicDirectionTimer <= 0f) { _panicAngleChangeRate = Random.Range(-5f, 5f); _panicDirectionTimer = Random.Range(0.2f, 0.6f); } _panicAngle += _panicAngleChangeRate * Time.deltaTime; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(Mathf.Sin(_panicAngle), Mathf.Cos(_panicAngle)); MoveVector2dField.SetValue(__instance, val2); } } } [HarmonyPatch] internal static class FreezeMovementPatch { private static readonly MethodBase TargetMb; private static readonly PropertyInfo VelocityProp; private static readonly FieldInfo VelocityField; static FreezeMovementPatch() { Type type = AccessTools.TypeByName("PlayerMovement"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[Freeze] PlayerMovement type not found — walking slide patch skipped."); return; } TargetMb = AccessTools.Method(type, "ApplyHorizontalDrag", (Type[])null, (Type[])null); if (TargetMb == null) { IssaPluginPlugin.Log.LogWarning((object)"[Freeze] PlayerMovement.ApplyHorizontalDrag not found — slide patch skipped."); return; } VelocityProp = AccessTools.Property(type, "Velocity"); VelocityField = ((VelocityProp == null) ? AccessTools.Field(type, "velocity") : null); IssaPluginPlugin.Log.LogInfo((object)("[Freeze] Movement patch ready. Velocity via " + ((VelocityProp != null) ? "property" : "field") + ".")); } private static MethodBase TargetMethod() { return TargetMb; } private static void Prefix(object __instance, out Vector3 __state) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) __state = GetVelocity(__instance); } private static void Postfix(object __instance, Vector3 __state) { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_00d2: 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_00e3: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (!FreezeItem.IsFrozen) { return; } Keyboard current = Keyboard.current; if (current != null && (((ButtonControl)current[(Key)37]).isPressed || ((ButtonControl)current[(Key)15]).isPressed || ((ButtonControl)current[(Key)33]).isPressed || ((ButtonControl)current[(Key)18]).isPressed || ((ButtonControl)current[(Key)63]).isPressed || ((ButtonControl)current[(Key)64]).isPressed || ((ButtonControl)current[(Key)61]).isPressed || ((ButtonControl)current[(Key)62]).isPressed)) { return; } PlayerGolfer localPlayerAsGolfer = GameManager.LocalPlayerAsGolfer; if ((Object)(object)localPlayerAsGolfer != (Object)null) { GolfBall ownBall = localPlayerAsGolfer.OwnBall; if ((Object)(object)ownBall != (Object)null) { Vector3 position = ((Component)__instance).transform.position; Vector3 val = position - ((Component)ownBall).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; float value = ModConfig.Freeze.GripRadius.Value; if (sqrMagnitude <= value * value) { return; } } } float num = __state.x * __state.x + __state.z * __state.z; if (!(num < 0.01f)) { Vector3 velocity = GetVelocity(__instance); SetVelocity(__instance, new Vector3(__state.x * 0.98f, velocity.y, __state.z * 0.98f)); } } private static Vector3 GetVelocity(object instance) { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (VelocityProp != null) { return (Vector3)VelocityProp.GetValue(instance); } if (VelocityField != null) { return (Vector3)VelocityField.GetValue(instance); } return Vector3.zero; } private static void SetVelocity(object instance, Vector3 value) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (VelocityProp != null) { VelocityProp.SetValue(instance, value); } else { VelocityField?.SetValue(instance, value); } } } public class FreezePhysicsHandler : MonoBehaviour { private PhysicsMaterial _iceMat; private readonly Dictionary _originalMaterials = new Dictionary(); private readonly Dictionary _originalBallMaterials = new Dictionary(); private readonly Dictionary _savedWheelFriction = new Dictionary(); private bool _freezeApplied; private static readonly int TerrainLayer = LayerMask.NameToLayer("Terrain"); private static readonly int DefaultLayer = LayerMask.NameToLayer("Default"); private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown _iceMat = new PhysicsMaterial("IceMat") { staticFriction = 0.02f, dynamicFriction = 0.02f, bounciness = 0.15f, frictionCombine = (PhysicsMaterialCombine)2, bounceCombine = (PhysicsMaterialCombine)3 }; } private void OnDestroy() { if (_freezeApplied) { RestoreOriginalMaterials(); } if ((Object)(object)_iceMat != (Object)null) { Object.Destroy((Object)(object)_iceMat); } } private void OnEnable() { Physics.ContactModifyEvent += OnContactModify; } private void OnDisable() { Physics.ContactModifyEvent -= OnContactModify; } private void Update() { if (FreezeItem.IsFrozen && !_freezeApplied) { ApplyIceMaterials(); } else if (!FreezeItem.IsFrozen && _freezeApplied) { RestoreOriginalMaterials(); } } private bool IsGroundCollider(Collider col) { if (col.isTrigger) { return false; } if (col is TerrainCollider) { return true; } int layer = ((Component)col).gameObject.layer; return layer == TerrainLayer || layer == DefaultLayer; } private void ApplyIceMaterials() { _freezeApplied = true; _originalMaterials.Clear(); _iceMat.staticFriction = ModConfig.Freeze.Friction.Value; _iceMat.dynamicFriction = ModConfig.Freeze.Friction.Value; _iceMat.bounciness = ModConfig.Freeze.Bounciness.Value; Collider[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Collider val in array) { if (IsGroundCollider(val)) { _originalMaterials[val] = val.sharedMaterial; val.sharedMaterial = _iceMat; } } ApplyBallIce(); ApplyCartIce(); IssaPluginPlugin.Log.LogInfo((object)($"[Freeze] Ice material applied to {_originalMaterials.Count} ground collider(s), " + $"{_originalBallMaterials.Count} ball collider(s), " + $"{_savedWheelFriction.Count} wheel collider(s).")); } private void RestoreOriginalMaterials() { _freezeApplied = false; foreach (var (val3, sharedMaterial) in _originalMaterials) { if ((Object)(object)val3 != (Object)null) { val3.sharedMaterial = sharedMaterial; } } _originalMaterials.Clear(); RestoreBallMaterials(); RestoreWheelFriction(); IssaPluginPlugin.Log.LogInfo((object)"[Freeze] Ground, ball, and cart physics restored."); } private void ApplyBallIce() { _originalBallMaterials.Clear(); GolfBall[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (GolfBall val in array) { SphereCollider collider = val.Collider; if (!((Object)(object)collider == (Object)null)) { _originalBallMaterials[(Collider)(object)collider] = ((Collider)collider).sharedMaterial; ((Collider)collider).sharedMaterial = _iceMat; } } } private void RestoreBallMaterials() { foreach (var (val3, sharedMaterial) in _originalBallMaterials) { if ((Object)(object)val3 != (Object)null) { val3.sharedMaterial = sharedMaterial; } } _originalBallMaterials.Clear(); } private void ApplyCartIce() { //IL_0036: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) _savedWheelFriction.Clear(); float value = ModConfig.Freeze.CartSidewaysStiffness.Value; WheelCollider[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (WheelCollider val in array) { _savedWheelFriction[val] = (val.forwardFriction, val.sidewaysFriction); WheelFrictionCurve sidewaysFriction = val.sidewaysFriction; ((WheelFrictionCurve)(ref sidewaysFriction)).stiffness = value; val.sidewaysFriction = sidewaysFriction; } } private void RestoreWheelFriction() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0048: 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) foreach (KeyValuePair item in _savedWheelFriction) { item.Deconstruct(out var key, out var value); (WheelFrictionCurve, WheelFrictionCurve) tuple = value; WheelCollider val = key; var (forwardFriction, sidewaysFriction) = tuple; if (!((Object)(object)val == (Object)null)) { val.forwardFriction = forwardFriction; val.sidewaysFriction = sidewaysFriction; } } _savedWheelFriction.Clear(); } private void OnContactModify(PhysicsScene scene, NativeArray pairs) { //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_0083: Unknown result type (might be due to invalid IL or missing references) if (!FreezeItem.IsFrozen) { return; } float value = ModConfig.Freeze.Friction.Value; float value2 = ModConfig.Freeze.Bounciness.Value; for (int i = 0; i < pairs.Length; i++) { ModifiableContactPair val = pairs[i]; for (int j = 0; j < ((ModifiableContactPair)(ref val)).contactCount; j++) { ((ModifiableContactPair)(ref val)).SetStaticFriction(j, value); ((ModifiableContactPair)(ref val)).SetDynamicFriction(j, value); ((ModifiableContactPair)(ref val)).SetBounciness(j, value2); } pairs[i] = val; } } } [HarmonyPatch(typeof(PlayerInventory), "TryParseFirearmRaycastResults")] internal static class HunterDroneFirearmHitPatch { private static void Postfix(PlayerInventory __instance, RaycastHit[] raycastResults, int raycastHitCount) { if (!NetworkClient.active) { return; } for (int i = 0; i < raycastHitCount; i++) { Collider collider = ((RaycastHit)(ref raycastResults[i])).collider; if ((Object)(object)collider == (Object)null) { continue; } HunterDroneBehaviour componentInParent = ((Component)collider).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { continue; } NetworkIdentity component = ((Component)componentInParent).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } uint netId = component.netId; if (NetworkServer.active) { componentInParent.ShootDown(); break; } NetworkConnection connectionToServer = ((NetworkBehaviour)__instance).connectionToServer; if (connectionToServer != null) { connectionToServer.Send(new HunterDroneShotMessage { DroneNetId = netId }, 0); } break; } } } [HarmonyPatch(typeof(GameManager))] public class GameManagerPatch { private static readonly FieldInfo _settingsField = AccessTools.Field(typeof(GameManager), "playerInventorySettings"); private static readonly MethodInfo _maxItemsSetter = AccessTools.PropertySetter(typeof(PlayerInventorySettings), "MaxItems"); [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch(GameManager __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown int num = (int)ModConfig.Global.NumInventorySlots.Value; if (num != 3) { PlayerInventorySettings val = (PlayerInventorySettings)_settingsField.GetValue(__instance); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogInfo((object)"[GameManager::PlayerInventorySettings] Failed to increase player inventory size."); return; } _maxItemsSetter.Invoke(val, new object[1] { num }); } } } [HarmonyPatch] internal static class RemoveItemAtForcedDeselectPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "RemoveItemAt", (Type[])null, (Type[])null); } private static void Postfix(PlayerInventory __instance, int index) { if (((NetworkBehaviour)__instance).isLocalPlayer && __instance.EquippedItemIndex == index) { ItemHelper.SetCurrentItemUse(__instance, (ItemUseType)0); __instance.TryDeselectItem(false, false); } } } [HarmonyPatch] internal static class HotkeysGolfCartPreviewBoundsPatch { private static readonly FieldInfo _currentModeField = AccessTools.Field(typeof(Hotkeys), "currentMode"); private static readonly FieldInfo _hotkeyPreviewUisField = AccessTools.Field(typeof(Hotkeys), "hotkeyPreviewUis"); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Hotkeys), "UpdatePlayerInventoryHotkeyInternal", (Type[])null, (Type[])null); } private static bool Prefix(Hotkeys __instance, int inventorySlotIndex) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 HotkeyMode val = (HotkeyMode)_currentModeField.GetValue(__instance); if ((int)val != 2) { return true; } Object[] array = (Object[])_hotkeyPreviewUisField.GetValue(__instance); if (array != null && inventorySlotIndex < array.Length) { return true; } return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class ItemDataNamePatch { private static bool Prefix(ItemData __instance, ref string __result) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CustomItemDefinition definition = ItemRegistry.GetDefinition(__instance.Type); if (definition == null) { return true; } __result = definition.DisplayName; return false; } } [HarmonyPatch] internal static class ItemCollectionInitPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(ItemCollection), "Initialize", (Type[])null, (Type[])null); } private static void Postfix(ItemCollection __instance) { ItemRegistry.InjectCustomItems(__instance); } } [HarmonyPatch] internal static class ServerTryAddItemPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "ServerTryAddItem", (Type[])null, (Type[])null); } private static bool Prefix(PlayerInventory __instance, ItemType itemToAdd, int remainingUses, ref bool __result) { //IL_0001: 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) if (!ItemRegistry.IsCustomItem(itemToAdd)) { return true; } __result = ItemRegistry.DirectAddCustomItem(__instance, itemToAdd, remainingUses); return false; } } [HarmonyPatch] internal static class CmdAddItemPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "UserCode_CmdAddItem__ItemType", (Type[])null, (Type[])null); } private static bool Prefix(PlayerInventory __instance, ItemType item) { //IL_0001: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!ItemRegistry.IsCustomItem(item)) { return true; } ItemRegistry.DirectAddCustomItem(__instance, item, ItemRegistry.GetMaxUses(item)); return false; } } [HarmonyPatch] internal static class ItemSpawnerResetRuntimeDataPatch { private static readonly FieldInfo SpawnChancesField = AccessTools.Field(typeof(ItemPool), "spawnChances"); private static readonly FieldInfo TotalWeightField = AccessTools.Field(typeof(ItemPool), "totalSpawnChanceWeight"); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(ItemSpawnerSettings), "ResetRuntimeData", (Type[])null, (Type[])null); } private static void Postfix(ItemSpawnerSettings __instance) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)__instance.AheadOfBallItemPool == (Object)null; if (flag) { if (__instance.ItemPools.Count > 0) { InjectPool(__instance.ItemPools[0].pool, 5); } } else { InjectPool(__instance.AheadOfBallItemPool, 0); for (int i = 0; i < __instance.ItemPools.Count; i++) { InjectPool(__instance.ItemPools[i].pool, i + 1); } } IssaPluginPlugin.Log.LogInfo((object)("[ItemPool] Custom items injected into " + (flag ? "mobility" : "regular") + " spawner.")); } private static void InjectPool(ItemPool pool, int gamePoolIndex) { //IL_00aa: 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_00b9: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pool == (Object)null || !ModConfig.Global.CustomItemSpawnsEnabled.Value) { return; } float value = ModConfig.Global.CustomItemSpawnRate.Value; if (value <= 0f) { return; } List list = new List(); foreach (CustomItemDefinition allItem in ItemRegistry.AllItems) { if (allItem.Enabled) { float num = allItem.GetPoolWeight(gamePoolIndex) * value; if (!(num <= 0f)) { list.Add(new ItemSpawnChance { item = allItem.ItemType, spawnChanceWeight = num }); MatchSetupRulesPatches.EffectiveWeights[(gamePoolIndex, allItem.ItemType)] = num; } } } if (list.Count != 0) { ItemSpawnChance[] array = ((ItemSpawnChance[])SpawnChancesField.GetValue(pool)) ?? Array.Empty(); ItemSpawnChance[] array2 = (ItemSpawnChance[])(object)new ItemSpawnChance[array.Length + list.Count]; Array.Copy(array, array2, array.Length); for (int i = 0; i < list.Count; i++) { array2[array.Length + i] = list[i]; } SpawnChancesField.SetValue(pool, array2); float num2 = 0f; ItemSpawnChance[] array3 = array2; foreach (ItemSpawnChance val in array3) { num2 += val.spawnChanceWeight; } TotalWeightField.SetValue(pool, num2); } } } [HarmonyPatch] internal static class TryUseItemPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "TryUseItem", (Type[])null, (Type[])null); } private static bool Prefix(PlayerInventory __instance, bool isAirhornReaction, ref bool shouldEatInput, ref bool __result) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected I4, but got Unknown ItemType effectivelyEquippedItem = __instance.GetEffectivelyEquippedItem(true); CustomItemDefinition definition = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition == null) { return true; } if (!SingletonBehaviour.HasInstance && (int)CourseManager.MatchState <= 2) { __result = false; return false; } PlayerInfo playerInfo = __instance.PlayerInfo; PlayerMovement val = ((playerInfo != null) ? playerInfo.Movement : null); if (!((Object)(object)val != (Object)null) || !val.IsKnockedOutOrRecovering) { PlayerInfo playerInfo2 = __instance.PlayerInfo; if (playerInfo2 != null) { Hittable asHittable = playerInfo2.AsHittable; if ((int)((asHittable != null) ? new FrozenState?(asHittable.FrozenState) : ((FrozenState?)null)).GetValueOrDefault() == 2) { goto IL_00ac; } } shouldEatInput = definition.ShouldEatInputOnUse; __result = definition.UseResult; IssaPluginPlugin.Log.LogDebug((object)$"[TryUseItem] Calling OnUse for item={(int)effectivelyEquippedItem} ({definition.GetType().Name}), isAirhornReaction={isAirhornReaction}, shouldEatInput={shouldEatInput}, UseResult={__result}"); definition.OnUse(__instance); return false; } goto IL_00ac; IL_00ac: __result = false; return false; } } [HarmonyPatch] internal static class LocalPlayerUpdateEquipmentSwitchers { private struct CustomEquipState { public GameObject Model; public ItemType ItemType; } private static readonly Dictionary _states = new Dictionary(); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "LocalPlayerUpdateEquipmentSwitchers", (Type[])null, (Type[])null); } private static void Postfix(PlayerInventory __instance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ItemType effectivelyEquippedItem = __instance.GetEffectivelyEquippedItem(true); EquipmentSwitcher rightHandEquipmentSwitcher = __instance.PlayerInfo.RightHandEquipmentSwitcher; CustomItemDefinition definition = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition == null) { ClearCustomModel(__instance); ShowDefaultEquipment(rightHandEquipmentSwitcher); return; } definition.OnEquip(__instance); rightHandEquipmentSwitcher.SetEquipment(definition.EquipmentType); __instance.PlayerInfo.LeftHandEquipmentSwitcher.SetEquipment((EquipmentType)0); EnsureCustomModel(rightHandEquipmentSwitcher, __instance, effectivelyEquippedItem); } private static void HideDefaultEquipment(EquipmentSwitcher switcher) { if (!((Object)(object)switcher.CurrentEquipment == (Object)null)) { Renderer[] componentsInChildren = ((Component)switcher.CurrentEquipment).gameObject.GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } } } internal static void ClearCustomModel(PlayerInventory inventory) { if (_states.TryGetValue(inventory, out var value)) { if ((Object)(object)value.Model != (Object)null) { Object.Destroy((Object)(object)value.Model); } _states.Remove(inventory); } } internal static void EnsureCustomModel(EquipmentSwitcher rightSwitcher, PlayerInventory inventory, ItemType equipped) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0120: Expected I4, but got Unknown GameObject prefabForItem = GetPrefabForItem(equipped); if ((Object)(object)prefabForItem == (Object)null) { return; } if (!_states.TryGetValue(inventory, out var value) || value.ItemType != equipped || (Object)(object)value.Model == (Object)null) { ClearCustomModel(inventory); GameObject val = Object.Instantiate(prefabForItem); val.transform.SetParent(((Component)rightSwitcher).transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; val.SetActive(true); SetLayerRecursive(val, ((Component)rightSwitcher).gameObject.layer); Collider[] componentsInChildren = val.GetComponentsInChildren(); foreach (Collider val2 in componentsInChildren) { val2.enabled = false; } _states[inventory] = new CustomEquipState { Model = val, ItemType = equipped }; IssaPluginPlugin.Log.LogDebug((object)$"[Equipment] Custom model spawned for item {(int)equipped}."); } HideDefaultEquipment(rightSwitcher); } private static GameObject GetPrefabForItem(ItemType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ItemRegistry.GetDefinition(type)?.HeldModelPrefab; } internal static void ShowDefaultEquipment(EquipmentSwitcher switcher) { if (!((Object)(object)switcher.CurrentEquipment == (Object)null)) { Renderer[] componentsInChildren = ((Component)switcher.CurrentEquipment).gameObject.GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { val.enabled = true; } } } private static void SetLayerRecursive(GameObject go, int layer) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown go.layer = layer; foreach (Transform item in go.transform) { Transform val = item; SetLayerRecursive(((Component)val).gameObject, layer); } } public static bool HasCustomModel(PlayerInventory inventory) { CustomEquipState value; return _states.TryGetValue(inventory, out value) && (Object)(object)value.Model != (Object)null; } } [HarmonyPatch] internal static class OnEquipmentTypeChangedPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(EquipmentSwitcher), "OnEquipmentTypeChanged", (Type[])null, (Type[])null); } private static void Postfix(EquipmentSwitcher __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) //IL_005f: Unknown result type (might be due to invalid IL or missing references) PlayerInfo componentInParent = ((Component)__instance).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)__instance != (Object)(object)componentInParent.RightHandEquipmentSwitcher) { return; } PlayerInventory inventory = componentInParent.Inventory; if (!((Object)(object)inventory == (Object)null)) { ItemType effectivelyEquippedItem = inventory.GetEffectivelyEquippedItem(true); if (!ItemRegistry.IsCustomItem(effectivelyEquippedItem)) { LocalPlayerUpdateEquipmentSwitchers.ClearCustomModel(inventory); } else { LocalPlayerUpdateEquipmentSwitchers.EnsureCustomModel(__instance, inventory, effectivelyEquippedItem); } } } } [HarmonyPatch] internal static class CanAimSwingPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerGolfer), "CanAimSwing", (Type[])null, (Type[])null); } private static bool Prefix(PlayerGolfer __instance, ref bool __result) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 PlayerInventory component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (ItemRegistry.IsCustomItem(effectivelyEquippedItem)) { CustomItemDefinition definition = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition == null || (int)definition.EquipmentType != 1) { __result = false; return false; } } return true; } } [HarmonyPatch] internal static class ServerDropCustomItemPatch { private static readonly FieldInfo SlotsField = AccessTools.Field(typeof(PlayerInventory), "slots"); private static readonly MethodInfo RemoveItemAtMethod = AccessTools.Method(typeof(PlayerInventory), "RemoveItemAt", (Type[])null, (Type[])null); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "UserCode_CmdDropItemAt__Int32__Vector3__Vector3__ItemUseId", (Type[])null, (Type[])null); } private static bool Prefix(PlayerInventory __instance, int index, Vector3 playerVelocity, Vector3 playerLocalAngularVelocity, ItemUseId itemUseId) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return true; } IList list = (IList)SlotsField.GetValue(__instance); if (index < 0 || index >= list.Count) { return true; } InventorySlot val = list[index]; if (!ItemRegistry.IsCustomItem(val.itemType)) { return true; } RemoveItemAtMethod.Invoke(__instance, new object[2] { index, false }); if (val.remainingUses <= 0 || (Object)(object)AssetLoader.DroppedCustomItemPrefab == (Object)null) { return false; } Vector3 val2 = ((Component)__instance).transform.position + Vector3.up * GameManager.PlayerInventorySettings.DropItemVerticalOffset + ((Component)__instance).transform.right * GameManager.GolfSettings.SwingHitBoxLocalCenter.x; Vector3 linearVelocity = playerVelocity * 0.25f; Vector3 angularVelocity = ((((Vector3)(ref linearVelocity)).sqrMagnitude > 0.001f) ? (Vector3.Cross(Vector3.up, ((Vector3)(ref linearVelocity)).normalized) * 3f) : Vector3.zero); GameObject val3 = Object.Instantiate(AssetLoader.DroppedCustomItemPrefab, val2, ((Component)__instance).transform.rotation); val3.layer = GameManager.LayerSettings.ItemsLayer; DroppedCustomItem component = val3.GetComponent(); component.ItemType = val.itemType; component.RemainingUses = val.remainingUses; GameObject modelPrefabForType = DroppedCustomItem.GetModelPrefabForType(val.itemType); if ((Object)(object)modelPrefabForType != (Object)null) { GameObject val4 = Object.Instantiate(modelPrefabForType); val4.transform.SetParent(val3.transform, false); val4.transform.localPosition = Vector3.zero; val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = Vector3.one; Rigidbody component2 = val4.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } Collider[] componentsInChildren = val4.GetComponentsInChildren(); foreach (Collider val5 in componentsInChildren) { val5.enabled = true; } val4.SetActive(true); } Rigidbody component3 = val3.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.linearVelocity = linearVelocity; component3.angularVelocity = angularVelocity; component3.isKinematic = false; component3.useGravity = true; } val3.SetActive(true); NetworkServer.Spawn(val3, (NetworkConnectionToClient)null); return false; } } [HarmonyPatch] internal static class LocalPlayerUpdateIsEquipmentForceHiddenPatch { private static readonly FieldInfo _localPlayerIsEquipmentForceHiddenField = AccessTools.Field(typeof(PlayerInventory), "localPlayerIsEquipmentForceHidden"); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerInventory), "LocalPlayerUpdateIsEquipmentForceHidden", (Type[])null, (Type[])null); } private static void Postfix(PlayerInventory __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!(bool)_localPlayerIsEquipmentForceHiddenField.GetValue(__instance)) { ItemType effectivelyEquippedItem = __instance.GetEffectivelyEquippedItem(true); CustomItemDefinition definition = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition != null) { __instance.PlayerInfo.AnimatorIo.OnNetworkedEquippedItemChanged(definition.AnimatorChangedItemType, effectivelyEquippedItem); __instance.PlayerInfo.AnimatorIo.SetEquippedItem(definition.AnimatorItemType); } } } } [HarmonyPatch(typeof(PlayerAnimatorIo), "SetEquippedItem")] internal static class PlayerAnimatorSetEquippedItemPatch { private static void Prefix(PlayerAnimatorIo __instance, ref ItemType equippedItem) { //IL_0003: 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: Expected I4, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected I4, but got Unknown ItemType val = equippedItem; CustomItemDefinition definition = ItemRegistry.GetDefinition(equippedItem); if (definition != null) { equippedItem = (ItemType)(int)definition.AnimatorItemType; } else { if (equippedItem) { return; } PlayerInfo component = ((Component)__instance).GetComponent(); if (!((Object)(object)((component != null) ? component.Inventory : null) == (Object)null)) { ItemType effectivelyEquippedItem = component.Inventory.GetEffectivelyEquippedItem(true); CustomItemDefinition definition2 = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition2 != null) { equippedItem = (ItemType)(int)definition2.AnimatorItemType; } } } } } [HarmonyPatch(typeof(PlayerInventory), "GetEffectivelyEquippedItem")] internal static class GetEffectivelyEquippedItemPatch { private static void Postfix(PlayerInventory __instance, bool ignoreEquipmentHiding, ref ItemType __result) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) if (!ignoreEquipmentHiding) { if (!ignoreEquipmentHiding && ItemRegistry.IsCustomItem(__result)) { __result = (ItemType)0; } if (__instance.GetEffectivelyEquippedItem(true) == ItemRegistry.SniperRifleItemType || __instance.GetEffectivelyEquippedItem(true) == ItemRegistry.AK47ItemType) { __result = (ItemType)3; } } } } [HarmonyPatch(typeof(PlayerInventory), "UpdateIsAimingItem")] internal static class UpdateIsAimingItemPatch { private static readonly PropertyInfo IsAimingItemProp = typeof(PlayerInventory).GetProperty("IsAimingItem", BindingFlags.Instance | BindingFlags.Public); private static void Postfix(PlayerInventory __instance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //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) if (__instance.GetEffectivelyEquippedItem(true) == ItemRegistry.SniperRifleItemType || __instance.GetEffectivelyEquippedItem(true) == ItemRegistry.AK47ItemType) { Mouse current = Mouse.current; bool flag = current != null && current.rightButton.isPressed; bool flag2 = (bool)(IsAimingItemProp?.GetValue(__instance) ?? ((object)false)); PlayerInfo playerInfo = __instance.PlayerInfo; bool? obj; if (playerInfo == null) { obj = null; } else { PlayerInput input = playerInfo.Input; obj = ((input != null) ? new bool?(input.IsHoldingAimSwing) : ((bool?)null)); } bool? flag3 = obj; bool valueOrDefault = flag3 == true; if (flag2 != flag) { __instance.PlayerInfo.SetIsAimingItem(flag); __instance.PlayerInfo.Movement.InformIsAimingItemChanged(); } } } } [HarmonyPatch(typeof(PlayerAnimatorIo), "OnNetworkedEquippedItemChanged")] internal static class PlayerAnimatorOnEquippedChangedPatch { private static void Prefix(PlayerAnimatorIo __instance, ref ItemType previousEquippedItem, ref ItemType currentEquippedItem) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected I4, but got Unknown //IL_005e: 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_0064: 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_007e: Expected I4, but got Unknown ItemType val = previousEquippedItem; if (ItemRegistry.IsCustomItem(previousEquippedItem)) { previousEquippedItem = (ItemType)(int)ItemRegistry.CustomItemDefinitionMap[(int)previousEquippedItem].AnimatorChangedItemType; } else { if (previousEquippedItem) { return; } PlayerInfo component = ((Component)__instance).GetComponent(); if (!((Object)(object)((component != null) ? component.Inventory : null) == (Object)null)) { ItemType effectivelyEquippedItem = component.Inventory.GetEffectivelyEquippedItem(true); CustomItemDefinition definition = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition != null) { currentEquippedItem = (ItemType)(int)definition.AnimatorChangedItemType; } } } } private static void Postfix(PlayerAnimatorIo __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_007d: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) PlayerInfo componentInParent = ((Component)__instance).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return; } PlayerInventory inventory = componentInParent.Inventory; EquipmentSwitcher rightHandEquipmentSwitcher = componentInParent.RightHandEquipmentSwitcher; if (!((Object)(object)inventory == (Object)null) && !((Object)(object)rightHandEquipmentSwitcher == (Object)null)) { ItemType effectivelyEquippedItem = inventory.GetEffectivelyEquippedItem(true); CustomItemDefinition definition = ItemRegistry.GetDefinition(effectivelyEquippedItem); if (definition != null) { __instance.SetEquippedItem(definition.AnimatorItemType); } if (definition != null && (int)definition.EquipmentType == 1) { LocalPlayerUpdateEquipmentSwitchers.EnsureCustomModel(rightHandEquipmentSwitcher, inventory, effectivelyEquippedItem); } else if (definition == null && LocalPlayerUpdateEquipmentSwitchers.HasCustomModel(inventory)) { LocalPlayerUpdateEquipmentSwitchers.ClearCustomModel(inventory); LocalPlayerUpdateEquipmentSwitchers.ShowDefaultEquipment(rightHandEquipmentSwitcher); } } } } [HarmonyPatch(typeof(PlayerMovement), "IsKnockoutProtectedFromPlayer")] internal static class KnockoutProtectionNullRefPatch { private static bool Prefix(ref bool __result) { if (CourseManager.PlayerKnockoutStreaks == null) { __result = false; return false; } return true; } } internal static class CustomLockOnHelper { public static bool IsCustomTarget(LockOnTarget t) { return (Object)(object)((Component)t).GetComponent() != (Object)null || (Object)(object)((Component)t).GetComponent() != (Object)null || (Object)(object)((Component)t).GetComponent() != (Object)null || (Object)(object)((Component)t).GetComponent() != (Object)null || (Object)(object)((Component)t).GetComponent() != (Object)null; } } [HarmonyPatch] internal static class GunshipLockOnPositionPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(LockOnTarget), "GetLockOnPosition", (Type[])null, (Type[])null); } private static bool Prefix(LockOnTarget __instance, ref Vector3 __result) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!CustomLockOnHelper.IsCustomTarget(__instance)) { return true; } __result = ((Component)__instance).transform.position; return false; } } [HarmonyPatch] internal static class GunshipLockOnIsValidPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(LockOnTarget), "IsValidForLocalPlayer", (Type[])null, (Type[])null); } private static bool Prefix(LockOnTarget __instance, ref bool __result) { if (!CustomLockOnHelper.IsCustomTarget(__instance)) { return true; } __result = true; return false; } } [HarmonyPatch] internal static class GunshipLockOnDetectionPatch { private static bool _wasTargetingGunship; private static bool _wasTargetingBomber; private static bool _wasTargetingDonut; private static bool _wasTargetingBear; private static bool _wasTargetingHarrier; private static BomberMarker _cachedBomberMarker; private static AC130GunshipMarker _cachedGunshipMarker; private static HarrierMarker _cachedHarrierMarker; internal static void ResetTargetingState() { _wasTargetingGunship = false; _wasTargetingBomber = false; _wasTargetingDonut = false; _wasTargetingBear = false; _wasTargetingHarrier = false; _cachedBomberMarker = null; _cachedGunshipMarker = null; _cachedHarrierMarker = null; } private static MethodBase TargetMethod() { return AccessTools.Method(typeof(PlayerGolfer), "TryGetBestLockOnTarget", (Type[])null, (Type[])null); } private static void Postfix(PlayerGolfer __instance, ref bool __result, ref LockOnTarget bestLockOnTarget) { //IL_0125: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).isOwned) { return; } bool flag = __result && (Object)(object)bestLockOnTarget != (Object)null && (Object)(object)((Component)bestLockOnTarget).GetComponent() != (Object)null; bool flag2 = __result && (Object)(object)bestLockOnTarget != (Object)null && (Object)(object)((Component)bestLockOnTarget).GetComponent() != (Object)null; bool flag3 = __result && (Object)(object)bestLockOnTarget != (Object)null && (Object)(object)((Component)bestLockOnTarget).GetComponent() != (Object)null; bool flag4 = __result && (Object)(object)bestLockOnTarget != (Object)null && (Object)(object)((Component)bestLockOnTarget).GetComponent() != (Object)null; bool flag5 = __result && (Object)(object)bestLockOnTarget != (Object)null && (Object)(object)((Component)bestLockOnTarget).GetComponent() != (Object)null; Camera main = Camera.main; Vector3 val; if (!flag2 && !__result) { if (_cachedBomberMarker == null) { _cachedBomberMarker = Object.FindFirstObjectByType(); } if ((Object)(object)_cachedBomberMarker != (Object)null) { LockOnTarget component = ((Component)_cachedBomberMarker).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)main != (Object)null) { val = ((Component)_cachedBomberMarker).transform.position - ((Component)main).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (Vector3.Dot(normalized, ((Component)main).transform.forward) > 0.7f) { __result = true; bestLockOnTarget = component; flag2 = true; } } } } if (!flag) { if (_cachedGunshipMarker == null) { _cachedGunshipMarker = Object.FindFirstObjectByType(); } if ((Object)(object)_cachedGunshipMarker != (Object)null) { LockOnTarget component2 = ((Component)_cachedGunshipMarker).GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)main != (Object)null) { val = ((Component)_cachedGunshipMarker).transform.position - ((Component)main).transform.position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; if (Vector3.Dot(normalized2, ((Component)main).transform.forward) > 0.7f) { __result = true; bestLockOnTarget = component2; flag = true; } } } } if (!flag5) { if (_cachedHarrierMarker == null) { _cachedHarrierMarker = Object.FindFirstObjectByType(); } if ((Object)(object)_cachedHarrierMarker != (Object)null) { LockOnTarget component3 = ((Component)_cachedHarrierMarker).GetComponent(); if ((Object)(object)component3 != (Object)null && (Object)(object)main != (Object)null) { val = ((Component)_cachedHarrierMarker).transform.position - ((Component)main).transform.position; Vector3 normalized3 = ((Vector3)(ref val)).normalized; if (Vector3.Dot(normalized3, ((Component)main).transform.forward) > 0.7f) { __result = true; bestLockOnTarget = component3; flag5 = true; } } } } if (flag && !_wasTargetingGunship) { IssaPluginPlugin.Log.LogInfo((object)"[LockOn] Locked onto AC130 gunship."); } if (flag) { NetworkClient.Send(default(AC130PrepareHomingMessage), 0); } if (flag2 && !_wasTargetingBomber) { IssaPluginPlugin.Log.LogInfo((object)"[LockOn] Locked onto stealth bomber."); } if (flag2) { NetworkClient.Send(default(BomberPrepareHomingMessage), 0); } if (flag3 && !_wasTargetingDonut) { IssaPluginPlugin.Log.LogInfo((object)"[LockOn] Locked onto Donut."); } if (flag3) { NetworkClient.Send(default(DonutPrepareHomingMessage), 0); } if (flag4 && !_wasTargetingBear) { IssaPluginPlugin.Log.LogInfo((object)"[LockOn] Locked onto Bear."); } if (flag4) { NetworkClient.Send(default(BearPrepareHomingMessage), 0); } if (flag5 && !_wasTargetingHarrier) { IssaPluginPlugin.Log.LogInfo((object)"[LockOn] Locked onto Harrier Jet."); } if (flag5) { NetworkClient.Send(default(HarrierPrepareHomingMessage), 0); } _wasTargetingGunship = flag; _wasTargetingBomber = flag2; _wasTargetingDonut = flag3; _wasTargetingBear = flag4; _wasTargetingHarrier = flag5; } } [HarmonyPatch(typeof(Rocket), "ServerInitialize")] internal static class RocketHomingPatch { private static void Postfix(Rocket __instance, PlayerInfo launcher) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)launcher == (Object)null || (Object)(object)((Component)__instance).GetComponent() != (Object)null) { return; } AC130NetworkBridge component = ((Component)launcher).GetComponent(); if ((Object)(object)component != (Object)null && component.PendingGunshipHoming) { AC130GunshipMarker aC130GunshipMarker = Object.FindFirstObjectByType(); if ((Object)(object)aC130GunshipMarker != (Object)null) { component.PendingGunshipHoming = false; RocketHomingBehaviour rocketHomingBehaviour = ((Component)__instance).gameObject.AddComponent(); rocketHomingBehaviour.Target = ((Component)aC130GunshipMarker).transform; IssaPluginPlugin.Log.LogInfo((object)$"[LockOn] Rocket homing toward gunship at {((Component)aC130GunshipMarker).transform.position}."); } } BomberNetworkBridge component2 = ((Component)launcher).GetComponent(); if ((Object)(object)component2 != (Object)null && component2.PendingBomberHoming) { BomberMarker bomberMarker = Object.FindFirstObjectByType(); if ((Object)(object)bomberMarker != (Object)null) { component2.PendingBomberHoming = false; RocketHomingBehaviour rocketHomingBehaviour2 = ((Component)__instance).gameObject.AddComponent(); rocketHomingBehaviour2.Target = ((Component)bomberMarker).transform; IssaPluginPlugin.Log.LogInfo((object)$"[LockOn] Rocket homing toward bomber at {((Component)bomberMarker).transform.position}."); } } DonutNetworkBridge component3 = ((Component)launcher).GetComponent(); if ((Object)(object)component3 != (Object)null && component3.PendingDonutHoming) { DonutMarker donutMarker = Object.FindFirstObjectByType(); if ((Object)(object)donutMarker != (Object)null) { component3.PendingDonutHoming = false; RocketHomingBehaviour rocketHomingBehaviour3 = ((Component)__instance).gameObject.AddComponent(); rocketHomingBehaviour3.Target = ((Component)donutMarker).transform; IssaPluginPlugin.Log.LogInfo((object)$"[LockOn] Rocket homing toward Donut at {((Component)donutMarker).transform.position}."); } } BearNetworkBridge component4 = ((Component)launcher).GetComponent(); if ((Object)(object)component4 != (Object)null && component4.PendingBearHoming) { BearMarker bearMarker = FindNearestBear(((Component)__instance).transform.position); if ((Object)(object)bearMarker != (Object)null) { component4.PendingBearHoming = false; RocketHomingBehaviour rocketHomingBehaviour4 = ((Component)__instance).gameObject.AddComponent(); rocketHomingBehaviour4.Target = ((Component)bearMarker).transform; IssaPluginPlugin.Log.LogInfo((object)$"[LockOn] Rocket homing toward Bear at {((Component)bearMarker).transform.position}."); } } HarrierNetworkBridge component5 = ((Component)launcher).GetComponent(); if ((Object)(object)component5 != (Object)null && component5.PendingHarrierHoming) { HarrierMarker harrierMarker = Object.FindFirstObjectByType(); if ((Object)(object)harrierMarker != (Object)null) { component5.PendingHarrierHoming = false; RocketHomingBehaviour rocketHomingBehaviour5 = ((Component)__instance).gameObject.AddComponent(); rocketHomingBehaviour5.Target = ((Component)harrierMarker).transform; IssaPluginPlugin.Log.LogInfo((object)$"[LockOn] Rocket homing toward Harrier at {((Component)harrierMarker).transform.position}."); } } } private static BearMarker FindNearestBear(Vector3 from) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) BearMarker[] array = Object.FindObjectsByType((FindObjectsSortMode)0); BearMarker result = null; float num = float.MaxValue; BearMarker[] array2 = array; foreach (BearMarker bearMarker in array2) { float num2 = Vector3.Distance(from, ((Component)bearMarker).transform.position); if (num2 < num) { num = num2; result = bearMarker; } } return result; } } [HarmonyPatch(typeof(MatchSetupRules), "Initialize")] internal static class MatchSettingsSliderLimitPatches { private const float SpeedMaxMultiplier = 25f; private const float CountdownMaxSeconds = 500f; private static readonly FieldInfo SliderField = typeof(SliderOption).GetField("slider", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly PropertyInfo MinValueProp = SliderField?.FieldType.GetProperty("minValue"); private static float GetMin(SliderOption opt) { object obj = SliderField?.GetValue(opt); if (obj == null || MinValueProp == null) { return 0f; } return (float)MinValueProp.GetValue(obj); } private static void ExpandLimits(MatchSetupRules instance) { SliderOption playerSpeed = instance.playerSpeed; if (playerSpeed != null) { playerSpeed.SetLimits(GetMin(instance.playerSpeed), 25f); } SliderOption cartSpeed = instance.cartSpeed; if (cartSpeed != null) { cartSpeed.SetLimits(GetMin(instance.cartSpeed), 25f); } SliderOption swingPower = instance.swingPower; if (swingPower != null) { swingPower.SetLimits(GetMin(instance.swingPower), 25f); } SliderOption countdown = instance.countdown; if (countdown != null) { countdown.SetLimits(GetMin(instance.countdown), 500f); } } private static void Prefix(MatchSetupRules __instance) { ExpandLimits(__instance); } private static void Postfix(MatchSetupRules __instance) { ExpandLimits(__instance); } } [HarmonyPatch] public static class MatchSetupRulesPatches { internal static readonly Dictionary<(int, ItemType), float> EffectiveWeights = new Dictionary<(int, ItemType), float>(); [HarmonyPatch(typeof(MatchSetupRules), "GetWeight")] [HarmonyPostfix] private static void GetWeightPatch(int poolIndex, ItemType itemType, ref float __result) { //IL_0001: 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) if (ItemRegistry.IsCustomItem(itemType) && EffectiveWeights.TryGetValue((poolIndex, itemType), out var value)) { __result = value; } } [HarmonyPatch(typeof(MatchSetupRules), "GetItemPoolTotalWeight")] [HarmonyPostfix] private static void GetItemPoolTotalWeightPatch(int index, ref float __result) { foreach (KeyValuePair<(int, ItemType), float> effectiveWeight in EffectiveWeights) { if (effectiveWeight.Key.Item1 == index) { __result += effectiveWeight.Value; } } } [HarmonyPatch(typeof(MatchSetupRules), "ResetSpawnChances")] [HarmonyPrefix] private static void ClearEffectiveWeightsPatch() { EffectiveWeights.Clear(); } } [HarmonyPatch] internal static class MatchSetupRulesOnSpawnChanceWeightsChangedInItemPoolPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(MatchSetupRules), "OnSpawnChanceWeightsChangedInItemPool", new Type[1] { typeof(ItemPoolId) }, (Type[])null); } private static bool Prefix(ItemPoolId itemPoolId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return !ItemRegistry.IsCustomItem(itemPoolId.itemType); } } [HarmonyPatch] internal static class MatchSetupRulesUpdatePatch { private static readonly FieldInfo CurrentItemPoolDirtyField = AccessTools.Field(typeof(MatchSetupRules), "currentItemPoolDirty"); private static readonly MethodInfo GetCurrentItemPoolMethod = AccessTools.Method(typeof(MatchSetupRules), "GetCurrentItemPool", (Type[])null, (Type[])null); private static readonly FieldInfo CurrentItemPoolIndexField = AccessTools.Field(typeof(MatchSetupRules), "currentItemPoolIndex"); private static readonly FieldInfo SpawnChanceWeightsField = AccessTools.Field(typeof(MatchSetupRules), "spawnChanceWeights"); private static readonly FieldInfo SpawnChanceSlidersField = AccessTools.Field(typeof(MatchSetupRules), "spawnChanceSliders"); private static MethodBase TargetMethod() { return AccessTools.Method(typeof(MatchSetupRules), "Update", (Type[])null, (Type[])null); } private static bool Prefix(MatchSetupRules __instance) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected I4, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if (!MatchSetupMenu.IsActive) { return false; } if (!(bool)CurrentItemPoolDirtyField.GetValue(__instance)) { return false; } ItemPool val = (ItemPool)GetCurrentItemPoolMethod.Invoke(__instance, null); int num = (int)CurrentItemPoolIndexField.GetValue(__instance); IDictionary dictionary = (IDictionary)SpawnChanceWeightsField.GetValue(__instance); List list = (List)SpawnChanceSlidersField.GetValue(__instance); int[] itemOrderLookup = __instance.itemOrderLookup; float num2 = 0f; ItemSpawnChance[] spawnChances = val.SpawnChances; foreach (ItemSpawnChance val2 in spawnChances) { if (!ItemRegistry.IsCustomItem(val2.item)) { ItemPoolId key = ItemPoolId.Get(num, val2.item); if (dictionary.ContainsKey(key)) { num2 += dictionary[key]; } } } ItemSpawnChance[] spawnChances2 = val.SpawnChances; foreach (ItemSpawnChance val3 in spawnChances2) { if (ItemRegistry.IsCustomItem(val3.item)) { continue; } int num3 = val3.item - 1; if (num3 >= 0 && num3 < itemOrderLookup.Length) { int num4 = itemOrderLookup[num3]; if (num4 >= 0 && num4 < list.Count) { ItemPoolId key2 = ItemPoolId.Get(num, val3.item); float num5 = ((num2 > float.Epsilon && dictionary.ContainsKey(key2)) ? (dictionary[key2] / num2) : 0f); list[num4].SetValueText($"{num5 * 100f:0.#}%"); } } } CurrentItemPoolDirtyField.SetValue(__instance, false); return false; } } [HarmonyPatch(typeof(NetworkIdentity), "Awake")] internal static class AddBridgeComponentsPatch { private static void Prefix(NetworkIdentity __instance) { if (!((Object)(object)((Component)__instance).GetComponent() == (Object)null)) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } IssaPluginPlugin.Log.LogDebug((object)"[Network] Bridge components injected onto player object."); } } } [HarmonyPatch] internal static class NetworkManagerRegisterPrefabsPatch { private static bool _prefabsRegistered; private static bool _networkMessageIdApiWarned; private static MethodBase TargetMethod() { return AccessTools.Method(typeof(BNetworkManager), "OnStartClient", (Type[])null, (Type[])null); } private static void Postfix() { if (!_prefabsRegistered) { IssaPluginPlugin.Log.LogInfo((object)"[NetworkManager] Registering custom prefabs."); RegisterPrefabs(); _prefabsRegistered = true; } IssaPluginPlugin.Log.LogInfo((object)"[NetworkManager] Registering custom message handlers."); RegisterNetworkMessages(); IssaPluginPlugin.Log.LogInfo((object)"[NetworkManager] Custom message handlers registered."); ValidateMessageIds(); } private static T GetBridge(NetworkConnectionToClient conn) where T : Component { NetworkIdentity identity = ((NetworkConnection)conn).identity; if ((Object)(object)identity == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)$"[GetBridge<{typeof(T).Name}>] conn.identity is NULL for conn={conn}"); return default(T); } T component = ((Component)identity).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)$"[GetBridge<{typeof(T).Name}>] No {typeof(T).Name} component on identity netId={identity.netId}"); } return component; } private static void ValidateMessageIds() { Type typeFromHandle = typeof(NetworkMessage); Assembly assembly = typeof(NetworkManagerRegisterPrefabsPatch).Assembly; Dictionary dictionary = new Dictionary(); List list = new List(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { if (assembly2 == assembly) { continue; } string name = assembly2.GetName().Name; Type[] array = SafeGetTypes(assembly2); foreach (Type type in array) { if (IsNetworkMessageType(type, typeFromHandle)) { ushort messageIdForType = GetMessageIdForType(type); if (messageIdForType != 0) { dictionary.TryAdd(messageIdForType, (type, name)); } } } } List list2 = new List(); Type[] array2 = SafeGetTypes(assembly); foreach (Type type2 in array2) { if (IsNetworkMessageType(type2, typeFromHandle)) { list2.Add(type2); } } foreach (Type item in list2) { ushort messageIdForType2 = GetMessageIdForType(item); if (messageIdForType2 != 0) { if (dictionary.TryGetValue(messageIdForType2, out var value)) { list.Add($" id={messageIdForType2}: [{value.Item2}] {value.Item1.FullName} vs [Plugin] {item.FullName}"); } else { dictionary[messageIdForType2] = (item, "Plugin"); } } } if (list.Count > 0) { IssaPluginPlugin.Log.LogError((object)"╔══════════════════════════════════════════════════════════╗"); IssaPluginPlugin.Log.LogError((object)"║ MIRROR MESSAGE ID COLLISION DETECTED ║"); IssaPluginPlugin.Log.LogError((object)"╚══════════════════════════════════════════════════════════╝"); IssaPluginPlugin.Log.LogError((object)$" {list.Count} collision(s) found. Multiplayer message dispatch is broken."); IssaPluginPlugin.Log.LogError((object)" FIX: Rename one struct from each pair below so its hash changes."); IssaPluginPlugin.Log.LogError((object)" ──────────────────────────────────────────────────────────"); foreach (string item2 in list) { IssaPluginPlugin.Log.LogError((object)item2); } IssaPluginPlugin.Log.LogError((object)"╚══════════════════════════════════════════════════════════╝"); } else { IssaPluginPlugin.Log.LogInfo((object)($"[MessageCollision] All {list2.Count} plugin message IDs are unique " + "(no collisions found across all loaded assemblies).")); } } private static bool IsNetworkMessageType(Type t, Type networkMessageInterface) { try { return t.IsValueType && networkMessageInterface.IsAssignableFrom(t); } catch { return false; } } private static Type[] SafeGetTypes(Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { List list = new List(ex.Types.Length); Type[] types = ex.Types; foreach (Type type in types) { if (type != null) { list.Add(type); } } return list.ToArray(); } catch (Exception ex2) { IssaPluginPlugin.Log.LogWarning((object)("[MessageCollision] Skipping assembly '" + assembly.GetName().Name + "' — GetTypes() threw: " + ex2.Message)); return Array.Empty(); } } private static ushort GetMessageIdForType(Type msgType) { try { Type type = typeof(NetworkMessageId<>).MakeGenericType(msgType); FieldInfo field = type.GetField("Id", BindingFlags.Static | BindingFlags.Public); if (field != null) { return (ushort)field.GetValue(null); } PropertyInfo property = type.GetProperty("Id", BindingFlags.Static | BindingFlags.Public); if (property != null) { return (ushort)property.GetValue(null); } if (!_networkMessageIdApiWarned) { _networkMessageIdApiWarned = true; IssaPluginPlugin.Log.LogWarning((object)"[MessageCollision] NetworkMessageId has no 'Id' field or property. Mirror's API may have changed — message ID collision detection is unreliable."); } } catch (Exception ex) { IssaPluginPlugin.Log.LogWarning((object)("[MessageCollision] Could not get ID for " + msgType.FullName + ": " + ex.Message)); } return 0; } private static void RegisterNetworkMessages() { NetworkClient.RegisterHandler((Action)FreezeNetworkBridge.HandleFreezeBegin, true); Writer.write = FreezeBeginMessageSerialization.WriteFreezeBeginMessage; Reader.read = FreezeBeginMessageSerialization.ReadFreezeBeginMessage; NetworkClient.RegisterHandler((Action)FreezeNetworkBridge.HandleFreezeEnd, true); Writer.write = FreezeEndMessageSerialization.WriteFreezeEndMessage; Reader.read = FreezeEndMessageSerialization.ReadFreezeEndMessage; NetworkClient.RegisterHandler((Action)LowGravityNetworkBridge.HandleLowGravityBegin, true); Writer.write = LowGravityBeginMessageSerialization.WriteLowGravityBeginMessage; Reader.read = LowGravityBeginMessageSerialization.ReadLowGravityBeginMessage; NetworkClient.RegisterHandler((Action)LowGravityNetworkBridge.HandleLowGravityEnd, true); Writer.write = LowGravityEndMessageSerialization.WriteLowGravityEndMessage; Reader.read = LowGravityEndMessageSerialization.ReadLowGravityEndMessage; NetworkClient.RegisterHandler((Action)BomberNetworkBridge.HandleBomberVisualSpawn, true); Writer.write = BomberVisualSpawnMessageSerialization.WriteBomberVisualSpawnMessage; Reader.read = BomberVisualSpawnMessageSerialization.ReadBomberVisualSpawnMessage; NetworkClient.RegisterHandler((Action)BomberNetworkBridge.HandleBomberShotDown, true); Writer.write = BomberShotDownMessageSerialization.WriteBomberShotDownMessage; Reader.read = BomberShotDownMessageSerialization.ReadBomberShotDownMessage; NetworkClient.RegisterHandler((Action)BomberNetworkBridge.HandleBomberDamaged, true); Writer.write = BomberDamagedMessageSerialization.WriteBomberDamagedMessage; Reader.read = BomberDamagedMessageSerialization.ReadBomberDamagedMessage; NetworkClient.RegisterHandler((Action)AC130ClientHandlers.HandleAC130Sound, true); Writer.write = AC130SoundMessageSerialization.WriteAC130SoundMessage; Reader.read = AC130SoundMessageSerialization.ReadAC130SoundMessage; NetworkClient.RegisterHandler((Action)AC130ClientHandlers.HandleAC130MaydayVfx, true); Writer.write = AC130MaydayVfxMessageSerialization.WriteAC130MaydayVfxMessage; Reader.read = AC130MaydayVfxMessageSerialization.ReadAC130MaydayVfxMessage; NetworkClient.RegisterHandler((Action)AC130ClientHandlers.HandleAC130Damaged, true); Writer.write = AC130DamagedMessageSerialization.WriteAC130DamagedMessage; Reader.read = AC130DamagedMessageSerialization.ReadAC130DamagedMessage; NetworkClient.RegisterHandler((Action)AC130ClientHandlers.HandleAC130MaydayImpact, true); Writer.write = AC130MaydayImpactMessageSerialization.WriteAC130MaydayImpactMessage; Reader.read = AC130MaydayImpactMessageSerialization.ReadAC130MaydayImpactMessage; Writer.write = DroppedItemPickupMessageSerialization.WriteDroppedItemPickupMessage; Reader.read = DroppedItemPickupMessageSerialization.ReadDroppedItemPickupMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)DroppedCustomItem.ServerHandlePickupMessage, true); } Writer.write = FreezeActivateMessageSerialization.WriteFreezeActivateMessage; Reader.read = FreezeActivateMessageSerialization.ReadFreezeActivateMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, FreezeActivateMessage msg) { GetBridge(conn)?.ServerActivateFreeze(); }, true); } Writer.write = LowGravityActivateMessageSerialization.WriteLowGravityActivateMessage; Reader.read = LowGravityActivateMessageSerialization.ReadLowGravityActivateMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, LowGravityActivateMessage msg) { LowGravityNetworkBridge bridge = GetBridge(conn); IssaPluginPlugin.Log.LogInfo((object)("[LowGravity] Server received LowGravityActivateMessage. identity=" + (((Object)(object)((NetworkConnection)conn).identity != (Object)null) ? "OK" : "NULL") + ", bridge=" + (((Object)(object)bridge != (Object)null) ? "OK" : "NULL"))); bridge?.ServerActivateLowGravity(); }, true); } Writer.write = BomberRunMessageSerialization.WriteBomberRunMessage; Reader.read = BomberRunMessageSerialization.ReadBomberRunMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, BomberRunMessage msg) { //IL_000e: 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) GetBridge(conn)?.ServerRequestBombingRun(msg.Center, msg.Forward, msg.Length, msg.EquippedIndex); }, true); } Writer.write = BomberPrepareHomingMessageSerialization.WriteBomberPrepareHomingMessage; Reader.read = BomberPrepareHomingMessageSerialization.ReadBomberPrepareHomingMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, BomberPrepareHomingMessage msg) { GetBridge(conn)?.ServerPrepareBomberRocket(); }, true); } Writer.write = DonutMessageSerialization.WriteDonutPrepareHomingMessage; Reader.read = DonutMessageSerialization.ReadDonutPrepareHomingMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, DonutPrepareHomingMessage msg) { GetBridge(conn)?.ServerPrepareDonutRocket(); }, true); } Writer.write = MissileRequestMessageSerialization.WriteMissileRequestMessage; Reader.read = MissileRequestMessageSerialization.ReadMissileRequestMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, MissileRequestMessage msg) { GetBridge(conn)?.ServerRequestMissile(); }, true); } Writer.write = MissileSetVelocityMessageSerialization.WriteMissileSetVelocityMessage; Reader.read = MissileSetVelocityMessageSerialization.ReadMissileSetVelocityMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, MissileSetVelocityMessage msg) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetBridge(conn)?.ServerSetMissileVelocity(msg.Velocity); }, true); } Writer.write = MissileDetonateMessageSerialization.WriteMissileDetonateMessage; Reader.read = MissileDetonateMessageSerialization.ReadMissileDetonateMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, MissileDetonateMessage msg) { GetBridge(conn)?.ServerDetonateMissile(); }, true); } Writer.write = AC130StartMessageSerialization.WriteAC130StartMessage; Reader.read = AC130StartMessageSerialization.ReadAC130StartMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130StartMessage msg) { GetBridge(conn)?.ServerStartAC130(); }, true); } Writer.write = AC130EndMessageSerialization.WriteAC130EndMessage; Reader.read = AC130EndMessageSerialization.ReadAC130EndMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130EndMessage msg) { GetBridge(conn)?.ServerEndAC130(); }, true); } Writer.write = AC130FireMessageSerialization.WriteAC130FireMessage; Reader.read = AC130FireMessageSerialization.ReadAC130FireMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130FireMessage msg) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetBridge(conn)?.ServerFireAC130(msg.AimDirection, msg.IsHeavy); }, true); } Writer.write = AC130TriggerMaydayMessageSerialization.WriteAC130TriggerMaydayMessage; Reader.read = AC130TriggerMaydayMessageSerialization.ReadAC130TriggerMaydayMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130TriggerMaydayMessage msg) { GetBridge(conn)?.ServerTriggerMayday(); }, true); } Writer.write = AC130PrepareHomingMessageSerialization.WriteAC130PrepareHomingMessage; Reader.read = AC130PrepareHomingMessageSerialization.ReadAC130PrepareHomingMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130PrepareHomingMessage msg) { GetBridge(conn)?.ServerPrepareGunshipRocket(); }, true); } Writer.write = AC130MaydayInputMessageSerialization.WriteAC130MaydayInputMessage; Reader.read = AC130MaydayInputMessageSerialization.ReadAC130MaydayInputMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130MaydayInputMessage msg) { GetBridge(conn)?.ServerSetMaydayInput(msg.DiveInfluence, msg.RollInfluence); }, true); } Writer.write = AC130FlightInputMessageSerialization.WriteAC130FlightInputMessage; Reader.read = AC130FlightInputMessageSerialization.ReadAC130FlightInputMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, AC130FlightInputMessage msg) { GetBridge(conn)?.ServerSetFlightInput(msg.AltitudeOffset, msg.Boosting); }, true); } Writer.write = MissileBeginSteeringMessageSerialization.WriteMissileBeginSteeringMessage; Reader.read = MissileBeginSteeringMessageSerialization.ReadMissileBeginSteeringMessage; NetworkClient.RegisterHandler((Action)delegate(MissileBeginSteeringMessage msg) { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientBeginSteering(msg.RocketNetId); } }, true); Writer.write = MissileEndSteeringMessageSerialization.WriteMissileEndSteeringMessage; Reader.read = MissileEndSteeringMessageSerialization.ReadMissileEndSteeringMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientEndSteering(); } }, true); Writer.write = AC130BeginClientMessageSerialization.WriteAC130BeginClientMessage; Reader.read = AC130BeginClientMessageSerialization.ReadAC130BeginClientMessage; NetworkClient.RegisterHandler((Action)delegate(AC130BeginClientMessage msg) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientBeginAC130(msg.GunshipNetId, msg.OrbitCenter); } }, true); Writer.write = AC130EndClientMessageSerialization.WriteAC130EndClientMessage; Reader.read = AC130EndClientMessageSerialization.ReadAC130EndClientMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientEndAC130(); } }, true); Writer.write = AC130BeginMaydayClientMessageSerialization.WriteAC130BeginMaydayClientMessage; Reader.read = AC130BeginMaydayClientMessageSerialization.ReadAC130BeginMaydayClientMessage; NetworkClient.RegisterHandler((Action)delegate(AC130BeginMaydayClientMessage msg) { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientBeginMayday(msg.GunshipNetId); } }, true); Writer.write = AC130EndMaydayClientMessageSerialization.WriteAC130EndMaydayClientMessage; Reader.read = AC130EndMaydayClientMessageSerialization.ReadAC130EndMaydayClientMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientEndMayday(); } }, true); Writer.write = AC130BusyMessageSerialization.WriteAC130BusyMessage; Reader.read = AC130BusyMessageSerialization.ReadAC130BusyMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientAC130Busy(); } }, true); Writer.write = DonutMessageSerialization.WriteDonutStartMessage; Reader.read = DonutMessageSerialization.ReadDonutStartMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, DonutStartMessage msg) { GetBridge(conn)?.ServerStartDonut(); }, true); } Writer.write = DonutMessageSerialization.WriteDonutEndMessage; Reader.read = DonutMessageSerialization.ReadDonutEndMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, DonutEndMessage msg) { GetBridge(conn)?.ServerEndDonut(msg.ShouldCrash); }, true); } Writer.write = DonutMessageSerialization.WriteDonutMoveMessage; Reader.read = DonutMessageSerialization.ReadDonutMoveMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, DonutMoveMessage msg) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetBridge(conn)?.ServerMoveDonut(msg.WorldMoveDir); }, true); } Writer.write = DonutMessageSerialization.WriteDonutFireLaserMessage; Reader.read = DonutMessageSerialization.ReadDonutFireLaserMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, DonutFireLaserMessage msg) { GetBridge(conn)?.ServerFireLaser(); }, true); } Writer.write = DonutMessageSerialization.WriteDonutBeginClientMessage; Reader.read = DonutMessageSerialization.ReadDonutBeginClientMessage; NetworkClient.RegisterHandler((Action)delegate(DonutBeginClientMessage msg) { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientBeginDonut(msg.DonutNetId); } }, true); Writer.write = DonutMessageSerialization.WriteDonutEndClientMessage; Reader.read = DonutMessageSerialization.ReadDonutEndClientMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientEndDonut(shotDown: false); } }, true); Writer.write = DonutMessageSerialization.WriteDonutShotDownMessage; Reader.read = DonutMessageSerialization.ReadDonutShotDownMessage; NetworkClient.RegisterHandler((Action)delegate { IssaPluginPlugin.Log.LogWarning((object)"[NetworkManager] Client received DonutShotDownMessage."); NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientEndDonut(shotDown: true); } }, true); Writer.write = DonutMessageSerialization.WriteDonutBusyMessage; Reader.read = DonutMessageSerialization.ReadDonutBusyMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientDonutBusy(); } }, true); Writer.write = DonutMessageSerialization.WriteDonutLaserShootStartMessage; Reader.read = DonutMessageSerialization.ReadDonutLaserShootStartMessage; NetworkClient.RegisterHandler((Action)delegate(DonutLaserShootStartMessage msg) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientDonutStartShooting(msg.StartPosition); } }, true); Writer.write = SuperDonutMessageSerialization.WriteSuperDonutStartMessage; Reader.read = SuperDonutMessageSerialization.ReadSuperDonutStartMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, SuperDonutStartMessage msg) { GetBridge(conn)?.ServerFireBarrage(); }, true); } Writer.write = SuperDonutMessageSerialization.WriteSuperDonutFiredMessage; Reader.read = SuperDonutMessageSerialization.ReadSuperDonutFiredMessage; NetworkClient.RegisterHandler((Action)delegate(SuperDonutFiredMessage msg) { IssaPluginPlugin.Log.LogInfo((object)$"[SuperDonut] Barrage fired — {msg.TargetCount} laser(s) incoming."); }, true); Writer.write = JavelinFireMessageSerialization.WriteJavelinFireMessage; Reader.read = JavelinFireMessageSerialization.ReadJavelinFireMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, JavelinFireMessage msg) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetBridge(conn)?.ServerHandleFire(msg.TargetPosition); }, true); } Writer.write = JavelinRocketTrailMessageSerialization.WriteJavelinRocketTrailMessage; Reader.read = JavelinRocketTrailMessageSerialization.ReadJavelinRocketTrailMessage; NetworkClient.RegisterHandler((Action)JavelinNetworkBridge.HandleRocketTrailVfx, true); Writer.write = JavelinExplosionMessageSerialization.WriteJavelinExplosionMessage; Reader.read = JavelinExplosionMessageSerialization.ReadJavelinExplosionMessage; NetworkClient.RegisterHandler((Action)JavelinNetworkBridge.HandleExplosionVfx, true); Writer.write = JavelinLaunchedMessageSerialization.WriteJavelinLaunchedMessage; Reader.read = JavelinLaunchedMessageSerialization.ReadJavelinLaunchedMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientHandleLaunched(); } }, true); Writer.write = JavelinDetonatedMessageSerialization.WriteJavelinDetonatedMessage; Reader.read = JavelinDetonatedMessageSerialization.ReadJavelinDetonatedMessage; NetworkClient.RegisterHandler((Action)delegate { NetworkIdentity localPlayer = NetworkClient.localPlayer; if (localPlayer != null) { ((Component)localPlayer).GetComponent()?.ClientHandleDetonated(); } }, true); Writer.write = StickyGrenadeThrowMessageSerialization.WriteStickyGrenadeThrowMessage; Reader.read = StickyGrenadeThrowMessageSerialization.ReadStickyGrenadeThrowMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, StickyGrenadeThrowMessage msg) { //IL_000e: 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) GetBridge(conn)?.ServerHandleThrow(msg.ThrowOrigin, msg.ThrowVelocity); }, true); } Writer.write = StickyGrenadeStuckMessageSerialization.WriteStickyGrenadeStuckMessage; Reader.read = StickyGrenadeStuckMessageSerialization.ReadStickyGrenadeStuckMessage; NetworkClient.RegisterHandler((Action)StickyGrenadeNetworkBridge.HandleStickyGrenadeStuck, true); Writer.write = StickyGrenadeDetonatedMessageSerialization.WriteStickyGrenadeDetonatedMessage; Reader.read = StickyGrenadeDetonatedMessageSerialization.ReadStickyGrenadeDetonatedMessage; NetworkClient.RegisterHandler((Action)StickyGrenadeNetworkBridge.HandleStickyGrenadeDetonated, true); Writer.write = NukeFireMessageSerialization.WriteNukeFireMessage; Reader.read = NukeFireMessageSerialization.ReadNukeFireMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, NukeFireMessage msg) { GetBridge(conn)?.ServerHandleFire(); }, true); } Writer.write = NukeExplosionMessageSerialization.WriteNukeExplosionMessage; Reader.read = NukeExplosionMessageSerialization.ReadNukeExplosionMessage; NetworkClient.RegisterHandler((Action)NukeNetworkBridge.HandleNukeExplosion, true); Writer.write = BlackHoleGrenadeThrowMessageSerialization.WriteBlackHoleGrenadeThrowMessage; Reader.read = BlackHoleGrenadeThrowMessageSerialization.ReadBlackHoleGrenadeThrowMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, BlackHoleGrenadeThrowMessage msg) { //IL_000e: 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) GetBridge(conn)?.ServerHandleThrow(msg.ThrowOrigin, msg.ThrowVelocity); }, true); } Writer.write = BlackHoleGrenadeLandedMessageSerialization.WriteBlackHoleGrenadeLandedMessage; Reader.read = BlackHoleGrenadeLandedMessageSerialization.ReadBlackHoleGrenadeLandedMessage; NetworkClient.RegisterHandler((Action)BlackHoleGrenadeNetworkBridge.HandleBlackHoleGrenadeLanded, true); Writer.write = BlackHoleGrenadeSpitMessageSerialization.WriteBlackHoleGrenadeSpitMessage; Reader.read = BlackHoleGrenadeSpitMessageSerialization.ReadBlackHoleGrenadeSpitMessage; NetworkClient.RegisterHandler((Action)BlackHoleGrenadeNetworkBridge.HandleBlackHoleGrenadeSpit, true); Writer.write = PlaceWallMessageSerialization.WritePlaceWallMessage; Reader.read = PlaceWallMessageSerialization.ReadPlaceWallMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, PlaceWallMessage msg) { //IL_000e: 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) GetBridge(conn)?.ServerHandlePlacement(msg.RayOrigin, msg.RayDirection, msg.ExtraYawDegrees); }, true); } Writer.write = WallDestroyedMessageSerialization.WriteWallDestroyedMessage; Reader.read = WallDestroyedMessageSerialization.ReadWallDestroyedMessage; NetworkClient.RegisterHandler((Action)PlaceableWallNetworkBridge.HandleWallDestroyed, true); Writer.write = SpawnWeightsMessageSerialization.WriteSpawnWeightsMessage; Reader.read = SpawnWeightsMessageSerialization.ReadSpawnWeightsMessage; NetworkClient.RegisterHandler((Action)SpawnWeightsSyncer.HandleSpawnWeights, true); Writer.write = ItemConfigSyncSerialization.Write; Reader.read = ItemConfigSyncSerialization.Read; NetworkClient.RegisterHandler((Action)ItemConfigSyncer.HandleConfigSync, true); Writer.write = VoteMessageSerialization.WriteVoteStartMessage; Reader.read = VoteMessageSerialization.ReadVoteStartMessage; Writer.write = VoteMessageSerialization.WriteVoteSubmitMessage; Reader.read = VoteMessageSerialization.ReadVoteSubmitMessage; Writer.write = VoteMessageSerialization.WriteVoteResultsMessage; Reader.read = VoteMessageSerialization.ReadVoteResultsMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, VoteSubmitMessage msg) { VoteManager.Instance?.HandleVoteSubmit(conn, msg); }, true); } NetworkClient.RegisterHandler((Action)VoteManager.HandleVoteStart, true); NetworkClient.RegisterHandler((Action)VoteManager.HandleVoteResults, true); Writer.write = BearActivateMessageSerialization.WriteBearActivateMessage; Reader.read = BearActivateMessageSerialization.ReadBearActivateMessage; IssaPluginPlugin.Log.LogInfo((object)$"[Bear] Registering BearActivateMessage handler — NetworkServer.active={NetworkServer.active}"); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, BearActivateMessage msg) { ManualLogSource log = IssaPluginPlugin.Log; uint? obj; if (conn == null) { obj = null; } else { NetworkIdentity identity = ((NetworkConnection)conn).identity; obj = ((identity != null) ? new uint?(identity.netId) : ((uint?)null)); } log.LogInfo((object)$"[Bear] BearActivateMessage handler invoked — conn={conn}, identity={obj}"); GetBridge(conn)?.ServerSummonBears(); }, true); IssaPluginPlugin.Log.LogInfo((object)"[Bear] BearActivateMessage server handler registered."); } else { IssaPluginPlugin.Log.LogWarning((object)"[Bear] Skipped BearActivateMessage server handler — NetworkServer not active."); } Writer.write = BearPrepareHomingMessageSerialization.WriteBearPrepareHomingMessage; Reader.read = BearPrepareHomingMessageSerialization.ReadBearPrepareHomingMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, BearPrepareHomingMessage msg) { GetBridge(conn)?.ServerPrepareBearRocket(); }, true); } Writer.write = BearSwingHitMessageSerialization.WriteBearSwingHitMessage; Reader.read = BearSwingHitMessageSerialization.ReadBearSwingHitMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)BearNetworkBridge.ServerHandleSwingHit, true); } Writer.write = BearStateMessageSerialization.WriteBearStateMessage; Reader.read = BearStateMessageSerialization.ReadBearStateMessage; NetworkClient.RegisterHandler((Action)BearNetworkBridge.HandleBearState, true); Writer.write = BearAttackImpactMessageSerialization.WriteBearAttackImpactMessage; Reader.read = BearAttackImpactMessageSerialization.ReadBearAttackImpactMessage; NetworkClient.RegisterHandler((Action)BearNetworkBridge.HandleBearAttackImpact, true); Writer.write = BearHuntEndedMessageSerialization.WriteBearHuntEndedMessage; Reader.read = BearHuntEndedMessageSerialization.ReadBearHuntEndedMessage; NetworkClient.RegisterHandler((Action)BearNetworkBridge.HandleBearSessionEnd, true); Writer.write = BearHitVfxMessageSerialization.WriteBearHitVfxMessage; Reader.read = BearHitVfxMessageSerialization.ReadBearHitVfxMessage; NetworkClient.RegisterHandler((Action)delegate(BearHitVfxMessage msg) { //IL_0001: 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) BloodSplatterHelper.SpawnBloodSplatter(msg.HitPoint, msg.AttackerOrigin); }, true); Writer.write = BearHPUpdateMessageSerialization.WriteBearHPUpdateMessage; Reader.read = BearHPUpdateMessageSerialization.ReadBearHPUpdateMessage; NetworkClient.RegisterHandler((Action)BearHealthBarOverlay.HandleBearHPUpdate, true); Writer.write = BearOverlayBeginMessageSerialization.WriteBearOverlayBeginMessage; Reader.read = BearOverlayBeginMessageSerialization.ReadBearOverlayBeginMessage; NetworkClient.RegisterHandler((Action)BearNetworkBridge.HandleBearOverlayBegin, true); Writer.write = BearKilledClientMessageSerialization.WriteBearKilledClientMessage; Reader.read = BearKilledClientMessageSerialization.ReadBearKilledClientMessage; NetworkClient.RegisterHandler((Action)BearNetworkBridge.HandleBearKilledClient, true); Writer.write = BearOverlayEndMessageSerialization.WriteBearOverlayEndMessage; Reader.read = BearOverlayEndMessageSerialization.ReadBearOverlayEndMessage; NetworkClient.RegisterHandler((Action)BearNetworkBridge.HandleBearOverlayEnd, true); Writer.write = HarrierRequestMessageSerialization.WriteHarrierRequestMessage; Reader.read = HarrierRequestMessageSerialization.ReadHarrierRequestMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, HarrierRequestMessage msg) { GetBridge(conn)?.ServerHandleRequest(); }, true); } Writer.write = HarrierPrepareHomingMessageSerialization.WriteHarrierPrepareHomingMessage; Reader.read = HarrierPrepareHomingMessageSerialization.ReadHarrierPrepareHomingMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, HarrierPrepareHomingMessage msg) { HarrierNetworkBridge bridge = GetBridge(conn); if ((Object)(object)bridge != (Object)null) { bridge.PendingHarrierHoming = true; } }, true); } Writer.write = HarrierBeginClientMessageSerialization.WriteHarrierBeginClientMessage; Reader.read = HarrierBeginClientMessageSerialization.ReadHarrierBeginClientMessage; NetworkClient.RegisterHandler((Action)HarrierNetworkBridge.ClientHandleBegin, true); Writer.write = HarrierEndClientMessageSerialization.WriteHarrierEndClientMessage; Reader.read = HarrierEndClientMessageSerialization.ReadHarrierEndClientMessage; NetworkClient.RegisterHandler((Action)HarrierNetworkBridge.ClientHandleEnd, true); Writer.write = HarrierShotDownMessageSerialization.WriteHarrierShotDownMessage; Reader.read = HarrierShotDownMessageSerialization.ReadHarrierShotDownMessage; NetworkClient.RegisterHandler((Action)HarrierNetworkBridge.ClientHandleShotDown, true); Writer.write = HarrierDamagedMessageSerialization.WriteHarrierDamagedMessage; Reader.read = HarrierDamagedMessageSerialization.ReadHarrierDamagedMessage; NetworkClient.RegisterHandler((Action)HarrierNetworkBridge.ClientHandleDamaged, true); Writer.write = HitNotificationMessageSerialization.WriteHitNotificationMessage; Reader.read = HitNotificationMessageSerialization.ReadHitNotificationMessage; NetworkClient.RegisterHandler((Action)delegate(HitNotificationMessage msg) { HitNotificationOverlay.Instance?.AddNotification(msg.Message); }, true); Writer.write = ItemWarningMessageSerialization.WriteItemWarningMessage; Reader.read = ItemWarningMessageSerialization.ReadItemWarningMessage; NetworkClient.RegisterHandler((Action)ItemWarningOverlay.HandleWarningMessage, true); Writer.write = PositionSwapRequestMessageSerialization.WritePositionSwapRequestMessage; Reader.read = PositionSwapRequestMessageSerialization.ReadPositionSwapRequestMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, PositionSwapRequestMessage msg) { GetBridge(conn)?.ServerHandleRequest(msg.TargetNetId, msg.EquippedSlotIndex); }, true); } Writer.write = PositionSwapWarningMessageSerialization.WritePositionSwapWarningMessage; Reader.read = PositionSwapWarningMessageSerialization.ReadPositionSwapWarningMessage; NetworkClient.RegisterHandler((Action)PositionSwapNetworkBridge.HandleWarning, true); Writer.write = PositionSwapTeleportMessageSerialization.WritePositionSwapTeleportMessage; Reader.read = PositionSwapTeleportMessageSerialization.ReadPositionSwapTeleportMessage; NetworkClient.RegisterHandler((Action)PositionSwapNetworkBridge.HandleTeleport, true); Writer.write = PositionSwapExecuteMessageSerialization.WritePositionSwapExecuteMessage; Reader.read = PositionSwapExecuteMessageSerialization.ReadPositionSwapExecuteMessage; NetworkClient.RegisterHandler((Action)PositionSwapNetworkBridge.HandleExecute, true); Writer.write = PositionSwapCancelledMessageSerialization.WritePositionSwapCancelledMessage; Reader.read = PositionSwapCancelledMessageSerialization.ReadPositionSwapCancelledMessage; NetworkClient.RegisterHandler((Action)PositionSwapNetworkBridge.HandleCancelled, true); Writer.write = PoisonJarMessageSerialization.WritePoisonJarThrowMessage; Reader.read = PoisonJarMessageSerialization.ReadPoisonJarThrowMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, PoisonJarThrowMessage msg) { //IL_000d: 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) GetBridge(conn)?.ServerHandleThrow(msg.ThrowOrigin, msg.ThrowVelocity); }, true); } Writer.write = PoisonJarMessageSerialization.WritePoisonJarLandedMessage; Reader.read = PoisonJarMessageSerialization.ReadPoisonJarLandedMessage; NetworkClient.RegisterHandler((Action)PoisonJarNetworkBridge.HandleLanded, true); Writer.write = DroneSwarmSummonMessageSerialization.WriteDroneSwarmSummonMessage; Reader.read = DroneSwarmSummonMessageSerialization.ReadDroneSwarmSummonMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, DroneSwarmSummonMessage msg) { GetBridge(conn)?.ServerSummonDrones(); }, true); } Writer.write = DroneExplodedMessageSerialization.WriteDroneExplodedMessage; Reader.read = DroneExplodedMessageSerialization.ReadDroneExplodedMessage; NetworkClient.RegisterHandler((Action)DroneSwarmNetworkBridge.HandleDroneExploded, true); Writer.write = DroneSwarmSessionEndedMessageSerialization.WriteDroneSwarmSessionEndedMessage; Reader.read = DroneSwarmSessionEndedMessageSerialization.ReadDroneSwarmSessionEndedMessage; NetworkClient.RegisterHandler((Action)DroneSwarmNetworkBridge.HandleSessionEnded, true); Writer.write = DroneSwarmOverlayBeginMessageSerialization.WriteDroneSwarmOverlayBeginMessage; Reader.read = DroneSwarmOverlayBeginMessageSerialization.ReadDroneSwarmOverlayBeginMessage; NetworkClient.RegisterHandler((Action)DroneSwarmNetworkBridge.HandleOverlayBegin, true); Writer.write = DroneDiedClientMessageSerialization.WriteDroneDiedClientMessage; Reader.read = DroneDiedClientMessageSerialization.ReadDroneDiedClientMessage; NetworkClient.RegisterHandler((Action)DroneSwarmNetworkBridge.HandleDroneDied, true); Writer.write = DroneSwarmOverlayEndMessageSerialization.WriteDroneSwarmOverlayEndMessage; Reader.read = DroneSwarmOverlayEndMessageSerialization.ReadDroneSwarmOverlayEndMessage; NetworkClient.RegisterHandler((Action)DroneSwarmNetworkBridge.HandleOverlayEnd, true); Writer.write = RedBullMessageSerialization.WriteActivate; Reader.read = RedBullMessageSerialization.ReadActivate; Writer.write = RedBullMessageSerialization.WriteTrailBegin; Reader.read = RedBullMessageSerialization.ReadTrailBegin; Writer.write = RedBullMessageSerialization.WriteTrailEnd; Reader.read = RedBullMessageSerialization.ReadTrailEnd; NetworkClient.RegisterHandler((Action)RedBullNetworkBridge.HandleTrailBegin, true); NetworkClient.RegisterHandler((Action)RedBullNetworkBridge.HandleTrailEnd, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, RedBullActivateMessage msg) { GetBridge(conn)?.ServerActivate(); }, true); } Writer.write = JetpackMessageSerialization.WriteThrustStart; Reader.read = JetpackMessageSerialization.ReadThrustStart; Writer.write = JetpackMessageSerialization.WriteThrustStop; Reader.read = JetpackMessageSerialization.ReadThrustStop; Writer.write = JetpackMessageSerialization.WriteThrustBegin; Reader.read = JetpackMessageSerialization.ReadThrustBegin; Writer.write = JetpackMessageSerialization.WriteThrustEnd; Reader.read = JetpackMessageSerialization.ReadThrustEnd; Writer.write = JetpackMessageSerialization.WriteEquipBegin; Reader.read = JetpackMessageSerialization.ReadEquipBegin; Writer.write = JetpackMessageSerialization.WriteEquipEnd; Reader.read = JetpackMessageSerialization.ReadEquipEnd; NetworkClient.RegisterHandler((Action)JetpackNetworkBridge.HandleThrustBegin, true); NetworkClient.RegisterHandler((Action)JetpackNetworkBridge.HandleThrustEnd, true); NetworkClient.RegisterHandler((Action)JetpackNetworkBridge.HandleEquipBegin, true); NetworkClient.RegisterHandler((Action)JetpackNetworkBridge.HandleEquipEnd, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, JetpackThrustStartMessage msg) { GetBridge(conn)?.ServerHandleThrustStart(); }, true); NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, JetpackThrustStopMessage msg) { GetBridge(conn)?.ServerHandleThrustStop(); }, true); } Writer.write = RedBullMessageSerialization.WriteCoffeeDispenserRedBull; Reader.read = RedBullMessageSerialization.ReadCoffeeDispenserRedBull; NetworkClient.RegisterHandler((Action)CoffeeDispenserClientHandlers.HandleVisualSwap, true); Writer.write = SpinachMessageSerialization.WriteActivate; Reader.read = SpinachMessageSerialization.ReadActivate; Writer.write = SpinachMessageSerialization.WriteTrailBegin; Reader.read = SpinachMessageSerialization.ReadTrailBegin; Writer.write = SpinachMessageSerialization.WriteTrailEnd; Reader.read = SpinachMessageSerialization.ReadTrailEnd; NetworkClient.RegisterHandler((Action)SpinachNetworkBridge.HandleVfxBegin, true); NetworkClient.RegisterHandler((Action)SpinachNetworkBridge.HandleVfxEnd, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, SpinachActivateMessage msg) { GetBridge(conn)?.ServerActivate(); }, true); } Writer.write = FlamethrowerMessageSerialization.WriteFireStart; Reader.read = FlamethrowerMessageSerialization.ReadFireStart; Writer.write = FlamethrowerMessageSerialization.WriteFireStop; Reader.read = FlamethrowerMessageSerialization.ReadFireStop; Writer.write = FlamethrowerMessageSerialization.WriteBurnRequest; Reader.read = FlamethrowerMessageSerialization.ReadBurnRequest; Writer.write = FlamethrowerMessageSerialization.WriteFireBegin; Reader.read = FlamethrowerMessageSerialization.ReadFireBegin; Writer.write = FlamethrowerMessageSerialization.WriteFireEnd; Reader.read = FlamethrowerMessageSerialization.ReadFireEnd; Writer.write = FlamethrowerMessageSerialization.WriteBurnBegin; Reader.read = FlamethrowerMessageSerialization.ReadBurnBegin; Writer.write = FlamethrowerMessageSerialization.WriteBurnEnd; Reader.read = FlamethrowerMessageSerialization.ReadBurnEnd; NetworkClient.RegisterHandler((Action)FlamethrowerNetworkBridge.HandleFireBegin, true); NetworkClient.RegisterHandler((Action)FlamethrowerNetworkBridge.HandleFireEnd, true); NetworkClient.RegisterHandler((Action)FlamethrowerNetworkBridge.HandleBurnBegin, true); NetworkClient.RegisterHandler((Action)FlamethrowerNetworkBridge.HandleBurnEnd, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, FlamethrowerFireStartMessage msg) { GetBridge(conn)?.ServerHandleFireStart(); }, true); NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, FlamethrowerFireStopMessage msg) { GetBridge(conn)?.ServerHandleFireStop(); }, true); NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, FlamethrowerBurnRequestMessage msg) { GetBridge(conn)?.ServerHandleBurnRequest(conn, msg.VictimNetId); }, true); } Writer.write = GiveItemRequestMessageSerialization.WriteGiveItemRequestMessage; Reader.read = GiveItemRequestMessageSerialization.ReadGiveItemRequestMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)ItemRegistry.ServerHandleGiveItemRequest, true); } Writer.write = GravityGunLockOnMessageSerialization.WriteGravityGunLockOnMessage; Reader.read = GravityGunLockOnMessageSerialization.ReadGravityGunLockOnMessage; Writer.write = GravityGunAimTickMessageSerialization.WriteGravityGunAimTickMessage; Reader.read = GravityGunAimTickMessageSerialization.ReadGravityGunAimTickMessage; Writer.write = GravityGunReleaseMessageSerialization.WriteGravityGunReleaseMessage; Reader.read = GravityGunReleaseMessageSerialization.ReadGravityGunReleaseMessage; Writer.write = GravityGunConnectedMessageSerialization.WriteGravityGunConnectedMessage; Reader.read = GravityGunConnectedMessageSerialization.ReadGravityGunConnectedMessage; Writer.write = GravityGunTetherTickMessageSerialization.WriteGravityGunTetherTickMessage; Reader.read = GravityGunTetherTickMessageSerialization.ReadGravityGunTetherTickMessage; Writer.write = GravityGunDisconnectedMessageSerialization.WriteGravityGunDisconnectedMessage; Reader.read = GravityGunDisconnectedMessageSerialization.ReadGravityGunDisconnectedMessage; Writer.write = GravityGunBusyMessageSerialization.WriteGravityGunBusyMessage; Reader.read = GravityGunBusyMessageSerialization.ReadGravityGunBusyMessage; NetworkClient.RegisterHandler((Action)GravityGunNetworkBridge.HandleGravityGunConnected, true); NetworkClient.RegisterHandler((Action)GravityGunNetworkBridge.HandleGravityGunTetherTick, true); NetworkClient.RegisterHandler((Action)GravityGunNetworkBridge.HandleGravityGunDisconnected, true); NetworkClient.RegisterHandler((Action)GravityGunNetworkBridge.HandleGravityGunBusy, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, GravityGunLockOnMessage msg) { GetBridge(conn)?.ServerHandleLockOn(conn, msg); }, true); NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, GravityGunAimTickMessage msg) { GetBridge(conn)?.ServerHandleAimTick(conn, msg); }, true); NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, GravityGunReleaseMessage msg) { GetBridge(conn)?.ServerHandleRelease(conn); }, true); } Writer.write = RocketTetherLockOnMessageSerialization.WriteRocketTetherLockOnMessage; Reader.read = RocketTetherLockOnMessageSerialization.ReadRocketTetherLockOnMessage; Writer.write = RocketTetherBusyMessageSerialization.WriteRocketTetherBusyMessage; Reader.read = RocketTetherBusyMessageSerialization.ReadRocketTetherBusyMessage; NetworkClient.RegisterHandler((Action)RocketTetherNetworkBridge.HandleRocketTetherBusy, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, RocketTetherLockOnMessage msg) { GetBridge(conn)?.ServerHandleLockOn(conn, msg); }, true); } Writer.write = RocketVictimConnectedMessageSerialization.WriteRocketVictimConnectedMessage; Reader.read = RocketVictimConnectedMessageSerialization.ReadRocketVictimConnectedMessage; Writer.write = RocketVictimDisconnectedMessageSerialization.WriteRocketVictimDisconnectedMessage; Reader.read = RocketVictimDisconnectedMessageSerialization.ReadRocketVictimDisconnectedMessage; NetworkClient.RegisterHandler((Action)RocketTetherClientLogic.HandleVictimConnected, true); NetworkClient.RegisterHandler((Action)RocketTetherClientLogic.HandleVictimDisconnected, true); Writer.write = RocketTetherGrenadeMessageSerialization.WriteRocketTetherGrenadeThrowMessage; Reader.read = RocketTetherGrenadeMessageSerialization.ReadRocketTetherGrenadeThrowMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, RocketTetherGrenadeThrowMessage msg) { //IL_000d: 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) GetBridge(conn)?.ServerHandleThrow(msg.ThrowOrigin, msg.ThrowVelocity); }, true); } Writer.write = RocketTetherGrenadeMessageSerialization.WriteRocketTetherGrenadeLandedMessage; Reader.read = RocketTetherGrenadeMessageSerialization.ReadRocketTetherGrenadeLandedMessage; NetworkClient.RegisterHandler((Action)delegate(RocketTetherGrenadeLandedMessage msg) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) RocketTetherGrenadeNetworkBridge.ClientHandleLand(msg.Position, msg.ThrowerNetId); }, true); Writer.write = TeleporterUseMessageSerialization.WriteTeleporterUseMessage; Reader.read = TeleporterUseMessageSerialization.ReadTeleporterUseMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, TeleporterUseMessage msg) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) GetBridge(conn)?.ServerHandleUse(msg.Destination, msg.EquippedIndex); }, true); } Writer.write = TeleporterWarpMessageSerialization.WriteTeleporterWarpMessage; Reader.read = TeleporterWarpMessageSerialization.ReadTeleporterWarpMessage; NetworkClient.RegisterHandler((Action)TeleporterNetworkBridge.HandleWarp, true); Writer.write = TeleporterVfxMessageSerialization.WriteTeleporterVfxMessage; Reader.read = TeleporterVfxMessageSerialization.ReadTeleporterVfxMessage; NetworkClient.RegisterHandler((Action)TeleporterNetworkBridge.HandleVfx, true); Writer.write = WindStormMessageSerialization.WriteActivate; Reader.read = WindStormMessageSerialization.ReadActivate; Writer.write = WindStormMessageSerialization.WriteBegin; Reader.read = WindStormMessageSerialization.ReadBegin; Writer.write = WindStormMessageSerialization.WriteEnd; Reader.read = WindStormMessageSerialization.ReadEnd; NetworkClient.RegisterHandler((Action)WindStormNetworkBridge.HandleBegin, true); NetworkClient.RegisterHandler((Action)WindStormNetworkBridge.HandleEnd, true); if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, WindStormActivateMessage msg) { GetBridge(conn)?.ServerActivate(); }, true); } Writer.write = UfoAbductionLockOnMessageSerialization.WriteUfoAbductionLockOnMessage; Reader.read = UfoAbductionLockOnMessageSerialization.ReadUfoAbductionLockOnMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, UfoAbductionLockOnMessage msg) { GetBridge(conn)?.ServerHandleLockOn(conn, msg); }, true); } Writer.write = UfoAbductionDropoffSelectedMessageSerialization.WriteUfoAbductionDropoffSelectedMessage; Reader.read = UfoAbductionDropoffSelectedMessageSerialization.ReadUfoAbductionDropoffSelectedMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, UfoAbductionDropoffSelectedMessage msg) { GetBridge(conn)?.ServerHandleDropoffSelected(conn, msg); }, true); } Writer.write = UfoAbductionDropoffCancelledMessageSerialization.WriteUfoAbductionDropoffCancelledMessage; Reader.read = UfoAbductionDropoffCancelledMessageSerialization.ReadUfoAbductionDropoffCancelledMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, UfoAbductionDropoffCancelledMessage msg) { GetBridge(conn)?.ServerHandleDropoffCancelled(conn, msg); }, true); } Writer.write = UfoAbductionBusyMessageSerialization.WriteUfoAbductionBusyMessage; Reader.read = UfoAbductionBusyMessageSerialization.ReadUfoAbductionBusyMessage; NetworkClient.RegisterHandler((Action)UfoAbductionNetworkBridge.HandleBusy, true); Writer.write = UfoAbductionTargetAcquiredMessageSerialization.WriteUfoAbductionTargetAcquiredMessage; Reader.read = UfoAbductionTargetAcquiredMessageSerialization.ReadUfoAbductionTargetAcquiredMessage; NetworkClient.RegisterHandler((Action)UfoAbductionNetworkBridge.HandleTargetAcquired, true); Writer.write = UfoAbductionBeingTargetedMessageSerialization.WriteUfoAbductionBeingTargetedMessage; Reader.read = UfoAbductionBeingTargetedMessageSerialization.ReadUfoAbductionBeingTargetedMessage; NetworkClient.RegisterHandler((Action)UfoAbductionNetworkBridge.HandleBeingTargeted, true); Writer.write = UfoAbductionSessionAbortedMessageSerialization.WriteUfoAbductionSessionAbortedMessage; Reader.read = UfoAbductionSessionAbortedMessageSerialization.ReadUfoAbductionSessionAbortedMessage; NetworkClient.RegisterHandler((Action)UfoAbductionNetworkBridge.HandleSessionAborted, true); Writer.write = UfoAbductionBeginMessageSerialization.WriteUfoAbductionBeginMessage; Reader.read = UfoAbductionBeginMessageSerialization.ReadUfoAbductionBeginMessage; NetworkClient.RegisterHandler((Action)UfoAbductionClientLogic.HandleBegin, true); Writer.write = UfoAbductionEndMessageSerialization.WriteUfoAbductionEndMessage; Reader.read = UfoAbductionEndMessageSerialization.ReadUfoAbductionEndMessage; NetworkClient.RegisterHandler((Action)UfoAbductionClientLogic.HandleEnd, true); Writer.write = MoonUseMessageSerialization.WriteMoonUseMessage; Reader.read = MoonUseMessageSerialization.ReadMoonUseMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, MoonUseMessage msg) { GetBridge(conn)?.ServerHandleUse(conn, msg); }, true); } Writer.write = MoonBeginMessageSerialization.WriteMoonBeginMessage; Reader.read = MoonBeginMessageSerialization.ReadMoonBeginMessage; NetworkClient.RegisterHandler((Action)MoonClientLogic.HandleMoonBegin, true); Writer.write = MoonEndMessageSerialization.WriteMoonEndMessage; Reader.read = MoonEndMessageSerialization.ReadMoonEndMessage; NetworkClient.RegisterHandler((Action)MoonClientLogic.HandleMoonEnd, true); Writer.write = HunterDroneLaunchMessageSerialization.WriteHunterDroneLaunchMessage; Reader.read = HunterDroneLaunchMessageSerialization.ReadHunterDroneLaunchMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, HunterDroneLaunchMessage msg) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) GetBridge(conn)?.ServerLaunchDrone(msg.AimPoint); }, true); } Writer.write = HunterDroneShotMessageSerialization.WriteHunterDroneShotMessage; Reader.read = HunterDroneShotMessageSerialization.ReadHunterDroneShotMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, HunterDroneShotMessage msg) { HunterDroneNetworkBridge.ServerHandleDroneShot(msg.DroneNetId); }, true); } Writer.write = HunterDroneExplodedMessageSerialization.WriteHunterDroneExplodedMessage; Reader.read = HunterDroneExplodedMessageSerialization.ReadHunterDroneExplodedMessage; NetworkClient.RegisterHandler((Action)HunterDroneNetworkBridge.HandleDroneExploded, true); Writer.write = ShapeShifterRequestMessageSerialization.WriteShapeShifterRequestMessage; Reader.read = ShapeShifterRequestMessageSerialization.ReadShapeShifterRequestMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, ShapeShifterRequestMessage msg) { GetBridge(conn)?.ServerHandleRequest(msg.TargetNetId, msg.EquippedSlotIndex); }, true); } Writer.write = SuperShapeShifterRequestMessageSerialization.WriteSuperShapeShifterRequestMessage; Reader.read = SuperShapeShifterRequestMessageSerialization.ReadSuperShapeShifterRequestMessage; if (NetworkServer.active) { NetworkServer.RegisterHandler((Action)delegate(NetworkConnectionToClient conn, SuperShapeShifterRequestMessage msg) { GetBridge(conn)?.ServerHandleRequest(msg.EquippedSlotIndex); }, true); } Writer.write = ShapeShifterBeginMessageSerialization.WriteShapeShifterBeginMessage; Reader.read = ShapeShifterBeginMessageSerialization.ReadShapeShifterBeginMessage; NetworkClient.RegisterHandler((Action)ShapeShifterHelper.HandleShapeShifterBegin, true); Writer.write = ShapeShifterEndMessageSerialization.WriteShapeShifterEndMessage; Reader.read = ShapeShifterEndMessageSerialization.ReadShapeShifterEndMessage; NetworkClient.RegisterHandler((Action)ShapeShifterHelper.HandleShapeShifterEnd, true); Writer.write = ExplosiveGolfBallsExplodeMessageSerialization.WriteExplosiveGolfBallsExplodeMessage; Reader.read = ExplosiveGolfBallsExplodeMessageSerialization.ReadExplosiveGolfBallsExplodeMessage; NetworkClient.RegisterHandler((Action)ExplosiveGolfBallsNetworkBridge.HandleExplosion, true); Writer.write = ScaledExplosionVfxMessageSerialization.WriteScaledExplosionVfxMessage; Reader.read = ScaledExplosionVfxMessageSerialization.ReadScaledExplosionVfxMessage; NetworkClient.RegisterHandler((Action)delegate(ScaledExplosionVfxMessage msg) { //IL_0004: 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_000e: 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_0037: Unknown result type (might be due to invalid IL or missing references) VfxManager.PlayPooledVfxLocalOnly((VfxType)37, msg.Position, Quaternion.identity, Vector3.one * msg.Scale, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.Position, 1f, 1f); }, true); } public static void ResetRegistration() { _prefabsRegistered = false; } private static void RegisterPrefabs() { RegisterPrefab(AssetLoader.DroppedCustomItemPrefab); RegisterPrefab(AssetLoader.DonutPrefab); RegisterPrefab(AssetLoader.DonutHandheldPrefab); RegisterPrefab(AssetLoader.JavelinHandheldPrefab); RegisterPrefab(AssetLoader.BatModelPrefab); RegisterPrefab(AssetLoader.BomberPrefab); RegisterPrefab(AssetLoader.BomberProxyPrefab); RegisterPrefab(AssetLoader.AC130Prefab); RegisterPrefab(AssetLoader.BomberTabletPrefab); RegisterPrefab(AssetLoader.MissileTabletPrefab); RegisterPrefab(AssetLoader.Ac130TabletPrefab); RegisterPrefab(AssetLoader.FreezeModelPrefab); RegisterPrefab(AssetLoader.LowGravityModelPrefab); RegisterPrefab(AssetLoader.SniperRiflePrefab); RegisterPrefab(AssetLoader.BloodSplatterPrefab); RegisterPrefab(AssetLoader.StickyGrenadePrefab); RegisterPrefab(AssetLoader.BearPrefab); RegisterPrefab(AssetLoader.TeddyBearPrefab); RegisterPrefab(AssetLoader.NukeBombPrefab); RegisterPrefab(AssetLoader.BlackHoleGrenadePrefab); RegisterPrefab(AssetLoader.WallPrefab); RegisterPrefab(AssetLoader.HarrierPrefab); RegisterPrefab(AssetLoader.PoisonJarPrefab); RegisterPrefab(AssetLoader.DronePrefab); if ((Object)(object)AssetLoader.RocketTetherGrenadePrefab != (Object)null) { RegisterPrefab(AssetLoader.RocketTetherGrenadePrefab); } if ((Object)(object)AssetLoader.HunterDronePrefab != (Object)null) { RegisterPrefab(AssetLoader.HunterDronePrefab); } } private static void RegisterPrefab(GameObject prefab) { if (!((Object)(object)prefab == (Object)null)) { NetworkIdentity component = prefab.GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)("[NetworkManager] Skipping " + ((Object)prefab).name + ": no NetworkIdentity.")); return; } if (component.assetId == 0) { IssaPluginPlugin.Log.LogWarning((object)("[NetworkManager] Skipping " + ((Object)prefab).name + ": assetId is 0 (not stable).")); return; } NetworkClient.RegisterPrefab(prefab); IssaPluginPlugin.Log.LogInfo((object)$"[NetworkManager] Registered '{((Object)prefab).name}' assetId={component.assetId}."); } } } [HarmonyPatch] internal static class NetworkManagerUnregisterPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(BNetworkManager), "OnStopClient", (Type[])null, (Type[])null); } private static void Postfix() { NetworkManagerRegisterPrefabsPatch.ResetRegistration(); } } [HarmonyPatch] internal static class BNetworkManagerOnServerReadyPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(BNetworkManager), "OnServerReady", new Type[1] { typeof(NetworkConnectionToClient) }, (Type[])null); } private static void Postfix(NetworkConnectionToClient connection) { if ((object)connection != NetworkServer.localConnection) { SpawnWeightsSyncer.SyncToConnection(connection); ItemConfigSyncer.BroadcastToConnection(connection); } } } internal class OrbitalLaserAircraftTracker : MonoBehaviour { public Transform AircraftTransform; public Action OnHit; public bool Triggered; public bool WasShotFromDonut; } internal static class OrbitalLaserAircraftHelpers { public static float XZDist(Vector3 p1, Vector3 p2) { //IL_0000: 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_000d: 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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = new Vector2(p1.x - p2.x, p1.z - p2.z); return ((Vector2)(ref val)).magnitude; } } [HarmonyPatch] internal static class OrbitalLaserGetTargetPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(OrbitalLaserManager), "GetTarget", (Type[])null, (Type[])null); } private static void Postfix(ref Hittable __result, ref Vector3 fallbackPosition) { //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_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)GolfHoleManager.MainHole).transform.position; Transform val = null; float num = float.MaxValue; AC130GunshipMarker aC130GunshipMarker = Object.FindFirstObjectByType(); if ((Object)(object)aC130GunshipMarker != (Object)null) { float num2 = OrbitalLaserAircraftHelpers.XZDist(((Component)aC130GunshipMarker).transform.position, position); if (num2 < num) { num = num2; val = ((Component)aC130GunshipMarker).transform; } } BomberMarker bomberMarker = Object.FindFirstObjectByType(); if ((Object)(object)bomberMarker != (Object)null) { float num3 = OrbitalLaserAircraftHelpers.XZDist(((Component)bomberMarker).transform.position, position); if (num3 < num) { num = num3; val = ((Component)bomberMarker).transform; } } DonutMarker donutMarker = Object.FindFirstObjectByType(); if ((Object)(object)donutMarker != (Object)null) { float num4 = OrbitalLaserAircraftHelpers.XZDist(((Component)donutMarker).transform.position, position); if (num4 < num) { num = num4; val = ((Component)donutMarker).transform; } } if (!((Object)(object)val == (Object)null)) { __result = null; fallbackPosition = val.position; IssaPluginPlugin.Log.LogInfo((object)$"[OrbitalLaser] Targeting aircraft at {val.position}."); } } } [HarmonyPatch] internal static class OrbitalLaserLockOnIndicatorPatch { private static readonly MethodInfo _localPlayerSetLockOnTarget = AccessTools.Method(typeof(PlayerInventory), "LocalPlayerSetLockOnTarget", (Type[])null, (Type[])null); private static MethodInfo TargetMethod() { return typeof(PlayerInventory).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name.Contains("UpdateOrbitalLaserLockOnTarget")); } private static bool Prefix(PlayerInventory __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (__instance.IsUsingItemAtAll) { return true; } Vector3 position = ((Component)GolfHoleManager.MainHole).transform.position; LockOnTarget val = null; float num = float.MaxValue; AC130GunshipMarker aC130GunshipMarker = Object.FindFirstObjectByType(); if ((Object)(object)aC130GunshipMarker != (Object)null) { LockOnTarget component = ((Component)aC130GunshipMarker).GetComponent(); if ((Object)(object)component != (Object)null) { float num2 = OrbitalLaserAircraftHelpers.XZDist(((Component)aC130GunshipMarker).transform.position, position); if (num2 < num) { num = num2; val = component; } } } BomberMarker bomberMarker = Object.FindFirstObjectByType(); if ((Object)(object)bomberMarker != (Object)null) { LockOnTarget component2 = ((Component)bomberMarker).GetComponent(); if ((Object)(object)component2 != (Object)null) { float num3 = OrbitalLaserAircraftHelpers.XZDist(((Component)bomberMarker).transform.position, position); if (num3 < num) { num = num3; val = component2; } } } if ((Object)(object)val == (Object)null) { return true; } _localPlayerSetLockOnTarget.Invoke(__instance, new object[1] { val }); return false; } } [HarmonyPatch(typeof(OrbitalLaser), "ServerActivate")] internal static class OrbitalLaserServerActivatePatch { private static Transform FindClosestAircraft(Vector3 fallbackWorldPosition, out Action onHit) { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) Transform result = null; onHit = null; float num = float.MaxValue; AC130GunshipMarker aC130GunshipMarker = Object.FindFirstObjectByType(); if ((Object)(object)aC130GunshipMarker != (Object)null) { float num2 = OrbitalLaserAircraftHelpers.XZDist(((Component)aC130GunshipMarker).transform.position, fallbackWorldPosition); if (num2 < num) { num = num2; result = ((Component)aC130GunshipMarker).transform; AC130HitReceiver hitReceiver = ((Component)aC130GunshipMarker).GetComponent(); onHit = delegate { hitReceiver?.OnHit(); }; } } BomberProxyBehaviour proxy = Object.FindFirstObjectByType(); if ((Object)(object)proxy != (Object)null) { float num3 = OrbitalLaserAircraftHelpers.XZDist(((Component)proxy).transform.position, fallbackWorldPosition); if (num3 < num) { num = num3; result = ((Component)proxy).transform; onHit = delegate { proxy.OnHit(); }; } } return result; } private static bool Prefix(OrbitalLaser __instance, Hittable target, Vector3 fallbackWorldPosition, PlayerInventory owner, ItemUseId itemUseId) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) if (!NetworkServer.active || (Object)(object)target != (Object)null) { return true; } if (fallbackWorldPosition == DonutNetworkBridge.DonutLaserTargetVector) { FieldInfo field = typeof(OrbitalLaser).GetField("owner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); field.SetValue(__instance, owner); FieldInfo field2 = typeof(OrbitalLaser).GetField("itemUseId", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); field2.SetValue(__instance, itemUseId); FieldInfo field3 = typeof(OrbitalLaser).GetField("activationTimestamp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); field3.SetValue(__instance, Time.timeAsDouble); __instance.NetworktargetPosition = fallbackWorldPosition; return false; } return true; } private static void Postfix(OrbitalLaser __instance, Hittable target, Vector3 fallbackWorldPosition, PlayerInventory owner, ItemUseId itemUseId) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00f7: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)target != (Object)null) { return; } Action onHit = null; Transform val = null; bool flag = false; if (fallbackWorldPosition == DonutNetworkBridge.DonutLaserTargetVector) { flag = true; DonutFlyBehaviour component = DonutNetworkBridge.ActiveDonut.GetComponent(); if ((Object)(object)component != (Object)null) { val = component.DonutLaserTarget.transform; } } else { val = FindClosestAircraft(fallbackWorldPosition, out onHit); } if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[OrbitalLaser] ServerActivate: target is null but no aircraft found on server."); return; } OrbitalLaserAircraftTracker orbitalLaserAircraftTracker = ((Component)__instance).gameObject.AddComponent(); orbitalLaserAircraftTracker.AircraftTransform = val; orbitalLaserAircraftTracker.OnHit = onHit; orbitalLaserAircraftTracker.WasShotFromDonut = flag; __instance.NetworktargetPosition = val.position; if (flag && (Object)(object)val != (Object)null) { __instance.Networkstate = (OrbitalLaserState)3; } IssaPluginPlugin.Log.LogInfo((object)("[OrbitalLaser] Tracker attached to " + ((Object)val).name + " " + $"at {val.position}.).")); } } [HarmonyPatch(typeof(OrbitalLaser), "OnBUpdate")] internal static class OrbitalLaserOnBUpdatePatch { private static readonly FieldInfo _stateField = AccessTools.Field(typeof(OrbitalLaser), "state"); private static void Postfix(OrbitalLaser __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) if (!NetworkServer.active) { return; } OrbitalLaserAircraftTracker component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.AircraftTransform == (Object)null || component.Triggered) { return; } OrbitalLaserState val = (OrbitalLaserState)_stateField.GetValue(__instance); if ((int)val == 1 || (int)val == 2) { __instance.NetworktargetPosition = component.AircraftTransform.position; } else if ((int)val == 3) { float num = OrbitalLaserAircraftHelpers.XZDist(__instance.NetworktargetPosition, component.AircraftTransform.position); float orbitalLaserExplosionMaxRange = GameManager.ItemSettings.OrbitalLaserExplosionMaxRange; if (num <= orbitalLaserExplosionMaxRange) { component.Triggered = true; Action onHit = component.OnHit; component.OnHit = null; onHit?.Invoke(); IssaPluginPlugin.Log.LogInfo((object)"[OrbitalLaser] Aircraft hit confirmed."); } } } } [HarmonyPatch] internal static class RedBullSpeedPatch { private static MethodBase _groundSpeedMb; private static MethodBase _airSpeedMb; static RedBullSpeedPatch() { Type type = AccessTools.TypeByName("PlayerMovement"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[RedBull] PlayerMovement not found — speed patch skipped."); return; } List declaredMethods = AccessTools.GetDeclaredMethods(type); _groundSpeedMb = declaredMethods.FirstOrDefault((MethodInfo m) => m.Name.Contains("GetTargetSpeedOnGround")); _airSpeedMb = declaredMethods.FirstOrDefault((MethodInfo m) => m.Name.Contains("GetTargetSpeedInAir")); } private static IEnumerable TargetMethods() { if (_groundSpeedMb != null) { yield return _groundSpeedMb; } if (_airSpeedMb != null) { yield return _airSpeedMb; } } private static void Postfix(object __instance, ref float __result) { if (RedBullBehaviour.IsActive) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if (!((Object)(object)localPlayerMovement == (Object)null) && __instance == localPlayerMovement && !(localPlayerMovement.SpeedBoostRemainingTime <= 0f)) { __result *= ModConfig.RedBull.ExtraSpeedMultiplier.Value; } } } } [HarmonyPatch] internal static class RedBullJumpPatch { private static MethodBase _targetMb; private static PropertyInfo _velocityProp; static RedBullJumpPatch() { Type type = AccessTools.TypeByName("PlayerMovement"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[RedBull] PlayerMovement not found — jump patch skipped."); return; } _targetMb = AccessTools.Method(type, "TriggerJumpInternal", (Type[])null, (Type[])null); _velocityProp = AccessTools.Property(type, "Velocity"); } private static MethodBase TargetMethod() { return _targetMb; } private static void Postfix(object __instance) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (RedBullBehaviour.IsActive) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if (!((Object)(object)localPlayerMovement == (Object)null) && __instance == localPlayerMovement && !(_velocityProp == null)) { Vector3 val = (Vector3)_velocityProp.GetValue(localPlayerMovement); val.y += ModConfig.RedBull.JumpBonus.Value; _velocityProp.SetValue(localPlayerMovement, val); } } } } [HarmonyPatch(typeof(Rocket), "Awake")] internal static class RocketAwakePatch { private static void Postfix(Rocket __instance) { //IL_0039: 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 (PredatorMissileItem.ActiveMissileRockets.Contains(__instance)) { Entity component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && component.HasRigidbody) { component.Rigidbody.linearVelocity = Vector3.down * ModConfig.PredatorMissile.FallSpeed.Value; } } } } [HarmonyPatch(typeof(Rocket), "ServerExplode")] internal class Patch_Rocket_ServerExplode { private static void Postfix(Rocket __instance, Vector3 worldPosition) { //IL_0001: 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_00a9: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(worldPosition, 8f, -1, (QueryTriggerInteraction)2); bool flag = StealthBomberItem.ActiveBomberDropRocketIds.Remove(((Object)__instance).GetInstanceID()); NetworkConnectionToClient value; bool flag2 = HarrierItem.ActiveHarrierRocketIds.Remove(((Object)__instance).GetInstanceID(), out value); Collider[] array2 = array; foreach (Collider val in array2) { AC130HitReceiver componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Rocket exploded within range — notifying AC130HitReceiver."); componentInParent.OnHit?.Invoke(); } if (!flag) { BomberProxyBehaviour componentInParent2 = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { componentInParent2.LastHitWorldPos = worldPosition; componentInParent2.OnHit(); } } DonutHitReceiver componentInParent3 = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null) { componentInParent3.OnHit(); } PlaceableWallDestructionBehaviour componentInParent4 = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent4 != (Object)null) { componentInParent4.ApplyExplosionDamage(worldPosition, 8f); } if (!flag2) { HarrierHitReceiver componentInParent5 = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent5 != (Object)null) { componentInParent5.LastHitWorldPos = worldPosition; componentInParent5.OnHit?.Invoke(); } } ((Component)val).GetComponentInParent()?.ShootDown(); } if (!flag2 || value == null) { return; } List list = new List(); Collider[] array3 = array; foreach (Collider val2 in array3) { PlayerInfo componentInParent6 = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent6 != (Object)null && !list.Contains(componentInParent6)) { list.Add(componentInParent6); ((NetworkConnection)value).Send(new HitNotificationMessage { Message = "Harrier hit " + componentInParent6.PlayerId.PlayerName + "!" }, 0); } } } } [HarmonyPatch(typeof(Rocket), "OnFixedBUpdate")] internal static class RocketFixedBUpdatePatch { private static readonly FieldRef DistanceTravelledRef = AccessTools.FieldRefAccess("distanceTravelled"); private static bool Prefix(Rocket __instance) { if (JavelinItem.ActiveJavelinRockets.Contains(__instance)) { return false; } if (PredatorMissileItem.ActiveMissileRockets.Contains(__instance)) { DistanceTravelledRef.Invoke(__instance) = 0f; } return true; } } [HarmonyPatch(typeof(Rocket), "OnLateBUpdate")] internal static class RocketLateBUpdatePatch { private static bool Prefix(Rocket __instance) { return !JavelinItem.ActiveJavelinRockets.Contains(__instance); } } [HarmonyPatch] internal static class ShapeShifterPhysicsPatch { private static readonly MethodBase TargetMb; static ShapeShifterPhysicsPatch() { Type type = AccessTools.TypeByName("GolfBall"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] GolfBall type not found — angular damping patch skipped."); return; } TargetMb = AccessTools.Method(type, "UpdateFrictionMode", (Type[])null, (Type[])null); if (TargetMb == null) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] GolfBall.UpdateFrictionMode not found — angular damping patch skipped."); } } private static MethodBase TargetMethod() { return TargetMb; } private static void Postfix(Component __instance) { if (!((Object)(object)__instance.GetComponent() == (Object)null)) { Rigidbody component = __instance.GetComponent(); if ((Object)(object)component != (Object)null) { component.angularDamping = ModConfig.ShapeShifter.PhysicsAngularDamping.Value; } } } } [HarmonyPatch] internal static class ShapeShifterContactDebugPatch { private static readonly MethodBase TargetMb; static ShapeShifterContactDebugPatch() { Type type = AccessTools.TypeByName("PhysicsManager"); TargetMb = ((type != null) ? AccessTools.Method(type, "ModifyContactsInternal", (Type[])null, (Type[])null) : null); if (TargetMb == null) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter][DEBUG] PhysicsManager.ModifyContactsInternal not found — contact debug patch skipped."); } } private static MethodBase TargetMethod() { return TargetMb; } private static void Postfix(ref NativeArray contactPairs) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) int activeShapeColliderId = GetActiveShapeColliderId(); if (activeShapeColliderId == 0) { return; } int localPlayerRigidbodyId = GetLocalPlayerRigidbodyId(); for (int i = 0; i < contactPairs.Length; i++) { ModifiableContactPair val = contactPairs[i]; int colliderInstanceID = ((ModifiableContactPair)(ref val)).colliderInstanceID; int otherColliderInstanceID = ((ModifiableContactPair)(ref val)).otherColliderInstanceID; if (colliderInstanceID == activeShapeColliderId || otherColliderInstanceID == activeShapeColliderId) { int bodyInstanceID = ((ModifiableContactPair)(ref val)).bodyInstanceID; int otherBodyInstanceID = ((ModifiableContactPair)(ref val)).otherBodyInstanceID; bool flag = bodyInstanceID == localPlayerRigidbodyId || otherBodyInstanceID == localPlayerRigidbodyId; ModifiableMassProperties massProperties = ((ModifiableContactPair)(ref val)).massProperties; IssaPluginPlugin.Log.LogInfo((object)("[ShapeShifter][DEBUG] Contact pair involving shape collider:" + $" colliderA={colliderInstanceID} colliderB={otherColliderInstanceID}" + $" rbA={bodyInstanceID} rbB={otherBodyInstanceID}" + $" localPlayerRbId={localPlayerRigidbodyId}" + $" involvedLocalPlayer={flag}" + $" inverseMassScale={massProperties.inverseMassScale:F4}" + $" otherInverseMassScale={massProperties.otherInverseMassScale:F4}" + $" contacts={((ModifiableContactPair)(ref val)).contactCount}")); } } } private static int GetActiveShapeColliderId() { ShapeShifterState[] array = Object.FindObjectsByType((FindObjectsSortMode)0); ShapeShifterState[] array2 = array; int num = 0; if (num < array2.Length) { ShapeShifterState obj = array2[num]; FieldInfo field = typeof(ShapeShifterState).GetField("_shapeColliderId", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return 0; } return (int)field.GetValue(obj); } return 0; } private static int GetLocalPlayerRigidbodyId() { NetworkIdentity localPlayer = NetworkClient.localPlayer; if ((Object)(object)localPlayer == (Object)null) { return 0; } Rigidbody component = ((Component)localPlayer).GetComponent(); return ((Object)(object)component != (Object)null) ? ((Object)component).GetInstanceID() : 0; } } [HarmonyPatch] internal static class ShapeShifterHitSpinPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Hittable), "HitWithGolfSwingInternal", (Type[])null, (Type[])null); } private static void Postfix(Hittable __instance) { //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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !__instance.AsEntity.IsGolfBall || (Object)(object)((Component)__instance).GetComponent() == (Object)null) { return; } float value = ModConfig.ShapeShifter.PhysicsHitSpinFactor.Value; if (value <= 0f) { return; } Rigidbody component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { return; } Vector3 linearVelocity = component.linearVelocity; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (!(magnitude < 0.01f)) { linearVelocity = component.linearVelocity; Vector3 val = Vector3.Cross(((Vector3)(ref linearVelocity)).normalized, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.right; } component.angularVelocity += val * (magnitude * value) + Random.insideUnitSphere * (magnitude * value * 0.3f); } } } [HarmonyPatch(typeof(PlayerGolfer), "OnFinishedSwinging")] internal static class GolfSwingWallHitPatch { private static readonly HashSet _hitWalls = new HashSet(); private static void Postfix(PlayerGolfer __instance) { //IL_0044: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) if (!NetworkServer.active) { return; } PlayerInfo playerInfo = __instance.PlayerInfo; if ((Object)(object)playerInfo == (Object)null) { return; } PlayerInventory inventory = playerInfo.Inventory; bool flag = ((inventory != null) ? new ItemType?(inventory.GetEffectivelyEquippedItem(true)) : ((ItemType?)null)) == (ItemType?)ItemRegistry.BaseballBatItemType; Vector3 val = ((Component)__instance).transform.TransformPoint(GameManager.GolfSettings.SwingHitBoxLocalCenter); float value = ModConfig.Bear.MeleeHitRange.Value; Collider[] array = Physics.OverlapSphere(val, value, -1, (QueryTriggerInteraction)2); float amount = (flag ? ModConfig.PlaceableWall.DamageBaseballBat.Value : ModConfig.PlaceableWall.DamageGolfClub.Value); _hitWalls.Clear(); Collider[] array2 = array; foreach (Collider val2 in array2) { PlaceableWallDestructionBehaviour componentInParent = ((Component)val2).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && _hitWalls.Add(((Component)componentInParent).gameObject)) { componentInParent.ApplyDamage(amount); } } } } [HarmonyPatch] internal static class WindStormMovementPatch { private static readonly MethodBase TargetMb; private static readonly FieldInfo RigidbodyField; private static readonly PropertyInfo IsKnockedOutProp; static WindStormMovementPatch() { Type type = AccessTools.TypeByName("PlayerMovement"); if (type == null) { IssaPluginPlugin.Log.LogWarning((object)"[WindStorm] PlayerMovement type not found — player wind patch skipped."); return; } TargetMb = AccessTools.Method(type, "FixedUpdate", (Type[])null, (Type[])null); if (TargetMb == null) { IssaPluginPlugin.Log.LogWarning((object)"[WindStorm] PlayerMovement.FixedUpdate not found — player wind patch skipped."); return; } RigidbodyField = AccessTools.Field(type, "rigidbody"); if (RigidbodyField == null) { IssaPluginPlugin.Log.LogWarning((object)"[WindStorm] PlayerMovement.rigidbody field not found — player wind patch skipped."); } IsKnockedOutProp = AccessTools.Property(type, "IsKnockedOut"); if (IsKnockedOutProp == null) { IssaPluginPlugin.Log.LogWarning((object)"[WindStorm] PlayerMovement.IsKnockedOut property not found — player wind patch skipped."); } IssaPluginPlugin.Log.LogInfo((object)"[WindStorm] Player wind movement patch ready."); } private static MethodBase TargetMethod() { return TargetMb; } private static void Postfix(object __instance) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!WindStormNetworkBridge.IsSessionActive || !ModConfig.WindStorm.AffectPlayers.Value || WindManager.CurrentWindSpeed <= 0 || RigidbodyField == null || IsKnockedOutProp == null) { return; } NetworkBehaviour val = (NetworkBehaviour)((__instance is NetworkBehaviour) ? __instance : null); if ((Object)(object)val == (Object)null || !val.isLocalPlayer || !(bool)IsKnockedOutProp.GetValue(__instance)) { return; } NetworkIdentity component = ((Component)__instance).GetComponent(); if (!((Object)(object)component != (Object)null) || !WindStormNetworkBridge.WindImmuneNetIds.Contains(component.netId)) { object? value = RigidbodyField.GetValue(__instance); Rigidbody val2 = (Rigidbody)((value is Rigidbody) ? value : null); if (!((Object)(object)val2 == (Object)null)) { float value2 = ModConfig.WindStorm.PlayerWindFactor.Value; val2.AddForce(WindManager.Wind * value2, (ForceMode)5); } } } } [HarmonyPatch] internal static class WindStormWindImmunityPatch { private static readonly FieldInfo CanBeAffectedByWindField = AccessTools.Field(typeof(GolfBall), "canBeAffectedByWind"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { return AccessTools.Method(typeof(GolfBall), "ApplyLinearDamping", (Type[])null, (Type[])null); } [HarmonyPrefix] private static void Prefix(GolfBall __instance) { if (WindStormNetworkBridge.WindImmuneNetIds.Count == 0) { return; } PlayerGolfer owner = __instance.Owner; if (!((Object)(object)owner == (Object)null)) { NetworkIdentity component = ((Component)owner).GetComponent(); if (!((Object)(object)component == (Object)null) && WindStormNetworkBridge.WindImmuneNetIds.Contains(component.netId)) { CanBeAffectedByWindField.SetValue(__instance, false); } } } } } namespace IssaPlugin.Items { internal static class AC130ClientHandlers { internal static void HandleAC130Sound(AC130SoundMessage msg) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown AudioClip aC130AboveClip = AssetLoader.AC130AboveClip; if ((Object)(object)aC130AboveClip == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[AC130] Audio clip not loaded."); return; } GameObject val = new GameObject("AC130_Sound"); AudioSource val2 = val.AddComponent(); val2.clip = aC130AboveClip; val2.spatialBlend = 0f; val2.volume = 1f; val2.Play(); Object.Destroy((Object)(object)val, aC130AboveClip.length + 0.1f); } internal static void HandleAC130MaydayVfx(AC130MaydayVfxMessage msg) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity localPlayer = NetworkClient.localPlayer; AC130NetworkBridge aC130NetworkBridge = ((localPlayer != null) ? ((Component)localPlayer).GetComponent() : null); if ((!((Object)(object)aC130NetworkBridge != (Object)null) || !aC130NetworkBridge.LocalSessionActive) && NetworkClient.spawned.TryGetValue(msg.GunshipNetId, out var value) && !((Object)(object)value == (Object)null)) { GameObject gameObject = ((Component)value).gameObject; if ((Object)(object)gameObject.GetComponent() == (Object)null) { AC130MaydayBehaviour aC130MaydayBehaviour = gameObject.AddComponent(); aC130MaydayBehaviour.IsLocalPlayer = false; aC130MaydayBehaviour.OrbitCenter = gameObject.GetComponent()?.orbitCenter ?? Vector3.zero; } } } internal static void HandleAC130Damaged(AC130DamagedMessage msg) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)AssetLoader.MaydaySmokeTrailPrefab == (Object)null) && NetworkClient.spawned.TryGetValue(msg.GunshipNetId, out var value) && !((Object)(object)value == (Object)null)) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Spawning damage smoke trail."); GameObject val = Object.Instantiate(AssetLoader.MaydaySmokeTrailPrefab, ((Component)value).transform.position, Quaternion.identity); val.transform.SetParent(((Component)value).transform, true); } } internal static void HandleAC130MaydayImpact(AC130MaydayImpactMessage msg) { //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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) float value = ModConfig.AC130.MaydayExplosionDuration.Value; if ((Object)(object)AssetLoader.MaydayExplosionVfxPrefab != (Object)null) { GameObject val = Object.Instantiate(AssetLoader.MaydayExplosionVfxPrefab, msg.ImpactPos, Quaternion.identity); Object.Destroy((Object)(object)val, value); } else { VfxManager.PlayPooledVfxLocalOnly((VfxType)37, msg.ImpactPos, Quaternion.identity, Vector3.one * ModConfig.AC130.MaydayExplosionScale.Value, 0u, false, 0f, (Action)null); } if ((Object)(object)AssetLoader.ImpactVfxPrefab != (Object)null) { GameObject val2 = Object.Instantiate(AssetLoader.ImpactVfxPrefab, msg.ImpactPos, Quaternion.identity); Object.Destroy((Object)(object)val2, value); } CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.ImpactPos, 1f, 1f); } } public class AC130ClientSetup : MonoBehaviour { private void Awake() { if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } } } public enum AC130FlightMode { FlyIn, Orbit, FlyOut } public class AC130FlyBehaviour : MonoBehaviour { public Vector3 orbitCenter; public float orbitRadius; public float altitude; public float orbitSpeed; public float currentAngle; public float altitudeLerpSpeed = 5f; public AC130FlightMode mode = AC130FlightMode.Orbit; public Vector3 flyTarget; public float flySpeed = 80f; private float _currentAltitude; private const float AltitudeSnapThreshold = 0.01f; private const float ArrivalThreshold = 5f; private const float FlyOutDestroyDistance = 2000f; private Vector3 _flyOutStart; private bool _normalFlyOutComplete; private Rigidbody _rb; public bool HasArrived { get; private set; } public Action OnExternallyDestroyed { get; set; } private void Start() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) _rb = ((Component)this).GetComponent(); _currentAltitude = altitude; if (mode == AC130FlightMode.FlyOut) { _flyOutStart = ((Component)this).transform.position; } } private void FixedUpdate() { if (NetworkServer.active) { switch (mode) { case AC130FlightMode.FlyIn: UpdateFlyIn(); break; case AC130FlightMode.Orbit: UpdateOrbit(); break; case AC130FlightMode.FlyOut: UpdateFlyOut(); break; } } } private void UpdateFlyIn() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_0043: 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) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0056: 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_006b: 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_007e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = Vector3.MoveTowards(((Component)this).transform.position, flyTarget, flySpeed * Time.fixedDeltaTime); Vector3 val = flyTarget - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion rotation = ((normalized != Vector3.zero) ? Quaternion.LookRotation(normalized, Vector3.up) : ((Component)this).transform.rotation); Move(position, rotation); if (Vector3.Distance(((Component)this).transform.position, flyTarget) < 5f) { HasArrived = true; mode = AC130FlightMode.Orbit; _currentAltitude = altitude; } } private void UpdateOrbit() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) currentAngle += orbitSpeed * Time.fixedDeltaTime; _currentAltitude = Mathf.Lerp(_currentAltitude, altitude, altitudeLerpSpeed * Time.fixedDeltaTime); if (Mathf.Abs(_currentAltitude - altitude) < 0.01f) { _currentAltitude = altitude; } float num = currentAngle * (MathF.PI / 180f); Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(orbitCenter.x + Mathf.Cos(num) * orbitRadius, orbitCenter.y + _currentAltitude, orbitCenter.z + Mathf.Sin(num) * orbitRadius); Vector3 val = new Vector3(0f - Mathf.Sin(num), 0f, Mathf.Cos(num)); Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion rotation = ((normalized != Vector3.zero) ? Quaternion.LookRotation(normalized, Vector3.up) : ((Component)this).transform.rotation); Move(position, rotation); } private void UpdateFlyOut() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0027: 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_003a: 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_0047: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * flySpeed * Time.fixedDeltaTime; Move(val, ((Component)this).transform.rotation); if (Vector3.Distance(val, _flyOutStart) > 2000f) { _normalFlyOutComplete = true; Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Move(Vector3 position, Quaternion rotation) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rb != (Object)null) { _rb.MovePosition(position); _rb.MoveRotation(rotation); } else { ((Component)this).transform.SetPositionAndRotation(position, rotation); } } public void BeginFlyOut() { //IL_000f: 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) mode = AC130FlightMode.FlyOut; _flyOutStart = ((Component)this).transform.position; flySpeed = ModConfig.AC130.ApproachSpeed.Value; } private void OnDestroy() { if (!_normalFlyOutComplete && mode != AC130FlightMode.FlyOut) { OnExternallyDestroyed?.Invoke(); } } } public class AC130GunshipCamera : MonoBehaviour { public Vector3 orbitCenter; public float baseFov = 60f; public float yawLimit = 40f; public float pitchLimit = 30f; public float mouseSensitivity = 0.15f; public float shakePeakDegrees = 1.4f; public float shakeDecaySpeed = 6f; private Camera _gunshipCam; private Camera _previousCam; private bool _active; private Vector2 _lookOffset; private Vector2 _shakeOffset; public float FieldOfView => ((Object)(object)_gunshipCam != (Object)null) ? _gunshipCam.fieldOfView : baseFov; public Camera Camera => _gunshipCam; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("AC130_GunshipCam"); val.transform.SetParent(((Component)this).transform, false); _gunshipCam = val.AddComponent(); _gunshipCam.fieldOfView = baseFov; _gunshipCam.nearClipPlane = 1f; _gunshipCam.farClipPlane = 8000f; ((Behaviour)_gunshipCam).enabled = false; } private void OnDestroy() { if (_active) { Deactivate(); } } public void Activate() { //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) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!_active) { _lookOffset = Vector2.zero; _shakeOffset = Vector2.zero; _previousCam = Camera.main; if ((Object)(object)_previousCam != (Object)null) { ((Behaviour)_previousCam).enabled = false; } _gunshipCam.fieldOfView = baseFov; ((Behaviour)_gunshipCam).enabled = true; _active = true; ApplyCameraTransform(); IssaPluginPlugin.Log.LogInfo((object)"[AC130] Gunship camera activated."); } } public void Deactivate() { if (_active) { ((Behaviour)_gunshipCam).enabled = false; if ((Object)(object)_previousCam != (Object)null) { ((Behaviour)_previousCam).enabled = true; } _active = false; IssaPluginPlugin.Log.LogInfo((object)"[AC130] Gunship camera deactivated."); } } public void UpdateLook() { //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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (_active) { Mouse current = Mouse.current; if (current != null) { Vector2 val = ((InputControl)(object)((Pointer)current).delta).ReadValue(); _lookOffset.y += val.x * mouseSensitivity; _lookOffset.x -= val.y * mouseSensitivity; _lookOffset.x = Mathf.Clamp(_lookOffset.x, 0f - pitchLimit, pitchLimit); _lookOffset.y = Mathf.Clamp(_lookOffset.y, 0f - yawLimit, yawLimit); } } } public void TriggerFireShake() { _shakeOffset.x = 0f - shakePeakDegrees; _shakeOffset.y = Random.Range((0f - shakePeakDegrees) * 0.4f, shakePeakDegrees * 0.4f); } public void SetFov(float targetFov, float lerpSpeed) { if (!((Object)(object)_gunshipCam == (Object)null)) { _gunshipCam.fieldOfView = Mathf.Lerp(_gunshipCam.fieldOfView, targetFov, lerpSpeed * Time.deltaTime); } } private void LateUpdate() { //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_0028: 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) if (_active) { _shakeOffset = Vector2.Lerp(_shakeOffset, Vector2.zero, shakeDecaySpeed * Time.deltaTime); ApplyCameraTransform(); } } private void ApplyCameraTransform() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_gunshipCam == (Object)null)) { Vector3 val = orbitCenter - ((Component)this).transform.position; Vector3 val2 = ((Vector3)(ref val)).normalized * 3f; ((Component)_gunshipCam).transform.position = ((Component)this).transform.position + val2; Vector3 val3 = orbitCenter - ((Component)this).transform.position; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.down; } Quaternion val4 = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up); Vector2 val5 = _lookOffset + _shakeOffset; Quaternion val6 = Quaternion.AngleAxis(val5.y, Vector3.up); Quaternion val7 = Quaternion.AngleAxis(val5.x, Vector3.right); ((Component)_gunshipCam).transform.rotation = val6 * val4 * val7; } } } public class AC130GunshipMarker : MonoBehaviour { } public static class AC130Helpers { public static Vector3 OrbitPosition(Vector3 centre, float angleDeg, float radius, float altitude) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) float num = angleDeg * (MathF.PI / 180f); return new Vector3(centre.x + Mathf.Cos(num) * radius, centre.y + altitude, centre.z + Mathf.Sin(num) * radius); } public static Vector3 OrbitTangent(float angleDeg) { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) float num = angleDeg * (MathF.PI / 180f); Vector3 val = new Vector3(0f - Mathf.Sin(num), 0f, Mathf.Cos(num)); return ((Vector3)(ref val)).normalized; } public static Vector3 ComputeMapCenter(Vector3 fallback) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_00de: 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_0043: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) GolfHole mainHole = GolfHoleManager.MainHole; if ((Object)(object)mainHole == (Object)null) { return fallback; } Vector3 position = ((Component)mainHole).transform.position; HashSet activeTeeingPlaforms = GolfTeeManager.ActiveTeeingPlaforms; if (activeTeeingPlaforms == null || activeTeeingPlaforms.Count == 0) { return position; } Vector3 val = Vector3.zero; int num = 0; foreach (GolfTeeingPlatform item in activeTeeingPlaforms) { if ((Object)(object)item != (Object)null) { val += ((Component)item).transform.position; num++; } } if (num == 0) { return position; } Vector3 val2 = val / (float)num; return (position + val2) * 0.5f; } } public class AC130HitReceiver : CustomHittable { public void Awake() { base.HitCount = 0; base.HitsRequired = (int)ModConfig.AC130.HitsToMayday.Value; base.OnHit = (Action)Delegate.Combine(base.OnHit, new Action(OnAC130Hit)); } private void OnAC130Hit() { IssaPluginPlugin.Log.LogInfo((object)"[AC130] OnAC130Hit called."); if (NetworkServer.active && base.HitsRequired > 0 && base.HitCount < base.HitsRequired) { base.HitCount++; IssaPluginPlugin.Log.LogInfo((object)$"[AC130] Rocket impact {base.HitCount}/{base.HitsRequired}."); if (base.HitCount >= base.HitsRequired) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Hit threshold reached — triggering mayday."); base.OnHitsExceeded?.Invoke(); } } } } public static class AC130Item { private static int _useIndex; public static void HandleZoom(Mouse mouse, AC130Session session) { if (mouse != null && !((Object)(object)session.GunshipCam == (Object)null)) { float targetFov = (mouse.rightButton.isPressed ? ModConfig.AC130.ZoomFov.Value : session.GunshipCam.baseFov); session.GunshipCam.SetFov(targetFov, ModConfig.AC130.ZoomSpeed.Value); } } public static void HandleFlight(Keyboard keyboard, AC130Session s) { bool flag = keyboard != null && ((ButtonControl)keyboard[(Key)51]).isPressed; if ((Object)(object)s.FlyComp != (Object)null) { s.FlyComp.orbitSpeed = (flag ? s.BoostedOrbitSpeed : s.BaseOrbitSpeed); } if (keyboard != null) { if (((ButtonControl)keyboard[(Key)31]).isPressed) { s.AltitudeOffset -= s.AltitudeAdjustSpeed * Time.deltaTime; } if (((ButtonControl)keyboard[(Key)19]).isPressed) { s.AltitudeOffset += s.AltitudeAdjustSpeed * Time.deltaTime; } s.AltitudeOffset = Mathf.Clamp(s.AltitudeOffset, 0f - s.AltitudeOffsetMax, s.AltitudeOffsetMax); if ((Object)(object)s.FlyComp != (Object)null) { s.FlyComp.altitude = s.Altitude + s.AltitudeOffset; } } } public static void SpawnRocketInDirection(PlayerInventory inventory, Vector3 position, Quaternion worldRotation, float explosionScale = -1f) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { if (explosionScale < 0f) { explosionScale = ModConfig.AC130.ExplosionScale.Value; } _useIndex++; ItemUseId val = default(ItemUseId); ((ItemUseId)(ref val))..ctor(inventory.PlayerInfo.PlayerId.Guid, _useIndex, (ItemType)7, false); Rocket val2 = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, worldRotation); if ((Object)(object)val2 == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[AC130Item] Rocket did not instantiate."); return; } ((Component)val2).gameObject.AddComponent(); val2.ServerInitialize(inventory.PlayerInfo, (Hittable)null, val); NetworkServer.Spawn(((Component)val2).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val2, explosionScale); } } public static Vector3 ProjectAimToGround(Vector3 origin, Vector3 direction) { //IL_0001: 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_0032: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) if (Mathf.Abs(direction.y) < 0.001f) { return origin + direction * 500f; } float num = (0f - origin.y) / direction.y; if (num < 0f) { return origin + direction * 500f; } return origin + direction * num; } public static void ServerExplodeRocket(Rocket rocket) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rocket == (Object)null)) { MethodInfo method = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(rocket, new object[1] { ((Component)rocket).transform.position }); } else { IssaPluginPlugin.Log.LogError((object)"[AC130] Could not find ServerExplode method."); } } } } public class AC130ItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.AC130ItemType; public override string DisplayName => "AC130 Gunship"; public override string[] ConsoleAliases => new string[1] { "ac130" }; public override Sprite Icon => AssetLoader.AC130Icon; public override GameObject HeldModelPrefab => AssetLoader.Ac130TabletPrefab; public override int MaxUses => (int)ModConfig.AC130.Uses.Value; public override float DefaultPoolWeight => 3f; public override Key GiveKey => ModConfig.AC130.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 0f, 0 => 0f, 2 => 1f, 3 => 2f, 5 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { AC130NetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(AC130StartMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[AC130] No AC130NetworkBridge on player."); } } } public class AC130MaydayBehaviour : MonoBehaviour { private float _diveAngle; private float _rollAngle; private float _driftVelX; private float _driftVelZ; private bool _impacted; private Camera _cockpitCam; private Camera _previousCam; private Vector2 _lookOffset; private Vector2 _shakeOffset; private GameObject _smokeTrail; private GameObject _fireTrail; public bool IsLocalPlayer { get; set; } public Vector3 OrbitCenter { get; set; } public Action OnImpact { get; set; } public float ExternalDiveInfluence { get; set; } public float ExternalRollInfluence { get; set; } public Camera CockpitCamera => _cockpitCam; private void Start() { //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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) _diveAngle = ModConfig.AC130.MaydayInitialDiveAngle.Value; _rollAngle = 0f; float value = ModConfig.AC130.MaydayDrift.Value; _driftVelX = Random.Range(0f - value, value); _driftVelZ = Random.Range(0f - value, value); if ((Object)(object)AssetLoader.MaydaySmokeTrailPrefab != (Object)null) { _smokeTrail = Object.Instantiate(AssetLoader.MaydaySmokeTrailPrefab, ((Component)this).transform.position, Quaternion.identity); _smokeTrail.transform.SetParent(((Component)this).transform, true); } else { IssaPluginPlugin.Log.LogWarning((object)"[Mayday] Smoke trail prefab not loaded."); } if ((Object)(object)AssetLoader.MaydayFireTrailPrefab != (Object)null) { _fireTrail = Object.Instantiate(AssetLoader.MaydayFireTrailPrefab, ((Component)this).transform.position, Quaternion.identity); _fireTrail.transform.SetParent(((Component)this).transform, true); } else { IssaPluginPlugin.Log.LogWarning((object)"[Mayday] Fire trail prefab not loaded."); } } public void BeginAsLocalPlayer() { SetupCockpitCamera(); PlayMaydayAlarm(); } private void OnDestroy() { if (IsLocalPlayer && (Object)(object)_cockpitCam != (Object)null) { DeactivateCockpitCamera(); } if ((Object)(object)_smokeTrail != (Object)null) { Object.Destroy((Object)(object)_smokeTrail); } if ((Object)(object)_fireTrail != (Object)null) { Object.Destroy((Object)(object)_fireTrail); } } private void FixedUpdate() { if (!_impacted && NetworkServer.active) { UpdateDive(); CheckImpact(); } } private void Update() { if (IsLocalPlayer) { if (!NetworkServer.active) { float value = ModConfig.AC130.MaydayDiveSteepRate.Value; float value2 = ModConfig.AC130.MaydayMaxDiveAngle.Value; _diveAngle = Mathf.MoveTowards(_diveAngle, value2, value * Time.deltaTime); } UpdateCockpitLook(); UpdateCameraShake(); ApplyCameraTransform(); } } private void UpdateDive() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_01dc: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: 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_02fd: Unknown result type (might be due to invalid IL or missing references) float value = ModConfig.AC130.MaydayDiveSteepRate.Value; float value2 = ModConfig.AC130.MaydayMaxDiveAngle.Value; _diveAngle = Mathf.MoveTowards(_diveAngle, value2, value * Time.deltaTime); if (ExternalDiveInfluence != 0f) { float value3 = ModConfig.AC130.MaydayPullInfluence.Value; _diveAngle += ExternalDiveInfluence * value3 * Time.deltaTime; _diveAngle = Mathf.Clamp(_diveAngle, 5f, value2); } if (ExternalRollInfluence != 0f) { float value4 = ModConfig.AC130.MaydayRollSpeed.Value; _rollAngle += ExternalRollInfluence * value4 * Time.deltaTime; } Vector3 val = OrbitCenter - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = ((Component)this).transform.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = new Vector3(((Component)this).transform.forward.x, 0f, ((Component)this).transform.forward.z); Vector3 val3 = ((Vector3)(ref val2)).normalized; float num = Vector3.SignedAngle(val3, val, Vector3.up); float num2 = ModConfig.AC130.MaydayCenterBias.Value * Time.deltaTime; float num3 = Mathf.Clamp(num, 0f - num2, num2); val3 = Quaternion.AngleAxis(num3, Vector3.up) * val3; ((Vector3)(ref val3)).Normalize(); float num4 = _rollAngle * (MathF.PI / 180f); float num5 = Mathf.Sin(num4) * ModConfig.AC130.MaydayRollTurnRate.Value * Time.deltaTime; val3 = Quaternion.AngleAxis(num5, Vector3.up) * val3; ((Vector3)(ref val3)).Normalize(); val3.x += _driftVelX * Time.deltaTime * 0.1f; val3.z += _driftVelZ * Time.deltaTime * 0.1f; ((Vector3)(ref val3)).Normalize(); float num6 = _diveAngle * (MathF.PI / 180f); val2 = new Vector3(val3.x * Mathf.Cos(num6), 0f - Mathf.Sin(num6), val3.z * Mathf.Cos(num6)); Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = Vector3.Cross(Vector3.up, normalized); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; Vector3 val4 = Quaternion.AngleAxis(_rollAngle, normalized) * Vector3.up; float value5 = ModConfig.AC130.MaydaySpeed.Value; Transform transform = ((Component)this).transform; transform.position += normalized * value5 * Time.deltaTime; if (((Vector3)(ref normalized)).sqrMagnitude > 0.01f) { ((Component)this).transform.rotation = Quaternion.LookRotation(normalized, val4); } } private void CheckImpact() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) float value = ModConfig.AC130.MaydaySpeed.Value; float num = value * Time.deltaTime * 2f; bool flag = ((Component)this).transform.position.y <= 0f; if (!flag) { flag = Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, num, ItemHelper.GroundLayerMask); } if (flag) { Impact(); } } private void Impact() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!_impacted) { _impacted = true; IssaPluginPlugin.Log.LogInfo((object)$"[Mayday] Impact at {((Component)this).transform.position}."); OnImpact?.Invoke(); } } private void SetupCockpitCamera() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0034: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AC130_CockpitCam"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = new Vector3(0f, 1.5f, 2f); _cockpitCam = val.AddComponent(); _cockpitCam.fieldOfView = 75f; _cockpitCam.nearClipPlane = 0.3f; _cockpitCam.farClipPlane = 8000f; _previousCam = Camera.main; if ((Object)(object)_previousCam != (Object)null) { ((Behaviour)_previousCam).enabled = false; } ((Behaviour)_cockpitCam).enabled = true; _lookOffset = Vector2.zero; _shakeOffset = Vector2.zero; IssaPluginPlugin.Log.LogInfo((object)"[Mayday] Cockpit camera activated."); } private void DeactivateCockpitCamera() { if ((Object)(object)_cockpitCam != (Object)null) { ((Behaviour)_cockpitCam).enabled = false; } if ((Object)(object)_previousCam != (Object)null) { ((Behaviour)_previousCam).enabled = true; } IssaPluginPlugin.Log.LogInfo((object)"[Mayday] Cockpit camera deactivated."); } private void UpdateCockpitLook() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_cockpitCam == (Object)null)) { Mouse current = Mouse.current; if (current != null) { float value = ModConfig.AC130.MouseSensitivity.Value; Vector2 val = ((InputControl)(object)((Pointer)current).delta).ReadValue(); _lookOffset.y += val.x * value; _lookOffset.x -= val.y * value; float value2 = ModConfig.AC130.MaydayCamYawLimit.Value; float value3 = ModConfig.AC130.MaydayCamPitchLimit.Value; _lookOffset.x = Mathf.Clamp(_lookOffset.x, 0f - value3, value3); _lookOffset.y = Mathf.Clamp(_lookOffset.y, 0f - value2, value2); } } } private void UpdateCameraShake() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_cockpitCam == (Object)null)) { float value = ModConfig.AC130.MaydayMaxDiveAngle.Value; float num = Mathf.Clamp01(_diveAngle / value); float value2 = ModConfig.AC130.MaydayShakeBase.Value; float value3 = ModConfig.AC130.MaydayShakeMax.Value; float num2 = Mathf.Lerp(value2, value3, num); _shakeOffset = new Vector2(Mathf.Lerp(_shakeOffset.x, Random.Range(0f - num2, num2), 20f * Time.deltaTime), Mathf.Lerp(_shakeOffset.y, Random.Range(0f - num2, num2), 20f * Time.deltaTime)); } } private void ApplyCameraTransform() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) //IL_0040: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_cockpitCam == (Object)null) && IsLocalPlayer) { Quaternion rotation = ((Component)this).transform.rotation; Vector2 val = _lookOffset + _shakeOffset; Quaternion val2 = Quaternion.AngleAxis(val.y, ((Component)this).transform.up); Quaternion val3 = Quaternion.AngleAxis(val.x, ((Component)this).transform.right); ((Component)_cockpitCam).transform.rotation = val2 * val3 * rotation; } } private void PlayMaydayAlarm() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown AudioClip maydayAlarmClip = AssetLoader.MaydayAlarmClip; if ((Object)(object)maydayAlarmClip == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[Mayday] Alarm clip not loaded."); return; } GameObject val = new GameObject("Mayday_Alarm"); AudioSource val2 = val.AddComponent(); val2.clip = maydayAlarmClip; val2.loop = true; val2.spatialBlend = 0f; val2.volume = 1f; val2.Play(); val.transform.SetParent(((Component)this).transform, false); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130SoundMessage : NetworkMessage { } public static class AC130SoundMessageSerialization { public static void WriteAC130SoundMessage(NetworkWriter writer, AC130SoundMessage msg) { } public static AC130SoundMessage ReadAC130SoundMessage(NetworkReader reader) { return default(AC130SoundMessage); } } public struct AC130MaydayVfxMessage : NetworkMessage { public uint GunshipNetId; public override string ToString() { return $"AC130MaydayVfxMessage[GunshipNetId={GunshipNetId}]"; } } public struct AC130MaydayImpactMessage : NetworkMessage { public Vector3 ImpactPos; public override string ToString() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return $"AC130MaydayImpactMessage[ImpactPos={ImpactPos}]"; } } public static class AC130MaydayVfxMessageSerialization { public static void WriteAC130MaydayVfxMessage(NetworkWriter writer, AC130MaydayVfxMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.GunshipNetId); } public static AC130MaydayVfxMessage ReadAC130MaydayVfxMessage(NetworkReader reader) { return new AC130MaydayVfxMessage { GunshipNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public static class AC130MaydayImpactMessageSerialization { public static void WriteAC130MaydayImpactMessage(NetworkWriter writer, AC130MaydayImpactMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.ImpactPos); } public static AC130MaydayImpactMessage ReadAC130MaydayImpactMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new AC130MaydayImpactMessage { ImpactPos = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct AC130DamagedMessage : NetworkMessage { public uint GunshipNetId; } public static class AC130DamagedMessageSerialization { public static void WriteAC130DamagedMessage(NetworkWriter writer, AC130DamagedMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.GunshipNetId); } public static AC130DamagedMessage ReadAC130DamagedMessage(NetworkReader reader) { return new AC130DamagedMessage { GunshipNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130StartMessage : NetworkMessage { } public static class AC130StartMessageSerialization { public static void WriteAC130StartMessage(NetworkWriter writer, AC130StartMessage msg) { } public static AC130StartMessage ReadAC130StartMessage(NetworkReader reader) { return default(AC130StartMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130EndMessage : NetworkMessage { } public static class AC130EndMessageSerialization { public static void WriteAC130EndMessage(NetworkWriter writer, AC130EndMessage msg) { } public static AC130EndMessage ReadAC130EndMessage(NetworkReader reader) { return default(AC130EndMessage); } } public struct AC130FireMessage : NetworkMessage { public Vector3 AimDirection; public bool IsHeavy; } public static class AC130FireMessageSerialization { public static void WriteAC130FireMessage(NetworkWriter writer, AC130FireMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.AimDirection); NetworkWriterExtensions.WriteBool(writer, msg.IsHeavy); } public static AC130FireMessage ReadAC130FireMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new AC130FireMessage { AimDirection = NetworkReaderExtensions.ReadVector3(reader), IsHeavy = NetworkReaderExtensions.ReadBool(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130TriggerMaydayMessage : NetworkMessage { } public static class AC130TriggerMaydayMessageSerialization { public static void WriteAC130TriggerMaydayMessage(NetworkWriter writer, AC130TriggerMaydayMessage msg) { } public static AC130TriggerMaydayMessage ReadAC130TriggerMaydayMessage(NetworkReader reader) { return default(AC130TriggerMaydayMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130PrepareHomingMessage : NetworkMessage { } public static class AC130PrepareHomingMessageSerialization { public static void WriteAC130PrepareHomingMessage(NetworkWriter writer, AC130PrepareHomingMessage msg) { } public static AC130PrepareHomingMessage ReadAC130PrepareHomingMessage(NetworkReader reader) { return default(AC130PrepareHomingMessage); } } public struct AC130MaydayInputMessage : NetworkMessage { public float DiveInfluence; public float RollInfluence; } public static class AC130MaydayInputMessageSerialization { public static void WriteAC130MaydayInputMessage(NetworkWriter writer, AC130MaydayInputMessage msg) { NetworkWriterExtensions.WriteFloat(writer, msg.DiveInfluence); NetworkWriterExtensions.WriteFloat(writer, msg.RollInfluence); } public static AC130MaydayInputMessage ReadAC130MaydayInputMessage(NetworkReader reader) { return new AC130MaydayInputMessage { DiveInfluence = NetworkReaderExtensions.ReadFloat(reader), RollInfluence = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct AC130FlightInputMessage : NetworkMessage { public float AltitudeOffset; public bool Boosting; } public static class AC130FlightInputMessageSerialization { public static void WriteAC130FlightInputMessage(NetworkWriter writer, AC130FlightInputMessage msg) { NetworkWriterExtensions.WriteFloat(writer, msg.AltitudeOffset); NetworkWriterExtensions.WriteBool(writer, msg.Boosting); } public static AC130FlightInputMessage ReadAC130FlightInputMessage(NetworkReader reader) { return new AC130FlightInputMessage { AltitudeOffset = NetworkReaderExtensions.ReadFloat(reader), Boosting = NetworkReaderExtensions.ReadBool(reader) }; } } public struct AC130BeginClientMessage : NetworkMessage { public uint GunshipNetId; public Vector3 OrbitCenter; } public static class AC130BeginClientMessageSerialization { public static void WriteAC130BeginClientMessage(NetworkWriter writer, AC130BeginClientMessage msg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.GunshipNetId); NetworkWriterExtensions.WriteVector3(writer, msg.OrbitCenter); } public static AC130BeginClientMessage ReadAC130BeginClientMessage(NetworkReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) return new AC130BeginClientMessage { GunshipNetId = NetworkReaderExtensions.ReadUInt(reader), OrbitCenter = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130EndClientMessage : NetworkMessage { } public static class AC130EndClientMessageSerialization { public static void WriteAC130EndClientMessage(NetworkWriter writer, AC130EndClientMessage msg) { } public static AC130EndClientMessage ReadAC130EndClientMessage(NetworkReader reader) { return default(AC130EndClientMessage); } } public struct AC130BeginMaydayClientMessage : NetworkMessage { public uint GunshipNetId; } public static class AC130BeginMaydayClientMessageSerialization { public static void WriteAC130BeginMaydayClientMessage(NetworkWriter writer, AC130BeginMaydayClientMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.GunshipNetId); } public static AC130BeginMaydayClientMessage ReadAC130BeginMaydayClientMessage(NetworkReader reader) { return new AC130BeginMaydayClientMessage { GunshipNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130EndMaydayClientMessage : NetworkMessage { } public static class AC130EndMaydayClientMessageSerialization { public static void WriteAC130EndMaydayClientMessage(NetworkWriter writer, AC130EndMaydayClientMessage msg) { } public static AC130EndMaydayClientMessage ReadAC130EndMaydayClientMessage(NetworkReader reader) { return default(AC130EndMaydayClientMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct AC130BusyMessage : NetworkMessage { } public static class AC130BusyMessageSerialization { public static void WriteAC130BusyMessage(NetworkWriter writer, AC130BusyMessage msg) { } public static AC130BusyMessage ReadAC130BusyMessage(NetworkReader reader) { return default(AC130BusyMessage); } } public class AC130NetworkBridge : NetworkBridgeBase { private Coroutine _serverTimeout; private bool _serverSessionActive; private GameObject _serverGunship; private AC130FlyBehaviour _serverFlyBehaviour; private AC130MaydayBehaviour _serverMaydayBehaviour; private float _serverLastFireTime; private float _serverLastHeavyFireTime; public bool PendingGunshipHoming; private bool _forceEnd; private bool _maydayTriggered; private float _maydayInputSendTimer; private float _lastMaydayDive; private float _lastMaydayRoll; private float _flightInputSendTimer; private float _lastAltitudeOffset = float.MinValue; private bool _lastBoosting; private const float InputSendInterval = 0.05f; public static GameObject ActiveGunship => GlobalSessionLock.Holder?._serverGunship; public bool LocalSessionActive { get; private set; } public bool LocalMaydayActive { get; private set; } public Camera LocalGunshipCamera { get; private set; } public override void OnStopServer() { if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Player disconnected during session — forcing cleanup."); ForceServerCleanup(); } } private void Update() { if (!LocalMaydayActive || !((NetworkBehaviour)this).isOwned) { return; } Keyboard current = Keyboard.current; float num = 0f; float num2 = 0f; if (current != null) { if (((ButtonControl)current[(Key)37]).isPressed || ((ButtonControl)current[(Key)63]).isPressed) { num = -1f; } if (((ButtonControl)current[(Key)33]).isPressed || ((ButtonControl)current[(Key)64]).isPressed) { num = 1f; } if (((ButtonControl)current[(Key)15]).isPressed || ((ButtonControl)current[(Key)61]).isPressed) { num2 = 1f; } if (((ButtonControl)current[(Key)18]).isPressed || ((ButtonControl)current[(Key)62]).isPressed) { num2 = -1f; } } bool flag = num != _lastMaydayDive || num2 != _lastMaydayRoll; _maydayInputSendTimer -= Time.deltaTime; if (flag || _maydayInputSendTimer <= 0f) { NetworkClient.Send(new AC130MaydayInputMessage { DiveInfluence = num, RollInfluence = num2 }, 0); _lastMaydayDive = num; _lastMaydayRoll = num2; _maydayInputSendTimer = 0.05f; } } public void ServerStartAC130() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008a: 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_00c8: 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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) if (_serverSessionActive) { IssaPluginPlugin.Log.LogWarning((object)"[AC130] Session already active for this player."); return; } if (GlobalSessionLock.IsActive) { IssaPluginPlugin.Log.LogWarning((object)"[AC130] Another player's AC130 is already active."); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(AC130BusyMessage), 0); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.AC130ItemType) { IssaPluginPlugin.Log.LogWarning((object)"[AC130] Player does not have AC130 equipped."); return; } ItemHelper.ConsumeEquippedItem(component); Vector3 position = ((Component)component.PlayerInfo).transform.position; Vector3 orbitCenter = AC130Helpers.ComputeMapCenter(position); GameObject val = SpawnGunship(orbitCenter); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[AC130] Failed to spawn gunship — aborting."); return; } _serverGunship = val; _serverSessionActive = true; GlobalSessionLock.TryAcquire(this); _serverFlyBehaviour = val.GetComponent(); if ((Object)(object)_serverFlyBehaviour != (Object)null) { _serverFlyBehaviour.OnExternallyDestroyed = delegate { if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Gunship destroyed externally — triggering mayday."); ServerBeginMayday(); } }; } AC130HitReceiver hitReceiver = val.GetComponent(); if ((Object)(object)hitReceiver != (Object)null) { NetworkIdentity gunshipIdentityForDmg = val.GetComponent(); AC130HitReceiver aC130HitReceiver = hitReceiver; aC130HitReceiver.OnHit = (Action)Delegate.Combine(aC130HitReceiver.OnHit, (Action)delegate { if (hitReceiver.HitsRequired > 0 && hitReceiver.HitCount > 0 && hitReceiver.HitCount < hitReceiver.HitsRequired) { IssaPluginPlugin.Log.LogInfo((object)$"[AC130] Damaged ({hitReceiver.HitCount}/{hitReceiver.HitsRequired}) — broadcasting smoke."); NetworkServer.SendToAll(new AC130DamagedMessage { GunshipNetId = gunshipIdentityForDmg.netId }, 0, false); } }); hitReceiver.OnHitsExceeded = delegate { ServerBeginMayday(); }; } NetworkIdentity component2 = val.GetComponent(); NetworkServer.SendToAll(default(AC130SoundMessage), 0, false); ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.AC130ItemType, "AC-130 Gunship", component2.netId, ((NetworkBehaviour)this).netId); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new AC130BeginClientMessage { GunshipNetId = component2.netId, OrbitCenter = orbitCenter }, 0); _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerTimeoutRoutine()); IssaPluginPlugin.Log.LogInfo((object)"[AC130] Server session started."); } public void ServerEndAC130() { EndServerSession(); } public void ServerFireAC130(Vector3 aimDirection, bool isHeavy) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!_serverSessionActive || (Object)(object)_serverGunship == (Object)null) { return; } float num = (isHeavy ? ModConfig.AC130.HeavyFireCooldown.Value : ModConfig.AC130.FireCooldown.Value); ref float reference = ref isHeavy ? ref _serverLastHeavyFireTime : ref _serverLastFireTime; if (!(Time.time - reference < num)) { reference = Time.time; PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { float value = ModConfig.AC130.RocketAngularJitter.Value; Quaternion val = Quaternion.Euler(Random.Range(0f - value, value), Random.Range(0f - value, value), 0f); Quaternion val2 = Quaternion.LookRotation(aimDirection, Vector3.up); Vector3 position = _serverGunship.transform.position + aimDirection * 15f; float explosionScale = (isHeavy ? ModConfig.AC130.HeavyRocketExplosionScale.Value : ModConfig.AC130.ExplosionScale.Value); AC130Item.SpawnRocketInDirection(component, position, val * val2, explosionScale); } } } public void ServerTriggerMayday() { if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Manual mayday triggered by player."); ServerBeginMayday(); } } public void ServerPrepareGunshipRocket() { PendingGunshipHoming = true; } public void ServerSetFlightInput(float altitudeOffset, bool boosting) { if (_serverSessionActive && !((Object)(object)_serverGunship == (Object)null) && !((Object)(object)_serverFlyBehaviour == (Object)null)) { _serverFlyBehaviour.altitude = ModConfig.AC130.Altitude.Value + altitudeOffset; _serverFlyBehaviour.orbitSpeed = (boosting ? (ModConfig.AC130.OrbitSpeed.Value * ModConfig.AC130.BoostMultiplier.Value) : ModConfig.AC130.OrbitSpeed.Value); } } public void ServerSetMaydayInput(float diveInfluence, float rollInfluence) { if (_serverSessionActive && !((Object)(object)_serverGunship == (Object)null) && !((Object)(object)_serverMaydayBehaviour == (Object)null)) { _serverMaydayBehaviour.ExternalDiveInfluence = diveInfluence; _serverMaydayBehaviour.ExternalRollInfluence = rollInfluence; } } public void ClientBeginAC130(uint gunshipNetId, Vector3 orbitCenter) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(RunLocalSession(((Component)this).GetComponent(), gunshipNetId, orbitCenter)); } public void ClientEndAC130() { _forceEnd = true; ApplyCoffeeMovementSpeed(); } public void ClientBeginMayday(uint gunshipNetId) { if (!NetworkClient.spawned.TryGetValue(gunshipNetId, out var value) || (Object)(object)value == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Mayday] gunshipIdentity not found in spawned."); return; } _maydayTriggered = true; GameObject gameObject = ((Component)value).gameObject; AC130MaydayBehaviour aC130MaydayBehaviour = gameObject.GetComponent() ?? gameObject.AddComponent(); aC130MaydayBehaviour.IsLocalPlayer = true; aC130MaydayBehaviour.BeginAsLocalPlayer(); LocalGunshipCamera = aC130MaydayBehaviour.CockpitCamera; LocalMaydayActive = true; AC130Overlay.SetMaydayActive(active: true); IssaPluginPlugin.Log.LogInfo((object)"[Mayday] Cockpit cinematic started on owning client."); } public void ClientEndMayday() { //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) LocalMaydayActive = false; LocalGunshipCamera = null; LocalSessionActive = false; AC130Overlay.SetMaydayActive(active: false); GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); IssaPluginPlugin.Log.LogInfo((object)"[Mayday] Client mayday ended."); } public void ClientAC130Busy() { IssaPluginPlugin.Log.LogInfo((object)"[AC130] AC130 is already in use by another player."); } private IEnumerator RunLocalSession(PlayerInventory inventory, uint gunshipNetId, Vector3 orbitCenter) { //IL_001c: 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) LocalSessionActive = true; _forceEnd = false; _maydayTriggered = false; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Disable(); yield return null; GameObject gunshipGo = null; yield return ((MonoBehaviour)this).StartCoroutine(WaitForGunshipSync(gunshipNetId, delegate(GameObject go) { gunshipGo = go; })); AC130Session session = new AC130Session(inventory, gunshipGo, orbitCenter); yield return ((MonoBehaviour)this).StartCoroutine(PhaseFlyIn(session)); if (_forceEnd && !_maydayTriggered) { EndSessionEarly(session); yield break; } if (_maydayTriggered) { yield return ((MonoBehaviour)this).StartCoroutine(HandleSessionMayday(session)); yield break; } yield return ((MonoBehaviour)this).StartCoroutine(PhaseOnStation(session)); if (_maydayTriggered) { yield return ((MonoBehaviour)this).StartCoroutine(HandleSessionMayday(session)); } else { EndSessionNormal(session); } } private IEnumerator WaitForGunshipSync(uint gunshipNetId, Action onReady) { float waited = 0f; NetworkIdentity identity = null; while (!NetworkClient.spawned.TryGetValue(gunshipNetId, out identity) && waited < 2f) { waited += Time.deltaTime; yield return null; } if ((Object)(object)identity == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[AC130] Gunship still null after waiting — camera will not activate."); } NetworkIdentity obj = identity; onReady((obj != null) ? ((Component)obj).gameObject : null); } private IEnumerator PhaseFlyIn(AC130Session session) { if ((Object)(object)session.FlyComp == (Object)null && (Object)(object)session.GunshipVisual == (Object)null) { yield break; } if ((Object)(object)session.OrbitModule != (Object)null) { session.OrbitModule.SetSubject(session.PivotGo.transform); session.OrbitModule.SetPitch(ModConfig.AC130.CameraPitch.Value); session.OrbitModule.SetDistanceAddition(ModConfig.AC130.CameraDistance.Value); session.OrbitModule.disablePhysics = true; } IssaPluginPlugin.Log.LogInfo((object)"[AC130] Fly-in phase started."); bool hasFlyComp = (Object)(object)session.FlyComp != (Object)null; float estimatedFlyInTime = ModConfig.AC130.ApproachDistance.Value / ModConfig.AC130.ApproachSpeed.Value; float flyInElapsed = 0f; while (!_forceEnd && !_maydayTriggered && !(hasFlyComp ? session.FlyComp.HasArrived : (flyInElapsed >= estimatedFlyInTime))) { if (Keyboard.current != null && ((ButtonControl)Keyboard.current[(Key)1]).wasPressedThisFrame) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Fly-in cancelled by player."); _forceEnd = true; yield break; } CheckMaydayHotkey(); if ((Object)(object)session.GunshipVisual != (Object)null) { session.PivotGo.transform.position = session.GunshipVisual.transform.position; } OrbitCameraModule orbitModule = session.OrbitModule; if (orbitModule != null) { orbitModule.ForceUpdateModule(); } flyInElapsed += Time.deltaTime; yield return null; } IssaPluginPlugin.Log.LogInfo((object)"[AC130] Fly-in complete."); } private IEnumerator PhaseOnStation(AC130Session session) { session.BeginGunshipView(); LocalGunshipCamera = session.GunshipCam?.Camera; while (session.Elapsed < session.Duration && !_forceEnd && !_maydayTriggered) { TickOnStationTimers(session); Keyboard keyboard = Keyboard.current; Mouse mouse = Mouse.current; if (keyboard != null && ((ButtonControl)keyboard[(Key)1]).wasPressedThisFrame) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Player exited early."); break; } HandleModeSwitch(session, keyboard); CheckMaydayHotkey(); AC130Item.HandleFlight(keyboard, session); SendFlightInputIfNeeded(session, keyboard); session.GunshipCam?.UpdateLook(); AC130Item.HandleZoom(mouse, session); Vector3 gunshipPos = ComputeGunshipPos(session); var (crosshairWorld, aimDirection) = ComputeAim(session, gunshipPos); UpdateOverlay(session, crosshairWorld); HandleFire(session, mouse, aimDirection, crosshairWorld); yield return null; } } private void TickOnStationTimers(AC130Session session) { session.Elapsed += Time.deltaTime; session.Cooldown -= Time.deltaTime; if (session.HeavyCooldown > 0f) { session.HeavyCooldown -= Time.deltaTime; } if (session.HeavyReloading) { session.HeavyReloadTimer -= Time.deltaTime; if (session.HeavyReloadTimer <= 0f) { session.HeavyShotsLeft = session.HeavyMaxShots; session.HeavyReloading = false; IssaPluginPlugin.Log.LogInfo((object)"[AC130] Heavy rocket reloaded."); } } } private static void HandleModeSwitch(AC130Session session, Keyboard keyboard) { if (keyboard != null) { if (((ButtonControl)keyboard[(Key)41]).wasPressedThisFrame) { session.HeavyMode = false; IssaPluginPlugin.Log.LogInfo((object)"[AC130] Switched to regular rockets."); } if (((ButtonControl)keyboard[(Key)42]).wasPressedThisFrame) { session.HeavyMode = true; IssaPluginPlugin.Log.LogInfo((object)"[AC130] Switched to big shot."); } } } private void SendFlightInputIfNeeded(AC130Session session, Keyboard keyboard) { if (!((Object)(object)session.FlyComp != (Object)null)) { bool flag = keyboard != null && ((ButtonControl)keyboard[(Key)51]).isPressed; bool flag2 = Mathf.Abs(session.AltitudeOffset - _lastAltitudeOffset) > 0.05f || flag != _lastBoosting; _flightInputSendTimer -= Time.deltaTime; if (flag2 || !(_flightInputSendTimer > 0f)) { NetworkClient.Send(new AC130FlightInputMessage { AltitudeOffset = session.AltitudeOffset, Boosting = flag }, 0); _lastAltitudeOffset = session.AltitudeOffset; _lastBoosting = flag; _flightInputSendTimer = 0.05f; } } } private static Vector3 ComputeGunshipPos(AC130Session session) { //IL_002b: 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) //IL_0049: 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) float angleDeg = (((Object)(object)session.FlyComp != (Object)null) ? session.FlyComp.currentAngle : (session.Elapsed * session.BaseOrbitSpeed)); return AC130Helpers.OrbitPosition(session.OrbitCenter, angleDeg, session.OrbitRadius, session.Altitude + session.AltitudeOffset); } private static (Vector3 crosshairWorld, Vector3 aimDirection) ComputeAim(AC130Session session, Vector3 gunshipPos) { //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) //IL_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0022: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) //IL_006d: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Camera val = session.GunshipCam?.Camera; if ((Object)(object)val == (Object)null) { return (crosshairWorld: gunshipPos, aimDirection: Vector3.down); } Vector3 position = ((Component)val).transform.position; Vector3 forward = ((Component)val).transform.forward; RaycastHit val3 = default(RaycastHit); Vector3 val2 = (Physics.Raycast(position, forward, ref val3, 5000f, ItemHelper.GroundLayerMask) ? ((RaycastHit)(ref val3)).point : AC130Item.ProjectAimToGround(position, forward)); Vector3 val4 = (((Object)(object)session.GunshipVisual != (Object)null) ? session.GunshipVisual.transform.position : gunshipPos); Vector3 val5 = val2 - val4; return (crosshairWorld: val2, aimDirection: ((Vector3)(ref val5)).normalized); } private static void UpdateOverlay(AC130Session session, Vector3 crosshairWorld) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AC130Overlay.UpdateAimInfo(crosshairWorld, session.Elapsed, session.Duration); float reloadProgress = (session.HeavyReloading ? (1f - session.HeavyReloadTimer / session.HeavyReloadTime) : 1f); AC130Overlay.UpdateHeavyRocketInfo(session.HeavyMode, session.HeavyShotsLeft, session.HeavyMaxShots, session.HeavyReloading, reloadProgress); } private void HandleFire(AC130Session session, Mouse mouse, Vector3 aimDirection, Vector3 crosshairWorld) { //IL_0034: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (mouse != null && mouse.leftButton.wasPressedThisFrame) { if (session.HeavyMode) { TryFireHeavy(session, aimDirection, crosshairWorld); } else { TryFireRegular(session, aimDirection, crosshairWorld); } } } private void TryFireHeavy(AC130Session session, Vector3 aimDirection, Vector3 crosshairWorld) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!(session.HeavyCooldown > 0f) && !session.HeavyReloading && session.HeavyShotsLeft > 0) { NetworkClient.Send(new AC130FireMessage { AimDirection = aimDirection, IsHeavy = true }, 0); session.HeavyCooldown = session.HeavyFireCooldown; session.HeavyShotsLeft--; if (session.HeavyShotsLeft <= 0) { session.HeavyReloading = true; session.HeavyReloadTimer = session.HeavyReloadTime; IssaPluginPlugin.Log.LogInfo((object)"[AC130] Heavy rocket out of ammo — reloading."); } session.GunshipCam?.TriggerFireShake(); IssaPluginPlugin.Log.LogInfo((object)$"[AC130] Big shot fired toward {crosshairWorld}. Shots left: {session.HeavyShotsLeft}"); } } private void TryFireRegular(AC130Session session, Vector3 aimDirection, Vector3 crosshairWorld) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!(session.Cooldown > 0f)) { NetworkClient.Send(new AC130FireMessage { AimDirection = aimDirection, IsHeavy = false }, 0); session.Cooldown = session.FireCooldown; session.GunshipCam?.TriggerFireShake(); IssaPluginPlugin.Log.LogInfo((object)$"[AC130] Rocket fired toward {crosshairWorld}."); } } private IEnumerator HandleSessionMayday(AC130Session session) { session.CleanupForMayday(); LocalGunshipCamera = null; yield return WaitForMaydayEnd(); ApplyCoffeeMovementSpeed(); } private void EndSessionEarly(AC130Session session) { session.Cleanup(); LocalGunshipCamera = null; LocalSessionActive = false; NetworkClient.Send(default(AC130EndMessage), 0); } private void EndSessionNormal(AC130Session session) { session.Cleanup(); LocalGunshipCamera = null; LocalSessionActive = false; NetworkClient.Send(default(AC130EndMessage), 0); IssaPluginPlugin.Log.LogInfo((object)"[AC130] Session ended, gunship flying out."); ApplyCoffeeMovementSpeed(); } private void CheckMaydayHotkey() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.AC130.MaydayEnabled.Value) { Keyboard current = Keyboard.current; if (current != null && ((ButtonControl)current[ModConfig.AC130.MaydayKey.Value]).wasPressedThisFrame) { IssaPluginPlugin.Log.LogInfo((object)"[AC130] Manual mayday hotkey pressed."); NetworkClient.Send(default(AC130TriggerMaydayMessage), 0); } } } private IEnumerator WaitForMaydayEnd() { while (LocalMaydayActive) { yield return null; } } internal static void ApplyCoffeeMovementSpeed() { if (ModConfig.AC130.ApplyCoffeeBoostAfterwards.Value) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { ((MonoBehaviour)localPlayerMovement).StartCoroutine(CoApplyCoffeeMovementSpeed(localPlayerMovement)); } } } internal static IEnumerator CoApplyCoffeeMovementSpeed(PlayerMovement playerMovement) { yield return (object)new WaitForSeconds(1f); playerMovement.InformDrankCoffee(); playerMovement.InformDrankCoffee(); playerMovement.InformDrankCoffee(); } private void ServerBeginMayday() { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)($"[AC130] ServerBeginMayday: session={_serverSessionActive}, " + $"gunship={(Object)(object)_serverGunship != (Object)null}, " + $"isServer={NetworkServer.active}, " + $"isOwned={((NetworkBehaviour)this).isOwned}")); if ((Object)(object)_serverGunship == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)("[AC130] ServerBeginMayday guard hit — aborting. " + $"session={_serverSessionActive}, gunship={(Object)(object)_serverGunship != (Object)null}")); return; } if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } Vector3 orbitCenter = (((Object)(object)_serverFlyBehaviour != (Object)null) ? _serverFlyBehaviour.orbitCenter : _serverGunship.transform.position); if ((Object)(object)_serverFlyBehaviour != (Object)null) { _serverFlyBehaviour.OnExternallyDestroyed = null; Object.Destroy((Object)(object)_serverFlyBehaviour); _serverFlyBehaviour = null; } NetworkIdentity component = _serverGunship.GetComponent(); _serverMaydayBehaviour = _serverGunship.AddComponent(); _serverMaydayBehaviour.IsLocalPlayer = false; _serverMaydayBehaviour.OrbitCenter = orbitCenter; _serverMaydayBehaviour.OnImpact = delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ServerHandleMaydayImpact(_serverGunship.transform.position); }; if (_serverSessionActive) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new AC130BeginMaydayClientMessage { GunshipNetId = component.netId }, 0); } NetworkServer.SendToAll(new AC130MaydayVfxMessage { GunshipNetId = component.netId }, 0, false); IssaPluginPlugin.Log.LogInfo((object)"[AC130] Server mayday sequence started."); } private void ServerHandleMaydayImpact(Vector3 impactPos) { //IL_000b: 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_0027: 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) IssaPluginPlugin.Log.LogInfo((object)$"[Mayday] Impact at {impactPos}."); NetworkServer.SendToAll(new AC130MaydayImpactMessage { ImpactPos = impactPos }, 0, false); ServerSpawnImpactRocket(impactPos); if ((Object)(object)_serverGunship != (Object)null) { Object.Destroy((Object)(object)_serverGunship); _serverGunship = null; } _serverMaydayBehaviour = null; _serverSessionActive = false; ReleaseGlobalLock(); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(AC130EndMaydayClientMessage), 0); } private void ServerSpawnImpactRocket(Vector3 position) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { Rocket val = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[AC130NetworkBridge] Rocket prefab failed to instantiate."); return; } ((Component)val).gameObject.AddComponent(); ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(component.PlayerInfo.PlayerId.Guid, int.MaxValue, (ItemType)7, false); val.ServerInitialize(component.PlayerInfo, (Hittable)null, val2); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ModConfig.AC130.MaydayExplosionScale.Value); AC130Item.ServerExplodeRocket(val); } } private static GameObject SpawnGunship(Vector3 orbitCenter) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0085: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AssetLoader.AC130Prefab == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[AC130] AC130 prefab not loaded — session will run without visual."); return null; } float num = 0f; float value = ModConfig.AC130.Altitude.Value; float value2 = ModConfig.AC130.OrbitRadius.Value; Vector3 val = AC130Helpers.OrbitPosition(orbitCenter, num, value2, value); Vector3 val2 = AC130Helpers.OrbitTangent(num); float value3 = ModConfig.AC130.ApproachDistance.Value; float value4 = ModConfig.AC130.ApproachSpeed.Value; Vector3 val3 = val - val2 * value3; GameObject val4 = Object.Instantiate(AssetLoader.AC130Prefab, val3, Quaternion.LookRotation(val2, Vector3.up)); AC130HitReceiver aC130HitReceiver = val4.AddComponent(); AC130FlyBehaviour aC130FlyBehaviour = val4.AddComponent(); aC130FlyBehaviour.orbitCenter = orbitCenter; aC130FlyBehaviour.orbitRadius = value2; aC130FlyBehaviour.altitude = value; aC130FlyBehaviour.orbitSpeed = ModConfig.AC130.OrbitSpeed.Value; aC130FlyBehaviour.currentAngle = num; aC130FlyBehaviour.flyTarget = val; aC130FlyBehaviour.flySpeed = value4; aC130FlyBehaviour.mode = AC130FlightMode.FlyIn; NetworkServer.Spawn(val4, (NetworkConnectionToClient)null); IssaPluginPlugin.Log.LogInfo((object)$"[AC130] Gunship spawned at approach distance {value3:F0}m."); return val4; } private IEnumerator ServerTimeoutRoutine() { yield return (object)new WaitForSeconds(ModConfig.AC130.Duration.Value + 5f); if (_serverSessionActive) { EndServerSession(); } } private void EndServerSession() { if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } _serverSessionActive = false; ReleaseGlobalLock(); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(AC130EndClientMessage), 0); if ((Object)(object)_serverFlyBehaviour != (Object)null) { _serverFlyBehaviour.OnExternallyDestroyed = null; _serverFlyBehaviour.BeginFlyOut(); } else if ((Object)(object)_serverGunship != (Object)null) { NetworkServer.Destroy(_serverGunship); _serverGunship = null; } IssaPluginPlugin.Log.LogInfo((object)"[AC130] Server session ended — gunship flying out."); } } public override void ServerHoleCleanup() { if (_serverSessionActive) { ForceServerCleanup(); } } public override void ClientHoleCleanup() { if (LocalSessionActive) { _forceEnd = true; } } private void ForceServerCleanup() { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } if ((Object)(object)_serverGunship != (Object)null) { NetworkServer.Destroy(_serverGunship); _serverGunship = null; } _serverFlyBehaviour = null; _serverMaydayBehaviour = null; _serverSessionActive = false; ReleaseGlobalLock(); } private static void ReleaseGlobalLock() { GlobalSessionLock.Release(); } public static void ForceReleaseGlobalLock() { IssaPluginPlugin.Log.LogWarning((object)"[AC130] ForceReleaseGlobalLock called — resetting session state."); GlobalSessionLock.Release(); } } public class AC130Session { public readonly float Altitude; public readonly float OrbitRadius; public readonly float Duration; public readonly float FireCooldown; public readonly float BaseOrbitSpeed; public readonly float BoostedOrbitSpeed; public readonly float AltitudeOffsetMax; public readonly float AltitudeAdjustSpeed; public float AltitudeOffset; public float Elapsed; public float Cooldown; public readonly float HeavyFireCooldown; public readonly int HeavyMaxShots; public readonly float HeavyReloadTime; public bool HeavyMode; public int HeavyShotsLeft; public bool HeavyReloading; public float HeavyReloadTimer; public float HeavyCooldown; public readonly Vector3 OrbitCenter; public readonly GameObject PivotGo; public readonly GameObject GunshipVisual; public readonly AC130FlyBehaviour FlyComp; public readonly AC130GunshipCamera GunshipCam; public readonly OrbitCameraModule OrbitModule; public readonly float SavedPitch; public readonly float SavedYaw; public readonly bool SavedDisablePhysics; private bool _orbitModuleRestored; public AC130Session(PlayerInventory inventory, GameObject gunshipGo, Vector3 orbitCenter) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0180: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) OrbitCenter = orbitCenter; Altitude = ModConfig.AC130.Altitude.Value; OrbitRadius = ModConfig.AC130.OrbitRadius.Value; Duration = ModConfig.AC130.Duration.Value; FireCooldown = ModConfig.AC130.FireCooldown.Value; BaseOrbitSpeed = ModConfig.AC130.OrbitSpeed.Value; BoostedOrbitSpeed = BaseOrbitSpeed * ModConfig.AC130.BoostMultiplier.Value; AltitudeOffsetMax = ModConfig.AC130.AltitudeOffsetMax.Value; AltitudeAdjustSpeed = ModConfig.AC130.AltitudeAdjustSpeed.Value; HeavyFireCooldown = ModConfig.AC130.HeavyFireCooldown.Value; HeavyMaxShots = Mathf.Max(1, Mathf.RoundToInt(ModConfig.AC130.HeavyShotsBeforeReload.Value)); HeavyReloadTime = ModConfig.AC130.HeavyReloadTime.Value; HeavyShotsLeft = HeavyMaxShots; CameraModuleController.TryGetOrbitModule(ref OrbitModule); OrbitCameraModule orbitModule = OrbitModule; SavedPitch = ((orbitModule != null) ? orbitModule.Pitch : 0f); OrbitCameraModule orbitModule2 = OrbitModule; SavedYaw = ((orbitModule2 != null) ? orbitModule2.Yaw : 0f); SavedDisablePhysics = OrbitModule?.disablePhysics ?? false; PivotGo = new GameObject("AC130Pivot"); PivotGo.transform.position = orbitCenter; if ((Object)(object)gunshipGo != (Object)null) { GunshipVisual = gunshipGo; FlyComp = gunshipGo.GetComponent(); GunshipCam = gunshipGo.GetComponent() ?? gunshipGo.AddComponent(); GunshipCam.orbitCenter = orbitCenter; GunshipCam.baseFov = ModConfig.AC130.BaseFov.Value; GunshipCam.yawLimit = ModConfig.AC130.YawLimit.Value; GunshipCam.pitchLimit = ModConfig.AC130.PitchLimit.Value; GunshipCam.mouseSensitivity = ModConfig.AC130.MouseSensitivity.Value; } else { IssaPluginPlugin.Log.LogWarning((object)"[AC130] Session started with null gunship."); } } public void BeginGunshipView() { if ((Object)(object)OrbitModule != (Object)null) { OrbitModule.SetFovOffset(0f); OrbitModule.SetDistanceAddition(0f); OrbitModule.disablePhysics = SavedDisablePhysics; PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { OrbitModule.SetSubject(((Component)localPlayerMovement).transform); } OrbitModule.SetPitch(SavedPitch); OrbitModule.SetYaw(SavedYaw); OrbitModule.ForceUpdateModule(); } if ((Object)(object)GunshipCam != (Object)null) { GunshipCam.Activate(); } IssaPluginPlugin.Log.LogInfo((object)($"[AC130] Gunship on station. Active for {Duration:F0}s, " + $"orbit radius {OrbitRadius:F0}m, altitude {Altitude:F0}m.")); } private void RestoreOrbitModule() { if (!_orbitModuleRestored && !((Object)(object)OrbitModule == (Object)null)) { OrbitModule.SetFovOffset(0f); OrbitModule.SetDistanceAddition(0f); OrbitModule.disablePhysics = SavedDisablePhysics; PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { OrbitModule.SetSubject(((Component)localPlayerMovement).transform); } OrbitModule.SetPitch(SavedPitch); OrbitModule.SetYaw(SavedYaw); OrbitModule.ForceUpdateModule(); _orbitModuleRestored = true; } } public void Cleanup() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) RestoreOrbitModule(); GunshipCam?.Deactivate(); if ((Object)(object)GunshipVisual != (Object)null && (Object)(object)FlyComp != (Object)null) { FlyComp.BeginFlyOut(); } else if ((Object)(object)GunshipVisual != (Object)null) { Object.Destroy((Object)(object)GunshipVisual); } Object.Destroy((Object)(object)PivotGo); GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); } public void CleanupForMayday() { RestoreOrbitModule(); GunshipCam?.Deactivate(); Object.Destroy((Object)(object)PivotGo); } } public static class AK47Item { private static bool _isFiring; private static float _lastVfxTime = float.MinValue; private const float VfxMinInterval = 0.1f; private static readonly MethodInfo TryParseFirearmRaycastResultsMethod = typeof(PlayerInventory).GetMethod("TryParseFirearmRaycastResults", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo CanHitWithGunshotMethod = typeof(PlayerInventory).GetMethod("CanHitWithGunshot", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo IncrementAndGetCurrentItemUseIdMethod = typeof(PlayerInventory).GetMethod("IncrementAndGetCurrentItemUseId", BindingFlags.Instance | BindingFlags.NonPublic); public static IEnumerator FireLoop(PlayerInventory inventory) { if (_isFiring) { yield break; } _isFiring = true; ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)1); inventory.PlayerInfo.PlayerAudio.PlayElephantGunShotForAllClients(); do { int slot = inventory.EquippedItemIndex; DoShoot(inventory); ItemHelper.DecrementAndRemove(inventory, slot); if (inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.AK47ItemType) { break; } yield return (object)new WaitForSeconds(ModConfig.AK47.FireRate.Value); } while (Mouse.current != null && Mouse.current.leftButton.isPressed); ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)0); _isFiring = false; } private static void DoShoot(PlayerInventory inventory) { //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_0019: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //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_01ef: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) Vector3 elephantGunBarrelEndPosition = inventory.GetElephantGunBarrelEndPosition(); float value = ModConfig.AK47.MaxAimingDistance.Value; float num = default(float); Vector3 firearmAimPoint = inventory.GetFirearmAimPoint(elephantGunBarrelEndPosition, inventory.GetElephantGunBarrelForward(), value, LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask), ref num); if (Mathf.Abs(num) > 45f) { inventory.PlayerInfo.Movement.AlignWithCameraImmediately(); float num2 = default(float); firearmAimPoint = inventory.GetFirearmAimPoint(elephantGunBarrelEndPosition, inventory.GetElephantGunBarrelForward(), value, LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask), ref num2); } float value2 = ModConfig.AK47.Inaccuracy.Value; Vector3 val = VectorExtensions.RandomlyRotatedDeg(firearmAimPoint - elephantGunBarrelEndPosition, value2); Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(elephantGunBarrelEndPosition, val); ScreenShakeHelper.ApplyScreenShake(ModConfig.AK47.ScreenShakeIntensity.Value); float value3 = ModConfig.AK47.MaxShotDistance.Value; int num3 = LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask); int num4 = Physics.RaycastNonAlloc(val2, PlayerGolfer.raycastHitBuffer, value3, num3, (QueryTriggerInteraction)1); object[] array = new object[5] { PlayerGolfer.raycastHitBuffer, num4, null, null, null }; if (!(bool)(TryParseFirearmRaycastResultsMethod?.Invoke(inventory, array) ?? ((object)false))) { if (Time.time - _lastVfxTime >= 0.1f) { _lastVfxTime = Time.time; VfxManager.PlayElephantGunMissForAllClients(inventory, ((Ray)(ref val2)).direction); } return; } RaycastHit val3 = (RaycastHit)array[3]; object obj = array[4]; Hittable val4 = (Hittable)((obj is Hittable) ? obj : null); bool flag = (Object)(object)val4 != (Object)null && (bool)(CanHitWithGunshotMethod?.Invoke(inventory, new object[2] { val4, null }) ?? ((object)false)); Vector3 val5 = Vector3.zero; if (flag) { val5 = ((Component)val4).transform.InverseTransformPoint(((RaycastHit)(ref val3)).point); if (val4.AsEntity.IsPlayer && val4.AsEntity.PlayerInfo.IsElectromagnetShieldActive) { if (Time.time - _lastVfxTime >= 0.1f) { _lastVfxTime = Time.time; VfxManager.PlayElephantGunHitForAllClients(inventory, new GunShotHitVfxData(val4, true, val5, ((RaycastHit)(ref val3)).point)); } return; } ItemUseId val6 = (ItemUseId)(IncrementAndGetCurrentItemUseIdMethod?.Invoke(inventory, new object[1] { ItemRegistry.AK47ItemType }) ?? ((object)default(ItemUseId))); val4.HitWithItem((ItemType)2, val6, val5, ((Ray)(ref val2)).direction, ((Component)val4).transform.InverseTransformPoint(elephantGunBarrelEndPosition), ((RaycastHit)(ref val3)).distance, inventory, false, false, false, NetworkTime.time, 0uL); } if (Time.time - _lastVfxTime >= 0.1f) { _lastVfxTime = Time.time; VfxManager.PlayElephantGunHitForAllClients(inventory, new GunShotHitVfxData(val4, false, val5, ((RaycastHit)(ref val3)).point)); } } } public class AK47ItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.AK47ItemType; public override string DisplayName => "AK47"; public override string[] ConsoleAliases => new string[6] { "ak47", "AK47", "assault_rifle", "assaultrifle", "AR", "ar" }; public override Sprite Icon => AssetLoader.AK47Icon; public override GameObject HeldModelPrefab => AssetLoader.AK47Prefab; public override bool UseRocketIconFallback => false; public override int MaxUses => (int)ModConfig.AK47.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.AK47.GiveKey.Value; public override EquipmentType EquipmentType => (EquipmentType)5; public override ItemType AnimatorItemType => (ItemType)3; public override ItemType AnimatorChangedItemType => (ItemType)3; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { ((MonoBehaviour)inventory).StartCoroutine(AK47Item.FireLoop(inventory)); } } public static class AssetLoader { private abstract class AssetDef { public abstract void Execute(AssetBundle bundle); } private sealed class SpriteDef : AssetDef { private readonly Action _set; private readonly string _name; private readonly bool _optional; public SpriteDef(Action set, string name, bool optional) { _set = set; _name = name; _optional = optional; } public override void Execute(AssetBundle bundle) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = (_optional ? AssetLoader.LoadOptionalRaw(bundle, _name) : AssetLoader.LoadRequiredRaw(bundle, _name)); if ((Object)(object)val != (Object)null) { _set(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } } } private sealed class TextureDef : AssetDef { private readonly Action _set; private readonly string _name; public TextureDef(Action set, string name) { _set = set; _name = name; } public override void Execute(AssetBundle bundle) { _set(AssetLoader.LoadRequiredRaw(bundle, _name)); } } private sealed class AudioDef : AssetDef { private readonly Action _set; private readonly string _name; public AudioDef(Action set, string name) { _set = set; _name = name; } public override void Execute(AssetBundle bundle) { _set(AssetLoader.LoadOptionalRaw(bundle, _name)); } } private sealed class PrefabDef : AssetDef { private readonly Action _set; private readonly string _name; public PrefabDef(Action set, string name) { _set = set; _name = name; } public override void Execute(AssetBundle bundle) { _set(AssetLoader.LoadRequiredRaw(bundle, _name)); } } private sealed class HandheldPrefabDef : AssetDef { private readonly Action _set; private readonly string _name; private readonly bool _optional; private readonly Func _fallback; public HandheldPrefabDef(Action set, string name, bool optional, Func fallback) { _set = set; _name = name; _optional = optional; _fallback = fallback; } public override void Execute(AssetBundle bundle) { GameObject val = (_optional ? AssetLoader.LoadOptionalRaw(bundle, _name) : AssetLoader.LoadRequiredRaw(bundle, _name)); if ((Object)(object)val == (Object)null && _fallback != null) { val = _fallback(); } if ((Object)(object)val != (Object)null) { DisableRigidbody(val); } _set(val); } } private sealed class NetworkedPrefabDef : AssetDef { private readonly Action _set; private readonly string _name; private readonly uint _assetId; private readonly Type _clientSetupType; private readonly bool _optional; private readonly Func _fallback; public NetworkedPrefabDef(Action set, string name, uint assetId, Type clientSetupType, bool optional, Func fallback) { _set = set; _name = name; _assetId = assetId; _clientSetupType = clientSetupType; _optional = optional; _fallback = fallback; } public override void Execute(AssetBundle bundle) { GameObject val = (_optional ? AssetLoader.LoadOptionalRaw(bundle, _name) : AssetLoader.LoadRequiredRaw(bundle, _name)); if ((Object)(object)val == (Object)null && _fallback != null) { val = _fallback(); } if ((Object)(object)val == (Object)null) { _set(null); return; } EnsureNetworkIdentity(val, _assetId); DisableRigidbody(val); if (_clientSetupType != null) { val.AddComponent(_clientSetupType); } _set(val); } } private sealed class LocalVfxPrefabDef : AssetDef { private readonly Action _set; private readonly string _name; public LocalVfxPrefabDef(Action set, string name) { _set = set; _name = name; } public override void Execute(AssetBundle bundle) { GameObject val = AssetLoader.LoadOptionalRaw(bundle, _name); if ((Object)(object)val != (Object)null) { StripNetworkComponents(val); Object.DontDestroyOnLoad((Object)(object)val); } else { IssaPluginPlugin.Log.LogWarning((object)("[AssetLoader] LocalVfxPrefab not found in bundle: '" + _name + "'")); } _set(val); } } private static AssetBundle _bundle; public static Sprite BatIcon { get; private set; } public static Sprite BomberIcon { get; private set; } public static Sprite MissileIcon { get; private set; } public static Sprite AC130Icon { get; private set; } public static Sprite FreezeIcon { get; private set; } public static Sprite LowGravityIcon { get; private set; } public static Sprite SniperRifleIcon { get; private set; } public static Sprite DonutIcon { get; private set; } public static Sprite JavelinIcon { get; private set; } public static Sprite StickyGrenadeIcon { get; private set; } public static Sprite BearIcon { get; private set; } public static Sprite NukeIcon { get; private set; } public static Sprite BlackHoleGrenadeIcon { get; private set; } public static Sprite WallIcon { get; private set; } public static Sprite AK47Icon { get; private set; } public static Sprite HarrierIcon { get; private set; } public static Sprite PositionSwapIcon { get; private set; } public static Sprite PoisonJarIcon { get; private set; } public static Sprite DroneSwarmIcon { get; private set; } public static Sprite HunterDroneIcon { get; private set; } public static Sprite ElectricGravityGunIcon { get; private set; } public static Sprite RedBullIcon { get; private set; } public static Sprite WindStormIcon { get; private set; } public static Sprite UfoAbductionIcon { get; private set; } public static Sprite SuperDonutIcon { get; private set; } public static Texture2D SniperScopeTexture { get; private set; } public static GameObject BatModelPrefab { get; private set; } public static GameObject FreezeModelPrefab { get; private set; } public static GameObject LowGravityModelPrefab { get; private set; } public static GameObject SniperRiflePrefab { get; private set; } public static GameObject DonutHandheldPrefab { get; private set; } public static GameObject JavelinHandheldPrefab { get; private set; } public static GameObject TeddyBearPrefab { get; private set; } public static GameObject NuclearDetonatorPrefab { get; private set; } public static GameObject WallHandheldPrefab { get; private set; } public static GameObject AK47Prefab { get; private set; } public static GameObject HarrierTabletPrefab { get; private set; } public static GameObject PositionSwapHandheldPrefab { get; private set; } public static GameObject PoisonJarHandheldPrefab { get; private set; } public static GameObject DroneControllerPrefab { get; private set; } public static GameObject ElectricWhipHandheldPrefab { get; private set; } public static GameObject RedBullHandheldPrefab { get; private set; } public static GameObject WindStormModelPrefab { get; private set; } public static GameObject SuperDonutHandheldPrefab { get; private set; } public static GameObject BomberTabletPrefab { get; private set; } public static GameObject MissileTabletPrefab { get; private set; } public static GameObject Ac130TabletPrefab { get; private set; } public static GameObject BomberPrefab { get; private set; } public static GameObject BomberProxyPrefab { get; private set; } public static GameObject AC130Prefab { get; private set; } public static GameObject DonutPrefab { get; private set; } public static GameObject StickyGrenadePrefab { get; private set; } public static GameObject BearPrefab { get; private set; } public static GameObject NukeBombPrefab { get; private set; } public static GameObject BlackHoleGrenadePrefab { get; private set; } public static GameObject WallPrefab { get; private set; } public static GameObject HarrierPrefab { get; private set; } public static GameObject PoisonJarPrefab { get; private set; } public static GameObject DronePrefab { get; private set; } public static GameObject HunterDroneHandheldPrefab { get; private set; } public static GameObject HunterDronePrefab { get; private set; } public static GameObject UfoAbductionHandheldPrefab { get; private set; } public static GameObject UfoAbductionUfoPrefab { get; private set; } public static Sprite ExplosiveGolfBallsIcon { get; private set; } public static GameObject ExplosiveGolfBallsHandheldPrefab { get; private set; } public static GameObject ShapeShifterShapeCube { get; private set; } public static GameObject ShapeShifterShapeDisk { get; private set; } public static GameObject ShapeShifterShapeCylinder { get; private set; } public static GameObject ShapeShifterShapeCone { get; private set; } public static GameObject ShapeShifterShapeAcorn { get; private set; } public static GameObject ShapeShifterShapePyramid { get; private set; } public static GameObject ShapeShifterShapeIsosphere { get; private set; } public static Sprite ShapeShifterIcon { get; private set; } public static Sprite SuperShapeShifterIcon { get; private set; } public static GameObject ShapeShifterHandheldPrefab { get; private set; } public static Sprite MoonIcon { get; private set; } public static GameObject MoonHandheldPrefab { get; private set; } public static GameObject MoonVfxPrefab { get; private set; } public static GameObject DroppedCustomItemPrefab { get; private set; } public static GameObject BlackHoleVfxPrefab { get; private set; } public static GameObject PositionSwapOrbPrefab { get; private set; } public static GameObject PositionSwapSmokePrefab { get; private set; } public static GameObject PoisonSplashPrefab { get; private set; } public static GameObject DroneExplosionVfxPrefab { get; private set; } public static GameObject RedBullTrailPrefab { get; private set; } public static GameObject GravityGunTetherVfxPrefab { get; private set; } public static GameObject WarningParticlePrefab { get; private set; } public static GameObject MaydaySmokeTrailPrefab { get; private set; } public static GameObject MaydayFireTrailPrefab { get; private set; } public static GameObject ConfettiBlastRainbow { get; private set; } public static GameObject BloodSplatterPrefab { get; private set; } public static GameObject NukeVerticalExplosionVfxPrefab { get; private set; } public static GameObject NukeExplosionVfxPrefab { get; private set; } public static GameObject JavelinExplosionVfxPrefab => NukeVerticalExplosionVfxPrefab; public static GameObject JavelinTrailVfxPrefab { get; private set; } public static GameObject MaydayExplosionVfxPrefab => NukeVerticalExplosionVfxPrefab; public static GameObject ImpactVfxPrefab { get; private set; } public static Sprite TeleporterIcon { get; private set; } public static GameObject TeleporterHandheldPrefab { get; private set; } public static GameObject TeleporterVfxPrefab { get; private set; } public static Sprite FlamethrowerIcon { get; private set; } public static GameObject FlamethrowerPrefab { get; private set; } public static GameObject FlamethrowerParticlePrefab { get; private set; } public static GameObject FlamethrowerVictimFirePrefab { get; private set; } public static Sprite JetpackIcon { get; private set; } public static GameObject JetpackHandheldPrefab { get; private set; } public static GameObject JetpackParticlePrefab { get; private set; } public static GameObject JetpackEquippedPrefab { get; private set; } public static Sprite RocketTetherIcon { get; private set; } public static GameObject RocketTetherPrefab { get; private set; } public static GameObject RocketTetherRocketPrefab { get; private set; } public static Sprite RocketTetherGrenadeIcon { get; private set; } public static GameObject RocketTetherGrenadePrefab { get; private set; } public static GameObject RocketTetherGrenadeExplosionVfx { get; private set; } public static Sprite SpinachIcon { get; private set; } public static GameObject SpinachPrefab { get; private set; } public static GameObject SpinachTrailPrefab { get; private set; } public static GameObject GoldStarPrefab { get; private set; } public static GameObject WallGhostPrefab { get; private set; } public static GameObject JavelinTargetIndicatorPrefab { get; private set; } public static AudioClip AC130AboveClip { get; private set; } public static AudioClip HomerunAudioClip { get; private set; } public static AudioClip MaydayAlarmClip { get; private set; } public static AudioClip MaydayImpactClip { get; private set; } public static AudioClip NukeExplosionClip => MaydayImpactClip; public static bool IsLoaded => (Object)(object)_bundle != (Object)null; public static void Load() { if (!TryLoadBundle()) { return; } foreach (AssetDef item in BuildAssetDefs()) { item.Execute(_bundle); } ApplyPostLoadMutations(); IssaPluginPlugin.Log.LogInfo((object)"[Assets] IssaPluginBundle loaded."); } public static void Unload() { AssetBundle bundle = _bundle; if (bundle != null) { bundle.Unload(true); } _bundle = null; } private static IEnumerable BuildAssetDefs() { return new AssetDef[120] { SpriteAsset(delegate(Sprite p) { BatIcon = p; }, "bat_icon.png"), SpriteAsset(delegate(Sprite p) { BomberIcon = p; }, "bomber_icon.png"), SpriteAsset(delegate(Sprite p) { MissileIcon = p; }, "missile_icon.png"), SpriteAsset(delegate(Sprite p) { AC130Icon = p; }, "ac130_icon.png"), SpriteAsset(delegate(Sprite p) { FreezeIcon = p; }, "freeze_effect_icon.png"), SpriteAsset(delegate(Sprite p) { LowGravityIcon = p; }, "gravity_remote_icon.png"), SpriteAsset(delegate(Sprite p) { SniperRifleIcon = p; }, "sniper_rifle_icon.png"), SpriteAsset(delegate(Sprite p) { DonutIcon = p; }, "donut_icon_v2.png"), SpriteAsset(delegate(Sprite p) { JavelinIcon = p; }, "javelin_icon.png"), SpriteAsset(delegate(Sprite p) { StickyGrenadeIcon = p; }, "spike_ball_icon.png"), SpriteAsset(delegate(Sprite p) { BearIcon = p; }, "bear_icon.png"), SpriteAsset(delegate(Sprite p) { NukeIcon = p; }, "nuke_icon.png"), SpriteAsset(delegate(Sprite p) { BlackHoleGrenadeIcon = p; }, "black_hole_grenade_icon.png"), SpriteAsset(delegate(Sprite p) { WallIcon = p; }, "wall_icon.png"), SpriteAsset(delegate(Sprite p) { AK47Icon = p; }, "ak47_icon.png"), SpriteAsset(delegate(Sprite p) { HarrierIcon = p; }, "harrier_icon.png"), SpriteAsset(delegate(Sprite p) { PositionSwapIcon = p; }, "position_swap_icon.png"), SpriteAsset(delegate(Sprite p) { PoisonJarIcon = p; }, "poison_bottle_icon.png"), SpriteAsset(delegate(Sprite p) { DroneSwarmIcon = p; }, "drone_swarm_icon.png"), SpriteAsset(delegate(Sprite p) { HunterDroneIcon = p; }, "hunter_drone_icon.png", optional: true), HandheldPrefab(delegate(GameObject p) { HunterDroneHandheldPrefab = p; }, "hunter_drone_handheld.prefab", optional: true), SpriteAsset(delegate(Sprite p) { ElectricGravityGunIcon = p; }, "gravity_gun_icon.png"), SpriteAsset(delegate(Sprite p) { RedBullIcon = p; }, "redbull_icon.png"), SpriteAsset(delegate(Sprite p) { WindStormIcon = p; }, "wind_storm_icon.png", optional: true), SpriteAsset(delegate(Sprite p) { SuperDonutIcon = p; }, "super_donut_icon.png", optional: true), Texture(delegate(Texture2D p) { SniperScopeTexture = p; }, "sniper_scope.png"), HandheldPrefab(delegate(GameObject p) { BatModelPrefab = p; }, "bat_model.prefab"), HandheldPrefab(delegate(GameObject p) { FreezeModelPrefab = p; }, "snowball.prefab"), HandheldPrefab(delegate(GameObject p) { LowGravityModelPrefab = p; }, "gravity_remote.prefab"), HandheldPrefab(delegate(GameObject p) { SniperRiflePrefab = p; }, "intervention.prefab"), HandheldPrefab(delegate(GameObject p) { DonutHandheldPrefab = p; }, "donut_model.prefab"), HandheldPrefab(delegate(GameObject p) { JavelinHandheldPrefab = p; }, "javelin_rocket_launcher.prefab"), HandheldPrefab(delegate(GameObject p) { TeddyBearPrefab = p; }, "teddy.prefab"), HandheldPrefab(delegate(GameObject p) { NuclearDetonatorPrefab = p; }, "nuclear_detonator.prefab"), HandheldPrefab(delegate(GameObject p) { WallHandheldPrefab = p; }, "brick.prefab", optional: true, BuildWallHandheldFallback), HandheldPrefab(delegate(GameObject p) { AK47Prefab = p; }, "ak47.prefab"), HandheldPrefab(delegate(GameObject p) { HarrierTabletPrefab = p; }, "harrier_tablet.prefab"), HandheldPrefab(delegate(GameObject p) { PositionSwapHandheldPrefab = p; }, "position_swap_handheld.prefab"), HandheldPrefab(delegate(GameObject p) { PoisonJarHandheldPrefab = p; }, "posion_bottle.prefab"), HandheldPrefab(delegate(GameObject p) { DroneControllerPrefab = p; }, "drone_swarm_tablet.prefab"), HandheldPrefab(delegate(GameObject p) { ElectricWhipHandheldPrefab = p; }, "gravity_gun.prefab"), HandheldPrefab(delegate(GameObject p) { RedBullHandheldPrefab = p; }, "redbull.prefab"), HandheldPrefab(delegate(GameObject p) { WindStormModelPrefab = p; }, "weather_remote.prefab", optional: true), HandheldPrefab(delegate(GameObject p) { SuperDonutHandheldPrefab = p; }, "super_donut_model.prefab", optional: true), HandheldPrefab(delegate(GameObject p) { BomberTabletPrefab = p; }, "stealth_bomber_tablet.prefab"), HandheldPrefab(delegate(GameObject p) { MissileTabletPrefab = p; }, "predator_missile_tablet.prefab"), HandheldPrefab(delegate(GameObject p) { Ac130TabletPrefab = p; }, "ac130_tablet.prefab"), Prefab(delegate(GameObject p) { BomberPrefab = p; }, "bomber_model.prefab"), Prefab(delegate(GameObject p) { JavelinTargetIndicatorPrefab = p; }, "javelin_target_indicator.prefab"), NetworkedPrefab(delegate(GameObject p) { BomberProxyPrefab = p; }, "bomber_proxy.prefab", 2963931137u, typeof(BomberProxyClientSetup)), NetworkedPrefab(delegate(GameObject p) { AC130Prefab = p; }, "ac130_model.prefab", 2886926337u, typeof(AC130ClientSetup)), NetworkedPrefab(delegate(GameObject p) { DonutPrefab = p; }, "donut_vehicle.prefab", 4026531841u, typeof(DonutClientSetup)), NetworkedPrefab(delegate(GameObject p) { StickyGrenadePrefab = p; }, "spike_ball.prefab", 1581771777u, typeof(StickyGrenadeClientSetup)), NetworkedPrefab(delegate(GameObject p) { BearPrefab = p; }, "bear.prefab", 3198156801u, typeof(BearClientSetup)), NetworkedPrefab(delegate(GameObject p) { NukeBombPrefab = p; }, "nuclear_bomb.prefab", 4048879617u), NetworkedPrefab(delegate(GameObject p) { HarrierPrefab = p; }, "harrier.prefab", 2809135105u, typeof(HarrierClientSetup), optional: true, BuildHarrierFallback), NetworkedPrefab(delegate(GameObject p) { WallPrefab = p; }, "wall.prefab", 1141964810u, null, optional: true, BuildWallFallback), NetworkedPrefab(delegate(GameObject p) { PoisonJarPrefab = p; }, "posion_bottle.prefab", 3489768705u), NetworkedPrefab(delegate(GameObject p) { DronePrefab = p; }, "drone.prefab", 3557687297u), NetworkedPrefab(delegate(GameObject p) { HunterDronePrefab = p; }, "hunter_drone.prefab", 3557687298u, null, optional: true), NetworkedPrefab(delegate(GameObject p) { BlackHoleGrenadePrefab = p; }, "black_hole_grenade.prefab", 2974547969u, null, optional: true, BuildBlackHoleGrenadeFallback), NetworkedPrefab(delegate(GameObject p) { DroppedCustomItemPrefab = p; }, "DroppedCustomItem.prefab", 3524067329u), Prefab(delegate(GameObject p) { NukeVerticalExplosionVfxPrefab = p; }, "NukeVerticalExplosionFire.prefab"), LocalVfxPrefab(delegate(GameObject p) { BlackHoleVfxPrefab = p; }, "black_hole.prefab"), LocalVfxPrefab(delegate(GameObject p) { PositionSwapOrbPrefab = p; }, "position_swap_orb.prefab"), LocalVfxPrefab(delegate(GameObject p) { PositionSwapSmokePrefab = p; }, "position_swap_smoke.prefab"), LocalVfxPrefab(delegate(GameObject p) { PoisonSplashPrefab = p; }, "poison_cloud_vfx.prefab"), LocalVfxPrefab(delegate(GameObject p) { DroneExplosionVfxPrefab = p; }, "drone_explosion.prefab"), LocalVfxPrefab(delegate(GameObject p) { RedBullTrailPrefab = p; }, "red_bull_trail.prefab"), LocalVfxPrefab(delegate(GameObject p) { GravityGunTetherVfxPrefab = p; }, "gravity_gun_vfx.prefab"), LocalVfxPrefab(delegate(GameObject p) { WarningParticlePrefab = p; }, "warning_particle.prefab"), LocalVfxPrefab(delegate(GameObject p) { MaydaySmokeTrailPrefab = p; }, "smoke_prefab.prefab"), LocalVfxPrefab(delegate(GameObject p) { MaydayFireTrailPrefab = p; }, "fire_torch_intense.prefab"), LocalVfxPrefab(delegate(GameObject p) { ConfettiBlastRainbow = p; }, "ConfettiBlastRainbow.prefab"), LocalVfxPrefab(delegate(GameObject p) { BloodSplatterPrefab = p; }, "blood_explosion_vfx.prefab"), LocalVfxPrefab(delegate(GameObject p) { JavelinTrailVfxPrefab = p; }, "javelin_trail.prefab"), Audio(delegate(AudioClip p) { AC130AboveClip = p; }, "ac130_above"), Audio(delegate(AudioClip p) { HomerunAudioClip = p; }, "homerun"), Audio(delegate(AudioClip p) { MaydayAlarmClip = p; }, "missile_locked"), Audio(delegate(AudioClip p) { MaydayImpactClip = p; }, "etfx_explosion_nuke"), LocalVfxPrefab(delegate(GameObject p) { ImpactVfxPrefab = p; }, "NukeVerticalExplosionFire.prefab"), SpriteAsset(delegate(Sprite p) { TeleporterIcon = p; }, "teleporter_icon.png"), HandheldPrefab(delegate(GameObject p) { TeleporterHandheldPrefab = p; }, "teleporter_handheld.prefab"), LocalVfxPrefab(delegate(GameObject p) { TeleporterVfxPrefab = p; }, "position_swap_smoke.prefab"), SpriteAsset(delegate(Sprite p) { FlamethrowerIcon = p; }, "flamethrower_icon.png"), HandheldPrefab(delegate(GameObject p) { FlamethrowerPrefab = p; }, "flamethrower.prefab"), LocalVfxPrefab(delegate(GameObject p) { FlamethrowerParticlePrefab = p; }, "flamethrower_vfx.prefab"), LocalVfxPrefab(delegate(GameObject p) { FlamethrowerVictimFirePrefab = p; }, "flamethrower_victim_fire.prefab"), SpriteAsset(delegate(Sprite p) { JetpackIcon = p; }, "jetpack_icon.png"), HandheldPrefab(delegate(GameObject p) { JetpackHandheldPrefab = p; }, "jetpack_handheld.prefab"), LocalVfxPrefab(delegate(GameObject p) { JetpackParticlePrefab = p; }, "jetpack_particles.prefab"), NetworkedPrefab(delegate(GameObject p) { JetpackEquippedPrefab = p; }, "jetpack.prefab", 0u), SpriteAsset(delegate(Sprite p) { RocketTetherIcon = p; }, "rocket_tether_icon.png"), HandheldPrefab(delegate(GameObject p) { RocketTetherPrefab = p; }, "rocket_tether_handheld.prefab"), LocalVfxPrefab(delegate(GameObject p) { RocketTetherRocketPrefab = p; }, "player_linker_rocket.prefab"), SpriteAsset(delegate(Sprite p) { RocketTetherGrenadeIcon = p; }, "rocket_tether_grenade_icon.png"), NetworkedPrefab(delegate(GameObject p) { RocketTetherGrenadePrefab = p; }, "toy_rocket.prefab", 0u), LocalVfxPrefab(delegate(GameObject p) { RocketTetherGrenadeExplosionVfx = p; }, "rocket_tether_grenade_explosion_vfx.prefab"), SpriteAsset(delegate(Sprite p) { SpinachIcon = p; }, "spinach_icon.png"), HandheldPrefab(delegate(GameObject p) { SpinachPrefab = p; }, "spinach.prefab"), LocalVfxPrefab(delegate(GameObject p) { SpinachTrailPrefab = p; }, "spinach_trail.prefab"), SpriteAsset(delegate(Sprite p) { UfoAbductionIcon = p; }, "ufo_abduction_icon.png", optional: true), HandheldPrefab(delegate(GameObject p) { UfoAbductionHandheldPrefab = p; }, "ufo_abduction_handheld.prefab", optional: true), LocalVfxPrefab(delegate(GameObject p) { UfoAbductionUfoPrefab = p; }, "ufo_abduction.prefab"), SpriteAsset(delegate(Sprite p) { MoonIcon = p; }, "moon_icon.png", optional: true), HandheldPrefab(delegate(GameObject p) { MoonHandheldPrefab = p; }, "moon_handheld.prefab", optional: true), LocalVfxPrefab(delegate(GameObject p) { MoonVfxPrefab = p; }, "moon.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapeCube = p; }, "golf_ball_cube.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapeDisk = p; }, "golf_ball_disk.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapeCylinder = p; }, "golf_ball_cylinder.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapeCone = p; }, "golf_ball_cone.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapeAcorn = p; }, "golf_ball_acorn.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapeIsosphere = p; }, "golf_ball_isosphere.prefab"), Prefab(delegate(GameObject p) { ShapeShifterShapePyramid = p; }, "golf_ball_pyramid.prefab"), SpriteAsset(delegate(Sprite p) { ShapeShifterIcon = p; }, "cube_ball_icon.png", optional: true), SpriteAsset(delegate(Sprite p) { SuperShapeShifterIcon = p; }, "super_cube_ball_icon.png", optional: true), HandheldPrefab(delegate(GameObject p) { ShapeShifterHandheldPrefab = p; }, "rubixcube.prefab", optional: true, BuildShapeShifterHandheldFallback), SpriteAsset(delegate(Sprite p) { ExplosiveGolfBallsIcon = p; }, "exploding_ball_icon.png", optional: true), HandheldPrefab(delegate(GameObject p) { ExplosiveGolfBallsHandheldPrefab = p; }, "bomb_for_exploding_balls.prefab", optional: true), LocalVfxPrefab(delegate(GameObject p) { GoldStarPrefab = p; }, "gold_star.prefab") }; } private static void ApplyPostLoadMutations() { NukeExplosionVfxPrefab = LoadRaw("nuclear_explosion.prefab") ?? NukeVerticalExplosionVfxPrefab; if ((Object)(object)DroppedCustomItemPrefab != (Object)null) { DroppedCustomItemPrefab.SetActive(false); SphereCollider component = DroppedCustomItemPrefab.GetComponent(); if ((Object)(object)component != (Object)null) { ((Collider)component).isTrigger = true; } DroppedCustomItemPrefab.AddComponent(); DroppedCustomItemPrefab.AddComponent(); } if ((Object)(object)WallPrefab != (Object)null) { WallGhostPrefab = BuildWallGhost(WallPrefab); } if (SuperDonutIcon == null) { SuperDonutIcon = DonutIcon; } if (SuperDonutHandheldPrefab == null) { SuperDonutHandheldPrefab = DonutHandheldPrefab; } if (SuperShapeShifterIcon == null) { SuperShapeShifterIcon = ShapeShifterIcon; } } private static GameObject BuildShapeShifterHandheldFallback() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "ShapeShifterHandheld_Fallback"; val.transform.localScale = Vector3.one * 0.15f; Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); return val; } private static GameObject BuildWallHandheldFallback() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "PlaceableWallHandheld_Fallback"; val.transform.localScale = new Vector3(0.4f, 0.3f, 0.05f); DisableRigidbody(val); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static GameObject BuildWallFallback() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogWarning((object)"[Assets] wall.prefab not found — using fallback box."); GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "PlaceableWall_Fallback"; val.transform.localScale = new Vector3(4f, 3f, 0.3f); Rigidbody val2 = val.AddComponent(); val2.isKinematic = true; val2.useGravity = false; EnsureNetworkIdentity(val, 1141964810u); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static GameObject BuildHarrierFallback() { IssaPluginPlugin.Log.LogWarning((object)"[Assets] harrier.prefab not found — using fallback capsule."); GameObject val = GameObject.CreatePrimitive((PrimitiveType)1); ((Object)val).name = "Harrier_Fallback"; DisableRigidbody(val); EnsureNetworkIdentity(val, 2809135105u); val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static GameObject BuildBlackHoleGrenadeFallback() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogWarning((object)"[Assets] black_hole_grenade.prefab not found — using fallback sphere."); GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = "BlackHoleGrenade_Fallback"; val.transform.localScale = Vector3.one * 0.4f; Rigidbody val2 = val.GetComponent() ?? val.AddComponent(); val2.isKinematic = true; val2.useGravity = false; SphereCollider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { ((Collider)component).enabled = false; } EnsureNetworkIdentity(val, 2974547969u); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static GameObject BuildWallGhost(GameObject wallPrefab) { GameObject val = Object.Instantiate(wallPrefab); ((Object)val).name = "PlaceableWall_GhostTemplate"; StripNetworkComponents(val); Rigidbody[] componentsInChildren = val.GetComponentsInChildren(true); foreach (Rigidbody val2 in componentsInChildren) { val2.isKinematic = true; val2.detectCollisions = false; } Collider[] componentsInChildren2 = val.GetComponentsInChildren(true); foreach (Collider val3 in componentsInChildren2) { val3.enabled = false; } val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); IssaPluginPlugin.Log.LogInfo((object)"[Assets] WallGhostPrefab created from WallPrefab."); return val; } private static AssetDef SpriteAsset(Action set, string name, bool optional = false) { return new SpriteDef(set, name, optional); } private static AssetDef Texture(Action set, string name) { return new TextureDef(set, name); } private static AssetDef Audio(Action set, string name) { return new AudioDef(set, name); } private static AssetDef Prefab(Action set, string name) { return new PrefabDef(set, name); } private static AssetDef HandheldPrefab(Action set, string name, bool optional = false, Func fallback = null) { return new HandheldPrefabDef(set, name, optional, fallback); } private static AssetDef NetworkedPrefab(Action set, string name, uint assetId, Type clientSetupType = null, bool optional = false, Func fallback = null) { return new NetworkedPrefabDef(set, name, assetId, clientSetupType, optional, fallback); } private static AssetDef NetworkedPrefab(Action set, string name, uint assetId, Type clientSetupType) { return new NetworkedPrefabDef(set, name, assetId, clientSetupType, optional: false, null); } private static AssetDef LocalVfxPrefab(Action set, string name) { return new LocalVfxPrefabDef(set, name); } private static bool TryLoadBundle() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "IssaPluginBundle", "issamod"); if (!File.Exists(text)) { text = Path.Combine(directoryName, "issamod"); if (!File.Exists(text)) { IssaPluginPlugin.Log.LogWarning((object)"[Assets] Asset bundle not found. Place 'issamod' in IssaPluginBundle/ next to the plugin DLL."); return false; } } _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Assets] Failed to load asset bundle."); return false; } return true; } private static T LoadRequiredRaw(AssetBundle bundle, string name) where T : Object { T val = bundle.LoadAsset(name); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)("[Assets] Missing required asset: " + name)); } return val; } private static T LoadOptionalRaw(AssetBundle bundle, string name) where T : Object { return bundle.LoadAsset(name); } private static T LoadRaw(string name) where T : Object { AssetBundle bundle = _bundle; return (bundle != null) ? bundle.LoadAsset(name) : default(T); } private static void EnsureNetworkIdentity(GameObject prefab, uint stableAssetId) { if (!((Object)(object)prefab == (Object)null)) { FieldInfo field = typeof(NetworkIdentity).GetField("assetId", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); NetworkIdentity component = prefab.GetComponent(); if ((Object)(object)component == (Object)null) { component = prefab.AddComponent(); field?.SetValue(component, stableAssetId); IssaPluginPlugin.Log.LogInfo((object)$"[Assets] Added NetworkIdentity to {((Object)prefab).name} (assetId={stableAssetId:X8})."); } else if (component.assetId == 0) { field?.SetValue(component, stableAssetId); IssaPluginPlugin.Log.LogInfo((object)$"[Assets] {((Object)prefab).name} had assetId=0; set stable assetId={stableAssetId:X8}."); } else { IssaPluginPlugin.Log.LogInfo((object)$"[Assets] {((Object)prefab).name} already has NetworkIdentity (assetId={component.assetId:X8})."); } Object.DontDestroyOnLoad((Object)(object)prefab); } } private static void DisableRigidbody(GameObject go) { if (!((Object)(object)go == (Object)null)) { Rigidbody component = go.GetComponent(); if (!((Object)(object)component == (Object)null)) { component.isKinematic = true; component.useGravity = false; } } } private static void StripNetworkComponents(GameObject go) { if (!((Object)(object)go == (Object)null)) { NetworkBehaviour[] componentsInChildren = go.GetComponentsInChildren(true); foreach (NetworkBehaviour val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } NetworkIdentity[] componentsInChildren2 = go.GetComponentsInChildren(true); foreach (NetworkIdentity val2 in componentsInChildren2) { Object.DestroyImmediate((Object)(object)val2); } } } } public class BatItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.BaseballBatItemType; public override string DisplayName => "Baseball Bat"; public override string[] ConsoleAliases => new string[2] { "baseballbat", "bat" }; public override Sprite Icon => AssetLoader.BatIcon; public override GameObject HeldModelPrefab => AssetLoader.BatModelPrefab; public override bool UseRocketIconFallback => false; public override int MaxUses => (int)ModConfig.BaseballBat.Uses.Value; public override float DefaultPoolWeight => 15f; public override Key GiveKey => ModConfig.BaseballBat.GiveKey.Value; public override EquipmentType EquipmentType => (EquipmentType)1; public override ItemType AnimatorItemType => (ItemType)0; public override ItemType AnimatorChangedItemType => (ItemType)0; public override bool ShouldEatInputOnUse => false; public override bool UseResult => false; public override void OnUse(PlayerInventory inventory) { } } public enum BearAIState : byte { Spawning, Idle, Pursuing, Charging, Attacking, AttackCooldown, Stunned, Enraged, Dying, Dead, Wander } [RequireComponent(typeof(Rigidbody))] public class BearBehaviour : MonoBehaviour { public PlayerInfo SummonerInfo; public BearHitReceiver HitReceiver; private Rigidbody _rb; private Animator _animator; private BearAnimatorDriver _animatorDriver; private BearTargetSelector _selector; private NetworkIdentity _ni; private BearAIState _state = BearAIState.Spawning; private float _stateTimer; private PlayerInfo _currentTarget; private bool _attackHitApplied; private float _attackHitWindow; private Vector3 _wanderTarget; private float _wanderTimer; private const int ContextRayCount = 8; private const float AngleStep = 45f; private readonly float[] _interest = new float[8]; private readonly float[] _danger = new float[8]; private Vector3 _cachedSteeringDir = Vector3.forward; private int _steeringTick; private int _obstacleMask; private bool _destroying; private float _blackHoleSuppressedUntil; private Vector3 _kinematicVelocity; private float _yVelocity; private static readonly RaycastHit[] _groundHitBuffer = (RaycastHit[])(object)new RaycastHit[8]; private static readonly List _playerScratchpad = new List(); private static readonly List _targetableScratchpad = new List(); private void Start() { if (!NetworkServer.active) { ((Behaviour)this).enabled = false; return; } _rb = ((Component)this).GetComponent(); _animator = ((Component)this).GetComponent(); _animatorDriver = ((Component)this).GetComponent(); _ni = ((Component)this).GetComponent(); _selector = new BearTargetSelector(); _obstacleMask = LayerMask.GetMask(new string[2] { "Default", "Terrain" }); _rb.isKinematic = true; _rb.useGravity = false; _rb.freezeRotation = true; _rb.interpolation = (RigidbodyInterpolation)1; TransitionTo(BearAIState.Spawning); } private void FixedUpdate() { if (NetworkServer.active) { _stateTimer -= Time.fixedDeltaTime; UpdateKinematicMode(); UpdateStateMachine(); ApplyKinematicPosition(); } } private void UpdateKinematicMode() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) bool flag = Time.fixedTime < _blackHoleSuppressedUntil || _state == BearAIState.Stunned || _state == BearAIState.Dying || _state == BearAIState.Dead; if (_rb.isKinematic == flag) { if (flag) { _rb.isKinematic = false; _rb.useGravity = true; _rb.linearVelocity = new Vector3(0f, _yVelocity, 0f); } else { _yVelocity = _rb.linearVelocity.y; _rb.linearVelocity = Vector3.zero; _rb.isKinematic = true; _rb.useGravity = false; } } } private void ApplyKinematicPosition() { //IL_0021: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (!_rb.isKinematic) { return; } _yVelocity += Physics.gravity.y * Time.fixedDeltaTime; float num = _rb.position.y + _yVelocity * Time.fixedDeltaTime; Vector3 val = _rb.position + Vector3.up; int num2 = Physics.RaycastNonAlloc(val, Vector3.down, _groundHitBuffer, 1.5f, _obstacleMask); float num3 = float.MaxValue; for (int i = 0; i < num2; i++) { ref RaycastHit reference = ref _groundHitBuffer[i]; if (((Component)((RaycastHit)(ref reference)).collider).transform.IsChildOf(((Component)this).transform) || !(((RaycastHit)(ref reference)).distance < num3)) { continue; } num3 = ((RaycastHit)(ref reference)).distance; if (_rb.position.y <= ((RaycastHit)(ref reference)).point.y + 0.05f) { num = ((RaycastHit)(ref reference)).point.y; if (_yVelocity < 0f) { _yVelocity = 0f; } } } _rb.MovePosition(new Vector3(_rb.position.x + _kinematicVelocity.x * Time.fixedDeltaTime, num, _rb.position.z + _kinematicVelocity.z * Time.fixedDeltaTime)); _kinematicVelocity = Vector3.zero; } private void UpdateStateMachine() { if (Time.fixedTime < _blackHoleSuppressedUntil) { return; } switch (_state) { case BearAIState.Spawning: if (_stateTimer <= 0f) { TransitionTo(BearAIState.Idle); } break; case BearAIState.Idle: UpdateIdle(); break; case BearAIState.Wander: UpdateWander(); break; case BearAIState.Pursuing: UpdatePursuing(); break; case BearAIState.Charging: UpdateCharging(); break; case BearAIState.Attacking: UpdateAttacking(); break; case BearAIState.AttackCooldown: if (_stateTimer <= 0f) { TransitionTo(BearAIState.Pursuing); } break; case BearAIState.Stunned: if (_stateTimer <= 0f) { TransitionTo(BearAIState.Enraged); } break; case BearAIState.Enraged: UpdateEnraged(); break; case BearAIState.Dying: if (_stateTimer <= 0f) { TransitionTo(BearAIState.Dead); } break; case BearAIState.Dead: if (!_destroying) { _destroying = true; NetworkServer.Destroy(((Component)this).gameObject); } break; } } private void UpdateIdle() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) _currentTarget = _selector.SelectTarget(((Component)this).transform.position, GetTargetablePlayers()); if ((Object)(object)_currentTarget != (Object)null) { TransitionTo(BearAIState.Pursuing); } else { TransitionTo(BearAIState.Wander); } } private void UpdateWander() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) _currentTarget = _selector.SelectTarget(((Component)this).transform.position, GetTargetablePlayers()); if ((Object)(object)_currentTarget != (Object)null) { TransitionTo(BearAIState.Pursuing); } else { DoWander(); } } private void UpdatePursuing() { //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) _currentTarget = _selector.SelectTarget(((Component)this).transform.position, GetTargetablePlayers()); if ((Object)(object)_currentTarget == (Object)null) { TransitionTo(BearAIState.Idle); return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)_currentTarget).transform.position); if (num <= ModConfig.Bear.ChargeRange.Value) { TransitionTo(BearAIState.Charging); return; } if (!IsTargetReachable(((Component)_currentTarget).transform.position)) { DoObstructedBehavior(); return; } Vector3 desiredDirection = GetDesiredDirection(((Component)_currentTarget).transform.position); Vector3 worldDir = ComputeContextSteering(desiredDirection); MoveInDirection(worldDir, ModConfig.Bear.RunSpeed.Value); } private void UpdateCharging() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0079: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_currentTarget == (Object)null) { TransitionTo(BearAIState.Pursuing); return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)_currentTarget).transform.position); if (num <= ModConfig.Bear.AttackRange.Value) { TransitionTo(BearAIState.Attacking); return; } Vector3 desiredDirection = GetDesiredDirection(((Component)_currentTarget).transform.position); MoveInDirection(desiredDirection, ModConfig.Bear.ChargeSpeed.Value); } private void UpdateAttacking() { //IL_0040: 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) if (!_attackHitApplied && _stateTimer <= _attackHitWindow) { _attackHitApplied = true; if ((Object)(object)_currentTarget != (Object)null) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)_currentTarget).transform.position); if (num <= ModConfig.Bear.AttackRange.Value * 1.4f) { ApplyAttackHit(_currentTarget); } } } if (_stateTimer <= 0f) { TransitionTo(BearAIState.AttackCooldown); } } private void UpdateEnraged() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if (_stateTimer <= 0f) { TransitionTo(BearAIState.Pursuing); return; } _currentTarget = _selector.SelectTarget(((Component)this).transform.position, GetTargetablePlayers()); if ((Object)(object)_currentTarget == (Object)null) { TransitionTo(BearAIState.Idle); return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)_currentTarget).transform.position); if (num <= ModConfig.Bear.ChargeRange.Value) { TransitionTo(BearAIState.Charging); return; } Vector3 desiredDirection = GetDesiredDirection(((Component)_currentTarget).transform.position); Vector3 worldDir = ComputeContextSteering(desiredDirection); float speed = ModConfig.Bear.RunSpeed.Value * ModConfig.Bear.EnrageSpeedMultiplier.Value; MoveInDirection(worldDir, speed); } private Vector3 ComputeContextSteering(Vector3 desiredWorldDir) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_0170: Unknown result type (might be due to invalid IL or missing references) _steeringTick++; if (_steeringTick % 3 != 0) { return _cachedSteeringDir; } for (int i = 0; i < 8; i++) { float num = (float)i * 45f; Vector3 val = Quaternion.Euler(0f, num, 0f) * Vector3.forward; _interest[i] = Mathf.Max(0f, Vector3.Dot(val, desiredWorldDir)); Vector3 val2 = ((Component)this).transform.position + Vector3.up * 0.6f; _danger[i] = (Physics.Raycast(val2, val, 4.5f, _obstacleMask) ? 1f : 0f); } for (int j = 0; j < 8; j++) { if (_danger[j] > 0f) { _interest[j] = 0f; } } int num2 = 0; for (int k = 1; k < 8; k++) { if (_interest[k] > _interest[num2]) { num2 = k; } } if (_interest[num2] <= 0f) { _cachedSteeringDir = GetLeastDangerousDirection(); return _cachedSteeringDir; } float num3 = (float)num2 * 45f; Vector3 val3 = Quaternion.Euler(0f, num3, 0f) * Vector3.forward; _cachedSteeringDir = ((Vector3)(ref val3)).normalized; return _cachedSteeringDir; } private Vector3 GetLeastDangerousDirection() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) int num = 0; float num2 = float.MaxValue; for (int i = 0; i < 8; i++) { if (_danger[i] < num2) { num2 = _danger[i]; num = i; } } float num3 = (float)num * 45f; Vector3 val = Quaternion.Euler(0f, num3, 0f) * Vector3.forward; return ((Vector3)(ref val)).normalized; } private Vector3 GetDesiredDirection(Vector3 targetPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0033: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPos - ((Component)this).transform.position; val.y = 0f; return (((Vector3)(ref val)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val)).normalized : ((Component)this).transform.forward; } private void MoveInDirection(Vector3 worldDir, float speed) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0015: 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_001f: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref worldDir)).sqrMagnitude > 0.01f) { Quaternion val = Quaternion.LookRotation(worldDir, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val, ModConfig.Bear.TurnSpeed.Value * Time.fixedDeltaTime); } _kinematicVelocity = worldDir * speed; } private void DoWander() { //IL_0026: 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_00a3: 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_00ad: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) _wanderTimer -= Time.fixedDeltaTime; if (_wanderTimer <= 0f || Vector3.Distance(((Component)this).transform.position, _wanderTarget) < 2f) { Vector2 val = Random.insideUnitCircle * ModConfig.Bear.WanderRadius.Value; _wanderTarget = ((Component)this).transform.position + new Vector3(val.x, 0f, val.y); _wanderTimer = Random.Range(3f, 8f); } Vector3 desiredDirection = GetDesiredDirection(_wanderTarget); MoveInDirection(desiredDirection, ModConfig.Bear.WalkSpeed.Value); } private void DoObstructedBehavior() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0065: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_currentTarget == (Object)null)) { Vector3 targetPos = default(Vector3); ((Vector3)(ref targetPos))..ctor(((Component)_currentTarget).transform.position.x, ((Component)this).transform.position.y, ((Component)_currentTarget).transform.position.z); Vector3 desiredDirection = GetDesiredDirection(targetPos); Vector3 worldDir = ComputeContextSteering(desiredDirection); MoveInDirection(worldDir, ModConfig.Bear.WalkSpeed.Value * 0.6f); } } private bool IsTargetReachable(Vector3 targetPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) float num = targetPos.y - ((Component)this).transform.position.y; return Mathf.Abs(num) <= ModConfig.Bear.MaxClimbHeight.Value; } private void ApplyAttackHit(PlayerInfo target) { //IL_0043: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //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_0062: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || (Object)(object)SummonerInfo == (Object)null) { return; } Hittable componentInChildren = ((Component)target).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { Vector3 val = ((Component)target).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = normalized + Vector3.up * 0.4f; normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = ((Component)componentInChildren).transform.InverseTransformPoint(((Component)target).transform.position); ItemUseId val3 = default(ItemUseId); ((ItemUseId)(ref val3))..ctor(SummonerInfo.PlayerId.Guid, BearItem.NextUseIndex(), (ItemType)3, false); componentInChildren.HitWithItem((ItemType)3, val3, val2, normalized, ((Component)componentInChildren).transform.InverseTransformPoint(((Component)this).transform.position), Vector3.Distance(((Component)this).transform.position, ((Component)target).transform.position), SummonerInfo.Inventory, false, false, false, NetworkTime.time, 0uL); NetworkServer.SendToAll(new BearAttackImpactMessage { BearNetId = _ni.netId, ImpactPosition = ((Component)target).transform.position }, 0, false); IssaPluginPlugin.Log.LogInfo((object)("[Bear] Attack hit applied to " + target.PlayerId.PlayerName + ".")); BearNetworkBridge component = ((Component)SummonerInfo).GetComponent(); NetworkConnectionToClient val4 = ((component != null) ? ((NetworkBehaviour)component).connectionToClient : null); if (val4 != null) { ((NetworkConnection)val4).Send(new HitNotificationMessage { Message = "Bear hit " + target.PlayerId.PlayerName + "!" }, 0); } } } public void ApplyMeleeKnockback(Vector3 direction, float force) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rb == (Object)null) && !_destroying) { if (_rb.isKinematic) { _rb.isKinematic = false; _rb.useGravity = true; _rb.linearVelocity = new Vector3(0f, _yVelocity, 0f); } _rb.AddForce(direction * force, (ForceMode)1); } } public void OnHitByExplosion(PlayerInfo attacker) { if (_state != BearAIState.Dying && _state != BearAIState.Dead) { _selector.NotifyHitBy(attacker); TransitionTo(BearAIState.Stunned); IssaPluginPlugin.Log.LogInfo((object)"[Bear] Bear stunned by explosion."); } } public void NotifyBlackHoleSuction() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) _blackHoleSuppressedUntil = Time.fixedTime + Time.fixedDeltaTime * 2f; if ((Object)(object)_rb != (Object)null && _rb.isKinematic) { _rb.isKinematic = false; _rb.useGravity = true; _rb.linearVelocity = new Vector3(0f, _yVelocity, 0f); } } public void NotifyBlackHoleSpitLaunch() { _blackHoleSuppressedUntil = Time.fixedTime + 2f; } public void OnKilled() { if (_state != BearAIState.Dying && _state != BearAIState.Dead) { TransitionTo(BearAIState.Dying); IssaPluginPlugin.Log.LogInfo((object)"[Bear] Bear killed."); } } private void TransitionTo(BearAIState newState) { //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) _state = newState; switch (newState) { case BearAIState.Spawning: _stateTimer = ModConfig.Bear.SpawnAnimationDuration.Value; ZeroVelocity(); break; case BearAIState.Idle: _stateTimer = 0f; _wanderTimer = 0f; break; case BearAIState.Wander: _stateTimer = 0f; break; case BearAIState.Pursuing: _stateTimer = 0f; break; case BearAIState.Charging: _stateTimer = 0f; break; case BearAIState.Attacking: { float num = (_stateTimer = ModConfig.Bear.AttackAnimationDuration.Value); _attackHitApplied = false; _attackHitWindow = num * 0.45f; ZeroVelocity(); break; } case BearAIState.AttackCooldown: _stateTimer = ModConfig.Bear.AttackCooldown.Value; _currentTarget = null; ZeroVelocity(); break; case BearAIState.Stunned: _stateTimer = ModConfig.Bear.StunDuration.Value; ZeroVelocity(); break; case BearAIState.Enraged: _stateTimer = ModConfig.Bear.EnrageDuration.Value; _selector.ClearLock(); break; case BearAIState.Dying: { _stateTimer = ModConfig.Bear.DeathAnimationDuration.Value; ZeroVelocity(); Collider[] components = ((Component)this).GetComponents(); foreach (Collider val in components) { val.enabled = false; } break; } case BearAIState.Dead: _stateTimer = 0f; break; } _animatorDriver?.ApplyState(newState, ((Object)(object)_currentTarget != (Object)null) ? ((Component)_currentTarget).transform.position : Vector3.zero); BroadcastState(); } private void BroadcastState() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) NetworkServer.SendToAll(new BearStateMessage { BearNetId = (((Object)(object)_ni != (Object)null) ? _ni.netId : 0u), State = _state, TargetPosition = (((Object)(object)_currentTarget != (Object)null) ? ((Component)_currentTarget).transform.position : Vector3.zero) }, 0, false); } private void ZeroVelocity() { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) _kinematicVelocity = Vector3.zero; _yVelocity = 0f; if ((Object)(object)_rb != (Object)null && !_rb.isKinematic) { _rb.linearVelocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; } } private static List GetActivePlayers() { _playerScratchpad.Clear(); if ((Object)(object)GameManager.LocalPlayerInfo != (Object)null) { _playerScratchpad.Add(GameManager.LocalPlayerInfo); } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { _playerScratchpad.AddRange(remotePlayers); } return _playerScratchpad; } private List GetTargetablePlayers() { List activePlayers = GetActivePlayers(); if (ModConfig.Bear.FriendlyFire.Value || (Object)(object)SummonerInfo == (Object)null) { return activePlayers; } _targetableScratchpad.Clear(); foreach (PlayerInfo item in activePlayers) { if ((Object)(object)item != (Object)(object)SummonerInfo) { _targetableScratchpad.Add(item); } } return _targetableScratchpad; } } public class BearClientSetup : MonoBehaviour { private void Awake() { if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } } } public class BearHitReceiver : CustomHittable { private NetworkIdentity _ni; public BearBehaviour Behaviour { get; set; } public float CurrentHP { get; private set; } public float MaxHP { get; private set; } private void Awake() { MaxHP = ModConfig.Bear.MaxHP.Value; CurrentHP = MaxHP; } private void Start() { _ni = ((Component)this).GetComponent(); } public void DealDamage(float amount) { if (NetworkServer.active && !(CurrentHP <= 0f) && !(MaxHP <= 0f)) { CurrentHP -= amount; IssaPluginPlugin.Log.LogInfo((object)$"[Bear] Hit for {amount} damage. HP: {CurrentHP}/{MaxHP}."); if ((Object)(object)_ni != (Object)null) { NetworkServer.SendToAll(new BearHPUpdateMessage { BearNetId = _ni.netId, CurrentHP = Mathf.Max(0f, CurrentHP), MaxHP = MaxHP }, 0, false); } if (CurrentHP <= 0f) { IssaPluginPlugin.Log.LogInfo((object)"[Bear] Bear killed."); Behaviour?.OnKilled(); } else { PlayerInfo currentAttacker = BearExplosionAttackerContext.CurrentAttacker; Behaviour?.OnHitByExplosion(currentAttacker); } } } } public static class BearExplosionAttackerContext { public static PlayerInfo CurrentAttacker { get; set; } } public static class BearItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class BearItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.BearItemType; public override string DisplayName => "Bear"; public override string[] ConsoleAliases => new string[2] { "bear", "bears" }; public override Sprite Icon => AssetLoader.BearIcon; public override GameObject HeldModelPrefab => AssetLoader.TeddyBearPrefab; public override int MaxUses => (int)ModConfig.Bear.Uses.Value; public override float DefaultPoolWeight => 3f; public override Key GiveKey => ModConfig.Bear.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 0f, 0 => 0f, 2 => 1f, 3 => 2f, 5 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { BearNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(BearActivateMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[Bear] No BearNetworkBridge on player."); } } } public class BearMarker : MonoBehaviour { } public class BearAnimatorDriver : MonoBehaviour { private Animator _animator; private static readonly int TrigAttack1 = Animator.StringToHash("Attack1"); private static readonly int TrigAttack2 = Animator.StringToHash("Attack2"); private static readonly int TrigAttack3 = Animator.StringToHash("Attack3"); private static readonly int TrigAttack5 = Animator.StringToHash("Attack5"); private static readonly int TrigBuff = Animator.StringToHash("Buff"); private static readonly int TrigGetHitFront = Animator.StringToHash("Get Hit Front"); private static readonly int BoolIdle = Animator.StringToHash("Idle"); private static readonly int BoolCombatIdle = Animator.StringToHash("Combat Idle"); private static readonly int BoolRunForward = Animator.StringToHash("Run Forward"); private static readonly int BoolWalkForward = Animator.StringToHash("WalkForward"); private static readonly int BoolStunnedLoop = Animator.StringToHash("Stunned Loop"); private static readonly int BoolDeath = Animator.StringToHash("Death"); private static readonly int[] AttackTriggers = new int[4] { TrigAttack1, TrigAttack2, TrigAttack3, TrigAttack5 }; private int _attackIndex; private void Awake() { _animator = ((Component)this).GetComponent(); } public void ApplyState(BearAIState state, Vector3 targetPosition) { //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: 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) if ((Object)(object)_animator == (Object)null) { return; } switch (state) { case BearAIState.Spawning: ClearMovementBools(); _animator.SetTrigger(TrigBuff); break; case BearAIState.Idle: ClearMovementBools(); _animator.SetBool(BoolIdle, true); break; case BearAIState.AttackCooldown: ClearMovementBools(); _animator.SetBool(BoolCombatIdle, true); break; case BearAIState.Wander: ClearMovementBools(); _animator.SetBool(BoolWalkForward, true); break; case BearAIState.Pursuing: case BearAIState.Enraged: ClearMovementBools(); _animator.SetBool(BoolRunForward, true); break; case BearAIState.Charging: ClearMovementBools(); _animator.SetBool(BoolRunForward, true); break; case BearAIState.Attacking: ClearMovementBools(); _animator.SetBool(BoolCombatIdle, true); _animator.SetTrigger(AttackTriggers[_attackIndex]); _attackIndex = (_attackIndex + 1) % AttackTriggers.Length; break; case BearAIState.Stunned: { ClearMovementBools(); int[] attackTriggers = AttackTriggers; foreach (int num in attackTriggers) { _animator.ResetTrigger(num); } _animator.CrossFadeInFixedTime("Hit Front", 0.05f); _animator.SetTrigger(TrigGetHitFront); _animator.SetBool(BoolStunnedLoop, true); break; } case BearAIState.Dying: ClearMovementBools(); _animator.SetBool(BoolDeath, true); break; } if (targetPosition != Vector3.zero && (state == BearAIState.Pursuing || state == BearAIState.Charging || state == BearAIState.Enraged || state == BearAIState.Attacking)) { Vector3 val = targetPosition - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); } } if (state != BearAIState.Stunned) { _animator.SetBool(BoolStunnedLoop, false); } } private void ClearMovementBools() { _animator.SetBool(BoolIdle, false); _animator.SetBool(BoolCombatIdle, false); _animator.SetBool(BoolRunForward, false); _animator.SetBool(BoolWalkForward, false); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BearActivateMessage : NetworkMessage { } public struct BearSwingHitMessage : NetworkMessage { public uint BearNetId; } public static class BearSwingHitMessageSerialization { public static void WriteBearSwingHitMessage(NetworkWriter writer, BearSwingHitMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.BearNetId); } public static BearSwingHitMessage ReadBearSwingHitMessage(NetworkReader reader) { return new BearSwingHitMessage { BearNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public static class BearActivateMessageSerialization { public static void WriteBearActivateMessage(NetworkWriter writer, BearActivateMessage msg) { } public static BearActivateMessage ReadBearActivateMessage(NetworkReader reader) { return default(BearActivateMessage); } } public struct BearStateMessage : NetworkMessage { public uint BearNetId; public BearAIState State; public Vector3 TargetPosition; } public static class BearStateMessageSerialization { public static void WriteBearStateMessage(NetworkWriter writer, BearStateMessage msg) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.BearNetId); writer.WriteByte((byte)msg.State); NetworkWriterExtensions.WriteVector3(writer, msg.TargetPosition); } public static BearStateMessage ReadBearStateMessage(NetworkReader reader) { //IL_0026: 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) return new BearStateMessage { BearNetId = NetworkReaderExtensions.ReadUInt(reader), State = (BearAIState)reader.ReadByte(), TargetPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct BearAttackImpactMessage : NetworkMessage { public uint BearNetId; public Vector3 ImpactPosition; } public static class BearAttackImpactMessageSerialization { public static void WriteBearAttackImpactMessage(NetworkWriter writer, BearAttackImpactMessage msg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.BearNetId); NetworkWriterExtensions.WriteVector3(writer, msg.ImpactPosition); } public static BearAttackImpactMessage ReadBearAttackImpactMessage(NetworkReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) return new BearAttackImpactMessage { BearNetId = NetworkReaderExtensions.ReadUInt(reader), ImpactPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct BearHitVfxMessage : NetworkMessage { public Vector3 HitPoint; public Vector3 AttackerOrigin; } public static class BearHitVfxMessageSerialization { public static void WriteBearHitVfxMessage(NetworkWriter writer, BearHitVfxMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.HitPoint); NetworkWriterExtensions.WriteVector3(writer, msg.AttackerOrigin); } public static BearHitVfxMessage ReadBearHitVfxMessage(NetworkReader reader) { //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_0018: 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) return new BearHitVfxMessage { HitPoint = NetworkReaderExtensions.ReadVector3(reader), AttackerOrigin = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BearHuntEndedMessage : NetworkMessage { } public static class BearHuntEndedMessageSerialization { public static void WriteBearHuntEndedMessage(NetworkWriter writer, BearHuntEndedMessage msg) { } public static BearHuntEndedMessage ReadBearHuntEndedMessage(NetworkReader reader) { return default(BearHuntEndedMessage); } } public struct BearHPUpdateMessage : NetworkMessage { public uint BearNetId; public float CurrentHP; public float MaxHP; } public static class BearHPUpdateMessageSerialization { public static void WriteBearHPUpdateMessage(NetworkWriter writer, BearHPUpdateMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.BearNetId); NetworkWriterExtensions.WriteFloat(writer, msg.CurrentHP); NetworkWriterExtensions.WriteFloat(writer, msg.MaxHP); } public static BearHPUpdateMessage ReadBearHPUpdateMessage(NetworkReader reader) { return new BearHPUpdateMessage { BearNetId = NetworkReaderExtensions.ReadUInt(reader), CurrentHP = NetworkReaderExtensions.ReadFloat(reader), MaxHP = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct BearOverlayBeginMessage : NetworkMessage { public int BearCount; public float SessionDuration; } public static class BearOverlayBeginMessageSerialization { public static void WriteBearOverlayBeginMessage(NetworkWriter writer, BearOverlayBeginMessage msg) { NetworkWriterExtensions.WriteInt(writer, msg.BearCount); NetworkWriterExtensions.WriteFloat(writer, msg.SessionDuration); } public static BearOverlayBeginMessage ReadBearOverlayBeginMessage(NetworkReader reader) { return new BearOverlayBeginMessage { BearCount = NetworkReaderExtensions.ReadInt(reader), SessionDuration = NetworkReaderExtensions.ReadFloat(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BearKilledClientMessage : NetworkMessage { } public static class BearKilledClientMessageSerialization { public static void WriteBearKilledClientMessage(NetworkWriter writer, BearKilledClientMessage msg) { } public static BearKilledClientMessage ReadBearKilledClientMessage(NetworkReader reader) { return default(BearKilledClientMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BearOverlayEndMessage : NetworkMessage { } public static class BearOverlayEndMessageSerialization { public static void WriteBearOverlayEndMessage(NetworkWriter writer, BearOverlayEndMessage msg) { } public static BearOverlayEndMessage ReadBearOverlayEndMessage(NetworkReader reader) { return default(BearOverlayEndMessage); } } public class BearNetworkBridge : NetworkBridgeBase { internal static readonly HashSet<(PlayerInfo, GameObject)> SwingHitPairs = new HashSet<(PlayerInfo, GameObject)>(); private readonly List _activeBears = new List(); private bool _serverSessionActive; private Coroutine _serverTimeout; public bool PendingBearHoming; public override void OnStopServer() { if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[Bear] Player disconnected during bear session — cleaning up."); ForceServerCleanup(); } } public void ServerSummonBears() { //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_0032: 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_0097: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)"ServerSummonBears called."); PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.BearItemType) { IssaPluginPlugin.Log.LogWarning((object)"[Bear] Player does not have Bear item equipped."); return; } if ((Object)(object)AssetLoader.BearPrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Bear] Bear prefab not loaded."); return; } ItemHelper.ConsumeEquippedItem(component); ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.BearItemType, "Bear", 0u, ((NetworkBehaviour)this).netId); int num = (int)ModConfig.Bear.Count.Value; float value = ModConfig.Bear.SpawnRadius.Value; float value2 = ModConfig.Bear.SessionDuration.Value; Vector3 position = ((Component)component.PlayerInfo).transform.position; Vector3 val = default(Vector3); for (int i = 0; i < num; i++) { float num2 = 360f / (float)num * (float)i + Random.Range(-20f, 20f); float num3 = Random.Range(value * 0.6f, value); float num4 = num2 * (MathF.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Cos(num4) * num3, 0f, Mathf.Sin(num4) * num3); Vector3 position2 = SnapToGround(position + val); SpawnOneBear(position2, component.PlayerInfo); } _serverSessionActive = true; _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerTimeoutRoutine()); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new BearOverlayBeginMessage { BearCount = num, SessionDuration = value2 }, 0); IssaPluginPlugin.Log.LogInfo((object)($"[Bear] Spawned {num} bear(s) for " + component.PlayerInfo.PlayerId.PlayerName + ".")); } public void ServerPrepareBearRocket() { PendingBearHoming = true; } private void SpawnOneBear(Vector3 position, PlayerInfo summoner) { //IL_0006: 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) GameObject val = Object.Instantiate(AssetLoader.BearPrefab, position, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); BearHitReceiver bearHitReceiver = val.AddComponent(); BearBehaviour bearBehaviour = val.AddComponent(); bearBehaviour.SummonerInfo = summoner; bearBehaviour.HitReceiver = bearHitReceiver; bearHitReceiver.Behaviour = bearBehaviour; NetworkServer.Spawn(val, (NetworkConnectionToClient)null); _activeBears.Add(val); ((MonoBehaviour)this).StartCoroutine(WatchBear(val)); } private IEnumerator WatchBear(GameObject bearGo) { while ((Object)(object)bearGo != (Object)null) { yield return null; } _activeBears.Remove(bearGo); if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(BearKilledClientMessage), 0); } if (_serverSessionActive && _activeBears.Count == 0) { IssaPluginPlugin.Log.LogInfo((object)"[Bear] All bears defeated — session ending."); EndServerSession(); } } private IEnumerator ServerTimeoutRoutine() { yield return (object)new WaitForSeconds(ModConfig.Bear.SessionDuration.Value); if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[Bear] Session timed out."); EndServerSession(); } } private void EndServerSession() { if (!_serverSessionActive) { return; } _serverSessionActive = false; if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } List list = new List(_activeBears); _activeBears.Clear(); foreach (GameObject item in list) { if ((Object)(object)item != (Object)null) { NetworkServer.Destroy(item); } } NetworkServer.SendToAll(default(BearHuntEndedMessage), 0, false); if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(BearOverlayEndMessage), 0); } IssaPluginPlugin.Log.LogInfo((object)"[Bear] Server session ended."); } public override void ServerHoleCleanup() { if (_serverSessionActive) { ForceServerCleanup(); } } public override void ClientHoleCleanup() { } private void ForceServerCleanup() { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } foreach (GameObject activeBear in _activeBears) { if ((Object)(object)activeBear != (Object)null) { NetworkServer.Destroy(activeBear); } } _activeBears.Clear(); _serverSessionActive = false; if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(BearOverlayEndMessage), 0); } } public static void HandleBearState(BearStateMessage msg) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (NetworkClient.spawned.TryGetValue(msg.BearNetId, out var value) && !((Object)(object)value == (Object)null)) { ((Component)value).GetComponent()?.ApplyState(msg.State, msg.TargetPosition); } } public static void HandleBearAttackImpact(BearAttackImpactMessage msg) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.ImpactPosition, 1f, 1f); } public static void HandleBearSessionEnd(BearHuntEndedMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[Bear] Session ended (all clients)."); } public static void HandleBearOverlayBegin(BearOverlayBeginMessage msg) { BearOverlay.Instance?.SetActive(active: true, msg.BearCount, msg.SessionDuration); } public static void HandleBearKilledClient(BearKilledClientMessage msg) { BearOverlay.Instance?.DecrementBearCount(); } public static void HandleBearOverlayEnd(BearOverlayEndMessage msg) { BearOverlay.Instance?.Deactivate(); } internal static void ServerHandleSwingHit(NetworkConnectionToClient conn, BearSwingHitMessage msg) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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) //IL_017c: 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_0188: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity identity = ((NetworkConnection)conn).identity; PlayerInfo val = ((identity != null) ? ((Component)identity).GetComponent() : null); if ((Object)(object)val == (Object)null || !NetworkServer.spawned.TryGetValue(msg.BearNetId, out var value) || (Object)(object)value == (Object)null) { return; } BearHitReceiver component = ((Component)value).GetComponent(); if (!((Object)(object)component == (Object)null)) { float num = Vector3.Distance(((Component)val).transform.position, ((Component)value).transform.position); if (!(num > ModConfig.Bear.MeleeHitRange.Value * 4f) && SwingHitPairs.Add((val, ((Component)component).gameObject))) { PlayerInventory inventory = val.Inventory; bool flag = ((inventory != null) ? new ItemType?(inventory.GetEffectivelyEquippedItem(true)) : ((ItemType?)null)) == (ItemType?)ItemRegistry.BaseballBatItemType; float num2 = (flag ? ModConfig.Bear.DamageBaseballBat.Value : ModConfig.Bear.DamageGolfClub.Value); float force = (flag ? ModConfig.Bear.BatKnockbackForce.Value : ModConfig.Bear.MeleeKnockbackForce.Value); Vector3 val2 = ((Component)value).transform.position - ((Component)val).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = normalized + Vector3.up * 0.5f; normalized = ((Vector3)(ref val2)).normalized; BearExplosionAttackerContext.CurrentAttacker = val; component.DealDamage(num2); BearExplosionAttackerContext.CurrentAttacker = null; component.Behaviour?.ApplyMeleeKnockback(normalized, force); NetworkServer.SendToAll(new BearHitVfxMessage { HitPoint = ((Component)value).transform.position + Vector3.up * 1f, AttackerOrigin = ((Component)val).transform.position }, 0, false); IssaPluginPlugin.Log.LogInfo((object)("[Bear] Hit by swing (client-reported) " + $"from {val.PlayerId.PlayerName} for {num2} damage.")); } } } private static Vector3 SnapToGround(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 val = pos + Vector3.up * 50f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 200f, ItemHelper.GroundLayerMask)) { return ((RaycastHit)(ref val2)).point + Vector3.up * 0.1f; } return pos; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BearPrepareHomingMessage : NetworkMessage { } public static class BearPrepareHomingMessageSerialization { public static void WriteBearPrepareHomingMessage(NetworkWriter writer, BearPrepareHomingMessage msg) { } public static BearPrepareHomingMessage ReadBearPrepareHomingMessage(NetworkReader reader) { return default(BearPrepareHomingMessage); } } public class BearTargetSelector { private PlayerInfo _lockedTarget; private float _lockTimer; private PlayerInfo _aggroTarget; private float _aggroTimer; private static float LockDuration => ModConfig.Bear.TargetLockDuration.Value; private static float StealDistanceThreshold => ModConfig.Bear.TargetStealThreshold.Value; private static float AbandonDistance => ModConfig.Bear.TargetAbandonDistance.Value; private static float AggroStealThreshold => ModConfig.Bear.AggroStealThreshold.Value; private static float AggroDuration => ModConfig.Bear.AggroDuration.Value; public PlayerInfo SelectTarget(Vector3 bearPos, List players) { //IL_010c: 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_00a2: 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) if (players == null || players.Count == 0) { _lockedTarget = null; return null; } _lockTimer -= Time.fixedDeltaTime; _aggroTimer -= Time.fixedDeltaTime; if (_aggroTimer <= 0f) { _aggroTarget = null; } if ((Object)(object)_lockedTarget != (Object)null) { if (!IsValidTarget(_lockedTarget)) { _lockedTarget = null; } else { float num = Vector3.Distance(bearPos, ((Component)_lockedTarget).transform.position); if (num > AbandonDistance) { _lockedTarget = null; } else if (_lockTimer <= 0f) { TryStealLock(bearPos, players, num); _lockTimer = LockDuration; } } } if ((Object)(object)_lockedTarget == (Object)null) { _lockedTarget = GetNearest(bearPos, players); _lockTimer = LockDuration; } return _lockedTarget; } public void NotifyHitBy(PlayerInfo attacker) { if (!((Object)(object)attacker == (Object)null)) { _aggroTarget = attacker; _aggroTimer = AggroDuration; } } public void ClearLock() { _lockedTarget = null; _lockTimer = 0f; } private void TryStealLock(Vector3 bearPos, List players, float distToLocked) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0041: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_aggroTarget != (Object)null && (Object)(object)_aggroTarget != (Object)(object)_lockedTarget && IsValidTarget(_aggroTarget)) { float num = Vector3.Distance(bearPos, ((Component)_aggroTarget).transform.position); if (distToLocked - num > AggroStealThreshold) { _lockedTarget = _aggroTarget; return; } } PlayerInfo nearest = GetNearest(bearPos, players); float num2 = Vector3.Distance(bearPos, ((Component)nearest).transform.position); if ((Object)(object)nearest != (Object)(object)_lockedTarget && distToLocked - num2 > StealDistanceThreshold) { _lockedTarget = nearest; } } private static PlayerInfo GetNearest(Vector3 bearPos, List players) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) PlayerInfo result = null; float num = float.MaxValue; foreach (PlayerInfo player in players) { if (IsValidTarget(player)) { float num2 = Vector3.Distance(bearPos, ((Component)player).transform.position); if (num2 < num) { num = num2; result = player; } } } return result; } private static bool IsValidTarget(PlayerInfo p) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 if ((Object)(object)p == (Object)null || (Object)(object)((Component)p).gameObject == (Object)null) { return false; } if (!((Component)p).gameObject.activeInHierarchy) { return false; } if (!ModConfig.Bear.AttackFinishedPlayers.Value && (Object)(object)p.AsGolfer != (Object)null && (int)p.AsGolfer.MatchResolution == 1) { return false; } return true; } } public class BlackHoleGrenadeBehaviour : MonoBehaviour { private enum Phase { Flying, Suck, Done } public PlayerInfo ThrowerInfo; public ItemUseId ItemUseId; public float GraceTime = 0.35f; public float SuckDuration = 6f; public float SuckRadius = 35f; public float SuckForce = 8f; public float MaxSuckForce = 40f; public float SpitForce = 35f; public float StickRadius = 0.55f; private Phase _phase = Phase.Flying; private Rigidbody _rb; private float _elapsed; private float _suckElapsed; private bool _landedMessageSent; private readonly HashSet _seenRigidbodies = new HashSet(); private void Start() { if (!NetworkServer.active) { ((Behaviour)this).enabled = false; return; } _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb != (Object)null) { _rb.useGravity = true; _rb.isKinematic = false; _rb.freezeRotation = false; } } private void FixedUpdate() { if (NetworkServer.active) { _elapsed += Time.fixedDeltaTime; switch (_phase) { case Phase.Flying: UpdateFlying(); break; case Phase.Suck: UpdateSuck(); break; case Phase.Done: break; } } } private void UpdateFlying() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (_elapsed < GraceTime) { return; } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, StickRadius * 0.7f, ItemHelper.GroundLayerMask, (QueryTriggerInteraction)1); Collider[] array2 = array; foreach (Collider val in array2) { if (!((Component)val).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)val).transform == (Object)(object)((Component)this).transform)) { Land(); break; } } } private void OnCollisionEnter(Collision collision) { if (_phase == Phase.Flying && (ItemHelper.GroundLayerMask & (1 << collision.gameObject.layer)) != 0) { Land(); } } private void Land() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) _phase = Phase.Suck; if ((Object)(object)_rb != (Object)null) { _rb.linearVelocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; _rb.isKinematic = true; _rb.detectCollisions = false; } IssaPluginPlugin.Log.LogInfo((object)$"[BlackHoleGrenade] Landed at {((Component)this).transform.position:F1} — starting suction."); } private void UpdateSuck() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0079: 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) if (!_landedMessageSent) { _landedMessageSent = true; NetworkIdentity component = ((Component)this).GetComponent(); NetworkServer.SendToAll(new BlackHoleGrenadeLandedMessage { BlackHoleNetId = (((Object)(object)component != (Object)null) ? component.netId : 0u), BlackHolePosition = new Vector3(((Component)this).transform.position.x, ((Component)this).transform.position.y + 5f, ((Component)this).transform.position.z), ThrowerInfo = ThrowerInfo, SuckDuration = SuckDuration, SuckRadius = SuckRadius, SuckForce = SuckForce, MaxSuckForce = MaxSuckForce }, 0, false); } ApplySuctionToNonPlayers(); _suckElapsed += Time.fixedDeltaTime; if (_suckElapsed >= SuckDuration) { Spit(); } } private void ApplySuctionToNonPlayers() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) //IL_0015: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(position.x, position.y + 5f, position.z); Collider[] array = Physics.OverlapSphere(val, SuckRadius, -5, (QueryTriggerInteraction)1); _seenRigidbodies.Clear(); Collider[] array2 = array; foreach (Collider val2 in array2) { if (((Component)val2).transform.IsChildOf(((Component)this).transform) || (Object)(object)((Component)val2).transform == (Object)(object)((Component)this).transform || (Object)(object)((Component)val2).GetComponentInParent() != (Object)null || (!ModConfig.BlackHoleGrenade.AffectsGolfBalls.Value && (Object)(object)((Component)val2).GetComponentInParent() != (Object)null)) { continue; } GolfCartInfo componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.NetworkdriverSeatReserver != (Object)null) { continue; } Rigidbody attachedRigidbody = val2.attachedRigidbody; if ((Object)(object)attachedRigidbody == (Object)null || _seenRigidbodies.Contains(attachedRigidbody)) { continue; } _seenRigidbodies.Add(attachedRigidbody); Vector3 val3 = val - attachedRigidbody.position; float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude < 0.01f)) { float num = 1f; if ((Object)(object)((Component)val2).GetComponentInParent() != (Object)null) { num = ModConfig.BlackHoleGrenade.BonusGolfCartForceMultiplier.Value; } float num2 = 1f - magnitude / SuckRadius; num2 *= num2; float num3 = Mathf.Lerp(SuckForce, MaxSuckForce, num2) * num; attachedRigidbody.AddForce(((Vector3)(ref val3)).normalized * num3, (ForceMode)5); ((Component)attachedRigidbody).GetComponent()?.NotifyBlackHoleSuction(); } } } public void Spit() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) if (_phase == Phase.Done) { return; } _phase = Phase.Done; Vector3 position = ((Component)this).transform.position; IssaPluginPlugin.Log.LogInfo((object)$"[BlackHoleGrenade] Spit phase at {position:F1} — ejecting objects."); Collider[] array = Physics.OverlapSphere(position, SuckRadius, -5, (QueryTriggerInteraction)1); _seenRigidbodies.Clear(); Collider[] array2 = array; foreach (Collider val in array2) { if (!((Component)val).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)val).transform == (Object)(object)((Component)this).transform) && !((Object)(object)((Component)val).GetComponentInParent() != (Object)null) && (ModConfig.BlackHoleGrenade.AffectsGolfBalls.Value || !((Object)(object)((Component)val).GetComponentInParent() != (Object)null))) { Rigidbody attachedRigidbody = val.attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null) && !_seenRigidbodies.Contains(attachedRigidbody)) { _seenRigidbodies.Add(attachedRigidbody); Vector3 val2 = Random.onUnitSphere; val2.y = Mathf.Abs(val2.y) + 0.5f; val2 = ((Vector3)(ref val2)).normalized; ((Component)attachedRigidbody).GetComponent()?.NotifyBlackHoleSpitLaunch(); attachedRigidbody.linearVelocity = val2 * SpitForce; } } } NetworkIdentity component = ((Component)this).GetComponent(); NetworkServer.SendToAll(new BlackHoleGrenadeSpitMessage { BlackHoleNetId = (((Object)(object)component != (Object)null) ? component.netId : 0u), BlackHolePosition = position, SpitRadius = SuckRadius, SpitForce = SpitForce, ThrowerInfo = ThrowerInfo, ItemUseId = ItemUseId, BlackHoleGrenadeSpitVfxScale = ModConfig.BlackHoleGrenade.SpitVfxScale.Value }, 0, false); IssaPluginPlugin.Log.LogInfo((object)"[BlackHoleGrenade] Spit complete — destroying."); NetworkServer.Destroy(((Component)this).gameObject); } } public static class BlackHoleGrenadeItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class BlackHoleGrenadeItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.BlackHoleGrenadeItemType; public override string DisplayName => "Black Hole Grenade"; public override string[] ConsoleAliases => new string[3] { "black_hole_grenade", "blackhole", "blackholegrenade" }; public override Sprite Icon => AssetLoader.BlackHoleGrenadeIcon; public override GameObject HeldModelPrefab => AssetLoader.BlackHoleGrenadePrefab; public override int MaxUses => (int)ModConfig.BlackHoleGrenade.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.BlackHoleGrenade.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnEquip(PlayerInventory inventory) { //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) StickyGrenadeTrajectoryPreview component = ((Component)inventory).GetComponent(); if ((Object)(object)component == (Object)null) { component = ((Component)inventory).gameObject.AddComponent(); component.TargetItemType = ItemRegistry.BlackHoleGrenadeItemType; component.ThrowSpeed = () => ModConfig.BlackHoleGrenade.ThrowSpeed.Value; component.LobAngle = () => ModConfig.BlackHoleGrenade.LobAngle.Value; } } public override void OnUse(PlayerInventory inventory) { BlackHoleGrenadeNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { component.ClientThrow(); } else { IssaPluginPlugin.Log.LogError((object)"[BlackHoleGrenade] No BlackHoleGrenadeNetworkBridge on player."); } } } public struct BlackHoleGrenadeThrowMessage : NetworkMessage { public Vector3 ThrowOrigin; public Vector3 ThrowVelocity; } public static class BlackHoleGrenadeThrowMessageSerialization { public static void WriteBlackHoleGrenadeThrowMessage(NetworkWriter writer, BlackHoleGrenadeThrowMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.ThrowOrigin); NetworkWriterExtensions.WriteVector3(writer, msg.ThrowVelocity); } public static BlackHoleGrenadeThrowMessage ReadBlackHoleGrenadeThrowMessage(NetworkReader reader) { //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_0018: 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) return new BlackHoleGrenadeThrowMessage { ThrowOrigin = NetworkReaderExtensions.ReadVector3(reader), ThrowVelocity = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct BlackHoleGrenadeLandedMessage : NetworkMessage { public uint BlackHoleNetId; public Vector3 BlackHolePosition; public PlayerInfo ThrowerInfo; public float SuckDuration; public float SuckRadius; public float SuckForce; public float MaxSuckForce; } public static class BlackHoleGrenadeLandedMessageSerialization { public static void WriteBlackHoleGrenadeLandedMessage(NetworkWriter writer, BlackHoleGrenadeLandedMessage msg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.BlackHoleNetId); NetworkWriterExtensions.WriteVector3(writer, msg.BlackHolePosition); NetworkWriterExtensions.WriteNetworkBehaviour(writer, (NetworkBehaviour)(object)msg.ThrowerInfo); NetworkWriterExtensions.WriteFloat(writer, msg.SuckDuration); NetworkWriterExtensions.WriteFloat(writer, msg.SuckRadius); NetworkWriterExtensions.WriteFloat(writer, msg.SuckForce); NetworkWriterExtensions.WriteFloat(writer, msg.MaxSuckForce); } public static BlackHoleGrenadeLandedMessage ReadBlackHoleGrenadeLandedMessage(NetworkReader reader) { //IL_0018: 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) return new BlackHoleGrenadeLandedMessage { BlackHoleNetId = NetworkReaderExtensions.ReadUInt(reader), BlackHolePosition = NetworkReaderExtensions.ReadVector3(reader), ThrowerInfo = NetworkReaderExtensions.ReadNetworkBehaviour(reader), SuckDuration = NetworkReaderExtensions.ReadFloat(reader), SuckRadius = NetworkReaderExtensions.ReadFloat(reader), SuckForce = NetworkReaderExtensions.ReadFloat(reader), MaxSuckForce = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct BlackHoleGrenadeSpitMessage : NetworkMessage { public uint BlackHoleNetId; public Vector3 BlackHolePosition; public float SpitRadius; public float SpitForce; public PlayerInfo ThrowerInfo; public ItemUseId ItemUseId; public float BlackHoleGrenadeSpitVfxScale; } public static class BlackHoleGrenadeSpitMessageSerialization { public static void WriteBlackHoleGrenadeSpitMessage(NetworkWriter writer, BlackHoleGrenadeSpitMessage msg) { //IL_0010: 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) NetworkWriterExtensions.WriteUInt(writer, msg.BlackHoleNetId); NetworkWriterExtensions.WriteVector3(writer, msg.BlackHolePosition); NetworkWriterExtensions.WriteFloat(writer, msg.SpitRadius); NetworkWriterExtensions.WriteFloat(writer, msg.SpitForce); NetworkWriterExtensions.WriteNetworkBehaviour(writer, (NetworkBehaviour)(object)msg.ThrowerInfo); writer.Write(msg.ItemUseId); writer.Write(msg.BlackHoleGrenadeSpitVfxScale); } public static BlackHoleGrenadeSpitMessage ReadBlackHoleGrenadeSpitMessage(NetworkReader reader) { //IL_0018: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) return new BlackHoleGrenadeSpitMessage { BlackHoleNetId = NetworkReaderExtensions.ReadUInt(reader), BlackHolePosition = NetworkReaderExtensions.ReadVector3(reader), SpitRadius = NetworkReaderExtensions.ReadFloat(reader), SpitForce = NetworkReaderExtensions.ReadFloat(reader), ThrowerInfo = NetworkReaderExtensions.ReadNetworkBehaviour(reader), ItemUseId = reader.Read(), BlackHoleGrenadeSpitVfxScale = NetworkReaderExtensions.ReadFloat(reader) }; } } public class BlackHoleGrenadeNetworkBridge : NetworkBridgeBase { private static readonly Dictionary s_activeSuctions = new Dictionary(); private static readonly Dictionary s_activeVfx = new Dictionary(); public void ServerHandleThrow(Vector3 throwOrigin, Vector3 throwVelocity) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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) PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[BlackHoleGrenade] No PlayerInventory on bridge object."); return; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.BlackHoleGrenadeItemType) { IssaPluginPlugin.Log.LogWarning((object)"[BlackHoleGrenade] Player does not have BlackHoleGrenade equipped."); return; } if ((Object)(object)AssetLoader.BlackHoleGrenadePrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[BlackHoleGrenade] Grenade prefab not loaded — cannot throw."); return; } ItemHelper.ConsumeEquippedItem(component); float value = ModConfig.BlackHoleGrenade.MaxThrowSpeed.Value; Vector3 linearVelocity = Vector3.ClampMagnitude(throwVelocity, value); GameObject val = Object.Instantiate(AssetLoader.BlackHoleGrenadePrefab, throwOrigin, Quaternion.LookRotation(((Vector3)(ref linearVelocity)).normalized, Vector3.up)); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[BlackHoleGrenade] Grenade prefab failed to instantiate."); return; } Rigidbody component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.useGravity = true; component2.isKinematic = false; component2.linearVelocity = linearVelocity; Vector3 val2 = Vector3.Cross(((Vector3)(ref linearVelocity)).normalized, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.right; } component2.angularVelocity = val3 * 10f; } NetworkServer.Spawn(val, (NetworkConnectionToClient)null); PlayerInfo playerInfo = component.PlayerInfo; ItemUseId itemUseId = default(ItemUseId); ((ItemUseId)(ref itemUseId))..ctor(playerInfo.PlayerId.Guid, BlackHoleGrenadeItem.NextUseIndex(), (ItemType)7, false); BlackHoleGrenadeBehaviour blackHoleGrenadeBehaviour = val.AddComponent(); blackHoleGrenadeBehaviour.ThrowerInfo = playerInfo; blackHoleGrenadeBehaviour.ItemUseId = itemUseId; blackHoleGrenadeBehaviour.GraceTime = ModConfig.BlackHoleGrenade.GraceTime.Value; blackHoleGrenadeBehaviour.SuckDuration = ModConfig.BlackHoleGrenade.SuckDuration.Value; blackHoleGrenadeBehaviour.SuckRadius = ModConfig.BlackHoleGrenade.SuckRadius.Value; blackHoleGrenadeBehaviour.SuckForce = ModConfig.BlackHoleGrenade.SuckForce.Value; blackHoleGrenadeBehaviour.MaxSuckForce = ModConfig.BlackHoleGrenade.MaxSuckForce.Value; blackHoleGrenadeBehaviour.SpitForce = ModConfig.BlackHoleGrenade.SpitForce.Value; IssaPluginPlugin.Log.LogInfo((object)($"[BlackHoleGrenade] Grenade thrown from {throwOrigin} " + $"velocity={((Vector3)(ref linearVelocity)).magnitude:F1} m/s")); } public void ClientThrow() { //IL_0030: 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_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) //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[BlackHoleGrenade] No main camera for throw direction."); return; } Vector3 forward = ((Component)main).transform.forward; Vector3 val = ((Component)main).transform.position + forward * 1.2f + Vector3.up * 0.3f; Vector3 val2 = forward + Vector3.up * ModConfig.BlackHoleGrenade.LobAngle.Value; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 throwVelocity = normalized * ModConfig.BlackHoleGrenade.ThrowSpeed.Value; NetworkClient.Send(new BlackHoleGrenadeThrowMessage { ThrowOrigin = val, ThrowVelocity = throwVelocity }, 0); IssaPluginPlugin.Log.LogInfo((object)($"[BlackHoleGrenade] Client throw: origin={val} " + $"speed={((Vector3)(ref throwVelocity)).magnitude:F1}")); } public static void HandleBlackHoleGrenadeLanded(BlackHoleGrenadeLandedMessage msg) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null) { return; } StopSuction(msg.BlackHoleNetId); if ((Object)(object)AssetLoader.BlackHoleVfxPrefab != (Object)null) { GameObject value = Object.Instantiate(AssetLoader.BlackHoleVfxPrefab, msg.BlackHolePosition, Quaternion.identity); s_activeVfx[msg.BlackHoleNetId] = value; } if (!ModConfig.BlackHoleGrenade.ExcludeThrower.Value || !((Object)(object)localPlayerInfo == (Object)(object)msg.ThrowerInfo)) { PlayerMovement movement = localPlayerInfo.Movement; if (!((Object)(object)movement == (Object)null)) { Coroutine item = ((MonoBehaviour)movement).StartCoroutine(SuctionCoroutine(msg.BlackHoleNetId, msg.BlackHolePosition, msg.ThrowerInfo, msg.SuckRadius, msg.SuckForce, msg.MaxSuckForce, msg.SuckDuration)); s_activeSuctions[msg.BlackHoleNetId] = (item, movement); IssaPluginPlugin.Log.LogInfo((object)$"[BlackHoleGrenade] Client: suction started (netId={msg.BlackHoleNetId})."); } } } public static void HandleBlackHoleGrenadeSpit(BlackHoleGrenadeSpitMessage msg) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00f8: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) StopSuction(msg.BlackHoleNetId); PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null) { return; } if (ModConfig.BlackHoleGrenade.ExcludeThrower.Value && (Object)(object)localPlayerInfo == (Object)(object)msg.ThrowerInfo) { PlaySpitVfx(msg.BlackHolePosition); return; } if (ModConfig.BlackHoleGrenade.ElectroShieldPreventsEffect.Value && localPlayerInfo.IsElectromagnetShieldActive) { PlaySpitVfx(msg.BlackHolePosition); return; } float num = Vector3.Distance(((Component)localPlayerInfo).transform.position, msg.BlackHolePosition); if (num > msg.SpitRadius) { PlaySpitVfx(msg.BlackHolePosition); return; } PlayerMovement movement = localPlayerInfo.Movement; Rigidbody componentInParent = ((Component)localPlayerInfo).GetComponentInParent(); GolfCartSeat activeGolfCartSeat = localPlayerInfo.ActiveGolfCartSeat; Rigidbody val = ((((GolfCartSeat)(ref activeGolfCartSeat)).IsValid() && (Object)(object)activeGolfCartSeat.golfCart != (Object)null) ? activeGolfCartSeat.golfCart.AsEntity.Rigidbody : componentInParent); if ((Object)(object)movement == (Object)null || (Object)(object)val == (Object)null) { PlaySpitVfx(msg.BlackHolePosition); return; } Vector3 val2 = Random.onUnitSphere; val2.y = Mathf.Abs(val2.y) + 0.5f; val2 = ((Vector3)(ref val2)).normalized; Vector3 val3 = val2 * msg.SpitForce; val.AddForce(val3, (ForceMode)2); GolfCartSeat activeGolfCartSeat2 = localPlayerInfo.ActiveGolfCartSeat; if (!((GolfCartSeat)(ref activeGolfCartSeat2)).IsValid()) { bool flag = default(bool); movement.TryKnockOut(msg.ThrowerInfo, (KnockoutType)7, false, ((Component)movement).transform.InverseTransformPoint(msg.BlackHolePosition), num, val3, (ElectromagnetShieldHitBlockType)0, msg.ItemUseId, false, true, ref flag, ref flag); } PlaySpitVfx(msg.BlackHolePosition); IssaPluginPlugin.Log.LogInfo((object)($"[BlackHoleGrenade] Client: spit applied (netId={msg.BlackHoleNetId}, " + $"dir={val2:F2}, force={msg.SpitForce:F1}).")); } private static IEnumerator SuctionCoroutine(uint blackHoleNetId, Vector3 blackHolePos, PlayerInfo throwerInfo, float radius, float baseForce, float maxForce, float duration) { //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) float elapsed = 0f; float timeout = duration + 3f; float knockdownCooldown = 0f; bool _ = default(bool); while (elapsed < timeout) { PlayerInfo localInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localInfo == (Object)null) { yield break; } Rigidbody rb = ((Component)localInfo).GetComponentInParent(); if (ModConfig.BlackHoleGrenade.ElectroShieldPreventsEffect.Value && localInfo.IsElectromagnetShieldActive) { elapsed += Time.fixedDeltaTime; yield return (object)new WaitForFixedUpdate(); continue; } Vector3 playerPos = (((Object)(object)rb != (Object)null) ? rb.position : ((Component)localInfo).transform.position); Vector3 toCenter = blackHolePos - playerPos; float dist = ((Vector3)(ref toCenter)).magnitude; GolfCartSeat seat = localInfo.ActiveGolfCartSeat; bool inCart = ((GolfCartSeat)(ref seat)).IsValid(); if (dist < radius && dist > 0.01f) { Rigidbody forceTarget = ((inCart && (Object)(object)seat.golfCart != (Object)null) ? seat.golfCart.AsEntity.Rigidbody : rb); if ((Object)(object)forceTarget != (Object)null) { Vector3 dir = ((Vector3)(ref toCenter)).normalized; float t = 1f - dist / radius; t *= t; float targetSpeed = Mathf.Lerp(baseForce, maxForce, t); float currentTowardCenter = Vector3.Dot(forceTarget.linearVelocity, dir); if (currentTowardCenter < targetSpeed) { forceTarget.AddForce(dir * (targetSpeed - currentTowardCenter), (ForceMode)2); } } } if (dist >= radius || dist <= 0.01f) { elapsed += Time.fixedDeltaTime; yield return (object)new WaitForFixedUpdate(); continue; } float knockdownRadius = ModConfig.BlackHoleGrenade.KnockdownRadius.Value; knockdownCooldown -= Time.fixedDeltaTime; if (knockdownRadius > 0f && dist < knockdownRadius && knockdownCooldown <= 0f && (Object)(object)localInfo.Movement != (Object)null && !inCart) { PlayerMovement movement = localInfo.Movement; float tKnock = 1f - dist / radius; tKnock *= tKnock; float knockSpeed = Mathf.Min(Mathf.Lerp(baseForce, maxForce, tKnock), 8f); Vector3 knockVelocity = ((Vector3)(ref toCenter)).normalized * knockSpeed; movement.TryKnockOut(throwerInfo, (KnockoutType)7, false, ((Component)movement).transform.InverseTransformPoint(blackHolePos), dist, knockVelocity, (ElectromagnetShieldHitBlockType)0, new ItemUseId(throwerInfo.PlayerId.Guid, BlackHoleGrenadeItem.NextUseIndex(), (ItemType)7, false), false, true, ref _, ref _); knockdownCooldown = 3f; } elapsed += Time.fixedDeltaTime; yield return (object)new WaitForFixedUpdate(); seat = default(GolfCartSeat); } s_activeSuctions.Remove(blackHoleNetId); } private static void StopSuction(uint netId) { if (s_activeSuctions.TryGetValue(netId, out (Coroutine, PlayerMovement) value)) { if (value.Item1 != null && (Object)(object)value.Item2 != (Object)null) { ((MonoBehaviour)value.Item2).StopCoroutine(value.Item1); } s_activeSuctions.Remove(netId); } if (s_activeVfx.TryGetValue(netId, out var value2)) { if ((Object)(object)value2 != (Object)null) { Object.Destroy((Object)(object)value2); } s_activeVfx.Remove(netId); } } private static void PlaySpitVfx(Vector3 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_001d: 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) VfxManager.PlayPooledVfxLocalOnly((VfxType)37, position, Quaternion.identity, Vector3.one * ModConfig.BlackHoleGrenade.SpitVfxScale.Value, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, position, 1f, 1f); } public override void ServerHoleCleanup() { IssaPluginPlugin.Log.LogInfo((object)"[BlackHoleGrenade] ServerHoleCleanup called (no persistent state to clear)."); } public override void ClientHoleCleanup() { } } public class CustomHittable : MonoBehaviour { public int HitCount { get; protected set; } public int HitsRequired { get; protected set; } public Action OnHitsExceeded { get; set; } public Action OnHit { get; set; } } public abstract class CustomItemDefinition { private readonly float?[] _serverPoolWeights = new float?[6]; public abstract ItemType ItemType { get; } public abstract string DisplayName { get; } public abstract string[] ConsoleAliases { get; } public abstract Sprite Icon { get; } public abstract GameObject HeldModelPrefab { get; } public virtual bool UseRocketIconFallback => true; public abstract int MaxUses { get; } public abstract Key GiveKey { get; } public abstract float DefaultPoolWeight { get; } public virtual string ConfigKeyPrefix => Regex.Replace(DisplayName, "[^A-Za-z0-9]", ""); public virtual bool Enabled { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ModConfig.GetItemEnabled(ItemType); } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ModConfig.SetItemEnabled(ItemType, value); } } public virtual EquipmentType EquipmentType => (EquipmentType)9; public virtual ItemType AnimatorItemType => (ItemType)10; public virtual ItemType AnimatorChangedItemType => (ItemType)10; public virtual bool ShouldEatInputOnUse => true; public virtual bool UseResult => true; public virtual float GetDefaultPoolWeight(int poolIndex) { return DefaultPoolWeight; } internal void SetServerPoolWeight(int poolIndex, float weight) { _serverPoolWeights[poolIndex] = weight; } internal void ResetServerWeights() { Array.Clear(_serverPoolWeights, 0, 6); } public float GetPoolWeight(int poolIndex) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if ((uint)poolIndex < 6u && _serverPoolWeights[poolIndex].HasValue) { return _serverPoolWeights[poolIndex].Value; } return ModConfig.GetItemPoolWeight(ItemType, poolIndex); } public abstract void OnUse(PlayerInventory inventory); public virtual void OnEquip(PlayerInventory inventory) { } } public class CustomSpawnedRocket : MonoBehaviour { } public static class DebugDummies { internal static readonly List DebugDummiesList = new List(); public static void ToggleDebugDummies() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) if (DebugDummiesList.Count > 0) { foreach (GameObject debugDummies in DebugDummiesList) { if ((Object)(object)debugDummies != (Object)null) { Object.Destroy((Object)(object)debugDummies); } } DebugDummiesList.Clear(); IssaPluginPlugin.Log.LogInfo((object)"[Missile] Debug dummies removed."); return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; Vector3 val = ((localPlayerInfo != null) ? ((Component)localPlayerInfo).transform.position : Vector3.zero); Vector3[] array = (Vector3[])(object)new Vector3[5] { new Vector3(10f, 0f, 10f), new Vector3(-12f, 0f, 5f), new Vector3(5f, 0f, -15f), new Vector3(-8f, 0f, -8f), new Vector3(18f, 0f, 0f) }; Vector3[] array2 = array; foreach (Vector3 val2 in array2) { GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)1); ((Object)val3).name = "MissileDummy"; val3.transform.position = val + val2; val3.transform.localScale = new Vector3(0.6f, 1f, 0.6f); Collider component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val3.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.material.color = new Color(1f, 0.3f, 0.3f, 0.7f); } DebugDummiesList.Add(val3); } IssaPluginPlugin.Log.LogInfo((object)$"[Missile] Spawned {array.Length} debug dummies near {val}."); } } public class DonutClientSetup : MonoBehaviour { private void Awake() { if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } } } public class DonutCrashBehaviour : MonoBehaviour { public Rigidbody Rigidbody; public DonutNetworkBridge DonutNetworkBridge; private bool _impacted; private float _lifetime; private bool _initialForcesApplied; private const float ImpactProximity = 0.25f; private const float MaxLifetime = 15f; private void Start() { } private void FixedUpdate() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008c: 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_0098: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (_impacted) { return; } if (!_initialForcesApplied && (Object)(object)Rigidbody != (Object)null) { Rigidbody.isKinematic = false; Rigidbody.useGravity = true; Rigidbody.freezeRotation = false; Rigidbody.AddForce(Vector3.down * ModConfig.Donut.CrashDownwardForce.Value); Vector3 val = Random.insideUnitSphere * ModConfig.Donut.CrashTorque.Value; Rigidbody.AddTorque(val, (ForceMode)1); _initialForcesApplied = true; } _lifetime += Time.fixedDeltaTime; if (_lifetime >= 15f) { Impact(); return; } if (Physics.Raycast(((Component)this).transform.position, Vector3.down, 0.25f)) { Impact(); return; } if ((Object)(object)Rigidbody != (Object)null) { Vector3 linearVelocity = Rigidbody.linearVelocity; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (magnitude > 0.1f && linearVelocity.y < 0f) { float num = magnitude * Time.fixedDeltaTime + 0.25f; if (Physics.Raycast(((Component)this).transform.position, ((Vector3)(ref linearVelocity)).normalized, num)) { Impact(); return; } } } if (((Component)this).transform.position.y <= 0f) { Impact(); } } private void Impact() { //IL_0027: 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) //IL_0049: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0095: Unknown result type (might be due to invalid IL or missing references) if (!_impacted) { _impacted = true; IssaPluginPlugin.Log.LogInfo((object)$"[DonutCrash] Impact at {((Component)this).transform.position}."); VfxManager.PlayPooledVfxLocalOnly((VfxType)37, ((Component)this).transform.position, Quaternion.identity, Vector3.one * ModConfig.Donut.CrashExplosionScale.Value, 0u, false, 0f, (Action)null); if ((Object)(object)AssetLoader.ConfettiBlastRainbow != (Object)null) { GameObject val = Object.Instantiate(AssetLoader.ConfettiBlastRainbow, ((Component)this).transform.position, Quaternion.identity); Object.Destroy((Object)(object)val, 3f); } CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, ((Component)this).transform.position, 1f, 1f); DonutNetworkBridge.ServerSpawnImpactRocket(((Component)this).transform.position); DonutNetworkBridge.ServerEndDonut(shouldCrash: false); Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class DonutFlyBehaviour : CustomHittable { public Vector3 MoveInput; private Rigidbody _rb; public GameObject DonutLaserTarget; private void Start() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb != (Object)null) { _rb.useGravity = false; _rb.freezeRotation = true; } ((Component)this).gameObject.layer = LayerMask.NameToLayer("Donut"); DonutLaserTarget = new GameObject("Donut_LaserTarget"); DonutLaserTarget.transform.SetParent(((Component)this).transform); } private void FixedUpdate() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_010a: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_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_0182: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rb == (Object)null)) { float value = ModConfig.Donut.Speed.Value; float value2 = ModConfig.Donut.Altitude.Value; float value3 = ModConfig.Donut.TerrainFollowSpeed.Value; Vector3 val = ((Component)this).transform.position + Vector3.down * 5f; RaycastHit val2 = default(RaycastHit); float num; if (Physics.Raycast(val, Vector3.down, ref val2, 2100f, ItemHelper.GroundLayerMask)) { num = ((RaycastHit)(ref val2)).point.y + value2; DonutLaserTarget.transform.position = ((RaycastHit)(ref val2)).point; } else { num = value2; } float num2 = (num - ((Component)this).transform.position.y) * value3; Vector3 val3 = new Vector3(MoveInput.x, 0f, MoveInput.z) * value; _rb.linearVelocity = new Vector3(val3.x, num2, val3.z); if (((Vector3)(ref MoveInput)).sqrMagnitude > 0.01f) { Quaternion val4 = Quaternion.LookRotation(new Vector3(MoveInput.x, 0f, MoveInput.z), Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val4, ModConfig.Donut.TurnSpeed.Value * Time.fixedDeltaTime); } } } } public class DonutHitReceiver : CustomHittable { public void Awake() { base.HitCount = 0; base.HitsRequired = 1; base.OnHit = (Action)Delegate.Combine(base.OnHit, new Action(OnDonutHit)); } private void OnDonutHit() { IssaPluginPlugin.Log.LogInfo((object)"[Donut] OnDonutHit called."); if (NetworkServer.active && base.HitsRequired > 0 && base.HitCount < base.HitsRequired) { base.HitCount++; IssaPluginPlugin.Log.LogInfo((object)$"[Donut] Rocket impact {base.HitCount}/{base.HitsRequired}."); if (base.HitCount >= base.HitsRequired) { IssaPluginPlugin.Log.LogInfo((object)"[Donut] Hit threshold reached — triggering mayday."); base.OnHitsExceeded?.Invoke(); } } } } public class DonutItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.DonutItemType; public override string DisplayName => "Donut"; public override string[] ConsoleAliases => new string[1] { "donut" }; public override Sprite Icon => AssetLoader.DonutIcon; public override GameObject HeldModelPrefab => AssetLoader.DonutHandheldPrefab; public override int MaxUses => (int)ModConfig.Donut.Uses.Value; public override float DefaultPoolWeight => 3f; public override Key GiveKey => ModConfig.Donut.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 0f, 0 => 0f, 2 => 1f, 3 => 2f, 5 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { DonutNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(DonutStartMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[Donut] No DonutNetworkBridge on player."); } } } public class DonutMarker : MonoBehaviour { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DonutStartMessage : NetworkMessage { } public struct DonutEndMessage : NetworkMessage { public bool ShouldCrash; } public struct DonutMoveMessage : NetworkMessage { public Vector3 WorldMoveDir; } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DonutFireLaserMessage : NetworkMessage { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DonutPrepareHomingMessage : NetworkMessage { } public struct DonutShotDownMessage : NetworkMessage { public Vector3 CrashDir; public float CrashSpeed; public Vector3 ImpactDir; public Vector3 TorqueImpulse; public override string ToString() { //IL_000f: 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_0039: Unknown result type (might be due to invalid IL or missing references) return $"DonutShotDownMessage[CrashDir={CrashDir},CrashSpeed={CrashSpeed},ImpactDir={ImpactDir},TorqueImpulse={TorqueImpulse}]"; } } public struct DonutBeginClientMessage : NetworkMessage { public uint DonutNetId; } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DonutEndClientMessage : NetworkMessage { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DonutBusyMessage : NetworkMessage { } public struct DonutLaserShootStartMessage : NetworkMessage { public Vector3 StartPosition; } public static class DonutMessageSerialization { public static void WriteDonutStartMessage(NetworkWriter w, DonutStartMessage m) { } public static DonutStartMessage ReadDonutStartMessage(NetworkReader r) { return default(DonutStartMessage); } public static void WriteDonutEndMessage(NetworkWriter w, DonutEndMessage m) { NetworkWriterExtensions.WriteBool(w, m.ShouldCrash); } public static DonutEndMessage ReadDonutEndMessage(NetworkReader r) { return new DonutEndMessage { ShouldCrash = NetworkReaderExtensions.ReadBool(r) }; } public static void WriteDonutMoveMessage(NetworkWriter w, DonutMoveMessage m) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(w, m.WorldMoveDir); } public static DonutMoveMessage ReadDonutMoveMessage(NetworkReader r) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new DonutMoveMessage { WorldMoveDir = NetworkReaderExtensions.ReadVector3(r) }; } public static void WriteDonutFireLaserMessage(NetworkWriter w, DonutFireLaserMessage m) { } public static DonutFireLaserMessage ReadDonutFireLaserMessage(NetworkReader r) { return default(DonutFireLaserMessage); } public static void WriteDonutPrepareHomingMessage(NetworkWriter w, DonutPrepareHomingMessage m) { } public static DonutPrepareHomingMessage ReadDonutPrepareHomingMessage(NetworkReader r) { return default(DonutPrepareHomingMessage); } public static void WriteDonutBeginClientMessage(NetworkWriter w, DonutBeginClientMessage m) { NetworkWriterExtensions.WriteUInt(w, m.DonutNetId); } public static DonutBeginClientMessage ReadDonutBeginClientMessage(NetworkReader r) { return new DonutBeginClientMessage { DonutNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteDonutEndClientMessage(NetworkWriter w, DonutEndClientMessage m) { } public static DonutEndClientMessage ReadDonutEndClientMessage(NetworkReader r) { return default(DonutEndClientMessage); } public static void WriteDonutShotDownMessage(NetworkWriter writer, DonutShotDownMessage msg) { //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_002a: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.CrashDir); NetworkWriterExtensions.WriteFloat(writer, msg.CrashSpeed); NetworkWriterExtensions.WriteVector3(writer, msg.ImpactDir); NetworkWriterExtensions.WriteVector3(writer, msg.TorqueImpulse); } public static DonutShotDownMessage ReadDonutShotDownMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_002b: 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) return new DonutShotDownMessage { CrashDir = NetworkReaderExtensions.ReadVector3(reader), CrashSpeed = NetworkReaderExtensions.ReadFloat(reader), ImpactDir = NetworkReaderExtensions.ReadVector3(reader), TorqueImpulse = NetworkReaderExtensions.ReadVector3(reader) }; } public static void WriteDonutBusyMessage(NetworkWriter writer, DonutBusyMessage msg) { } public static DonutBusyMessage ReadDonutBusyMessage(NetworkReader reader) { return default(DonutBusyMessage); } public static void WriteDonutLaserShootStartMessage(NetworkWriter writer, DonutLaserShootStartMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.StartPosition); } public static DonutLaserShootStartMessage ReadDonutLaserShootStartMessage(NetworkReader reader) { //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) return new DonutLaserShootStartMessage { StartPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public class DonutNetworkBridge : NetworkBridgeBase { private readonly struct DonutCameraState { public readonly OrbitCameraModule OrbitModule; public readonly float SavedPitch; public readonly float SavedYaw; public readonly bool SavedDisablePhysics; public DonutCameraState(OrbitCameraModule module, float pitch, float yaw, bool disablePhysics) { OrbitModule = module; SavedPitch = pitch; SavedYaw = yaw; SavedDisablePhysics = disablePhysics; } } private static Transform _donutLaserTarget = null; public static readonly Vector3 DonutLaserTargetVector = new Vector3(180150000f, 180150000f, 180150000f); private bool _serverSessionActive; private GameObject _serverDonut; private DonutFlyBehaviour _serverFlyBehaviour; private int _laserUsesRemaining; private int _laserUseIndex; private bool _laserPending; private float _lastLaserTime; private Coroutine _serverTimeout; public bool PendingDonutHoming; private bool _forceEnd; private bool _shotDown; private int _localLaserUsesRemaining; private float _localLastLaserTime; private bool _canMove; private const float InputSendInterval = 0.05f; private Vector3 _lastSentMoveDir; private float _moveSendTimer; public static GameObject ActiveDonut => GlobalSessionLock.Holder?._serverDonut; public static Transform DonutLaserTarget { get { return _donutLaserTarget; } set { _donutLaserTarget = value; } } public bool LocalSessionActive { get; private set; } public override void OnStopServer() { if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[Donut] Player disconnected during session — cleanup."); ForceServerCleanup(); } } public void ServerStartDonut() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) if (_serverSessionActive) { IssaPluginPlugin.Log.LogWarning((object)"[Donut] Session already active for this player."); return; } if (GlobalSessionLock.IsActive) { IssaPluginPlugin.Log.LogWarning((object)"[Donut] Another player's Donut is already active."); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(DonutBusyMessage), 0); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.DonutItemType) { IssaPluginPlugin.Log.LogWarning((object)"[Donut] Player does not have Donut item equipped."); return; } if ((Object)(object)AssetLoader.DonutPrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Donut] Donut prefab not loaded."); return; } ItemHelper.ConsumeEquippedItem(component); Vector3 val = ((Component)component.PlayerInfo).transform.position + Vector3.up * ModConfig.Donut.Altitude.Value; GameObject val2 = Object.Instantiate(AssetLoader.DonutPrefab, val, Quaternion.identity); _serverFlyBehaviour = val2.AddComponent(); DonutHitReceiver donutHitReceiver = val2.AddComponent(); Rigidbody component2 = val2.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = false; component2.useGravity = false; } donutHitReceiver.OnHitsExceeded = delegate { ServerDonutShotDown(); }; NetworkServer.Spawn(val2, (NetworkConnectionToClient)null); NetworkIdentity component3 = val2.GetComponent(); _serverDonut = val2; _serverSessionActive = true; GlobalSessionLock.TryAcquire(this); _laserUsesRemaining = (int)ModConfig.Donut.LaserUses.Value; _laserUseIndex = 0; _laserPending = false; _lastLaserTime = -999f; ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.DonutItemType, "Donut", component3.netId, ((NetworkBehaviour)this).netId); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new DonutBeginClientMessage { DonutNetId = component3.netId }, 0); _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerTimeoutRoutine()); IssaPluginPlugin.Log.LogInfo((object)"[Donut] Server session started."); } public void ServerEndDonut(bool shouldCrash) { if (_serverSessionActive) { if (!shouldCrash) { EndServerSession(); } else { ServerTriggerCrashBehaviour(); } } } public void ServerPrepareDonutRocket() { if (!((Object)(object)ActiveDonut == (Object)null)) { PendingDonutHoming = true; } } public void ServerMoveDonut(Vector3 worldMoveDir) { //IL_0034: 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) if (_serverSessionActive && !((Object)(object)_serverDonut == (Object)null) && (Object)(object)_serverFlyBehaviour != (Object)null) { _serverFlyBehaviour.MoveInput = worldMoveDir; } } public void ServerFireLaser() { if (_serverSessionActive && !((Object)(object)_serverDonut == (Object)null) && !_laserPending && _laserUsesRemaining > 0 && !(Time.time - _lastLaserTime < ModConfig.Donut.LaserCooldown.Value)) { _lastLaserTime = Time.time; ExecuteLaserFire(); } } public void ServerDonutShotDown() { IssaPluginPlugin.Log.LogInfo((object)"[Donut] Server Donut Shot Down sequence started."); NetworkServer.SendToAll(default(DonutShotDownMessage), 0, false); ServerTriggerCrashBehaviour(); } public void ServerTriggerCrashBehaviour() { Collider[] components = _serverDonut.GetComponents(); foreach (Collider val in components) { val.enabled = true; } if ((Object)(object)_serverFlyBehaviour != (Object)null) { ((Behaviour)_serverFlyBehaviour).enabled = false; } Rigidbody component = _serverDonut.GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = true; } DonutCrashBehaviour donutCrashBehaviour = _serverDonut.AddComponent(); donutCrashBehaviour.Rigidbody = component; donutCrashBehaviour.DonutNetworkBridge = this; } public void ServerSpawnImpactRocket(Vector3 position) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { Rocket val = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Donut] Rocket prefab failed to instantiate."); return; } ((Component)val).gameObject.AddComponent(); ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(component.PlayerInfo.PlayerId.Guid, int.MaxValue, (ItemType)7, false); val.ServerInitialize(component.PlayerInfo, (Hittable)null, val2); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ModConfig.Donut.CrashExplosionScale.Value); AC130Item.ServerExplodeRocket(val); } } public void ClientBeginDonut(uint donutNetId) { ((MonoBehaviour)this).StartCoroutine(RunLocalSession(donutNetId)); } public void ClientEndDonut(bool shotDown) { _forceEnd = true; _shotDown = shotDown; } public void ClientDonutBusy() { IssaPluginPlugin.Log.LogInfo((object)"[Donut] Donut is already in use by another player."); } public void ClientDonutStartShooting(Vector3 startPosition) { _localLaserUsesRemaining--; DonutOverlay.UpdateLaserUses(_localLaserUsesRemaining); DonutOverlay.TriggerLaserFlash(); } private void ExecuteLaserFire() { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) _laserPending = true; if (_serverSessionActive && (Object)(object)_serverDonut != (Object)null) { PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ItemUseId val = default(ItemUseId); ((ItemUseId)(ref val))..ctor(component.PlayerInfo.PlayerId.Guid, ++_laserUseIndex, (ItemType)10, false); OrbitalLaserManager.ServerActivateLaser((Hittable)null, DonutLaserTargetVector, component, val); _laserUsesRemaining--; } } NetworkServer.SendToAll(new DonutLaserShootStartMessage { StartPosition = DonutLaserTargetVector }, 0, false); _laserPending = false; } private void EndServerSession() { if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } _serverSessionActive = false; ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(DonutEndClientMessage), 0); if ((Object)(object)_serverDonut != (Object)null) { NetworkServer.Destroy(_serverDonut); _serverDonut = null; } _serverFlyBehaviour = null; ReleaseGlobalLock(); IssaPluginPlugin.Log.LogInfo((object)"[Donut] Server session ended."); } } public override void ServerHoleCleanup() { if (_serverSessionActive) { ForceServerCleanup(); } } public override void ClientHoleCleanup() { //IL_0028: 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) if (LocalSessionActive) { _forceEnd = true; DonutOverlay.SetActive(active: false, 0); LocalSessionActive = false; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); } } private void ForceServerCleanup() { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } if ((Object)(object)_serverDonut != (Object)null) { NetworkServer.Destroy(_serverDonut); _serverDonut = null; } _serverFlyBehaviour = null; _serverSessionActive = false; ReleaseGlobalLock(); } private static void ReleaseGlobalLock() { GlobalSessionLock.Release(); } public static void ForceReleaseGlobalLock() { IssaPluginPlugin.Log.LogWarning((object)"[Donut] ForceReleaseGlobalLock called — resetting session state."); GlobalSessionLock.Release(); } private IEnumerator ServerTimeoutRoutine() { yield return (object)new WaitForSeconds(ModConfig.Donut.Duration.Value + 10f); if (_serverSessionActive) { EndServerSession(); } } private static DonutCameraState SetupOrbitCamera(Transform donutTransform) { OrbitCameraModule val = default(OrbitCameraModule); CameraModuleController.TryGetOrbitModule(ref val); float pitch = ((val != null) ? val.Pitch : 0f); float yaw = ((val != null) ? val.Yaw : 0f); bool disablePhysics = val?.disablePhysics ?? false; if ((Object)(object)val != (Object)null) { val.SetSubject(donutTransform); val.SetPitch(ModConfig.Donut.CameraPitch.Value); val.SetDistanceAddition(ModConfig.Donut.CameraDistance.Value); val.disablePhysics = true; val.ForceUpdateModule(); } return new DonutCameraState(val, pitch, yaw, disablePhysics); } private static void TeardownOrbitCamera(DonutCameraState state) { if (!((Object)(object)state.OrbitModule == (Object)null)) { state.OrbitModule.SetDistanceAddition(0f); state.OrbitModule.disablePhysics = state.SavedDisablePhysics; PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { state.OrbitModule.SetSubject(((Component)localPlayerMovement).transform); } state.OrbitModule.SetPitch(state.SavedPitch); state.OrbitModule.SetYaw(state.SavedYaw); state.OrbitModule.ForceUpdateModule(); } } private bool ProcessDonutInput(OrbitCameraModule orbitModule, ref float cameraYaw) { //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_01e8: 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_01ef: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) Mouse current = Mouse.current; Keyboard current2 = Keyboard.current; if (!_canMove && Time.time - _localLastLaserTime >= ModConfig.Donut.LaserCooldown.Value) { _canMove = true; } if (current2 != null && ((ButtonControl)current2[(Key)1]).wasPressedThisFrame) { IssaPluginPlugin.Log.LogInfo((object)"[Donut] Donut cancelled by player."); _forceEnd = true; return false; } if (current != null) { float num = ((InputControl)(object)((Vector2Control)((Pointer)current).delta).x).ReadValue() * ModConfig.Donut.MouseSensitivity.Value; cameraYaw += num; if (cameraYaw >= 360f) { cameraYaw -= 360f; } if (cameraYaw < 0f) { cameraYaw += 360f; } if (orbitModule != null) { orbitModule.SetYaw(cameraYaw); } } if (orbitModule != null) { orbitModule.ForceUpdateModule(); } float num2 = 0f; float num3 = 0f; if (current2 != null && _canMove) { if (((ButtonControl)current2[(Key)37]).isPressed) { num2 += 1f; } if (((ButtonControl)current2[(Key)33]).isPressed) { num2 -= 1f; } if (((ButtonControl)current2[(Key)15]).isPressed) { num3 -= 1f; } if (((ButtonControl)current2[(Key)18]).isPressed) { num3 += 1f; } if (((ButtonControl)current2[(Key)60]).wasPressedThisFrame) { _forceEnd = true; } } Vector3 val = Vector3.zero; if (Mathf.Abs(num2) > 0.001f || Mathf.Abs(num3) > 0.001f) { Quaternion val2 = Quaternion.Euler(0f, cameraYaw, 0f); val = val2 * Vector3.forward * num2 + val2 * Vector3.right * num3; if (((Vector3)(ref val)).sqrMagnitude > 1f) { ((Vector3)(ref val)).Normalize(); } } Vector3 val3 = val - _lastSentMoveDir; bool flag = ((Vector3)(ref val3)).sqrMagnitude > 0.001f; _moveSendTimer -= Time.deltaTime; if (flag || _moveSendTimer <= 0f) { NetworkClient.Send(new DonutMoveMessage { WorldMoveDir = val }, 0); _lastSentMoveDir = val; _moveSendTimer = 0.05f; } if (current != null && current.leftButton.wasPressedThisFrame && _localLaserUsesRemaining > 0 && Time.time - _localLastLaserTime >= ModConfig.Donut.LaserCooldown.Value) { NetworkClient.Send(default(DonutFireLaserMessage), 0); _localLastLaserTime = Time.time; _canMove = false; } return true; } private IEnumerator RunLocalSession(uint donutNetId) { LocalSessionActive = true; _forceEnd = false; _shotDown = false; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Disable(); yield return null; float waited = 0f; NetworkIdentity donutIdentity = null; while (!NetworkClient.spawned.TryGetValue(donutNetId, out donutIdentity) && waited < 2f) { waited += Time.deltaTime; yield return null; } if ((Object)(object)donutIdentity == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Donut] Donut not found in spawned dict after wait."); DonutOverlay.SetActive(active: false, 0); LocalSessionActive = false; gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); yield break; } DonutCameraState cameraState = SetupOrbitCamera(((Component)donutIdentity).transform); float cameraYaw = cameraState.SavedYaw; _localLaserUsesRemaining = (int)ModConfig.Donut.LaserUses.Value; float sessionElapsed = 0f; float sessionDuration = ModConfig.Donut.Duration.Value; DonutOverlay.SetActive(active: true, _localLaserUsesRemaining); while (!_forceEnd && sessionElapsed < sessionDuration) { sessionElapsed += Time.deltaTime; if (!ProcessDonutInput(cameraState.OrbitModule, ref cameraYaw)) { break; } DonutOverlay.UpdateTimeRemaining(sessionDuration - sessionElapsed); yield return null; } if (!_shotDown) { NetworkClient.Send(new DonutMoveMessage { WorldMoveDir = Vector3.zero }, 0); NetworkClient.Send(new DonutEndMessage { ShouldCrash = true }, 0); } DonutOverlay.SetActive(active: false, 0); TeardownOrbitCamera(cameraState); gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); LocalSessionActive = false; IssaPluginPlugin.Log.LogInfo((object)"[Donut] Client session ended."); } } public class DroneBehaviour : MonoBehaviour { private enum Phase { Swarming, Diving } public Vector3 WanderCenter; public float WanderRadius = 40f; public float WanderSpeed = 25f; public float WanderTurnRate = 90f; public float AltitudeVariance = 10f; public float CircleTime = 5f; public float DiveSpeed = 30f; public float DiveAcceleration = 20f; public float HomingStopDistance = 15f; public float ArrivalRadius = 3f; public float ExplosionScale = 1.5f; public PlayerInfo ThrowerInfo; public ItemUseId ItemUseId; public bool FriendlyFire; public bool AttackFinishedPlayers; private Phase _phase = Phase.Swarming; private Rigidbody _rb; private float _noiseOffset; private Vector3 _heading; private float _swarmTimer; private const float NoiseTimeScale = 2.5f; private const float BoundaryRestoreWeight = 3f; private const float AltitudeRestoreWeight = 2f; private const float DroneCollisionRange = 2f; private Transform _diveTargetTransform; private Vector3 _homingTarget; private bool _homingActive; private float _currentDiveSpeed; private float _divingTimeoutTimer; private bool _exploded; private const float DivingTimeout = 30f; private const float NoTargetRetryInterval = 1f; private static readonly MethodInfo ServerExplodeMethod = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly List _candidateScratch = new List(); private void Start() { //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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { _rb = ((Component)this).gameObject.AddComponent(); } _rb.isKinematic = true; _rb.useGravity = false; _noiseOffset = Random.Range(0f, 1000f); _swarmTimer = CircleTime; _heading = Random.onUnitSphere; _heading.y = 0f; if (((Vector3)(ref _heading)).sqrMagnitude < 0.001f) { _heading = Vector3.forward; } ((Vector3)(ref _heading)).Normalize(); } private void FixedUpdate() { if (NetworkServer.active && !_exploded) { switch (_phase) { case Phase.Swarming: UpdateSwarming(); break; case Phase.Diving: UpdateDiving(); break; } } } private void UpdateSwarming() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0148: 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_014e: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) _swarmTimer -= Time.fixedDeltaTime; float num = Time.time * 2.5f + _noiseOffset; float num2 = (Mathf.PerlinNoise(num, _noiseOffset + 31.4f) * 2f - 1f) * WanderTurnRate; _heading = Quaternion.AngleAxis(num2 * Time.fixedDeltaTime, Vector3.up) * _heading; _heading.y = 0f; if (((Vector3)(ref _heading)).sqrMagnitude < 0.001f) { _heading = Vector3.forward; } else { ((Vector3)(ref _heading)).Normalize(); } Vector3 val = BoundaryForce(); if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { Vector3 val2 = new Vector3(val.x, 0f, val.z); Vector3 normalized = ((Vector3)(ref val2)).normalized; _heading = Vector3.RotateTowards(_heading, normalized, ((Vector3)(ref val)).magnitude * WanderTurnRate * (MathF.PI / 180f) * Time.fixedDeltaTime, 0f); } Vector3 val3 = AltitudeForce() * (WanderSpeed * 0.4f); Vector3 val4 = _heading * WanderSpeed + val3; _rb.MovePosition(((Component)this).transform.position + val4 * Time.fixedDeltaTime); RotateTowardStep(val4); if (!(_swarmTimer > 0f)) { Transform val5 = SelectRandomTarget(); if ((Object)(object)val5 == (Object)null) { _swarmTimer = 1f; return; } _diveTargetTransform = val5; _homingTarget = val5.position; _homingActive = true; _currentDiveSpeed = DiveSpeed; _divingTimeoutTimer = 30f; _phase = Phase.Diving; IssaPluginPlugin.Log.LogInfo((object)$"[Drone] Transitioning to dive — target {((Object)val5).name} at {val5.position:F1}."); } } private Vector3 BoundaryForce() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //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_00a5: Unknown result type (might be due to invalid IL or missing references) float num = ((Component)this).transform.position.x - WanderCenter.x; float num2 = ((Component)this).transform.position.z - WanderCenter.z; float num3 = num * num + num2 * num2; if (num3 <= WanderRadius * WanderRadius) { return Vector3.zero; } float num4 = Mathf.Sqrt(num3); float num5 = (num4 - WanderRadius) / WanderRadius; Vector3 val = new Vector3(0f - num, 0f, 0f - num2); return ((Vector3)(ref val)).normalized * (num5 * 3f); } private Vector3 AltitudeForce() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) float num = WanderCenter.y - AltitudeVariance; float num2 = WanderCenter.y + AltitudeVariance; float y = ((Component)this).transform.position.y; if (y < num) { return Vector3.up * ((num - y) / AltitudeVariance * 2f); } if (y > num2) { return Vector3.down * ((y - num2) / AltitudeVariance * 2f); } return Vector3.zero; } private void UpdateDiving() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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) _divingTimeoutTimer -= Time.fixedDeltaTime; if (_divingTimeoutTimer <= 0f) { IssaPluginPlugin.Log.LogInfo((object)"[Drone] Dive timed out — force detonating."); Detonate(); return; } if (Physics.CheckSphere(((Component)this).transform.position, 2f, LayerMask.op_Implicit(GameManager.LayerSettings.RocketHittablesMask), (QueryTriggerInteraction)1)) { IssaPluginPlugin.Log.LogInfo((object)"[Drone] Collision while diving."); Detonate(); return; } if (_homingActive && (Object)(object)_diveTargetTransform != (Object)null) { float num = Vector3.Distance(((Component)this).transform.position, _diveTargetTransform.position); if (!(HomingStopDistance > 0f) || !(num <= HomingStopDistance)) { _homingTarget = _diveTargetTransform.position; } else { _homingActive = false; } } float num2 = Vector3.Distance(((Component)this).transform.position, _homingTarget); if (num2 < ArrivalRadius) { Detonate(); return; } _currentDiveSpeed += DiveAcceleration * Time.fixedDeltaTime; Vector3 val = _homingTarget - ((Component)this).transform.position; Vector3 val2 = ((Vector3)(ref val)).normalized * _currentDiveSpeed * Time.fixedDeltaTime; if (((Vector3)(ref val2)).magnitude > num2) { val2 = val; } RotateTowardStep(val2); _rb.MovePosition(((Component)this).transform.position + val2); } public void Detonate() { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0041: 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_0102: Unknown result type (might be due to invalid IL or missing references) if (!_exploded) { _exploded = true; Vector3 position = ((Component)this).transform.position; if ((Object)(object)_diveTargetTransform != (Object)null) { position.y = Mathf.Min(position.y, _diveTargetTransform.position.y + 0.5f); } IssaPluginPlugin.Log.LogInfo((object)$"[Drone] Detonating at {position:F1}."); NetworkServer.SendToAll(new DroneExplodedMessage { Position = position }, 0, false); Rocket val = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.AddComponent(); val.ServerInitialize(ThrowerInfo, (Hittable)null, ItemUseId); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ExplosionScale); ServerExplodeMethod?.Invoke(val, new object[1] { position }); } NetworkServer.Destroy(((Component)this).gameObject); } } private Transform SelectRandomTarget() { _candidateScratch.Clear(); PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null && IsValidTarget(localPlayerInfo)) { _candidateScratch.Add(((Component)localPlayerInfo).transform); } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (IsValidTarget(item)) { _candidateScratch.Add(((Component)item).transform); } } } return (_candidateScratch.Count == 0) ? null : _candidateScratch[Random.Range(0, _candidateScratch.Count)]; } private bool IsValidTarget(PlayerInfo player) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 if ((Object)(object)player == (Object)null || !((Component)player).gameObject.activeInHierarchy) { return false; } if (!FriendlyFire && (Object)(object)ThrowerInfo != (Object)null && player.PlayerId.Guid == ThrowerInfo.PlayerId.Guid) { return false; } if (!AttackFinishedPlayers) { PlayerGolfer asGolfer = player.AsGolfer; if (asGolfer != null && (int)asGolfer.MatchResolution == 1) { return false; } } return true; } private void RotateTowardStep(Vector3 direction) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002e: 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_003f: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector3)(ref direction)).sqrMagnitude < 0.0001f)) { Quaternion val = DirectionToRotation(((Vector3)(ref direction)).normalized); _rb.MoveRotation(Quaternion.RotateTowards(((Component)this).transform.rotation, val, 720f * Time.fixedDeltaTime)); } } private static Quaternion DirectionToRotation(Vector3 direction) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0040: 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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref direction)).sqrMagnitude < 0.001f) { return Quaternion.identity; } Vector3 val = ((Mathf.Abs(Vector3.Dot(direction, Vector3.up)) > 0.99f) ? Vector3.forward : Vector3.up); return Quaternion.LookRotation(direction, val); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DroneSwarmSummonMessage : NetworkMessage { } public static class DroneSwarmSummonMessageSerialization { public static void WriteDroneSwarmSummonMessage(NetworkWriter writer, DroneSwarmSummonMessage msg) { } public static DroneSwarmSummonMessage ReadDroneSwarmSummonMessage(NetworkReader reader) { return default(DroneSwarmSummonMessage); } } public struct DroneExplodedMessage : NetworkMessage { public Vector3 Position; } public static class DroneExplodedMessageSerialization { public static void WriteDroneExplodedMessage(NetworkWriter writer, DroneExplodedMessage msg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Position); } public static DroneExplodedMessage ReadDroneExplodedMessage(NetworkReader reader) { //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) return new DroneExplodedMessage { Position = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DroneSwarmSessionEndedMessage : NetworkMessage { } public static class DroneSwarmSessionEndedMessageSerialization { public static void WriteDroneSwarmSessionEndedMessage(NetworkWriter writer, DroneSwarmSessionEndedMessage msg) { } public static DroneSwarmSessionEndedMessage ReadDroneSwarmSessionEndedMessage(NetworkReader reader) { return default(DroneSwarmSessionEndedMessage); } } public struct DroneSwarmOverlayBeginMessage : NetworkMessage { public int DroneCount; } public static class DroneSwarmOverlayBeginMessageSerialization { public static void WriteDroneSwarmOverlayBeginMessage(NetworkWriter writer, DroneSwarmOverlayBeginMessage msg) { NetworkWriterExtensions.WriteInt(writer, msg.DroneCount); } public static DroneSwarmOverlayBeginMessage ReadDroneSwarmOverlayBeginMessage(NetworkReader reader) { return new DroneSwarmOverlayBeginMessage { DroneCount = NetworkReaderExtensions.ReadInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DroneDiedClientMessage : NetworkMessage { } public static class DroneDiedClientMessageSerialization { public static void WriteDroneDiedClientMessage(NetworkWriter writer, DroneDiedClientMessage msg) { } public static DroneDiedClientMessage ReadDroneDiedClientMessage(NetworkReader reader) { return default(DroneDiedClientMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct DroneSwarmOverlayEndMessage : NetworkMessage { } public static class DroneSwarmOverlayEndMessageSerialization { public static void WriteDroneSwarmOverlayEndMessage(NetworkWriter writer, DroneSwarmOverlayEndMessage msg) { } public static DroneSwarmOverlayEndMessage ReadDroneSwarmOverlayEndMessage(NetworkReader reader) { return default(DroneSwarmOverlayEndMessage); } } public class DroneSwarmItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.DroneSwarmItemType; public override string DisplayName => "Drone Swarm"; public override string[] ConsoleAliases => new string[3] { "drone", "droneswarm", "drones" }; public override Sprite Icon => AssetLoader.DroneSwarmIcon; public override GameObject HeldModelPrefab => AssetLoader.DroneControllerPrefab; public override int MaxUses => (int)ModConfig.DroneSwarm.Uses.Value; public override float DefaultPoolWeight => 1f; public override Key GiveKey => ModConfig.DroneSwarm.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 0f, 0 => 0f, 2 => 0.5f, 4 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { NetworkConnection connectionToServer = ((NetworkBehaviour)inventory).connectionToServer; if (connectionToServer != null) { connectionToServer.Send(default(DroneSwarmSummonMessage), 0); } } } public class DroneSwarmNetworkBridge : NetworkBridgeBase { private readonly List _activeDrones = new List(); private bool _serverSessionActive; private Coroutine _serverTimeout; private static int _useIndex; private static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } public override void OnStopServer() { if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[DroneSwarm] Player disconnected during active session — cleaning up."); ForceServerCleanup(); } } public void ServerSummonDrones() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0158: Unknown result type (might be due to invalid IL or missing references) if (_serverSessionActive) { IssaPluginPlugin.Log.LogWarning((object)"[DroneSwarm] Session already active for this player — ignoring."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[DroneSwarm] No PlayerInventory on bridge object."); return; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.DroneSwarmItemType) { IssaPluginPlugin.Log.LogWarning((object)"[DroneSwarm] Player does not have Drone Swarm item equipped."); return; } if ((Object)(object)AssetLoader.DronePrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[DroneSwarm] DronePrefab not loaded."); return; } ItemHelper.ConsumeEquippedItem(component); ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.DroneSwarmItemType, "Drone Swarm", 0u, ((NetworkBehaviour)this).netId); int num = (int)ModConfig.DroneSwarm.BaseDroneCount.Value; float value = ModConfig.DroneSwarm.PerPlayerScalingFactor.Value; float num2 = 1f + value * (float)GameManager.RemotePlayers.Count; num = (int)((float)num * num2); float value2 = ModConfig.DroneSwarm.Altitude.Value; float value3 = ModConfig.DroneSwarm.WanderRadius.Value; Vector3 wanderCenter = ComputeOrbitCenter(value2); _serverSessionActive = true; _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerMaxDurationRoutine()); for (int i = 0; i < num; i++) { SpawnOneDrone(wanderCenter, value3, component.PlayerInfo); } ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new DroneSwarmOverlayBeginMessage { DroneCount = num }, 0); IssaPluginPlugin.Log.LogInfo((object)($"[DroneSwarm] Spawned {num} drone(s) for " + component.PlayerInfo.PlayerId.PlayerName + ".")); } private void SpawnOneDrone(Vector3 wanderCenter, float wanderRadius, PlayerInfo summoner) { //IL_0052: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 360f) * (MathF.PI / 180f); float num2 = Random.Range(wanderRadius * 0.2f, wanderRadius * 0.8f); float num3 = Random.Range(0f - ModConfig.DroneSwarm.AltitudeVariance.Value, ModConfig.DroneSwarm.AltitudeVariance.Value); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(wanderCenter.x + Mathf.Sin(num) * num2, wanderCenter.y + num3, wanderCenter.z + Mathf.Cos(num) * num2); GameObject val2 = Object.Instantiate(AssetLoader.DronePrefab, val, Quaternion.identity); ItemUseId itemUseId = default(ItemUseId); ((ItemUseId)(ref itemUseId))..ctor(summoner.PlayerId.Guid, NextUseIndex(), (ItemType)7, false); DroneBehaviour droneBehaviour = val2.AddComponent(); droneBehaviour.WanderCenter = wanderCenter; droneBehaviour.WanderRadius = wanderRadius; droneBehaviour.WanderSpeed = ModConfig.DroneSwarm.WanderSpeed.Value; droneBehaviour.WanderTurnRate = ModConfig.DroneSwarm.WanderTurnRate.Value; droneBehaviour.AltitudeVariance = ModConfig.DroneSwarm.AltitudeVariance.Value; droneBehaviour.CircleTime = Random.Range(ModConfig.DroneSwarm.CircleTimeMin.Value, ModConfig.DroneSwarm.CircleTimeMax.Value); droneBehaviour.DiveSpeed = ModConfig.DroneSwarm.DiveSpeed.Value; droneBehaviour.DiveAcceleration = ModConfig.DroneSwarm.DiveAcceleration.Value; droneBehaviour.HomingStopDistance = ModConfig.DroneSwarm.HomingStopDistance.Value; droneBehaviour.ArrivalRadius = ModConfig.DroneSwarm.ArrivalRadius.Value; droneBehaviour.ExplosionScale = ModConfig.DroneSwarm.ExplosionScale.Value; droneBehaviour.ThrowerInfo = summoner; droneBehaviour.ItemUseId = itemUseId; droneBehaviour.FriendlyFire = ModConfig.DroneSwarm.FriendlyFire.Value; droneBehaviour.AttackFinishedPlayers = ModConfig.DroneSwarm.AttackFinishedPlayers.Value; NetworkServer.Spawn(val2, (NetworkConnectionToClient)null); _activeDrones.Add(val2); ((MonoBehaviour)this).StartCoroutine(WatchDrone(val2)); } private IEnumerator WatchDrone(GameObject droneGo) { while ((Object)(object)droneGo != (Object)null) { yield return null; } _activeDrones.Remove(droneGo); if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(DroneDiedClientMessage), 0); } if (_serverSessionActive && _activeDrones.Count == 0) { IssaPluginPlugin.Log.LogInfo((object)"[DroneSwarm] All drones destroyed — session ending."); EndServerSession(); } } private IEnumerator ServerMaxDurationRoutine() { yield return (object)new WaitForSeconds(ModConfig.DroneSwarm.MaxSessionDuration.Value); if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[DroneSwarm] Session timed out."); EndServerSession(); } } private void EndServerSession() { if (!_serverSessionActive) { return; } _serverSessionActive = false; if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } List list = new List(_activeDrones); _activeDrones.Clear(); foreach (GameObject item in list) { if ((Object)(object)item != (Object)null) { NetworkServer.Destroy(item); } } NetworkServer.SendToAll(default(DroneSwarmSessionEndedMessage), 0, false); if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(DroneSwarmOverlayEndMessage), 0); } IssaPluginPlugin.Log.LogInfo((object)"[DroneSwarm] Server session ended."); } public override void ServerHoleCleanup() { if (_serverSessionActive) { ForceServerCleanup(); } } public override void ClientHoleCleanup() { } private void ForceServerCleanup() { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } foreach (GameObject activeDrone in _activeDrones) { if ((Object)(object)activeDrone != (Object)null) { NetworkServer.Destroy(activeDrone); } } _activeDrones.Clear(); _serverSessionActive = false; if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(DroneSwarmOverlayEndMessage), 0); } } private static Vector3 ComputeOrbitCenter(float altitude) { //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_001c: 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_0074: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_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_0066: 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_0070: Unknown result type (might be due to invalid IL or missing references) PlayerInventory[] array = Object.FindObjectsByType((FindObjectsSortMode)0); if (array.Length == 0) { return new Vector3(0f, altitude, 0f); } Vector3 val = Vector3.zero; PlayerInventory[] array2 = array; foreach (PlayerInventory val2 in array2) { val += ((Component)val2).transform.position; } Vector3 result = val / (float)array.Length; result.y = altitude; return result; } public static void HandleDroneExploded(DroneExplodedMessage msg) { //IL_0018: 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) if (!((Object)(object)AssetLoader.DroneExplosionVfxPrefab == (Object)null)) { Object.Instantiate(AssetLoader.DroneExplosionVfxPrefab, msg.Position, Quaternion.identity); } } public static void HandleSessionEnded(DroneSwarmSessionEndedMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[DroneSwarm] Session ended (all clients)."); } public static void HandleOverlayBegin(DroneSwarmOverlayBeginMessage msg) { DroneSwarmOverlay.Instance?.SetActive(active: true, msg.DroneCount); } public static void HandleDroneDied(DroneDiedClientMessage msg) { DroneSwarmOverlay.Instance?.DecrementDroneCount(); } public static void HandleOverlayEnd(DroneSwarmOverlayEndMessage msg) { DroneSwarmOverlay.Instance?.Deactivate(); } } public class DroppedCustomItem : NetworkBehaviour, IInteractable { public ItemType ItemType; public int RemainingUses; public Entity AsEntity { get; private set; } public bool IsInteractionEnabled => true; public LocalizedString InteractString => LocalizationManager.GetLocalizedString((StringTable)1, "ITEM_" + (int)ItemType); private void Awake() { AsEntity = ((Component)this).GetComponent(); } public override bool Weaved() { return true; } protected override void SerializeSyncVars(NetworkWriter writer, bool forceAll) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown ((NetworkBehaviour)this).SerializeSyncVars(writer, forceAll); if (forceAll) { NetworkWriterExtensions.WriteInt(writer, (int)ItemType); NetworkWriterExtensions.WriteInt(writer, RemainingUses); } else { NetworkWriterExtensions.WriteVarULong(writer, 0uL); } } protected override void DeserializeSyncVars(NetworkReader reader, bool initialState) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).DeserializeSyncVars(reader, initialState); if (initialState) { ItemType = (ItemType)NetworkReaderExtensions.ReadInt(reader); RemainingUses = NetworkReaderExtensions.ReadInt(reader); } else { NetworkReaderExtensions.ReadVarULong(reader); } } public override void OnStartClient() { //IL_004d: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.layer = GameManager.LayerSettings.ItemsLayer; if (((NetworkBehaviour)this).isServer) { return; } Rigidbody component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; component.useGravity = false; } GameObject modelPrefabForType = GetModelPrefabForType(ItemType); if (!((Object)(object)modelPrefabForType == (Object)null)) { GameObject val = Object.Instantiate(modelPrefabForType); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; Collider[] componentsInChildren = val.GetComponentsInChildren(); foreach (Collider val2 in componentsInChildren) { val2.enabled = false; } val.SetActive(true); } } public void LocalPlayerInteract() { NetworkIdentity component = ((Component)this).GetComponent(); NetworkClient.Send(new DroppedItemPickupMessage { DroppedItemNetId = component.netId }, 0); } internal static void ServerHandlePickupMessage(NetworkConnectionToClient conn, DroppedItemPickupMessage msg) { if (NetworkServer.spawned.TryGetValue(msg.DroppedItemNetId, out var value) && !((Object)(object)value == (Object)null)) { DroppedCustomItem component = ((Component)value).gameObject.GetComponent(); NetworkIdentity identity = ((NetworkConnection)conn).identity; PlayerInventory val = ((identity != null) ? ((Component)identity).GetComponent() : null); if (!((Object)(object)component == (Object)null) && !((Object)(object)val == (Object)null)) { component.ServerPickup(val); } } } public void ServerPickup(PlayerInventory player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) int num = default(int); if (player.HasSpaceForItem(ref num) && player.ServerTryAddItem(ItemType, RemainingUses)) { NetworkServer.Destroy(((Component)this).gameObject); } } public static GameObject GetModelPrefabForType(ItemType type) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) if (type == ItemRegistry.JetpackItemType) { return AssetLoader.JetpackEquippedPrefab; } return ItemRegistry.GetDefinition(type)?.HeldModelPrefab; } public bool IsInteractionSuppressed() { return false; } } public struct DroppedItemPickupMessage : NetworkMessage { public uint DroppedItemNetId; } public static class DroppedItemPickupMessageSerialization { public static void WriteDroppedItemPickupMessage(NetworkWriter writer, DroppedItemPickupMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.DroppedItemNetId); } public static DroppedItemPickupMessage ReadDroppedItemPickupMessage(NetworkReader reader) { return new DroppedItemPickupMessage { DroppedItemNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public static class ExplosionScaler { private static readonly Dictionary _scales = new Dictionary(); public static void Register(Rocket rocket, float scale) { if (rocket != null) { _scales[((Object)rocket).GetInstanceID()] = scale; } } public static void Unregister(Rocket rocket) { if (rocket != null) { _scales.Remove(((Object)rocket).GetInstanceID()); } } public static float GetScale(Rocket rocket) { if (rocket != null && _scales.TryGetValue(((Object)rocket).GetInstanceID(), out var value)) { return value; } return 1f; } public static bool IsRegistered(Rocket rocket) { return rocket != null && _scales.ContainsKey(((Object)rocket).GetInstanceID()); } } public class ExplosiveGolfBallsBehaviour : MonoBehaviour { public PlayerGolfer Hitter; public float ExplosionScale = 1.5f; private const float GraceTime = 0.2f; private const float MaxLifetime = 15f; private float _elapsed; private bool _triggered; private static readonly MethodInfo RocketServerExplode = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); private void FixedUpdate() { if (!_triggered) { _elapsed += Time.fixedDeltaTime; if (_elapsed >= 15f) { _triggered = true; Object.Destroy((Object)(object)this); } } } private void OnCollisionEnter(Collision collision) { if (!_triggered && !(_elapsed < 0.2f)) { Explode(); } } private void Explode() { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (_triggered) { return; } _triggered = true; Vector3 position = ((Component)this).transform.position; IssaPluginPlugin.Log.LogInfo((object)$"[ExplosiveGolfBalls] Exploding at {position}"); NetworkServer.SendToAll(new ExplosiveGolfBallsExplodeMessage { WorldPosition = position }, 0, false); Rocket rocketPrefab = GameManager.ItemSettings.RocketPrefab; if ((Object)(object)rocketPrefab != (Object)null) { PlayerGolfer hitter = Hitter; if ((Object)(object)((hitter != null) ? hitter.PlayerInfo : null) != (Object)null) { Rocket val = Object.Instantiate(rocketPrefab, position, Quaternion.identity); if ((Object)(object)val != (Object)null) { ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(Hitter.PlayerInfo.PlayerId.Guid, ExplosiveGolfBallsItem.NextUseIndex(), (ItemType)7, false); val.ServerInitialize(Hitter.PlayerInfo, (Hittable)null, val2); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ExplosionScale); RocketServerExplode?.Invoke(val, new object[1] { position }); } } } Object.Destroy((Object)(object)this); } } public static class ExplosiveGolfBallsItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } internal class ExplosiveGolfBallsItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.ExplosiveGolfBallsItemType; public override string DisplayName => "Explosive Golf Balls"; public override string[] ConsoleAliases => new string[3] { "explodingballs", "expballs", "explosiveballs" }; public override Sprite Icon => AssetLoader.ExplosiveGolfBallsIcon; public override GameObject HeldModelPrefab => AssetLoader.ExplosiveGolfBallsHandheldPrefab; public override int MaxUses => (int)ModConfig.ExplosiveGolfBalls.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.ExplosiveGolfBalls.GiveKey.Value; public override void OnUse(PlayerInventory inventory) { } } public struct ExplosiveGolfBallsExplodeMessage : NetworkMessage { public Vector3 WorldPosition; } public static class ExplosiveGolfBallsExplodeMessageSerialization { public static void WriteExplosiveGolfBallsExplodeMessage(NetworkWriter writer, ExplosiveGolfBallsExplodeMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.WorldPosition); } public static ExplosiveGolfBallsExplodeMessage ReadExplosiveGolfBallsExplodeMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new ExplosiveGolfBallsExplodeMessage { WorldPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public class ExplosiveGolfBallsNetworkBridge : NetworkBridgeBase { public static void HandleExplosion(ExplosiveGolfBallsExplodeMessage msg) { //IL_0004: 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_000e: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) VfxManager.PlayPooledVfxLocalOnly((VfxType)37, msg.WorldPosition, Quaternion.identity, Vector3.one * ModConfig.ExplosiveGolfBalls.ExplosionScale.Value, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.WorldPosition, 1f, 1f); IssaPluginPlugin.Log.LogInfo((object)$"[ExplosiveGolfBalls] Client: explosion VFX at {msg.WorldPosition}"); } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public class FlamethrowerHitDetector : MonoBehaviour { private uint _shooterNetId; private FlamethrowerNetworkBridge _bridge; private readonly Dictionary _lastSendTime = new Dictionary(); public void Initialize(FlamethrowerNetworkBridge bridge, uint shooterNetId) { _bridge = bridge; _shooterNetId = shooterNetId; } private void OnTriggerStay(Collider other) { if ((Object)(object)_bridge == (Object)null) { return; } HunterDroneBehaviour componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { NetworkIdentity component = ((Component)componentInParent).GetComponent(); if (!((Object)(object)component != (Object)null)) { return; } uint netId = component.netId; float time = Time.time; float value = ModConfig.Flamethrower.BurnRequestInterval.Value; if (_lastSendTime.TryGetValue(netId, out var value2) && !(time - value2 >= value)) { return; } _lastSendTime[netId] = time; if (NetworkServer.active) { componentInParent.ShootDown(); return; } NetworkConnection connectionToServer = ((NetworkBehaviour)_bridge).connectionToServer; if (connectionToServer != null) { connectionToServer.Send(new HunterDroneShotMessage { DroneNetId = netId }, 0); } return; } PlayerMovement componentInParent2 = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent2 == (Object)null) { return; } NetworkIdentity component2 = ((Component)componentInParent2).GetComponent(); if ((Object)(object)component2 == (Object)null) { return; } uint netId2 = component2.netId; if (netId2 != _shooterNetId) { float value3 = ModConfig.Flamethrower.BurnRequestInterval.Value; float time2 = Time.time; if (!_lastSendTime.TryGetValue(netId2, out var value4) || !(time2 - value4 < value3)) { _lastSendTime[netId2] = time2; _bridge.ClientRequestBurn(netId2); } } } public void ResetCooldowns() { _lastSendTime.Clear(); } } public static class FlamethrowerItem { private static bool _isFiring; private static float _fuelRemaining = -1f; public static float FuelFraction { get; private set; } = 1f; public static bool IsFiring => _isFiring; public static void ResetFiringState() { _fuelRemaining = -1f; _isFiring = false; } public static IEnumerator FireLoop(PlayerInventory inventory) { if (Mouse.current == null || !Mouse.current.leftButton.isPressed || _isFiring) { yield break; } _isFiring = true; FlamethrowerNetworkBridge bridge = ((Component)inventory).GetComponent(); ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)1); bridge?.ClientNotifyFireStart(); if (_fuelRemaining < 0f) { _fuelRemaining = ModConfig.Flamethrower.FuelPerUse.Value; } FuelFraction = Mathf.Clamp01(_fuelRemaining / ModConfig.Flamethrower.FuelPerUse.Value); try { while (inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.FlamethrowerItemType) { _fuelRemaining -= Time.fixedDeltaTime; FuelFraction = Mathf.Clamp01(_fuelRemaining / ModConfig.Flamethrower.FuelPerUse.Value); ScreenShakeHelper.ApplyScreenShake(0.025f); if (_fuelRemaining <= 0f) { ItemHelper.DecrementAndRemove(inventory, inventory.EquippedItemIndex); if (inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.FlamethrowerItemType) { break; } _fuelRemaining = ModConfig.Flamethrower.FuelPerUse.Value; FuelFraction = 1f; } yield return (object)new WaitForFixedUpdate(); if (Mouse.current == null || !Mouse.current.leftButton.isPressed || !(_fuelRemaining > 0f)) { break; } } } finally { ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)0); bridge?.ClientNotifyFireStop(); _isFiring = false; } } } public class FlamethrowerItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.FlamethrowerItemType; public override string DisplayName => "Flamethrower"; public override string[] ConsoleAliases => new string[4] { "flamethrower", "flame", "flamer", "fire" }; public override Sprite Icon => AssetLoader.FlamethrowerIcon; public override GameObject HeldModelPrefab => AssetLoader.FlamethrowerPrefab; public override bool UseRocketIconFallback => true; public override int MaxUses => (int)ModConfig.Flamethrower.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.Flamethrower.GiveKey.Value; public override EquipmentType EquipmentType => (EquipmentType)5; public override ItemType AnimatorItemType => (ItemType)3; public override ItemType AnimatorChangedItemType => (ItemType)3; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { ((MonoBehaviour)inventory).StartCoroutine(FlamethrowerItem.FireLoop(inventory)); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct FlamethrowerFireStartMessage : NetworkMessage { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct FlamethrowerFireStopMessage : NetworkMessage { } public struct FlamethrowerBurnRequestMessage : NetworkMessage { public uint VictimNetId; } public struct FlamethrowerFireBeginMessage : NetworkMessage { public uint ShooterNetId; } public struct FlamethrowerFireEndMessage : NetworkMessage { public uint ShooterNetId; } public struct FlamethrowerBurnBeginMessage : NetworkMessage { public uint VictimNetId; } public struct FlamethrowerBurnEndMessage : NetworkMessage { public uint VictimNetId; public uint ShooterNetId; public Vector3 KnockImpulse; } public static class FlamethrowerMessageSerialization { public static void WriteFireStart(NetworkWriter w, FlamethrowerFireStartMessage msg) { } public static FlamethrowerFireStartMessage ReadFireStart(NetworkReader r) { return default(FlamethrowerFireStartMessage); } public static void WriteFireStop(NetworkWriter w, FlamethrowerFireStopMessage msg) { } public static FlamethrowerFireStopMessage ReadFireStop(NetworkReader r) { return default(FlamethrowerFireStopMessage); } public static void WriteBurnRequest(NetworkWriter w, FlamethrowerBurnRequestMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.VictimNetId); } public static FlamethrowerBurnRequestMessage ReadBurnRequest(NetworkReader r) { return new FlamethrowerBurnRequestMessage { VictimNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteFireBegin(NetworkWriter w, FlamethrowerFireBeginMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.ShooterNetId); } public static FlamethrowerFireBeginMessage ReadFireBegin(NetworkReader r) { return new FlamethrowerFireBeginMessage { ShooterNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteFireEnd(NetworkWriter w, FlamethrowerFireEndMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.ShooterNetId); } public static FlamethrowerFireEndMessage ReadFireEnd(NetworkReader r) { return new FlamethrowerFireEndMessage { ShooterNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteBurnBegin(NetworkWriter w, FlamethrowerBurnBeginMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.VictimNetId); } public static FlamethrowerBurnBeginMessage ReadBurnBegin(NetworkReader r) { return new FlamethrowerBurnBeginMessage { VictimNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteBurnEnd(NetworkWriter w, FlamethrowerBurnEndMessage msg) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(w, msg.VictimNetId); NetworkWriterExtensions.WriteUInt(w, msg.ShooterNetId); NetworkWriterExtensions.WriteVector3(w, msg.KnockImpulse); } public static FlamethrowerBurnEndMessage ReadBurnEnd(NetworkReader r) { //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) return new FlamethrowerBurnEndMessage { VictimNetId = NetworkReaderExtensions.ReadUInt(r), ShooterNetId = NetworkReaderExtensions.ReadUInt(r), KnockImpulse = NetworkReaderExtensions.ReadVector3(r) }; } } public class FlamethrowerNetworkBridge : NetworkBridgeBase { private static readonly Dictionary _serverActiveBurns = new Dictionary(); private static readonly Dictionary _serverBurnShooters = new Dictionary(); private bool _serverFiring; private GameObject _flameParticles; private GameObject _victimFireParticles; private FlamethrowerHitDetector _hitDetector; private bool _wasAimedIn; public static bool LocalPlayerIsBurning { get; private set; } public void ClientNotifyFireStart() { NetworkClient.Send(default(FlamethrowerFireStartMessage), 0); } public void ClientNotifyFireStop() { _hitDetector?.ResetCooldowns(); NetworkClient.Send(default(FlamethrowerFireStopMessage), 0); } public void ClientRequestBurn(uint victimNetId) { NetworkClient.Send(new FlamethrowerBurnRequestMessage { VictimNetId = victimNetId }, 0); } public void ServerHandleFireStart() { if (((NetworkBehaviour)this).isServer && !_serverFiring) { _serverFiring = true; NetworkServer.SendToAll(new FlamethrowerFireBeginMessage { ShooterNetId = ((NetworkBehaviour)this).netId }, 0, false); } } public void ServerHandleFireStop() { if (((NetworkBehaviour)this).isServer && _serverFiring) { _serverFiring = false; NetworkServer.SendToAll(new FlamethrowerFireEndMessage { ShooterNetId = ((NetworkBehaviour)this).netId }, 0, false); } } public void ServerHandleBurnRequest(NetworkConnectionToClient conn, uint victimNetId) { if (!((NetworkBehaviour)this).isServer || !NetworkServer.spawned.TryGetValue(victimNetId, out var value)) { return; } FlamethrowerNetworkBridge component = ((Component)value).GetComponent(); if ((Object)(object)component == (Object)null) { return; } if (_serverActiveBurns.TryGetValue(victimNetId, out (FlamethrowerNetworkBridge, Coroutine) value2)) { if ((Object)(object)value2.Item1 != (Object)null && value2.Item2 != null) { ((MonoBehaviour)value2.Item1).StopCoroutine(value2.Item2); } } else { NetworkServer.SendToAll(new FlamethrowerBurnBeginMessage { VictimNetId = victimNetId }, 0, false); } _serverBurnShooters[victimNetId] = ((NetworkBehaviour)this).netId; float value3 = ModConfig.Flamethrower.BurnDuration.Value; Coroutine item = ((MonoBehaviour)component).StartCoroutine(ServerBurnTimeout(victimNetId, value3)); _serverActiveBurns[victimNetId] = (component, item); } public static void HandleFireBegin(FlamethrowerFireBeginMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.ShooterNetId, out var value)) { ((Component)value).GetComponent()?.ClientShowFlame(value.isLocalPlayer); } } public static void HandleFireEnd(FlamethrowerFireEndMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.ShooterNetId, out var value)) { ((Component)value).GetComponent()?.ClientHideFlame(); } } public static void HandleBurnBegin(FlamethrowerBurnBeginMessage msg) { if (!NetworkClient.spawned.TryGetValue(msg.VictimNetId, out var value)) { return; } FlamethrowerNetworkBridge component = ((Component)value).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.ClientShowVictimFire(); if (value.isLocalPlayer) { LocalPlayerIsBurning = true; } } } public static void HandleBurnEnd(FlamethrowerBurnEndMessage msg) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.spawned.TryGetValue(msg.VictimNetId, out var value)) { return; } FlamethrowerNetworkBridge component = ((Component)value).GetComponent(); if ((Object)(object)component == (Object)null) { return; } component.ClientHideVictimFire(); if (!value.isLocalPlayer) { return; } LocalPlayerIsBurning = false; PlayerMovement component2 = ((Component)value).GetComponent(); if (!((Object)(object)component2 == (Object)null)) { PlayerInfo val = null; if (msg.ShooterNetId != 0 && NetworkClient.spawned.TryGetValue(msg.ShooterNetId, out var value2)) { val = ((Component)value2).GetComponent(); } bool flag = default(bool); bool flag2 = default(bool); component2.TryKnockOut(val, (KnockoutType)7, false, Vector3.zero, 0f, msg.KnockImpulse, (ElectromagnetShieldHitBlockType)0, default(ItemUseId), false, true, ref flag, ref flag2); } } private void ClientShowFlame(bool isLocalShooter) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) ClientHideFlame(); if (!((Object)(object)AssetLoader.FlamethrowerParticlePrefab == (Object)null)) { _flameParticles = Object.Instantiate(AssetLoader.FlamethrowerParticlePrefab); _flameParticles.transform.SetParent(((Component)this).transform, false); _flameParticles.transform.localPosition = new Vector3(0f, 0.8f, 0.3f); _flameParticles.transform.localRotation = Quaternion.identity; _flameParticles.SetActive(true); if (isLocalShooter) { Collider componentInChildren = _flameParticles.GetComponentInChildren(); GameObject val = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).gameObject : _flameParticles); _hitDetector = val.AddComponent(); _hitDetector.Initialize(this, ((NetworkBehaviour)this).netId); } } } private void ClientHideFlame() { if (!((Object)(object)_flameParticles == (Object)null)) { Object.Destroy((Object)(object)_flameParticles); _flameParticles = null; _hitDetector = null; } } private void ClientShowVictimFire() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ClientHideVictimFire(); if (!((Object)(object)AssetLoader.FlamethrowerVictimFirePrefab == (Object)null)) { _victimFireParticles = Object.Instantiate(AssetLoader.FlamethrowerVictimFirePrefab); _victimFireParticles.transform.SetParent(((Component)this).transform, false); _victimFireParticles.transform.localPosition = Vector3.zero; _victimFireParticles.transform.localRotation = Quaternion.identity; _victimFireParticles.SetActive(true); } } private void ClientHideVictimFire() { if (!((Object)(object)_victimFireParticles == (Object)null)) { Object.Destroy((Object)(object)_victimFireParticles); _victimFireParticles = null; } } private void LateUpdate() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)((localPlayerInfo != null) ? localPlayerInfo.Inventory : null) != (Object)null && localPlayerInfo.Inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.FlamethrowerItemType) { Mouse current = Mouse.current; bool flag = current != null && current.rightButton.isPressed; if (!_wasAimedIn && flag) { localPlayerInfo.PlayerAudio.PlayItemAimForAllClients((ItemType)3); } _wasAimedIn = flag; } } private IEnumerator ServerBurnTimeout(uint victimNetId, float duration) { yield return (object)new WaitForSeconds(duration); _serverActiveBurns.Remove(victimNetId); _serverBurnShooters.TryGetValue(victimNetId, out var shooterNetId); _serverBurnShooters.Remove(victimNetId); Vector3 knockImpulse = Vector3.zero; if (NetworkServer.spawned.TryGetValue(victimNetId, out var victimIdentity)) { knockImpulse = ((Component)victimIdentity).transform.forward * 3f; } NetworkServer.SendToAll(new FlamethrowerBurnEndMessage { VictimNetId = victimNetId, ShooterNetId = shooterNetId, KnockImpulse = knockImpulse }, 0, false); } private static void ServerCancelAllBurns() { foreach (KeyValuePair serverActiveBurn in _serverActiveBurns) { serverActiveBurn.Deconstruct(out var _, out var value); var (flamethrowerNetworkBridge, val) = value; if ((Object)(object)flamethrowerNetworkBridge != (Object)null && val != null) { ((MonoBehaviour)flamethrowerNetworkBridge).StopCoroutine(val); } } _serverActiveBurns.Clear(); _serverBurnShooters.Clear(); } public override void ServerHoleCleanup() { if (_serverFiring) { _serverFiring = false; NetworkServer.SendToAll(new FlamethrowerFireEndMessage { ShooterNetId = ((NetworkBehaviour)this).netId }, 0, false); } GlobalServerHoleCleanup(); } public static void GlobalServerHoleCleanup() { ServerCancelAllBurns(); } public override void ClientHoleCleanup() { ClientHideFlame(); ClientHideVictimFire(); LocalPlayerIsBurning = false; if (((NetworkBehaviour)this).isLocalPlayer) { FlamethrowerItem.ResetFiringState(); } } public override void OnStopServer() { _serverFiring = false; ServerCancelAllBurns(); } } public static class FreezeItem { public static bool IsFrozen { get; set; } } public class FreezeItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.FreezeItemType; public override string DisplayName => "Freeze World"; public override string[] ConsoleAliases => new string[2] { "freezeworld", "freeze" }; public override Sprite Icon => AssetLoader.FreezeIcon; public override GameObject HeldModelPrefab => AssetLoader.FreezeModelPrefab; public override int MaxUses => (int)ModConfig.Freeze.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.Freeze.GiveKey.Value; public override void OnUse(PlayerInventory inventory) { FreezeNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(FreezeActivateMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[Freeze] No FreezeNetworkBridge on player."); } } } public struct FreezeBeginMessage : NetworkMessage { public float Duration; public uint ActivatorNetId; public override string ToString() { return $"FreezeBeginMessage[Duration={Duration}, ActivatorNetId={ActivatorNetId}]"; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct FreezeEndMessage : NetworkMessage { } public static class FreezeBeginMessageSerialization { public static void WriteFreezeBeginMessage(NetworkWriter writer, FreezeBeginMessage msg) { NetworkWriterExtensions.WriteFloat(writer, msg.Duration); NetworkWriterExtensions.WriteUInt(writer, msg.ActivatorNetId); } public static FreezeBeginMessage ReadFreezeBeginMessage(NetworkReader reader) { return new FreezeBeginMessage { Duration = NetworkReaderExtensions.ReadFloat(reader), ActivatorNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public static class FreezeEndMessageSerialization { public static void WriteFreezeEndMessage(NetworkWriter writer, FreezeEndMessage msg) { } public static FreezeEndMessage ReadFreezeEndMessage(NetworkReader reader) { return default(FreezeEndMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct FreezeActivateMessage : NetworkMessage { } public static class FreezeActivateMessageSerialization { public static void WriteFreezeActivateMessage(NetworkWriter writer, FreezeActivateMessage msg) { } public static FreezeActivateMessage ReadFreezeActivateMessage(NetworkReader reader) { return default(FreezeActivateMessage); } } public class FreezeNetworkBridge : NetworkBridgeBase { private static bool _globalSessionActive; private static Coroutine _timeoutCoroutine; private static FreezeNetworkBridge _activeInstance; private static Color _savedFogColor; private static float _savedFogDensity; private static Color _savedAmbientLight; private static bool _savedFog; public void ServerActivateFreeze() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (_globalSessionActive) { IssaPluginPlugin.Log.LogWarning((object)"[Freeze] A freeze session is already active."); return; } PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.FreezeItemType) { IssaPluginPlugin.Log.LogWarning((object)"[Freeze] Player does not have Freeze item equipped."); return; } ItemHelper.ConsumeEquippedItem(component); _globalSessionActive = true; _activeInstance = this; float value = ModConfig.Freeze.Duration.Value; NetworkServer.SendToAll(new FreezeBeginMessage { Duration = value, ActivatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _timeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ServerTimeoutRoutine(value)); IssaPluginPlugin.Log.LogInfo((object)$"[Freeze] Server freeze started for {value}s."); } } public static void HandleFreezeBegin(FreezeBeginMessage msg) { //IL_006d: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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) IssaPluginPlugin.Log.LogInfo((object)$"[Freeze] HandleFreezeBegin called: msg={msg}"); if (!FreezeItem.IsFrozen) { _savedFogColor = RenderSettings.fogColor; _savedFogDensity = RenderSettings.fogDensity; _savedAmbientLight = RenderSettings.ambientLight; _savedFog = RenderSettings.fog; } RenderSettings.fog = true; RenderSettings.fogColor = new Color(0.7f, 0.85f, 1f, 1f); RenderSettings.fogDensity = 0.04f; RenderSettings.ambientLight = new Color(0.5f, 0.65f, 0.9f); bool flag = (Object)(object)NetworkClient.localPlayer != (Object)null && NetworkClient.localPlayer.netId == msg.ActivatorNetId && !ModConfig.Freeze.AffectsUser.Value; if (!flag) { FreezeItem.IsFrozen = true; } FreezeOverlay.Instance?.SetFrozen(!flag, msg.Duration); IssaPluginPlugin.Log.LogInfo((object)(flag ? "[Freeze] Client freeze started (local player exempt as activator)." : "[Freeze] Client freeze started.")); } public static void HandleFreezeEnd(FreezeEndMessage msg) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)$"[Freeze] HandleFreezeEnd called: msg={msg}"); RenderSettings.fogColor = _savedFogColor; RenderSettings.fogDensity = _savedFogDensity; RenderSettings.ambientLight = _savedAmbientLight; RenderSettings.fog = _savedFog; FreezeItem.IsFrozen = false; FreezeOverlay.Instance?.SetFrozen(frozen: false); IssaPluginPlugin.Log.LogInfo((object)"[Freeze] Client freeze ended."); } private IEnumerator ServerTimeoutRoutine(float duration) { yield return (object)new WaitForSeconds(duration); NetworkServer.SendToAll(default(FreezeEndMessage), 0, false); _globalSessionActive = false; _activeInstance = null; _timeoutCoroutine = null; IssaPluginPlugin.Log.LogInfo((object)"[Freeze] Server freeze session ended."); } public static void GlobalServerHoleCleanup() { if (_globalSessionActive) { if (_timeoutCoroutine != null && (Object)(object)_activeInstance != (Object)null) { ((MonoBehaviour)_activeInstance).StopCoroutine(_timeoutCoroutine); } _timeoutCoroutine = null; _activeInstance = null; NetworkServer.SendToAll(default(FreezeEndMessage), 0, false); _globalSessionActive = false; IssaPluginPlugin.Log.LogInfo((object)"[Freeze] Session force-ended for hole transition."); } } public override void ServerHoleCleanup() { GlobalServerHoleCleanup(); } public override void ClientHoleCleanup() { } public override void OnStopServer() { if (_globalSessionActive) { if (_timeoutCoroutine != null && (Object)(object)_activeInstance != (Object)null) { ((MonoBehaviour)_activeInstance).StopCoroutine(_timeoutCoroutine); } _timeoutCoroutine = null; _activeInstance = null; NetworkServer.SendToAll(default(FreezeEndMessage), 0, false); _globalSessionActive = false; IssaPluginPlugin.Log.LogInfo((object)"[Freeze] Session ended and global lock released on server stop."); } } } internal static class GlobalSessionLock where T : class { private static bool _active; private static T _holder; public static T Holder => _holder; public static bool IsActive => _active; public static bool TryAcquire(T instance) { if (_active) { return false; } _active = true; _holder = instance; return true; } public static void Release() { _active = false; _holder = null; } } public static class GravityGunItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class GravityGunItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.GravityGunItemType; public override string DisplayName => "Gravity Gun"; public override string[] ConsoleAliases => new string[2] { "gravity_gun", "gravity-gun" }; public override Sprite Icon => AssetLoader.ElectricGravityGunIcon; public override GameObject HeldModelPrefab => AssetLoader.ElectricWhipHandheldPrefab; public override bool UseRocketIconFallback => true; public override EquipmentType EquipmentType => (EquipmentType)5; public override ItemType AnimatorItemType => (ItemType)3; public override ItemType AnimatorChangedItemType => (ItemType)3; public override int MaxUses => (int)ModConfig.GravityGun.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.GravityGun.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { GravityGunNetworkBridge component = ((Component)inventory).GetComponent(); if (!((Object)(object)component == (Object)null)) { if (component.LocalSessionActive) { NetworkClient.Send(default(GravityGunReleaseMessage), 0); } else { component.ClientUse(); } } } } public struct GravityGunLockOnMessage : NetworkMessage { public uint TargetNetId; } public static class GravityGunLockOnMessageSerialization { public static void WriteGravityGunLockOnMessage(NetworkWriter writer, GravityGunLockOnMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); } public static GravityGunLockOnMessage ReadGravityGunLockOnMessage(NetworkReader reader) { return new GravityGunLockOnMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public struct GravityGunAimTickMessage : NetworkMessage { public Vector3 WielderPos; public Vector3 AimDir; } public static class GravityGunAimTickMessageSerialization { public static void WriteGravityGunAimTickMessage(NetworkWriter writer, GravityGunAimTickMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.WielderPos); NetworkWriterExtensions.WriteVector3(writer, msg.AimDir); } public static GravityGunAimTickMessage ReadGravityGunAimTickMessage(NetworkReader reader) { //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_0018: 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) return new GravityGunAimTickMessage { WielderPos = NetworkReaderExtensions.ReadVector3(reader), AimDir = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct GravityGunReleaseMessage : NetworkMessage { } public static class GravityGunReleaseMessageSerialization { public static void WriteGravityGunReleaseMessage(NetworkWriter writer, GravityGunReleaseMessage msg) { } public static GravityGunReleaseMessage ReadGravityGunReleaseMessage(NetworkReader reader) { return default(GravityGunReleaseMessage); } } public struct GravityGunConnectedMessage : NetworkMessage { public uint WielderNetId; public uint TargetNetId; public float TetherRadius; public float Duration; } public static class GravityGunConnectedMessageSerialization { public static void WriteGravityGunConnectedMessage(NetworkWriter writer, GravityGunConnectedMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.WielderNetId); NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteFloat(writer, msg.TetherRadius); NetworkWriterExtensions.WriteFloat(writer, msg.Duration); } public static GravityGunConnectedMessage ReadGravityGunConnectedMessage(NetworkReader reader) { return new GravityGunConnectedMessage { WielderNetId = NetworkReaderExtensions.ReadUInt(reader), TargetNetId = NetworkReaderExtensions.ReadUInt(reader), TetherRadius = NetworkReaderExtensions.ReadFloat(reader), Duration = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct GravityGunTetherTickMessage : NetworkMessage { public Vector3 WielderPos; public Vector3 AimDir; } public static class GravityGunTetherTickMessageSerialization { public static void WriteGravityGunTetherTickMessage(NetworkWriter writer, GravityGunTetherTickMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.WielderPos); NetworkWriterExtensions.WriteVector3(writer, msg.AimDir); } public static GravityGunTetherTickMessage ReadGravityGunTetherTickMessage(NetworkReader reader) { //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_0018: 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) return new GravityGunTetherTickMessage { WielderPos = NetworkReaderExtensions.ReadVector3(reader), AimDir = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct GravityGunDisconnectedMessage : NetworkMessage { public uint WielderNetId; } public static class GravityGunDisconnectedMessageSerialization { public static void WriteGravityGunDisconnectedMessage(NetworkWriter writer, GravityGunDisconnectedMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.WielderNetId); } public static GravityGunDisconnectedMessage ReadGravityGunDisconnectedMessage(NetworkReader reader) { return new GravityGunDisconnectedMessage { WielderNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct GravityGunBusyMessage : NetworkMessage { } public static class GravityGunBusyMessageSerialization { public static void WriteGravityGunBusyMessage(NetworkWriter writer, GravityGunBusyMessage msg) { } public static GravityGunBusyMessage ReadGravityGunBusyMessage(NetworkReader reader) { return default(GravityGunBusyMessage); } } public class GravityGunNetworkBridge : NetworkBridgeBase { private bool _serverSessionActive; private NetworkConnectionToClient _targetConn; private PlayerInfo _targetInfo; private Coroutine _serverTimeout; private int _wielderGravityGunSlot = -1; private bool _targetIsEmptyCart; private GameObject _targetCartGo; private float _sendTimer; private static LineRenderer s_tetherLine; private static uint s_wielderNetId; private static uint s_targetNetId; private static GameObject s_tetherVfxInstance; private static bool s_tetherActive; private static Vector3 s_wielderPos; private static Vector3 s_aimDir; private static float s_tetherRadius; private static Coroutine s_tetherCoroutine; private static PlayerMovement s_tetherMovement; public bool LocalSessionActive { get; private set; } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).isOwned && (LocalSessionActive || s_tetherActive)) { UpdateTetherLine(); } if (!((NetworkBehaviour)this).isOwned || !LocalSessionActive) { return; } _sendTimer -= Time.deltaTime; if (_sendTimer <= 0f) { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { NetworkClient.Send(new GravityGunAimTickMessage { WielderPos = ((Component)this).transform.position, AimDir = ((Component)main).transform.forward }, 0); } _sendTimer = ModConfig.GravityGun.InputSendInterval.Value; } } public void ClientUse() { if (((NetworkBehaviour)this).isOwned) { NetworkIdentity val = GravityGunOverlay.Instance?.BestTargetIdentity; if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] ClientUse: no valid target in cone."); return; } IssaPluginPlugin.Log.LogInfo((object)$"[GravityGun] ClientUse: locking onto netId={val.netId}."); NetworkClient.Send(new GravityGunLockOnMessage { TargetNetId = val.netId }, 0); } } public void ServerHandleLockOn(NetworkConnectionToClient conn, GravityGunLockOnMessage msg) { //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_0219: 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_0229: 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_0232: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } if (!GlobalSessionLock.TryAcquire(this)) { IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Server: session busy — rejecting lock-on."); NetworkConnectionToClient connectionToClient = ((NetworkBehaviour)this).connectionToClient; if (connectionToClient != null) { ((NetworkConnection)connectionToClient).Send(default(GravityGunBusyMessage), 0); } return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null || component.GetEffectivelyEquippedItem(true) != ItemRegistry.GravityGunItemType) { IssaPluginPlugin.Log.LogWarning((object)"[GravityGun] Server: wielder does not have Gravity Gun equipped."); GlobalSessionLock.Release(); return; } _wielderGravityGunSlot = ((!((NetworkBehaviour)component).isLocalPlayer && NetworkServer.active) ? component.PlayerInfo.NetworkedEquippedItemIndex : component.EquippedItemIndex); if (!NetworkServer.spawned.TryGetValue(msg.TargetNetId, out var value)) { IssaPluginPlugin.Log.LogWarning((object)$"[GravityGun] Server: target netId={msg.TargetNetId} not found."); GlobalSessionLock.Release(); _wielderGravityGunSlot = -1; return; } PlayerInfo val = ((Component)value).GetComponentInParent(); GolfCartInfo component2 = ((Component)value).GetComponent(); uint num = msg.TargetNetId; NetworkConnectionToClient val2; if ((Object)(object)val != (Object)null) { val2 = value.connectionToClient; } else { if (!((Object)(object)component2 != (Object)null)) { IssaPluginPlugin.Log.LogWarning((object)"[GravityGun] Server: target is neither a player nor a golf cart."); GlobalSessionLock.Release(); _wielderGravityGunSlot = -1; return; } PlayerInfo val3 = default(PlayerInfo); if (component2.TryGetDriver(ref val3) && (Object)(object)val3 != (Object)null) { val = val3; val2 = ((NetworkBehaviour)val3).netIdentity.connectionToClient; num = ((NetworkBehaviour)val3).netIdentity.netId; IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Server: cart target has driver — redirecting to driver."); } else { val2 = null; IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Server: empty cart target — server will apply force."); } } if ((Object)(object)val != (Object)null && val.IsElectromagnetShieldActive) { IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Server: target has electromagnetic shield — rejecting lock-on."); GlobalSessionLock.Release(); _wielderGravityGunSlot = -1; PlayerInfo obj = val; Vector3 val4 = ((Component)val).transform.position - ((Component)this).transform.position; obj.PlayElectromagnetShieldHitForAllClients(((Vector3)(ref val4)).normalized, false); return; } _serverSessionActive = true; _targetConn = val2; _targetInfo = val; _targetIsEmptyCart = (Object)(object)component2 != (Object)null && val2 == null; _targetCartGo = (_targetIsEmptyCart ? ((Component)component2).gameObject : null); uint netId = ((Component)this).GetComponent().netId; IssaPluginPlugin.Log.LogInfo((object)("[GravityGun] Server: session started. " + $"wielder={netId} target={num}" + (_targetIsEmptyCart ? " (empty cart)" : ""))); NetworkServer.SendToAll(new GravityGunConnectedMessage { WielderNetId = netId, TargetNetId = num, TetherRadius = ModConfig.GravityGun.TetherRadius.Value, Duration = ModConfig.GravityGun.TetherDuration.Value }, 0, false); _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerTimeoutCoroutine()); } public void ServerHandleAimTick(NetworkConnectionToClient conn, GravityGunAimTickMessage msg) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) if (!((NetworkBehaviour)this).isServer || !_serverSessionActive) { return; } if (_targetIsEmptyCart && (Object)(object)_targetCartGo != (Object)null) { Rigidbody component = _targetCartGo.GetComponent(); if (!((Object)(object)component != (Object)null) || !(((Vector3)(ref msg.AimDir)).sqrMagnitude > 0.0001f)) { return; } float value = ModConfig.GravityGun.TetherRadius.Value; Vector3 val = msg.WielderPos + ((Vector3)(ref msg.AimDir)).normalized * value; Vector3 val2 = val - component.position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 0.05f) { Vector3 val3 = val2 / magnitude; float num = magnitude * ModConfig.GravityGun.SpringForce.Value; float num2 = Vector3.Dot(component.linearVelocity, val3); float num3 = Mathf.Min(num - num2, ModConfig.GravityGun.MaxPullSpeed.Value); if (num3 > 0f) { component.AddForce(val3 * num3, (ForceMode)2); } } } else { NetworkConnectionToClient targetConn = _targetConn; if (targetConn != null) { ((NetworkConnection)targetConn).Send(new GravityGunTetherTickMessage { WielderPos = msg.WielderPos, AimDir = msg.AimDir }, 0); } } } public void ServerHandleRelease(NetworkConnectionToClient conn) { if (((NetworkBehaviour)this).isServer && _serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Server: wielder released tether."); ServerEndSession(); } } private IEnumerator ServerTimeoutCoroutine() { yield return (object)new WaitForSeconds(ModConfig.GravityGun.TetherDuration.Value); if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Server: session timed out."); ServerEndSession(); } } private void ServerEndSession() { if (!_serverSessionActive) { return; } _serverSessionActive = false; if (_wielderGravityGunSlot >= 0) { PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ItemHelper.SetCurrentItemUse(component, (ItemUseType)1); ItemHelper.DecrementAndRemove(component, _wielderGravityGunSlot); ItemHelper.SetCurrentItemUse(component, (ItemUseType)0); } } _wielderGravityGunSlot = -1; uint netId = ((Component)this).GetComponent().netId; NetworkServer.SendToAll(new GravityGunDisconnectedMessage { WielderNetId = netId }, 0, false); GlobalSessionLock.Release(); if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } _targetConn = null; _targetInfo = null; _targetIsEmptyCart = false; _targetCartGo = null; } public static void HandleGravityGunConnected(GravityGunConnectedMessage msg) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0241: 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_0257: 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) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null) { return; } if ((Object)(object)s_tetherLine != (Object)null) { Object.Destroy((Object)(object)((Component)s_tetherLine).gameObject); s_tetherLine = null; } if ((Object)(object)s_tetherVfxInstance != (Object)null) { Object.Destroy((Object)(object)s_tetherVfxInstance); s_tetherVfxInstance = null; } GameObject val = CreateTetherLine(); s_wielderNetId = msg.WielderNetId; s_targetNetId = msg.TargetNetId; if ((Object)(object)AssetLoader.GravityGunTetherVfxPrefab != (Object)null) { Transform transformByNetId = GetTransformByNetId(msg.TargetNetId); if ((Object)(object)transformByNetId != (Object)null) { s_tetherVfxInstance = Object.Instantiate(AssetLoader.GravityGunTetherVfxPrefab, transformByNetId.position, Quaternion.identity, transformByNetId); } } NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == msg.WielderNetId) { GravityGunNetworkBridge component2 = ((Component)localPlayerInfo).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.OnLocalSessionStarted(); } } if (num != msg.TargetNetId) { return; } PlayerMovement movement = localPlayerInfo.Movement; if ((Object)(object)movement == (Object)null) { return; } s_tetherActive = true; s_tetherRadius = msg.TetherRadius; s_wielderPos = ((Component)localPlayerInfo).transform.position; s_aimDir = Vector3.zero; s_tetherMovement = movement; s_tetherCoroutine = ((MonoBehaviour)movement).StartCoroutine(TetherCoroutine(msg.Duration)); PlayerInfo val2 = null; NetworkIdentity component3 = ((Component)localPlayerInfo).GetComponent(); foreach (KeyValuePair item in NetworkClient.spawned) { if (item.Key == msg.WielderNetId) { NetworkIdentity value = item.Value; val2 = ((value != null) ? ((Component)value).GetComponentInParent() : null); break; } } if ((Object)(object)val2 != (Object)null) { ItemUseId val3 = default(ItemUseId); ((ItemUseId)(ref val3))..ctor(val2.PlayerId.Guid, GravityGunItem.NextUseIndex(), (ItemType)7, false); bool flag = default(bool); movement.TryKnockOut(val2, (KnockoutType)7, false, ((Component)movement).transform.InverseTransformPoint(((Component)val2).transform.position), Vector3.Distance(((Component)localPlayerInfo).transform.position, ((Component)val2).transform.position), Vector3.zero, (ElectromagnetShieldHitBlockType)0, val3, false, true, ref flag, ref flag); } IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Client: tether coroutine started (local player is target)."); } public static void HandleGravityGunTetherTick(GravityGunTetherTickMessage msg) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) s_wielderPos = msg.WielderPos; s_aimDir = msg.AimDir; } public static void HandleGravityGunDisconnected(GravityGunDisconnectedMessage msg) { if (s_tetherCoroutine != null && (Object)(object)s_tetherMovement != (Object)null) { ((MonoBehaviour)s_tetherMovement).StopCoroutine(s_tetherCoroutine); } s_tetherCoroutine = null; s_tetherMovement = null; s_tetherActive = false; if ((Object)(object)s_tetherLine != (Object)null) { Object.Destroy((Object)(object)((Component)s_tetherLine).gameObject); s_tetherLine = null; } if ((Object)(object)s_tetherVfxInstance != (Object)null) { Object.Destroy((Object)(object)s_tetherVfxInstance); s_tetherVfxInstance = null; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == msg.WielderNetId) { ((Component)localPlayerInfo).GetComponent()?.OnLocalSessionEnded(); } } IssaPluginPlugin.Log.LogInfo((object)$"[GravityGun] Client: session disconnected (wielderNetId={msg.WielderNetId})."); } public static void HandleGravityGunBusy(GravityGunBusyMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[GravityGun] Session busy — another Gravity Gun is already active."); GravityGunOverlay.Instance?.ShowBusy(); } private static IEnumerator TetherCoroutine(float maxDuration) { float elapsed = 0f; while (elapsed < maxDuration && s_tetherActive) { PlayerInfo localInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localInfo == (Object)null) { break; } GolfCartSeat seat = localInfo.ActiveGolfCartSeat; Rigidbody rb = ((((GolfCartSeat)(ref seat)).IsValid() && (Object)(object)seat.golfCart != (Object)null) ? seat.golfCart.AsEntity.Rigidbody : ((Component)localInfo).GetComponentInParent()); if ((Object)(object)rb != (Object)null && ((Vector3)(ref s_aimDir)).sqrMagnitude > 0.0001f) { Vector3 desiredPos = s_wielderPos + ((Vector3)(ref s_aimDir)).normalized * s_tetherRadius; Vector3 toDesired = desiredPos - rb.position; float dist = ((Vector3)(ref toDesired)).magnitude; if (dist > 0.05f) { Vector3 dir = toDesired / dist; float springForce = ModConfig.GravityGun.SpringForce.Value; float maxPullSpeed = ModConfig.GravityGun.MaxPullSpeed.Value; float targetSpeed = dist * springForce; float currentSpeed = Vector3.Dot(rb.linearVelocity, dir); float deficit = Mathf.Min(targetSpeed - currentSpeed, maxPullSpeed); if (deficit > 0f) { rb.AddForce(dir * deficit, (ForceMode)2); } } } elapsed += Time.fixedDeltaTime; yield return (object)new WaitForFixedUpdate(); seat = default(GolfCartSeat); } } private static GameObject CreateTetherLine() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GravityGunTetherLine"); s_tetherLine = val.AddComponent(); s_tetherLine.positionCount = 2; s_tetherLine.startWidth = 0.1f; s_tetherLine.endWidth = 0.06f; ((Renderer)s_tetherLine).material = new Material(Shader.Find("Sprites/Default")); s_tetherLine.startColor = new Color(0.3f, 0.8f, 1f, 0.9f); s_tetherLine.endColor = new Color(1f, 1f, 0.5f, 0.5f); s_tetherLine.useWorldSpace = true; Object.DontDestroyOnLoad((Object)(object)val); return val; } private void UpdateTetherLine() { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)s_tetherLine == (Object)null)) { Transform transformByNetId = GetTransformByNetId(s_wielderNetId); Transform transformByNetId2 = GetTransformByNetId(s_targetNetId); if ((Object)(object)transformByNetId != (Object)null && (Object)(object)transformByNetId2 != (Object)null) { s_tetherLine.SetPosition(0, transformByNetId.position + Vector3.up * 1f); s_tetherLine.SetPosition(1, transformByNetId2.position + Vector3.up * 1f); } } } private static Transform GetTransformByNetId(uint netId) { if (netId == 0) { return null; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == netId) { return ((Component)localPlayerInfo).transform; } } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (!((Object)(object)item == (Object)null)) { NetworkIdentity component2 = ((Component)item).GetComponent(); uint num2 = ((component2 != null) ? component2.netId : 0u); if (num2 == netId) { return ((Component)item).transform; } } } } if (NetworkClient.spawned.TryGetValue(netId, out var value) && (Object)(object)value != (Object)null) { return ((Component)value).transform; } return null; } private void OnLocalSessionStarted() { LocalSessionActive = true; _sendTimer = 0f; } private void OnLocalSessionEnded() { LocalSessionActive = false; _sendTimer = 0f; } public override void ServerHoleCleanup() { if (_serverSessionActive) { ServerEndSession(); } if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } } public override void ClientHoleCleanup() { //IL_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (s_tetherCoroutine != null && (Object)(object)s_tetherMovement != (Object)null) { ((MonoBehaviour)s_tetherMovement).StopCoroutine(s_tetherCoroutine); } if ((Object)(object)s_tetherLine != (Object)null) { Object.Destroy((Object)(object)((Component)s_tetherLine).gameObject); s_tetherLine = null; } if ((Object)(object)s_tetherVfxInstance != (Object)null) { Object.Destroy((Object)(object)s_tetherVfxInstance); s_tetherVfxInstance = null; } s_tetherCoroutine = null; s_tetherMovement = null; s_tetherActive = false; s_wielderNetId = 0u; s_targetNetId = 0u; s_wielderPos = Vector3.zero; s_aimDir = Vector3.zero; s_tetherRadius = 0f; OnLocalSessionEnded(); } } public class HarrierBehaviour : MonoBehaviour { private enum Phase { FlyIn, Hover, FlyOut } public Vector3 HoverTarget; public Vector3 FlyOutTarget; public float ApproachSpeed; public float DriftSpeed; public float HoverRadius; private Phase _phase = Phase.FlyIn; private Rigidbody _rb; private Vector3 _initialCenter; private Vector3 _currentDriftTarget; private float _driftRefreshTimer; private const float DriftRefreshInterval = 1.5f; private const float ArrivalThreshold = 4f; private const float FlyOutCompleteThreshold = 10f; private const float FlyOutSpeedMultiplier = 1.5f; public bool HasArrived => _phase != Phase.FlyIn; public bool IsComplete { get; private set; } private void Awake() { _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { _rb = ((Component)this).gameObject.AddComponent(); } _rb.isKinematic = true; _rb.useGravity = false; } private void Start() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) _initialCenter = HoverTarget; _currentDriftTarget = HoverTarget; } private void FixedUpdate() { switch (_phase) { case Phase.FlyIn: UpdateFlyIn(); break; case Phase.Hover: UpdateHover(); break; case Phase.FlyOut: UpdateFlyOut(); break; } } private void UpdateFlyIn() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) Vector3 val = HoverTarget - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 4f) { _rb.MovePosition(HoverTarget); _phase = Phase.Hover; return; } Vector3 val2 = ((Vector3)(ref val)).normalized * (ApproachSpeed * Time.fixedDeltaTime); if (((Vector3)(ref val2)).magnitude > magnitude) { val2 = val; } _rb.MovePosition(((Component)this).transform.position + val2); if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { _rb.MoveRotation(Quaternion.LookRotation(((Vector3)(ref val)).normalized)); } } private void UpdateHover() { //IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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) _driftRefreshTimer -= Time.fixedDeltaTime; if (_driftRefreshTimer <= 0f) { _driftRefreshTimer = 1.5f; RefreshDriftTarget(); } Vector3 val = _currentDriftTarget - ((Component)this).transform.position; if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val2 = ((Vector3)(ref val)).normalized * (DriftSpeed * Time.fixedDeltaTime); if (((Vector3)(ref val2)).magnitude > ((Vector3)(ref val)).magnitude) { val2 = val; } _rb.MovePosition(((Component)this).transform.position + val2); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val.x, 0f, val.z); if (((Vector3)(ref val3)).magnitude > 0.5f) { _rb.MoveRotation(Quaternion.LookRotation(((Vector3)(ref val3)).normalized)); } } private void UpdateFlyOut() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) Vector3 val = FlyOutTarget - ((Component)this).transform.position; if (((Vector3)(ref val)).magnitude <= 10f) { IsComplete = true; return; } float num = ApproachSpeed * 1.5f; _rb.MovePosition(((Component)this).transform.position + ((Vector3)(ref val)).normalized * (num * Time.fixedDeltaTime)); _rb.MoveRotation(Quaternion.LookRotation(((Vector3)(ref val)).normalized)); } public void BeginFlyOut() { _phase = Phase.FlyOut; } private void RefreshDriftTarget() { //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_0016: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) PlayerInventory[] array = Object.FindObjectsByType((FindObjectsSortMode)0); if (array.Length == 0) { _currentDriftTarget = _initialCenter; return; } Vector3 val = Vector3.zero; PlayerInventory[] array2 = array; foreach (PlayerInventory val2 in array2) { val += ((Component)val2).transform.position; } Vector3 val3 = val / (float)array.Length; val3.y = _initialCenter.y; Vector3 val4 = val3 - _initialCenter; if (((Vector3)(ref val4)).magnitude > HoverRadius) { val3 = _initialCenter + ((Vector3)(ref val4)).normalized * HoverRadius; } _currentDriftTarget = val3; } } public class HarrierClientSetup : MonoBehaviour { private void Awake() { if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } } } public class HarrierCrashBehaviour : MonoBehaviour { public PlayerInventory ThrowerInventory; public Vector3 KillingRocketDir; public float ExplosionScale; private Rigidbody _rb; private bool _impacted; private float _lifetime; private const float MaxLifetime = 20f; private const float ImpactProximity = 3f; private const float InitialDownSpeed = 15f; private const float RocketImpulse = 25f; private GameObject _smokeTrail; private GameObject _fireTrail; public bool IsComplete { get; private set; } private void Start() { //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_007a: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0153: 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_015d: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AssetLoader.MaydaySmokeTrailPrefab != (Object)null) { _smokeTrail = Object.Instantiate(AssetLoader.MaydaySmokeTrailPrefab, ((Component)this).transform.position, Quaternion.identity); _smokeTrail.transform.SetParent(((Component)this).transform, true); } else { IssaPluginPlugin.Log.LogWarning((object)"[Mayday] Smoke trail prefab not loaded."); } if ((Object)(object)AssetLoader.MaydayFireTrailPrefab != (Object)null) { _fireTrail = Object.Instantiate(AssetLoader.MaydayFireTrailPrefab, ((Component)this).transform.position, Quaternion.identity); _fireTrail.transform.SetParent(((Component)this).transform, true); } else { IssaPluginPlugin.Log.LogWarning((object)"[Mayday] Fire trail prefab not loaded."); } HarrierBehaviour component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { _rb = ((Component)this).gameObject.AddComponent(); } _rb.isKinematic = false; _rb.useGravity = true; Vector3 val = ((Component)this).transform.forward * ModConfig.Harrier.ApproachSpeed.Value * 0.125f + Vector3.down * 15f; if (KillingRocketDir != Vector3.zero) { val += KillingRocketDir * 25f; } _rb.linearVelocity = val; _rb.AddTorque(new Vector3(Random.Range(-1f, 1f), Random.Range(-0.5f, 0.5f), Random.Range(-1f, 1f)) * 3f, (ForceMode)1); } private void FixedUpdate() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || _impacted) { return; } _lifetime += Time.fixedDeltaTime; if (_lifetime >= 20f) { Impact(); return; } if (Physics.Raycast(((Component)this).transform.position, Vector3.down, 3f)) { Impact(); return; } if ((Object)(object)_rb != (Object)null) { Vector3 linearVelocity = _rb.linearVelocity; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (magnitude > 0.1f && linearVelocity.y < 0f) { float num = magnitude * Time.fixedDeltaTime + 3f; if (Physics.Raycast(((Component)this).transform.position, ((Vector3)(ref linearVelocity)).normalized, num)) { Impact(); return; } } } if (((Component)this).transform.position.y <= 0f) { Impact(); } } private void Impact() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!_impacted) { _impacted = true; IsComplete = true; IssaPluginPlugin.Log.LogInfo((object)$"[HarrierCrash] Impact at {((Component)this).transform.position:F0}."); if ((Object)(object)ThrowerInventory != (Object)null) { HarrierItem.SpawnAndExplodeImpactRocket(ThrowerInventory, ((Component)this).transform.position, ExplosionScale); } VfxManager.PlayPooledVfxLocalOnly((VfxType)37, ((Component)this).transform.position, Quaternion.identity, Vector3.one * ModConfig.AC130.MaydayExplosionScale.Value, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, ((Component)this).transform.position, 1f, 1f); Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class HarrierHitReceiver : CustomHittable { public Vector3 LastHitWorldPos; private bool _shotDown; private void Awake() { base.HitCount = 0; base.HitsRequired = (int)ModConfig.Harrier.HitsToDestroy.Value; base.OnHit = (Action)Delegate.Combine(base.OnHit, new Action(HandleHit)); } private void HandleHit() { if (NetworkServer.active && !_shotDown && base.HitsRequired > 0 && base.HitCount < base.HitsRequired) { base.HitCount++; IssaPluginPlugin.Log.LogInfo((object)$"[Harrier] Rocket impact {base.HitCount}/{base.HitsRequired}."); if (base.HitCount >= base.HitsRequired) { _shotDown = true; IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Hit threshold reached — crashing."); base.OnHitsExceeded?.Invoke(); } } } } public static class HarrierItem { private static int _useIndex; private static readonly MethodInfo ServerExplodeMethod = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); public static readonly Dictionary ActiveHarrierRocketIds = new Dictionary(); public static void SpawnRocketAtTarget(PlayerInventory inventory, Vector3 fromPosition, Vector3 targetPosition) { //IL_0014: 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_0016: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_00f1: 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_0048: 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_0052: 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_0105: 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_007d: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } Vector3 val = targetPosition - fromPosition; Vector3 normalized = ((Vector3)(ref val)).normalized; float value = ModConfig.Harrier.RocketJitter.Value; if (value > 0f) { Vector3 val2 = Vector3.Cross(normalized, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.Cross(normalized, Vector3.right); } ((Vector3)(ref val2)).Normalize(); val = Vector3.Cross(normalized, val2); Vector3 normalized2 = ((Vector3)(ref val)).normalized; float num = Random.value * 360f * (MathF.PI / 180f); float num2 = Mathf.Tan(value * (MathF.PI / 180f)) * Random.value; val = normalized + (Mathf.Cos(num) * val2 + Mathf.Sin(num) * normalized2) * num2; normalized = ((Vector3)(ref val)).normalized; } Quaternion val3 = ((normalized != Vector3.zero) ? Quaternion.LookRotation(normalized) : Quaternion.identity); _useIndex++; ItemUseId val4 = default(ItemUseId); ((ItemUseId)(ref val4))..ctor(inventory.PlayerInfo.PlayerId.Guid, _useIndex, (ItemType)7, false); Vector3 val5 = fromPosition + normalized * 15f; Rocket val6 = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, val5, val3); if ((Object)(object)val6 == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Harrier] Rocket did not instantiate."); return; } ((Component)val6).gameObject.AddComponent(); val6.ServerInitialize(inventory.PlayerInfo, (Hittable)null, val4); NetworkServer.Spawn(((Component)val6).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val6, ModConfig.Harrier.ExplosionScale.Value); HarrierNetworkBridge component = ((Component)inventory).GetComponent(); NetworkConnectionToClient value2 = ((component != null) ? ((NetworkBehaviour)component).connectionToClient : null); ActiveHarrierRocketIds[((Object)((Component)val6).gameObject).GetInstanceID()] = value2; } public static void SpawnAndExplodeImpactRocket(PlayerInventory inventory, Vector3 position, float explosionScale) { //IL_0046: 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_0084: 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) if (NetworkServer.active) { _useIndex++; ItemUseId val = default(ItemUseId); ((ItemUseId)(ref val))..ctor(inventory.PlayerInfo.PlayerId.Guid, _useIndex, (ItemType)7, false); Rocket val2 = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val2 == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Harrier] Impact rocket did not instantiate."); return; } ((Component)val2).gameObject.AddComponent(); val2.ServerInitialize(inventory.PlayerInfo, (Hittable)null, val); NetworkServer.Spawn(((Component)val2).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val2, explosionScale); ServerExplodeMethod?.Invoke(val2, new object[1] { position }); } } public static List GetValidTargets(PlayerInfo throwerInfo, bool friendlyFireEnabled) { List list = new List(); PlayerInventory[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (PlayerInventory val in array) { if (friendlyFireEnabled || val.PlayerInfo.PlayerId.Guid != throwerInfo.PlayerId.Guid) { list.Add(val); } } return list; } public static bool FireAtRandomTarget(PlayerInventory inventory, Vector3 fromPosition, bool friendlyFireEnabled) { //IL_0033: 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) List validTargets = GetValidTargets(inventory.PlayerInfo, friendlyFireEnabled); if (validTargets.Count == 0) { return false; } PlayerInventory val = validTargets[Random.Range(0, validTargets.Count)]; SpawnRocketAtTarget(inventory, fromPosition, ((Component)val).transform.position); return true; } } public class HarrierItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.HarrierItemType; public override string DisplayName => "Harrier Jet"; public override string[] ConsoleAliases => new string[3] { "harrier", "harrierjet", "jet" }; public override Sprite Icon => AssetLoader.HarrierIcon; public override GameObject HeldModelPrefab => AssetLoader.HarrierTabletPrefab; public override int MaxUses => (int)ModConfig.Harrier.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.Harrier.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { NetworkConnection connectionToServer = ((NetworkBehaviour)inventory).connectionToServer; if (connectionToServer != null) { connectionToServer.Send(default(HarrierRequestMessage), 0); } } } public class HarrierMarker : MonoBehaviour { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct HarrierRequestMessage : NetworkMessage { } public static class HarrierRequestMessageSerialization { public static void WriteHarrierRequestMessage(NetworkWriter writer, HarrierRequestMessage msg) { } public static HarrierRequestMessage ReadHarrierRequestMessage(NetworkReader reader) { return default(HarrierRequestMessage); } } public struct HarrierBeginClientMessage : NetworkMessage { public Vector3 HoverCenter; } public static class HarrierBeginClientMessageSerialization { public static void WriteHarrierBeginClientMessage(NetworkWriter writer, HarrierBeginClientMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.HoverCenter); } public static HarrierBeginClientMessage ReadHarrierBeginClientMessage(NetworkReader reader) { //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) return new HarrierBeginClientMessage { HoverCenter = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct HarrierEndClientMessage : NetworkMessage { } public static class HarrierEndClientMessageSerialization { public static void WriteHarrierEndClientMessage(NetworkWriter writer, HarrierEndClientMessage msg) { } public static HarrierEndClientMessage ReadHarrierEndClientMessage(NetworkReader reader) { return default(HarrierEndClientMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct HarrierPrepareHomingMessage : NetworkMessage { } public static class HarrierPrepareHomingMessageSerialization { public static void WriteHarrierPrepareHomingMessage(NetworkWriter writer, HarrierPrepareHomingMessage msg) { } public static HarrierPrepareHomingMessage ReadHarrierPrepareHomingMessage(NetworkReader reader) { return default(HarrierPrepareHomingMessage); } } public struct HarrierShotDownMessage : NetworkMessage { public uint HarrierNetId; public override string ToString() { return $"HarrierShotDownMessage[HarrierNetId={HarrierNetId}]"; } } public static class HarrierShotDownMessageSerialization { public static void WriteHarrierShotDownMessage(NetworkWriter writer, HarrierShotDownMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.HarrierNetId); } public static HarrierShotDownMessage ReadHarrierShotDownMessage(NetworkReader reader) { return new HarrierShotDownMessage { HarrierNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public struct HarrierDamagedMessage : NetworkMessage { public uint HarrierNetId; } public static class HarrierDamagedMessageSerialization { public static void WriteHarrierDamagedMessage(NetworkWriter writer, HarrierDamagedMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.HarrierNetId); } public static HarrierDamagedMessage ReadHarrierDamagedMessage(NetworkReader reader) { return new HarrierDamagedMessage { HarrierNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public class HarrierNetworkBridge : NetworkBridgeBase { public bool PendingHarrierHoming; private bool _serverRoutineActive; private bool _shotDown; private Coroutine _serverRoutine; private GameObject _serverHarrier; public bool LocalSessionActive { get; private set; } public override void OnStopServer() { if (_serverRoutineActive) { ForceServerCleanup(); } } public void ServerHandleRequest() { if (_serverRoutineActive) { IssaPluginPlugin.Log.LogWarning((object)"[Harrier] Session already active for this player — ignoring."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Harrier] No PlayerInventory on bridge object."); } else { _serverRoutine = ((MonoBehaviour)this).StartCoroutine(ServerHarrierRoutine(component)); } } private IEnumerator ServerHarrierRoutine(PlayerInventory inventory) { _serverRoutineActive = true; ItemHelper.ConsumeEquippedItem(inventory); Vector3 mapCenter = ComputeMapCenter(); float altitude = ModConfig.Harrier.Altitude.Value; Vector3 hoverPos = new Vector3(mapCenter.x, mapCenter.y + altitude, mapCenter.z); float approachAngle = Random.value * 360f * (MathF.PI / 180f); Vector3 approachDir = new Vector3(Mathf.Cos(approachAngle), 0f, Mathf.Sin(approachAngle)); float approachDist = ModConfig.Harrier.ApproachDistance.Value; Vector3 spawnPos = hoverPos + approachDir * approachDist; Vector3 flyOutPos = hoverPos + approachDir * (approachDist * 1.5f); GameObject harrierGo = SpawnHarrierObject(spawnPos, hoverPos); if ((Object)(object)harrierGo == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Harrier] Failed to spawn harrier object."); _serverRoutineActive = false; yield break; } _serverHarrier = harrierGo; _shotDown = false; HarrierBehaviour behaviour = harrierGo.AddComponent(); behaviour.HoverTarget = hoverPos; behaviour.FlyOutTarget = flyOutPos; behaviour.ApproachSpeed = ModConfig.Harrier.ApproachSpeed.Value; behaviour.DriftSpeed = ModConfig.Harrier.DriftSpeed.Value; behaviour.HoverRadius = ModConfig.Harrier.HoverRadius.Value; HarrierHitReceiver hitReceiver = harrierGo.AddComponent(); NetworkIdentity harrierIdentity = harrierGo.GetComponent(); ItemWarningBroadcaster.Broadcast(inventory.PlayerInfo.PlayerId.PlayerName, ItemRegistry.HarrierItemType, "Harrier Jet", harrierIdentity.netId, ((NetworkBehaviour)this).netId); HarrierHitReceiver harrierHitReceiver = hitReceiver; harrierHitReceiver.OnHit = (Action)Delegate.Combine(harrierHitReceiver.OnHit, (Action)delegate { if (hitReceiver.HitsRequired > 0 && hitReceiver.HitCount > 0 && hitReceiver.HitCount < hitReceiver.HitsRequired) { IssaPluginPlugin.Log.LogInfo((object)$"[Harrier] Damaged ({hitReceiver.HitCount}/{hitReceiver.HitsRequired}) — broadcasting smoke."); NetworkServer.SendToAll(new HarrierDamagedMessage { HarrierNetId = harrierIdentity.netId }, 0, false); } }); HarrierHitReceiver harrierHitReceiver2 = hitReceiver; harrierHitReceiver2.OnHitsExceeded = (Action)Delegate.Combine(harrierHitReceiver2.OnHitsExceeded, (Action)delegate { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!_shotDown && !((Object)(object)harrierGo == (Object)null)) { _shotDown = true; IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Shot down — initiating crash."); NetworkServer.SendToAll(new HarrierShotDownMessage { HarrierNetId = harrierIdentity.netId }, 0, false); HarrierCrashBehaviour harrierCrashBehaviour = harrierGo.AddComponent(); harrierCrashBehaviour.ThrowerInventory = inventory; Vector3 val = harrierGo.transform.position - hitReceiver.LastHitWorldPos; harrierCrashBehaviour.KillingRocketDir = ((Vector3)(ref val)).normalized; harrierCrashBehaviour.ExplosionScale = ModConfig.Harrier.CrashExplosionScale.Value; } }); IssaPluginPlugin.Log.LogInfo((object)$"[Harrier] Jet spawned at {spawnPos:F0}, heading to {hoverPos:F0}."); NetworkServer.SendToAll(new HarrierBeginClientMessage { HoverCenter = mapCenter }, 0, false); float flyInTimeout = approachDist / Mathf.Max(ModConfig.Harrier.ApproachSpeed.Value, 1f) + 8f; float elapsed = 0f; while ((Object)(object)harrierGo != (Object)null && (Object)(object)behaviour != (Object)null && !behaviour.HasArrived && !_shotDown && elapsed < flyInTimeout) { elapsed += Time.deltaTime; yield return null; } if ((Object)(object)harrierGo == (Object)null || (Object)(object)behaviour == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[Harrier] Jet destroyed before arriving — aborting session."); ForceServerCleanup(); yield break; } IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Jet arrived — beginning attack phase."); float duration = ModConfig.Harrier.Duration.Value; float fireInterval = ModConfig.Harrier.FireInterval.Value; bool friendlyFire = ModConfig.Harrier.FriendlyFire.Value; float sessionElapsed = 0f; float fireCooldown = fireInterval * 0.5f; while (sessionElapsed < duration && (Object)(object)harrierGo != (Object)null && !_shotDown) { sessionElapsed += Time.deltaTime; fireCooldown -= Time.deltaTime; if (fireCooldown <= 0f) { fireCooldown = fireInterval; HarrierItem.FireAtRandomTarget(inventory, harrierGo.transform.position, friendlyFire); } yield return null; } if (_shotDown) { float crashTimeout = 20f; elapsed = 0f; GameObject obj = harrierGo; HarrierCrashBehaviour crashBehaviour = ((obj != null) ? obj.GetComponent() : null); while ((Object)(object)harrierGo != (Object)null && (Object)(object)crashBehaviour != (Object)null && !crashBehaviour.IsComplete && elapsed < crashTimeout) { elapsed += Time.deltaTime; yield return null; } } else if ((Object)(object)harrierGo != (Object)null && (Object)(object)behaviour != (Object)null) { behaviour.BeginFlyOut(); IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Beginning fly-out."); float flyOutTimeout = 12f; elapsed = 0f; while ((Object)(object)harrierGo != (Object)null && (Object)(object)behaviour != (Object)null && !behaviour.IsComplete && elapsed < flyOutTimeout) { elapsed += Time.deltaTime; yield return null; } } if ((Object)(object)harrierGo != (Object)null) { NetworkServer.Destroy(harrierGo); } NetworkServer.SendToAll(default(HarrierEndClientMessage), 0, false); _serverHarrier = null; _serverRoutineActive = false; _serverRoutine = null; IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Session complete."); } private static Vector3 ComputeMapCenter() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0069: Unknown result type (might be due to invalid IL or missing references) PlayerInventory[] array = Object.FindObjectsByType((FindObjectsSortMode)0); if (array.Length == 0) { return Vector3.zero; } Vector3 val = Vector3.zero; PlayerInventory[] array2 = array; foreach (PlayerInventory val2 in array2) { val += ((Component)val2).transform.position; } Vector3 result = val / (float)array.Length; result.y = 0f; return result; } private static GameObject SpawnHarrierObject(Vector3 spawnPos, Vector3 hoverPos) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AssetLoader.HarrierPrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Harrier] HarrierPrefab is null — was AssetLoader.Load() called?"); return null; } GameObject val = Object.Instantiate(AssetLoader.HarrierPrefab, spawnPos, Quaternion.identity); if ((Object)(object)val == (Object)null) { return null; } Rigidbody component = val.GetComponent(); if ((Object)(object)component == (Object)null) { component = val.AddComponent(); component.isKinematic = true; component.useGravity = false; } Vector3 val2 = hoverPos - spawnPos; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f) { val.transform.rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized); } NetworkServer.Spawn(val, (NetworkConnectionToClient)null); return val; } private void ForceServerCleanup() { if (_serverRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverRoutine); _serverRoutine = null; } if ((Object)(object)_serverHarrier != (Object)null) { NetworkServer.Destroy(_serverHarrier); _serverHarrier = null; } _serverRoutineActive = false; } public static void ClientHandleBegin(HarrierBeginClientMessage msg) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)$"[Harrier] Inbound — hover center {msg.HoverCenter:F0}."); NetworkIdentity localPlayer = NetworkClient.localPlayer; HarrierNetworkBridge harrierNetworkBridge = ((localPlayer != null) ? ((Component)localPlayer).GetComponent() : null); if ((Object)(object)harrierNetworkBridge != (Object)null) { harrierNetworkBridge.LocalSessionActive = true; } } public static void ClientHandleEnd(HarrierEndClientMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Session ended."); NetworkIdentity localPlayer = NetworkClient.localPlayer; HarrierNetworkBridge harrierNetworkBridge = ((localPlayer != null) ? ((Component)localPlayer).GetComponent() : null); if ((Object)(object)harrierNetworkBridge != (Object)null) { harrierNetworkBridge.LocalSessionActive = false; } } public static void ClientHandleDamaged(HarrierDamagedMessage msg) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)AssetLoader.MaydaySmokeTrailPrefab == (Object)null) && NetworkClient.spawned.TryGetValue(msg.HarrierNetId, out var value) && !((Object)(object)value == (Object)null)) { IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Spawning damage smoke trail."); GameObject val = Object.Instantiate(AssetLoader.MaydaySmokeTrailPrefab, ((Component)value).transform.position, Quaternion.identity); val.transform.SetParent(((Component)value).transform, true); } } public static void ClientHandleShotDown(HarrierShotDownMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[Harrier] Shot down!"); NetworkIdentity localPlayer = NetworkClient.localPlayer; HarrierNetworkBridge harrierNetworkBridge = ((localPlayer != null) ? ((Component)localPlayer).GetComponent() : null); if ((!((Object)(object)harrierNetworkBridge != (Object)null) || !harrierNetworkBridge.LocalSessionActive) && NetworkClient.spawned.TryGetValue(msg.HarrierNetId, out var value) && !((Object)(object)value == (Object)null)) { GameObject gameObject = ((Component)value).gameObject; if ((Object)(object)gameObject.GetComponent() == (Object)null) { HarrierCrashBehaviour harrierCrashBehaviour = gameObject.AddComponent(); } } } public override void ServerHoleCleanup() { HarrierItem.ActiveHarrierRocketIds.Clear(); if (_serverRoutineActive) { ForceServerCleanup(); } } public override void ClientHoleCleanup() { LocalSessionActive = false; } } public class HunterDroneBehaviour : CustomHittable { public float LaunchSpeed = 35f; public float Acceleration = 25f; public float HomingStopDistance = 10f; public float ArrivalRadius = 0.5f; public float ExplosionScale = 1.2f; public PlayerInfo ThrowerInfo; public ItemUseId ItemUseId; public bool FriendlyFire; public bool AttackFinishedPlayers; public float ArmDelay = 0.4f; public float MaxFlightDistance = 500f; public float MaxSpeed = 300f; private Vector3 _launchDirection; private bool _hasLaunchDirection; private Rigidbody _rb; private Transform _targetTransform; private Vector3 _homingTarget; private bool _homingActive; private float _currentSpeed; private bool _armed; private float _armTimer; private bool _exploded; private float _distanceTraveled; private const float NoTargetRetryInterval = 0.5f; private float _retryTimer; private static readonly MethodInfo ServerExplodeMethod = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); private readonly List<(Transform t, float sqDist)> _candidateScratch = new List<(Transform, float)>(); private readonly Collider[] _collisionBuffer = (Collider[])(object)new Collider[8]; public void SetFallbackAimPoint(Vector3 worldPoint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = worldPoint - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude > 0.001f) { _launchDirection = ((Vector3)(ref val)).normalized; _hasLaunchDirection = true; } } private void Start() { _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { _rb = ((Component)this).gameObject.AddComponent(); } _rb.isKinematic = true; _rb.useGravity = false; _currentSpeed = LaunchSpeed; _armTimer = ArmDelay; _retryTimer = 0.5f; base.OnHit = (Action)Delegate.Combine(base.OnHit, new Action(HandleHit)); ParticleSystem[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren(true); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ((Component)val).gameObject.SetActive(true); val.Play(); } TrySelectTarget(); } private void FixedUpdate() { if (!NetworkServer.active || _exploded) { return; } if (!_armed) { _armTimer -= Time.fixedDeltaTime; if (_armTimer <= 0f) { _armed = true; } } if ((Object)(object)_targetTransform != (Object)null) { PlayerInfo component = ((Component)_targetTransform).GetComponent(); if (!IsValidTarget(component)) { IssaPluginPlugin.Log.LogInfo((object)"[HunterDrone] Locked target is no longer valid — re-selecting."); _targetTransform = null; _homingActive = false; _retryTimer = 0f; } } if ((Object)(object)_targetTransform == (Object)null) { _retryTimer -= Time.fixedDeltaTime; if (_retryTimer <= 0f) { TrySelectTarget(); _retryTimer = 0.5f; } } UpdateHoming(); } private void UpdateHoming() { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e9: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (_armed && DetectExternalCollision()) { IssaPluginPlugin.Log.LogInfo((object)"[HunterDrone] Collision detected — detonating."); Detonate(); return; } _currentSpeed = Mathf.Min(_currentSpeed + Acceleration * Time.fixedDeltaTime, MaxSpeed); Vector3 val2; if ((Object)(object)_targetTransform != (Object)null) { if (_homingActive) { float num = Vector3.Distance(((Component)this).transform.position, _targetTransform.position); if (HomingStopDistance > 0f && num <= HomingStopDistance) { _homingActive = false; } else { _homingTarget = _targetTransform.position; } } Vector3 val = _homingTarget - ((Component)this).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < ArrivalRadius) { Detonate(); return; } float num2 = Mathf.Min(_currentSpeed * Time.fixedDeltaTime, magnitude); val2 = ((Vector3)(ref val)).normalized * num2; } else { Vector3 val3 = (_hasLaunchDirection ? _launchDirection : ((Component)this).transform.forward); val2 = val3 * _currentSpeed * Time.fixedDeltaTime; } _distanceTraveled += ((Vector3)(ref val2)).magnitude; if (_distanceTraveled >= MaxFlightDistance) { IssaPluginPlugin.Log.LogInfo((object)$"[HunterDrone] Max flight distance ({MaxFlightDistance:F0} m) reached — detonating."); Detonate(); } else { RotateTowardStep(val2); _rb.MovePosition(((Component)this).transform.position + val2); } } private bool DetectExternalCollision() { //IL_0007: 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) int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, ArrivalRadius, _collisionBuffer, LayerMask.op_Implicit(GameManager.LayerSettings.RocketHittablesMask), (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { if (!((Component)_collisionBuffer[i]).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)_collisionBuffer[i]).GetComponentInParent() != (Object)null)) { return true; } } return false; } private void TrySelectTarget() { //IL_0031: 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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00c3: Unknown result type (might be due to invalid IL or missing references) _candidateScratch.Clear(); PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; Vector3 val; if ((Object)(object)localPlayerInfo != (Object)null && IsValidTarget(localPlayerInfo)) { val = ((Component)localPlayerInfo).transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; _candidateScratch.Add((((Component)localPlayerInfo).transform, sqrMagnitude)); } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (IsValidTarget(item)) { val = ((Component)item).transform.position - ((Component)this).transform.position; float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude; _candidateScratch.Add((((Component)item).transform, sqrMagnitude2)); } } } if (_candidateScratch.Count == 0) { return; } int index = 0; for (int i = 1; i < _candidateScratch.Count; i++) { if (_candidateScratch[i].sqDist < _candidateScratch[index].sqDist) { index = i; } } _targetTransform = _candidateScratch[index].t; _homingTarget = _targetTransform.position; _homingActive = true; IssaPluginPlugin.Log.LogInfo((object)("[HunterDrone] Locked on to " + ((Object)_targetTransform).name + " at " + $"{_targetTransform.position:F1}.")); } private bool IsValidTarget(PlayerInfo player) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 if ((Object)(object)player == (Object)null || !((Component)player).gameObject.activeInHierarchy) { return false; } if (!FriendlyFire && player.PlayerId.Guid == ThrowerInfo.PlayerId.Guid) { return false; } if (!AttackFinishedPlayers) { PlayerGolfer asGolfer = player.AsGolfer; if (asGolfer != null && (int)asGolfer.MatchResolution == 1) { return false; } } return true; } private void HandleHit() { if (NetworkServer.active && !_exploded) { IssaPluginPlugin.Log.LogInfo((object)"[HunterDrone] Shot down — detonating in place."); Detonate(); } } public void ShootDown() { if (NetworkServer.active && !_exploded) { base.OnHit?.Invoke(); } } public void Detonate() { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_0041: 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_0102: Unknown result type (might be due to invalid IL or missing references) if (!_exploded) { _exploded = true; Vector3 position = ((Component)this).transform.position; if ((Object)(object)_targetTransform != (Object)null) { position.y = Mathf.Min(position.y, _targetTransform.position.y + 0.5f); } IssaPluginPlugin.Log.LogInfo((object)$"[HunterDrone] Detonating at {position:F1}."); NetworkServer.SendToAll(new HunterDroneExplodedMessage { Position = position }, 0, false); Rocket val = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.AddComponent(); val.ServerInitialize(ThrowerInfo, (Hittable)null, ItemUseId); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ExplosionScale); ServerExplodeMethod?.Invoke(val, new object[1] { position }); } NetworkServer.Destroy(((Component)this).gameObject); } } private void RotateTowardStep(Vector3 direction) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002e: 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_003f: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector3)(ref direction)).sqrMagnitude < 0.0001f)) { Quaternion val = DirectionToRotation(((Vector3)(ref direction)).normalized); _rb.MoveRotation(Quaternion.RotateTowards(((Component)this).transform.rotation, val, 720f * Time.fixedDeltaTime)); } } private static Quaternion DirectionToRotation(Vector3 direction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Mathf.Abs(Vector3.Dot(direction, Vector3.up)) > 0.99f) ? Vector3.forward : Vector3.up); return Quaternion.LookRotation(direction, val); } } public class HunterDroneItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.HunterDroneItemType; public override string DisplayName => "Hunter Drone"; public override string[] ConsoleAliases => new string[3] { "hunterdrone", "hd", "hdrone" }; public override Sprite Icon => AssetLoader.HunterDroneIcon ?? AssetLoader.DroneSwarmIcon; public override GameObject HeldModelPrefab => AssetLoader.HunterDroneHandheldPrefab ?? AssetLoader.DroneControllerPrefab; public override int MaxUses => (int)ModConfig.HunterDrone.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.HunterDrone.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 0f, 0 => 0f, 2 => 2f, 4 => 4f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00b5: Unknown result type (might be due to invalid IL or missing references) Vector3 aimPoint; if (Mouse.current == null) { aimPoint = ((Component)inventory).transform.position + ((Component)inventory).transform.forward * 200f; } else { if (!Mouse.current.rightButton.isPressed) { return; } Vector2 val = ((InputControl)(object)((Pointer)Mouse.current).position).ReadValue(); Ray val2 = Camera.main.ScreenPointToRay(Vector2.op_Implicit(val)); RaycastHit val3 = default(RaycastHit); aimPoint = ((!Physics.Raycast(val2, ref val3, 500f)) ? ((Ray)(ref val2)).GetPoint(200f) : ((RaycastHit)(ref val3)).point); } NetworkConnection connectionToServer = ((NetworkBehaviour)inventory).connectionToServer; if (connectionToServer != null) { connectionToServer.Send(new HunterDroneLaunchMessage { AimPoint = aimPoint }, 0); } } } public struct HunterDroneLaunchMessage : NetworkMessage { public Vector3 AimPoint; } public static class HunterDroneLaunchMessageSerialization { public static void WriteHunterDroneLaunchMessage(NetworkWriter writer, HunterDroneLaunchMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.AimPoint); } public static HunterDroneLaunchMessage ReadHunterDroneLaunchMessage(NetworkReader reader) { //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) return new HunterDroneLaunchMessage { AimPoint = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct HunterDroneShotMessage : NetworkMessage { public uint DroneNetId; } public static class HunterDroneShotMessageSerialization { public static void WriteHunterDroneShotMessage(NetworkWriter writer, HunterDroneShotMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.DroneNetId); } public static HunterDroneShotMessage ReadHunterDroneShotMessage(NetworkReader reader) { return new HunterDroneShotMessage { DroneNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public struct HunterDroneExplodedMessage : NetworkMessage { public Vector3 Position; } public static class HunterDroneExplodedMessageSerialization { public static void WriteHunterDroneExplodedMessage(NetworkWriter writer, HunterDroneExplodedMessage msg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Position); } public static HunterDroneExplodedMessage ReadHunterDroneExplodedMessage(NetworkReader reader) { //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) return new HunterDroneExplodedMessage { Position = NetworkReaderExtensions.ReadVector3(reader) }; } } public class HunterDroneNetworkBridge : NetworkBridgeBase { private readonly List _activeDrones = new List(); private static int _useIndex; private static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } public override void OnStopServer() { if (_activeDrones.Count > 0) { IssaPluginPlugin.Log.LogInfo((object)"[HunterDrone] Player disconnected during active session — cleaning up."); ForceServerCleanup(); } } public void ServerLaunchDrone(Vector3 aimPoint) { //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) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[HunterDrone] No PlayerInventory on bridge object."); return; } if (component.GetEffectivelyEquippedItem(true) != ItemRegistry.HunterDroneItemType) { IssaPluginPlugin.Log.LogWarning((object)"[HunterDrone] Player does not have Hunter Drone item equipped."); return; } if ((Object)(object)AssetLoader.HunterDronePrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[HunterDrone] HunterDronePrefab not loaded — rebuild the asset bundle to include hunter_drone.prefab."); return; } int num = (int)ModConfig.HunterDrone.MaxActiveDrones.Value; if (_activeDrones.Count >= num) { IssaPluginPlugin.Log.LogInfo((object)$"[HunterDrone] Already at the limit of {num} active drone(s) — ignoring."); return; } ItemHelper.ConsumeEquippedItem(component); ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.HunterDroneItemType, "Hunter Drone", 0u, ((NetworkBehaviour)this).netId); SpawnDrone(component.PlayerInfo, aimPoint); } public static void ServerHandleDroneShot(uint droneNetId) { if (NetworkServer.active) { if (!NetworkServer.spawned.TryGetValue(droneNetId, out var value) || (Object)(object)value == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)$"[HunterDrone] Shot report for netId {droneNetId} — not found in spawned."); } else { ((Component)value).GetComponent()?.ShootDown(); } } } private void SpawnDrone(PlayerInfo summoner, Vector3 aimPoint) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) //IL_0046: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)summoner).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val = ((Component)summoner).transform.position + forward * 1.5f + Vector3.up * 2f; GameObject val2 = Object.Instantiate(AssetLoader.HunterDronePrefab, val, ((Component)summoner).transform.rotation); SetLayerRecursive(val2, GameManager.LayerSettings.HittablesLayer); ItemUseId itemUseId = default(ItemUseId); ((ItemUseId)(ref itemUseId))..ctor(summoner.PlayerId.Guid, NextUseIndex(), (ItemType)7, false); HunterDroneBehaviour hunterDroneBehaviour = val2.AddComponent(); hunterDroneBehaviour.LaunchSpeed = ModConfig.HunterDrone.LaunchSpeed.Value; hunterDroneBehaviour.Acceleration = ModConfig.HunterDrone.Acceleration.Value; hunterDroneBehaviour.HomingStopDistance = ModConfig.HunterDrone.HomingStopDistance.Value; hunterDroneBehaviour.ArrivalRadius = ModConfig.HunterDrone.ArrivalRadius.Value; hunterDroneBehaviour.ExplosionScale = ModConfig.HunterDrone.ExplosionScale.Value; hunterDroneBehaviour.ThrowerInfo = summoner; hunterDroneBehaviour.ItemUseId = itemUseId; hunterDroneBehaviour.MaxFlightDistance = ModConfig.HunterDrone.MaxFlightDistance.Value; hunterDroneBehaviour.MaxSpeed = ModConfig.HunterDrone.MaxSpeed.Value; hunterDroneBehaviour.FriendlyFire = ModConfig.HunterDrone.FriendlyFire.Value; hunterDroneBehaviour.AttackFinishedPlayers = ModConfig.HunterDrone.AttackFinishedPlayers.Value; hunterDroneBehaviour.ArmDelay = ModConfig.HunterDrone.ArmDelay.Value; hunterDroneBehaviour.SetFallbackAimPoint(aimPoint); NetworkServer.Spawn(val2, (NetworkConnectionToClient)null); _activeDrones.Add(val2); ((MonoBehaviour)this).StartCoroutine(WatchDrone(val2)); IssaPluginPlugin.Log.LogInfo((object)("[HunterDrone] Spawned drone for " + $"{summoner.PlayerId.PlayerName} at {val:F1}.")); } private IEnumerator WatchDrone(GameObject droneGo) { while ((Object)(object)droneGo != (Object)null) { yield return null; } _activeDrones.RemoveAll((GameObject go) => (Object)(object)go == (Object)null); IssaPluginPlugin.Log.LogInfo((object)$"[HunterDrone] Drone destroyed — {_activeDrones.Count} still active."); } public override void ServerHoleCleanup() { if (_activeDrones.Count > 0) { ForceServerCleanup(); } } public override void ClientHoleCleanup() { } private void ForceServerCleanup() { ((MonoBehaviour)this).StopAllCoroutines(); foreach (GameObject activeDrone in _activeDrones) { if ((Object)(object)activeDrone != (Object)null) { NetworkServer.Destroy(activeDrone); } } _activeDrones.Clear(); } private static void SetLayerRecursive(GameObject go, int layer) { go.layer = layer; for (int i = 0; i < go.transform.childCount; i++) { SetLayerRecursive(((Component)go.transform.GetChild(i)).gameObject, layer); } } public static void HandleDroneExploded(HunterDroneExplodedMessage msg) { //IL_0018: 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) if (!((Object)(object)AssetLoader.DroneExplosionVfxPrefab == (Object)null)) { Object.Instantiate(AssetLoader.DroneExplosionVfxPrefab, msg.Position, Quaternion.identity); } } } public interface IHoleCleanable { void ServerHoleCleanup(); void ClientHoleCleanup(); } public static class ItemHelper { public static readonly int GroundLayerMask = LayerMask.GetMask(new string[2] { "Default", "Terrain" }); private static readonly RaycastHit[] raycastHitBuffer = (RaycastHit[])(object)new RaycastHit[30]; private static readonly MethodInfo DecrementMethod = typeof(PlayerInventory).GetMethod("DecrementUseFromSlotAt", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo RemoveMethod = typeof(PlayerInventory).GetMethod("RemoveIfOutOfUses", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo SetItemUseMethod = typeof(PlayerInventory).GetMethod("SetCurrentItemUse", BindingFlags.Instance | BindingFlags.NonPublic); public static void GiveItemToLocalPlayer(ItemType itemType, int uses, string logTag) { //IL_0076: 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_003b: Unknown result type (might be due to invalid IL or missing references) PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)("[" + logTag + "] No local player inventory.")); } else if (NetworkServer.active) { if (!ItemRegistry.DirectAddCustomItem(localPlayerInventory, itemType, uses)) { IssaPluginPlugin.Log.LogWarning((object)("[" + logTag + "] Failed to add item (inventory full?).")); } } else { NetworkClient.Send(new GiveItemRequestMessage { ItemType = itemType, Uses = uses }, 0); IssaPluginPlugin.Log.LogInfo((object)("[" + logTag + "] Sent item request to server.")); } } public static void DecrementAndRemove(PlayerInventory inventory, int slotIndex) { DecrementMethod?.Invoke(inventory, new object[1] { slotIndex }); RemoveMethod?.Invoke(inventory, new object[2] { slotIndex, true }); } public static void SetCurrentItemUse(PlayerInventory inventory, ItemUseType type) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) SetItemUseMethod?.Invoke(inventory, new object[1] { type }); } public static void ConsumeItemAtSlot(PlayerInventory inventory, int slotIndex) { if (slotIndex >= 0) { SetCurrentItemUse(inventory, (ItemUseType)1); DecrementAndRemove(inventory, slotIndex); SetCurrentItemUse(inventory, (ItemUseType)0); } } public static void ConsumeEquippedItem(PlayerInventory inventory) { int num = ((!((NetworkBehaviour)inventory).isLocalPlayer && NetworkServer.active) ? inventory.PlayerInfo.NetworkedEquippedItemIndex : inventory.EquippedItemIndex); if (num >= 0) { SetCurrentItemUse(inventory, (ItemUseType)1); DecrementAndRemove(inventory, num); SetCurrentItemUse(inventory, (ItemUseType)0); } } public static float SampleTerrainY(float x, float z, float fallbackY) { //IL_000f: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(x, 2000f, z); int num = Physics.RaycastNonAlloc(val, Vector3.down, raycastHitBuffer, 4000f, LayerMask.op_Implicit(GameManager.LayerSettings.PlayerGroundableMask), (QueryTriggerInteraction)1); if (num > 0) { int num2 = 0; for (int i = 1; i < num; i++) { if (((RaycastHit)(ref raycastHitBuffer[i])).distance < ((RaycastHit)(ref raycastHitBuffer[num2])).distance) { num2 = i; } } return ((RaycastHit)(ref raycastHitBuffer[num2])).point.y + 0.5f; } return fallbackY; } } public struct ScaledExplosionVfxMessage : NetworkMessage { public Vector3 Position; public float Scale; } public static class ScaledExplosionVfxMessageSerialization { public static void WriteScaledExplosionVfxMessage(NetworkWriter writer, ScaledExplosionVfxMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Position); NetworkWriterExtensions.WriteFloat(writer, msg.Scale); } public static ScaledExplosionVfxMessage ReadScaledExplosionVfxMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new ScaledExplosionVfxMessage { Position = NetworkReaderExtensions.ReadVector3(reader), Scale = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct GiveItemRequestMessage : NetworkMessage { public ItemType ItemType; public int Uses; } public static class GiveItemRequestMessageSerialization { public static void WriteGiveItemRequestMessage(NetworkWriter writer, GiveItemRequestMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected I4, but got Unknown NetworkWriterExtensions.WriteInt(writer, (int)msg.ItemType); NetworkWriterExtensions.WriteInt(writer, msg.Uses); } public static GiveItemRequestMessage ReadGiveItemRequestMessage(NetworkReader reader) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new GiveItemRequestMessage { ItemType = (ItemType)NetworkReaderExtensions.ReadInt(reader), Uses = NetworkReaderExtensions.ReadInt(reader) }; } } public static class ItemRegistry { public static readonly ItemType BaseballBatItemType = (ItemType)100; public static readonly ItemType StealthBomberItemType = (ItemType)101; public static readonly ItemType PredatorMissileItemType = (ItemType)102; public static readonly ItemType AC130ItemType = (ItemType)103; public static readonly ItemType FreezeItemType = (ItemType)104; public static readonly ItemType LowGravityItemType = (ItemType)105; public static readonly ItemType SniperRifleItemType = (ItemType)106; public static readonly ItemType DonutItemType = (ItemType)107; public static readonly ItemType JavelinItemType = (ItemType)108; public static readonly ItemType StickyGrenadeItemType = (ItemType)109; public static readonly ItemType BearItemType = (ItemType)110; public static readonly ItemType NukeItemType = (ItemType)111; public static readonly ItemType BlackHoleGrenadeItemType = (ItemType)112; public static readonly ItemType PlaceableWallItemType = (ItemType)113; public static readonly ItemType AK47ItemType = (ItemType)114; public static readonly ItemType HarrierItemType = (ItemType)115; public static readonly ItemType PositionSwapItemType = (ItemType)116; public static readonly ItemType PoisonJarItemType = (ItemType)117; public static readonly ItemType DroneSwarmItemType = (ItemType)118; public static readonly ItemType RedBullItemType = (ItemType)119; public static readonly ItemType SuperDonutItemType = (ItemType)120; public static readonly ItemType GravityGunItemType = (ItemType)121; public static readonly ItemType RocketTetherItemType = (ItemType)122; public static readonly ItemType JetpackItemType = (ItemType)123; public static readonly ItemType TeleporterItemType = (ItemType)124; public static readonly ItemType SpinachItemType = (ItemType)125; public static readonly ItemType FlamethrowerItemType = (ItemType)126; public static readonly ItemType RocketTetherGrenadeItemType = (ItemType)127; public static readonly ItemType WindStormItemType = (ItemType)128; public static readonly ItemType HunterDroneItemType = (ItemType)129; public static readonly ItemType UfoAbductionItemType = (ItemType)130; public static readonly ItemType MoonItemType = (ItemType)131; public static readonly ItemType ShapeShifterItemType = (ItemType)132; public static readonly ItemType SuperShapeShifterItemType = (ItemType)133; public static readonly ItemType ExplosiveGolfBallsItemType = (ItemType)134; private static IReadOnlyDictionary _customItemDefinitionMap; private static readonly FieldInfo SlotsField = AccessTools.Field(typeof(PlayerInventory), "slots"); private static readonly FieldInfo AllItemField = AccessTools.Field(typeof(ItemCollection), "items"); private static readonly FieldInfo AllItemDataField = AccessTools.Field(typeof(ItemCollection), "allItemData"); private static readonly PropertyInfo IconProperty = AccessTools.Property(typeof(ItemData), "Icon"); private static readonly Dictionary CustomItemDataCache = new Dictionary(); public static IReadOnlyList AllItems { get; } = new List { new BatItemDefinition(), new StealthBomberItemDefinition(), new PredatorMissileItemDefinition(), new AC130ItemDefinition(), new FreezeItemDefinition(), new LowGravityItemDefinition(), new SniperRifleItemDefinition(), new DonutItemDefinition(), new JavelinItemDefinition(), new StickyGrenadeItemDefinition(), new BearItemDefinition(), new NukeItemDefinition(), new BlackHoleGrenadeItemDefinition(), new PlaceableWallItemDefinition(), new AK47ItemDefinition(), new HarrierItemDefinition(), new PositionSwapItemDefinition(), new PoisonJarItemDefinition(), new DroneSwarmItemDefinition(), new RedBullItemDefinition(), new SuperDonutItemDefinition(), new GravityGunItemDefinition(), new RocketTetherItemDefinition(), new JetpackItemDefinition(), new TeleporterItemDefinition(), new SpinachItemDefinition(), new FlamethrowerItemDefinition(), new RocketTetherGrenadeItemDefinition(), new WindStormItemDefinition(), new HunterDroneItemDefinition(), new UfoAbductionItemDefinition(), new MoonItemDefinition(), new ShapeShifterItemDefinition(), new SuperShapeShifterItemDefinition(), new ExplosiveGolfBallsItemDefinition() }; public static IReadOnlyDictionary CustomItemDefinitionMap { get { if (_customItemDefinitionMap == null) { _customItemDefinitionMap = AllItems.ToDictionary((CustomItemDefinition item) => (int)item.ItemType, (CustomItemDefinition item) => item); } return _customItemDefinitionMap; } } public static CustomItemDefinition GetDefinition(ItemType type) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected I4, but got Unknown CustomItemDefinition value; return CustomItemDefinitionMap.TryGetValue((int)type, out value) ? value : null; } public static bool IsCustomItem(ItemType type) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected I4, but got Unknown return CustomItemDefinitionMap.ContainsKey((int)type); } public static int GetMaxUses(ItemType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return GetDefinition(type)?.MaxUses ?? 1; } internal static ItemData GetOrCreateItemData(CustomItemDefinition def) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0067: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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) ItemType itemType = def.ItemType; if (CustomItemDataCache.TryGetValue(itemType, out var value)) { AccessTools.Property(typeof(ItemData), "MaxUses").SetValue(value, GetMaxUses(itemType)); return value; } ItemData val = new ItemData(); Type typeFromHandle = typeof(ItemData); AccessTools.Property(typeFromHandle, "Type").SetValue(val, itemType); AccessTools.Property(typeFromHandle, "MaxUses").SetValue(val, GetMaxUses(itemType)); AccessTools.Property(typeFromHandle, "Icon").SetValue(val, def.Icon); AccessTools.Property(typeFromHandle, "Prefab").SetValue(val, def.HeldModelPrefab); AccessTools.Property(typeFromHandle, "AnimatorOverrideController").SetValue(val, null); AccessTools.Property(typeFromHandle, "IsExplosive").SetValue(val, false); AccessTools.Property(typeFromHandle, "NonAimUse").SetValue(val, (object)(ItemNonAimingUse)0); AccessTools.Property(typeFromHandle, "AirhornReaction").SetValue(val, (object)(ItemAirhornReaction)0); AccessTools.Property(typeFromHandle, "CanUsageAffectBalls").SetValue(val, false); AccessTools.Property(typeFromHandle, "HitTransfersToGolfCartPassengers").SetValue(val, false); AccessTools.Property(typeFromHandle, "FlourishFrames").SetValue(val, 0f); AccessTools.Property(typeFromHandle, "DroppedLocalRotationEuler").SetValue(val, Vector3.zero); val.Initialize(); CustomItemDataCache[itemType] = val; return val; } internal static void InjectCustomItems(ItemCollection collection) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = (Dictionary)AllItemDataField.GetValue(collection); if (dictionary == null) { IssaPluginPlugin.Log.LogError((object)"[ItemRegistry] Could not inject custom items: could not find 'allItemData' field."); return; } ItemData[] array = (ItemData[])AllItemField.GetValue(collection); if (array == null) { IssaPluginPlugin.Log.LogError((object)"[ItemRegistry] Could not inject custom items: could not find 'items' field."); return; } int num = array.Length; int length = num + AllItems.Count; Type elementType = array.GetType().GetElementType(); ItemData[] array2 = (ItemData[])Array.CreateInstance(elementType, length); Array.Copy(array, array2, array.Length); ItemData value; Sprite val = (dictionary.TryGetValue((ItemType)7, out value) ? value.Icon : null); ItemData value2; Sprite val2 = (dictionary.TryGetValue((ItemType)2, out value2) ? value2.Icon : null); for (int i = 0; i < AllItems.Count; i++) { CustomItemDefinition customItemDefinition = AllItems[i]; ItemData orCreateItemData = GetOrCreateItemData(customItemDefinition); Sprite val3 = (customItemDefinition.UseRocketIconFallback ? val : val2); IconProperty.SetValue(orCreateItemData, customItemDefinition.Icon ?? val3); dictionary[customItemDefinition.ItemType] = orCreateItemData; array2.SetValue(orCreateItemData, num + i); } AllItemField.SetValue(collection, array2); IssaPluginPlugin.Log.LogInfo((object)$"[ItemRegistry] Injected {AllItems.Count} custom items."); } public static bool RegisterCustomItemNames() { //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Expected I4, but got Unknown try { Assembly assembly = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly2 in assemblies) { if (assembly2.GetName().Name == "Unity.Localization") { assembly = assembly2; break; } } if (assembly == null) { IssaPluginPlugin.Log.LogWarning((object)"[ItemRegistry] Unity.Localization assembly not found."); return false; } Type type = assembly.GetType("UnityEngine.Localization.Settings.LocalizationSettings"); PropertyInfo property = type.GetProperty("StringDatabase", BindingFlags.Static | BindingFlags.Public); object value = property.GetValue(null); if (value == null) { return false; } Type type2 = assembly.GetType("UnityEngine.Localization.Tables.TableReference"); MethodInfo method = type2.GetMethod("op_Implicit", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); object obj = method.Invoke(null, new object[1] { "Data" }); MethodInfo methodInfo = null; MethodInfo[] methods = value.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public); foreach (MethodInfo methodInfo2 in methods) { if (!(methodInfo2.Name != "GetTable")) { ParameterInfo[] parameters = methodInfo2.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType == type2) { methodInfo = methodInfo2; break; } } } if (methodInfo == null) { return false; } object obj2 = methodInfo.Invoke(value, new object[2] { obj, null }); if (obj2 == null) { IssaPluginPlugin.Log.LogWarning((object)"[ItemRegistry] Data string table not loaded yet — will retry."); return false; } MethodInfo method2 = obj2.GetType().GetMethod("AddEntry", new Type[2] { typeof(string), typeof(string) }); if (method2 == null) { return false; } foreach (CustomItemDefinition allItem in AllItems) { method2.Invoke(obj2, new object[2] { "ITEM_" + (int)allItem.ItemType, allItem.DisplayName }); } IssaPluginPlugin.Log.LogInfo((object)"[ItemRegistry] Custom item names registered in string table."); return true; } catch (Exception ex) { IssaPluginPlugin.Log.LogWarning((object)("[ItemRegistry] Failed to register item names: " + ex.Message)); return false; } } public static ItemType GetItemTypeAtSlot(PlayerInventory inventory, int slotIndex) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0050: 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) if ((Object)(object)inventory == (Object)null || slotIndex < 0) { return (ItemType)0; } if (!(SlotsField.GetValue(inventory) is IList list) || slotIndex >= list.Count) { return (ItemType)0; } return list[slotIndex].itemType; } public static int FindSlotIndex(PlayerInventory inventory, ItemType itemType) { //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) if ((Object)(object)inventory == (Object)null) { return -1; } if (!(SlotsField.GetValue(inventory) is IList list)) { return -1; } for (int i = 0; i < list.Count; i++) { if (list[i].itemType == itemType) { return i; } } return -1; } public static bool DirectAddCustomItem(PlayerInventory inventory, ItemType itemType, int uses) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_006e: Expected I4, but got Unknown if (!NetworkServer.active) { return false; } int num = default(int); if (!inventory.HasSpaceForItem(ref num)) { IssaPluginPlugin.Log.LogWarning((object)"[ItemRegistry] No empty slot available."); return false; } IList list = (IList)SlotsField.GetValue(inventory); list[num] = new InventorySlot(itemType, (uses <= 0) ? 1 : uses); IssaPluginPlugin.Log.LogInfo((object)$"[ItemRegistry] Added custom item {(int)itemType} to slot {num} ({uses} uses)."); return true; } internal static void ServerHandleGiveItemRequest(NetworkConnectionToClient conn, GiveItemRequestMessage msg) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!ModConfig.Global.AllowHotkeyItemGiving.Value) { IssaPluginPlugin.Log.LogInfo((object)"[GiveItem] Rejected hotkey request: AllowHotkeyItemGiving is disabled."); return; } NetworkIdentity identity = ((NetworkConnection)conn).identity; PlayerInventory val = ((identity != null) ? ((Component)identity).GetComponent() : null); if (!((Object)(object)val == (Object)null)) { CustomItemDefinition definition = GetDefinition(msg.ItemType); int uses = ((msg.Uses > 0) ? msg.Uses : (definition?.MaxUses ?? 1)); if (!DirectAddCustomItem(val, msg.ItemType, uses)) { IssaPluginPlugin.Log.LogWarning((object)"[GiveItem] Failed to add item (inventory full?)."); } } } } public static class JavelinItem { private static int _useIndex; internal static readonly HashSet ActiveJavelinRockets = new HashSet(); public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class JavelinItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.JavelinItemType; public override string DisplayName => "Javelin"; public override string[] ConsoleAliases => new string[1] { "javelin" }; public override Sprite Icon => AssetLoader.JavelinIcon; public override GameObject HeldModelPrefab => AssetLoader.JavelinHandheldPrefab; public override int MaxUses => (int)ModConfig.Javelin.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.Javelin.GiveKey.Value; public override ItemType AnimatorItemType => (ItemType)7; public override ItemType AnimatorChangedItemType => (ItemType)7; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) JavelinNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { component.ClientUpdateLockOn(); if (component.HasLock && !component.IsWaitingForDetonation) { component.ClientFire(component.ClientLockedTarget); } else if (component.IsWaitingForDetonation) { IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Already in-flight, please wait."); } else { IssaPluginPlugin.Log.LogInfo((object)"[Javelin] No lock — aim at the ground first."); } } else { IssaPluginPlugin.Log.LogError((object)"[Javelin] No JavelinNetworkBridge on player."); } } public override void OnEquip(PlayerInventory inventory) { if ((Object)(object)((Component)inventory).GetComponent() == (Object)null) { ((Component)inventory).gameObject.AddComponent(); } } } public class JavelinLockOnIndicator : MonoBehaviour { private JavelinNetworkBridge _bridge; private PlayerInventory _inventory; private GameObject _indicator; private void Awake() { _bridge = ((Component)this).GetComponent(); _inventory = ((Component)this).GetComponent(); if ((Object)(object)AssetLoader.JavelinTargetIndicatorPrefab != (Object)null) { _indicator = Object.Instantiate(AssetLoader.JavelinTargetIndicatorPrefab); _indicator.SetActive(false); } } private void Update() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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) if ((Object)(object)_inventory == (Object)null || (Object)(object)_bridge == (Object)null || _inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.JavelinItemType) { Object.Destroy((Object)(object)this); return; } Mouse current = Mouse.current; bool flag = current != null && current.rightButton.isPressed; if (!_bridge.IsWaitingForDetonation) { _bridge.ClientUpdateLockOn(); } if (!((Object)(object)_indicator == (Object)null)) { bool flag2 = _bridge.HasLock && (flag || _bridge.IsWaitingForDetonation); _indicator.SetActive(flag2); if (flag2) { _indicator.transform.position = _bridge.ClientLockedTarget + Vector3.up * 0.05f; } } } private void OnDestroy() { if ((Object)(object)_indicator != (Object)null) { Object.Destroy((Object)(object)_indicator); } } } public struct JavelinFireMessage : NetworkMessage { public Vector3 TargetPosition; } public static class JavelinFireMessageSerialization { public static void WriteJavelinFireMessage(NetworkWriter writer, JavelinFireMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.TargetPosition); } public static JavelinFireMessage ReadJavelinFireMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new JavelinFireMessage { TargetPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct JavelinRocketTrailMessage : NetworkMessage { public uint RocketNetId; } public static class JavelinRocketTrailMessageSerialization { public static void WriteJavelinRocketTrailMessage(NetworkWriter w, JavelinRocketTrailMessage m) { NetworkWriterExtensions.WriteUInt(w, m.RocketNetId); } public static JavelinRocketTrailMessage ReadJavelinRocketTrailMessage(NetworkReader r) { return new JavelinRocketTrailMessage { RocketNetId = NetworkReaderExtensions.ReadUInt(r) }; } } public struct JavelinExplosionMessage : NetworkMessage { public Vector3 Position; } public static class JavelinExplosionMessageSerialization { public static void WriteJavelinExplosionMessage(NetworkWriter w, JavelinExplosionMessage m) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(w, m.Position); } public static JavelinExplosionMessage ReadJavelinExplosionMessage(NetworkReader r) { //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) return new JavelinExplosionMessage { Position = NetworkReaderExtensions.ReadVector3(r) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct JavelinLaunchedMessage : NetworkMessage { } public static class JavelinLaunchedMessageSerialization { public static void WriteJavelinLaunchedMessage(NetworkWriter w, JavelinLaunchedMessage m) { } public static JavelinLaunchedMessage ReadJavelinLaunchedMessage(NetworkReader r) { return default(JavelinLaunchedMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct JavelinDetonatedMessage : NetworkMessage { } public static class JavelinDetonatedMessageSerialization { public static void WriteJavelinDetonatedMessage(NetworkWriter w, JavelinDetonatedMessage m) { } public static JavelinDetonatedMessage ReadJavelinDetonatedMessage(NetworkReader r) { return default(JavelinDetonatedMessage); } } public class JavelinNetworkBridge : NetworkBridgeBase { private bool _serverRoutineActive; private Coroutine _serverRoutine; private Camera _camera; private static readonly MethodInfo ServerExplodeMethod = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); public Vector3 ClientLockedTarget { get; private set; } public bool HasLock { get; private set; } public bool IsWaitingForDetonation { get; private set; } public override void OnStopServer() { } public void ClientUpdateLockOn() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e6: Unknown result type (might be due to invalid IL or missing references) if (_camera == null) { _camera = Camera.main; } Camera camera = _camera; if ((Object)(object)camera == (Object)null) { HasLock = false; return; } Ray val = camera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 2000f, ItemHelper.GroundLayerMask)) { ClientLockedTarget = ((RaycastHit)(ref val2)).point; HasLock = true; return; } if (Mathf.Abs(((Ray)(ref val)).direction.y) > 0.001f) { float num = (0f - ((Ray)(ref val)).origin.y) / ((Ray)(ref val)).direction.y; if (num > 0f) { ClientLockedTarget = ((Ray)(ref val)).origin + ((Ray)(ref val)).direction * num; HasLock = true; return; } } HasLock = false; } public void ClientClearLock() { HasLock = false; IsWaitingForDetonation = false; } public void ClientFire(Vector3 targetPosition) { //IL_0030: 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) if (IsWaitingForDetonation) { IssaPluginPlugin.Log.LogWarning((object)"[Javelin] Already waiting for detonation."); return; } IsWaitingForDetonation = true; NetworkClient.Send(new JavelinFireMessage { TargetPosition = targetPosition }, 0); } public void ServerHandleFire(Vector3 targetPosition) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (_serverRoutineActive) { IssaPluginPlugin.Log.LogWarning((object)"[Javelin] Server routine already active."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Javelin] No PlayerInventory on bridge object."); return; } _serverRoutineActive = true; _serverRoutine = ((MonoBehaviour)this).StartCoroutine(ServerFireRoutine(component, targetPosition)); } private IEnumerator ServerFireRoutine(PlayerInventory inventory, Vector3 targetPosition) { //IL_0015: 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) ItemHelper.ConsumeEquippedItem(inventory); PlayerInfo playerInfo = inventory.PlayerInfo; Vector3 spawnPos = ((Component)playerInfo).transform.position + Vector3.up * 2f; Quaternion spawnRot = Quaternion.LookRotation(Vector3.up, Vector3.forward); int useIndex = JavelinItem.NextUseIndex(); ItemUseId itemUseId = new ItemUseId(playerInfo.PlayerId.Guid, useIndex, (ItemType)7, false); Rocket rocket = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, spawnPos, spawnRot); if ((Object)(object)rocket == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Javelin] Rocket prefab failed to instantiate."); _serverRoutineActive = false; yield break; } ((Component)rocket).gameObject.AddComponent(); rocket.ServerInitialize(playerInfo, (Hittable)null, itemUseId); NetworkServer.Spawn(((Component)rocket).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(rocket, ModConfig.Javelin.ExplosionScale.Value); JavelinRocketBehaviour flight = ((Component)rocket).gameObject.AddComponent(); flight.TargetPosition = targetPosition; flight.ApexHeightAboveLaunch = ModConfig.Javelin.ApexHeight.Value; flight.AscentSpeed = ModConfig.Javelin.AscentSpeed.Value; flight.DiveSpeed = ModConfig.Javelin.DiveSpeed.Value; flight.DiveAcceleration = ModConfig.Javelin.DiveAcceleration.Value; flight.ArrivalRadius = ModConfig.Javelin.ArrivalRadius.Value; IssaPluginPlugin.Log.LogInfo((object)($"[Javelin] Rocket spawned. Target={targetPosition}, " + $"Apex+{ModConfig.Javelin.ApexHeight.Value} units.")); yield return null; NetworkServer.SendToAll(new JavelinRocketTrailMessage { RocketNetId = ((NetworkBehaviour)rocket).netId }, 0, false); ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(JavelinLaunchedMessage), 0); float elapsed = 0f; float timeout = ModConfig.Javelin.Timeout.Value; while ((Object)(object)rocket != (Object)null && (Object)(object)((Component)rocket).gameObject != (Object)null && elapsed < timeout) { elapsed += Time.deltaTime; yield return null; } if ((Object)(object)rocket != (Object)null && (Object)(object)((Component)rocket).gameObject != (Object)null) { JavelinRocketBehaviour flightComp = ((Component)rocket).gameObject.GetComponent(); if ((Object)(object)flightComp != (Object)null) { flightComp.Detonate(); } else { ForceServerExplode(rocket); } } if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(default(JavelinDetonatedMessage), 0); } _serverRoutineActive = false; _serverRoutine = null; IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Server routine complete."); } public override void ServerHoleCleanup() { if (_serverRoutineActive) { if (_serverRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverRoutine); _serverRoutine = null; } _serverRoutineActive = false; IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Server state cleared on hole transition."); } } public override void ClientHoleCleanup() { ClientClearLock(); } public void ClientHandleLaunched() { IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Rocket launched — watching for impact."); } public void ClientHandleDetonated() { IsWaitingForDetonation = false; HasLock = false; IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Detonation confirmed — lock cleared."); } internal static void HandleRocketTrailVfx(JavelinRocketTrailMessage msg) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)AssetLoader.JavelinTrailVfxPrefab == (Object)null) && NetworkClient.spawned.TryGetValue(msg.RocketNetId, out var value) && !((Object)(object)value == (Object)null)) { GameObject val = Object.Instantiate(AssetLoader.JavelinTrailVfxPrefab, ((Component)value).transform.position, ((Component)value).transform.rotation); val.transform.SetParent(((Component)value).transform, false); val.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); JavelinRocketTrailDetacher javelinRocketTrailDetacher = ((Component)value).gameObject.AddComponent(); javelinRocketTrailDetacher.TrailRoot = val.transform; } } internal static void HandleExplosionVfx(JavelinExplosionMessage msg) { //IL_0018: 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) if (!((Object)(object)AssetLoader.JavelinExplosionVfxPrefab == (Object)null)) { GameObject val = Object.Instantiate(AssetLoader.JavelinExplosionVfxPrefab, msg.Position, Quaternion.identity); Object.Destroy((Object)(object)val, ModConfig.Javelin.ExplosionVfxDuration.Value); } } private static void ForceServerExplode(Rocket rocket) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) ServerExplodeMethod?.Invoke(rocket, new object[1] { ((Component)rocket).transform.position }); } } public class JavelinRocketBehaviour : MonoBehaviour { private enum Phase { Ascending, Turning, Diving } public Vector3 TargetPosition; public float ApexHeightAboveLaunch = 60f; public float AscentSpeed = 35f; public float DiveSpeed = 55f; public float DiveAcceleration = 25f; public float ArrivalRadius = 3f; public float TurnRate = 180f; private Phase _phase = Phase.Ascending; private Rocket _rocket; private Rigidbody _rb; private float _apexY; private float _currentDiveSpeed; private bool _exploded; private static readonly MethodInfo ServerExplodeMethod = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); private void Start() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) _rocket = ((Component)this).GetComponent(); _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { Entity component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null && component.HasRigidbody) { _rb = component.Rigidbody; } } if ((Object)(object)_rocket != (Object)null) { JavelinItem.ActiveJavelinRockets.Add(_rocket); } _apexY = ((Component)this).transform.position.y + ApexHeightAboveLaunch; _currentDiveSpeed = DiveSpeed; IssaPluginPlugin.Log.LogInfo((object)($"[Javelin] Launched from {((Component)this).transform.position:F1} " + $"toward {TargetPosition:F1}. ApexY={_apexY:F1}")); } private void FixedUpdate() { if (!_exploded && !((Object)(object)_rocket == (Object)null)) { switch (_phase) { case Phase.Ascending: UpdateAscending(); break; case Phase.Turning: UpdateTurning(); break; case Phase.Diving: UpdateDiving(); break; } } } private void UpdateAscending() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0070: 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) if (!((Object)(object)_rb == (Object)null)) { _rb.linearVelocity = Vector3.up * AscentSpeed; _rb.angularVelocity = Vector3.zero; RotateTowardVelocity(); if (((Component)this).transform.position.y >= _apexY) { _rb.linearVelocity = Vector3.zero; _phase = Phase.Turning; IssaPluginPlugin.Log.LogInfo((object)$"[Javelin] Apex reached at Y={((Component)this).transform.position.y:F1}. Turning."); } } } private void UpdateTurning() { //IL_001c: 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_0039: 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) //IL_0049: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rb == (Object)null) { return; } _rb.linearVelocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; Vector3 val = TargetPosition - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Already at target during turn — diving."); _phase = Phase.Diving; _currentDiveSpeed = DiveSpeed; return; } Quaternion val2 = DirectionToRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val2, TurnRate * Time.fixedDeltaTime); if (Quaternion.Angle(((Component)this).transform.rotation, val2) < 5f) { _phase = Phase.Diving; _currentDiveSpeed = DiveSpeed; IssaPluginPlugin.Log.LogInfo((object)"[Javelin] Turn complete — diving."); } } private void UpdateDiving() { //IL_0032: 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) //IL_0047: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0107: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rb == (Object)null)) { _currentDiveSpeed += DiveAcceleration * Time.fixedDeltaTime; Vector3 val = TargetPosition - ((Component)this).transform.position; Vector3 linearVelocity = ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? (((Vector3)(ref val)).normalized * _currentDiveSpeed) : (Vector3.down * _currentDiveSpeed)); _rb.linearVelocity = linearVelocity; RotateTowardVelocity(); float num = Vector3.Distance(((Component)this).transform.position, TargetPosition); float num2 = Vector3.Distance(new Vector3(((Component)this).transform.position.x, 0f, ((Component)this).transform.position.z), new Vector3(TargetPosition.x, 0f, TargetPosition.z)); bool flag = num < ArrivalRadius; bool flag2 = ((Component)this).transform.position.y <= TargetPosition.y + 2f && num2 < ArrivalRadius * 2f; if (flag || flag2) { Detonate(); } } } private void RotateTowardVelocity() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rb == (Object)null)) { Vector3 linearVelocity = _rb.linearVelocity; if (!(((Vector3)(ref linearVelocity)).sqrMagnitude < 0.01f)) { Quaternion val = DirectionToRotation(((Vector3)(ref linearVelocity)).normalized); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val, 720f * Time.fixedDeltaTime); } } } private static Quaternion DirectionToRotation(Vector3 direction) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0040: 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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref direction)).sqrMagnitude < 0.001f) { return Quaternion.identity; } Vector3 val = ((Mathf.Abs(Vector3.Dot(direction, Vector3.up)) > 0.99f) ? Vector3.forward : Vector3.up); return Quaternion.LookRotation(direction, val); } public void Detonate() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) if (!_exploded) { _exploded = true; if ((Object)(object)_rocket != (Object)null) { JavelinItem.ActiveJavelinRockets.Remove(_rocket); } if (!((Object)(object)_rocket == (Object)null)) { Vector3 position = ((Component)this).transform.position; IssaPluginPlugin.Log.LogInfo((object)$"[Javelin] Detonating at {position:F1} (target {TargetPosition:F1})."); NetworkServer.SendToAll(new JavelinExplosionMessage { Position = position }, 0, false); ServerExplodeMethod?.Invoke(_rocket, new object[1] { position }); } } } } public class JavelinRocketTrailDetacher : MonoBehaviour { private const float LingerSeconds = 4f; public Transform TrailRoot; private void OnDestroy() { //IL_0038: 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) if (!((Object)(object)TrailRoot == (Object)null)) { TrailRoot.SetParent((Transform)null, true); ParticleSystem[] componentsInChildren = ((Component)TrailRoot).GetComponentsInChildren(); foreach (ParticleSystem val in componentsInChildren) { EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; } Object.Destroy((Object)(object)((Component)TrailRoot).gameObject, 4f); } } } public static class JetpackItem { private static bool _isFlying; internal static float ServerFuelPerUse = -1f; internal static float ServerThrustForce = -1f; private static float _fuelRemaining = -1f; public static bool IsFlying => _isFlying; public static float FuelFraction { get; private set; } = 1f; public static void ResetFuel() { _fuelRemaining = -1f; } public static int FindJetpackSlot(PlayerInventory inventory) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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) for (int i = 0; i < inventory.slots.Count; i++) { if (inventory.slots[i].itemType == ItemRegistry.JetpackItemType) { return i; } } return -1; } public static IEnumerator FireLoop(PlayerInventory inventory, bool fromJump = false, int slotOverride = -1) { if (!fromJump) { inventory.PlayerInfo.Movement.TryTriggerJump(); } if (_isFlying) { yield break; } if (!fromJump) { if (Mouse.current == null || !Mouse.current.leftButton.isPressed) { yield break; } } else if (slotOverride < 0) { yield break; } _isFlying = true; JetpackNetworkBridge bridge = ((Component)inventory).GetComponent(); PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; Rigidbody rb = ((localPlayerMovement != null) ? ((Component)localPlayerMovement).GetComponent() : null); if ((Object)(object)rb == (Object)null) { _isFlying = false; yield break; } bridge?.ClientNotifyThrustStart(); if (!fromJump) { ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)1); } float fuelPerUse = ((ServerFuelPerUse >= 0f) ? ServerFuelPerUse : ModConfig.Jetpack.FuelPerUse.Value); if (_fuelRemaining < 0f) { _fuelRemaining = fuelPerUse; } FuelFraction = Mathf.Clamp01(_fuelRemaining / fuelPerUse); try { do { if (fromJump) { if (slotOverride >= inventory.slots.Count || inventory.slots[slotOverride].itemType != ItemRegistry.JetpackItemType) { break; } } else if (inventory.GetEffectivelyEquippedItem(true) != ItemRegistry.JetpackItemType) { break; } float thrustForce = ((ServerThrustForce >= 0f) ? ServerThrustForce : ModConfig.Jetpack.ThrustForce.Value); rb.AddForce(Vector3.up * thrustForce, (ForceMode)5); _fuelRemaining -= Time.fixedDeltaTime; FuelFraction = Mathf.Clamp01(_fuelRemaining / fuelPerUse); if (_fuelRemaining <= 0f) { int slotToDrain = (fromJump ? slotOverride : inventory.EquippedItemIndex); ItemHelper.DecrementAndRemove(inventory, slotToDrain); if (!((!fromJump) ? (inventory.GetEffectivelyEquippedItem(true) == ItemRegistry.JetpackItemType) : (slotOverride < inventory.slots.Count && inventory.slots[slotOverride].itemType == ItemRegistry.JetpackItemType))) { break; } _fuelRemaining = fuelPerUse; FuelFraction = 1f; } yield return (object)new WaitForFixedUpdate(); } while (((!fromJump) ? (Mouse.current != null && Mouse.current.leftButton.isPressed) : (Keyboard.current != null && ((ButtonControl)Keyboard.current.spaceKey).isPressed)) && _fuelRemaining > 0f); } finally { if (!fromJump) { ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)0); } bridge?.ClientNotifyThrustStop(); _isFlying = false; } } } public class JetpackItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.JetpackItemType; public override string DisplayName => "Jetpack"; public override string[] ConsoleAliases => new string[3] { "jetpack", "jet", "jetpak" }; public override Sprite Icon => AssetLoader.JetpackIcon; public override GameObject HeldModelPrefab => AssetLoader.JetpackHandheldPrefab; public override int MaxUses => (int)ModConfig.Jetpack.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.Jetpack.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { IssaPluginPlugin.Log.LogInfo((object)("[Jetpack] Player " + inventory.PlayerInfo.PlayerId.PlayerName + " is using Jetpack.")); ((MonoBehaviour)inventory).StartCoroutine(JetpackItem.FireLoop(inventory)); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct JetpackThrustStartMessage : NetworkMessage { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct JetpackThrustStopMessage : NetworkMessage { } public struct JetpackThrustBeginMessage : NetworkMessage { public uint PlayerNetId; } public struct JetpackThrustEndMessage : NetworkMessage { public uint PlayerNetId; } public struct JetpackEquipBeginMessage : NetworkMessage { public uint PlayerNetId; public float FuelPerUse; public float ThrustForce; } public struct JetpackEquipEndMessage : NetworkMessage { public uint PlayerNetId; } public static class JetpackMessageSerialization { public static void WriteThrustStart(NetworkWriter w, JetpackThrustStartMessage msg) { } public static JetpackThrustStartMessage ReadThrustStart(NetworkReader r) { return default(JetpackThrustStartMessage); } public static void WriteThrustStop(NetworkWriter w, JetpackThrustStopMessage msg) { } public static JetpackThrustStopMessage ReadThrustStop(NetworkReader r) { return default(JetpackThrustStopMessage); } public static void WriteThrustBegin(NetworkWriter w, JetpackThrustBeginMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); } public static JetpackThrustBeginMessage ReadThrustBegin(NetworkReader r) { return new JetpackThrustBeginMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteThrustEnd(NetworkWriter w, JetpackThrustEndMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); } public static JetpackThrustEndMessage ReadThrustEnd(NetworkReader r) { return new JetpackThrustEndMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteEquipBegin(NetworkWriter w, JetpackEquipBeginMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); NetworkWriterExtensions.WriteFloat(w, msg.FuelPerUse); NetworkWriterExtensions.WriteFloat(w, msg.ThrustForce); } public static JetpackEquipBeginMessage ReadEquipBegin(NetworkReader r) { return new JetpackEquipBeginMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r), FuelPerUse = NetworkReaderExtensions.ReadFloat(r), ThrustForce = NetworkReaderExtensions.ReadFloat(r) }; } public static void WriteEquipEnd(NetworkWriter w, JetpackEquipEndMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); } public static JetpackEquipEndMessage ReadEquipEnd(NetworkReader r) { return new JetpackEquipEndMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r) }; } } public class JetpackNetworkBridge : NetworkBridgeBase { private bool _serverThrusting; private bool _serverEquipped; private GameObject _particles; private GameObject _equippedPrefabInstance; public void ClientNotifyThrustStart() { NetworkClient.Send(default(JetpackThrustStartMessage), 0); } public void ClientNotifyThrustStop() { NetworkClient.Send(default(JetpackThrustStopMessage), 0); } public void ServerHandleThrustStart() { if (((NetworkBehaviour)this).isServer && !_serverThrusting) { _serverThrusting = true; NetworkServer.SendToAll(new JetpackThrustBeginMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); } } public void ServerHandleThrustStop() { if (((NetworkBehaviour)this).isServer && _serverThrusting) { _serverThrusting = false; NetworkServer.SendToAll(new JetpackThrustEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); } } public static void HandleThrustBegin(JetpackThrustBeginMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { ((Component)value).GetComponent()?.ClientShowParticles(); } } public static void HandleThrustEnd(JetpackThrustEndMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { ((Component)value).GetComponent()?.ClientHideParticles(); } } public static void HandleEquipBegin(JetpackEquipBeginMessage msg) { if (!NetworkServer.active) { JetpackItem.ServerFuelPerUse = msg.FuelPerUse; JetpackItem.ServerThrustForce = msg.ThrustForce; } if (!NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { return; } JetpackNetworkBridge component = ((Component)value).GetComponent(); if (!((Object)(object)component == (Object)null)) { if (((NetworkBehaviour)component).isLocalPlayer) { JetpackOverlay.OnLocalEquip(); } else { component.ClientShowEquippedPrefab(); } } } public static void HandleEquipEnd(JetpackEquipEndMessage msg) { if (!NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { return; } JetpackNetworkBridge component = ((Component)value).GetComponent(); if (!((Object)(object)component == (Object)null)) { if (((NetworkBehaviour)component).isLocalPlayer) { JetpackOverlay.OnLocalUnequip(); } else { component.ClientDestroyEquippedPrefab(); } } } private void ClientShowParticles() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ClientHideParticles(); if (!((Object)(object)AssetLoader.JetpackParticlePrefab == (Object)null)) { _particles = Object.Instantiate(AssetLoader.JetpackParticlePrefab); _particles.transform.SetParent(((Component)this).transform, false); _particles.transform.localPosition = Vector3.zero; _particles.transform.localRotation = Quaternion.identity; _particles.SetActive(true); } } private void ClientHideParticles() { if (!((Object)(object)_particles == (Object)null)) { Object.Destroy((Object)(object)_particles); _particles = null; } } private void Update() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).isServer) { PlayerInventory component = ((Component)this).GetComponent(); bool flag = (Object)(object)component != (Object)null && (ModConfig.Jetpack.UseJumpToActivate.Value ? (JetpackItem.FindJetpackSlot(component) >= 0) : (component.GetEffectivelyEquippedItem(true) == ItemRegistry.JetpackItemType)); if (flag && !_serverEquipped) { _serverEquipped = true; NetworkServer.SendToAll(new JetpackEquipBeginMessage { PlayerNetId = ((NetworkBehaviour)this).netId, FuelPerUse = ModConfig.Jetpack.FuelPerUse.Value, ThrustForce = ModConfig.Jetpack.ThrustForce.Value }, 0, false); } else if (!flag && _serverEquipped) { _serverEquipped = false; NetworkServer.SendToAll(new JetpackEquipEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); } } if (!((NetworkBehaviour)this).isLocalPlayer) { return; } PlayerInventory component2 = ((Component)this).GetComponent(); bool flag2 = (Object)(object)component2 != (Object)null && (ModConfig.Jetpack.UseJumpToActivate.Value ? (JetpackItem.FindJetpackSlot(component2) >= 0) : (component2.GetEffectivelyEquippedItem(true) == ItemRegistry.JetpackItemType)); if (flag2 && (Object)(object)_equippedPrefabInstance == (Object)null && (Object)(object)AssetLoader.JetpackEquippedPrefab != (Object)null) { _equippedPrefabInstance = Object.Instantiate(AssetLoader.JetpackEquippedPrefab); Rigidbody component3 = _equippedPrefabInstance.gameObject.GetComponent(); component3.isKinematic = true; component3.useGravity = false; _equippedPrefabInstance.transform.SetParent(((Component)this).transform, false); _equippedPrefabInstance.transform.localPosition = new Vector3(0f, 0.5f, -0.2f); _equippedPrefabInstance.transform.localRotation = Quaternion.identity; } else if (!flag2 && (Object)(object)_equippedPrefabInstance != (Object)null) { Object.Destroy((Object)(object)_equippedPrefabInstance); _equippedPrefabInstance = null; } if (!ModConfig.Jetpack.UseJumpToActivate.Value || JetpackItem.IsFlying || !((Object)(object)component2 != (Object)null)) { return; } Keyboard current = Keyboard.current; if (current != null && ((ButtonControl)current.spaceKey).wasPressedThisFrame) { int num = JetpackItem.FindJetpackSlot(component2); if (num >= 0) { ((MonoBehaviour)component2).StartCoroutine(JetpackItem.FireLoop(component2, fromJump: true, num)); } } } private void ClientShowEquippedPrefab() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_equippedPrefabInstance != (Object)null) && !((Object)(object)AssetLoader.JetpackEquippedPrefab == (Object)null)) { _equippedPrefabInstance = Object.Instantiate(AssetLoader.JetpackEquippedPrefab); Rigidbody component = _equippedPrefabInstance.GetComponent(); component.isKinematic = true; component.useGravity = false; _equippedPrefabInstance.transform.SetParent(((Component)this).transform, false); _equippedPrefabInstance.transform.localPosition = new Vector3(0f, 0.5f, -0.2f); _equippedPrefabInstance.transform.localRotation = Quaternion.identity; } } private void ClientDestroyEquippedPrefab() { if (!((Object)(object)_equippedPrefabInstance == (Object)null)) { Object.Destroy((Object)(object)_equippedPrefabInstance); _equippedPrefabInstance = null; } } public override void ServerHoleCleanup() { if (_serverThrusting) { NetworkServer.SendToAll(new JetpackThrustEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); _serverThrusting = false; } _serverEquipped = false; } public override void ClientHoleCleanup() { ClientHideParticles(); ClientDestroyEquippedPrefab(); if (((NetworkBehaviour)this).isLocalPlayer) { JetpackItem.ResetFuel(); JetpackOverlay.OnLocalUnequip(); } } public override void OnStopServer() { _serverThrusting = false; _serverEquipped = false; } } public static class LowGravityItem { public static bool IsActive { get; set; } } public class LowGravityItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.LowGravityItemType; public override string DisplayName => "Low Gravity"; public override string[] ConsoleAliases => new string[2] { "lowgravity", "gravity" }; public override Sprite Icon => AssetLoader.LowGravityIcon; public override GameObject HeldModelPrefab => AssetLoader.LowGravityModelPrefab; public override int MaxUses => (int)ModConfig.LowGravity.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.LowGravity.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { LowGravityNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(LowGravityActivateMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[LowGravity] No LowGravityNetworkBridge on player."); } } } public struct LowGravityBeginMessage : NetworkMessage { public float Duration; public override string ToString() { return $"LowGravityBeginMessage[Duration={Duration}]"; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct LowGravityEndMessage : NetworkMessage { } public static class LowGravityBeginMessageSerialization { public static void WriteLowGravityBeginMessage(NetworkWriter writer, LowGravityBeginMessage msg) { NetworkWriterExtensions.WriteFloat(writer, msg.Duration); } public static LowGravityBeginMessage ReadLowGravityBeginMessage(NetworkReader reader) { return new LowGravityBeginMessage { Duration = NetworkReaderExtensions.ReadFloat(reader) }; } } public static class LowGravityEndMessageSerialization { public static void WriteLowGravityEndMessage(NetworkWriter writer, LowGravityEndMessage msg) { } public static LowGravityEndMessage ReadLowGravityEndMessage(NetworkReader reader) { return default(LowGravityEndMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct LowGravityActivateMessage : NetworkMessage { } public static class LowGravityActivateMessageSerialization { public static void WriteLowGravityActivateMessage(NetworkWriter writer, LowGravityActivateMessage msg) { } public static LowGravityActivateMessage ReadLowGravityActivateMessage(NetworkReader reader) { return default(LowGravityActivateMessage); } } public class LowGravityNetworkBridge : NetworkBridgeBase { private static bool _globalSessionActive; private static Coroutine _timeoutCoroutine; private static LowGravityNetworkBridge _activeInstance; private static Color _savedFogColor; private static float _savedFogDensity; private static Color _savedAmbientLight; private static bool _savedFog; public void ServerActivateLowGravity() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_008a: Expected I4, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected I4, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)string.Format("[LowGravity] ServerActivateLowGravity called. globalSessionActive={0}, inventory={1}", _globalSessionActive, ((Object)(object)((Component)this).GetComponent() != (Object)null) ? "OK" : "NULL")); if (_globalSessionActive) { IssaPluginPlugin.Log.LogWarning((object)"[LowGravity] A session is already active."); return; } PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); IssaPluginPlugin.Log.LogInfo((object)$"[LowGravity] Equipped item on server: {(int)effectivelyEquippedItem} (expected {(int)ItemRegistry.LowGravityItemType})"); if (effectivelyEquippedItem != ItemRegistry.LowGravityItemType) { IssaPluginPlugin.Log.LogWarning((object)"[LowGravity] Player does not have Low Gravity item equipped."); return; } ItemHelper.ConsumeEquippedItem(component); _globalSessionActive = true; _activeInstance = this; float value = ModConfig.LowGravity.Duration.Value; NetworkServer.SendToAll(new LowGravityBeginMessage { Duration = value }, 0, false); _timeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ServerTimeoutRoutine(value)); IssaPluginPlugin.Log.LogInfo((object)$"[LowGravity] Server session started for {value}s."); } } public static void HandleLowGravityBegin(LowGravityBeginMessage msg) { //IL_006d: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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) IssaPluginPlugin.Log.LogInfo((object)$"[LowGravity] HandleLowGravityBegin called: msg={msg}"); if (!LowGravityItem.IsActive) { _savedFogColor = RenderSettings.fogColor; _savedFogDensity = RenderSettings.fogDensity; _savedAmbientLight = RenderSettings.ambientLight; _savedFog = RenderSettings.fog; } RenderSettings.fog = true; RenderSettings.fogColor = new Color(0.05f, 0.02f, 0.15f, 1f); RenderSettings.fogDensity = 0.01f; RenderSettings.ambientLight = new Color(0.2f, 0.1f, 0.4f); LowGravityItem.IsActive = true; LowGravityOverlay.Instance?.SetActive(active: true, msg.Duration); IssaPluginPlugin.Log.LogInfo((object)"[LowGravity] Client session started."); } public static void HandleLowGravityEnd(LowGravityEndMessage msg) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)$"[LowGravity] HandleLowGravityEnd called: msg={msg}"); RenderSettings.fogColor = _savedFogColor; RenderSettings.fogDensity = _savedFogDensity; RenderSettings.ambientLight = _savedAmbientLight; RenderSettings.fog = _savedFog; LowGravityItem.IsActive = false; LowGravityOverlay.Instance?.SetActive(active: false); IssaPluginPlugin.Log.LogInfo((object)"[LowGravity] Client session ended."); } private IEnumerator ServerTimeoutRoutine(float duration) { yield return (object)new WaitForSeconds(duration); NetworkServer.SendToAll(default(LowGravityEndMessage), 0, false); _globalSessionActive = false; _activeInstance = null; _timeoutCoroutine = null; IssaPluginPlugin.Log.LogInfo((object)"[LowGravity] Server session ended."); } public static void GlobalServerHoleCleanup() { if (_globalSessionActive) { if (_timeoutCoroutine != null && (Object)(object)_activeInstance != (Object)null) { ((MonoBehaviour)_activeInstance).StopCoroutine(_timeoutCoroutine); } _timeoutCoroutine = null; _activeInstance = null; NetworkServer.SendToAll(default(LowGravityEndMessage), 0, false); _globalSessionActive = false; IssaPluginPlugin.Log.LogInfo((object)"[LowGravity] Session force-ended for hole transition."); } } public override void ServerHoleCleanup() { GlobalServerHoleCleanup(); } public override void ClientHoleCleanup() { } public override void OnStopServer() { if (_globalSessionActive) { if (_timeoutCoroutine != null && (Object)(object)_activeInstance != (Object)null) { ((MonoBehaviour)_activeInstance).StopCoroutine(_timeoutCoroutine); } _timeoutCoroutine = null; _activeInstance = null; NetworkServer.SendToAll(default(LowGravityEndMessage), 0, false); _globalSessionActive = false; IssaPluginPlugin.Log.LogInfo((object)"[LowGravity] Session ended and global lock released on server stop."); } } } internal sealed class MoonSessionState { public uint WielderNetId; public Vector3 MoonSpawnPos; public Vector3 MoonImpactPos; public float ApproachDuration; public float SuckDuration; public float StartTime; public GameObject MoonVfxInstance; public Coroutine ForceCoroutine; public PlayerMovement ForceMovement; public float InitialScale; public float FinalScale; public float TotalDuration => ApproachDuration + SuckDuration; } public static class MoonClientLogic { private static readonly Dictionary s_sessions = new Dictionary(); private static readonly Color DuskSkyColor = new Color(0.05f, 0.02f, 0.08f); private static readonly Color DuskHorizonColor = new Color(0.6f, 0.15f, 0f); private static readonly Vector4 DuskSunDirection = new Vector4(0.5f, -0.2f, 0.5f, 0f); private const float DuskMoonCycle = 0.3f; private const float DuskStarsExposure = 5f; private const float DuskAmbientIntensity = 0.3f; private static readonly Color DuskAmbientLight = new Color(0.55f, 0.25f, 0.05f); private static readonly Color DuskFogColor = new Color(0.6f, 0.25f, 0.05f); private const float DuskFogDensity = 0.008f; private static readonly Color DuskSunLightColor = new Color(1f, 0.45f, 0.1f); private const float DuskSunLightIntensity = 0.4f; private static Material _duskSkyInstance; private static Material _originalSharedSkybox; private static Color _origSkyColor; private static Color _origHorizonColor; private static Vector4 _origSunDirection; private static float _origMoonCycle; private static float _origStarsExposure; private static float _origAmbientIntensity; private static Color _savedAmbientLight; private static Color _savedFogColor; private static float _savedFogDensity; private static bool _savedFog; private static Light _sunLight; private static Color _savedSunColor; private static float _savedSunIntensity; private static Coroutine _duskCoroutine; private static MonoBehaviour _duskCoroutineHost; public static void HandleMoonBegin(MoonBeginMessage msg) { BeginSession(msg); } public static void HandleMoonEnd(MoonEndMessage msg) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) EndSession(msg.WielderNetId, msg.ExplosionPos); } public static void UpdateAll() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //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_0182: 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) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) if (s_sessions.Count == 0) { return; } foreach (KeyValuePair s_session in s_sessions) { MoonSessionState value = s_session.Value; float num = Time.time - value.StartTime; Vector3 val; if (num < value.ApproachDuration) { float num2 = ((value.ApproachDuration > 0f) ? Mathf.Clamp01(num / value.ApproachDuration) : 1f); val = Vector3.Lerp(value.MoonSpawnPos, value.MoonImpactPos, num2); } else { val = value.MoonImpactPos; } if (!((Object)(object)value.MoonVfxInstance != (Object)null)) { continue; } value.MoonVfxInstance.transform.position = val; float num3 = Vector3.Distance(value.MoonSpawnPos, value.MoonImpactPos); float num4 = Vector3.Distance(val, value.MoonImpactPos); float num5 = ((num3 > 0f) ? (1f - num4 / num3) : 1f); float num6 = Mathf.Lerp(value.InitialScale, value.FinalScale, num5); value.MoonVfxInstance.transform.localScale = Vector3.one * num6; Transform transformByNetId = GetTransformByNetId(value.WielderNetId); if ((Object)(object)transformByNetId != (Object)null) { Vector3 val2 = transformByNetId.position - val; Vector3 normalized = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref normalized)).sqrMagnitude > 0.001f) { Vector3 val3 = ((Mathf.Abs(Vector3.Dot(normalized, Vector3.up)) > 0.99f) ? Vector3.forward : Vector3.up); value.MoonVfxInstance.transform.rotation = Quaternion.LookRotation(normalized, val3); } } } } public static void DrawWarningGui() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) if (s_sessions.Count == 0) { return; } using Dictionary.Enumerator enumerator = s_sessions.GetEnumerator(); if (enumerator.MoveNext()) { MoonSessionState value = enumerator.Current.Value; float num = Time.time - value.StartTime; if (!(num >= value.ApproachDuration)) { float num2 = value.ApproachDuration - num; GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 28, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; Color color = GUI.color; GUI.color = new Color(1f, 0.3f, 0.1f, 0.9f); float num3 = (float)Screen.width * 0.6f; float num4 = 80f; float num5 = ((float)Screen.width - num3) * 0.5f; float num6 = (float)Screen.height * 0.15f; GUI.Label(new Rect(num5, num6, num3, num4), $"THE MOON IS FALLING\n{num2:F0}s", val); GUI.color = color; } } } private static void BeginDuskEffect(MonoBehaviour host) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Invalid comparison between Unknown and I4 if (!ModConfig.Moon.DuskEnabled.Value || (Object)(object)host == (Object)null) { return; } _originalSharedSkybox = RenderSettings.skybox; if ((Object)(object)_originalSharedSkybox == (Object)null) { return; } _origSkyColor = _originalSharedSkybox.GetColor("_SkyColor"); _origHorizonColor = _originalSharedSkybox.GetColor("_HorizonColor"); _origSunDirection = _originalSharedSkybox.GetVector("_SunDirection"); _origMoonCycle = _originalSharedSkybox.GetFloat("_MoonCycle"); _origStarsExposure = _originalSharedSkybox.GetFloat("_StarsExposure"); _origAmbientIntensity = _originalSharedSkybox.GetFloat("_AmbientIntensity"); _savedAmbientLight = RenderSettings.ambientLight; _savedFog = RenderSettings.fog; _savedFogColor = RenderSettings.fogColor; _savedFogDensity = RenderSettings.fogDensity; _sunLight = RenderSettings.sun; if ((Object)(object)_sunLight == (Object)null) { Light[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Light val in array) { if ((int)val.type == 1 && ((Behaviour)val).isActiveAndEnabled) { _sunLight = val; break; } } } if ((Object)(object)_sunLight != (Object)null) { _savedSunColor = _sunLight.color; _savedSunIntensity = _sunLight.intensity; } _duskSkyInstance = Object.Instantiate(_originalSharedSkybox); RenderSettings.skybox = _duskSkyInstance; _duskCoroutineHost = host; _duskCoroutine = host.StartCoroutine(DuskFadeIn()); } private static void EndDuskEffect() { if (!((Object)(object)_duskSkyInstance == (Object)null)) { if (_duskCoroutine != null && (Object)(object)_duskCoroutineHost != (Object)null) { _duskCoroutineHost.StopCoroutine(_duskCoroutine); } _duskCoroutine = null; if ((Object)(object)_duskCoroutineHost == (Object)null) { ClearDuskState(); } else { _duskCoroutine = _duskCoroutineHost.StartCoroutine(DuskFadeOut()); } } } private static void RestoreSkyboxImmediate() { if (!((Object)(object)_duskSkyInstance == (Object)null)) { if (_duskCoroutine != null && (Object)(object)_duskCoroutineHost != (Object)null) { _duskCoroutineHost.StopCoroutine(_duskCoroutine); } _duskCoroutine = null; ClearDuskState(); } } private static void ClearDuskState() { //IL_000c: 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_004d: Unknown result type (might be due to invalid IL or missing references) RenderSettings.skybox = _originalSharedSkybox; RenderSettings.ambientLight = _savedAmbientLight; RenderSettings.fog = _savedFog; RenderSettings.fogColor = _savedFogColor; RenderSettings.fogDensity = _savedFogDensity; if ((Object)(object)_sunLight != (Object)null) { _sunLight.color = _savedSunColor; _sunLight.intensity = _savedSunIntensity; _sunLight = null; } if ((Object)(object)_duskSkyInstance != (Object)null) { Object.Destroy((Object)(object)_duskSkyInstance); _duskSkyInstance = null; } _originalSharedSkybox = null; _duskCoroutineHost = null; } private static IEnumerator DuskFadeIn() { bool hasSkyColor = _duskSkyInstance.HasProperty("_SkyColor"); bool hasHorizonColor = _duskSkyInstance.HasProperty("_HorizonColor"); bool hasSunDirection = _duskSkyInstance.HasProperty("_SunDirection"); bool hasMoonCycle = _duskSkyInstance.HasProperty("_MoonCycle"); bool hasStarsExposure = _duskSkyInstance.HasProperty("_StarsExposure"); bool hasAmbientIntensity = _duskSkyInstance.HasProperty("_AmbientIntensity"); if (!hasSkyColor && !hasHorizonColor && !hasSunDirection && !hasMoonCycle && !hasStarsExposure && !hasAmbientIntensity) { IssaPluginPlugin.Log.LogWarning((object)"[MoonClientLogic] DuskEffect: skybox has no matching shader properties — dusk effect will not appear."); yield break; } RenderSettings.fog = true; float duration = ModConfig.Moon.DuskFadeDuration.Value; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); if ((Object)(object)_duskSkyInstance == (Object)null) { break; } if (hasSkyColor) { _duskSkyInstance.SetColor("_SkyColor", Color.Lerp(_origSkyColor, DuskSkyColor, t)); } if (hasHorizonColor) { _duskSkyInstance.SetColor("_HorizonColor", Color.Lerp(_origHorizonColor, DuskHorizonColor, t)); } if (hasSunDirection) { _duskSkyInstance.SetVector("_SunDirection", Vector4.Lerp(_origSunDirection, DuskSunDirection, t)); } if (hasMoonCycle) { _duskSkyInstance.SetFloat("_MoonCycle", Mathf.Lerp(_origMoonCycle, 0.3f, t)); } if (hasStarsExposure) { _duskSkyInstance.SetFloat("_StarsExposure", Mathf.Lerp(_origStarsExposure, 5f, t)); } if (hasAmbientIntensity) { _duskSkyInstance.SetFloat("_AmbientIntensity", Mathf.Lerp(_origAmbientIntensity, 0.3f, t)); } RenderSettings.ambientLight = Color.Lerp(_savedAmbientLight, DuskAmbientLight, t); RenderSettings.fogColor = Color.Lerp(_savedFogColor, DuskFogColor, t); RenderSettings.fogDensity = Mathf.Lerp(_savedFogDensity, 0.008f, t); if ((Object)(object)_sunLight != (Object)null) { _sunLight.color = Color.Lerp(_savedSunColor, DuskSunLightColor, t); _sunLight.intensity = Mathf.Lerp(_savedSunIntensity, 0.4f, t); } yield return null; } } private static IEnumerator DuskFadeOut() { if ((Object)(object)_duskSkyInstance == (Object)null) { yield break; } bool hasSkyColor = _duskSkyInstance.HasProperty("_SkyColor"); bool hasHorizonColor = _duskSkyInstance.HasProperty("_HorizonColor"); bool hasSunDirection = _duskSkyInstance.HasProperty("_SunDirection"); bool hasMoonCycle = _duskSkyInstance.HasProperty("_MoonCycle"); bool hasStarsExposure = _duskSkyInstance.HasProperty("_StarsExposure"); bool hasAmbientIntensity = _duskSkyInstance.HasProperty("_AmbientIntensity"); Color fromSkyColor = (hasSkyColor ? _duskSkyInstance.GetColor("_SkyColor") : _origSkyColor); Color fromHorizonColor = (hasHorizonColor ? _duskSkyInstance.GetColor("_HorizonColor") : _origHorizonColor); Vector4 fromSunDirection = (hasSunDirection ? _duskSkyInstance.GetVector("_SunDirection") : _origSunDirection); float fromMoonCycle = (hasMoonCycle ? _duskSkyInstance.GetFloat("_MoonCycle") : _origMoonCycle); float fromStarsExposure = (hasStarsExposure ? _duskSkyInstance.GetFloat("_StarsExposure") : _origStarsExposure); float fromAmbientIntensity = (hasAmbientIntensity ? _duskSkyInstance.GetFloat("_AmbientIntensity") : _origAmbientIntensity); Color fromAmbientLight = RenderSettings.ambientLight; Color fromFogColor = RenderSettings.fogColor; float fromFogDensity = RenderSettings.fogDensity; Color fromSunColor = (((Object)(object)_sunLight != (Object)null) ? _sunLight.color : _savedSunColor); float fromSunIntensity = (((Object)(object)_sunLight != (Object)null) ? _sunLight.intensity : _savedSunIntensity); float duration = ModConfig.Moon.DuskFadeDuration.Value; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); if ((Object)(object)_duskSkyInstance == (Object)null) { yield break; } if (hasSkyColor) { _duskSkyInstance.SetColor("_SkyColor", Color.Lerp(fromSkyColor, _origSkyColor, t)); } if (hasHorizonColor) { _duskSkyInstance.SetColor("_HorizonColor", Color.Lerp(fromHorizonColor, _origHorizonColor, t)); } if (hasSunDirection) { _duskSkyInstance.SetVector("_SunDirection", Vector4.Lerp(fromSunDirection, _origSunDirection, t)); } if (hasMoonCycle) { _duskSkyInstance.SetFloat("_MoonCycle", Mathf.Lerp(fromMoonCycle, _origMoonCycle, t)); } if (hasStarsExposure) { _duskSkyInstance.SetFloat("_StarsExposure", Mathf.Lerp(fromStarsExposure, _origStarsExposure, t)); } if (hasAmbientIntensity) { _duskSkyInstance.SetFloat("_AmbientIntensity", Mathf.Lerp(fromAmbientIntensity, _origAmbientIntensity, t)); } RenderSettings.ambientLight = Color.Lerp(fromAmbientLight, _savedAmbientLight, t); RenderSettings.fogColor = Color.Lerp(fromFogColor, _savedFogColor, t); RenderSettings.fogDensity = Mathf.Lerp(fromFogDensity, _savedFogDensity, t); if ((Object)(object)_sunLight != (Object)null) { _sunLight.color = Color.Lerp(fromSunColor, _savedSunColor, t); _sunLight.intensity = Mathf.Lerp(fromSunIntensity, _savedSunIntensity, t); } yield return null; } ClearDuskState(); } public static void ClearAll() { RestoreSkyboxImmediate(); foreach (uint item in new List(s_sessions.Keys)) { EndSessionInternal(item); } } private static void BeginSession(MoonBeginMessage msg) { //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) //IL_0042: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null) { return; } EndSessionInternal(msg.WielderNetId); MoonSessionState moonSessionState = new MoonSessionState { WielderNetId = msg.WielderNetId, MoonSpawnPos = msg.MoonSpawnPos, MoonImpactPos = msg.MoonImpactPos, ApproachDuration = msg.ApproachDuration, SuckDuration = msg.SuckDuration, StartTime = Time.time, InitialScale = msg.InitialScale, FinalScale = msg.FinalScale }; if ((Object)(object)AssetLoader.MoonVfxPrefab != (Object)null) { moonSessionState.MoonVfxInstance = Object.Instantiate(AssetLoader.MoonVfxPrefab, msg.MoonSpawnPos, Quaternion.identity); Rigidbody[] componentsInChildren = moonSessionState.MoonVfxInstance.GetComponentsInChildren(); foreach (Rigidbody val in componentsInChildren) { val.isKinematic = true; val.useGravity = false; } Object.DontDestroyOnLoad((Object)(object)moonSessionState.MoonVfxInstance); IssaPluginPlugin.Log.LogInfo((object)$"[MoonClientLogic] MoonVfxInstance created at {msg.MoonSpawnPos}, scale={moonSessionState.MoonVfxInstance.transform.localScale}"); } else { IssaPluginPlugin.Log.LogWarning((object)"[MoonClientLogic] AssetLoader.MoonVfxPrefab is NULL — moon VFX will not appear."); } s_sessions[msg.WielderNetId] = moonSessionState; PlayerMovement movement = localPlayerInfo.Movement; if ((Object)(object)movement != (Object)null) { moonSessionState.ForceMovement = movement; moonSessionState.ForceCoroutine = ((MonoBehaviour)movement).StartCoroutine(ForceCoroutine(msg.WielderNetId)); } BeginDuskEffect((MonoBehaviour)(object)localPlayerInfo.Movement); IssaPluginPlugin.Log.LogInfo((object)$"[MoonClientLogic] Session started. wielder={msg.WielderNetId} spawnPos={msg.MoonSpawnPos} impactPos={msg.MoonImpactPos}"); } private static void EndSession(uint wielderNetId, Vector3 explosionPos) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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) if (!s_sessions.TryGetValue(wielderNetId, out var value)) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { GolfCartSeat activeGolfCartSeat = localPlayerInfo.ActiveGolfCartSeat; Rigidbody val = ((((GolfCartSeat)(ref activeGolfCartSeat)).IsValid() && (Object)(object)activeGolfCartSeat.golfCart != (Object)null) ? activeGolfCartSeat.golfCart.AsEntity.Rigidbody : ((Component)localPlayerInfo).GetComponentInParent()); if ((Object)(object)val != (Object)null) { val.useGravity = true; NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); if (((component != null) ? component.netId : 0) != wielderNetId || ModConfig.Moon.PullAffectsWielder.Value) { float value2 = ModConfig.Moon.ExplosionForce.Value; float value3 = ModConfig.Moon.ExplosionRadius.Value; val.AddExplosionForce(value2, explosionPos, value3, 1f, (ForceMode)2); } } } VfxManager.PlayPooledVfxLocalOnly((VfxType)37, explosionPos, Quaternion.identity, Vector3.one * 10f, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, explosionPos, 1f, 1f); IssaPluginPlugin.Log.LogInfo((object)$"[MoonClientLogic] Moon explosion at {explosionPos} (wielder={wielderNetId})."); float value4 = ModConfig.Moon.FlyAwayDuration.Value; GameObject val2 = null; MonoBehaviour val3 = null; if (value4 > 0f && (Object)(object)value.MoonVfxInstance != (Object)null && (Object)(object)value.ForceMovement != (Object)null) { val2 = value.MoonVfxInstance; val3 = (MonoBehaviour)(object)value.ForceMovement; value.MoonVfxInstance = null; } EndDuskEffect(); EndSessionInternal(wielderNetId); if ((Object)(object)val2 != (Object)null) { val3.StartCoroutine(FlyAwayCoroutine(val2, explosionPos, value.MoonSpawnPos, value.FinalScale, value.InitialScale, value4)); } } private static IEnumerator FlyAwayCoroutine(GameObject vfx, Vector3 from, Vector3 to, float fromScale, float toScale, float duration) { //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) //IL_0015: 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) float elapsed = 0f; while (elapsed < duration) { if ((Object)(object)vfx == (Object)null) { yield break; } elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); t *= t; vfx.transform.position = Vector3.Lerp(from, to, t); vfx.transform.localScale = Vector3.one * Mathf.Lerp(fromScale, toScale, t); yield return null; } if ((Object)(object)vfx != (Object)null) { Object.Destroy((Object)(object)vfx); } } private static void EndSessionInternal(uint wielderNetId) { if (s_sessions.TryGetValue(wielderNetId, out var value)) { s_sessions.Remove(wielderNetId); if (value.ForceCoroutine != null && (Object)(object)value.ForceMovement != (Object)null) { ((MonoBehaviour)value.ForceMovement).StopCoroutine(value.ForceCoroutine); } if ((Object)(object)value.MoonVfxInstance != (Object)null) { Object.Destroy((Object)(object)value.MoonVfxInstance); } } } private static IEnumerator ForceCoroutine(uint wielderNetId) { PlayerInfo localInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localInfo == (Object)null) { yield break; } NetworkIdentity component = ((Component)localInfo).GetComponent(); uint localNetId = ((component != null) ? component.netId : 0u); bool localIsWielder = localNetId == wielderNetId; Rigidbody lastRb = null; bool knockoutApplied = false; while (s_sessions.ContainsKey(wielderNetId)) { if (!s_sessions.TryGetValue(wielderNetId, out var state)) { yield break; } float elapsed = Time.time - state.StartTime; if (elapsed < state.ApproachDuration) { yield return (object)new WaitForFixedUpdate(); continue; } if (localIsWielder && !ModConfig.Moon.PullAffectsWielder.Value) { yield return (object)new WaitForFixedUpdate(); continue; } GolfCartSeat seat = localInfo.ActiveGolfCartSeat; Rigidbody rb = ((((GolfCartSeat)(ref seat)).IsValid() && (Object)(object)seat.golfCart != (Object)null) ? seat.golfCart.AsEntity.Rigidbody : ((Component)localInfo).GetComponentInParent()); if ((Object)(object)lastRb != (Object)null && (Object)(object)lastRb != (Object)(object)rb) { lastRb.useGravity = true; } lastRb = rb; if ((Object)(object)rb != (Object)null) { if (!knockoutApplied) { knockoutApplied = true; ApplyMoonKnockout(localInfo, state); } rb.useGravity = false; rb.angularVelocity = Vector3.zero; Vector3 playerPos = rb.position; Vector3 val = state.MoonImpactPos - playerPos; Vector3 direction = ((Vector3)(ref val)).normalized; float distance = Vector3.Distance(playerPos, state.MoonImpactPos); float maxDist = ModConfig.Moon.PullRadius.Value; float t = Mathf.Clamp01(1f - distance / maxDist); t *= t; float pullForce = ModConfig.Moon.PullForce.Value; float force = Mathf.Lerp(pullForce * 0.3f, pullForce, t); rb.AddForce(direction * force, (ForceMode)5); float towardSpeed = Vector3.Dot(rb.linearVelocity, direction); float maxSpeed = ModConfig.Moon.MaxPullSpeed.Value; if (towardSpeed > maxSpeed) { rb.linearVelocity -= direction * (towardSpeed - maxSpeed); } } yield return (object)new WaitForFixedUpdate(); state = null; seat = default(GolfCartSeat); } if ((Object)(object)lastRb != (Object)null) { lastRb.useGravity = true; } } private static void ApplyMoonKnockout(PlayerInfo localInfo, MoonSessionState state) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_007d: Unknown result type (might be due to invalid IL or missing references) Transform transformByNetId = GetTransformByNetId(state.WielderNetId); PlayerInfo val = ((transformByNetId != null) ? ((Component)transformByNetId).GetComponentInParent() : null); if (!((Object)(object)val == (Object)null)) { ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(val.PlayerId.Guid, MoonItem.NextUseIndex(), (ItemType)7, false); bool flag = default(bool); localInfo.Movement.TryKnockOut(val, (KnockoutType)7, false, ((Component)localInfo.Movement).transform.InverseTransformPoint(state.MoonImpactPos), Vector3.Distance(((Component)localInfo).transform.position, state.MoonImpactPos), Vector3.zero, (ElectromagnetShieldHitBlockType)0, val2, false, true, ref flag, ref flag); } } private static Transform GetTransformByNetId(uint netId) { if (netId == 0) { return null; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == netId) { return ((Component)localPlayerInfo).transform; } } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (!((Object)(object)item == (Object)null)) { NetworkIdentity component2 = ((Component)item).GetComponent(); uint num2 = ((component2 != null) ? component2.netId : 0u); if (num2 == netId) { return ((Component)item).transform; } } } } if (NetworkClient.spawned.TryGetValue(netId, out var value) && (Object)(object)value != (Object)null) { return ((Component)value).transform; } return null; } } public static class MoonItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class MoonItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.MoonItemType; public override string DisplayName => "Majora's Moon"; public override string[] ConsoleAliases => new string[2] { "moon", "majoras_moon" }; public override Sprite Icon => AssetLoader.MoonIcon; public override GameObject HeldModelPrefab => AssetLoader.MoonHandheldPrefab; public override bool UseRocketIconFallback => true; public override EquipmentType EquipmentType => (EquipmentType)12; public override ItemType AnimatorItemType => (ItemType)10; public override ItemType AnimatorChangedItemType => (ItemType)10; public override int MaxUses => (int)ModConfig.Moon.Uses.Value; public override float DefaultPoolWeight => 4f; public override Key GiveKey => ModConfig.Moon.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 2f, 0 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { MoonNetworkBridge component = ((Component)inventory).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.ClientUse(); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct MoonUseMessage : NetworkMessage { } public static class MoonUseMessageSerialization { public static void WriteMoonUseMessage(NetworkWriter writer, MoonUseMessage msg) { } public static MoonUseMessage ReadMoonUseMessage(NetworkReader reader) { return default(MoonUseMessage); } } public struct MoonBeginMessage : NetworkMessage { public uint WielderNetId; public Vector3 MoonSpawnPos; public Vector3 MoonImpactPos; public float ApproachDuration; public float SuckDuration; public float InitialScale; public float FinalScale; } public static class MoonBeginMessageSerialization { public static void WriteMoonBeginMessage(NetworkWriter writer, MoonBeginMessage msg) { //IL_0010: 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) NetworkWriterExtensions.WriteUInt(writer, msg.WielderNetId); NetworkWriterExtensions.WriteVector3(writer, msg.MoonSpawnPos); NetworkWriterExtensions.WriteVector3(writer, msg.MoonImpactPos); NetworkWriterExtensions.WriteFloat(writer, msg.ApproachDuration); NetworkWriterExtensions.WriteFloat(writer, msg.SuckDuration); NetworkWriterExtensions.WriteFloat(writer, msg.InitialScale); NetworkWriterExtensions.WriteFloat(writer, msg.FinalScale); } public static MoonBeginMessage ReadMoonBeginMessage(NetworkReader reader) { //IL_0018: 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_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) return new MoonBeginMessage { WielderNetId = NetworkReaderExtensions.ReadUInt(reader), MoonSpawnPos = NetworkReaderExtensions.ReadVector3(reader), MoonImpactPos = NetworkReaderExtensions.ReadVector3(reader), ApproachDuration = NetworkReaderExtensions.ReadFloat(reader), SuckDuration = NetworkReaderExtensions.ReadFloat(reader), InitialScale = NetworkReaderExtensions.ReadFloat(reader), FinalScale = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct MoonEndMessage : NetworkMessage { public uint WielderNetId; public Vector3 ExplosionPos; } public static class MoonEndMessageSerialization { public static void WriteMoonEndMessage(NetworkWriter writer, MoonEndMessage msg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.WielderNetId); NetworkWriterExtensions.WriteVector3(writer, msg.ExplosionPos); } public static MoonEndMessage ReadMoonEndMessage(NetworkReader reader) { //IL_0018: 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) return new MoonEndMessage { WielderNetId = NetworkReaderExtensions.ReadUInt(reader), ExplosionPos = NetworkReaderExtensions.ReadVector3(reader) }; } } public class MoonNetworkBridge : NetworkBridgeBase { private bool _serverSessionActive; private Coroutine _serverCoroutine; private int _wielderSlot = -1; private Vector3 _serverImpactPos; private readonly HashSet _seenRigidbodies = new HashSet(); private void Update() { if (((NetworkBehaviour)this).isOwned) { MoonClientLogic.UpdateAll(); } } private void OnGUI() { if (((NetworkBehaviour)this).isOwned) { MoonClientLogic.DrawWarningGui(); } } public void ClientUse() { if (((NetworkBehaviour)this).isOwned) { NetworkClient.Send(default(MoonUseMessage), 0); } } public void ServerHandleUse(NetworkConnectionToClient conn, MoonUseMessage msg) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } if (!GlobalSessionLock.TryAcquire(this)) { IssaPluginPlugin.Log.LogInfo((object)"[Moon] Server: session already active — ignoring use request."); return; } PlayerInventory component = ((Component)this).GetComponent(); int num = (((Object)(object)component != (Object)null) ? ItemRegistry.FindSlotIndex(component, ItemRegistry.MoonItemType) : (-1)); if (num < 0) { IssaPluginPlugin.Log.LogWarning((object)"[Moon] Server: wielder does not have the Moon item."); GlobalSessionLock.Release(); return; } _wielderSlot = num; if ((Object)(object)GolfHoleManager.MainHole == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[Moon] Server: GolfHoleManager.MainHole is null — aborting."); GlobalSessionLock.Release(); _wielderSlot = -1; return; } Vector3 position = ((Component)GolfHoleManager.MainHole).transform.position; float num2 = Random.Range(0f, 360f) * (MathF.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); float value = ModConfig.Moon.SpawnDistance.Value; float value2 = ModConfig.Moon.SpawnHeight.Value; float value3 = ModConfig.Moon.InitialScale.Value; float value4 = ModConfig.Moon.FinalScale.Value; float value5 = ModConfig.Moon.ImpactHeight.Value; float value6 = ModConfig.Moon.ApproachDuration.Value; float value7 = ModConfig.Moon.SuckDuration.Value; Vector3 val2 = position + val * value + Vector3.up * value2; Vector3 val3 = (_serverImpactPos = position + Vector3.up * value5); _serverSessionActive = true; uint netId = ((Component)this).GetComponent().netId; IssaPluginPlugin.Log.LogInfo((object)$"[Moon] Server: session started. wielder={netId} spawnPos={val2} impactPos={val3}"); NetworkServer.SendToAll(new MoonBeginMessage { WielderNetId = netId, MoonSpawnPos = val2, MoonImpactPos = val3, ApproachDuration = value6, SuckDuration = value7, InitialScale = value3, FinalScale = value4 }, 0, false); _serverCoroutine = ((MonoBehaviour)this).StartCoroutine(ServerSessionCoroutine(value6, value7)); } private IEnumerator ServerSessionCoroutine(float approachDuration, float suckDuration) { yield return (object)new WaitForSeconds(approachDuration); if (!_serverSessionActive) { yield break; } float suckEnd = Time.time + suckDuration; while (Time.time < suckEnd) { if (ModConfig.Moon.PullAffectsGolfBalls.Value) { ServerApplyGolfBallPull(); } yield return (object)new WaitForFixedUpdate(); } if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[Moon] Server: session complete — triggering explosion."); ServerEndSession(broadcast: true); } } private void ServerApplyGolfBallPull() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_0170: Unknown result type (might be due to invalid IL or missing references) float value = ModConfig.Moon.PullRadius.Value; float value2 = ModConfig.Moon.PullForce.Value; float value3 = ModConfig.Moon.MaxPullSpeed.Value; Collider[] array = Physics.OverlapSphere(_serverImpactPos, value, -5, (QueryTriggerInteraction)1); _seenRigidbodies.Clear(); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)((Component)val).GetComponentInParent() != (Object)null || (Object)(object)((Component)val).GetComponentInParent() == (Object)null) { continue; } Rigidbody attachedRigidbody = val.attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && !_seenRigidbodies.Contains(attachedRigidbody)) { _seenRigidbodies.Add(attachedRigidbody); Vector3 val2 = _serverImpactPos - attachedRigidbody.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Distance(attachedRigidbody.position, _serverImpactPos); float num2 = Mathf.Clamp01(1f - num / value); num2 *= num2; float num3 = Mathf.Lerp(value2 * 0.3f, value2, num2); attachedRigidbody.AddForce(normalized * num3, (ForceMode)5); float num4 = Vector3.Dot(attachedRigidbody.linearVelocity, normalized); if (num4 > value3) { attachedRigidbody.linearVelocity -= normalized * (num4 - value3); } } } } private void ServerEndSession(bool broadcast) { //IL_0044: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (!_serverSessionActive) { return; } _serverSessionActive = false; if (broadcast) { float value = ModConfig.Moon.ExplosionForce.Value; float value2 = ModConfig.Moon.ExplosionRadius.Value; Collider[] array = Physics.OverlapSphere(_serverImpactPos, value2); Collider[] array2 = array; foreach (Collider val in array2) { Rigidbody attachedRigidbody = val.attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && !((Object)(object)((Component)val).GetComponentInParent() != (Object)null)) { attachedRigidbody.AddExplosionForce(value, _serverImpactPos, value2, 0.5f, (ForceMode)2); } } if (_wielderSlot >= 0) { PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ItemHelper.SetCurrentItemUse(component, (ItemUseType)1); ItemHelper.DecrementAndRemove(component, _wielderSlot); ItemHelper.SetCurrentItemUse(component, (ItemUseType)0); } } NetworkServer.SendToAll(new MoonEndMessage { WielderNetId = ((Component)this).GetComponent().netId, ExplosionPos = _serverImpactPos }, 0, false); } GlobalSessionLock.Release(); if (_serverCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverCoroutine); _serverCoroutine = null; } _wielderSlot = -1; } public override void ServerHoleCleanup() { if (_serverSessionActive) { ServerEndSession(broadcast: false); } } public override void OnStopServer() { if (_serverSessionActive) { ServerEndSession(broadcast: true); } } public override void ClientHoleCleanup() { MoonClientLogic.ClearAll(); } } public abstract class NetworkBridgeBase : NetworkBehaviour, IHoleCleanable { public abstract void ServerHoleCleanup(); public abstract void ClientHoleCleanup(); } public class NukeBombBehaviour : MonoBehaviour { public PlayerInfo ThrowerInfo; public Rigidbody ThrowerRigidbody; public ItemUseId ItemUseId; public float DropSpeed = 80f; public float GroundProximityDistance = 3f; public float ExplosionScale = 8f; public float SkyBlastForce = 100f; public float SkyBlastRadius = 300f; public float SkyBlastVerticalBias = 0.6f; private Rigidbody _rb; private bool _detonated; private static readonly MethodInfo ServerExplodeMethod = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); private void Start() { _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = false; _rb.useGravity = true; } } private void FixedUpdate() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!_detonated && !((Object)(object)_rb == (Object)null)) { _rb.linearVelocity = Vector3.down * DropSpeed; _rb.angularVelocity = Vector3.zero; if (Physics.Raycast(((Component)this).transform.position, Vector3.down, GroundProximityDistance, ItemHelper.GroundLayerMask)) { Detonate(); } } } private void OnCollisionEnter(Collision collision) { if (!_detonated && (ItemHelper.GroundLayerMask & (1 << collision.gameObject.layer)) != 0) { Detonate(); } } public void Detonate() { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!_detonated) { _detonated = true; Vector3 position = ((Component)this).transform.position; IssaPluginPlugin.Log.LogInfo((object)$"[Nuke] Bomb detonating at {position:F1}."); NetworkServer.SendToAll(new NukeExplosionMessage { Position = position, ThrowerInfo = ThrowerInfo, ItemUseId = ItemUseId, SkyBlastForce = SkyBlastForce, SkyBlastVerticalBias = SkyBlastVerticalBias, NukeExplosionVfxScale = ModConfig.Nuke.ExplosionVfxScale.Value }, 0, false); Rocket val = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.AddComponent(); val.ServerInitialize(ThrowerInfo, (Hittable)null, ItemUseId); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ExplosionScale); ServerExplodeMethod?.Invoke(val, new object[1] { position }); } IssaPluginPlugin.Log.LogInfo((object)"[Nuke] Detonation complete."); NetworkServer.Destroy(((Component)this).gameObject); } } } public static class NukeItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class NukeItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.NukeItemType; public override string DisplayName => "Nuke"; public override string[] ConsoleAliases => new string[1] { "nuke" }; public override Sprite Icon => AssetLoader.NukeIcon; public override GameObject HeldModelPrefab => AssetLoader.NuclearDetonatorPrefab; public override int MaxUses => (int)ModConfig.Nuke.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.Nuke.GiveKey.Value; public override ItemType AnimatorItemType => (ItemType)7; public override ItemType AnimatorChangedItemType => (ItemType)7; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { NukeNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(NukeFireMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[Nuke] No NukeNetworkBridge on player."); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct NukeFireMessage : NetworkMessage { } public static class NukeFireMessageSerialization { public static void WriteNukeFireMessage(NetworkWriter w, NukeFireMessage m) { } public static NukeFireMessage ReadNukeFireMessage(NetworkReader r) { return default(NukeFireMessage); } } public struct NukeExplosionMessage : NetworkMessage { public Vector3 Position; public PlayerInfo ThrowerInfo; public ItemUseId ItemUseId; public float SkyBlastForce; public float SkyBlastVerticalBias; public float NukeExplosionVfxScale; } public static class NukeExplosionMessageSerialization { public static void WriteNukeExplosionMessage(NetworkWriter w, NukeExplosionMessage m) { //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) NetworkWriterExtensions.WriteVector3(w, m.Position); NetworkWriterExtensions.WriteNetworkBehaviour(w, (NetworkBehaviour)(object)m.ThrowerInfo); w.Write(m.ItemUseId); NetworkWriterExtensions.WriteFloat(w, m.SkyBlastForce); NetworkWriterExtensions.WriteFloat(w, m.SkyBlastVerticalBias); NetworkWriterExtensions.WriteFloat(w, m.NukeExplosionVfxScale); } public static NukeExplosionMessage ReadNukeExplosionMessage(NetworkReader r) { //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_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) return new NukeExplosionMessage { Position = NetworkReaderExtensions.ReadVector3(r), ThrowerInfo = NetworkReaderExtensions.ReadNetworkBehaviour(r), ItemUseId = r.Read(), SkyBlastForce = NetworkReaderExtensions.ReadFloat(r), SkyBlastVerticalBias = NetworkReaderExtensions.ReadFloat(r), NukeExplosionVfxScale = NetworkReaderExtensions.ReadFloat(r) }; } } public class NukeNetworkBridge : NetworkBridgeBase { private bool _serverRoutineActive; private Coroutine _serverRoutine; public void ServerHandleFire() { if (_serverRoutineActive) { IssaPluginPlugin.Log.LogWarning((object)"[Nuke] Server routine already active."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Nuke] No PlayerInventory on bridge object."); return; } _serverRoutineActive = true; _serverRoutine = ((MonoBehaviour)this).StartCoroutine(ServerFireRoutine(component)); } private IEnumerator ServerFireRoutine(PlayerInventory inventory) { ItemHelper.ConsumeEquippedItem(inventory); if ((Object)(object)AssetLoader.NukeBombPrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Nuke] NukeBombPrefab not loaded — add 'nuke_bomb.prefab' to the asset bundle."); _serverRoutineActive = false; yield break; } float dropHeight = ModConfig.Nuke.DropHeight.Value; Vector3 mapCenter = ((Component)inventory).transform.position; Vector3 spawnPos = new Vector3(mapCenter.x, mapCenter.y + dropHeight, mapCenter.z); GameObject bombGo = Object.Instantiate(AssetLoader.NukeBombPrefab, spawnPos, Quaternion.identity); if ((Object)(object)bombGo == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Nuke] Failed to instantiate NukeBombPrefab."); _serverRoutineActive = false; yield break; } NetworkServer.Spawn(bombGo, (NetworkConnectionToClient)null); PlayerInfo playerInfo = inventory.PlayerInfo; string playerName = playerInfo.PlayerId.PlayerName; ItemType nukeItemType = ItemRegistry.NukeItemType; NetworkIdentity component = bombGo.GetComponent(); ItemWarningBroadcaster.Broadcast(playerName, nukeItemType, "Nuke", (component != null) ? component.netId : 0u, ((NetworkBehaviour)this).netId); ItemUseId itemUseId = new ItemUseId(playerInfo.PlayerId.Guid, NukeItem.NextUseIndex(), (ItemType)7, false); NukeBombBehaviour behaviour = bombGo.AddComponent(); behaviour.ThrowerInfo = playerInfo; behaviour.ThrowerRigidbody = ((Component)this).GetComponentInParent(); behaviour.ItemUseId = itemUseId; behaviour.DropSpeed = ModConfig.Nuke.DropSpeed.Value; behaviour.ExplosionScale = ModConfig.Nuke.ExplosionScale.Value; behaviour.SkyBlastForce = ModConfig.Nuke.SkyBlastForce.Value; behaviour.SkyBlastRadius = ModConfig.Nuke.SkyBlastRadius.Value; behaviour.SkyBlastVerticalBias = ModConfig.Nuke.SkyBlastVerticalBias.Value; IssaPluginPlugin.Log.LogInfo((object)$"[Nuke] Bomb spawned at {spawnPos:F1}."); float dropTime = dropHeight / Mathf.Max(ModConfig.Nuke.DropSpeed.Value, 1f); float timeout = dropTime + 10f; float elapsed = 0f; while ((Object)(object)bombGo != (Object)null && elapsed < timeout) { elapsed += Time.deltaTime; yield return null; } if ((Object)(object)bombGo != (Object)null) { bombGo.GetComponent()?.Detonate(); } _serverRoutineActive = false; _serverRoutine = null; IssaPluginPlugin.Log.LogInfo((object)"[Nuke] Server routine complete."); } public override void ServerHoleCleanup() { if (_serverRoutineActive) { if (_serverRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverRoutine); _serverRoutine = null; } _serverRoutineActive = false; IssaPluginPlugin.Log.LogInfo((object)"[Nuke] Server state cleared on hole transition."); } } public override void ClientHoleCleanup() { } internal static void HandleNukeExplosion(NukeExplosionMessage msg) { //IL_0065: 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_007a: 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_001e: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_0192: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AssetLoader.NukeExplosionVfxPrefab != (Object)null) { GameObject val = Object.Instantiate(AssetLoader.NukeExplosionVfxPrefab, msg.Position, Quaternion.identity); val.transform.localScale = Vector3.one * msg.NukeExplosionVfxScale; Object.Destroy((Object)(object)val, ModConfig.Nuke.ExplosionVfxDuration.Value); } else { VfxManager.PlayPooledVfxLocalOnly((VfxType)37, msg.Position, Quaternion.identity, Vector3.one * msg.NukeExplosionVfxScale, 0u, false, 0f, (Action)null); } if ((Object)(object)AssetLoader.NukeExplosionClip != (Object)null) { GameObject val2 = new GameObject("Nuke_Sound"); AudioSource val3 = val2.AddComponent(); val3.clip = AssetLoader.NukeExplosionClip; val3.spatialBlend = 0f; val3.volume = 1f; val3.Play(); Object.Destroy((Object)(object)val2, AssetLoader.NukeExplosionClip.length + 0.1f); } CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.Position, 1f, 1f); PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null || (ModConfig.Nuke.ExcludeThrower.Value && (Object)(object)localPlayerInfo == (Object)(object)msg.ThrowerInfo)) { return; } PlayerMovement movement = localPlayerInfo.Movement; Rigidbody componentInParent = ((Component)localPlayerInfo).GetComponentInParent(); if (!((Object)(object)movement == (Object)null) && !((Object)(object)componentInParent == (Object)null)) { Vector3 val4 = ((Component)movement).transform.position - msg.Position; Vector3 val5 = new Vector3(val4.x, 0f, val4.z); Vector3 normalized = ((Vector3)(ref val5)).normalized; val5 = Vector3.Lerp(normalized, Vector3.up, msg.SkyBlastVerticalBias); Vector3 normalized2 = ((Vector3)(ref val5)).normalized; Vector3 val6 = normalized2 * msg.SkyBlastForce; componentInParent.AddForce(val6, (ForceMode)2); bool flag = default(bool); movement.TryKnockOut(msg.ThrowerInfo, (KnockoutType)7, false, ((Component)movement).transform.InverseTransformPoint(msg.Position), ((Vector3)(ref val4)).magnitude, val6, (ElectromagnetShieldHitBlockType)0, msg.ItemUseId, false, true, ref flag, ref flag); PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { ((MonoBehaviour)movement).StartCoroutine(ApplyCoffeeMovementSpeed(movement)); } } } internal static IEnumerator ApplyCoffeeMovementSpeed(PlayerMovement movement) { yield return (object)new WaitForSeconds(3f); movement.InformDrankCoffee(); movement.InformDrankCoffee(); movement.InformDrankCoffee(); } } public class PlaceableWallBehaviour : MonoBehaviour { private int _activeChunks; public PlaceableWallNetworkBridge OwnerBridge { get; set; } private void Start() { _activeChunks = ((Component)this).GetComponentsInChildren().Length; } internal void OnChunkDeformed() { _activeChunks--; IssaPluginPlugin.Log.LogWarning((object)$"[PlaceableWall] Chunk deformed. Number of active chunks remaining: {_activeChunks}."); if (_activeChunks <= 0) { IssaPluginPlugin.Log.LogWarning((object)"[PlaceableWall] No more active chunks remaining. Cleaning up wall."); Object.Destroy((Object)(object)((Component)this).gameObject, ModConfig.PlaceableWall.DebrisLifetime.Value); } } } public class PlaceableWallDestructionBehaviour : MonoBehaviour { private bool _deformed; public float HealthPoints { get; private set; } public float VelocityImpactFactor { get; private set; } public float TorsionMultiplier { get; private set; } public Rigidbody Rigidbody { get; private set; } private void Awake() { Rigidbody = ((Component)this).GetComponent(); HealthPoints = ModConfig.PlaceableWall.HealthPoints.Value; VelocityImpactFactor = ModConfig.PlaceableWall.VelocityImpactFactor.Value; TorsionMultiplier = ModConfig.PlaceableWall.TorsionMultiplier.Value; } public void ApplyDamage(float amount) { HealthPoints -= amount; TryDeformWall(); } public void ApplyExplosionDamage(Vector3 explosionCenter, float explosionRadius) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) HealthPoints = 0f; TryDeformWall(explosionCenter, explosionRadius); } private void TryDeformWall(Vector3? explosionCenter = null, float explosionRadius = 0f) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (_deformed || HealthPoints > 0f) { return; } _deformed = true; float value = ModConfig.PlaceableWall.DebrisLifetime.Value; float value2 = ModConfig.PlaceableWall.RocketExplosionForce.Value; foreach (Transform item in ((Component)this).transform) { Transform val = item; val.parent = null; Rigidbody val2 = ((Component)val).gameObject.AddComponent(); if (explosionCenter.HasValue) { val2.AddExplosionForce(value2, explosionCenter.Value, explosionRadius, 1f, (ForceMode)1); } else { val2.linearVelocity = Rigidbody.GetPointVelocity(val.position); val2.AddTorque(Rigidbody.angularVelocity, (ForceMode)2); } Object.Destroy((Object)(object)((Component)val).gameObject, value); } ((Component)this).GetComponentInParent()?.OnChunkDeformed(); Object.Destroy((Object)(object)((Component)this).gameObject); } private void FixedUpdate() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) float torsionMultiplier = TorsionMultiplier; Vector3 angularVelocity = Rigidbody.angularVelocity; float num = torsionMultiplier * ((Vector3)(ref angularVelocity)).sqrMagnitude; HealthPoints -= num; TryDeformWall(); } private void OnCollisionEnter(Collision collision) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)collision.gameObject.GetComponentInParent() != (Object)null)) { Vector3 relativeVelocity = collision.relativeVelocity; float sqrMagnitude = ((Vector3)(ref relativeVelocity)).sqrMagnitude; float num = sqrMagnitude * VelocityImpactFactor; if (Object.op_Implicit((Object)(object)collision.rigidbody)) { num *= collision.rigidbody.mass; } HealthPoints -= num; } } } public static class PlaceableWallItem { private static int _nextUseIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _nextUseIndex); } } public class PlaceableWallItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.PlaceableWallItemType; public override string DisplayName => "Placeable Wall"; public override string[] ConsoleAliases => new string[2] { "wall", "placewall" }; public override Sprite Icon => AssetLoader.WallIcon; public override GameObject HeldModelPrefab => AssetLoader.WallHandheldPrefab; public override int MaxUses => (int)ModConfig.PlaceableWall.Uses.Value; public override float DefaultPoolWeight => 15f; public override Key GiveKey => ModConfig.PlaceableWall.GiveKey.Value; public override void OnUse(PlayerInventory inventory) { ((Component)inventory).GetComponent()?.ClientPlace(); } public override void OnEquip(PlayerInventory inventory) { if ((Object)(object)((Component)inventory).GetComponent() == (Object)null) { ((Component)inventory).gameObject.AddComponent(); } } } public struct PlaceWallMessage : NetworkMessage { public Vector3 RayOrigin; public Vector3 RayDirection; public float ExtraYawDegrees; } public static class PlaceWallMessageSerialization { public static void WritePlaceWallMessage(NetworkWriter writer, PlaceWallMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.RayOrigin); NetworkWriterExtensions.WriteVector3(writer, msg.RayDirection); NetworkWriterExtensions.WriteFloat(writer, msg.ExtraYawDegrees); } public static PlaceWallMessage ReadPlaceWallMessage(NetworkReader reader) { //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_0018: 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) return new PlaceWallMessage { RayOrigin = NetworkReaderExtensions.ReadVector3(reader), RayDirection = NetworkReaderExtensions.ReadVector3(reader), ExtraYawDegrees = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct WallDestroyedMessage : NetworkMessage { public Vector3 DestroyPosition; } public static class WallDestroyedMessageSerialization { public static void WriteWallDestroyedMessage(NetworkWriter writer, WallDestroyedMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.DestroyPosition); } public static WallDestroyedMessage ReadWallDestroyedMessage(NetworkReader reader) { //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) return new WallDestroyedMessage { DestroyPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public class PlaceableWallNetworkBridge : NetworkBridgeBase { internal readonly List _activeWalls = new List(); public void ClientPlace() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[PlaceableWall] No main camera for placement ray."); return; } float extraYawDegrees = ((Component)this).GetComponent()?.CurrentRotationOffset ?? 0f; NetworkClient.Send(new PlaceWallMessage { RayOrigin = ((Component)main).transform.position, RayDirection = ((Component)main).transform.forward, ExtraYawDegrees = extraYawDegrees }, 0); } public void ServerHandlePlacement(Vector3 rayOrigin, Vector3 rayDirection, float extraYawDegrees = 0f) { //IL_001c: 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_007e: 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_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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00df: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return; } if (component.GetEffectivelyEquippedItem(true) != ItemRegistry.PlaceableWallItemType) { IssaPluginPlugin.Log.LogWarning((object)"[PlaceableWall] Player does not have PlaceableWall equipped."); return; } if ((Object)(object)AssetLoader.WallPrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[PlaceableWall] Wall prefab not loaded."); return; } float value = ModConfig.PlaceableWall.MaxPlacementDistance.Value; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(rayOrigin, rayDirection, ref val, value, ItemHelper.GroundLayerMask, (QueryTriggerInteraction)1)) { IssaPluginPlugin.Log.LogInfo((object)"[PlaceableWall] Placement raycast found no ground — ignoring."); return; } Vector3 point = ((RaycastHit)(ref val)).point; Vector3 val2 = Vector3.ProjectOnPlane(rayDirection, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.001f) { val2 = Vector3.forward; } Quaternion val3 = Quaternion.LookRotation(-((Vector3)(ref val2)).normalized, Vector3.up); Quaternion val4 = val3 * Quaternion.Euler(0f, extraYawDegrees, 0f); if (!IsValidPlacement(point, val4)) { IssaPluginPlugin.Log.LogInfo((object)$"[PlaceableWall] Placement at {point} rejected (hole or player overlap)."); return; } ItemHelper.ConsumeEquippedItem(component); GameObject val5 = Object.Instantiate(AssetLoader.WallPrefab, point, val4); if ((Object)(object)val5 == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[PlaceableWall] Wall prefab failed to instantiate."); return; } foreach (Transform item in val5.transform) { Transform val6 = item; if ((Object)(object)((Component)val6).GetComponent() != (Object)null) { ((Component)val6).gameObject.AddComponent(); } } NetworkServer.Spawn(val5, (NetworkConnectionToClient)null); PlaceableWallBehaviour placeableWallBehaviour = val5.AddComponent(); placeableWallBehaviour.OwnerBridge = this; _activeWalls.Add(val5); ManualLogSource log = IssaPluginPlugin.Log; string text = $"[PlaceableWall] Wall placed at {point} by "; PlayerInfo playerInfo = component.PlayerInfo; log.LogInfo((object)(text + (((playerInfo != null) ? playerInfo.PlayerId.PlayerName : null) ?? "unknown") + ".")); } public static void HandleWallDestroyed(WallDestroyedMessage msg) { //IL_0004: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) VfxManager.PlayPooledVfxLocalOnly((VfxType)37, msg.DestroyPosition, Quaternion.identity, Vector3.one * 0.6f, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.DestroyPosition, 1f, 1f); } private static bool IsValidPlacement(Vector3 position, Quaternion rotation) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00dd: Unknown result type (might be due to invalid IL or missing references) float value = ModConfig.PlaceableWall.MinHoleDistance.Value; if (value > 0f) { GolfHole mainHole = GolfHoleManager.MainHole; if ((Object)(object)mainHole != (Object)null) { Vector3 position2 = ((Component)mainHole).transform.position; Vector2 val = new Vector2(position.x - position2.x, position.z - position2.z); float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < value) { return false; } } } Vector3 val2 = (Vector3)(((Object)(object)AssetLoader.WallPrefab != (Object)null) ? AssetLoader.WallPrefab.transform.localScale : new Vector3(4f, 3f, 0.3f)); Vector3 val3 = val2 * 0.45f; Vector3 val4 = position + Vector3.up * val3.y; Collider[] array = Physics.OverlapBox(val4, val3, rotation, -1, (QueryTriggerInteraction)1); Collider[] array2 = array; foreach (Collider val5 in array2) { if ((Object)(object)((Component)val5).GetComponentInParent() != (Object)null) { return false; } } return true; } public override void ServerHoleCleanup() { foreach (GameObject activeWall in _activeWalls) { if ((Object)(object)activeWall != (Object)null) { NetworkServer.Destroy(activeWall); } } _activeWalls.Clear(); IssaPluginPlugin.Log.LogInfo((object)"[PlaceableWall] ServerHoleCleanup: all walls destroyed."); } public override void ClientHoleCleanup() { } } public class PlaceableWallPlacementPreview : MonoBehaviour { private GameObject _ghost; private static Material _validMat; private static Material _invalidMat; public float CurrentRotationOffset { get; private set; } private void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_0161: Unknown result type (might be due to invalid IL or missing references) PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null || component.GetEffectivelyEquippedItem(true) != ItemRegistry.PlaceableWallItemType) { DestroyGhost(); Object.Destroy((Object)(object)this); return; } Mouse current = Mouse.current; if (current == null || !current.rightButton.isPressed) { HideGhost(); return; } float y = ((InputControl)(object)Mouse.current.scroll).ReadValue().y; if (y != 0f) { CurrentRotationOffset = (CurrentRotationOffset + Mathf.Sign(y) * ModConfig.PlaceableWall.RotationStep.Value) % 360f; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { HideGhost(); return; } float value = ModConfig.PlaceableWall.MaxPlacementDistance.Value; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val, value, ItemHelper.GroundLayerMask, (QueryTriggerInteraction)1)) { HideGhost(); return; } Vector3 point = ((RaycastHit)(ref val)).point; Vector3 val2 = Vector3.ProjectOnPlane(((Component)main).transform.forward, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.001f) { val2 = Vector3.forward; } Quaternion val3 = Quaternion.LookRotation(-((Vector3)(ref val2)).normalized, Vector3.up); Quaternion rotation = val3 * Quaternion.Euler(0f, CurrentRotationOffset, 0f); ShowGhost(point, rotation); bool flag = IsPlacementValid(point, rotation); ApplyMaterial(flag ? GetValidMat() : GetInvalidMat()); } private void OnDestroy() { DestroyGhost(); } private void ShowGhost(Vector3 position, Quaternion rotation) { //IL_0062: 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_0029: 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) if ((Object)(object)_ghost == (Object)null) { if (!((Object)(object)AssetLoader.WallGhostPrefab == (Object)null)) { _ghost = Object.Instantiate(AssetLoader.WallGhostPrefab, position, rotation); ((Object)_ghost).name = "PlaceableWall_Ghost"; _ghost.SetActive(true); } } else { _ghost.transform.SetPositionAndRotation(position, rotation); if (!_ghost.activeSelf) { _ghost.SetActive(true); } } } private void HideGhost() { if ((Object)(object)_ghost != (Object)null && _ghost.activeSelf) { _ghost.SetActive(false); } } private void DestroyGhost() { if ((Object)(object)_ghost != (Object)null) { Object.Destroy((Object)(object)_ghost); _ghost = null; } } private void ApplyMaterial(Material mat) { if ((Object)(object)_ghost == (Object)null || (Object)(object)mat == (Object)null) { return; } MeshRenderer[] componentsInChildren = _ghost.GetComponentsInChildren(true); foreach (MeshRenderer val in componentsInChildren) { Material[] array = (Material[])(object)new Material[((Renderer)val).sharedMaterials.Length]; for (int j = 0; j < array.Length; j++) { array[j] = mat; } ((Renderer)val).sharedMaterials = array; } } private static bool IsPlacementValid(Vector3 position, Quaternion rotation) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00dd: Unknown result type (might be due to invalid IL or missing references) float value = ModConfig.PlaceableWall.MinHoleDistance.Value; if (value > 0f) { GolfHole mainHole = GolfHoleManager.MainHole; if ((Object)(object)mainHole != (Object)null) { Vector3 position2 = ((Component)mainHole).transform.position; Vector2 val = new Vector2(position.x - position2.x, position.z - position2.z); float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < value) { return false; } } } Vector3 val2 = (Vector3)(((Object)(object)AssetLoader.WallPrefab != (Object)null) ? AssetLoader.WallPrefab.transform.localScale : new Vector3(4f, 3f, 0.3f)); Vector3 val3 = val2 * 0.45f; Vector3 val4 = position + Vector3.up * val3.y; Collider[] array = Physics.OverlapBox(val4, val3, rotation, -1, (QueryTriggerInteraction)1); Collider[] array2 = array; foreach (Collider val5 in array2) { if ((Object)(object)((Component)val5).GetComponentInParent() != (Object)null) { return false; } } return true; } private static Material GetValidMat() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_validMat == (Object)null) { _validMat = BuildGhostMaterial(new Color(0f, 1f, 0f, 0.35f)); } return _validMat; } private static Material GetInvalidMat() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_invalidMat == (Object)null) { _invalidMat = BuildGhostMaterial(new Color(1f, 0f, 0f, 0.35f)); } return _invalidMat; } private static Material BuildGhostMaterial(Color color) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Custom/GhostPlacement"); if ((Object)(object)val != (Object)null) { Material val2 = new Material(val); val2.SetColor("_Color", color); return val2; } Shader val3 = Shader.Find("Standard"); if ((Object)(object)val3 == (Object)null) { return null; } Material val4 = new Material(val3); val4.SetFloat("_Mode", 3f); val4.SetInt("_SrcBlend", 5); val4.SetInt("_DstBlend", 10); val4.SetInt("_ZWrite", 0); val4.DisableKeyword("_ALPHATEST_ON"); val4.EnableKeyword("_ALPHABLEND_ON"); val4.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val4.renderQueue = 3000; val4.color = color; return val4; } } public class PoisonJarBehaviour : MonoBehaviour { public uint ThrowerNetId; private Rigidbody _rb; private bool _landed; private float _graceTimer = 0.25f; private void Start() { _rb = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (!_landed) { _graceTimer -= Time.fixedDeltaTime; if (!(_graceTimer > 0f) && (Object)(object)_rb != (Object)null && !(_rb.linearVelocity.y > 0f)) { } } } private void OnCollisionEnter(Collision collision) { Land(); } private void Land() { //IL_0079: 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_002c: 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) _landed = true; if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = true; _rb.linearVelocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; } float value = ModConfig.PoisonJar.Radius.Value; float value2 = ModConfig.PoisonJar.Duration.Value; NetworkServer.SendToAll(new PoisonJarLandedMessage { Position = ((Component)this).transform.position, Radius = value, Duration = value2, ThrowerNetId = ThrowerNetId }, 0, false); NetworkServer.Destroy(((Component)this).gameObject); } } public class PoisonJarItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.PoisonJarItemType; public override string DisplayName => "Poison Jar"; public override string[] ConsoleAliases => new string[2] { "poisonjar", "poison" }; public override Sprite Icon => AssetLoader.PoisonJarIcon; public override GameObject HeldModelPrefab => AssetLoader.PoisonJarHandheldPrefab; public override int MaxUses => (int)ModConfig.PoisonJar.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.PoisonJar.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnEquip(PlayerInventory inventory) { //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) StickyGrenadeTrajectoryPreview component = ((Component)inventory).GetComponent(); if ((Object)(object)component == (Object)null) { component = ((Component)inventory).gameObject.AddComponent(); component.TargetItemType = ItemRegistry.PoisonJarItemType; component.ThrowSpeed = () => ModConfig.PoisonJar.ThrowSpeed.Value; component.LobAngle = () => ModConfig.PoisonJar.LobAngle.Value; } } public override void OnUse(PlayerInventory inventory) { ((Component)inventory).GetComponent()?.ClientThrow(); } } public struct PoisonJarThrowMessage : NetworkMessage { public Vector3 ThrowOrigin; public Vector3 ThrowVelocity; } public struct PoisonJarLandedMessage : NetworkMessage { public Vector3 Position; public float Radius; public float Duration; public uint ThrowerNetId; } public static class PoisonJarMessageSerialization { public static void WritePoisonJarThrowMessage(NetworkWriter w, PoisonJarThrowMessage m) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(w, m.ThrowOrigin); NetworkWriterExtensions.WriteVector3(w, m.ThrowVelocity); } public static PoisonJarThrowMessage ReadPoisonJarThrowMessage(NetworkReader r) { //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_0018: 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) return new PoisonJarThrowMessage { ThrowOrigin = NetworkReaderExtensions.ReadVector3(r), ThrowVelocity = NetworkReaderExtensions.ReadVector3(r) }; } public static void WritePoisonJarLandedMessage(NetworkWriter w, PoisonJarLandedMessage m) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(w, m.Position); NetworkWriterExtensions.WriteFloat(w, m.Radius); NetworkWriterExtensions.WriteFloat(w, m.Duration); NetworkWriterExtensions.WriteUInt(w, m.ThrowerNetId); } public static PoisonJarLandedMessage ReadPoisonJarLandedMessage(NetworkReader r) { //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) return new PoisonJarLandedMessage { Position = NetworkReaderExtensions.ReadVector3(r), Radius = NetworkReaderExtensions.ReadFloat(r), Duration = NetworkReaderExtensions.ReadFloat(r), ThrowerNetId = NetworkReaderExtensions.ReadUInt(r) }; } } public class PoisonJarNetworkBridge : NetworkBridgeBase { public void ClientThrow() { //IL_0030: 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_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) //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[PoisonJar] No main camera for throw direction."); return; } Vector3 forward = ((Component)main).transform.forward; Vector3 val = ((Component)main).transform.position + forward * 1.2f + Vector3.up * 0.3f; Vector3 val2 = forward + Vector3.up * ModConfig.PoisonJar.LobAngle.Value; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 throwVelocity = normalized * ModConfig.PoisonJar.ThrowSpeed.Value; NetworkClient.Send(new PoisonJarThrowMessage { ThrowOrigin = val, ThrowVelocity = throwVelocity }, 0); IssaPluginPlugin.Log.LogInfo((object)$"[PoisonJar] Client throw: origin={val} speed={((Vector3)(ref throwVelocity)).magnitude:F1}"); } public void ServerHandleThrow(Vector3 throwOrigin, Vector3 throwVelocity) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[PoisonJar] No PlayerInventory on bridge object."); return; } if (component.GetEffectivelyEquippedItem(true) != ItemRegistry.PoisonJarItemType) { IssaPluginPlugin.Log.LogWarning((object)"[PoisonJar] Player does not have PoisonJar equipped."); return; } if ((Object)(object)AssetLoader.PoisonJarPrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[PoisonJar] Jar prefab not loaded."); return; } ItemHelper.ConsumeEquippedItem(component); Vector3 linearVelocity = Vector3.ClampMagnitude(throwVelocity, ModConfig.PoisonJar.ThrowSpeed.Value * 1.5f); GameObject val = Object.Instantiate(AssetLoader.PoisonJarPrefab, throwOrigin, (((Vector3)(ref linearVelocity)).sqrMagnitude > 0.001f) ? Quaternion.LookRotation(((Vector3)(ref linearVelocity)).normalized, Vector3.up) : Quaternion.identity); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[PoisonJar] Jar prefab failed to instantiate."); return; } Rigidbody component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.useGravity = true; component2.isKinematic = false; component2.linearVelocity = linearVelocity; Vector3 val2 = Vector3.Cross(((Vector3)(ref linearVelocity)).normalized, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.right; } component2.angularVelocity = val3 * 8f; } NetworkServer.Spawn(val, (NetworkConnectionToClient)null); PoisonJarBehaviour poisonJarBehaviour = val.AddComponent(); poisonJarBehaviour.ThrowerNetId = ((NetworkBehaviour)this).netId; IssaPluginPlugin.Log.LogInfo((object)$"[PoisonJar] Jar thrown from {throwOrigin} speed={((Vector3)(ref linearVelocity)).magnitude:F1} m/s"); } public static void HandleLanded(PoisonJarLandedMessage msg) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) GameObject poisonSplashPrefab = AssetLoader.PoisonSplashPrefab; if ((Object)(object)poisonSplashPrefab != (Object)null) { float num = msg.Radius / ModConfig.PoisonJar.Radius.Value; GameObject val = Object.Instantiate(poisonSplashPrefab, msg.Position, Quaternion.identity); val.transform.localScale = Vector3.one * num; Object.Destroy((Object)(object)val, 6f); } NetworkIdentity localPlayer = NetworkClient.localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Vector3 val2 = ((Component)localPlayer).transform.position - msg.Position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude <= msg.Radius * msg.Radius) { PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null && localPlayerInfo.IsElectromagnetShieldActive) { val2 = ((Component)localPlayer).transform.position - msg.Position; Vector3 normalized = ((Vector3)(ref val2)).normalized; localPlayerInfo.PlayElectromagnetShieldHitForAllClients(normalized, false); } else { IssaPluginPlugin.Log.LogInfo((object)$"[PoisonJar] Local player poisoned for {msg.Duration:F1}s"); PoisonOverlay.Instance?.ActivatePoison(msg.Duration); } } } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public class PositionSwapItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.PositionSwapItemType; public override string DisplayName => "Position Swap"; public override string[] ConsoleAliases => new string[2] { "positionswap", "swap" }; public override Sprite Icon => AssetLoader.PositionSwapIcon; public override GameObject HeldModelPrefab => AssetLoader.PositionSwapHandheldPrefab; public override int MaxUses => (int)ModConfig.PositionSwap.Uses.Value; public override float DefaultPoolWeight => 15f; public override Key GiveKey => ModConfig.PositionSwap.GiveKey.Value; public override void OnUse(PlayerInventory inventory) { PositionSwapOverlay.Instance?.OpenChooser(); } } public struct PositionSwapRequestMessage : NetworkMessage { public uint TargetNetId; public int EquippedSlotIndex; } public static class PositionSwapRequestMessageSerialization { public static void WritePositionSwapRequestMessage(NetworkWriter writer, PositionSwapRequestMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteInt(writer, msg.EquippedSlotIndex); } public static PositionSwapRequestMessage ReadPositionSwapRequestMessage(NetworkReader reader) { return new PositionSwapRequestMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader), EquippedSlotIndex = NetworkReaderExtensions.ReadInt(reader) }; } } public struct PositionSwapWarningMessage : NetworkMessage { public uint InitiatorNetId; public uint TargetNetId; public float Delay; } public static class PositionSwapWarningMessageSerialization { public static void WritePositionSwapWarningMessage(NetworkWriter writer, PositionSwapWarningMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.InitiatorNetId); NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteFloat(writer, msg.Delay); } public static PositionSwapWarningMessage ReadPositionSwapWarningMessage(NetworkReader reader) { return new PositionSwapWarningMessage { InitiatorNetId = NetworkReaderExtensions.ReadUInt(reader), TargetNetId = NetworkReaderExtensions.ReadUInt(reader), Delay = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct PositionSwapTeleportMessage : NetworkMessage { public Vector3 NewPosition; } public static class PositionSwapTeleportMessageSerialization { public static void WritePositionSwapTeleportMessage(NetworkWriter writer, PositionSwapTeleportMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.NewPosition); } public static PositionSwapTeleportMessage ReadPositionSwapTeleportMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new PositionSwapTeleportMessage { NewPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct PositionSwapExecuteMessage : NetworkMessage { public uint InitiatorNetId; public uint TargetNetId; public Vector3 InitiatorDestination; public Vector3 TargetDestination; } public static class PositionSwapExecuteMessageSerialization { public static void WritePositionSwapExecuteMessage(NetworkWriter writer, PositionSwapExecuteMessage msg) { //IL_001d: 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) NetworkWriterExtensions.WriteUInt(writer, msg.InitiatorNetId); NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteVector3(writer, msg.InitiatorDestination); NetworkWriterExtensions.WriteVector3(writer, msg.TargetDestination); } public static PositionSwapExecuteMessage ReadPositionSwapExecuteMessage(NetworkReader reader) { //IL_0026: 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_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) return new PositionSwapExecuteMessage { InitiatorNetId = NetworkReaderExtensions.ReadUInt(reader), TargetNetId = NetworkReaderExtensions.ReadUInt(reader), InitiatorDestination = NetworkReaderExtensions.ReadVector3(reader), TargetDestination = NetworkReaderExtensions.ReadVector3(reader) }; } } public enum PositionSwapCancelReason : byte { Generic, PlayerEnteredGolfCart } public struct PositionSwapCancelledMessage : NetworkMessage { public uint InitiatorNetId; public PositionSwapCancelReason CancelReason; } public static class PositionSwapCancelledMessageSerialization { public static void WritePositionSwapCancelledMessage(NetworkWriter writer, PositionSwapCancelledMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.InitiatorNetId); writer.WriteByte((byte)msg.CancelReason); } public static PositionSwapCancelledMessage ReadPositionSwapCancelledMessage(NetworkReader reader) { return new PositionSwapCancelledMessage { InitiatorNetId = NetworkReaderExtensions.ReadUInt(reader), CancelReason = (PositionSwapCancelReason)reader.ReadByte() }; } } public class PositionSwapNetworkBridge : NetworkBridgeBase { private bool _isServerRoutineActive; private Coroutine _serverRoutine; private PlayerInventory _inventory; private static readonly Dictionary _pendingOrbs = new Dictionary(); private void Awake() { _inventory = ((Component)this).GetComponent(); } public void ServerHandleRequest(uint targetNetId, int equippedSlotIndex) { //IL_0041: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) if (_isServerRoutineActive) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Routine already active for this player."); } else { if ((Object)(object)_inventory == (Object)null) { return; } if (ItemRegistry.GetItemTypeAtSlot(_inventory, equippedSlotIndex) != ItemRegistry.PositionSwapItemType) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Item not equipped on initiator."); return; } if (targetNetId == ((NetworkBehaviour)this).netId) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Initiator targeted themselves."); return; } if (!NetworkServer.spawned.TryGetValue(targetNetId, out var value)) { IssaPluginPlugin.Log.LogWarning((object)$"[PositionSwap] Target netId {targetNetId} not found."); NetworkConnectionToClient connectionToClient = ((NetworkBehaviour)this).connectionToClient; if (connectionToClient != null) { ((NetworkConnection)connectionToClient).Send(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0); } return; } PlayerInventory component = ((Component)value).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Target has no PlayerInventory."); NetworkConnectionToClient connectionToClient2 = ((NetworkBehaviour)this).connectionToClient; if (connectionToClient2 != null) { ((NetworkConnection)connectionToClient2).Send(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0); } return; } PlayerInfo playerInfo = _inventory.PlayerInfo; PlayerInfo playerInfo2 = component.PlayerInfo; GolfCartSeat activeGolfCartSeat; if ((Object)(object)playerInfo != (Object)null) { activeGolfCartSeat = playerInfo.ActiveGolfCartSeat; if (((GolfCartSeat)(ref activeGolfCartSeat)).IsValid()) { goto IL_0197; } } if ((Object)(object)playerInfo2 != (Object)null) { activeGolfCartSeat = playerInfo2.ActiveGolfCartSeat; if (((GolfCartSeat)(ref activeGolfCartSeat)).IsValid()) { goto IL_0197; } } ItemHelper.ConsumeItemAtSlot(_inventory, equippedSlotIndex); float value2 = ModConfig.PositionSwap.Delay.Value; NetworkServer.SendToAll(new PositionSwapWarningMessage { InitiatorNetId = ((NetworkBehaviour)this).netId, TargetNetId = targetNetId, Delay = value2 }, 0, false); _isServerRoutineActive = true; _serverRoutine = ((MonoBehaviour)this).StartCoroutine(ServerSwapRoutine(_inventory, component, value2)); } return; IL_0197: IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] One or both players are in a golf cart."); NetworkConnectionToClient connectionToClient3 = ((NetworkBehaviour)this).connectionToClient; if (connectionToClient3 != null) { ((NetworkConnection)connectionToClient3).Send(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0); } } private IEnumerator ServerSwapRoutine(PlayerInventory initiatorInventory, PlayerInventory targetInventory, float delay) { yield return (object)new WaitForSeconds(delay); if ((Object)(object)initiatorInventory == (Object)null || (Object)(object)targetInventory == (Object)null || (Object)(object)((Component)initiatorInventory).gameObject == (Object)null || (Object)(object)((Component)targetInventory).gameObject == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Player gone before swap could execute."); NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _isServerRoutineActive = false; _serverRoutine = null; yield break; } PlayerInfo initiatorInfo = initiatorInventory.PlayerInfo; PlayerInfo targetInfo = targetInventory.PlayerInfo; if ((Object)(object)initiatorInfo == (Object)null || (Object)(object)targetInfo == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] PlayerInfo null before swap could execute."); NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _isServerRoutineActive = false; _serverRoutine = null; yield break; } GolfCartSeat activeGolfCartSeat = initiatorInfo.ActiveGolfCartSeat; int num; if (!((GolfCartSeat)(ref activeGolfCartSeat)).IsValid()) { activeGolfCartSeat = targetInfo.ActiveGolfCartSeat; num = (((GolfCartSeat)(ref activeGolfCartSeat)).IsValid() ? 1 : 0); } else { num = 1; } if (num != 0) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] A player entered a golf cart during the delay; cancelling."); NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId, CancelReason = PositionSwapCancelReason.PlayerEnteredGolfCart }, 0, false); _isServerRoutineActive = false; _serverRoutine = null; yield break; } PositionSwapNetworkBridge targetBridge = ((Component)targetInventory).GetComponent(); if ((Object)(object)targetBridge == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Target lost its NetworkBridge before swap could execute."); NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _isServerRoutineActive = false; _serverRoutine = null; yield break; } if (!((NetworkBehaviour)this).isLocalPlayer && ((NetworkBehaviour)this).connectionToClient == null) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Initiator connection lost before swap could execute."); NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _isServerRoutineActive = false; _serverRoutine = null; yield break; } if (!((NetworkBehaviour)targetBridge).isLocalPlayer && ((NetworkBehaviour)targetBridge).connectionToClient == null) { IssaPluginPlugin.Log.LogWarning((object)"[PositionSwap] Target connection lost before swap could execute."); NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _isServerRoutineActive = false; _serverRoutine = null; yield break; } Vector3 initiatorOldPos = initiatorInfo.Rigidbody.position; Vector3 targetOldPos = targetInfo.Rigidbody.position; initiatorInfo.Rigidbody.position = targetOldPos; targetInfo.Rigidbody.position = initiatorOldPos; if (((NetworkBehaviour)this).isLocalPlayer) { HandleTeleport(new PositionSwapTeleportMessage { NewPosition = targetOldPos }); } else { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new PositionSwapTeleportMessage { NewPosition = targetOldPos }, 0); } if (((NetworkBehaviour)targetBridge).isLocalPlayer) { HandleTeleport(new PositionSwapTeleportMessage { NewPosition = initiatorOldPos }); } else { ((NetworkConnection)((NetworkBehaviour)targetBridge).connectionToClient).Send(new PositionSwapTeleportMessage { NewPosition = initiatorOldPos }, 0); } NetworkServer.SendToAll(new PositionSwapExecuteMessage { InitiatorNetId = ((NetworkBehaviour)this).netId, TargetNetId = ((NetworkBehaviour)targetInventory).netId, InitiatorDestination = targetOldPos, TargetDestination = initiatorOldPos }, 0, false); IssaPluginPlugin.Log.LogInfo((object)$"[PositionSwap] Swapped positions: initiator→{targetOldPos}, target→{initiatorOldPos}"); _isServerRoutineActive = false; _serverRoutine = null; } public static void HandleWarning(PositionSwapWarningMessage msg) { PositionSwapOverlay.Instance?.OnSwapWarning(msg.InitiatorNetId, msg.TargetNetId, msg.Delay); SpawnWarningOrbs(msg.InitiatorNetId, msg.TargetNetId); } public static void HandleTeleport(PositionSwapTeleportMessage msg) { //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_0042: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (!((Object)(object)localPlayerInfo == (Object)null)) { localPlayerInfo.Movement.Teleport(msg.NewPosition, ((Component)localPlayerInfo.Movement).transform.rotation, false); IssaPluginPlugin.Log.LogInfo((object)$"[PositionSwap] Local player teleported to {msg.NewPosition}"); } } public static void HandleExecute(PositionSwapExecuteMessage msg) { //IL_002b: 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) PositionSwapOverlay.Instance?.OnSwapExecuted(msg.InitiatorNetId, msg.TargetNetId); DestroyWarningOrbs(msg.InitiatorNetId); SpawnSmokeAtPositions(msg.InitiatorDestination, msg.TargetDestination); } public static void HandleCancelled(PositionSwapCancelledMessage msg) { DestroyWarningOrbs(msg.InitiatorNetId); PositionSwapOverlay.Instance?.OnSwapCancelled(msg.InitiatorNetId, msg.CancelReason); IssaPluginPlugin.Log.LogInfo((object)"[PositionSwap] Swap cancelled."); } private static void SpawnWarningOrbs(uint initiatorNetId, uint targetNetId) { //IL_0051: 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) GameObject positionSwapOrbPrefab = AssetLoader.PositionSwapOrbPrefab; if (!((Object)(object)positionSwapOrbPrefab == (Object)null)) { GameObject val = null; GameObject val2 = null; if (NetworkClient.spawned.TryGetValue(initiatorNetId, out var value)) { val = Object.Instantiate(positionSwapOrbPrefab); val.transform.SetParent(((Component)value).transform, false); val.transform.localPosition = Vector3.zero; } if (NetworkClient.spawned.TryGetValue(targetNetId, out var value2)) { val2 = Object.Instantiate(positionSwapOrbPrefab); val2.transform.SetParent(((Component)value2).transform, false); val2.transform.localPosition = Vector3.zero; } _pendingOrbs[initiatorNetId] = (val, val2); } } private static void DestroyWarningOrbs(uint initiatorNetId) { if (_pendingOrbs.TryGetValue(initiatorNetId, out (GameObject, GameObject) value)) { if ((Object)(object)value.Item1 != (Object)null) { Object.Destroy((Object)(object)value.Item1); } if ((Object)(object)value.Item2 != (Object)null) { Object.Destroy((Object)(object)value.Item2); } _pendingOrbs.Remove(initiatorNetId); } } private static void SpawnSmokeAtPositions(Vector3 pos1, Vector3 pos2) { //IL_0015: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) GameObject positionSwapSmokePrefab = AssetLoader.PositionSwapSmokePrefab; if (!((Object)(object)positionSwapSmokePrefab == (Object)null)) { Object.Instantiate(positionSwapSmokePrefab, pos1, Quaternion.identity); Object.Instantiate(positionSwapSmokePrefab, pos2, Quaternion.identity); } } public override void ServerHoleCleanup() { if (_isServerRoutineActive) { if (_serverRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverRoutine); _serverRoutine = null; } NetworkServer.SendToAll(new PositionSwapCancelledMessage { InitiatorNetId = ((NetworkBehaviour)this).netId }, 0, false); _isServerRoutineActive = false; IssaPluginPlugin.Log.LogInfo((object)"[PositionSwap] Server state cleared on hole transition."); } } public override void OnStopServer() { if (_isServerRoutineActive) { if (_serverRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverRoutine); _serverRoutine = null; } _isServerRoutineActive = false; IssaPluginPlugin.Log.LogInfo((object)"[PositionSwap] Server state cleared on server stop."); } } public override void ClientHoleCleanup() { foreach (KeyValuePair pendingOrb in _pendingOrbs) { if ((Object)(object)pendingOrb.Value.Item1 != (Object)null) { Object.Destroy((Object)(object)pendingOrb.Value.Item1); } if ((Object)(object)pendingOrb.Value.Item2 != (Object)null) { Object.Destroy((Object)(object)pendingOrb.Value.Item2); } } _pendingOrbs.Clear(); PositionSwapOverlay instance = PositionSwapOverlay.Instance; if ((Object)(object)instance != (Object)null) { instance.ForceClose(); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct MissileRequestMessage : NetworkMessage { } public static class MissileRequestMessageSerialization { public static void WriteMissileRequestMessage(NetworkWriter writer, MissileRequestMessage msg) { } public static MissileRequestMessage ReadMissileRequestMessage(NetworkReader reader) { return default(MissileRequestMessage); } } public struct MissileSetVelocityMessage : NetworkMessage { public Vector3 Velocity; } public static class MissileSetVelocityMessageSerialization { public static void WriteMissileSetVelocityMessage(NetworkWriter writer, MissileSetVelocityMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Velocity); } public static MissileSetVelocityMessage ReadMissileSetVelocityMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new MissileSetVelocityMessage { Velocity = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct MissileDetonateMessage : NetworkMessage { } public static class MissileDetonateMessageSerialization { public static void WriteMissileDetonateMessage(NetworkWriter writer, MissileDetonateMessage msg) { } public static MissileDetonateMessage ReadMissileDetonateMessage(NetworkReader reader) { return default(MissileDetonateMessage); } } public struct MissileBeginSteeringMessage : NetworkMessage { public uint RocketNetId; } public static class MissileBeginSteeringMessageSerialization { public static void WriteMissileBeginSteeringMessage(NetworkWriter writer, MissileBeginSteeringMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.RocketNetId); } public static MissileBeginSteeringMessage ReadMissileBeginSteeringMessage(NetworkReader reader) { return new MissileBeginSteeringMessage { RocketNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct MissileEndSteeringMessage : NetworkMessage { } public static class MissileEndSteeringMessageSerialization { public static void WriteMissileEndSteeringMessage(NetworkWriter writer, MissileEndSteeringMessage msg) { } public static MissileEndSteeringMessage ReadMissileEndSteeringMessage(NetworkReader reader) { return default(MissileEndSteeringMessage); } } public class MissileNetworkBridge : NetworkBridgeBase { private Rocket _activeRocket; private Rigidbody _activeRocketRigidbody; private bool _isSteering; private bool _serverMissileActive; public bool IsSteering => _isSteering; public void ServerRequestMissile() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (_serverMissileActive) { IssaPluginPlugin.Log.LogWarning((object)"[Missile] Missile already active for this player."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Missile] No PlayerInventory on bridge object."); return; } _serverMissileActive = true; ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.PredatorMissileItemType, "Predator Missile", 0u, ((NetworkBehaviour)this).netId); ((MonoBehaviour)this).StartCoroutine(PredatorMissileItem.ServerMissileRoutine(component, this)); } public void ServerSetMissileVelocity(Vector3 velocity) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_activeRocket == (Object)null) && !((Object)(object)_activeRocketRigidbody == (Object)null)) { float num = ModConfig.PredatorMissile.FallSpeed.Value + ModConfig.PredatorMissile.SteerSpeed.Value * 1.5f; _activeRocketRigidbody.linearVelocity = Vector3.ClampMagnitude(velocity, num); } } public void ServerDetonateMissile() { if (!((Object)(object)_activeRocket == (Object)null)) { PredatorMissileItem.ServerExplode(_activeRocket); _activeRocket = null; } } public void ClientBeginSteering(uint rocketNetId) { if (!NetworkClient.spawned.TryGetValue(rocketNetId, out var value) || (Object)(object)value == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[Missile] ClientBeginSteering: rocket not found in spawned."); return; } _activeRocket = ((Component)value).GetComponent(); ((MonoBehaviour)this).StartCoroutine(LocalSteeringCoroutine()); } public void ClientEndSteering() { _isSteering = false; _activeRocket = null; } public void ServerSetActiveRocket(Rocket rocket) { _activeRocket = rocket; _activeRocketRigidbody = ((rocket != null) ? ((Component)rocket).GetComponent() : null); } public void ServerClearSteering() { _activeRocket = null; _serverMissileActive = false; } private IEnumerator LocalSteeringCoroutine() { if ((Object)(object)_activeRocket == (Object)null) { yield break; } _isSteering = true; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Disable(); OrbitCameraModule orbitModule = null; CameraModuleController.TryGetOrbitModule(ref orbitModule); OrbitCameraModule obj = orbitModule; float savedPitch = ((obj != null) ? obj.Pitch : 0f); OrbitCameraModule obj2 = orbitModule; float savedYaw = ((obj2 != null) ? obj2.Yaw : 0f); if ((Object)(object)orbitModule != (Object)null) { orbitModule.SetSubject(((Component)_activeRocket).transform); orbitModule.SetPitch(80f); orbitModule.ForceUpdateModule(); } float fallSpeed = ModConfig.PredatorMissile.FallSpeed.Value; float steerSpeed = ModConfig.PredatorMissile.SteerSpeed.Value; float sendTimer = 0f; Vector3 lastSentVelocity = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); while (_isSteering && (Object)(object)_activeRocket != (Object)null && (Object)(object)((Component)_activeRocket).gameObject != (Object)null) { Keyboard keyboard = Keyboard.current; Mouse mouse = Mouse.current; if (mouse != null && mouse.rightButton.wasPressedThisFrame) { NetworkClient.Send(default(MissileDetonateMessage), 0); break; } float inputX = 0f; float inputZ = 0f; if (keyboard != null) { if (((ButtonControl)keyboard[(Key)37]).isPressed || ((ButtonControl)keyboard[(Key)63]).isPressed) { inputZ += 1f; } if (((ButtonControl)keyboard[(Key)33]).isPressed || ((ButtonControl)keyboard[(Key)64]).isPressed) { inputZ -= 1f; } if (((ButtonControl)keyboard[(Key)15]).isPressed || ((ButtonControl)keyboard[(Key)61]).isPressed) { inputX -= 1f; } if (((ButtonControl)keyboard[(Key)18]).isPressed || ((ButtonControl)keyboard[(Key)62]).isPressed) { inputX += 1f; } } Vector3 camForward = Vector3.forward; Vector3 camRight = Vector3.right; if ((Object)(object)orbitModule != (Object)null) { float yawRad = orbitModule.Yaw * (MathF.PI / 180f); camForward = new Vector3(Mathf.Sin(yawRad), 0f, Mathf.Cos(yawRad)); camRight = new Vector3(Mathf.Cos(yawRad), 0f, 0f - Mathf.Sin(yawRad)); } Vector3 steer = (camRight * inputX + camForward * inputZ) * steerSpeed; Vector3 desiredVelocity = new Vector3(steer.x, 0f - fallSpeed, steer.z); sendTimer -= Time.deltaTime; if (sendTimer <= 0f) { Vector3 val = desiredVelocity - lastSentVelocity; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { NetworkClient.Send(new MissileSetVelocityMessage { Velocity = desiredVelocity }, 0); lastSentVelocity = desiredVelocity; } sendTimer = 0.05f; } yield return null; } if ((Object)(object)orbitModule != (Object)null) { PlayerMovement playerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)playerMovement != (Object)null) { orbitModule.SetSubject(((Component)playerMovement).transform); } orbitModule.SetPitch(savedPitch); orbitModule.SetYaw(savedYaw); orbitModule.ForceUpdateModule(); } gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); _isSteering = false; _activeRocket = null; IssaPluginPlugin.Log.LogInfo((object)"[Missile] Client steering ended."); } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public static class PredatorMissileItem { private static int _missileUseIndex; internal static readonly HashSet ActiveMissileRockets = new HashSet(); public static IEnumerator ServerMissileRoutine(PlayerInventory inventory, MissileNetworkBridge bridge) { PlayerInfo playerInfo = inventory.PlayerInfo; Transform playerTransform = ((Component)playerInfo).transform; ItemHelper.ConsumeEquippedItem(inventory); float altitude = ModConfig.PredatorMissile.Altitude.Value; Vector3 spawnPos = playerTransform.position + Vector3.up * altitude; Quaternion spawnRot = Quaternion.LookRotation(Vector3.down, Vector3.forward); _missileUseIndex++; ItemUseId itemUseId = new ItemUseId(playerInfo.PlayerId.Guid, _missileUseIndex, (ItemType)7, false); Rocket rocket = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, spawnPos, spawnRot); if ((Object)(object)rocket == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Missile] Rocket did not instantiate."); yield break; } ((Component)rocket).gameObject.AddComponent(); rocket.ServerInitialize(playerInfo, (Hittable)null, itemUseId); NetworkServer.Spawn(((Component)rocket).gameObject, (NetworkConnectionToClient)null); ActiveMissileRockets.Add(rocket); bridge.ServerSetActiveRocket(rocket); ExplosionScaler.Register(rocket, ModConfig.PredatorMissile.ExplosionScale.Value); IssaPluginPlugin.Log.LogInfo((object)$"[Missile] Launched at {spawnPos}."); yield return null; NetworkIdentity rocketIdentity = ((Component)rocket).GetComponent(); ((NetworkConnection)((NetworkBehaviour)bridge).connectionToClient).Send(new MissileBeginSteeringMessage { RocketNetId = rocketIdentity.netId }, 0); float elapsed = 0f; float timeout = ModConfig.PredatorMissile.Timeout.Value; while ((Object)(object)rocket != (Object)null && (Object)(object)((Component)rocket).gameObject != (Object)null && elapsed < timeout) { elapsed += Time.deltaTime; yield return null; } if ((Object)(object)rocket != (Object)null && (Object)(object)((Component)rocket).gameObject != (Object)null) { ServerExplode(rocket); } ActiveMissileRockets.Remove(rocket); ((NetworkConnection)((NetworkBehaviour)bridge).connectionToClient).Send(default(MissileEndSteeringMessage), 0); bridge.ServerClearSteering(); IssaPluginPlugin.Log.LogInfo((object)"[Missile] Server routine complete."); } public static void ServerExplode(Rocket rocket) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rocket == (Object)null)) { MethodInfo method = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(rocket, new object[1] { ((Component)rocket).transform.position }); } else { IssaPluginPlugin.Log.LogError((object)"[Missile] Could not find ServerExplode method."); } } } } public class PredatorMissileItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.PredatorMissileItemType; public override string DisplayName => "Predator Missile"; public override string[] ConsoleAliases => new string[2] { "predatormissile", "missile" }; public override Sprite Icon => AssetLoader.MissileIcon; public override GameObject HeldModelPrefab => AssetLoader.MissileTabletPrefab; public override int MaxUses => (int)ModConfig.PredatorMissile.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.PredatorMissile.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { MissileNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(MissileRequestMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[Missile] No MissileNetworkBridge on player."); } } } public static class RedBullBehaviour { public static bool IsActive { get; private set; } public static void Activate(float duration) { IsActive = true; ((MonoBehaviour)IssaPluginPlugin.Instance).StartCoroutine(DeactivateAfter(duration)); } private static IEnumerator DeactivateAfter(float duration) { yield return (object)new WaitForSeconds(duration); IsActive = false; } } public class RedBullItemDefinition : CustomItemDefinition { private static readonly MethodInfo _addSpeedBoostMethod; public override ItemType ItemType => ItemRegistry.RedBullItemType; public override string DisplayName => "Red Bull"; public override string[] ConsoleAliases => new string[2] { "redbull", "bull" }; public override Sprite Icon => AssetLoader.RedBullIcon; public override bool UseRocketIconFallback => false; public override GameObject HeldModelPrefab => AssetLoader.RedBullHandheldPrefab; public override int MaxUses => (int)ModConfig.RedBull.Uses.Value; public override float DefaultPoolWeight => 15f; public override Key GiveKey => ModConfig.RedBull.GiveKey.Value; static RedBullItemDefinition() { Type type = AccessTools.TypeByName("PlayerMovement"); if (type != null) { _addSpeedBoostMethod = AccessTools.Method(type, "AddSpeedBoost", (Type[])null, (Type[])null); } } public override void OnUse(PlayerInventory inventory) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if (!((Object)(object)localPlayerMovement == (Object)null)) { float value = ModConfig.RedBull.Duration.Value; _addSpeedBoostMethod?.Invoke(localPlayerMovement, new object[1] { value }); RedBullBehaviour.Activate(value); ItemHelper.ConsumeEquippedItem(inventory); ((Component)inventory).GetComponent()?.ClientRequestTrail(); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct RedBullActivateMessage : NetworkMessage { } public struct RedBullTrailBeginMessage : NetworkMessage { public uint PlayerNetId; public float Duration; } public struct RedBullTrailEndMessage : NetworkMessage { public uint PlayerNetId; } public struct CoffeeDispenserRedBullMessage : NetworkMessage { public uint NetId; } public static class RedBullMessageSerialization { public static void WriteActivate(NetworkWriter w, RedBullActivateMessage msg) { } public static RedBullActivateMessage ReadActivate(NetworkReader r) { return default(RedBullActivateMessage); } public static void WriteTrailBegin(NetworkWriter w, RedBullTrailBeginMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); NetworkWriterExtensions.WriteFloat(w, msg.Duration); } public static RedBullTrailBeginMessage ReadTrailBegin(NetworkReader r) { return new RedBullTrailBeginMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r), Duration = NetworkReaderExtensions.ReadFloat(r) }; } public static void WriteTrailEnd(NetworkWriter w, RedBullTrailEndMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); } public static RedBullTrailEndMessage ReadTrailEnd(NetworkReader r) { return new RedBullTrailEndMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r) }; } public static void WriteCoffeeDispenserRedBull(NetworkWriter w, CoffeeDispenserRedBullMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.NetId); } public static CoffeeDispenserRedBullMessage ReadCoffeeDispenserRedBull(NetworkReader r) { return new CoffeeDispenserRedBullMessage { NetId = NetworkReaderExtensions.ReadUInt(r) }; } } public class RedBullNetworkBridge : NetworkBridgeBase { private bool _serverSessionActive; private Coroutine _serverTimeout; private GameObject _trail; private Coroutine _clientHideCoroutine; public void ClientRequestTrail() { NetworkClient.Send(default(RedBullActivateMessage), 0); } public void ServerActivate() { if (!((NetworkBehaviour)this).isServer) { return; } if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); } NetworkServer.SendToAll(new RedBullTrailEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); } float value = ModConfig.RedBull.Duration.Value; _serverSessionActive = true; NetworkServer.SendToAll(new RedBullTrailBeginMessage { PlayerNetId = ((NetworkBehaviour)this).netId, Duration = value }, 0, false); _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerEndAfter(value)); } private IEnumerator ServerEndAfter(float duration) { yield return (object)new WaitForSeconds(duration); NetworkServer.SendToAll(new RedBullTrailEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); _serverSessionActive = false; _serverTimeout = null; } public static void HandleTrailBegin(RedBullTrailBeginMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { ((Component)value).GetComponent()?.ClientShowTrail(msg.Duration); } } public static void HandleTrailEnd(RedBullTrailEndMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { ((Component)value).GetComponent()?.ClientHideTrail(); } } private void ClientShowTrail(float duration) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ClientHideTrail(); if (!((Object)(object)AssetLoader.RedBullTrailPrefab == (Object)null)) { _trail = Object.Instantiate(AssetLoader.RedBullTrailPrefab); _trail.transform.SetParent(((Component)this).transform, false); _trail.transform.localPosition = Vector3.zero; _trail.transform.localRotation = Quaternion.identity; _trail.SetActive(true); _clientHideCoroutine = ((MonoBehaviour)this).StartCoroutine(HideAfter(duration)); } } private void ClientHideTrail() { if (_clientHideCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_clientHideCoroutine); _clientHideCoroutine = null; } if ((Object)(object)_trail != (Object)null) { Object.Destroy((Object)(object)_trail); _trail = null; } } private IEnumerator HideAfter(float duration) { yield return (object)new WaitForSeconds(duration); ClientHideTrail(); } public override void ServerHoleCleanup() { if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } NetworkServer.SendToAll(new RedBullTrailEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); _serverSessionActive = false; } } public override void ClientHoleCleanup() { ClientHideTrail(); } public override void OnStopServer() { if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); } _serverTimeout = null; _serverSessionActive = false; } } } public class RocketHomingBehaviour : MonoBehaviour { public Transform Target; public float ProximityFuse = -1f; private Rigidbody _rb; private void Start() { _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[RocketHomingBehaviour] No Rigidbody on rocket."); } if (ProximityFuse < 0f) { ProximityFuse = ModConfig.AC130.RocketProximityFuse.Value; } } private void FixedUpdate() { //IL_0040: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00ef: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)_rb == (Object)null || (Object)(object)Target == (Object)null) { return; } Vector3 val = Target.position - _rb.worldCenterOfMass; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= ProximityFuse) { Rocket component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { PredatorMissileItem.ServerExplode(component); } } else if (!(magnitude < 0.01f)) { float num = GameManager.ItemSettings.RocketMaxVelocityRotationPerSecond * Time.fixedDeltaTime * (MathF.PI / 180f); Rigidbody rb = _rb; Vector3 linearVelocity = _rb.linearVelocity; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 linearVelocity2 = _rb.linearVelocity; rb.linearVelocity = Vector3.RotateTowards(linearVelocity, normalized * ((Vector3)(ref linearVelocity2)).magnitude, num, 0f); } } } public class RocketTetherGrenadeBehaviour : MonoBehaviour { public uint ThrowerNetId; private Rigidbody _rb; private bool _landed; private float _graceTimer = 0.25f; private void Start() { _rb = ((Component)this).GetComponent(); } private void FixedUpdate() { if (_graceTimer > 0f) { _graceTimer -= Time.fixedDeltaTime; } } private void OnCollisionEnter(Collision collision) { if (!_landed && !(_graceTimer > 0f)) { Land(); } } private void Land() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) if (NetworkServer.active) { NetworkServer.SendToAll(new RocketTetherGrenadeLandedMessage { Position = ((Component)this).transform.position, ThrowerNetId = ThrowerNetId }, 0, false); _landed = true; if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = true; _rb.linearVelocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; } ServerApplyTethers(((Component)this).transform.position); NetworkServer.Destroy(((Component)this).gameObject); } } private void ServerApplyTethers(Vector3 landPos) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0163: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.spawned.TryGetValue(ThrowerNetId, out var value)) { IssaPluginPlugin.Log.LogWarning((object)$"[RocketTetherGrenade] Thrower netId={ThrowerNetId} not found — grenade fizzles."); return; } RocketTetherGrenadeNetworkBridge component = ((Component)value).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[RocketTetherGrenade] Thrower has no RocketTetherGrenadeNetworkBridge."); return; } float value2 = ModConfig.RocketTetherGrenade.BlastRadius.Value; int num = (int)ModConfig.RocketTetherGrenade.MaxVictims.Value; List list = new List(num); Collider[] array = Physics.OverlapSphere(landPos, value2); foreach (Collider val in array) { if (list.Count >= num) { break; } PlayerInfo componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { continue; } NetworkIdentity component2 = ((Component)componentInParent).GetComponent(); if (!((Object)(object)component2 == (Object)null) && (component2.netId != ThrowerNetId || !ModConfig.RocketTetherGrenade.ExcludeThrower.Value) && !list.Contains(componentInParent)) { if (componentInParent.IsElectromagnetShieldActive) { Vector3 val2 = ((Component)componentInParent).transform.position - landPos; Vector3 normalized = ((Vector3)(ref val2)).normalized; componentInParent.PlayElectromagnetShieldHitForAllClients(normalized, false); } else { list.Add(componentInParent); } } } if (list.Count == 0) { IssaPluginPlugin.Log.LogInfo((object)"[RocketTetherGrenade] Landed — no valid victims in radius."); return; } IssaPluginPlugin.Log.LogInfo((object)$"[RocketTetherGrenade] Landed — tethering {list.Count} victim(s)."); component.ServerBeginVictimTethers(list); } } public class RocketTetherGrenadeItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.RocketTetherGrenadeItemType; public override string DisplayName => "Rocket Tether Grenade"; public override string[] ConsoleAliases => new string[2] { "rocket_tether_grenade", "rtgrenade" }; public override Sprite Icon => AssetLoader.RocketTetherGrenadeIcon; public override GameObject HeldModelPrefab => AssetLoader.RocketTetherGrenadePrefab; public override int MaxUses => (int)ModConfig.RocketTetherGrenade.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.RocketTetherGrenade.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 1f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnEquip(PlayerInventory inventory) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) StickyGrenadeTrajectoryPreview component = ((Component)inventory).GetComponent(); if ((Object)(object)component == (Object)null) { component = ((Component)inventory).gameObject.AddComponent(); component.TargetItemType = ItemRegistry.RocketTetherGrenadeItemType; component.ThrowSpeed = () => ModConfig.RocketTetherGrenade.ThrowSpeed.Value; component.LobAngle = () => ModConfig.RocketTetherGrenade.LobAngle.Value; component.RingRadius = () => ModConfig.RocketTetherGrenade.BlastRadius.Value; } } public override void OnUse(PlayerInventory inventory) { ((Component)inventory).GetComponent()?.ClientThrow(); } } public struct RocketTetherGrenadeThrowMessage : NetworkMessage { public Vector3 ThrowOrigin; public Vector3 ThrowVelocity; } public struct RocketTetherGrenadeLandedMessage : NetworkMessage { public Vector3 Position; public uint ThrowerNetId; } public static class RocketTetherGrenadeMessageSerialization { public static void WriteRocketTetherGrenadeLandedMessage(NetworkWriter writer, RocketTetherGrenadeLandedMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Position); NetworkWriterExtensions.WriteUInt(writer, msg.ThrowerNetId); } public static RocketTetherGrenadeLandedMessage ReadRocketTetherGrenadeLandedMessage(NetworkReader reader) { //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) return new RocketTetherGrenadeLandedMessage { Position = NetworkReaderExtensions.ReadVector3(reader), ThrowerNetId = NetworkReaderExtensions.ReadUInt(reader) }; } public static void WriteRocketTetherGrenadeThrowMessage(NetworkWriter writer, RocketTetherGrenadeThrowMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.ThrowOrigin); NetworkWriterExtensions.WriteVector3(writer, msg.ThrowVelocity); } public static RocketTetherGrenadeThrowMessage ReadRocketTetherGrenadeThrowMessage(NetworkReader reader) { //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_0018: 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) return new RocketTetherGrenadeThrowMessage { ThrowOrigin = NetworkReaderExtensions.ReadVector3(reader), ThrowVelocity = NetworkReaderExtensions.ReadVector3(reader) }; } } public class RocketTetherGrenadeNetworkBridge : NetworkBridgeBase { private struct ServerVictimSession { public Coroutine Coroutine; public Vector3 RocketStartPos; public float RocketSpeed; public float StartTime; } private readonly Dictionary _serverVictimSessions = new Dictionary(); public void ClientThrow() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00ce: 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) if (((NetworkBehaviour)this).isOwned) { Camera main = Camera.main; if ((Object)(object)main == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[RTGrenade] No main camera for throw direction."); return; } Vector3 forward = ((Component)main).transform.forward; Vector3 val = ((Component)main).transform.position + forward * 1.2f + Vector3.up * 0.3f; Vector3 val2 = forward + Vector3.up * ModConfig.RocketTetherGrenade.LobAngle.Value; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 throwVelocity = normalized * ModConfig.RocketTetherGrenade.ThrowSpeed.Value; NetworkClient.Send(new RocketTetherGrenadeThrowMessage { ThrowOrigin = val, ThrowVelocity = throwVelocity }, 0); IssaPluginPlugin.Log.LogInfo((object)$"[RTGrenade] Client throw: origin={val} speed={((Vector3)(ref throwVelocity)).magnitude:F1}"); } } public static void ClientHandleLand(Vector3 position, uint throwerNetId) { //IL_0014: 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) GameObject rocketTetherGrenadeExplosionVfx = AssetLoader.RocketTetherGrenadeExplosionVfx; if ((Object)(object)rocketTetherGrenadeExplosionVfx != (Object)null) { GameObject val = Object.Instantiate(rocketTetherGrenadeExplosionVfx, position, Quaternion.identity); Object.Destroy((Object)(object)val, 5f); } } public void ServerHandleThrow(Vector3 throwOrigin, Vector3 throwVelocity) { //IL_0041: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_014d: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[RTGrenade] No PlayerInventory on bridge object."); return; } if (component.GetEffectivelyEquippedItem(true) != ItemRegistry.RocketTetherGrenadeItemType) { IssaPluginPlugin.Log.LogWarning((object)"[RTGrenade] Player does not have RTGrenade equipped."); return; } if ((Object)(object)AssetLoader.RocketTetherGrenadePrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[RTGrenade] Grenade prefab not loaded."); return; } ItemHelper.ConsumeEquippedItem(component); Vector3 linearVelocity = Vector3.ClampMagnitude(throwVelocity, ModConfig.RocketTetherGrenade.ThrowSpeed.Value * 1.5f); GameObject val = Object.Instantiate(AssetLoader.RocketTetherGrenadePrefab, throwOrigin, (((Vector3)(ref linearVelocity)).sqrMagnitude > 0.001f) ? Quaternion.LookRotation(((Vector3)(ref linearVelocity)).normalized, Vector3.up) : Quaternion.identity); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[RTGrenade] Grenade prefab failed to instantiate."); return; } Rigidbody component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.useGravity = true; component2.isKinematic = false; component2.linearVelocity = linearVelocity; Vector3 val2 = Vector3.Cross(((Vector3)(ref linearVelocity)).normalized, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.right; } component2.angularVelocity = val3 * 8f; } NetworkServer.Spawn(val, (NetworkConnectionToClient)null); RocketTetherGrenadeBehaviour rocketTetherGrenadeBehaviour = val.AddComponent(); rocketTetherGrenadeBehaviour.ThrowerNetId = ((NetworkBehaviour)this).netId; IssaPluginPlugin.Log.LogInfo((object)$"[RTGrenade] Grenade spawned from {throwOrigin} speed={((Vector3)(ref linearVelocity)).magnitude:F1} m/s"); } public void ServerBeginVictimTethers(List victims) { //IL_00b9: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } float value = ModConfig.RocketTetherGrenade.RocketSpeed.Value; float value2 = ModConfig.RocketTetherGrenade.TetherDuration.Value; foreach (PlayerInfo victim in victims) { NetworkIdentity component = ((Component)victim).GetComponent(); if ((Object)(object)component == (Object)null) { continue; } uint netId = component.netId; if (_serverVictimSessions.TryGetValue(netId, out var value3)) { if (value3.Coroutine != null) { ((MonoBehaviour)this).StopCoroutine(value3.Coroutine); } _serverVictimSessions.Remove(netId); } Vector3 rocketStartPos = ((Component)victim).transform.position + Vector3.up * 1.5f; NetworkServer.SendToAll(new RocketVictimConnectedMessage { WielderNetId = ((NetworkBehaviour)this).netId, VictimNetId = netId, RocketStartPos = rocketStartPos, RocketSpeed = value, Duration = value2, SpringForce = ModConfig.RocketTetherGrenade.SpringForce.Value, MaxPullSpeed = ModConfig.RocketTetherGrenade.MaxPullSpeed.Value, NaturalLength = ModConfig.RocketTetherGrenade.NaturalLength.Value }, 0, false); ServerVictimSession serverVictimSession = new ServerVictimSession { RocketStartPos = rocketStartPos, RocketSpeed = value, StartTime = Time.time }; serverVictimSession.Coroutine = ((MonoBehaviour)this).StartCoroutine(ServerVictimTetherCoroutine(netId, serverVictimSession, value2)); _serverVictimSessions[netId] = serverVictimSession; IssaPluginPlugin.Log.LogInfo((object)$"[RTGrenade] Tethered victim netId={netId}."); } } private IEnumerator ServerVictimTetherCoroutine(uint victimNetId, ServerVictimSession session, float duration) { yield return (object)new WaitForSeconds(duration); if (!_serverVictimSessions.ContainsKey(victimNetId)) { yield break; } float explosionForce = ModConfig.RocketTetherGrenade.ExplosionForce.Value; float explosionRadius = ModConfig.RocketTetherGrenade.ExplosionRadius.Value; Vector3 explosionPos = session.RocketStartPos + Vector3.up * session.RocketSpeed * duration; Collider[] array = Physics.OverlapSphere(explosionPos, explosionRadius); foreach (Collider col in array) { Rigidbody rb = col.attachedRigidbody; if (!((Object)(object)rb == (Object)null) && !rb.isKinematic && !((Object)(object)((Component)col).GetComponentInParent() != (Object)null)) { rb.AddExplosionForce(explosionForce, explosionPos, explosionRadius, 0.5f, (ForceMode)2); } } NetworkServer.SendToAll(new RocketVictimDisconnectedMessage { VictimNetId = victimNetId, ExplosionPosition = explosionPos, ExplosionForce = explosionForce, ExplosionRadius = explosionRadius }, 0, false); _serverVictimSessions.Remove(victimNetId); IssaPluginPlugin.Log.LogInfo((object)$"[RTGrenade] Victim {victimNetId} rocket exploded at {explosionPos}."); } public override void ServerHoleCleanup() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer || _serverVictimSessions.Count == 0) { return; } KeyValuePair[] array = new KeyValuePair[_serverVictimSessions.Count]; int num = 0; foreach (KeyValuePair serverVictimSession in _serverVictimSessions) { array[num++] = serverVictimSession; } float value = ModConfig.RocketTetherGrenade.ExplosionForce.Value; float value2 = ModConfig.RocketTetherGrenade.ExplosionRadius.Value; KeyValuePair[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair keyValuePair = array2[i]; uint key = keyValuePair.Key; ServerVictimSession value3 = keyValuePair.Value; if (value3.Coroutine != null) { ((MonoBehaviour)this).StopCoroutine(value3.Coroutine); } float num2 = Time.time - value3.StartTime; Vector3 explosionPosition = value3.RocketStartPos + Vector3.up * value3.RocketSpeed * num2; NetworkServer.SendToAll(new RocketVictimDisconnectedMessage { VictimNetId = key, ExplosionPosition = explosionPosition, ExplosionForce = value, ExplosionRadius = value2 }, 0, false); } _serverVictimSessions.Clear(); } public override void ClientHoleCleanup() { } } internal struct TetherSpringParams { public float SpringForce; public float MaxPullSpeed; public float NaturalLength; } internal sealed class TetherSessionState { public uint WielderNetId; public Vector3 RocketStartPos; public float RocketSpeed; public float StartTime; public float Duration; public TetherSpringParams SpringParams; public LineRenderer TetherLine; public GameObject RocketVfxInstance; public Coroutine ForceCoroutine; public PlayerMovement ForceMovement; } public static class RocketTetherClientLogic { private static readonly Dictionary s_activeSessions = new Dictionary(); public static void HandleVictimConnected(RocketVictimConnectedMessage msg) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) BeginVictimSession(msg.VictimNetId, msg.WielderNetId, msg.RocketStartPos, msg.RocketSpeed, msg.Duration, new TetherSpringParams { SpringForce = msg.SpringForce, MaxPullSpeed = msg.MaxPullSpeed, NaturalLength = msg.NaturalLength }); } public static void HandleVictimDisconnected(RocketVictimDisconnectedMessage msg) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) EndVictimSession(msg.VictimNetId, msg.ExplosionPosition, msg.ExplosionForce, msg.ExplosionRadius); } internal static bool TryGetSessionForVictim(uint victimNetId, out TetherSessionState state) { return s_activeSessions.TryGetValue(victimNetId, out state); } public static void UpdateAll() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (s_activeSessions.Count == 0) { return; } KeyValuePair[] array = s_activeSessions.ToArray(); KeyValuePair[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair keyValuePair = array2[i]; TetherSessionState value = keyValuePair.Value; float num = Time.time - value.StartTime; Vector3 val = value.RocketStartPos + Vector3.up * value.RocketSpeed * num; if ((Object)(object)value.RocketVfxInstance != (Object)null) { value.RocketVfxInstance.transform.SetPositionAndRotation(val, Quaternion.identity); } UpdateTetherLine(keyValuePair.Key, value, val); } } public static void ClearAll() { KeyValuePair[] array = s_activeSessions.ToArray(); foreach (KeyValuePair keyValuePair in array) { EndVictimSessionInternal(keyValuePair.Key); } } private static void BeginVictimSession(uint victimNetId, uint wielderNetId, Vector3 rocketStartPos, float rocketSpeed, float duration, TetherSpringParams spring) { //IL_002b: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null) { return; } EndVictimSessionInternal(victimNetId); TetherSessionState tetherSessionState = new TetherSessionState { WielderNetId = wielderNetId, RocketStartPos = rocketStartPos, RocketSpeed = rocketSpeed, StartTime = Time.time, Duration = duration, SpringParams = spring }; if ((Object)(object)AssetLoader.RocketTetherRocketPrefab != (Object)null) { tetherSessionState.RocketVfxInstance = Object.Instantiate(AssetLoader.RocketTetherRocketPrefab, rocketStartPos, Quaternion.identity); Rigidbody[] componentsInChildren = tetherSessionState.RocketVfxInstance.GetComponentsInChildren(); foreach (Rigidbody val in componentsInChildren) { val.isKinematic = true; val.useGravity = false; } Object.DontDestroyOnLoad((Object)(object)tetherSessionState.RocketVfxInstance); } tetherSessionState.TetherLine = CreateTetherLine(); s_activeSessions[victimNetId] = tetherSessionState; NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == victimNetId) { PlayerMovement movement = localPlayerInfo.Movement; if ((Object)(object)movement != (Object)null) { tetherSessionState.ForceMovement = movement; tetherSessionState.ForceCoroutine = ((MonoBehaviour)movement).StartCoroutine(ForceCoroutine(victimNetId, duration)); IssaPluginPlugin.Log.LogInfo((object)$"[RocketTetherClientLogic] Tether started — local player is victim (netId={victimNetId})."); } } } private static void EndVictimSession(uint victimNetId, Vector3 explosionPos, float explosionForce, float explosionRadius) { //IL_0197: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00d3: 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_0150: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { s_activeSessions.TryGetValue(victimNetId, out var value); NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (value != null && num == victimNetId) { Transform transformByNetId = GetTransformByNetId(value.WielderNetId); PlayerInfo val = ((transformByNetId != null) ? ((Component)transformByNetId).GetComponentInParent() : null); if ((Object)(object)val != (Object)null) { ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(val.PlayerId.Guid, RocketTetherItem.NextUseIndex(), (ItemType)7, false); bool flag = default(bool); localPlayerInfo.Movement.TryKnockOut(val, (KnockoutType)7, false, ((Component)localPlayerInfo.Movement).transform.InverseTransformPoint(((Component)val).transform.position), Vector3.Distance(((Component)localPlayerInfo).transform.position, ((Component)val).transform.position), Vector3.zero, (ElectromagnetShieldHitBlockType)0, val2, false, true, ref flag, ref flag); } } GolfCartSeat activeGolfCartSeat = localPlayerInfo.ActiveGolfCartSeat; Rigidbody val3 = ((((GolfCartSeat)(ref activeGolfCartSeat)).IsValid() && (Object)(object)activeGolfCartSeat.golfCart != (Object)null) ? activeGolfCartSeat.golfCart.AsEntity.Rigidbody : ((Component)localPlayerInfo).GetComponentInParent()); if ((Object)(object)val3 != (Object)null) { float num2 = Vector3.Distance(val3.position, explosionPos); if (num2 < explosionRadius) { val3.AddExplosionForce(explosionForce, explosionPos, explosionRadius, 0.5f, (ForceMode)2); } } } if ((Object)(object)AssetLoader.JavelinExplosionVfxPrefab != (Object)null) { GameObject val4 = Object.Instantiate(AssetLoader.JavelinExplosionVfxPrefab, explosionPos, Quaternion.identity); Object.Destroy((Object)(object)val4, 3f); } else { VfxManager.PlayPooledVfxLocalOnly((VfxType)37, explosionPos, Quaternion.identity, Vector3.one, 0u, false, 0f, (Action)null); } CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, explosionPos, 1f, 1f); IssaPluginPlugin.Log.LogInfo((object)$"[RocketTetherClientLogic] Rocket exploded at {explosionPos} (victim={victimNetId})."); EndVictimSessionInternal(victimNetId); } private static void EndVictimSessionInternal(uint victimNetId) { if (s_activeSessions.TryGetValue(victimNetId, out var value)) { s_activeSessions.Remove(victimNetId); if (value.ForceCoroutine != null && (Object)(object)value.ForceMovement != (Object)null) { ((MonoBehaviour)value.ForceMovement).StopCoroutine(value.ForceCoroutine); } if ((Object)(object)value.TetherLine != (Object)null) { Object.Destroy((Object)(object)((Component)value.TetherLine).gameObject); } if ((Object)(object)value.RocketVfxInstance != (Object)null) { Object.Destroy((Object)(object)value.RocketVfxInstance); } } } private static IEnumerator ForceCoroutine(uint victimNetId, float maxDuration) { float elapsed = 0f; while (elapsed < maxDuration && s_activeSessions.ContainsKey(victimNetId)) { PlayerInfo localInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localInfo == (Object)null || !s_activeSessions.TryGetValue(victimNetId, out var state)) { break; } GolfCartSeat seat = localInfo.ActiveGolfCartSeat; Rigidbody rb = ((((GolfCartSeat)(ref seat)).IsValid() && (Object)(object)seat.golfCart != (Object)null) ? seat.golfCart.AsEntity.Rigidbody : ((Component)localInfo).GetComponentInParent()); if ((Object)(object)rb != (Object)null) { Vector3 rocketPos = state.RocketStartPos + Vector3.up * state.RocketSpeed * elapsed; Vector3 toRocket = rocketPos - rb.position; float dist = ((Vector3)(ref toRocket)).magnitude; if (dist > state.SpringParams.NaturalLength && dist > 0.05f) { Vector3 dir = toRocket / dist; float stretch = dist - state.SpringParams.NaturalLength; float targetSpeed = stretch * state.SpringParams.SpringForce; float currentComp = Vector3.Dot(rb.linearVelocity, dir); float deficit = Mathf.Min(targetSpeed - currentComp, state.SpringParams.MaxPullSpeed); if (deficit > 0f) { rb.AddForce(dir * deficit, (ForceMode)2); } } } elapsed += Time.fixedDeltaTime; yield return (object)new WaitForFixedUpdate(); state = null; seat = default(GolfCartSeat); } } private static LineRenderer CreateTetherLine() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_005e: 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) GameObject val = new GameObject("RocketTetherLine"); LineRenderer val2 = val.AddComponent(); val2.positionCount = 2; val2.startWidth = 0.12f; val2.endWidth = 0.06f; ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); val2.startColor = new Color(1f, 0.55f, 0.1f, 0.9f); val2.endColor = new Color(1f, 0.2f, 0.1f, 0.9f); val2.useWorldSpace = true; Object.DontDestroyOnLoad((Object)(object)val); return val2; } private static void UpdateTetherLine(uint victimNetId, TetherSessionState state, Vector3 rocketPos) { //IL_002e: 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_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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)state.TetherLine == (Object)null)) { Transform transformByNetId = GetTransformByNetId(victimNetId); if ((Object)(object)transformByNetId != (Object)null) { state.TetherLine.SetPosition(0, transformByNetId.position + Vector3.up * 1f); state.TetherLine.SetPosition(1, rocketPos); } } } internal static Transform GetTransformByNetId(uint netId) { if (netId == 0) { return null; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == netId) { return ((Component)localPlayerInfo).transform; } } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (!((Object)(object)item == (Object)null)) { NetworkIdentity component2 = ((Component)item).GetComponent(); uint num2 = ((component2 != null) ? component2.netId : 0u); if (num2 == netId) { return ((Component)item).transform; } } } } if (NetworkClient.spawned.TryGetValue(netId, out var value) && (Object)(object)value != (Object)null) { return ((Component)value).transform; } return null; } } public static class RocketTetherItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class RocketTetherItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.RocketTetherItemType; public override string DisplayName => "Rocket Tether"; public override string[] ConsoleAliases => new string[2] { "player_linker", "linker" }; public override Sprite Icon => AssetLoader.RocketTetherIcon; public override GameObject HeldModelPrefab => AssetLoader.RocketTetherPrefab; public override bool UseRocketIconFallback => true; public override EquipmentType EquipmentType => (EquipmentType)5; public override ItemType AnimatorItemType => (ItemType)3; public override ItemType AnimatorChangedItemType => (ItemType)3; public override int MaxUses => (int)ModConfig.RocketTether.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.RocketTether.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { RocketTetherNetworkBridge component = ((Component)inventory).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.ClientUse(); } } } public struct RocketTetherLockOnMessage : NetworkMessage { public uint TargetNetId; } public static class RocketTetherLockOnMessageSerialization { public static void WriteRocketTetherLockOnMessage(NetworkWriter writer, RocketTetherLockOnMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); } public static RocketTetherLockOnMessage ReadRocketTetherLockOnMessage(NetworkReader reader) { return new RocketTetherLockOnMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct RocketTetherBusyMessage : NetworkMessage { } public static class RocketTetherBusyMessageSerialization { public static void WriteRocketTetherBusyMessage(NetworkWriter writer, RocketTetherBusyMessage msg) { } public static RocketTetherBusyMessage ReadRocketTetherBusyMessage(NetworkReader reader) { return default(RocketTetherBusyMessage); } } public class RocketTetherNetworkBridge : NetworkBridgeBase { private bool _serverSessionActive; private NetworkConnectionToClient _wielderConn; private PlayerInfo _targetInfo; private Coroutine _serverTimeout; private int _wielderLinkerSlot = -1; private Vector3 _serverRocketStartPos; private float _serverRocketSpeed; private float _serverSessionStartTime; private void Update() { if (((NetworkBehaviour)this).isOwned) { RocketTetherClientLogic.UpdateAll(); } } public void ClientUse() { if (((NetworkBehaviour)this).isOwned) { NetworkIdentity val = RocketTetherOverlay.Instance?.BestTargetIdentity; if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogInfo((object)"[RocketTether] ClientUse: no valid target in cone."); return; } IssaPluginPlugin.Log.LogInfo((object)$"[RocketTether] ClientUse: targeting netId={val.netId}."); NetworkClient.Send(new RocketTetherLockOnMessage { TargetNetId = val.netId }, 0); } } public void ServerHandleLockOn(NetworkConnectionToClient conn, RocketTetherLockOnMessage msg) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_019c: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } if (!GlobalSessionLock.TryAcquire(this)) { IssaPluginPlugin.Log.LogInfo((object)"[RocketTether] Server: session busy — rejecting lock-on."); ((NetworkConnection)conn).Send(default(RocketTetherBusyMessage), 0); return; } PlayerInventory component = ((Component)this).GetComponent(); int num = (((Object)(object)component != (Object)null) ? ItemRegistry.FindSlotIndex(component, ItemRegistry.RocketTetherItemType) : (-1)); if (num < 0) { IssaPluginPlugin.Log.LogWarning((object)"[RocketTether] Server: wielder does not have Rocket Tether."); GlobalSessionLock.Release(); return; } _wielderLinkerSlot = num; if (!NetworkServer.spawned.TryGetValue(msg.TargetNetId, out var value)) { IssaPluginPlugin.Log.LogWarning((object)$"[RocketTether] Server: target netId={msg.TargetNetId} not found."); GlobalSessionLock.Release(); _wielderLinkerSlot = -1; return; } PlayerInfo componentInParent = ((Component)value).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[RocketTether] Server: target is not a player."); GlobalSessionLock.Release(); _wielderLinkerSlot = -1; return; } if ((Object)(object)value == (Object)(object)((Component)this).GetComponent()) { IssaPluginPlugin.Log.LogWarning((object)"[RocketTether] Server: self-targeting rejected."); GlobalSessionLock.Release(); _wielderLinkerSlot = -1; return; } if (componentInParent.IsElectromagnetShieldActive) { IssaPluginPlugin.Log.LogInfo((object)"[RocketTether] Server: target has electromagnetic shield — rejecting."); GlobalSessionLock.Release(); _wielderLinkerSlot = -1; Vector3 val = ((Component)componentInParent).transform.position - ((Component)this).transform.position; componentInParent.PlayElectromagnetShieldHitForAllClients(((Vector3)(ref val)).normalized, false); return; } uint netId = ((Component)this).GetComponent().netId; float value2 = ModConfig.RocketTether.RocketSpeed.Value; float value3 = ModConfig.RocketTether.TetherDuration.Value; Vector3 val2 = ((Component)componentInParent).transform.position + Vector3.up * 1.5f; _serverSessionActive = true; _wielderConn = conn; _targetInfo = componentInParent; _serverRocketStartPos = val2; _serverRocketSpeed = value2; _serverSessionStartTime = Time.time; IssaPluginPlugin.Log.LogInfo((object)$"[RocketTether] Server: session started. wielder={netId} target={value.netId}"); NetworkServer.SendToAll(new RocketVictimConnectedMessage { WielderNetId = netId, VictimNetId = value.netId, RocketStartPos = val2, RocketSpeed = value2, Duration = value3, SpringForce = ModConfig.RocketTether.SpringForce.Value, MaxPullSpeed = ModConfig.RocketTether.MaxPullSpeed.Value, NaturalLength = ModConfig.RocketTether.NaturalLength.Value }, 0, false); _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerRocketCoroutine(value3)); } private IEnumerator ServerRocketCoroutine(float duration) { yield return (object)new WaitForSeconds(duration); if (!_serverSessionActive) { yield break; } IssaPluginPlugin.Log.LogInfo((object)"[RocketTether] Server: rocket exploding."); Vector3 explosionPos = _serverRocketStartPos + Vector3.up * _serverRocketSpeed * duration; float explosionForce = ModConfig.RocketTether.ExplosionForce.Value; float explosionRadius = ModConfig.RocketTether.ExplosionRadius.Value; Collider[] colliders = Physics.OverlapSphere(explosionPos, explosionRadius); Collider[] array = colliders; foreach (Collider col in array) { Rigidbody rb = col.attachedRigidbody; if (!((Object)(object)rb == (Object)null) && !rb.isKinematic && !((Object)(object)((Component)col).GetComponentInParent() != (Object)null)) { rb.AddExplosionForce(explosionForce, explosionPos, explosionRadius, 0.5f, (ForceMode)2); } } ServerEndSession(explosionPos, explosionForce, explosionRadius); } private void ServerEndSession(Vector3 explosionPos, float explosionForce, float explosionRadius) { //IL_0085: 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) if (!_serverSessionActive) { return; } _serverSessionActive = false; if (_wielderLinkerSlot >= 0) { PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ItemHelper.SetCurrentItemUse(component, (ItemUseType)1); ItemHelper.DecrementAndRemove(component, _wielderLinkerSlot); ItemHelper.SetCurrentItemUse(component, (ItemUseType)0); } } _wielderLinkerSlot = -1; NetworkServer.SendToAll(new RocketVictimDisconnectedMessage { VictimNetId = ((Component)_targetInfo).GetComponent().netId, ExplosionPosition = explosionPos, ExplosionForce = explosionForce, ExplosionRadius = explosionRadius }, 0, false); GlobalSessionLock.Release(); if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } _wielderConn = null; _targetInfo = null; } public static void HandleRocketTetherBusy(RocketTetherBusyMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[RocketTether] Session busy — another Rocket Tether is already active."); RocketTetherOverlay.Instance?.ShowBusy(); } public override void ServerHoleCleanup() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0030: 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_003c: Unknown result type (might be due to invalid IL or missing references) if (_serverSessionActive) { float num = Time.time - _serverSessionStartTime; Vector3 explosionPos = _serverRocketStartPos + Vector3.up * _serverRocketSpeed * num; ServerEndSession(explosionPos, ModConfig.RocketTether.ExplosionForce.Value, ModConfig.RocketTether.ExplosionRadius.Value); } if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } } public override void ClientHoleCleanup() { RocketTetherClientLogic.ClearAll(); } } public struct RocketVictimConnectedMessage : NetworkMessage { public uint WielderNetId; public uint VictimNetId; public Vector3 RocketStartPos; public float RocketSpeed; public float Duration; public float SpringForce; public float MaxPullSpeed; public float NaturalLength; } public static class RocketVictimConnectedMessageSerialization { public static void WriteRocketVictimConnectedMessage(NetworkWriter writer, RocketVictimConnectedMessage msg) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.WielderNetId); NetworkWriterExtensions.WriteUInt(writer, msg.VictimNetId); NetworkWriterExtensions.WriteVector3(writer, msg.RocketStartPos); NetworkWriterExtensions.WriteFloat(writer, msg.RocketSpeed); NetworkWriterExtensions.WriteFloat(writer, msg.Duration); NetworkWriterExtensions.WriteFloat(writer, msg.SpringForce); NetworkWriterExtensions.WriteFloat(writer, msg.MaxPullSpeed); NetworkWriterExtensions.WriteFloat(writer, msg.NaturalLength); } public static RocketVictimConnectedMessage ReadRocketVictimConnectedMessage(NetworkReader reader) { //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) return new RocketVictimConnectedMessage { WielderNetId = NetworkReaderExtensions.ReadUInt(reader), VictimNetId = NetworkReaderExtensions.ReadUInt(reader), RocketStartPos = NetworkReaderExtensions.ReadVector3(reader), RocketSpeed = NetworkReaderExtensions.ReadFloat(reader), Duration = NetworkReaderExtensions.ReadFloat(reader), SpringForce = NetworkReaderExtensions.ReadFloat(reader), MaxPullSpeed = NetworkReaderExtensions.ReadFloat(reader), NaturalLength = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct RocketVictimDisconnectedMessage : NetworkMessage { public uint VictimNetId; public Vector3 ExplosionPosition; public float ExplosionForce; public float ExplosionRadius; } public static class RocketVictimDisconnectedMessageSerialization { public static void WriteRocketVictimDisconnectedMessage(NetworkWriter writer, RocketVictimDisconnectedMessage msg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.VictimNetId); NetworkWriterExtensions.WriteVector3(writer, msg.ExplosionPosition); NetworkWriterExtensions.WriteFloat(writer, msg.ExplosionForce); NetworkWriterExtensions.WriteFloat(writer, msg.ExplosionRadius); } public static RocketVictimDisconnectedMessage ReadRocketVictimDisconnectedMessage(NetworkReader reader) { //IL_0018: 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) return new RocketVictimDisconnectedMessage { VictimNetId = NetworkReaderExtensions.ReadUInt(reader), ExplosionPosition = NetworkReaderExtensions.ReadVector3(reader), ExplosionForce = NetworkReaderExtensions.ReadFloat(reader), ExplosionRadius = NetworkReaderExtensions.ReadFloat(reader) }; } } public class ScreenShakeHelper { public static readonly FieldInfo ShakeDurationField = typeof(ScreenshakeSettings).GetField("k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); public static readonly FieldInfo ShakePositionCurveField = typeof(ScreenshakeSettings).GetField("k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); public static readonly FieldInfo ShakeRotationCurveField = typeof(ScreenshakeSettings).GetField("k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); public static void ApplyScreenShake(float intensity) { if (!(intensity <= 0f)) { ScreenshakeSettings val = ScriptableObject.CreateInstance(); ShakeDurationField?.SetValue(val, 0.35f); ShakePositionCurveField?.SetValue(val, AnimationCurve.EaseInOut(0f, intensity, 1f, 0f)); ShakeRotationCurveField?.SetValue(val, AnimationCurve.EaseInOut(0f, intensity * 15f, 1f, 0f)); CameraModuleController.Shake(val, 1f, 1f); } } } public static class ShapeShifterHelper { private static readonly Dictionary _cubeEndTimes = new Dictionary(); private static readonly Dictionary _cubeCoroutines = new Dictionary(); public static void ServerApplyCube(uint targetNetId, float duration, bool reroll = false) { float num = Time.time + duration; if (_cubeEndTimes.TryGetValue(targetNetId, out var value)) { if (num > value) { _cubeEndTimes[targetNetId] = num; } float duration2 = _cubeEndTimes[targetNetId] - Time.time; NetworkServer.SendToAll(new ShapeShifterBeginMessage { TargetNetId = targetNetId, Duration = duration2, Reroll = reroll }, 0, false); return; } _cubeEndTimes[targetNetId] = num; NetworkServer.SendToAll(new ShapeShifterBeginMessage { TargetNetId = targetNetId, Duration = duration, Reroll = false }, 0, false); ShapeShifterManager instance = ShapeShifterManager.Instance; if ((Object)(object)instance == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[ShapeShifter] ShapeShifterManager.Instance is null — cannot start timeout coroutine."); return; } Coroutine value2 = ((MonoBehaviour)instance).StartCoroutine(ServerCubeTimeout(targetNetId)); _cubeCoroutines[targetNetId] = value2; IssaPluginPlugin.Log.LogInfo((object)$"[ShapeShifter] Cube effect started for netId={targetNetId}, duration={duration:F1}s."); } public static void ServerCancelCube(uint targetNetId) { if (!_cubeEndTimes.ContainsKey(targetNetId)) { return; } _cubeEndTimes.Remove(targetNetId); if (_cubeCoroutines.TryGetValue(targetNetId, out var value)) { _cubeCoroutines.Remove(targetNetId); ShapeShifterManager instance = ShapeShifterManager.Instance; if (instance != null) { ((MonoBehaviour)instance).StopCoroutine(value); } } NetworkServer.SendToAll(new ShapeShifterEndMessage { TargetNetId = targetNetId }, 0, false); IssaPluginPlugin.Log.LogInfo((object)$"[ShapeShifter] Cube effect cancelled for netId={targetNetId}."); } public static void ServerCleanupAll() { if (_cubeEndTimes.Count == 0) { return; } ShapeShifterManager instance = ShapeShifterManager.Instance; List list = new List(_cubeEndTimes.Keys); foreach (uint item in list) { if (_cubeCoroutines.TryGetValue(item, out var value) && instance != null) { ((MonoBehaviour)instance).StopCoroutine(value); } NetworkServer.SendToAll(new ShapeShifterEndMessage { TargetNetId = item }, 0, false); } _cubeEndTimes.Clear(); _cubeCoroutines.Clear(); IssaPluginPlugin.Log.LogInfo((object)"[ShapeShifter] All cube effects cleaned up."); } public static void HandleShapeShifterBegin(ShapeShifterBeginMessage msg) { GolfBall val = FindBall(msg.TargetNetId); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)$"[ShapeShifter] HandleBegin: no GolfBall found for netId={msg.TargetNetId}."); return; } ShapeShifterState shapeShifterState = ((Component)val).GetComponent(); if ((Object)(object)shapeShifterState != (Object)null && msg.Reroll) { shapeShifterState.Revert(); shapeShifterState = null; } if ((Object)(object)shapeShifterState == (Object)null) { ShapeShifterState shapeShifterState2 = ((Component)val).gameObject.AddComponent(); shapeShifterState2.Apply(); IssaPluginPlugin.Log.LogInfo((object)$"[ShapeShifter] Shape applied to ball owned by netId={msg.TargetNetId} (shape={shapeShifterState2.Shape})."); } if (IsLocalPlayerTarget(msg.TargetNetId)) { ShapeShifterOverlay.Instance?.SetCubed(cubed: true, msg.Duration); } } public static void HandleShapeShifterEnd(ShapeShifterEndMessage msg) { GolfBall val = FindBall(msg.TargetNetId); ShapeShifterState shapeShifterState = ((val != null) ? ((Component)val).GetComponent() : null); shapeShifterState?.Revert(); if (IsLocalPlayerTarget(msg.TargetNetId)) { ShapeShifterOverlay.Instance?.SetCubed(cubed: false); } if ((Object)(object)shapeShifterState != (Object)null) { IssaPluginPlugin.Log.LogInfo((object)$"[ShapeShifter] Cube reverted for ball owned by netId={msg.TargetNetId}."); } } private static IEnumerator ServerCubeTimeout(uint targetNetId) { float endTime; while (_cubeEndTimes.TryGetValue(targetNetId, out endTime) && Time.time < endTime) { float remaining = endTime - Time.time; yield return (object)new WaitForSeconds(remaining); } _cubeEndTimes.Remove(targetNetId); _cubeCoroutines.Remove(targetNetId); if (NetworkServer.active) { NetworkServer.SendToAll(new ShapeShifterEndMessage { TargetNetId = targetNetId }, 0, false); } IssaPluginPlugin.Log.LogInfo((object)$"[ShapeShifter] Cube effect timed out for netId={targetNetId}."); } private static GolfBall FindBall(uint netId) { Dictionary dictionary = (NetworkServer.active ? NetworkServer.spawned : NetworkClient.spawned); if (!dictionary.TryGetValue(netId, out var value)) { return null; } PlayerInventory component = ((Component)value).GetComponent(); object result; if (component == null) { result = null; } else { PlayerInfo playerInfo = component.PlayerInfo; if (playerInfo == null) { result = null; } else { PlayerGolfer asGolfer = playerInfo.AsGolfer; result = ((asGolfer != null) ? asGolfer.OwnBall : null); } } return (GolfBall)result; } private static bool IsLocalPlayerTarget(uint targetNetId) { return (Object)(object)NetworkClient.localPlayer != (Object)null && NetworkClient.localPlayer.netId == targetNetId; } } public class ShapeShifterItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.ShapeShifterItemType; public override string DisplayName => "Shape Shifter"; public override string[] ConsoleAliases => new string[2] { "cubeball", "cube_ball" }; public override Sprite Icon => AssetLoader.ShapeShifterIcon; public override GameObject HeldModelPrefab => AssetLoader.ShapeShifterHandheldPrefab; public override int MaxUses => (int)ModConfig.ShapeShifter.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.ShapeShifter.GiveKey.Value; public override void OnUse(PlayerInventory inventory) { ShapeShifterOverlay instance = ShapeShifterOverlay.Instance; if ((Object)(object)instance == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[ShapeShifter] No ShapeShifterOverlay instance found."); } else { instance.OpenChooser(inventory.EquippedItemIndex); } } } public class ShapeShifterManager : MonoBehaviour { public static ShapeShifterManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)this); } else { Instance = this; } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } public struct ShapeShifterRequestMessage : NetworkMessage { public uint TargetNetId; public int EquippedSlotIndex; } public static class ShapeShifterRequestMessageSerialization { public static void WriteShapeShifterRequestMessage(NetworkWriter writer, ShapeShifterRequestMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteInt(writer, msg.EquippedSlotIndex); } public static ShapeShifterRequestMessage ReadShapeShifterRequestMessage(NetworkReader reader) { return new ShapeShifterRequestMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader), EquippedSlotIndex = NetworkReaderExtensions.ReadInt(reader) }; } } public struct SuperShapeShifterRequestMessage : NetworkMessage { public int EquippedSlotIndex; } public static class SuperShapeShifterRequestMessageSerialization { public static void WriteSuperShapeShifterRequestMessage(NetworkWriter writer, SuperShapeShifterRequestMessage msg) { NetworkWriterExtensions.WriteInt(writer, msg.EquippedSlotIndex); } public static SuperShapeShifterRequestMessage ReadSuperShapeShifterRequestMessage(NetworkReader reader) { return new SuperShapeShifterRequestMessage { EquippedSlotIndex = NetworkReaderExtensions.ReadInt(reader) }; } } public struct ShapeShifterBeginMessage : NetworkMessage { public uint TargetNetId; public float Duration; public bool Reroll; } public static class ShapeShifterBeginMessageSerialization { public static void WriteShapeShifterBeginMessage(NetworkWriter writer, ShapeShifterBeginMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteFloat(writer, msg.Duration); NetworkWriterExtensions.WriteBool(writer, msg.Reroll); } public static ShapeShifterBeginMessage ReadShapeShifterBeginMessage(NetworkReader reader) { return new ShapeShifterBeginMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader), Duration = NetworkReaderExtensions.ReadFloat(reader), Reroll = NetworkReaderExtensions.ReadBool(reader) }; } } public struct ShapeShifterEndMessage : NetworkMessage { public uint TargetNetId; } public static class ShapeShifterEndMessageSerialization { public static void WriteShapeShifterEndMessage(NetworkWriter writer, ShapeShifterEndMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); } public static ShapeShifterEndMessage ReadShapeShifterEndMessage(NetworkReader reader) { return new ShapeShifterEndMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public class ShapeShifterNetworkBridge : NetworkBridgeBase { private PlayerInventory _inventory; private void Awake() { _inventory = ((Component)this).GetComponent(); } public void ServerHandleRequest(uint targetNetId, int equippedSlotIndex) { //IL_0031: 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) if (!((NetworkBehaviour)this).isServer || (Object)(object)_inventory == (Object)null) { return; } if (ItemRegistry.GetItemTypeAtSlot(_inventory, equippedSlotIndex) != ItemRegistry.ShapeShifterItemType) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] ServerHandleRequest: item not at expected slot."); return; } if (targetNetId == ((NetworkBehaviour)this).netId) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] ServerHandleRequest: self-targeting rejected."); return; } if (!NetworkServer.spawned.ContainsKey(targetNetId)) { IssaPluginPlugin.Log.LogWarning((object)$"[ShapeShifter] ServerHandleRequest: target netId {targetNetId} not found."); return; } PlayerInventory component = ((Component)NetworkServer.spawned[targetNetId]).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] ServerHandleRequest: target has no PlayerInventory."); return; } PlayerInfo playerInfo = component.PlayerInfo; object obj; if (playerInfo == null) { obj = null; } else { PlayerGolfer asGolfer = playerInfo.AsGolfer; obj = ((asGolfer != null) ? asGolfer.OwnBall : null); } GolfBall val = (GolfBall)obj; if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] ServerHandleRequest: target has no GolfBall."); return; } ItemHelper.ConsumeItemAtSlot(_inventory, equippedSlotIndex); float value = ModConfig.ShapeShifter.Duration.Value; ShapeShifterHelper.ServerApplyCube(targetNetId, value); IssaPluginPlugin.Log.LogInfo((object)$"[ShapeShifter] Applied cube to target netId={targetNetId} for {value:F1}s."); } public override void ServerHoleCleanup() { ShapeShifterHelper.ServerCleanupAll(); } public override void ClientHoleCleanup() { ShapeShifterOverlay.Instance?.ForceClose(); ShapeShifterOverlay.Instance?.SetCubed(cubed: false); } } public class ShapeShifterOverlay : MonoBehaviour { private bool _cubed; private float _cubeStartTime; private float _cubeDuration; private Texture2D _barBgTexture; private Texture2D _barFillTexture; private int _cachedBarW = -1; private GUIStyle _barLabelStyle; private static readonly Color FillColor = new Color(0.85f, 0.5f, 0.15f, 0.9f); private static readonly Color BgColor = new Color(0f, 0f, 0f, 0.55f); private bool _isOpen; private int _equippedSlotIndex; private readonly List _cachedPlayers = new List(); private const float PanelWidth = 500f; private const float RowHeight = 42f; private const float HeaderH = 48f; private const float TipH = 22f; private const float Padding = 14f; private const float ButtonW = 84f; private const float ButtonH = 30f; private bool _stylesReady; private Texture2D _panelBgTex; private Texture2D _selectOnTex; private Texture2D _selectHovTex; private Texture2D _cancelBgTex; private Texture2D _cancelHovTex; private GUIStyle _panelStyle; private GUIStyle _titleStyle; private GUIStyle _tipStyle; private GUIStyle _rowStyle; private GUIStyle _subStyle; private GUIStyle _selectBtnStyle; private GUIStyle _cancelStyle; public static ShapeShifterOverlay Instance { get; private set; } private void Awake() { Instance = this; } private void Update() { if (_cubed && _cubeDuration > 0f && Time.time - _cubeStartTime >= _cubeDuration) { _cubed = false; } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } DestroyBarTextures(); Object.Destroy((Object)(object)_panelBgTex); Object.Destroy((Object)(object)_selectOnTex); Object.Destroy((Object)(object)_selectHovTex); Object.Destroy((Object)(object)_cancelBgTex); Object.Destroy((Object)(object)_cancelHovTex); } public void OpenChooser(int equippedSlotIndex) { _equippedSlotIndex = equippedSlotIndex; _isOpen = true; RefreshPlayerList(); } public void ForceClose() { _isOpen = false; } public void SetCubed(bool cubed, float duration = 0f) { _cubed = cubed; if (cubed) { _cubeDuration = duration; _cubeStartTime = Time.time; } } private void OnGUI() { if (_cubed) { DrawTimerBar(); } if (_isOpen) { EnsureStyles(); DrawChooser(); } } private void DrawTimerBar() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_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_014f: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown if (_cubeDuration <= 0f) { return; } int num = (int)EffectBarLayout.GetBarWidth(); if (num != _cachedBarW) { RebuildBarTextures(num); } if (!((Object)(object)_barBgTexture == (Object)null) && !((Object)(object)_barFillTexture == (Object)null)) { float num2 = Time.time - _cubeStartTime; float num3 = Mathf.Clamp01(1f - num2 / _cubeDuration); float num4 = Mathf.Max(0f, _cubeDuration - num2); float barWidth = EffectBarLayout.GetBarWidth(); float num5 = 28f; float barX = EffectBarLayout.GetBarX(); int num6 = 0; if (FreezeItem.IsFrozen) { num6++; } if (LowGravityItem.IsActive) { num6++; } float barY = EffectBarLayout.GetBarY(num6); GUI.DrawTexture(new Rect(barX, barY, barWidth, num5), (Texture)(object)_barBgTexture); GUI.BeginGroup(new Rect(barX, barY, barWidth * num3, num5)); GUI.DrawTexture(new Rect(0f, 0f, barWidth, num5), (Texture)(object)_barFillTexture); GUI.EndGroup(); if (_barLabelStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; _barLabelStyle = val; } GUI.Label(new Rect(barX, barY, barWidth, num5), $"Shape Shifter Time Remaining: {num4:F1}s", _barLabelStyle); } } private void RebuildBarTextures(int barW) { //IL_0013: 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) DestroyBarTextures(); int num = 28; int radius = num / 3; _barBgTexture = GenerateRoundedRectTexture(barW, num, radius, BgColor); _barFillTexture = GenerateRoundedRectTexture(barW, num, radius, FillColor); _cachedBarW = barW; } private void DestroyBarTextures() { if ((Object)(object)_barBgTexture != (Object)null) { Object.Destroy((Object)(object)_barBgTexture); _barBgTexture = null; } if ((Object)(object)_barFillTexture != (Object)null) { Object.Destroy((Object)(object)_barFillTexture); _barFillTexture = null; } _cachedBarW = -1; } private static Texture2D GenerateRoundedRectTexture(int w, int h, int radius, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[w * h]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { array[i * w + j] = (IsInsideRoundedRect(j, i, w, h, radius) ? color : Color.clear); } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)1; val.Apply(); return val; } private static bool IsInsideRoundedRect(int x, int y, int w, int h, int r) { bool flag = x < r; bool flag2 = x >= w - r; bool flag3 = y < r; bool flag4 = y >= h - r; if (!(flag || flag2) || !(flag3 || flag4)) { return true; } int num = (flag ? r : (w - 1 - r)); int num2 = (flag3 ? r : (h - 1 - r)); float num3 = x - num; float num4 = y - num2; return num3 * num3 + num4 * num4 <= (float)(r * r); } private void DrawChooser() { //IL_005e: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_01d3: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(1, _cachedPlayers.Count); float num2 = 84f + 42f * (float)num + 14f + 30f + 14f; float num3 = ((float)Screen.width - 500f) * 0.5f; float num4 = ((float)Screen.height - num2) * 0.5f; GUI.Box(new Rect(num3, num4, 500f, num2), GUIContent.none, _panelStyle); float num5 = num4 + 7f; GUI.Label(new Rect(num3, num5, 500f, 48f), "Shape Shifter — Choose Target", _titleStyle); num5 += 48f; GUI.Label(new Rect(num3, num5, 500f, 22f), "Select a player to turn their ball into a cube", _tipStyle); num5 += 36f; if (_cachedPlayers.Count == 0) { GUI.Label(new Rect(num3 + 14f, num5, 472f, 42f), "No other players in the session.", _rowStyle); num5 += 42f; } else { float num6 = 380f; foreach (PlayerInfo cachedPlayer in _cachedPlayers) { string playerName = cachedPlayer.PlayerId.PlayerName; string text = BuildInfoLabel(cachedPlayer); float num7 = num5 + 6f; GUI.Label(new Rect(num3 + 14f, num5, num6, 23.1f), playerName, _rowStyle); GUI.Label(new Rect(num3 + 14f, num5 + 21.84f, num6, 20.16f), text, _subStyle); if (GUI.Button(new Rect(num3 + 14f + num6 + 8f, num7, 84f, 30f), "CUBIFY", _selectBtnStyle)) { NetworkIdentity component = ((Component)cachedPlayer).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(new ShapeShifterRequestMessage { TargetNetId = component.netId, EquippedSlotIndex = _equippedSlotIndex }, 0); _isOpen = false; } } num5 += 42f; } } num5 += 14f; float num8 = 110f; if (GUI.Button(new Rect(num3 + (500f - num8) * 0.5f, num5, num8, 30f), "Cancel", _cancelStyle)) { _isOpen = false; } } private void RefreshPlayerList() { _cachedPlayers.Clear(); List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { _cachedPlayers.AddRange(remotePlayers); } } private static string BuildInfoLabel(PlayerInfo player) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0075: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; Vector3 val = ((localPlayerInfo != null) ? ((Component)localPlayerInfo).transform.position : Vector3.zero); float num = Vector3.Distance(val, ((Component)player).transform.position); GolfHole mainHole = GolfHoleManager.MainHole; Vector3? val2 = ((mainHole != null) ? new Vector3?(((Component)mainHole).transform.position) : ((Vector3?)null)); string arg = (val2.HasValue ? $"{Mathf.RoundToInt(Vector3.Distance(val2.Value, ((Component)player).transform.position))}m to hole" : "? to hole"); return $"{Mathf.RoundToInt(num)}m away · {arg}"; } private void EnsureStyles() { //IL_002c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0131: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //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_01cf: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0207: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown if (!_stylesReady) { _stylesReady = true; _panelBgTex = Tex(new Color(0.06f, 0.06f, 0.16f, 0.93f)); _selectOnTex = Tex(new Color(0.7f, 0.35f, 0.1f, 1f)); _selectHovTex = Tex(new Color(0.9f, 0.5f, 0.15f, 1f)); _cancelBgTex = Tex(new Color(0.4f, 0.1f, 0.1f, 1f)); _cancelHovTex = Tex(new Color(0.6f, 0.15f, 0.15f, 1f)); GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = _panelBgTex; _panelStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 21, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val2.normal.textColor = Color.white; _titleStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 15, alignment = (TextAnchor)4 }; val3.normal.textColor = new Color(0.6f, 0.6f, 0.6f); _tipStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)6 }; val4.normal.textColor = Color.white; _rowStyle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.label) { fontSize = 15, alignment = (TextAnchor)0 }; val5.normal.textColor = new Color(0.85f, 0.65f, 0.4f); _subStyle = val5; GUIStyle val6 = new GUIStyle(GUI.skin.button) { fontSize = 13, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val6.normal.background = _selectOnTex; val6.normal.textColor = Color.white; val6.hover.background = _selectHovTex; val6.hover.textColor = Color.white; _selectBtnStyle = val6; GUIStyle val7 = new GUIStyle(GUI.skin.button) { fontSize = 15, alignment = (TextAnchor)4 }; val7.normal.background = _cancelBgTex; val7.normal.textColor = Color.white; val7.hover.background = _cancelHovTex; val7.hover.textColor = Color.white; _cancelStyle = val7; } } private static Texture2D Tex(Color col) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, col); val.Apply(); return val; } } public enum BallShape { Cube, Disk, Cylinder, Cone, Pyramid, Acorn, Isosphere } public class ShapeShifterState : MonoBehaviour { private SphereCollider _sphere; private float _originalRadius; private MeshRenderer[] _originalRenderers; private GameObject _shapeChild; private int _shapeColliderId; public BallShape Shape { get; private set; } public void Apply() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_01b9: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) Shape = PickRandomShape(); _sphere = ((Component)this).GetComponent(); if ((Object)(object)_sphere == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] ShapeShifterState.Apply: no SphereCollider found on ball."); } float num = (((Object)(object)_sphere != (Object)null) ? (_sphere.radius * 2f) : 1f); Vector3 localPosition = (((Object)(object)_sphere != (Object)null) ? _sphere.center : Vector3.zero); if ((Object)(object)_sphere != (Object)null) { _originalRadius = _sphere.radius; _sphere.radius = 0.001f; } MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); int num2 = 0; for (int i = 0; i < componentsInChildren.Length; i++) { if (((Renderer)componentsInChildren[i]).enabled) { num2++; } } _originalRenderers = (MeshRenderer[])(object)new MeshRenderer[num2]; int num3 = 0; for (int j = 0; j < componentsInChildren.Length; j++) { if (((Renderer)componentsInChildren[j]).enabled) { _originalRenderers[num3++] = componentsInChildren[j]; } } for (int k = 0; k < _originalRenderers.Length; k++) { ((Renderer)_originalRenderers[k]).enabled = false; } GameObject shapePrefab = GetShapePrefab(Shape); _shapeChild = (((Object)(object)shapePrefab != (Object)null) ? Object.Instantiate(shapePrefab) : FallbackShapeObject(Shape)); _shapeChild.transform.SetParent(((Component)this).transform, false); _shapeChild.transform.localPosition = localPosition; _shapeChild.transform.localScale = Vector3.one * num; _shapeChild.transform.localRotation = Quaternion.identity; Collider componentInChildren = _shapeChild.GetComponentInChildren(); if (componentInChildren != null) { PhysicsSettings settings = PhysicsManager.Settings; componentInChildren.sharedMaterial = ((settings != null) ? settings.BallMaterial : null); ((Component)componentInChildren).gameObject.layer = (((Object)(object)_sphere != (Object)null) ? ((Component)_sphere).gameObject.layer : ((Component)this).gameObject.layer); componentInChildren.hasModifiableContacts = true; _shapeColliderId = ((Object)componentInChildren).GetInstanceID(); PhysicsManager.RegisterBallColliderId(_shapeColliderId); ManualLogSource log = IssaPluginPlugin.Log; string[] obj = new string[8] { "[ShapeShifter][DEBUG] Shape collider registered: type=", ((object)componentInChildren).GetType().Name, $" instanceId={_shapeColliderId}", $" hasModifiableContacts={componentInChildren.hasModifiableContacts}", $" layer={((Component)componentInChildren).gameObject.layer} ({LayerMask.LayerToName(((Component)componentInChildren).gameObject.layer)})", $" PhysicsManager.HasInstance={SingletonBehaviour.HasInstance}", " BallMaterial=", null }; PhysicsSettings settings2 = PhysicsManager.Settings; obj[7] = (((Object)(object)((settings2 != null) ? settings2.BallMaterial : null) != (Object)null) ? ((Object)PhysicsManager.Settings.BallMaterial).name : "NULL"); log.LogInfo((object)string.Concat(obj)); } else { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter][DEBUG] No collider found on shape child — nothing registered."); } if ((Object)(object)_sphere != (Object)null) { IssaPluginPlugin.Log.LogInfo((object)("[ShapeShifter][DEBUG] SphereCollider (shrunk):" + $" instanceId={((Object)_sphere).GetInstanceID()}" + $" hasModifiableContacts={((Collider)_sphere).hasModifiableContacts}" + $" layer={((Component)_sphere).gameObject.layer} ({LayerMask.LayerToName(((Component)_sphere).gameObject.layer)})")); } MeshRenderer componentInChildren2 = ((Component)this).GetComponentInChildren(false); Material val = ((componentInChildren2 != null) ? ((Renderer)componentInChildren2).sharedMaterial : null); if (val != null) { MeshRenderer componentInChildren3 = _shapeChild.GetComponentInChildren(); if (componentInChildren3 != null) { ((Renderer)componentInChildren3).sharedMaterial = val; } } } public void Revert() { if (_shapeColliderId != 0) { PhysicsManager.DeregisterBallColliderId(_shapeColliderId); _shapeColliderId = 0; } if ((Object)(object)_sphere != (Object)null) { _sphere.radius = _originalRadius; } if ((Object)(object)_shapeChild != (Object)null) { Object.Destroy((Object)(object)_shapeChild); } if (_originalRenderers != null) { for (int i = 0; i < _originalRenderers.Length; i++) { if ((Object)(object)_originalRenderers[i] != (Object)null) { ((Renderer)_originalRenderers[i]).enabled = true; } } } Object.Destroy((Object)(object)this); } private static BallShape PickRandomShape() { ShapeShifterConfig shapeShifter = ModConfig.ShapeShifter; BallShape[] array = new BallShape[7] { BallShape.Cube, BallShape.Disk, BallShape.Cylinder, BallShape.Cone, BallShape.Pyramid, BallShape.Acorn, BallShape.Isosphere }; bool[] array2 = new bool[7] { shapeShifter.ShapeCubeEnabled.Value, shapeShifter.ShapeDiskEnabled.Value, shapeShifter.ShapeCylinderEnabled.Value, shapeShifter.ShapeConeEnabled.Value, shapeShifter.ShapePyramidEnabled.Value, shapeShifter.ShapeAcornEnabled.Value, shapeShifter.ShapeIsosphereEnabled.Value }; int num = 0; for (int i = 0; i < array2.Length; i++) { if (array2[i]) { num++; } } if (num == 0) { IssaPluginPlugin.Log.LogWarning((object)"[ShapeShifter] All shapes are disabled in config — picking from full pool."); return array[Random.Range(0, array.Length)]; } int num2 = Random.Range(0, num); int num3 = 0; for (int j = 0; j < array.Length; j++) { if (array2[j]) { if (num3 == num2) { return array[j]; } num3++; } } return BallShape.Cube; } private static GameObject GetShapePrefab(BallShape shape) { if (1 == 0) { } GameObject result = (GameObject)(shape switch { BallShape.Cube => AssetLoader.ShapeShifterShapeCube, BallShape.Disk => AssetLoader.ShapeShifterShapeDisk, BallShape.Cylinder => AssetLoader.ShapeShifterShapeCylinder, BallShape.Cone => AssetLoader.ShapeShifterShapeCone, BallShape.Pyramid => AssetLoader.ShapeShifterShapePyramid, BallShape.Acorn => AssetLoader.ShapeShifterShapeAcorn, BallShape.Isosphere => AssetLoader.ShapeShifterShapeIsosphere, _ => null, }); if (1 == 0) { } return result; } private static GameObject FallbackShapeObject(BallShape shape) { IssaPluginPlugin.Log.LogWarning((object)$"[ShapeShifter] Bundle prefab for shape '{shape}' not found — using primitive fallback."); if (1 == 0) { } GameObject result = (GameObject)(shape switch { BallShape.Cylinder => GameObject.CreatePrimitive((PrimitiveType)2), BallShape.Disk => BuildFlatCylinder(), BallShape.Cone => GameObject.CreatePrimitive((PrimitiveType)1), BallShape.Pyramid => GameObject.CreatePrimitive((PrimitiveType)3), BallShape.Acorn => GameObject.CreatePrimitive((PrimitiveType)1), _ => GameObject.CreatePrimitive((PrimitiveType)3), }); if (1 == 0) { } return result; } private static GameObject BuildFlatCylinder() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Disk_Fallback"); GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)2); val2.transform.SetParent(val.transform, false); val2.transform.localScale = new Vector3(1f, 0.2f, 1f); return val; } } public static class SniperRifleItem { private static readonly MethodInfo TryParseFirearmRaycastResultsMethod = typeof(PlayerInventory).GetMethod("TryParseFirearmRaycastResults", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo CanHitWithGunshotMethod = typeof(PlayerInventory).GetMethod("CanHitWithGunshot", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo IncrementAndGetCurrentItemUseIdMethod = typeof(PlayerInventory).GetMethod("IncrementAndGetCurrentItemUseId", BindingFlags.Instance | BindingFlags.NonPublic); public static bool IsScoped { get; set; } public static IEnumerator ShootRoutine(PlayerInventory inventory) { ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)1); DoShoot(inventory); int slot = inventory.EquippedItemIndex; ItemHelper.DecrementAndRemove(inventory, slot); inventory.PlayerInfo.PlayerAudio.PlayElephantGunShotForAllClients(); float elapsed = 0f; float duration = ModConfig.SniperRifle.ShotDuration.Value; while (elapsed < duration) { elapsed += Time.deltaTime; yield return null; } ItemHelper.SetCurrentItemUse(inventory, (ItemUseType)0); } private static void DoShoot(PlayerInventory inventory) { //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_0019: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c3: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028b: 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_0267: Unknown result type (might be due to invalid IL or missing references) Vector3 elephantGunBarrelEndPosition = inventory.GetElephantGunBarrelEndPosition(); float value = ModConfig.SniperRifle.MaxAimingDistance.Value; float num = default(float); Vector3 firearmAimPoint = inventory.GetFirearmAimPoint(elephantGunBarrelEndPosition, inventory.GetElephantGunBarrelForward(), value, LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask), ref num); if (Mathf.Abs(num) > 45f) { inventory.PlayerInfo.Movement.AlignWithCameraImmediately(); float num2 = default(float); firearmAimPoint = inventory.GetFirearmAimPoint(elephantGunBarrelEndPosition, inventory.GetElephantGunBarrelForward(), ModConfig.SniperRifle.MaxAimingDistance.Value, LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask), ref num2); } float num3 = (IsScoped ? ModConfig.SniperRifle.ScopedInaccuracy.Value : ModConfig.SniperRifle.HipFireInaccuracy.Value); Vector3 val = VectorExtensions.RandomlyRotatedDeg(firearmAimPoint - elephantGunBarrelEndPosition, num3); Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(elephantGunBarrelEndPosition, val); ScreenShakeHelper.ApplyScreenShake(ModConfig.SniperRifle.ScreenShakeIntensity.Value); float value2 = ModConfig.SniperRifle.MaxShotDistance.Value; int num4 = LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask); int num5 = Physics.RaycastNonAlloc(val2, PlayerGolfer.raycastHitBuffer, value2, num4, (QueryTriggerInteraction)1); object[] array = new object[5] { PlayerGolfer.raycastHitBuffer, num5, null, null, null }; if (!(bool)(TryParseFirearmRaycastResultsMethod?.Invoke(inventory, array) ?? ((object)false))) { VfxManager.PlayElephantGunMissForAllClients(inventory, ((Ray)(ref val2)).direction); return; } RaycastHit val3 = (RaycastHit)array[3]; object obj = array[4]; Hittable val4 = (Hittable)((obj is Hittable) ? obj : null); bool flag = (Object)(object)val4 != (Object)null && (bool)(CanHitWithGunshotMethod?.Invoke(inventory, new object[2] { val4, null }) ?? ((object)false)); Vector3 val5 = Vector3.zero; if (flag) { val5 = ((Component)val4).transform.InverseTransformPoint(((RaycastHit)(ref val3)).point); if (val4.AsEntity.IsPlayer && val4.AsEntity.PlayerInfo.IsElectromagnetShieldActive) { VfxManager.PlayElephantGunHitForAllClients(inventory, new GunShotHitVfxData(val4, true, val5, ((RaycastHit)(ref val3)).point)); return; } ItemUseId val6 = (ItemUseId)(IncrementAndGetCurrentItemUseIdMethod?.Invoke(inventory, new object[1] { ItemRegistry.SniperRifleItemType }) ?? ((object)default(ItemUseId))); val4.HitWithItem((ItemType)3, val6, val5, ((Ray)(ref val2)).direction, ((Component)val4).transform.InverseTransformPoint(elephantGunBarrelEndPosition), ((RaycastHit)(ref val3)).distance, inventory, false, false, false, NetworkTime.time, 0uL); } VfxManager.PlayElephantGunHitForAllClients(inventory, new GunShotHitVfxData(val4, false, val5, ((RaycastHit)(ref val3)).point)); } } public class SniperRifleItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.SniperRifleItemType; public override string DisplayName => "M200 Intervention"; public override string[] ConsoleAliases => new string[4] { "m200", "sniper", "sniper_rifle", "intervention" }; public override Sprite Icon => AssetLoader.SniperRifleIcon; public override GameObject HeldModelPrefab => AssetLoader.SniperRiflePrefab; public override bool UseRocketIconFallback => false; public override int MaxUses => (int)ModConfig.SniperRifle.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.SniperRifle.GiveKey.Value; public override EquipmentType EquipmentType => (EquipmentType)5; public override ItemType AnimatorItemType => (ItemType)3; public override ItemType AnimatorChangedItemType => (ItemType)3; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { ((MonoBehaviour)inventory).StartCoroutine(SniperRifleItem.ShootRoutine(inventory)); } } public static class SpinachBehaviour { public static bool IsActive { get; private set; } public static void Activate(float duration) { IsActive = true; ((MonoBehaviour)IssaPluginPlugin.Instance).StartCoroutine(DeactivateAfter(duration)); } private static IEnumerator DeactivateAfter(float duration) { yield return (object)new WaitForSeconds(duration); IsActive = false; } } internal class SpinachItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.SpinachItemType; public override string DisplayName => "Spinach"; public override string[] ConsoleAliases => new string[2] { "steroids", "juice" }; public override Sprite Icon => AssetLoader.SpinachIcon; public override GameObject HeldModelPrefab => AssetLoader.SpinachPrefab; public override int MaxUses => (int)ModConfig.Spinach.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.Spinach.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if (!((Object)(object)localPlayerMovement == (Object)null)) { float value = ModConfig.Spinach.Duration.Value; localPlayerMovement.InformDrankCoffee(); localPlayerMovement.InformDrankCoffee(); localPlayerMovement.InformDrankCoffee(); SpinachBehaviour.Activate(value); ItemHelper.ConsumeEquippedItem(inventory); ((Component)inventory).GetComponent()?.ClientRequestVfx(); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct SpinachActivateMessage : NetworkMessage { } public struct SpinachTrailBeginMessage : NetworkMessage { public uint PlayerNetId; public float Duration; } public struct SpinachTrailEndMessage : NetworkMessage { public uint PlayerNetId; } public static class SpinachMessageSerialization { public static void WriteActivate(NetworkWriter w, SpinachActivateMessage msg) { } public static SpinachActivateMessage ReadActivate(NetworkReader r) { return default(SpinachActivateMessage); } public static void WriteTrailBegin(NetworkWriter w, SpinachTrailBeginMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); NetworkWriterExtensions.WriteFloat(w, msg.Duration); } public static SpinachTrailBeginMessage ReadTrailBegin(NetworkReader r) { return new SpinachTrailBeginMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r), Duration = NetworkReaderExtensions.ReadFloat(r) }; } public static void WriteTrailEnd(NetworkWriter w, SpinachTrailEndMessage msg) { NetworkWriterExtensions.WriteUInt(w, msg.PlayerNetId); } public static SpinachTrailEndMessage ReadTrailEnd(NetworkReader r) { return new SpinachTrailEndMessage { PlayerNetId = NetworkReaderExtensions.ReadUInt(r) }; } } public class SpinachNetworkBridge : NetworkBridgeBase { private bool _serverSessionActive; private Coroutine _serverTimeout; private GameObject _trail; private Coroutine _clientHideCoroutine; public void ClientRequestVfx() { NetworkClient.Send(default(SpinachActivateMessage), 0); } public void ServerActivate() { if (!((NetworkBehaviour)this).isServer) { return; } if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); } NetworkServer.SendToAll(new SpinachTrailEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); } float value = ModConfig.Spinach.Duration.Value; _serverSessionActive = true; NetworkServer.SendToAll(new SpinachTrailBeginMessage { PlayerNetId = ((NetworkBehaviour)this).netId, Duration = value }, 0, false); _serverTimeout = ((MonoBehaviour)this).StartCoroutine(ServerEndAfter(value)); } private IEnumerator ServerEndAfter(float duration) { yield return (object)new WaitForSeconds(duration); NetworkServer.SendToAll(new SpinachTrailEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); _serverSessionActive = false; _serverTimeout = null; } public static void HandleVfxBegin(SpinachTrailBeginMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { ((Component)value).GetComponent()?.ClientShowTrail(msg.Duration); } } public static void HandleVfxEnd(SpinachTrailEndMessage msg) { if (NetworkClient.spawned.TryGetValue(msg.PlayerNetId, out var value)) { ((Component)value).GetComponent()?.ClientHideTrail(); } } private void ClientShowTrail(float duration) { //IL_0069: 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) ClientHideTrail(); if (((NetworkBehaviour)this).isLocalPlayer) { SpinachOverlay.Instance?.SetActive(active: true, duration); } if (!((Object)(object)AssetLoader.SpinachTrailPrefab == (Object)null)) { _trail = Object.Instantiate(AssetLoader.SpinachTrailPrefab); _trail.transform.SetParent(((Component)this).transform, false); _trail.transform.localPosition = Vector3.zero; _trail.transform.localRotation = Quaternion.identity; _trail.SetActive(true); _clientHideCoroutine = ((MonoBehaviour)this).StartCoroutine(HideAfter(duration)); } } private void ClientHideTrail() { if (_clientHideCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_clientHideCoroutine); _clientHideCoroutine = null; } if ((Object)(object)_trail != (Object)null) { Object.Destroy((Object)(object)_trail); _trail = null; } if (((NetworkBehaviour)this).isLocalPlayer) { SpinachOverlay.Instance?.SetActive(active: false); } } private IEnumerator HideAfter(float duration) { yield return (object)new WaitForSeconds(duration); ClientHideTrail(); } public override void ServerHoleCleanup() { if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); _serverTimeout = null; } NetworkServer.SendToAll(new SpinachTrailEndMessage { PlayerNetId = ((NetworkBehaviour)this).netId }, 0, false); _serverSessionActive = false; } } public override void ClientHoleCleanup() { ClientHideTrail(); } public override void OnStopServer() { if (_serverSessionActive) { if (_serverTimeout != null) { ((MonoBehaviour)this).StopCoroutine(_serverTimeout); } _serverTimeout = null; _serverSessionActive = false; } } public override void OnStopClient() { if (((NetworkBehaviour)this).isLocalPlayer) { SpinachOverlay.Instance?.SetActive(active: false); } } } public class BomberCrashBehaviour : MonoBehaviour { public Rigidbody Rigidbody; private bool _impacted; private float _lifetime; private const float ImpactProximity = 2f; private const float MaxLifetime = 15f; private void FixedUpdate() { //IL_0049: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_009e: 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_00d3: Unknown result type (might be due to invalid IL or missing references) if (_impacted) { return; } _lifetime += Time.fixedDeltaTime; if (_lifetime >= 15f) { Impact(); return; } if (Physics.Raycast(((Component)this).transform.position, Vector3.down, 2f)) { Impact(); return; } if ((Object)(object)Rigidbody != (Object)null) { Vector3 linearVelocity = Rigidbody.linearVelocity; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (magnitude > 0.1f && linearVelocity.y < 0f) { float num = magnitude * Time.fixedDeltaTime + 2f; if (Physics.Raycast(((Component)this).transform.position, ((Vector3)(ref linearVelocity)).normalized, num)) { Impact(); return; } } } if (((Component)this).transform.position.y <= 0f) { Impact(); } } private void Impact() { //IL_0027: 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) //IL_0049: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (!_impacted) { _impacted = true; IssaPluginPlugin.Log.LogInfo((object)$"[BomberCrash] Impact at {((Component)this).transform.position}."); VfxManager.PlayPooledVfxLocalOnly((VfxType)37, ((Component)this).transform.position, Quaternion.identity, Vector3.one * ModConfig.AC130.MaydayExplosionScale.Value, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, ((Component)this).transform.position, 1f, 1f); Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class BomberFlyBehaviour : MonoBehaviour { public Vector3 destination; public float speed; private void Update() { //IL_001c: 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_0033: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, destination, speed * Time.deltaTime); if (Vector3.Distance(((Component)this).transform.position, destination) < 0.5f) { StealthBomberItem.ActiveBomberVisual = null; Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public class BomberMarker : MonoBehaviour { } public struct BomberVisualSpawnMessage : NetworkMessage { public Vector3 SpawnPos; public Vector3 ExitPos; public Vector3 Direction; public float Speed; public override string ToString() { //IL_000f: 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_002b: Unknown result type (might be due to invalid IL or missing references) return $"BomberVisualSpawnMessage[SpawnPos={SpawnPos},ExitPos={ExitPos},Direction={Direction},Speed={Speed}]"; } } public struct BomberShotDownMessage : NetworkMessage { public Vector3 CrashDir; public float CrashSpeed; public Vector3 ImpactDir; public Vector3 TorqueImpulse; public override string ToString() { //IL_000f: 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_0039: Unknown result type (might be due to invalid IL or missing references) return $"BomberShotDownMessage[CrashDir={CrashDir},CrashSpeed={CrashSpeed},ImpactDir={ImpactDir},TorqueImpulse={TorqueImpulse}]"; } } public static class BomberVisualSpawnMessageSerialization { public static void WriteBomberVisualSpawnMessage(NetworkWriter writer, BomberVisualSpawnMessage msg) { //IL_0003: 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_001d: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.SpawnPos); NetworkWriterExtensions.WriteVector3(writer, msg.ExitPos); NetworkWriterExtensions.WriteVector3(writer, msg.Direction); NetworkWriterExtensions.WriteFloat(writer, msg.Speed); } public static BomberVisualSpawnMessage ReadBomberVisualSpawnMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001e: 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_002b: Unknown result type (might be due to invalid IL or missing references) return new BomberVisualSpawnMessage { SpawnPos = NetworkReaderExtensions.ReadVector3(reader), ExitPos = NetworkReaderExtensions.ReadVector3(reader), Direction = NetworkReaderExtensions.ReadVector3(reader), Speed = NetworkReaderExtensions.ReadFloat(reader) }; } } public static class BomberShotDownMessageSerialization { public static void WriteBomberShotDownMessage(NetworkWriter writer, BomberShotDownMessage msg) { //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_002a: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.CrashDir); NetworkWriterExtensions.WriteFloat(writer, msg.CrashSpeed); NetworkWriterExtensions.WriteVector3(writer, msg.ImpactDir); NetworkWriterExtensions.WriteVector3(writer, msg.TorqueImpulse); } public static BomberShotDownMessage ReadBomberShotDownMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_002b: 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) return new BomberShotDownMessage { CrashDir = NetworkReaderExtensions.ReadVector3(reader), CrashSpeed = NetworkReaderExtensions.ReadFloat(reader), ImpactDir = NetworkReaderExtensions.ReadVector3(reader), TorqueImpulse = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct BomberRunMessage : NetworkMessage { public Vector3 Center; public Vector3 Forward; public float Length; public int EquippedIndex; } public static class BomberRunMessageSerialization { public static void WriteBomberRunMessage(NetworkWriter writer, BomberRunMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.Center); NetworkWriterExtensions.WriteVector3(writer, msg.Forward); NetworkWriterExtensions.WriteFloat(writer, msg.Length); NetworkWriterExtensions.WriteInt(writer, msg.EquippedIndex); } public static BomberRunMessage ReadBomberRunMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001e: Unknown result type (might be due to invalid IL or missing references) return new BomberRunMessage { Center = NetworkReaderExtensions.ReadVector3(reader), Forward = NetworkReaderExtensions.ReadVector3(reader), Length = NetworkReaderExtensions.ReadFloat(reader), EquippedIndex = NetworkReaderExtensions.ReadInt(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BomberPrepareHomingMessage : NetworkMessage { } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct BomberDamagedMessage : NetworkMessage { } public static class BomberDamagedMessageSerialization { public static void WriteBomberDamagedMessage(NetworkWriter writer, BomberDamagedMessage msg) { } public static BomberDamagedMessage ReadBomberDamagedMessage(NetworkReader reader) { return default(BomberDamagedMessage); } } public static class BomberPrepareHomingMessageSerialization { public static void WriteBomberPrepareHomingMessage(NetworkWriter writer, BomberPrepareHomingMessage msg) { } public static BomberPrepareHomingMessage ReadBomberPrepareHomingMessage(NetworkReader reader) { return default(BomberPrepareHomingMessage); } } public class BomberNetworkBridge : NetworkBridgeBase { private bool _isBombing; private bool _wasOwned; public bool PendingBomberHoming; public void ServerRequestBombingRun(Vector3 center, Vector3 forward, float length, int equippedIndex) { //IL_0076: 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_007e: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (_isBombing) { IssaPluginPlugin.Log.LogWarning((object)"[Bomber] Run already in progress for this player."); return; } _isBombing = true; PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.StealthBomberItemType, "Stealth Bomber", 0u, ((NetworkBehaviour)this).netId); } ((MonoBehaviour)this).StartCoroutine(StealthBomberItem.ServerBombingPhase(((Component)this).GetComponent(), equippedIndex, new StealthBomberItem.BombingStripInfo { Center = center, Forward = forward, Length = length }, this, delegate { _isBombing = false; })); } public void ServerPrepareBomberRocket() { PendingBomberHoming = true; } public void SendSpawnBomberVisual(Vector3 spawnPos, Vector3 exitPos, Vector3 direction, float speed) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) //IL_0014: 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_001c: Unknown result type (might be due to invalid IL or missing references) NetworkServer.SendToAll(new BomberVisualSpawnMessage { SpawnPos = spawnPos, ExitPos = exitPos, Direction = direction, Speed = speed }, 0, false); } public void SendBomberDamaged() { NetworkServer.SendToAll(default(BomberDamagedMessage), 0, false); } public void SendBomberShotDown(Vector3 crashDir, float crashSpeed, Vector3 impactDir, Vector3 torqueImpulse) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) NetworkServer.SendToAll(new BomberShotDownMessage { CrashDir = crashDir, CrashSpeed = crashSpeed, ImpactDir = impactDir, TorqueImpulse = torqueImpulse }, 0, false); } public static void HandleBomberDamaged(BomberDamagedMessage msg) { //IL_0040: 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) if (!((Object)(object)AssetLoader.MaydaySmokeTrailPrefab == (Object)null)) { GameObject activeBomberVisual = StealthBomberItem.ActiveBomberVisual; if (!((Object)(object)activeBomberVisual == (Object)null)) { IssaPluginPlugin.Log.LogInfo((object)"[Bomber] Spawning damage smoke trail."); GameObject val = Object.Instantiate(AssetLoader.MaydaySmokeTrailPrefab, activeBomberVisual.transform.position, Quaternion.identity); val.transform.SetParent(activeBomberVisual.transform, true); } } } public static void HandleBomberVisualSpawn(BomberVisualSpawnMessage msg) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)$"[Bomber] BomberVisualSpawnMessage received on client. msg={msg}"); StealthBomberItem.LocalSpawnBomberVisual(msg.SpawnPos, msg.ExitPos, msg.Direction, msg.Speed); } public static void HandleBomberShotDown(BomberShotDownMessage msg) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) IssaPluginPlugin.Log.LogInfo((object)$"[Bomber] BomberShotDownMessage received: triggering physics crash. msg={msg}"); GameObject activeBomberVisual = StealthBomberItem.ActiveBomberVisual; if ((Object)(object)activeBomberVisual == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[Bomber] Shot-down message arrived before visual — crash physics skipped on this client."); return; } BomberFlyBehaviour component = activeBomberVisual.GetComponent(); float num = (((Object)(object)component != (Object)null) ? component.speed : msg.CrashSpeed); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = false; } Collider[] components = activeBomberVisual.GetComponents(); foreach (Collider val in components) { val.enabled = false; } Rigidbody component2 = activeBomberVisual.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = false; component2.useGravity = true; component2.linearVelocity = msg.CrashDir * num; if (msg.ImpactDir != Vector3.zero) { component2.AddForce(msg.ImpactDir * ModConfig.StealthBomber.CrashImpactForce.Value, (ForceMode)1); } component2.AddForce(Vector3.down * ModConfig.StealthBomber.CrashDownwardForce.Value); component2.AddTorque(msg.TorqueImpulse, (ForceMode)1); } BomberCrashBehaviour bomberCrashBehaviour = activeBomberVisual.AddComponent(); bomberCrashBehaviour.Rigidbody = component2; } public override void OnStartClient() { _wasOwned = ((NetworkBehaviour)this).isOwned; } public override void OnStopClient() { if (((NetworkBehaviour)this).isOwned) { StealthBomberItem.CancelTargeting(); } } private void OnDestroy() { if (_wasOwned) { StealthBomberItem.CancelTargeting(); } } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public class BomberProxyBehaviour : CustomHittable { public Vector3 SpawnPos; public Vector3 Direction; public float Speed; public float TotalDist; public Vector3 LastHitWorldPos; private float _startTime; private bool _shotDown; public bool ShotDown { get { return _shotDown; } private set { _shotDown = value; } } private void Awake() { _startTime = Time.time; base.HitCount = 0; base.HitsRequired = (int)ModConfig.StealthBomber.HitsToDestroy.Value; base.OnHit = (Action)Delegate.Combine(base.OnHit, new Action(OnStealthBomberHit)); } private void FixedUpdate() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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 (NetworkServer.active) { float num = (Time.time - _startTime) * Speed; ((Component)this).transform.position = SpawnPos + Direction * num; if (num >= TotalDist) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void OnStealthBomberHit() { IssaPluginPlugin.Log.LogInfo((object)"[BomberProxy] OnStealthBomberHit called."); if (NetworkServer.active && !_shotDown && base.HitsRequired > 0 && base.HitCount < base.HitsRequired) { base.HitCount++; IssaPluginPlugin.Log.LogInfo((object)$"[BomberProxy] Rocket impact {base.HitCount}/{base.HitsRequired}."); if (base.HitCount >= base.HitsRequired) { _shotDown = true; IssaPluginPlugin.Log.LogInfo((object)"[BomberProxy] Shot down. Cancelling run."); base.OnHitsExceeded?.Invoke(); Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public class BomberProxyClientSetup : MonoBehaviour { private void Awake() { if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } if ((Object)(object)((Component)this).gameObject.GetComponent() == (Object)null) { ((Component)this).gameObject.AddComponent(); } } } public static class StealthBomberItem { private class TargetingResult { public BombingStripInfo? Strip; } public struct BombingStripInfo { public Vector3 Center; public Vector3 Forward; public float Length; } private static bool _isTargeting; private static bool _targetingCancelled; private static int _bomberUseIndex; private static Material _sharedStripMat; internal static readonly HashSet ActiveBomberDropRocketIds = new HashSet(); private static float _terrainSampleTimer = 0f; private const float _terrainSampleInterval = 0.05f; public static bool IsTargeting => _isTargeting; public static GameObject ActiveBomberVisual { get; set; } public static void CancelTargeting() { _targetingCancelled = true; } public static float RandomGaussian(float minValue = 0f, float maxValue = 1f) { float num; float num3; do { num = 2f * Random.value - 1f; float num2 = 2f * Random.value - 1f; num3 = num * num + num2 * num2; } while (num3 >= 1f); float num4 = num * Mathf.Sqrt(-2f * Mathf.Log(num3) / num3); float num5 = (minValue + maxValue) / 2f; float num6 = (maxValue - num5) / 3f; return Mathf.Clamp(num4 * num6 + num5, minValue, maxValue); } private static void SetCurrentItemUse(PlayerInventory inventory, ItemUseType type) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ItemHelper.SetCurrentItemUse(inventory, type); } public static IEnumerator BomberRunRoutine(PlayerInventory inventory) { if (_isTargeting) { yield break; } int equippedIndex = inventory.EquippedItemIndex; TargetingResult result = new TargetingResult(); yield return RunTargetingPhase(inventory, result); if (!result.Strip.HasValue) { IssaPluginPlugin.Log.LogInfo((object)"[Bomber] Targeting cancelled."); yield break; } BomberNetworkBridge bridge = ((Component)inventory).GetComponent(); if ((Object)(object)bridge == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Bomber] No BomberNetworkBridge on player."); yield break; } NetworkClient.Send(new BomberRunMessage { Center = result.Strip.Value.Center, Forward = result.Strip.Value.Forward, Length = result.Strip.Value.Length, EquippedIndex = equippedIndex }, 0); } private static void HandleTargetingMovement(Keyboard keyboard, OrbitCameraModule orbitModule, float moveSpeed, GameObject stripGo, GameObject pivotGo) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_0244: 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_0252: Unknown result type (might be due to invalid IL or missing references) _terrainSampleTimer += Time.deltaTime; float num = 0f; float num2 = 0f; if (((ButtonControl)keyboard[(Key)37]).isPressed || ((ButtonControl)keyboard[(Key)63]).isPressed) { num2 += 1f; } if (((ButtonControl)keyboard[(Key)33]).isPressed || ((ButtonControl)keyboard[(Key)64]).isPressed) { num2 -= 1f; } if (((ButtonControl)keyboard[(Key)15]).isPressed || ((ButtonControl)keyboard[(Key)61]).isPressed) { num -= 1f; } if (((ButtonControl)keyboard[(Key)18]).isPressed || ((ButtonControl)keyboard[(Key)62]).isPressed) { num += 1f; } if (num == 0f && num2 == 0f) { return; } Vector3 forward = Vector3.forward; Vector3 right = Vector3.right; if ((Object)(object)orbitModule != (Object)null) { float num3 = orbitModule.Yaw * (MathF.PI / 180f); ((Vector3)(ref forward))..ctor(Mathf.Sin(num3), 0f, Mathf.Cos(num3)); ((Vector3)(ref right))..ctor(Mathf.Cos(num3), 0f, 0f - Mathf.Sin(num3)); } Vector3 val = (right * num + forward * num2) * moveSpeed * Time.deltaTime; Transform transform = stripGo.transform; transform.position += val; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(stripGo.transform.position.x, pivotGo.transform.position.y, stripGo.transform.position.z); if (val2 != pivotGo.transform.position) { if (_terrainSampleTimer >= 0.05f) { _terrainSampleTimer = 0f; Vector3 position = stripGo.transform.position; position.y = ItemHelper.SampleTerrainY(position.x, position.z, position.y) + 10f; stripGo.transform.position = position; val2.y = ItemHelper.SampleTerrainY(val2.x, val2.z, val2.y) + 10f; } pivotGo.transform.position = val2; } } private static void HandleTargetingRotation(Keyboard keyboard, float rotateSpeed, ref float stripAngle, GameObject stripGo) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (((ButtonControl)keyboard[(Key)31]).isPressed) { stripAngle -= rotateSpeed * Time.deltaTime; } if (((ButtonControl)keyboard[(Key)19]).isPressed) { stripAngle += rotateSpeed * Time.deltaTime; } stripGo.transform.rotation = Quaternion.Euler(0f, stripAngle, 0f); } private static IEnumerator RunTargetingPhase(PlayerInventory inventory, TargetingResult result) { _isTargeting = true; _targetingCancelled = false; _terrainSampleTimer = 0f; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Disable(); OrbitCameraModule orbitModule = null; CameraModuleController.TryGetOrbitModule(ref orbitModule); OrbitCameraModule obj = orbitModule; float savedPitch = ((obj != null) ? obj.Pitch : 0f); OrbitCameraModule obj2 = orbitModule; float savedYaw = ((obj2 != null) ? obj2.Yaw : 0f); bool savedDisablePhysics = false; Vector3 playerPos = ((Component)inventory.PlayerInfo).transform.position; GameObject pivotGo = new GameObject("BomberTargetPivot"); pivotGo.transform.position = playerPos; float stripLength = ModConfig.StealthBomber.StripLength.Value; float stripWidth = ModConfig.StealthBomber.Spread.Value * 2f; float stripAngle = 0f; GameObject stripGo = CreateStripVisual(playerPos, stripWidth, stripLength); float currentDistanceAddition = 0f; float zoomSpeed = ModConfig.StealthBomber.TargetingZoomSpeed.Value; float zoomTimer = 0f; if ((Object)(object)orbitModule != (Object)null) { savedDisablePhysics = orbitModule.disablePhysics; orbitModule.SetSubject(pivotGo.transform); orbitModule.SetPitch(88f); orbitModule.SetDistanceAddition(currentDistanceAddition); orbitModule.disablePhysics = true; orbitModule.ForceUpdateModule(); } yield return null; float moveSpeed = ModConfig.StealthBomber.TargetMoveSpeed.Value; float rotateSpeed = ModConfig.StealthBomber.TargetRotateSpeed.Value; bool confirmed = false; bool cancelled = false; while (!confirmed && !cancelled && !_targetingCancelled) { Keyboard keyboard = Keyboard.current; Mouse mouse = Mouse.current; if (keyboard == null) { yield return null; continue; } HandleTargetingMovement(keyboard, orbitModule, moveSpeed, stripGo, pivotGo); if (((ButtonControl)keyboard[(Key)31]).isPressed || ((ButtonControl)keyboard[(Key)19]).isPressed) { HandleTargetingRotation(keyboard, rotateSpeed, ref stripAngle, stripGo); } zoomTimer -= Time.deltaTime; if ((Object)(object)orbitModule != (Object)null && mouse != null) { float scroll = ((InputControl)(object)mouse.scroll).ReadValue().y; if (scroll != 0f) { float zoomStep = Mathf.Sign(scroll) * zoomSpeed; currentDistanceAddition -= zoomStep; currentDistanceAddition = Mathf.Clamp(currentDistanceAddition, 1f, 2000f); } if (zoomTimer <= 0f) { orbitModule.SetDistanceAddition(currentDistanceAddition); } } if (zoomTimer <= 0f) { zoomTimer = 0.05f; } if (((ButtonControl)keyboard[(Key)2]).wasPressedThisFrame || (mouse != null && mouse.leftButton.wasPressedThisFrame)) { confirmed = true; } if (((ButtonControl)keyboard[(Key)1]).wasPressedThisFrame || (mouse != null && mouse.rightButton.wasPressedThisFrame)) { cancelled = true; } yield return null; } if (confirmed) { result.Strip = new BombingStripInfo { Center = stripGo.transform.position, Forward = stripGo.transform.forward, Length = stripLength }; } Object.Destroy((Object)(object)stripGo); Object.Destroy((Object)(object)pivotGo); _sharedStripMat = null; _isTargeting = false; RestoreCamera(orbitModule, savedPitch, savedYaw, savedDisablePhysics); gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); } public static void LocalSpawnBomberVisual(Vector3 spawnPos, Vector3 exitPos, Vector3 direction, float speed) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) ActiveBomberVisual = SpawnBomberVisual(spawnPos, exitPos, direction, speed); } public static IEnumerator ServerBombingPhase(PlayerInventory inventory, int equippedIndex, BombingStripInfo strip, BomberNetworkBridge bridge, Action onComplete) { IssaPluginPlugin.Log.LogWarning((object)"[Bomber] Running server-side stealth bomber phase."); SetCurrentItemUse(inventory, (ItemUseType)1); if (equippedIndex >= 0) { ItemHelper.DecrementAndRemove(inventory, equippedIndex); } SetCurrentItemUse(inventory, (ItemUseType)0); yield return (object)new WaitForSeconds(0.01f); yield return (object)new WaitForSeconds(ModConfig.StealthBomber.WaitTime.Value); float altitude = ModConfig.StealthBomber.Altitude.Value; float rocketInterval = ModConfig.StealthBomber.RocketInterval.Value; float spread = ModConfig.StealthBomber.Spread.Value; float approachDist = ModConfig.StealthBomber.ApproachDistance.Value; float waitTime = ModConfig.StealthBomber.WaitTime.Value; float halfLength = strip.Length / 2f; Vector3 stripStart = strip.Center - strip.Forward * halfLength; Vector3 stripEnd = strip.Center + strip.Forward * halfLength; Vector3 val = stripEnd - stripStart; Vector3 direction = ((Vector3)(ref val)).normalized; val = Vector3.Cross(direction, Vector3.up); Vector3 perpendicular = ((Vector3)(ref val)).normalized; Vector3 spawnPos = stripStart - direction * approachDist; Vector3 exitPos = stripEnd + direction * approachDist; spawnPos.y = strip.Center.y + altitude; exitPos.y = strip.Center.y + altitude; float exitBufferDist = ModConfig.StealthBomber.Speed.Value * waitTime; float dropEndDist = Vector3.Distance(spawnPos, exitPos) - exitBufferDist; float totalDist = Vector3.Distance(spawnPos, exitPos); IssaPluginPlugin.Log.LogInfo((object)($"[Bomber] Run started: dropping rockets at interval {rocketInterval:F0} over {strip.Length:F0}m " + $"at altitude {altitude:F0}m, approach {approachDist:F0}m")); bool proxyShotDown = false; BomberProxyBehaviour proxyBehaviour = null; GameObject proxyGo = SpawnBomberProxy(spawnPos, direction, ModConfig.StealthBomber.Speed.Value, totalDist, delegate { //IL_000e: Unknown result type (might be due to invalid IL or missing references) OnShotDown(proxyBehaviour, bridge, direction); }); proxyBehaviour = ((proxyGo != null) ? proxyGo.GetComponent() : null); if ((Object)(object)proxyBehaviour != (Object)null) { BomberProxyBehaviour bomberProxyBehaviour = proxyBehaviour; bomberProxyBehaviour.OnHit = (Action)Delegate.Combine(bomberProxyBehaviour.OnHit, (Action)delegate { if (proxyBehaviour.HitsRequired > 0 && proxyBehaviour.HitCount > 0 && proxyBehaviour.HitCount < proxyBehaviour.HitsRequired) { IssaPluginPlugin.Log.LogInfo((object)$"[BomberProxy] Damaged ({proxyBehaviour.HitCount}/{proxyBehaviour.HitsRequired}) — broadcasting smoke."); bridge.SendBomberDamaged(); } }); } bridge.SendSpawnBomberVisual(spawnPos, exitPos, direction, ModConfig.StealthBomber.Speed.Value); float startTime = Time.time; int rocketsDropped = 0; while (true) { float elapsed = Time.time - startTime; float distanceTravelled = elapsed * ModConfig.StealthBomber.Speed.Value; if (proxyShotDown || (Object)(object)proxyGo == (Object)null || distanceTravelled >= totalDist) { break; } Vector3 bomberPos = spawnPos + direction * distanceTravelled; if (distanceTravelled >= dropEndDist) { yield return null; continue; } float offsetAmount = RandomGaussian(0f - spread, spread); offsetAmount = Mathf.Clamp(offsetAmount, 0f - spread, spread); Vector3 offset = perpendicular * offsetAmount; float angularJitter = ModConfig.StealthBomber.RocketAngularJitter.Value; SpawnRocket(jitter: Quaternion.Euler(Random.Range(0f - angularJitter, angularJitter), Random.Range(0f - angularJitter, angularJitter), 0f), inventory: inventory, position: bomberPos + offset + Vector3.down * ModConfig.StealthBomber.RocketSpawnDepth.Value); rocketsDropped++; yield return (object)new WaitForSeconds(rocketInterval); } IssaPluginPlugin.Log.LogInfo((object)$"[Bomber] Run complete. {rocketsDropped} rockets dropped."); if ((Object)(object)proxyGo != (Object)null) { Object.Destroy((Object)(object)proxyGo); } onComplete?.Invoke(); } private static void OnShotDown(BomberProxyBehaviour proxyBehaviour, BomberNetworkBridge bridge, Vector3 direction) { //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_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_0048: Unknown result type (might be due to invalid IL or missing references) //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Vector3 impactDir = Vector3.zero; if ((Object)(object)proxyBehaviour != (Object)null && proxyBehaviour.LastHitWorldPos != Vector3.zero) { Vector3 val = ((Component)proxyBehaviour).transform.position - proxyBehaviour.LastHitWorldPos; impactDir = ((Vector3)(ref val)).normalized; } Vector3 torqueImpulse = Random.insideUnitSphere * ModConfig.StealthBomber.CrashTorque.Value; bridge.SendBomberShotDown(direction, ModConfig.StealthBomber.Speed.Value, impactDir, torqueImpulse); } private static GameObject SpawnBomberProxy(Vector3 spawnPos, Vector3 direction, float speed, float totalDist, Action onShotDown) { //IL_0006: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(AssetLoader.BomberProxyPrefab, spawnPos, Quaternion.LookRotation(direction, Vector3.up)); BomberProxyBehaviour bomberProxyBehaviour = val.AddComponent(); bomberProxyBehaviour.SpawnPos = spawnPos; bomberProxyBehaviour.Direction = direction; bomberProxyBehaviour.Speed = speed; bomberProxyBehaviour.TotalDist = totalDist; bomberProxyBehaviour.OnHitsExceeded = onShotDown; NetworkServer.Spawn(val, (NetworkConnectionToClient)null); return val; } private static GameObject SpawnBomberVisual(Vector3 spawnPos, Vector3 exitPos, Vector3 direction, float speed) { //IL_003a: 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) //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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AssetLoader.BomberPrefab == (Object)null) { IssaPluginPlugin.Log.LogInfo((object)"[Bomber] Cannot spawn bomber visual; cannot find prefab."); return null; } IssaPluginPlugin.Log.LogInfo((object)"[Bomber] Spawning bomber visual."); GameObject val = Object.Instantiate(AssetLoader.BomberPrefab, spawnPos, Quaternion.LookRotation(direction, Vector3.up)); BomberFlyBehaviour bomberFlyBehaviour = val.AddComponent(); bomberFlyBehaviour.destination = exitPos; bomberFlyBehaviour.speed = speed; return val; } private static GameObject CreateStripVisual(Vector3 center, float width, float length) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0040: 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) GameObject val = new GameObject("BomberTargetStrip"); val.transform.position = new Vector3(center.x, center.y + 0.5f, center.z); CreateStripPart(val.transform, "StripBody", Vector3.zero, new Vector3(width, 0.2f, length), new Color(1f, 0.3f, 0f, 0.3f)); AddDirectionChevrons(val.transform, width, length); return val; } private static void AddDirectionChevrons(Transform parent, float width, float length) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //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) float num = Mathf.Max(width * 0.6f, 4f); float num2 = width * 0.35f; float num3 = Mathf.Max(width * 0.08f, 0.6f); float num4 = Mathf.Sqrt(num2 * num2 + num * num); Color color = default(Color); ((Color)(ref color))..ctor(1f, 0.15f, 0.15f, 0.55f); float[] array = new float[2] { length * 0.15f, (0f - length) * 0.15f }; float[] array2 = array; foreach (float num5 in array2) { Vector3 val = new Vector3(0f - num2, 0f, num); Vector3 normalized = ((Vector3)(ref val)).normalized; CreateStripPart(parent, "ChevronL", new Vector3(num2 * 0.5f, 0.15f, num5), new Vector3(num3, 0.25f, num4), color, Quaternion.LookRotation(normalized, Vector3.up)); val = new Vector3(num2, 0f, num); Vector3 normalized2 = ((Vector3)(ref val)).normalized; CreateStripPart(parent, "ChevronR", new Vector3((0f - num2) * 0.5f, 0.15f, num5), new Vector3(num3, 0.25f, num4), color, Quaternion.LookRotation(normalized2, Vector3.up)); } } private static GameObject CreateStripPart(Transform parent, string name, Vector3 localPos, Vector3 localScale, Color color, Quaternion? localRotation = null) { //IL_0024: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localScale = localScale; if (localRotation.HasValue) { val.transform.localRotation = localRotation.Value; } Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { if ((Object)(object)_sharedStripMat == (Object)null) { Shader val2 = Shader.Find("Sprites/Default") ?? Shader.Find("UI/Default") ?? Shader.Find("Unlit/Color"); _sharedStripMat = new Material(val2) { color = color }; _sharedStripMat.SetInt("_ZTest", 8); _sharedStripMat.SetInt("_ZWrite", 0); _sharedStripMat.renderQueue = 3100; } component2.sharedMaterial = _sharedStripMat; } return val; } private static void RestoreCamera(OrbitCameraModule orbitModule, float savedPitch, float savedYaw, bool savedDisablePhysics) { if (!((Object)(object)orbitModule == (Object)null)) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { orbitModule.SetSubject(((Component)localPlayerMovement).transform); } orbitModule.SetDistanceAddition(0f); orbitModule.disablePhysics = savedDisablePhysics; orbitModule.SetPitch(savedPitch); orbitModule.SetYaw(savedYaw); orbitModule.ForceUpdateModule(); } } private static void SpawnRocket(PlayerInventory inventory, Vector3 position, Quaternion jitter) { //IL_0012: 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) //IL_0018: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { Quaternion val = jitter * Quaternion.LookRotation(Vector3.down, Vector3.forward); _bomberUseIndex++; ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(inventory.PlayerInfo.PlayerId.Guid, _bomberUseIndex, (ItemType)7, false); IssaPluginPlugin.Log.LogInfo((object)$"[Bomber] Spawning rocket at position={position}"); Rocket val3 = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, val); if ((Object)(object)val3 == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[Bomber] Rocket did not instantiate."); return; } ((Component)val3).gameObject.AddComponent(); val3.ServerInitialize(inventory.PlayerInfo, (Hittable)null, val2); NetworkServer.Spawn(((Component)val3).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val3, ModConfig.StealthBomber.ExplosionScale.Value); ActiveBomberDropRocketIds.Add(((Object)val3).GetInstanceID()); } } } internal class StealthBomberItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.StealthBomberItemType; public override string DisplayName => "Stealth Bomber"; public override string[] ConsoleAliases => new string[2] { "stealthbomber", "bomber" }; public override Sprite Icon => AssetLoader.BomberIcon; public override GameObject HeldModelPrefab => AssetLoader.BomberTabletPrefab; public override int MaxUses => (int)ModConfig.StealthBomber.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.StealthBomber.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { ((MonoBehaviour)inventory).StartCoroutine(StealthBomberItem.BomberRunRoutine(inventory)); } } public class StickyGrenadeBehaviour : NetworkBehaviour { private enum Phase { Flying, Stuck, Detonated } public PlayerInfo ThrowerInfo; public float GraceTime = 0.35f; public float FuseTime = 3.5f; public float StickRadius = 0.55f; public float ExplosionScale = 4f; private Phase _phase = Phase.Flying; private Rigidbody _rb; private float _elapsed; private float _fuseElapsed; private Transform _stickyTarget; private Vector3 _localOffset; private Vector3 _worldStuckPos; private static readonly MethodInfo RocketServerExplode = typeof(Rocket).GetMethod("ServerExplode", BindingFlags.Instance | BindingFlags.NonPublic); private void Start() { if (!NetworkServer.active) { ((Behaviour)this).enabled = false; return; } _rb = ((Component)this).GetComponent(); if ((Object)(object)_rb == (Object)null) { Entity component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null && component.HasRigidbody) { _rb = component.Rigidbody; } } if ((Object)(object)_rb != (Object)null) { _rb.useGravity = true; _rb.isKinematic = false; _rb.freezeRotation = false; } } private void FixedUpdate() { if (NetworkServer.active) { _elapsed += Time.fixedDeltaTime; switch (_phase) { case Phase.Flying: UpdateFlying(); break; case Phase.Stuck: UpdateStuck(); break; case Phase.Detonated: break; } } } private void UpdateFlying() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if (_elapsed < GraceTime) { return; } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, StickRadius, LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask), (QueryTriggerInteraction)1); Collider[] array2 = array; foreach (Collider val in array2) { if (((Component)val).transform.IsChildOf(((Component)this).transform) || (Object)(object)((Component)val).transform == (Object)(object)((Component)this).transform) { continue; } PlayerInfo componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { if (!((Object)(object)ThrowerInfo != (Object)null) || !((Object)(object)componentInParent == (Object)(object)ThrowerInfo)) { StickTo(((Component)componentInParent).transform, ((Component)componentInParent).GetComponent()); return; } continue; } NetworkIdentity componentInParent2 = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)((Component)componentInParent2).GetComponent() == (Object)null) { StickTo(((Component)componentInParent2).transform, componentInParent2); return; } } Collider[] array3 = Physics.OverlapSphere(((Component)this).transform.position, StickRadius * 0.7f, ItemHelper.GroundLayerMask, (QueryTriggerInteraction)1); Collider[] array4 = array3; foreach (Collider val2 in array4) { if (!((Component)val2).transform.IsChildOf(((Component)this).transform) && !((Object)(object)((Component)val2).transform == (Object)(object)((Component)this).transform)) { StickTo(null, null); break; } } } private void UpdateStuck() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_stickyTarget != (Object)null) { ((Component)this).transform.position = _stickyTarget.TransformPoint(_localOffset); } else { ((Component)this).transform.position = _worldStuckPos; } _fuseElapsed += Time.fixedDeltaTime; if (_fuseElapsed >= FuseTime) { Detonate(); } } private void StickTo(Transform target, NetworkIdentity targetNetworkIdentity) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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) _phase = Phase.Stuck; if ((Object)(object)_rb != (Object)null) { _rb.linearVelocity = Vector3.zero; _rb.angularVelocity = Vector3.zero; _rb.isKinematic = true; _rb.detectCollisions = false; } _stickyTarget = target; uint num = 0u; if ((Object)(object)target != (Object)null) { _localOffset = target.InverseTransformPoint(((Component)this).transform.position); num = (((Object)(object)targetNetworkIdentity != (Object)null) ? targetNetworkIdentity.netId : 0u); IssaPluginPlugin.Log.LogInfo((object)($"[StickyGrenade] Stuck to moving target netId={num} " + $"localOffset={_localOffset}")); } else { _worldStuckPos = ((Component)this).transform.position; IssaPluginPlugin.Log.LogInfo((object)$"[StickyGrenade] Stuck to static geometry at {_worldStuckPos}"); } NetworkIdentity component = ((Component)this).GetComponent(); NetworkServer.SendToAll(new StickyGrenadeStuckMessage { GrenadeNetId = (((Object)(object)component != (Object)null) ? component.netId : 0u), TargetNetId = num, LocalOffset = (((Object)(object)target != (Object)null) ? _localOffset : _worldStuckPos), FuseRemaining = FuseTime }, 0, false); } public void Detonate() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0064: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if (_phase == Phase.Detonated) { return; } _phase = Phase.Detonated; Vector3 position = ((Component)this).transform.position; IssaPluginPlugin.Log.LogInfo((object)$"[StickyGrenade] Detonating at {position}"); NetworkServer.SendToAll(new StickyGrenadeDetonatedMessage { WorldPosition = position }, 0, false); Rocket val = Object.Instantiate(GameManager.ItemSettings.RocketPrefab, position, Quaternion.identity); if ((Object)(object)val != (Object)null) { if ((Object)(object)ThrowerInfo == (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } else { ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(ThrowerInfo.PlayerId.Guid, StickyGrenadeItem.NextUseIndex(), (ItemType)7, false); val.ServerInitialize(ThrowerInfo, (Hittable)null, val2); NetworkServer.Spawn(((Component)val).gameObject, (NetworkConnectionToClient)null); ExplosionScaler.Register(val, ExplosionScale); RocketServerExplode?.Invoke(val, new object[1] { position }); } } NetworkServer.Destroy(((Component)this).gameObject); } } public class StickyGrenadeClientSetup : MonoBehaviour { private Light _blinkLight; private ParticleSystem _blinkParticles; private float _stuckTime; public Transform StickyTarget { get; set; } public Vector3 LocalOffset { get; set; } public bool IsStuck { get; private set; } public float FuseRemaining { get; set; } private void Awake() { _blinkLight = ((Component)this).GetComponentInChildren(true); _blinkParticles = ((Component)this).GetComponentInChildren(true); } private void Update() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (IsStuck) { if ((Object)(object)StickyTarget != (Object)null) { ((Component)this).transform.position = StickyTarget.TransformPoint(LocalOffset); } float num = Time.time - _stuckTime; float num2 = Mathf.Clamp01(num / Mathf.Max(FuseRemaining, 0.01f)); float num3 = Mathf.Lerp(1f, 8f, num2); float num4 = 1f / num3; float num5 = Time.time % num4 / num4; bool flag = num5 < 0.5f; if ((Object)(object)_blinkLight != (Object)null) { ((Behaviour)_blinkLight).enabled = flag; _blinkLight.intensity = Mathf.Lerp(0.5f, 3f, num2); _blinkLight.color = Color.Lerp(new Color(1f, 0.4f, 0f), Color.red, num2); } if ((Object)(object)_blinkParticles != (Object)null) { EmissionModule emission = _blinkParticles.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(flag ? Mathf.Lerp(5f, 30f, num2) : 0f); } } } public void OnStuck(Transform target, Vector3 localOffset, float fuseRemaining) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) IsStuck = true; StickyTarget = target; LocalOffset = localOffset; FuseRemaining = fuseRemaining; _stuckTime = Time.time; if ((Object)(object)_blinkLight != (Object)null) { ((Behaviour)_blinkLight).enabled = true; } if ((Object)(object)_blinkParticles != (Object)null) { _blinkParticles.Play(); } IssaPluginPlugin.Log.LogInfo((object)$"[StickyGrenade] Client: grenade stuck. FuseRemaining={fuseRemaining:F2}s"); } } public static class StickyGrenadeItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class StickyGrenadeItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.StickyGrenadeItemType; public override string DisplayName => "Sticky Grenade"; public override string[] ConsoleAliases => new string[3] { "sticky_grenade", "sticky", "stickygrenade" }; public override Sprite Icon => AssetLoader.StickyGrenadeIcon; public override GameObject HeldModelPrefab => AssetLoader.StickyGrenadePrefab; public override int MaxUses => (int)ModConfig.StickyGrenade.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.StickyGrenade.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { StickyGrenadeNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { component.ClientThrow(); } else { IssaPluginPlugin.Log.LogError((object)"[StickyGrenade] No StickyGrenadeNetworkBridge on player."); } } public override void OnEquip(PlayerInventory inventory) { if ((Object)(object)((Component)inventory).GetComponent() == (Object)null) { ((Component)inventory).gameObject.AddComponent(); } } } public struct StickyGrenadeThrowMessage : NetworkMessage { public Vector3 ThrowOrigin; public Vector3 ThrowVelocity; } public static class StickyGrenadeThrowMessageSerialization { public static void WriteStickyGrenadeThrowMessage(NetworkWriter writer, StickyGrenadeThrowMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.ThrowOrigin); NetworkWriterExtensions.WriteVector3(writer, msg.ThrowVelocity); } public static StickyGrenadeThrowMessage ReadStickyGrenadeThrowMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001e: Unknown result type (might be due to invalid IL or missing references) return new StickyGrenadeThrowMessage { ThrowOrigin = NetworkReaderExtensions.ReadVector3(reader), ThrowVelocity = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct StickyGrenadeStuckMessage : NetworkMessage { public uint GrenadeNetId; public uint TargetNetId; public Vector3 LocalOffset; public float FuseRemaining; } public static class StickyGrenadeStuckMessageSerialization { public static void WriteStickyGrenadeStuckMessage(NetworkWriter writer, StickyGrenadeStuckMessage msg) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.GrenadeNetId); NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); NetworkWriterExtensions.WriteVector3(writer, msg.LocalOffset); NetworkWriterExtensions.WriteFloat(writer, msg.FuseRemaining); } public static StickyGrenadeStuckMessage ReadStickyGrenadeStuckMessage(NetworkReader reader) { //IL_0026: 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) return new StickyGrenadeStuckMessage { GrenadeNetId = NetworkReaderExtensions.ReadUInt(reader), TargetNetId = NetworkReaderExtensions.ReadUInt(reader), LocalOffset = NetworkReaderExtensions.ReadVector3(reader), FuseRemaining = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct StickyGrenadeDetonatedMessage : NetworkMessage { public Vector3 WorldPosition; } public static class StickyGrenadeDetonatedMessageSerialization { public static void WriteStickyGrenadeDetonatedMessage(NetworkWriter writer, StickyGrenadeDetonatedMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.WorldPosition); } public static StickyGrenadeDetonatedMessage ReadStickyGrenadeDetonatedMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new StickyGrenadeDetonatedMessage { WorldPosition = NetworkReaderExtensions.ReadVector3(reader) }; } } public class StickyGrenadeNetworkBridge : NetworkBridgeBase { private bool _serverThrowActive; public void ServerHandleThrow(Vector3 throwOrigin, Vector3 throwVelocity) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (_serverThrowActive) { IssaPluginPlugin.Log.LogWarning((object)"[StickyGrenade] Throw already in progress."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[StickyGrenade] No PlayerInventory on bridge object."); return; } ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.StickyGrenadeItemType) { IssaPluginPlugin.Log.LogWarning((object)"[StickyGrenade] Player does not have StickyGrenade equipped."); return; } if ((Object)(object)AssetLoader.StickyGrenadePrefab == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[StickyGrenade] Grenade prefab not loaded."); return; } ItemHelper.ConsumeEquippedItem(component); float value = ModConfig.StickyGrenade.MaxThrowSpeed.Value; Vector3 linearVelocity = Vector3.ClampMagnitude(throwVelocity, value); GameObject val = Object.Instantiate(AssetLoader.StickyGrenadePrefab, throwOrigin, Quaternion.LookRotation(((Vector3)(ref linearVelocity)).normalized, Vector3.up)); if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogError((object)"[StickyGrenade] Grenade prefab failed to instantiate."); return; } Rigidbody component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.useGravity = true; component2.isKinematic = false; component2.linearVelocity = linearVelocity; Vector3 val2 = Vector3.Cross(((Vector3)(ref linearVelocity)).normalized, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.right; } component2.angularVelocity = val3 * 10f; } NetworkServer.Spawn(val, (NetworkConnectionToClient)null); StickyGrenadeBehaviour stickyGrenadeBehaviour = val.AddComponent(); stickyGrenadeBehaviour.ThrowerInfo = component.PlayerInfo; stickyGrenadeBehaviour.GraceTime = ModConfig.StickyGrenade.GraceTime.Value; stickyGrenadeBehaviour.FuseTime = ModConfig.StickyGrenade.FuseTime.Value; stickyGrenadeBehaviour.StickRadius = ModConfig.StickyGrenade.StickRadius.Value; stickyGrenadeBehaviour.ExplosionScale = ModConfig.StickyGrenade.ExplosionScale.Value; _serverThrowActive = false; IssaPluginPlugin.Log.LogInfo((object)$"[StickyGrenade] Grenade thrown from {throwOrigin} velocity={((Vector3)(ref linearVelocity)).magnitude:F1} m/s"); } public void ClientThrow() { //IL_0030: 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_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) //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[StickyGrenade] No main camera for throw direction."); return; } Vector3 forward = ((Component)main).transform.forward; Vector3 val = ((Component)main).transform.position + forward * 1.2f + Vector3.up * 0.3f; Vector3 val2 = forward + Vector3.up * ModConfig.StickyGrenade.LobAngle.Value; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 throwVelocity = normalized * ModConfig.StickyGrenade.ThrowSpeed.Value; NetworkClient.Send(new StickyGrenadeThrowMessage { ThrowOrigin = val, ThrowVelocity = throwVelocity }, 0); IssaPluginPlugin.Log.LogInfo((object)$"[StickyGrenade] Client throw: origin={val} speed={((Vector3)(ref throwVelocity)).magnitude:F1}"); } public static void HandleStickyGrenadeStuck(StickyGrenadeStuckMessage msg) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.spawned.TryGetValue(msg.GrenadeNetId, out var value) || (Object)(object)value == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)$"[StickyGrenade] HandleStickyGrenadeStuck: grenade netId={msg.GrenadeNetId} not found."); return; } StickyGrenadeClientSetup component = ((Component)value).GetComponent(); if (!((Object)(object)component == (Object)null)) { Transform target = null; if (msg.TargetNetId != 0 && NetworkClient.spawned.TryGetValue(msg.TargetNetId, out var value2) && (Object)(object)value2 != (Object)null) { target = ((Component)value2).transform; } component.OnStuck(target, msg.LocalOffset, msg.FuseRemaining); } } public static void HandleStickyGrenadeDetonated(StickyGrenadeDetonatedMessage msg) { //IL_0004: 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_000e: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) VfxManager.PlayPooledVfxLocalOnly((VfxType)37, msg.WorldPosition, Quaternion.identity, Vector3.one * ModConfig.StickyGrenade.ExplosionScale.Value, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, msg.WorldPosition, 1f, 1f); IssaPluginPlugin.Log.LogInfo((object)$"[StickyGrenade] Client: detonation VFX at {msg.WorldPosition}"); } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public class StickyGrenadeTrajectoryPreview : MonoBehaviour { private const int ArcSteps = 40; private const float ArcTimeStep = 0.08f; private const int RingSegments = 32; private const float RingSurfaceOffset = 0.06f; public ItemType TargetItemType; public Func ThrowSpeed; public Func LobAngle; public Func RingRadius; private LineRenderer _line; private LineRenderer _ring; private PlayerInventory _inventory; private readonly Vector3[] _positions = (Vector3[])(object)new Vector3[41]; private readonly Vector3[] _ringPositions = (Vector3[])(object)new Vector3[32]; private void Awake() { //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) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0244: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown _inventory = ((Component)this).GetComponent(); TargetItemType = ItemRegistry.StickyGrenadeItemType; ThrowSpeed = () => ModConfig.StickyGrenade.ThrowSpeed.Value; LobAngle = () => ModConfig.StickyGrenade.LobAngle.Value; RingRadius = () => 0.55f; _line = ((Component)this).gameObject.AddComponent(); _line.useWorldSpace = true; _line.positionCount = 41; _line.startWidth = 0.07f; _line.endWidth = 0.02f; ((Renderer)_line).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)_line).receiveShadows = false; _line.numCapVertices = 2; Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val != (Object)null) { ((Renderer)_line).material = new Material(val); } _line.startColor = new Color(1f, 0.85f, 0f, 0.9f); _line.endColor = new Color(1f, 0.4f, 0f, 0.1f); GameObject val2 = new GameObject("StickyGrenadeRing"); val2.transform.SetParent((Transform)null, false); _ring = val2.AddComponent(); _ring.useWorldSpace = true; _ring.loop = true; _ring.positionCount = 32; _ring.startWidth = 0.06f; _ring.endWidth = 0.06f; ((Renderer)_ring).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)_ring).receiveShadows = false; _ring.numCapVertices = 2; if ((Object)(object)val != (Object)null) { ((Renderer)_ring).material = new Material(val); } Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.85f, 0f, 0.85f); _ring.startColor = val3; _ring.endColor = val3; ((Renderer)_ring).enabled = false; } private void Update() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0136: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_inventory == (Object)null || _inventory.GetEffectivelyEquippedItem(true) != TargetItemType) { Object.Destroy((Object)(object)this); return; } Mouse current = Mouse.current; if (current == null || !current.rightButton.isPressed) { ((Renderer)_line).enabled = false; ((Renderer)_ring).enabled = false; return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { ((Renderer)_line).enabled = false; ((Renderer)_ring).enabled = false; return; } ((Renderer)_line).enabled = true; Vector3 forward = ((Component)main).transform.forward; Vector3 val = ((Component)main).transform.position + forward * 1.2f + Vector3.up * 0.3f; Vector3 val2 = forward + Vector3.up * LobAngle(); Vector3 val3 = ((Vector3)(ref val2)).normalized * ThrowSpeed(); int num = ItemHelper.GroundLayerMask | LayerMask.op_Implicit(GameManager.LayerSettings.GunHittablesMask); _positions[0] = val; int positionCount = 1; Vector3 center = val; Vector3 normal = Vector3.up; bool flag = false; RaycastHit val5 = default(RaycastHit); for (int i = 1; i <= 40; i++) { Vector3 val4 = val + val3 * 0.08f; val3 += Physics.gravity * 0.08f; if (Physics.Linecast(val, val4, ref val5, num, (QueryTriggerInteraction)1)) { _positions[i] = ((RaycastHit)(ref val5)).point; positionCount = i + 1; center = ((RaycastHit)(ref val5)).point; normal = ((RaycastHit)(ref val5)).normal; flag = true; break; } val = val4; _positions[i] = val; positionCount = i + 1; center = val; } _line.positionCount = positionCount; _line.SetPositions(_positions); ((Renderer)_ring).enabled = flag; if (flag) { UpdateRing(center, normal); } } private void UpdateRing(Vector3 center, Vector3 normal) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_000c: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0040: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0021: 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_0027: 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_0089: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //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_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) Vector3 val = Vector3.Cross(normal, Vector3.forward); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.Cross(normal, Vector3.right); } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(val, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = RingRadius(); Vector3 val3 = center + normal * 0.06f; for (int i = 0; i < 32; i++) { float num2 = (float)i * MathF.PI * 2f / 32f; _ringPositions[i] = val3 + (val * Mathf.Cos(num2) + normalized * Mathf.Sin(num2)) * num; } _ring.SetPositions(_ringPositions); } private void OnDestroy() { if ((Object)(object)_line != (Object)null) { Object.Destroy((Object)(object)_line); } if ((Object)(object)_ring != (Object)null) { Object.Destroy((Object)(object)((Component)_ring).gameObject); } } } public class SuperDonutItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.SuperDonutItemType; public override string DisplayName => "Super Donut"; public override string[] ConsoleAliases => new string[2] { "superdonut", "super_donut" }; public override Sprite Icon => AssetLoader.SuperDonutIcon ?? AssetLoader.DonutIcon; public override GameObject HeldModelPrefab => AssetLoader.SuperDonutHandheldPrefab ?? AssetLoader.DonutHandheldPrefab; public override int MaxUses => (int)ModConfig.SuperDonut.Uses.Value; public override float DefaultPoolWeight => 1f; public override Key GiveKey => ModConfig.SuperDonut.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 0f, 0 => 0f, 2 => 0.5f, 4 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { SuperDonutNetworkBridge component = ((Component)inventory).GetComponent(); if ((Object)(object)component != (Object)null) { NetworkClient.Send(default(SuperDonutStartMessage), 0); } else { IssaPluginPlugin.Log.LogError((object)"[SuperDonut] No SuperDonutNetworkBridge on player."); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct SuperDonutStartMessage : NetworkMessage { } public struct SuperDonutFiredMessage : NetworkMessage { public int TargetCount; } public static class SuperDonutMessageSerialization { public static void WriteSuperDonutStartMessage(NetworkWriter w, SuperDonutStartMessage m) { } public static SuperDonutStartMessage ReadSuperDonutStartMessage(NetworkReader r) { return default(SuperDonutStartMessage); } public static void WriteSuperDonutFiredMessage(NetworkWriter w, SuperDonutFiredMessage m) { NetworkWriterExtensions.WriteInt(w, m.TargetCount); } public static SuperDonutFiredMessage ReadSuperDonutFiredMessage(NetworkReader r) { return new SuperDonutFiredMessage { TargetCount = NetworkReaderExtensions.ReadInt(r) }; } } public class SuperDonutNetworkBridge : NetworkBridgeBase { private const float LaserStaggerDelay = 0.4f; public void ServerFireBarrage() { //IL_0026: 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_002c: 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) if (!((NetworkBehaviour)this).isServer) { return; } PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { ItemType effectivelyEquippedItem = component.GetEffectivelyEquippedItem(true); if (effectivelyEquippedItem != ItemRegistry.SuperDonutItemType) { IssaPluginPlugin.Log.LogWarning((object)"[SuperDonut] Player does not have Super Donut equipped."); return; } ItemHelper.ConsumeEquippedItem(component); ((MonoBehaviour)this).StartCoroutine(ServerBarrageCoroutine(component)); } } private IEnumerator ServerBarrageCoroutine(PlayerInventory owner) { List targets = CollectTargets(owner); if (targets.Count == 0) { IssaPluginPlugin.Log.LogInfo((object)"[SuperDonut] No valid targets found."); NetworkServer.SendToAll(new SuperDonutFiredMessage { TargetCount = 0 }, 0, false); yield break; } IssaPluginPlugin.Log.LogInfo((object)$"[SuperDonut] Firing barrage at {targets.Count} player(s)."); int useIndex = 0; foreach (Hittable hittable in targets) { ulong guid = owner.PlayerInfo.PlayerId.Guid; int num = useIndex + 1; useIndex = num; ItemUseId itemUseId = new ItemUseId(guid, num, (ItemType)10, false); OrbitalLaserManager.ServerActivateLaser(hittable, Vector3.zero, owner, itemUseId); if (useIndex < targets.Count) { yield return (object)new WaitForSeconds(0.4f); } } NetworkServer.SendToAll(new SuperDonutFiredMessage { TargetCount = targets.Count }, 0, false); IssaPluginPlugin.Log.LogInfo((object)"[SuperDonut] Barrage complete."); } private static List CollectTargets(PlayerInventory owner) { List list = new List(); foreach (NetworkConnectionToClient value in NetworkServer.connections.Values) { NetworkIdentity identity = ((NetworkConnection)value).identity; if ((Object)(object)identity == (Object)null) { continue; } PlayerInventory component = ((Component)identity).GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component == (Object)(object)owner)) { PlayerInfo playerInfo = component.PlayerInfo; Hittable val = ((playerInfo != null) ? playerInfo.AsHittable : null); if (!((Object)(object)val == (Object)null)) { list.Add(val); } } } return list; } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public class SuperShapeShifterItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.SuperShapeShifterItemType; public override string DisplayName => "Super Shape Shifter"; public override string[] ConsoleAliases => new string[4] { "supercubeball", "super_cube_ball", "supershapeshifter", "super_shape_shifter" }; public override Sprite Icon => AssetLoader.SuperShapeShifterIcon ?? AssetLoader.ShapeShifterIcon; public override GameObject HeldModelPrefab => AssetLoader.ShapeShifterHandheldPrefab; public override int MaxUses => (int)ModConfig.SuperShapeShifter.Uses.Value; public override float DefaultPoolWeight => 3f; public override Key GiveKey => ModConfig.SuperShapeShifter.GiveKey.Value; public override void OnUse(PlayerInventory inventory) { NetworkClient.Send(new SuperShapeShifterRequestMessage { EquippedSlotIndex = inventory.EquippedItemIndex }, 0); } } public class SuperShapeShifterNetworkBridge : NetworkBridgeBase { private PlayerInventory _inventory; private void Awake() { _inventory = ((Component)this).GetComponent(); } public void ServerHandleRequest(int equippedSlotIndex) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer || (Object)(object)_inventory == (Object)null) { return; } if (ItemRegistry.GetItemTypeAtSlot(_inventory, equippedSlotIndex) != ItemRegistry.SuperShapeShifterItemType) { IssaPluginPlugin.Log.LogWarning((object)"[SuperShapeShifter] ServerHandleRequest: item not at expected slot."); return; } ItemHelper.ConsumeItemAtSlot(_inventory, equippedSlotIndex); float value = ModConfig.SuperShapeShifter.Duration.Value; int num = 0; foreach (NetworkConnectionToClient value2 in NetworkServer.connections.Values) { NetworkIdentity val = ((value2 != null) ? ((NetworkConnection)value2).identity : null); if ((Object)(object)val == (Object)null || (val.netId == ((NetworkBehaviour)this).netId && !ModConfig.SuperShapeShifter.AffectSelf.Value)) { continue; } PlayerInventory component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { PlayerInfo playerInfo = component.PlayerInfo; object obj; if (playerInfo == null) { obj = null; } else { PlayerGolfer asGolfer = playerInfo.AsGolfer; obj = ((asGolfer != null) ? asGolfer.OwnBall : null); } if (!((Object)obj == (Object)null)) { ShapeShifterHelper.ServerApplyCube(val.netId, value, reroll: true); num++; } } } IssaPluginPlugin.Log.LogInfo((object)$"[SuperShapeShifter] Cubed {num} ball(s) for {value:F1}s."); } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } public static class TeleporterItem { private static bool _isTargeting; private static bool _targetingCancelled; public static bool IsTargeting => _isTargeting; public static void CancelTargeting() { _targetingCancelled = true; } public static IEnumerator TeleporterUseRoutine(PlayerInventory inventory) { if (!_isTargeting) { int equippedIndex = inventory.EquippedItemIndex; Vector3? destination = null; yield return RunTargetingPhase(inventory, delegate(Vector3? result) { destination = result; }); if (!destination.HasValue) { IssaPluginPlugin.Log.LogInfo((object)"[Teleporter] Targeting cancelled."); yield break; } NetworkClient.Send(new TeleporterUseMessage { Destination = destination.Value, EquippedIndex = equippedIndex }, 0); } } private static IEnumerator RunTargetingPhase(PlayerInventory inventory, Action onComplete) { _isTargeting = true; _targetingCancelled = false; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Disable(); OrbitCameraModule orbitModule = null; CameraModuleController.TryGetOrbitModule(ref orbitModule); OrbitCameraModule obj = orbitModule; float savedPitch = ((obj != null) ? obj.Pitch : 0f); OrbitCameraModule obj2 = orbitModule; float savedYaw = ((obj2 != null) ? obj2.Yaw : 0f); bool savedDisablePhysics = false; Vector3 playerPos = ((Component)inventory.PlayerInfo).transform.position; float snappedY = ItemHelper.SampleTerrainY(playerPos.x, playerPos.z, playerPos.y); Vector3 markerStartPos = new Vector3(playerPos.x, snappedY, playerPos.z); GameObject pivotGo = new GameObject("TeleporterTargetPivot"); pivotGo.transform.position = playerPos; GameObject markerGo = CreateMarkerVisual(markerStartPos); float currentDistanceAddition = 25f; float zoomSpeed = ModConfig.StealthBomber.TargetingZoomSpeed.Value; if ((Object)(object)orbitModule != (Object)null) { savedDisablePhysics = orbitModule.disablePhysics; orbitModule.SetSubject(pivotGo.transform); orbitModule.SetPitch(88f); orbitModule.SetDistanceAddition(currentDistanceAddition); orbitModule.disablePhysics = true; orbitModule.ForceUpdateModule(); } yield return null; float moveSpeed = ModConfig.Teleporter.TargetMoveSpeed.Value; bool confirmed = false; bool cancelled = false; while (!confirmed && !cancelled && !_targetingCancelled) { Keyboard keyboard = Keyboard.current; Mouse mouse = Mouse.current; if (keyboard == null) { yield return null; continue; } HandleMarkerMovement(keyboard, orbitModule, moveSpeed, markerGo, pivotGo); if ((Object)(object)orbitModule != (Object)null && mouse != null) { float scroll = ((InputControl)(object)mouse.scroll).ReadValue().y; if (scroll != 0f) { float zoomStep = Mathf.Sign(scroll) * zoomSpeed; currentDistanceAddition -= zoomStep; currentDistanceAddition = Mathf.Clamp(currentDistanceAddition, 1f, 2000f); orbitModule.SetDistanceAddition(currentDistanceAddition); } } if (((ButtonControl)keyboard[(Key)2]).wasPressedThisFrame || (mouse != null && mouse.leftButton.wasPressedThisFrame)) { confirmed = true; } if (((ButtonControl)keyboard[(Key)1]).wasPressedThisFrame || (mouse != null && mouse.rightButton.wasPressedThisFrame)) { cancelled = true; } yield return null; } Vector3? result = (confirmed ? new Vector3?(markerGo.transform.position) : ((Vector3?)null)); Object.Destroy((Object)(object)markerGo); Object.Destroy((Object)(object)pivotGo); _isTargeting = false; RestoreCamera(orbitModule, savedPitch, savedYaw, savedDisablePhysics); gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); onComplete(result); } private static void HandleMarkerMovement(Keyboard keyboard, OrbitCameraModule orbitModule, float moveSpeed, GameObject markerGo, GameObject pivotGo) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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) float num = 0f; float num2 = 0f; if (((ButtonControl)keyboard[(Key)37]).isPressed || ((ButtonControl)keyboard[(Key)63]).isPressed) { num2 += 1f; } if (((ButtonControl)keyboard[(Key)33]).isPressed || ((ButtonControl)keyboard[(Key)64]).isPressed) { num2 -= 1f; } if (((ButtonControl)keyboard[(Key)15]).isPressed || ((ButtonControl)keyboard[(Key)61]).isPressed) { num -= 1f; } if (((ButtonControl)keyboard[(Key)18]).isPressed || ((ButtonControl)keyboard[(Key)62]).isPressed) { num += 1f; } if (num != 0f || num2 != 0f) { if (((ButtonControl)keyboard[(Key)51]).isPressed || ((ButtonControl)keyboard[(Key)52]).isPressed) { moveSpeed *= ModConfig.Teleporter.SprintMultiplier.Value; } Vector3 forward = Vector3.forward; Vector3 right = Vector3.right; if ((Object)(object)orbitModule != (Object)null) { float num3 = orbitModule.Yaw * (MathF.PI / 180f); ((Vector3)(ref forward))..ctor(Mathf.Sin(num3), 0f, Mathf.Cos(num3)); ((Vector3)(ref right))..ctor(Mathf.Cos(num3), 0f, 0f - Mathf.Sin(num3)); } Vector3 val = (right * num + forward * num2) * moveSpeed * Time.deltaTime; Vector3 val2 = markerGo.transform.position + val; val2.y = ItemHelper.SampleTerrainY(val2.x, val2.z, markerGo.transform.position.y); markerGo.transform.position = val2; pivotGo.transform.position = new Vector3(val2.x, pivotGo.transform.position.y, val2.z); } } private static GameObject CreateMarkerVisual(Vector3 center) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_0125: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("TeleporterTargetMarker"); val.transform.position = center; float value = ModConfig.Teleporter.MarkerRadius.Value; CreateMarkerPart(val.transform, "MarkerDisc", Vector3.zero, new Vector3(value * 2f, 0.15f, value * 2f), new Color(0.2f, 0.6f, 1f, 0.35f)); CreateMarkerPart(val.transform, "MarkerRing", new Vector3(0f, 0.08f, 0f), new Vector3(value * 2f + 1.5f, 0.1f, value * 2f + 1.5f), new Color(0.4f, 0.8f, 1f, 0.55f)); float num = value * 0.55f; float num2 = Mathf.Max(value * 0.07f, 0.4f); Color color = default(Color); ((Color)(ref color))..ctor(0.5f, 0.9f, 1f, 0.7f); CreateMarkerPart(val.transform, "TickN", new Vector3(0f, 0.2f, value + num * 0.5f), new Vector3(num2, 0.2f, num), color); CreateMarkerPart(val.transform, "TickS", new Vector3(0f, 0.2f, 0f - (value + num * 0.5f)), new Vector3(num2, 0.2f, num), color); CreateMarkerPart(val.transform, "TickE", new Vector3(value + num * 0.5f, 0.2f, 0f), new Vector3(num, 0.2f, num2), color); CreateMarkerPart(val.transform, "TickW", new Vector3(0f - (value + num * 0.5f), 0.2f, 0f), new Vector3(num, 0.2f, num2), color); return val; } private static GameObject CreateMarkerPart(Transform parent, string name, Vector3 localPos, Vector3 localScale, Color color) { //IL_0039: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) GameObject val = (name.StartsWith("Tick") ? GameObject.CreatePrimitive((PrimitiveType)3) : GameObject.CreatePrimitive((PrimitiveType)2)); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localScale = localScale; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Shader val2 = Shader.Find("Sprites/Default") ?? Shader.Find("UI/Default") ?? Shader.Find("Unlit/Color"); Material val3 = new Material(val2); val3.color = color; val3.SetInt("_ZTest", 8); val3.SetInt("_ZWrite", 0); val3.renderQueue = 3100; component2.material = val3; } return val; } private static void RestoreCamera(OrbitCameraModule orbitModule, float savedPitch, float savedYaw, bool savedDisablePhysics) { if (!((Object)(object)orbitModule == (Object)null)) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { orbitModule.SetSubject(((Component)localPlayerMovement).transform); } orbitModule.SetDistanceAddition(0f); orbitModule.disablePhysics = savedDisablePhysics; orbitModule.SetPitch(savedPitch); orbitModule.SetYaw(savedYaw); orbitModule.ForceUpdateModule(); } } } internal class TeleporterItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.TeleporterItemType; public override string DisplayName => "Teleporter"; public override string[] ConsoleAliases => new string[3] { "teleporter", "teleport", "tp" }; public override Sprite Icon => AssetLoader.TeleporterIcon; public override GameObject HeldModelPrefab => AssetLoader.TeleporterHandheldPrefab; public override int MaxUses => (int)ModConfig.Teleporter.Uses.Value; public override float DefaultPoolWeight => 10f; public override Key GiveKey => ModConfig.Teleporter.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 5f, 0 => 5f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { ((MonoBehaviour)inventory).StartCoroutine(TeleporterItem.TeleporterUseRoutine(inventory)); } } public struct TeleporterUseMessage : NetworkMessage { public Vector3 Destination; public int EquippedIndex; } public static class TeleporterUseMessageSerialization { public static void WriteTeleporterUseMessage(NetworkWriter writer, TeleporterUseMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Destination); NetworkWriterExtensions.WriteInt(writer, msg.EquippedIndex); } public static TeleporterUseMessage ReadTeleporterUseMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new TeleporterUseMessage { Destination = NetworkReaderExtensions.ReadVector3(reader), EquippedIndex = NetworkReaderExtensions.ReadInt(reader) }; } } public struct TeleporterWarpMessage : NetworkMessage { public Vector3 Destination; } public static class TeleporterWarpMessageSerialization { public static void WriteTeleporterWarpMessage(NetworkWriter writer, TeleporterWarpMessage msg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Destination); } public static TeleporterWarpMessage ReadTeleporterWarpMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new TeleporterWarpMessage { Destination = NetworkReaderExtensions.ReadVector3(reader) }; } } public struct TeleporterVfxMessage : NetworkMessage { public Vector3 Origin; public Vector3 Destination; } public static class TeleporterVfxMessageSerialization { public static void WriteTeleporterVfxMessage(NetworkWriter writer, TeleporterVfxMessage msg) { //IL_0003: 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) NetworkWriterExtensions.WriteVector3(writer, msg.Origin); NetworkWriterExtensions.WriteVector3(writer, msg.Destination); } public static TeleporterVfxMessage ReadTeleporterVfxMessage(NetworkReader reader) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001e: Unknown result type (might be due to invalid IL or missing references) return new TeleporterVfxMessage { Origin = NetworkReaderExtensions.ReadVector3(reader), Destination = NetworkReaderExtensions.ReadVector3(reader) }; } } public class TeleporterNetworkBridge : NetworkBridgeBase { private bool _isActive; private bool _wasOwned; public void ServerHandleUse(Vector3 destination, int equippedIndex) { //IL_0053: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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) if (_isActive) { IssaPluginPlugin.Log.LogWarning((object)"[Teleporter] Teleport already in progress for this player."); return; } PlayerInventory component = ((Component)this).GetComponent(); if (!((Object)(object)component == (Object)null)) { _isActive = true; ItemWarningBroadcaster.Broadcast(component.PlayerInfo.PlayerId.PlayerName, ItemRegistry.TeleporterItemType, "Teleporter", 0u, ((NetworkBehaviour)this).netId); PlayerInfo playerInfo = component.PlayerInfo; Vector3 position = playerInfo.Rigidbody.position; float num = ItemHelper.SampleTerrainY(destination.x, destination.z, destination.y); ((Vector3)(ref destination))..ctor(destination.x, num, destination.z); IssaPluginPlugin.Log.LogInfo((object)("[Teleporter] Player '" + playerInfo.PlayerId.PlayerName + "' teleporting " + $"from {position} to {destination}.")); ItemHelper.SetCurrentItemUse(component, (ItemUseType)1); if (equippedIndex >= 0) { ItemHelper.DecrementAndRemove(component, equippedIndex); } ItemHelper.SetCurrentItemUse(component, (ItemUseType)0); playerInfo.Rigidbody.position = destination; playerInfo.Rigidbody.linearVelocity = Vector3.zero; playerInfo.Rigidbody.angularVelocity = Vector3.zero; if (((NetworkBehaviour)this).isLocalPlayer) { HandleWarp(new TeleporterWarpMessage { Destination = destination }); } else if (((NetworkBehaviour)this).connectionToClient != null) { ((NetworkConnection)((NetworkBehaviour)this).connectionToClient).Send(new TeleporterWarpMessage { Destination = destination }, 0); } NetworkServer.SendToAll(new TeleporterVfxMessage { Origin = position, Destination = destination }, 0, false); _isActive = false; } } public static void HandleWarp(TeleporterWarpMessage msg) { //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_0042: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if (!((Object)(object)localPlayerInfo == (Object)null)) { localPlayerInfo.Movement.Teleport(msg.Destination, ((Component)localPlayerInfo.Movement).transform.rotation, false); IssaPluginPlugin.Log.LogInfo((object)$"[Teleporter] Local player warped to {msg.Destination}."); } } public static void HandleVfx(TeleporterVfxMessage msg) { //IL_0002: 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) SpawnTeleportVfx(msg.Origin); SpawnTeleportVfx(msg.Destination); } private static void SpawnTeleportVfx(Vector3 position) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006f: Unknown result type (might be due to invalid IL or missing references) //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_007d: Unknown result type (might be due to invalid IL or missing references) GameObject teleporterVfxPrefab = AssetLoader.TeleporterVfxPrefab; if ((Object)(object)teleporterVfxPrefab == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[Teleporter] VFX prefab not loaded — skipping effect."); return; } GameObject val = Object.Instantiate(teleporterVfxPrefab, position, Quaternion.identity); ParticleSystem component = val.GetComponent(); if ((Object)(object)component != (Object)null) { MainModule main = component.main; if (!((MainModule)(ref main)).loop) { main = component.main; float duration = ((MainModule)(ref main)).duration; main = component.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; Object.Destroy((Object)(object)val, duration + ((MinMaxCurve)(ref startLifetime)).constantMax); return; } } Object.Destroy((Object)(object)val, 5f); } public override void OnStartClient() { _wasOwned = ((NetworkBehaviour)this).isOwned; } public override void OnStopClient() { if (((NetworkBehaviour)this).isOwned) { TeleporterItem.CancelTargeting(); } } private void OnDestroy() { if (_wasOwned) { TeleporterItem.CancelTargeting(); } } public override void ServerHoleCleanup() { } public override void ClientHoleCleanup() { } } internal sealed class UfoAbductionSessionState { public uint WielderNetId; public Vector3 UfoSpawnPos; public Vector3 HoverPos; public Vector3 DropoffPos; public float ApproachDuration; public float AbductionDuration; public float TransitDuration; public float StartTime; public float MaxPullSpeed; public float NaturalLength; public float HoverHeight; public bool HoverLocked; public GameObject UfoVfxInstance; public LineRenderer BeamLine; public Camera PipCamera; public RenderTexture PipRenderTexture; public Coroutine ForceCoroutine; public PlayerMovement ForceMovement; public float TotalDuration => ApproachDuration + AbductionDuration + TransitDuration; public Vector3 GetUfoPosition(float elapsed) { //IL_0018: 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_0062: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) float num = elapsed - ApproachDuration; if (num < AbductionDuration) { return HoverPos; } float num2 = num - AbductionDuration; float num3 = ((TransitDuration > 0f) ? Mathf.Clamp01(num2 / TransitDuration) : 1f); return Vector3.Lerp(HoverPos, DropoffPos, num3); } } public static class UfoAbductionClientLogic { private static readonly Dictionary s_sessions = new Dictionary(); private static readonly List s_flyAwayInstances = new List(); private const float StasisBeamOffset = 1.5f; public static void HandleBegin(UfoAbductionBeginMessage msg) { BeginSession(msg); } public static void HandleEnd(UfoAbductionEndMessage msg) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) EndSession(msg.VictimNetId, msg.ExplosionPos, msg.ExplosionForce, msg.ExplosionRadius); } internal static bool TryGetSession(uint victimNetId, out UfoAbductionSessionState state) { return s_sessions.TryGetValue(victimNetId, out state); } internal static bool TryGetSessionForWielder(uint wielderNetId, out UfoAbductionSessionState state) { foreach (KeyValuePair s_session in s_sessions) { if (s_session.Value.WielderNetId == wielderNetId) { state = s_session.Value; return true; } } state = null; return false; } public static void UpdateAll() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (s_sessions.Count == 0) { return; } KeyValuePair[] array = s_sessions.ToArray(); KeyValuePair[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair keyValuePair = array2[i]; UfoAbductionSessionState value = keyValuePair.Value; float num = Time.time - value.StartTime; Vector3 val2; if (num < value.ApproachDuration) { Transform transformByNetId = GetTransformByNetId(keyValuePair.Key); Vector3 val = (((Object)(object)transformByNetId != (Object)null) ? (transformByNetId.position + Vector3.up * value.HoverHeight) : value.HoverPos); float num2 = ((value.ApproachDuration > 0f) ? Mathf.Clamp01(num / value.ApproachDuration) : 1f); val2 = Vector3.Lerp(value.UfoSpawnPos, val, num2); } else { if (!value.HoverLocked) { Transform transformByNetId2 = GetTransformByNetId(keyValuePair.Key); if ((Object)(object)transformByNetId2 != (Object)null) { value.HoverPos = transformByNetId2.position + Vector3.up * value.HoverHeight; } value.HoverLocked = true; } val2 = value.GetUfoPosition(num); } if ((Object)(object)value.UfoVfxInstance != (Object)null) { value.UfoVfxInstance.transform.position = val2; } UpdateBeamLine(keyValuePair.Key, value, val2, num); UpdatePipCamera(keyValuePair.Key, value, val2, num); } } public static void ClearAll() { KeyValuePair[] array = s_sessions.ToArray(); foreach (KeyValuePair keyValuePair in array) { EndSessionInternal(keyValuePair.Key); } foreach (GameObject s_flyAwayInstance in s_flyAwayInstances) { if ((Object)(object)s_flyAwayInstance != (Object)null) { Object.Destroy((Object)(object)s_flyAwayInstance); } } s_flyAwayInstances.Clear(); } private static void BeginSession(UfoAbductionBeginMessage msg) { //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) //IL_0042: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo == (Object)null) { return; } EndSessionInternal(msg.VictimNetId); UfoAbductionSessionState ufoAbductionSessionState = new UfoAbductionSessionState { WielderNetId = msg.WielderNetId, UfoSpawnPos = msg.UfoSpawnPos, HoverPos = msg.HoverPos, DropoffPos = msg.DropoffPos, ApproachDuration = msg.ApproachDuration, AbductionDuration = msg.AbductionDuration, TransitDuration = msg.TransitDuration, StartTime = Time.time, MaxPullSpeed = msg.MaxPullSpeed, NaturalLength = msg.NaturalLength, HoverHeight = msg.HoverHeight }; if ((Object)(object)AssetLoader.UfoAbductionUfoPrefab != (Object)null) { ufoAbductionSessionState.UfoVfxInstance = Object.Instantiate(AssetLoader.UfoAbductionUfoPrefab, msg.UfoSpawnPos, Quaternion.identity); Rigidbody[] componentsInChildren = ufoAbductionSessionState.UfoVfxInstance.GetComponentsInChildren(); foreach (Rigidbody val in componentsInChildren) { val.isKinematic = true; val.useGravity = false; } Object.DontDestroyOnLoad((Object)(object)ufoAbductionSessionState.UfoVfxInstance); } ufoAbductionSessionState.BeamLine = CreateBeamLine(); CreatePipCamera(ufoAbductionSessionState); s_sessions[msg.VictimNetId] = ufoAbductionSessionState; NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == msg.VictimNetId) { PlayerMovement movement = localPlayerInfo.Movement; if ((Object)(object)movement != (Object)null) { ufoAbductionSessionState.ForceMovement = movement; ufoAbductionSessionState.ForceCoroutine = ((MonoBehaviour)movement).StartCoroutine(ForceCoroutine(msg.VictimNetId)); IssaPluginPlugin.Log.LogInfo((object)$"[UfoAbductionClientLogic] Session started — local player is victim (netId={msg.VictimNetId})."); } } } private static void EndSession(uint victimNetId, Vector3 explosionPos, float explosionForce, float explosionRadius) { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (!s_sessions.TryGetValue(victimNetId, out var value)) { return; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); GolfCartSeat activeGolfCartSeat = localPlayerInfo.ActiveGolfCartSeat; Rigidbody val = ((((GolfCartSeat)(ref activeGolfCartSeat)).IsValid() && (Object)(object)activeGolfCartSeat.golfCart != (Object)null) ? activeGolfCartSeat.golfCart.AsEntity.Rigidbody : ((Component)localPlayerInfo).GetComponentInParent()); if ((Object)(object)val != (Object)null) { if (num == victimNetId) { val.linearVelocity = Vector3.zero; val.useGravity = true; } else { float num2 = Vector3.Distance(val.position, explosionPos); if (num2 < explosionRadius) { val.AddExplosionForce(explosionForce, explosionPos, explosionRadius, 0f, (ForceMode)2); } } } if ((Object)(object)value.UfoVfxInstance != (Object)null) { PlayerMovement movement = localPlayerInfo.Movement; if ((Object)(object)movement != (Object)null) { s_flyAwayInstances.Add(value.UfoVfxInstance); ((MonoBehaviour)movement).StartCoroutine(FlyAwayCoroutine(value.UfoVfxInstance, value.DropoffPos)); } else { Object.Destroy((Object)(object)value.UfoVfxInstance); } value.UfoVfxInstance = null; } } VfxManager.PlayPooledVfxLocalOnly((VfxType)37, explosionPos, Quaternion.identity, Vector3.one * 2f, 0u, false, 0f, (Action)null); CameraModuleController.Shake(GameManager.CameraGameplaySettings.RocketExplosionScreenshakeSettings, explosionPos, 1f, 1f); IssaPluginPlugin.Log.LogInfo((object)$"[UfoAbductionClientLogic] Explosion at {explosionPos} (victim={victimNetId})."); EndSessionInternal(victimNetId); } private static IEnumerator FlyAwayCoroutine(GameObject ufoGo, Vector3 fromPos) { //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) if ((Object)(object)ufoGo == (Object)null) { yield break; } float angle = Random.Range(0f, 360f) * (MathF.PI / 180f); Vector3 val = new Vector3(Mathf.Cos(angle), 0.4f, Mathf.Sin(angle)); Vector3 awayDir = ((Vector3)(ref val)).normalized; Vector3 destination = fromPos + awayDir * 120f; float elapsed = 0f; Vector3 start = ufoGo.transform.position; while (elapsed < 2.5f) { if ((Object)(object)ufoGo == (Object)null) { yield break; } elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / 2.5f); ufoGo.transform.position = Vector3.Lerp(start, destination, t * t); yield return null; } if ((Object)(object)ufoGo != (Object)null) { s_flyAwayInstances.Remove(ufoGo); Object.Destroy((Object)(object)ufoGo); } } private static void EndSessionInternal(uint victimNetId) { if (s_sessions.TryGetValue(victimNetId, out var value)) { s_sessions.Remove(victimNetId); if (value.ForceCoroutine != null && (Object)(object)value.ForceMovement != (Object)null) { ((MonoBehaviour)value.ForceMovement).StopCoroutine(value.ForceCoroutine); } if ((Object)(object)value.BeamLine != (Object)null) { Object.Destroy((Object)(object)((Component)value.BeamLine).gameObject); } if ((Object)(object)value.UfoVfxInstance != (Object)null) { Object.Destroy((Object)(object)value.UfoVfxInstance); } if ((Object)(object)value.PipCamera != (Object)null) { Object.Destroy((Object)(object)((Component)value.PipCamera).gameObject); } if ((Object)(object)value.PipRenderTexture != (Object)null) { value.PipRenderTexture.Release(); Object.Destroy((Object)(object)value.PipRenderTexture); } } } private static IEnumerator ForceCoroutine(uint victimNetId) { PlayerInfo localInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localInfo == (Object)null) { yield break; } Rigidbody lastRb = null; bool knockoutApplied = false; while (s_sessions.ContainsKey(victimNetId)) { if (!s_sessions.TryGetValue(victimNetId, out var state)) { yield break; } GolfCartSeat seat = localInfo.ActiveGolfCartSeat; Rigidbody rb = ((((GolfCartSeat)(ref seat)).IsValid() && (Object)(object)seat.golfCart != (Object)null) ? seat.golfCart.AsEntity.Rigidbody : ((Component)localInfo).GetComponentInParent()); if ((Object)(object)lastRb != (Object)null && (Object)(object)lastRb != (Object)(object)rb) { lastRb.useGravity = true; } lastRb = rb; if ((Object)(object)rb != (Object)null) { float sessionElapsed = Time.time - state.StartTime; if (sessionElapsed >= state.ApproachDuration) { if (!knockoutApplied) { knockoutApplied = true; ApplyAbductionKnockout(localInfo, state); } float abductionElapsed = sessionElapsed - state.ApproachDuration; bool inTransit = abductionElapsed >= state.AbductionDuration; Vector3 targetPos = ComputeVictimTargetPos(state, sessionElapsed); rb.useGravity = false; rb.angularVelocity = Vector3.zero; if (inTransit) { SnapToPosition(rb, targetPos); } else { LockToPosition(rb, targetPos, state.MaxPullSpeed); } } } yield return (object)new WaitForFixedUpdate(); state = null; seat = default(GolfCartSeat); } if ((Object)(object)lastRb != (Object)null) { lastRb.useGravity = true; } } private static void ApplyAbductionKnockout(PlayerInfo localInfo, UfoAbductionSessionState state) { //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_006c: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) Transform transformByNetId = GetTransformByNetId(state.WielderNetId); PlayerInfo val = ((transformByNetId != null) ? ((Component)transformByNetId).GetComponentInParent() : null); if (!((Object)(object)val == (Object)null)) { ItemUseId val2 = default(ItemUseId); ((ItemUseId)(ref val2))..ctor(val.PlayerId.Guid, UfoAbductionItem.NextUseIndex(), (ItemType)7, false); bool flag = default(bool); localInfo.Movement.TryKnockOut(val, (KnockoutType)7, false, ((Component)localInfo.Movement).transform.InverseTransformPoint(((Component)val).transform.position), Vector3.Distance(((Component)localInfo).transform.position, ((Component)val).transform.position), Vector3.zero, (ElectromagnetShieldHitBlockType)0, val2, false, true, ref flag, ref flag); } } private static Vector3 ComputeVictimTargetPos(UfoAbductionSessionState state, float elapsed) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) Vector3 ufoPosition = state.GetUfoPosition(elapsed); float num = elapsed - state.ApproachDuration; if (num < state.AbductionDuration) { return ufoPosition - Vector3.up * state.NaturalLength; } return ufoPosition - Vector3.up * 1.5f; } private static void LockToPosition(Rigidbody rb, Vector3 targetPos, float maxSpeed) { //IL_0002: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) rb.linearVelocity = Vector3.zero; rb.position = Vector3.MoveTowards(rb.position, targetPos, maxSpeed * Time.fixedDeltaTime); } private static void SnapToPosition(Rigidbody rb, Vector3 targetPos) { //IL_0002: 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) rb.linearVelocity = Vector3.zero; rb.position = targetPos; } private static void CreatePipCamera(UfoAbductionSessionState state) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown state.PipRenderTexture = new RenderTexture(320, 180, 16); state.PipRenderTexture.Create(); GameObject val = new GameObject("UfoAbductionPiP"); Object.DontDestroyOnLoad((Object)(object)val); Camera val2 = val.AddComponent(); val2.targetTexture = state.PipRenderTexture; val2.fieldOfView = 55f; val2.nearClipPlane = 0.3f; val2.farClipPlane = 500f; val2.allowHDR = false; val2.allowMSAA = false; val2.depth = -20f; state.PipCamera = val2; } private static void UpdatePipCamera(uint victimNetId, UfoAbductionSessionState state, Vector3 ufoPos, float elapsed) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)state.PipCamera == (Object)null)) { Transform transformByNetId = GetTransformByNetId(victimNetId); Vector3 val = (((Object)(object)transformByNetId != (Object)null) ? transformByNetId.position : (ufoPos - Vector3.up * state.HoverHeight)); Vector3 val2 = Vector3.Lerp(val, ufoPos, 0.5f); float num = Vector3.Distance(val, ufoPos); float num2 = ((elapsed < state.ApproachDuration) ? 1.2f : 0.7f); float num3 = elapsed - state.ApproachDuration; float num4 = ((state.TransitDuration > 0f) ? Mathf.Clamp01((num3 - state.AbductionDuration) / state.TransitDuration) : 0f); float num5 = Mathf.Lerp(12f, 45f, num4); float num6 = Mathf.Max(num * num2, num5); float num7 = elapsed * 20f; Vector3 val3 = Quaternion.Euler(20f, num7, 0f) * new Vector3(0f, 0f, 0f - num6); ((Component)state.PipCamera).transform.position = val2 + val3; ((Component)state.PipCamera).transform.LookAt(val2); } } internal static RenderTexture GetActivePipTexture() { foreach (KeyValuePair s_session in s_sessions) { RenderTexture pipRenderTexture = s_session.Value.PipRenderTexture; if ((Object)(object)pipRenderTexture != (Object)null && pipRenderTexture.IsCreated()) { return pipRenderTexture; } } return null; } private static LineRenderer CreateBeamLine() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_005e: 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) GameObject val = new GameObject("UfoAbductionBeam"); LineRenderer val2 = val.AddComponent(); val2.positionCount = 2; val2.startWidth = 0.3f; val2.endWidth = 0.8f; ((Renderer)val2).material = new Material(Shader.Find("Sprites/Default")); val2.startColor = new Color(0.3f, 1f, 0.5f, 0.7f); val2.endColor = new Color(0.3f, 1f, 0.5f, 0.15f); val2.useWorldSpace = true; Object.DontDestroyOnLoad((Object)(object)val); return val2; } private static void UpdateBeamLine(uint victimNetId, UfoAbductionSessionState state, Vector3 ufoPos, float elapsed) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.BeamLine == (Object)null) { return; } bool flag = elapsed >= state.ApproachDuration; ((Renderer)state.BeamLine).enabled = flag; if (flag) { Transform transformByNetId = GetTransformByNetId(victimNetId); if ((Object)(object)transformByNetId != (Object)null) { state.BeamLine.SetPosition(0, ufoPos); state.BeamLine.SetPosition(1, transformByNetId.position + Vector3.up * 1f); } } } internal static Transform GetTransformByNetId(uint netId) { if (netId == 0) { return null; } PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; if ((Object)(object)localPlayerInfo != (Object)null) { NetworkIdentity component = ((Component)localPlayerInfo).GetComponent(); uint num = ((component != null) ? component.netId : 0u); if (num == netId) { return ((Component)localPlayerInfo).transform; } } List remotePlayers = GameManager.RemotePlayers; if (remotePlayers != null) { foreach (PlayerInfo item in remotePlayers) { if (!((Object)(object)item == (Object)null)) { NetworkIdentity component2 = ((Component)item).GetComponent(); uint num2 = ((component2 != null) ? component2.netId : 0u); if (num2 == netId) { return ((Component)item).transform; } } } } if (NetworkClient.spawned.TryGetValue(netId, out var value) && (Object)(object)value != (Object)null) { return ((Component)value).transform; } return null; } } public static class UfoAbductionItem { private static int _useIndex; public static int NextUseIndex() { return Interlocked.Increment(ref _useIndex); } } public class UfoAbductionItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.UfoAbductionItemType; public override string DisplayName => "UFO Abduction"; public override string[] ConsoleAliases => new string[3] { "ufo", "abduction", "ufo_abduction" }; public override Sprite Icon => AssetLoader.UfoAbductionIcon; public override GameObject HeldModelPrefab => AssetLoader.UfoAbductionHandheldPrefab; public override bool UseRocketIconFallback => true; public override EquipmentType EquipmentType => (EquipmentType)12; public override ItemType AnimatorItemType => (ItemType)10; public override ItemType AnimatorChangedItemType => (ItemType)10; public override int MaxUses => (int)ModConfig.UfoAbduction.Uses.Value; public override float DefaultPoolWeight => 8f; public override Key GiveKey => ModConfig.UfoAbduction.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 4f, 0 => 4f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { UfoAbductionNetworkBridge component = ((Component)inventory).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.ClientUse(); } } } public struct UfoAbductionLockOnMessage : NetworkMessage { public uint TargetNetId; } public static class UfoAbductionLockOnMessageSerialization { public static void WriteUfoAbductionLockOnMessage(NetworkWriter writer, UfoAbductionLockOnMessage msg) { NetworkWriterExtensions.WriteUInt(writer, msg.TargetNetId); } public static UfoAbductionLockOnMessage ReadUfoAbductionLockOnMessage(NetworkReader reader) { return new UfoAbductionLockOnMessage { TargetNetId = NetworkReaderExtensions.ReadUInt(reader) }; } } public struct UfoAbductionDropoffSelectedMessage : NetworkMessage { public Vector3 Destination; } public static class UfoAbductionDropoffSelectedMessageSerialization { public static void WriteUfoAbductionDropoffSelectedMessage(NetworkWriter writer, UfoAbductionDropoffSelectedMessage msg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.Destination); } public static UfoAbductionDropoffSelectedMessage ReadUfoAbductionDropoffSelectedMessage(NetworkReader reader) { //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) return new UfoAbductionDropoffSelectedMessage { Destination = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct UfoAbductionDropoffCancelledMessage : NetworkMessage { } public static class UfoAbductionDropoffCancelledMessageSerialization { public static void WriteUfoAbductionDropoffCancelledMessage(NetworkWriter writer, UfoAbductionDropoffCancelledMessage msg) { } public static UfoAbductionDropoffCancelledMessage ReadUfoAbductionDropoffCancelledMessage(NetworkReader reader) { return default(UfoAbductionDropoffCancelledMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct UfoAbductionBusyMessage : NetworkMessage { } public static class UfoAbductionBusyMessageSerialization { public static void WriteUfoAbductionBusyMessage(NetworkWriter writer, UfoAbductionBusyMessage msg) { } public static UfoAbductionBusyMessage ReadUfoAbductionBusyMessage(NetworkReader reader) { return default(UfoAbductionBusyMessage); } } public struct UfoAbductionTargetAcquiredMessage : NetworkMessage { public Vector3 VictimPos; } public static class UfoAbductionTargetAcquiredMessageSerialization { public static void WriteUfoAbductionTargetAcquiredMessage(NetworkWriter writer, UfoAbductionTargetAcquiredMessage msg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(writer, msg.VictimPos); } public static UfoAbductionTargetAcquiredMessage ReadUfoAbductionTargetAcquiredMessage(NetworkReader reader) { //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) return new UfoAbductionTargetAcquiredMessage { VictimPos = NetworkReaderExtensions.ReadVector3(reader) }; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct UfoAbductionBeingTargetedMessage : NetworkMessage { } public static class UfoAbductionBeingTargetedMessageSerialization { public static void WriteUfoAbductionBeingTargetedMessage(NetworkWriter writer, UfoAbductionBeingTargetedMessage msg) { } public static UfoAbductionBeingTargetedMessage ReadUfoAbductionBeingTargetedMessage(NetworkReader reader) { return default(UfoAbductionBeingTargetedMessage); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct UfoAbductionSessionAbortedMessage : NetworkMessage { } public static class UfoAbductionSessionAbortedMessageSerialization { public static void WriteUfoAbductionSessionAbortedMessage(NetworkWriter writer, UfoAbductionSessionAbortedMessage msg) { } public static UfoAbductionSessionAbortedMessage ReadUfoAbductionSessionAbortedMessage(NetworkReader reader) { return default(UfoAbductionSessionAbortedMessage); } } public struct UfoAbductionBeginMessage : NetworkMessage { public uint WielderNetId; public uint VictimNetId; public Vector3 UfoSpawnPos; public Vector3 HoverPos; public Vector3 DropoffPos; public float ApproachDuration; public float AbductionDuration; public float TransitDuration; public float MaxPullSpeed; public float NaturalLength; public float ExplosionForce; public float ExplosionRadius; public float HoverHeight; } public static class UfoAbductionBeginMessageSerialization { public static void WriteUfoAbductionBeginMessage(NetworkWriter writer, UfoAbductionBeginMessage msg) { //IL_001d: 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_0037: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.WielderNetId); NetworkWriterExtensions.WriteUInt(writer, msg.VictimNetId); NetworkWriterExtensions.WriteVector3(writer, msg.UfoSpawnPos); NetworkWriterExtensions.WriteVector3(writer, msg.HoverPos); NetworkWriterExtensions.WriteVector3(writer, msg.DropoffPos); NetworkWriterExtensions.WriteFloat(writer, msg.ApproachDuration); NetworkWriterExtensions.WriteFloat(writer, msg.AbductionDuration); NetworkWriterExtensions.WriteFloat(writer, msg.TransitDuration); NetworkWriterExtensions.WriteFloat(writer, msg.MaxPullSpeed); NetworkWriterExtensions.WriteFloat(writer, msg.NaturalLength); NetworkWriterExtensions.WriteFloat(writer, msg.ExplosionForce); NetworkWriterExtensions.WriteFloat(writer, msg.ExplosionRadius); NetworkWriterExtensions.WriteFloat(writer, msg.HoverHeight); } public static UfoAbductionBeginMessage ReadUfoAbductionBeginMessage(NetworkReader reader) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0044: Unknown result type (might be due to invalid IL or missing references) return new UfoAbductionBeginMessage { WielderNetId = NetworkReaderExtensions.ReadUInt(reader), VictimNetId = NetworkReaderExtensions.ReadUInt(reader), UfoSpawnPos = NetworkReaderExtensions.ReadVector3(reader), HoverPos = NetworkReaderExtensions.ReadVector3(reader), DropoffPos = NetworkReaderExtensions.ReadVector3(reader), ApproachDuration = NetworkReaderExtensions.ReadFloat(reader), AbductionDuration = NetworkReaderExtensions.ReadFloat(reader), TransitDuration = NetworkReaderExtensions.ReadFloat(reader), MaxPullSpeed = NetworkReaderExtensions.ReadFloat(reader), NaturalLength = NetworkReaderExtensions.ReadFloat(reader), ExplosionForce = NetworkReaderExtensions.ReadFloat(reader), ExplosionRadius = NetworkReaderExtensions.ReadFloat(reader), HoverHeight = NetworkReaderExtensions.ReadFloat(reader) }; } } public struct UfoAbductionEndMessage : NetworkMessage { public uint VictimNetId; public Vector3 ExplosionPos; public float ExplosionForce; public float ExplosionRadius; } public static class UfoAbductionEndMessageSerialization { public static void WriteUfoAbductionEndMessage(NetworkWriter writer, UfoAbductionEndMessage msg) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteUInt(writer, msg.VictimNetId); NetworkWriterExtensions.WriteVector3(writer, msg.ExplosionPos); NetworkWriterExtensions.WriteFloat(writer, msg.ExplosionForce); NetworkWriterExtensions.WriteFloat(writer, msg.ExplosionRadius); } public static UfoAbductionEndMessage ReadUfoAbductionEndMessage(NetworkReader reader) { //IL_0018: 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) return new UfoAbductionEndMessage { VictimNetId = NetworkReaderExtensions.ReadUInt(reader), ExplosionPos = NetworkReaderExtensions.ReadVector3(reader), ExplosionForce = NetworkReaderExtensions.ReadFloat(reader), ExplosionRadius = NetworkReaderExtensions.ReadFloat(reader) }; } } public class UfoAbductionNetworkBridge : NetworkBridgeBase { private bool _serverSessionActive; private bool _serverWaitingForDropoff; private NetworkConnectionToClient _wielderConn; private PlayerInfo _targetInfo; private uint _victimNetId; private Coroutine _serverCoroutine; private Coroutine _serverDropoffTimeoutCoroutine; private int _wielderSlot = -1; private Vector3 _serverExplosionPos; private bool _wasOwned; private void Update() { if (((NetworkBehaviour)this).isOwned) { UfoAbductionClientLogic.UpdateAll(); } } public override void OnStartClient() { _wasOwned = ((NetworkBehaviour)this).isOwned; } public override void OnStopClient() { if (((NetworkBehaviour)this).isOwned) { UfoAbductionTargeting.CancelSelection(); } } private void OnDestroy() { if (_wasOwned) { UfoAbductionTargeting.CancelSelection(); } } public void ClientUse() { if (((NetworkBehaviour)this).isOwned) { NetworkIdentity val = UfoAbductionOverlay.Instance?.BestTargetIdentity; if ((Object)(object)val == (Object)null) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] ClientUse: no valid target in cone."); return; } IssaPluginPlugin.Log.LogInfo((object)$"[UfoAbduction] ClientUse: targeting netId={val.netId}."); NetworkClient.Send(new UfoAbductionLockOnMessage { TargetNetId = val.netId }, 0); } } public void ServerHandleLockOn(NetworkConnectionToClient conn, UfoAbductionLockOnMessage msg) { //IL_0060: 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_0233: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } if (!GlobalSessionLock.TryAcquire(this)) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Server: session busy — rejecting lock-on."); ((NetworkConnection)conn).Send(default(UfoAbductionBusyMessage), 0); return; } PlayerInventory component = ((Component)this).GetComponent(); int num = (((Object)(object)component != (Object)null) ? ItemRegistry.FindSlotIndex(component, ItemRegistry.UfoAbductionItemType) : (-1)); if (num < 0) { IssaPluginPlugin.Log.LogWarning((object)"[UfoAbduction] Server: wielder does not have UFO Abduction."); GlobalSessionLock.Release(); return; } _wielderSlot = num; if (!NetworkServer.spawned.TryGetValue(msg.TargetNetId, out var value)) { IssaPluginPlugin.Log.LogWarning((object)$"[UfoAbduction] Server: target netId={msg.TargetNetId} not found."); GlobalSessionLock.Release(); _wielderSlot = -1; return; } PlayerInfo componentInParent = ((Component)value).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { IssaPluginPlugin.Log.LogWarning((object)"[UfoAbduction] Server: target is not a player."); GlobalSessionLock.Release(); _wielderSlot = -1; return; } if (NetworkServer.connections.Count > 1 && (Object)(object)value == (Object)(object)((Component)this).GetComponent()) { IssaPluginPlugin.Log.LogWarning((object)"[UfoAbduction] Server: self-targeting rejected."); GlobalSessionLock.Release(); _wielderSlot = -1; return; } if (componentInParent.IsElectromagnetShieldActive) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Server: target has electromagnetic shield — rejecting."); GlobalSessionLock.Release(); _wielderSlot = -1; Vector3 val = ((Component)componentInParent).transform.position - ((Component)this).transform.position; componentInParent.PlayElectromagnetShieldHitForAllClients(((Vector3)(ref val)).normalized, false); return; } _serverWaitingForDropoff = true; _wielderConn = conn; _targetInfo = componentInParent; _serverDropoffTimeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ServerDropoffTimeoutCoroutine()); IssaPluginPlugin.Log.LogInfo((object)$"[UfoAbduction] Server: target acquired. wielder={((Component)this).GetComponent().netId} victim={value.netId}"); ((NetworkConnection)conn).Send(new UfoAbductionTargetAcquiredMessage { VictimPos = ((Component)componentInParent).transform.position }, 0); if (value.isLocalPlayer) { HandleBeingTargeted(default(UfoAbductionBeingTargetedMessage)); return; } NetworkConnectionToClient connectionToClient = value.connectionToClient; if (connectionToClient != null) { ((NetworkConnection)connectionToClient).Send(default(UfoAbductionBeingTargetedMessage), 0); } } public void ServerHandleDropoffSelected(NetworkConnectionToClient conn, UfoAbductionDropoffSelectedMessage msg) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).isServer && _serverWaitingForDropoff && conn == _wielderConn) { uint num = (_victimNetId = ((Component)_targetInfo).GetComponent().netId); if (!NetworkServer.spawned.ContainsKey(num)) { IssaPluginPlugin.Log.LogWarning((object)"[UfoAbduction] Server: victim disconnected before drop-off selected — aborting."); ServerAbortWaiting(); return; } ((MonoBehaviour)this).StopCoroutine(_serverDropoffTimeoutCoroutine); _serverDropoffTimeoutCoroutine = null; _serverWaitingForDropoff = false; _serverSessionActive = true; _serverExplosionPos = msg.Destination; Vector3 position = ((Component)_targetInfo).transform.position; float value = ModConfig.UfoAbduction.HoverHeight.Value; Vector3 hoverPos = position + Vector3.up * value; Vector3 dropoffPos = msg.Destination + Vector3.up * ModConfig.UfoAbduction.DropHeight.Value; float num2 = Random.Range(0f, 360f) * (MathF.PI / 180f); Vector3 ufoSpawnPos = position + new Vector3(Mathf.Cos(num2) * 40f, value + 30f, Mathf.Sin(num2) * 40f); uint netId = ((Component)this).GetComponent().netId; float value2 = ModConfig.UfoAbduction.ApproachDuration.Value; float value3 = ModConfig.UfoAbduction.AbductionDuration.Value; float value4 = ModConfig.UfoAbduction.AscentDuration.Value; IssaPluginPlugin.Log.LogInfo((object)$"[UfoAbduction] Server: session started. wielder={netId} victim={num} dropoff={msg.Destination}"); NetworkServer.SendToAll(new UfoAbductionBeginMessage { WielderNetId = netId, VictimNetId = num, UfoSpawnPos = ufoSpawnPos, HoverPos = hoverPos, DropoffPos = dropoffPos, ApproachDuration = value2, AbductionDuration = value3, TransitDuration = value4, MaxPullSpeed = ModConfig.UfoAbduction.MaxPullSpeed.Value, NaturalLength = ModConfig.UfoAbduction.NaturalLength.Value, ExplosionForce = ModConfig.UfoAbduction.ExplosionForce.Value, ExplosionRadius = ModConfig.UfoAbduction.ExplosionRadius.Value, HoverHeight = value }, 0, false); float duration = value2 + value3 + value4; _serverCoroutine = ((MonoBehaviour)this).StartCoroutine(ServerSessionCoroutine(duration)); } } public void ServerHandleDropoffCancelled(NetworkConnectionToClient conn, UfoAbductionDropoffCancelledMessage msg) { if (((NetworkBehaviour)this).isServer && _serverWaitingForDropoff && conn == _wielderConn) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Server: wielder cancelled drop-off selection."); ServerAbortWaiting(); } } private void ServerAbortWaiting() { _serverWaitingForDropoff = false; if (_serverDropoffTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverDropoffTimeoutCoroutine); _serverDropoffTimeoutCoroutine = null; } NetworkServer.SendToAll(default(UfoAbductionSessionAbortedMessage), 0, false); GlobalSessionLock.Release(); _wielderConn = null; _targetInfo = null; _wielderSlot = -1; } private IEnumerator ServerDropoffTimeoutCoroutine() { yield return (object)new WaitForSeconds(ModConfig.UfoAbduction.DropoffSelectionTimeout.Value); if (_serverWaitingForDropoff) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Server: drop-off selection timed out."); ServerAbortWaiting(); } } private IEnumerator ServerSessionCoroutine(float duration) { yield return (object)new WaitForSeconds(duration); if (_serverSessionActive) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Server: session ended — applying explosion."); ServerEndSession(); } } private void ServerEndSession() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!_serverSessionActive) { return; } _serverSessionActive = false; float value = ModConfig.UfoAbduction.ExplosionForce.Value; float value2 = ModConfig.UfoAbduction.ExplosionRadius.Value; Collider[] array = Physics.OverlapSphere(_serverExplosionPos, value2); Collider[] array2 = array; foreach (Collider val in array2) { Rigidbody attachedRigidbody = val.attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null) && !attachedRigidbody.isKinematic && !((Object)(object)((Component)val).GetComponentInParent() != (Object)null)) { attachedRigidbody.AddExplosionForce(value, _serverExplosionPos, value2, 0.5f, (ForceMode)2); } } if (_wielderSlot >= 0) { PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { ItemHelper.SetCurrentItemUse(component, (ItemUseType)1); ItemHelper.DecrementAndRemove(component, _wielderSlot); ItemHelper.SetCurrentItemUse(component, (ItemUseType)0); } } _wielderSlot = -1; NetworkServer.SendToAll(new UfoAbductionEndMessage { VictimNetId = _victimNetId, ExplosionPos = _serverExplosionPos, ExplosionForce = value, ExplosionRadius = value2 }, 0, false); GlobalSessionLock.Release(); if (_serverCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverCoroutine); _serverCoroutine = null; } _wielderConn = null; _targetInfo = null; _victimNetId = 0u; } public static void HandleBusy(UfoAbductionBusyMessage msg) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Session busy — another UFO abduction is already active."); UfoAbductionOverlay.Instance?.ShowBusy(); } public static void HandleTargetAcquired(UfoAbductionTargetAcquiredMessage msg) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerInfo localPlayerInfo = GameManager.LocalPlayerInfo; PlayerMovement val = ((localPlayerInfo != null) ? localPlayerInfo.Movement : null); if (!((Object)(object)val == (Object)null)) { ((MonoBehaviour)val).StartCoroutine(UfoAbductionTargeting.BeginDropoffSelectionRoutine(msg.VictimPos)); } } public static void HandleBeingTargeted(UfoAbductionBeingTargetedMessage msg) { UfoAbductionOverlay.Instance?.ShowBeingTargeted(); } public static void HandleSessionAborted(UfoAbductionSessionAbortedMessage msg) { bool isSelectingDropoff = UfoAbductionTargeting.IsSelectingDropoff; UfoAbductionTargeting.CancelSelection(); UfoAbductionOverlay.Instance?.ClearBeingTargeted(); if (isSelectingDropoff) { UfoAbductionOverlay.Instance?.ShowAborted(); } } public override void ServerHoleCleanup() { if (_serverWaitingForDropoff) { ServerAbortWaiting(); } if (_serverSessionActive) { ServerEndSession(); } if (_serverCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_serverCoroutine); _serverCoroutine = null; } } public override void OnStopServer() { ServerHoleCleanup(); } public override void ClientHoleCleanup() { UfoAbductionClientLogic.ClearAll(); UfoAbductionTargeting.CancelSelection(); } } public static class UfoAbductionTargeting { private static bool _isSelectingDropoff; private static bool _selectionCancelled; public static bool IsSelectingDropoff => _isSelectingDropoff; public static void CancelSelection() { _selectionCancelled = true; } public static IEnumerator BeginDropoffSelectionRoutine(Vector3 victimPos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!_isSelectingDropoff) { yield return RunSelectionPhase(victimPos); } } private static IEnumerator RunSelectionPhase(Vector3 victimPos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) _isSelectingDropoff = true; _selectionCancelled = false; GameplayActions gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Disable(); OrbitCameraModule orbitModule = null; CameraModuleController.TryGetOrbitModule(ref orbitModule); OrbitCameraModule obj = orbitModule; float savedPitch = ((obj != null) ? obj.Pitch : 0f); OrbitCameraModule obj2 = orbitModule; float savedYaw = ((obj2 != null) ? obj2.Yaw : 0f); bool savedDisablePhysics = false; float snappedY = ItemHelper.SampleTerrainY(victimPos.x, victimPos.z, victimPos.y); Vector3 markerStartPos = new Vector3(victimPos.x, snappedY, victimPos.z); GameObject pivotGo = new GameObject("UfoAbductionDropoffPivot"); pivotGo.transform.position = victimPos; GameObject markerGo = CreateMarkerVisual(markerStartPos); float currentDistanceAddition = 25f; float zoomSpeed = ModConfig.StealthBomber.TargetingZoomSpeed.Value; if ((Object)(object)orbitModule != (Object)null) { savedDisablePhysics = orbitModule.disablePhysics; orbitModule.SetSubject(pivotGo.transform); orbitModule.SetPitch(88f); orbitModule.SetDistanceAddition(currentDistanceAddition); orbitModule.disablePhysics = true; orbitModule.ForceUpdateModule(); } yield return null; float moveSpeed = ModConfig.Teleporter.TargetMoveSpeed.Value; bool confirmed = false; bool cancelled = false; while (!confirmed && !cancelled && !_selectionCancelled) { Keyboard keyboard = Keyboard.current; Mouse mouse = Mouse.current; if (keyboard == null) { yield return null; continue; } HandleMarkerMovement(keyboard, orbitModule, moveSpeed, markerGo, pivotGo); if ((Object)(object)orbitModule != (Object)null && mouse != null) { float scroll = ((InputControl)(object)mouse.scroll).ReadValue().y; if (scroll != 0f) { float zoomStep = Mathf.Sign(scroll) * zoomSpeed; currentDistanceAddition -= zoomStep; currentDistanceAddition = Mathf.Clamp(currentDistanceAddition, 1f, 2000f); orbitModule.SetDistanceAddition(currentDistanceAddition); } } if (((ButtonControl)keyboard[(Key)2]).wasPressedThisFrame || (mouse != null && mouse.leftButton.wasPressedThisFrame)) { confirmed = true; } if (((ButtonControl)keyboard[(Key)1]).wasPressedThisFrame || (mouse != null && mouse.rightButton.wasPressedThisFrame)) { cancelled = true; } yield return null; } Vector3 markerPos = markerGo.transform.position; Object.Destroy((Object)(object)markerGo); Object.Destroy((Object)(object)pivotGo); _isSelectingDropoff = false; RestoreCamera(orbitModule, savedPitch, savedYaw, savedDisablePhysics); gameplay = InputManager.Controls.Gameplay; ((GameplayActions)(ref gameplay)).Enable(); if (confirmed) { IssaPluginPlugin.Log.LogInfo((object)$"[UfoAbduction] Targeting: drop zone confirmed at {markerPos}."); NetworkClient.Send(new UfoAbductionDropoffSelectedMessage { Destination = markerPos }, 0); } else if (cancelled) { IssaPluginPlugin.Log.LogInfo((object)"[UfoAbduction] Targeting: wielder cancelled."); NetworkClient.Send(default(UfoAbductionDropoffCancelledMessage), 0); } } private static void HandleMarkerMovement(Keyboard keyboard, OrbitCameraModule orbitModule, float moveSpeed, GameObject markerGo, GameObject pivotGo) { //IL_00df: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = 0f; if (((ButtonControl)keyboard[(Key)37]).isPressed || ((ButtonControl)keyboard[(Key)63]).isPressed) { num2 += 1f; } if (((ButtonControl)keyboard[(Key)33]).isPressed || ((ButtonControl)keyboard[(Key)64]).isPressed) { num2 -= 1f; } if (((ButtonControl)keyboard[(Key)15]).isPressed || ((ButtonControl)keyboard[(Key)61]).isPressed) { num -= 1f; } if (((ButtonControl)keyboard[(Key)18]).isPressed || ((ButtonControl)keyboard[(Key)62]).isPressed) { num += 1f; } if (num != 0f || num2 != 0f) { Vector3 forward = Vector3.forward; Vector3 right = Vector3.right; if ((Object)(object)orbitModule != (Object)null) { float num3 = orbitModule.Yaw * (MathF.PI / 180f); ((Vector3)(ref forward))..ctor(Mathf.Sin(num3), 0f, Mathf.Cos(num3)); ((Vector3)(ref right))..ctor(Mathf.Cos(num3), 0f, 0f - Mathf.Sin(num3)); } Vector3 val = (right * num + forward * num2) * moveSpeed * Time.deltaTime; Vector3 val2 = markerGo.transform.position + val; val2.y = ItemHelper.SampleTerrainY(val2.x, val2.z, markerGo.transform.position.y); markerGo.transform.position = val2; pivotGo.transform.position = new Vector3(val2.x, pivotGo.transform.position.y, val2.z); } } private static GameObject CreateMarkerVisual(Vector3 center) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_0125: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("UfoAbductionDropoffMarker"); val.transform.position = center; float value = ModConfig.Teleporter.MarkerRadius.Value; CreateMarkerPart(val.transform, "MarkerDisc", Vector3.zero, new Vector3(value * 2f, 0.15f, value * 2f), new Color(0.2f, 1f, 0.4f, 0.35f)); CreateMarkerPart(val.transform, "MarkerRing", new Vector3(0f, 0.08f, 0f), new Vector3(value * 2f + 1.5f, 0.1f, value * 2f + 1.5f), new Color(0.4f, 1f, 0.6f, 0.55f)); float num = value * 0.55f; float num2 = Mathf.Max(value * 0.07f, 0.4f); Color color = default(Color); ((Color)(ref color))..ctor(0.5f, 1f, 0.7f, 0.7f); CreateMarkerPart(val.transform, "TickN", new Vector3(0f, 0.2f, value + num * 0.5f), new Vector3(num2, 0.2f, num), color); CreateMarkerPart(val.transform, "TickS", new Vector3(0f, 0.2f, 0f - (value + num * 0.5f)), new Vector3(num2, 0.2f, num), color); CreateMarkerPart(val.transform, "TickE", new Vector3(value + num * 0.5f, 0.2f, 0f), new Vector3(num, 0.2f, num2), color); CreateMarkerPart(val.transform, "TickW", new Vector3(0f - (value + num * 0.5f), 0.2f, 0f), new Vector3(num, 0.2f, num2), color); return val; } private static GameObject CreateMarkerPart(Transform parent, string name, Vector3 localPos, Vector3 localScale, Color color) { //IL_0039: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) GameObject val = (name.StartsWith("Tick") ? GameObject.CreatePrimitive((PrimitiveType)3) : GameObject.CreatePrimitive((PrimitiveType)2)); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localScale = localScale; Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Shader val2 = Shader.Find("Sprites/Default") ?? Shader.Find("UI/Default") ?? Shader.Find("Unlit/Color"); Material val3 = new Material(val2); val3.color = color; val3.SetInt("_ZTest", 8); val3.SetInt("_ZWrite", 0); val3.renderQueue = 3100; component2.material = val3; } return val; } private static void RestoreCamera(OrbitCameraModule orbitModule, float savedPitch, float savedYaw, bool savedDisablePhysics) { if (!((Object)(object)orbitModule == (Object)null)) { PlayerMovement localPlayerMovement = GameManager.LocalPlayerMovement; if ((Object)(object)localPlayerMovement != (Object)null) { orbitModule.SetSubject(((Component)localPlayerMovement).transform); } orbitModule.SetDistanceAddition(0f); orbitModule.disablePhysics = savedDisablePhysics; orbitModule.SetPitch(savedPitch); orbitModule.SetYaw(savedYaw); orbitModule.ForceUpdateModule(); } } } public class WindStormItemDefinition : CustomItemDefinition { public override ItemType ItemType => ItemRegistry.WindStormItemType; public override string DisplayName => "Wind Storm"; public override string[] ConsoleAliases => new string[3] { "windstorm", "storm", "wind" }; public override Sprite Icon => AssetLoader.WindStormIcon; public override bool UseRocketIconFallback => false; public override GameObject HeldModelPrefab => AssetLoader.WindStormModelPrefab; public override int MaxUses => (int)ModConfig.WindStorm.Uses.Value; public override float DefaultPoolWeight => 5f; public override Key GiveKey => ModConfig.WindStorm.GiveKey.Value; public override float GetDefaultPoolWeight(int poolIndex) { if (1 == 0) { } float result = poolIndex switch { 1 => 1f, 0 => 2f, _ => DefaultPoolWeight, }; if (1 == 0) { } return result; } public override void OnUse(PlayerInventory inventory) { NetworkClient.Send(default(WindStormActivateMessage), 0); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct WindStormActivateMessage : NetworkMessage { } public struct WindStormBeginMessage : NetworkMessage { public uint ActivatorNetId; public float Duration; public int StormSpeed; } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct WindStormEndMessage : NetworkMessage { } public static class WindStormMessageSerialization { public static void WriteActivate(NetworkWriter w, WindStormActivateMessage m) { } public static WindStormActivateMessage ReadActivate(NetworkReader r) { return default(WindStormActivateMessage); } public static void WriteBegin(NetworkWriter w, WindStormBeginMessage m) { NetworkWriterExtensions.WriteUInt(w, m.ActivatorNetId); NetworkWriterExtensions.WriteFloat(w, m.Duration); NetworkWriterExtensions.WriteInt(w, m.StormSpeed); } public static WindStormBeginMessage ReadBegin(NetworkReader r) { return new WindStormBeginMessage { ActivatorNetId = NetworkReaderExtensions.ReadUInt(r), Duration = NetworkReaderExtensions.ReadFloat(r), StormSpeed = NetworkReaderExtensions.ReadInt(r) }; } public static void WriteEnd(NetworkWriter w, WindStormEndMessage m) { } public static WindStormEndMessage ReadEnd(NetworkReader r) { return default(WindStormEndMessage); } } public class WindStormNetworkBridge : NetworkBridgeBase { private static bool _globalSessionActive; private static Coroutine _timeoutCoroutine; private static WindStormNetworkBridge _activeInstance; private static int _savedWindSpeed; private static int _savedWindAngle; public static readonly HashSet WindImmuneNetIds = new HashSet(); public static bool IsSessionActive => _globalSessionActive; public void ServerActivate() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).isServer) { return; } if (_globalSessionActive) { IssaPluginPlugin.Log.LogWarning((object)"[WindStorm] A session is already active."); return; } PlayerInventory component = ((Component)this).GetComponent(); if ((Object)(object)component == (Object)null) { return; } if (component.GetEffectivelyEquippedItem(true) != ItemRegistry.WindStormItemType) { IssaPluginPlugin.Log.LogWarning((object)"[WindStorm] Player does not have Wind Storm item equipped."); return; } ItemHelper.ConsumeEquippedItem(component); _globalSessionActive = true; _activeInstance = this; _savedWindSpeed = WindManager.CurrentWindSpeed; if (SingletonNetworkBehaviour.HasInstance) { _savedWindAngle = SingletonNetworkBehaviour.Instance.NetworkcurrentWindAngle; } int num = (int)ModConfig.WindStorm.StormSpeed.Value; int num2 = Random.Range(0, 360); if (SingletonNetworkBehaviour.HasInstance) { SingletonNetworkBehaviour.Instance.NetworkcurrentWindSpeed = num; SingletonNetworkBehaviour.Instance.NetworkcurrentWindAngle = num2; } float value = ModConfig.WindStorm.Duration.Value; NetworkServer.SendToAll(new WindStormBeginMessage { ActivatorNetId = (ModConfig.WindStorm.ExcludeActivator.Value ? ((NetworkBehaviour)this).netId : 0u), Duration = value, StormSpeed = num }, 0, false); _timeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ServerStormRoutine(value, num2)); IssaPluginPlugin.Log.LogInfo((object)$"[WindStorm] Session started: speed={num}, angle={num2}, duration={value}s."); } public static void HandleBegin(WindStormBeginMessage msg) { _globalSessionActive = true; if (msg.ActivatorNetId != 0) { WindImmuneNetIds.Add(msg.ActivatorNetId); } WindStormOverlay.Instance?.SetActive(active: true, msg.Duration); IssaPluginPlugin.Log.LogInfo((object)$"[WindStorm] Storm began: speed={msg.StormSpeed}, immune netId={msg.ActivatorNetId}."); } public static void HandleEnd(WindStormEndMessage msg) { _globalSessionActive = false; WindImmuneNetIds.Clear(); WindStormOverlay.Instance?.SetActive(active: false); IssaPluginPlugin.Log.LogInfo((object)"[WindStorm] Storm ended."); } private IEnumerator ServerStormRoutine(float duration, int initialAngle) { float elapsed = 0f; float interval = ModConfig.WindStorm.DirectionChangeInterval.Value; int range = (int)ModConfig.WindStorm.DirectionChangeRange.Value; int angle = initialAngle; while (elapsed < duration) { float waitTime = Mathf.Min(interval, duration - elapsed); yield return (object)new WaitForSeconds(waitTime); elapsed += waitTime; if (!_globalSessionActive) { yield break; } if (elapsed < duration && SingletonNetworkBehaviour.HasInstance) { angle = (angle + Random.Range(-range, range + 1) + 360) % 360; SingletonNetworkBehaviour.Instance.NetworkcurrentWindAngle = angle; } } if (SingletonNetworkBehaviour.HasInstance) { SingletonNetworkBehaviour.Instance.NetworkcurrentWindSpeed = _savedWindSpeed; SingletonNetworkBehaviour.Instance.NetworkcurrentWindAngle = _savedWindAngle; } NetworkServer.SendToAll(default(WindStormEndMessage), 0, false); _globalSessionActive = false; _activeInstance = null; _timeoutCoroutine = null; IssaPluginPlugin.Log.LogInfo((object)"[WindStorm] Session ended, wind restored."); } public static void GlobalServerHoleCleanup() { if (_globalSessionActive) { if (_timeoutCoroutine != null && (Object)(object)_activeInstance != (Object)null) { ((MonoBehaviour)_activeInstance).StopCoroutine(_timeoutCoroutine); } _timeoutCoroutine = null; _activeInstance = null; if (SingletonNetworkBehaviour.HasInstance) { SingletonNetworkBehaviour.Instance.NetworkcurrentWindSpeed = _savedWindSpeed; SingletonNetworkBehaviour.Instance.NetworkcurrentWindAngle = _savedWindAngle; } NetworkServer.SendToAll(default(WindStormEndMessage), 0, false); _globalSessionActive = false; IssaPluginPlugin.Log.LogInfo((object)"[WindStorm] Session force-ended for hole transition."); } } public override void ServerHoleCleanup() { GlobalServerHoleCleanup(); } public override void ClientHoleCleanup() { WindImmuneNetIds.Clear(); } public override void OnStopServer() { if (_globalSessionActive) { if (_timeoutCoroutine != null && (Object)(object)_activeInstance != (Object)null) { ((MonoBehaviour)_activeInstance).StopCoroutine(_timeoutCoroutine); } _timeoutCoroutine = null; _activeInstance = null; _globalSessionActive = false; NetworkServer.SendToAll(default(WindStormEndMessage), 0, false); IssaPluginPlugin.Log.LogInfo((object)"[WindStorm] Session ended on server stop."); } } } public struct HitNotificationMessage : NetworkMessage { public string Message; } public static class HitNotificationMessageSerialization { public static void WriteHitNotificationMessage(NetworkWriter writer, HitNotificationMessage msg) { NetworkWriterExtensions.WriteString(writer, msg.Message); } public static HitNotificationMessage ReadHitNotificationMessage(NetworkReader reader) { return new HitNotificationMessage { Message = NetworkReaderExtensions.ReadString(reader) }; } } }