using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using Photon.Pun;
using Photon.Realtime;
using PhotonCustomPropsUtils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PEAK Blow Darts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PEAK Blow Darts")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1bf01cad-9d92-4c56-aa0d-03fd3b28b670")]
[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 Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace PEAK_Blow_Darts
{
public enum BlowDartType
{
Unmodified,
Injury,
Poison,
Cold,
Hunger,
Drowsy,
Curse,
Hot,
Crab,
InfiniteStamina,
ExtraStamina,
FasterBoi,
AfflictionClearer,
Chaos,
Invincibility
}
public static class BlowDartDataEntryKey
{
public static readonly DataEntryKey DartType;
}
[BepInPlugin("tony4twentys.PEAK_Blow_Darts", "Peak Blow Darts", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class PEAKBlowDartsPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(Item), "Start")]
private static class Item_Start_Patch
{
private static void Postfix(Item __instance)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if (!IsBlowDart(__instance) || !Instance.allowBlowDartModification)
{
return;
}
if (__instance.HasData(BlowDartDataEntryKey.DartType))
{
IntItemData data = __instance.GetData<IntItemData>(BlowDartDataEntryKey.DartType);
BlowDartType value = (BlowDartType)data.Value;
if (value != 0)
{
ModifyToDartType(__instance, value);
}
}
else
{
BlowDartType randomDartType = GetRandomDartType();
if (randomDartType == BlowDartType.Unmodified)
{
IntItemData data2 = __instance.GetData<IntItemData>(BlowDartDataEntryKey.DartType);
data2.Value = 0;
}
else
{
ModifyToDartType(__instance, randomDartType);
}
}
}
}
[HarmonyPatch(typeof(Item), "GetItemName")]
private static class Item_GetItemName_Patch
{
private static void Postfix(Item __instance, ItemInstanceData data, ref string __result)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
IntItemData val = default(IntItemData);
if (IsBlowDart(__instance) && data != null && data.HasData(BlowDartDataEntryKey.DartType) && data.TryGetDataEntry<IntItemData>(BlowDartDataEntryKey.DartType, ref val))
{
BlowDartType value = (BlowDartType)val.Value;
if (value != 0)
{
__result = GetDartName(value);
}
}
}
}
private static Harmony _harmony;
internal static PEAKBlowDartsPlugin Instance;
private PhotonScopedManager photonManager;
public bool IsHost = false;
public bool allowBlowDartModification = false;
private static ConfigEntry<bool> CFG_EnableInjury;
private static ConfigEntry<bool> CFG_EnablePoison;
private static ConfigEntry<bool> CFG_EnableCold;
private static ConfigEntry<bool> CFG_EnableHunger;
private static ConfigEntry<bool> CFG_EnableDrowsy;
private static ConfigEntry<bool> CFG_EnableCurse;
private static ConfigEntry<bool> CFG_EnableHot;
private static ConfigEntry<bool> CFG_EnableCrab;
private static ConfigEntry<bool> CFG_EnableInfiniteStamina;
private static ConfigEntry<bool> CFG_EnableExtraStamina;
private static ConfigEntry<bool> CFG_EnableFasterBoi;
private static ConfigEntry<bool> CFG_EnableAfflictionClearer;
private static ConfigEntry<bool> CFG_EnablePandoras;
private static ConfigEntry<bool> CFG_EnableInvincibility;
private static ConfigEntry<float> CFG_InjuryChance;
private static ConfigEntry<float> CFG_PoisonChance;
private static ConfigEntry<float> CFG_ColdChance;
private static ConfigEntry<float> CFG_HungerChance;
private static ConfigEntry<float> CFG_DrowsyChance;
private static ConfigEntry<float> CFG_CurseChance;
private static ConfigEntry<float> CFG_HotChance;
private static ConfigEntry<float> CFG_CrabChance;
private static ConfigEntry<float> CFG_InfiniteStaminaChance;
private static ConfigEntry<float> CFG_ExtraStaminaChance;
private static ConfigEntry<float> CFG_FasterBoiChance;
private static ConfigEntry<float> CFG_AfflictionClearerChance;
private static ConfigEntry<float> CFG_PandorasChance;
private static ConfigEntry<float> CFG_InvincibilityChance;
private static ConfigEntry<float> CFG_UnmodifiedChance;
private static ConfigEntry<float> CFG_InjuryAmount;
private static ConfigEntry<float> CFG_PoisonAmount;
private static ConfigEntry<float> CFG_PoisonDuration;
private static ConfigEntry<float> CFG_ColdAmount;
private static ConfigEntry<float> CFG_ColdDuration;
private static ConfigEntry<float> CFG_HungerAmount;
private static ConfigEntry<float> CFG_DrowsyAmount;
private static ConfigEntry<float> CFG_CurseAmount;
private static ConfigEntry<float> CFG_HotAmount;
private static ConfigEntry<float> CFG_CrabAmount;
private static ConfigEntry<float> CFG_InfiniteStaminaDuration;
private static ConfigEntry<float> CFG_ExtraStaminaAmount;
private static ConfigEntry<float> CFG_InvincibilityDuration;
private static ConfigEntry<float> CFG_FasterBoiDuration;
private static ConfigEntry<float> CFG_FasterBoiMoveSpeed;
private static ConfigEntry<float> CFG_FasterBoiClimbSpeed;
private void Awake()
{
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_0632: Expected O, but got Unknown
Instance = this;
CFG_EnableInjury = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableInjury", false, "Enable Injury Blow Gun");
CFG_EnablePoison = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnablePoison", false, "Enable Poison Blow Gun");
CFG_EnableCold = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableCold", false, "Enable Cold Blow Gun");
CFG_EnableHunger = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableHunger", false, "Enable Hunger Blow Gun");
CFG_EnableDrowsy = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableDrowsy", false, "Enable Drowsy Blow Gun");
CFG_EnableCurse = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableCurse", false, "Enable Curse Blow Gun");
CFG_EnableHot = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableHot", false, "Enable Hot Blow Gun");
CFG_EnableCrab = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableCrab", false, "Enable Crab Blow Gun");
CFG_EnableInfiniteStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableInfiniteStamina", true, "Enable Infinite Stamina Blow Gun");
CFG_EnableExtraStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableExtraStamina", true, "Enable Extra Stamina Blow Gun");
CFG_EnableFasterBoi = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableFasterBoi", true, "Enable Faster Boi Blow Gun");
CFG_EnableAfflictionClearer = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableAfflictionClearer", true, "Enable Affliction Clearer Blow Gun");
CFG_EnablePandoras = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnablePandoras", true, "Enable Pandoras Blow Gun");
CFG_EnableInvincibility = ((BaseUnityPlugin)this).Config.Bind<bool>("DartTypes", "EnableInvincibility", true, "Enable Invincibility Blow Gun");
CFG_InjuryChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "InjuryChance", 0f, "Chance for Injury Blow Gun (0.0-1.0)");
CFG_PoisonChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "PoisonChance", 0f, "Chance for Poison Blow Gun (0.0-1.0)");
CFG_ColdChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "ColdChance", 0f, "Chance for Cold Blow Gun (0.0-1.0)");
CFG_HungerChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "HungerChance", 0f, "Chance for Hunger Blow Gun (0.0-1.0)");
CFG_DrowsyChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "DrowsyChance", 0f, "Chance for Drowsy Blow Gun (0.0-1.0)");
CFG_CurseChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "CurseChance", 0f, "Chance for Curse Blow Gun (0.0-1.0)");
CFG_HotChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "HotChance", 0f, "Chance for Hot Blow Gun (0.0-1.0)");
CFG_CrabChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "CrabChance", 0f, "Chance for Crab Blow Gun (0.0-1.0)");
CFG_InfiniteStaminaChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "InfiniteStaminaChance", 0.1f, "Chance for Infinite Stamina Blow Gun (0.0-1.0)");
CFG_ExtraStaminaChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "ExtraStaminaChance", 0.1f, "Chance for Extra Stamina Blow Gun (0.0-1.0)");
CFG_FasterBoiChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "FasterBoiChance", 0.1f, "Chance for Faster Boi Blow Gun (0.0-1.0)");
CFG_AfflictionClearerChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "AfflictionClearerChance", 0.1f, "Chance for Affliction Clearer Blow Gun (0.0-1.0)");
CFG_PandorasChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "PandorasChance", 0.1f, "Chance for Pandoras Blow Gun (0.0-1.0)");
CFG_InvincibilityChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "InvincibilityChance", 0.01f, "Chance for Invincibility Blow Gun (0.0-1.0)");
CFG_UnmodifiedChance = ((BaseUnityPlugin)this).Config.Bind<float>("Chances", "UnmodifiedChance", 0.5f, "Chance to get the classic blow gun (0.0-1.0)");
CFG_InjuryAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "InjuryAmount", 0.25f, "Injury amount");
CFG_PoisonAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "PoisonAmount", 0.25f, "Poison amount (instant)");
CFG_PoisonDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "PoisonDuration", 0.001f, "Poison duration in seconds (instant)");
CFG_ColdAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "ColdAmount", -0.25f, "Cold amount (instant)");
CFG_ColdDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "ColdDuration", 0.001f, "Cold duration in seconds (instant)");
CFG_HungerAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "HungerAmount", 0.25f, "Hunger amount");
CFG_DrowsyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "DrowsyAmount", 0.25f, "Drowsy amount");
CFG_CurseAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "CurseAmount", 0.25f, "Curse amount");
CFG_HotAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "HotAmount", 0.25f, "Hot amount");
CFG_CrabAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "CrabAmount", 0.25f, "Crab amount");
CFG_InfiniteStaminaDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "InfiniteStaminaDuration", 30f, "Infinite stamina duration in seconds");
CFG_ExtraStaminaAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "ExtraStaminaAmount", 50f, "Extra stamina amount");
CFG_InvincibilityDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "InvincibilityDuration", 30f, "Invincibility duration in seconds");
CFG_FasterBoiDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "FasterBoiDuration", 20f, "Faster Boi duration in seconds");
CFG_FasterBoiMoveSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "FasterBoiMoveSpeed", 1.5f, "Faster Boi movement speed multiplier");
CFG_FasterBoiClimbSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Parameters", "FasterBoiClimbSpeed", 1.3f, "Faster Boi climb speed multiplier");
_harmony = new Harmony("tony4twentys.PEAK_Blow_Darts");
_harmony.PatchAll();
InitializePhotonManager();
PhotonNetwork.AddCallbackTarget((object)this);
}
private void OnDestroy()
{
if (_harmony != null)
{
_harmony.UnpatchSelf();
}
PhotonNetwork.RemoveCallbackTarget((object)this);
}
private void InitializePhotonManager()
{
if (PhotonCustomPropsUtilsPlugin.IsReady)
{
SetupPhotonManager();
}
else
{
PhotonCustomPropsUtilsPlugin.OnReady += SetupPhotonManager;
}
}
private void SetupPhotonManager()
{
photonManager = PhotonCustomPropsUtilsPlugin.GetManager("tony4twentys.PEAK_Blow_Darts");
photonManager.RegisterOnJoinedRoom((Action<Player>)delegate
{
CheckHostStatus();
});
photonManager.RegisterRoomProperty<string>("blowDartConfig", (RoomEventType)2, (Action<string>)delegate(string configData)
{
if (!PhotonNetwork.IsMasterClient && !string.IsNullOrEmpty(configData))
{
UnpackConfigData(configData);
allowBlowDartModification = true;
}
});
}
private void CheckHostStatus()
{
if (PhotonNetwork.InRoom)
{
if (PhotonNetwork.IsMasterClient)
{
IsHost = true;
allowBlowDartModification = true;
PublishHostConfig();
}
else
{
IsHost = false;
allowBlowDartModification = false;
}
}
}
private void PublishHostConfig()
{
if (PhotonNetwork.IsMasterClient && photonManager != null)
{
string text = PackConfigData();
photonManager.SetRoomProperty("blowDartConfig", (object)text);
}
}
private string PackConfigData()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"ENABLE_Injury={CFG_EnableInjury.Value}");
stringBuilder.AppendLine($"ENABLE_Poison={CFG_EnablePoison.Value}");
stringBuilder.AppendLine($"ENABLE_Cold={CFG_EnableCold.Value}");
stringBuilder.AppendLine($"ENABLE_Hunger={CFG_EnableHunger.Value}");
stringBuilder.AppendLine($"ENABLE_Drowsy={CFG_EnableDrowsy.Value}");
stringBuilder.AppendLine($"ENABLE_Curse={CFG_EnableCurse.Value}");
stringBuilder.AppendLine($"ENABLE_Hot={CFG_EnableHot.Value}");
stringBuilder.AppendLine($"ENABLE_Crab={CFG_EnableCrab.Value}");
stringBuilder.AppendLine($"ENABLE_InfiniteStamina={CFG_EnableInfiniteStamina.Value}");
stringBuilder.AppendLine($"ENABLE_ExtraStamina={CFG_EnableExtraStamina.Value}");
stringBuilder.AppendLine($"ENABLE_FasterBoi={CFG_EnableFasterBoi.Value}");
stringBuilder.AppendLine($"ENABLE_AfflictionClearer={CFG_EnableAfflictionClearer.Value}");
stringBuilder.AppendLine($"ENABLE_Pandoras={CFG_EnablePandoras.Value}");
stringBuilder.AppendLine($"ENABLE_Invincibility={CFG_EnableInvincibility.Value}");
stringBuilder.AppendLine($"CHANCE_Injury={CFG_InjuryChance.Value}");
stringBuilder.AppendLine($"CHANCE_Poison={CFG_PoisonChance.Value}");
stringBuilder.AppendLine($"CHANCE_Cold={CFG_ColdChance.Value}");
stringBuilder.AppendLine($"CHANCE_Hunger={CFG_HungerChance.Value}");
stringBuilder.AppendLine($"CHANCE_Drowsy={CFG_DrowsyChance.Value}");
stringBuilder.AppendLine($"CHANCE_Curse={CFG_CurseChance.Value}");
stringBuilder.AppendLine($"CHANCE_Hot={CFG_HotChance.Value}");
stringBuilder.AppendLine($"CHANCE_Crab={CFG_CrabChance.Value}");
stringBuilder.AppendLine($"CHANCE_InfiniteStamina={CFG_InfiniteStaminaChance.Value}");
stringBuilder.AppendLine($"CHANCE_ExtraStamina={CFG_ExtraStaminaChance.Value}");
stringBuilder.AppendLine($"CHANCE_FasterBoi={CFG_FasterBoiChance.Value}");
stringBuilder.AppendLine($"CHANCE_AfflictionClearer={CFG_AfflictionClearerChance.Value}");
stringBuilder.AppendLine($"CHANCE_Pandoras={CFG_PandorasChance.Value}");
stringBuilder.AppendLine($"CHANCE_Invincibility={CFG_InvincibilityChance.Value}");
stringBuilder.AppendLine($"CHANCE_Unmodified={CFG_UnmodifiedChance.Value}");
stringBuilder.AppendLine($"AMOUNT_Injury={CFG_InjuryAmount.Value}");
stringBuilder.AppendLine($"AMOUNT_Poison={CFG_PoisonAmount.Value}");
stringBuilder.AppendLine($"DURATION_Poison={CFG_PoisonDuration.Value}");
stringBuilder.AppendLine($"AMOUNT_Cold={CFG_ColdAmount.Value}");
stringBuilder.AppendLine($"DURATION_Cold={CFG_ColdDuration.Value}");
stringBuilder.AppendLine($"AMOUNT_Hunger={CFG_HungerAmount.Value}");
stringBuilder.AppendLine($"AMOUNT_Drowsy={CFG_DrowsyAmount.Value}");
stringBuilder.AppendLine($"AMOUNT_Curse={CFG_CurseAmount.Value}");
stringBuilder.AppendLine($"AMOUNT_Hot={CFG_HotAmount.Value}");
stringBuilder.AppendLine($"AMOUNT_Crab={CFG_CrabAmount.Value}");
stringBuilder.AppendLine($"AMOUNT_ExtraStamina={CFG_ExtraStaminaAmount.Value}");
stringBuilder.AppendLine($"DURATION_FasterBoi={CFG_FasterBoiDuration.Value}");
stringBuilder.AppendLine($"DURATION_InfiniteStamina={CFG_InfiniteStaminaDuration.Value}");
stringBuilder.AppendLine($"DURATION_Invincibility={CFG_InvincibilityDuration.Value}");
stringBuilder.AppendLine($"MOVESPEED_FasterBoi={CFG_FasterBoiMoveSpeed.Value}");
stringBuilder.AppendLine($"CLIMBSPEED_FasterBoi={CFG_FasterBoiClimbSpeed.Value}");
return Convert.ToBase64String(Encoding.UTF8.GetBytes(stringBuilder.ToString()));
}
private void UnpackConfigData(string configData)
{
try
{
string @string = Encoding.UTF8.GetString(Convert.FromBase64String(configData));
string[] array = @string.Split(new char[1] { '\n' });
string[] array2 = array;
foreach (string text in array2)
{
if (string.IsNullOrWhiteSpace(text))
{
continue;
}
string[] array3 = text.Split(new char[1] { '=' }, 2);
if (array3.Length != 2)
{
continue;
}
string text2 = array3[0];
string text3 = array3[1];
float result6;
if (text2.StartsWith("ENABLE_"))
{
string text4 = text2.Substring(7);
if (bool.TryParse(text3, out var result))
{
switch (text4)
{
case "Injury":
CFG_EnableInjury.Value = result;
break;
case "Poison":
CFG_EnablePoison.Value = result;
break;
case "Cold":
CFG_EnableCold.Value = result;
break;
case "Hunger":
CFG_EnableHunger.Value = result;
break;
case "Drowsy":
CFG_EnableDrowsy.Value = result;
break;
case "Curse":
CFG_EnableCurse.Value = result;
break;
case "Hot":
CFG_EnableHot.Value = result;
break;
case "Crab":
CFG_EnableCrab.Value = result;
break;
case "InfiniteStamina":
CFG_EnableInfiniteStamina.Value = result;
break;
case "ExtraStamina":
CFG_EnableExtraStamina.Value = result;
break;
case "FasterBoi":
CFG_EnableFasterBoi.Value = result;
break;
case "AfflictionClearer":
CFG_EnableAfflictionClearer.Value = result;
break;
case "Pandoras":
CFG_EnablePandoras.Value = result;
break;
case "Invincibility":
CFG_EnableInvincibility.Value = result;
break;
}
}
}
else if (text2.StartsWith("CHANCE_"))
{
string text5 = text2.Substring(7);
if (float.TryParse(text3, out var result2))
{
switch (text5)
{
case "Injury":
CFG_InjuryChance.Value = result2;
break;
case "Poison":
CFG_PoisonChance.Value = result2;
break;
case "Cold":
CFG_ColdChance.Value = result2;
break;
case "Hunger":
CFG_HungerChance.Value = result2;
break;
case "Drowsy":
CFG_DrowsyChance.Value = result2;
break;
case "Curse":
CFG_CurseChance.Value = result2;
break;
case "Hot":
CFG_HotChance.Value = result2;
break;
case "Crab":
CFG_CrabChance.Value = result2;
break;
case "InfiniteStamina":
CFG_InfiniteStaminaChance.Value = result2;
break;
case "ExtraStamina":
CFG_ExtraStaminaChance.Value = result2;
break;
case "FasterBoi":
CFG_FasterBoiChance.Value = result2;
break;
case "AfflictionClearer":
CFG_AfflictionClearerChance.Value = result2;
break;
case "Pandoras":
CFG_PandorasChance.Value = result2;
break;
case "Invincibility":
CFG_InvincibilityChance.Value = result2;
break;
case "Unmodified":
CFG_UnmodifiedChance.Value = result2;
break;
}
}
}
else if (text2.StartsWith("AMOUNT_"))
{
string text6 = text2.Substring(7);
if (float.TryParse(text3, out var result3))
{
switch (text6)
{
case "Injury":
CFG_InjuryAmount.Value = result3;
break;
case "Poison":
CFG_PoisonAmount.Value = result3;
break;
case "Cold":
CFG_ColdAmount.Value = result3;
break;
case "Hunger":
CFG_HungerAmount.Value = result3;
break;
case "Drowsy":
CFG_DrowsyAmount.Value = result3;
break;
case "Curse":
CFG_CurseAmount.Value = result3;
break;
case "Hot":
CFG_HotAmount.Value = result3;
break;
case "Crab":
CFG_CrabAmount.Value = result3;
break;
case "ExtraStamina":
CFG_ExtraStaminaAmount.Value = result3;
break;
}
}
}
else if (text2.StartsWith("DURATION_"))
{
string text7 = text2.Substring(9);
if (float.TryParse(text3, out var result4))
{
switch (text7)
{
case "Poison":
CFG_PoisonDuration.Value = result4;
break;
case "Cold":
CFG_ColdDuration.Value = result4;
break;
case "FasterBoi":
CFG_FasterBoiDuration.Value = result4;
break;
case "InfiniteStamina":
CFG_InfiniteStaminaDuration.Value = result4;
break;
case "Invincibility":
CFG_InvincibilityDuration.Value = result4;
break;
}
}
}
else if (text2.StartsWith("MOVESPEED_"))
{
if (float.TryParse(text3, out var result5))
{
CFG_FasterBoiMoveSpeed.Value = result5;
}
}
else if (text2.StartsWith("CLIMBSPEED_") && float.TryParse(text3, out result6))
{
CFG_FasterBoiClimbSpeed.Value = result6;
}
}
}
catch (Exception)
{
}
}
private static bool IsBlowDart(Item item)
{
if (!Object.op_Implicit((Object)(object)item))
{
return false;
}
return (Object)(object)((Component)item).GetComponent<Action_RaycastDart>() != (Object)null;
}
private static void SetItemUIName(Item item, string name)
{
if (!Object.op_Implicit((Object)(object)item))
{
return;
}
try
{
Type type = AccessTools.Inner(typeof(Item), "ItemUIData");
if (type == null)
{
return;
}
FieldInfo fieldInfo = null;
foreach (FieldInfo declaredField in AccessTools.GetDeclaredFields(typeof(Item)))
{
if (declaredField.FieldType == type)
{
fieldInfo = declaredField;
break;
}
}
if (fieldInfo == null)
{
return;
}
object obj = fieldInfo.GetValue(item);
if (obj == null)
{
obj = Activator.CreateInstance(type);
}
FieldInfo fieldInfo2 = AccessTools.Field(type, "itemName");
if (!(fieldInfo2 == null))
{
if (type.IsValueType)
{
object obj2 = obj;
fieldInfo2.SetValue(obj2, name);
fieldInfo.SetValue(item, obj2);
}
else
{
fieldInfo2.SetValue(obj, name);
fieldInfo.SetValue(item, obj);
}
}
}
catch (Exception)
{
}
}
private static string GetDartName(BlowDartType dartType)
{
return dartType switch
{
BlowDartType.Injury => "Injury Blow Gun",
BlowDartType.Poison => "Poison Blow Gun",
BlowDartType.Cold => "Frosting Blow Gun",
BlowDartType.Hunger => "Hunger Blow Gun",
BlowDartType.Drowsy => "Drowsy Blow Gun",
BlowDartType.Curse => "Curse Blow Gun",
BlowDartType.Hot => "Burning Blow Gun",
BlowDartType.Crab => "Crabby Blow Gun",
BlowDartType.InfiniteStamina => "Infinite Stamina Blow Gun",
BlowDartType.ExtraStamina => "Extra Stamina Blow Gun",
BlowDartType.FasterBoi => "Energy Blow Gun",
BlowDartType.AfflictionClearer => "Affliction Clearer Blow Gun",
BlowDartType.Chaos => "Pandoras Blow Gun",
BlowDartType.Invincibility => "Invincibility Blow Gun",
_ => "Modified Blow Gun",
};
}
private static Affliction CreateAffliction(BlowDartType dartType)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Expected O, but got Unknown
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Expected O, but got Unknown
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Expected O, but got Unknown
switch (dartType)
{
case BlowDartType.Injury:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)0, CFG_InjuryAmount.Value, 0f);
case BlowDartType.Poison:
return (Affliction)new Affliction_PoisonOverTime(1f, 0f, 0.5f);
case BlowDartType.Cold:
return (Affliction)new Affliction_AdjustColdOverTime(0.5f, 1f);
case BlowDartType.Hunger:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)1, CFG_HungerAmount.Value, 0f);
case BlowDartType.Drowsy:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)6, CFG_DrowsyAmount.Value, 0f);
case BlowDartType.Curse:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)5, CFG_CurseAmount.Value, 0f);
case BlowDartType.Hot:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)8, CFG_HotAmount.Value, 0f);
case BlowDartType.Crab:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)4, CFG_CrabAmount.Value, 0f);
case BlowDartType.InfiniteStamina:
return (Affliction)new Affliction_InfiniteStamina(CFG_InfiniteStaminaDuration.Value);
case BlowDartType.ExtraStamina:
return (Affliction)new Affliction_AddBonusStamina(CFG_ExtraStaminaAmount.Value, 0f);
case BlowDartType.FasterBoi:
{
Affliction_FasterBoi val = new Affliction_FasterBoi();
((Affliction)val).totalTime = CFG_FasterBoiDuration.Value;
val.moveSpeedMod = CFG_FasterBoiMoveSpeed.Value;
val.climbSpeedMod = CFG_FasterBoiClimbSpeed.Value;
val.drowsyOnEnd = 0f;
val.climbDelay = 0f;
return (Affliction)(object)val;
}
case BlowDartType.AfflictionClearer:
return (Affliction)new Affliction_ClearAllStatus(false, 0f);
case BlowDartType.Chaos:
return (Affliction)new Affliction_Chaos(0.5f, 0.2f, 0.3f, 0.1f);
case BlowDartType.Invincibility:
return (Affliction)new Affliction_BingBongShield
{
totalTime = CFG_InvincibilityDuration.Value
};
default:
return (Affliction)new Affliction_AdjustStatus((STATUSTYPE)0, CFG_InjuryAmount.Value, 0f);
}
}
private static BlowDartType GetRandomDartType()
{
if (Random.Range(0f, 1f) < CFG_UnmodifiedChance.Value)
{
return BlowDartType.Unmodified;
}
List<(BlowDartType, float)> list = new List<(BlowDartType, float)>();
if (CFG_EnableInjury.Value)
{
list.Add((BlowDartType.Injury, CFG_InjuryChance.Value));
}
if (CFG_EnablePoison.Value)
{
list.Add((BlowDartType.Poison, CFG_PoisonChance.Value));
}
if (CFG_EnableCold.Value)
{
list.Add((BlowDartType.Cold, CFG_ColdChance.Value));
}
if (CFG_EnableHunger.Value)
{
list.Add((BlowDartType.Hunger, CFG_HungerChance.Value));
}
if (CFG_EnableDrowsy.Value)
{
list.Add((BlowDartType.Drowsy, CFG_DrowsyChance.Value));
}
if (CFG_EnableCurse.Value)
{
list.Add((BlowDartType.Curse, CFG_CurseChance.Value));
}
if (CFG_EnableHot.Value)
{
list.Add((BlowDartType.Hot, CFG_HotChance.Value));
}
if (CFG_EnableCrab.Value)
{
list.Add((BlowDartType.Crab, CFG_CrabChance.Value));
}
if (CFG_EnableInfiniteStamina.Value)
{
list.Add((BlowDartType.InfiniteStamina, CFG_InfiniteStaminaChance.Value));
}
if (CFG_EnableExtraStamina.Value)
{
list.Add((BlowDartType.ExtraStamina, CFG_ExtraStaminaChance.Value));
}
if (CFG_EnableFasterBoi.Value)
{
list.Add((BlowDartType.FasterBoi, CFG_FasterBoiChance.Value));
}
if (CFG_EnableAfflictionClearer.Value)
{
list.Add((BlowDartType.AfflictionClearer, CFG_AfflictionClearerChance.Value));
}
if (CFG_EnablePandoras.Value)
{
list.Add((BlowDartType.Chaos, CFG_PandorasChance.Value));
}
if (CFG_EnableInvincibility.Value)
{
list.Add((BlowDartType.Invincibility, CFG_InvincibilityChance.Value));
}
if (list.Count == 0)
{
return BlowDartType.Unmodified;
}
float num = 0f;
foreach (var item in list)
{
num += item.Item2;
}
if (num <= 0f)
{
return BlowDartType.Unmodified;
}
float num2 = Random.Range(0f, num);
float num3 = 0f;
foreach (var item2 in list)
{
num3 += item2.Item2;
if (num2 <= num3)
{
return item2.Item1;
}
}
return list[0].Item1;
}
private static void ModifyToDartType(Item dartItem, BlowDartType dartType)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
try
{
Action_RaycastDart component = ((Component)dartItem).GetComponent<Action_RaycastDart>();
if (!((Object)(object)component == (Object)null))
{
Affliction val = CreateAffliction(dartType);
component.afflictionsOnHit = (Affliction[])(object)new Affliction[1] { val };
string dartName = GetDartName(dartType);
SetItemUIName(dartItem, dartName);
IntItemData data = dartItem.GetData<IntItemData>(BlowDartDataEntryKey.DartType);
data.Value = (int)dartType;
}
}
catch (Exception)
{
}
}
public void OnJoinedRoom()
{
CheckHostStatus();
}
public void OnLeftRoom()
{
IsHost = false;
allowBlowDartModification = false;
}
public void OnMasterClientSwitched(Player _)
{
CheckHostStatus();
}
public void OnPlayerEnteredRoom(Player _)
{
if (PhotonNetwork.IsMasterClient && photonManager != null)
{
PublishHostConfig();
}
}
public void OnPlayerLeftRoom(Player _)
{
}
public void OnRoomPropertiesUpdate(Hashtable _)
{
}
public void OnPlayerPropertiesUpdate(Player _, Hashtable _1)
{
}
public void OnConnected()
{
}
public void OnConnectedToMaster()
{
}
public void OnDisconnected(DisconnectCause _)
{
}
public void OnRegionListReceived(RegionHandler _)
{
}
public void OnCustomAuthenticationResponse(Dictionary<string, object> _)
{
}
public void OnCustomAuthenticationFailed(string _)
{
}
public void OnFriendListUpdate(List<FriendInfo> _)
{
}
public void OnCreatedRoom()
{
}
public void OnCreateRoomFailed(short _, string _1)
{
}
public void OnJoinRoomFailed(short _, string _1)
{
}
public void OnJoinRandomFailed(short _, string _1)
{
}
}
}