using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dice;
using HarmonyLib;
using ModdingTales;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Device;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DiceCamPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("DiceCamPlugin")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("DiceCamPlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LordAshes;
[BepInPlugin("org.lordashes.plugins.dicecam", "Dice Cam Plugin", "1.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class DiceCamPlugin : BaseUnityPlugin
{
public static class DiceSimplifier
{
public class SimpleDice
{
public string formula { get; set; }
public short diceCount { get; set; }
}
public static SimpleDice SimplifyDiceDescription(DiceGroupDescriptor[] groups)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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)
string formula = "";
short totalDice = 0;
foreach (DiceGroupDescriptor group in groups)
{
SimplifyDiceGroupDescription(group, ref formula, ref totalDice);
}
return new SimpleDice
{
formula = formula,
diceCount = totalDice
};
}
private static void SimplifyDiceGroupDescription(DiceGroupDescriptor group, ref string formula, ref short totalDice)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_00bc: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
LoggingPlugin.LogDebug("Analyzing Dice Group " + ((group.Name != null && group.Name.Trim() != "") ? group.Name : ""));
if (formula != "")
{
formula += "/";
}
formula += ((group.Name != null && group.Name.Trim() != "") ? (group.Name + ": ") : "");
List<RollOperandDescriptor> list = new List<RollOperandDescriptor>();
list.Add(group.OperandDescriptor);
RollOperationDescriptor val2 = default(RollOperationDescriptor);
RollDescriptor val3 = default(RollDescriptor);
RollValueDescriptor val4 = default(RollValueDescriptor);
while (list.Count > 0)
{
RollOperandDescriptor val = list.ElementAt(0);
list.RemoveAt(0);
((RollOperandDescriptor)(ref val)).Get(ref val2, ref val3, ref val4);
formula += (((int)val2.DiceOperator == 0) ? "+" : "-");
string obj = formula;
byte count = val3.Count;
formula = obj + count + "D" + ((DieKind)(ref val3.Kind)).RegisteredName.Replace("number", "");
string obj2 = formula;
string text;
if (val4.Value < 0)
{
short value = val4.Value;
text = value.ToString();
}
else
{
short value = val4.Value;
text = "+" + value;
}
formula = obj2 + text;
if (val2.OperandDescriptors != null)
{
list.AddRange(val2.OperandDescriptors);
}
count = val3.Count;
LoggingPlugin.LogDebug("Found " + count + " Dice");
totalDice += val3.Count;
}
}
}
[HarmonyPatch(typeof(Die), "Spawn")]
public static class Patch_Die_Spawn
{
public static bool Prefix(object roll, DieKind kind, Transform parent, ref float3 pos, quaternion rot, RollId rollId, Mode mode, bool isGmOnly, MaterialPropertyBlock iconMpb, int faceIndexBase, Die __instance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
LoggingPlugin.LogDebug("Outstanding Dice Cam Roll In Progress. Stacking Dice.");
if (diceCamRollId.AsLong != default(RollId).AsLong)
{
pos = float3.op_Implicit(new Vector3(gatherX, gatherY, gatherZ) + new Vector3(0f, dieOffset * 10f));
float3 val = pos;
LoggingPlugin.LogInfo("Spawning Die At " + ((object)(float3)(ref val)).ToString());
dieOffset += 0.1f;
}
return true;
}
}
public class ZoomLevels
{
private SortedDictionary<int, Tuple<Vector3, Vector3>> zoomLevels = new SortedDictionary<int, Tuple<Vector3, Vector3>>();
public void AddZoomLevel(int boundary, Vector3 postion, Vector3 rotation)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
zoomLevels.Add(boundary, new Tuple<Vector3, Vector3>(postion, rotation));
}
public Tuple<Vector3, Vector3> GetZoomLevel(int boundary)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
KeyValuePair<int, Tuple<Vector3, Vector3>> keyValuePair = zoomLevels.FirstOrDefault((KeyValuePair<int, Tuple<Vector3, Vector3>> p) => p.Key >= boundary);
return keyValuePair.Equals(default(KeyValuePair<int, Tuple<Vector3, Vector3>>)) ? new Tuple<Vector3, Vector3>(default(Vector3), default(Vector3)) : keyValuePair.Value;
}
public string Serialize()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00c9: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
string text = "{\r\n";
foreach (KeyValuePair<int, Tuple<Vector3, Vector3>> zoomLevel in zoomLevels)
{
text = text + " " + zoomLevel.Key + ": \"" + zoomLevel.Value.Item1.x + "," + zoomLevel.Value.Item1.y + "," + zoomLevel.Value.Item1.z + "," + zoomLevel.Value.Item2.x + "," + zoomLevel.Value.Item2.y + "," + zoomLevel.Value.Item2.z + "\",\r\n";
}
text = text.Substring(0, text.Length - 3) + "\r\n";
return text + "}";
}
public void Deserialize(string json)
{
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
string[] array = json.Split(new string[1] { "\r\n" }, StringSplitOptions.None);
Vector3 item = default(Vector3);
Vector3 item2 = default(Vector3);
foreach (string text in array)
{
if (text.IndexOf(":") > -1)
{
string s = text.Substring(0, text.IndexOf(":")).Trim();
int key = int.Parse(s);
string[] array2 = text.Substring(text.IndexOf(":") + 1).Replace("\"", "").Split(new char[1] { ',' });
((Vector3)(ref item))..ctor(float.Parse(array2[0], CultureInfo.InvariantCulture), float.Parse(array2[1], CultureInfo.InvariantCulture), float.Parse(array2[2], CultureInfo.InvariantCulture));
((Vector3)(ref item2))..ctor(float.Parse(array2[3], CultureInfo.InvariantCulture), float.Parse(array2[4], CultureInfo.InvariantCulture), float.Parse(array2[5], CultureInfo.InvariantCulture));
zoomLevels.Add(key, new Tuple<Vector3, Vector3>(item, item2));
}
}
}
}
[CompilerGenerated]
private sealed class <WarnAboutLogLevel>d__29 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public DiceCamPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WarnAboutLogLevel>d__29(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
try
{
DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
SystemMessage.DisplayInfoText("Dice Cam Plugin: Using '" + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + "' diagnostics.\r\nUse 'Info' for better performance", 10f, 0f);
SystemMessage.DisplayInfoText("Dice Cam Plugin: Use 'Debug' or 'Trace' for\r\ntroubleshooting only.", 10f, 0f);
}
catch
{
goto IL_0072;
}
return false;
IL_0072:
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
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();
}
}
[CompilerGenerated]
private sealed class <clearDiceEventEx>d__27 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public RollId rollId;
public DiceCamPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <clearDiceEventEx>d__27(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
diceCamRollId = default(RollId);
<>2__current = (object)new WaitForSeconds(3f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
LoggingPlugin.LogDebug("Clearing Dice");
((MonoBehaviour)_self).StartCoroutine(DiceOpsPlugin._self.ClearDice(rollId, 0.1f));
LoggingPlugin.LogDebug("Dectivating Dice Cam");
Object.DestroyImmediate((Object)(object)diceCam);
Object.DestroyImmediate((Object)(object)dolly);
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();
}
}
[CompilerGenerated]
private sealed class <spawnDiceEventEx>d__25 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public RollId rollId;
public DiceRollDescriptor diceRollDescriptor;
public DiceCamPlugin <>4__this;
private DiceRollManager <dm>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <spawnDiceEventEx>d__25(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<dm>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_005d: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
LoggingPlugin.LogTrace("Gathering And Rolling Dice");
<dm>5__1 = Object.FindObjectOfType<DiceRollManager>();
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<dm>5__1.ThrowDice(rollId, new float3(0f, 0.01f, 0f));
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();
}
}
public const string Name = "Dice Cam Plugin";
public const string Guid = "org.lordashes.plugins.dicecam";
public const string Version = "1.0.0.0";
public const string Author = "Lord Ashes";
public static DiceCamPlugin _self = null;
public static float gatherX = 200f;
public static float gatherY = 1.5f;
public static float gatherZ = 200f;
public static float gatherRotX = 0f;
public static float gatherRotY = 0f;
public static float gatherRotZ = 0f;
public static GameObject dolly;
public static Camera diceCam;
public static RenderTexture auxCameraTexture = new RenderTexture(Screen.width, Screen.height, 32);
public static float dieOffset = 0f;
public static string zoomLevelsJson = "";
public static int diceCamX;
public static int diceCamY;
public static int diceCamW;
public static int diceCamH;
public static RollId diceCamRollId;
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Invalid comparison between Unknown and I4
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Expected O, but got Unknown
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Expected O, but got Unknown
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Expected O, but got Unknown
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Expected O, but got Unknown
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Expected O, but got Unknown
_self = this;
LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", (DiagnosticLevel)3, (ConfigDescription)null).Value);
string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName;
DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
LoggingPlugin.LogInfo(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")");
gatherX = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dice Cam X Position", 200f, (ConfigDescription)null).Value;
gatherY = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dice Cam Drop Height", 1.5f, (ConfigDescription)null).Value;
gatherZ = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dice Cam Y Position", 200f, (ConfigDescription)null).Value;
gatherRotX = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dice Cam X Rotation", 55f, (ConfigDescription)null).Value;
gatherRotZ = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dice Cam Y Rotation", 0f, (ConfigDescription)null).Value;
gatherRotY = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dice Cam Z Rotation", 0f, (ConfigDescription)null).Value;
zoomLevelsJson = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Zoom Levels", "{\r\n 1: \"0,1,-1,60,0,0\",\r\n 10: \"0,2,-2,60,0,0\",\r\n 20: \"0,4,-3,60,0,0\",\r\n 999: \"0,5,-4,60,0,0\"\r\n}", (ConfigDescription)null).Value;
diceCamX = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Dice Cam Screen X", 1270, (ConfigDescription)null).Value;
diceCamY = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Dice Cam Screen Y", 35, (ConfigDescription)null).Value;
diceCamW = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Dice Cam Screen Width", 640, (ConfigDescription)null).Value;
diceCamH = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Dice Cam Screen Height", 480, (ConfigDescription)null).Value;
if ((int)LoggingPlugin.GetLogLevel() >= 4)
{
((MonoBehaviour)this).StartCoroutine(WarnAboutLogLevel());
}
DiceOpsPlugin.AddNotification(new LoadDiceInTrayCallback(loadDiceEvent));
DiceOpsPlugin.AddNotification(new SpawnDiceFromTrayCallback(spawnDiceEvent));
DiceOpsPlugin.AddNotification(new DiceRollResultCallback(clearDiceEvent));
Harmony val = new Harmony("org.lordashes.plugins.dicecam");
val.PatchAll();
string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
ModdingUtils.Initialize((BaseUnityPlugin)(object)this, new ManualLogSource("Dice Cam Plugin"), text, false);
}
private void loadDiceEvent(DiceEvent diceEvent, RollId rollId, ref DiceRollDescriptor rollDescriptor, ref bool showResult)
{
//IL_0019: 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_00a2: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Invalid comparison between Unknown and I4
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (rollDescriptor.DiceGroupDescriptors != null && rollDescriptor.DiceGroupDescriptors.Length != 0 && rollDescriptor.DiceGroupDescriptors.ElementAt(0).Name != null && rollDescriptor.DiceGroupDescriptors.ElementAt(0).Name.Trim() != "")
{
LoggingPlugin.LogDebug("Named Roll '" + rollDescriptor.DiceGroupDescriptors.ElementAt(0).Name.Trim() + "' Detected. Automatically Spawning Dice. (" + ((object)(DiceEvent)(ref diceEvent)).ToString() + ")");
diceCamRollId = rollId;
if ((int)diceEvent == 2)
{
dieOffset = 0f;
((MonoBehaviour)_self).StartCoroutine(DiceOpsPlugin._self.SpawnTrayDice(0.5f));
}
}
}
private void spawnDiceEvent(DiceEvent diceEvent, RollId rollId, DiceRollDescriptor diceRollDescriptor, ref float3 pos, ref bool isGmRoll, ref bool showResult)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Invalid comparison between Unknown and I4
//IL_0025: 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_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
if (diceRollDescriptor.DiceGroupDescriptors == null || diceRollDescriptor.DiceGroupDescriptors.Length == 0 || diceRollDescriptor.DiceGroupDescriptors.ElementAt(0).Name == null || !(diceRollDescriptor.DiceGroupDescriptors.ElementAt(0).Name.Trim() != ""))
{
return;
}
LoggingPlugin.LogDebug("Named Roll '" + diceRollDescriptor.DiceGroupDescriptors.ElementAt(0).Name.Trim() + "' Detected. Processing With Dice Cam. (" + ((object)(DiceEvent)(ref diceEvent)).ToString() + ")");
diceCamRollId = rollId;
if ((int)diceEvent == 3)
{
DiceSimplifier.SimpleDice simpleDice = DiceSimplifier.SimplifyDiceDescription(diceRollDescriptor.DiceGroupDescriptors);
ZoomLevels zoomLevels = new ZoomLevels();
zoomLevels.Deserialize(zoomLevelsJson);
Tuple<Vector3, Vector3> zoomLevel = zoomLevels.GetZoomLevel(simpleDice.diceCount);
LoggingPlugin.LogDebug("Activating Dice Cam With Zoom Level For " + simpleDice.diceCount + " Dice");
dolly = new GameObject();
((Object)dolly).name = "dolly";
diceCam = dolly.AddComponent<Camera>();
diceCam.rect = new Rect(0.005f, 0.005f, 1f, 1f);
dolly.transform.position = new Vector3(gatherX + zoomLevel.Item1.x, gatherY + zoomLevel.Item1.y, gatherZ - zoomLevel.Item1.z);
((Component)diceCam).transform.rotation = Quaternion.Euler(new Vector3(gatherRotX + zoomLevel.Item2.x, gatherRotY + zoomLevel.Item2.y, gatherRotZ + zoomLevel.Item2.z));
diceCam.targetTexture = auxCameraTexture;
CreatureBoardAsset val = null;
CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
if ((Object)(object)val != (Object)null && diceRollDescriptor.DiceGroupDescriptors.ElementAt(0).Name == "Setup")
{
((MovableBoardAsset)val).MoveTo(new Vector3(gatherX, gatherY, gatherX), false);
}
}
else
{
LoggingPlugin.LogDebug("Automatically Rolling Dice");
((MonoBehaviour)_self).StartCoroutine(spawnDiceEventEx(rollId, diceRollDescriptor));
}
}
[IteratorStateMachine(typeof(<spawnDiceEventEx>d__25))]
private IEnumerator spawnDiceEventEx(RollId rollId, DiceRollDescriptor diceRollDescriptor)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <spawnDiceEventEx>d__25(0)
{
<>4__this = this,
rollId = rollId,
diceRollDescriptor = diceRollDescriptor
};
}
private void clearDiceEvent(DiceEvent diceEvent, RollId rollId, ref RollResults rollResultData, ref ClientGuid sender)
{
//IL_0021: 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_00ac: 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_00b5: Invalid comparison between Unknown and I4
//IL_0035: 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)
if (rollResultData.ResultsGroups != null && rollResultData.ResultsGroups.Length > 0 && ((IEnumerable<RollGroup>)rollResultData.ResultsGroups).ElementAt(0).Name != null && ((IEnumerable<RollGroup>)rollResultData.ResultsGroups).ElementAt(0).Name.Trim() != "")
{
LoggingPlugin.LogDebug("Named Roll '" + ((IEnumerable<RollGroup>)rollResultData.ResultsGroups).ElementAt(0).Name.Trim() + "' Detected. Deactivating Dice Cam. (" + ((object)(DiceEvent)(ref diceEvent)).ToString() + ")");
diceCamRollId = rollId;
if ((int)diceEvent == 10)
{
LoggingPlugin.LogDebug("Automatically Clearning Dice Cam");
((MonoBehaviour)_self).StartCoroutine(clearDiceEventEx(rollId));
}
}
}
[IteratorStateMachine(typeof(<clearDiceEventEx>d__27))]
private IEnumerator clearDiceEventEx(RollId rollId)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <clearDiceEventEx>d__27(0)
{
<>4__this = this,
rollId = rollId
};
}
private void OnGUI()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)dolly != (Object)null)
{
GUI.DrawTexture(new Rect((float)diceCamX, (float)diceCamY, (float)diceCamW, (float)diceCamH), (Texture)(object)auxCameraTexture, (ScaleMode)2);
}
}
[IteratorStateMachine(typeof(<WarnAboutLogLevel>d__29))]
private IEnumerator WarnAboutLogLevel()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WarnAboutLogLevel>d__29(0)
{
<>4__this = this
};
}
}