Files
zzz_REBIRTH__Utils/Harmony/Harmony_PlayerMoveController.cs
2025-06-04 16:44:53 +09:30

3911 lines
264 KiB
C#

using Audio;
using GUI_2;
using InControl;
using Platform;
using System.Collections.Generic;
using static RebirthManager;
using static Unity.IO.LowLevel.Unsafe.AsyncReadManagerMetrics;
namespace Harmony.PlayerMoveControllerPatches
{
[HarmonyPatch(typeof(PlayerMoveController), "updateRespawn")]
public class updateRespawnPatch
{
private static bool Prefix(ref PlayerMoveController __instance)
{
if (__instance.entityPlayerLocal.Spawned)
{
if (__instance.unstuckCoState != ERoutineState.Running || !__instance.playerInput.GUIActions.Cancel.WasPressed && !__instance.windowManager.IsWindowOpen(XUiC_InGameMenuWindow.ID))
return false;
__instance.unstuckCoState = ERoutineState.Cancelled;
}
else
{
if (GameManager.IsVideoPlaying())
return false;
if (!__instance.bLastRespawnActive)
{
__instance.spawnWindowOpened = false;
__instance.spawnPosition = SpawnPosition.Undef;
__instance.entityPlayerLocal.BeforePlayerRespawn(__instance.respawnReason);
__instance.bLastRespawnActive = true;
__instance.waitingForSpawnPointSelection = false;
}
__instance.entityPlayerLocal.ResetLastTickPos(__instance.entityPlayerLocal.GetPosition());
__instance.respawnTime -= Time.deltaTime;
if ((double)__instance.respawnTime > 0.0)
return false;
__instance.respawnTime = 0.0f;
if (__instance.spawnWindowOpened && XUiC_SpawnSelectionWindow.IsOpenInUI(LocalPlayerUI.primaryUI))
{
if ((double)Mathf.Abs(__instance.entityPlayerLocal.GetPosition().y - Constants.cStartPositionPlayerInLevel.y) < 0.0099999997764825821)
{
Vector3 position = __instance.entityPlayerLocal.GetPosition();
Vector3i blockPosition = __instance.entityPlayerLocal.GetBlockPosition();
if (__instance.gameManager.World.GetChunkFromWorldPos(blockPosition) != null)
{
float y = (float)((int)__instance.gameManager.World.GetHeight(blockPosition.x, blockPosition.z) + 1);
if ((double)position.y < 0.0 || (double)y < (double)position.y || (double)y > (double)position.y && (double)y - 2.5 < (double)position.y)
__instance.entityPlayerLocal.SetPosition(new Vector3(__instance.entityPlayerLocal.GetPosition().x, y, __instance.entityPlayerLocal.GetPosition().z), true);
}
}
if (__instance.playerAutoPilotControllor == null || !__instance.playerAutoPilotControllor.IsEnabled())
return false;
XUiC_SpawnSelectionWindow.Close(LocalPlayerUI.primaryUI);
}
else
{
bool flag = __instance.respawnReason == RespawnType.NewGame || __instance.respawnReason == RespawnType.EnterMultiplayer || __instance.respawnReason == RespawnType.JoinMultiplayer || __instance.respawnReason == RespawnType.LoadedGame;
Entity entity = (bool)(UnityEngine.Object)__instance.entityPlayerLocal.AttachedToEntity ? __instance.entityPlayerLocal.AttachedToEntity : (Entity)__instance.entityPlayerLocal;
switch (__instance.respawnReason)
{
case RespawnType.NewGame:
if (!__instance.spawnWindowOpened)
{
__instance.openSpawnWindow(__instance.respawnReason);
return false;
}
__instance.spawnPosition = new SpawnPosition(__instance.entityPlayerLocal.GetPosition(), __instance.entityPlayerLocal.rotation.y);
break;
case RespawnType.LoadedGame:
if (!__instance.spawnWindowOpened)
{
__instance.spawnPosition = new SpawnPosition(__instance.entityPlayerLocal.GetPosition(), __instance.entityPlayerLocal.rotation.y);
__instance.entityPlayerLocal.SetPosition(__instance.spawnPosition.position, true);
__instance.openSpawnWindow(__instance.respawnReason);
return false;
}
__instance.spawnPosition = new SpawnPosition(__instance.entityPlayerLocal.GetPosition(), __instance.entityPlayerLocal.rotation.y);
break;
case RespawnType.Teleport:
__instance.spawnPosition = new SpawnPosition(entity.GetPosition(), entity.rotation.y);
__instance.spawnPosition.position.y = -1f;
break;
case RespawnType.EnterMultiplayer:
case RespawnType.JoinMultiplayer:
if (!__instance.spawnWindowOpened)
{
__instance.spawnPosition = new SpawnPosition(__instance.entityPlayerLocal.GetPosition(), __instance.entityPlayerLocal.rotation.y);
if ((__instance.spawnPosition.IsUndef() || __instance.spawnPosition.position.Equals(Constants.cStartPositionPlayerInLevel)) && !__instance.entityPlayerLocal.lastSpawnPosition.IsUndef())
__instance.spawnPosition = __instance.entityPlayerLocal.lastSpawnPosition;
if (__instance.spawnPosition.IsUndef() || __instance.spawnPosition.position.Equals(Constants.cStartPositionPlayerInLevel))
__instance.spawnPosition = __instance.gameManager.GetSpawnPointList().GetRandomSpawnPosition(__instance.entityPlayerLocal.world);
__instance.entityPlayerLocal.SetPosition(new Vector3(__instance.spawnPosition.position.x, (double)__instance.spawnPosition.position.y == 0.0 ? Constants.cStartPositionPlayerInLevel.y : __instance.spawnPosition.position.y, __instance.spawnPosition.position.z), true);
__instance.openSpawnWindow(__instance.respawnReason);
return false;
}
__instance.spawnPosition = new SpawnPosition(__instance.entityPlayerLocal.GetPosition(), __instance.entityPlayerLocal.rotation.y);
break;
default:
if (!__instance.gameManager.IsEditMode() && !__instance.spawnWindowOpened)
{
__instance.openSpawnWindow(__instance.respawnReason);
return false;
}
XUiC_SpawnSelectionWindow window = XUiC_SpawnSelectionWindow.GetWindow(LocalPlayerUI.primaryUI);
if (!__instance.waitingForSpawnPointSelection && !__instance.gameManager.IsEditMode() && __instance.spawnWindowOpened && window.spawnMethod != SpawnMethod.Invalid)
{
__instance.StartCoroutine(__instance.FindRespawnSpawnPointRoutine(window.spawnMethod, window.spawnTarget));
window.spawnMethod = SpawnMethod.Invalid;
window.spawnTarget = SpawnPosition.Undef;
}
if (__instance.waitingForSpawnPointSelection)
return false;
if (__instance.entityPlayerLocal.position != __instance.spawnPosition.position)
{
Vector3 position = __instance.spawnPosition.position;
if (__instance.spawnPosition.IsUndef())
position = __instance.entityPlayerLocal.GetPosition();
__instance.spawnPosition = new SpawnPosition(position + new Vector3(0.0f, 5f, 0.0f), __instance.entityPlayerLocal.rotation.y);
__instance.entityPlayerLocal.SetPosition(__instance.spawnPosition.position, true);
break;
}
break;
}
if (GameUtils.IsPlaytesting() || GameManager.Instance.IsEditMode() && GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Empty")
{
SpawnPointList spawnPointList = GameManager.Instance.GetSpawnPointList();
if (__instance.respawnReason != RespawnType.Teleport && spawnPointList.Count > 0)
{
__instance.spawnPosition.position = spawnPointList[0].spawnPosition.position;
__instance.spawnPosition.heading = spawnPointList[0].spawnPosition.heading;
__instance.entityPlayerLocal.SetPosition(__instance.spawnPosition.position, true);
}
}
if (!__instance.spawnPosition.IsUndef())
{
if (!PrefabEditModeManager.Instance.IsActive() && !__instance.gameManager.World.IsPositionAvailable(__instance.spawnPosition.ClrIdx, __instance.spawnPosition.position))
{
__instance.spawnPosition.position = __instance.gameManager.World.ClampToValidWorldPos(__instance.spawnPosition.position);
if (!(__instance.entityPlayerLocal.position != __instance.spawnPosition.position))
return false;
__instance.entityPlayerLocal.SetPosition(__instance.spawnPosition.position, true);
return false;
}
if (!__instance.entityPlayerLocal.CheckSpawnPointStillThere())
{
__instance.entityPlayerLocal.RemoveSpawnPoints();
if (flag)
{
__instance.entityPlayerLocal.QuestJournal.RemoveAllSharedQuests();
__instance.entityPlayerLocal.QuestJournal.StartQuests();
}
}
Vector3i blockPos = World.worldToBlockPos(__instance.spawnPosition.position);
float num = (float)((int)__instance.gameManager.World.GetHeight(blockPos.x, blockPos.z) + 1);
if ((double)__instance.spawnPosition.position.y < 0.0 || (double)__instance.spawnPosition.position.y > (double)num)
__instance.spawnPosition.position.y = num;
else if ((double)__instance.spawnPosition.position.y < (double)num && !__instance.gameManager.World.CanPlayersSpawnAtPos(__instance.spawnPosition.position, true))
{
++__instance.spawnPosition.position.y;
if (!__instance.gameManager.World.CanPlayersSpawnAtPos(__instance.spawnPosition.position, true))
__instance.spawnPosition.position.y = num;
}
}
Log.Out("Respawn almost done");
if (__instance.spawnPosition.IsUndef())
{
__instance.entityPlayerLocal.Respawn(__instance.respawnReason);
}
else
{
RaycastHit hitInfo;
float num = !Physics.Raycast(new Ray(__instance.spawnPosition.position + Vector3.up - Origin.position, Vector3.down), out hitInfo, 3f, 1342242816) ? __instance.gameManager.World.GetTerrainOffset(0, World.worldToBlockPos(__instance.spawnPosition.position)) + 0.05f : hitInfo.point.y - __instance.spawnPosition.position.y + Origin.position.y;
__instance.gameManager.ClearTooltips(__instance.nguiWindowManager);
__instance.spawnPosition.position.y += num;
__instance.entityPlayerLocal.onGround = true;
__instance.entityPlayerLocal.lastSpawnPosition = __instance.spawnPosition;
__instance.entityPlayerLocal.Spawned = true;
GameManager.Instance.PlayerSpawnedInWorld((ClientInfo)null, __instance.respawnReason, new Vector3i(__instance.spawnPosition.position), __instance.entityPlayerLocal.entityId);
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToClientsOrServer((NetPackage)NetPackageManager.GetPackage<NetPackagePlayerSpawnedInWorld>().Setup(__instance.respawnReason, new Vector3i(__instance.spawnPosition.position), __instance.entityPlayerLocal.entityId));
if (__instance.respawnReason == RespawnType.Died || __instance.respawnReason == RespawnType.EnterMultiplayer || __instance.respawnReason == RespawnType.NewGame)
__instance.entityPlayerLocal.SetAlive();
else
__instance.entityPlayerLocal.bDead = false;
if (__instance.respawnReason == RespawnType.NewGame || __instance.respawnReason == RespawnType.LoadedGame || __instance.respawnReason == RespawnType.EnterMultiplayer || __instance.respawnReason == RespawnType.JoinMultiplayer)
__instance.entityPlayerLocal.TryAddRecoveryPosition(Vector3i.FromVector3Rounded(__instance.spawnPosition.position));
__instance.entityPlayerLocal.ResetLastTickPos(__instance.spawnPosition.position);
if (!(bool)(UnityEngine.Object)__instance.entityPlayerLocal.AttachedToEntity)
__instance.entityPlayerLocal.transform.position = __instance.spawnPosition.position - Origin.position;
else
__instance.spawnPosition.position.y += 2f;
entity.SetPosition(__instance.spawnPosition.position);
entity.SetRotation(new Vector3(0.0f, __instance.spawnPosition.heading, 0.0f));
__instance.entityPlayerLocal.JetpackWearing = false;
__instance.entityPlayerLocal.ParachuteWearing = false;
__instance.entityPlayerLocal.AfterPlayerRespawn(__instance.respawnReason);
if (flag)
{
__instance.entityPlayerLocal.QuestJournal.RemoveAllSharedQuests();
__instance.entityPlayerLocal.QuestJournal.StartQuests();
}
if ((__instance.respawnReason == RespawnType.NewGame || __instance.respawnReason == RespawnType.EnterMultiplayer) && !GameManager.Instance.World.IsEditor() && !(GameMode.GetGameModeForId(GameStats.GetInt(EnumGameStats.GameModeId)) is GameModeCreative) && !GameUtils.IsPlaytesting() && !GameManager.bRecordNextSession && !GameManager.bPlayRecordedSession)
GameEventManager.Current.HandleAction("game_first_spawn", (EntityPlayer)__instance.entityPlayerLocal, (Entity)__instance.entityPlayerLocal, false);
if (__instance.respawnReason != RespawnType.Died && __instance.respawnReason != RespawnType.Teleport && GameStats.GetBool(EnumGameStats.AutoParty) && __instance.entityPlayerLocal.Party == null)
{
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer((NetPackage)NetPackageManager.GetPackage<NetPackagePartyActions>().Setup(NetPackagePartyActions.PartyActions.JoinAutoParty, __instance.entityPlayerLocal.entityId, __instance.entityPlayerLocal.entityId));
else
Party.ServerHandleAutoJoinParty((EntityPlayer)__instance.entityPlayerLocal);
}
if (__instance.respawnReason == RespawnType.JoinMultiplayer || __instance.respawnReason == RespawnType.LoadedGame)
{
__instance.entityPlayerLocal.ReassignEquipmentTransforms();
GameEventManager.Current.HandleAction("game_on_spawn", (EntityPlayer)__instance.entityPlayerLocal, (Entity)__instance.entityPlayerLocal, false);
}
#region Rebirth
float spawnedIn = __instance.entityPlayerLocal.Buffs.GetCustomVar("$spawnedIn");
//Log.Out("PlayerMoveControllerPatches-updateRespawn $spawnedIn: " + spawnedIn);
if (RebirthUtilities.ScenarioSkip() && !(__instance.entityPlayerLocal.world.IsEditor() || GameUtils.IsWorldEditor() || GameUtils.IsPlaytesting() || spawnedIn == 1f))
{
//Log.Out("PlayerMoveControllerPatches-updateRespawn TURN CAMERA OFF");
__instance.entityPlayerLocal.EnableCamera(false);
}
else
{
//Log.Out("PlayerMoveControllerPatches-updateRespawn TURN CAMERA ON");
__instance.entityPlayerLocal.EnableCamera(true);
}
#endregion
LocalPlayerUI.primaryUI.windowManager.Close(XUiC_LoadingScreen.ID);
LocalPlayerUI.primaryUI.windowManager.Close("eacWarning");
LocalPlayerUI.primaryUI.windowManager.Close("crossplayWarning");
if (flag && PlatformManager.NativePlatform.GameplayNotifier != null)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
PlatformManager.NativePlatform.GameplayNotifier.GameplayStart(SingletonMonoBehaviour<ConnectionManager>.Instance.CurrentMode == ProtocolManager.NetworkType.Server, SingletonMonoBehaviour<ConnectionManager>.Instance.LocalServerInfo.AllowsCrossplay);
else if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
PlatformManager.NativePlatform.GameplayNotifier.GameplayStart(true, SingletonMonoBehaviour<ConnectionManager>.Instance.LastGameServerInfo.AllowsCrossplay);
}
if (__instance.respawnReason == RespawnType.Died)
{
__instance.entityPlayerLocal.QuestJournal.FailAllActivatedQuests();
__instance.entityPlayerLocal.Progression.OnRespawnFromDeath();
switch (GameStats.GetInt(EnumGameStats.DeathPenalty))
{
case 0:
GameEventManager.Current.HandleAction("game_on_respawn_none", (EntityPlayer)__instance.entityPlayerLocal, (Entity)__instance.entityPlayerLocal, false);
break;
case 1:
GameEventManager.Current.HandleAction("game_on_respawn_default", (EntityPlayer)__instance.entityPlayerLocal, (Entity)__instance.entityPlayerLocal, false);
break;
case 2:
GameEventManager.Current.HandleAction("game_on_respawn_injured", (EntityPlayer)__instance.entityPlayerLocal, (Entity)__instance.entityPlayerLocal, false);
break;
case 3:
GameEventManager.Current.HandleAction("game_on_respawn_permanent", (EntityPlayer)__instance.entityPlayerLocal, (Entity)__instance.entityPlayerLocal, false);
break;
}
}
if (!__instance.gameManager.IsEditMode() && (__instance.respawnReason == RespawnType.NewGame || __instance.respawnReason == RespawnType.EnterMultiplayer))
{
#region Rebirth
if (RebirthUtilities.ScenarioSkip() && !GameUtils.IsPlaytesting())
{
if (__instance.entityPlayerLocal.Buffs.GetCustomVar("$spawnedIn") == 0f)
{
__instance.windowManager.TempHUDDisable();
__instance.entityPlayerLocal.SetControllable(false);
__instance.entityPlayerLocal.bIntroAnimActive = true;
}
else
{
if (__instance.entityPlayerLocal != null && __instance.entityPlayerLocal.inventory != null)
{
__instance.entityPlayerLocal.inventory.ForceHoldingItemUpdate();
}
if (__instance.entityPlayerLocal != null && __instance.entityPlayerLocal.transform != null)
{
__instance.entityPlayerLocal.bIntroAnimActive = false;
__instance.entityPlayerLocal.SetControllable(true);
}
if (__instance.windowManager != null)
{
__instance.windowManager.ReEnableHUD();
}
__instance.entityPlayerLocal.EnableCamera(true);
}
}
#endregion
else
{
__instance.windowManager.TempHUDDisable();
__instance.entityPlayerLocal.SetControllable(false);
__instance.entityPlayerLocal.bIntroAnimActive = true;
GameManager.Instance.StartCoroutine(__instance.showUILater());
if (!GameUtils.IsPlaytesting())
GameManager.Instance.StartCoroutine(__instance.initializeHoldingItemLater(4f));
}
}
else
{
__instance.entityPlayerLocal.SetControllable(true);
if (!__instance.gameManager.IsEditMode() && !GameUtils.IsPlaytesting() && (__instance.respawnReason == RespawnType.LoadedGame || __instance.respawnReason == RespawnType.JoinMultiplayer))
GameManager.Instance.StartCoroutine(__instance.initializeHoldingItemLater(0.1f));
}
__instance.bLastRespawnActive = false;
}
}
}
return false;
}
}
[HarmonyPatch(typeof(PlayerMoveController), "Update")]
public class PlayerMoveControllerUpdatePatch
{
private static bool Prefix(ref PlayerMoveController __instance)
{
if (__instance.entityPlayerLocal.world.IsEditor())
{
return true;
}
bool bCheckPlayerActions = CheckPlayerActions(__instance, __instance.playerUI, __instance.entityPlayerLocal);
bool flag1 = !__instance.playerUI.windowManager.IsCursorWindowOpen() && !__instance.playerUI.windowManager.IsModalWindowOpen() && (__instance.playerInput.Enabled || __instance.playerInput.VehicleActions.Enabled);
if (DroneManager.Debug_LocalControl)
flag1 = false;
if (__instance.playerAutoPilotControllor != null && __instance.playerAutoPilotControllor.IsEnabled())
__instance.playerAutoPilotControllor.Update();
if (!(__instance.bCanControlOverride & flag1) && GamePrefs.GetInt(EnumGamePrefs.SelectionOperationMode) == 0)
{
XUiC_InteractionPrompt.SetText(__instance.playerUI, string.Empty);
__instance.strTextLabelPointingTo = string.Empty;
}
if (!__instance.gameManager.gameStateManager.IsGameStarted() || GameStats.GetInt(EnumGameStats.GameState) != 1)
{
__instance.stopMoving();
}
else
{
if (__instance.entityPlayerLocal.PlayerUI.windowManager.IsModalWindowOpen())
{
if (!__instance.IsGUICancelPressed && __instance.playerInput.PermanentActions.Cancel.WasPressed)
__instance.IsGUICancelPressed = true;
}
else if (__instance.IsGUICancelPressed)
__instance.IsGUICancelPressed = __instance.playerInput.PermanentActions.Cancel.GetBindingOfType(__instance.playerInput.ActiveDevice.DeviceClass == InputDeviceClass.Controller).GetState(__instance.playerInput.ActiveDevice);
__instance.updateRespawn();
__instance.updateDebugKeys();
if (__instance.drawChunkMode > 0)
{
__instance.DrawChunkBoundary();
if (__instance.drawChunkMode == 2)
__instance.DrawChunkDensities();
}
if (__instance.entityPlayerLocal.emodel.IsRagdollActive)
__instance.stopMoving();
else if (__instance.entityPlayerLocal.IsDead())
{
XUiC_InteractionPrompt.SetText(__instance.playerUI, (string)null);
__instance.strTextLabelPointingTo = string.Empty;
}
else
{
bool flag2 = false;
float num1 = __instance.playerInput.Scroll.Value;
if (__instance.playerInput.LastInputType == BindingSourceType.DeviceBindingSource)
{
if (!__instance.entityPlayerLocal.AimingGun)
num1 = 0.0f;
else
num1 *= 0.25f;
}
float num2 = num1 * 0.25f;
if ((double)Mathf.Abs(num2) < 1.0 / 1000.0)
num2 = 0.0f;
__instance.gameManager.GetActiveBlockTool().CheckKeys(__instance.entityPlayerLocal.inventory.holdingItemData, __instance.entityPlayerLocal.HitInfo, __instance.playerInput);
if (__instance.gameManager.IsEditMode() || BlockToolSelection.Instance.SelectionActive)
{
SelectionBoxManager.Instance.CheckKeys(__instance.gameManager, __instance.playerInput, __instance.entityPlayerLocal.HitInfo);
if (!flag2)
SelectionBoxManager.Instance.ConsumeScrollWheel(num2, __instance.playerInput);
flag2 = __instance.gameManager.GetActiveBlockTool().ConsumeScrollWheel(__instance.entityPlayerLocal.inventory.holdingItemData, num2, __instance.playerInput);
}
if (!(__instance.bCanControlOverride & flag1) && GamePrefs.GetInt(EnumGamePrefs.SelectionOperationMode) == 0)
{
__instance.stopMoving();
}
else
{
__instance.entityPlayerLocal.movementInput.lastInputController = __instance.playerInput.LastInputType == BindingSourceType.DeviceBindingSource;
if (!__instance.IsGUICancelPressed && (!__instance.gameManager.IsEditMode() || GamePrefs.GetInt(EnumGamePrefs.SelectionOperationMode) == 0))
{
bool controlKeyPressed = InputUtils.ControlKeyPressed;
PlayerAction playerAction1 = __instance.playerInput.VehicleActions.Enabled ? __instance.playerInput.VehicleActions.Turbo : __instance.playerInput.Run;
PlayerAction playerAction2 = __instance.playerInput.VehicleActions.Enabled ? __instance.playerInput.VehicleActions.MoveForward : __instance.playerInput.MoveForward;
if (playerAction1.WasPressed)
{
__instance.runInputTime = 0.0f;
__instance.entityPlayerLocal.movementInput.running = true;
__instance.entityPlayerLocal.AimingGun = false;
__instance.runPressedWhileActive = true;
}
else if (playerAction1.WasReleased && __instance.runPressedWhileActive)
{
if ((double)__instance.runInputTime > 0.20000000298023224)
{
__instance.entityPlayerLocal.movementInput.running = false;
__instance.runToggleActive = false;
}
else if (__instance.runToggleActive)
{
__instance.runToggleActive = false;
__instance.entityPlayerLocal.movementInput.running = false;
}
else if (playerAction2.IsPressed || __instance.sprintLockEnabled)
{
__instance.runToggleActive = true;
}
else
{
__instance.runToggleActive = false;
__instance.entityPlayerLocal.movementInput.running = false;
}
__instance.runPressedWhileActive = false;
}
if (playerAction1.IsPressed)
__instance.runInputTime += Time.deltaTime;
if (__instance.runToggleActive)
{
bool sprintLockEnabled = GamePrefs.GetBool(EnumGamePrefs.OptionsControlsSprintLock);
if ((double)__instance.entityPlayerLocal.Stamina <= 0.0 && !__instance.sprintLockEnabled)
{
__instance.runToggleActive = false;
__instance.runPressedWhileActive = false;
__instance.entityPlayerLocal.movementInput.running = false;
}
else if (playerAction2.WasReleased && !__instance.sprintLockEnabled)
{
__instance.entityPlayerLocal.movementInput.running = false;
__instance.runToggleActive = false;
__instance.runPressedWhileActive = false;
}
//else if (!sprintLockEnabled && playerAction1.WasReleased && !__instance.sprintLockEnabled)
else if (playerAction1.WasReleased && !__instance.sprintLockEnabled && !RebirthVariables.customRunToggle)
{
__instance.entityPlayerLocal.movementInput.running = false;
__instance.runToggleActive = false;
__instance.runPressedWhileActive = false;
}
else
__instance.entityPlayerLocal.movementInput.running = true;
}
__instance.entityPlayerLocal.movementInput.down = __instance.playerInput.Crouch.IsPressed && !(__instance.gameManager.IsEditMode() & controlKeyPressed);
__instance.entityPlayerLocal.movementInput.jump = __instance.playerInput.Jump.IsPressed;
if (__instance.entityPlayerLocal.movementInput.running && __instance.entityPlayerLocal.AimingGun)
__instance.entityPlayerLocal.AimingGun = false;
}
__instance.entityPlayerLocal.movementInput.downToggle = !__instance.gameManager.IsEditMode() && !__instance.entityPlayerLocal.IsFlyMode.Value && __instance.playerInput.ToggleCrouch.WasPressed;
if (GamePrefs.GetBool(EnumGamePrefs.DebugMenuEnabled) && __instance.playerInput.PermanentActions.DebugControllerLeft.IsPressed && __instance.playerInput.PermanentActions.DebugControllerRight.IsPressed)
{
if (__instance.playerInput.GodAlternate.WasPressed)
__instance.toggleGodMode();
if (__instance.playerInput.TeleportAlternate.WasPressed)
__instance.teleportPlayer();
}
if (__instance.playerInput.DecSpeed.WasPressed)
__instance.entityPlayerLocal.GodModeSpeedModifier = Utils.FastMax(0.1f, __instance.entityPlayerLocal.GodModeSpeedModifier - 0.1f);
if (__instance.playerInput.IncSpeed.WasPressed)
__instance.entityPlayerLocal.GodModeSpeedModifier = Utils.FastMin(3f, __instance.entityPlayerLocal.GodModeSpeedModifier + 0.1f);
Vector2 vector2_1;
Vector2 vector2_2;
if (__instance.playerInput.Look.LastInputType != BindingSourceType.MouseBindingSource)
{
__instance.entityPlayerLocal.movementInput.down = __instance.entityPlayerLocal.IsFlyMode.Value && __instance.playerInput.ToggleCrouch.IsPressed;
float magnitude;
if (__instance.playerInput.VehicleActions.Enabled)
{
vector2_1.x = __instance.playerInput.VehicleActions.Look.X;
vector2_1.y = __instance.playerInput.VehicleActions.Look.Y * (float)__instance.invertController;
magnitude = __instance.playerInput.VehicleActions.Look.Vector.magnitude;
}
else
{
vector2_1.x = __instance.playerInput.Look.X;
vector2_1.y = __instance.playerInput.Look.Y * (float)__instance.invertController;
magnitude = __instance.playerInput.Look.Vector.magnitude;
}
__instance.currentLookAcceleration = (double)__instance.lookAccelerationRate > 0.0 ? ((double)magnitude <= 0.0 ? 0.0f : Mathf.Clamp(__instance.currentLookAcceleration + __instance.lookAccelerationRate * magnitude * Time.unscaledDeltaTime, 0.0f, magnitude)) : 1f;
Vector2 controllerLookSensitivity = __instance.controllerLookSensitivity;
if (__instance.entityPlayerLocal.AimingGun)
controllerLookSensitivity *= __instance.controllerZoomSensitivity;
else if (__instance.playerInput.VehicleActions.Enabled)
controllerLookSensitivity *= __instance.controllerVehicleSensitivity;
vector2_2 = controllerLookSensitivity * __instance.lookAccelerationCurve.Evaluate(__instance.currentLookAcceleration);
if (__instance.entityPlayerLocal.AimingGun)
{
float num3 = Mathf.Lerp(0.2f, 1f, (float)(((double)__instance.entityPlayerLocal.playerCamera.fieldOfView - 10.0) / ((double)Constants.cDefaultCameraFieldOfView - 10.0)));
vector2_2 *= num3;
}
if (__instance.entityPlayerLocal.AttachedToEntity != null)
{
__instance.aimAssistSlowAmount = 1f;
}
else
{
bool flag3 = false;
WorldRayHitInfo hitInfo = __instance.entityPlayerLocal.HitInfo;
if (hitInfo.bHitValid)
{
if ((bool)hitInfo.transform)
{
Transform hitRootTransform = GameUtils.GetHitRootTransform(hitInfo.tag, hitInfo.transform);
if (hitRootTransform != null)
{
EntityAlive component;
if (hitRootTransform.TryGetComponent<EntityAlive>(out component) && component.IsAlive() && component.IsValidAimAssistSlowdownTarget && (double)hitInfo.hit.distanceSq <= 50.0 && (__instance.entityPlayerLocal.inventory.holdingItem.Actions[0] is ItemActionAttack || __instance.entityPlayerLocal.inventory.holdingItem.Actions[0] is ItemActionDynamicMelee))
{
__instance.bAimAssistTargetingItem = false;
flag3 = true;
}
else if ((hitInfo.tag.StartsWith("Item", StringComparison.Ordinal) || hitRootTransform.TryGetComponent<EntityItem>(out EntityItem _)) && (double)hitInfo.hit.distanceSq <= 10.0)
{
__instance.bAimAssistTargetingItem = true;
flag3 = true;
}
}
}
else if ((double)__instance.entityPlayerLocal.ThreatLevel.Numeric < 0.75 && GameUtils.IsBlockOrTerrain(hitInfo.tag) && __instance.entityPlayerLocal.PlayerUI.windowManager.IsWindowOpen("interactionPrompt"))
{
BlockValue blockValue = hitInfo.hit.blockValue;
if (!blockValue.Block.isMultiBlock && !blockValue.Block.isOversized && blockValue.Block.shape is BlockShapeModelEntity)
{
__instance.bAimAssistTargetingItem = true;
flag3 = true;
}
}
}
__instance.aimAssistSlowAmount = !flag3 ? Mathf.MoveTowards(__instance.aimAssistSlowAmount, 1f, Time.unscaledDeltaTime * 5f) : (__instance.bAimAssistTargetingItem ? 0.6f : 0.5f);
vector2_2 *= __instance.aimAssistSlowAmount;
if (__instance.controllerAimAssistsEnabled && __instance.cameraSnapTargetEntity != null && __instance.cameraSnapTargetEntity.IsAlive() && (double)Time.time - (double)__instance.cameraSnapTime < 0.30000001192092896)
{
Vector2 vector2_3 = Vector2.one * 0.5f;
Vector2 vector2_4 = (Vector2)(__instance.snapTargetingHead ? __instance.entityPlayerLocal.playerCamera.WorldToViewportPoint(__instance.cameraSnapTargetEntity.emodel.GetHeadTransform().position) : __instance.entityPlayerLocal.playerCamera.WorldToViewportPoint(__instance.cameraSnapTargetEntity.GetChestTransformPosition())) - vector2_3;
float num4 = __instance.cameraSnapMode == eCameraSnapMode.MeleeAttack ? 1.5f : 1f;
vector2_1 += vector2_4.normalized * num4 * vector2_4.magnitude / 0.15f;
}
}
}
else
{
vector2_2 = __instance.mouseLookSensitivity;
Vector2 vector2_5 = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (float)__instance.invertMouse);
vector2_1 = (vector2_5 + __instance.previousMouseInput) / 2f;
__instance.previousMouseInput = vector2_5;
if (__instance.playerInput.VehicleActions.Enabled)
{
vector2_2 *= __instance.vehicleLookSensitivity;
}
else
{
float magnitude = vector2_1.magnitude;
float num5 = 1f;
if (__instance.entityPlayerLocal.AimingGun && (double)magnitude > 0.0)
{
Vector2 vector2_6 = vector2_2 * __instance.mouseZoomSensitivity;
float num6 = Mathf.Pow(magnitude * 0.4f, 2.5f) / magnitude;
float num7 = (num5 + num6 * __instance.zoomAccel) * Mathf.Lerp(0.2f, 1f, (float)(((double)__instance.entityPlayerLocal.playerCamera.fieldOfView - 10.0) / ((double)Constants.cDefaultCameraFieldOfView - 10.0)));
vector2_2 = vector2_6 * num7;
if ((double)vector2_2.magnitude > (double)__instance.mouseLookSensitivity.magnitude)
vector2_2 = __instance.mouseLookSensitivity;
}
}
if (__instance.skipMouseLookNextFrame > 0 && ((double)vector2_1.x <= -1.0 || (double)vector2_1.x >= 1.0 || (double)vector2_1.y <= -1.0 || (double)vector2_1.y >= 1.0))
{
--__instance.skipMouseLookNextFrame;
vector2_1 = Vector2.zero;
}
}
MovementInput movementInput = __instance.entityPlayerLocal.movementInput;
if (!movementInput.bDetachedCameraMove)
{
PlayerActionsLocal playerInput = __instance.playerInput;
movementInput.moveForward = __instance.playerAutoPilotControllor == null || !__instance.playerAutoPilotControllor.IsEnabled() ? playerInput.Move.Y : __instance.playerAutoPilotControllor.GetForwardMovement();
movementInput.moveStrafe = playerInput.Move.X;
if (movementInput.bCameraPositionLocked)
vector2_1 = Vector2.zero;
if (PlayerMoveController.useScaledMouseLook && !__instance.entityPlayerLocal.movementInput.lastInputController)
{
movementInput.rotation.x += vector2_1.y * vector2_2.y * Time.unscaledDeltaTime * PlayerMoveController.mouseDeltaTimeScale;
movementInput.rotation.y += vector2_1.x * vector2_2.x * Time.unscaledDeltaTime * PlayerMoveController.mouseDeltaTimeScale;
}
else if (__instance.entityPlayerLocal.movementInput.lastInputController)
{
movementInput.rotation.x += vector2_1.y * vector2_2.y * Time.unscaledDeltaTime * PlayerMoveController.lookDeltaTimeScale;
movementInput.rotation.y += vector2_1.x * vector2_2.x * Time.unscaledDeltaTime * PlayerMoveController.lookDeltaTimeScale;
}
else
{
movementInput.rotation.x += vector2_1.y * vector2_2.y;
movementInput.rotation.y += vector2_1.x * vector2_2.x;
}
bool flag4 = __instance.entityPlayerLocal.IsGodMode.Value;
movementInput.bCameraChange = playerInput.CameraChange.IsPressed && !flag4 && !playerInput.Primary.IsPressed && !playerInput.Secondary.IsPressed;
if (movementInput.bCameraChange)
{
flag2 = true;
if (__instance.entityPlayerLocal.bFirstPersonView)
{
if ((double)num2 < 0.0)
{
__instance.entityPlayerLocal.SwitchFirstPersonViewFromInput();
__instance.wasCameraChangeUsedWithWheel = true;
}
}
else
{
movementInput.cameraDistance = Utils.FastMin(movementInput.cameraDistance - 2f * num2, 3f);
if ((double)movementInput.cameraDistance < -0.20000000298023224)
{
movementInput.cameraDistance = -0.2f;
__instance.entityPlayerLocal.SwitchFirstPersonViewFromInput();
}
if ((double)num2 != 0.0)
__instance.wasCameraChangeUsedWithWheel = true;
}
}
if (playerInput.CameraChange.WasReleased && !flag4)
{
if (!__instance.wasCameraChangeUsedWithWheel && !playerInput.Primary.IsPressed && !playerInput.Secondary.IsPressed)
__instance.entityPlayerLocal.SwitchFirstPersonViewFromInput();
__instance.wasCameraChangeUsedWithWheel = false;
}
if ((__instance.gameManager.IsEditMode() || BlockToolSelection.Instance.SelectionActive) && (Input.GetKey(KeyCode.LeftControl) || GamePrefs.GetInt(EnumGamePrefs.SelectionOperationMode) != 0))
movementInput.Clear();
__instance.entityPlayerLocal.MoveByInput();
}
else
{
float num8 = 0.15f;
float num9 = !__instance.entityPlayerLocal.movementInput.running ? num8 * __instance.entityPlayerLocal.GodModeSpeedModifier : num8 * 3f;
if (__instance.playerInput.MoveForward.IsPressed)
__instance.entityPlayerLocal.cameraTransform.position += __instance.entityPlayerLocal.cameraTransform.forward * num9;
if (__instance.playerInput.MoveBack.IsPressed)
__instance.entityPlayerLocal.cameraTransform.position -= __instance.entityPlayerLocal.cameraTransform.forward * num9;
if (__instance.playerInput.MoveLeft.IsPressed)
__instance.entityPlayerLocal.cameraTransform.position -= __instance.entityPlayerLocal.cameraTransform.right * num9;
if (__instance.playerInput.MoveRight.IsPressed)
__instance.entityPlayerLocal.cameraTransform.position += __instance.entityPlayerLocal.cameraTransform.right * num9;
if (__instance.playerInput.Jump.IsPressed)
__instance.entityPlayerLocal.cameraTransform.position += Vector3.up * num9;
if (__instance.playerInput.Crouch.IsPressed)
__instance.entityPlayerLocal.cameraTransform.position -= Vector3.up * num9;
if (!movementInput.bCameraPositionLocked)
{
Vector3 localEulerAngles = __instance.entityPlayerLocal.cameraTransform.localEulerAngles;
__instance.entityPlayerLocal.cameraTransform.localEulerAngles = new Vector3(localEulerAngles.x - vector2_1.y, localEulerAngles.y + vector2_1.x, localEulerAngles.z);
}
}
bool _bAlternativeBlockPos = __instance.gameManager.IsEditMode() && __instance.playerInput.Run.IsPressed;
Ray ray = __instance.entityPlayerLocal.GetLookRay();
if (__instance.gameManager.IsEditMode() && GamePrefs.GetInt(EnumGamePrefs.SelectionOperationMode) == 4)
{
ray = __instance.entityPlayerLocal.cameraTransform.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
ray.origin += Origin.position;
}
ray.origin += ray.direction.normalized * 0.1f;
float num10 = Utils.FastMax(Utils.FastMax(Constants.cDigAndBuildDistance, Constants.cCollectItemDistance), 30f);
RaycastHit hitInfo1;
bool flag5 = Physics.Raycast(new Ray(ray.origin - Origin.position, ray.direction), out hitInfo1, num10, 73728);
bool flag6 = false;
if (flag5 && hitInfo1.transform.CompareTag("E_BP_Body"))
flag6 = true;
if (flag5)
flag5 &= hitInfo1.transform.CompareTag("Item");
int _hitMask1 = 69;
bool flag7;
if (!__instance.gameManager.IsEditMode())
{
flag7 = Voxel.Raycast(__instance.gameManager.World, ray, num10, -555528213, _hitMask1, 0.0f);
if (flag7)
{
Transform hitRootTransform = GameUtils.GetHitRootTransform(Voxel.voxelRayHitInfo.tag, Voxel.voxelRayHitInfo.transform);
Entity component;
EntityAlive entityAlive = !(hitRootTransform != null) || !hitRootTransform.TryGetComponent<Entity>(out component) ? (EntityAlive)null : component as EntityAlive;
if (entityAlive == null || !entityAlive.IsDead())
flag7 = Voxel.Raycast(__instance.gameManager.World, ray, num10, -555266069, _hitMask1, 0.0f);
}
}
else
{
int _hitMask2 = _hitMask1 | 256;
int _layerMask = -555266069 | 268435456;
if (!GameManager.bVolumeBlocksEditing)
_layerMask = int.MinValue;
flag7 = Voxel.RaycastOnVoxels(__instance.gameManager.World, ray, num10, _layerMask, _hitMask2, 0.0f);
if (flag7 && !GameManager.bVolumeBlocksEditing)
{
Voxel.voxelRayHitInfo.lastBlockPos = Vector3i.zero;
Voxel.voxelRayHitInfo.hit.voxelData.Clear();
Voxel.voxelRayHitInfo.hit.blockPos = Vector3i.zero;
}
}
WorldRayHitInfo hitInfo2 = __instance.entityPlayerLocal.HitInfo;
Vector3i zero = Vector3i.zero;
Vector3i _blockPos = Vector3i.zero;
if (flag7)
{
hitInfo2.CopyFrom(Voxel.voxelRayHitInfo);
_blockPos = hitInfo2.hit.blockPos;
Vector3i lastBlockPos = hitInfo2.lastBlockPos;
hitInfo2.bHitValid = true;
}
else
hitInfo2.bHitValid = false;
BlockValue blockValue1 = hitInfo2.hit.blockValue;
if (!blockValue1.isair)
{
blockValue1 = hitInfo2.hit.blockValue;
Block block = blockValue1.Block;
if (!block.IsCollideMovement || block.CanBlocksReplace)
hitInfo2.lastBlockPos = _blockPos;
}
float num11 = flag5 ? hitInfo1.distance : 1000f;
if (flag7 && GameUtils.IsBlockOrTerrain(hitInfo2.tag))
{
num11 -= 1.2f;
if ((double)num11 < 0.0)
num11 = 0.1f;
}
if (flag5 && (!flag7 || flag7 && (double)num11 * (double)num11 <= (double)hitInfo2.hit.distanceSq))
{
hitInfo2.bHitValid = true;
hitInfo2.tag = "Item";
hitInfo2.transform = hitInfo1.collider.transform;
hitInfo2.hit.pos = hitInfo1.point;
hitInfo2.hit.blockPos = World.worldToBlockPos(hitInfo2.hit.pos);
hitInfo2.hit.distanceSq = hitInfo1.distance * hitInfo1.distance;
}
if (flag6 && (double)hitInfo1.distance * (double)hitInfo1.distance <= (double)hitInfo2.hit.distanceSq)
{
hitInfo2.bHitValid = true;
hitInfo2.tag = "E_BP_Body";
hitInfo2.transform = hitInfo1.collider.transform;
hitInfo2.hit.pos = hitInfo1.point;
hitInfo2.hit.blockPos = World.worldToBlockPos(hitInfo2.hit.pos);
hitInfo2.hit.distanceSq = hitInfo1.distance * hitInfo1.distance;
}
bool flag8 = true;
EntityCollisionRules component1;
if ((bool)hitInfo2.hitCollider && hitInfo2.hitCollider.TryGetComponent<EntityCollisionRules>(out component1) && !component1.IsInteractable)
flag8 = false;
if (__instance.entityPlayerLocal.inventory != null && __instance.entityPlayerLocal.inventory.holdingItemData != null)
__instance.entityPlayerLocal.inventory.holdingItemData.hitInfo = __instance.entityPlayerLocal.HitInfo;
TileEntity _te1 = (TileEntity)null;
EntityTurret entityTurret = (EntityTurret)null;
bool flag9 = true;
bool flag10 = true;
bool flag11 = __instance.playerInput.Primary.IsPressed && __instance.bAllowPlayerInput && !__instance.IsGUICancelPressed;
bool flag12 = __instance.playerInput.Secondary.IsPressed && __instance.bAllowPlayerInput && !__instance.IsGUICancelPressed;
if (flag11 && GameManager.Instance.World.IsEditor())
{
if (__instance.bIgnoreLeftMouseUntilReleased)
flag11 = false;
}
else
__instance.bIgnoreLeftMouseUntilReleased = false;
bool flag13 = false;
ITileEntityLootable _te2 = (ITileEntityLootable)null;
EntityItem focusedItem = (EntityItem)null;
BlockValue _bv = BlockValue.Air;
ProjectileMoveScript projectileMoveScript = (ProjectileMoveScript)null;
ThrownWeaponMoveScript weaponMoveScript = (ThrownWeaponMoveScript)null;
string str1 = (string)null;
bool _bMeshSelected = GameManager.Instance.IsEditMode() && __instance.entityPlayerLocal.HitInfo.transform != null && __instance.entityPlayerLocal.HitInfo.transform.gameObject.layer == 28;
Entity _entity = (Entity)null;
if (__instance.entityPlayerLocal.AttachedToEntity == null & flag8)
{
if (hitInfo2.bHitValid && (_bMeshSelected |= GameUtils.IsBlockOrTerrain(hitInfo2.tag)))
{
blockValue1 = hitInfo2.hit.blockValue;
int activationDistanceSq = blockValue1.Block.GetActivationDistanceSq();
if ((double)hitInfo2.hit.distanceSq < (double)activationDistanceSq)
{
_bv = hitInfo2.hit.blockValue;
Block block = _bv.Block;
BlockValue _blockValue = _bv;
Vector3i vector3i = _blockPos;
if (_blockValue.ischild && block != null && block.multiBlockPos != null)
{
vector3i = block.multiBlockPos.GetParentPos(vector3i, _blockValue);
_blockValue = __instance.gameManager.World.GetBlock(hitInfo2.hit.clrIdx, vector3i);
}
if (block.HasBlockActivationCommands((WorldBase)__instance.gameManager.World, _blockValue, hitInfo2.hit.clrIdx, vector3i, (EntityAlive)__instance.entityPlayerLocal))
{
str1 = block.GetActivationText((WorldBase)__instance.gameManager.World, _blockValue, hitInfo2.hit.clrIdx, vector3i, (EntityAlive)__instance.entityPlayerLocal);
if (str1 != null)
{
string str2 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = string.Format(str1, (object)str2);
}
_te1 = __instance.gameManager.World.GetTileEntity(hitInfo2.hit.clrIdx, _blockPos);
}
else if (block.DisplayInfo == Block.EnumDisplayInfo.Name)
str1 = block.GetLocalizedBlockName();
else if (block.DisplayInfo == Block.EnumDisplayInfo.Description)
str1 = Localization.Get(block.DescriptionKey);
else if (block.DisplayInfo == Block.EnumDisplayInfo.Custom)
str1 = block.GetCustomDescription(vector3i, _bv);
if (flag12 && InputUtils.ShiftKeyPressed && InputUtils.AltKeyPressed && __instance.gameManager.IsEditMode())
{
GUIWindowEditBlockValue window = (GUIWindowEditBlockValue)__instance.windowManager.GetWindow(GUIWindowEditBlockValue.ID);
if (window != null)
{
window.SetBlock(hitInfo2.hit.blockPos, hitInfo2.hit.blockFace);
__instance.windowManager.Open(GUIWindowEditBlockValue.ID, true);
flag9 = false;
}
}
if (flag12 && InputUtils.ShiftKeyPressed && InputUtils.AltKeyPressed && __instance.gameManager.IsEditMode() && _bv.Block is BlockSpawnEntity)
{
__instance.windowManager.GetWindow<GUIWindowEditBlockSpawnEntity>(GUIWindowEditBlockSpawnEntity.ID).SetBlockValue(hitInfo2.hit.blockPos, _bv);
__instance.windowManager.Open(GUIWindowEditBlockSpawnEntity.ID, true);
flag9 = false;
}
}
}
else if (hitInfo2.bHitValid && hitInfo2.tag.Equals("Item") && (double)hitInfo2.hit.distanceSq < (double)Constants.cCollectItemDistance * (double)Constants.cCollectItemDistance)
{
focusedItem = hitInfo2.transform.GetComponent<EntityItem>();
RootTransformRefEntity component2;
if (focusedItem == null && (component2 = hitInfo2.transform.GetComponent<RootTransformRefEntity>()) != null && component2.RootTransform != null)
focusedItem = component2.RootTransform.GetComponent<EntityItem>();
if (focusedItem != null)
{
if (focusedItem.onGround && focusedItem.CanCollect())
{
string localizedItemName = ItemClass.GetForId(focusedItem.itemStack.itemValue.type).GetLocalizedItemName();
string str3 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = focusedItem.itemStack.count <= 1 ? string.Format(Localization.Get("itemTooltipFocusedOne"), (object)str3, (object)localizedItemName) : string.Format(Localization.Get("itemTooltipFocusedSeveral"), (object)str3, (object)localizedItemName, (object)focusedItem.itemStack.count);
}
}
else
{
projectileMoveScript = hitInfo2.transform.GetComponent<ProjectileMoveScript>();
if (projectileMoveScript != null)
{
string localizedItemName = ItemClass.GetForId(projectileMoveScript.itemValueProjectile.type).GetLocalizedItemName();
string str4 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = string.Format(Localization.Get("itemTooltipFocusedOne"), (object)str4, (object)localizedItemName);
}
weaponMoveScript = hitInfo2.transform.GetComponent<ThrownWeaponMoveScript>();
if (weaponMoveScript != null)
{
string localizedItemName = ItemClass.GetForId(weaponMoveScript.itemValueWeapon.type).GetLocalizedItemName();
string str5 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = string.Format(Localization.Get("itemTooltipFocusedOne"), (object)str5, (object)localizedItemName);
}
}
}
else if (hitInfo2.bHitValid && hitInfo2.tag.StartsWith("E_") && (double)hitInfo2.hit.distanceSq < (double)Constants.cCollectItemDistance * (double)Constants.cCollectItemDistance)
{
Transform hitRootTransform = GameUtils.GetHitRootTransform(hitInfo2.tag, hitInfo2.transform);
if (hitRootTransform != null && (_entity = hitRootTransform.GetComponent<Entity>()) != null)
{
if ((projectileMoveScript = hitRootTransform.GetComponentInChildren<ProjectileMoveScript>()) != null)
{
if (!_entity.IsDead() && (_entity as EntityPlayer) != null && (_entity as EntityPlayer).inventory != null && (_entity as EntityPlayer).inventory.holdingItem != null && (_entity as EntityPlayer).inventory.holdingItem.HasAnyTags(PlayerMoveController.BowTag))
projectileMoveScript = (ProjectileMoveScript)null;
if (_entity.IsDead())
{
string localizedItemName = ItemClass.GetForId(projectileMoveScript.itemValueProjectile.type).GetLocalizedItemName();
string str6 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = string.Format(Localization.Get("itemTooltipFocusedOne"), (object)str6, (object)localizedItemName);
}
}
else if ((weaponMoveScript = hitRootTransform.GetComponentInChildren<ThrownWeaponMoveScript>()) != null)
{
if (!_entity.IsDead() && (_entity as EntityPlayer) != null && (_entity as EntityPlayer).inventory != null && (_entity as EntityPlayer).inventory.holdingItem != null && (_entity as EntityPlayer).inventory.holdingItem.HasAnyTags(PlayerMoveController.BowTag))
weaponMoveScript = (ThrownWeaponMoveScript)null;
if (_entity.IsDead())
{
string localizedItemName = ItemClass.GetForId(weaponMoveScript.itemValueWeapon.type).GetLocalizedItemName();
string str7 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = string.Format(Localization.Get("itemTooltipFocusedOne"), (object)str7, (object)localizedItemName);
}
}
// ADDED - START
else if (_entity is EntityAnimalChickenRebirth && _entity.IsAlive())
{
EntityAnimalChickenRebirth EntityAnimalChickenRebirth = (EntityAnimalChickenRebirth)_entity;
Transform hitRootTransform2 = GameUtils.GetHitRootTransform(hitInfo2.tag, hitInfo2.transform);
Entity entityChicken = null;
TileEntity tileEntityFocus = __instance.gameManager.World.GetTileEntity(_entity.entityId);
if (tileEntityFocus != null && hitRootTransform2 != null && (entityChicken = hitRootTransform2.GetComponent<Entity>()) != null)
{
float distanceFocus = __instance.entityPlayerLocal.GetDistance(entityChicken);
if (distanceFocus <= EntityAnimalChickenRebirth.flCaptureDistance)
{
//Log.Out("PlayerMoveControllerUpdate-UpdatePostFix holdingItem: " + __instance.entityPlayerLocal.inventory.holdingItem.GetItemName().ToLower());
if (EntityAnimalChickenRebirth.GetActivationCommands(tileEntityFocus.ToWorldPos(), __instance.entityPlayerLocal).Length != 0)
{
if (__instance.playerInput.PermanentActions.Activate.WasPressed || __instance.playerInput.Activate.IsPressed)
{
if (__instance.entityPlayerLocal.inventory.holdingItem.GetItemName().ToLower() == "meleehandplayer")
{
__instance.entityPlayerLocal.AimingGun = false;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetCurrentEntityData(__instance.gameManager.World, EntityAnimalChickenRebirth, tileEntityFocus, __instance.entityPlayerLocal);
}
else
{
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal as global::EntityPlayerLocal, Localization.Get("ttBareHands"), string.Empty, "ui_denied", null);
}
//Log.Out("PlayerMoveControllerUpdate-UpdatePostFix 6");
}
}
}
}
}
// ADDED - END
else if (_entity is EntityNPC && _entity.IsAlive())
{
_te1 = (TileEntity)(__instance.gameManager.World.GetTileEntity(_entity.entityId) as TileEntityTrader);
if (_te1 != null)
{
EntityTrader entityTrader = (EntityTrader)_entity;
string str8 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
string str9 = Localization.Get(entityTrader.EntityName);
str1 = string.Format(Localization.Get("npcTooltipTalk"), (object)str8, (object)str9);
entityTrader.HandleClientQuests((EntityPlayer)__instance.entityPlayerLocal);
}
else
{
_te1 = __instance.gameManager.World.GetTileEntity(_entity.entityId);
if (_te1 != null)
{
string str10 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
string str11 = Localization.Get(((EntityAlive)_entity).EntityName);
str1 = string.Format(Localization.Get("npcTooltipTalk"), (object)str10, (object)str11);
// ADDITION - START Should not show the interaction prompt if the entity is hostile
if (_entity is EntityAliveV2)
{
if (EntityTargetingUtilities.CanTakeDamage(__instance.entityPlayerLocal, (EntityAlive)_entity))
{
str1 = "";
}
}
// ADDITION - END
if (_entity is EntityDrone)
{
EntityDrone entityDrone = _entity as EntityDrone;
if ((bool)entityDrone && entityDrone.IsLocked() && !entityDrone.IsUserAllowed(PlatformManager.InternalLocalUserIdentifier))
str1 = Localization.Get("ttLocked") + "\n" + str1;
}
}
}
}
else if ((_entity as EntityTurret) != null)
{
entityTurret = _entity as EntityTurret;
if (entityTurret.CanInteract(__instance.entityPlayerLocal.entityId))
{
string str12 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
string str13 = Localization.Get(((EntityAlive)_entity).EntityName);
str1 = string.Format(Localization.Get("turretPickUp"), (object)str12, (object)str13);
}
}
else if (!string.IsNullOrEmpty(_entity.GetLootList()))
{
_te2 = __instance.gameManager.World.GetTileEntity(_entity.entityId).GetSelfOrFeature<ITileEntityLootable>();
if (_te2 != null)
{
string str14 = Localization.Get(EntityClass.list[_entity.entityClass].entityClassName);
string str15 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
string str16 = str14;
switch (_entity)
{
case EntityNPC _ when _entity.IsAlive():
str1 = string.Format(Localization.Get("npcTooltipTalk"), (object)str15, (object)str16);
EntityDrone entityDrone = _entity as EntityDrone;
if ((bool)entityDrone && entityDrone.IsLocked() && !entityDrone.IsUserAllowed(PlatformManager.InternalLocalUserIdentifier))
{
str1 = Localization.Get("ttLocked") + "\n" + str1;
break;
}
break;
case EntityDriveable _ when _entity.IsAlive():
str1 = string.Format(Localization.Get("tooltipInteract"), (object)str15, (object)str16);
if (((EntityVehicle)_entity).IsLockedForLocalPlayer((EntityAlive)__instance.entityPlayerLocal))
{
str1 = Localization.Get("ttLocked") + "\n" + str1;
break;
}
break;
default:
// ADDITION - START
//Log.Out("_entity.GetLootList(): " + _entity.GetLootList());
//Log.Out("_te2.bTouched: " + _te2.bTouched);
//Log.Out("_te2.IsEmpty(): " + _te2.IsEmpty());
//Log.Out("Localization.Get(lootTooltipTouched): " + Localization.Get("lootTooltipTouched"));
//Log.Out("Localization.Get(lootTooltipEmpty): " + Localization.Get("lootTooltipEmpty"));
//Log.Out("Localization.Get(lootTooltipNew): " + Localization.Get("lootTooltipNew"));
//Log.Out("str15: " + str15);
//Log.Out("str16: " + str16);
if (_te2.bTouched)
{
if (!_te2.IsEmpty())
{
str1 = string.Format(Localization.Get("lootTooltipTouched"), str15, str16);
}
else
{
str1 = string.Format(Localization.Get("lootTooltipEmpty"), str15, str16);
}
}
else
{
if (_entity.IsAlive() || (!string.IsNullOrEmpty(_entity.lootListOnDeath) && _entity.IsDead()))
{
if (!(_entity is EntityAliveV2 && _entity.GetLootList().ToLower() == "traderNPC"))
{
str1 = string.Format(Localization.Get("lootTooltipNew"), str15, str16);
}
}
}
// ADDITION - END
// VANILLA VALUE
//str1 = _te2.bTouched ? (!_te2.IsEmpty() ? string.Format(Localization.Get("lootTooltipTouched"), (object)str15, (object)str16) : string.Format(Localization.Get("lootTooltipEmpty"), (object)str15, (object)str16)) : string.Format(Localization.Get("lootTooltipNew"), (object)str15, (object)str16);
break;
}
}
}
}
}
if (str1 == null)
{
__instance.InteractName = (string)null;
if (__instance.entityPlayerLocal.IsMoveStateStill() && (!__instance.entityPlayerLocal.IsSwimming() || (double)__instance.entityPlayerLocal.cameraTransform.up.y < 0.699999988079071))
{
__instance.InteractName = __instance.entityPlayerLocal.inventory.CanInteract();
if (__instance.InteractName != null && (double)__instance.InteractWaitTime == 0.0)
__instance.InteractWaitTime = Time.time + 0.3f;
}
if (__instance.InteractName != null)
{
if ((double)Time.time >= (double)__instance.InteractWaitTime)
{
flag13 = true;
string str17 = __instance.playerInput.Activate.GetBindingXuiMarkupString() + __instance.playerInput.PermanentActions.Activate.GetBindingXuiMarkupString();
str1 = string.Format(Localization.Get("ttPressTo"), (object)str17, (object)Localization.Get(__instance.InteractName));
}
}
else
__instance.InteractWaitTime = 0.0f;
}
else
__instance.InteractWaitTime = 0.0f;
}
if (__instance.entityPlayerLocal.IsAlive())
{
if (!string.Equals(str1, __instance.strTextLabelPointingTo) && ((double)Time.time - (double)__instance.timeActivatePressed > 0.5 || string.IsNullOrEmpty(str1)))
{
XUiC_InteractionPrompt.SetText(__instance.playerUI, str1);
__instance.strTextLabelPointingTo = str1;
}
}
else
{
__instance.strTextLabelPointingTo = "";
XUiC_InteractionPrompt.SetText(__instance.playerUI, (string)null);
}
__instance.FocusBoxPosition = hitInfo2.lastBlockPos;
if (_bAlternativeBlockPos || __instance.entityPlayerLocal.inventory != null && __instance.entityPlayerLocal.inventory.holdingItem.IsFocusBlockInside())
__instance.FocusBoxPosition = _blockPos;
__instance.focusBoxScript.Update(_bMeshSelected, __instance.gameManager.World, hitInfo2, __instance.FocusBoxPosition, (EntityAlive)__instance.entityPlayerLocal, __instance.gameManager.persistentLocalPlayer, _bAlternativeBlockPos);
if (!__instance.windowManager.IsInputActive() && !__instance.windowManager.IsFullHUDDisabled() && (__instance.playerInput.Activate.IsPressed || __instance.playerInput.VehicleActions.Activate.IsPressed || __instance.playerInput.PermanentActions.Activate.IsPressed))
{
if (__instance.playerInput.Activate.WasPressed || __instance.playerInput.VehicleActions.Activate.WasPressed || __instance.playerInput.PermanentActions.Activate.WasPressed)
{
__instance.timeActivatePressed = Time.time;
if (flag13 && hitInfo2.bHitValid && GameUtils.IsBlockOrTerrain(hitInfo2.tag))
_bv = BlockValue.Air;
if (__instance.entityPlayerLocal.AttachedToEntity != null)
__instance.entityPlayerLocal.SendDetach();
else if (entityTurret != null || projectileMoveScript != null || weaponMoveScript != null || focusedItem != null || !_bv.isair || _te2 != null || _te1 != null)
{
BlockValue _blockValue = _bv;
Vector3i vector3i = _blockPos;
if (_blockValue.ischild)
{
vector3i = _blockValue.Block.multiBlockPos.GetParentPos(vector3i, _blockValue);
_blockValue = __instance.gameManager.World.GetBlock(hitInfo2.hit.clrIdx, vector3i);
}
if (!_blockValue.Equals(BlockValue.Air) && _blockValue.Block.HasBlockActivationCommands((WorldBase)__instance.gameManager.World, _blockValue, hitInfo2.hit.clrIdx, vector3i, (EntityAlive)__instance.entityPlayerLocal))
{
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetCurrentBlockData((WorldBase)__instance.gameManager.World, vector3i, hitInfo2.hit.clrIdx, _blockValue, __instance.entityPlayerLocal);
flag9 = true;
}
else if (_te2 != null && _entity.GetActivationCommands(_te2.ToWorldPos(), (EntityAlive)__instance.entityPlayerLocal).Length != 0)
{
__instance.entityPlayerLocal.AimingGun = false;
_te2.bWasTouched = _te2.bTouched;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetCurrentEntityData((WorldBase)__instance.gameManager.World, _entity, (ITileEntity)_te2, (EntityAlive)__instance.entityPlayerLocal);
flag9 = true;
}
else if (_te1 != null && _entity.GetActivationCommands(_te1.ToWorldPos(), (EntityAlive)__instance.entityPlayerLocal).Length != 0)
{
__instance.entityPlayerLocal.AimingGun = false;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetCurrentEntityData((WorldBase)__instance.gameManager.World, _entity, (ITileEntity)_te1, (EntityAlive)__instance.entityPlayerLocal);
flag9 = true;
}
else if (entityTurret != null)
{
if (entityTurret.CanInteract(__instance.entityPlayerLocal.entityId))
{
ItemStack _itemStack = new ItemStack(entityTurret.OriginalItemValue, 1);
if (__instance.entityPlayerLocal.inventory.CanTakeItem(_itemStack) || __instance.entityPlayerLocal.bag.CanTakeItem(_itemStack))
__instance.gameManager.CollectEntityServer(entityTurret.entityId, __instance.playerUI.entityPlayer.entityId);
else
GameManager.ShowTooltip(__instance.entityPlayerLocal, Localization.Get("xuiInventoryFullForPickup"), string.Empty, "ui_denied");
}
}
else
{
__instance.windowManager.Close("radial");
if (focusedItem != null)
{
EntityItem entityItem = focusedItem;
if (entityItem != null && entityItem.CanCollect() && entityItem.onGround)
{
if (__instance.entityPlayerLocal.inventory.CanTakeItem(entityItem.itemStack) || __instance.entityPlayerLocal.bag.CanTakeItem(entityItem.itemStack))
__instance.gameManager.CollectEntityServer(focusedItem.entityId, __instance.entityPlayerLocal.entityId);
else
GameManager.ShowTooltip(__instance.entityPlayerLocal, Localization.Get("xuiInventoryFullForPickup"), string.Empty, "ui_denied");
}
}
else if (projectileMoveScript != null)
{
if (projectileMoveScript.itemProjectile.IsSticky)
{
ItemStack _itemStack = new ItemStack(projectileMoveScript.itemValueProjectile, 1);
if (__instance.entityPlayerLocal.inventory.CanTakeItem(_itemStack) || __instance.entityPlayerLocal.bag.CanTakeItem(_itemStack))
{
__instance.playerUI.xui.PlayerInventory.AddItem(_itemStack);
projectileMoveScript.ProjectileID = -1;
UnityEngine.Object.Destroy(projectileMoveScript.gameObject);
}
else
GameManager.ShowTooltip(__instance.entityPlayerLocal, Localization.Get("xuiInventoryFullForPickup"), string.Empty, "ui_denied");
}
}
else if (weaponMoveScript != null)
{
if (weaponMoveScript.itemWeapon.IsSticky)
{
ItemStack _itemStack = new ItemStack(weaponMoveScript.itemValueWeapon, 1);
if (__instance.entityPlayerLocal.inventory.CanTakeItem(_itemStack) || __instance.entityPlayerLocal.bag.CanTakeItem(_itemStack))
{
__instance.playerUI.xui.PlayerInventory.AddItem(_itemStack);
weaponMoveScript.ProjectileID = -1;
UnityEngine.Object.Destroy(weaponMoveScript.gameObject);
}
else
GameManager.ShowTooltip(__instance.entityPlayerLocal, Localization.Get("xuiInventoryFullForPickup"), string.Empty, "ui_denied");
}
}
else
__instance.suckItemsNearby(focusedItem);
}
}
else if (flag13)
__instance.entityPlayerLocal.inventory.Interact();
}
else
{
__instance.windowManager.Close("radial");
__instance.suckItemsNearby(focusedItem);
}
}
if (__instance.gameManager.IsEditMode() & flag11 & flag10 && !__instance.playerInput.Drop.IsPressed)
{
WorldRayHitInfo _other = Voxel.voxelRayHitInfo.Clone();
int _hitMask3 = 325;
int minValue = int.MinValue;
if (Voxel.RaycastOnVoxels(__instance.gameManager.World, ray, 250f, minValue, _hitMask3, 0.0f) && SelectionBoxManager.Instance.Select(Voxel.voxelRayHitInfo))
{
flag10 = false;
__instance.bIgnoreLeftMouseUntilReleased = true;
}
Voxel.voxelRayHitInfo.CopyFrom(_other);
}
if (flag11 && (GameManager.Instance.World.IsEditor() || BlockToolSelection.Instance.SelectionActive))
flag11 &= !__instance.playerInput.Drop.IsPressed;
int _idx = __instance.playerInput.InventorySlotWasPressed;
if (_idx >= 0)
{
if (__instance.playerInput.LastInputType == BindingSourceType.DeviceBindingSource)
{
if (__instance.entityPlayerLocal.AimingGun)
_idx = -1;
}
else if (InputUtils.ShiftKeyPressed && __instance.entityPlayerLocal.inventory.PUBLIC_SLOTS > __instance.entityPlayerLocal.inventory.SHIFT_KEY_SLOT_OFFSET)
{
if (RebirthVariables.customShiftToolbelt)
{
_idx += __instance.entityPlayerLocal.inventory.SHIFT_KEY_SLOT_OFFSET;
}
}
}
if (__instance.inventoryScrollPressed && __instance.inventoryScrollIdxToSelect != -1)
_idx = __instance.inventoryScrollIdxToSelect;
if (!flag2)
flag2 = __instance.entityPlayerLocal.inventory.holdingItem.ConsumeScrollWheel(__instance.entityPlayerLocal.inventory.holdingItemData, num2, __instance.playerInput);
__instance.entityPlayerLocal.inventory.holdingItem.CheckKeys(__instance.entityPlayerLocal.inventory.holdingItemData, hitInfo2);
ItemClass holdingItem = __instance.entityPlayerLocal.inventory.holdingItem;
bool flag14 = holdingItem.Actions[0] != null && holdingItem.Actions[0].AllowConcurrentActions() || holdingItem.Actions[1] != null && holdingItem.Actions[1].AllowConcurrentActions();
bool flag15 = holdingItem.Actions[1] != null && holdingItem.Actions[1].IsActionRunning(__instance.entityPlayerLocal.inventory.holdingItemData.actionData[1]);
if (flag10 & flag11 && (flag14 || !flag15))
{
if (__instance.gameManager.IsEditMode())
flag10 = !__instance.gameManager.GetActiveBlockTool().ExecuteAttackAction(__instance.entityPlayerLocal.inventory.holdingItemData, false, __instance.playerInput);
if (flag10)
__instance.entityPlayerLocal.inventory.Execute(0, false, __instance.playerInput);
}
if (flag10 && __instance.playerInput.Primary.WasReleased)
{
if (__instance.gameManager.IsEditMode() && !__instance.entityPlayerLocal.inventory.holdingItem.IsGun())
flag10 = !__instance.gameManager.GetActiveBlockTool().ExecuteAttackAction(__instance.entityPlayerLocal.inventory.holdingItemData, true, __instance.playerInput);
if (flag10)
__instance.entityPlayerLocal.inventory.Execute(0, true, __instance.playerInput);
}
ItemAction action1 = __instance.entityPlayerLocal.inventory.holdingItem.Actions[0];
bool flag16 = action1 != null && action1.IsActionRunning(__instance.entityPlayerLocal.inventory.holdingItemData.actionData[0]);
if (flag9 & flag12 && (flag14 || !flag16))
{
if (__instance.gameManager.IsEditMode())
flag9 = !__instance.gameManager.GetActiveBlockTool().ExecuteUseAction(__instance.entityPlayerLocal.inventory.holdingItemData, false, __instance.playerInput);
if (flag9)
__instance.entityPlayerLocal.inventory.Execute(1, false, __instance.playerInput);
}
if (flag9 && __instance.playerInput.Secondary.WasReleased && __instance.entityPlayerLocal.inventory != null)
{
__instance.entityPlayerLocal.inventory.Execute(1, true, __instance.playerInput);
if (__instance.gameManager.IsEditMode() && !__instance.entityPlayerLocal.inventory.holdingItem.IsGun())
__instance.gameManager.GetActiveBlockTool().ExecuteUseAction(__instance.entityPlayerLocal.inventory.holdingItemData, true, __instance.playerInput);
}
if (__instance.playerInput.Drop.WasPressed && !__instance.gameManager.IsEditMode() && !BlockToolSelection.Instance.SelectionActive && __instance.entityPlayerLocal.inventory != null && !__instance.entityPlayerLocal.inventory.IsHoldingItemActionRunning() && !__instance.entityPlayerLocal.inventory.IsHolsterDelayActive() && !__instance.entityPlayerLocal.inventory.IsUnholsterDelayActive() && __instance.entityPlayerLocal.inventory.holdingItemIdx != __instance.entityPlayerLocal.inventory.DUMMY_SLOT_IDX && !__instance.entityPlayerLocal.AimingGun && _idx == -1 && !flag2)
{
Vector3 dropPosition = __instance.entityPlayerLocal.GetDropPosition();
ItemValue holdingItemItemValue = __instance.entityPlayerLocal.inventory.holdingItemItemValue;
if (ItemClass.GetForId(holdingItemItemValue.type).CanDrop(holdingItemItemValue) && __instance.entityPlayerLocal.inventory.holdingCount > 0 && (double)__instance.entityPlayerLocal.DropTimeDelay <= 0.0)
{
__instance.entityPlayerLocal.DropTimeDelay = 0.5f;
int count = __instance.entityPlayerLocal.inventory.holdingItemStack.count;
__instance.gameManager.ItemDropServer(__instance.entityPlayerLocal.inventory.holdingItemStack.Clone(), dropPosition, Vector3.zero, __instance.entityPlayerLocal.entityId, ItemClass.GetForId(holdingItemItemValue.type).GetLifetimeOnDrop(), false);
__instance.entityPlayerLocal.AddUIHarvestingItem(new ItemStack(holdingItemItemValue, -count), false);
Manager.BroadcastPlay((Entity)__instance.entityPlayerLocal, "itemdropped");
__instance.entityPlayerLocal.inventory.DecHoldingItem(count);
}
}
bool flag17 = __instance.playerInput.InventorySlotLeft.WasPressed || __instance.playerInput.InventorySlotRight.WasPressed || __instance.inventoryScrollPressed;
__instance.inventoryScrollPressed = false;
if (__instance.entityPlayerLocal.AttachedToEntity == null)
{
if (_idx != -1 && _idx != __instance.entityPlayerLocal.inventory.GetFocusedItemIdx() && _idx < __instance.entityPlayerLocal.inventory.PUBLIC_SLOTS && __instance.entityPlayerLocal.inventory != null)
{
if (__instance.entityPlayerLocal.inventory.GetHoldingGun() is ItemActionRanged holdingGun)
holdingGun.CancelReload(__instance.entityPlayerLocal.inventory.holdingItemData.actionData[0]);
else if (__instance.entityPlayerLocal.inventory.holdingItem.Actions[1] is ItemActionActivate action2)
action2.CancelAction(__instance.entityPlayerLocal.inventory.holdingItemData.actionData[1]);
__instance.entityPlayerLocal.AimingGun = false;
__instance.inventoryItemToSetAfterTimeout = __instance.entityPlayerLocal.inventory.SetFocusedItemIdx(_idx);
__instance.inventoryItemSwitchTimeout = flag17 ? 0.3f : 0.0f;
}
if ((double)__instance.inventoryItemSwitchTimeout > 0.0)
__instance.inventoryItemSwitchTimeout -= Time.deltaTime;
Inventory inventory = __instance.entityPlayerLocal.inventory;
if (__instance.inventoryItemToSetAfterTimeout != int.MinValue && (double)__instance.inventoryItemSwitchTimeout <= 0.0 && inventory != null)
{
if (inventory.IsHoldingItemActionRunning())
{
if (inventory.GetHoldingGun() is ItemActionRanged holdingGun1)
holdingGun1.CancelReload(inventory.holdingItemData.actionData[0]);
}
else
{
__instance.entityPlayerLocal.AimingGun = false;
inventory.SetHoldingItemIdx(__instance.inventoryItemToSetAfterTimeout);
__instance.inventoryItemToSetAfterTimeout = int.MinValue;
}
}
if ((__instance.playerInput.Reload.WasPressed || __instance.playerInput.PermanentActions.Reload.WasPressed) && __instance.entityPlayerLocal.inventory != null)
{
int num12 = __instance.entityPlayerLocal.inventory.IsHoldingGun() ? 1 : (__instance.entityPlayerLocal.inventory.IsHoldingDynamicMelee() ? 1 : 0);
ItemAction holdingPrimary = __instance.entityPlayerLocal.inventory.GetHoldingPrimary();
ItemAction holdingSecondary = __instance.entityPlayerLocal.inventory.GetHoldingSecondary();
if (num12 != 0 && holdingPrimary != null)
{
if (holdingPrimary.HasRadial())
{
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
holdingPrimary.SetupRadial(__instance.playerUI.xui.RadialWindow, __instance.entityPlayerLocal);
}
else
{
holdingPrimary.CancelAction(__instance.entityPlayerLocal.inventory.holdingItemData.actionData[0]);
switch (holdingSecondary)
{
case null:
case ItemActionSpawnTurret _:
break;
default:
holdingSecondary.CancelAction(__instance.entityPlayerLocal.inventory.holdingItemData.actionData[1]);
break;
}
}
}
else if (__instance.entityPlayerLocal.inventory.GetHoldingBlock() != null)
{
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetupBlockShapeData();
}
}
if (__instance.playerInput.ToggleFlashlight.WasPressed || __instance.playerInput.PermanentActions.ToggleFlashlight.WasPressed)
{
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetActivatableItemData(__instance.entityPlayerLocal);
}
if (__instance.playerInput.Swap.WasPressed || __instance.playerInput.PermanentActions.Swap.WasPressed)
{
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetupToolbeltMenu(0);
}
if (!flag2 && __instance.playerInput.InventorySlotRight.WasPressed)
{
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetupToolbeltMenu(1);
}
if (flag2 || !__instance.playerInput.InventorySlotLeft.WasPressed)
return false;
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetupToolbeltMenu(-1);
}
else
{
if (!(__instance.entityPlayerLocal.AttachedToEntity is EntityVehicle attachedToEntity))
return false;
if (__instance.playerInput.PermanentActions.ToggleFlashlight.WasPressed || __instance.playerInput.VehicleActions.ToggleFlashlight.WasPressed)
{
if (attachedToEntity.HasHeadlight())
{
attachedToEntity.ToggleHeadlight();
}
else
{
__instance.timeActivatePressed = Time.time;
__instance.playerUI.xui.RadialWindow.Open();
__instance.playerUI.xui.RadialWindow.SetActivatableItemData(__instance.entityPlayerLocal);
}
}
if (!__instance.playerInput.VehicleActions.HonkHorn.WasPressed)
return false;
attachedToEntity.UseHorn();
}
}
}
}
return false;
}
private static bool CheckPlayerActions(PlayerMoveController __instance, LocalPlayerUI ___playerUI, EntityPlayerLocal ___entityPlayerLocal)
{
if (!RebirthVariables.loaded)
{
return true;
}
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions START");
float flActionInProgress = RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"];
if (__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() || flActionInProgress == 1)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 1");
return true;
}
bool isReloading = false;
if (__instance.entityPlayerLocal.inventory.holdingItem.Actions[0] is ItemActionRanged)
{
if (((ItemActionRanged.ItemActionDataRanged)__instance.entityPlayerLocal.inventory.holdingItemData.actionData[0]).isReloading)
{
isReloading = true;
}
}
//if (__instance.playerInput.Run.IsPressed && Input.GetKeyDown(KeyCode.H))
if (Input.GetKeyDown(KeyCode.End) && __instance.entityPlayerLocal.AttachedToEntity == null && !isReloading)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 2");
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 1;
float useQuickHeal = 1;
if (useQuickHeal == 0)
{
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal as global::EntityPlayerLocal, Localization.Get("ttNoQuickHeal"), string.Empty, "ui_denied", null);
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 0;
return false;
}
ProgressionValue healingProgressionValue = __instance.entityPlayerLocal.Progression.GetProgressionValue("perkHealingFactor");
float perkHealingFactor = RebirthUtilities.GetCalculatedLevel(__instance.entityPlayerLocal, healingProgressionValue);
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions perkHealingFactor: " + perkHealingFactor);
if (perkHealingFactor == 0)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions healing factor == null");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal as global::EntityPlayerLocal, Localization.Get("ttNoHealingFactor"), string.Empty, "ui_denied", null);
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 0;
return false;
}
int healedAmount = 0;
int playerMaxHealth = __instance.entityPlayerLocal.GetMaxHealth();
int playerHealth = __instance.entityPlayerLocal.Health;
int playerHealthModifier = (int)Math.Floor(__instance.entityPlayerLocal.Stats.Health.MaxModifier);
int missingHealth = playerMaxHealth - playerHealth - healedAmount + playerHealthModifier;
bool bHealing = __instance.entityPlayerLocal.Buffs.HasBuff("buffHealHealth");
float numHealing = __instance.entityPlayerLocal.Buffs.GetCustomVar("medicalRegHealthAmount");
float numHealingLeft = missingHealth - numHealing;
bool bBandageSound = false;
bool bPillSound = false;
bool bEatSound = false;
bool bDrinkSound = false;
bool foundHealingMeds = false;
bool bInfected = __instance.entityPlayerLocal.Buffs.HasBuff("buffInfectionMain");
float percInfection = __instance.entityPlayerLocal.Buffs.GetCustomVar(".infectionDisplayPerc");
float percInfectionCure = __instance.entityPlayerLocal.Buffs.GetCustomVar(".infectionCureDisplayPerc");
float perTotalInfection = percInfection - percInfectionCure;
float counterInfectionCure = __instance.entityPlayerLocal.Buffs.GetCustomVar("$infectionCureCounter");
float healingLeft = __instance.entityPlayerLocal.Buffs.GetCustomVar("medicalRegHealthAmount");
bool restrictiveHealing = RebirthVariables.customRestrictiveHealing && healingLeft > 10 && !__instance.entityPlayerLocal.Buffs.HasBuff("buffInjuryBleeding");
bool restritedHealing = false;
bool isOnFire = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayFireZombieDamage") ||
__instance.entityPlayerLocal.Buffs.HasBuff("buffBurningFlamingArrow") ||
__instance.entityPlayerLocal.Buffs.HasBuff("buffBurningMolotov") ||
__instance.entityPlayerLocal.Buffs.HasBuff("buffBurningElement") ||
__instance.entityPlayerLocal.Buffs.HasBuff("buffIsOnFire") ||
__instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamage") ||
__instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayAddBurningEnemyBoss") ||
__instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayBurningTrapDamage")
;
if (isOnFire && perkHealingFactor > 0)
{
ItemValue itemMurkyWater = ItemClass.GetItem("drinkJarRiverWater", false);
ItemClass itemClassMurkyWater = itemMurkyWater.ItemClass;
int itemCountMurkyWater = __instance.entityPlayerLocal.bag.GetItemCount(itemMurkyWater, -1, -1, false);
int itemCount2MurkyWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemMurkyWater, false, -1, -1);
if (itemClassMurkyWater != null)
{
itemCountMurkyWater = __instance.entityPlayerLocal.bag.GetItemCount(itemMurkyWater, -1, -1, false);
itemCount2MurkyWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemMurkyWater, false, -1, -1);
}
ItemValue itemBoiledWater = ItemClass.GetItem("drinkJarBoiledWater", false);
ItemClass itemClassBoiledWater = itemBoiledWater.ItemClass;
int itemCountBoiledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemBoiledWater, -1, -1, false);
int itemCount2BoiledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemBoiledWater, false, -1, -1);
if (itemClassBoiledWater != null)
{
itemCountBoiledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemBoiledWater, -1, -1, false);
itemCount2BoiledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemBoiledWater, false, -1, -1);
}
ItemValue itemDistilledWater = ItemClass.GetItem("drinkJarPureMineralWater", false);
ItemClass itemClassDistilledWater = itemDistilledWater.ItemClass;
int itemCountDistilledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemDistilledWater, -1, -1, false);
int itemCount2DistilledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemDistilledWater, false, -1, -1);
if (itemClassDistilledWater != null)
{
itemCountDistilledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemDistilledWater, -1, -1, false);
itemCount2DistilledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemDistilledWater, false, -1, -1);
}
if ((itemCountMurkyWater + itemCount2MurkyWater) > 0)
{
if (itemCount2MurkyWater > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMurkyWater, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMurkyWater, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMurkyWater, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("buffExtinguishFire");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTempResistFire");
bDrinkSound = true;
foundHealingMeds = true;
}
else if ((itemCountBoiledWater + itemCount2BoiledWater) > 0)
{
if (itemCount2BoiledWater > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemBoiledWater, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemBoiledWater, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemBoiledWater, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("buffExtinguishFire");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTempResistFire");
bDrinkSound = true;
foundHealingMeds = true;
}
else if ((itemCountDistilledWater + itemCount2DistilledWater) > 0)
{
if (itemCount2DistilledWater > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemDistilledWater, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemDistilledWater, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemDistilledWater, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("buffExtinguishFire");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTempResistFire");
bDrinkSound = true;
foundHealingMeds = true;
}
}
//Log.Out("Percentage Infection: " + percInfection);
//Log.Out("Percentage Infection Cure: " + percInfectionCure);
//Log.Out("Percentage Total Infection: " + perTotalInfection);
//Log.Out("HEALING FACTOR: " + perkHealingFactor);
if (perTotalInfection > 0 && perkHealingFactor > 0)
{
//Log.Out("INFECTED");
ItemValue itemHoney = ItemClass.GetItem("foodHoney", false);
ItemClass itemClassHoney = itemHoney.ItemClass;
int itemCountHoney = __instance.entityPlayerLocal.bag.GetItemCount(itemHoney, -1, -1, false);
int itemCount2Honey = __instance.entityPlayerLocal.inventory.GetItemCount(itemHoney, false, -1, -1);
if (itemClassHoney != null)
{
itemCountHoney = __instance.entityPlayerLocal.bag.GetItemCount(itemHoney, -1, -1, false);
itemCount2Honey = __instance.entityPlayerLocal.inventory.GetItemCount(itemHoney, false, -1, -1);
}
ItemValue itemHerbalAntibiotics = ItemClass.GetItem("drugHerbalAntibiotics", false);
ItemClass itemClassHerbalAntibiotics = itemHerbalAntibiotics.ItemClass;
int itemCountHerbalAntibiotics = __instance.entityPlayerLocal.bag.GetItemCount(itemHerbalAntibiotics, -1, -1, false);
int itemCount2HerbalAntibiotics = __instance.entityPlayerLocal.inventory.GetItemCount(itemHerbalAntibiotics, false, -1, -1);
if (itemClassHerbalAntibiotics != null)
{
itemCountHerbalAntibiotics = __instance.entityPlayerLocal.bag.GetItemCount(itemHerbalAntibiotics, -1, -1, false);
itemCount2HerbalAntibiotics = __instance.entityPlayerLocal.inventory.GetItemCount(itemHerbalAntibiotics, false, -1, -1);
}
ItemValue itemAntibiotics = ItemClass.GetItem("drugAntibiotics", false);
ItemClass itemClassAntibiotics = itemAntibiotics.ItemClass;
int itemCountAntibiotics = __instance.entityPlayerLocal.bag.GetItemCount(itemAntibiotics, -1, -1, false);
int itemCount2Antibiotics = __instance.entityPlayerLocal.inventory.GetItemCount(itemAntibiotics, false, -1, -1);
if (itemClassAntibiotics != null)
{
itemCountAntibiotics = __instance.entityPlayerLocal.bag.GetItemCount(itemAntibiotics, -1, -1, false);
itemCount2Antibiotics = __instance.entityPlayerLocal.inventory.GetItemCount(itemAntibiotics, false, -1, -1);
}
//Log.Out("Honey: " + (itemCountHoney+ itemCount2Honey));
//Log.Out("Herbal Antibiotics: " + (itemCountHerbalAntibiotics + itemCount2HerbalAntibiotics));
//Log.Out("Antibiotics: " + (itemCountAntibiotics + itemCount2Antibiotics));
if ((percInfection < 5) && ((itemCountHoney + itemCount2Honey) > 0) && perkHealingFactor > 0)
{
if (itemCount2Honey > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemHoney, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemHoney, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemHoney, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayFoodHoneyTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassHoney.ItemTags);
bInfected = false;
bEatSound = true;
foundHealingMeds = true;
}
else if ((percInfection >= 5 && percInfection < 10) && ((itemCountHerbalAntibiotics + itemCount2HerbalAntibiotics) > 0) && perkHealingFactor >= 2)
{
if (itemCount2HerbalAntibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemHerbalAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemHerbalAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemHerbalAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugHerbalAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassHerbalAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if ((percInfection >= 10) && ((itemCountAntibiotics + itemCount2Antibiotics) > 0) && perkHealingFactor >= 3)
{
if (itemCount2Antibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if ((percInfection < 5) && ((itemCountHerbalAntibiotics + itemCount2HerbalAntibiotics) > 0) && perkHealingFactor >= 2)
{
if (itemCount2HerbalAntibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemHerbalAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemHerbalAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemHerbalAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugHerbalAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassHerbalAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if ((percInfection >= 5 && percInfection < 10) && ((itemCountAntibiotics + itemCount2Antibiotics) > 0) && perkHealingFactor >= 3)
{
if (itemCount2Antibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if ((percInfection < 5) && ((itemCountAntibiotics + itemCount2Antibiotics) > 0) && perkHealingFactor >= 3)
{
if (itemCount2Antibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if (percInfection >= 5 && ((itemCountHerbalAntibiotics + itemCount2HerbalAntibiotics) > 0) && ((itemCountAntibiotics + itemCount2Antibiotics) == 0) && ((itemCountHoney + itemCount2Honey) == 0) && perkHealingFactor >= 2)
{
if (itemCount2HerbalAntibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemHerbalAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemHerbalAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemHerbalAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugHerbalAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassHerbalAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if (percInfection >= 5 && ((itemCountHerbalAntibiotics + itemCount2HerbalAntibiotics) == 0) && ((itemCountAntibiotics + itemCount2Antibiotics) > 0) && ((itemCountHoney + itemCount2Honey) == 0) && perkHealingFactor >= 3)
{
if (itemCount2Antibiotics > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemAntibiotics, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemAntibiotics, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemAntibiotics, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugAntibioticsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassAntibiotics.ItemTags);
bInfected = false;
bPillSound = true;
foundHealingMeds = true;
}
else if ((itemCountHoney + itemCount2Honey) > 0 && perkHealingFactor > 0)
{
if (itemCount2Honey > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemHoney, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemHoney, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemHoney, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayFoodHoneyTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassHoney.ItemTags);
bInfected = false;
bEatSound = true;
foundHealingMeds = true;
}
}
bool bFatigued = __instance.entityPlayerLocal.Buffs.HasBuff("buffFatigued");
if (bFatigued && perkHealingFactor >= 3)
{
ItemValue item = ItemClass.GetItem("drugVitamins", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugVitaminsTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
bFatigued = false;
bPillSound = true;
foundHealingMeds = true;
}
}
}
bool bRadiated = __instance.entityPlayerLocal.Buffs.HasBuff("buffRadiationMain");
bool bHasRadiationCure = __instance.entityPlayerLocal.Buffs.HasBuff("buffRadiationCureDisplay");
if (bRadiated && !bHasRadiationCure && perkHealingFactor >= 3)
{
ItemValue item = ItemClass.GetItem("FuriousRamsayDrinkPrussianBlue", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugPrussianBlueTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
bRadiated = false;
bDrinkSound = true;
foundHealingMeds = true;
}
}
}
bool bArmBroken = __instance.entityPlayerLocal.Buffs.HasBuff("buffArmBroken");
bool bLegBroken = __instance.entityPlayerLocal.Buffs.HasBuff("buffLegBroken");
if ((bArmBroken || bLegBroken) && perkHealingFactor >= 3)
{
ItemValue item = ItemClass.GetItem("medicalPlasterCast", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalPlasterCastTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
bArmBroken = false;
bLegBroken = false;
bBandageSound = true;
foundHealingMeds = true;
}
}
}
if ((bArmBroken || bLegBroken) && perkHealingFactor >= 2)
{
ItemValue item = ItemClass.GetItem("medicalSplint", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalSplintTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
bArmBroken = false;
bLegBroken = false;
bBandageSound = true;
foundHealingMeds = true;
}
}
}
bool bLaceration = __instance.entityPlayerLocal.Buffs.HasBuff("buffLaceration");
bool bBleeding = __instance.entityPlayerLocal.Buffs.HasBuff("buffInjuryBleeding");
if (bLaceration && perkHealingFactor >= 2)
{
ItemValue item = ItemClass.GetItem("resourceSewingKit", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsaySewingKitTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
bLaceration = false;
bBleeding = false;
bBandageSound = true;
foundHealingMeds = true;
}
}
}
bool bAbrasion = __instance.entityPlayerLocal.Buffs.HasBuff("buffInjuryAbrasion");
bool MedicalBandage = false;
if ((bBleeding & bAbrasion) && perkHealingFactor > 0)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
ItemValue item = ItemClass.GetItem("medicalFirstAidBandage", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalFirstAidBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
healedAmount = healedAmount + 20;
bAbrasion = false;
bBleeding = false;
bBandageSound = true;
foundHealingMeds = true;
MedicalBandage = true;
}
}
}
}
bool AloeCream = false;
if (bAbrasion && perkHealingFactor > 0)
{
ItemValue item = ItemClass.GetItem("medicalAloeCream", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayAloeCreamTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
healedAmount = healedAmount + 5;
bAbrasion = false;
bBandageSound = true;
foundHealingMeds = true;
AloeCream = true;
}
}
}
bool bConcussion = __instance.entityPlayerLocal.Buffs.HasBuff("buffInjuryConcussion");
bool bPainKillers = __instance.entityPlayerLocal.Buffs.HasBuff("buffDrugPainkillers");
bool bUserPainkillers = false;
if ((bConcussion && !bPainKillers) && perkHealingFactor >= 2 && !bBleeding)
{
//Log.Out("HEALING C");
ItemValue item = ItemClass.GetItem("drugPainkillers", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugPainkillersTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
healedAmount = healedAmount + 40;
bConcussion = false;
bPillSound = true;
foundHealingMeds = true;
bUserPainkillers = true;
}
}
}
int numAloeCream = 0; // 10 health
int numMedicalBandages = 0; // 6 health
int numMedicalFirstAidBandages = 0; // 25 health
int numPainkillers = 0; // 40 health
int numMedicalFirstAidKit = 0; // 70 health
ItemValue itemMedicalBandage = ItemClass.GetItem("medicalBandage", false);
ItemClass itemClassMedicalBandage = itemMedicalBandage.ItemClass;
int itemCountMedicalBandage = 0;
int itemCount2MedicalBandage = 0;
if (itemClassMedicalBandage != null)
{
itemCountMedicalBandage = __instance.entityPlayerLocal.bag.GetItemCount(itemMedicalBandage, -1, -1, false);
itemCount2MedicalBandage = __instance.entityPlayerLocal.inventory.GetItemCount(itemMedicalBandage, false, -1, -1);
numMedicalBandages = itemCountMedicalBandage + itemCount2MedicalBandage;
}
ItemValue itemMedicalFirstAidBandage = ItemClass.GetItem("medicalFirstAidBandage", false);
ItemClass itemClassMedicalFirstAidBandage = itemMedicalFirstAidBandage.ItemClass;
int itemCountMedicalFirstAidBandage = 0;
int itemCount2MedicalFirstAidBandage = 0;
if (itemClassMedicalFirstAidBandage != null)
{
itemCountMedicalFirstAidBandage = __instance.entityPlayerLocal.bag.GetItemCount(itemMedicalFirstAidBandage, -1, -1, false);
itemCount2MedicalFirstAidBandage = __instance.entityPlayerLocal.inventory.GetItemCount(itemMedicalFirstAidBandage, false, -1, -1);
numMedicalFirstAidBandages = itemCountMedicalFirstAidBandage + itemCount2MedicalFirstAidBandage;
}
ItemValue itemMedicalFirstAidKit = ItemClass.GetItem("medicalFirstAidKit", false);
ItemClass itemClassMedicalFirstAidKit = itemMedicalFirstAidKit.ItemClass;
int itemCountMedicalFirstAidKit = 0;
int itemCount2MedicalFirstAidKit = 0;
if (itemClassMedicalFirstAidKit != null)
{
itemCountMedicalFirstAidKit = __instance.entityPlayerLocal.bag.GetItemCount(itemMedicalFirstAidKit, -1, -1, false);
itemCount2MedicalFirstAidKit = __instance.entityPlayerLocal.inventory.GetItemCount(itemMedicalFirstAidKit, false, -1, -1);
numMedicalFirstAidKit = itemCountMedicalFirstAidKit + itemCount2MedicalFirstAidKit;
}
ItemValue itemPainkillers = ItemClass.GetItem("drugPainkillers", false);
ItemClass itemClassPainkillers = itemPainkillers.ItemClass;
int itemCountPainkillers = 0;
int itemCount2Painkillers = 0;
if (itemClassPainkillers != null)
{
itemCountPainkillers = __instance.entityPlayerLocal.bag.GetItemCount(itemPainkillers, -1, -1, false);
itemCount2Painkillers = __instance.entityPlayerLocal.inventory.GetItemCount(itemPainkillers, false, -1, -1);
numPainkillers = itemCountPainkillers + itemCount2Painkillers;
}
ItemValue itemAloeCream = ItemClass.GetItem("medicalAloeCream", false);
ItemClass itemClassAloeCream = itemAloeCream.ItemClass;
int itemCountAloeCream = 0;
int itemCount2AloeCream = 0;
if (itemClassAloeCream != null)
{
itemCountAloeCream = __instance.entityPlayerLocal.bag.GetItemCount(itemAloeCream, -1, -1, false);
itemCount2AloeCream = __instance.entityPlayerLocal.inventory.GetItemCount(itemAloeCream, false, -1, -1);
numAloeCream = itemCountAloeCream + itemCount2AloeCream;
}
if (numHealingLeft > 0)
{
//Log.Out("INSIDE HEALING");
if (numHealingLeft >= 70 && numMedicalFirstAidKit > 0 && perkHealingFactor >= 3)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 1");
if (itemCount2MedicalFirstAidKit > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalFirstAidKit, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalFirstAidKit, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalFirstAidKit, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalFirstAidKitTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalFirstAidKit.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if ((numHealingLeft >= 25 && numHealingLeft < 70) && numMedicalFirstAidBandages > 0 && perkHealingFactor > 0 && !MedicalBandage)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 2");
if (itemCount2MedicalFirstAidBandage > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalFirstAidBandage, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalFirstAidBandage, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalFirstAidBandage, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalFirstAidBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalFirstAidBandage.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
/*else if ((numHealingLeft >= 25 && numHealingLeft < 70) && !bUserPainkillers && numPainkillers > 0 && !bPainKillers && perkHealingFactor >= 2)
{
//Log.Out("INSIDE HEALING: 3");
if (itemCount2Painkillers > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemPainkillers, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemPainkillers, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemPainkillers, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugPainkillersTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassPainkillers.ItemTags);
bPillSound = true;
foundHealingMeds = true;
}*/
else if ((numHealingLeft >= 6 && numHealingLeft < 25) && numMedicalBandages > 0 && perkHealingFactor > 0)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 4");
if (itemCount2MedicalBandage > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalBandage, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalBandage, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalBandage, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalBandage.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if (numHealingLeft >= 70 && numMedicalFirstAidBandages > 0 && perkHealingFactor > 0 && !MedicalBandage)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 5");
if (itemCount2MedicalFirstAidBandage > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalFirstAidBandage, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalFirstAidBandage, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalFirstAidBandage, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalFirstAidBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalFirstAidBandage.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if (numHealingLeft >= 25 && numMedicalBandages > 0 && perkHealingFactor > 0)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 6");
if (itemCount2MedicalBandage > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalBandage, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalBandage, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalBandage, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalBandage.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if (numMedicalFirstAidBandages > 0 && numMedicalBandages == 0 && perkHealingFactor > 0 && !MedicalBandage)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 7");
if (itemCount2MedicalFirstAidBandage > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalFirstAidBandage, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalFirstAidBandage, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalFirstAidBandage, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalFirstAidBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalFirstAidBandage.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if (numMedicalBandages > 0 && perkHealingFactor > 0)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 8");
if (itemCount2MedicalBandage > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalBandage, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalBandage, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalBandage, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalBandageTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalBandage.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if (numAloeCream > 0 && perkHealingFactor > 0 && !AloeCream)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 9");
if (itemCount2AloeCream > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemAloeCream, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemAloeCream, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemAloeCream, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayAloeCreamTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassAloeCream.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
else if (numHealingLeft >= 50 && numMedicalFirstAidKit > 0 && perkHealingFactor >= 3)
{
if (restrictiveHealing)
{
restritedHealing = true;
}
else
{
//Log.Out("INSIDE HEALING: 10");
if (itemCount2MedicalFirstAidKit > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMedicalFirstAidKit, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMedicalFirstAidKit, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMedicalFirstAidKit, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMedicalFirstAidKitTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClassMedicalFirstAidKit.ItemTags);
bBandageSound = true;
foundHealingMeds = true;
}
}
/*if (!bPainKillers && perkHealingFactor >= 2 && !foundHealingMeds && restritedHealing)
{
//Log.Out("HEALING D");
ItemValue item = ItemClass.GetItem("drugPainkillers", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayDrugPainkillersTrigger");
RebirthUtilities.ProcessItem(__instance.entityPlayerLocal, itemClass.ItemTags);
healedAmount = healedAmount + 40;
bConcussion = false;
bPillSound = true;
foundHealingMeds = true;
bUserPainkillers = true;
}
}
}*/
}
//Log.Out("perkHealingFactor: " + perkHealingFactor);
//Log.Out("Total Health: " + playerMaxHealth);
//Log.Out("Healed Amount: " + healedAmount);
//Log.Out("Current Health: " + playerHealth);
//Log.Out("Missing Health: " + missingHealth);
//Log.Out("Health Modifier: " + playerHealthModifier);
//Log.Out("Healing Num: " + numHealing);
//Log.Out("Healing Left: " + numHealingLeft);
string itemQuickHealName = "FuriousRamsayQuickHealBandage";
if (bBandageSound)
{
Manager.PlayInsidePlayerHead("player_bandage");
itemQuickHealName = "FuriousRamsayQuickHealBandage";
}
else
{
if (bPillSound)
{
Manager.PlayInsidePlayerHead("player_painkillers");
itemQuickHealName = "FuriousRamsayQuickHealPill";
}
else
{
if (bEatSound)
{
Manager.PlayInsidePlayerHead("player_eating");
itemQuickHealName = "FuriousRamsayQuickHealEat";
}
else
{
if (bDrinkSound)
{
Manager.PlayInsidePlayerHead("player_drinking");
itemQuickHealName = "FuriousRamsayQuickHealDrink";
}
}
}
}
int itemIndex = __instance.entityPlayerLocal.inventory.GetFocusedItemIdx();
int emptyItemIndex = -1;
bool foundEmptySpot = false;
ItemValue itemQuickHeal = ItemClass.GetItem(itemQuickHealName, false);
ItemStack[] slots = __instance.entityPlayerLocal.inventory.GetSlots();
int numSlots = __instance.entityPlayerLocal.inventory.GetSlotCount();
//Log.Out("NUM SLOTS: " + numSlots);
if (foundHealingMeds)
{
for (int i = 0; i < slots.Length - 1; i++)
{
ItemStack itemStack = slots[i];
if (!itemStack.IsEmpty())
{
//Log.Out("Item: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("Item Num: " + itemStack.count);
}
else
{
emptyItemIndex = i;
ItemClass itemClass = itemQuickHeal.ItemClass;
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 1);
__instance.entityPlayerLocal.inventory.AddItem(@is);
__instance.entityPlayerLocal.inventory.SetFocusedItemIdx(i);
__instance.entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(i);
__instance.entityPlayerLocal.RightArmAnimationUse = true;
foundEmptySpot = true;
GameManager.Instance.StartCoroutine(RebirthUtilities.ProcessItemEmptySpot(1.5f, __instance.entityPlayerLocal, itemIndex, emptyItemIndex));
//Log.Out("FOUND EMPTY SPOT");
break;
}
}
//Log.Out("Item: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("BEFORE NO EMPTY SPOT-EmptyItemIndex: " + emptyItemIndex);
if (!foundEmptySpot)
{
//__instance.entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(numSlots-1);
ItemValue newItem = ItemClass.GetItem(itemQuickHealName, false);
ItemStack[] currentSlots = __instance.entityPlayerLocal.inventory.GetSlots();
currentSlots[numSlots - 1] = ItemStack.Empty.Clone();
__instance.entityPlayerLocal.inventory.SetSlots(currentSlots);
//ItemClass itemClass = newItem.ItemClass;
//ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 1);
//__instance.entityPlayerLocal.inventory.AddItem(@is);
__instance.entityPlayerLocal.inventory.SetItem(numSlots - 1, newItem, 1);
__instance.entityPlayerLocal.inventory.SetFocusedItemIdx(numSlots - 1);
__instance.entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(numSlots - 1);
__instance.entityPlayerLocal.RightArmAnimationUse = true;
GameManager.Instance.StartCoroutine(RebirthUtilities.ProcessItemEmptySpot(1.5f, __instance.entityPlayerLocal, itemIndex, numSlots - 1));
//Log.Out("Previous Item: " + @currentHoldingItem.itemValue.ItemClass.GetItemName());
}
//Log.Out("AFTER NO EMPTY SPOT");
}
else
{
if (restritedHealing)
{
GameManager.ShowTooltip(__instance.entityPlayerLocal, Localization.Get("ttNotDoneHealing"), string.Empty, "ui_denied", null);
}
RebirthVariables.localConstants["$varFuriousRamsayActionInProgress"] = 0;
}
return false;
}
if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Return) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive())
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 3");
bool flag = false;
ItemStack[] slots = __instance.entityPlayerLocal.bag.GetSlots();
for (int i = 0; i < slots.Length; i++)
{
if (!slots[i].itemValue.type.Equals(ItemValue.None.type))
{
flag = true;
break;
}
}
if (!flag)
{
return false;
}
EntityBackpack entityBackpack = EntityFactory.CreateEntity("Backpack".GetHashCode(), __instance.entityPlayerLocal.position + __instance.entityPlayerLocal.transform.up * 2f) as EntityBackpack;
TileEntityLootContainer tileEntityLootContainer = new TileEntityLootContainer((Chunk)null);
string lootList = entityBackpack.GetLootList();
tileEntityLootContainer.lootListName = lootList;
tileEntityLootContainer.SetUserAccessing(true);
tileEntityLootContainer.SetEmpty();
tileEntityLootContainer.SetContainerSize(LootContainer.GetLootContainer(lootList, true).size, true);
bool[] lockedSlots = __instance.entityPlayerLocal.bag.LockedSlots;
ItemStack[] slots3 = __instance.entityPlayerLocal.bag.GetSlots();
int numItems = 0;
for (int n = 0; n < slots3.Length; n++)
{
bool skipSlot = false;
if (lockedSlots != null)
{
skipSlot = lockedSlots[n];
}
//Log.Out("skipSlot[" + n + "]: " + skipSlot);
if (!slots3[n].IsEmpty() && !slots3[n].itemValue.ItemClass.KeepOnDeath() && !skipSlot)
{
tileEntityLootContainer.AddItem(slots3[n]);
slots3[n] = ItemStack.Empty.Clone();
numItems++;
}
}
//Log.Out("numItems: " + numItems);
if (numItems == 0)
{
tileEntityLootContainer.SetUserAccessing(false);
tileEntityLootContainer.SetModified();
entityBackpack.OnEntityUnload();
return false;
}
tileEntityLootContainer.bPlayerBackpack = true;
__instance.entityPlayerLocal.bag.SetSlots(slots3);
tileEntityLootContainer.SetUserAccessing(false);
tileEntityLootContainer.SetModified();
entityBackpack.RefPlayerId = __instance.entityPlayerLocal.entityId;
EntityCreationData entityCreationData = new EntityCreationData(entityBackpack);
entityCreationData.entityName = string.Format(Localization.Get("playersBackpack"), __instance.entityPlayerLocal.EntityName);
entityCreationData.id = -1;
entityCreationData.lootContainer = tileEntityLootContainer;
GameManager.Instance.RequestToSpawnEntityServer(entityCreationData);
entityBackpack.OnEntityUnload();
//__instance.entityPlayerLocal.SetDroppedBackpackPosition(new Vector3i(__instance.entityPlayerLocal.position));
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
__instance.entityPlayerLocal.SetDroppedBackpackPositions(GameManager.Instance.persistentLocalPlayer.GetDroppedBackpackPositions());
}
Manager.BroadcastPlay(__instance.entityPlayerLocal.position, "close_backpack", 0f);
return false;
}
else if (__instance.entityPlayerLocal.playerInput.MoveBack.IsPressed && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive())
{
__instance.entityPlayerLocal.Buffs.SetCustomVar("$autoRunToggle", 0f);
return true;
}
else if (Input.GetKeyDown(KeyCode.LeftAlt) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive())
{
float currentToggle = __instance.entityPlayerLocal.Buffs.GetCustomVar("$autoRunToggle");
if (currentToggle == 0f)
{
__instance.entityPlayerLocal.Buffs.SetCustomVar("$autoRunToggle", 1f);
}
else if (currentToggle == 1f)
{
__instance.entityPlayerLocal.Buffs.SetCustomVar("$autoRunToggle", 2f);
}
else
{
__instance.entityPlayerLocal.Buffs.SetCustomVar("$autoRunToggle", 0f);
}
return false;
}
else if (Input.GetKeyDown(KeyCode.Backspace) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() && RebirthUtilities.HasMod(__instance.entityPlayerLocal, "FuriousRamsayWalkmanMod"))
{
/*
if (RebirthVariables.forceNoHit)
{
int layerId = __instance.entityPlayerLocal.GetModelLayer();
//Log.Out("PlayerMoveControllerUpdatePatches-Update: layerId: " + layerId);
__instance.entityPlayerLocal.SetModelLayer(2, true, null);
}
*/
if (RebirthVariables.musicMode == 0 || RebirthVariables.musicMode == -1)
{
RebirthVariables.musicMode = 1;
RebirthVariables.walkman = true;
}
else
{
RebirthVariables.musicMode = 0;
RebirthVariables.walkman = true;
}
return false;
}
else if (Input.GetKeyDown(KeyCode.Return) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() && RebirthUtilities.HasMod(__instance.entityPlayerLocal, "FuriousRamsayWalkmanMod"))
{
if (RebirthVariables.musicMode == 1)
{
RebirthVariables.musicMode = 2;
}
return false;
}
else if (Input.GetKeyDown(KeyCode.Equals) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() && RebirthUtilities.HasMod(__instance.entityPlayerLocal, "FuriousRamsayWalkmanMod"))
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions EQUALS");
if (RebirthVariables.musicMode == 1)
{
RebirthVariables.musicMode = 4;
}
return false;
}
else if (Input.GetKeyDown(KeyCode.Minus) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() && RebirthUtilities.HasMod(__instance.entityPlayerLocal, "FuriousRamsayWalkmanMod"))
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions MINUS");
if (RebirthVariables.musicMode == 1)
{
RebirthVariables.musicMode = 5;
}
return false;
}
else if (__instance.entityPlayerLocal.inventory.holdingItemItemValue != null && __instance.entityPlayerLocal.inventory.holdingItemItemValue.ItemClass is ItemClassBlock && __instance.entityPlayerLocal.inventory.holdingItemItemValue.ItemClass.GetItemName() .ToLower().Contains("shapes:") && Input.GetKeyDown(KeyCode.F) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() && !__instance.playerUI.windowManager.IsModalWindowOpen())
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions COPY SHAPE AND ROTATION ");
EntityPlayerLocal _epl = __instance.entityPlayerLocal;
ItemClassBlock.ItemBlockInventoryData _ibid;
Block _blockHolding;
Block _blockSelectedShape;
bool _hasAutoRotation;
bool _onlySimpleRotations;
bool _hasCopyRotation;
bool _allowShapes;
bool _hasCopyAutoShape;
bool _hasCopyShapeLegacy;
if (!RebirthUtilities.getBasicBlockInfo(_epl, out _ibid, out _blockHolding, out _blockSelectedShape, out _hasAutoRotation, out _onlySimpleRotations, out _hasCopyRotation, out _allowShapes, out _hasCopyAutoShape, out _hasCopyShapeLegacy, out bool _))
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions EXIT");
return false;
}
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions HOLDING Shape: " + _blockHolding.shape.GetName());
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions HOLDING Rotation: " + _ibid.rotation);
BlockValue blockValue2 = __instance.entityPlayerLocal.HitInfo.hit.blockValue;
if (blockValue2.ischild)
{
blockValue2 = __instance.entityPlayerLocal.world.GetBlock(blockValue2.Block.multiBlockPos.GetParentPos(__instance.entityPlayerLocal.HitInfo.hit.blockPos, blockValue2));
}
if (blockValue2.Block.shape != null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions TARGET Shape: " + blockValue2.Block.shape.GetName());
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions BEFORE _ibid.itemValue.Meta: " + _ibid.itemValue.Meta);
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions _hasCopyAutoShape: " + _hasCopyAutoShape);
int num = 0;
if (_hasCopyAutoShape)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions blockValue2.Block.GetAutoShapeShapeName(): " + blockValue2.Block.GetAutoShapeShapeName());
num = _blockHolding.AutoShapeAlternateShapeNameIndex(blockValue2.Block.GetAutoShapeShapeName());
}
else
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions blockValue2.Block.GetBlockName(): " + blockValue2.Block.GetBlockName());
num = _blockHolding.GetAlternateBlockIndex(blockValue2.Block.GetBlockName());
}
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions num: " + num);
if (num < 0)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions EXIT 1");
return false;
}
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions AFTER _ibid.itemValue.Meta: " + num);
_ibid.itemValue.Meta = num;
XUiC_Toolbelt childByType = ((XUiWindowGroup)__instance.entityPlayerLocal.playerUI.windowManager.GetWindow("toolbelt")).Controller.GetChildByType<XUiC_Toolbelt>();
if (childByType == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions EXIT 2");
return false;
}
int holdingItemIdx = _epl.inventory.holdingItemIdx;
XUiC_ItemStack slotControl = childByType.GetSlotControl(holdingItemIdx);
slotControl.ItemStack = new ItemStack(_ibid.itemValue, _ibid.itemStack.count);
slotControl.ForceRefreshItemStack();
}
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions BEFORE _ibid.rotation: " + _ibid.rotation);
_ibid.rotation = blockValue2.rotation;
_ibid.mode = BlockPlacement.EnumRotationMode.Advanced;
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions HOLDING AFTER Shape: " + _blockHolding.shape.GetName());
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions AFTER _ibid.rotation: " + _ibid.rotation);
return false;
}
else if (Input.GetKeyDown(KeyCode.Q) && __instance.entityPlayerLocal.AttachedToEntity == null && !__instance.entityPlayerLocal.PlayerUI.windowManager.IsInputActive() && !__instance.playerUI.windowManager.IsModalWindowOpen())
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 4");
//Log.Out("PlayerMoveControllerUpdatePatches-Update: Q, hires: " + playerHires.Count);
int numTeleport = 0;
foreach (hireInfo hire in playerHires)
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update A hire.hireID: " + hire.hireID);
//Log.Out("PlayerMoveControllerUpdatePatches-Update A hire.order: " + hire.order);
//Log.Out("PlayerMoveControllerUpdatePatches-Update A hire.playerID: " + hire.playerID);
if (hire.playerID == __instance.entityPlayerLocal.entityId && hire.order == 0)
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update B hire.hireID: " + hire.hireID);
EntityNPCRebirth entity = GameManager.Instance.World.GetEntity(hire.hireID) as EntityNPCRebirth;
if (entity)
{
float flNPCRespawned = entity.Buffs.GetCustomVar("$FR_NPC_Respawn");
//Log.Out("PlayerMoveControllerUpdatePatches-Update flNPCRespawned: " + flNPCRespawned);
if (entity.IsDead() || flNPCRespawned == 1 || entity.LeaderUtils.IsTeleporting)
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update SKIP");
continue;
}
var target2i = new Vector2(__instance.entityPlayerLocal.position.x, __instance.entityPlayerLocal.position.z);
var mine2i = new Vector2(entity.position.x, entity.position.z);
var distance = Vector2.Distance(target2i, mine2i);
//if (!(distance < 8 && (Math.Abs(__instance.entityPlayerLocal.position.y - entity.position.y) < 3)))
//{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update IS SERVER");
bool hasFireBuff = entity.Buffs.HasBuff("FuriousRamsayFireZombieDamage") ||
entity.Buffs.HasBuff("buffBurningFlamingArrow") ||
entity.Buffs.HasBuff("buffBurningMolotov") ||
entity.Buffs.HasBuff("buffBurningEnvironmentHack") ||
entity.Buffs.HasBuff("buffBurningEnvironment") ||
entity.Buffs.HasBuff("buffBurningElement") ||
entity.Buffs.HasBuff("buffIsOnFire") ||
entity.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamage") ||
entity.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamageDisplay") ||
entity.Buffs.HasBuff("FuriousRamsayAddBurningEnemyBoss") ||
entity.Buffs.HasBuff("FuriousRamsayBurningTrapDamage");
// On Fire
if (hasFireBuff && entity.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.Follow)
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update NPC IS ON FIRE");
ItemValue itemMurkyWater = ItemClass.GetItem("drinkJarRiverWater", false);
ItemClass itemClassMurkyWater = itemMurkyWater.ItemClass;
int itemCountMurkyWater = __instance.entityPlayerLocal.bag.GetItemCount(itemMurkyWater, -1, -1, false);
int itemCount2MurkyWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemMurkyWater, false, -1, -1);
if (itemClassMurkyWater != null)
{
itemCountMurkyWater = __instance.entityPlayerLocal.bag.GetItemCount(itemMurkyWater, -1, -1, false);
itemCount2MurkyWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemMurkyWater, false, -1, -1);
}
ItemValue itemBoiledWater = ItemClass.GetItem("drinkJarBoiledWater", false);
ItemClass itemClassBoiledWater = itemBoiledWater.ItemClass;
int itemCountBoiledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemBoiledWater, -1, -1, false);
int itemCount2BoiledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemBoiledWater, false, -1, -1);
if (itemClassBoiledWater != null)
{
itemCountBoiledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemBoiledWater, -1, -1, false);
itemCount2BoiledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemBoiledWater, false, -1, -1);
}
ItemValue itemDistilledWater = ItemClass.GetItem("drinkJarPureMineralWater", false);
ItemClass itemClassDistilledWater = itemDistilledWater.ItemClass;
int itemCountDistilledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemDistilledWater, -1, -1, false);
int itemCount2DistilledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemDistilledWater, false, -1, -1);
if (itemClassDistilledWater != null)
{
itemCountDistilledWater = __instance.entityPlayerLocal.bag.GetItemCount(itemDistilledWater, -1, -1, false);
itemCount2DistilledWater = __instance.entityPlayerLocal.inventory.GetItemCount(itemDistilledWater, false, -1, -1);
}
if ((itemCountMurkyWater + itemCount2MurkyWater) > 0)
{
if (itemCount2MurkyWater > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMurkyWater, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMurkyWater, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMurkyWater, 1));
entity.Buffs.AddBuff("buffExtinguishFire");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieDamage");
entity.Buffs.RemoveBuff("buffBurningFlamingArrow");
entity.Buffs.RemoveBuff("buffBurningMolotov");
entity.Buffs.RemoveBuff("buffBurningEnvironmentHack");
entity.Buffs.RemoveBuff("buffBurningEnvironment");
entity.Buffs.RemoveBuff("buffBurningElement");
entity.Buffs.RemoveBuff("buffIsOnFire");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamage");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamageDisplay");
entity.Buffs.RemoveBuff("FuriousRamsayAddBurningEnemyBoss");
entity.Buffs.RemoveBuff("FuriousRamsayBurningTrapDamage");
entity.Buffs.AddBuff("FuriousRamsayTempResistFire");
}
else if ((itemCountBoiledWater + itemCount2BoiledWater) > 0)
{
if (itemCount2BoiledWater > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemBoiledWater, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemBoiledWater, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemBoiledWater, 1));
entity.Buffs.AddBuff("buffExtinguishFire");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieDamage");
entity.Buffs.RemoveBuff("buffBurningFlamingArrow");
entity.Buffs.RemoveBuff("buffBurningMolotov");
entity.Buffs.RemoveBuff("buffBurningEnvironmentHack");
entity.Buffs.RemoveBuff("buffBurningEnvironment");
entity.Buffs.RemoveBuff("buffBurningElement");
entity.Buffs.RemoveBuff("buffIsOnFire");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamage");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamageDisplay");
entity.Buffs.RemoveBuff("FuriousRamsayAddBurningEnemyBoss");
entity.Buffs.RemoveBuff("FuriousRamsayBurningTrapDamage");
entity.Buffs.AddBuff("FuriousRamsayTempResistFire");
}
else if ((itemCountDistilledWater + itemCount2DistilledWater) > 0)
{
if (itemCount2DistilledWater > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemDistilledWater, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemDistilledWater, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemDistilledWater, 1));
entity.Buffs.AddBuff("buffExtinguishFire");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieDamage");
entity.Buffs.RemoveBuff("buffBurningFlamingArrow");
entity.Buffs.RemoveBuff("buffBurningMolotov");
entity.Buffs.RemoveBuff("buffBurningEnvironmentHack");
entity.Buffs.RemoveBuff("buffBurningEnvironment");
entity.Buffs.RemoveBuff("buffBurningElement");
entity.Buffs.RemoveBuff("buffIsOnFire");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamage");
entity.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamageDisplay");
entity.Buffs.RemoveBuff("FuriousRamsayAddBurningEnemyBoss");
entity.Buffs.RemoveBuff("FuriousRamsayBurningTrapDamage");
entity.Buffs.AddBuff("FuriousRamsayTempResistFire");
}
}
if (!__instance.entityPlayerLocal.IsInElevator())
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update NOT IN ELEVATOR TELEPORT");
entity.Buffs.SetCustomVar("$FR_NPC_ForceTeleport", 1f);
entity.Buffs.AddBuff("FuriousRamsayStandStill");
//entity.SetMoveForwardWithModifiers(0f, 0f, false);
//entity.ChaseReturnLocation = entity.position;
entity.TeleportToPlayer(__instance.entityPlayerLocal, false);
}
}
else
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update IS NOT SERVER");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageForceTeleportRebirth>().Setup(entity.entityId), false);
}
numTeleport++;
//}
}
else
{
//Log.Out("PlayerMoveControllerUpdatePatches-Update NPC DOES NOT EXIST");
}
}
}
if (numTeleport > 0)
{
Manager.PlayInsidePlayerHead("FuriousRamsayWhistle");
}
return false;
}
else if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Comma) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
RebirthUtilities.SwitchNPCOrder(__instance.entityPlayerLocal);
return false;
}
else if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) && Input.GetKeyDown(KeyCode.Period) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 6");
RebirthUtilities.SwitchNPCMode(__instance.entityPlayerLocal);
return false;
}
else if (Input.GetKeyDown(KeyCode.Home) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 9");
bool bProtectionShield = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayProtectionShieldTrigger");
if (!bProtectionShield)
{
ItemValue item = ItemClass.GetItem("FuriousRamsayProtectionShield", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayProtectionShieldTrigger");
}
else
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttProtectionShieldMissing"));
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer.AddUIHarvestingItem(@is, true);
}
}
}
else
{
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttProtectionShieldOn"));
}
return false;
}
else if (Input.GetKeyDown(KeyCode.Insert) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 10");
float manualMercenaries = 1;
if (manualMercenaries == 1)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 10a");
bool bMercenariesBuffTier1 = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayMercenariesBuffTier1");
bool bMercenariesBuffTier2 = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayMercenariesBuffTier2");
bool bMercenariesBuffTier3 = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayMercenariesBuffTier3");
bool bMercenariesBuffTier4 = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayMercenariesBuffTier4");
bool bMercenariesBuffTier5 = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayMercenariesBuffTier5");
bool isHordeNight = RebirthUtilities.IsHordeNight();
if (bMercenariesBuffTier1)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 10b");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMercenariesBuffTier1Cooldown");
__instance.entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsayMercenariesBuffTier1");
if (isHordeNight)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 10c");
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier1_FR", 5, "", "", "8888", "dynamic", "", "", 1, -1, false, false, false, __instance.entityPlayerLocal.entityId, 0, "FuriousRamsayWarHorn");
}
else
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 10d");
//RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier1_FR", 1, "", "", "9999", "dynamic", "", "", 1, -1, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier1_FR", 1, "", "", "9999", "dynamic", "", "", 1, -1, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
}
else if (bMercenariesBuffTier2)
{
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMercenariesBuffTier2Cooldown");
__instance.entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsayMercenariesBuffTier2");
if (isHordeNight)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier2_FR", 6, "", "", "8888", "dynamic", "", "", 1, -1, false, false, false, __instance.entityPlayerLocal.entityId, 0, "FuriousRamsayWarHorn");
}
else
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier2_FR", 2, "", "", "9999", "dynamic", "", "", 1, -1, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
}
else if (bMercenariesBuffTier3)
{
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMercenariesBuffTier3Cooldown");
__instance.entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsayMercenariesBuffTier3");
if (isHordeNight)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier3_FR", 7, "", "", "8888", "dynamic", "", "", 1, -1, false, false, false, __instance.entityPlayerLocal.entityId, 0, "FuriousRamsayWarHorn");
}
else
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier3_FR", 3, "", "", "9999", "dynamic", "", "", 1, -1, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
}
else if (bMercenariesBuffTier4)
{
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMercenariesBuffTier4Cooldown");
__instance.entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsayMercenariesBuffTier4");
if (isHordeNight)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier4_FR", 8, "", "", "8888", "dynamic", "", "", 1, -1, false, false, false, __instance.entityPlayerLocal.entityId, 0, "FuriousRamsayWarHorn");
}
else
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier4_FR", 4, "", "", "9999", "dynamic", "", "", 1, -1, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
}
else if (bMercenariesBuffTier5)
{
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMercenariesBuffTier5Cooldown");
__instance.entityPlayerLocal.Buffs.RemoveBuff("FuriousRamsayMercenariesBuffTier5");
if (isHordeNight)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier5_FR", 9, "", "", "8888", "dynamic", "", "", 1, -1, false, false, false, __instance.entityPlayerLocal.entityId, 0, "FuriousRamsayWarHorn");
}
else
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayMercenaryTier5_FR", 5, "", "", "9999", "dynamic", "", "", 1, -1, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
}
else
{
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttMercenaryContractMissing"));
}
}
return false;
}
else if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.PageDown) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11");
bool canTurretSkill = false;
bool hasJunkTurretSkillCooldown = false;
//float flClass = __instance.entityPlayerLocal.Buffs.GetCustomVar("$ActiveClass_FR");
float levelDeployableTurrets = RebirthUtilities.GetPerkLevel(__instance.entityPlayerLocal, "FuriousRamsayPerkDeployableTurrets");
bool hasJunkTurretCooldown = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayTurretSledgeSkillCooldown");
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions hasJunkTurretCooldown: " + hasJunkTurretCooldown);
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 5))
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11A");
if (levelDeployableTurrets >= 3)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11B");
canTurretSkill = true;
if (!hasJunkTurretCooldown)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11C");
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions levelDeployableTurrets: " + levelDeployableTurrets);
if (levelDeployableTurrets == 3)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11D 3");
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 4)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11D 4");
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 35, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 325, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 5)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 11D 5");
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 35, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 325, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 6)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 35, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 325, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 145, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 215, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 7)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 70, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 290, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 145, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 215, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 8)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 60, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 120, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 240, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 300, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 9)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 52, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 103, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 154, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 206, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 257, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 309, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 10)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 45, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 90, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 135, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 225, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 270, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 315, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
}
else
{
int classID = 5; // Technogeek
if (levelDeployableTurrets == 3)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 3, classID));
}
else if (levelDeployableTurrets == 4)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 4, classID));
}
else if (levelDeployableTurrets == 5)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 5, classID));
}
else if (levelDeployableTurrets == 6)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 6, classID));
}
else if (levelDeployableTurrets == 7)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 7, classID));
}
else if (levelDeployableTurrets == 8)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 8, classID));
}
else if (levelDeployableTurrets == 9)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 9, classID));
}
else if (levelDeployableTurrets == 10)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 10, classID));
}
}
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTurretSledgeSkillCooldown");
return false;
}
else
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions HAS TURRET COOLDOWN");
hasJunkTurretSkillCooldown = true;
}
}
if (canTurretSkill && hasJunkTurretSkillCooldown)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttHasJunkTurretSledgeSkillCooldown"));
}
}
return false;
}
else if (Input.GetKeyDown(KeyCode.PageDown) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 12");
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 9))
{
string itemMindControlBrewName = "FuriousRamsayQuickMindControlDrink";
ItemValue itemMindControlBrew = ItemClass.GetItem("FuriousRamsayMindControlDrink", false);
ItemClass itemClassMindControlBrew = itemMindControlBrew.ItemClass;
int itemCountMindControlBrew = __instance.entityPlayerLocal.bag.GetItemCount(itemMindControlBrew, -1, -1, false);
int itemCount2MindControlBrew = __instance.entityPlayerLocal.inventory.GetItemCount(itemMindControlBrew, false, -1, -1);
if (itemClassMindControlBrew != null)
{
itemCountMindControlBrew = __instance.entityPlayerLocal.bag.GetItemCount(itemMindControlBrew, -1, -1, false);
itemCount2MindControlBrew = __instance.entityPlayerLocal.inventory.GetItemCount(itemMindControlBrew, false, -1, -1);
}
if ((itemCountMindControlBrew + itemCount2MindControlBrew) > 0)
{
if (itemCount2MindControlBrew > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemMindControlBrew, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemMindControlBrew, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemMindControlBrew, 1));
Manager.PlayInsidePlayerHead("player_drinking");
int itemIndex = __instance.entityPlayerLocal.inventory.GetFocusedItemIdx();
int emptyItemIndex = -1;
bool foundEmptySpot = false;
ItemValue itemQuickHeal = ItemClass.GetItem(itemMindControlBrewName, false);
ItemStack[] slots = __instance.entityPlayerLocal.inventory.GetSlots();
for (int i = 0; i < slots.Length - 1; i++)
{
ItemStack itemStack = slots[i];
if (!itemStack.IsEmpty())
{
//Log.Out("Item: " + itemStack.itemValue.ItemClass.GetItemName());
//Log.Out("Item Num: " + itemStack.count);
}
else
{
emptyItemIndex = i;
ItemClass itemClass = itemQuickHeal.ItemClass;
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 1);
__instance.entityPlayerLocal.inventory.AddItem(@is);
__instance.entityPlayerLocal.inventory.SetFocusedItemIdx(i);
__instance.entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(i);
__instance.entityPlayerLocal.RightArmAnimationUse = true;
foundEmptySpot = true;
GameManager.Instance.StartCoroutine(RebirthUtilities.ProcessItemEmptySpot(1.5f, __instance.entityPlayerLocal, itemIndex, emptyItemIndex));
//Log.Out("FOUND EMPTY SPOT");
break;
}
}
if (!foundEmptySpot)
{
ItemStack @currentHoldingItem = new ItemStack(__instance.entityPlayerLocal.inventory.GetItem(itemIndex).itemValue.Clone(), 1);
int numInventoryItems = __instance.entityPlayerLocal.inventory.GetItemCount();
int numItems = __instance.entityPlayerLocal.inventory.GetItem(itemIndex).count;
//Log.Out("CURRENT ITEM: " + itemIndex);
//Log.Out("NUM ITEMS: " + __instance.entityPlayerLocal.inventory.GetItem(itemIndex).count);
ItemValue newItem = ItemClass.GetItem(itemMindControlBrewName, false);
ItemStack[] currentSlots = __instance.entityPlayerLocal.inventory.GetSlots();
//Log.Out("ADDING MEDICAL BANDAGE");
currentSlots[itemIndex] = ItemStack.Empty.Clone();
__instance.entityPlayerLocal.inventory.SetSlots(currentSlots);
ItemClass itemClass = newItem.ItemClass;
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 1);
__instance.entityPlayerLocal.inventory.AddItem(@is);
__instance.entityPlayerLocal.inventory.SetFocusedItemIdx(itemIndex);
__instance.entityPlayerLocal.inventory.SetHoldingItemIdxNoHolsterTime(itemIndex);
__instance.entityPlayerLocal.RightArmAnimationUse = true;
//Log.Out("Previous Item: " + @currentHoldingItem.itemValue.ItemClass.GetItemName());
GameManager.Instance.StartCoroutine(RebirthUtilities.ProcessItemUsedSpot(3.5f, __instance.entityPlayerLocal, itemIndex, @currentHoldingItem, numItems));
}
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMindControlBrewBuff");
}
else
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttMindControlBrewMissing"));
ItemStack @is = new ItemStack(new ItemValue(itemClassMindControlBrew.Id, false), 0);
__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer.AddUIHarvestingItem(@is, true);
}
}
else if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 10))
{
bool hasDensiveRageBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "FuriousRamsayRageBuffTier");
bool hasOffensiveRageBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "FuriousRamsayOffensiveRageBuffTier");
bool hasBloodMoonBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "BloodMoonRageBuffTier");
bool hasDefensiveRageCooldownBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "FuriousRamsayRageBuffCooldown");
bool hasOffensiveRageCooldownBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayOffensiveRageBuffCooldown");
bool hasBloodMoonRageCooldownBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayBloodMoonRageBuffCooldown");
bool hasOtherRageCapsuleCooldownBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayRageBuffOther");
bool bBerserker = !hasOtherRageCapsuleCooldownBuff && !hasDensiveRageBuff && !hasOffensiveRageBuff & !hasDefensiveRageCooldownBuff && !hasOffensiveRageCooldownBuff && !hasBloodMoonRageCooldownBuff;
//Log.Out("BACKSLASH-bBerserker: " + bBerserker);
//Log.Out("BACKSLASH-hasDensiveRageBuff: " + hasDensiveRageBuff);
//Log.Out("BACKSLASH-hasOffensiveRageBuff: " + hasOffensiveRageBuff);
//Log.Out("BACKSLASH-hasBloodMoonBuff: " + hasBloodMoonBuff);
//Log.Out("BACKSLASH-hasDefensiveRageCooldownBuff: " + hasDefensiveRageCooldownBuff);
//Log.Out("BACKSLASH-hasOffensiveRageCooldownBuff: " + hasOffensiveRageCooldownBuff);
if (bBerserker)
{
//Log.Out("DEFENSIVE RAGE TRIGGER");
RebirthUtilities.TriggerDefensiveRage(__instance.entityPlayerLocal);
}
else
{
//Log.Out("DEFENSIVE RAGE TRIGGER CANNOT");
if (hasDefensiveRageCooldownBuff ||
hasOffensiveRageCooldownBuff ||
hasBloodMoonRageCooldownBuff)
{
//Log.Out("DEFENSIVE RAGE TRIGGER CANNOT 0");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageCooldownActive"));
}
else if (hasDensiveRageBuff)
{
//Log.Out("DENIED 1");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageDefensiveActive"));
}
else if (hasBloodMoonRageCooldownBuff)
{
//Log.Out("DENIED 2");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageBloodmoonActive"));
}
else if (hasOffensiveRageCooldownBuff)
{
//Log.Out("DENIED 3");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageOffensiveActive"));
}
else if (hasOtherRageCapsuleCooldownBuff)
{
//Log.Out("DENIED 4");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageOffensiveOther"));
}
else
{
//Log.Out("DENIED 5");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttCannotUseAtThisTime"));
}
}
}
else
{
bool canRageCapsuleOther = false;
bool canTurretSkill = false;
bool hasJunkTurretSkillCooldown = false;
bool hasRageBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayRageBuffOther");
bool hasRageBuffCooldown = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayRageBuffOtherCooldown");
bool hasJunkTurretCooldown = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayTurretSkillCooldown");
float levelDeployableTurrets = RebirthUtilities.GetPerkLevel(__instance.entityPlayerLocal, "FuriousRamsayPerkDeployableTurrets");
bool isClassActive = RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 5);
if (isClassActive)
{
if (levelDeployableTurrets >= 3)
{
canTurretSkill = true;
if (!hasJunkTurretCooldown)
{
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
bool canSpawn = true;
if (levelDeployableTurrets == 3)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 4)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 5)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 120, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 240, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 6)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 90, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 270, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 7)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 72, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 144, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 216, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 288, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 8)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 60, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 120, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 240, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 300, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 9)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 52, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 103, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 154, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 206, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 257, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 309, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
else if (levelDeployableTurrets == 10)
{
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 45, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 90, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 135, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 225, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 270, false, true, false, __instance.entityPlayerLocal.entityId, 1);
RebirthUtilities.SpawnEntity(__instance.entityPlayerLocal.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 315, false, true, false, __instance.entityPlayerLocal.entityId, 1);
}
if (!canSpawn)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttCantUseSkill"));
return false;
}
}
else
{
int classID = 5; // Technogeek
if (levelDeployableTurrets == 3)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 13, classID));
}
else if (levelDeployableTurrets == 4)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 14, classID));
}
else if (levelDeployableTurrets == 5)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 15, classID));
}
else if (levelDeployableTurrets == 6)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 16, classID));
}
else if (levelDeployableTurrets == 7)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 17, classID));
}
else if (levelDeployableTurrets == 8)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 18, classID));
}
else if (levelDeployableTurrets == 9)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 19, classID));
}
else if (levelDeployableTurrets == 10)
{
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageRebirthUtilitiesSpawnEntity>().Setup(__instance.entityPlayerLocal.entityId, 20, classID));
}
}
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTurretSkillCooldown");
return false;
}
else
{
hasJunkTurretSkillCooldown = true;
}
}
if (canTurretSkill && hasJunkTurretSkillCooldown)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttHasJunkTurretSkillCooldown"));
}
return false;
}
ItemValue itemRageCapsuleOther = ItemClass.GetItem("FuriousRamsayRageCapsuleOther", false);
ItemClass itemClassRageCapsuleOther = itemRageCapsuleOther.ItemClass;
if (!(hasRageBuff || hasRageBuffCooldown))
{
int itemCountRageCapsuleOther = __instance.entityPlayerLocal.bag.GetItemCount(itemRageCapsuleOther, -1, -1, false);
int itemCount2RageCapsuleOther = __instance.entityPlayerLocal.inventory.GetItemCount(itemRageCapsuleOther, false, -1, -1);
if (itemClassRageCapsuleOther != null)
{
itemCountRageCapsuleOther = __instance.entityPlayerLocal.bag.GetItemCount(itemRageCapsuleOther, -1, -1, false);
itemCount2RageCapsuleOther = __instance.entityPlayerLocal.inventory.GetItemCount(itemRageCapsuleOther, false, -1, -1);
}
if ((itemCountRageCapsuleOther + itemCount2RageCapsuleOther) > 0)
{
if (itemCount2RageCapsuleOther > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(itemRageCapsuleOther, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(itemRageCapsuleOther, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemRageCapsuleOther, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayRageBuffOther");
canRageCapsuleOther = true;
}
}
//Log.Out("PlayerMoveControllerPatches-Update hasRageBuff: " + hasRageBuff);
//Log.Out("PlayerMoveControllerPatches-Update hasRageBuffCooldown: " + hasRageBuffCooldown);
if (hasRageBuffCooldown)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttHasRageCapsuleOtherCooldown"));
}
else if (!canRageCapsuleOther && !hasRageBuff)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageCapsuleMissing"));
ItemStack @is = new ItemStack(new ItemValue(itemClassRageCapsuleOther.Id, false), 0);
__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer.AddUIHarvestingItem(@is, true);
}
}
return false;
}
else if (Input.GetKeyDown(KeyCode.PageUp) && __instance.entityPlayerLocal.AttachedToEntity == null)
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 13");
//Log.Out("PlayerMoveControllerPatches-Update PAGE UP");
//float flClass = __instance.entityPlayerLocal.Buffs.GetCustomVar("$ActiveClass_FR");
float levelTechnogeekClass = RebirthUtilities.GetPerkLevel(__instance.entityPlayerLocal, "furiousramsayatttechnogeek");
float levelThugClass = RebirthUtilities.GetPerkLevel(__instance.entityPlayerLocal, "furiousramsayattthug");
float levelMadmanClass = RebirthUtilities.GetPerkLevel(__instance.entityPlayerLocal, "furiousramsayattmadman");
//Log.Out("PlayerMoveControllerPatches-Update levelTechnogeekClass: " + levelTechnogeekClass);
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 2) && levelThugClass >= 3)
{
bool bBuffCooldown = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayThugStunAoECooldown");
if (!bBuffCooldown)
{
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayThugStunAoECooldown");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayRangedStunAoETrigger", __instance.entityPlayerLocal.entityId);
}
}
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 6) && levelMadmanClass >= 3)
{
bool bBuffCooldown = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayMadmanExplosionAoECooldown");
if (!bBuffCooldown)
{
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayMadmanExplosionAoECooldown");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayAddAuraMadmanExplosionDamage" + levelMadmanClass, __instance.entityPlayerLocal.entityId);
}
}
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 5) && levelTechnogeekClass >= 5)
{
//Log.Out("PlayerMoveControllerPatches-Update IS TECHNOGEEK");
bool bBuffCooldown = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayTechnogeekShockAoECooldown");
if (!bBuffCooldown)
{
//Log.Out("PlayerMoveControllerPatches-Update NO TECHNOGEEK SHOCK AOE COOLDOWN");
ItemValue item = ItemClass.GetItem("FuriousRamsayShockwaveGrenade", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
//Log.Out("PlayerMoveControllerPatches-Update GRENADE ITEM EXISTS");
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
//Log.Out("PlayerMoveControllerPatches-Update I DO HAVE GRENADES");
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTechnogeekShockAoE");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTempResistShock");
__instance.entityPlayerLocal.Buffs.AddBuff("FuriousRamsayTechnogeekShockAoECooldown");
}
else
{
//Log.Out("PlayerMoveControllerPatches-Update I DON'T HAVE GRENADES");
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttShockwaveGrenadeMissing"));
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer.AddUIHarvestingItem(@is, true);
}
}
}
else
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttShockwaveCooldown"));
}
}
else
{
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 5) && levelTechnogeekClass < 5)
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttShockwaveNotReached"));
}
}
if (RebirthUtilities.IsPrimaryClass(__instance.entityPlayerLocal, 10))
{
float levelRage = RebirthUtilities.GetPerkLevel(__instance.entityPlayerLocal, "FuriousRamsayPerkRage");
bool hasDensiveRageBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "FuriousRamsayRageBuffTier");
bool hasOffensiveRageBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "FuriousRamsayOffensiveRageBuffTier");
bool hasBloodMoonBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "BloodMoonRageBuffTier");
Log.Out("DEFENSIVE RAGE TRIGGER 1 ");
bool hasDefensiveRageCooldownBuff = RebirthUtilities.HasBuffLike(__instance.entityPlayerLocal, "FuriousRamsayRageBuffCooldown");
bool hasOffensiveRageCooldownBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayOffensiveRageBuffCooldown");
bool hasBloodMoonRageCooldownBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayBloodMoonRageBuffCooldown");
bool hasOtherRageCapsuleCooldownBuff = __instance.entityPlayerLocal.Buffs.HasBuff("FuriousRamsayRageBuffOther");
bool bBerserker = !hasOtherRageCapsuleCooldownBuff && !hasDensiveRageBuff && !hasOffensiveRageBuff & !hasDefensiveRageCooldownBuff && !hasOffensiveRageCooldownBuff && !hasBloodMoonRageCooldownBuff;
if (bBerserker)
{
ItemValue item = ItemClass.GetItem("FuriousRamsayRageCapsule", false);
ItemClass itemClass = item.ItemClass;
if (itemClass != null)
{
int itemCount = __instance.entityPlayerLocal.bag.GetItemCount(item, -1, -1, false);
int itemCount2 = __instance.entityPlayerLocal.inventory.GetItemCount(item, false, -1, -1);
if (itemCount + itemCount2 > 0)
{
if (itemCount2 > 0)
{
__instance.entityPlayerLocal.inventory.DecItem(item, 1, false);
}
else
{
__instance.entityPlayerLocal.bag.DecItem(item, 1, false);
}
LocalPlayerUI.GetUIForPlayer(__instance.entityPlayerLocal).xui.CollectedItemList.RemoveItemStack(new ItemStack(item, 1));
RebirthUtilities.TriggerOffensiveRage(__instance.entityPlayerLocal);
}
else
{
Manager.PlayInsidePlayerHead("misc/missingitemtorepair");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageCapsuleMissing"));
ItemStack @is = new ItemStack(new ItemValue(itemClass.Id, false), 0);
__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer.AddUIHarvestingItem(@is, true);
}
}
}
else
{
if (hasDefensiveRageCooldownBuff ||
hasOffensiveRageCooldownBuff ||
hasBloodMoonRageCooldownBuff)
{
//Log.Out("DENIED B 1");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageCooldownActive"));
}
else if (hasDensiveRageBuff)
{
//Log.Out("DENIED B 2");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageDefensiveActive"));
}
else if (hasBloodMoonBuff)
{
//Log.Out("DENIED B 3");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageBloodmoonActive"));
}
else if (hasOffensiveRageBuff)
{
//Log.Out("DENIED B 4");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttRageOffensiveActive"));
}
else
{
//Log.Out("DENIED B 5");
Manager.PlayInsidePlayerHead("ui_denied");
GameManager.ShowTooltip(__instance.entityPlayerLocal.PlayerUI.xui.playerUI.entityPlayer, Localization.Get("ttCannotUseAtThisTime"));
}
}
}
return false;
}
else
{
//Log.Out("PlayerMoveControllerPatches-CheckPlayerActions 14");
return true;
}
}
}
}