using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Empress_ShopLoaderAPI;
using ExitGames.Client.Photon;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7caf00520587bc4705fdf22c05a4ce546279ff19")]
[assembly: AssemblyProduct("EmpressCustomShop3")]
[assembly: AssemblyTitle("EmpressCustomShop3")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CustomWizardMod
{
[BepInPlugin("com.Omniscye.TriWizardCup", "TriWizard Cup", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class TriWizardPlugin : BaseUnityPlugin
{
private void Awake()
{
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "shop3"));
if ((Object)(object)val != (Object)null)
{
GameObject val2 = val.LoadAsset<GameObject>("Module - Shop - N - Omni3");
if ((Object)(object)val2 != (Object)null)
{
ShopAPI.RegisterShop(val2, "Omniscye/TriWizardCup");
((BaseUnityPlugin)this).Logger.LogInfo((object)"TriWizard Cup registered successfully via Empress ShopAPI.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"TriWizard Cup: Prefab 'Module - Shop - N - Omni3' not found in bundle!");
}
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"TriWizard Cup: Failed to load AssetBundle 'shop3'!");
}
}
}
public class TriWizardCupScript : MonoBehaviour, IOnEventCallback
{
public Transform itemSpawnPoint;
public float interactionDistance = 3f;
public AudioClip soundBindSoul;
public float floatHeight = 1.5f;
public float spinSpeed = 360f;
public float shakeAmount = 0.1f;
private bool _isBound;
private bool _localInteracting;
private bool _confirming;
private GameObject _p;
private Text _t;
private AudioSource _a;
private const byte CupEventCode = 143;
private List<Item> _potentialItems = new List<Item>();
private void OnEnable()
{
PhotonNetwork.AddCallbackTarget((object)this);
}
private void OnDisable()
{
PhotonNetwork.RemoveCallbackTarget((object)this);
}
private void Start()
{
_a = ((Component)this).gameObject.AddComponent<AudioSource>();
_a.spatialBlend = 1f;
_a.minDistance = 1f;
_a.maxDistance = 15f;
SetupUI();
LoadPotentialItems();
}
private void LoadPotentialItems()
{
try
{
_potentialItems.Clear();
if (!((Object)(object)StatsManager.instance != (Object)null))
{
return;
}
foreach (Item value in StatsManager.instance.itemDictionary.Values)
{
if (!value.disabled && value.physicalItem && !((Object)value).name.Contains("Upgrade"))
{
_potentialItems.Add(value);
}
}
}
catch
{
}
}
private void Update()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
if (_isBound || !Object.op_Implicit((Object)(object)PlayerAvatar.instance))
{
if (Object.op_Implicit((Object)(object)_p) && _p.activeSelf)
{
_p.SetActive(false);
}
}
else if (Vector3.Distance(((Component)this).transform.position, ((Component)PlayerAvatar.instance).transform.position) <= interactionDistance)
{
if (!_localInteracting)
{
if (InputManager.instance.KeyDown((InputKey)2) || Input.GetKeyDown((KeyCode)101))
{
StartInteraction();
}
}
else
{
UpdateInput();
}
}
else if (_localInteracting)
{
CancelInteraction();
}
}
private void StartInteraction()
{
_localInteracting = true;
_confirming = false;
if (Object.op_Implicit((Object)(object)_p))
{
_p.SetActive(true);
}
UpdateUIText();
}
private void CancelInteraction()
{
_localInteracting = false;
_confirming = false;
if (Object.op_Implicit((Object)(object)_p))
{
_p.SetActive(false);
}
}
private void UpdateInput()
{
if (!_confirming)
{
if (Input.GetKeyDown((KeyCode)101) || Input.GetKeyDown((KeyCode)13) || InputManager.instance.KeyDown((InputKey)2))
{
_confirming = true;
UpdateUIText();
}
else if (Input.GetKeyDown((KeyCode)27) || InputManager.instance.KeyDown((InputKey)6))
{
CancelInteraction();
}
}
else if (Input.GetKeyDown((KeyCode)101) || Input.GetKeyDown((KeyCode)13) || InputManager.instance.KeyDown((InputKey)2))
{
TriggerBindSoul();
}
else if (Input.GetKeyDown((KeyCode)27) || InputManager.instance.KeyDown((InputKey)6))
{
CancelInteraction();
}
}
private void UpdateUIText()
{
if (Object.op_Implicit((Object)(object)_t))
{
if (!_confirming)
{
_t.text = "Do you want to bind your soul to the cup?\n\n[E] Next [Esc] Leave";
}
else
{
_t.text = "<color=red>WARNING: BINDING SOUL CANNOT BE UNDONE.</color>\n\nAre you sure?\n[E] YES [Esc] NO";
}
}
}
private void TriggerBindSoul()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!_isBound)
{
if (PhotonNetwork.InRoom)
{
object[] array = new object[0];
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)143, (object)array, val, SendOptions.SendReliable);
}
else
{
_isBound = true;
((MonoBehaviour)this).StartCoroutine(AnimationSequence());
}
CancelInteraction();
}
}
catch
{
}
}
public void OnEvent(EventData photonEvent)
{
try
{
if (photonEvent.Code == 143 && !_isBound)
{
_isBound = true;
((MonoBehaviour)this).StartCoroutine(AnimationSequence());
}
}
catch
{
}
}
private IEnumerator AnimationSequence()
{
if (Object.op_Implicit((Object)(object)soundBindSoul))
{
_a.PlayOneShot(soundBindSoul);
}
float duration = 3f;
float elapsed = 0f;
Vector3 startPos = ((Component)this).transform.position;
Vector3 targetPos = startPos + Vector3.up * floatHeight;
while (elapsed < duration)
{
float num = elapsed / duration;
((Component)this).transform.position = Vector3.Lerp(startPos, targetPos, num) + Random.insideUnitSphere * shakeAmount * num;
((Component)this).transform.Rotate(Vector3.up, spinSpeed * Time.deltaTime * (1f + num * 2f));
elapsed += Time.deltaTime;
yield return null;
}
if (PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom)
{
((MonoBehaviour)this).StartCoroutine(SpawnItemsRoutine());
yield break;
}
float maxWait = 15f;
float timer = 0f;
while (timer < maxWait)
{
timer += Time.deltaTime;
((Component)this).transform.position = targetPos + Random.insideUnitSphere * shakeAmount;
((Component)this).transform.Rotate(Vector3.up, spinSpeed * Time.deltaTime * 3f);
yield return null;
}
((Component)this).gameObject.SetActive(false);
}
private IEnumerator SpawnItemsRoutine()
{
int count = Random.Range(1, 6);
if (_potentialItems.Count == 0)
{
LoadPotentialItems();
}
for (int i = 0; i < count; i++)
{
if (_potentialItems.Count > 0)
{
Item item = _potentialItems[Random.Range(0, _potentialItems.Count)];
SpawnSingleItem(item);
}
if (count > 1)
{
float waitTime = 2f;
float t = 0f;
while (t < waitTime)
{
t += Time.deltaTime;
((Component)this).transform.Rotate(Vector3.up, spinSpeed * Time.deltaTime * 3f);
((Component)this).transform.position = ((Component)this).transform.position - Random.insideUnitSphere * shakeAmount + Random.insideUnitSphere * shakeAmount;
yield return null;
}
}
}
if (PhotonNetwork.InRoom)
{
PhotonNetwork.Destroy(((Component)this).GetComponent<PhotonView>());
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
if (Object.op_Implicit((Object)(object)((Component)this).gameObject))
{
((Component)this).gameObject.SetActive(false);
}
}
private void SpawnSingleItem(Item item)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
try
{
Vector3 val = (Object.op_Implicit((Object)(object)itemSpawnPoint) ? itemSpawnPoint.position : (((Component)this).transform.position + Vector3.up));
Quaternion rotation = Random.rotation;
GameObject val2 = null;
if (PhotonNetwork.InRoom)
{
val2 = PhotonNetwork.InstantiateRoomObject(item.prefab.ResourcePath, val, rotation, (byte)0, (object[])null);
}
else
{
GameObject val3 = Resources.Load<GameObject>(item.prefab.ResourcePath);
if (Object.op_Implicit((Object)(object)val3))
{
val2 = Object.Instantiate<GameObject>(val3, val, rotation);
}
}
if (Object.op_Implicit((Object)(object)val2))
{
Rigidbody component = val2.GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)component))
{
Vector3 val4 = Vector3.up * 1.5f + Random.onUnitSphere;
Vector3 normalized = ((Vector3)(ref val4)).normalized;
normalized.y = Mathf.Abs(normalized.y);
component.AddForce(normalized * 8f, (ForceMode)1);
component.AddTorque(Random.insideUnitSphere * 10f, (ForceMode)1);
}
}
}
catch
{
}
}
private void SetupUI()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
Transform val = (Object.op_Implicit((Object)(object)HUDCanvas.instance) ? ((Component)HUDCanvas.instance).transform : null);
if (!Object.op_Implicit((Object)(object)val))
{
GameObject val2 = new GameObject("TriWizardCanvas");
Canvas obj = val2.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 999;
val2.AddComponent<CanvasScaler>();
val2.AddComponent<GraphicRaycaster>();
val = val2.transform;
}
_p = new GameObject("CupPanel");
_p.transform.SetParent(val, false);
((Graphic)_p.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
RectTransform component = _p.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.2f, 0.3f);
component.anchorMax = new Vector2(0.8f, 0.7f);
Vector2 offsetMin = (component.offsetMax = Vector2.zero);
component.offsetMin = offsetMin;
GameObject val3 = new GameObject("CupText");
val3.transform.SetParent(_p.transform, false);
_t = val3.AddComponent<Text>();
Font font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font x) => ((Object)x).name == "Arial")) ?? Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault() ?? Font.CreateDynamicFontFromOSFont("Arial", 16);
_t.font = font;
((Graphic)_t).color = Color.white;
_t.alignment = (TextAnchor)4;
_t.resizeTextForBestFit = true;
_t.resizeTextMinSize = 14;
_t.resizeTextMaxSize = 30;
_t.verticalOverflow = (VerticalWrapMode)1;
RectTransform component2 = val3.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.offsetMin = new Vector2(10f, 10f);
component2.offsetMax = new Vector2(-10f, -10f);
_p.SetActive(false);
}
private void OnDestroy()
{
if (Object.op_Implicit((Object)(object)_p))
{
Object.Destroy((Object)(object)_p);
}
}
}
public class DobyScript : MonoBehaviour, IOnEventCallback
{
public Animator animator;
public float interactionDistance = 3f;
public AudioClip magicSound;
public float magicDelay = 2.4f;
public List<Rigidbody> furnitureObjects = new List<Rigidbody>();
public List<GameObject> objectsToActivate = new List<GameObject>();
public float furnitureLiftHeight = 2f;
public float furnitureThrowForce = 15f;
private bool _isInteracting;
private bool _magicActive;
private GameObject _p;
private Text _t;
private AudioSource _a;
private const byte DobyEventCode = 144;
private List<Item> _potentialItems = new List<Item>();
private void OnEnable()
{
PhotonNetwork.AddCallbackTarget((object)this);
}
private void OnDisable()
{
PhotonNetwork.RemoveCallbackTarget((object)this);
}
private void Start()
{
_a = ((Component)this).gameObject.AddComponent<AudioSource>();
_a.spatialBlend = 1f;
_a.minDistance = 2f;
_a.maxDistance = 20f;
SetupUI();
LoadPotentialItems();
}
private void LoadPotentialItems()
{
try
{
_potentialItems.Clear();
if (!((Object)(object)StatsManager.instance != (Object)null))
{
return;
}
foreach (Item value in StatsManager.instance.itemDictionary.Values)
{
if (!value.disabled && value.physicalItem && !((Object)value).name.Contains("Upgrade"))
{
_potentialItems.Add(value);
}
}
}
catch
{
}
}
private void Update()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
if (_magicActive || !Object.op_Implicit((Object)(object)PlayerAvatar.instance))
{
if (Object.op_Implicit((Object)(object)_p) && _p.activeSelf)
{
_p.SetActive(false);
}
}
else if (Vector3.Distance(((Component)this).transform.position, ((Component)PlayerAvatar.instance).transform.position) <= interactionDistance)
{
if (!_isInteracting)
{
if (InputManager.instance.KeyDown((InputKey)2) || Input.GetKeyDown((KeyCode)101))
{
StartInteraction();
}
return;
}
UpdateInput();
Vector3 val = ((Component)PlayerAvatar.instance).transform.position - ((Component)this).transform.position;
val.y = 0f;
if (val != Vector3.zero)
{
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(val), Time.deltaTime * 5f);
}
}
else if (_isInteracting)
{
CancelInteraction();
}
}
private void StartInteraction()
{
_isInteracting = true;
if (Object.op_Implicit((Object)(object)_p))
{
_p.SetActive(true);
}
if (Object.op_Implicit((Object)(object)_t))
{
_t.text = "Will you give Doby a sock to set him free?\n\n[Y] Yes [N] No";
}
}
private void CancelInteraction()
{
_isInteracting = false;
if (Object.op_Implicit((Object)(object)_p))
{
_p.SetActive(false);
}
}
private void UpdateInput()
{
if (Input.GetKeyDown((KeyCode)110))
{
TriggerMagic(giveSock: false);
}
else if (Input.GetKeyDown((KeyCode)121))
{
TriggerMagic(giveSock: true);
}
else if (Input.GetKeyDown((KeyCode)27) || InputManager.instance.KeyDown((InputKey)6))
{
CancelInteraction();
}
}
private void TriggerMagic(bool giveSock)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!_magicActive)
{
if (PhotonNetwork.InRoom)
{
object[] array = new object[1] { giveSock };
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)144, (object)array, val, SendOptions.SendReliable);
}
else
{
_magicActive = true;
((MonoBehaviour)this).StartCoroutine(MagicRoutine(giveSock));
}
CancelInteraction();
}
}
catch
{
}
}
public void OnEvent(EventData photonEvent)
{
try
{
if (photonEvent.Code != 144 || _magicActive)
{
return;
}
_magicActive = true;
bool giveSock = false;
if (photonEvent.CustomData != null)
{
object[] array = (object[])photonEvent.CustomData;
if (array.Length != 0)
{
giveSock = (bool)array[0];
}
}
((MonoBehaviour)this).StartCoroutine(MagicRoutine(giveSock));
}
catch
{
}
}
private IEnumerator MagicRoutine(bool giveSock)
{
if (Object.op_Implicit((Object)(object)animator))
{
animator.SetBool("magic", true);
}
if (Object.op_Implicit((Object)(object)magicSound))
{
_a.PlayOneShot(magicSound);
}
foreach (GameObject item2 in objectsToActivate)
{
if (Object.op_Implicit((Object)(object)item2))
{
item2.SetActive(true);
}
}
yield return (object)new WaitForSeconds(magicDelay);
if (giveSock)
{
int num = Random.Range(1, 4);
if (_potentialItems.Count == 0)
{
LoadPotentialItems();
}
if (_potentialItems.Count > 0)
{
for (int i = 0; i < num; i++)
{
Item item = _potentialItems[Random.Range(0, _potentialItems.Count)];
SpawnSingleItem(item);
}
}
}
else
{
foreach (Rigidbody furnitureObject in furnitureObjects)
{
if ((Object)(object)furnitureObject == (Object)null)
{
continue;
}
PhotonView component = ((Component)furnitureObject).GetComponent<PhotonView>();
if ((Object)(object)component == (Object)null || component.IsMine || !PhotonNetwork.InRoom)
{
Transform transform = ((Component)furnitureObject).transform;
transform.position += Vector3.up * furnitureLiftHeight;
Vector3 onUnitSphere = Random.onUnitSphere;
if (onUnitSphere.y < 0f)
{
onUnitSphere.y = 0f - onUnitSphere.y;
}
furnitureObject.AddForce(onUnitSphere * furnitureThrowForce, (ForceMode)1);
furnitureObject.AddTorque(Random.insideUnitSphere * furnitureThrowForce, (ForceMode)1);
}
}
}
SpawnParticles();
((Component)this).gameObject.SetActive(false);
}
private void SpawnSingleItem(Item item)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
try
{
Vector3 val = ((Component)this).transform.position + Vector3.up * 1.5f;
Quaternion rotation = Random.rotation;
GameObject val2 = null;
if (PhotonNetwork.InRoom)
{
val2 = PhotonNetwork.InstantiateRoomObject(item.prefab.ResourcePath, val, rotation, (byte)0, (object[])null);
}
else
{
GameObject val3 = Resources.Load<GameObject>(item.prefab.ResourcePath);
if (Object.op_Implicit((Object)(object)val3))
{
val2 = Object.Instantiate<GameObject>(val3, val, rotation);
}
}
if (Object.op_Implicit((Object)(object)val2))
{
Rigidbody component = val2.GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)component))
{
Vector3 val4 = Vector3.up * 1.5f + Random.onUnitSphere;
Vector3 normalized = ((Vector3)(ref val4)).normalized;
normalized.y = Mathf.Abs(normalized.y);
component.AddForce(normalized * 5f, (ForceMode)1);
component.AddTorque(Random.insideUnitSphere * 10f, (ForceMode)1);
}
}
}
catch
{
}
}
private void SpawnParticles()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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)
//IL_00f8: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: 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_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Expected O, but got Unknown
GameObject val = new GameObject("DobyPoof");
val.transform.position = ((Component)this).transform.position + Vector3.up;
ParticleSystem val2 = val.AddComponent<ParticleSystem>();
MainModule main = val2.main;
((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.8f);
((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(4f);
((MainModule)(ref main)).startSize = new MinMaxCurve(0.1f, 0.5f);
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(1f, 1f, 1f, 0.5f));
((MainModule)(ref main)).loop = false;
EmissionModule emission = val2.emission;
((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
{
new Burst(0f, (short)40)
});
ShapeModule shape = val2.shape;
((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
((ShapeModule)(ref shape)).radius = 0.2f;
ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
Gradient val3 = new Gradient();
val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
{
new GradientColorKey(Color.white, 0f),
new GradientColorKey(Color.white, 1f)
}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
{
new GradientAlphaKey(1f, 0f),
new GradientAlphaKey(0f, 1f)
});
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
((Renderer)((Component)val2).GetComponent<ParticleSystemRenderer>()).material = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply"));
val2.Play();
Object.Destroy((Object)(object)val, 2f);
}
private void SetupUI()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
Transform val = (Object.op_Implicit((Object)(object)HUDCanvas.instance) ? ((Component)HUDCanvas.instance).transform : null);
if (!Object.op_Implicit((Object)(object)val))
{
GameObject val2 = new GameObject("DobyCanvas");
Canvas obj = val2.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 999;
val2.AddComponent<CanvasScaler>();
val2.AddComponent<GraphicRaycaster>();
val = val2.transform;
}
_p = new GameObject("DobyPanel");
_p.transform.SetParent(val, false);
((Graphic)_p.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
RectTransform component = _p.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.2f, 0.3f);
component.anchorMax = new Vector2(0.8f, 0.7f);
Vector2 offsetMin = (component.offsetMax = Vector2.zero);
component.offsetMin = offsetMin;
GameObject val3 = new GameObject("DobyText");
val3.transform.SetParent(_p.transform, false);
_t = val3.AddComponent<Text>();
Font font = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font x) => ((Object)x).name == "Arial")) ?? Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault() ?? Font.CreateDynamicFontFromOSFont("Arial", 16);
_t.font = font;
((Graphic)_t).color = Color.white;
_t.alignment = (TextAnchor)4;
_t.resizeTextForBestFit = true;
_t.resizeTextMinSize = 14;
_t.resizeTextMaxSize = 30;
_t.verticalOverflow = (VerticalWrapMode)1;
RectTransform component2 = val3.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.offsetMin = new Vector2(10f, 10f);
component2.offsetMax = new Vector2(-10f, -10f);
_p.SetActive(false);
}
private void OnDestroy()
{
if (Object.op_Implicit((Object)(object)_p))
{
Object.Destroy((Object)(object)_p);
}
}
}
}