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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalLib.Modules;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
using XIVitems;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mare")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mare")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a1e7220b-a7c4-4bc7-b4ae-60397cbd6e8a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class GunItem : GrabbableObject
{
public AudioSource gunAudio;
public AudioSource gunShootAudio;
public AudioSource gunBulletsRicochetAudio;
private Coroutine gunCoroutine;
public AudioClip[] gunShootSFX;
public float damageScale = 0.5f;
public int shotsPerCharge = 4;
private float chargePerShot;
private bool hasHitGroundWithSafetyOff = true;
private bool localClientSendingShootGunRPC;
private PlayerControllerB previousPlayerHeldBy;
public ParticleSystem gunShootParticle;
public Transform shotgunRayPoint;
private RaycastHit[] enemyColliders;
private EnemyAI heldByEnemy;
public override void Start()
{
((GrabbableObject)this).Start();
chargePerShot = 1f / (float)shotsPerCharge;
}
public override void Update()
{
((GrabbableObject)this).Update();
if (((NetworkBehaviour)this).IsOwner && !((Object)(object)heldByEnemy != (Object)null) && !base.isPocketed)
{
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
previousPlayerHeldBy = base.playerHeldBy;
previousPlayerHeldBy.equippedUsableItemQE = true;
hasHitGroundWithSafetyOff = false;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (((NetworkBehaviour)this).IsOwner && !base.insertedBattery.empty && base.insertedBattery.charge >= chargePerShot)
{
Debug.Log((object)("before: " + base.insertedBattery.charge));
ShootGunAndSync(heldByPlayer: true);
base.insertedBattery.charge = Mathf.Clamp(base.insertedBattery.charge - chargePerShot, 0f, 1f);
Debug.Log((object)("after: " + base.insertedBattery.charge));
}
}
public void ShootGunAndSync(bool heldByPlayer)
{
//IL_003a: 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_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_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_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_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_00aa: 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)
Vector3 shotgunPosition;
Vector3 forward;
if (!heldByPlayer)
{
shotgunPosition = shotgunRayPoint.position;
forward = shotgunRayPoint.forward;
}
else
{
shotgunPosition = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position - ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.45f;
forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward;
}
Debug.Log((object)"Calling shoot gun....");
ShootGun(shotgunPosition, forward);
Debug.Log((object)"Calling shoot gun and sync");
localClientSendingShootGunRPC = true;
ShootGunServerRpc(shotgunPosition, forward);
}
[ServerRpc(RequireOwnership = false)]
public void ShootGunServerRpc(Vector3 shotgunPosition, Vector3 shotgunForward)
{
//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)
ShootGunClientRpc(shotgunPosition, shotgunForward);
}
[ClientRpc]
public void ShootGunClientRpc(Vector3 shotgunPosition, Vector3 shotgunForward)
{
//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)
Debug.Log((object)"Shoot gun client rpc received");
if (localClientSendingShootGunRPC)
{
localClientSendingShootGunRPC = false;
Debug.Log((object)"localClientSendingShootGunRPC was true");
}
else
{
ShootGun(shotgunPosition, shotgunForward);
}
}
public void ShootGun(Vector3 shotgunPosition, Vector3 shotgunForward)
{
//IL_00bd: 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_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_00f5: 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_010a: 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_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_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: 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_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: 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_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: 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_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: 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_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_047a: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
base.playerHeldBy.playerBodyAnimator.SetTrigger("ShootShotgun");
flag = true;
}
RoundManager.PlayRandomClip(gunShootAudio, gunShootSFX, true, 1f, 1840, 1000);
WalkieTalkie.TransmitOneShotAudio(gunShootAudio, gunShootSFX[0], 1f);
gunShootParticle.Play(true);
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if ((Object)(object)localPlayerController == (Object)null)
{
return;
}
float num = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)shotgunRayPoint).transform.position);
bool flag2 = false;
int num2 = 0;
float num3 = 0f;
Vector3 val = localPlayerController.playerCollider.ClosestPoint(shotgunPosition);
if (!flag && !Physics.Linecast(shotgunPosition, val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Vector3.Angle(shotgunForward, val - shotgunPosition) < 30f)
{
flag2 = true;
}
if (num < 5f)
{
num3 = 0.8f;
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
num2 = (int)(100f * damageScale);
}
if (num < 15f)
{
num3 = 0.5f;
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
num2 = (int)(100f * damageScale);
}
else if (num < 23f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
num2 = (int)(40f * damageScale);
}
else if (num < 30f)
{
num2 = (int)(20f * damageScale);
}
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(shotgunPosition, shotgunForward);
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val2, ref val3, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
((Component)gunBulletsRicochetAudio).transform.position = ((Ray)(ref val2)).GetPoint(((RaycastHit)(ref val3)).distance - 0.5f);
gunBulletsRicochetAudio.Play();
}
if (flag2)
{
Debug.Log((object)$"Dealing {num2} damage to player");
localPlayerController.DamagePlayer(num2, true, true, (CauseOfDeath)7, 0, false, shotgunRayPoint.forward * 30f);
}
if (enemyColliders == null)
{
enemyColliders = (RaycastHit[])(object)new RaycastHit[10];
}
((Ray)(ref val2))..ctor(shotgunPosition - shotgunForward * 10f, shotgunForward);
int num4 = Physics.SphereCastNonAlloc(val2, 5f, enemyColliders, 15f, 524288, (QueryTriggerInteraction)2);
Debug.Log((object)$"Enemies hit: {num4}");
IHittable val4 = default(IHittable);
for (int i = 0; i < num4; i++)
{
Debug.Log((object)"Raycasting enemy");
if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>()))
{
continue;
}
EnemyAI mainScript = ((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>().mainScript;
if ((Object)(object)heldByEnemy != (Object)null && (Object)(object)heldByEnemy == (Object)(object)mainScript)
{
Debug.Log((object)"Shotgun is held by enemy, skipping enemy raycast");
continue;
}
Debug.Log((object)("Hit enemy " + mainScript.enemyType.enemyName));
if (((RaycastHit)(ref enemyColliders[i])).distance == 0f)
{
Debug.Log((object)"Spherecast started inside enemy collider");
}
else if (Physics.Linecast(shotgunPosition, ((RaycastHit)(ref enemyColliders[i])).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
Debug.DrawRay(((RaycastHit)(ref val3)).point, Vector3.up, Color.red, 15f);
Debug.DrawLine(shotgunPosition, ((RaycastHit)(ref enemyColliders[i])).point, Color.cyan, 15f);
Debug.Log((object)("Raycast hit wall: " + ((Object)((Component)((RaycastHit)(ref val3)).collider).gameObject).name));
}
else if (((Component)((RaycastHit)(ref enemyColliders[i])).transform).TryGetComponent<IHittable>(ref val4))
{
float num5 = Vector3.Distance(shotgunPosition, ((RaycastHit)(ref enemyColliders[i])).point);
int num6 = ((num5 < 3.7f) ? 3 : ((!(num5 < 6f)) ? 1 : 2));
Debug.Log((object)$"Hit enemy, hitDamage: {num6}");
val4.Hit(num6, shotgunForward, base.playerHeldBy, true, -1);
}
else
{
Debug.Log((object)("Could not get hittable script from collider, transform: " + ((Object)((RaycastHit)(ref enemyColliders[i])).transform).name));
Debug.Log((object)("collider: " + ((Object)((RaycastHit)(ref enemyColliders[i])).collider).name));
}
}
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
}
}
public class AzemCrystal : GrabbableObject
{
public bool isInverseTeleporter;
public Transform teleportOutPosition;
[Space(5f)]
public Transform teleporterPosition;
public Animator teleporterAnimator;
public Animator buttonAnimator;
public AudioSource buttonAudio;
public AudioSource shipTeleporterAudio;
public AudioClip buttonPressSFX;
public AudioClip teleporterSpinSFX;
public AudioClip teleporterBeamUpSFX;
public AudioClip beamUpPlayerBodySFX;
private Coroutine beamUpPlayerCoroutine;
public int teleporterId = 1;
private int[] playersBeingTeleported;
private float cooldownTime;
public float cooldownAmount;
public InteractTrigger buttonTrigger;
public static bool hasBeenSpawnedThisSession;
public static bool hasBeenSpawnedThisSessionInverse;
private Random shipTeleporterSeed;
private void Awake()
{
playersBeingTeleported = new int[4] { -1, -1, -1, -1 };
if ((isInverseTeleporter && hasBeenSpawnedThisSessionInverse) || (!isInverseTeleporter && hasBeenSpawnedThisSession))
{
buttonTrigger.interactable = false;
cooldownTime = cooldownAmount;
}
hasBeenSpawnedThisSession = true;
}
private void OnDisable()
{
for (int i = 0; i < playersBeingTeleported.Length; i++)
{
if (playersBeingTeleported[i] == teleporterId)
{
StartOfRound.Instance.allPlayerScripts[playersBeingTeleported[i]].shipTeleporterId = -1;
}
}
}
public void PressTeleportButtonOnLocalClient()
{
if (!isInverseTeleporter || (!StartOfRound.Instance.inShipPhase && SceneManager.sceneCount > 1))
{
PressTeleportButtonServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
public void PressTeleportButtonServerRpc()
{
PressTeleportButtonClientRpc();
}
[ClientRpc]
public void PressTeleportButtonClientRpc()
{
PressButtonEffects();
if (beamUpPlayerCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(beamUpPlayerCoroutine);
}
cooldownTime = cooldownAmount;
buttonTrigger.interactable = false;
beamUpPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(beamUpPlayer());
}
private void PressButtonEffects()
{
buttonAnimator.SetTrigger("press");
buttonAnimator.SetBool("GlassOpen", false);
((Component)buttonAnimator).GetComponentInChildren<AnimatedObjectTrigger>().boolValue = false;
teleporterAnimator.SetTrigger("useTeleporter");
buttonAudio.PlayOneShot(buttonPressSFX);
WalkieTalkie.TransmitOneShotAudio(buttonAudio, buttonPressSFX, 1f);
}
private IEnumerator beamUpPlayer()
{
shipTeleporterAudio.PlayOneShot(teleporterSpinSFX);
PlayerControllerB playerToBeamUp = StartOfRound.Instance.mapScreen.targetedPlayer;
if ((Object)(object)playerToBeamUp == (Object)null)
{
Debug.Log((object)"Targeted player is null");
yield break;
}
if ((Object)(object)playerToBeamUp.redirectToEnemy != (Object)null)
{
Debug.Log((object)$"Attemping to teleport enemy '{((Object)((Component)playerToBeamUp.redirectToEnemy).gameObject).name}' (tied to player #{playerToBeamUp.playerClientId}) to ship.");
if (StartOfRound.Instance.shipIsLeaving)
{
Debug.Log((object)$"Ship could not teleport enemy '{((Object)((Component)playerToBeamUp.redirectToEnemy).gameObject).name}' (tied to player #{playerToBeamUp.playerClientId}) because the ship is leaving the nav mesh.");
}
playerToBeamUp.redirectToEnemy.ShipTeleportEnemy();
yield return (object)new WaitForSeconds(3f);
shipTeleporterAudio.PlayOneShot(teleporterBeamUpSFX);
if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
}
SetPlayerTeleporterId(playerToBeamUp, 1);
if ((Object)(object)playerToBeamUp.deadBody != (Object)null)
{
if ((Object)(object)playerToBeamUp.deadBody.beamUpParticle == (Object)null)
{
yield break;
}
playerToBeamUp.deadBody.beamUpParticle.Play();
playerToBeamUp.deadBody.bodyAudio.PlayOneShot(beamUpPlayerBodySFX);
}
else
{
playerToBeamUp.beamUpParticle.Play();
playerToBeamUp.movementAudio.PlayOneShot(beamUpPlayerBodySFX);
}
Debug.Log((object)"Teleport A");
yield return (object)new WaitForSeconds(3f);
bool flag = false;
if ((Object)(object)playerToBeamUp.deadBody != (Object)null)
{
if ((Object)(object)playerToBeamUp.deadBody.grabBodyObject == (Object)null || !playerToBeamUp.deadBody.grabBodyObject.isHeldByEnemy)
{
flag = true;
playerToBeamUp.deadBody.attachedTo = null;
playerToBeamUp.deadBody.attachedLimb = null;
playerToBeamUp.deadBody.secondaryAttachedLimb = null;
playerToBeamUp.deadBody.secondaryAttachedTo = null;
playerToBeamUp.deadBody.SetRagdollPositionSafely(teleporterPosition.position, true);
((Component)playerToBeamUp.deadBody).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
if ((Object)(object)playerToBeamUp.deadBody.grabBodyObject != (Object)null && playerToBeamUp.deadBody.grabBodyObject.isHeld && (Object)(object)playerToBeamUp.deadBody.grabBodyObject.playerHeldBy != (Object)null)
{
playerToBeamUp.deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false);
}
}
}
else
{
flag = true;
if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
{
Object.FindObjectOfType<AudioReverbPresets>().audioPresets[3].ChangeAudioReverbForPlayer(playerToBeamUp);
}
playerToBeamUp.isInElevator = true;
playerToBeamUp.isInHangarShipRoom = true;
playerToBeamUp.isInsideFactory = false;
playerToBeamUp.averageVelocity = 0f;
playerToBeamUp.velocityLastFrame = Vector3.zero;
playerToBeamUp.TeleportPlayer(teleporterPosition.position, true, 160f, false, true);
}
Debug.Log((object)"Teleport B");
SetPlayerTeleporterId(playerToBeamUp, -1);
if (flag)
{
shipTeleporterAudio.PlayOneShot(teleporterBeamUpSFX);
if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
}
Debug.Log((object)"Teleport C");
}
private void SetPlayerTeleporterId(PlayerControllerB playerScript, int teleporterId)
{
playerScript.shipTeleporterId = teleporterId;
playersBeingTeleported[playerScript.playerClientId] = (int)playerScript.playerClientId;
}
}
public class FireBall : MonoBehaviour
{
private float currentMissileSpeed;
public TwoHandWithProjectile BLMStaffScript;
private bool hitWall = true;
private float despawnTimer;
private float forwardDistance;
private float lastRotationDistance;
private void Start()
{
hitWall = false;
currentMissileSpeed = BLMStaffScript.flySpeed;
}
private void FixedUpdate()
{
//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_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_0071: Unknown result type (might be due to invalid IL or missing references)
if (!hitWall)
{
if (despawnTimer < 5f)
{
despawnTimer += Time.deltaTime;
CheckCollision();
Transform transform = ((Component)this).transform;
transform.position += ((Component)this).transform.forward * BLMStaffScript.flySpeed * currentMissileSpeed;
forwardDistance += BLMStaffScript.flySpeed * currentMissileSpeed;
currentMissileSpeed += 0.05f;
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
private void CheckCollision()
{
//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_0038: 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_0181: 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_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_01a6: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (!Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val, 0.6f * currentMissileSpeed, 526592, (QueryTriggerInteraction)2) && !Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val, 0.6f * currentMissileSpeed, 8, (QueryTriggerInteraction)2))
{
return;
}
Debug.Log((object)((Component)((Component)((RaycastHit)(ref val)).collider).transform).gameObject);
Debug.Log((object)((Component)((RaycastHit)(ref val)).collider).gameObject.layer);
if (((Component)((RaycastHit)(ref val)).collider).gameObject.layer == 19)
{
Debug.Log((object)"Hit Enemy");
EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null && (Object)(object)component.mainScript == (Object)(object)BLMStaffScript)
{
return;
}
}
bool calledByClient = false;
if (((Component)((RaycastHit)(ref val)).collider).gameObject.layer == 3)
{
Debug.Log((object)"Hit Player");
PlayerControllerB component2 = ((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component2 != (Object)null && (Object)(object)component2 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
calledByClient = true;
}
}
hitWall = true;
Debug.Log((object)"Hit wall");
BLMStaffScript.StartExplosion(((Component)this).transform.position - ((Component)this).transform.forward * 0.5f, ((Component)this).transform.forward, calledByClient);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class TwoHandBackflip : GrabbableObject
{
public int shovelHitForce = 1;
public bool reelingUp;
public bool isHoldingButton;
public float flipCooldown = 3f;
private RaycastHit rayHit;
private Coroutine reelingUpCoroutine;
private RaycastHit[] objectsHitByShovel;
private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>();
public AudioClip reelUp;
public AudioClip swing;
public float physicsForce = 30f;
public GameObject knockOrigin;
public AudioClip[] hitSFX;
public AudioClip[] flipSFX;
public AudioSource shovelAudio;
private PlayerControllerB previousPlayerHeldBy;
private PlayerControllerB playerControllerB;
private int shovelMask = 11012424;
public override void ItemActivate(bool used, bool buttonDown = true)
{
if ((Object)(object)base.playerHeldBy == (Object)null)
{
return;
}
isHoldingButton = buttonDown;
if (!reelingUp && buttonDown)
{
reelingUp = true;
previousPlayerHeldBy = base.playerHeldBy;
if (reelingUpCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
}
reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel());
}
}
public override void ItemInteractLeftRight(bool right)
{
//IL_0095: 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_00c5: 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_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_0103: 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_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_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_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_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)
if (!right)
{
Debug.Log((object)("curret cooldown" + base.currentUseCooldown));
playerControllerB = base.playerHeldBy;
((GrabbableObject)this).ItemInteractLeftRight(right);
if (!((Object)(object)base.playerHeldBy == (Object)null) && base.currentUseCooldown <= 0f)
{
RoundManager.PlayRandomClip(shovelAudio, flipSFX, true, 0.8f, 0, 1000);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(knockOrigin.transform.position.x, ((Component)playerControllerB).transform.localPosition.y - 0.7f, knockOrigin.transform.position.z);
float num = Vector3.Distance(((Component)playerControllerB).transform.position, val);
Vector3 val2 = Vector3.Normalize(((Component)playerControllerB).transform.position + Vector3.up * num - val) / (num * 0.35f) * physicsForce;
PlayerControllerB obj = playerControllerB;
obj.externalForceAutoFade += val2;
base.currentUseCooldown = flipCooldown;
}
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
base.playerHeldBy.equippedUsableItemQE = true;
}
private IEnumerator reelUpShovel()
{
base.playerHeldBy.activatingItem = true;
base.playerHeldBy.twoHanded = true;
base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
shovelAudio.PlayOneShot(reelUp);
ReelUpSFXServerRpc();
yield return (object)new WaitForSeconds(0.35f);
yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
SwingShovel(!base.isHeld);
yield return (object)new WaitForSeconds(0.13f);
yield return (object)new WaitForEndOfFrame();
HitShovel(!base.isHeld);
yield return (object)new WaitForSeconds(0.3f);
reelingUp = false;
reelingUpCoroutine = null;
}
[ServerRpc]
public void ReelUpSFXServerRpc()
{
ReelUpSFXClientRpc();
}
[ClientRpc]
public void ReelUpSFXClientRpc()
{
if (!((NetworkBehaviour)this).IsOwner)
{
shovelAudio.PlayOneShot(reelUp);
}
}
public override void DiscardItem()
{
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
}
((GrabbableObject)this).DiscardItem();
}
public void SwingShovel(bool cancel = false)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
if (!cancel)
{
shovelAudio.PlayOneShot(swing);
previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
}
}
public void HitShovel(bool cancel = false)
{
//IL_005f: 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_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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: 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_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_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_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_01e3: 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_020b: 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_0214: 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_0283: 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_0235: 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_0247: 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_0293: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
return;
}
previousPlayerHeldBy.activatingItem = false;
bool flag = false;
bool flag2 = false;
int num = -1;
if (!cancel)
{
previousPlayerHeldBy.twoHanded = false;
objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2);
objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
IHittable val2 = default(IHittable);
RaycastHit val3 = default(RaycastHit);
for (int i = 0; i < objectsHitByShovelList.Count; i++)
{
RaycastHit val = objectsHitByShovelList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
{
val = objectsHitByShovelList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
{
val = objectsHitByShovelList[i];
if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
{
continue;
}
val = objectsHitByShovelList[i];
if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
{
continue;
}
val = objectsHitByShovelList[i];
if (!(((RaycastHit)(ref val)).point == Vector3.zero))
{
Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
val = objectsHitByShovelList[i];
if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
continue;
}
}
flag = true;
Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
try
{
val2.Hit(shovelHitForce, forward, previousPlayerHeldBy, true, 1);
flag2 = true;
}
catch (Exception arg)
{
Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}");
}
continue;
}
}
flag = true;
val = objectsHitByShovelList[i];
string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
{
if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
{
num = j;
break;
}
}
}
}
if (flag)
{
RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000);
Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
HitShovelServerRpc(num);
}
}
[ServerRpc]
public void HitShovelServerRpc(int hitSurfaceID)
{
HitShovelClientRpc(hitSurfaceID);
}
[ClientRpc]
public void HitShovelClientRpc(int hitSurfaceID)
{
if (!((NetworkBehaviour)this).IsOwner)
{
RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000);
if (hitSurfaceID != -1)
{
HitSurfaceWithShovel(hitSurfaceID);
}
}
}
private void HitSurfaceWithShovel(int hitSurfaceID)
{
shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
}
}
namespace XIVitems;
public class NoiseAndHeal : GrabbableObject
{
public int healAmount = 100;
public ParticleSystem healVFX;
public AudioSource noiseAudio;
public AudioSource noiseAudioFar;
[Space(3f)]
public AudioClip[] noiseSFX;
public AudioClip[] noiseSFXFar;
public AudioClip[] healSFX;
[Space(3f)]
public float noiseRange;
public float maxLoudness;
public float minLoudness;
public float minPitch;
public float maxPitch;
private Random noisemakerRandom;
public override void Start()
{
((GrabbableObject)this).Start();
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && base.insertedBattery.charge > 0f)
{
int num = noisemakerRandom.Next(0, noiseSFX.Length);
float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
noiseAudio.pitch = pitch;
noiseAudio.PlayOneShot(noiseSFX[num], num2);
if ((Object)(object)noiseAudioFar != (Object)null)
{
noiseAudioFar.pitch = pitch;
noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2);
}
WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (minLoudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
Heal();
}
}
public void Heal()
{
//IL_0045: 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)
Debug.Log((object)("playerHeldby: " + base.playerHeldBy.playerUsername + " Health:" + base.playerHeldBy.health));
base.playerHeldBy.DamagePlayer(-healAmount, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
healVFX.Play(true);
RoundManager.PlayRandomClip(noiseAudio, healSFX, true, 0.6f, 0, 1000);
Debug.Log((object)("playerHeldby: " + base.playerHeldBy.playerUsername + " HealthAfterRpc:" + base.playerHeldBy.health));
if (base.playerHeldBy.health >= 20)
{
base.playerHeldBy.criticallyInjured = false;
}
base.insertedBattery.charge = 0f;
}
}
public class OneHandMeleeBackFlip : GrabbableObject
{
public AudioSource weaponAudio;
public float weaponRadius = 0.3f;
public float maxDistance = 1.2f;
private List<RaycastHit> objectsHitByweaponList = new List<RaycastHit>();
public PlayerControllerB previousPlayerHeldBy;
private RaycastHit[] objectsHitByweapon;
public int weaponHitForce;
public float flipCoolDown = 2f;
public float physicsForce = 30f;
public GameObject knockOrigin;
public AudioClip[] hitSFX;
public AudioClip[] swingSFX;
public AudioClip[] flipSFX;
private int weaponMask = 11012424;
private float timeAtLastDamageDealt;
public ParticleSystem bloodParticle;
private PlayerControllerB playerControllerB;
public override void ItemActivate(bool used, bool buttonDown = true)
{
RoundManager.PlayRandomClip(weaponAudio, swingSFX, true, 1f, 0, 1000);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
previousPlayerHeldBy = base.playerHeldBy;
if (((NetworkBehaviour)base.playerHeldBy).IsOwner)
{
base.playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1");
}
}
if (((NetworkBehaviour)this).IsOwner)
{
Hitweapon();
}
}
public override void ItemInteractLeftRight(bool right)
{
//IL_007a: 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_00aa: 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_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_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_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_0105: 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_0115: 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_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)
if (!right)
{
playerControllerB = base.playerHeldBy;
((GrabbableObject)this).ItemInteractLeftRight(right);
if (!((Object)(object)base.playerHeldBy == (Object)null) && base.currentUseCooldown <= 0f)
{
RoundManager.PlayRandomClip(weaponAudio, flipSFX, true, 0.8f, 0, 1000);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(knockOrigin.transform.position.x, ((Component)playerControllerB).transform.localPosition.y - 0.7f, knockOrigin.transform.position.z);
float num = Vector3.Distance(((Component)playerControllerB).transform.position, val);
Vector3 val2 = Vector3.Normalize(((Component)playerControllerB).transform.position + Vector3.up * num - val) / (num * 0.35f) * physicsForce;
PlayerControllerB obj = playerControllerB;
obj.externalForceAutoFade += val2;
base.currentUseCooldown = flipCoolDown;
}
}
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
base.playerHeldBy.equippedUsableItemQE = true;
}
public void Hitweapon(bool cancel = false)
{
//IL_005f: 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_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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: 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_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_01c4: 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_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_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_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_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: 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_028d: 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_0245: 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)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
Debug.LogError((object)"Previousplayerheldby is null on this client when HitStaff is called.");
return;
}
previousPlayerHeldBy.activatingItem = false;
bool flag = false;
bool flag2 = false;
int num = -1;
if (!cancel)
{
previousPlayerHeldBy.twoHanded = false;
objectsHitByweapon = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, weaponRadius, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, maxDistance, weaponMask, (QueryTriggerInteraction)2);
objectsHitByweaponList = objectsHitByweapon.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
IHittable val2 = default(IHittable);
for (int i = 0; i < objectsHitByweaponList.Count; i++)
{
RaycastHit val = objectsHitByweaponList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
{
val = objectsHitByweaponList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
{
val = objectsHitByweaponList[i];
if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
{
continue;
}
val = objectsHitByweaponList[i];
if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
{
continue;
}
val = objectsHitByweaponList[i];
if (!(((RaycastHit)(ref val)).point == Vector3.zero))
{
Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
RaycastHit val3 = objectsHitByweaponList[i];
if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
continue;
}
}
flag = true;
Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
try
{
if (Time.realtimeSinceStartup - timeAtLastDamageDealt > 0.43f)
{
timeAtLastDamageDealt = Time.realtimeSinceStartup;
val2.Hit(weaponHitForce, forward, previousPlayerHeldBy, true, 5);
bloodParticle.Play(true);
}
flag2 = true;
}
catch (Exception arg)
{
Debug.Log((object)$"Exception caught when hitting object with staff from player #{previousPlayerHeldBy.playerClientId}: {arg}");
}
continue;
}
}
flag = true;
val = objectsHitByweaponList[i];
string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
{
if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
{
num = j;
break;
}
}
}
}
if (flag)
{
RoundManager.PlayRandomClip(weaponAudio, hitSFX, true, 1f, 0, 1000);
Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
HitStaffServerRpc(num);
}
}
[ServerRpc]
public void HitStaffServerRpc(int hitSurfaceID)
{
HitStaffClientRpc(hitSurfaceID);
}
[ClientRpc]
public void HitStaffClientRpc(int hitSurfaceID)
{
if (!((NetworkBehaviour)this).IsOwner)
{
RoundManager.PlayRandomClip(weaponAudio, hitSFX, true, 1f, 0, 1000);
if (hitSurfaceID != -1)
{
HitSurfaceWithweapon(hitSurfaceID);
}
}
}
private void HitSurfaceWithweapon(int hitSurfaceID)
{
weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
}
}
public class OneHandMelee : GrabbableObject
{
public AudioSource weaponAudio;
public float weaponRadius = 0.3f;
public float maxDistance = 1.2f;
private List<RaycastHit> objectsHitByweaponList = new List<RaycastHit>();
public PlayerControllerB previousPlayerHeldBy;
private RaycastHit[] objectsHitByweapon;
public int weaponHitForce;
public AudioClip[] hitSFX;
public AudioClip[] swingSFX;
private int weaponMask = 11012424;
private float timeAtLastDamageDealt;
public ParticleSystem bloodParticle;
public override void ItemActivate(bool used, bool buttonDown = true)
{
RoundManager.PlayRandomClip(weaponAudio, swingSFX, true, 1f, 0, 1000);
if ((Object)(object)base.playerHeldBy != (Object)null)
{
previousPlayerHeldBy = base.playerHeldBy;
if (((NetworkBehaviour)base.playerHeldBy).IsOwner)
{
base.playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1");
}
}
if (((NetworkBehaviour)this).IsOwner)
{
Hitweapon();
}
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
}
public void Hitweapon(bool cancel = false)
{
//IL_005f: 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_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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: 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_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_01c4: 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_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_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_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_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: 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_028d: 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_0245: 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)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
Debug.LogError((object)"Previousplayerheldby is null on this client when HitStaff is called.");
return;
}
previousPlayerHeldBy.activatingItem = false;
bool flag = false;
bool flag2 = false;
int num = -1;
if (!cancel)
{
previousPlayerHeldBy.twoHanded = false;
objectsHitByweapon = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, weaponRadius, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, maxDistance, weaponMask, (QueryTriggerInteraction)2);
objectsHitByweaponList = objectsHitByweapon.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
IHittable val2 = default(IHittable);
for (int i = 0; i < objectsHitByweaponList.Count; i++)
{
RaycastHit val = objectsHitByweaponList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
{
val = objectsHitByweaponList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
{
val = objectsHitByweaponList[i];
if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
{
continue;
}
val = objectsHitByweaponList[i];
if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
{
continue;
}
val = objectsHitByweaponList[i];
if (!(((RaycastHit)(ref val)).point == Vector3.zero))
{
Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
RaycastHit val3 = objectsHitByweaponList[i];
if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
continue;
}
}
flag = true;
Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
try
{
if (Time.realtimeSinceStartup - timeAtLastDamageDealt > 0.43f)
{
timeAtLastDamageDealt = Time.realtimeSinceStartup;
val2.Hit(weaponHitForce, forward, previousPlayerHeldBy, true, 5);
bloodParticle.Play(true);
}
flag2 = true;
}
catch (Exception arg)
{
Debug.Log((object)$"Exception caught when hitting object with staff from player #{previousPlayerHeldBy.playerClientId}: {arg}");
}
continue;
}
}
flag = true;
val = objectsHitByweaponList[i];
string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
{
if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
{
num = j;
break;
}
}
}
}
if (flag)
{
RoundManager.PlayRandomClip(weaponAudio, hitSFX, true, 1f, 0, 1000);
Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
HitStaffServerRpc(num);
}
}
[ServerRpc]
public void HitStaffServerRpc(int hitSurfaceID)
{
HitStaffClientRpc(hitSurfaceID);
}
[ClientRpc]
public void HitStaffClientRpc(int hitSurfaceID)
{
if (!((NetworkBehaviour)this).IsOwner)
{
RoundManager.PlayRandomClip(weaponAudio, hitSFX, true, 1f, 0, 1000);
if (hitSurfaceID != -1)
{
HitSurfaceWithweapon(hitSurfaceID);
}
}
}
private void HitSurfaceWithweapon(int hitSurfaceID)
{
weaponAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(weaponAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
}
}
[BepInPlugin("boboboba.XIVitems", "XIVitems", "1.3.10")]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "boboboba.XIVitems";
private const string NAME = "XIVitems";
private const string VERSION = "1.3.10";
private const string GUID2 = "ainavt.lc.lethalconfig";
public static Plugin instance;
private static AssetBundle bundle;
private static ConfigEntry<bool> config_RestrictXIVItem;
private static string[] XivMoonList = new string[7] { "Mare", "Limsa", "Amaurot", "Ishgard", "Crystarium", "Elpis", "Kugane" };
public static bool IsAvailable => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");
private void Awake()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)("LethalConfig Avaliable: " + IsAvailable));
config_RestrictXIVItem = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn", "Limit to FFXIV moons", false, new ConfigDescription("Check this box to make XIVitems only spawn on Bobo's FFXIV moons", (AcceptableValueBase)null, Array.Empty<object>()));
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "xivitemmod");
bundle = AssetBundle.LoadFromFile(text);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Rock.asset", "Rock", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Ronka.asset", "Great serpent of Ronka", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Bunny.asset", "ScammingWay", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/UFO.asset", "UFO", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Eyes.asset", "Possessed Eye", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Mask.asset", "Mysterious Mask", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Sword.asset", "Ame-no-Habakiri", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Shield.asset", "Broken Shield", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/CatBoi.asset", "Best Boi", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Namazu.asset", "Golden Namazu Plush", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Pupu.asset", "Pupu Plush", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Emet.asset", "Grumpy Old Man", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/AbyssalAxe.asset", "Abyssal War Axe", 20);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/BahamutMini.asset", "Bahamut Statue", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/BlackMagePlush.asset", "Black Mage Plush", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Doll1.asset", "Blue Doll", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Doll2.asset", "Red Doll", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/HadesCrystal.asset", "Hades Crystal", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/IndirectLight.asset", "Indirect Lighting", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/OdinMini.asset", "Odin Statue", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/SwordofLight.asset", "Sword of Light", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/TableOrchestrion.asset", "Table Orchestrion", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/UmbralHammer.asset", "Bonk Hammer", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/DwarvenMythrilHammer.asset", "Dwarven Mythril Hammer", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Estinein.asset", "Estinein Plush", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/FatCatBank.asset", "Fat Cat Bank", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/LionHeart.asset", "Lion Heart", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/NidhoggMini.asset", "Nidhogg Statue", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/SummoningBell.asset", "Summoning Bell", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Tataru.asset", "Tataru Plush", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/ToraJiro.asset", "Tora Jiro", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Urianger.asset", "Urianger Plush", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Hien.asset", "Hien Plush", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Yshtola.asset", "Yshtola Plush", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/ZenosScythe.asset", "Zenos Scythe", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/GaeBolg.asset", "GaeBolg", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Hi-Elixir.asset", "Hi-Elixir", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/WhiteMageStaff.asset", "White Mage Staff", 30);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Hythlodaeus.asset", "Hythlodaeus Plush", 40);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/BlackMageStaff.asset", "Black Mage Staff", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/AlisaieRapier.asset", "Red Mage Rapier", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/EmetPistol.asset", "Emet Pistol", 25);
LoadScrap(text, "Assets/LethalCompany/Mods/Items/ItemProperties/Yugiri.asset", "Yugiri Plush", 30);
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "boboboba.XIVitems");
((BaseUnityPlugin)this).Logger.LogInfo((object)"XIV Items Loaded");
}
private void LoadScrap(string assetDir, string innerAssetPath, string name, int rarity)
{
//IL_0017: 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_0045: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_004a: Expected O, but got Unknown
ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("General", name + " Rarity"), rarity, new ConfigDescription("How often " + name + " will show up. Higher value means more likely to show up", (AcceptableValueBase)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
Item val2 = bundle.LoadAsset<Item>(innerAssetPath);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
if (config_RestrictXIVItem.Value)
{
Items.RegisterScrap(val2, val.Value, (LevelTypes)1, XivMoonList);
}
else
{
Items.RegisterScrap(val2, val.Value, (LevelTypes)(-1));
}
if (IsAvailable)
{
AddIntSlider(val, restartRequired: true);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)(name + " Loaded. Rarity: " + val.Value));
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddIntSlider(ConfigEntry<int> entry, bool restartRequired)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry, restartRequired));
}
}
public class TwoHandWithProjectile : GrabbableObject
{
public int staffHitForce = 0;
public int healAmount = 20;
public GameObject FireBalllPrefab;
public GameObject explosionPrefab;
public AudioSource explosionAudio;
private Vector3 previousExplosionPosition;
public float flySpeed = 0.1f;
public GameObject startTransform;
public bool reelingUp;
public bool isHoldingButton;
public int shotsPerCharge = 4;
private float chargePerShot;
private Coroutine reelingUpCoroutine;
public AudioClip reelUp;
public AudioClip swing;
public AudioClip[] largeExplosionSFX;
public AudioSource staffAudio;
private PlayerControllerB previousPlayerHeldBy;
private int staffMask = 11012424;
public AudioClip[] fireBallSfx;
public AudioSource fireBallAudio;
public override void ItemActivate(bool used, bool buttonDown = true)
{
if ((Object)(object)base.playerHeldBy == (Object)null)
{
return;
}
isHoldingButton = buttonDown;
if (!reelingUp && buttonDown)
{
reelingUp = true;
previousPlayerHeldBy = base.playerHeldBy;
if (reelingUpCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
}
reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelUpStaff());
}
}
private IEnumerator ReelUpStaff()
{
base.playerHeldBy.activatingItem = true;
base.playerHeldBy.twoHanded = true;
base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
staffAudio.PlayOneShot(reelUp);
ReelUpSFXServerRpc();
yield return (object)new WaitForSeconds(0.35f);
yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
SwingStaff(!base.isHeld);
yield return (object)new WaitForSeconds(0.13f);
yield return (object)new WaitForEndOfFrame();
if (!StartOfRound.Instance.inShipPhase)
{
StartShootFireBall();
}
yield return (object)new WaitForSeconds(0.3f);
reelingUp = false;
reelingUpCoroutine = null;
previousPlayerHeldBy.activatingItem = false;
previousPlayerHeldBy.twoHanded = false;
}
[ServerRpc]
public void ReelUpSFXServerRpc()
{
ReelUpSFXClientRpc();
}
[ClientRpc]
public void ReelUpSFXClientRpc()
{
if (!((NetworkBehaviour)this).IsOwner)
{
staffAudio.PlayOneShot(reelUp);
}
}
public override void DiscardItem()
{
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
}
((GrabbableObject)this).DiscardItem();
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
chargePerShot = 1f / (float)shotsPerCharge;
}
public void SwingStaff(bool cancel = false)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
if (!cancel)
{
staffAudio.PlayOneShot(swing);
previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
}
}
public void StartShootFireBall()
{
//IL_0022: 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_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)
if (((NetworkBehaviour)this).IsServer)
{
Debug.Log((object)"FireBall Start");
Debug.Log((object)startTransform.transform.position);
Debug.Log((object)startTransform.transform.eulerAngles);
ShootFireBallClientRpc(startTransform.transform.position, startTransform.transform.eulerAngles);
}
}
[ClientRpc]
public void ShootFireBallClientRpc(Vector3 startPos, Vector3 startRot)
{
//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)
ShootFireBall(startPos, startRot);
}
public void ShootFireBall(Vector3 startPos, Vector3 startRot)
{
//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_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)
if (!base.insertedBattery.empty && base.insertedBattery.charge >= chargePerShot)
{
GameObject val = Object.Instantiate<GameObject>(FireBalllPrefab, startPos, Quaternion.Euler(startRot), RoundManager.Instance.mapPropsContainer.transform);
val.GetComponent<FireBall>().BLMStaffScript = this;
RoundManager.PlayRandomClip(fireBallAudio, fireBallSfx, true, 1f, 0, 1000);
if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position) < 16f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
base.insertedBattery.charge = Mathf.Clamp(base.insertedBattery.charge - chargePerShot, 0f, 1f);
}
previousPlayerHeldBy.activatingItem = false;
}
public void StartExplosion(Vector3 explosionPosition, Vector3 forwardRotation, bool calledByClient = false)
{
//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_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)
Debug.Log((object)"startedExplosiion");
if (((NetworkBehaviour)this).IsServer)
{
Debug.Log((object)"startExpserver");
SetExplosionClientRpc(explosionPosition, forwardRotation);
}
else if (calledByClient)
{
Debug.Log((object)"startExpccalledbyc");
SetExplosionServerRpc(explosionPosition, forwardRotation);
}
}
public void SetExplosion(Vector3 explosionPosition, Vector3 forwardRotation)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0087: 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_004d: 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_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_00de: 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_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_0104: 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_0138: 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_014e: 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_015e: 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)
Debug.Log((object)"SettingExplosion");
if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition - forwardRotation * 0.1f) < 8f)
{
Debug.Log((object)"spawn1");
Landmine.SpawnExplosion(explosionPosition - forwardRotation * 0.1f, true, 1f, 7f, 30, 65f, explosionPrefab);
}
else
{
Landmine.SpawnExplosion(explosionPosition - forwardRotation * 0.1f, true, 1f, 7f, 30, 35f, explosionPrefab);
}
Debug.Log((object)("ExplosionAudio is Active: " + ((Behaviour)explosionAudio).isActiveAndEnabled));
((Component)explosionAudio).transform.position = explosionPosition + Vector3.up * 0.5f;
Debug.Log((object)((Component)explosionAudio).transform.position);
RoundManager.PlayRandomClip(explosionAudio, largeExplosionSFX, true, 1f, 0, 1000);
RaycastHit val = default(RaycastHit);
if (!(Vector3.Distance(previousExplosionPosition, explosionPosition) < 4f) && Physics.Raycast(explosionPosition - forwardRotation * 0.1f, forwardRotation, ref val, 4f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
_ = ((RaycastHit)(ref val)).normal;
}
}
[ServerRpc(RequireOwnership = false)]
public void SetExplosionServerRpc(Vector3 explosionPosition, Vector3 forwardRotation)
{
//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)
SetExplosionClientRpc(explosionPosition, forwardRotation, calledByClient: true);
}
[ClientRpc]
public void SetExplosionClientRpc(Vector3 explosionPosition, Vector3 forwardRotation, bool calledByClient = false)
{
//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)
SetExplosion(explosionPosition, forwardRotation);
}
}
public class TwoHandHeal : GrabbableObject
{
public int staffHitForce = 0;
public int healAmount = 20;
public ParticleSystem healVFX;
public bool reelingUp;
public bool isHoldingButton;
private RaycastHit rayHit;
private Coroutine reelingUpCoroutine;
private RaycastHit[] objectsHitByStaff;
private List<RaycastHit> objectsHitByStaffList = new List<RaycastHit>();
public AudioClip reelUp;
public AudioClip swing;
public AudioClip[] hitSFX;
public AudioClip[] healSFX;
public AudioSource staffAudio;
private PlayerControllerB previousPlayerHeldBy;
private int staffMask = 11012424;
public override void ItemActivate(bool used, bool buttonDown = true)
{
if ((Object)(object)base.playerHeldBy == (Object)null)
{
return;
}
isHoldingButton = buttonDown;
if (!reelingUp && buttonDown)
{
reelingUp = true;
previousPlayerHeldBy = base.playerHeldBy;
if (reelingUpCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
}
reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelUpStaff());
}
}
private IEnumerator ReelUpStaff()
{
base.playerHeldBy.activatingItem = true;
base.playerHeldBy.twoHanded = true;
base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
staffAudio.PlayOneShot(reelUp);
ReelUpSFXServerRpc();
yield return (object)new WaitForSeconds(0.35f);
yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
SwingStaff(!base.isHeld);
yield return (object)new WaitForSeconds(0.13f);
yield return (object)new WaitForEndOfFrame();
HitStaff(!base.isHeld);
yield return (object)new WaitForSeconds(0.3f);
reelingUp = false;
reelingUpCoroutine = null;
}
[ServerRpc]
public void ReelUpSFXServerRpc()
{
ReelUpSFXClientRpc();
}
[ClientRpc]
public void ReelUpSFXClientRpc()
{
if (!((NetworkBehaviour)this).IsOwner)
{
staffAudio.PlayOneShot(reelUp);
}
}
public override void DiscardItem()
{
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
}
((GrabbableObject)this).DiscardItem();
}
public void SwingStaff(bool cancel = false)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
if (!cancel)
{
staffAudio.PlayOneShot(swing);
previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
}
}
public void HitStaff(bool cancel = false)
{
//IL_005f: 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_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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: 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_0103: 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_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_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_01e3: 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_020b: 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_0214: 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_0286: 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_0235: 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_0247: 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_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_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
Debug.LogError((object)"Previousplayerheldby is null on this client when HitStaff is called.");
return;
}
previousPlayerHeldBy.activatingItem = false;
bool flag = false;
bool flag2 = false;
int num = -1;
if (!cancel)
{
previousPlayerHeldBy.twoHanded = false;
objectsHitByStaff = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, staffMask, (QueryTriggerInteraction)2);
objectsHitByStaffList = objectsHitByStaff.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
IHittable val2 = default(IHittable);
RaycastHit val3 = default(RaycastHit);
for (int i = 0; i < objectsHitByStaffList.Count; i++)
{
RaycastHit val = objectsHitByStaffList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
{
val = objectsHitByStaffList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
{
val = objectsHitByStaffList[i];
if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
{
continue;
}
val = objectsHitByStaffList[i];
if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
{
continue;
}
val = objectsHitByStaffList[i];
if (!(((RaycastHit)(ref val)).point == Vector3.zero))
{
Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
val = objectsHitByStaffList[i];
if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
continue;
}
}
flag = true;
Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
try
{
val = objectsHitByStaffList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.CompareTag("Player"))
{
val = objectsHitByStaffList[i];
PlayerControllerB component = ((Component)((RaycastHit)(ref val)).transform).gameObject.GetComponent<PlayerControllerB>();
Heal(component);
flag2 = true;
}
else
{
val2.Hit(staffHitForce, forward, previousPlayerHeldBy, true, 1);
flag2 = true;
}
}
catch (Exception arg)
{
Debug.Log((object)$"Exception caught when hitting object with staff from player #{previousPlayerHeldBy.playerClientId}: {arg}");
}
continue;
}
}
flag = true;
val = objectsHitByStaffList[i];
string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
{
if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
{
num = j;
break;
}
}
}
}
if (flag)
{
RoundManager.PlayRandomClip(staffAudio, hitSFX, true, 1f, 0, 1000);
Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
staffAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(staffAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
base.playerHeldBy.playerBodyAnimator.SetTrigger("staffHit");
HitStaffServerRpc(num);
}
}
public void Heal(PlayerControllerB playerToHeal)
{
//IL_0040: 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)
Debug.Log((object)("previousplayerHeldby: " + previousPlayerHeldBy.playerUsername + " Health:" + previousPlayerHeldBy.health));
playerToHeal.DamagePlayer(-healAmount, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
healVFX.Play(true);
RoundManager.PlayRandomClip(staffAudio, healSFX, true, 0.6f, 0, 1000);
Debug.Log((object)("playerToHeal: " + playerToHeal.playerUsername + "| HealthAfterRpc: " + playerToHeal.health));
if (playerToHeal.health >= 20)
{
playerToHeal.criticallyInjured = false;
}
}
[ServerRpc]
public void HitStaffServerRpc(int hitSurfaceID)
{
HitStaffClientRpc(hitSurfaceID);
}
[ClientRpc]
public void HitStaffClientRpc(int hitSurfaceID)
{
if (!((NetworkBehaviour)this).IsOwner)
{
RoundManager.PlayRandomClip(staffAudio, hitSFX, true, 1f, 0, 1000);
if (hitSurfaceID != -1)
{
HitSurfaceWithStaff(hitSurfaceID);
}
}
}
private void HitSurfaceWithStaff(int hitSurfaceID)
{
staffAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(staffAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
}
}