Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RoR2StreamCompanion v2.8.0
StreamCompanion.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates.Captain.Weapon; using EntityStates.Toolbot; using ItemQualities; using ItemQualities.Utilities.Extensions; using On.EntityStates.Captain.Weapon; using On.EntityStates.Toolbot; using On.RoR2; using On.RoR2.Skills; using RoR2; using RoR2.Skills; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("StreamCompanion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+54af8a5f5ce75d9174962ca69170613071be811e")] [assembly: AssemblyProduct("StreamCompanion")] [assembly: AssemblyTitle("StreamCompanion")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace StreamCompanion; internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("TaranDev.RoR2StreamCompanion", "RoR2StreamCompanion", "2.8.0")] public class StreamCompanion : BaseUnityPlugin { public static class QualityCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static EquipmentDef TryGetQualityEquipment(EquipmentDef equipmentDef, EquipmentSlot equipmentSlot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0026: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0030: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) QualityTier activeEquipmentQualityTier = EquipmentExtensions.GetActiveEquipmentQualityTier(equipmentSlot); EquipmentIndex val = (EquipmentIndex)((!Object.op_Implicit((Object)(object)equipmentDef)) ? (-1) : ((int)equipmentDef.equipmentIndex)); if ((int)val != -1) { EquipmentIndex equipmentIndexOfQuality = QualityCatalog.GetEquipmentIndexOfQuality(val, activeEquipmentQualityTier); if ((int)equipmentIndexOfQuality != -1 && equipmentIndexOfQuality != val) { equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndexOfQuality); val = equipmentIndexOfQuality; } } return equipmentDef; } } public const string PluginGUID = "TaranDev.RoR2StreamCompanion"; public const string PluginAuthor = "TaranDev"; public const string PluginName = "RoR2StreamCompanion"; public const string PluginVersion = "2.8.0"; public const string url = "https://ror2-sc-api.herokuapp.com/"; public static string inventoryItemsString = ""; public static string equipmentString = ""; public static string skillsString = ""; public static string bodyColourString = ""; public static List<string> VanillaItems = new List<string> { "ITEM_BOSSDAMAGEBONUS_NAME", "ITEM_SECONDARYSKILLMAGAZINE_NAME", "ITEM_FLATHEALTH_NAME", "ITEM_FIREWORK_NAME", "ITEM_MUSHROOM_NAME", "ITEM_HEALWHILESAFE_NAME", "ITEM_CROWBAR_NAME", "ITEM_FRAGILEDAMAGEBONUS_NAME", "ITEM_SPRINTBONUS_NAME", "ITEM_NEARBYDAMAGEBONUS_NAME", "ITEM_IGNITEONKILL_NAME", "ITEM_SCRAPWHITE_NAME", "ITEM_CRITGLASSES_NAME", "ITEM_MEDKIT_NAME", "ITEM_ATTACKSPEEDANDMOVESPEED_NAME", "ITEM_TOOTH_NAME", "ITEM_OUTOFCOMBATARMOR_NAME", "ITEM_HOOF_NAME", "ITEM_PERSONALSHIELD_NAME", "ITEM_HEALINGPOTION_NAME", "ITEM_REPULSIONARMORPLATE_NAME", "ITEM_GOLDONHURT_NAME", "ITEM_TREASURECACHE_NAME", "ITEM_SYRINGE_NAME", "ITEM_STICKYBOMB_NAME", "ITEM_STUNCHANCEONHIT_NAME", "ITEM_BARRIERONKILL_NAME", "ITEM_BEAR_NAME", "ITEM_BLEEDONHIT_NAME", "ITEM_WARDONLEVEL_NAME", "ITEM_MISSILE_NAME", "ITEM_BANDOLIER_NAME", "ITEM_WARCRYONMULTIKILL_NAME", "ITEM_SLOWONHIT_NAME", "ITEM_DEATHMARK_NAME", "ITEM_EQUIPMENTMAGAZINE_NAME", "ITEM_BONUSGOLDPACKONKILL_NAME", "ITEM_HEALONCRIT_NAME", "ITEM_FEATHER_NAME", "ITEM_MOVESPEEDONKILL_NAME", "ITEM_STRENGTHENBURN_NAME", "ITEM_INFUSION_NAME", "ITEM_SCRAPGREEN_NAME", "ITEM_FIRERING_NAME", "ITEM_SEED_NAME", "ITEM_TPHEALINGNOVA_NAME", "ITEM_EXECUTELOWHEALTHELITE_NAME", "ITEM_PHASING_NAME", "ITEM_ATTACKSPEEDONCRIT_NAME", "ITEM_THORNS_NAME", "ITEM_SPRINTOUTOFCOMBAT_NAME", "ITEM_REGENERATINGSCRAP_NAME", "ITEM_SPRINTARMOR_NAME", "ITEM_ICERING_NAME", "ITEM_FREECHEST_NAME", "ITEM_PRIMARYSKILLSHURIKEN_NAME", "ITEM_SQUIDTURRET_NAME", "ITEM_CHAINLIGHTNING_NAME", "ITEM_ENERGIZEDONEQUIPMENTUSE_NAME", "ITEM_JUMPBOOST_NAME", "ITEM_EXPLODEONDEATH_NAME", "ITEM_CLOVER_NAME", "ITEM_BARRIERONOVERHEAL_NAME", "ITEM_ALIENHEAD_NAME", "ITEM_IMMUNETODEBUFF_NAME", "ITEM_RANDOMEQUIPMENTTRIGGER_NAME", "ITEM_KILLELITEFRENZY_NAME", "ITEM_BEHEMOTH_NAME", "ITEM_DAGGER_NAME", "ITEM_CAPTAINDEFENSEMATRIX_NAME", "ITEM_EXTRALIFE_NAME", "ITEM_ICICLE_NAME", "ITEM_FALLBOOTS_NAME", "ITEM_GHOSTONKILL_NAME", "ITEM_UTILITYSKILLMAGAZINE_NAME", "ITEM_INTERSTELLARDESKPLANT_NAME", "ITEM_SCRAPRED_NAME", "ITEM_CRITDAMAGE_NAME", "ITEM_NOVAONHEAL_NAME", "ITEM_MOREMISSILE_NAME", "ITEM_INCREASEHEALING_NAME", "ITEM_LASERTURBINE_NAME", "ITEM_BOUNCENEARBY_NAME", "ITEM_ARMORREDUCTIONONHIT_NAME", "ITEM_TALISMAN_NAME", "ITEM_DRONEWEAPONS_NAME", "ITEM_PERMANENTDEBUFFONHIT_NAME", "ITEM_SHOCKNEARBY_NAME", "ITEM_HEADHUNTER_NAME", "ITEM_ARTIFACTKEY_NAME", "ITEM_LIGHTNINGSTRIKEONHIT_NAME", "ITEM_MINORCONSTRUCTONKILL_NAME", "ITEM_ROBOBALLBUDDY_NAME", "ITEM_NOVAONLOWHEALTH_NAME", "ITEM_TITANGOLDDURINGTP_NAME", "ITEM_SHINYPEARL_NAME", "ITEM_SCRAPYELLOW_NAME", "ITEM_SPRINTWISP_NAME", "ITEM_SIPHONONLOWHEALTH_NAME", "ITEM_FIREBALLSONHIT_NAME", "ITEM_PEARL_NAME", "ITEM_PARENTEGG_NAME", "ITEM_BEETLEGLAND_NAME", "ITEM_BLEEDONHITANDEXPLODE_NAME", "ITEM_KNURL_NAME", "ITEM_LUNARTRINKET_NAME", "ITEM_GOLDONHIT_NAME", "ITEM_REPEATHEAL_NAME", "ITEM_MONSTERSONSHRINEUSE_NAME", "ITEM_LUNARSUN_NAME", "ITEM_LUNARSPECIALREPLACEMENT_NAME", "ITEM_RANDOMLYLUNAR_NAME", "ITEM_FOCUSEDCONVERGENCE_NAME", "ITEM_AUTOCASTEQUIPMENT_NAME", "ITEM_LUNARSECONDARYREPLACEMENT_NAME", "ITEM_HALFATTACKSPEEDHALFCOOLDOWNS_NAME", "ITEM_RANDOMDAMAGEZONE_NAME", "ITEM_LUNARBADLUCK_NAME", "ITEM_LUNARDAGGER_NAME", "ITEM_HALFSPEEDDOUBLEHEALTH_NAME", "ITEM_LUNARUTILITYREPLACEMENT_NAME", "ITEM_SHIELDONLY_NAME", "ITEM_LUNARPRIMARYREPLACEMENT_NAME", "ITEM_CLOVERVOID_NAME", "ITEM_TREASURECACHEVOID_NAME", "ITEM_CRITGLASSESVOID_NAME", "ITEM_EQUIPMENTMAGAZINEVOID_NAME", "ITEM_BLEEDONHITVOID_NAME", "ITEM_VOIDMEGACRABITEM_NAME", "ITEM_MISSILEVOID_NAME", "ITEM_EXTRALIFEVOID_NAME", "ITEM_CHAINLIGHTNINGVOID_NAME", "ITEM_BEARVOID_NAME", "ITEM_ELEMENTALRINGVOID_NAME", "ITEM_SLOWONHITVOID_NAME", "ITEM_EXPLODEONDEATHVOID_NAME", "ITEM_MUSHROOMVOID_NAME", "ITEM_FRAGILEDAMAGEBONUSCONSUMED_NAME", "ITEM_EXTRALIFECONSUMED_NAME", "ITEM_HEALINGPOTIONCONSUMED_NAME", "ITEM_EXTRALIFEVOIDCONSUMED_NAME", "ITEM_REGENERATINGSCRAPCONSUMED_NAME", "ITEM_TONICAFFLICTION_NAME" }; public static List<string> CaptainBeacons = new List<string> { "CAPTAIN_SUPPLY_HEAL_NAME", "CAPTAIN_SUPPLY_DEFENSE_NAME", "CAPTAIN_SUPPLY_HACKING_NAME", "CAPTAIN_SUPPLY_EQUIPMENT_RESTOCK_NAME", "CAPTAIN_SUPPLY_SHOCKING_NAME" }; public static List<string> MULTPrimarySkills = new List<string> { "TOOLBOT_PRIMARY_NAME", "TOOLBOT_PRIMARY_ALT1_NAME", "TOOLBOT_PRIMARY_ALT2_NAME", "TOOLBOT_PRIMARY_ALT3_NAME" }; public static bool isWaitingForUpdate = false; public static CharacterBody localBodyCache; public static ConfigEntry<string> TwitchNameConfigEntry { get; set; } public static ConfigEntry<string> SecretKeyConfigEntry { get; set; } public static ConfigEntry<double> DelayConfigEntry { get; set; } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); TwitchNameConfigEntry = ((BaseUnityPlugin)this).Config.Bind<string>("RoR2 Stream Companion", "Twitch Name", "exampleTwitchName", "The name of your channel on Twitch"); SecretKeyConfigEntry = ((BaseUnityPlugin)this).Config.Bind<string>("RoR2 Stream Companion", "Secret Key", "123MySecretKey", "The secret key you generated in the extension config page on Twitch"); DelayConfigEntry = ((BaseUnityPlugin)this).Config.Bind<double>("RoR2 Stream Companion", "Delay", 2.0, "The delay of your twitch stream in seconds"); SendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); } private void OnEnable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown Inventory.HandleInventoryChanged += new hook_HandleInventoryChanged(OnInventoryChanged); Inventory.UpdateEffectiveItemStacks += new hook_UpdateEffectiveItemStacks(OnUpdateEffectiveItemStacks); ItemTransformation.TryTransform += new hook_TryTransform(OnTryTransform); GameOverController.Awake += new hook_Awake(OnGameOver); CharacterMaster.OnBodyStart += new hook_OnBodyStart(OnBodyLoaded); CallSupplyDropBase.OnEnter += new hook_OnEnter(OnEnterSupplyDrop); ToolbotStanceSwap.OnEnter += new hook_OnEnter(OnEnterRetool); ToolbotDualWield.OnEnter += new hook_OnEnter(OnEnterPowerMode); ToolbotDualWield.OnExit += new hook_OnExit(OnExitPowerMode); CaptainSupplyDropSkillDef.GetCurrentNameToken += new hook_GetCurrentNameToken(CaptainGetCurrentNameToken); CaptainSupplyDropSkillDef.GetCurrentDescriptionToken += new hook_GetCurrentDescriptionToken(CaptainGetCurrentDescriptionToken); Run.OnApplicationQuit += new hook_OnApplicationQuit(OnApplicationQuit); } private void OnDisable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown Inventory.HandleInventoryChanged -= new hook_HandleInventoryChanged(OnInventoryChanged); Inventory.UpdateEffectiveItemStacks += new hook_UpdateEffectiveItemStacks(OnUpdateEffectiveItemStacks); ItemTransformation.TryTransform += new hook_TryTransform(OnTryTransform); GameOverController.Awake -= new hook_Awake(OnGameOver); CharacterMaster.OnBodyStart -= new hook_OnBodyStart(OnBodyLoaded); CallSupplyDropBase.OnEnter -= new hook_OnEnter(OnEnterSupplyDrop); ToolbotStanceSwap.OnEnter -= new hook_OnEnter(OnEnterRetool); ToolbotDualWield.OnEnter -= new hook_OnEnter(OnEnterPowerMode); ToolbotDualWield.OnExit -= new hook_OnExit(OnExitPowerMode); CaptainSupplyDropSkillDef.GetCurrentNameToken -= new hook_GetCurrentNameToken(CaptainGetCurrentNameToken); CaptainSupplyDropSkillDef.GetCurrentDescriptionToken -= new hook_GetCurrentDescriptionToken(CaptainGetCurrentDescriptionToken); Run.OnApplicationQuit -= new hook_OnApplicationQuit(OnApplicationQuit); } private void OnUpdateEffectiveItemStacks(orig_UpdateEffectiveItemStacks orig, Inventory self, ItemIndex itemIndex) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, itemIndex); RefreshItemList(self); } private static void OnInventoryChanged(orig_HandleInventoryChanged orig, Inventory self) { orig.Invoke(self); RefreshItemList(self); } private bool OnTryTransform(orig_TryTransform orig, ref ItemTransformation self, Inventory inventory, out TryTransformResult result) { bool result2 = orig.Invoke(ref self, inventory, ref result); Task.Delay(1000).ContinueWith(delegate { RefreshItemList(inventory); }); return result2; } private void OnApplicationQuit(orig_OnApplicationQuit orig, Run self) { inventoryItemsString = ""; equipmentString = ""; skillsString = ""; bodyColourString = ""; localBodyCache = null; SendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); orig.Invoke(self); } private string CaptainGetCurrentDescriptionToken(orig_GetCurrentDescriptionToken orig, CaptainSupplyDropSkillDef self, GenericSkill skillSlot) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)skillSlot != (Object)null && (int)(InstanceData)skillSlot.skillInstanceData != 0 && !((InstanceData)skillSlot.skillInstanceData).anySupplyDropsAvailable) { return self.exhaustedDescriptionToken; } if (!((CaptainOrbitalSkillDef)self).isAvailable) { return ((CaptainOrbitalSkillDef)self).disabledDescriptionToken; } return ((SkillDef)self).skillDescriptionToken; } private string CaptainGetCurrentNameToken(orig_GetCurrentNameToken orig, CaptainSupplyDropSkillDef self, GenericSkill skillSlot) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)skillSlot != (Object)null && (int)(InstanceData)skillSlot.skillInstanceData != 0 && !((InstanceData)skillSlot.skillInstanceData).anySupplyDropsAvailable) { return self.exhaustedNameToken; } if (!((CaptainOrbitalSkillDef)self).isAvailable) { return ((CaptainOrbitalSkillDef)self).disabledNameToken; } return ((SkillDef)self).skillNameToken; } public static CharacterBody GetCurrentCharacterMaster() { CharacterBody val = null; if ((Object)(object)Run.instance != (Object)null) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if ((Object)(object)val != (Object)null) { localBodyCache = val; } } return localBodyCache; } private static void OnEnterSupplyDrop(orig_OnEnter orig, CallSupplyDropBase self) { orig.Invoke(self); Task.Delay(500).ContinueWith(delegate { checkSkillString(); }); } private static void OnEnterRetool(orig_OnEnter orig, ToolbotStanceSwap self) { orig.Invoke(self); checkSkillString(); } private static void OnEnterPowerMode(orig_OnEnter orig, ToolbotDualWield self) { orig.Invoke(self); checkSkillString(); } private static void OnExitPowerMode(orig_OnExit orig, ToolbotDualWield self) { orig.Invoke(self); checkSkillString(); } public static void OnBodyLoaded(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { orig.Invoke(self, body); Task.Delay(1500).ContinueWith(delegate { checkSkillString(); }); } private static void checkSkillString() { if (PlayerCharacterMasterController.instances.Count > 0 && Object.op_Implicit((Object)(object)PlayerCharacterMasterController.instances[0].master.GetBody())) { string skillString = GetSkillString(inventoryItemsString); if (!skillString.Equals(skillsString)) { skillsString = skillString; bodyColourString = GetColourString(); WaitThenSendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); } } } private static void OnGameOver(orig_Awake orig, GameOverController self) { localBodyCache = null; inventoryItemsString = ""; equipmentString = ""; skillsString = ""; bodyColourString = ""; WaitThenSendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); orig.Invoke(self); } private static void RefreshItemList(Inventory inventory) { //IL_006b: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Invalid comparison between Unknown and I4 //IL_00ce: 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) //IL_015f: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Invalid comparison between Unknown and I4 //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GetCurrentCharacterMaster() == (Object)null || PlayerCharacterMasterController.instances.Count <= 0 || !((object)inventory).Equals((object?)GetCurrentCharacterMaster().master.inventory) || Object.op_Implicit((Object)(object)GameOverController.instance)) { return; } List<ItemIndex> itemAcquisitionOrder = inventory.itemAcquisitionOrder; string text = ""; for (int i = 0; i < itemAcquisitionOrder.Count; i++) { ItemDef itemDef = ItemCatalog.GetItemDef(itemAcquisitionOrder[i]); if (!itemDef.hidden) { bool flag = false; string @string = Language.GetString(itemDef.nameToken); string[] obj = new string[7] { text, @string, "{", Language.GetString(itemDef.descriptionToken), "}[", null, null }; ItemTier tier = itemDef.tier; obj[5] = ((object)(ItemTier)(ref tier)).ToString(); obj[6] = "];"; text = string.Concat(obj); } } text = text.Replace("\n", ""); text = text.Replace("\r", ""); EquipmentIndex currentEquipmentIndex = inventory.currentEquipmentIndex; string text2 = ""; if ((int)currentEquipmentIndex != -1) { EquipmentDef val = null; if (QualityCompatibility.enabled) { val = QualityCompatibility.TryGetQualityEquipment(EquipmentCatalog.GetEquipmentDef(currentEquipmentIndex), inventory.characterBody.equipmentSlot); } if ((Object)(object)val == (Object)null) { val = EquipmentCatalog.GetEquipmentDef(currentEquipmentIndex); } if (Object.op_Implicit((Object)(object)val)) { text2 = GetEquipmentString(val); EquipmentIndex alternateEquipmentIndex = inventory.alternateEquipmentIndex; if ((int)alternateEquipmentIndex != -1) { EquipmentDef val2 = null; if (QualityCompatibility.enabled) { val2 = QualityCompatibility.TryGetQualityEquipment(EquipmentCatalog.GetEquipmentDef(alternateEquipmentIndex), inventory.characterBody.equipmentSlot); } if ((Object)(object)val2 == (Object)null) { val2 = EquipmentCatalog.GetEquipmentDef(alternateEquipmentIndex); } string text3 = ""; if (Object.op_Implicit((Object)(object)val2)) { text3 = GetEquipmentString(val2); } text2 += text3; } } text2 = text2.Replace("\n", ""); text2 = text2.Replace("\r", ""); } string text4 = ""; string text5 = ""; if (Object.op_Implicit((Object)(object)PlayerCharacterMasterController.instances[0].master.GetBody())) { text4 = GetSkillString(text); text5 = GetColourString(); } if (text.Equals(inventoryItemsString) && text2.Equals(equipmentString) && text4.Equals(skillsString)) { return; } inventoryItemsString = text; equipmentString = text2; skillsString = text4; bodyColourString = text5; if (Object.op_Implicit((Object)(object)PhaseCounter.instance) && PhaseCounter.instance.phase == 4) { if (!isWaitingForUpdate) { isWaitingForUpdate = true; WaitThenSendItemsUpdatePhase4(); } } else { WaitThenSendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); } } private static string GetEquipmentString(EquipmentDef equipmentInfo) { string @string = Language.GetString(equipmentInfo.descriptionToken); if (@string == "" || @string == "???") { @string = Language.GetString(equipmentInfo.pickupToken); } return Language.GetString(equipmentInfo.nameToken) + "{" + @string + "}[" + equipmentInfo.isLunar + "];"; } private static string GetSkillString(string InventoryItemsString) { if ((Object)(object)GetCurrentCharacterMaster() == (Object)null) { return ""; } GenericSkill primary = GetCurrentCharacterMaster().skillLocator.primary; GenericSkill secondary = GetCurrentCharacterMaster().skillLocator.secondary; GenericSkill utility = GetCurrentCharacterMaster().skillLocator.utility; GenericSkill special = GetCurrentCharacterMaster().skillLocator.special; if (!Object.op_Implicit((Object)(object)primary) || !Object.op_Implicit((Object)(object)secondary) || !Object.op_Implicit((Object)(object)utility) || !Object.op_Implicit((Object)(object)special)) { return skillsString; } string text = ""; string text2 = ""; if ((Object)(object)primary.skillDef != (Object)null && (Object)(object)primary.baseSkill != (Object)null) { string text3 = primary.baseSkill.GetCurrentNameToken(primary); if (text3 == null) { text3 = ""; } string text4 = primary.baseSkill.GetCurrentDescriptionToken(primary); if (text4 == null) { text4 = ""; } text2 = (InventoryItemsString.Contains("ITEM_LUNARPRIMARYREPLACEMENT_NAME") ? (Language.GetString("SKILL_LUNAR_PRIMARY_REPLACEMENT_NAME") + "{" + Language.GetString("SKILL_LUNAR_PRIMARY_REPLACEMENT_DESCRIPTION") + "};") : ((!CaptainBeacons.Contains(text3)) ? (Language.GetString(text3) + "{" + Language.GetString(text4) + "};") : (Language.GetString("CAPTAIN_PRIMARY_NAME") + "{" + Language.GetString("CAPTAIN_PRIMARY_DESCRIPTION") + "};"))); } text += text2; string text5 = ""; if ((Object)(object)secondary.skillDef != (Object)null && (Object)(object)secondary.baseSkill != (Object)null) { string text6 = secondary.baseSkill.GetCurrentNameToken(secondary); if (text6 == null) { text6 = ""; } string text7 = secondary.baseSkill.GetCurrentDescriptionToken(secondary); if (text7 == null) { text7 = ""; } text5 = (MULTPrimarySkills.Contains(text6) ? (Language.GetString(text6) + "{" + Language.GetString(text7) + "};") : (InventoryItemsString.Contains("ITEM_LUNARSECONDARYREPLACEMENT_NAME") ? (Language.GetString("SKILL_LUNAR_SECONDARY_REPLACEMENT_NAME") + "{" + Language.GetString("SKILL_LUNAR_SECONDARY_REPLACEMENT_DESCRIPTION") + "};") : ((!CaptainBeacons.Contains(text6)) ? (Language.GetString(text6) + "{" + Language.GetString(text7) + "};") : (Language.GetString("CAPTAIN_SECONDARY_NAME") + "{" + Language.GetString("CAPTAIN_SECONDARY_DESCRIPTION") + "};")))); } text += text5; string text8 = ""; if ((Object)(object)utility.baseSkill != (Object)null) { string text9 = utility.baseSkill.GetCurrentNameToken(utility); if (text9 == null) { text9 = ""; } string text10 = utility.baseSkill.GetCurrentDescriptionToken(utility); if (text10 == null) { text10 = ""; } text8 = ((!InventoryItemsString.Contains("ITEM_LUNARUTILITYREPLACEMENT_NAME")) ? (Language.GetString(text9) + "{" + Language.GetString(text10) + "};") : (Language.GetString("SKILL_LUNAR_UTILITY_REPLACEMENT_NAME") + "{" + Language.GetString("SKILL_LUNAR_UTILITY_REPLACEMENT_DESCRIPTION") + "};")); } text += text8; string text11 = ""; if ((Object)(object)special.baseSkill != (Object)null) { string text12 = ""; if (special.skillNameToken != null && special.baseSkill.GetCurrentNameToken(special) != null) { text12 = special.baseSkill.GetCurrentNameToken(special); } string text13 = ""; if (special.skillDescriptionToken != null && special.baseSkill.GetCurrentDescriptionToken(special) != null) { text13 = special.baseSkill.GetCurrentDescriptionToken(special); } text11 = ((!InventoryItemsString.Contains("ITEM_LUNARSPECIALREPLACEMENT_NAME")) ? (Language.GetString(text12) + "{" + Language.GetString(text13) + "};") : (Language.GetString("SKILL_LUNAR_SPECIAL_REPLACEMENT_NAME") + "{" + Language.GetString("SKILL_LUNAR_SPECIAL_REPLACEMENT_DESCRIPTION") + "};")); } return text + text11; } private static string GetColourString() { //IL_0013: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0094: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GetCurrentCharacterMaster() == (Object)null)) { _ = GetCurrentCharacterMaster().bodyColor; if (0 == 0) { Color bodyColor = GetCurrentCharacterMaster().bodyColor; return "rgb(" + Math.Round(bodyColor.r * 200f) + "," + Math.Round(bodyColor.g * 200f) + "," + Math.Round(bodyColor.b * 200f) + ")"; } } return ""; } private static async void WaitThenSendItemsUpdate(string items, string equipment, string skills, string bodycolour) { await Task.Delay((int)(DelayConfigEntry.Value * 1000.0)).ContinueWith(delegate { SendItemsUpdate(items, equipment, skills, bodycolour); }); } private static void WaitThenSendItemsUpdatePhase4() { Task.Delay((int)(DelayConfigEntry.Value * 1000.0) + 3000).ContinueWith(delegate { isWaitingForUpdate = false; SendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); }); } private static string SanitiseString(string inputString) { inputString = inputString.Replace("<sprite name=\"Quality\">", "<style=cIsUtility>♦</style>"); inputString = Regex.Replace(inputString, "<sprite(?=[^>]*QualityCommon)[^>]*>", " (Common)"); inputString = Regex.Replace(inputString, "<sprite(?=[^>]*QualityUncommon)[^>]*>", " (Uncommon)"); inputString = Regex.Replace(inputString, "<sprite(?=[^>]*QualityRare)[^>]*>", " (Rare)"); inputString = Regex.Replace(inputString, "<sprite(?=[^>]*QualityEpic)[^>]*>", " (Epic)"); inputString = Regex.Replace(inputString, "<sprite(?=[^>]*QualityLegendary)[^>]*>", " (Legendary)"); inputString = Regex.Replace(inputString, "<sprite.*?>", ""); return inputString; } private static async void SendItemsUpdate(string items, string equipment, string skills, string bodycolour) { items = SanitiseString(items); equipment = SanitiseString(equipment); skills = SanitiseString(skills); bodycolour = SanitiseString(bodycolour); string hudstatus = ""; await Task.Run(delegate { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://ror2-sc-api.herokuapp.com/"); httpWebRequest.ContentType = "application/json"; httpWebRequest.Method = "POST"; using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string value = "{\"twitchName\":\"" + TwitchNameConfigEntry.Value + "\",\"secretKey\":\"" + SecretKeyConfigEntry.Value + "\",\"items\":\"" + items + "\",\"equipment\":\"" + equipment + "\",\"skills\":\"" + skills + "\",\"survivor\":\"" + bodycolour + "\",\"hudstatus\":\"" + hudstatus + "\"}"; streamWriter.Write(value); } HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); httpWebResponse.Close(); }); } private void Update() { if ((!Object.op_Implicit((Object)(object)PhaseCounter.instance) || PhaseCounter.instance.phase != 4) && isWaitingForUpdate) { isWaitingForUpdate = false; } if ((Object)(object)Run.instance == (Object)null && (inventoryItemsString.Length > 0 || equipmentString.Length > 0 || skillsString.Length > 0 || bodyColourString.Length > 0 || (Object)(object)localBodyCache != (Object)null)) { inventoryItemsString = ""; equipmentString = ""; skillsString = ""; bodyColourString = ""; localBodyCache = null; SendItemsUpdate(inventoryItemsString, equipmentString, skillsString, bodyColourString); } } }