using System;
using System.Collections;
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.RegularExpressions;
using BepInEx;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MichPerksSystem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MichPerksSystem")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f47ea826-6616-4160-9d0e-37f4b2284353")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MichPerks;
[BepInPlugin("com.Mich.PerksSystem", "Mich Perk System v40 Ownership", "40.0.0")]
public class PerkSystemPlugin : BaseUnityPlugin
{
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mich Perk System v40: OWNERSHIP TAKEOVER ACTIVADO.");
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
R_PerkGhost.ResetStatics();
R_PerkGhost[] array = Object.FindObjectsOfType<R_PerkGhost>();
foreach (R_PerkGhost r_PerkGhost in array)
{
Object.Destroy((Object)(object)((Component)r_PerkGhost).gameObject);
}
}
}
public class R_VendingMachine : MonoBehaviourPun
{
[Header("--- CONFIGURACIÓN VENDING ---")]
public GameObject lataPrefab;
public Transform puntoDeSpawn;
public AudioClip sonidoComprar;
public AudioClip sonidoError;
private AudioSource _audio;
private bool _yaUsada = false;
private bool _procesando = false;
private void Awake()
{
_audio = ((Component)this).GetComponent<AudioSource>();
if (!Object.op_Implicit((Object)(object)_audio))
{
_audio = ((Component)this).gameObject.AddComponent<AudioSource>();
}
_audio.spatialBlend = 1f;
}
public void ComprarSoda()
{
if (_yaUsada || _procesando)
{
if (Object.op_Implicit((Object)(object)sonidoError))
{
_audio.PlayOneShot(sonidoError);
}
return;
}
_procesando = true;
if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom)
{
if (PhotonNetwork.IsMasterClient)
{
int num = PhotonNetwork.AllocateViewID(0);
((MonoBehaviourPun)this).photonView.RPC("SpawnSodaManualRPC", (RpcTarget)3, new object[1] { num });
}
else
{
((MonoBehaviourPun)this).photonView.RPC("SolicitarCompraRPC", (RpcTarget)2, Array.Empty<object>());
}
}
else
{
SpawnSodaLocal(-1);
_yaUsada = true;
_procesando = false;
}
}
[PunRPC]
public void SolicitarCompraRPC()
{
if (PhotonNetwork.IsMasterClient && !_yaUsada)
{
int num = PhotonNetwork.AllocateViewID(0);
((MonoBehaviourPun)this).photonView.RPC("SpawnSodaManualRPC", (RpcTarget)3, new object[1] { num });
}
}
[PunRPC]
public void SpawnSodaManualRPC(int viewID)
{
if (!_yaUsada)
{
SpawnSodaLocal(viewID);
_yaUsada = true;
_procesando = false;
}
}
private void SpawnSodaLocal(int photonID)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)lataPrefab) || !Object.op_Implicit((Object)(object)puntoDeSpawn))
{
return;
}
GameObject val = Object.Instantiate<GameObject>(lataPrefab, puntoDeSpawn.position, puntoDeSpawn.rotation);
if (photonID != -1)
{
PhotonView component = val.GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.ViewID = photonID;
PhotonNetwork.RegisterPhotonView(component);
component.OwnershipTransfer = (OwnershipOption)1;
}
}
else
{
PhotonView component2 = val.GetComponent<PhotonView>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
}
}
val.SetActive(true);
if (Object.op_Implicit((Object)(object)sonidoComprar))
{
_audio.PlayOneShot(sonidoComprar);
}
}
}
public enum SodaType
{
SpeedCola,
Juggernog,
DoubleTap,
QuickRevive
}
public class R_PerkSoda : MonoBehaviourPun, IPunOwnershipCallbacks
{
[CompilerGenerated]
private sealed class <RutinaBeber>d__24 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public R_PerkSoda <>4__this;
private Rigidbody <rb>5__1;
private Camera <mainCam>5__2;
private Vector3 <startPos>5__3;
private Quaternion <startRot>5__4;
private Quaternion <finalRot>5__5;
private float <timer>5__6;
private GameObject <fantasma>5__7;
private R_PerkGhost <scriptFantasma>5__8;
private Collider[] <>s__9;
private int <>s__10;
private Collider <c>5__11;
private float <p>5__12;
private float <smooth>5__13;
private Renderer[] <>s__14;
private int <>s__15;
private Renderer <r>5__16;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RutinaBeber>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<rb>5__1 = null;
<mainCam>5__2 = null;
<fantasma>5__7 = null;
<scriptFantasma>5__8 = null;
<>s__9 = null;
<c>5__11 = null;
<>s__14 = null;
<r>5__16 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Expected O, but got Unknown
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Expected O, but got Unknown
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this._bebiendo = true;
<rb>5__1 = ((Component)<>4__this).GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)<rb>5__1))
{
<rb>5__1.isKinematic = true;
<rb>5__1.velocity = Vector3.zero;
}
<>s__9 = ((Component)<>4__this).GetComponentsInChildren<Collider>();
for (<>s__10 = 0; <>s__10 < <>s__9.Length; <>s__10++)
{
<c>5__11 = <>s__9[<>s__10];
<c>5__11.enabled = false;
<c>5__11 = null;
}
<>s__9 = null;
<mainCam>5__2 = Camera.main;
if ((Object)(object)<mainCam>5__2 != (Object)null)
{
((Component)<>4__this).transform.SetParent(((Component)<mainCam>5__2).transform);
}
if (Object.op_Implicit((Object)(object)<>4__this.sonidoBeber) && Object.op_Implicit((Object)(object)<mainCam>5__2))
{
AudioSource.PlayClipAtPoint(<>4__this.sonidoBeber, ((Component)<mainCam>5__2).transform.position);
}
<startPos>5__3 = ((Component)<>4__this).transform.localPosition;
<startRot>5__4 = ((Component)<>4__this).transform.localRotation;
<finalRot>5__5 = Quaternion.Euler(<>4__this.rotacionBoca);
<timer>5__6 = 0f;
goto IL_0270;
case 1:
<>1__state = -1;
goto IL_0270;
case 2:
{
<>1__state = -1;
if (PhotonNetwork.IsConnected && ((MonoBehaviourPun)<>4__this).photonView.IsMine)
{
PhotonNetwork.Destroy(((Component)<>4__this).gameObject);
}
else
{
Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
}
return false;
}
IL_0270:
if (<timer>5__6 < <>4__this.tiempoBeber)
{
<p>5__12 = <timer>5__6 / <>4__this.tiempoBeber;
<smooth>5__13 = <p>5__12 * <p>5__12 * (3f - 2f * <p>5__12);
((Component)<>4__this).transform.localPosition = Vector3.Lerp(<startPos>5__3, <>4__this.posicionBoca, <smooth>5__13);
((Component)<>4__this).transform.localRotation = Quaternion.Lerp(<startRot>5__4, <finalRot>5__5, <smooth>5__13);
<timer>5__6 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<fantasma>5__7 = new GameObject($"GHOST_{<>4__this.tipoDeSoda}_{Time.time}");
<scriptFantasma>5__8 = <fantasma>5__7.AddComponent<R_PerkGhost>();
<scriptFantasma>5__8.Setup(<>4__this);
<scriptFantasma>5__8.Activar();
<>s__14 = ((Component)<>4__this).GetComponentsInChildren<Renderer>();
for (<>s__15 = 0; <>s__15 < <>s__14.Length; <>s__15++)
{
<r>5__16 = <>s__14[<>s__15];
<r>5__16.enabled = false;
<r>5__16 = null;
}
<>s__14 = null;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[Header("--- DATOS ---")]
public SodaType tipoDeSoda;
public Texture2D iconoPerk;
public float duracionEfecto = 30f;
public float tiempoBeber = 1.3f;
public Vector3 posicionBoca = new Vector3(0f, -0.2f, 0.4f);
public Vector3 rotacionBoca = new Vector3(-45f, 0f, 0f);
[Header("--- EFECTOS ---")]
public float speedMultiplier = 1.5f;
public bool energiaInfinita = true;
public int vidaModoTanque = 500;
public float fuerzaExtra = 50f;
public float rangoExtra = 5f;
public int vidaBuffer = 5000;
public bool ocultarVidaExtraEnHUD = true;
[Header("--- AUDIO ---")]
public AudioClip sonidoBeber;
public AudioClip sonidoEructo;
public AudioClip sonidoSalvacion;
private bool _bebiendo = false;
private bool _peticionBeberEnProceso = false;
private void Awake()
{
PhotonNetwork.AddCallbackTarget((object)this);
}
private void OnDestroy()
{
PhotonNetwork.RemoveCallbackTarget((object)this);
}
public void DrinkMe()
{
if (!_bebiendo && !_peticionBeberEnProceso)
{
if (!PhotonNetwork.IsConnected || ((MonoBehaviourPun)this).photonView.IsMine)
{
((MonoBehaviour)this).StartCoroutine(RutinaBeber());
return;
}
Debug.Log((object)"[MOD] Solicitando propiedad de la lata para beber...");
_peticionBeberEnProceso = true;
((MonoBehaviourPun)this).photonView.RequestOwnership();
}
}
public void OnOwnershipRequest(PhotonView targetView, Player requestingPlayer)
{
}
public void OnOwnershipTransfered(PhotonView targetView, Player previousOwner)
{
if ((Object)(object)targetView == (Object)(object)((MonoBehaviourPun)this).photonView && targetView.IsMine && _peticionBeberEnProceso)
{
Debug.Log((object)"[MOD] ¡Propiedad obtenida! Bebiendo ahora.");
_peticionBeberEnProceso = false;
((MonoBehaviour)this).StartCoroutine(RutinaBeber());
}
}
public void OnOwnershipTransferFailed(PhotonView targetView, Player senderOfFailedRequest)
{
_peticionBeberEnProceso = false;
}
[IteratorStateMachine(typeof(<RutinaBeber>d__24))]
private IEnumerator RutinaBeber()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RutinaBeber>d__24(0)
{
<>4__this = this
};
}
}
public class R_PerkGhost : MonoBehaviour
{
[CompilerGenerated]
private sealed class <RutinaEfecto>d__27 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public R_PerkGhost <>4__this;
private PlayerController <pc>5__1;
private PlayerHealth <hp>5__2;
private MonoBehaviour <grabber>5__3;
private MonoBehaviour[] <>s__4;
private int <>s__5;
private MonoBehaviour <s>5__6;
private PhotonView <pv>5__7;
private PlayerHealth <hp>5__8;
private int <total>5__9;
private bool <salvado>5__10;
private int <actual>5__11;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RutinaEfecto>d__27(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<pc>5__1 = null;
<hp>5__2 = null;
<grabber>5__3 = null;
<>s__4 = null;
<s>5__6 = null;
<pv>5__7 = null;
<hp>5__8 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Expected O, but got Unknown
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Expected O, but got Unknown
//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
//IL_07ee: Expected O, but got Unknown
//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
//IL_07cb: Expected O, but got Unknown
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (Object.op_Implicit((Object)(object)Camera.main) && Object.op_Implicit((Object)(object)<>4__this.sEructo))
{
AudioSource.PlayClipAtPoint(<>4__this.sEructo, ((Component)Camera.main).transform.position);
}
if (<>4__this.tipo == SodaType.SpeedCola)
{
<pc>5__1 = <>4__this.GetMyPlayerController();
if (Object.op_Implicit((Object)(object)<pc>5__1))
{
if (speedStack == 0)
{
originalSpeed = <pc>5__1.SprintSpeed;
originalDrain = <pc>5__1.EnergySprintDrain;
}
speedStack++;
<pc>5__1.SprintSpeed = originalSpeed * <>4__this.v1;
if (<>4__this.vBool)
{
<pc>5__1.EnergySprintDrain = 0f;
}
<>2__current = (object)new WaitForSeconds(<>4__this.duracion);
<>1__state = 1;
return true;
}
goto IL_01f5;
}
if (<>4__this.tipo == SodaType.Juggernog)
{
<hp>5__2 = <>4__this.GetMyPlayerHealth();
if (Object.op_Implicit((Object)(object)<hp>5__2))
{
if (juggStack == 0)
{
originalMaxHP = <>4__this.GetField<int>(<hp>5__2, "maxHealth");
}
juggStack++;
<>4__this.SetField(<hp>5__2, "maxHealth", <>4__this.vInt);
if (<>4__this.GetField<int>(<hp>5__2, "health") < <>4__this.vInt)
{
<>4__this.SetField(<hp>5__2, "health", <>4__this.vInt);
}
<>2__current = (object)new WaitForSeconds(<>4__this.duracion);
<>1__state = 2;
return true;
}
goto IL_03b7;
}
if (<>4__this.tipo == SodaType.DoubleTap)
{
<grabber>5__3 = null;
<>s__4 = Object.FindObjectsOfType<MonoBehaviour>();
for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
{
<s>5__6 = <>s__4[<>s__5];
if (((object)<s>5__6).GetType().Name.Contains("PhysGrabber"))
{
<pv>5__7 = ((Component)<s>5__6).GetComponent<PhotonView>();
if (!PhotonNetwork.IsConnected)
{
<grabber>5__3 = <s>5__6;
break;
}
if ((Object)(object)<pv>5__7 != (Object)null && <pv>5__7.IsMine)
{
<grabber>5__3 = <s>5__6;
break;
}
<pv>5__7 = null;
}
<s>5__6 = null;
}
<>s__4 = null;
if (Object.op_Implicit((Object)(object)<grabber>5__3))
{
if (tapStack == 0)
{
originalStr = <>4__this.GetField<float>(<grabber>5__3, "grabStrength");
originalRange = <>4__this.GetField<float>(<grabber>5__3, "grabRange");
}
tapStack++;
<>4__this.SetField(<grabber>5__3, "grabStrength", originalStr + <>4__this.v1);
<>4__this.SetField(<grabber>5__3, "grabRange", originalRange + <>4__this.v2);
<>2__current = (object)new WaitForSeconds(<>4__this.duracion);
<>1__state = 3;
return true;
}
goto IL_0658;
}
if (<>4__this.tipo != SodaType.QuickRevive)
{
break;
}
<hp>5__8 = <>4__this.GetMyPlayerHealth();
if (Object.op_Implicit((Object)(object)<hp>5__8))
{
<>4__this.vidaOriginalLocal = <>4__this.GetField<int>(<hp>5__8, "maxHealth");
<total>5__9 = <>4__this.vidaOriginalLocal + <>4__this.vInt;
<>4__this.SetField(<hp>5__8, "maxHealth", <total>5__9);
<>4__this.SetField(<hp>5__8, "health", <total>5__9);
<salvado>5__10 = false;
goto IL_081e;
}
goto IL_08a0;
case 1:
<>1__state = -1;
speedStack--;
if (speedStack <= 0)
{
speedStack = 0;
if (originalSpeed != -1f)
{
<pc>5__1.SprintSpeed = originalSpeed;
}
if (originalDrain != -1f)
{
<pc>5__1.EnergySprintDrain = originalDrain;
}
originalSpeed = -1f;
originalDrain = -1f;
}
goto IL_01f5;
case 2:
<>1__state = -1;
juggStack--;
if (juggStack <= 0)
{
juggStack = 0;
if (originalMaxHP != -1)
{
<>4__this.SetField(<hp>5__2, "maxHealth", originalMaxHP);
}
if (<>4__this.GetField<int>(<hp>5__2, "health") > originalMaxHP)
{
<>4__this.SetField(<hp>5__2, "health", originalMaxHP);
}
originalMaxHP = -1;
}
goto IL_03b7;
case 3:
<>1__state = -1;
tapStack--;
if (tapStack <= 0)
{
tapStack = 0;
if (originalStr != -1f)
{
<>4__this.SetField(<grabber>5__3, "grabStrength", originalStr);
}
if (originalRange != -1f)
{
<>4__this.SetField(<grabber>5__3, "grabRange", originalRange);
}
originalStr = -1f;
originalRange = -1f;
}
goto IL_0658;
case 4:
<>1__state = -1;
goto IL_07fe;
case 5:
<>1__state = -1;
goto IL_07fe;
case 6:
{
<>1__state = -1;
goto IL_081e;
}
IL_07fe:
<salvado>5__10 = true;
goto IL_0806;
IL_08a0:
<hp>5__8 = null;
break;
IL_0806:
<>2__current = null;
<>1__state = 6;
return true;
IL_03b7:
<hp>5__2 = null;
break;
IL_081e:
if (!<salvado>5__10 && (Object)(object)<hp>5__8 != (Object)null)
{
<actual>5__11 = <>4__this.GetField<int>(<hp>5__8, "health");
if (<total>5__9 - <actual>5__11 >= <>4__this.vidaOriginalLocal)
{
if (Object.op_Implicit((Object)(object)<>4__this.sSalvacion) && Object.op_Implicit((Object)(object)Camera.main))
{
AudioSource.PlayClipAtPoint(<>4__this.sSalvacion, ((Component)Camera.main).transform.position);
<>2__current = (object)new WaitForSeconds(2f);
<>1__state = 4;
return true;
}
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 5;
return true;
}
goto IL_0806;
}
if (Object.op_Implicit((Object)(object)<hp>5__8))
{
<>4__this.SetField(<hp>5__8, "maxHealth", <>4__this.vidaOriginalLocal);
<>4__this.SetField(<hp>5__8, "health", <>4__this.vidaOriginalLocal);
}
goto IL_08a0;
IL_0658:
<grabber>5__3 = null;
break;
IL_01f5:
<pc>5__1 = null;
break;
}
<>4__this.iconoActivo = false;
Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static int speedStack = 0;
private static float originalSpeed = -1f;
private static float originalDrain = -1f;
private static int juggStack = 0;
private static int originalMaxHP = -1;
private static int tapStack = 0;
private static float originalStr = -1f;
private static float originalRange = -1f;
public SodaType tipo;
public Texture2D icono;
public float duracion;
public float v1;
public float v2;
public int vInt;
public bool vBool;
public AudioClip sEructo;
public AudioClip sSalvacion;
private bool iconoActivo = true;
private int vidaOriginalLocal = 100;
public static void ResetStatics()
{
speedStack = 0;
originalSpeed = -1f;
originalDrain = -1f;
juggStack = 0;
originalMaxHP = -1;
tapStack = 0;
originalStr = -1f;
originalRange = -1f;
}
public void Setup(R_PerkSoda origen)
{
tipo = origen.tipoDeSoda;
icono = origen.iconoPerk;
duracion = origen.duracionEfecto;
sEructo = origen.sonidoEructo;
sSalvacion = origen.sonidoSalvacion;
if (tipo == SodaType.SpeedCola)
{
v1 = origen.speedMultiplier;
vBool = origen.energiaInfinita;
}
if (tipo == SodaType.Juggernog)
{
vInt = origen.vidaModoTanque;
}
if (tipo == SodaType.DoubleTap)
{
v1 = origen.fuerzaExtra;
v2 = origen.rangoExtra;
}
if (tipo == SodaType.QuickRevive)
{
vInt = origen.vidaBuffer;
}
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
public void Activar()
{
((MonoBehaviour)this).StartCoroutine(RutinaEfecto());
}
private void OnGUI()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (iconoActivo && (Object)(object)icono != (Object)null)
{
int num = (int)tipo;
float num2 = 20f + (float)num * 74f;
GUI.DrawTexture(new Rect(num2, (float)Screen.height - 84f, 64f, 64f), (Texture)(object)icono);
}
}
private void LateUpdate()
{
if (tipo != SodaType.QuickRevive || !iconoActivo)
{
return;
}
MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>();
foreach (MonoBehaviour val in array)
{
if (!((Object)(object)val == (Object)null))
{
string name = ((object)val).GetType().Name;
if (name.Contains("Text") || name.Contains("TMP"))
{
FixUI(val);
}
}
}
}
private void FixUI(object txt)
{
try
{
PropertyInfo property = txt.GetType().GetProperty("text");
if (property == null)
{
return;
}
string text = (string)property.GetValue(txt, null);
string text2 = text;
int num = vidaOriginalLocal + vInt;
if (text.Contains(num.ToString()))
{
text = text.Replace(num.ToString(), vidaOriginalLocal.ToString());
}
MatchCollection matchCollection = Regex.Matches(text, "\\d+");
foreach (Match item in matchCollection)
{
if (int.TryParse(item.Value, out var result) && result > vidaOriginalLocal + vInt / 2 && result <= num)
{
int num2 = result - vInt;
if (num2 < 0)
{
num2 = 0;
}
text = new Regex("\\b" + item.Value + "\\b").Replace(text, num2.ToString(), 1);
}
}
if (text2 != text)
{
property.SetValue(txt, text, null);
}
}
catch
{
}
}
private PlayerController GetMyPlayerController()
{
PlayerController[] array = Object.FindObjectsOfType<PlayerController>();
foreach (PlayerController val in array)
{
PhotonView component = ((Component)val).GetComponent<PhotonView>();
if (PhotonNetwork.IsConnected)
{
if ((Object)(object)component != (Object)null && component.IsMine)
{
return val;
}
continue;
}
return val;
}
return null;
}
private PlayerHealth GetMyPlayerHealth()
{
PlayerHealth[] array = Object.FindObjectsOfType<PlayerHealth>();
foreach (PlayerHealth val in array)
{
PhotonView component = ((Component)val).GetComponent<PhotonView>();
if (PhotonNetwork.IsConnected)
{
if ((Object)(object)component != (Object)null && component.IsMine)
{
return val;
}
continue;
}
return val;
}
return null;
}
[IteratorStateMachine(typeof(<RutinaEfecto>d__27))]
private IEnumerator RutinaEfecto()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RutinaEfecto>d__27(0)
{
<>4__this = this
};
}
private void SetField(object t, string n, object v)
{
FieldInfo field = t.GetType().GetField(n, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(t, v);
}
}
private T GetField<T>(object t, string n)
{
FieldInfo field = t.GetType().GetField(n, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return (field != null) ? ((T)field.GetValue(t)) : default(T);
}
}