using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Configuration; using Bounce.Singletons; using Bounce.Unmanaged; using DataModel; using Dice; using GameChat.UI; using HarmonyLib; using Newtonsoft.Json; using RadialUI; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.Device; using UnityEngine.Rendering.PostProcessing; 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("TaleSpireRuleSet5EPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TaleSpireRuleSet5EPlugin")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("TaleSpireRuleSet5EPlugin")] [assembly: ComVisible(false)] [assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")] [assembly: AssemblyFileVersion("3.1.6.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("3.1.6.0")] namespace LordAshes; [BepInPlugin("org.lordashes.plugins.ruleset5e", "RuleSet 5E Plug-In", "3.1.6.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RuleSet5EPlugin : BaseUnityPlugin { public static class CacheLoader { public static IEnumerator LoadCache(float loadSeperationDelay) { List iconsList = File.Find("/org.lordashes.plugins.ruleset5e/", (CacheType)999).ToList(); if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Found " + iconsList.Count + " Icons")); } while (iconsList.Count > 0) { if (!iconsCache.ContainsKey(Path.GetFileNameWithoutExtension(iconsList.ElementAt(0)))) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Caching '" + iconsList.ElementAt(0) + "'")); } iconsCache.Add(Path.GetFileNameWithoutExtension(iconsList.ElementAt(0)), Image.LoadSprite(iconsList.ElementAt(0), (CacheType)999)); yield return (object)new WaitForSeconds(loadSeperationDelay); } iconsList.RemoveAt(0); } } public static Sprite GetSprite(string iconName) { if (!iconsCache.ContainsKey(Path.GetFileNameWithoutExtension(iconName))) { string text = ""; switch (pluginMode.Value) { case OperationMode.localAlways: text = "/org.lordashes.plugins.ruleset5e/" + Path.GetFileNameWithoutExtension(iconName); break; case OperationMode.remoteAlways: text = locationPrefixFiles + "/org.lordashes.plugins.ruleset5e/" + Path.GetFileNameWithoutExtension(iconName) + defaultIconExtension.Value; break; case OperationMode.localFirstRemoteFallback: text = "/org.lordashes.plugins.ruleset5e/" + Path.GetFileNameWithoutExtension(iconName); if (!File.Exists(text)) { text = locationPrefixFiles + "/org.lordashes.plugins.ruleset5e/" + Path.GetFileNameWithoutExtension(iconName) + defaultIconExtension.Value; } break; } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Icon Not Cached. Caching '" + Path.GetFileNameWithoutExtension(iconName) + "' From '" + text + "'")); } iconsCache.Add(Path.GetFileNameWithoutExtension(iconName), Image.LoadSprite(text, (CacheType)999)); } return iconsCache[Path.GetFileNameWithoutExtension(iconName)]; } } public class Character { public bool NPC { get; set; } = false; public int reach { get; set; } = 5; public List attacks { get; set; } = new List(); public List attacksDC { get; set; } = new List(); public List saves { get; set; } = new List(); public List skills { get; set; } = new List(); public List healing { get; set; } = new List(); public List resistance { get; set; } = new List(); public List vulnerability { get; set; } = new List(); public List immunity { get; set; } = new List(); public string ac { get; set; } = "8"; public string hp { get; set; } = "10"; public string str { get; set; } = "10"; public string dex { get; set; } = "10"; public string con { get; set; } = "10"; public string Int { get; set; } = "10"; public string wis { get; set; } = "10"; public string cha { get; set; } = "10"; public string speed { get; set; } = "30"; public string lv { get; set; } = "1"; public string var1 { get; set; } = ""; public string var2 { get; set; } = ""; public string var3 { get; set; } = ""; } public class Roll { public string name { get; set; } = ""; public string type { get; set; } = ""; public string roll { get; set; } = "100"; public string critrangemin { get; set; } = "20"; public string critmultip { get; set; } = "2"; public string range { get; set; } = "0/0"; public string info { get; set; } = ""; public bool aoo { get; set; } = false; public string futureUse_icon { get; set; } = "Melee"; public string menuUI { get; set; } = ""; public Roll link { get; set; } = null; public Roll() { } public Roll(Roll source) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"Copying Roll Stats To New Roll Object"); } name = source.name; type = source.type; roll = source.roll; critrangemin = source.critrangemin; critmultip = source.critmultip; range = source.range; info = source.info; futureUse_icon = source.futureUse_icon; if (source.link == null) { link = null; } else { link = new Roll(source.link); } } } public class IdBonus { public string name { get; set; } = ""; public bool _useAttackBonusDie { get; set; } = false; public bool _useDamageBonusDie { get; set; } = false; public bool _useSkillBonusDie { get; set; } = false; public bool _useACBonusDie { get; set; } = false; public bool _useHPBonus { get; set; } = false; public string _amountAttackBonusDie { get; set; } = ""; public string _amountDamageBonusDie { get; set; } = ""; public string _amountSkillBonusDie { get; set; } = ""; public string _amountACBonusDie { get; set; } = ""; public string _amountHPBonus { get; set; } = ""; public bool _useAdv { get; set; } = false; public bool _useDis { get; set; } = false; } public class Damage { public string name { get; set; } = "Undefined"; public string type { get; set; } = "Undefined"; public string roll { get; set; } = ""; public int total { get; set; } = 0; public string expansion { get; set; } = ""; public Damage() { } public Damage(string name, string type, string roll, string expansion, int total) { this.name = name; this.type = type; this.roll = roll; this.expansion = expansion; this.total = total; } } public class Existence { public Vector3 position { get; set; } = Vector3.zero; public Vector3 rotation { get; set; } = Vector3.zero; public Existence() { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) public Existence(Vector3 pos, Vector3 rot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references) position = pos; rotation = rot; } public void Apply(Transform transform) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) transform.position = position; transform.rotation = Quaternion.Euler(rotation); } } [HarmonyPatch(typeof(UIChatMessageManager), "AddChatMessage")] public static class PatchAddChatMessage { public static bool Prefix(ref string creatureName, Texture2D icon, ref string chatMessage, IChatFocusable focus = null) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Patch: Checking Message Content"); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Creature Name" + creatureName + " | ChatMessage: " + chatMessage)); } if (chatMessage != null) { chatMessage = chatMessage.Replace("(Whisper)", "").Trim(); if (chatMessage.StartsWith("[") && chatMessage.Contains("]")) { creatureName = chatMessage.Substring(0, chatMessage.IndexOf("]")); creatureName = creatureName.Substring(1); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Patch: Speaker Changed To '" + creatureName + "'")); } chatMessage = chatMessage.Substring(chatMessage.IndexOf("]") + 1); } } return true; } } [HarmonyPatch(typeof(CreaturePresenter), "OnCreatureDataChanged")] public static class PatchCreaturePresenterOnCreatureDataChanged { public static void Postfix(in CreatureDataV3 creatureData, bool teleport) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!selectRuleMode && processCallback) { ((MonoBehaviour)Instance).StartCoroutine(SupressionSystem); if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"Ruleset5E Plugin: Patch: OnCreatureDataChanged"); } processCallback = false; ((MonoBehaviour)Instance).StartCoroutine(waitimestandard(creatureData)); } } } [HarmonyPatch(typeof(CreatureBoardAsset), "Pickup")] public static class PatchCreatureBoardAssetPickup { public static bool Prefix() { return !selectRuleMode; } public static void Postfix() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!selectRuleMode) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"Ruleset5E Plugin: PatchCreatureBoardAssetPickup"); } Instance.LoadBonus(LocalClient.SelectedCreatureId); } } } public static class PatchAssistant { public static object GetProperty(object instance, string propertyName) { Type type = instance.GetType(); foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties()) { if (runtimeProperty.Name.Contains(propertyName)) { return runtimeProperty.GetValue(instance); } } PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.Name.Contains(propertyName)) { return propertyInfo.GetValue(instance); } } return null; } public static void SetProperty(object instance, string propertyName, object value) { Type type = instance.GetType(); foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties()) { if (runtimeProperty.Name.Contains(propertyName)) { runtimeProperty.SetValue(instance, value); return; } } PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.Name.Contains(propertyName)) { propertyInfo.SetValue(instance, value); break; } } } public static object GetField(object instance, string fieldName) { Type type = instance.GetType(); foreach (FieldInfo runtimeField in type.GetRuntimeFields()) { if (runtimeField.Name.Contains(fieldName)) { try { return runtimeField.GetValue(instance); } catch (Exception ex) { Debug.LogWarning((object)("Patch Assistant: Unable To GetValue Of '" + fieldName + "' From '" + instance?.ToString() + "'\r\n" + ex)); return null; } } } FieldInfo[] fields = type.GetFields(); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name.Contains(fieldName)) { try { return fieldInfo.GetValue(instance); } catch (Exception ex2) { Debug.LogWarning((object)("Patch Assistant: Unable To GetValue Of '" + fieldName + "' From '" + instance?.ToString() + "'\r\n" + ex2)); return null; } } } return null; } public static void SetField(object instance, string fieldName, object value) { Type type = instance.GetType(); foreach (FieldInfo runtimeField in type.GetRuntimeFields()) { if (runtimeField.Name.Contains(fieldName)) { runtimeField.SetValue(instance, value); return; } } FieldInfo[] fields = type.GetFields(); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name.Contains(fieldName)) { fieldInfo.SetValue(instance, value); break; } } } public static object UseMethod(object instance, string methodName, object[] parameters) { Type type = instance.GetType(); foreach (MethodInfo runtimeMethod in type.GetRuntimeMethods()) { if (runtimeMethod.Name.Contains(methodName)) { return runtimeMethod.Invoke(instance, parameters); } } MethodInfo[] methods = type.GetMethods(); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name.Contains(methodName)) { return methodInfo.Invoke(instance, parameters); } } return null; } } public enum DiagnosticMode { none, low, high, ultra } public enum RollTotal { normal, advantage, disadvantage } public enum RollMode { manual, manual_side, automaticDice, automaticGenerator } public enum StateMachineState { idle, attackAttackRangeCheck, attackAttackIntention, attackRollSetup, attackAttackDieCreate, attackAttackDieWaitCreate, attackAttackDieRollExecute, attackAttackDieWaitRoll, attackAttackBonusDieCreate, attackAttackBonusDieWaitCreate, attackAttackBonusDieRollExecute, attackAttackBonusDieWaitRoll, attackAttackBonusDieReaction, attackAttackBonusDieReactionWait, attackAttackDieRollReport, attackAttackDefenceCheck, attackAttackMissReport, attackAttackHitReport, attackDamageDieCreate, attackDamageDieWaitCreate, attackDamageDieRollExecute, attackDamageDieWaitRoll, attackDamageDieRollReport, attackDamageDieDamageReport, attackDamageDieDamageTake, attackRollCleanup, skillRollSetup, skillRollDieCreate, skillRollDieWaitCreate, skillRollDieRollExecute, skillRollDieWaitRoll, skillBonusRollDieCreate, skillBonusRollDieWaitCreate, skillBonusRollDieRollExecute, skillBonusRollDieWaitRoll, skillRollDieRollReport, skillRollCleanup, skillRollMore, healingRollStart, healingRollDieCreate, healingRollDieWaitCreate, healingRollDieRollExecute, healingRollDieWaitRoll, healingRollDieRollReport, healingRollDieValueReport, healingRollDieValueTake, healingRollCleanup } public static class Utility { private static bool postProcessingOn = true; public static void PostOnMainPage(MemberInfo plugin) { SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown try { if (((Scene)(ref scene)).name == "UI") { TextMeshProUGUI uITextByName = GetUITextByName("BETA"); if (Object.op_Implicit((Object)(object)uITextByName)) { ((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods"; } } else { TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text"); if (Object.op_Implicit((Object)(object)uITextByName2)) { BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin)); if (((TMP_Text)uITextByName2).text.EndsWith("")) { ((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n"; } TextMeshProUGUI val2 = uITextByName2; ((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nXJ_Nekomancer's " + val.Name + " - " + val.Version; } } } catch (Exception ex) { Debug.LogWarning((object)ex); } }; } public static bool isBoardLoaded() { return SimpleSingletonBehaviour.HasInstance && SingletonStateMBehaviour>.HasInstance && !BoardSessionManager.IsLoading; } public static bool StrictKeyCheck(KeyboardShortcut check) { //IL_002e: 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_003f: Unknown result type (might be due to invalid IL or missing references) if (!((KeyboardShortcut)(ref check)).IsUp()) { return false; } KeyCode[] array = new KeyCode[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); KeyCode[] array2 = (KeyCode[])(object)array; foreach (KeyCode val in array2) { if (Input.GetKey(val) != ((KeyboardShortcut)(ref check)).Modifiers.Contains(val)) { return false; } } return true; } public static bool CharacterCheck(string characterName, string rollName) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreatureBoardAsset val = null; CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val); if ((Object)(object)val == (Object)null) { return false; } return GetCharacterName(val) == characterName; } public static List FindGMs() { //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_002e: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) List list = new List(); ClientMode val = default(ClientMode); foreach (PlayerGuid key in CampaignSessionManager.PlayersInfo.Keys) { List list2 = new List(); if (!BoardSessionManager.PlayersClientsGuids.TryGetValue(key, ref list2)) { continue; } int count = list2.Count; for (int i = 0; i < count; i++) { if (BoardSessionManager.ClientsModes.TryGetValue(list2[i], ref val) && (int)val == 2) { list.Add(key); } } } return (list.Count > 0) ? list : new List(); } public static List FindOwners(CreatureGuid cid) { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) List list = new List(); foreach (PlayerGuid key in CampaignSessionManager.PlayersInfo.Keys) { if (CreatureManager.PlayerCanControlCreature(key, cid)) { list.Add(key); } } return list; } private static TextMeshProUGUI GetUITextByName(string name) { TextMeshProUGUI[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == name) { return array[i]; } } return null; } public static string GetCharacterName(CreatureBoardAsset creature) { return GetCharacterName(creature.Name).Trim(); } public static string GetCharacterName(string creatureName) { if (creatureName == null) { return ""; } string text = creatureName; if (text.IndexOf("<") >= 0) { text = text.Substring(0, text.IndexOf("<")).Trim(); } return text; } public static void DisableProcessing(bool setting) { PostProcessLayer component = ((Component)Camera.main).GetComponent(); if (setting) { postProcessingOn = GetPostProcessing(); ((Behaviour)component).enabled = false; } else { ((Behaviour)component).enabled = postProcessingOn; } } private static bool GetPostProcessing() { PostProcessLayer component = ((Component)Camera.main).GetComponent(); return ((Behaviour)component).enabled; } public static bool IsNumeric(string value) { return value.All(char.IsNumber); } } public enum OperationMode { localAlways, remoteAlways, localFirstRemoteFallback } public static bool selectRuleMode = false; public static bool processCallback = true; public static Action callbackRollReady = null; public static Action> callbackRollResult = null; public static Existence forceExistence = null; public static Random random = new Random(); private static Color diceColor = Color.black; private static Color32 diceHighlightColor = new Color32(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue); public static DiagnosticMode diagnostics; public const float scale = 5f; public static RollMode rollingSystem = RollMode.automaticDice; public static StateMachineState stateMachineState = StateMachineState.idle; public static StateMachineState stateMachineLastState = StateMachineState.idle; private Roll lastRollRequest = null; private RollTotal lastRollRequestTotal = RollTotal.normal; private Roll loadedRollRequest = null; private long lastRollId = -2L; private Dictionary lastResult = null; private float damageDieMultiplier = 1f; private CreatureBoardAsset instigator = null; private CreatureBoardAsset victim = null; private string missAnimation = "TLA_Wiggle"; private string deadAnimation = "TLA_Action_Knockdown"; private bool changeBaseColors = true; private string[] npcColors = new string[3] { "6", "7", "8" }; private string[] pcColors = new string[3] { "2", "13", "1" }; private Existence saveCamera = null; private string messageContent = ""; private ChatManager chatManager = null; private bool totalAdv = false; private bool totalDis = false; private bool victim_totalAdv = false; private bool victim_totalDis = false; private bool useAttackBonusDie = false; private string amountAttackBonusDie = ""; private bool useDamageBonusDie = false; private string amountDamageBonusDie = ""; private bool useSkillBonusDie = false; private string amountSkillBonusDie = ""; private bool victim_useSkillBonusDie = false; private string amountACBonusDie = ""; private bool useACBonusDie = false; private string amountHPBonus = ""; private bool useHPBonus = false; private string victim_amountSkillBonusDie = ""; private string victim_amountACBonusDie = ""; private string victim_amountHPBonus = ""; private bool reactionStop = false; public static float processSpeed = 1f; private Existence diceSideExistance = null; private bool secureSuccess = false; private bool halfDamage = false; private bool criticalImmunity = false; private bool firstWithDamageBonus = false; private GameObject dolly = null; private Camera camera = null; private RenderTexture auxCameraTexture = new RenderTexture(Screen.width, Screen.height, 32); private List multiDCAttackDataList = new List(); public const string Name = "RuleSet 5E Plug-In"; public const string Guid = "org.lordashes.plugins.ruleset5e"; public const string Version = "3.1.6.0"; public const string Author = "XJ_Nekomancer"; public static RuleSet5EPlugin Instance = null; private string iconSelector = "type"; private Dictionary characters = new Dictionary(); private Dictionary idMinis = new Dictionary(); private Dictionary IdBonusList = new Dictionary(); private Texture reactionStopIcon = null; private bool reactionStopContinue = false; private string reactionRollTotal = "NoInfo"; private bool reactionHalve = false; private bool dcAttack = false; private bool healSequence = false; private bool oppositeRoll = false; private Roll oppositeRollvalue; private Vector2 smallScreenConversion = new Vector2(-1200f, 40f); private bool pauseRender = false; private int numberOfSelectedTargets = 0; public List multiTargetAssets = new List(); private int MultitargetAssetsIndex; public static Texture2D backgroundTexture; public static string multiAttackType = ""; public static Roll multiRoll; private GameInput gameInputInstance = null; private MethodInfo gameInputDisable = null; private MethodInfo gameInputEnable = null; public bool globalKeyboardDisabled = false; public int uiLocX; public int uiLocY; public bool shakeonhit; public bool fadeText = false; public bool useGeneralIcons = false; public static bool useJsonExtension = false; public static string locationPrefixFiles = ""; public static string locationPrefixIcons = ""; public static Dictionary iconsCache = new Dictionary(); private static ConfigEntry defaultIconExtension; private ConfigEntry reloadAssetTrigger; private static ConfigEntry pluginMode; private Dictionary> radiaMainMenuList = new Dictionary>(); public static IEnumerator SupressionSystem { get { processCallback = false; yield return (object)new WaitForSeconds(0.5f); processCallback = true; } } public unsafe static IEnumerator waitimestandard(CreatureDataV3 creatureData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) CreatureBoardAsset asset2 = null; CreaturePresenter.TryGetAsset(creatureData.CreatureId, ref asset2); AssetDataPlugin.ReadInfo(((object)(*(CreatureDataV3*)(&creatureData))/*cast due to .constrained prefix*/).ToString(), "org.lordashes.plugins.ruleset5e.BonusData"); yield return 0.1f; Instance.LoadDnd5eJson(asset2); yield return 0.1f; if ((Object)(object)asset2 != (Object)null) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"Ruleset5E Plugin: Patch: Triggering LoadDnd5eJson"); } Instance.CustomBColor(asset2, (int)asset2.Hp.Value, (int)asset2.Hp.Max); } } private IEnumerator Executor() { DiceRollManager dm = Object.FindObjectOfType(); UIDiceTray dt = Object.FindObjectOfType(); List damages = new List(); Roll tmp = null; Dictionary hold = null; RollId idLastroll4 = default(RollId); RollId idLastroll = default(RollId); RollId idLastroll3 = default(RollId); while (true) { if (stateMachineState != stateMachineLastState && diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: State = " + stateMachineState)); stateMachineLastState = stateMachineState; } float stepDelay = 0.1f; switch (stateMachineState) { case StateMachineState.attackAttackRangeCheck: { stateMachineState = StateMachineState.attackAttackIntention; if (healSequence) { stateMachineState = StateMachineState.healingRollStart; } secureSuccess = false; halfDamage = false; float reachAdjust = 0.5f; float dist; if (CreatureManager.SnapToGrid) { Vector3 vecresult = ((Component)instigator).transform.position - ((Component)victim).transform.position; dist = 5f * Math.Max(Math.Abs(((Vector3)(ref vecresult))[0]), Math.Max(Math.Abs(((Vector3)(ref vecresult))[1]), Math.Abs(((Vector3)(ref vecresult))[2]))); dist = dist - (((((MovableBoardAsset)instigator).Scale >= 1f) ? ((MovableBoardAsset)instigator).Scale : 1f) - 1f) * 2.5f - (((((MovableBoardAsset)victim).Scale >= 1f) ? ((MovableBoardAsset)victim).Scale : 1f) - 1f) * 2.5f; dist = float.Parse(Math.Round(dist).ToString()); } else { dist = 5f * Vector3.Distance(((Component)instigator).transform.position, ((Component)victim).transform.position); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Attack:" + dist + "|" + instigator.ScaledBaseRadius + "|" + victim.ScaledBaseRadius + "|" + 5f)); } dist -= (instigator.ScaledBaseRadius + victim.ScaledBaseRadius) * 5f - 5f; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Attack: dist : " + dist)); } } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Attack: Ran-+ge=" + dist)); } int attackRange = (((lastRollRequest.type.ToUpper() == "MELEE") & (lastRollRequest.range == "0/0")) ? characters[Utility.GetCharacterName(instigator)].reach : int.Parse(lastRollRequest.range.Split(new char[1] { '/' })[1])); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("distancia:" + dist + "attackrange + adjust:" + ((float)attackRange + reachAdjust) + "atacck range:" + attackRange + "adjust:" + reachAdjust)); } if ((dist > (float)attackRange + reachAdjust) & !(dcAttack & (multiTargetAssets.Count != 0))) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage(Utility.GetCharacterName(instigator) + " cannot reach " + Utility.GetCharacterName(victim) + " at " + dist + "' with " + lastRollRequest.name + " (Range: " + attackRange + "')", 1f)); if ((Object)(object)victim != (Object)null) { victim.SetGlow(false, Color.red); } stateMachineState = StateMachineState.idle; if (multiTargetAssets.Count != 0) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Cannot reach Multi"); } StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); } } else { if (!((lastRollRequest.type.ToUpper() == "RANGE" || lastRollRequest.type.ToUpper() == "RANGED" || lastRollRequest.type.ToUpper() == "MAGIC") & !dcAttack)) { break; } attackRange = int.Parse(lastRollRequest.range.Split(new char[1] { '/' })[0]); if (dist <= (float)attackRange + reachAdjust) { foreach (CreatureBoardAsset asset in (IEnumerable)CreaturePresenter.GetTempReadOnlyViewOfAllCreatureAssets()/*cast due to .constrained prefix*/) { int reach = 5; bool npc = true; if (characters.ContainsKey(Utility.GetCharacterName(asset))) { npc = characters[Utility.GetCharacterName(asset)].NPC; reach = characters[Utility.GetCharacterName(asset)].reach; } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: " + (npc ? "Foe" : "Ally") + " " + Utility.GetCharacterName(asset) + " at " + dist + "' with reach " + reach)); } if (npc && dist < (float)reach + reachAdjust && instigator.CreatureId != asset.CreatureId) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage(Utility.GetCharacterName(instigator) + " is with " + reach + "' reach of " + Utility.GetCharacterName(asset) + ". Disadvantage on ranged attacks.", 1f)); } } } else { ((MonoBehaviour)this).StartCoroutine(DisplayMessage(Utility.GetCharacterName(instigator) + " requires a long range shot (" + attackRange + "'+) to reach of " + Utility.GetCharacterName(victim) + " at " + dist + "'. Disadvantage on ranged attacks.", 1f)); } } break; } case StateMachineState.attackAttackIntention: { stateMachineState = StateMachineState.attackRollSetup; string players; if (oppositeRoll) { instigator.SpeakEx("Opposed check!"); players = "[" + Utility.GetCharacterName(instigator) + "] Opposed check VS " + Utility.GetCharacterName(victim); } else { instigator.SpeakEx("Attack!"); players = "[" + Utility.GetCharacterName(instigator) + "] Attacks " + Utility.GetCharacterName(victim); } string owner = players; string gm = players; chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); for (int r = 0; r < 10; r++) { ((MovableBoardAsset)instigator).RotateTowards(((Component)victim).transform.position); ((MovableBoardAsset)victim).RotateTowards(((Component)instigator).transform.position); yield return (object)new WaitForSeconds(0.01f * processSpeed); } break; } case StateMachineState.attackRollSetup: stateMachineState = StateMachineState.attackAttackDieCreate; RollSetup(dm, ref stepDelay); if (rollingSystem == RollMode.automaticDice) { dolly.transform.position = new Vector3(-100f, 2f, -1.5f); } damageDieMultiplier = 1f; break; case StateMachineState.attackAttackDieCreate: stateMachineState = StateMachineState.attackAttackDieWaitCreate; if (dcAttack) { if (lastRollRequest.roll.Contains("/")) { bool havedata = false; foreach (Roll roll in characters[Utility.GetCharacterName(victim)].saves) { if (roll.name.ToUpper() == lastRollRequest.roll.Split(new char[1] { '/' })[1].ToUpper()) { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(lastRollRequest.name) + ":" + roll.roll, ref stepDelay); havedata = true; break; } } if (!havedata) { foreach (Roll roll2 in characters[Utility.GetCharacterName(victim)].skills) { if (roll2.name.ToUpper().Contains(lastRollRequest.roll.Split(new char[1] { '/' })[1].ToUpper())) { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(lastRollRequest.name) + ":" + roll2.roll, ref stepDelay); havedata = true; break; } } } if (!havedata) { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(lastRollRequest.name) + ":1d20" + checkToMod(lastRollRequest.roll.Split(new char[1] { '/' })[1]), ref stepDelay); SystemMessage.DisplayInfoText("Victim dont have:" + lastRollRequest.roll.Split(new char[1] { '/' })[1].ToString(), 4f, 0f, (Action)null); if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Victim dont have: " + lastRollRequest.roll.Split(new char[1] { '/' })[1].ToString())); } } } else { secureSuccess = true; stateMachineState = StateMachineState.attackAttackBonusDieReaction; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"RuleSet 5E Plugin: Secure Success (DC Attack)"); } } } else if (lastRollRequest.roll.ToUpper().Contains("D")) { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(lastRollRequest.name) + ":" + lastRollRequest.roll, ref stepDelay); } else { secureSuccess = true; stateMachineState = StateMachineState.attackAttackBonusDieReaction; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Secure Success (Attack)"); } } if (rollingSystem.ToString().ToUpper().Contains("MANUAL")) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage("Please Roll Provided Die Or Dice To Continue...", 3f)); } break; case StateMachineState.attackAttackDieRollExecute: stateMachineState = StateMachineState.attackAttackDieWaitRoll; RollExecute(dm, ref stepDelay); break; case StateMachineState.attackAttackBonusDieCreate: if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("Critical Check Stage 1 = " + lastResult["IsMax"])); } stateMachineState = StateMachineState.attackAttackBonusDieReaction; if (dcAttack) { useAttackBonusDie = victim_useSkillBonusDie; amountAttackBonusDie = victim_amountSkillBonusDie; } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: UseAttackBonusDie: " + useAttackBonusDie + " mountAttackBonusDie: " + amountAttackBonusDie.ToString())); } if (!(useAttackBonusDie & (amountAttackBonusDie != ""))) { break; } hold = lastResult; if (amountAttackBonusDie.ToUpper().Contains("D")) { RollId.TryParse(lastRollId.ToString(), ref idLastroll4); dm.RemoveRoll(idLastroll4); stateMachineState = StateMachineState.attackAttackBonusDieWaitCreate; RollCreate(dt, "talespire://dice/" + SafeForProtocolName("Bonus Die") + ":" + amountAttackBonusDie, ref stepDelay); if (rollingSystem.ToString().ToUpper().Contains("MANUAL")) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage("Please Roll Provided Die Or Dice To Continue...", 3f)); } } else { lastResult = ResolveRoll(amountAttackBonusDie); } break; case StateMachineState.attackAttackBonusDieRollExecute: stateMachineState = StateMachineState.attackAttackBonusDieWaitRoll; RollExecute(dm, ref stepDelay); break; case StateMachineState.attackAttackBonusDieReaction: stateMachineState = StateMachineState.attackAttackDieRollReport; if (secureSuccess) { stateMachineState = StateMachineState.attackAttackHitReport; } RollId.TryParse(lastRollId.ToString(), ref idLastroll); dm.RemoveRoll(idLastroll); if (useAttackBonusDie & (amountAttackBonusDie != "") & !secureSuccess) { if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"Adding Bonus Die"); } hold["Total"] = (int)hold["Total"] + (int)lastResult["Total"]; if ("-".Contains(lastResult["Expanded"].ToString().Substring(0, 1))) { hold["Expanded"] = hold["Expanded"]?.ToString() + lastResult["Expanded"].ToString(); } else { hold["Expanded"] = hold["Expanded"]?.ToString() + "+" + lastResult["Expanded"].ToString(); } hold["Roll"] = hold["Roll"]?.ToString() + ("+-".Contains(lastResult["Roll"].ToString().Substring(0, 1)) ? lastResult["Roll"].ToString() : ("+" + lastResult["Roll"].ToString())); lastResult = hold; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"Bonus Die Added"); } } criticalImmunity = false; if (!secureSuccess && ((bool)lastResult["IsMax"] & characters[Utility.GetCharacterName(victim)].immunity.Contains("critical"))) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Critical immunity "); } criticalImmunity = true; lastResult["IsMax"] = false; } if (reactionStop) { stateMachineState = StateMachineState.attackAttackBonusDieReactionWait; reactionStopContinue = true; if (secureSuccess) { reactionRollTotal = "Automatic Success"; } else if (dcAttack) { reactionRollTotal = lastResult["Expanded"].ToString() + " = " + lastResult["Total"].ToString() + " VS DC:" + lastRollRequest.roll.Split(new char[1] { '/' })[0]; } else { reactionRollTotal = lastResult["Expanded"].ToString() + " = " + lastResult["Total"].ToString() + " VS AC"; } } break; case StateMachineState.attackAttackDieRollReport: { stateMachineState = StateMachineState.attackAttackDefenceCheck; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("Critical Check State 2 = " + lastResult["IsMax"])); } if (!dcAttack) { int dieresult = int.Parse(lastResult["Expanded"].ToString().Substring(lastResult["Expanded"].ToString().IndexOf("[") + 1, lastResult["Expanded"].ToString().IndexOf("]") - 1).Split(new char[1] { ',' })[0]); if (totalAdv || totalDis) { if (totalAdv & (int.Parse(lastResult["Expanded"].ToString().Substring(lastResult["Expanded"].ToString().IndexOf("[") + 1, lastResult["Expanded"].ToString().IndexOf("]") - 1).Split(new char[1] { ',' })[1]) > dieresult)) { dieresult = int.Parse(lastResult["Expanded"].ToString().Substring(lastResult["Expanded"].ToString().IndexOf("[") + 1, lastResult["Expanded"].ToString().IndexOf("]") - 1).Split(new char[1] { ',' })[1]); } if (totalDis & (int.Parse(lastResult["Expanded"].ToString().Substring(lastResult["Expanded"].ToString().IndexOf("[") + 1, lastResult["Expanded"].ToString().IndexOf("]") - 1).Split(new char[1] { ',' })[1]) < dieresult)) { dieresult = int.Parse(lastResult["Expanded"].ToString().Substring(lastResult["Expanded"].ToString().IndexOf("[") + 1, lastResult["Expanded"].ToString().IndexOf("]") - 1).Split(new char[1] { ',' })[1]); } } if (dieresult >= int.Parse(lastRollRequest.critrangemin)) { lastResult["IsMax"] = true; if (characters[Utility.GetCharacterName(victim)].immunity.Contains("critical")) { criticalImmunity = true; lastResult["IsMax"] = false; } } } else { lastResult["IsMax"] = false; lastResult["IsMin"] = false; } if ((bool)lastResult["IsMax"]) { if (criticalImmunity) { instigator.SpeakEx(lastRollRequest.name + " " + lastResult["Total"]?.ToString() + " (Critical Immunity)"); } else { instigator.SpeakEx(lastRollRequest.name + " " + lastResult["Total"]?.ToString() + " (Critical Hit)"); } } else if ((bool)lastResult["IsMin"]) { instigator.SpeakEx(lastRollRequest.name + " " + lastResult["Total"]?.ToString() + " (Critical Miss)"); } else if (dcAttack) { if (oppositeRoll) { victim.SpeakEx("Opposed check (" + lastRollRequest.roll.Split(new char[1] { '/' })[1].ToString() + "): " + lastResult["Total"]); } else { victim.SpeakEx("Save (" + lastRollRequest.roll.Split(new char[1] { '/' })[1].ToString() + "): " + lastResult["Total"]); } } else { instigator.SpeakEx(lastRollRequest.name + " " + lastResult["Total"]); } string players; if (dcAttack) { players = "[" + Utility.GetCharacterName(victim) + "]"; players = ((!oppositeRoll) ? (players + "Save (" + lastRollRequest.roll.Split(new char[1] { '/' })[1].ToString() + "): " + lastResult["Total"]?.ToString() + " VS DC (" + lastRollRequest.name + ")\r\n") : (players + "Opposed check (" + lastRollRequest.roll.Split(new char[1] { '/' })[1].ToString() + "): " + lastResult["Total"]?.ToString() + "\r\n")); } else { players = "[" + Utility.GetCharacterName(instigator) + "]"; players = players + "Attack: " + lastResult["Total"]?.ToString() + " VS AC (" + lastRollRequest.name + ")\r\n"; } string owner = players; owner = owner + "" + lastResult["Roll"]?.ToString() + " = "; owner = owner + "" + lastResult["Expanded"]; if ((bool)lastResult["IsMax"]) { owner += " (Critical Hit)"; } else if (criticalImmunity) { owner += " (Critical Hit) [Critical Immunity]"; } else if ((bool)lastResult["IsMin"]) { owner += " (Critical Miss)"; } string gm = owner; if (dcAttack) { chatManager.SendChatMessageEx(players, owner, gm, victim.CreatureId, LocalClient.Id.Value); } else { chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); } stepDelay = 1f; break; } case StateMachineState.attackAttackDefenceCheck: { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("Getting Total from '" + lastResult["Total"]?.ToString() + "'")); } int attack = (int)lastResult["Total"]; int ac = int.Parse(characters[Utility.GetCharacterName(victim)].ac) + ((victim_amountACBonusDie != "") ? int.Parse(victim_amountACBonusDie) : 0); if (dcAttack) { ac = int.Parse(lastRollRequest.roll.Split(new char[1] { '/' })[0]); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("Getting Min from '" + lastResult["IsMin"]?.ToString() + "'")); } if (((attack < ac) & !(bool)lastResult["IsMax"] & !dcAttack) || (bool)lastResult["IsMin"] || (dcAttack && attack >= ac)) { stateMachineState = StateMachineState.attackAttackMissReport; if ((dcAttack & lastRollRequest.roll.Contains("/")) && lastRollRequest.roll.Split(new char[1] { '/' })[2].ToUpper() == "HALF") { halfDamage = true; stateMachineState = StateMachineState.attackAttackHitReport; } } else { stateMachineState = StateMachineState.attackAttackHitReport; } stepDelay = 0f; break; } case StateMachineState.attackAttackMissReport: stateMachineState = StateMachineState.attackRollCleanup; victim.StartTargetEmote(instigator, missAnimation); if (dcAttack) { if (oppositeRoll) { instigator.Speak("Fail!"); } else { victim.Speak("Save!"); } } else { victim.SpeakEx("Miss!"); } if (secureSuccess) { string players = "[" + Utility.GetCharacterName(victim) + "]Evades attack\r\n"; string gm = players; string owner = players; chatManager.SendChatMessageEx(players, owner, gm, victim.CreatureId, LocalClient.Id.Value); } else if (dcAttack) { string players; string gm; if (oppositeRoll) { players = "[" + Utility.GetCharacterName(instigator) + "]Fail opposed check\r\n"; gm = players + "" + lastRollRequest.roll.Split(new char[1] { '/' })[0] + " (" + oppositeRollvalue.roll.Split(new char[1] { '/' })[0] + ") vs " + lastResult["Total"]?.ToString() + " (" + lastRollRequest.roll.Split(new char[1] { '/' })[1] + ")"; } else { players = "[" + Utility.GetCharacterName(victim) + "]Successfull saving throw\r\n"; gm = players + "" + lastResult["Total"]?.ToString() + " (" + lastRollRequest.roll.Split(new char[1] { '/' })[1] + ") vs DC " + lastRollRequest.roll.Split(new char[1] { '/' })[0]; } string owner = gm; chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); } else { string players = "[" + Utility.GetCharacterName(victim) + "]Evades attack\r\n"; string gm = players + "" + lastResult["Total"]?.ToString() + " vs AC " + (int.Parse(characters[Utility.GetCharacterName(victim)].ac) + ((victim_amountACBonusDie != "") ? int.Parse(victim_amountACBonusDie) : 0)); string owner = gm; chatManager.SendChatMessageEx(players, owner, gm, victim.CreatureId, LocalClient.Id.Value); } if (!secureSuccess & dcAttack & (multiTargetAssets.Count != 0)) { if (multiTargetAssets.Count != MultitargetAssetsIndex) { stateMachineState = StateMachineState.idle; victim.SetGlow(false, Color.red); RollCleanup(dm, ref stepDelay); StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); } else { stateMachineState = StateMachineState.attackDamageDieCreate; } } break; case StateMachineState.attackAttackHitReport: stateMachineState = StateMachineState.attackDamageDieCreate; if (lastRollRequest.info != "") { instigator.StartTargetEmote(victim, lastRollRequest.info); } else { switch (lastRollRequest.type.ToUpper()) { case "MAGIC": instigator.StartTargetEmote(victim, "TLA_MagicMissileAttack"); break; case "RANGE": case "RANGED": instigator.StartTargetEmote(victim, "TLA_LaserRed"); break; default: instigator.StartTargetEmote(victim, "TLA_MeleeAttack"); break; } } if (shakeonhit) { TS_CameraShaker.CallShakeWithNoise(0.25f, 5f, Vector3.up, 1f); } if (dcAttack) { if (oppositeRoll) { if (halfDamage) { instigator.Speak("Fail!"); } else { instigator.Speak("Success!"); } } else if (halfDamage) { victim.Speak("Save!"); } else { victim.Speak("Fail!"); } } else { victim.SpeakEx("Hit!"); } if (secureSuccess) { string players = "[" + Utility.GetCharacterName(instigator) + "]Hits " + Utility.GetCharacterName(victim) + "\r\n"; string gm = players + "Automatic Success"; string owner = gm; chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); } else if (dcAttack) { string players; string gm; if (oppositeRoll) { players = "[" + Utility.GetCharacterName(instigator) + "]Successfull opposed check\r\n"; if (halfDamage) { players = "[" + Utility.GetCharacterName(instigator) + "]Failed opposed check\r\n"; } gm = players + "" + lastRollRequest.roll.Split(new char[1] { '/' })[0] + " (" + oppositeRollvalue.roll.Split(new char[1] { '/' })[0] + ") vs " + lastResult["Total"]?.ToString() + " (" + lastRollRequest.roll.Split(new char[1] { '/' })[1] + ")"; } else { players = "[" + Utility.GetCharacterName(victim) + "]Failed saving throw\r\n"; if (halfDamage) { players = "[" + Utility.GetCharacterName(victim) + "]Successfull saving throw\r\n"; } gm = players + "" + lastResult["Total"]?.ToString() + " (" + lastRollRequest.roll.Split(new char[1] { '/' })[1] + ") vs DC " + lastRollRequest.roll.Split(new char[1] { '/' })[0]; } if (halfDamage) { gm = ((!oppositeRoll) ? (gm + " (On save: half damage)") : (gm + " (On success: half damage)")); } string owner = gm; chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); } else { string players = "[" + Utility.GetCharacterName(instigator) + "]Hits " + Utility.GetCharacterName(victim) + "\r\n"; string gm = players + "" + lastResult["Total"]?.ToString() + " vs AC " + (int.Parse(characters[Utility.GetCharacterName(victim)].ac) + ((victim_amountACBonusDie != "") ? int.Parse(victim_amountACBonusDie) : 0)); string owner = gm; chatManager.SendChatMessageEx(players, owner, gm, victim.CreatureId, LocalClient.Id.Value); } firstWithDamageBonus = true; tmp = lastRollRequest.link; damages.Clear(); if (!secureSuccess) { if ((bool)lastResult["IsMax"]) { damageDieMultiplier = float.Parse(lastRollRequest.critmultip); } else { damageDieMultiplier = 1f; } } if (!secureSuccess & dcAttack & (multiTargetAssets.Count != 0)) { MultiDCAttackData multiDCAttackData = new MultiDCAttackData { mVcitim = victim, mHalfDamage = halfDamage, mReactionHalve = reactionHalve }; multiDCAttackDataList.Add(multiDCAttackData); if (multiTargetAssets.Count != MultitargetAssetsIndex) { stateMachineState = StateMachineState.idle; victim.SetGlow(false, Color.red); RollCleanup(dm, ref stepDelay); StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); } } stepDelay = 1f; break; case StateMachineState.attackDamageDieCreate: try { if (tmp != null) { lastRollRequest = tmp; if (rollingSystem == RollMode.automaticDice && tmp.roll.ToUpper().Contains("D")) { if (int.Parse(tmp.roll.Substring(0, tmp.roll.ToUpper().IndexOf("D"))) > 3) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Adjusting Dolly And Camera For Large Dice Count"); } dolly.transform.position = new Vector3(-100f, 4f, -3f); } else { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Adjusting Dolly And Camera For Small Dice Count"); } dolly.transform.position = new Vector3(-100f, 2f, -1.5f); } } stateMachineState = StateMachineState.attackDamageDieWaitCreate; int posIni = 0; while (tmp.roll.Substring(posIni, tmp.roll.Length - posIni).ToUpper().Contains("D")) { int Pos = posIni + tmp.roll.Substring(posIni, tmp.roll.Length - posIni).ToUpper().IndexOf("D"); int sPos = Pos; while ("0123456789".Contains(tmp.roll.Substring(sPos - 1, 1))) { sPos--; if (sPos == 0) { break; } } if (sPos > 0) { tmp.roll = tmp.roll.Substring(0, sPos) + (float)int.Parse(tmp.roll.Substring(sPos, Pos - sPos)) * damageDieMultiplier + tmp.roll.Substring(Pos, tmp.roll.Length - Pos); } else { tmp.roll = (float)int.Parse(tmp.roll.Substring(sPos, Pos - sPos)) * damageDieMultiplier + tmp.roll.Substring(Pos, tmp.roll.Length - Pos); } posIni = posIni + tmp.roll.Substring(posIni, tmp.roll.Length - posIni).ToUpper().IndexOf("D") + 1; } if (useDamageBonusDie & firstWithDamageBonus & (tmp.roll != "0")) { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(tmp.name) + ":" + tmp.roll + ("+-".Contains(amountDamageBonusDie.Substring(0, 1)) ? amountDamageBonusDie : ("+" + amountDamageBonusDie)), ref stepDelay); firstWithDamageBonus = false; } else { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(tmp.name) + ":" + tmp.roll, ref stepDelay); } } else { stateMachineState = StateMachineState.attackDamageDieDamageReport; } } catch (Exception ex) { Exception e = ex; stateMachineState = StateMachineState.attackRollCleanup; Debug.LogWarning((object)("RuleSet 5E Plugin:!Critical error:[ " + e.Message + " ]!")); } break; case StateMachineState.attackDamageDieRollExecute: stateMachineState = StateMachineState.attackDamageDieWaitRoll; dt.SpawnAt(Vector3.zero, Vector3.zero); RollExecute(dm, ref stepDelay); if (rollingSystem.ToString().ToUpper().Contains("MANUAL")) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage("Please Roll Provided Die Or Dice To Continue...", 3f)); } break; case StateMachineState.attackDamageDieRollReport: RollId.TryParse(lastRollId.ToString(), ref idLastroll); dm.RemoveRoll(idLastroll); stateMachineState = StateMachineState.attackDamageDieCreate; if ((int)lastResult["Total"] < 0) { lastResult["Total"] = 0; } if (int.Parse(lastResult["Total"].ToString()) == 0) { instigator.SpeakEx(lastRollRequest.name + ":\r\nNo damage"); damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastResult["Roll"].ToString(), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } else if (lastRollRequest.roll != "") { instigator.SpeakEx(lastRollRequest.name + ":\r\n" + lastResult["Total"]?.ToString() + " " + lastRollRequest.type); if (useDamageBonusDie & (damages.Count == 0)) { damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastResult["Roll"].ToString(), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } else { damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastResult["Roll"].ToString(), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } } else { instigator.SpeakEx(lastRollRequest.name + ":\r\n" + lastRollRequest.type); damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastResult["Roll"].ToString(), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } stepDelay = 1f; tmp = tmp.link; break; case StateMachineState.attackDamageDieDamageReport: { stateMachineState = StateMachineState.attackDamageDieDamageTake; int total = 0; string info = ""; foreach (Damage dmg4 in damages) { total += dmg4.total; if (dmg4.roll != "0") { info = info + dmg4.total + " " + dmg4.type + " (" + dmg4.name + ") " + dmg4.roll + " = " + dmg4.expansion + "\r\n"; } } string players; string owner; string gm; if (total == 0) { players = "[" + Utility.GetCharacterName(instigator) + "]No damage "; owner = players + "\r\n" + info; gm = owner; chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); stateMachineState = StateMachineState.attackRollCleanup; break; } if (damages.Count > 1) { yield return (object)new WaitForSeconds(0.5f * processSpeed); instigator.SpeakEx("Total Damage: " + total); } players = "[" + Utility.GetCharacterName(instigator) + "]Attack damage: " + total + ""; owner = players + "\r\n" + info; gm = owner; chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); break; } case StateMachineState.attackDamageDieDamageTake: stateMachineState = StateMachineState.attackRollCleanup; if (secureSuccess || !dcAttack || multiTargetAssets.Count == 0) { MultiDCAttackData multiDCAttackData2 = new MultiDCAttackData { mVcitim = victim, mHalfDamage = halfDamage, mReactionHalve = reactionHalve }; multiDCAttackDataList.Add(multiDCAttackData2); } foreach (MultiDCAttackData tempmultiDcattackData in multiDCAttackDataList) { victim = tempmultiDcattackData.mVcitim; halfDamage = tempmultiDcattackData.mHalfDamage; reactionHalve = tempmultiDcattackData.mReactionHalve; bool fullDamage = true; int adjustedDamage = 0; string damageList = ""; string damageListVictim = ""; foreach (Damage dmg3 in damages) { int tempTotal = dmg3.total; string tempType = dmg3.type; string tempExpansion = dmg3.expansion; if (halfDamage) { tempTotal /= 2; tempExpansion += " (Miss: Half Damage)"; } if (reactionHalve) { tempTotal /= 2; fullDamage = false; } if (characters.ContainsKey(Utility.GetCharacterName(victim))) { foreach (string immunity in characters[Utility.GetCharacterName(victim)].immunity) { if (tempType == immunity) { tempTotal = 0; tempType += ":Immunity"; fullDamage = false; } } foreach (string resisitance in characters[Utility.GetCharacterName(victim)].resistance) { if (tempType == resisitance) { tempTotal /= 2; tempType += ":Resistance"; fullDamage = false; } } foreach (string vulnerability in characters[Utility.GetCharacterName(victim)].vulnerability) { if (tempType == vulnerability) { tempTotal *= 2; tempType += ":Vulnerability"; fullDamage = true; } } } adjustedDamage += tempTotal; if (reactionHalve) { tempType += " [Halve]"; } damageList = damageList + tempTotal + " " + tempType + " (" + dmg3.name + ") " + dmg3.roll + " = " + tempExpansion + "\r\n"; damageListVictim = damageListVictim + tempTotal + " " + tempType + " (" + dmg3.name + ") \r\n"; } reactionHalve = false; int adjustHPBonus = adjustedDamage; pauseRender = true; string json = AssetDataPlugin.ReadInfo(((object)victim.CreatureId/*cast due to .constrained prefix*/).ToString(), "org.lordashes.plugins.ruleset5e.BonusData"); IdBonus idbonus = new IdBonus(); if (json != null) { idbonus = JsonConvert.DeserializeObject(json); } if (idbonus._amountHPBonus != "") { adjustHPBonus = Math.Max(adjustHPBonus - int.Parse(idbonus._amountHPBonus), 0); string returnHPBonus = Math.Max(int.Parse(idbonus._amountHPBonus) - adjustedDamage, 0).ToString(); idbonus._amountHPBonus = returnHPBonus.ToString(); AssetDataPlugin.SetInfo(((object)victim.CreatureId/*cast due to .constrained prefix*/).ToString(), "org.lordashes.plugins.ruleset5e.BonusData", (object)idbonus, false); } pauseRender = false; int hp = Math.Max((int)(victim.Hp.Value - (float)adjustHPBonus), 0); int hpMax = (int)victim.Hp.Max; CreatureManager.SetCreatureStatByIndex(victim.CreatureId, new CreatureStat((float)hp, (float)hpMax), -1); damageList = "Damage: " + adjustedDamage + "\r\n" + damageList; string players; string gm; string owner; if (adjustedDamage == 0 && fullDamage) { victim.SpeakEx("Your attempts are futile!"); _ = "\r\n" + damageList; players = "[" + Utility.GetCharacterName(victim) + "]Takes no damage\r\n"; owner = players + ""; gm = players + ""; } else if (!fullDamage) { if (hp > 0) { victim.SpeakEx("I resist your efforts!"); } else { victim.SpeakEx("I resist your efforts\r\nbut I am slain!"); if (deadAnimation.ToUpper() != "REMOVE") { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Playing Death Animation '" + deadAnimation + "'")); } victim.StartTargetEmote(instigator, deadAnimation); } else { yield return (object)new WaitForSeconds(1f); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Requesting Mini Remove"); } victim.RequestDelete(); } } players = ((adjustedDamage != 0) ? ("[" + Utility.GetCharacterName(victim) + "]Takes some damage\r\n") : ("[" + Utility.GetCharacterName(victim) + "]Takes no damage\r\n")); owner = players + "" + damageListVictim; gm = players + "" + damageList; } else { if (hp > 0) { victim.SpeakEx("Ouch!"); } else { victim.SpeakEx("I am slain!"); if (deadAnimation.ToUpper() != "REMOVE") { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Playing Death Animation '" + deadAnimation + "'")); } victim.StartTargetEmote(instigator, deadAnimation); } else { yield return (object)new WaitForSeconds(1f); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Requesting Mini Remove"); } victim.RequestDelete(); } } players = "[" + Utility.GetCharacterName(victim) + "]Takes the damage\r\n"; owner = players + "" + damageListVictim; gm = players + "" + damageList; } gm = gm + "\r\nRemaining HP: " + hp + " of " + hpMax; owner = owner + "\r\nRemaining HP: " + hp + " of " + hpMax; if (adjustHPBonus != adjustedDamage) { gm = gm + " (" + (adjustedDamage - adjustHPBonus) + " temp. HP less)"; owner = owner + " (" + (adjustedDamage - adjustHPBonus) + " temp. HP less)"; } CreatureManager.SetCreatureStatByIndex(victim.CreatureId, new CreatureStat((float)hp, (float)hpMax), -1); chatManager.SendChatMessageEx(players, owner, gm, victim.CreatureId, LocalClient.Id.Value); if (halfDamage) { halfDamage = false; } } break; case StateMachineState.attackRollCleanup: stateMachineState = StateMachineState.idle; RollCleanup(dm, ref stepDelay); multiDCAttackDataList.Clear(); if ((Object)(object)victim != (Object)null) { victim.SetGlow(false, Color.red); } if (multiTargetAssets.Count != 0) { StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); } oppositeRoll = false; break; case StateMachineState.skillRollSetup: stateMachineState = StateMachineState.skillRollDieCreate; RollSetup(dm, ref stepDelay); if (rollingSystem == RollMode.automaticDice) { dolly.transform.position = new Vector3(-100f, 2f, -1.5f); } damageDieMultiplier = 1f; break; case StateMachineState.skillRollDieCreate: stateMachineState = StateMachineState.skillRollDieWaitCreate; RollCreate(dt, "talespire://dice/" + SafeForProtocolName(lastRollRequest.name) + ":" + lastRollRequest.roll, ref stepDelay); if (rollingSystem.ToString().ToUpper().Contains("MANUAL")) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage("Please Roll Provided Die Or Dice To Continue...", 3f)); } break; case StateMachineState.skillRollDieRollExecute: stateMachineState = StateMachineState.skillRollDieWaitRoll; RollExecute(dm, ref stepDelay); break; case StateMachineState.skillBonusRollDieCreate: stateMachineState = StateMachineState.skillRollDieRollReport; if (useSkillBonusDie & (amountSkillBonusDie != "")) { stateMachineState = StateMachineState.skillBonusRollDieWaitCreate; hold = lastResult; RollId.TryParse(lastRollId.ToString(), ref idLastroll); dm.RemoveRoll(idLastroll); RollCreate(dt, "talespire://dice/" + SafeForProtocolName("Bonus Die") + ":" + amountSkillBonusDie, ref stepDelay); if (rollingSystem.ToString().ToUpper().Contains("MANUAL")) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage("Please Roll Provided Die Or Dice To Continue...", 3f)); } } break; case StateMachineState.skillBonusRollDieRollExecute: stateMachineState = StateMachineState.skillBonusRollDieWaitRoll; RollExecute(dm, ref stepDelay); break; case StateMachineState.skillRollDieRollReport: { stateMachineState = StateMachineState.skillRollCleanup; RollId.TryParse(lastRollId.ToString(), ref idLastroll3); dm.RemoveRoll(idLastroll3); if (useSkillBonusDie & (amountSkillBonusDie != "")) { hold["Total"] = (int)hold["Total"] + (int)lastResult["Total"]; if ("-".Contains(lastResult["Expanded"].ToString().Substring(0, 1))) { hold["Expanded"] = hold["Expanded"]?.ToString() + lastResult["Expanded"].ToString(); } else { hold["Expanded"] = hold["Expanded"]?.ToString() + "+" + lastResult["Expanded"].ToString(); } hold["Roll"] = hold["Roll"]?.ToString() + ("+-".Contains(lastResult["Roll"].ToString().Substring(0, 1)) ? lastResult["Roll"].ToString() : ("+" + lastResult["Roll"].ToString())); lastResult = hold; } string players = ((!(lastRollRequest.roll != "")) ? ("[" + Utility.GetCharacterName(instigator) + "]" + lastRollRequest.name + "\r\n") : ("[" + Utility.GetCharacterName(instigator) + "]" + lastRollRequest.name + ": " + lastResult["Total"]?.ToString() + "\r\n")); string owner = players; owner = owner + "" + lastResult["Roll"]?.ToString() + " = "; owner = owner + "" + lastResult["Expanded"]; if (lastRollRequest.roll != "") { if ((bool)lastResult["IsMax"]) { owner += " (Max)"; } else if ((bool)lastResult["IsMin"]) { owner += " (Min)"; } } string gm = owner; if (lastRollRequest.type.ToUpper().Contains("SECRET")) { players = null; } else if (lastRollRequest.type.ToUpper().Contains("PRIVATE")) { instigator.SpeakEx(lastRollRequest.name); players = "[" + Utility.GetCharacterName(instigator) + "]" + lastRollRequest.name + "\r\n"; } else { instigator.SpeakEx(lastRollRequest.name + " " + lastResult["Total"]); } if (lastRollRequest.type.ToUpper().Contains("GM")) { players = null; owner = null; } chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); stepDelay = 1f; break; } case StateMachineState.skillRollCleanup: stateMachineState = StateMachineState.skillRollMore; RollCleanup(dm, ref stepDelay); break; case StateMachineState.skillRollMore: stateMachineState = StateMachineState.idle; victim.SetGlow(false, Color.green); if (oppositeRoll) { Roll tempSendRoll = new Roll(oppositeRollvalue); tempSendRoll.roll = lastResult["Total"].ToString() + "/" + tempSendRoll.roll.Split(new char[1] { '/' })[1] + "/" + tempSendRoll.roll.Split(new char[1] { '/' })[2]; if (multiTargetAssets.Count > 0) { multiRoll = tempSendRoll; } AttackDC(tempSendRoll, instigator.CreatureId, null, null); } else if (lastRollRequest.link != null) { lastRollRequest = lastRollRequest.link; stateMachineState = StateMachineState.skillRollSetup; } break; case StateMachineState.healingRollStart: RollSetup(dm, ref stepDelay); if (rollingSystem == RollMode.automaticDice) { dolly.transform.position = new Vector3(-100f, 2f, -1.5f); } damageDieMultiplier = 1f; tmp = lastRollRequest; firstWithDamageBonus = true; damages.Clear(); stepDelay = 1f; stateMachineState = StateMachineState.healingRollDieCreate; break; case StateMachineState.healingRollDieCreate: if (tmp != null) { lastRollRequest = tmp; if (rollingSystem == RollMode.automaticDice && tmp.roll.ToUpper().Contains("D")) { if (int.Parse(tmp.roll.Substring(0, tmp.roll.ToUpper().IndexOf("D"))) > 3) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Adjusting Dolly And Camera For Large Dice Count"); } dolly.transform.position = new Vector3(-100f, 4f, -3f); } else { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Adjusting Dolly And Camera For Small Dice Count"); } dolly.transform.position = new Vector3(-100f, 2f, -1.5f); } } stateMachineState = StateMachineState.healingRollDieWaitCreate; if (useDamageBonusDie & firstWithDamageBonus) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: First Heal Link"); } RollCreate(dt, "talespire://dice/" + SafeForProtocolName(tmp.name) + ":" + tmp.roll + ("+-".Contains(amountDamageBonusDie.Substring(0, 1)) ? amountDamageBonusDie : ("+" + amountDamageBonusDie)), ref stepDelay); firstWithDamageBonus = false; } else { RollCreate(dt, "talespire://dice/" + SafeForProtocolName(tmp.name) + ":" + tmp.roll, ref stepDelay); } } else { stateMachineState = StateMachineState.healingRollDieValueReport; } break; case StateMachineState.healingRollDieRollExecute: stateMachineState = StateMachineState.healingRollDieWaitRoll; dt.SpawnAt(Vector3.zero, Vector3.zero); RollExecute(dm, ref stepDelay); if (rollingSystem.ToString().ToUpper().Contains("MANUAL")) { ((MonoBehaviour)this).StartCoroutine(DisplayMessage("Please Roll Provided Die Or Dice To Continue...", 3f)); } break; case StateMachineState.healingRollDieRollReport: RollId.TryParse(lastRollId.ToString(), ref idLastroll); dm.RemoveRoll(idLastroll); stateMachineState = StateMachineState.healingRollDieCreate; if (lastRollRequest.roll != "") { instigator.SpeakEx(lastRollRequest.name + ":\r\n" + lastResult["Total"]); if (useDamageBonusDie & (damages.Count == 0)) { damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastRollRequest.roll + ("+-".Contains(amountDamageBonusDie.Substring(0, 1)) ? amountDamageBonusDie : ("+" + amountDamageBonusDie)), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } else { damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastResult["Roll"].ToString(), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } } else { instigator.SpeakEx(lastRollRequest.name + ":\r\n" + lastRollRequest.type); damages.Add(new Damage(lastRollRequest.name, lastRollRequest.type, lastResult["Roll"].ToString(), lastResult["Expanded"].ToString(), (int)lastResult["Total"])); } stepDelay = 1f; tmp = tmp.link; break; case StateMachineState.healingRollDieValueReport: { stateMachineState = StateMachineState.healingRollDieValueTake; int total = 0; string info = ""; foreach (Damage dmg2 in damages) { total += dmg2.total; info = info + dmg2.total + " " + dmg2.type + " (" + dmg2.name + ") " + dmg2.roll + " = " + dmg2.expansion + "\r\n"; } string players = "[" + Utility.GetCharacterName(instigator) + "]Heal " + Utility.GetCharacterName(victim) + " " + total + " hp"; string owner = players + "\r\n" + info; string gm = owner; if (damages.Count > 1) { instigator.SpeakEx("Total Healing " + total); } chatManager.SendChatMessageEx(players, owner, gm, instigator.CreatureId, LocalClient.Id.Value); break; } case StateMachineState.healingRollDieValueTake: { stateMachineState = StateMachineState.attackRollCleanup; int adjustedHealing = 0; string healingList = ""; if (characters.ContainsKey(Utility.GetCharacterName(victim))) { foreach (Damage dmg in damages) { adjustedHealing += dmg.total; healingList = healingList + dmg.total + " " + dmg.type + " (" + dmg.name + ") " + dmg.roll + " = " + dmg.expansion + "\r\n"; } } int hp = Math.Min((int)(victim.Hp.Value + (float)adjustedHealing), (int)victim.Hp.Max); int hpMax = (int)victim.Hp.Max; CreatureManager.SetCreatureStatByIndex(victim.CreatureId, new CreatureStat((float)hp, (float)hpMax), -1); _ = "Healing: " + adjustedHealing + "\r\n" + healingList; string players = "[" + Utility.GetCharacterName(victim) + "]Regain " + adjustedHealing + " hp"; string owner = players + "\r\nCurrent HP: " + hp + " of " + hpMax; string gm = players; SpeakExtensions.SendChatMessageEx(gmMessage: gm + "\r\nCurrent HP: " + hp + " of " + hpMax, chatManager: chatManager, playersMessage: null, ownerMessage: owner, subject: victim.CreatureId, speaker: LocalClient.Id.Value); break; } case StateMachineState.healingRollCleanup: stateMachineState = StateMachineState.idle; victim.SetGlow(false, Color.green); RollCleanup(dm, ref stepDelay); if (multiTargetAssets.Count != 0) { StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); } break; } yield return (object)new WaitForSeconds(stepDelay * processSpeed); } } public void CustomBColor(CreatureBoardAsset sujeto, int hp, int hpMax) { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_019b: 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_0179: 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_011a: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) try { if (!changeBaseColors || !(changeBaseColors & characters.ContainsKey(Utility.GetCharacterName(sujeto)))) { return; } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: CustomBColor: " + sujeto.Name.ToString())); } if (!((npcColors.Length == 3) & (pcColors.Length == 3)) || !characters.ContainsKey(Utility.GetCharacterName(sujeto.Name))) { return; } if (characters[Utility.GetCharacterName(sujeto)].NPC) { if (hp <= hpMax / 2) { CreatureManager.SetBaseColorIndex(sujeto.CreatureId, new CreatureColorIndex(ushort.Parse(npcColors[2]))); } else if (hp < hpMax) { CreatureManager.SetBaseColorIndex(sujeto.CreatureId, new CreatureColorIndex(ushort.Parse(npcColors[1]))); } else { CreatureManager.SetBaseColorIndex(sujeto.CreatureId, new CreatureColorIndex(ushort.Parse(npcColors[0]))); } } else if (hp <= hpMax / 2) { CreatureManager.SetBaseColorIndex(sujeto.CreatureId, new CreatureColorIndex(ushort.Parse(pcColors[2]))); } else if (hp < hpMax) { CreatureManager.SetBaseColorIndex(sujeto.CreatureId, new CreatureColorIndex(ushort.Parse(pcColors[1]))); } else { CreatureManager.SetBaseColorIndex(sujeto.CreatureId, new CreatureColorIndex(ushort.Parse(pcColors[0]))); } } catch (Exception ex) { Debug.LogWarning((object)("RuleSet 5E Plugin:!Error CustomBColor: " + ex.ToString())); } } public void RollSetup(DiceRollManager dm, ref float stepDelay) { //IL_003b: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) switch (rollingSystem) { case RollMode.manual: break; case RollMode.manual_side: { Utility.DisableProcessing(setting: true); Vector3 position = ((Component)Camera.main).transform.position; Quaternion rotation = ((Component)Camera.main).transform.rotation; saveCamera = new Existence(position, ((Quaternion)(ref rotation)).eulerAngles); break; } case RollMode.automaticDice: if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Creating Dolly And Camera"); } dolly = new GameObject(); ((Object)dolly).name = "dolly"; camera = dolly.AddComponent(); dolly.transform.position = diceSideExistance.position; ((Component)camera).transform.rotation = Quaternion.Euler(diceSideExistance.rotation); camera.targetTexture = auxCameraTexture; stepDelay = 0.1f; break; case RollMode.automaticGenerator: stepDelay = 0f; break; } } public void RollCreate(UIDiceTray dt, string old_formula, ref float stepDelay) { //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("formula before " + old_formula)); } old_formula = old_formula.Replace("talespire://dice/", "talespire://dice/XRuleset5e"); string text = old_formula.Substring(0, old_formula.LastIndexOf(":") + 1); int num = 0; old_formula = old_formula.Replace("+", "|+").Replace("-", "|-"); string text2 = string.Empty; string[] array = old_formula.Substring(old_formula.LastIndexOf(":") + 1).Replace(" ", "").Split(new char[1] { '|' }); foreach (string text3 in array) { if (text3.ToUpper().Contains("D")) { if (text3.Substring(0, 1) == "-") { text2 += text3; } else { text = ((!((rollingSystem != RollMode.automaticGenerator) & text3.ToUpper().Contains("1D20") & ((dcAttack & (victim_totalAdv | victim_totalDis)) | (!dcAttack & (totalAdv | totalDis))))) ? (text + text3) : (text + text3.ToUpper().Replace("1D20", "2D20"))); } } else if (text3 != "") { num = ("-".Contains(text3.Substring(0, 1)) ? (num - int.Parse(text3.Substring(1))) : (num + int.Parse(text3.Replace("+", "")))); } } text = ((!(text == old_formula.Substring(0, old_formula.LastIndexOf(":") + 1))) ? (text + ((num < 0) ? num.ToString() : ("+" + num)) + text2) : (text + text2 + ((num < 0) ? num.ToString() : ("+" + num)))); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("formula after " + text)); } RollMode rollMode = rollingSystem; if (!text.ToUpper().Substring(text.LastIndexOf(":") + 1).Contains("D")) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("Roll Create Diversion Due To Lack Of Dice In Formula: " + text.ToUpper())); } rollMode = RollMode.automaticGenerator; } switch (rollMode) { case RollMode.manual: dt.SpawnAt(new Vector3(((Component)instigator).transform.position.x + 1f, ((Component)instigator).transform.position.y + 2f, ((Component)instigator).transform.position.z + 1f), Vector3.zero); LocalConnectionManager.ProcessTaleSpireUrl(text); break; case RollMode.manual_side: case RollMode.automaticDice: { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(diceSideExistance.position.x, diceSideExistance.position.y + (float)((rollingSystem != RollMode.automaticDice) ? 1 : 5), diceSideExistance.position.z); dt.SpawnAt(val, Vector3.zero); if (rollingSystem == RollMode.manual_side) { CameraController.MoveToPosition(val, false, false, false); CameraController.LookAtTarget(val); } LocalConnectionManager.ProcessTaleSpireUrl(text); break; } case RollMode.automaticGenerator: text = text.Substring("talespire://dice/XRuleset5e".Length); loadedRollRequest = new Roll { name = text.Substring(0, text.LastIndexOf(":")), roll = text.Substring(text.LastIndexOf(":") + 1) }; NewDiceSet(-2L); break; } } public void RollExecute(DiceRollManager dm, ref float stepDelay) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) stepDelay = 0f; RollMode rollMode = rollingSystem; if (loadedRollRequest != null) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"Roll Execute Diversion Due To Load Roll"); } rollMode = RollMode.automaticGenerator; } switch (rollMode) { case RollMode.manual: case RollMode.manual_side: break; case RollMode.automaticDice: { RollId val = default(RollId); RollId.TryParse(lastRollId.ToString(), ref val); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(diceSideExistance.position.x, diceSideExistance.position.y + (float)((rollingSystem != RollMode.automaticDice) ? 1 : 5), diceSideExistance.position.z); dm.ThrowDice(val, new float3(0f, 1f, 0f)); break; } case RollMode.automaticGenerator: ResultDiceSet(ResolveRoll(loadedRollRequest.roll)); break; } } public void RollCleanup(DiceRollManager dm, ref float stepDelay) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) switch (rollingSystem) { case RollMode.manual_side: Utility.DisableProcessing(setting: false); CameraController.MoveToPosition(saveCamera.position, false, false, false); CameraController.LookAtTarget(float3.op_Implicit(instigator.TargetPosition)); saveCamera = null; break; case RollMode.automaticDice: Object.Destroy((Object)(object)dolly); break; } loadedRollRequest = null; SyncDisNormAdv(); } public void NewDiceSet(long rollId) { switch (stateMachineState) { case StateMachineState.attackAttackDieWaitCreate: case StateMachineState.attackAttackBonusDieWaitCreate: case StateMachineState.attackDamageDieWaitCreate: case StateMachineState.skillRollDieWaitCreate: case StateMachineState.skillBonusRollDieWaitCreate: case StateMachineState.healingRollDieWaitCreate: if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"RuleSet 5E Plugin: Dice Set Ready"); } lastRollId = rollId; stateMachineState++; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Transitioned To " + stateMachineState)); } break; } } public void ResultDiceSet(Dictionary result) { if (lastRollId == (long)result["Identifier"] || (long)result["Identifier"] == -2) { switch (stateMachineState) { case StateMachineState.attackAttackDieWaitRoll: case StateMachineState.attackAttackBonusDieWaitRoll: case StateMachineState.attackDamageDieWaitRoll: case StateMachineState.skillRollDieWaitRoll: case StateMachineState.skillBonusRollDieWaitRoll: case StateMachineState.healingRollDieWaitRoll: if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"RuleSet 5E Plugin: Dice Set Roll Result Ready"); } lastResult = result; stateMachineState++; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Transitioned To " + stateMachineState)); } break; } } else if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Request '" + lastRollId + "' Result '" + result["Identifier"]?.ToString() + "'. Ignoring.")); } } public IEnumerator DisplayMessage(string text, float duration) { messageContent = text; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Displaying Message For " + Math.Max(1f, duration * processSpeed) + " Seconds")); } yield return (object)new WaitForSeconds(Math.Max(1f, duration * processSpeed)); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Displaying Message Duration Expired"); } if (messageContent == text) { messageContent = ""; } } private static void SyncDisNormAdv() { if (Instance.totalAdv) { Instance.lastRollRequestTotal = RollTotal.advantage; } else if (Instance.totalDis) { Instance.lastRollRequestTotal = RollTotal.disadvantage; } else { Instance.lastRollRequestTotal = RollTotal.normal; } } private static string SafeForProtocolName(string tmp) { tmp = tmp.Replace(" ", "\u00a0"); tmp = tmp.Replace("&", "\u00a0And\u00a0"); return tmp; } private Dictionary ResolveRoll(string roll) { try { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("Roll: " + roll + " (" + ((lastRollRequest.type == "x2") ? "x2" : "x1") + ")")); } bool flag = true; bool flag2 = true; Random random = new Random(); roll = roll.Substring(roll.IndexOf(" ") + 1).Trim(); roll = "0+" + roll + "+0"; roll = roll.ToUpper(); string text = roll; string text2 = text; while (roll.Contains("D")) { int num = 0; int num2 = roll.IndexOf("D"); int num3 = num2 - 1; int num4 = num2 + 1; while ("0123456789".Contains(roll.Substring(num3, 1))) { num3--; if (num3 == 0) { break; } } while ("0123456789".Contains(roll.Substring(num4, 1))) { num4++; if (num4 > roll.Length) { break; } } int num5 = int.Parse(roll.Substring(num3 + 1, num2 - (num3 + 1))); int num6 = int.Parse(roll.Substring(num2 + 1, num4 - (num2 + 1))); string text3 = "["; for (int i = 0; i < num5; i++) { int num7 = random.Next(1, num6 + 1); int num8 = random.Next(1, num6 + 1); int num9 = num7; if (dcAttack) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: (victim_totalAdv) (victim_totalDis) | " + victim_totalAdv + " | " + victim_totalDis)); } if (victim_totalAdv && num6 == 20) { num9 = Math.Max(num7, num8); } if (victim_totalDis && num6 == 20) { num9 = Math.Min(num7, num8); } } else { if (totalAdv && num6 == 20) { num9 = Math.Max(num7, num8); } if (totalDis && num6 == 20) { num9 = Math.Min(num7, num8); } } text3 = text3 + num9 + ","; num += num9; if (num9 != 1) { flag = false; } if (num9 != num6) { flag2 = false; } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: (victim_totalAdv) (victim_totalDis) | " + victim_totalAdv + " | " + victim_totalDis)); } if (dcAttack) { if ((victim_totalAdv || victim_totalDis) && num6 == 20) { text3 = text3 + (text3.Contains(num8.ToString()) ? num7 : num8) + ","; } } else if ((totalAdv || totalDis) && num6 == 20) { text3 = text3 + (text3.Contains(num8.ToString()) ? num7 : num8) + ","; } } roll = roll.Substring(0, num3 + 1) + num + roll.Substring(num4); text3 = text3.Substring(0, text3.Length - 1) + "]"; int num10 = text2.IndexOf(num5 + "D" + num6); text2 = text2.Substring(0, num10) + text3 + text2.Substring(num10 + (num5 + "D" + num6).Length); if (text != "0+0+0") { text2 = text2.Replace("+0+0", "+0"); } } DataTable dataTable = new DataTable(); Dictionary dictionary = new Dictionary(); dictionary.Add("Identifier", -2L); dictionary.Add("Roll", text.Substring(2).Substring(0, text.Substring(2).Length - 2).Replace("D", "d") .Replace("+0", "")); dictionary.Add("Total", (int)dataTable.Compute(roll, null)); text2 = text2.Substring(2).Substring(0, text2.Substring(2).Length - 2); text2 = ("+".Contains(text2.Substring(0, 1)) ? text2.Substring(1) : text2); dictionary.Add("Expanded", text2); dictionary.Add("IsMax", flag2); dictionary.Add("IsMin", flag); return dictionary; } catch (Exception ex) { Dictionary dictionary2 = new Dictionary(); dictionary2.Add("Identifier", -2L); dictionary2.Add("Roll", roll.Substring(2).Substring(0, roll.Substring(2).Length - 2)); dictionary2.Add("Total", 0); dictionary2.Add("Expanded", ex.Message); dictionary2.Add("IsMax", false); dictionary2.Add("IsMin", false); return dictionary2; } } public string checkToMod(string check) { string text = ""; check = check.ToUpper(); if (check == "Athletics".ToUpper() || check == "STR".ToUpper()) { text = "+" + (decimal)(int.Parse(characters[Utility.GetCharacterName(victim)].str) - 10) / 2m; } else if (check == "Acrobatics".ToUpper() || check == "Sleight of Hand".ToUpper() || check == "Stealth".ToUpper() || check == "DEX".ToUpper()) { text = "+" + (decimal)(int.Parse(characters[Utility.GetCharacterName(victim)].dex) - 10) / 2m; } else if (check == "Arcana".ToUpper() || check == "History".ToUpper() || check == "Investigation".ToUpper() || check == "Nature".ToUpper() || check == "Religion".ToUpper() || check == "INT".ToUpper()) { text = "+" + (decimal)(int.Parse(characters[Utility.GetCharacterName(victim)].Int) - 10) / 2m; } else if (check == "Animal Handling".ToUpper() || check == "Insight".ToUpper() || check == "Medicine".ToUpper() || check == "Perception".ToUpper() || check == "Survival".ToUpper() || check == "WIS".ToUpper()) { text = "+" + (decimal)(int.Parse(characters[Utility.GetCharacterName(victim)].wis) - 10) / 2m; } else { if (!(check == "Deception".ToUpper()) && !(check == "Intimidation".ToUpper()) && !(check == "Performance".ToUpper()) && !(check == "Persuasion".ToUpper()) && !(check == "CHA".ToUpper())) { return "0"; } text = "+" + (decimal)(int.Parse(characters[Utility.GetCharacterName(victim)].cha) - 10) / 2m; } return text.Replace("+-", "-"); } private void Awake() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) diagnostics = ((BaseUnityPlugin)this).Config.Bind("Troubleshooting", "Diagnostic Mode", DiagnosticMode.low, (ConfigDescription)null).Value; Debug.Log((object)("RuleSet 5E Plugin: " + ((object)this).GetType().AssemblyQualifiedName + " Active. (Diagnostic Level = " + diagnostics.ToString() + ")")); Instance = this; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Harmony val = new Harmony("org.lordashes.plugins.ruleset5e"); val.PatchAll(); AssetDataPlugin.Subscribe("org.lordashes.plugins.ruleset5e.BonusData", (Action)Callback); AssetDataPlugin.Subscribe("org.lordashes.plugins.ruleset5e.Bubble", (Action)Callback); AssetDataPlugin.Subscribe("org.lordashes.plugins.ruleset5e.Request", (Action)Callback); if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: CurrentCulture:" + Thread.CurrentThread.CurrentCulture.ToString())); } iconSelector = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Attack Icons Base On", "type", (ConfigDescription)null).Value; string[] array = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Dice Side Existance", "-100,0,0,45,0,0", (ConfigDescription)null).Value.Split(new char[1] { ',' }); diceSideExistance = new Existence(new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2])), new Vector3(float.Parse(array[3]), float.Parse(array[4]), float.Parse(array[5]))); string[] array2 = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Dice Color", "0,0,0", (ConfigDescription)null).Value.Split(new char[1] { ',' }); if (array2.Length == 3) { diceColor = new Color(float.Parse(array2[0], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array2[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array2[2], CultureInfo.InvariantCulture.NumberFormat)); } else if (array2.Length > 3) { diceColor = new Color(float.Parse(array2[0], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array2[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array2[2], CultureInfo.InvariantCulture.NumberFormat), float.Parse(array2[3], CultureInfo.InvariantCulture.NumberFormat)); } array2 = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Dice Highlight Color", "1.0,1.0,0", (ConfigDescription)null).Value.Split(new char[1] { ',' }); if (array2.Length == 3) { diceHighlightColor = new Color32((byte)(255f * float.Parse(array2[0], CultureInfo.InvariantCulture.NumberFormat)), (byte)(255f * float.Parse(array2[1], CultureInfo.InvariantCulture.NumberFormat)), (byte)(255f * float.Parse(array2[2], CultureInfo.InvariantCulture.NumberFormat)), byte.MaxValue); } else if (array2.Length > 3) { diceHighlightColor = new Color32((byte)(255f * float.Parse(array2[0], CultureInfo.InvariantCulture.NumberFormat)), (byte)(255f * float.Parse(array2[1], CultureInfo.InvariantCulture.NumberFormat)), (byte)(255f * float.Parse(array2[2], CultureInfo.InvariantCulture.NumberFormat)), (byte)(255f * float.Parse(array2[3], CultureInfo.InvariantCulture.NumberFormat))); } missAnimation = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Miss Animation Name", "TLA_Wiggle", (ConfigDescription)null).Value; deadAnimation = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Dead Animation Name", "TLA_Action_Knockdown", (ConfigDescription)null).Value; fadeText = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Hide UI Menu Text When Not Under Mouse", false, (ConfigDescription)null).Value; useGeneralIcons = ((BaseUnityPlugin)this).Config.Bind("Appearance", "Use General Icons", true, (ConfigDescription)null).Value; string[] array3 = ((BaseUnityPlugin)this).Config.Bind("Settings", "Small Screen Offset", "-1200,40", (ConfigDescription)null).Value.Split(new char[1] { ',' }); smallScreenConversion = new Vector2(float.Parse(array3[0], CultureInfo.InvariantCulture), float.Parse(array3[1], CultureInfo.InvariantCulture)); rollingSystem = ((BaseUnityPlugin)this).Config.Bind("Settings", "Rolling Style", RollMode.automaticDice, (ConfigDescription)null).Value; processSpeed = ((BaseUnityPlugin)this).Config.Bind("Settings", "Process Delay Percentage", 100, (ConfigDescription)null).Value / 100; locationPrefixFiles = ((BaseUnityPlugin)this).Config.Bind("Settings", "Remote Location Prefix For Dnd5E Files (Blank For Local Files)", "", (ConfigDescription)null).Value; locationPrefixIcons = ((BaseUnityPlugin)this).Config.Bind("Settings", "Remote Location Prefix For Icon Files (Blank For Local Files)", "", (ConfigDescription)null).Value; useJsonExtension = ((BaseUnityPlugin)this).Config.Bind("Settings", "Use Json Extension Instead Of Dnd5E", false, (ConfigDescription)null).Value; changeBaseColors = ((BaseUnityPlugin)this).Config.Bind("Auto Color Base Settings", "Auto Color Base", false, (ConfigDescription)null).Value; npcColors = ((BaseUnityPlugin)this).Config.Bind("Auto Color Base Settings", "Npc Colors", "2,13,1", (ConfigDescription)null).Value.Split(new char[1] { ',' }); pcColors = ((BaseUnityPlugin)this).Config.Bind("Auto Color Base Settings", "PC Colors", "6,7,8", (ConfigDescription)null).Value.Split(new char[1] { ',' }); uiLocX = int.Parse(((BaseUnityPlugin)this).Config.Bind("Appearance", "UI Location X", "0", (ConfigDescription)null).Value); uiLocY = int.Parse(((BaseUnityPlugin)this).Config.Bind("Appearance", "UI Location Y", "0", (ConfigDescription)null).Value); pluginMode = ((BaseUnityPlugin)this).Config.Bind("Settings", "Plugin Mode", OperationMode.localAlways, (ConfigDescription)null); defaultIconExtension = ((BaseUnityPlugin)this).Config.Bind("Settings", "Default Icon Extension", ".png", (ConfigDescription)null); reloadAssetTrigger = ((BaseUnityPlugin)this).Config.Bind("Shortcuts", "Reload Asset File Request", new KeyboardShortcut((KeyCode)114, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null); shakeonhit = ((BaseUnityPlugin)this).Config.Bind("Appearance", "The camera shake when an attack hits", false, (ConfigDescription)null).Value; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Dice Side Location = " + ((object)diceSideExistance.position/*cast due to .constrained prefix*/).ToString())); } if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Speed = " + processSpeed + "x")); } rollingSystem = RollMode.automaticGenerator; RadialUIPlugin.RemoveCustomButtonOnCharacter("Attacks"); backgroundTexture = Image.LoadTexture(locationPrefixIcons + "/org.lordashes.plugins.ruleset5e/RulesetBuilder.Toolbar.png", (CacheType)999); reactionStopIcon = (Texture)(object)Image.LoadTexture(locationPrefixIcons + "/org.lordashes.plugins.ruleset5e/ReactionStop.png", (CacheType)999); ((MonoBehaviour)this).StartCoroutine(CacheLoader.LoadCache(((BaseUnityPlugin)this).Config.Bind("Settings", "Cache Delay Between Loading Each Item", 0.1f, (ConfigDescription)null).Value)); Utility.PostOnMainPage(((object)this).GetType()); } private void Update() { //IL_0086: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_015f: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: 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_0210: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) if (!Utility.isBoardLoaded()) { return; } if (callbackRollReady == null) { callbackRollReady = NewDiceSet; callbackRollResult = ResultDiceSet; chatManager = Object.FindObjectOfType(); ((MonoBehaviour)this).StartCoroutine(Executor()); } if (Input.GetMouseButtonDown(0)) { Rect val = ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 70f, 34f, 40f, 20f), applySmallScreenConversion: true); if (((float)Screen.height - Input.mousePosition.y > ((Rect)(ref val)).y) & ((float)Screen.height - Input.mousePosition.y < ((Rect)(ref val)).y + ((Rect)(ref val)).height)) { Rect val2 = ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 5f, 34f, 40f, 20f), applySmallScreenConversion: true); Rect val3 = ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 80f, 34f, 40f, 20f), applySmallScreenConversion: true); Rect val4 = ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 165f, 34f, 40f, 20f), applySmallScreenConversion: true); Rect val5 = ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 250f, 34f, 40f, 20f), applySmallScreenConversion: true); if (((Input.mousePosition.x > ((Rect)(ref val)).x) & (Input.mousePosition.x < ((Rect)(ref val)).x + ((Rect)(ref val)).width)) || ((Input.mousePosition.x > ((Rect)(ref val2)).x) & (Input.mousePosition.x < ((Rect)(ref val2)).x + ((Rect)(ref val2)).width)) || ((Input.mousePosition.x > ((Rect)(ref val3)).x) & (Input.mousePosition.x < ((Rect)(ref val3)).x + ((Rect)(ref val3)).width)) || ((Input.mousePosition.x > ((Rect)(ref val4)).x) & (Input.mousePosition.x < ((Rect)(ref val4)).x + ((Rect)(ref val4)).width)) || ((Input.mousePosition.x > ((Rect)(ref val5)).x) & (Input.mousePosition.x < ((Rect)(ref val5)).x + ((Rect)(ref val5)).width))) { DisableKeyboardEvents(setting: true); } else { DisableKeyboardEvents(setting: false); } } else { DisableKeyboardEvents(setting: false); } if (selectRuleMode) { CreatureBoardAsset val6 = null; float3 val7 = default(float3); PixelPickingManager.TryGetPickedCreature(ref val7, ref val6); if ((Object)(object)val6 != (Object)null) { numberOfSelectedTargets++; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Last Clicked: " + ((object)val6.CreatureId/*cast due to .constrained prefix*/).ToString())); } string text = "I'm target "; string text2 = ""; int num = 0; int num2 = 0; if (multiAttackType == "Heal") { val6.SetGlow(true, Color.Lerp(Color.green, Color.black, 0.65f)); } else { val6.SetGlow(true, Color.Lerp(Color.red, Color.black, 0.3f)); } multiTargetAssets.Add(val6); foreach (CreatureBoardAsset multiTargetAsset in multiTargetAssets) { num++; if (multiTargetAsset.CreatureId == val6.CreatureId) { num2++; text2 = text2 + "," + num; } } text = ((num2 <= 1) ? (text + numberOfSelectedTargets) : (text + text2.Trim(new char[1] { ',' }))); SingletonBehaviour.Instance.Hire().Setup(val6.HookHead, text, Color.Lerp(Color.red, Color.yellow, 0.4f), new Color(0.4f, 0.3f, 0.5f, 1f)); } } } if (selectRuleMode) { if (Input.GetMouseButtonDown(2)) { numberOfSelectedTargets = 0; StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); selectRuleMode = false; } if (Input.GetMouseButtonDown(1)) { foreach (CreatureBoardAsset multiTargetAsset2 in multiTargetAssets) { multiTargetAsset2.SetGlow(false, Color.red); } numberOfSelectedTargets = 0; multiTargetAssets.Clear(); MultitargetAssetsIndex = 0; selectRuleMode = false; } } KeyboardShortcut value = reloadAssetTrigger.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CreatureBoardAsset val8 = null; CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val8); if ((Object)(object)val8 != (Object)null) { SystemMessage.DisplayInfoText("Rulset 5e Plugin:\r\nRequesting Reload Of " + Utility.GetCharacterName(val8.Name), 2.5f, 0f, (Action)null); AssetDataPlugin.SetInfo(((object)val8.CreatureId/*cast due to .constrained prefix*/).ToString(), "org.lordashes.plugins.ruleset5e.Request", "Reload" + DateTime.UtcNow, false); } else { SystemMessage.DisplayInfoText("Rulset 5e Plugin:\r\nNo Asset Selected For File Reload", 2.5f, 0f, (Action)null); } } } private void OnGUI() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0169: 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_01a3: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dolly != (Object)null) { GUI.DrawTexture(new Rect(5f, (float)(Screen.height / 2), (float)(Screen.width / 4), (float)(Screen.height / 4)), (Texture)(object)auxCameraTexture, (ScaleMode)2); } if (selectRuleMode) { GUIStyle val = new GUIStyle(); val.alignment = (TextAnchor)1; GUI.DrawTexture(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 460f, 64f, 920f, 42f)), (Texture)(object)backgroundTexture); val.fontSize = 20; GUI.Label(ScreenSizeAdjustment(new Rect(3f, 65f, (float)Screen.width, 30f)), " MultiSelectMode: ON | Targets: " + numberOfSelectedTargets + "", val); val.fontSize = 16; GUI.Label(ScreenSizeAdjustment(new Rect(3f, 86f, (float)Screen.width, 30f)), "To add Target: Press Left Mouse Button | To continue: Press Middle Mouse Button | To Cancel: Press Right Mouse Button ", val); } if (messageContent != "") { GUIStyle val2 = new GUIStyle(); val2.normal.textColor = Color.black; val2.alignment = (TextAnchor)1; val2.fontSize = 32; GUIStyle val3 = new GUIStyle(); val3.normal.textColor = Color.yellow; val3.alignment = (TextAnchor)1; val3.fontSize = 32; GUI.Label(ScreenSizeAdjustment(new Rect(0f, 60f, (float)Screen.width, 55f)), messageContent, val2); GUI.Label(ScreenSizeAdjustment(new Rect(3f, 63f, (float)Screen.width, 55f)), messageContent, val3); } if (reactionStopContinue) { GUIStyle val4 = new GUIStyle(); val4.normal.textColor = Color.yellow; val4.alignment = (TextAnchor)1; val4.fontSize = 26; GUI.Label(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 40f, 55f, 80f, 30f)), "Roll: " + reactionRollTotal, val4); if (GUI.Button(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 130f, 85f, 40f, 30f)), "Hit")) { reactionStopContinue = false; string text = "Forced Normal Hit Reaction Used"; lastResult["IsMax"] = false; chatManager.SendChatMessageEx(text, text, text, instigator.CreatureId, LocalClient.Id.Value); stateMachineState = StateMachineState.attackAttackHitReport; } if (GUI.Button(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 220f, 85f, 80f, 30f)), "Critical")) { reactionStopContinue = false; string text2 = "Forced Critical Hit Reaction Used"; lastResult["IsMax"] = true; chatManager.SendChatMessageEx(text2, text2, text2, instigator.CreatureId, LocalClient.Id.Value); stateMachineState = StateMachineState.attackAttackHitReport; } if (GUI.Button(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 85f, 85f, 80f, 30f)), "Continue")) { reactionStopContinue = false; stateMachineState = StateMachineState.attackAttackDieRollReport; if (secureSuccess) { stateMachineState = StateMachineState.attackAttackHitReport; } } if (GUI.Button(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 5f, 85f, 80f, 30f)), "Cancel")) { reactionStopContinue = false; string text3 = "Cancel Attack Reaction Used"; chatManager.SendChatMessageEx(text3, text3, text3, instigator.CreatureId, LocalClient.Id.Value); stateMachineState = StateMachineState.attackRollCleanup; } if (GUI.Button(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 90f, 85f, 40f, 30f)), "Miss")) { reactionStopContinue = false; string text4 = "Miss Reaction Used"; chatManager.SendChatMessageEx(text4, text4, text4, instigator.CreatureId, LocalClient.Id.Value); stateMachineState = StateMachineState.attackAttackMissReport; } if (GUI.Button(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 140f, 85f, 60f, 30f)), "Halve")) { reactionStopContinue = false; reactionHalve = true; string text5 = "Halved Reaction Used"; chatManager.SendChatMessageEx(text5, text5, text5, instigator.CreatureId, LocalClient.Id.Value); stateMachineState = StateMachineState.attackAttackDieRollReport; if (secureSuccess) { stateMachineState = StateMachineState.attackAttackHitReport; } } } if (Utility.isBoardLoaded() && !pauseRender && PlayMode.CurrentStateId != Ids.Cutscene) { RenderToolBarAddons(); } } public void AttackDC(Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: AttacksDC: " + roll.name)); } lastRollRequest = new Roll(roll); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: AttacksDC: " + lastRollRequest.name)); } Roll link = lastRollRequest; do { if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("Damage Stack: " + link.name + " : " + link.type + " : " + link.roll)); } link = link.link; } while (link != null); if (!((Object)(object)instigator != (Object)null) || !((Object)(object)victim != (Object)null)) { return; } if (!Utility.IsNumeric(lastRollRequest.roll.Split(new char[1] { '/' })[0].Replace("+", "").Replace("-", ""))) { bool flag = false; foreach (Roll skill in characters[Utility.GetCharacterName(instigator)].skills) { if (skill.name.ToUpper().Contains(lastRollRequest.roll.Split(new char[1] { '/' })[0].ToUpper())) { flag = true; oppositeRollvalue = new Roll(lastRollRequest); lastRollRequest = new Roll(skill); oppositeRoll = true; break; } } if (!flag) { SystemMessage.DisplayInfoText("The instigator does not have the skill: " + lastRollRequest.roll.Split(new char[1] { '/' })[0], 2.5f, 0f, (Action)null); } else { Skill(lastRollRequest, cid, obj, mi); } return; } if (lastRollRequest.roll.Split(new char[1] { '/' })[0].Contains("+") || lastRollRequest.roll.Split(new char[1] { '/' })[0].Contains("-")) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: DC Compute Input: " + lastRollRequest.roll.ToString())); } DataTable dataTable = new DataTable(); string text = Convert.ToString(dataTable.Compute(lastRollRequest.roll.Split(new char[1] { '/' })[0], null)); lastRollRequest.roll = text + "/" + lastRollRequest.roll.Split(new char[1] { '/' })[1] + "/" + lastRollRequest.roll.Split(new char[1] { '/' })[2]; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: DC Compute Output: " + lastRollRequest.roll.ToString())); } } dcAttack = true; stateMachineState = StateMachineState.attackAttackRangeCheck; victim.SetGlow(true, Color.red); } public void Attack(Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: Attack: " + roll.name)); } lastRollRequest = new Roll(roll); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Attack: " + lastRollRequest.name)); } Roll link = lastRollRequest; do { if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("Damage Stack: " + link.name + " : " + link.type + " : " + link.roll)); } link = link.link; } while (link != null); if ((Object)(object)instigator != (Object)null && (Object)(object)victim != (Object)null) { stateMachineState = StateMachineState.attackAttackRangeCheck; victim.SetGlow(true, Color.red); } } public void Skill(Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: Save: " + roll.name)); } lastRollRequest = roll; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("Roll: " + roll.roll)); } if ((Object)(object)instigator != (Object)null) { stateMachineState = StateMachineState.skillRollSetup; victim.SetGlow(true, Color.Lerp(Color.green, Color.black, 0.76f)); } } public void Save(Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: Skill: " + roll.name)); } lastRollRequest = roll; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("Roll: " + roll.roll)); } if ((Object)(object)instigator != (Object)null) { stateMachineState = StateMachineState.skillRollSetup; victim.SetGlow(true, Color.Lerp(Color.green, Color.black, 0.76f)); } } public void Heal(Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_008c: 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) if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: Heal: " + roll.name)); } lastRollRequest = roll; if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("Roll: " + roll.roll)); } if ((Object)(object)instigator != (Object)null && (Object)(object)victim != (Object)null) { healSequence = true; stateMachineState = StateMachineState.attackAttackRangeCheck; victim.SetGlow(true, Color.Lerp(Color.green, Color.black, 0.76f)); } } public void LoadDnd5(CreatureBoardAsset instigator) { //IL_003d: 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_00bb: 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_00f5: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) try { if (!characters.ContainsKey(Utility.GetCharacterName(instigator.Name))) { return; } if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"RuleSet 5E Plugin: Loading stats from Dndn5:"); } float value = instigator.Hp.Value; string text = value.ToString(); value = instigator.Hp.Max; if (text == value.ToString()) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].hp), (float)int.Parse(characters[Utility.GetCharacterName(instigator)].hp)), -1); } else { CreatureGuid creatureId = instigator.CreatureId; value = instigator.Hp.Value; CreatureManager.SetCreatureStatByIndex(creatureId, new CreatureStat((float)int.Parse(value.ToString()), (float)int.Parse(characters[Utility.GetCharacterName(instigator)].hp)), -1); } for (int i = 0; i < CampaignSessionManager.StatNames.Length; i++) { if (CampaignSessionManager.StatNames[i].ToUpper().Equals("AC")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].ac), 0f), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: AC CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("SPEED")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].speed), 0f), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: SPEED CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("STR MOD")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].str), (float)int.Parse(Math.Floor((float.Parse(characters[Utility.GetCharacterName(instigator)].str) - 10f) / 2f).ToString())), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: STR CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("DEX MOD")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].dex), (float)int.Parse(Math.Floor((float.Parse(characters[Utility.GetCharacterName(instigator)].dex) - 10f) / 2f).ToString())), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: DEX CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("CON MOD")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].con), (float)int.Parse(Math.Floor((float.Parse(characters[Utility.GetCharacterName(instigator)].con) - 10f) / 2f).ToString())), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: CON CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("INT MOD")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].Int), (float)int.Parse(Math.Floor((float.Parse(characters[Utility.GetCharacterName(instigator)].Int) - 10f) / 2f).ToString())), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: INT CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("WIS MOD")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].wis), (float)int.Parse(Math.Floor((float.Parse(characters[Utility.GetCharacterName(instigator)].wis) - 10f) / 2f).ToString())), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: WIS CHANGED"); } } if (CampaignSessionManager.StatNames[i].ToUpper().Equals("CHA MOD")) { CreatureManager.SetCreatureStatByIndex(instigator.CreatureId, new CreatureStat((float)int.Parse(characters[Utility.GetCharacterName(instigator)].cha), (float)int.Parse(Math.Floor((float.Parse(characters[Utility.GetCharacterName(instigator)].cha) - 10f) / 2f).ToString())), i); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: CHA CHANGED"); } } } Instance.CustomBColor(instigator, (int)instigator.Hp.Value, (int)instigator.Hp.Max); } catch (Exception ex) { Debug.LogWarning((object)("RuleSet 5E Plugin:!Error loading Dnd5 stats: " + ex)); } } public void LoadDnd5eJson(CreatureBoardAsset instigator, bool forceReload = false) { //IL_0ee2: Unknown result type (might be due to invalid IL or missing references) //IL_0ee7: Unknown result type (might be due to invalid IL or missing references) //IL_0f3c: Unknown result type (might be due to invalid IL or missing references) //IL_0f41: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Unknown result type (might be due to invalid IL or missing references) //IL_0f11: Unknown result type (might be due to invalid IL or missing references) //IL_0fa3: Unknown result type (might be due to invalid IL or missing references) //IL_0fa8: Unknown result type (might be due to invalid IL or missing references) //IL_1008: Unknown result type (might be due to invalid IL or missing references) //IL_100d: Unknown result type (might be due to invalid IL or missing references) //IL_0fd9: Unknown result type (might be due to invalid IL or missing references) //IL_0fde: Unknown result type (might be due to invalid IL or missing references) //IL_104b: Unknown result type (might be due to invalid IL or missing references) //IL_1050: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Expected O, but got Unknown //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Expected O, but got Unknown //IL_09f1: Unknown result type (might be due to invalid IL or missing references) //IL_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_09fd: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a81: Expected O, but got Unknown //IL_0b81: Unknown result type (might be due to invalid IL or missing references) //IL_0b86: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b99: Unknown result type (might be due to invalid IL or missing references) //IL_0bc4: Unknown result type (might be due to invalid IL or missing references) //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) //IL_0c07: Expected O, but got Unknown //IL_0d1a: Unknown result type (might be due to invalid IL or missing references) //IL_0d1f: Unknown result type (might be due to invalid IL or missing references) //IL_0d26: Unknown result type (might be due to invalid IL or missing references) //IL_0d32: Unknown result type (might be due to invalid IL or missing references) //IL_0d5d: Unknown result type (might be due to invalid IL or missing references) //IL_0d6f: Unknown result type (might be due to invalid IL or missing references) //IL_0da0: Expected O, but got Unknown string characterName = Utility.GetCharacterName(instigator.Name); if (forceReload && characters.ContainsKey(characterName)) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Loading Character With Forece Reload. Removing Current Character Data"); } characters.Remove(characterName); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Loading Character With Forece Reload. Removing Radial Menu Entries"); } FieldInfo fieldInfo = (from f in typeof(RadialSubmenu).GetRuntimeFields() where f.Name == "subMenuEntries" select f).ElementAt(0); Dictionary> dictionary = (Dictionary>)fieldInfo.GetValue(null); List list = new List { "org.lordashes.plugins.ruleset5e.AttacksDC", "org.lordashes.plugins.ruleset5e.Attacks", "org.lordashes.plugins.ruleset5e.Saves", "org.lordashes.plugins.ruleset5e.Skills", "org.lordashes.plugins.ruleset5e.Healing" }; if (radiaMainMenuList.ContainsKey(characterName)) { foreach (string item in radiaMainMenuList[characterName]) { list.Add("org.lordashes.plugins.ruleset5e." + item); } } foreach (string item2 in list) { if (!dictionary.ContainsKey(item2)) { continue; } List list2 = dictionary[item2]; for (int num = 0; num < list2.Count; num++) { if (list2.ElementAt(num).ValueText == characterName) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Removing " + characterName + " Categroy " + item2 + " Item " + list2.ElementAt(num).Title)); } list2.RemoveAt(num); num--; } } dictionary[item2] = list2; } if (Enumerable.Contains(radiaMainMenuList.Keys, characterName)) { radiaMainMenuList[characterName].Clear(); radiaMainMenuList.Remove(characterName); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Loading Character With Forece Reload. Updating Radial Menu"); } fieldInfo.SetValue(null, dictionary); } if (!characters.ContainsKey(characterName)) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Loading Character '/" + Utility.GetCharacterName(instigator.Name) + ".dnd5e'")); } string text = ""; switch (pluginMode.Value) { case OperationMode.localAlways: text = "/" + Utility.GetCharacterName(instigator.Name) + (useJsonExtension ? ".json" : ".dnd5e"); break; case OperationMode.remoteAlways: text = locationPrefixFiles + "/" + Utility.GetCharacterName(instigator.Name) + (useJsonExtension ? ".json" : ".dnd5e"); break; case OperationMode.localFirstRemoteFallback: text = "/" + Utility.GetCharacterName(instigator.Name) + (useJsonExtension ? ".json" : ".dnd5e"); if (!File.Exists(text)) { text = locationPrefixFiles + "/" + Utility.GetCharacterName(instigator.Name) + (useJsonExtension ? ".json" : ".dnd5e"); } break; } try { if (!File.Exists(text)) { throw new Exception("RuleSet 5E Plugin: Cannot find '" + text + "'"); } } catch (Exception) { Debug.LogWarning((object)("RuleSet 5E Plugin: Cannot find '" + text + "'")); return; } try { text = File.Find(text, (CacheType)999)[0]; if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: Loading Character '" + characterName + "' From '" + text + "'")); } string json = File.ReadAllText(text, (CacheType)(forceReload ? 1 : 999)); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Loading Character '" + characterName + "' Contains:\r\n" + json)); } CalculateSheet(ref json); characters.Add(characterName, JsonConvert.DeserializeObject(json)); } catch (Exception ex2) { Debug.LogWarning((object)("RuleSet 5E Plugin: Cannot read dnd5e file '" + text + "': " + ex2)); } try { foreach (Roll roll in characters[characterName].attacksDC) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Adding Character '" + characterName + "' attacksDC '" + roll.name + "'")); } string iconName = PatchAssistant.GetField(roll, iconSelector)?.ToString() + ".png"; string text2 = "AttacksDC"; if (roll.menuUI != "") { text2 = roll.menuUI; } NewRadialUIMenu(characterName, text2, "Magic"); RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.ruleset5e." + text2, new ItemArgs { CloseMenuOnActivate = true, FadeName = fadeText, Icon = (useGeneralIcons ? CacheLoader.GetSprite("Magic") : CacheLoader.GetSprite(iconName)), Title = roll.name, ValueText = characterName }, (Action)delegate(HideVolume hv, string obj, MapMenuItem mi) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) StartSequencePre("AttackDC", roll, new CreatureGuid(((object)RadialUIPlugin.GetLastRadialTargetCreature()/*cast due to .constrained prefix*/).ToString()), obj, mi); }, (Func)(() => Utility.CharacterCheck(characterName, roll.name))); } foreach (Roll roll2 in characters[characterName].attacks) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Adding Character '" + characterName + "' Attack '" + roll2.name + "'")); } string iconName2 = PatchAssistant.GetField(roll2, iconSelector)?.ToString() + ".png"; string text3 = "Attacks"; if (roll2.menuUI != "") { text3 = roll2.menuUI; } NewRadialUIMenu(characterName, text3, "Attack"); RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.ruleset5e." + text3, new ItemArgs { CloseMenuOnActivate = true, FadeName = fadeText, Icon = (useGeneralIcons ? CacheLoader.GetSprite("Attack") : CacheLoader.GetSprite(iconName2)), Title = roll2.name, ValueText = characterName }, (Action)delegate(HideVolume hv, string obj, MapMenuItem mi) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) StartSequencePre("Attack", roll2, new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), obj, mi); }, (Func)(() => Utility.CharacterCheck(characterName, roll2.name))); } foreach (Roll roll3 in characters[characterName].saves) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Adding Character '" + characterName + "' Save '" + roll3.name + "'")); } string text4 = "Saves"; if (roll3.menuUI != "") { text4 = roll3.menuUI; } NewRadialUIMenu(characterName, text4, "Saves"); RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.ruleset5e." + text4, new ItemArgs { CloseMenuOnActivate = true, FadeName = fadeText, Icon = (useGeneralIcons ? CacheLoader.GetSprite("Saves") : CacheLoader.GetSprite("save_" + roll3.name)), Title = roll3.name, ValueText = characterName }, (Action)delegate(HideVolume hv, string obj, MapMenuItem mi) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) StartSequencePre("Save", roll3, new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), obj, mi); }, (Func)(() => Utility.CharacterCheck(characterName, roll3.name))); } foreach (Roll roll4 in characters[characterName].skills) { Debug.Log((object)("RuleSet 5E Plugin: Adding Character '" + characterName + "' Skill '" + roll4.name + "'")); string text5 = "Skills"; if (roll4.menuUI != "") { text5 = roll4.menuUI; } NewRadialUIMenu(characterName, text5, "Skills"); RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.ruleset5e." + text5, new ItemArgs { CloseMenuOnActivate = true, FadeName = fadeText, Icon = (useGeneralIcons ? CacheLoader.GetSprite("Skills") : CacheLoader.GetSprite(roll4.name)), Title = roll4.name, ValueText = characterName }, (Action)delegate(HideVolume hv, string obj, MapMenuItem mi) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) StartSequencePre("Skill", roll4, new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), obj, mi); }, (Func)(() => Utility.CharacterCheck(characterName, roll4.name))); } foreach (Roll roll5 in characters[characterName].healing) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Adding Character '" + characterName + "' Healing '" + roll5.name + "'")); } string text6 = "Healing"; if (roll5.menuUI != "") { text6 = roll5.menuUI; } NewRadialUIMenu(characterName, text6, "Healing"); RadialSubmenu.CreateSubMenuItem("org.lordashes.plugins.ruleset5e." + text6, new ItemArgs { CloseMenuOnActivate = true, FadeName = fadeText, Icon = (useGeneralIcons ? CacheLoader.GetSprite("Healing") : CacheLoader.GetSprite(roll5.name)), Title = roll5.name, ValueText = characterName }, (Action)delegate(HideVolume hv, string obj, MapMenuItem mi) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) StartSequencePre("Heal", roll5, new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), obj, mi); }, (Func)(() => Utility.CharacterCheck(characterName, roll5.name))); } FieldInfo fieldInfo2 = (from f in typeof(RadialUIPlugin).GetRuntimeFields() where f.Name == "_onCharacterCallback" select f).ElementAt(0); Dictionary)> source = (Dictionary)>)fieldInfo2.GetValue(null); source = source.OrderBy((KeyValuePair)> x) => x.Key).ToDictionary((KeyValuePair)> x) => x.Key, (KeyValuePair)> y) => y.Value); fieldInfo2.SetValue(null, source); } catch (Exception ex3) { Debug.LogWarning((object)("RuleSet 5E Plugin: Cannot read create radial menu entries. " + ex3)); } try { Instance.LoadDnd5(instigator); } catch (Exception ex4) { Debug.LogWarning((object)("RuleSet 5E Plugin: Cannot set mini stats. " + ex4)); } if (!idMinis.ContainsKey(((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString())) { idMinis.Add(((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString(), Utility.GetCharacterName(instigator.Name)); } else { idMinis[((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString()] = Utility.GetCharacterName(instigator.Name); } } else { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Character '" + Utility.GetCharacterName(instigator.Name) + "' Already Added.")); } if (!idMinis.ContainsKey(((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString())) { Instance.LoadDnd5(instigator); idMinis.Add(((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString(), Utility.GetCharacterName(instigator.Name)); } else if (idMinis[((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString()] != Utility.GetCharacterName(instigator.Name)) { Instance.LoadDnd5(instigator); idMinis[((object)instigator.CreatureId/*cast due to .constrained prefix*/).ToString()] = Utility.GetCharacterName(instigator.Name); } } } private void CalculateSheet(ref string json) { Character character = JsonConvert.DeserializeObject(json); json = json.Replace("{ac}", character.ac); json = json.Replace("{hp}", character.hp); json = json.Replace("{speed}", character.speed); json = json.Replace("{lv}", character.lv); json = json.Replace("{var1}", character.var1); json = json.Replace("{var2}", character.var2); json = json.Replace("{var3}", character.var3); int num = int.Parse(character.lv); int num2 = num; if (num2 <= 4) { json = json.Replace("{pb}", "2"); json = json.Replace("{ex}", "4"); json = json.Replace("{ph}", "1"); } else { int num3 = num2; if (num3 <= 8) { json = json.Replace("{pb}", "3"); json = json.Replace("{ex}", "6"); json = json.Replace("{ph}", "1"); } else { int num4 = num2; if (num4 <= 12) { json = json.Replace("{pb}", "4"); json = json.Replace("{ex}", "8"); json = json.Replace("{ph}", "2"); } else { int num5 = num2; if (num5 <= 16) { json = json.Replace("{pb}", "5"); json = json.Replace("{ex}", "10"); json = json.Replace("{ph}", "2"); } else { int num6 = num2; if (num6 <= 20) { json = json.Replace("{pb}", "6"); json = json.Replace("{ex}", "12"); json = json.Replace("{ph}", "3"); } } } } } json = json.Replace("{str}", Convert.ToString(GetMod(int.Parse(character.str)))); json = json.Replace("{dex}", Convert.ToString(GetMod(int.Parse(character.dex)))); json = json.Replace("{con}", Convert.ToString(GetMod(int.Parse(character.con)))); json = json.Replace("{int}", Convert.ToString(GetMod(int.Parse(character.Int)))); json = json.Replace("{wis}", Convert.ToString(GetMod(int.Parse(character.wis)))); json = json.Replace("{cha}", Convert.ToString(GetMod(int.Parse(character.cha)))); json = json.Replace("+-", "-"); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Calculated Content Contains:\r\n" + json)); } } private int GetMod(int score) { return (int)Math.Floor((decimal)(score - 10) / 2m); } private void RenderToolBarAddons() { //IL_0099: 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_00d8: 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_0121: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: Unknown result type (might be due to invalid IL or missing references) if (!globalKeyboardDisabled && (GUI.GetNameOfFocusedControl() == "guiAmountAttack" || GUI.GetNameOfFocusedControl() == "guiAmountDamage" || GUI.GetNameOfFocusedControl() == "guiAmountSkill" || GUI.GetNameOfFocusedControl() == "guiAmountAC" || GUI.GetNameOfFocusedControl() == "guiAmountHP")) { GUI.FocusControl((string)null); } GUI.DrawTexture(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 215f, 32f, 515f, 24f), applySmallScreenConversion: true), (Texture)(object)backgroundTexture); reactionStop = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 215f + 10f, 34f, 40f, 20f), applySmallScreenConversion: true), reactionStop, reactionStopIcon); bool flag = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 215f + 50f, 34f, 30f, 20f), applySmallScreenConversion: true), totalAdv, "+"); bool flag2 = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 215f + 80f, 34f, 30f, 20f), applySmallScreenConversion: true), totalDis, "-"); bool flag3 = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 100f, 34f, 25f, 20f), applySmallScreenConversion: true), useAttackBonusDie, "A"); GUI.SetNextControlName("guiAmountAttack"); string text = GUI.TextField(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 70f, 34f, 40f, 20f), applySmallScreenConversion: true), amountAttackBonusDie, 9); bool flag4 = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f - 25f, 34f, 25f, 20f), applySmallScreenConversion: true), useDamageBonusDie, "D"); GUI.SetNextControlName("guiAmountDamage"); string text2 = GUI.TextField(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 5f, 34f, 40f, 20f), applySmallScreenConversion: true), amountDamageBonusDie, 9); bool flag5 = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 50f, 34f, 25f, 20f), applySmallScreenConversion: true), useSkillBonusDie, "S"); GUI.SetNextControlName("guiAmountSkill"); string text3 = GUI.TextField(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 80f, 34f, 40f, 20f), applySmallScreenConversion: true), amountSkillBonusDie, 9); bool flag6 = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 125f, 34f, 35f, 20f), applySmallScreenConversion: true), useACBonusDie, "AC"); GUI.SetNextControlName("guiAmountAC"); string text4 = GUI.TextField(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 165f, 34f, 40f, 20f), applySmallScreenConversion: true), amountACBonusDie, 9); bool flag7 = GUI.Toggle(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 210f, 34f, 35f, 20f), applySmallScreenConversion: true), useHPBonus, "HP"); GUI.SetNextControlName("guiAmountHP"); string text5 = GUI.TextField(ScreenSizeAdjustment(new Rect((float)Screen.width / 2f + 250f, 34f, 40f, 20f), applySmallScreenConversion: true), amountHPBonus, 9); int num = 0; if (flag2 != totalDis) { totalDis = flag2; totalAdv = false; num = 1; } else if (flag != totalAdv) { totalAdv = flag; totalDis = false; num = 2; } if (useAttackBonusDie != flag3) { useAttackBonusDie = flag3; num = 3; } if (useDamageBonusDie != flag4) { useDamageBonusDie = flag4; num = 4; } if (useSkillBonusDie != flag5) { useSkillBonusDie = flag5; num = 5; } if (amountAttackBonusDie != text) { amountAttackBonusDie = text; num = 6; } if (amountDamageBonusDie != text2) { amountDamageBonusDie = text2; num = 7; } if (amountSkillBonusDie != text3) { amountSkillBonusDie = text3; num = 8; } if (useACBonusDie != flag6) { useACBonusDie = flag6; num = 9; } if (amountACBonusDie != text4) { amountACBonusDie = text4; num = 10; } if (useHPBonus != flag7) { useHPBonus = flag7; num = 11; } if (amountHPBonus != text5) { amountHPBonus = text5; num = 12; } if (num > 0) { if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Toolbar Selection Changed (" + num + ")")); } CreatureBoardAsset val = default(CreatureBoardAsset); CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val); if ((Object)(object)val != (Object)null) { amountAttackBonusDie = Regex.Replace(amountAttackBonusDie, "[^0-9dD+-]", ""); amountDamageBonusDie = Regex.Replace(amountDamageBonusDie, "[^0-9dD+-]", ""); amountSkillBonusDie = Regex.Replace(amountSkillBonusDie, "[^0-9dD+-]", ""); amountACBonusDie = Regex.Replace(amountACBonusDie, "[^0-9-]", ""); amountHPBonus = Regex.Replace(amountHPBonus, "[^0-9]", ""); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: Valid Mini Selected For Update"); } IdBonus idBonus = new IdBonus(); idBonus.name = Utility.GetCharacterName(val.Name); idBonus._useAttackBonusDie = useAttackBonusDie; idBonus._useDamageBonusDie = useDamageBonusDie; idBonus._useSkillBonusDie = useSkillBonusDie; idBonus._useACBonusDie = useACBonusDie; idBonus._useHPBonus = useHPBonus; idBonus._amountAttackBonusDie = amountAttackBonusDie; idBonus._amountDamageBonusDie = amountDamageBonusDie; idBonus._amountSkillBonusDie = amountSkillBonusDie; idBonus._amountACBonusDie = amountACBonusDie; idBonus._amountHPBonus = amountHPBonus; idBonus._useAdv = totalAdv; idBonus._useDis = totalDis; AssetDataPlugin.SetInfo(((object)val.CreatureId/*cast due to .constrained prefix*/).ToString(), "org.lordashes.plugins.ruleset5e.BonusData", (object)idBonus, false); if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Creature: " + ((object)val.CreatureId/*cast due to .constrained prefix*/).ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus.name.ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useAttackBonusDie)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useDamageBonusDie)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useSkillBonusDie)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._amountAttackBonusDie.ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._amountDamageBonusDie.ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._amountSkillBonusDie.ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useAdv)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useDis)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useACBonusDie)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._amountACBonusDie.ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._useHPBonus)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin:" + idBonus._amountHPBonus.ToString())); } } } if (dcAttack) { if (victim_totalAdv) { lastRollRequestTotal = RollTotal.advantage; } else if (victim_totalDis) { lastRollRequestTotal = RollTotal.disadvantage; } else { lastRollRequestTotal = RollTotal.normal; } } else if (totalAdv) { lastRollRequestTotal = RollTotal.advantage; } else if (totalDis) { lastRollRequestTotal = RollTotal.disadvantage; } else { lastRollRequestTotal = RollTotal.normal; } } public Rect ScreenSizeAdjustment(Rect element, bool applySmallScreenConversion = false) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) if (Screen.height > 1080) { ((Rect)(ref element)).y = ((Rect)(ref element)).y + math.round(((Rect)(ref element)).y + (float)((Screen.height - 1080) / 22)); } ((Rect)(ref element)).y = ((Rect)(ref element)).y + (float)uiLocY; ((Rect)(ref element)).x = ((Rect)(ref element)).x + (float)uiLocX; return element; } public void StartSequencePre(string action, Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: StartSequencePre"); } CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref instigator); if (multiTargetAssets.Count == 0) { CreaturePresenter.TryGetAsset(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), ref victim); if (instigator.CreatureId == victim.CreatureId && (action == "Attack" || action == "AttackDC" || action == "Heal")) { selectRuleMode = true; multiTargetAssets.Clear(); MultitargetAssetsIndex = 0; multiRoll = roll; multiAttackType = action; } else { StartSequence(action, roll, cid, obj, mi); } } else if (MultitargetAssetsIndex < multiTargetAssets.Count) { victim = multiTargetAssets[MultitargetAssetsIndex]; MultitargetAssetsIndex++; StartSequence(multiAttackType, multiRoll, instigator.CreatureId, obj, mi); } else { multiTargetAssets.Clear(); MultitargetAssetsIndex = 0; multiRoll = null; multiAttackType = ""; } } public void StartSequence(string action, Roll roll, CreatureGuid cid, object obj, MapMenuItem mi) { //IL_008c: 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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) dcAttack = false; healSequence = false; if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: StartSequence"); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Action = " + action)); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Roll = " + JsonConvert.SerializeObject((object)roll))); } if ((Object)(object)instigator != (Object)null) { LoadBonus(instigator.CreatureId); } if ((Object)(object)victim != (Object)null) { LoadBonus(victim.CreatureId, victim: true); } if ((Object)(object)instigator != (Object)null && !characters.ContainsKey(Utility.GetCharacterName(instigator))) { LoadDnd5eJson(instigator); } if ((Object)(object)victim != (Object)null && !characters.ContainsKey(Utility.GetCharacterName(victim))) { LoadDnd5eJson(victim); } if (characters.ContainsKey(Utility.GetCharacterName(victim))) { switch (action) { case "Attack": Attack(roll, cid, obj, mi); break; case "AttackDC": AttackDC(roll, cid, obj, mi); break; case "Skill": Skill(roll, cid, obj, mi); break; case "Save": Save(roll, cid, obj, mi); break; case "Heal": Heal(roll, cid, obj, mi); break; } return; } string text = "Invalid target: " + victim.Name.ToString(); chatManager.SendChatMessageEx(text, text, text, instigator.CreatureId, LocalClient.Id.Value); if (diagnostics >= DiagnosticMode.low) { Debug.Log((object)("RuleSet 5E Plugin: Invalid target (" + victim.Name + "), does not have Dnd5e assigned")); } if (multiTargetAssets.Count != 0) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin:Invalid Target Multi"); } if ((action == "AttackDC") & (multiTargetAssets.Count == MultitargetAssetsIndex)) { stateMachineState = StateMachineState.attackDamageDieCreate; } else { StartSequencePre(multiAttackType, multiRoll, instigator.CreatureId, null, null); } } } private void Callback(DatumChange change) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)("RuleSet 5E Plugin: Callback (" + ((object)change.action/*cast due to .constrained prefix*/).ToString() + ") " + change.source + ": " + change.key + " -> " + change.previous?.ToString() + " -> " + change.value)); } switch (change.key) { case "org.lordashes.plugins.ruleset5e.Request": if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"RuleSet 5E Plugin: Request"); } if (change.value.ToString().StartsWith("Reload")) { CreatureBoardAsset val2 = null; CreaturePresenter.TryGetAsset(new CreatureGuid(change.source), ref val2); if ((Object)(object)val2 != (Object)null) { SystemMessage.DisplayInfoText("Ruleset 5e Plugin:\r\n" + Utility.GetCharacterName(val2.Name) + " File Reloaded", 2.5f, 0f, (Action)null); LoadDnd5eJson(val2, forceReload: true); } } else { if (!(change.source == "SYSTEM")) { break; } string[] array = change.value.ToString().Split(new char[1] { '|' }); CreaturePresenter.TryGetAsset(new CreatureGuid(array[0]), ref instigator); CreaturePresenter.TryGetAsset(new CreatureGuid(array[1]), ref victim); if ((Object)(object)instigator != (Object)null) { string text2 = array[2]; string text3 = array[3]; List list = null; switch (text2.ToUpper()) { case "ATTACK": list = characters[Utility.GetCharacterName(instigator.Name)].attacks; break; case "ATTACKDC": list = characters[Utility.GetCharacterName(instigator.Name)].attacksDC; break; case "SAVE": list = characters[Utility.GetCharacterName(instigator.Name)].saves; break; case "SKILL": list = characters[Utility.GetCharacterName(instigator.Name)].skills; break; case "HEALING": list = characters[Utility.GetCharacterName(instigator.Name)].healing; break; } { foreach (Roll item in list) { if (item.name == text3) { StartSequence(text2, item, victim.CreatureId, null, null); break; } } break; } } SystemMessage.DisplayInfoText("Ruleset 5e Plugin:\r\nInvalid Instigator", 2.5f, 0f, (Action)null); } break; case "org.lordashes.plugins.ruleset5e.BonusData": break; case "org.lordashes.plugins.ruleset5e.Bubble": { string text = (string)change.value; CreatureGuid val = default(CreatureGuid); CreatureGuid.TryParse(text.Split(new char[1] { '|' })[0], ref val); CreatureBoardAsset creature = default(CreatureBoardAsset); CreaturePresenter.TryGetAsset(val, ref creature); if (diagnostics >= DiagnosticMode.high) { Debug.Log((object)"RuleSet 5E Plugin: SpeakBubble"); } creature.SpeakExMessage(text.Split(new char[1] { '|' })[1]); break; } } } private void DisableKeyboardEvents(bool setting) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown if (gameInputInstance == null || gameInputDisable == null || gameInputEnable == null) { try { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: GameInputEnabled()"); } gameInputInstance = null; gameInputDisable = null; gameInputEnable = null; gameInputInstance = (GameInput)(from f in typeof(ControllerManager).GetRuntimeFields() where f.Name == "_gameInput" select f).ToArray()[0].GetValue(Object.FindObjectOfType()); gameInputDisable = (from m in typeof(GameInput).GetMethods() where m.Name == "Disable" select m).ElementAt(0); gameInputEnable = (from m in typeof(GameInput).GetMethods() where m.Name == "Enable" select m).ElementAt(0); } catch (Exception ex) { Debug.LogWarning((object)("RuleSet 5E Plugin: GameInputEnabled exception:" + ex.Message.ToString())); } } if (!setting) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: GameInputEnabled() ENABLED"); } gameInputEnable.Invoke(gameInputInstance, new object[0]); globalKeyboardDisabled = false; } else { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: GameInputEnabled() DISABLED"); } gameInputDisable.Invoke(gameInputInstance, new object[0]); globalKeyboardDisabled = true; } } public unsafe void LoadBonus(CreatureGuid cid, bool victim = false) { if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)"RuleSet 5E Plugin: LoadBonus"); } IdBonus idBonus = new IdBonus(); string text = AssetDataPlugin.ReadInfo(((object)(*(CreatureGuid*)(&cid))/*cast due to .constrained prefix*/).ToString(), "org.lordashes.plugins.ruleset5e.BonusData"); if (text != null) { idBonus = JsonConvert.DeserializeObject(text); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: LoadBonus: " + ((object)(*(CreatureGuid*)(&cid))/*cast due to .constrained prefix*/).ToString())); } if (diagnostics >= DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Restoring " + idBonus._amountAttackBonusDie + "/" + idBonus._amountDamageBonusDie + "/" + idBonus._amountSkillBonusDie + "/" + idBonus._amountACBonusDie)); } if (!victim) { useAttackBonusDie = idBonus._useAttackBonusDie; useDamageBonusDie = idBonus._useDamageBonusDie; useSkillBonusDie = idBonus._useSkillBonusDie; useHPBonus = idBonus._useHPBonus; useACBonusDie = idBonus._useACBonusDie; amountAttackBonusDie = idBonus._amountAttackBonusDie; amountDamageBonusDie = idBonus._amountDamageBonusDie; amountSkillBonusDie = idBonus._amountSkillBonusDie; amountACBonusDie = idBonus._amountACBonusDie; amountHPBonus = idBonus._amountHPBonus; totalAdv = idBonus._useAdv; totalDis = idBonus._useDis; } else { pauseRender = true; victim_useSkillBonusDie = idBonus._useSkillBonusDie; victim_amountSkillBonusDie = idBonus._amountSkillBonusDie; if (int.TryParse(idBonus._amountACBonusDie, out var _) & idBonus._useACBonusDie) { victim_amountACBonusDie = idBonus._amountACBonusDie; } else { victim_amountACBonusDie = ""; } if (int.TryParse(idBonus._amountHPBonus, out var _) & idBonus._useHPBonus) { victim_amountHPBonus = idBonus._amountHPBonus; } else { victim_amountHPBonus = ""; } victim_totalAdv = idBonus._useAdv; victim_totalDis = idBonus._useDis; pauseRender = false; } } public void NewRadialUIMenu(string characterNameUI, string menuName, string iconName) { if (!Enumerable.Contains(radiaMainMenuList.Keys, characterNameUI)) { radiaMainMenuList.Add(characterNameUI, new List()); } if (!radiaMainMenuList[characterNameUI].Contains(menuName)) { radiaMainMenuList[characterNameUI].Add(menuName); string iconName2 = menuName; if (new List { "AttacksDC", "Attacks", "Saves", "Skills", "Healing" }.Contains(menuName)) { iconName2 = iconName; } RadialSubmenu.EnsureMainMenuItem("org.lordashes.plugins.ruleset5e." + menuName, (MenuType)1, menuName, useGeneralIcons ? CacheLoader.GetSprite(iconName) : CacheLoader.GetSprite(iconName2), (Func)((NGuid nGuidID1, NGuid nGuidID2) => containsRadialUi(menuName) ? true : false)); } } public bool containsRadialUi(string menuName) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreatureBoardAsset val = null; CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val); if ((Object)(object)val != (Object)null) { if (!Enumerable.Contains(radiaMainMenuList.Keys, Utility.GetCharacterName(val.Name))) { return false; } if (radiaMainMenuList[Utility.GetCharacterName(val.Name)].Contains(menuName)) { return true; } return false; } return false; } } public static class SpeakExtensions { public static void SpeakEx(this CreatureBoardAsset creature, string text) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) AssetDataPlugin.SendInfo("org.lordashes.plugins.ruleset5e.Bubble", ((object)creature.CreatureId/*cast due to .constrained prefix*/).ToString() + "|" + text); } public static void SpeakExMessage(this CreatureBoardAsset creature, string text) { if (RuleSet5EPlugin.rollingSystem != RuleSet5EPlugin.RollMode.manual_side) { creature.Speak(text); } else { ((MonoBehaviour)RuleSet5EPlugin.Instance).StartCoroutine(RuleSet5EPlugin.Instance.DisplayMessage(RuleSet5EPlugin.Utility.GetCharacterName(creature) + ": " + text, 3f)); } } public unsafe static void SendChatMessageEx(this ChatManager chatManager, string playersMessage, string ownerMessage, string gmMessage, CreatureGuid subject, NGuid speaker) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) List list = RuleSet5EPlugin.Utility.FindGMs(); List list2 = RuleSet5EPlugin.Utility.FindOwners(subject); if (gmMessage != null) { foreach (PlayerGuid item in list) { if (RuleSet5EPlugin.diagnostics >= RuleSet5EPlugin.DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Chat Extension: Sending Chat Message To GM '" + ((object)(*(PlayerGuid*)(&item))/*cast due to .constrained prefix*/).ToString() + "' Content: " + gmMessage.Replace("\r\n", "|"))); } ChatManager.SendChatMessageToGms(gmMessage, speaker, (float3?)null, false); } } if (ownerMessage != null) { foreach (PlayerGuid item2 in list2) { if (!list.Contains(item2)) { if (RuleSet5EPlugin.diagnostics >= RuleSet5EPlugin.DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Chat Extension: Sending Chat Message To Owner '" + ((object)(*(PlayerGuid*)(&item2))/*cast due to .constrained prefix*/).ToString() + "' Content: " + gmMessage.Replace("\r\n", "|"))); } ChatManager.SendChatMessageToPlayer(ownerMessage, item2, speaker, (float3?)null, false); } } } if (playersMessage == null) { return; } foreach (PlayerGuid key in CampaignSessionManager.PlayersInfo.Keys) { if (!list.Contains(key) && !list2.Contains(key)) { if (RuleSet5EPlugin.diagnostics >= RuleSet5EPlugin.DiagnosticMode.ultra) { Debug.Log((object)("RuleSet 5E Plugin: Chat Extension: Sending Chat Message To Player '" + CampaignSessionManager.GetPlayerName(key) + "' Content: " + playersMessage.Replace("\r\n", "|"))); } ChatManager.SendChatMessageToPlayer(playersMessage, key, speaker, (float3?)null, false); } } } } [HarmonyPatch(typeof(LocalClient), "SetSelectedCreatureId")] public static class PatchLocalClientSetSelectedCreatureId { public static bool Prefix() { if (RuleSet5EPlugin.Instance.multiTargetAssets.Count != 0) { return false; } return !RuleSet5EPlugin.selectRuleMode; } public static void Postfix() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (RuleSet5EPlugin.diagnostics >= RuleSet5EPlugin.DiagnosticMode.ultra) { Debug.Log((object)"Ruleset5E Plugin: PatchCreatureBoardAssetUpdate : "); } if (RuleSet5EPlugin.diagnostics >= RuleSet5EPlugin.DiagnosticMode.ultra) { Debug.Log((object)((object)LocalClient.SelectedCreatureId/*cast due to .constrained prefix*/).ToString()); } } } public static class DiceExtensions { public static void SpawnAt(this UIDiceTray dt, Vector3 pos, Vector3 rot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_000f: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (pos != Vector3.zero || rot != Vector3.zero) { RuleSet5EPlugin.forceExistence = new RuleSet5EPlugin.Existence(pos, rot); } else { RuleSet5EPlugin.forceExistence = null; } } } public class MultiDCAttackData { public CreatureBoardAsset mVcitim { get; set; } = null; public bool mHalfDamage { get; set; } = false; public bool mReactionHalve { get; set; } = false; }