using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BingoSyncAPI;
using HarmonyLib;
using Reptile;
using Reptile.Phone;
using TMPro;
using TrueBingo.BingoSyncManager;
using TrueBingo.Components;
using TrueBingo.Patches;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Playables;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TrueBingo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TrueBingo")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ca007dd4-4557-4d77-af3f-81f55fd407a3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TrueBingo
{
public static class BingoConfig
{
private struct ConfigEntry
{
public ConfigFile configFile;
public string selection;
public ConfigEntry(ConfigFile configFile, string selection)
{
this.configFile = configFile;
this.selection = selection;
}
}
private static ConfigFile config_char;
private static ConfigFile config_world;
public static ConfigFile config_bingosync;
private static string config_char_path_full;
private static string config_world_path_full;
private static string config_bingosync_path_full;
private const string config_foldername = "TrueBingo";
private const string config_char_filename = "Character";
private const string config_world_filename = "World";
private const string config_bingosync_filename = "BingoSync";
private const string config_filetype = "cfg";
private const string config_selection_char = "Character Settings";
private const string config_selection_world = "World Settings";
public const string config_selection_bingosync = "BingoSync";
private static ConfigEntry characterEntry;
private const string characterEntry_char = "Character";
private const string characterEntry_style = "Style";
private const string characterEntry_outfit = "Outfit";
private static ConfigEntry worldEntry;
private const string worldEntry_stage = "Starting Stage";
private const string worldEntry_pos = "Starting Position";
private const string worldEntry_seed = "Seed";
private const string worldEntry_story = "Disable Story";
private const string worldEntry_bmx = "Disable BMX Doors";
private const string worldEntry_taxi = "Enable Taxi Fight";
private const string worldEntry_boss = "Enable Final Boss Trigger";
private const string worldEntry_cops = "Disable Cops";
private const string worldEntry_roboskip = "Open Teleport Robo-Posts";
private const string worldEntry_cutscene = "Allow Skipping All Cutscenes";
private const string worldEntry_fastcutscene = "Fast Cutscene Skip";
private const string worldEntry_repdisplay = "Always Display REP";
private const string worldEntry_mallvinyl = "Skip Mall Vinyl";
private static ConfigEntry bingoSyncEntry;
public const string bingoSyncEntry_roomID = "Room ID";
public const string bingoSyncEntry_password = "Room Password";
public const string bingoSyncEntry_name = "Player Name";
public const string bingoSyncEntry_color = "Player Color";
public const string bingoSyncEntry_autoconnect = "Auto-Connect";
public const string bingoSyncEntry_phonenoti = "Notifications";
public const string bingoSyncEntry_key = "Menu Key";
public static Characters character;
public static MoveStyle moveStyle;
public static int outfit;
public static Stage stage;
public static int seed;
public static Vector3 position;
public static bool disableStory;
public static bool disableBMX;
public static bool enableTaxi;
public static bool enableBoss;
public static bool disableCops;
public static bool roboSkip;
public static bool cutsceneSkip;
public static bool fastCutscene;
public static bool repDisplay;
public static bool skipMallVinyl;
public static bool autoconnect;
public static bool phonenotification;
public static KeyCode menukey;
public static void InitConfigs()
{
CreateConfig();
FillConfigs();
ReloadConfigs();
}
private static void CreateConfig()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
config_char_path_full = GetFilePath("TrueBingo", "Character", "cfg");
config_char = new ConfigFile(config_char_path_full, true);
config_world_path_full = GetFilePath("TrueBingo", "World", "cfg");
config_world = new ConfigFile(config_world_path_full, true);
config_bingosync_path_full = GetFilePath("TrueBingo", "BingoSync", "cfg");
config_bingosync = new ConfigFile(config_bingosync_path_full, true);
}
private static string GetFilePath(string foldername, string filename, string filetype)
{
return Path.Combine(Paths.ConfigPath, foldername + "\\" + filename + "." + filetype);
}
private static void FillConfigs()
{
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
characterEntry = new ConfigEntry(config_char, "Character Settings");
BindConfig(characterEntry, "Character", BingoConfigTypes.Characters.Red);
BindConfig(characterEntry, "Style", BingoConfigTypes.Styles.Skateboard);
BindConfig(characterEntry, "Outfit", BingoConfigTypes.Outfits.Spring);
worldEntry = new ConfigEntry(config_world, "World Settings");
BindConfig(worldEntry, "Starting Stage", BingoConfigTypes.Stages.Hideout);
BindConfig<Vector3>(worldEntry, "Starting Position", new Vector3(-5f, 3f, 43f), "If Zero'd, uses random Stage spawn, otherwise spawns player at this position.\nDefault is relative to Hideout.\nWarning: Random can place you in closed OldHead areas.");
BindConfig(worldEntry, "Seed", 0, "If Stage Random, and/or Spawn Random, uses this seed.\n0 = Fully Random Each Time");
BindConfig(worldEntry, "Disable Story", defaultValue: false, "Disable Story Events such as Challenges.\nEnables Challenge Graffiti Pickups.");
BindConfig(worldEntry, "Disable BMX Doors", defaultValue: false);
BindConfig(worldEntry, "Enable Taxi Fight", defaultValue: true);
BindConfig(worldEntry, "Enable Final Boss Trigger", defaultValue: false, "Enables the Trigger which lets you enter the Final Boss area, located at the start of the final Mataan area after the vent.\nOnly has an effect if Story is also enabled.");
BindConfig(worldEntry, "Disable Cops", defaultValue: true);
BindConfig(worldEntry, "Open Teleport Robo-Posts", defaultValue: true);
BindConfig(worldEntry, "Allow Skipping All Cutscenes", defaultValue: true);
BindConfig(worldEntry, "Fast Cutscene Skip", defaultValue: true);
BindConfig(worldEntry, "Always Display REP", defaultValue: true);
BindConfig(worldEntry, "Skip Mall Vinyl", defaultValue: true);
bingoSyncEntry = new ConfigEntry(config_bingosync, "BingoSync");
BindConfig(bingoSyncEntry, "Room ID", "", "Room ID (Numbers / Letters after /room/)");
BindConfig(bingoSyncEntry, "Room Password", "", "Room Password");
BindConfig(bingoSyncEntry, "Player Name", "", "Player Name in Room");
BindConfig<PlayerColors>(bingoSyncEntry, "Player Color", (PlayerColors)1, "Player Color on Board");
BindConfig(bingoSyncEntry, "Auto-Connect", defaultValue: true, "Auto-Connect if Config Found");
BindConfig(bingoSyncEntry, "Notifications", defaultValue: true, "Show Phone notifications when someone gets something on the board");
BindConfig<KeyCode>(bingoSyncEntry, "Menu Key", (KeyCode)282, "Key to Open Menu");
}
private static void BindConfig<T>(ConfigEntry configEntry, string key, T defaultValue, string description = "")
{
configEntry.configFile.Bind<T>(configEntry.selection, key, defaultValue, description);
}
public static void HandleConfig()
{
InitConfigs();
}
private static void ReloadConfigs()
{
config_char.Reload();
config_world.Reload();
config_bingosync.Reload();
UpdateConfigAll();
}
private static void UpdateConfigAll()
{
//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_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_00af: 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)
if (characterEntry.TryGetEntry<BingoConfigTypes.Characters>("Character", out var entryValue))
{
character = BingoConfigTypes.GetCharacter(entryValue);
}
if (characterEntry.TryGetEntry<BingoConfigTypes.Styles>("Style", out var entryValue2))
{
moveStyle = BingoConfigTypes.GetStyle(entryValue2);
}
if (characterEntry.TryGetEntry<BingoConfigTypes.Outfits>("Outfit", out var entryValue3))
{
outfit = BingoConfigTypes.GetOutfit(entryValue3);
}
characterEntry.UpdateConfig("Seed", ref seed);
if (worldEntry.TryGetEntry<BingoConfigTypes.Stages>("Starting Stage", out var entryValue4))
{
BingoConfigTypes.Stages stages = entryValue4;
Random random = ((seed == 0) ? new Random() : new Random(seed));
stage = BingoConfigTypes.GetStage((stages == BingoConfigTypes.Stages.Random) ? ((BingoConfigTypes.Stages)random.Next(7)) : stages);
}
worldEntry.UpdateConfig("Starting Position", ref position);
worldEntry.UpdateConfig("Disable Story", ref disableStory);
worldEntry.UpdateConfig("Disable BMX Doors", ref disableBMX);
worldEntry.UpdateConfig("Enable Taxi Fight", ref enableTaxi);
worldEntry.UpdateConfig("Enable Final Boss Trigger", ref enableBoss);
worldEntry.UpdateConfig("Disable Cops", ref disableCops);
worldEntry.UpdateConfig("Open Teleport Robo-Posts", ref roboSkip);
worldEntry.UpdateConfig("Allow Skipping All Cutscenes", ref cutsceneSkip);
worldEntry.UpdateConfig("Fast Cutscene Skip", ref fastCutscene);
worldEntry.UpdateConfig("Always Display REP", ref repDisplay);
worldEntry.UpdateConfig("Skip Mall Vinyl", ref skipMallVinyl);
bingoSyncEntry.UpdateConfig("Auto-Connect", ref autoconnect);
bingoSyncEntry.UpdateConfig("Notifications", ref phonenotification);
bingoSyncEntry.UpdateConfig("Menu Key", ref menukey);
}
private static void UpdateConfig<T>(this ConfigEntry configEntry, string entry, ref T option)
{
if (configEntry.TryGetEntry<T>(entry, out var entryValue))
{
option = entryValue;
}
}
public static void SetConfigValue<T>(this ConfigFile configEntry, string selection, string key, T value)
{
ConfigEntry<T> val = default(ConfigEntry<T>);
if (configEntry.TryGetEntry<T>(selection, key, ref val))
{
val.Value = value;
}
configEntry.Save();
}
private static bool TryGetEntry<T>(this ConfigEntry configEntry, string key, out T entryValue)
{
ConfigEntry<T> val = default(ConfigEntry<T>);
if (configEntry.configFile.TryGetEntry<T>(configEntry.selection, key, ref val))
{
entryValue = val.Value;
return true;
}
entryValue = default(T);
return false;
}
}
public static class BingoConfigTypes
{
public enum Outfits
{
Spring,
Summer,
Autumn,
Winter
}
public enum Styles
{
Skateboard,
Inline,
BMX
}
public enum Characters
{
Vinyl,
Frank,
Coil,
Red,
Tryce,
Bel,
Rave,
DOTEXE,
Solace,
DJCyber,
Eclipse,
DevilTheory,
Faux,
FleshPrince,
Irene,
Felix,
OldHead,
Base,
Jay,
Mesh,
Futurism,
Rise,
Shine,
Faux_NoJetpack,
DOTEXE_Boss,
Felix_Red
}
public enum Stages
{
Hideout,
Versum,
Square,
Brink,
Mall,
Pyramid,
Mataan,
Random
}
public static Characters GetCharacter(Characters character)
{
return (Characters)character;
}
public static MoveStyle GetStyle(Styles style)
{
return (MoveStyle)(style switch
{
Styles.Skateboard => 2,
Styles.Inline => 3,
Styles.BMX => 1,
_ => 2,
});
}
public static int GetOutfit(Outfits outfit)
{
return (int)outfit;
}
public static Stage GetStage(Stages stage)
{
return (Stage)(stage switch
{
Stages.Hideout => 5,
Stages.Versum => 4,
Stages.Square => 11,
Stages.Brink => 12,
Stages.Mall => 6,
Stages.Pyramid => 9,
Stages.Mataan => 7,
_ => 5,
});
}
}
public static class BingoHandleStage
{
public static bool HasLeftRespawn = false;
public static Vector3 spawnPosition = Vector3.zero;
public static void UpdateStage()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_004f: Unknown result type (might be due to invalid IL or missing references)
Stage currentStage = Utility.GetCurrentStage();
WorldHandler instance = WorldHandler.instance;
SceneObjectsRegister sceneObjectsRegister = ((instance != null) ? instance.SceneObjectsRegister : null);
WorldHandler instance2 = WorldHandler.instance;
Player player = ((instance2 != null) ? instance2.GetCurrentPlayer() : null);
BingoConfig.HandleConfig();
UpdateObjective();
UpdatePlayer(player);
if (Patch_NewGame.newGame)
{
HandleNewGame(instance2, player);
}
UpdateProgress(sceneObjectsRegister, currentStage);
UpdateStageProgress(sceneObjectsRegister, currentStage);
if (BingoConfig.disableBMX)
{
DisableBMXDoors();
}
if (BingoConfig.roboSkip)
{
UnlockRoboDoors();
}
}
private static void UpdatePlayer(Player player)
{
Core instance = Core.Instance;
object obj;
if (instance == null)
{
obj = null;
}
else
{
SaveManager saveManager = instance.SaveManager;
obj = ((saveManager != null) ? saveManager.CurrentSaveSlot : null);
}
SaveSlotData val = (SaveSlotData)obj;
if (val != null)
{
val.taxiLocked = false;
if (((Ability)player.GetValue<AirDashAbility>("airDashAbility", Array.Empty<object>())).locked || ((Ability)player.GetValue<SlideAbility>("slideAbility", Array.Empty<object>())).locked || ((Ability)player.GetValue<SpecialAirAbility>("specialAirAbility", Array.Empty<object>())).locked || ((Ability)player.GetValue<LedgeClimbAbility>("ledgeClimbAbility", Array.Empty<object>())).locked || ((Ability)player.GetValue<BoostAbility>("boostAbility", Array.Empty<object>())).locked || val.boostAbilityLocked || val.boostpackLocked)
{
player.LockBoostpack(false);
}
if (val.cameraAppLocked)
{
player.LockCameraApp(false);
}
if (val.characterSelectLocked)
{
player.LockCharacterSelect(false);
}
if (val.phoneLocked)
{
player.LockPhone(false);
}
if (val.spraycanLocked)
{
player.LockSpraycan(false);
}
if (val.switchToEquippedMovestyleLocked)
{
player.LockSwitchToEquippedMoveStyle(false);
}
if (!val.fortuneAppLocked)
{
player.LockFortuneApp(true);
}
UnlockVinylSolace(val);
}
}
private static void UnlockVinylSolace(SaveSlotData saveSlot)
{
if (saveSlot != null)
{
if (!saveSlot.GetCharacterProgress((Characters)0).unlocked)
{
saveSlot.UnlockCharacter((Characters)0);
}
if (!saveSlot.GetCharacterProgress((Characters)8).unlocked)
{
saveSlot.UnlockCharacter((Characters)8);
}
}
}
private static void HandleNewGame(WorldHandler worldHandler, Player player)
{
//IL_0025: 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_005a: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
Patch_NewGame.newGame = false;
if (!((Object)(object)player != (Object)null))
{
return;
}
Core instance = Core.Instance;
SaveManager val = ((instance != null) ? instance.SaveManager : null);
player.SetCharacter(BingoConfig.character, 0);
player.InitVisual();
player.SetCurrentMoveStyleEquipped(BingoConfig.moveStyle, true, true);
player.InitAbilities();
player.GetValue<CharacterVisual>("characterVisual", Array.Empty<object>()).SetMoveStyleVisualProps(player, BingoConfig.moveStyle, false);
player.SwitchToEquippedMovestyle(false, false, true, false);
if (((val != null) ? val.CurrentSaveSlot : null) != null)
{
val.CurrentSaveSlot.GetCharacterProgress(BingoConfig.character).moveStyle = BingoConfig.moveStyle;
}
player.SetOutfit(BingoConfig.outfit);
if (val != null)
{
SaveSlotData currentSaveSlot = val.CurrentSaveSlot;
if (currentSaveSlot != null)
{
currentSaveSlot.SetupStoryCharactersLocked();
}
}
UnlockVinylSolace(val.CurrentSaveSlot);
for (int i = 0; i < 6; i++)
{
if (val != null)
{
SaveSlotData currentSaveSlot2 = val.CurrentSaveSlot;
if (currentSaveSlot2 != null)
{
currentSaveSlot2.UnlockDance(i);
}
}
}
spawnPosition = BingoConfig.position;
Quaternion rotation = ((Component)player).transform.rotation;
if (spawnPosition == Vector3.zero)
{
List<PlayerSpawner> list = worldHandler.SceneObjectsRegister?.playerSpawners;
Random random = ((BingoConfig.seed == 0) ? new Random() : new Random(BingoConfig.seed));
if (list.Count > 0)
{
PlayerSpawner obj = list[random.Next(list.Count)];
spawnPosition = ((Component)obj).transform.position;
rotation = ((Component)obj).transform.rotation;
}
}
worldHandler.PlaceCurrentPlayerAt(spawnPosition, rotation, true);
HasLeftRespawn = false;
val.SaveCurrentSaveSlot();
}
private static void UpdateProgress(SceneObjectsRegister sceneObjectsRegister, Stage stage)
{
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Invalid comparison between Unknown and I4
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Invalid comparison between Unknown and I4
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Invalid comparison between Unknown and I4
if (sceneObjectsRegister == null)
{
return;
}
List<ProgressObject> progressObjects = sceneObjectsRegister.progressObjects;
if (BingoConfig.disableStory)
{
foreach (Collectable item in from x in Resources.FindObjectsOfTypeAll<Collectable>()
where (int)x.GetValue<PickUpType>("pickUpType", Array.Empty<object>()) == 4
select x)
{
((GameplayEvent)item).canOpen = true;
item.InvokeMethod("SetAvailable", true);
}
}
if (progressObjects == null)
{
return;
}
ProgressObject[] array = (ProgressObject[])(object)new ProgressObject[0];
ProgressObject[] array2 = progressObjects.Where((ProgressObject x) => BingoStageItems.GlobalProgressObjects.Contains(((Object)x).name)).ToArray();
if ((int)stage != 4)
{
if ((int)stage != 5)
{
if ((int)stage == 11)
{
array = progressObjects.Where((ProgressObject x) => BingoStageItems.SquareProgressObjects.Contains(((Object)x).name)).ToArray();
}
}
else
{
array = progressObjects.Where((ProgressObject x) => BingoStageItems.HideoutProgressObjects.Contains(((Object)x).name)).ToArray();
}
}
else
{
array = progressObjects.Where((ProgressObject x) => BingoStageItems.DownhillProgressObjects.Contains(((Object)x).name)).ToArray();
}
ProgressObject[] array3 = array;
for (int i = 0; i < array3.Length; i++)
{
((Component)array3[i]).gameObject.SetActive(false);
}
array3 = array2;
foreach (ProgressObject obj in array3)
{
((Component)obj).gameObject.SetActive(true);
obj.SetAvailable(true);
obj.SetTriggerable(true);
}
}
private static void DisableBMXDoors()
{
BMXOnlyGateway val = Object.FindObjectOfType<BMXOnlyGateway>();
if ((Object)(object)val != (Object)null)
{
val.InvokeMethod("SetState", 5);
}
}
public static void UpdateObjective()
{
//IL_0002: 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)
//IL_002e: 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)
ObjectiveID val = (ObjectiveID)14;
Core instance = Core.Instance;
SaveManager val2 = ((instance != null) ? instance.SaveManager : null);
if (((val2 != null) ? val2.CurrentSaveSlot : null) != null && val2.CurrentSaveSlot.CurrentStoryObjective != val)
{
val2.CurrentSaveSlot.CurrentStoryObjective = val;
val2.SaveCurrentSaveSlot();
Mapcontroller instance2 = Mapcontroller.Instance;
if (instance2 != null)
{
instance2.UpdateObjectivePins();
}
}
}
public static void UpdateWanted()
{
if (BingoConfig.disableCops)
{
WantedManager instance = WantedManager.instance;
if (instance != null)
{
instance.StopPlayerWantedStatus(false);
}
}
}
public static void UpdateStageProgress(SceneObjectsRegister sceneObjectsRegister, Stage stage)
{
//IL_005f: 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_008b: Expected I4, but got Unknown
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Expected O, but got Unknown
List<AProgressable> list = sceneObjectsRegister?.progressables;
if (list == null)
{
return;
}
AProgressable val = list.Find((AProgressable x) => BingoStageItems.PostGameChallenges.Contains(((Object)x).name));
if ((Object)(object)val != (Object)null)
{
((Component)val).gameObject.SetActive(true);
}
AProgressable[] array = (AProgressable[])(object)new AProgressable[0];
AProgressable[] array2 = (AProgressable[])(object)new AProgressable[0];
AProgressable val2 = null;
switch (stage - 4)
{
case 8:
array = list.Where((AProgressable x) => BingoStageItems.TowerAProgressable_Disable.Contains(((Object)x).name)).ToArray();
array2 = list.Where((AProgressable x) => BingoStageItems.TowerAProgressable_Enable.Contains(((Object)x).name)).ToArray();
break;
case 7:
if (!BingoConfig.enableTaxi)
{
array = list.Where((AProgressable x) => BingoStageItems.SquareAProgressable_Disable.Contains(((Object)x).name)).ToArray();
}
array2 = list.Where((AProgressable x) => BingoStageItems.SquareAProgressable_Enable.Contains(((Object)x).name)).ToArray();
if (array2.Length != 0)
{
AProgressable val4 = ((IEnumerable<AProgressable>)array2).FirstOrDefault((Func<AProgressable, bool>)((AProgressable x) => ((Object)x).name == BingoStageItems.SquareAProgressable_Enable[0]));
if ((Object)(object)val4 != (Object)null)
{
((GraffitiSpot)((val4 is GraffitiSpot) ? val4 : null)).OnFinish = new UnityEvent();
}
}
break;
case 3:
array = list.Where((AProgressable x) => BingoStageItems.OsakaAProgressable_Disable.Contains(((Object)x).name) || (!BingoConfig.enableBoss && BingoStageItems.OsakaBoss_Disable.Contains(((Object)x).name))).ToArray();
array2 = list.Where((AProgressable x) => BingoStageItems.OsakaAProgressable_Enable.Contains(((Object)x).name)).ToArray();
break;
case 2:
array = list.Where((AProgressable x) => BingoStageItems.MallAProgressable_Disable.Contains(((Object)x).name)).ToArray();
HandleMallVinyl();
break;
case 5:
array = list.Where((AProgressable x) => BingoStageItems.PyramidAProgressable_Disable.Contains(((Object)x).name)).ToArray();
array2 = list.Where((AProgressable x) => BingoStageItems.PyramidAProgressable_Enable.Contains(((Object)x).name)).ToArray();
break;
case 0:
{
Core instance = Core.Instance;
object obj;
if (instance == null)
{
obj = null;
}
else
{
SaveManager saveManager = instance.SaveManager;
obj = ((saveManager != null) ? saveManager.CurrentSaveSlot : null);
}
SaveSlotData val3 = (SaveSlotData)obj;
if (val3 != null && !val3.GetCharacterProgress((Characters)14).unlocked)
{
val2 = list.Find((AProgressable x) => ((Object)x).name == "CombatEncounter_IreneUnlockChallenge");
if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject.GetComponent<Component_IreneTrigger>() == (Object)null)
{
((Component)val2).gameObject.AddComponent<Component_IreneTrigger>();
}
}
break;
}
}
AProgressable[] array3 = array;
for (int i = 0; i < array3.Length; i++)
{
((Component)array3[i]).gameObject.SetActive(false);
}
array3 = array2;
for (int i = 0; i < array3.Length; i++)
{
((Component)array3[i]).gameObject.SetActive(true);
}
}
private static void HandleMallVinyl()
{
if (BingoConfig.skipMallVinyl)
{
BoxCollider[] array = (from x in Resources.FindObjectsOfTypeAll<BoxCollider>()
where ((Object)x).name == "ProgressObject_TriggerIntro" || ((Object)x).name == "NPC_Vinyl1"
select x).ToArray();
for (int i = 0; i < array.Length; i++)
{
((Component)array[i]).gameObject.SetActive(false);
}
NPC val = ((IEnumerable<NPC>)Resources.FindObjectsOfTypeAll<NPC>()).FirstOrDefault((Func<NPC, bool>)((NPC x) => ((Object)x).name == "NPC_Vinyl4"));
if ((Object)(object)val != (Object)null && val.GetValue<int>("dialogueLevel", Array.Empty<object>()) < 1)
{
val.InvokeMethod("SetNPCActive", true);
val.InvokeMethod("SetAvailable", true);
val.SetDialogueLevel(1);
}
}
}
public static void UnlockRoboDoors()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_0009: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected I4, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
Stage currentStage = Utility.GetCurrentStage();
if ((int)currentStage != 9 && (int)currentStage != 6 && (int)currentStage != 7)
{
return;
}
ComboMascotSystem[] array = Object.FindObjectsOfType<ComboMascotSystem>().ToArray();
if ((((int)currentStage == 9 || (int)currentStage == 6) && array.Length > 1) || ((int)currentStage == 7 && array.Length != 0))
{
ComboMascotSystem val = null;
switch (currentStage - 6)
{
case 0:
case 3:
val = array[1];
break;
case 1:
val = array[0];
break;
}
if ((Object)(object)val != (Object)null)
{
val.door1.MakeUnactive();
val.door2.MakeUnactive();
val.TurnOffMascots();
}
}
}
}
public static class BingoStageItems
{
public static readonly string[] HideoutProgressObjects = new string[5] { "GarageDoorBMXClosed", "GarageDoorInlineClosed", "SquareWall", "GateOsaka", "GarageDoorSBClosed" };
public static readonly string[] DownhillProgressObjects = new string[9] { "ProgressObject_basketWallToSquare", "ProgressObject_ForceTalkToBel", "ProgressObject_basketWallWithCars", "ProgressObject_basketWall2Gate", "ProgressObject_basketWall2", "FranksIntroTrigger", "BarricadeExit", "FranksBarricadeChunks1", "BarricadeChunks1" };
public static readonly string[] SquareProgressObjects = new string[4] { "ProgressObject_SolaceTrigger", "Wall", "ProgressObject_SquareIntro_1", "ProgressObject_SquareIntro_2" };
public static readonly string[] GlobalProgressObjects = new string[6] { "AllGraffitiProgressObject", "collectables_Hideout", "ProgressObject_MapPickup", "ProgressObject_MapUnlockPickup", "ProgressObject_Map_Pickup", "ProgressObject_MapUnlock" };
public static readonly string[] TowerAProgressable_Disable = new string[2] { "ProgressObject_WallToTower", "ProgressObject_TowerDoor" };
public static readonly string[] TowerAProgressable_Enable = new string[1] { "ProgressObject_FrankGraffiti" };
public static readonly string[] SquareAProgressable_Disable = new string[3] { "SaveTaxiDriverCops", "NPC_TaxiDriver", "SaveTaxiDriverCombatEncounter" };
public static readonly string[] SquareAProgressable_Enable = new string[1] { "FrankGraffiti" };
public static readonly string[] OsakaAProgressable_Disable = new string[4] { "ProgressObject_StartTrigger", "LionStatueModelClosed", "ProgressObject_Gate", "ProgressObjectGateArena" };
public static readonly string[] OsakaBoss_Disable = new string[1] { "IntroSnakeBoss" };
public static readonly string[] OsakaAProgressable_Enable = new string[1] { "LionStatueModelOpen" };
public static readonly string[] MallAProgressable_Disable = new string[3] { "ProgressObject_HallwayDoor", "ProgressObject_FirstProgressDoor", "ProgressObject_SecondProgressDoor" };
public static readonly string[] PyramidAProgressable_Disable = new string[3] { "ProgressObject_DoorOutOfLab", "REPdoor", "ProgressObject_DoorToHigherAreas" };
public static readonly string[] PyramidAProgressable_Enable = new string[1] { "ProgressObject_FerriesToIsland" };
public static readonly string[] PostGameChallenges = new string[6] { "NPC_Eclipe_UnlockChallenge", "NPC_DJ_UnlockChallenge", "NPC_Futurism_UnlockChallenge", "NPC_DOTEXE_UnlockChallenge", "NPC_DevilTheory_UnlockChallenge", "NPC_Frank_UnlockChallenge" };
}
public static class Extensions
{
private static BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
private static List<MemberInfo> savedMembers = new List<MemberInfo>();
public static T GetValue<T>(this object input, string name, params object[] methodParams)
{
if (input.GetMember(name, out var member))
{
switch (member.MemberType)
{
case MemberTypes.Field:
return (T)(member as FieldInfo).GetValue(input);
case MemberTypes.Property:
return (T)(member as PropertyInfo).GetValue(input, null);
case MemberTypes.Method:
return (T)(member as MethodInfo).Invoke(input, methodParams);
}
}
return default(T);
}
public static void InvokeMethod(this object input, string name, params object[] methodParams)
{
if (input.GetMember(name, out var member))
{
(member as MethodInfo).Invoke(input, methodParams);
}
}
public static void SetValue<T>(this object input, string name, T value)
{
if (input.GetMember(name, out var member))
{
switch (member.MemberType)
{
case MemberTypes.Field:
(member as FieldInfo).SetValue(input, value);
break;
case MemberTypes.Property:
(member as PropertyInfo).SetValue(input, value);
break;
}
}
}
public static T GetMember<T>(this object input, string name) where T : MemberInfo
{
if (input.GetMember(name, out var member))
{
return (T)member;
}
return null;
}
private static bool GetMember(this object input, string name, out MemberInfo member)
{
MemberInfo memberInfo = savedMembers.Find((MemberInfo x) => x.DeclaringType == input.GetType() && x.Name == name);
if (memberInfo != null)
{
member = memberInfo;
return true;
}
MemberInfo[] member2 = input.GetType().GetMember(name, flags);
if (member2 != null && member2.Length != 0)
{
member = member2.First();
savedMembers.Add(member);
return true;
}
Debug.LogError((object)("No Member \"" + name + "\" Could Be Found..."));
member = null;
return false;
}
}
[BepInPlugin("ninjacookie.brc.truebingo", "TrueBingo", "1.2.4")]
public class Plugin : BaseUnityPlugin
{
public const string pluginGuid = "ninjacookie.brc.truebingo";
public const string pluginName = "TrueBingo";
public const string pluginVersion = "1.2.4";
public static GameObject BingoSyncGUI;
public void Awake()
{
//IL_0005: 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_0025: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
new Harmony("ninjacookie.brc.truebingo").PatchAll();
BingoConfig.InitConfigs();
StageManager.OnStageInitialized += new OnStageInitializedDelegate(BingoHandleStage.UpdateStage);
Core.OnUpdate += new OnUpdateHandler(BingoHandleStage.UpdateObjective);
Core.OnUpdate += new OnUpdateHandler(BingoHandleStage.UpdateWanted);
Core.OnAlwaysUpdate += new OnUpdateHandler(TrueBingoSync.Update);
BingoSyncGUI = new GameObject("BingoSyncGUI", new Type[1] { typeof(BingoSyncGUI) });
Object.DontDestroyOnLoad((Object)(object)BingoSyncGUI);
}
}
}
namespace TrueBingo.Patches
{
internal class Patch_CutsceneSkip : HarmonyPatch
{
[HarmonyPatch(typeof(SequenceHandler), "UpdateSequenceHandler")]
public static class UpdateSequenceHandler_Patch
{
public static void Prefix(SequenceHandler __instance, Player ___player, PlayableDirector ___sequence, ref float ___skipFadeDuration, ref float ___skipStartTimer)
{
if (BingoConfig.fastCutscene)
{
___skipFadeDuration = 0f;
___skipStartTimer = 1.5f;
}
if (BingoConfig.cutsceneSkip && (Object)(object)___player != (Object)null && ___player.IsBusyWithSequence() && (Object)(object)___sequence != (Object)null && !((object)___sequence).ToString().Contains("ChangeOutfitSequence") && __instance.GetValue<int>("skipTextActiveState", Array.Empty<object>()) == 0)
{
__instance.SetValue("skipTextActiveState", 1);
}
}
}
}
internal class Patch_Inputs : HarmonyPatch
{
[HarmonyPatch(typeof(UserInputHandler), "PollInputs")]
public static class UserInputHandler_PollInputs_Patch
{
public static bool Prefix(ref InputBuffer __result)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (BingoSyncGUI.GUIOpen)
{
__result = default(InputBuffer);
return false;
}
return true;
}
}
}
internal class Patch_ItemDisplay : HarmonyPatch
{
[HarmonyPatch(typeof(Pickup), "ApplyPickupType")]
public static class Pickup_ApplyPickupType_Patch
{
public static void Prefix(AUnlockable unlockable, PickUpType pickupType)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if ((int)pickupType != 5)
{
return;
}
OutfitUnlockable val = (OutfitUnlockable)(object)((unlockable is OutfitUnlockable) ? unlockable : null);
if ((Object)(object)val != (Object)null)
{
Core instance = Core.Instance;
object charName;
if (instance == null)
{
charName = null;
}
else
{
IGameTextLocalizer localizer = instance.Localizer;
charName = ((localizer != null) ? localizer.GetCharacterName(val.character) : null);
}
Patch_ItemDisplay.charName = (string)charName;
}
}
}
[HarmonyPatch(typeof(UIManager), "ShowNotification", new Type[]
{
typeof(string),
typeof(string[])
})]
public static class UIManager_ShowNotification_Patch
{
public static void Prefix(ref string text, params string[] textsToInsert)
{
if (!(charName != string.Empty))
{
return;
}
int num = textsToInsert.Count();
if (num > 0)
{
for (int i = 0; i < num; i++)
{
if (textsToInsert[i].Equals("???"))
{
textsToInsert[i] = charName;
break;
}
}
}
charName = string.Empty;
}
}
private static string charName = string.Empty;
}
internal class Patch_LegalCrime : HarmonyPatch
{
[HarmonyPatch(typeof(WantedManager), "ProcessCrime")]
public static class ProcessCrime_Patch
{
public static bool Prefix()
{
return !BingoConfig.disableCops;
}
}
}
internal class Patch_NewGame : HarmonyPatch
{
[HarmonyPatch(typeof(BaseModule), "StartNewGame")]
public static class BaseModule_StartNewGame_Patch
{
public static bool Prefix(BaseModule __instance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
newGame = true;
BingoConfig.HandleConfig();
__instance.LoadStage(BingoConfig.stage);
return false;
}
}
[HarmonyPatch(typeof(ActiveOnChapter), "OnStageInitialized")]
public static class ActiveOnChapter_OnStageInitialized_Patch
{
public static void Prefix()
{
WorldHandler instance = WorldHandler.instance;
if (instance != null)
{
StoryManager storyManager = instance.StoryManager;
if (storyManager != null)
{
storyManager.SetStoryObjective((ObjectiveID)14);
}
}
}
public static void Postfix(ActiveOnChapter __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
if ((int)Utility.GetCurrentStage() != 5)
{
((Component)__instance).gameObject.SetActive((!BingoConfig.disableStory || __instance.chapters.Contains((Chapter)6)) && ((Object)__instance).name != "BeforeFinalBossElephants");
}
else
{
((Component)__instance).gameObject.SetActive(false);
}
}
}
[HarmonyPatch(typeof(BaseModule), "HandleStageFullyLoaded")]
public static class BaseModule_HandleStageFullyLoaded_Patch
{
public static void Postfix()
{
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
Core instance = Core.Instance;
SaveManager val = ((instance != null) ? instance.SaveManager : null);
WorldHandler instance2 = WorldHandler.instance;
Player val2 = ((instance2 != null) ? instance2.GetCurrentPlayer() : null);
if ((Object)(object)val2 != (Object)null && ((val != null) ? val.CurrentSaveSlot : null) != null)
{
Stage currentStage = Utility.GetCurrentStage();
val.CurrentSaveSlot.GetStageProgress(currentStage).respawnPos = ((Component)val2).transform.position;
StageProgress stageProgress = val.CurrentSaveSlot.GetStageProgress(currentStage);
Quaternion rotation = ((Component)val2).transform.rotation;
stageProgress.respawnRot = ((Quaternion)(ref rotation)).eulerAngles;
val.SaveCurrentSaveSlotImmediate();
}
BingoHandleStage.UpdateStageProgress((instance2 != null) ? instance2.SceneObjectsRegister : null, Utility.GetCurrentStage());
}
}
[HarmonyPatch(typeof(WorldHandler), "SavePosToNearestReachedRespawner")]
public static class WorldHandler_SavePosToNearestReachedRespawner_Patch
{
public static bool Prefix(WorldHandler __instance)
{
//IL_001d: 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 (!BingoHandleStage.HasLeftRespawn)
{
Player currentPlayer = __instance.GetCurrentPlayer();
if ((Object)(object)currentPlayer != (Object)null)
{
if (Vector3.Distance(((Component)currentPlayer).transform.position, BingoHandleStage.spawnPosition) > 2f)
{
BingoHandleStage.HasLeftRespawn = true;
return true;
}
return false;
}
}
return true;
}
}
public static bool newGame;
}
internal class Patch_NPCAvailability : HarmonyPatch
{
[HarmonyPatch(typeof(WorldHandler), "SetNPCAvailabilityBasedOnPlayer")]
public static class WorldHandler_SetNPCAvailabilityBasedOnPlayer_Patch
{
public static bool Prefix(SceneObjectsRegister ___sceneObjectsRegister)
{
EnableNPCs(___sceneObjectsRegister);
return false;
}
}
[HarmonyPatch(typeof(WorldHandler), "SetNPCAvailabilityBasedOnCharacter")]
public static class WorldHandler_SetNPCAvailabilityBasedOnCharacter_Patch
{
public static bool Prefix(SceneObjectsRegister ___sceneObjectsRegister)
{
EnableNPCs(___sceneObjectsRegister);
return false;
}
}
[HarmonyPatch(typeof(WorldHandler), "SetNPCAvailabilityBasedOnCharacterSelect")]
public static class WorldHandler_SetNPCAvailabilityBasedOnCharacterSelect_Patch
{
public static bool Prefix(SceneObjectsRegister ___sceneObjectsRegister)
{
EnableNPCs(___sceneObjectsRegister);
return false;
}
}
[HarmonyPatch(typeof(WorldHandler), "CharacterIsAlreadyNPCInScene")]
public static class WorldHandler_CharacterIsAlreadyNPCInScene_Patch
{
public static bool Prefix(ref bool __result)
{
__result = false;
return false;
}
}
public static void EnableNPCs(SceneObjectsRegister sceneObjectsRegister)
{
foreach (NPC nPC in sceneObjectsRegister.NPCs)
{
nPC.InvokeMethod("SetAvailable", true);
}
}
}
internal class Patch_RepLabel : HarmonyPatch
{
[HarmonyPatch(typeof(Player), "SetRepLabel")]
public static class Player_SetRepLabel_Patch
{
public static bool Prefix(GameplayUI ___ui)
{
if (!BingoConfig.repDisplay)
{
return true;
}
Core instance = Core.Instance;
object obj;
if (instance == null)
{
obj = null;
}
else
{
SaveManager saveManager = instance.SaveManager;
if (saveManager == null)
{
obj = null;
}
else
{
SaveSlotData currentSaveSlot = saveManager.CurrentSaveSlot;
obj = ((currentSaveSlot != null) ? currentSaveSlot.GetCurrentStageProgress() : null);
}
}
StageProgress val = (StageProgress)obj;
if (val != null)
{
((TMP_Text)___ui.repLabel).text = val.reputation.ToString();
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Player), "RepDisplayUpdate")]
public static class Player_RepDisplayUpdate_Patch
{
public static bool Prefix(ref float ___showRepLingerTimer, ref int ___showAddRep, ref float ___showingREP)
{
if (!BingoConfig.repDisplay)
{
return true;
}
___showRepLingerTimer = 99f;
___showAddRep = 0;
___showingREP = -1f;
return true;
}
}
}
internal class Patch_BingoSync : HarmonyPatch
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class Pickup_ApplyPickupType_Patch
{
public static void Postfix(AUnlockable unlockable, PickUpType pickupType)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected I4, but got Unknown
//IL_0075: 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_002a: Invalid comparison between Unknown and I4
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
if ((int)TrueBingoSync.bingoSync.Status != 0)
{
return;
}
string text = string.Empty;
switch (pickupType - 3)
{
default:
if ((int)pickupType == 11)
{
text = English.GetSkinText(((MoveStyleSkin)((unlockable is MoveStyleSkin) ? unlockable : null)).Title, Array.Empty<string>());
}
break;
case 0:
text = ((MusicTrack)((unlockable is MusicTrack) ? unlockable : null)).Title;
break;
case 1:
text = ((GraffitiAppEntry)((unlockable is GraffitiAppEntry) ? unlockable : null)).Title;
break;
case 2:
{
if (HardCharNames.TryGetValue(((OutfitUnlockable)((unlockable is OutfitUnlockable) ? unlockable : null)).character, out var value))
{
text = StringExtensions.FirstCharToUpper(value.ToLower()) + ": " + English.GetSkinText(((OutfitUnlockable)((unlockable is OutfitUnlockable) ? unlockable : null)).outfitName, Array.Empty<string>());
}
break;
}
}
if (text != string.Empty)
{
MarkObjective(text, TrueBingoSync.ObjectiveType.ItemPickup, pickupType);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class SaveSlotData_UnlockCharacter_Patch
{
public static void Postfix(Characters character)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
if ((int)TrueBingoSync.bingoSync.Status == 0)
{
MarkObjective(StringExtensions.FirstCharToUpper(English.GetCharacterName(character).ToLower()), TrueBingoSync.ObjectiveType.CharacterUnlock);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class NPC_UnlockTaxi_Patch
{
public static void Postfix()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if ((int)TrueBingoSync.bingoSync.Status == 0)
{
MarkObjective("Save the Taxi Driver", TrueBingoSync.ObjectiveType.TaxiDriver);
}
}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public static class StageProgress_AddRep_Patch
{
public static void Postfix(int ___reputation, Stage ___stageID)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected I4, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
if ((int)TrueBingoSync.bingoSync.Status == 0)
{
int num = 999;
switch (___stageID - 4)
{
case 0:
case 8:
num = 142;
break;
case 1:
num = 108;
break;
case 7:
num = 107;
break;
case 2:
case 5:
num = 148;
break;
case 3:
num = 184;
break;
}
if (___reputation >= num)
{
MarkObjective(English.GetStageName(___stageID), TrueBingoSync.ObjectiveType.Rep);
}
}
}
}
private static readonly IGameTextLocalizer English = (IGameTextLocalizer)new TextMeshProGameTextLocalizer((SystemLanguage)10, (SystemLanguage)10, Core.Instance.localizerData, Core.Instance.platformData.languageData, Core.Instance.platformData.buttonSpriteData, Core.Instance.GameInput);
public static Dictionary<Characters, string> HardCharNames = new Dictionary<Characters, string>
{
{
(Characters)0,
"VINYL"
},
{
(Characters)1,
"FRANK"
},
{
(Characters)2,
"COIL"
},
{
(Characters)3,
"RED"
},
{
(Characters)4,
"TRYCE"
},
{
(Characters)5,
"BEL"
},
{
(Characters)6,
"RAVE"
},
{
(Characters)7,
"DOT EXE"
},
{
(Characters)8,
"SOLACE"
},
{
(Characters)9,
"DJ CYBER"
},
{
(Characters)10,
"ECLIPSE"
},
{
(Characters)11,
"DEVIL THEORY"
},
{
(Characters)12,
"FAUX"
},
{
(Characters)13,
"FLESH PRINCE"
},
{
(Characters)14,
"RIETVELD"
},
{
(Characters)15,
"FELIX"
},
{
(Characters)16,
"OLDHEAD"
},
{
(Characters)17,
"BASE"
},
{
(Characters)18,
"JAY"
},
{
(Characters)19,
"MESH"
},
{
(Characters)20,
"FUTURISM"
},
{
(Characters)21,
"RISE"
},
{
(Characters)22,
"SHINE"
},
{
(Characters)23,
"FAUX"
},
{
(Characters)24,
"DOT EXE"
},
{
(Characters)25,
"RED FELIX"
}
};
private static void MarkObjective(string itemToSend, TrueBingoSync.ObjectiveType objectiveType, PickUpType? pickupType = null)
{
TrueBingoSync.MarkObjective(itemToSend, objectiveType, pickupType);
}
}
}
namespace TrueBingo.Components
{
internal class Component_IreneTrigger : MonoBehaviour
{
private ProgressObject BackToPrinceTrigger;
private ProgressObject ProgressObject_Bel;
private ProgressObject ProgressObject_AmbushEnemies;
private WorldHandler worldHandler;
private Player player;
private SaveSlotData saveSlotData;
private Encounter encounter;
private const string encounterName = "CombatEncounter_IreneUnlockChallenge";
private bool ShouldBeActive
{
get
{
if (!BackToPrinceTrigger.isActive && !ProgressObject_Bel.isActive && (Object)(object)encounter == (Object)null)
{
return !player.IsBusyWithSequence();
}
return false;
}
}
public void Awake()
{
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
worldHandler = WorldHandler.instance;
WorldHandler obj = worldHandler;
player = ((obj != null) ? obj.GetCurrentPlayer() : null);
Core instance = Core.Instance;
object obj2;
if (instance == null)
{
obj2 = null;
}
else
{
SaveManager saveManager = instance.SaveManager;
obj2 = ((saveManager != null) ? saveManager.CurrentSaveSlot : null);
}
saveSlotData = (SaveSlotData)obj2;
WorldHandler instance2 = WorldHandler.instance;
List<ProgressObject> list = ((instance2 == null) ? null : instance2.SceneObjectsRegister?.progressObjects);
if (list != null)
{
BackToPrinceTrigger = list.Find((ProgressObject x) => ((Object)x).name == "BackToPrinceTrigger");
ProgressObject_Bel = list.Find((ProgressObject x) => ((Object)x).name == "ProgressObject_Bel");
ProgressObject_AmbushEnemies = list.Find((ProgressObject x) => ((Object)x).name == "ProgressObject_AmbushEnemies");
}
Core.OnAlwaysUpdate += new OnUpdateHandler(CheckShouldBeActive);
}
public void CheckShouldBeActive()
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
if (saveSlotData != null)
{
bool unlocked = saveSlotData.GetCharacterProgress((Characters)14).unlocked;
if (!unlocked && (Object)(object)worldHandler != (Object)null && (Object)(object)player != (Object)null && (Object)(object)BackToPrinceTrigger != (Object)null && (Object)(object)ProgressObject_Bel != (Object)null)
{
encounter = worldHandler?.GetValue<Encounter>("currentEncounter", Array.Empty<object>());
GameObject gameObject = ((Component)this).gameObject;
Encounter obj = encounter;
gameObject.SetActive(((obj != null) ? ((Object)obj).name : null) == "CombatEncounter_IreneUnlockChallenge" || ShouldBeActive);
((Component)ProgressObject_AmbushEnemies).gameObject.SetActive(ShouldBeActive);
}
else if (unlocked)
{
Core.OnAlwaysUpdate -= new OnUpdateHandler(CheckShouldBeActive);
((Component)ProgressObject_AmbushEnemies).gameObject.SetActive(false);
}
}
}
public void OnDestroy()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
Core.OnAlwaysUpdate -= new OnUpdateHandler(CheckShouldBeActive);
}
}
}
namespace TrueBingo.BingoSyncManager
{
internal class BingoSyncGUI : MonoBehaviour
{
public static bool GUIOpen = false;
public static bool Countdown = false;
public static bool Pause = false;
public static string countdownMessage = "";
private Dictionary<string, string> textFields = new Dictionary<string, string>();
private const float windowY = 60f;
private const float windowW = 500f;
private const float windowH = 200f;
private const float elementX = 20f;
private const float elementH = 20f;
private const float elementPadding = 4f;
public const float labelSpace = 110f;
private int index;
private const string windowName = "BingoSync";
public static string errorMessage = string.Empty;
private readonly int possibleColors = Enum.GetValues(typeof(PlayerColors)).Length;
private PlayerColors PlayerColor = (PlayerColors)1;
private string RoomID = string.Empty;
private string Password = string.Empty;
private string PlayerName = string.Empty;
private float windowX => (float)Screen.width * 0.5f - 250f;
private float elementY => 20f + 20f * (float)(index - 1) + 4f * (float)index;
public static float elementW => 460f;
private Rect elementRect => new Rect(20f, elementY, elementW, 20f);
private string ConnectionColor
{
get
{
//IL_0005: 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_0017: Invalid comparison between Unknown and I4
if ((int)TrueBingoSync.bingoSync.Status != 0)
{
if ((int)TrueBingoSync.bingoSync.Status != 1)
{
return "red";
}
return "orange";
}
return "lime";
}
}
private string ConnectColor
{
get
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)TrueBingoSync.bingoSync.Status != 3)
{
return "grey";
}
return "white";
}
}
private string DisconnectionColor
{
get
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
if ((int)TrueBingoSync.bingoSync.Status != 0)
{
return "grey";
}
return "red";
}
}
private void Awake()
{
UpdateBingoSyncConfig("Room ID", ref RoomID);
UpdateBingoSyncConfig("Room Password", ref Password);
UpdateBingoSyncConfig("Player Name", ref PlayerName);
UpdateBingoSyncConfig("Player Color", ref PlayerColor);
if (BingoConfig.autoconnect && RoomID != string.Empty && PlayerName != string.Empty)
{
JoinRoom();
}
}
private void UpdateBingoSyncConfig<T>(string key, ref T reference)
{
ConfigEntry<T> val = default(ConfigEntry<T>);
if (BingoConfig.config_bingosync.TryGetEntry<T>("BingoSync", key, ref val))
{
reference = val.Value;
}
}
private void SetBingoSyncConfigValue<T>(string key, T value)
{
ConfigEntry<T> val = default(ConfigEntry<T>);
if (BingoConfig.config_bingosync.TryGetEntry<T>("BingoSync", key, ref val))
{
val.Value = value;
}
}
private void OnGUI()
{
//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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_008d: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
BingoSyncGUIConfig.SetupStyles();
if (GUIOpen)
{
GUIWindow(0, "BingoSync", new Color(0f, 0f, 0f, 1f));
}
if (Pause)
{
GUI.contentColor = Color.black;
GUI.Label(new Rect(3f, 3f, (float)Screen.width, (float)Screen.height), "Paused", BingoSyncGUIConfig.Styles.Pause);
GUI.contentColor = Color.red;
GUI.Label(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), "Paused", BingoSyncGUIConfig.Styles.Pause);
}
if (Countdown)
{
Pause = false;
GUIStyle countdownLabel = BingoSyncGUIConfig.GetCountdownLabel();
GUI.contentColor = Color.black;
GUI.Label(new Rect(3f, 3f, (float)Screen.width, (float)Screen.height), countdownMessage, countdownLabel);
GUI.contentColor = Color.white;
GUI.Label(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), countdownMessage, countdownLabel);
}
}
private Color PlayerColorToColor(PlayerColors playerColor)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected I4, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
return (Color)((int)playerColor switch
{
0 => BingoSyncGUIConfig.Colors.Orange,
1 => BingoSyncGUIConfig.Colors.Red,
2 => BingoSyncGUIConfig.Colors.Blue,
3 => BingoSyncGUIConfig.Colors.Green,
4 => BingoSyncGUIConfig.Colors.Purple,
5 => BingoSyncGUIConfig.Colors.Navy,
6 => BingoSyncGUIConfig.Colors.Teal,
7 => BingoSyncGUIConfig.Colors.Brown,
8 => BingoSyncGUIConfig.Colors.Pink,
9 => BingoSyncGUIConfig.Colors.Yellow,
_ => Color.black,
});
}
private void HandleGUI(int windowID)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: 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_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Invalid comparison between Unknown and I4
//IL_01d6: 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: Invalid comparison between Unknown and I4
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Invalid comparison between Unknown and I4
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
index = 0;
if (GUIButton("Color: " + ((object)(PlayerColors)(ref PlayerColor)).ToString(), PlayerColorToColor(PlayerColor)) && !TrueBingoSync.IsUpdatingColor && (int)TrueBingoSync.bingoSync.Status != 1 && (int)TrueBingoSync.bingoSync.Status != 2)
{
PlayerColor = (PlayerColors)(((int)PlayerColor < possibleColors - 1) ? (PlayerColor + 1) : 0);
TrueBingoSync.SetPlayerColor(PlayerColor);
SetBingoSyncConfigValue<PlayerColors>("Player Color", PlayerColor);
BingoConfig.config_bingosync.Save();
}
RoomID = GUITextField("RoomID", RoomID, Color.white, Color.white, "Room ID:", password: true);
Password = GUITextField("Password", Password, Color.white, Color.white, "Password:", password: true);
PlayerName = GUITextField("Name", PlayerName, Color.white, Color.white, "Player Name:");
GUILabel(errorMessage, Color.red);
string[] obj = new string[7] { "<color=", ConnectColor, ">Connect</color> <color=", ConnectionColor, ">(", null, null };
ConnectionStatus status = TrueBingoSync.bingoSync.Status;
obj[5] = ((object)(ConnectionStatus)(ref status)).ToString();
obj[6] = ")</color>";
if (GUIButton(string.Concat(obj), Color.gray) && (int)TrueBingoSync.bingoSync.Status == 3)
{
errorMessage = "";
JoinRoom();
}
if (GUIButton("<color=" + DisconnectionColor + ">Disconnect</color>", Color.gray) && (int)TrueBingoSync.bingoSync.Status == 0)
{
TrueBingoSync.Disconnect();
}
}
private Rect GUIWindow(int ID, string name, Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
GUI.backgroundColor = color;
index++;
return GUI.Window(ID, new Rect(windowX, 60f, 500f, 200f), new WindowFunction(HandleGUI), "BingoSync");
}
private void GUILabel(string text, Color color, bool updateIndex = true, Rect customRect = default(Rect))
{
//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_001a: Unknown result type (might be due to invalid IL or missing references)
if (updateIndex)
{
index++;
}
GUI.contentColor = color;
GUI.Label(updateIndex ? elementRect : customRect, text, BingoSyncGUIConfig.GetLabelStyle(!updateIndex));
}
private void JoinRoom()
{
//IL_0013: 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_0023: Expected O, but got Unknown
TrueBingoSync.JoinRoom(new RoomInfo(RoomID, Password, PlayerName, PlayerColor, false));
}
private bool GUIButton(string text, Color color)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
index++;
Color val = default(Color);
((Color)(ref val))..ctor(color.r / 255f, color.g / 255f, color.b / 255f, 0.7f);
BingoSyncGUIConfig.Textures.Button_Background.SetPixel(0, 0, val);
BingoSyncGUIConfig.Textures.Button_Background.Apply();
BingoSyncGUIConfig.Textures.Button_Hover.SetPixel(0, 0, val * 1.1f);
BingoSyncGUIConfig.Textures.Button_Hover.Apply();
BingoSyncGUIConfig.Textures.Button_Click.SetPixel(0, 0, val * 0.8f);
BingoSyncGUIConfig.Textures.Button_Click.Apply();
return GUI.Button(elementRect, text, BingoSyncGUIConfig.Styles.Button);
}
private string GUITextField(string ID, string initialText, Color textColor, Color outlineColor, string label = null, bool password = false)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_007a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
index++;
string value = initialText;
if (!textFields.TryGetValue(ID, out value))
{
textFields.Add(ID, value);
}
if (value == null)
{
value = initialText;
}
GUI.contentColor = textColor;
GUI.backgroundColor = outlineColor;
Rect val = elementRect;
if (label != null && label != string.Empty)
{
Rect val2 = elementRect;
float num = ((Rect)(ref val2)).x + 110f;
val2 = elementRect;
float y = ((Rect)(ref val2)).y;
val2 = elementRect;
float num2 = ((Rect)(ref val2)).width - 110f;
val2 = elementRect;
((Rect)(ref val))..ctor(num, y, num2, ((Rect)(ref val2)).height);
Color white = Color.white;
val2 = elementRect;
float x = ((Rect)(ref val2)).x;
val2 = elementRect;
float y2 = ((Rect)(ref val2)).y;
val2 = elementRect;
float num3 = ((Rect)(ref val2)).width - ((Rect)(ref val)).width;
val2 = elementRect;
GUILabel(label, white, updateIndex: false, new Rect(x, y2, num3, ((Rect)(ref val2)).height));
}
string empty = string.Empty;
empty = ((!password) ? GUI.TextField(val, value) : GUI.PasswordField(val, value, "*"[0], 64));
return textFields[ID] = empty;
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(BingoConfig.menukey))
{
GUIOpen = !GUIOpen;
Core instance = Core.Instance;
GameInput val = ((instance != null) ? instance.GameInput : null);
if (GUIOpen)
{
if (val != null)
{
val.DisableMouse(0);
}
}
else
{
if (instance != null)
{
BaseModule baseModule = instance.BaseModule;
if (baseModule != null)
{
baseModule.RestoreMouseInputState();
}
}
if (val != null)
{
val.EnableMouse(0);
}
}
}
if (GUIOpen)
{
Cursor.visible = true;
}
}
}
internal static class BingoSyncGUIConfig
{
public static class Styles
{
public static GUIStyle Button;
public static GUIStyle Label;
public static GUIStyle LabelCountdown;
public static GUIStyle Pause;
}
public static class Textures
{
public static readonly Texture2D Button_Background = new Texture2D(1, 1);
public static readonly Texture2D Button_Hover = new Texture2D(1, 1);
public static readonly Texture2D Button_Click = new Texture2D(1, 1);
}
public static class Colors
{
public static readonly Color Orange = new Color(254f, 154f, 20f);
public static readonly Color Red = new Color(247f, 72f, 67f);
public static readonly Color Blue = new Color(62f, 157f, 248f);
public static readonly Color Green = new Color(39f, 209f, 16f);
public static readonly Color Purple = new Color(128f, 44f, 189f);
public static readonly Color Navy = new Color(11f, 66f, 168f);
public static readonly Color Teal = new Color(62f, 145f, 144f);
public static readonly Color Brown = new Color(162f, 87f, 33f);
public static readonly Color Pink = new Color(232f, 131f, 166f);
public static readonly Color Yellow = new Color(212f, 205f, 19f);
}
private static bool stylesSetUp;
public static void SetupStyles()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
if (!stylesSetUp)
{
Styles.Button = new GUIStyle(GUI.skin.button);
Styles.Button.normal.background = Textures.Button_Background;
Styles.Button.hover.background = Textures.Button_Hover;
Styles.Button.active.background = Textures.Button_Click;
Styles.Label = new GUIStyle(GUI.skin.label);
Styles.Label.alignment = (TextAnchor)4;
Styles.Label.wordWrap = false;
Styles.Label.fontStyle = (FontStyle)1;
Styles.LabelCountdown = new GUIStyle(GUI.skin.label);
Styles.LabelCountdown.fixedWidth = Screen.width;
Styles.LabelCountdown.alignment = (TextAnchor)4;
Styles.LabelCountdown.wordWrap = false;
Styles.LabelCountdown.fontStyle = (FontStyle)1;
Styles.Pause = new GUIStyle(GUI.skin.label);
Styles.Pause.fixedWidth = Screen.width;
Styles.Pause.alignment = (TextAnchor)4;
Styles.Pause.wordWrap = false;
Styles.Pause.fontStyle = (FontStyle)1;
Styles.Pause.fontSize = Mathf.FloorToInt((float)Screen.width * 0.05f);
stylesSetUp = true;
}
}
public static GUIStyle GetLabelStyle(bool field = false)
{
Styles.Label.fixedWidth = (field ? 110f : BingoSyncGUI.elementW);
return Styles.Label;
}
public static GUIStyle GetCountdownLabel()
{
int num = 1;
if (int.TryParse(BingoSyncGUI.countdownMessage, out var result))
{
num = result;
}
int num2 = Mathf.FloorToInt((float)Screen.width * 0.08f);
int num3 = num2 / 4;
Styles.LabelCountdown.fontSize = num2 + (5 * num3 - Mathf.FloorToInt((float)(num * num3)));
return Styles.LabelCountdown;
}
}
internal static class TrueBingoSync
{
public enum ObjectiveType
{
ItemPickup,
CharacterUnlock,
TaxiDriver,
Rep
}
public static readonly BingoSync bingoSync = new BingoSync();
public static bool IsUpdatingColor = false;
private static bool _paused = false;
private static List<MessageReceived> receivers = new List<MessageReceived>();
private static readonly Dictionary<Stage, string> StageToName = new Dictionary<Stage, string>
{
{
(Stage)5,
"Hideout"
},
{
(Stage)12,
"Brink"
},
{
(Stage)6,
"Mall"
},
{
(Stage)7,
"Mataan"
},
{
(Stage)11,
"Square"
},
{
(Stage)4,
"Versum"
},
{
(Stage)9,
"Pyramid"
}
};
private static AppEmail EmailApp
{
get
{
WorldHandler instance = WorldHandler.instance;
if (instance == null)
{
return null;
}
Player currentPlayer = instance.GetCurrentPlayer();
if (currentPlayer == null)
{
return null;
}
Phone value = currentPlayer.GetValue<Phone>("phone", Array.Empty<object>());
if (value == null)
{
return null;
}
return value.GetAppInstance<AppEmail>();
}
}
private static void OnMessage(SocketMessage message)
{
if (message.type == "goal" && BingoConfig.phonenotification)
{
SendNotification(message);
}
else
{
if (!(message.type == "chat"))
{
return;
}
string text = message.text;
if (text == null || text == string.Empty)
{
return;
}
text = text.Trim();
if (!text.StartsWith("!"))
{
return;
}
text = text.Substring(1).Trim(new char[1] { ' ' });
string[] array = new string[1] { text };
if (Enumerable.Contains(array[0], ' '))
{
array = text.Split(new char[1] { ' ' });
}
switch (array[0].ToLower())
{
case "start":
StartCountdown();
break;
case "ping":
SendMessage("pong", networkReply: true);
break;
case "pause":
{
Core instance = Core.Instance;
if (instance != null)
{
instance.PauseCore((PauseType)8);
}
_paused = true;
BingoSyncGUI.Pause = true;
break;
}
case "resume":
StartCountdown(resume: true);
break;
case "help":
if (message.player.name.ToLower().Trim() == bingoSync.CurrentRoomInfo.PlayerName.ToLower().Trim())
{
SendMessage("[!start] Start Countdown, [!pause] Pause all players, [!resume] Resume all players, [!ping] Test players connection");
}
break;
}
}
}
public static void Update()
{
if (_paused && !Core.Instance.IsCorePaused)
{
Core.Instance.PauseCore((PauseType)8);
}
}
private static async void StartCountdown(bool resume = false)
{
if (_paused && !resume)
{
return;
}
if (resume)
{
while (BingoSyncGUI.Countdown)
{
await Task.Yield();
}
}
if (BingoSyncGUI.Countdown)
{
return;
}
BingoSyncGUI.countdownMessage = "";
BingoSyncGUI.Countdown = true;
BingoSyncGUI.Pause = false;
int num = 5;
Core instance = Core.Instance;
AudioManager audioManager = ((instance != null) ? instance.AudioManager : null);
MethodInfo PlaySfxGameplay = null;
if (audioManager != null)
{
PlaySfxGameplay = ((object)audioManager).GetType().GetMethods(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault((MethodInfo x) => x.Name == "PlaySfxGameplay" && x.GetParameters().Length == 3 && x.GetParameters().All((ParameterInfo y) => y.ParameterType == typeof(SfxCollectionID) || y.ParameterType == typeof(AudioClipID) || y.ParameterType == typeof(float)));
}
for (int i = num; i >= 0; i--)
{
if (i != 0)
{
PlaySfxGameplay?.Invoke(audioManager, new object[3]
{
(object)(SfxCollectionID)18,
(object)(AudioClipID)985,
0f
});
BingoSyncGUI.countdownMessage = i.ToString();
}
else
{
PlaySfxGameplay?.Invoke(audioManager, new object[3]
{
(object)(SfxCollectionID)19,
(object)(AudioClipID)409,
0f
});
BingoSyncGUI.countdownMessage = "GO!";
if (resume)
{
_paused = false;
Core instance2 = Core.Instance;
if (instance2 != null)
{
instance2.UnPauseCore((PauseType)8);
}
}
}
await Task.Delay(TimeSpan.FromSeconds(1.0));
}
BingoSyncGUI.Countdown = false;
}
public static async void JoinRoom(RoomInfo roomInfo)
{
if ((int)(await bingoSync.JoinRoom(roomInfo)) == 0)
{
RemoveReceivers();
AddReceiver(new MessageReceived(OnMessage));
}
else
{
BingoSyncGUI.errorMessage = "Failed Connection: Check Room ID / Password";
}
}
public static async void Disconnect()
{
if ((int)bingoSync.Status == 0)
{
await bingoSync.Disconnect();
RemoveReceivers();
}
}
private static void RemoveReceivers()
{
for (int i = 0; i < receivers.Count; i++)
{
MessageReceived val = receivers[i];
bingoSync.OnMessageReceived -= val;
}
}
private static void AddReceiver(MessageReceived messageReceiver)
{
bingoSync.OnMessageReceived += messageReceiver;
receivers.Add(messageReceiver);
}
public static async void SendMessage(string message, bool networkReply = false)
{
if ((int)bingoSync.Status == 0)
{
if (networkReply)
{
float networkTime = Time.time;
await bingoSync.SendChatMessage("pong");
message = $"{Time.time - networkTime}";
}
await bingoSync.SendChatMessage(message);
}
}
public static async void MarkObjective(string itemToSend, ObjectiveType objectiveType, PickUpType? pickupType = null)
{
if ((int)bingoSync.Status != 0 || itemToSend == string.Empty)
{
return;
}
SlotInfo itemSlot = null;
SlotInfo[] array = await bingoSync.GetBoardSlots();
if (array == null || array.Length == 0)
{
return;
}
string stage = string.Empty;
if (!StageToName.TryGetValue(Utility.GetCurrentStage(), out stage))
{
return;
}
switch (objectiveType)
{
case ObjectiveType.ItemPickup:
if ((int)pickupType.GetValueOrDefault() != 5)
{
SlotInfo[] source = array.Where((SlotInfo x) => x.Info.ToLower().StartsWith(stage.ToLower()) && !Enumerable.Contains(x.Info, ':') && x.Info.Contains(" - ")).ToArray();
itemSlot = ((IEnumerable<SlotInfo>)source).FirstOrDefault((Func<SlotInfo, bool>)((SlotInfo x) => x.Info != null && CompareItems(itemToSend, GetItemFromSlotName(x.Info))));
}
else
{
itemSlot = ((IEnumerable<SlotInfo>)array).FirstOrDefault((Func<SlotInfo, bool>)((SlotInfo x) => x.Info != null && Enumerable.Contains(x.Info, ':') && GetItemFromSlotName(x.Info).ToLower().Contains(itemToSend.ToLower())));
}
break;
case ObjectiveType.CharacterUnlock:
itemToSend = itemToSend.ToLower().Trim();
if (Enumerable.Contains(itemToSend, ' '))
{
itemToSend = itemToSend.Split(new char[1] { ' ' })[0];
}
itemSlot = ((IEnumerable<SlotInfo>)array).FirstOrDefault((Func<SlotInfo, bool>)((SlotInfo x) => x.Info.ToLower().Contains("(" + stage.ToLower() + ")") && x.Info.ToLower().Contains("unlock " + itemToSend)));
break;
case ObjectiveType.TaxiDriver:
itemSlot = ((IEnumerable<SlotInfo>)array).FirstOrDefault((Func<SlotInfo, bool>)((SlotInfo x) => x.Info.ToLower().Contains("(" + stage.ToLower() + ")") && x.Info.ToLower().Contains(itemToSend.ToLower().Trim())));
break;
case ObjectiveType.Rep:
itemToSend = itemToSend.ToLower().Trim();
if (Enumerable.Contains(itemToSend, ' '))
{
itemToSend = itemToSend.Split(new char[1] { ' ' })[1];
}
itemSlot = ((IEnumerable<SlotInfo>)array).FirstOrDefault((Func<SlotInfo, bool>)((SlotInfo x) => x.Info.ToLower().Contains(" rep ") && x.Info.ToLower().Contains(itemToSend)));
break;
}
if (itemSlot != null)
{
await bingoSync.SelectSlot(itemSlot.ID, true, (PlayerColors?)null);
}
}
public static async void SetPlayerColor(PlayerColors playerColor)
{
//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)
IsUpdatingColor = true;
await bingoSync.SetPlayerColor(playerColor);
IsUpdatingColor = false;
}
private static string GetItemFromSlotName(string name)
{
Match match = Regex.Match(name, "- (.+?) -");
if (!match.Success)
{
return string.Empty;
}
return match.Groups[1].Value;
}
private static bool CompareItems(string pickup, string itemOnBoard)
{
pickup = pickup.ToLower();
itemOnBoard = itemOnBoard.ToLower();
if (pickup.Replace(" ", string.Empty).Trim().Equals(itemOnBoard.Replace(" ", string.Empty).Trim()))
{
return true;
}
int num = 0;
int num2 = 2;
int num3 = 3;
for (int i = 0; i < itemOnBoard.Length; i++)
{
if (i + (num2 - 1) <= itemOnBoard.Length - 1)
{
string value = itemOnBoard.Substring(i, num2);
if (pickup.Contains(value))
{
num += num3;
}
}
else
{
num--;
}
}
int num4 = Mathf.Abs(pickup.Length - itemOnBoard.Length);
num -= num4;
int num5 = Mathf.FloorToInt((float)itemOnBoard.Length * ((float)num3 * 0.5f) - (float)num4);
return num >= num5;
}
public static void SendNotification(SocketMessage response)
{
SocketSlot square = response.square;
string obj = ((square != null) ? square.colors : null);
SocketPlayer player = response.player;
string text = ((player != null) ? player.name : null);
SocketSlot square2 = response.square;
string collection = ((square2 != null) ? square2.name : null);
if (obj == null || text == null || collection == null || response.remove)
{
return;
}
string text2 = collection;
string text3 = StageToName.Values.ToArray().FirstOrDefault((string x) => collection.Trim().StartsWith(x) || collection.Trim().EndsWith("(" + x + ")") || (collection.ToLower().Contains(" rep ") && collection.Contains(x)));
if (collection.Contains(" - "))
{
text2 = GetItemFromSlotName(collection);
}
else if (Regex.Match(collection, "\\((.+?)\\)").Success)
{
text2 = collection.Substring(0, collection.IndexOf('(') - 1).Trim();
}
else if (collection.ToLower().Contains(" rep "))
{
text2 = collection.Substring(collection.ToLower().IndexOf("rep "));
}
if (text != string.Empty && text2 != string.Empty && text.ToLower().Replace(" ", "").Trim() != bingoSync.CurrentRoomInfo.PlayerName.ToLower().Replace(" ", "").Trim())
{
string text4 = text + ": \"" + text2 + "\"";
if (text3 != null && text3 != string.Empty)
{
text4 = text4 + " (" + text3 + ")";
}
WaitThenSendNotification(text4);
}
}
private static async void WaitThenSendNotification(string notification)
{
Core instance = Core.Instance;
BaseModule val = ((instance != null) ? instance.BaseModule : null);
if ((Object)(object)val == (Object)null)
{
return;
}
if (val.IsLoading)
{
AppEmail val2 = await GetEmailApp(Time.time + (float)TimeSpan.FromSeconds(10.0).TotalSeconds);
if ((Object)(object)val2 != (Object)null)
{
((App)val2).PushNotification(notification, (AUnlockable)null);
}
}
else
{
AppEmail emailApp = EmailApp;
if (emailApp != null)
{
((App)emailApp).PushNotification(notification, (AUnlockable)null);
}
}
}
private static async Task<AppEmail> GetEmailApp(float endAfter)
{
AppEmail appEmail = null;
while ((Object)(object)appEmail == (Object)null && !(Time.time > endAfter))
{
appEmail = EmailApp;
if ((Object)(object)appEmail == (Object)null)
{
await Task.Yield();
}
}
return appEmail;
}
}
}