using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ScarletItem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScarletItem")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d1bf633-2dd5-4d51-a726-ced07245478c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace scarlet_item;
[BepInPlugin("item", "item", "0.0.1")]
public class plugin : BaseUnityPlugin
{
private const string GUID = "item";
private const string NAME = "item";
private const string VERSION = "0.0.1";
private static plugin instance;
private readonly Harmony harmony = new Harmony("item");
private void Awake()
{
instance = this;
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "items");
AssetBundle val = AssetBundle.LoadFromFile(text);
harmony.PatchAll(typeof(BladedWeapons));
string[] array = new string[5] { "KatxBlade", "ScarletBlade", "BlueStarBlade", "BeyondsBlade", "UltrasBlade" };
string[] array2 = new string[10] { "Sleepy", "KatxPainting", "RedCoin", "MW3", "GreenStar", "PinkStar", "RedStar", "Star", "BlueStar", "ScarletNew" };
string[] array3 = new string[3] { "Scarlet", "Beyond", "Ultra" };
for (int i = 0; i < 10; i++)
{
string text2 = "Assets/Items/" + array2[i] + ".asset";
Item val2 = val.LoadAsset<Item>(text2);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
Items.RegisterScrap(val2, 45, (LevelTypes)(-1));
}
for (int j = 0; j < 3; j++)
{
string text3 = "Assets/Items/" + array3[j] + ".asset";
Item val3 = val.LoadAsset<Item>(text3);
NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
Utilities.FixMixerGroups(val3.spawnPrefab);
Items.RegisterScrap(val3, 75, (LevelTypes)(-1));
}
for (int k = 0; k < 5; k++)
{
string text4 = "Assets/Items/" + array[k] + ".asset";
Item val4 = val.LoadAsset<Item>(text4);
NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
Utilities.FixMixerGroups(val4.spawnPrefab);
Items.RegisterScrap(val4, 45, (LevelTypes)(-1));
Shovel component = val4.spawnPrefab.GetComponent<Shovel>();
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class BladedWeapons : MonoBehaviour
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void NightVision(ref Light ___nightVision)
{
___nightVision.type = (LightType)2;
___nightVision.intensity = 44444f;
___nightVision.range = 99999f;
___nightVision.shadowStrength = 0f;
___nightVision.bounceIntensity = 5555f;
___nightVision.innerSpotAngle = 999f;
___nightVision.spotAngle = 9999f;
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void KatxBlade(PlayerControllerB __instance, ref Light ___nightVision)
{
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
bool flag = ((Component)___nightVision).gameObject.activeSelf;
((Component)___nightVision).gameObject.SetActive(false);
__instance.jumpForce = 13f;
__instance.drunkness = 0f;
__instance.movementSpeed = 4.6f;
if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName == "Katxs Blade")
{
if (__instance.playerUsername != "Katx" && __instance.playerUsername != "Scarlet")
{
__instance.drunkness = 999f;
__instance.sprintMeter = 0f;
__instance.movementSpeed = 1f;
}
else
{
HUDManager.Instance.AddTextToChatOnServer("<color=purple>Fallen Darkness<color=white>:</color></color>\n<color=red>Welcome Katx</color>", -1);
__instance.takingFallDamage = false;
__instance.sprintMeter = 1f;
__instance.jumpForce = 45f;
__instance.movementSpeed = 10f;
}
if (((ButtonControl)Keyboard.current[(Key)31]).wasPressedThisFrame)
{
__instance.DamagePlayer(-100, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
else if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName == "Beyonds Blade")
{
__instance.takingFallDamage = false;
__instance.sprintMeter = 1f;
__instance.jumpForce = 45f;
if (((ButtonControl)Keyboard.current[(Key)31]).wasPressedThisFrame)
{
if (((Component)___nightVision).gameObject.activeSelf)
{
flag = false;
}
if (!((Component)___nightVision).gameObject.activeSelf)
{
flag = true;
}
}
if (!flag)
{
((Component)___nightVision).gameObject.SetActive(false);
}
if (flag)
{
((Component)___nightVision).gameObject.SetActive(true);
}
}
else if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName == "Scarlet Blade")
{
if (((ButtonControl)Keyboard.current[(Key)31]).wasPressedThisFrame)
{
if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName == "Scarlet Blade")
{
__instance.DamagePlayer(100, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
else
{
StartOfRound.Instance.ReviveDeadPlayers();
HUDManager.Instance.HideHUD(false);
}
}
if (__instance.playerUsername != "Katx" && __instance.playerUsername != "Scarlet")
{
__instance.takingFallDamage = false;
__instance.sprintMeter = 1f;
return;
}
__instance.takingFallDamage = false;
__instance.sprintMeter = 1f;
__instance.jumpForce = 45f;
__instance.movementSpeed = 10f;
}
else if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName == "Ultras Blade")
{
__instance.sprintMeter = 1f;
__instance.movementSpeed = 10f;
}
else if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.currentlyHeldObjectServer.itemProperties.itemName == "Scarlet")
{
if (((ButtonControl)Keyboard.current[(Key)31]).wasPressedThisFrame)
{
__instance.playerUsername = "Scarlet";
__instance.playerClientId = ulong.Parse(__instance.playerUsername);
__instance.playerSteamId = ulong.Parse(__instance.playerUsername);
__instance.actualClientId = ulong.Parse(__instance.playerUsername);
}
if (__instance.playerUsername == "Scarlet")
{
HUDManager.Instance.AddTextToChatOnServer("<color=purple>Scarlet<color=white>:</color></color>\n<color=red>You have been renamed to scarlet</color>", -1);
}
}
}
}