using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using PEAKLib.Core;
using PEAKLib.Items;
using PEAKLib.Stats;
using Photon.Pun;
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("PeakMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PeakMod")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a84ce0ab-c1b9-497a-a435-6f9a7cf947fa")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LitEnger
{
public class CondStatus : Status
{
}
}
namespace LitEnger.Properties
{
[CompilerGenerated]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
internal sealed class Settings : ApplicationSettingsBase
{
private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());
public static Settings Default => defaultInstance;
}
}
namespace PeakMod
{
internal class Action_PoisonWithTimer : ItemAction
{
public override void RunAction()
{
((Component)((ItemActionBase)this).character).gameObject.GetComponent<LE_EffectHandler>().SC(((ItemActionBase)this).character);
}
}
internal class LE_EffectHandler : MonoBehaviourPun
{
public bool cond = false;
public void SC(Character character)
{
((MonoBehaviour)this).StartCoroutine(Fall(character));
}
public void Start_Cond(CharacterAfflictions chaf)
{
((MonoBehaviour)this).StartCoroutine(Cond(chaf));
}
public IEnumerator Fall(Character character)
{
character.refs.afflictions.AddStatus((STATUSTYPE)3, (float)Math.Abs(1), false);
yield return (object)new WaitForSeconds(6f);
character.refs.afflictions.SubtractStatus((STATUSTYPE)3, (float)Math.Abs(1), false);
}
public IEnumerator Cond(CharacterAfflictions chaf)
{
cond = true;
yield return (object)new WaitForSeconds(15f);
chaf.SubtractStatus(Plugin.cond.Type, Math.Abs(0.05f), false);
cond = false;
chaf.character.refs.afflictions.AddStatus((STATUSTYPE)3, (float)Math.Abs(1), false);
yield return (object)new WaitForSeconds(3f);
chaf.character.refs.afflictions.SubtractStatus((STATUSTYPE)3, (float)Math.Abs(1), false);
}
}
internal class LitEnger : MonoBehaviourPunCallbacks
{
[SerializeField]
private MeshRenderer main;
private void Start()
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
((Renderer)main).material = Plugin.variants[((Component)this).gameObject.GetComponent<Item>().GetData<IntItemData>((DataEntryKey)9).Value];
Action_ModifyStatus val = ((Component)this).gameObject.AddComponent<Action_ModifyStatus>();
((ItemAction)val).OnCastFinished = true;
val.changeAmount = 0f;
Action_GiveExtraStamina val2 = ((Component)this).gameObject.AddComponent<Action_GiveExtraStamina>();
((ItemAction)val2).OnCastFinished = true;
val2.amount = 0f;
switch (Random.Range(1, 6))
{
case 1:
val.statusType = (STATUSTYPE)3;
val.changeAmount = 0.1f;
break;
case 2:
val.statusType = (STATUSTYPE)2;
val.changeAmount = 0.3f;
break;
case 3:
val2.amount = 0.4f;
break;
case 4:
((Component)this).gameObject.AddComponent<Action_PoisonWithTimer>();
((ItemAction)((Component)this).gameObject.GetComponent<Action_PoisonWithTimer>()).OnCastFinished = true;
break;
case 5:
val.statusType = Plugin.cond.Type;
val.changeAmount = 0.05f;
break;
}
}
[PunRPC]
public void randomizeVariant(int r)
{
((Component)this).gameObject.GetComponent<Item>().GetData<IntItemData>((DataEntryKey)9).Value = r;
}
}
[HarmonyPatch(typeof(Character), "Start")]
public class StartPatch
{
public static void Postfix(Character __instance)
{
((Component)__instance).gameObject.AddComponent<LE_EffectHandler>();
}
}
[HarmonyPatch(typeof(Luggage), "OpenLuggageRPC")]
public class LuggagePatch
{
[HarmonyPrefix]
public static void Prefix(Luggage __instance, ref bool spawnItems)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
Plugin.logger.LogInfo((object)"OpenLuggageRPC invoked;");
if ((int)(LuggageState)((object)__instance).GetType().GetField("state", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance) == 0)
{
((Component)__instance).GetComponent<Animator>().Play("Luggage_Open");
Luggage.ALL_LUGGAGE.Remove(__instance);
((object)__instance).GetType().GetField("state", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, (object)(LuggageState)1);
if (spawnItems)
{
((MonoBehaviour)__instance).StartCoroutine(SpawnItemRoutine());
}
}
IEnumerator SpawnItemRoutine()
{
yield return (object)new WaitForSeconds(0.1f);
List<PhotonView> pv = ((Spawner)__instance).SpawnItems((List<Transform>)((object)__instance).GetType().GetMethod("GetSpawnSpots", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, null));
foreach (PhotonView item in pv)
{
if ((Object)(object)((Component)item).GetComponent<LitEnger>() != (Object)null && PhotonNetwork.IsMasterClient)
{
((MonoBehaviourPun)((Component)item).GetComponent<LitEnger>()).photonView.RPC("randomizeVariant", (RpcTarget)0, new object[1] { Random.Range(0, 5) });
Plugin.logger.LogInfo((object)("le spawned in luggage with " + ((Component)item).GetComponent<Item>().GetData<IntItemData>((DataEntryKey)9).Value + " color value;"));
}
}
}
}
}
[HarmonyPatch]
public class LocalizedTextPatches
{
[HarmonyPatch(typeof(LocalizedText), "GetText", new Type[]
{
typeof(string),
typeof(bool)
})]
[HarmonyPrefix]
private static bool GetText_Prefix(string id, ref string __result)
{
string text = id.ToUpperInvariant();
if (id.Contains("ЛИТ"))
{
__result = text.Replace("NAME_", "");
return false;
}
return true;
}
}
[BepInPlugin("EffMapis.LITENGER", "LITENGER", "1.1.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource logger;
public AssetBundle bundle;
public static Sprite cond_ico;
public static Status cond;
public static List<Material> variants = new List<Material>();
private void Awake()
{
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Expected O, but got Unknown
//IL_01b4: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
logger = ((BaseUnityPlugin)this).Logger;
ModDefinition orCreate = ModDefinition.GetOrCreate(((BaseUnityPlugin)this).Info.Metadata);
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "litenger");
bundle = AssetBundle.LoadFromFile(text);
Item component = bundle.LoadAsset<GameObject>("Assets/Mods/LitEnger/Energy Drink.prefab").GetComponent<Item>();
variants.Add(bundle.LoadAsset<Material>("Assets/Mods/LitEnger/M_LitEneger.mat"));
variants.Add(bundle.LoadAsset<Material>("Assets/Mods/LitEnger/M_LitEneger2.mat"));
variants.Add(bundle.LoadAsset<Material>("Assets/Mods/LitEnger/M_LitEneger3.mat"));
variants.Add(bundle.LoadAsset<Material>("Assets/Mods/LitEnger/M_LitEneger4.mat"));
variants.Add(bundle.LoadAsset<Material>("Assets/Mods/LitEnger/M_LitEneger5.mat"));
foreach (Material variant in variants)
{
variant.shader = Shader.Find("W/Peak_Standard");
}
new ItemContent(component).Register(orCreate);
cond_ico = bundle.LoadAsset<Sprite>("Assets/Mods/LitEnger/cond.asset");
cond = new Status
{
Name = "Кондиции",
Color = Color.blue,
MaxAmount = 0.05f,
ReductionPerSecond = 0.025f,
ReductionCooldown = 15f,
Icon = cond_ico,
AllowClear = false,
Update = new UpdateStatusHandler(UpdateStatusHandler)
};
new StatusContent(cond).Register(orCreate);
new Harmony("EffMapis.LITENGER").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded.");
}
private void UpdateStatusHandler(CharacterAfflictions chaf, Status status)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
LE_EffectHandler component = ((Component)chaf.character).gameObject.GetComponent<LE_EffectHandler>();
if (chaf.GetCurrentStatus(cond.Type) != 0f)
{
if (!component.cond)
{
component.Start_Cond(chaf);
return;
}
chaf.character.refs.movement.jumpGravity = 60f;
chaf.character.refs.movement.sprintStaminaUsage = 0f;
chaf.character.refs.climbing.maxStaminaUsage = 0.015f;
chaf.character.refs.climbing.minStaminaUsage = 0.015f;
chaf.character.refs.climbing.climbSpeedMod = 2.5f;
}
else
{
chaf.character.refs.movement.jumpGravity = 15f;
chaf.character.refs.movement.sprintStaminaUsage = 0.05f;
chaf.character.refs.climbing.maxStaminaUsage = 0.1f;
chaf.character.refs.climbing.minStaminaUsage = 0.02f;
chaf.character.refs.climbing.climbSpeedMod = 1f;
}
}
}
}