using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Photon; using SideLoader; using SideLoader.Helpers; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("PvP")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PvP")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8654b1db-7a3b-411b-9891-c0078b5dda2f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace PvP; public class BattleRoyale : MonoBehaviour { public static BattleRoyale Instance; public bool IsGameplayStarting = false; public bool IsGameplayEnding = false; public static int SupplyDropInterval = 120; public float LastSupplyDropTime = 0f; public int SupplyDropCounter = 0; public List ActiveItemContainers = new List(); public List ActiveBeamObjects = new List(); public GameObject beamObject; public static int EnemyDropInterval = 45; public float LastEnemySpawnTime = 0f; public List EnemyCharacters = new List(); internal void Awake() { Instance = this; } internal void Update() { if (MenuManager.Instance.IsInMainMenuScene) { if (IsGameplayStarting) { IsGameplayStarting = false; ((MonoBehaviour)this).StopAllCoroutines(); } if (PvP.Instance.CurrentGame == PvP.GameModes.BattleRoyale) { PvP.Instance.CurrentGame = PvP.GameModes.NONE; } } if (!IsGameplayStarting && IsGameplayEnding && !PvPGUI.Instance.ShowGUI) { PvPGUI.Instance.ShowGUI = true; } } public bool CheckCanStart() { //IL_002a: 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) List list = new List(); foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (!list.Contains(item.ControlledCharacter.Faction)) { list.Add(item.ControlledCharacter.Faction); } } if (list.Count() > 1) { return true; } return false; } public void StartBattleRoyale(bool skipLoad = false) { ((MonoBehaviour)RPCManager.Instance).photonView.RPC("RPCStartBattleRoyale", (PhotonTargets)0, new object[1] { skipLoad }); } public IEnumerator SetupAfterSceneLoad(bool skipLoad = false) { if (!skipLoad) { while (!NetworkLevelLoader.Instance.IsSceneLoading) { yield return (object)new WaitForSeconds(0.1f); } while (!NetworkLevelLoader.Instance.IsOverallLoadingDone) { yield return (object)new WaitForSeconds(0.1f); } } SetupCharacters(); while (NetworkLevelLoader.Instance.IsGameplayPaused) { yield return null; } yield return (object)new WaitForSeconds(1f); Debug.Log((object)"Setting up local scene..."); LocalSceneSetup(); if (!PhotonNetwork.isNonMasterClientInRoom) { Debug.Log((object)"Setting up as host..."); HostSceneSetup(); } Debug.Log((object)"Battle Royale is about to start, finalizing..."); RPCManager.Instance.StartGameplayRPC(2, "A Battle Royale has begun!"); EnemyDropInterval = Mathf.Clamp(45 - PlayerManager.Instance.GetRemainingPlayers().Count() * 2, 15, 45); Debug.Log((object)"Finalized!"); } private void HostSceneSetup() { //IL_00cb: 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) while (ItemManager.Instance.WorldItems.Keys.Count() > 0) { ItemManager.Instance.DestroyItem(ItemManager.Instance.WorldItems.Keys[0]); } if (Templates.BR_Templates.SpawnLocations.ContainsKey(SceneManagerHelper.ActiveSceneName)) { List list = Templates.BR_Templates.SpawnLocations[SceneManagerHelper.ActiveSceneName].ToList(); { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { Character controlledCharacter = item.ControlledCharacter; if (list.Count == 0) { list = Templates.BR_Templates.SpawnLocations[SceneManagerHelper.ActiveSceneName].ToList(); } int index = Random.Range(0, list.Count()); controlledCharacter.Teleport(list[index], ((Component)controlledCharacter).transform.rotation); list.RemoveAt(index); controlledCharacter.StatusEffectMngr.Purge(); } return; } } PvP.Instance.StopGameplay("An error has occured! We seem to be in the wrong scene."); } private void LocalSceneSetup() { //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown EnvironmentConditions.Instance.SetTimeOfDay(Templates.BR_Templates.TimeOfDayStarts[SceneManagerHelper.ActiveSceneName], false); if (Templates.BR_Templates.ObjectsToDeactivate.ContainsKey(SceneManagerHelper.ActiveSceneName)) { foreach (string item in Templates.BR_Templates.ObjectsToDeactivate[SceneManagerHelper.ActiveSceneName]) { GameObject val = GameObject.Find(item); if (val != null) { if (item == "JesusBeam") { beamObject = val; } val.SetActive(false); } } } if (Templates.BR_Templates.ObjectsToActivate.ContainsKey(SceneManagerHelper.ActiveSceneName)) { foreach (string item2 in Templates.BR_Templates.ObjectsToActivate[SceneManagerHelper.ActiveSceneName]) { GameObject val2 = GameObject.Find(item2); if (val2 != null) { val2.SetActive(true); continue; } GameObject val3 = FindInactiveObjectByName(item2); if (val3 != null) { val3.SetActive(true); } } } EnemyCharacters.Clear(); foreach (Character item3 in CharacterManager.Instance.Characters.Values.Where((Character x) => x.IsAI && (int)x.Faction != 1)) { EnemyCharacters.Add(item3); ((Component)item3).gameObject.SetActive(false); } foreach (PlayerSystem item4 in Global.Lobby.PlayersInLobby.Where((PlayerSystem x) => x.IsLocalPlayer)) { Character controlledCharacter = item4.ControlledCharacter; string text = "Pouch_" + UID.op_Implicit(controlledCharacter.UID); if (Object.op_Implicit((Object)(object)ItemManager.Instance.GetItem(text))) { ItemManager.Instance.DestroyItem(text); } ItemContainer val4 = null; if (Object.op_Implicit((Object)(object)controlledCharacter.Inventory.PouchPrefab)) { Transform val5 = Object.Instantiate(controlledCharacter.Inventory.PouchPrefab); val5.SetParent(((Component)this).transform, false); val4 = ((Component)val5).GetComponent(); ((Item)val4).SetKeepAlive(); ((Item)val4).UID = "CustomPouch_" + UID.op_Implicit(controlledCharacter.UID); ((Item)val4).ProcessInit(); At.SetField(controlledCharacter.Inventory, "m_inventoryPouch", (object)val4); if (PhotonNetwork.isNonMasterClientInRoom) { ((Item)val4).ForceUpdateParentChange(); } } if (controlledCharacter.Inventory.MapKnowledge == null) { CharacterMapKnowledge val6 = new CharacterMapKnowledge(); val6.Init(); At.SetField(controlledCharacter.Inventory, "m_mapKnowledge", (object)val6); } controlledCharacter.Inventory.Equipment.ProcessStart(); SetupStarterPack(controlledCharacter); controlledCharacter.StatusEffectMngr.Purge(); } UICompass[] array = Resources.FindObjectsOfTypeAll(); foreach (UICompass val7 in array) { ((UIElement)val7).Hide(); } } private void SetupCharacters() { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { CustomPlayerSetup(item.ControlledCharacter); } } private void CustomPlayerSetup(Character _char) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown CharacterSave val = SaveManager.Instance.CreateNewCharacterSave(); ((CharacterSaveData)val.PSave).NewSave = true; ((CharacterSaveData)val.PSave).ManaPoint = 0; ((CharacterSaveData)val.PSave).UID = UID.op_Implicit(_char.UID); val.PSave.Name = _char.Name; ((CharacterSaveData)val.PSave).VisualData = _char.VisualData; val.PSave.Food = 1000f; val.PSave.Drink = 1000f; val.PSave.HardcoreMode = false; val.ApplyLoadedSaveToChar(_char); At.SetField(_char.Stats, "m_maxHealthStat", (object)new Stat(500f)); At.SetField(_char.Stats, "m_maxStamina", (object)new Stat(200f)); At.SetField(_char.Stats, "m_maxManaStat", (object)new Stat(75f)); _char.Stats.GiveManaPoint(1); _char.Cheats.Invincible = false; _char.Cheats.IndestructibleEquipment = false; _char.Cheats.NotAffectedByWeightPenalties = false; _char.Cheats.NeedsEnabled = true; At.Invoke(_char.Stats, "UpdateVitalStats", Array.Empty()); _char.Stats.Reset(); _char.Stats.RestoreAllVitals(); if (At.GetField(_char.QuickSlotMngr, "m_quickSlots") is QuickSlot[] source) { for (int i = 0; i < source.Count(); i++) { _char.QuickSlotMngr.GetQuickSlot(i).Clear(); } } } private void SetupStarterPack(Character _char) { Debug.Log((object)("SetupStarterPack for " + ((Object)((Component)_char).gameObject).name)); Item val = ItemManager.Instance.GenerateItemNetwork(5300000); if ((Object)(object)val != (Object)null) { _char.Inventory.TakeItem(val.UID, false); At.Invoke(_char.Inventory.Equipment, "EquipWithoutAssociating", new object[2] { val, false }); ItemContainer val2 = _char.Inventory.Pouch; ItemContainer componentInChildren = ((Component)val).GetComponentInChildren(); if (componentInChildren != null) { val2 = componentInChildren; } AddItemsToContainer(Templates.BR_Templates.Weapons_Low, 1, ((Component)val2).transform); AddItemsToContainer(Templates.BR_Templates.Offhands_Low, 1, ((Component)val2).transform); AddItemsToContainer(Templates.BR_Templates.Supplies_Low, 5, ((Component)val2).transform); AddItemsToContainer(Templates.StarterSkills, Templates.StarterSkills.Count(), ((Component)val2).transform); } } public void UpdateBR() { if (!PhotonNetwork.isNonMasterClientInRoom) { WorldHostUpdate(); } } private void WorldHostUpdate() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) List remainingTeams = PlayerManager.Instance.GetRemainingTeams(); if (remainingTeams.Count() < 2) { Factions val = remainingTeams[0]; string text = ((object)(Factions)(ref val)).ToString(); if (!text.EndsWith("s")) { text += "s"; } PvP.Instance.StopGameplay(text + " have won!"); } if (LastSupplyDropTime <= 0f || Time.time - LastSupplyDropTime > (float)SupplyDropInterval) { LastSupplyDropTime = Time.time; SupplyDropCounter++; ((MonoBehaviour)this).StartCoroutine(GenerateSupplyDrops()); } if (!(Time.time - LastEnemySpawnTime > (float)EnemyDropInterval) || EnemyCharacters.Count() <= 0) { return; } LastEnemySpawnTime = Time.time; Character val2 = null; List list = EnemyCharacters.Where((Character x) => !((Component)x).gameObject.activeSelf).ToList(); if (list.Count() <= 0) { return; } Character butcher = list.Find((Character x) => x.Name.ToLower().Contains("butcher")); if (SupplyDropCounter < 3 || !Object.op_Implicit((Object)(object)butcher)) { if (Object.op_Implicit((Object)(object)butcher)) { list.Remove(butcher); } int index = Random.Range(0, list.Count()); val2 = list.ElementAt(index); } else { val2 = butcher; } if (!Object.op_Implicit((Object)(object)val2)) { return; } if (val2.IsDead) { val2.Resurrect(); } string activeSceneName = SceneManagerHelper.ActiveSceneName; List list2 = Templates.BR_Templates.SpawnLocations[activeSceneName]; int index2 = Random.Range(0, list2.Count()); Vector3 val3 = list2[index2]; UID uID; if (PhotonNetwork.offlineMode) { RPCManager instance = RPCManager.Instance; uID = val2.UID; instance.SendSpawnEnemyRPC(((object)(UID)(ref uID)).ToString(), val3.x, val3.y, val3.z); } else { PhotonView photonView = ((MonoBehaviour)RPCManager.Instance).photonView; object[] array = new object[4]; uID = val2.UID; array[0] = ((object)(UID)(ref uID)).ToString(); array[1] = val3.x; array[2] = val3.y; array[3] = val3.z; photonView.RPC("SendSpawnEnemyRPC", (PhotonTargets)0, array); } if (val2.Name.ToLower().Contains("butcher")) { RPCManager.SendMessageToAll("The Butcher of Men has spawned!"); EnemyCharacters.RemoveAll((Character x) => x.UID == butcher.UID); } PlayerManager.Instance.ChangeFactions(val2, (Factions)0); } public void EndBattleRoyale() { UICompass[] array = Resources.FindObjectsOfTypeAll(); foreach (UICompass val in array) { ((UIElement)val).Show(true); } try { if (PhotonNetwork.offlineMode) { RPCManager.Instance.RPCSendCleanup(); } else { ((MonoBehaviour)RPCManager.Instance).photonView.RPC("RPCSendCleanup", (PhotonTargets)0, new object[0]); } ActiveItemContainers.Clear(); ActiveBeamObjects.Clear(); } catch { } if (!PhotonNetwork.isNonMasterClientInRoom && !MenuManager.Instance.IsReturningToMainMenu && !MenuManager.Instance.IsInMainMenuScene) { IsGameplayEnding = true; } } public void AddItemsToContainer(List _itemList, int _amountToAdd, Transform _container, bool _removeWhenAdded = true) { List list = _itemList.ToList(); for (int i = 0; i < _amountToAdd; i++) { if (list.Count() == 0) { break; } int index = Random.Range(0, list.Count()); Item val = ItemManager.Instance.GenerateItemNetwork(list[index]); val.ChangeParent(_container); if (_removeWhenAdded) { list.RemoveAt(index); } } } private IEnumerator GenerateSupplyDrops() { if (ActiveItemContainers.Count() > 0) { if (PhotonNetwork.offlineMode) { RPCManager.Instance.RPCSendCleanup(); } else { ((MonoBehaviour)RPCManager.Instance).photonView.RPC("RPCSendCleanup", (PhotonTargets)0, new object[0]); } yield return (object)new WaitForSeconds(2f); } if (SupplyDropCounter == 1) { foreach (PlayerSystem ps in Global.Lobby.PlayersInLobby) { Character _char = ps.ControlledCharacter; TreasureChest stash = ((Component)ItemManager.Instance.GenerateItemNetwork(1000110)).GetComponent(); ((Component)stash).transform.position = ((Component)_char).transform.position + new Vector3(1.5f, 0f, 1.5f); ActiveItemContainers.Add(((Component)stash).gameObject); if (!PhotonNetwork.offlineMode) { ((MonoBehaviour)RPCManager.Instance).photonView.RPC("RPCGenerateStash", (PhotonTargets)1, new object[5] { ((Item)stash).ItemID, ((Item)stash).UID, ((Component)stash).transform.position.x, ((Component)stash).transform.position.y, ((Component)stash).transform.position.z }); } At.Invoke(stash, "InitDrops", Array.Empty()); for (int j = 0; j < 5; j++) { At.SetField(stash, "m_hasGeneratedContent", (object)false); ((SelfFilledItemContainer)stash).GenerateContents(); } } yield break; } RPCManager.SendMessageToAll("Supply Chests are spawning!"); List locations = Templates.BR_Templates.SupplyDropLocations[SceneManagerHelper.ActiveSceneName].ToList(); int numOfDrops2 = (int)Math.Ceiling((float)PlayerManager.Instance.GetRemainingPlayers().Count() * 0.5f); numOfDrops2 = Mathf.Clamp(numOfDrops2, 2, locations.Count()); for (int i = 0; i < numOfDrops2; i++) { if (locations.Count == 0) { break; } int random = Random.Range(0, locations.Count()); GenerateChestSingle(locations[random]); locations.RemoveAt(random); } } private void GenerateChestSingle(Vector3 position) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0179: Unknown result type (might be due to invalid IL or missing references) int num = ((SupplyDropCounter != 2) ? 1000040 : 1000000); TreasureChest component = ((Component)ItemManager.Instance.GenerateItemNetwork(num)).GetComponent(); ActiveItemContainers.Add(((Component)component).gameObject); ((Component)component).transform.position = position; if (!PhotonNetwork.offlineMode) { ((MonoBehaviour)RPCManager.Instance).photonView.RPC("RPCGenerateStash", (PhotonTargets)1, new object[5] { ((Item)component).ItemID, ((Item)component).UID, position.x, position.y, position.z }); } Transform transform = ((Component)((Component)component).GetComponentInChildren()).transform; if (SupplyDropCounter == 2) { AddItemsToContainer(Templates.BR_Templates.Weapons_Med, 1, transform); AddItemsToContainer(Templates.BR_Templates.Offhands_High, 1, transform); AddItemsToContainer(Templates.BR_Templates.Armor_Low, 2, transform); AddItemsToContainer(Templates.BR_Templates.Supplies_Low, 6, transform, _removeWhenAdded: false); } else { AddItemsToContainer(Templates.BR_Templates.Weapons_High, 1, transform); AddItemsToContainer(Templates.BR_Templates.Offhands_High, 1, transform); AddItemsToContainer(Templates.BR_Templates.Armor_High, 2, transform); AddItemsToContainer(Templates.BR_Templates.Supplies_High, 6, transform); } if (PhotonNetwork.offlineMode) { RPCManager.Instance.RPCSendSupplyDrop(((Item)component).UID, position.x, position.y, position.z); return; } ((MonoBehaviour)RPCManager.Instance).photonView.RPC("RPCSendSupplyDrop", (PhotonTargets)0, new object[4] { ((Item)component).UID, position.x, position.y, position.z }); } public IEnumerator SupplyDropLocalCoroutine(string itemUID, Vector3 location) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) while (!Object.op_Implicit((Object)(object)ItemManager.Instance.GetItem(itemUID))) { yield return (object)new WaitForSeconds(0.1f); } if ((Object)(object)beamObject != (Object)null) { GameObject newbeam = Object.Instantiate(beamObject); newbeam.SetActive(true); ((Component)newbeam.transform.GetChild(0)).gameObject.SetActive(false); Object.DestroyImmediate((Object)(object)newbeam.GetComponent()); newbeam.transform.localScale = new Vector3(100f, 10f, 100f); newbeam.transform.position = location + Vector3.up * 10f; ActiveBeamObjects.Add(newbeam); } } public void CleanupSupplyObjects() { int num = 0; while (num < ActiveItemContainers.Count() && ActiveItemContainers.Count() >= 1) { GameObject val = ActiveItemContainers[num]; if (Object.op_Implicit((Object)(object)val)) { TreasureChest component = val.GetComponent(); if (component != null) { try { ItemManager.Instance.DestroyItem(((Item)component).UID); } catch { } } } ActiveItemContainers.RemoveAt(num); num--; num++; } int num2 = 0; while (num2 < ActiveBeamObjects.Count() && ActiveBeamObjects.Count() >= 1) { GameObject val2 = ActiveBeamObjects[num2]; if (Object.op_Implicit((Object)(object)val2)) { Object.DestroyImmediate((Object)(object)val2); } ActiveBeamObjects.RemoveAt(num2); num2--; num2++; } } public GameObject FindInactiveObjectByName(string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 Transform[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name) { return ((Component)array[i]).gameObject; } } return null; } } public class BattleRoyale_Hooks { [HarmonyPatch(typeof(Character), "Die")] public class Character_Die { [HarmonyPrefix] public static void Prefix(Character __instance) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (PvP.Instance.CurrentGame != PvP.GameModes.BattleRoyale) { return; } if (!__instance.IsAI) { if (!PhotonNetwork.isNonMasterClientInRoom && At.GetField(__instance, "m_lastDealers") is List> list) { float num = Time.time; string text = ""; foreach (Pair item in list) { if (item.Value < num) { num = item.Value; text = UID.op_Implicit(item.Key); } } if (text != "") { Character character = CharacterManager.Instance.GetCharacter(text); if (character != null) { list.Clear(); At.SetField(__instance, "m_lastDealers", (object)character); RPCManager.SendMessageToAll(character.Name + " has defeated " + __instance.Name); } } } foreach (EquipmentSlot item2 in __instance.Inventory.Equipment.EquipmentSlots.Where((EquipmentSlot x) => (Object)(object)x != (Object)null && x.HasItemEquipped)) { __instance.Inventory.DropItem(((Item)item2.EquippedItem).UID); } } else { if ((Object)(object)__instance.Inventory == (Object)null || (Object)(object)((Component)__instance).GetComponent() == (Object)null) { return; } if (!Object.op_Implicit((Object)(object)__instance.Inventory.Pouch) || !((EffectSynchronizer)__instance.Inventory.Pouch).FullyInitialized) { __instance.Inventory.ProcessStart(); } if (!PhotonNetwork.isNonMasterClientInRoom) { if (__instance.Name.ToLower().Contains("butcher")) { BattleRoyale.Instance.AddItemsToContainer(Templates.BR_Templates.Skills_High, 3, ((Component)__instance.Inventory.Pouch).transform); BattleRoyale.Instance.AddItemsToContainer(Templates.BR_Templates.Weapons_High, 1, ((Component)__instance.Inventory.Pouch).transform); } else if (__instance.Name == "Immaculate" || ((Object)__instance).name == "Shell Horror") { BattleRoyale.Instance.AddItemsToContainer(Templates.BR_Templates.Skills_High, 1, ((Component)__instance.Inventory.Pouch).transform); BattleRoyale.Instance.AddItemsToContainer(Templates.BR_Templates.Skills_Low, 2, ((Component)__instance.Inventory.Pouch).transform); } else { BattleRoyale.Instance.AddItemsToContainer(Templates.BR_Templates.Skills_Low, 3, ((Component)__instance.Inventory.Pouch).transform); } } } if (__instance.IsLocalPlayer) { ((Component)__instance.OwnerPlayerSys).gameObject.AddComponent(); } } } [HarmonyPatch(typeof(ItemContainer), "AddItem", new Type[] { typeof(Item), typeof(bool) })] public class ItemContainer_AddItem { [HarmonyPrefix] public static bool Prefix(ItemContainer __instance, Item _item, ref bool __result) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected I4, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected I4, but got Unknown if (PhotonNetwork.isNonMasterClientInRoom) { return true; } if (BattleRoyale.Instance.IsGameplayStarting || PvP.Instance.CurrentGame == PvP.GameModes.BattleRoyale) { if (_item is Skill && (Object)(object)((EffectSynchronizer)__instance).OwnerCharacter != (Object)null && !((EffectSynchronizer)__instance).OwnerCharacter.IsAI) { if (!((CharacterKnowledge)((EffectSynchronizer)__instance).OwnerCharacter.Inventory.SkillKnowledge).IsItemLearned(_item.ItemID)) { _item.ChangeParent(((Component)((EffectSynchronizer)__instance).OwnerCharacter.Inventory.SkillKnowledge).transform); } __result = true; return false; } if (_item is Weapon && (Object)(object)((EffectSynchronizer)__instance).OwnerCharacter != (Object)null && Templates.Weapon_Skills.ContainsKey((int)((Weapon)((_item is Weapon) ? _item : null)).Type)) { int num = Templates.Weapon_Skills[(int)((Weapon)((_item is Weapon) ? _item : null)).Type]; CharacterSkillKnowledge skillKnowledge = ((EffectSynchronizer)__instance).OwnerCharacter.Inventory.SkillKnowledge; if (skillKnowledge != null && !((CharacterKnowledge)skillKnowledge).IsItemLearned(num)) { Item val = ItemManager.Instance.GenerateItemNetwork(num); val.ChangeParent(((Component)skillKnowledge).transform); List list = At.GetField((CharacterKnowledge)(object)skillKnowledge, "m_learnedItems") as List; list.Add(val); } } } return true; } } [HarmonyPatch(typeof(PlayerCharacterStats), "UpdateWeight")] public class PlayerCharacterStats_UpdateWeight { [HarmonyFinalizer] public static Exception Finalizer() { return null; } } } public class DeathMatch : MonoBehaviour { public static DeathMatch Instance; internal void Awake() { Instance = this; } public void UpdateDM() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) List remainingTeams = PlayerManager.Instance.GetRemainingTeams(); if (remainingTeams.Count == 1) { Factions val = remainingTeams[0]; string text = ((object)(Factions)(ref val)).ToString(); if (text.EndsWith("s")) { text = text.Substring(0, text.Length - 1); } PvP.Instance.StopGameplay(text + "s have won!"); } else if (remainingTeams.Count <= 0) { PvP.Instance.StopGameplay("Game ended because there are no active teams!"); } } } public class FriendlyFire { [HarmonyPatch(typeof(Character), "IsEnemyClose")] public class Character_IsEnemyClose { [HarmonyPrefix] public static bool Prefix(ref bool __result, Character __instance, float _range) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) __result = false; Collider[] array = Physics.OverlapSphere(__instance.CenterPosition, _range, Global.LockingPointsMask); for (int i = 0; i < array.Length; i++) { LockingPoint component = ((Component)array[i]).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.OwnerChar) && component.OwnerChar.Alive && OrigIsTargetable(__instance.TargetingSystem, component.OwnerChar)) { __result = true; } } return false; } } [HarmonyPatch(typeof(TargetingSystem), "IsTargetable", new Type[] { typeof(Character) })] public class TargetingSys_IsTargetable { [HarmonyPrefix] public static bool Prefix(ref bool __result, Character ___m_character, Character _char) { //IL_0023: 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) if (___m_character.IsAI || !PvP.Instance.FriendlyFireEnabled) { return true; } if (___m_character.UID != _char.UID) { __result = true; } else { __result = false; } return false; } } [HarmonyPatch(typeof(TargetingSystem), "IsTargetable", new Type[] { typeof(Factions) })] public class TargetingSys_IsTargetable_2 { [HarmonyPrefix] public static bool Prefix(ref bool __result, Character ___m_character) { if (___m_character.IsAI || !PvP.Instance.FriendlyFireEnabled) { return true; } __result = true; return false; } } [HarmonyPatch(typeof(TargetingSystem), "AcquireTarget")] public class TargetingSys_AcquireTarget { [HarmonyPrefix] public static bool Prefix(TargetingSystem __instance, ref bool __result, Character ___m_character, ref LockingPoint ___m_currentLockingPoint, ref int ___m_remainingHelpLockCount) { //IL_005a: 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_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) //IL_0085: 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) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)___m_character) || ___m_character.IsAI || !PvP.Instance.FriendlyFireEnabled || (PvP.Instance.FriendlyFireEnabled && PvP.Instance.FriendlyTargetingEnabled)) { return true; } if ((Object)(object)__instance.CameraRef != (Object)null) { Collider[] array = Physics.OverlapSphere(___m_character.CenterPosition, __instance.TrueRange, Global.LockingPointsMask); LockingPoint val = null; Vector3 val2 = Vector2.op_Implicit(Vector2.zero); Matrix4x4 worldToCameraMatrix = __instance.CameraRef.worldToCameraMatrix; Collider[] array2 = array; foreach (Collider val3 in array2) { Vector3 val4 = ((Matrix4x4)(ref worldToCameraMatrix)).MultiplyPoint(((Component)val3).transform.position); if (!(val4.z < 0f)) { continue; } val4.z *= 0.1f; if ((Object)(object)val == (Object)null || ((Vector3)(ref val4)).magnitude < ((Vector3)(ref val2)).magnitude) { LockingPoint component = ((Component)val3).GetComponent(); if ((Object)(object)component.OwnerChar == (Object)null || (OrigIsTargetable(__instance, component.OwnerChar) && component.OwnerChar.Alive && !Physics.Linecast(___m_character.CenterPosition, ((Component)val3).transform.position, Global.SightHideMask))) { val = component; val2 = val4; } } } if ((Object)(object)val != (Object)null) { ___m_currentLockingPoint = val; if (___m_remainingHelpLockCount > 0) { ___m_remainingHelpLockCount--; } __result = true; return false; } } __result = false; return false; } } [HarmonyPatch(typeof(Blast), "Hit")] public class Blast_Hit { [HarmonyPrefix] public static bool Prefix(Blast __instance, ref List ___cachedHitBox) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((EffectSynchronizer)__instance).OwnerCharacter) || ((EffectSynchronizer)__instance).OwnerCharacter.IsAI || !PvP.Instance.FriendlyFireEnabled) { return true; } Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, __instance.Radius, Global.WeaponHittingMask); List list = new List(); ___cachedHitBox.Clear(); for (int i = 0; i < array.Length; i++) { Hitbox component = ((Component)array[i]).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.OwnerChar != (Object)null && component.OwnerChar.UID != ((EffectSynchronizer)__instance).OwnerCharacter.UID && !component.BlockBox && !list.Contains(component.OwnerChar)) { ___cachedHitBox.Add(component); list.Add(component.OwnerChar); } } At.Invoke(__instance, "AffectHit", new object[1] { ___cachedHitBox }); return false; } } [HarmonyPatch(typeof(Projectile), "Explode", new Type[] { typeof(Collider), typeof(Vector3), typeof(Vector3), typeof(bool) })] public class Projectile_Explode { [HarmonyPrefix] public static bool Prefix(Projectile __instance, Collider _collider, Vector3 _hitPoint, Vector3 _hitDir, ref float ___m_lastHitTimer, ref float ___m_targetLightIntensity, float ___m_lightStartIntensity, ref float ___m_lightIntensityFadeSpeed, SoundPlayer ___m_shootSound, SoundPlayer ___m_travelSound, ParticleSystem ___m_explosionFX, ref object[] ___m_explodeInfos) { //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b3: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)((EffectSynchronizer)__instance).OwnerCharacter) || ((EffectSynchronizer)__instance).OwnerCharacter.IsAI || !PvP.Instance.FriendlyFireEnabled) { return true; } ___m_lastHitTimer = 5f; ___m_targetLightIntensity = ___m_lightStartIntensity * 1.8f; ___m_lightIntensityFadeSpeed = __instance.LightIntensityFade.x * 0.5f; if (Object.op_Implicit((Object)(object)___m_shootSound)) { ___m_shootSound.Stop(false); } if (Object.op_Implicit((Object)(object)___m_travelSound)) { ___m_travelSound.Stop(false); } Character val = null; if ((Object)(object)_collider != (Object)null) { if (Object.op_Implicit((Object)(object)___m_explosionFX)) { ___m_explosionFX.Play(); } val = UnityEngineExtensions.GetCharacterOwner(_collider); } bool flag = false; if (Object.op_Implicit((Object)(object)val) && (Object)(object)((EffectSynchronizer)__instance).OwnerCharacter != (Object)(object)val) { if (!__instance.Unblockable && val.ShieldEquipped) { Hitbox component = ((Component)_collider).GetComponent(); if ((Object)(object)component != (Object)null && component.BlockBox && val.Blocking && !val.Countering) { flag = true; } } } else { val = null; } At.Invoke(__instance, "OnProjectileHit", new object[4] { val, _hitPoint, _hitDir, flag }); ___m_explodeInfos[0] = val; ___m_explodeInfos[1] = _hitPoint; ___m_explodeInfos[2] = _hitDir; ___m_explodeInfos[3] = (Object)(object)_collider != (Object)null; ((Component)__instance).SendMessage("OnExplodeDone", (object)___m_explodeInfos, (SendMessageOptions)1); if ((int)__instance.EndMode == 0 || ((int)__instance.EndMode == 3 && ((Object)(object)_collider == (Object)null || Global.FullEnvironmentMask == (Global.FullEnvironmentMask | (1 << ((Component)_collider).gameObject.layer))))) { At.Invoke(__instance, "EndLife", Array.Empty()); } return false; } } [HarmonyPatch(typeof(RaycastProjectile), "CheckCollision")] public class RaycastProjectile_CheckCollision { [HarmonyPrefix] public static bool Prefix(ref bool __result, RaycastProjectile __instance, Vector3 _startRaycast, float _dist, ref RaycastHit _hit, ref Vector3 ___m_shootDir, float ___m_radiusAdd, float ___m_capsuleAdd, LockingPoint ___m_homingTarget, List ___m_hitCharList) { //IL_0039: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Invalid comparison between Unknown and I4 if (!PvP.Instance.FriendlyFireEnabled || Object.op_Implicit((Object)(object)((EffectSynchronizer)__instance).OwnerCharacter) || ((EffectSynchronizer)__instance).OwnerCharacter.IsAI) { return true; } _hit = default(RaycastHit); int num = RaycastHitLayerMask(__instance); RaycastHit[] array = ((__instance.Radius == 0f) ? Physics.RaycastAll(_startRaycast, ___m_shootDir, _dist, num) : ((__instance.Capsule == 0f) ? Physics.CapsuleCastAll(_startRaycast - ((Component)__instance).transform.right * (__instance.Capsule + ___m_capsuleAdd), _startRaycast + ((Component)__instance).transform.right * (__instance.Capsule + ___m_capsuleAdd), __instance.Radius + ___m_radiusAdd, ___m_shootDir, _dist, num) : Physics.SphereCastAll(_startRaycast, __instance.Radius + ___m_radiusAdd, ___m_shootDir, _dist, num))); if (array.Length != 0) { Character val = (Character)At.GetField((Projectile)(object)__instance, "m_ignoredCharacter"); int num2 = -1; for (int i = 0; i < array.Length; i++) { Character characterOwner = UnityEngineExtensions.GetCharacterOwner(((RaycastHit)(ref array[i])).collider); if (!(((EffectSynchronizer)__instance).OwnerCharacter.UID != characterOwner.UID)) { continue; } bool flag = (Object)(object)characterOwner == (Object)null && !__instance.HitTargetOnly; if (!flag) { flag = !__instance.HitTargetOnly || (Object.op_Implicit((Object)(object)___m_homingTarget) && (Object)(object)characterOwner == (Object)(object)___m_homingTarget.OwnerChar); flag &= (Object)(object)characterOwner != (Object)(object)val; flag &= !___m_hitCharList.Contains(characterOwner) || (!__instance.MultiTarget && (int)((Projectile)__instance).EndMode == 0); } if (!flag) { continue; } if (((RaycastHit)(ref array[i])).point == Vector3.zero) { ((RaycastHit)(ref array[i])).point = ((Component)__instance).transform.position; } if (num2 != -1) { Vector3 val2 = _startRaycast - ((RaycastHit)(ref array[i])).point; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; val2 = _startRaycast - ((RaycastHit)(ref array[num2])).point; if (!(sqrMagnitude < ((Vector3)(ref val2)).sqrMagnitude)) { continue; } } if (Object.op_Implicit((Object)(object)characterOwner)) { ___m_hitCharList.Add(characterOwner); } num2 = i; } if (num2 != -1) { _hit = array[num2]; __result = true; return false; } } __result = false; return false; } private static int RaycastHitLayerMask(RaycastProjectile __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if (((Projectile)__instance).OnlyExplodeOnLayers) { return LayerMask.op_Implicit(((Projectile)__instance).ExplodeOnContactWithLayers); } if ((int)__instance.HitLayer == 2) { return Global.ProjectileHitAllMask; } if ((int)__instance.HitLayer == 0) { return Global.ProjectileHitMeleeMask; } return Global.ProjectileHitRangedMask; } } public static bool OrigIsTargetable(TargetingSystem instance, Character _character) { //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_0022: Unknown result type (might be due to invalid IL or missing references) Factions faction = _character.Faction; for (int num = instance.TargetableFactions.Length - 1; num >= 0; num--) { if (((Enum)(Factions)(ref instance.TargetableFactions[num])).CompareTo((object?)faction) == 0) { return true; } } return false; } } public class PlayerManager : MonoBehaviour { [HarmonyPatch(typeof(DeployableTrap), "ProcessEffect")] public class DeployableTrap_ProcessEffect { [HarmonyPrefix] public static bool Prefix(DeployableTrap __instance, Effect _effect) { Shooter val = (Shooter)(object)((_effect is Shooter) ? _effect : null); if (val != null && PvP.Instance.CurrentGame == PvP.GameModes.BattleRoyale) { val.Setup(Instance.AllFactions.ToArray(), (!((Object)(object)__instance.FX_HolderTrans != (Object)null)) ? ((Component)__instance).transform : __instance.FX_HolderTrans); return false; } return true; } } [HarmonyPatch(typeof(TrapTrigger), "OnTriggerEnter")] public class TrapTrigger_OnTriggerEnter { [HarmonyPrefix] public static bool Prefix(TrapTrigger __instance, Collider _other) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected I4, but got Unknown if ((Object)(object)_other == (Object)null) { return true; } if (PvP.Instance.CurrentGame != 0) { DeployableTrap componentInParent = ((Component)__instance).GetComponentInParent(); if (componentInParent != null) { At.SetField(componentInParent, "m_targetFactions", (object)Instance.AllFactions.ToArray()); } List list = At.GetField(__instance, "m_charactersInTrigger") as List; Character component = ((Component)_other).GetComponent(); if ((Object)(object)component != (Object)null && !list.Contains(component)) { list.Add(component); if (!(bool)At.GetField(__instance, "m_alreadyTriggered")) { ((TriggerColliderFlag)__instance).Trigger.ActivateBasicAction(component, __instance.OnEnterState - 1); } At.SetField(__instance, "m_alreadyTriggered", (object)true); } return false; } return true; } } public static PlayerManager Instance; public List AllFactions; internal void Awake() { Instance = this; AllFactions = new List(); for (int i = 0; i < 10; i++) { AllFactions.Add((Factions)i); } } public void ChangeFactions(Character c, Factions faction) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected I4, but got Unknown //IL_0023: 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) PhotonView photonView = ((MonoBehaviour)RPCManager.Instance).photonView; object[] obj = new object[3] { (int)faction, null, null }; UID uID = c.UID; obj[1] = ((object)(UID)(ref uID)).ToString(); obj[2] = true; photonView.RPC("SendChangeFactionsRPC", (PhotonTargets)0, obj); } public List GetRemainingTeams() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (KeyValuePair> currentPlayer in PvP.Instance.CurrentPlayers) { if ((int)currentPlayer.Key == 0) { continue; } bool flag = false; foreach (PlayerSystem item in currentPlayer.Value) { if ((Object)(object)item.ControlledCharacter != (Object)null && !item.ControlledCharacter.IsDead) { flag = true; break; } } if (flag) { list.Add(currentPlayer.Key); } } return list; } public List GetRemainingPlayers() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (KeyValuePair> currentPlayer in PvP.Instance.CurrentPlayers) { foreach (PlayerSystem item in PvP.Instance.CurrentPlayers[currentPlayer.Key]) { if ((Object)(object)item.ControlledCharacter != (Object)null && !item.ControlledCharacter.IsDead) { list.Add(item.ControlledCharacter); } } } return list; } } [BepInPlugin("com.sinai.pvp", "PvP", "2.6.0")] public class PvP : BaseUnityPlugin { public enum GameModes { NONE, Deathmatch, BattleRoyale } [HarmonyPatch(typeof(InteractionRevive), "OnActivate")] public class InteractionRevive_OnActivate { [HarmonyPrefix] public static bool Prefix(InteractionRevive __instance) { if (Instance.CurrentGame == GameModes.NONE) { return true; } object field = At.GetField((InteractionBase)(object)__instance, "m_lastCharacter"); Character val = (Character)((field is Character) ? field : null); if (val != null && val.IsLocalPlayer) { RPCManager.Instance.SendUIMessageLocal(val, "You cannot revive players during a game!"); ((MonoBehaviour)Instance).StartCoroutine(Instance.FixReviveInteraction((InteractionBase)(object)__instance, ((InteractionBase)__instance).OnActivationEvent)); ((InteractionBase)__instance).OnActivationEvent = null; } return false; } } [HarmonyPatch(typeof(InteractionRevive), "ProcessText")] public class InteractionRevive_ProcessText { [HarmonyPostfix] public static void Postfix(ref string __result) { if (Instance.CurrentGame != 0) { __result = ""; } } } public const string GUID = "com.sinai.pvp"; public const string NAME = "PvP"; public const string VERSION = "2.6.0"; public static PvP Instance; private const string MenuKey = "PvP Menu"; public static ConfigEntry Show_Menu_On_Startup; public static ConfigEntry Enable_Menu_Scaling; public GameModes CurrentGame = GameModes.NONE; public float GameStartTime = 0f; public Dictionary> CurrentPlayers = new Dictionary>(); public bool FriendlyFireEnabled; public bool FriendlyTargetingEnabled; public bool EnemiesDisabled; internal void Awake() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Instance = this; CustomKeybindings.AddAction("PvP Menu", (KeybindingsCategory)0, (ControlType)0, (InputType)1); Show_Menu_On_Startup = ((BaseUnityPlugin)this).Config.Bind("PvP", "Show Menu On startup", true, "Show the PvP menu on game startup."); Enable_Menu_Scaling = ((BaseUnityPlugin)this).Config.Bind("PvP", "Enable Menu Scaling", true, "Attempts to scale the menu to your screen resolution"); SceneManager.activeSceneChanged += SceneManager_activeSceneChanged; Harmony val = new Harmony("com.sinai.pvp"); val.PatchAll(); GameObject val2 = new GameObject("PvP"); Object.DontDestroyOnLoad((Object)(object)val2); val2.AddComponent(); PhotonView val3 = val2.AddComponent(); val3.viewID = 998; Debug.Log((object)("Registered PvP with ViewID " + val3.viewID)); val2.AddComponent(); val2.AddComponent(); val2.AddComponent(); val2.AddComponent(); } private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1) { string text = SceneManagerHelper.ActiveSceneName.ToLower(); if (!text.Contains("lowmemory") && !text.Contains("mainmenu")) { ((MonoBehaviour)Instance).StartCoroutine(OnSceneChange()); } } private IEnumerator OnSceneChange() { while (NetworkLevelLoader.Instance.IsGameplayLoading || !NetworkLevelLoader.Instance.AllPlayerDoneLoading) { yield return (object)new WaitForSeconds(0.3f); } if (EnemiesDisabled) { SetEnemiesActive(active: false); } } public static void SetEnemiesActive(bool active) { Instance.EnemiesDisabled = !active; ((Component)AISquadManager.Instance).gameObject.SetActive(active); } internal void Update() { if ((MenuManager.Instance.IsReturningToMainMenu || Global.IsApplicationClosing) && CurrentGame != 0) { CurrentGame = GameModes.NONE; if (!PhotonNetwork.isNonMasterClientInRoom) { StopGameplay("The host has left the game!"); } } if (CustomKeybindings.GetKeyDown("PvP Menu")) { PvPGUI.Instance.ShowGUI = !PvPGUI.Instance.ShowGUI; } if (Global.Lobby.PlayersInLobbyCount >= 1 && !NetworkLevelLoader.Instance.IsGameplayPaused && CurrentGame != 0) { UpdateGameplay(); } } public void StartGameplay(int _mode, string messageToPlayers = "") { CurrentGame = (GameModes)_mode; ((MonoBehaviour)RPCManager.Instance).photonView.RPC("StartGameplayRPC", (PhotonTargets)0, new object[2] { _mode, messageToPlayers }); } public void StopGameplay(string messageToPlayers = "") { ((MonoBehaviour)RPCManager.Instance).photonView.RPC("StopGameplayRPC", (PhotonTargets)0, new object[1] { messageToPlayers }); } private void UpdateGameplay() { if (CurrentGame != GameModes.BattleRoyale && CurrentGame == GameModes.Deathmatch) { DeathMatch.Instance.UpdateDM(); } } private IEnumerator FixReviveInteraction(InteractionBase _base, UnityAction action) { yield return (object)new WaitForSeconds(0.1f); _base.OnActivationEvent = action; } } public class PvPGUI : MonoBehaviour { public static PvPGUI Instance; private static readonly int WINDOW_ID = 6313531; public Rect m_windowRect = Rect.zero; public Vector2 scroll = Vector2.zero; private Vector2 m_virtualSize = new Vector2(1920f, 1080f); private Vector2 m_currentSize = Vector2.zero; public Matrix4x4 m_scaledMatrix; private bool m_showGUI; public int guiPage = 0; public bool lastMenuToggle; public bool ConfirmingBattleRoyale = false; public Dictionary TeamColors = new Dictionary { { (Factions)0, Color.white }, { (Factions)1, Color.green }, { (Factions)2, Color.red * 2f }, { (Factions)3, Color.cyan * Color.grey }, { (Factions)4, Color.magenta }, { (Factions)5, new Color(0.8f, 0.3f, 0.3f) }, { (Factions)6, new Color(0.3f, 0.3f, 1f) }, { (Factions)7, Color.gray }, { (Factions)8, Color.yellow } }; public bool ShowGUI { get { return m_showGUI; } set { m_showGUI = value; if (m_showGUI) { ForceUnlockCursor.AddUnlockSource(); } else { ForceUnlockCursor.RemoveUnlockSource(); } } } internal void Awake() { Instance = this; } internal void Start() { ShowGUI = PvP.Show_Menu_On_Startup.Value; } internal void Update() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (m_currentSize.x != (float)Screen.width || m_currentSize.y != (float)Screen.height) { m_scaledMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3((float)Screen.width / m_virtualSize.x, (float)Screen.height / m_virtualSize.y, 1f)); m_currentSize = new Vector2((float)Screen.width, (float)Screen.height); } if (!NetworkLevelLoader.Instance.IsGameplayPaused && Global.Lobby.PlayersInLobbyCount > 0) { } } internal void OnGUI() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0068: 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_0090: 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_00ab: Expected O, but got Unknown //IL_00a6: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) GUISkin skin = GUI.skin; GUI.skin = UIStyles.WindowSkin; Matrix4x4 matrix = GUI.matrix; if (PvP.Enable_Menu_Scaling.Value) { GUI.matrix = m_scaledMatrix; } if (!(m_windowRect == Rect.zero)) { _ = m_windowRect; if (0 == 0) { goto IL_0072; } } m_windowRect = new Rect(50f, 50f, 500f, 300f); goto IL_0072; IL_0072: if (!ConfirmingBattleRoyale && ShowGUI) { m_windowRect = GUI.Window(WINDOW_ID, m_windowRect, new WindowFunction(DrawWindow), "PvP 2.6.0"); } else if (ConfirmingBattleRoyale || BattleRoyale.Instance.IsGameplayEnding) { float num = Screen.width / 2 - 200; float num2 = ((Global.Lobby.LocalPlayerCount <= 1) ? ((float)(Screen.height / 2 - 150)) : ((float)(Screen.height / 4 - 150))); if (ConfirmingBattleRoyale) { GUI.Window(WINDOW_ID, new Rect(num, num2, 400f, 250f), new WindowFunction(BattleRoyaleConfirmStart), "Are you sure?"); } else if (BattleRoyale.Instance.IsGameplayEnding) { GUI.Window(WINDOW_ID, new Rect(num, num2, 400f, 150f), new WindowFunction(BattleRoyaleGameEnd), "Play again?"); } } if (PvP.Instance.CurrentGame != 0) { CurrentGameWindow(); } GUI.matrix = matrix; GUI.skin = skin; } private void DrawWindow(int id) { //IL_0021: 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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0162: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref m_windowRect)).width - 50f, 20f)); if (GUI.Button(new Rect(((Rect)(ref m_windowRect)).width - 50f, 0f, 45f, 20f), "X")) { ShowGUI = false; } GUILayout.BeginArea(new Rect(3f, 25f, ((Rect)(ref m_windowRect)).width - 8f, ((Rect)(ref m_windowRect)).height - 5f)); GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty()); GUILayout.Space(150f); if (guiPage == 0) { GUI.color = Color.green; } else { GUI.color = Color.white; } if (GUILayout.Button("Main", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) })) { guiPage = 0; } if (guiPage == 1) { GUI.color = Color.green; } else { GUI.color = Color.white; } if (GUILayout.Button("Settings", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) })) { guiPage = 1; } GUI.color = Color.white; GUILayout.EndHorizontal(); GUI.skin.box.alignment = (TextAnchor)0; scroll = GUILayout.BeginScrollView(scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(((Rect)(ref m_windowRect)).height - 70f) }); switch (guiPage) { case 0: MainPage(); break; case 1: SettingsPage(); break; } GUILayout.EndScrollView(); GUILayout.EndArea(); } private void MainPage() { //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Invalid comparison between Unknown and I4 //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) if (Global.Lobby.PlayersInLobbyCount > 0 && !NetworkLevelLoader.Instance.IsGameplayPaused) { if (!PhotonNetwork.isNonMasterClientInRoom) { if (PvP.Instance.CurrentGame == PvP.GameModes.NONE) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Begin Deathmatch", Array.Empty())) { PvP.Instance.StartGameplay(1, "A Deathmatch has begun!"); } if (GUILayout.Button("Begin Battle Royale", Array.Empty())) { ConfirmingBattleRoyale = true; } GUILayout.EndHorizontal(); } else if (GUILayout.Button("End Gameplay", Array.Empty())) { PvP.Instance.StopGameplay("The host has ended the game."); } GUILayout.BeginHorizontal(Array.Empty()); if (!PvP.Instance.FriendlyFireEnabled) { GUI.color = Color.red; if (GUILayout.Button("Enable Friendly Fire", Array.Empty())) { RPCManager.SendFriendyFire(enabled: true); } } else { GUI.color = Color.green; if (GUILayout.Button("Disable Friendly Fire", Array.Empty())) { RPCManager.SendFriendyFire(enabled: false); } if (!PvP.Instance.FriendlyTargetingEnabled) { GUI.color = Color.red; if (GUILayout.Button("Enable Friendly Targeting", Array.Empty())) { RPCManager.SendFriendyTargeting(enabled: true); } } else if (GUILayout.Button("Disable Friendly Targeting", Array.Empty())) { RPCManager.SendFriendyTargeting(enabled: false); } } if (!PvP.Instance.EnemiesDisabled) { GUI.color = Color.green; if (GUILayout.Button("Disable Enemies", Array.Empty())) { RPCManager.SendSetEnemiesActive(active: false); } } else { GUI.color = Color.red; if (GUILayout.Button("Enable Enemies", Array.Empty())) { RPCManager.SendSetEnemiesActive(active: true); } } GUILayout.EndHorizontal(); GUI.color = Color.white; } GUILayout.Label("Characters: ", Array.Empty()); { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (!item.ControlledCharacter.Initialized) { continue; } GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty()); GUI.skin.label.wordWrap = false; GUI.color = TeamColors[item.ControlledCharacter.Faction]; string name = item.ControlledCharacter.Name; name = (item.ControlledCharacter.IsWorldHost ? (name + " [Host]") : ((!item.ControlledCharacter.IsLocalPlayer) ? (name + " [Online]") : (name + " [Local]"))); GUILayout.Label(name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); GUILayout.Label("Team: ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }); if (!PhotonNetwork.isNonMasterClientInRoom || item.ControlledCharacter.IsLocalPlayer) { if ((int)item.ControlledCharacter.Faction != 0 && PvP.Instance.CurrentGame == PvP.GameModes.NONE) { if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { Factions faction = (Factions)(item.ControlledCharacter.Faction - 1); PlayerManager.Instance.ChangeFactions(item.ControlledCharacter, faction); } } else { GUILayout.Space(35f); } } GUILayout.Label(((object)(Factions)(ref item.ControlledCharacter.Faction)).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); if (!PhotonNetwork.isNonMasterClientInRoom || item.ControlledCharacter.IsLocalPlayer) { if ((int)item.ControlledCharacter.Faction != 8 && PvP.Instance.CurrentGame == PvP.GameModes.NONE) { if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { Factions faction2 = (Factions)(item.ControlledCharacter.Faction + 1); PlayerManager.Instance.ChangeFactions(item.ControlledCharacter, faction2); } } else { GUILayout.Space(35f); } if (item.ControlledCharacter.IsDead && PvP.Instance.CurrentGame == PvP.GameModes.NONE && GUILayout.Button("Resurrect", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(75f) })) { RPCManager.Instance.SendResurrect(item.ControlledCharacter); } } GUI.skin.label.wordWrap = true; GUI.color = Color.white; GUILayout.EndHorizontal(); } return; } } GUILayout.Label("Load up a character to begin...", Array.Empty()); } private void SettingsPage() { GUILayout.BeginVertical(GUI.skin.box, Array.Empty()); PvP.Show_Menu_On_Startup.Value = GUILayout.Toggle(PvP.Show_Menu_On_Startup.Value, "Show Menu On Startup", Array.Empty()); PvP.Enable_Menu_Scaling.Value = GUILayout.Toggle(PvP.Enable_Menu_Scaling.Value, "Enable Menu Scaling", Array.Empty()); GUILayout.Space(15f); GUILayout.EndVertical(); } private void BattleRoyaleConfirmStart(int windowID) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) GUI.DragWindow(new Rect(0f, 0f, 400f, 20f)); GUILayout.BeginArea(new Rect(15f, 25f, 370f, 350f)); GUI.skin.label.alignment = (TextAnchor)4; string text = "Are you sure you want to start a Battle Royale?"; if (SceneManagerHelper.ActiveSceneName != "Monsoon") { text += "\r\n\r\nThis will teleport all players to Monsoon."; } GUILayout.Label(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(370f) }); GUILayout.Label("WARNING: This will WIPE the character save and you will need to manually restore your save from a backup if you wish to restore it for this character.\r\n\r\nIt is highly recommended to use a fresh character for Battle Royale so that you don't care if it gets wiped.", Array.Empty()); GUILayout.Space(20f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("No, go back!", Array.Empty())) { ConfirmingBattleRoyale = false; } GUILayout.Space(30f); if (GUILayout.Button("Yes, I'm sure!", Array.Empty())) { ConfirmingBattleRoyale = false; ShowGUI = false; if (BattleRoyale.Instance.CheckCanStart()) { BattleRoyale.Instance.StartBattleRoyale(); } else { RPCManager.Instance.SendUIMessageLocal(CharacterManager.Instance.GetFirstLocalCharacter(), "There are not enough teams to start!"); } } GUILayout.EndHorizontal(); GUILayout.EndArea(); } private void BattleRoyaleGameEnd(int windowID) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) GUI.DragWindow(new Rect(0f, 0f, 400f, 20f)); GUILayout.BeginArea(new Rect(15f, 65f, 370f, 350f)); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Play Again", Array.Empty())) { BattleRoyale.Instance.StartBattleRoyale(skipLoad: true); BattleRoyale.Instance.IsGameplayEnding = false; ShowGUI = false; } GUILayout.Space(30f); if (GUILayout.Button("End Lobby", Array.Empty())) { BattleRoyale.Instance.IsGameplayEnding = false; ShowGUI = false; ((MonoBehaviour)RPCManager.Instance).photonView.RPC("EndBattleRoyaleRPC", (PhotonTargets)0, new object[0]); } GUILayout.EndHorizontal(); GUILayout.EndArea(); } private void CurrentGameWindow() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginArea(new Rect(15f, 15f, 240f, (float)Screen.height * 0.7f)); if (PvP.Instance.CurrentGame == PvP.GameModes.BattleRoyale && BattleRoyale.Instance.IsGameplayStarting) { GUILayout.Label("A Battle Royale is starting...", Array.Empty()); } else { GUIStyle label = GUI.skin.label; label.fontSize *= 2; TimeSpan timeSpan = TimeSpan.FromSeconds(Time.time - PvP.Instance.GameStartTime); GUILayout.Label(timeSpan.Minutes.ToString("0") + ":" + timeSpan.Seconds.ToString("00"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); GUIStyle label2 = GUI.skin.label; label2.fontSize /= 2; GUILayout.Label("Current Teams:", Array.Empty()); foreach (KeyValuePair> currentPlayer in PvP.Instance.CurrentPlayers) { if ((int)currentPlayer.Key == 0) { continue; } GUI.color = TeamColors[currentPlayer.Key]; Factions key = currentPlayer.Key; GUILayout.Label(((object)(Factions)(ref key)).ToString() + ":", Array.Empty()); GUI.color = Color.white; foreach (PlayerSystem item in currentPlayer.Value) { if (item.ControlledCharacter.IsDead) { GUI.color = Color.black; GUILayout.Label(" - " + item.ControlledCharacter.Name + " (DEAD)", Array.Empty()); continue; } GUILayout.Label(" - " + item.ControlledCharacter.Name + " (" + Math.Round((decimal)item.ControlledCharacter.Stats.CurrentHealth) + " / " + item.ControlledCharacter.Stats.MaxHealth + ")", Array.Empty()); } } } GUILayout.EndArea(); } } public class UIStyles { private static GUISkin _customSkin; public static Texture2D m_nofocusTex; public static Texture2D m_focusTex; private static GUIStyle _horizBarStyle; public static GUISkin WindowSkin { get { if ((Object)(object)_customSkin == (Object)null) { try { _customSkin = CreateWindowSkin(); } catch { _customSkin = GUI.skin; } } return _customSkin; } } private static GUIStyle HorizontalBar { get { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (_horizBarStyle == null) { _horizBarStyle = new GUIStyle(); _horizBarStyle.normal.background = Texture2D.whiteTexture; _horizBarStyle.margin = new RectOffset(0, 0, 4, 4); _horizBarStyle.fixedHeight = 2f; } return _horizBarStyle; } } public static void HorizontalLine(Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUILayout.Box(GUIContent.none, HorizontalBar, Array.Empty()); GUI.color = color2; } private static GUISkin CreateWindowSkin() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) GUISkin val = Object.Instantiate(GUI.skin); Object.DontDestroyOnLoad((Object)(object)val); m_nofocusTex = MakeTex(550, 700, new Color(0.1f, 0.1f, 0.1f, 0.7f)); m_focusTex = MakeTex(550, 700, new Color(0.3f, 0.3f, 0.3f, 1f)); val.window.normal.background = m_nofocusTex; val.window.onNormal.background = m_focusTex; val.box.normal.textColor = Color.white; val.window.normal.textColor = Color.white; val.button.normal.textColor = Color.white; val.textField.normal.textColor = Color.white; val.label.normal.textColor = Color.white; return val; } public static Texture2D MakeTex(int width, int height, Color col) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } } public class RPCManager : MonoBehaviour { public static RPCManager Instance; internal void Awake() { Instance = this; } public static void SendSetEnemiesActive(bool active) { if (!PhotonNetwork.isNonMasterClientInRoom) { ((MonoBehaviour)Instance).photonView.RPC("RPCSetEnemiesActive", (PhotonTargets)0, new object[1] { active }); } } [PunRPC] private void RPCSetEnemiesActive(bool active) { PvP.SetEnemiesActive(active); } public static void SendSetPlayerActive(string uid, bool active) { ((MonoBehaviour)Instance).photonView.RPC("RPCSetPlayerActive", (PhotonTargets)0, new object[2] { uid, active }); } [PunRPC] private void RPCSetPlayerActive(string uid, bool active) { Character character = CharacterManager.Instance.GetCharacter(uid); if (character != null) { ((Component)character).gameObject.SetActive(active); } } public static void SendFriendyFire(bool enabled) { SendMessageToAll((enabled ? "Enabling" : "Disabling") + " Friendly Fire!"); ((MonoBehaviour)Instance).photonView.RPC("SendFriendlyFireRPC", (PhotonTargets)0, new object[1] { enabled }); } [PunRPC] private void SendFriendlyFireRPC(bool enabled) { PvP.Instance.FriendlyFireEnabled = enabled; } public static void SendFriendyTargeting(bool enabled) { SendMessageToAll((enabled ? "Enabling" : "Disabling") + " Friendly Targeting!"); ((MonoBehaviour)Instance).photonView.RPC("SendFriendlyTargetingRPC", (PhotonTargets)0, new object[1] { enabled }); } [PunRPC] private void SendFriendlyTargetingRPC(bool enabled) { PvP.Instance.FriendlyTargetingEnabled = enabled; } [PunRPC] public void StartGameplayRPC(int _mode, string messageToPlayers = "") { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Invalid comparison between Unknown and I4 //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if (PvPGUI.Instance.ShowGUI) { PvPGUI.Instance.ShowGUI = false; } if (_mode == 2) { BattleRoyale.Instance.IsGameplayStarting = false; BattleRoyale.Instance.LastSupplyDropTime = -1f; BattleRoyale.Instance.LastEnemySpawnTime = Time.time; BattleRoyale.Instance.SupplyDropCounter = 0; BattleRoyale.Instance.ActiveItemContainers.Clear(); BattleRoyale.Instance.ActiveBeamObjects.Clear(); } PvP.Instance.CurrentPlayers.Clear(); foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if ((int)item.ControlledCharacter.Faction == 0) { if (item.IsLocalPlayer) { ((Component)item).gameObject.AddComponent(); } continue; } if (PvP.Instance.CurrentPlayers.ContainsKey(item.ControlledCharacter.Faction)) { PvP.Instance.CurrentPlayers[item.ControlledCharacter.Faction].Add(item); } else { PvP.Instance.CurrentPlayers.Add(item.ControlledCharacter.Faction, new List { item }); } if (item.ControlledCharacter.IsLocalPlayer) { Instance.SendUIMessageLocal(item.ControlledCharacter, messageToPlayers); } } PvP.Instance.CurrentGame = (PvP.GameModes)_mode; PvP.Instance.GameStartTime = Time.time; } [PunRPC] public void StopGameplayRPC(string messageToPlayers = "") { if (PvP.Instance.CurrentGame == PvP.GameModes.BattleRoyale) { BattleRoyale.Instance.EndBattleRoyale(); } PvP.Instance.CurrentGame = PvP.GameModes.NONE; List list = Global.Lobby.PlayersInLobby; if (PhotonNetwork.isNonMasterClientInRoom) { list = list.Where((PlayerSystem x) => (Object)(object)x.ControlledCharacter != (Object)null && x.ControlledCharacter.IsLocalPlayer).ToList(); } foreach (PlayerSystem item in list) { ((Component)item).GetComponent()?.EndSpectate(); if (messageToPlayers != "" && (Object)(object)item.ControlledCharacter != (Object)null && item.ControlledCharacter.IsLocalPlayer) { Instance.SendUIMessageLocal(item.ControlledCharacter, messageToPlayers); } if (!PhotonNetwork.isNonMasterClientInRoom && (Object)(object)item.ControlledCharacter != (Object)null && item.ControlledCharacter.IsDead) { Instance.SendResurrect(item.ControlledCharacter); } } } public static void SendMessageToAll(string message) { ((MonoBehaviour)Instance).photonView.RPC("SendMessageToAllRPC", (PhotonTargets)0, new object[1] { message }); } [PunRPC] private void SendMessageToAllRPC(string message) { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby.Where((PlayerSystem x) => x.ControlledCharacter.IsLocalPlayer)) { SendUIMessageLocal(item.ControlledCharacter, message); } } public void SendUIMessageLocal(Character c, string message) { c.CharacterUI.NotificationPanel.ShowNotification(message, 5f); } [PunRPC] public void SendChangeFactionsRPC(int factionInt, string UID, bool alliedToSame = true) { //IL_0021: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Character character = CharacterManager.Instance.GetCharacter(UID); if (character != null) { Factions faction = (Factions)factionInt; character.Faction = faction; character.DetectabilityEmitter.Faction = faction; List list = PlayerManager.Instance.AllFactions.Where((Factions x) => x != faction).ToList(); character.TargetingSystem.TargetableFactions = list.ToArray(); if (!alliedToSame) { character.TargetingSystem.AlliedToSameFaction = false; } else { character.TargetingSystem.AlliedToSameFaction = true; } } } public void SendResurrect(Character _character) { if (!PhotonNetwork.offlineMode) { ((MonoBehaviour)_character).photonView.RPC("SendResurrect", (PhotonTargets)0, new object[3] { true, string.Empty, true }); } else { _character.Resurrect(); } } [PunRPC] public void RPCStartBattleRoyale(bool skipLoad = false) { if (SceneManagerHelper.ActiveSceneName == "Monsoon") { skipLoad = true; } BattleRoyale.Instance.IsGameplayStarting = true; PvP.Instance.CurrentGame = PvP.GameModes.BattleRoyale; if (!skipLoad) { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby.Where((PlayerSystem x) => x.ControlledCharacter.IsLocalPlayer)) { Character controlledCharacter = item.ControlledCharacter; CharacterManager.Instance.RequestAreaSwitch(controlledCharacter, AreaManager.Instance.GetAreaFromSceneName("Monsoon"), 0, 0, 1.5f, "Battle Royale!"); } } if (Global.CheatsEnabled) { Global.CheatsEnabled = false; foreach (PlayerSystem item2 in Global.Lobby.PlayersInLobby.Where((PlayerSystem x) => x.ControlledCharacter.IsLocalPlayer)) { Character controlledCharacter2 = item2.ControlledCharacter; CharacterControl characterControl = controlledCharacter2.CharacterControl; ((LocalCharacterControl)((characterControl is LocalCharacterControl) ? characterControl : null)).MovementMultiplier = 1f; } } ((MonoBehaviour)this).StartCoroutine(BattleRoyale.Instance.SetupAfterSceneLoad(skipLoad)); } [PunRPC] public void SendSpawnEnemyRPC(string uid, float x, float y, float z) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown Character val = BattleRoyale.Instance.EnemyCharacters.Find((Character w) => w.UID == UID.op_Implicit(uid)); if (val != null) { ((Component)val).gameObject.SetActive(true); val.Teleport(new Vector3(x, y, z), ((Component)val).transform.rotation); int num = 50; if (val.Name.ToLower().Contains("butcher")) { num = 200; } else if (((Object)val).name.ToLower().Contains("illuminator")) { num = 20; } At.SetField(val.Stats, "m_maxHealthStat", (object)new Stat((float)num)); } } [PunRPC] public void EndBattleRoyaleRPC() { MenuManager.Instance.BackToMainMenu(); } [PunRPC] public void RPCSendSupplyDrop(string itemUID, float x, float y, float z) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(BattleRoyale.Instance.SupplyDropLocalCoroutine(itemUID, new Vector3(x, y, z))); } [PunRPC] public void RPCSendCleanup() { BattleRoyale.Instance.CleanupSupplyObjects(); } [PunRPC] public void RPCGenerateStash(int itemID, string UID, float x, float y, float z) { //IL_001c: 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) TreasureChest component = ((Component)ItemManager.Instance.GenerateItemNetwork(itemID)).GetComponent(); ((Item)component).UID = UID; ((Item)component).SaveType = (SaveTypes)0; ((Component)component).transform.position = new Vector3(x, y, z); BattleRoyale.Instance.ActiveItemContainers.Add(((Component)component).gameObject); } } public class Spectate : MonoBehaviour { private static Camera m_camera; private Character m_ownerCharacter; private Vector3 m_startPosition; private Character m_target; private int m_spectateTargetIndex; private bool hasTarget; public static Transform CameraTransform => VideoCamera.Instance.VideoCameraTrans; public static Camera FreeCamera { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)m_camera)) { m_camera = (Camera)At.GetField(VideoCamera.Instance, "m_camera"); } return m_camera; } } public Character[] AvailableTargets => PlayerManager.Instance.GetRemainingPlayers().ToArray(); internal void Awake() { //IL_0023: 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_0043: 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) m_ownerCharacter = ((Component)this).gameObject.GetComponent().ControlledCharacter; m_startPosition = ((Component)m_ownerCharacter).transform.position; List list = new List(); CharacterManager.Instance.FindCharactersInRange(((Component)m_ownerCharacter).transform.position, 10f, ref list); if (list.Contains(m_ownerCharacter)) { list.Remove(m_ownerCharacter); } RPCManager.SendSetPlayerActive(UID.op_Implicit(m_ownerCharacter.UID), active: false); SetFreeCam(active: true); if (list.Count > 0) { SetTarget(list[0]); } } private void SetFreeCam(bool active) { At.Invoke(VideoCamera.Instance, "SetCameraActive", new object[1] { active }); if (active) { At.SetField(VideoCamera.Instance, "m_flyMode", (object)true); Global.LockCursor(true); } } internal void Update() { if (Input.GetKeyDown((KeyCode)276)) { CycleTarget(-1); } else if (Input.GetKeyDown((KeyCode)275)) { CycleTarget(1); } else if (Input.GetKeyDown((KeyCode)273) || Input.GetKeyDown((KeyCode)274)) { m_spectateTargetIndex = 0; ReleaseTarget(); } else if (Input.GetKeyDown((KeyCode)27) && !PvPGUI.Instance.ShowGUI) { ReleaseTarget(); PvPGUI.Instance.ShowGUI = true; Global.LockCursor(false); } if (hasTarget) { UpdateTarget(); } } private void UpdateTarget() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_005c: 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_006b: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_target) || m_target.IsDead) { ReleaseTarget(); return; } Vector3 position = ((Component)m_target).transform.position + Vector3.up * 4f + ((Component)m_target).transform.forward * -6f; ((Component)FreeCamera).transform.position = position; CameraTransform.position = position; ((Component)FreeCamera).transform.LookAt(((Component)m_target).transform); CameraTransform.LookAt(((Component)m_target).transform); } private void CycleTarget(int change) { if (change == -1) { if (m_spectateTargetIndex > 0) { m_spectateTargetIndex--; } else { m_spectateTargetIndex = AvailableTargets.Length - 1; } } else if (m_spectateTargetIndex < AvailableTargets.Length - 1) { m_spectateTargetIndex++; } else { m_spectateTargetIndex = 0; } SetTarget(AvailableTargets[m_spectateTargetIndex]); } private void SetTarget(Character target) { hasTarget = true; m_target = target; Global.LockCursor(true); RPCManager.Instance.SendUIMessageLocal(m_ownerCharacter, "Spectating " + target.Name); At.SetField(VideoCamera.Instance, "m_targetTrans", (object)((Component)target).transform); At.SetField(VideoCamera.Instance, "m_state", (object)(VideoCamState)2); } private void ReleaseTarget() { hasTarget = false; m_target = null; At.SetField(VideoCamera.Instance, "m_targetTrans", (object)null); At.SetField(VideoCamera.Instance, "m_state", (object)(VideoCamState)0); } public void EndSpectate() { //IL_0016: 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_0033: Unknown result type (might be due to invalid IL or missing references) ReleaseTarget(); SetFreeCam(active: false); RPCManager.SendSetPlayerActive(UID.op_Implicit(m_ownerCharacter.UID), active: true); m_ownerCharacter.Teleport(m_startPosition, Quaternion.identity); Object.Destroy((Object)(object)this); } } public static class Templates { public static class BR_Templates { public static readonly Dictionary TimeOfDayStarts = new Dictionary { { "Monsoon", 23f } }; public static readonly Dictionary> SpawnLocations = new Dictionary> { { "Monsoon", new List { new Vector3(50.4f, -2.7f, 102.6f), new Vector3(93.9f, -6.97f, 109.1f), new Vector3(137.5f, 22.13f, 172.5f), new Vector3(91.7f, -4.37f, 195.2f), new Vector3(81.82f, -3.38f, 258.07f), new Vector3(146.4f, 9.03f, 255.2f), new Vector3(-11.6f, 4.78f, 276.93f), new Vector3(61.3f, 4.46f, 192.4f), new Vector3(3.04f, -0.744f, 200.03f), new Vector3(-15.39f, -0.37f, 146.63f), new Vector3(40.2f, -4.43f, 208.093f), new Vector3(77.34f, 4.465f, 136.96f) } } }; public static readonly Dictionary> SupplyDropLocations = new Dictionary> { { "Monsoon", new List { new Vector3(92.48f, -5.45f, 138.99f), new Vector3(-18.96f, -0.29f, 208.71f), new Vector3(90.05f, 4.465f, 162.2f), new Vector3(97.65f, 10.52f, 290.009f), new Vector3(121.197f, 0.182f, 232.48f), new Vector3(-6.46f, 11.67f, 287.92f) } } }; public static readonly Dictionary> ObjectsToDeactivate = new Dictionary> { { "Monsoon", new List { "JesusBeam", "Tree Behavior UNPC", "Tree_Behavior_CityCheck", "Tree Behavior Teleport", "Tree_Behavior_Council", "CharactersToDesactivate", "Allies", "DialogueAutomaticGuards", "AutomaticDialogueInn", "AreaSwitchToMarsh" } } }; public static readonly Dictionary> ObjectsToActivate = new Dictionary> { { "Monsoon", new List { "WarzoneMonsoon", "Ennemies" } } }; public static readonly List Skills_Low = new List { 8100090, 8100140, 8100130, 8100071, 8100101, 8100121, 8100260, 8100360, 8205350, 8205000, 8205120, 8205050, 8205080, 8205150, 8205210 }; public static readonly List Skills_High = new List { 8100020, 8100370, 8100350, 8100280, 8100200, 8200310, 8200030, 8200031, 8200032, 8200100, 8200101, 8200102, 8200103, 8205320, 8205330 }; public static readonly List Weapons_Low = new List { 2000061, 2000110, 2000151, 2000120, 2010020, 2010040, 2010041, 2010080, 2020030 }; public static readonly List Weapons_Med = new List { 2000021, 2000031, 2020060, 2020110, 2020020, 2100000, 2100110, 2130000, 2130022, 2120000, 2120030, 2140070, 2200010, 2200040 }; public static readonly List Weapons_High = new List { 2000150, 2000170, 2010070, 2010130, 2010140, 2020140, 2020160, 2100100, 2100160, 2110100, 2110110, 2120070, 2130021, 2130160, 2140120, 2140130, 2200030, 2200040, 2200020 }; public static readonly List Offhands_Low = new List { 2300120, 2300070, 2300210, 2300050 }; public static readonly List Offhands_High = new List { 5110100, 5110110, 5110002, 5110004, 2300171, 2300160, 2300091, 2300220, 5100090 }; public static readonly List Armor_Low = new List { 3000010, 3000011, 3000012, 3000020, 3000021, 3000022, 3000030, 3000031, 3000034, 3000180, 3000181, 3000182, 3000183, 3000184, 3000103, 3000250 }; public static readonly List Armor_High = new List { 3000061, 3100120, 3100201, 3100202, 3100200, 3000103, 3000252, 3000302, 3000303, 3100010, 3100012, 3100013, 3100040, 3100041, 3100042, 3100080, 3100081, 3100082, 3100090, 3100091, 3100092, 3100150, 3100151, 3100152, 3100170, 3100171, 3100172 }; public static readonly List Supplies_Low = new List { 4300010, 4300010, 4300010, 4300010, 4300010, 4300010, 4300010, 4300060, 4300060, 4300060, 4300020, 4300020, 4300030, 4300030, 4300050, 4300070, 4300080, 4300100, 4300120 }; public static readonly List Supplies_High = new List { 4300240, 4300240, 4300240, 4300260, 4300260, 4300260, 4300250, 4300250, 4300250, 4400070, 4400060, 4400051, 4400041, 4400031 }; } public static readonly List StarterSkills = new List { 8100010, 8200040, 8100072, 8200600, 8100120, 8100190 }; public static readonly Dictionary Weapon_Skills = new Dictionary { { 0, 8100290 }, { 1, 8100380 }, { 2, 8100270 }, { 50, 8100320 }, { 51, 8100362 }, { 52, 8100300 }, { 53, 8100310 }, { 54, 8100340 } }; }