Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ManorPvP v1.3.0
ManorPvP.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ManorPvP")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ManorPvP")] [assembly: AssemblyTitle("ManorPvP")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ManorPvP { public class ManorPvPManager : MonoBehaviour { public static MatchSettings Settings = MatchSettings.FromConfig(); private bool matchStarted; private bool leftOrbit; private bool spawnDone; private bool resultSent; private bool starting; private float landedTimer; private float winCheckTimer; private int spawnedPlayerCount; private bool menuOpen; private bool autoOpenedThisOrbit; private Rect windowRect = new Rect(0f, 0f, 460f, 640f); private Vector2 scroll; private GUIStyle titleStyle; private GUIStyle boxStyle; private GUIStyle bigButton; private readonly Dictionary<ShotgunItem, int> ammo = new Dictionary<ShotgunItem, int>(); private readonly Dictionary<ShotgunItem, int> pendingEchoes = new Dictionary<ShotgunItem, int>(); private bool inMyFire; private float nextShotTime; private float reloadEndTime; private ShotgunItem heldGun; private InputAction fireAction; private readonly Dictionary<ulong, int> mineCounts = new Dictionary<ulong, int>(); private const int MinesPerTool = 1; private float lastMineTime; public static readonly string[] TeamNames = new string[4] { "KIRMIZI", "MAVİ", "YEŞİL", "SARI" }; public static readonly Color[] TeamColors = (Color[])(object)new Color[4] { new Color(1f, 0.35f, 0.35f), new Color(0.4f, 0.6f, 1f), new Color(0.4f, 1f, 0.45f), new Color(1f, 0.9f, 0.3f) }; private readonly Dictionary<int, int> hostTeams = new Dictionary<int, int>(); private readonly Dictionary<int, int> playerTeams = new Dictionary<int, int>(); private int spawnedTeamCount; private static GameObject landminePrefab; private GameObject ghost; private MeshRenderer[] ghostRenderers; private bool ghostValid; private readonly Dictionary<ulong, MineInfo> mines = new Dictionary<ulong, MineInfo>(); public static ManorPvPManager Instance { get; private set; } public static bool MatchActive { get { if ((Object)(object)Instance != (Object)null && Instance.matchStarted && (Object)(object)StartOfRound.Instance != (Object)null) { return !StartOfRound.Instance.inShipPhase; } return false; } } private static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { return NetworkManager.Singleton.IsServer; } return false; } } private static PlayerControllerB Local { get { if (!((Object)(object)GameNetworkManager.Instance != (Object)null)) { return null; } return GameNetworkManager.Instance.localPlayerController; } } private void Awake() { Instance = this; } public void ResetAll() { matchStarted = false; leftOrbit = false; spawnDone = false; resultSent = false; starting = false; autoOpenedThisOrbit = false; ammo.Clear(); pendingEchoes.Clear(); mineCounts.Clear(); mines.Clear(); playerTeams.Clear(); hostTeams.Clear(); fireAction = null; if (menuOpen) { SetMenu(open: false); } ((MonoBehaviour)this).StopAllCoroutines(); } private void Update() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.Enabled.Value) { return; } StartOfRound instance = StartOfRound.Instance; PlayerControllerB local = Local; if ((Object)(object)instance == (Object)null || (Object)(object)local == (Object)null) { if (menuOpen) { SetMenu(open: false); } return; } if (Keyboard.current != null && ((ButtonControl)Keyboard.current[Plugin.MenuKey.Value]).wasPressedThisFrame && !local.isTypingChat) { SetMenu(!menuOpen); } if (!instance.inShipPhase) { leftOrbit = true; } if (instance.inShipPhase && leftOrbit) { leftOrbit = false; matchStarted = false; spawnDone = false; resultSent = false; autoOpenedThisOrbit = false; ammo.Clear(); pendingEchoes.Clear(); mineCounts.Clear(); mines.Clear(); playerTeams.Clear(); } if (IsHost && instance.inShipPhase && !autoOpenedThisOrbit && !instance.travellingToNewLevel && instance.fullyLoadedPlayers != null) { autoOpenedThisOrbit = true; SetMenu(open: true); } if (menuOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; local.disableLookInput = true; local.disableMoveInput = true; } if (IsHost) { HostUpdate(instance); } if (MatchActive) { GunUpdate(local); } GhostUpdate(local); } private void HostUpdate(StartOfRound sor) { if (!matchStarted || sor.inShipPhase) { return; } if (!spawnDone) { RoundManager instance = RoundManager.Instance; if (sor.shipHasLanded && (Object)(object)instance != (Object)null && instance.dungeonFinishedGeneratingForAllPlayers && instance.insideAINodes != null && instance.insideAINodes.Length != 0) { landedTimer += Time.deltaTime; if (landedTimer > 1.5f) { spawnDone = true; DoSpawns(); } } else { landedTimer = 0f; } } else { if (resultSent || !sor.shipHasLanded) { return; } winCheckTimer -= Time.deltaTime; if (winCheckTimer > 0f) { return; } winCheckTimer = 0.5f; List<PlayerControllerB> list = sor.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead).ToList(); if (Settings.TeamMode) { List<int> list2 = list.Select((PlayerControllerB p) => TeamOf(p)).Distinct().ToList(); if (spawnedTeamCount < 2 || list2.Count > 1) { return; } resultSent = true; string text; if (list2.Count == 1) { int team = list2[0]; IEnumerable<string> values = from p in sor.allPlayerScripts where (Object)(object)p != (Object)null && playerTeams.ContainsKey(PlayerIndex(p)) && TeamOf(p) == team select p.playerUsername; text = TeamName(team) + " TAKIM KAZANDI! (" + string.Join(", ", values) + ")"; } else { text = "Kimse hayatta kalmadı, berabere!"; } Net.BroadcastResult(text); if (Plugin.AutoLeaveOnWin.Value && list2.Count == 1) { ((MonoBehaviour)this).StartCoroutine(LeaveAfter(6f)); } } else if (spawnedPlayerCount >= 2 && list.Count <= 1) { resultSent = true; Net.BroadcastResult((list.Count == 1) ? (list[0].playerUsername + " KAZANDI!") : "Kimse hayatta kalmadı, berabere!"); if (Plugin.AutoLeaveOnWin.Value && list.Count == 1) { ((MonoBehaviour)this).StartCoroutine(LeaveAfter(6f)); } } } } public static string TeamName(int team) { if (team < 0 || team >= TeamNames.Length) { return "?"; } return TeamNames[team]; } private static int PlayerIndex(PlayerControllerB p) { return Array.IndexOf(StartOfRound.Instance.allPlayerScripts, p); } private int TeamOf(PlayerControllerB p) { return TeamOfIndex(PlayerIndex(p)); } private int TeamOfIndex(int index) { if (!playerTeams.TryGetValue(index, out var value)) { return -1; } return value; } public bool SameTeam(int indexA, int teamB) { if (!Settings.TeamMode || teamB < 0) { return false; } return TeamOfIndex(indexA) == teamB; } public bool AreTeammates(PlayerControllerB a, PlayerControllerB b) { if ((Object)(object)a == (Object)null || (Object)(object)b == (Object)null || (Object)(object)a == (Object)(object)b) { return false; } return SameTeam(PlayerIndex(a), TeamOf(b)); } private List<PlayerControllerB> ConnectedPlayers() { return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled).ToList(); } private void EnsureHostTeams() { int num = Mathf.Clamp(Plugin.TeamCount.Value, 2, TeamNames.Length); foreach (PlayerControllerB p in ConnectedPlayers()) { int key = PlayerIndex(p); if (hostTeams.TryGetValue(key, out var value) && value < num) { continue; } hostTeams[key] = (from team in Enumerable.Range(0, num) orderby ConnectedPlayers().Count((PlayerControllerB o) => (Object)(object)o != (Object)(object)p && hostTeams.TryGetValue(PlayerIndex(o), out var value2) && value2 == team) select team).First(); } } private void RandomizeTeams() { int num = Mathf.Clamp(Plugin.TeamCount.Value, 2, TeamNames.Length); List<PlayerControllerB> list = (from _ in ConnectedPlayers() orderby Random.value select _).ToList(); for (int num2 = 0; num2 < list.Count; num2++) { hostTeams[PlayerIndex(list[num2])] = num2 % num; } } private IEnumerator LeaveAfter(float seconds) { yield return (object)new WaitForSeconds(seconds); ForceShipLeave(); } private static void ForceShipLeave() { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && instance.shipHasLanded && !instance.shipIsLeaving) { instance.EndGameServerRpc((int)Local.playerClientId); } } private List<SelectableLevel> Moons() { return StartOfRound.Instance.levels.Where((SelectableLevel l) => (Object)(object)l != (Object)null && l.sceneName != "CompanyBuilding" && !l.PlanetName.Contains("Gordion")).ToList(); } private SelectableLevel SelectedMoon() { List<SelectableLevel> source = Moons(); return ((IEnumerable<SelectableLevel>)source).FirstOrDefault((Func<SelectableLevel, bool>)((SelectableLevel l) => l.PlanetName == Plugin.MoonName.Value)) ?? ((IEnumerable<SelectableLevel>)source).FirstOrDefault((Func<SelectableLevel, bool>)((SelectableLevel l) => l.PlanetName.Contains(Plugin.MoonName.Value))) ?? source.FirstOrDefault(); } private void StartMatch() { SelectableLevel val = SelectedMoon(); if (!((Object)(object)val == (Object)null) && !starting) { Plugin.Cfg.Save(); SetMenu(open: false); ((MonoBehaviour)this).StartCoroutine(StartMatchRoutine(val.levelID)); } } private IEnumerator StartMatchRoutine(int levelId) { starting = true; StartOfRound sor = StartOfRound.Instance; Net.BroadcastStart(MatchSettings.FromConfig()); if (sor.currentLevelID != levelId) { Terminal val = Object.FindObjectOfType<Terminal>(); sor.ChangeLevelServerRpc(levelId, ((Object)(object)val != (Object)null) ? val.groupCredits : 0); float t = 0f; yield return (object)new WaitForSeconds(0.5f); while ((sor.travellingToNewLevel || sor.currentLevelID != levelId) && t < 40f) { t += Time.deltaTime; yield return null; } yield return (object)new WaitForSeconds(1f); } if (sor.currentLevelID != levelId) { HUDManager.Instance.DisplayTip("Manor PvP", "Aya gidilemedi, tekrar dene.", true, false, "LC_Tip1"); starting = false; yield break; } landedTimer = 0f; spawnDone = false; resultSent = false; sor.StartGameServerRpc(); yield return (object)new WaitForSeconds(3f); starting = false; } private void DoSpawns() { //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; List<PlayerControllerB> list = instance.allPlayerScripts.Where((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled && !p.isPlayerDead).ToList(); spawnedPlayerCount = list.Count; bool teamMode = Plugin.TeamMode.Value; if (teamMode) { EnsureHostTeams(); } List<PlayerControllerB> list2 = list.OrderBy((PlayerControllerB _) => Random.value).ToList(); Dictionary<PlayerControllerB, Vector3> dictionary = new Dictionary<PlayerControllerB, Vector3>(); if (teamMode && Plugin.TeamsSpawnTogether.Value) { List<int> teams = list2.Select(HostTeam).Distinct().ToList(); List<Vector3> list3 = PickFarApartPoints(teams.Count); int t; for (t = 0; t < teams.Count; t++) { List<PlayerControllerB> list4 = list2.Where((PlayerControllerB p) => HostTeam(p) == teams[t]).ToList(); for (int num = 0; num < list4.Count; num++) { dictionary[list4[num]] = PointNear(list3[t % list3.Count], num); } } } else { List<Vector3> list5 = PickFarApartPoints(list.Count); for (int num2 = 0; num2 < list2.Count; num2++) { dictionary[list2[num2]] = list5[num2 % list5.Count]; } } Item val = (Plugin.GiveGun.Value ? FindItem<ShotgunItem>("Silah") : null); Item val2 = ((Plugin.KeyCount.Value > 0) ? FindItem<KeyItem>("Anahtar") : null); Item val3 = (Plugin.GiveMineTool.Value ? FindItem<RemoteProp>("Kumanda (mayın koyucu)") : null); int num3 = Mathf.Clamp(Plugin.KeyCount.Value, 0, 2); List<SpawnEntry> list6 = new List<SpawnEntry>(); mineCounts.Clear(); for (int num4 = 0; num4 < list2.Count; num4++) { Vector3 val4 = dictionary[list2[num4]]; List<ulong> list7 = new List<ulong>(); if ((Object)(object)val2 != (Object)null) { for (int num5 = 0; num5 < num3; num5++) { list7.Add(SpawnItem(val2, val4)); } } ulong num6 = 0uL; if ((Object)(object)val3 != (Object)null) { num6 = SpawnItem(val3, val4); list7.Add(num6); } if ((Object)(object)val != (Object)null) { list7.Add(SpawnItem(val, val4)); } list6.Add(new SpawnEntry { PlayerIndex = Array.IndexOf(instance.allPlayerScripts, list2[num4]), Position = val4, GrabIds = list7.ToArray(), MineToolId = num6, Team = HostTeam(list2[num4]) }); } Net.BroadcastSpawns(list6); int HostTeam(PlayerControllerB p) { if (!teamMode) { return -1; } return hostTeams[PlayerIndex(p)]; } } private static Vector3 PointNear(Vector3 center, int slot) { //IL_001f: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) if (slot == 0) { return center; } float num = (float)slot * 2.4f; Vector3 val = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 1.6f; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(center + val, ref val2, 2f, -1) && !Physics.Linecast(center + Vector3.up, ((NavMeshHit)(ref val2)).position + Vector3.up, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return ((NavMeshHit)(ref val2)).position; } return center; } private static ulong SpawnItem(Item item, Vector3 pos) { //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_0011: 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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(item.spawnPrefab, pos + Vector3.up * 0.5f, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); GrabbableObject component = obj.GetComponent<GrabbableObject>(); component.fallTime = 0f; component.isInFactory = true; NetworkObject component2 = obj.GetComponent<NetworkObject>(); component2.Spawn(false); return component2.NetworkObjectId; } private static Item FindItem<T>(string label) where T : GrabbableObject { Item? obj = ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item i) => (Object)(object)i != (Object)null && (Object)(object)i.spawnPrefab != (Object)null && (Object)(object)i.spawnPrefab.GetComponent<T>() != (Object)null)); if ((Object)(object)obj == (Object)null) { Plugin.Log.LogWarning((object)(label + " eşyası bulunamadı!")); } return obj; } private static GameObject FindLandminePrefab() { if ((Object)(object)landminePrefab != (Object)null) { return landminePrefab; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (val?.indoorMapHazards == null) { continue; } IndoorMapHazard[] indoorMapHazards = val.indoorMapHazards; for (int j = 0; j < indoorMapHazards.Length; j++) { GameObject val2 = indoorMapHazards[j]?.hazardType?.prefabToSpawn; if ((Object)(object)val2 != (Object)null && (Object)(object)val2.GetComponentInChildren<Landmine>() != (Object)null) { return landminePrefab = val2; } } } Plugin.Log.LogWarning((object)"Mayın prefab'ı bulunamadı!"); return null; } private static bool ComputeMinePlacement(PlayerControllerB local, out Vector3 point, out float yaw, out bool valid) { //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_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_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_0041: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c7: 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_00d1: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)local).transform; Vector3 val = Vector3.ProjectOnPlane(((Component)local.gameplayCamera).transform.forward, Vector3.up); Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = transform.forward; } Quaternion val3 = Quaternion.LookRotation(val2); yaw = ((Quaternion)(ref val3)).eulerAngles.y; Vector3 val4 = transform.position + Vector3.up * 1f; Vector3 val5 = transform.position + val2 * 1.5f + Vector3.up * 1f; int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; RaycastHit val6 = default(RaycastHit); bool flag = Physics.Linecast(val4, val5, ref val6, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); if (flag) { val5 = ((RaycastHit)(ref val6)).point - val2 * 0.3f; } RaycastHit val7 = default(RaycastHit); if (!Physics.Raycast(val5, Vector3.down, ref val7, 3f, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { point = default(Vector3); valid = false; return false; } point = ((RaycastHit)(ref val7)).point; valid = !flag && ((RaycastHit)(ref val7)).normal.y > 0.7f; return true; } public void TryPlaceMine(GrabbableObject tool) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB local = Local; if (!((Object)(object)local == (Object)null) && !((Object)(object)tool.playerHeldBy != (Object)(object)local) && !local.isPlayerDead && !(Time.time - lastMineTime < 1f) && mineCounts.TryGetValue(((NetworkBehaviour)tool).NetworkObjectId, out var value) && value > 0) { if (!ComputeMinePlacement(local, out var point, out var yaw, out var valid) || !valid) { HUDManager.Instance.DisplayTip("Mayın", "Buraya mayın koyulamaz.", true, false, "LC_Tip1"); return; } lastMineTime = Time.time; Net.RequestPlaceMine(((NetworkBehaviour)tool).NetworkObjectId, point, yaw); } } private void GhostUpdate(PlayerControllerB local) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) GrabbableObject currentlyHeldObjectServer = local.currentlyHeldObjectServer; if (!MatchActive || local.isPlayerDead || menuOpen || !IsMineTool(currentlyHeldObjectServer) || mineCounts[((NetworkBehaviour)currentlyHeldObjectServer).NetworkObjectId] <= 0 || !ComputeMinePlacement(local, out var point, out var yaw, out var valid) || !EnsureGhost()) { if ((Object)(object)ghost != (Object)null) { ghost.SetActive(false); } return; } ghost.SetActive(true); ghost.transform.SetPositionAndRotation(point, Quaternion.Euler(0f, yaw, 0f)); if (valid != ghostValid) { ghostValid = valid; SetGhostMaterial(valid); } } private bool EnsureGhost() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if ((Object)(object)ghost != (Object)null) { return true; } GameObject val = FindLandminePrefab(); ShipBuildModeManager instance = ShipBuildModeManager.Instance; if ((Object)(object)val == (Object)null || (Object)(object)instance == (Object)null || (Object)(object)instance.ghostObjectGreen == (Object)null) { return false; } ghost = new GameObject("ManorPvP_MineGhost"); Transform transform = val.transform; List<MeshRenderer> list = new List<MeshRenderer>(); MeshFilter[] componentsInChildren = val.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val2 in componentsInChildren) { MeshRenderer component = ((Component)val2).GetComponent<MeshRenderer>(); if (!((Object)(object)val2.sharedMesh == (Object)null) && !((Object)(object)component == (Object)null) && ((Renderer)component).enabled && !((Object)(object)((Component)val2).GetComponent<TMP_Text>() != (Object)null)) { AddGhostPart(transform, ((Component)val2).transform, val2.sharedMesh, list); } } SkinnedMeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val3 in componentsInChildren2) { if (!((Object)(object)val3.sharedMesh == (Object)null) && ((Renderer)val3).enabled) { AddGhostPart(transform, ((Component)val3).transform, val3.sharedMesh, list); } } ghostRenderers = list.ToArray(); ghostValid = true; SetGhostMaterial(valid: true); ghost.SetActive(false); return true; } private void AddGhostPart(Transform root, Transform part, Mesh mesh, List<MeshRenderer> renderers) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0033: 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_004b: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) Matrix4x4 val = root.worldToLocalMatrix * part.localToWorldMatrix; GameObject val2 = new GameObject("part"); val2.transform.SetParent(ghost.transform, false); val2.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(3)); val2.transform.localRotation = ((Matrix4x4)(ref val)).rotation; val2.transform.localScale = ((Matrix4x4)(ref val)).lossyScale; val2.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer val3 = val2.AddComponent<MeshRenderer>(); ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; renderers.Add(val3); } private void SetGhostMaterial(bool valid) { ShipBuildModeManager instance = ShipBuildModeManager.Instance; if ((Object)(object)instance == (Object)null || ghostRenderers == null) { return; } Material element = (valid ? instance.ghostObjectGreen : instance.ghostObjectRed); MeshRenderer[] array = ghostRenderers; foreach (MeshRenderer val in array) { if (!((Object)(object)val == (Object)null)) { int count = Mathf.Max(1, ((Component)val).GetComponent<MeshFilter>().sharedMesh.subMeshCount); ((Renderer)val).sharedMaterials = Enumerable.Repeat<Material>(element, count).ToArray(); } } } public void HostPlaceMine(ulong sender, ulong toolId, Vector3 pos, float yaw) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!MatchActive || !mineCounts.TryGetValue(toolId, out var value) || value <= 0 || !NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(toolId, out var value2) || value2.OwnerClientId != sender) { return; } GameObject val = FindLandminePrefab(); if (!((Object)(object)val == (Object)null)) { GameObject val2 = GameObject.FindGameObjectWithTag("MapPropsContainer"); NetworkObject component = Object.Instantiate<GameObject>(val, pos, Quaternion.Euler(0f, yaw, 0f), ((Object)(object)val2 != (Object)null) ? val2.transform : null).GetComponent<NetworkObject>(); component.Spawn(true); PlayerControllerB val3 = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled && p.actualClientId == sender)); int num = (((Object)(object)val3 != (Object)null) ? PlayerIndex(val3) : (-1)); MineInfo info = new MineInfo { OwnerIndex = num, Team = TeamOfIndex(num) }; Net.BroadcastMinePlaced(toolId, value - 1, component.NetworkObjectId, info); } } public bool MineIgnores(Landmine mine, PlayerControllerB player) { if (!MatchActive || (Object)(object)mine == (Object)null || (Object)(object)player == (Object)null) { return false; } if (!mines.TryGetValue(((NetworkBehaviour)mine).NetworkObjectId, out var value)) { return false; } int num = PlayerIndex(player); if (num != value.OwnerIndex) { return SameTeam(num, value.Team); } return true; } public void OnMinePlaced(ulong toolId, int remaining, ulong mineId, MineInfo info) { mines[mineId] = info; mineCounts[toolId] = remaining; PlayerControllerB local = Local; GrabbableObject val = (((Object)(object)local != (Object)null) ? local.currentlyHeldObjectServer : null); if (remaining <= 0 && (Object)(object)val != (Object)null && ((NetworkBehaviour)val).NetworkObjectId == toolId && ((NetworkBehaviour)val).IsOwner) { local.DespawnHeldObject(); } } public bool IsMineTool(GrabbableObject item) { if ((Object)(object)item != (Object)null && (Object)(object)((NetworkBehaviour)item).NetworkObject != (Object)null) { return mineCounts.ContainsKey(((NetworkBehaviour)item).NetworkObjectId); } return false; } private static List<Vector3> PickFarApartPoints(int count) { //IL_002b: 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_0070: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); GameObject[] insideAINodes = RoundManager.Instance.insideAINodes; NavMeshHit val2 = default(NavMeshHit); foreach (GameObject val in insideAINodes) { if (!((Object)(object)val == (Object)null) && NavMesh.SamplePosition(val.transform.position, ref val2, 3f, -1)) { list.Add(((NavMeshHit)(ref val2)).position); } } if (list.Count == 0) { list.Add(RoundManager.Instance.insideAINodes[0].transform.position); } List<Vector3> list2 = new List<Vector3> { list[Random.Range(0, list.Count)] }; while (list2.Count < count && list2.Count < list.Count) { Vector3 item = list[0]; float num = -1f; foreach (Vector3 c in list) { float num2 = list2.Min((Vector3 x) => Vector3.Distance(x, c)); if (num2 > num) { num = num2; item = c; } } list2.Add(item); } return list2; } public void OnMatchStart(MatchSettings s) { Settings = s; matchStarted = true; ammo.Clear(); pendingEchoes.Clear(); mineCounts.Clear(); mines.Clear(); playerTeams.Clear(); HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip("Manor PvP", "Maç başlıyor! Gemi malikaneye iniyor...", false, false, "LC_Tip1"); } } public void OnSpawns(List<SpawnEntry> entries) { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) StartOfRound sor = StartOfRound.Instance; PlayerControllerB local = Local; AudioReverbPresets val = Object.FindObjectOfType<AudioReverbPresets>(); playerTeams.Clear(); foreach (SpawnEntry entry in entries) { if (entry.Team >= 0) { playerTeams[entry.PlayerIndex] = entry.Team; } } spawnedTeamCount = playerTeams.Values.Distinct().Count(); foreach (SpawnEntry e in entries) { if (e.PlayerIndex < 0 || e.PlayerIndex >= sor.allPlayerScripts.Length) { continue; } PlayerControllerB val2 = sor.allPlayerScripts[e.PlayerIndex]; val2.isInElevator = false; val2.isInHangarShipRoom = false; val2.isInsideFactory = true; val2.averageVelocity = 0f; val2.velocityLastFrame = Vector3.zero; try { if ((Object)(object)val != (Object)null && val.audioPresets.Length > 2) { val.audioPresets[2].ChangeAudioReverbForPlayer(val2); } } catch { } val2.TeleportPlayer(e.Position, false, 0f, false, true); ParticleSystem beamOutParticle = val2.beamOutParticle; if (beamOutParticle != null) { beamOutParticle.Play(); } if (e.MineToolId != 0L) { mineCounts[e.MineToolId] = 1; } if (!((Object)(object)val2 == (Object)(object)local)) { continue; } HUDManager.Instance.ShakeCamera((ScreenShakeType)1); if (e.Team >= 0) { List<string> list = (from o in entries where o.Team == e.Team && o.PlayerIndex != e.PlayerIndex select sor.allPlayerScripts[o.PlayerIndex].playerUsername).ToList(); HUDManager.Instance.DisplayTip("Takımın: " + TeamName(e.Team), ((list.Count > 0) ? ("Takım arkadaşların: " + string.Join(", ", list)) : "Takımında tek başınasın!") + "\nSon hayatta kalan takım kazanır.", false, false, "LC_Tip1"); } else { HUDManager.Instance.DisplayTip("Manor PvP", "Son hayatta kalan kazanır! Sol tık basılı tut = ateş. Kumanda elindeyken sol tık = mayın.", false, false, "LC_Tip1"); } if (e.GrabIds != null && e.GrabIds.Length != 0) { ((MonoBehaviour)this).StartCoroutine(GrabItemsRoutine(e.GrabIds)); } } } public void OnResult(string text) { HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip("MAÇ BİTTİ", text, false, false, "LC_Tip1"); } Plugin.Log.LogInfo((object)("Maç sonucu: " + text)); } private IEnumerator GrabItemsRoutine(ulong[] ids) { yield return (object)new WaitForSeconds(0.5f); foreach (ulong id in ids) { NetworkObject no = null; float t = 0f; while (t < 8f && !NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(id, out no)) { t += Time.deltaTime; yield return null; } if ((Object)(object)no == (Object)null) { continue; } PlayerControllerB local = Local; GrabbableObject item = ((Component)no).GetComponent<GrabbableObject>(); if ((Object)(object)local == (Object)null || local.isPlayerDead) { break; } if (!((Object)(object)item == (Object)null) && !item.isHeld && !item.heldByPlayerOnServer) { t = 0f; while ((local.isGrabbingObjectAnimation || local.inSpecialInteractAnimation || local.twoHanded) && t < 5f) { t += Time.deltaTime; yield return null; } ForceGrab(local, item); t = 0f; while ((local.isGrabbingObjectAnimation || !item.isHeld) && t < 4f) { t += Time.deltaTime; yield return null; } yield return (object)new WaitForSeconds(0.25f); } } } private static void ForceGrab(PlayerControllerB p, GrabbableObject item) { //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (item.grabbable && p.FirstEmptyItemSlot(item) != -1 && ((NetworkBehaviour)item).NetworkObject.IsSpawned) { p.currentlyGrabbingObject = item; p.grabInvalidated = false; item.InteractItem(); p.playerBodyAnimator.SetBool("GrabInvalidated", false); p.playerBodyAnimator.SetBool("GrabValidated", false); p.playerBodyAnimator.SetBool("cancelHolding", false); p.playerBodyAnimator.ResetTrigger("Throw"); p.SetSpecialGrabAnimationBool(true, (GrabbableObject)null); p.isGrabbingObjectAnimation = true; ((Behaviour)p.cursorIcon).enabled = false; ((TMP_Text)p.cursorTip).text = ""; p.twoHanded = item.itemProperties.twoHanded; p.carryWeight = Mathf.Clamp(p.carryWeight + (item.itemProperties.weight - 1f), 1f, 10f); StartOfRound.Instance.SendChangedWeightEvent(); p.grabObjectAnimationTime = ((item.itemProperties.grabAnimationTime > 0f) ? item.itemProperties.grabAnimationTime : 0.4f); p.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)item).NetworkObject)); if (p.grabObjectCoroutine != null) { ((MonoBehaviour)p).StopCoroutine(p.grabObjectCoroutine); } p.grabObjectCoroutine = ((MonoBehaviour)p).StartCoroutine(p.GrabObject()); } } private void GunUpdate(PlayerControllerB local) { GrabbableObject currentlyHeldObjectServer = local.currentlyHeldObjectServer; ShotgunItem val = (ShotgunItem)(object)((currentlyHeldObjectServer is ShotgunItem) ? currentlyHeldObjectServer : null); if ((Object)(object)val == (Object)null || !((GrabbableObject)val).isHeld || (Object)(object)((GrabbableObject)val).playerHeldBy != (Object)(object)local || ((GrabbableObject)val).isPocketed || local.isPlayerDead) { heldGun = null; return; } if ((Object)(object)heldGun != (Object)(object)val) { heldGun = val; reloadEndTime = 0f; } val.shellsLoaded = 2; val.isReloading = false; if (!ammo.ContainsKey(val)) { ammo[val] = Settings.MagazineSize; } if (reloadEndTime > 0f) { if (Time.time < reloadEndTime) { return; } reloadEndTime = 0f; ammo[val] = Settings.MagazineSize; if ((Object)(object)val.gunReloadFinishSFX != (Object)null) { val.gunAudio.PlayOneShot(val.gunReloadFinishSFX); } } if (!FirePressed() || !CanUseInput(local) || Time.time < nextShotTime) { return; } if (!Settings.InfiniteAmmo && ammo[val] <= 0) { StartReload(val); return; } Fire(val); nextShotTime = Time.time + 1f / Settings.FireRate; if (!Settings.InfiniteAmmo) { ammo[val]--; if (ammo[val] <= 0) { StartReload(val); } } } private void StartReload(ShotgunItem gun) { reloadEndTime = Time.time + Settings.ReloadTime; if ((Object)(object)gun.gunReloadSFX != (Object)null) { gun.gunAudio.PlayOneShot(gun.gunReloadSFX); } } private void Fire(ShotgunItem gun) { pendingEchoes.TryGetValue(gun, out var value); pendingEchoes[gun] = value + 1; inMyFire = true; try { gun.ShootGunAndSync(true); } finally { inMyFire = false; } gun.localClientSendingShootGunRPC = false; gun.shellsLoaded = 2; } public bool ConsumeEcho(ShotgunItem gun) { if (inMyFire || !((NetworkBehaviour)gun).IsOwner) { return false; } if (pendingEchoes.TryGetValue(gun, out var value) && value > 0) { pendingEchoes[gun] = value - 1; return true; } return false; } private bool FirePressed() { if (fireAction == null) { IngamePlayerSettings instance = IngamePlayerSettings.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerInput == (Object)null) { return false; } fireAction = instance.playerInput.actions.FindAction("ActivateItem", false); if (fireAction == null) { return false; } } return fireAction.IsPressed(); } private bool CanUseInput(PlayerControllerB p) { if (!menuOpen && !p.isTypingChat && !p.inTerminalMenu && !p.quickMenuManager.isMenuOpen && !p.inSpecialInteractAnimation) { return !p.isGrabbingObjectAnimation; } return false; } private void SetMenu(bool open) { if (menuOpen == open) { return; } menuOpen = open; PlayerControllerB local = Local; if (!open) { Plugin.Cfg.Save(); if ((Object)(object)local != (Object)null) { local.disableLookInput = false; local.disableMoveInput = false; if (!local.quickMenuManager.isMenuOpen && !local.inTerminalMenu) { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } } } else { ((Rect)(ref windowRect)).x = ((float)Screen.width - ((Rect)(ref windowRect)).width) / 2f; ((Rect)(ref windowRect)).y = ((float)Screen.height - ((Rect)(ref windowRect)).height) / 2f; } } private void InitStyles() { //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_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_0034: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005f: Expected O, but got Unknown //IL_006a: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (titleStyle == null) { titleStyle = new GUIStyle(GUI.skin.label) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; boxStyle = new GUIStyle(GUI.skin.box) { fontSize = 14, alignment = (TextAnchor)4, wordWrap = true }; bigButton = new GUIStyle(GUI.skin.button) { fontSize = 16, fontStyle = (FontStyle)1, fixedHeight = 40f }; } } private void OnGUI() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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) if (!Plugin.Enabled.Value || (Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)Local == (Object)null) { return; } InitStyles(); StartOfRound instance = StartOfRound.Instance; if (MatchActive && Settings.TeamMode && playerTeams.TryGetValue(PlayerIndex(Local), out var value)) { Color color = GUI.color; GUI.color = TeamColors[value]; GUI.Box(new Rect(20f, 20f, 220f, 34f), "Takımın: " + TeamName(value), boxStyle); GUI.color = color; } GrabbableObject currentlyHeldObjectServer = Local.currentlyHeldObjectServer; if (MatchActive && !Local.isPlayerDead && IsMineTool(currentlyHeldObjectServer)) { GUI.Box(new Rect((float)(Screen.width - 300), (float)(Screen.height - 70), 280f, 40f), $"Mayın: {mineCounts[((NetworkBehaviour)currentlyHeldObjectServer).NetworkObjectId]} (sol tık: önüne koy)", boxStyle); } if (MatchActive && (Object)(object)heldGun != (Object)null && !Local.isPlayerDead) { int value2; string text = ((reloadEndTime > 0f) ? "Şarjör değiştiriliyor..." : (Settings.InfiniteAmmo ? "Mermi: ∞" : $"Mermi: {(ammo.TryGetValue(heldGun, out value2) ? value2 : 0)} / {Settings.MagazineSize}")); GUI.Box(new Rect((float)(Screen.width - 260), (float)(Screen.height - 70), 240f, 40f), text, boxStyle); } if (!menuOpen) { if (instance.inShipPhase && !IsHost) { GUI.Box(new Rect((float)Screen.width / 2f - 220f, 20f, 440f, 34f), "Manor PvP: Host'un maçı başlatması bekleniyor", boxStyle); } } else { windowRect = GUI.Window(5066830, windowRect, new WindowFunction(DrawWindow), "MANOR PvP"); } } private void DrawTeams() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(Plugin.TeamCount.Value, 2, TeamNames.Length); GUILayout.Label($"Takım sayısı: {num}", Array.Empty<GUILayoutOption>()); Plugin.TeamCount.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)num, 2f, (float)TeamNames.Length, Array.Empty<GUILayoutOption>())); Plugin.TeamsSpawnTogether.Value = GUILayout.Toggle(Plugin.TeamsSpawnTogether.Value, " Takım arkadaşları yan yana doğsun", Array.Empty<GUILayoutOption>()); EnsureHostTeams(); List<PlayerControllerB> players = ConnectedPlayers(); Color color = GUI.color; foreach (PlayerControllerB item in players) { int key = PlayerIndex(item); int num2 = hostTeams[key]; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(item.playerUsername, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); GUI.color = TeamColors[num2]; if (GUILayout.Button(TeamName(num2), Array.Empty<GUILayoutOption>())) { hostTeams[key] = (num2 + 1) % num; } GUI.color = color; GUILayout.EndHorizontal(); } IEnumerable<string> values = from t in Enumerable.Range(0, num) select $"{TeamNames[t]} {players.Count((PlayerControllerB p) => hostTeams[PlayerIndex(p)] == t)}"; GUILayout.Label(string.Join(" - ", values), Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Rastgele dağıt", Array.Empty<GUILayoutOption>())) { RandomizeTeams(); } } private void DrawWindow(int id) { //IL_00ee: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; GUILayout.Label("Maç Ayarları", titleStyle, Array.Empty<GUILayoutOption>()); if (!IsHost) { GUILayout.Space(10f); GUILayout.Label("Ayarları sadece host değiştirebilir.", Array.Empty<GUILayoutOption>()); GUILayout.Label($"Ateş hızı: {Settings.FireRate:0.#}/sn Hasar: {Settings.Damage}", Array.Empty<GUILayoutOption>()); GUILayout.Label(Settings.InfiniteAmmo ? "Mermi: sınırsız" : $"Şarjör: {Settings.MagazineSize} ({Settings.ReloadTime:0.#} sn)", Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button($"Kapat ({Plugin.MenuKey.Value})", Array.Empty<GUILayoutOption>())) { SetMenu(open: false); } GUI.DragWindow(); return; } scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>()); List<SelectableLevel> list = Moons(); SelectableLevel item = SelectedMoon(); int num = Mathf.Max(0, list.IndexOf(item)); GUILayout.Space(6f); GUILayout.Label("Ay (iç harita her zaman MALİKANE):", Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { num = (num - 1 + list.Count) % list.Count; } GUILayout.Label((list.Count > 0) ? list[num].PlanetName : "-", boxStyle, Array.Empty<GUILayoutOption>()); if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) })) { num = (num + 1) % list.Count; } GUILayout.EndHorizontal(); if (list.Count > 0) { Plugin.MoonName.Value = list[num].PlanetName; } GUILayout.Space(10f); GUILayout.Label("— Silah —", Array.Empty<GUILayoutOption>()); Plugin.GiveGun.Value = GUILayout.Toggle(Plugin.GiveGun.Value, " Herkesin eline silah ver", Array.Empty<GUILayoutOption>()); GUILayout.Label($"Ateş hızı: {Plugin.FireRate.Value:0.#} atış/sn", Array.Empty<GUILayoutOption>()); Plugin.FireRate.Value = Mathf.Round(GUILayout.HorizontalSlider(Plugin.FireRate.Value, 1f, 15f, Array.Empty<GUILayoutOption>()) * 2f) / 2f; GUILayout.Label($"Mermi hasarı: {Plugin.Damage.Value} (can = 100)", Array.Empty<GUILayoutOption>()); Plugin.Damage.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.Damage.Value, 1f, 100f, Array.Empty<GUILayoutOption>())); Plugin.InfiniteAmmo.Value = GUILayout.Toggle(Plugin.InfiniteAmmo.Value, " Sınırsız mermi", Array.Empty<GUILayoutOption>()); if (!Plugin.InfiniteAmmo.Value) { GUILayout.Label($"Şarjör: {Plugin.MagazineSize.Value} mermi", Array.Empty<GUILayoutOption>()); Plugin.MagazineSize.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.MagazineSize.Value, 5f, 100f, Array.Empty<GUILayoutOption>())); GUILayout.Label($"Şarjör değiştirme: {Plugin.ReloadTime.Value:0.0} sn", Array.Empty<GUILayoutOption>()); Plugin.ReloadTime.Value = Mathf.Round(GUILayout.HorizontalSlider(Plugin.ReloadTime.Value, 0.5f, 6f, Array.Empty<GUILayoutOption>()) * 10f) / 10f; } GUILayout.Space(10f); GUILayout.Label("— Eşyalar —", Array.Empty<GUILayoutOption>()); GUILayout.Label($"Anahtar: {Plugin.KeyCount.Value} adet (kilitli kapıları açar)", Array.Empty<GUILayoutOption>()); Plugin.KeyCount.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)Plugin.KeyCount.Value, 0f, 2f, Array.Empty<GUILayoutOption>())); Plugin.GiveMineTool.Value = GUILayout.Toggle(Plugin.GiveMineTool.Value, " Mayın koyucu ver (kumanda, 1 mayın)", Array.Empty<GUILayoutOption>()); GUILayout.Space(10f); GUILayout.Label("— Takımlar —", Array.Empty<GUILayoutOption>()); Plugin.TeamMode.Value = GUILayout.Toggle(Plugin.TeamMode.Value, " Takım modu (takım arkadaşına hasar işlemez)", Array.Empty<GUILayoutOption>()); if (Plugin.TeamMode.Value) { DrawTeams(); } GUILayout.Space(10f); GUILayout.Label("— Maç —", Array.Empty<GUILayoutOption>()); Plugin.DisableEnemies.Value = GUILayout.Toggle(Plugin.DisableEnemies.Value, " Canavarları kapat", Array.Empty<GUILayoutOption>()); Plugin.DisableTraps.Value = GUILayout.Toggle(Plugin.DisableTraps.Value, " Tuzakları kapat (taret, mayın...)", Array.Empty<GUILayoutOption>()); Plugin.AutoLeaveOnWin.Value = GUILayout.Toggle(Plugin.AutoLeaveOnWin.Value, " Tek kişi kalınca gemi otomatik kalksın", Array.Empty<GUILayoutOption>()); GUILayout.EndScrollView(); int num2 = instance.allPlayerScripts.Count((PlayerControllerB p) => (Object)(object)p != (Object)null && p.isPlayerControlled); GUILayout.Label($"Bağlı oyuncu: {num2}", Array.Empty<GUILayoutOption>()); if (instance.inShipPhase) { GUI.enabled = !starting && !instance.travellingToNewLevel; if (GUILayout.Button(starting ? "Başlatılıyor..." : "MAÇI BAŞLAT", bigButton, Array.Empty<GUILayoutOption>())) { StartMatch(); } GUI.enabled = true; } else { GUILayout.Label("Maç devam ediyor.", Array.Empty<GUILayoutOption>()); GUI.enabled = instance.shipHasLanded && !instance.shipIsLeaving; if (GUILayout.Button("Maçı bitir (gemi kalksın)", bigButton, Array.Empty<GUILayoutOption>())) { SetMenu(open: false); ForceShipLeave(); } GUI.enabled = true; } if (GUILayout.Button($"Kapat ({Plugin.MenuKey.Value})", Array.Empty<GUILayoutOption>())) { SetMenu(open: false); } GUI.DragWindow(); } } public struct MatchSettings { public float FireRate; public int Damage; public bool InfiniteAmmo; public int MagazineSize; public float ReloadTime; public bool TeamMode; public static MatchSettings FromConfig() { return new MatchSettings { TeamMode = Plugin.TeamMode.Value, FireRate = Mathf.Clamp(Plugin.FireRate.Value, 1f, 20f), Damage = Mathf.Clamp(Plugin.Damage.Value, 1, 100), InfiniteAmmo = Plugin.InfiniteAmmo.Value, MagazineSize = Mathf.Clamp(Plugin.MagazineSize.Value, 1, 200), ReloadTime = Mathf.Clamp(Plugin.ReloadTime.Value, 0.2f, 10f) }; } } public struct SpawnEntry { public int PlayerIndex; public Vector3 Position; public ulong[] GrabIds; public ulong MineToolId; public int Team; } public struct MineInfo { public int OwnerIndex; public int Team; } internal static class Net { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnStart; public static HandleNamedMessageDelegate <1>__OnSpawn; public static HandleNamedMessageDelegate <2>__OnResult; public static HandleNamedMessageDelegate <3>__OnPlaceMine; public static HandleNamedMessageDelegate <4>__OnMineCount; } private const string MsgStart = "ManorPvP_Start"; private const string MsgSpawn = "ManorPvP_Spawn"; private const string MsgResult = "ManorPvP_Result"; private const string MsgPlaceMine = "ManorPvP_PlaceMine"; private const string MsgMineCount = "ManorPvP_MineCount"; private static readonly string[] AllMessages = new string[5] { "ManorPvP_Start", "ManorPvP_Spawn", "ManorPvP_Result", "ManorPvP_PlaceMine", "ManorPvP_MineCount" }; private static bool registered; public static void Register() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0090: 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_009b: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.CustomMessagingManager != null && !registered) { CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; object obj = <>O.<0>__OnStart; if (obj == null) { HandleNamedMessageDelegate val = OnStart; <>O.<0>__OnStart = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("ManorPvP_Start", (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnSpawn; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnSpawn; <>O.<1>__OnSpawn = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("ManorPvP_Spawn", (HandleNamedMessageDelegate)obj2); CustomMessagingManager customMessagingManager3 = singleton.CustomMessagingManager; object obj3 = <>O.<2>__OnResult; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnResult; <>O.<2>__OnResult = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler("ManorPvP_Result", (HandleNamedMessageDelegate)obj3); CustomMessagingManager customMessagingManager4 = singleton.CustomMessagingManager; object obj4 = <>O.<3>__OnPlaceMine; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnPlaceMine; <>O.<3>__OnPlaceMine = val4; obj4 = (object)val4; } customMessagingManager4.RegisterNamedMessageHandler("ManorPvP_PlaceMine", (HandleNamedMessageDelegate)obj4); CustomMessagingManager customMessagingManager5 = singleton.CustomMessagingManager; object obj5 = <>O.<4>__OnMineCount; if (obj5 == null) { HandleNamedMessageDelegate val5 = OnMineCount; <>O.<4>__OnMineCount = val5; obj5 = (object)val5; } customMessagingManager5.RegisterNamedMessageHandler("ManorPvP_MineCount", (HandleNamedMessageDelegate)obj5); registered = true; } } public static void Unregister() { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton != (Object)null && singleton.CustomMessagingManager != null && registered) { string[] allMessages = AllMessages; foreach (string text in allMessages) { singleton.CustomMessagingManager.UnregisterNamedMessageHandler(text); } } registered = false; } private static IReadOnlyList<ulong> OtherClients() { return NetworkManager.Singleton.ConnectedClientsIds.Where((ulong id) => id != 0).ToList(); } private static void SendToOthers(string name, FastBufferWriter writer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) IReadOnlyList<ulong> readOnlyList = OtherClients(); if (readOnlyList.Count > 0) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(name, readOnlyList, writer, (NetworkDelivery)4); } } public unsafe static void BroadcastStart(MatchSettings s) { //IL_0016: 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_002d: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0072: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter writer = default(FastBufferWriter); ((FastBufferWriter)(ref writer))..ctor(64, (Allocator)2, -1); try { ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref s.FireRate, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref s.Damage, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref s.InfiniteAmmo, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref s.MagazineSize, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<float>(ref s.ReloadTime, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<bool>(ref s.TeamMode, default(ForPrimitives)); SendToOthers("ManorPvP_Start", writer); } finally { ((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose(); } ManorPvPManager.Instance.OnMatchStart(s); } public unsafe static void BroadcastSpawns(List<SpawnEntry> entries) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_006d: 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_0084: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter writer = default(FastBufferWriter); ((FastBufferWriter)(ref writer))..ctor(256, (Allocator)2, 65536); try { int count = entries.Count; ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref count, default(ForPrimitives)); foreach (SpawnEntry entry in entries) { SpawnEntry current = entry; ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref current.PlayerIndex, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe(ref current.Position); ((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(current.GrabIds, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(ref current.MineToolId, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref current.Team, default(ForPrimitives)); } SendToOthers("ManorPvP_Spawn", writer); } finally { ((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose(); } ManorPvPManager.Instance.OnSpawns(entries); } public unsafe static void BroadcastResult(string text) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter writer = default(FastBufferWriter); ((FastBufferWriter)(ref writer))..ctor(1024, (Allocator)2, -1); try { ((FastBufferWriter)(ref writer)).WriteValueSafe(text, false); SendToOthers("ManorPvP_Result", writer); } finally { ((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose(); } ManorPvPManager.Instance.OnResult(text); } public unsafe static void BroadcastMinePlaced(ulong toolId, int remaining, ulong mineId, MineInfo info) { //IL_0011: 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_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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter writer = default(FastBufferWriter); ((FastBufferWriter)(ref writer))..ctor(40, (Allocator)2, -1); try { ((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(ref toolId, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref remaining, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<ulong>(ref mineId, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref info.OwnerIndex, default(ForPrimitives)); ((FastBufferWriter)(ref writer)).WriteValueSafe<int>(ref info.Team, default(ForPrimitives)); SendToOthers("ManorPvP_MineCount", writer); } finally { ((IDisposable)(*(FastBufferWriter*)(&writer))/*cast due to .constrained prefix*/).Dispose(); } ManorPvPManager.Instance.OnMinePlaced(toolId, remaining, mineId, info); } public unsafe static void RequestPlaceMine(ulong toolId, Vector3 pos, float yaw) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (singleton.IsServer) { ManorPvPManager.Instance.HostPlaceMine(0uL, toolId, pos, yaw); return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(32, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref toolId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref yaw, default(ForPrimitives)); singleton.CustomMessagingManager.SendNamedMessage("ManorPvP_PlaceMine", 0uL, val, (NetworkDelivery)2); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void OnPlaceMine(ulong sender, FastBufferReader r) { //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_002e: 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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { ulong toolId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref toolId, default(ForPrimitives)); Vector3 pos = default(Vector3); ((FastBufferReader)(ref r)).ReadValueSafe(ref pos); float yaw = default(float); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref yaw, default(ForPrimitives)); ManorPvPManager.Instance.HostPlaceMine(sender, toolId, pos, yaw); } } private static void OnMineCount(ulong sender, FastBufferReader r) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006e: Unknown result type (might be due to invalid IL or missing references) if (sender == 0L) { ulong toolId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref toolId, default(ForPrimitives)); int remaining = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref remaining, default(ForPrimitives)); ulong mineId = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref mineId, default(ForPrimitives)); MineInfo info = default(MineInfo); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref info.OwnerIndex, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref info.Team, default(ForPrimitives)); ManorPvPManager.Instance.OnMinePlaced(toolId, remaining, mineId, info); } } private static void OnStart(ulong sender, FastBufferReader r) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (sender == 0L) { MatchSettings s = default(MatchSettings); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref s.FireRate, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref s.Damage, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref s.InfiniteAmmo, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref s.MagazineSize, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<float>(ref s.ReloadTime, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref s.TeamMode, default(ForPrimitives)); ManorPvPManager.Instance.OnMatchStart(s); } } private static void OnSpawn(ulong sender, FastBufferReader r) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_005f: 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_0076: 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_008d: Unknown result type (might be due to invalid IL or missing references) if (sender == 0L) { int num = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref num, default(ForPrimitives)); List<SpawnEntry> list = new List<SpawnEntry>(num); for (int i = 0; i < num; i++) { SpawnEntry item = default(SpawnEntry); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref item.PlayerIndex, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe(ref item.Position); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref item.GrabIds, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref item.MineToolId, default(ForPrimitives)); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref item.Team, default(ForPrimitives)); list.Add(item); } ManorPvPManager.Instance.OnSpawns(list); } } private static void OnResult(ulong sender, FastBufferReader r) { if (sender == 0L) { string text = default(string); ((FastBufferReader)(ref r)).ReadValueSafe(ref text, false); ManorPvPManager.Instance.OnResult(text); } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start() { Net.Register(); ManorPvPManager.Instance.ResetAll(); } [HarmonyPatch("OnDestroy")] [HarmonyPostfix] private static void OnDestroy() { Net.Unregister(); ManorPvPManager.Instance.ResetAll(); } } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] internal static class ForceManorPatch { private static void Prefix(RoundManager __instance, out IntWithRarity[] __state) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown __state = null; if (!Plugin.Enabled.Value || (Object)(object)__instance.currentLevel == (Object)null) { return; } int num = -1; for (int i = 0; i < __instance.dungeonFlowTypes.Length; i++) { DungeonFlow val = __instance.dungeonFlowTypes[i]?.dungeonFlow; if ((Object)(object)val != (Object)null && (((Object)val).name.Contains("Level2") || ((Object)val).name.ToLower().Contains("manor"))) { num = i; break; } } if (num < 0) { Plugin.Log.LogWarning((object)"Malikane haritası bulunamadı, normal harita kullanılıyor."); return; } __state = __instance.currentLevel.dungeonFlowTypes; LevelAmbienceLibrary val2 = null; if (__state != null) { IntWithRarity[] array = __state; foreach (IntWithRarity val3 in array) { if (val3 != null && val3.id == num) { val2 = val3.overrideLevelAmbience; } } } __instance.currentLevel.dungeonFlowTypes = (IntWithRarity[])(object)new IntWithRarity[1] { new IntWithRarity(num, 100, val2) }; } private static void Postfix(RoundManager __instance, IntWithRarity[] __state) { if (__state != null) { __instance.currentLevel.dungeonFlowTypes = __state; } } } [HarmonyPatch(typeof(StartMatchLever), "LeverAnimation")] internal static class BlockLeverPatch { private static bool Prefix() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.Enabled.Value) { return true; } HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip("Manor PvP", $"Gemi koldan kullanılamaz. Host oyunu {Plugin.MenuKey.Value} menüsünden başlatır.", true, false, "LC_Tip1"); } return false; } } [HarmonyPatch(typeof(RoundManager))] internal static class SpawnPatches { private static bool NoEnemies { get { if (Plugin.Enabled.Value) { return Plugin.DisableEnemies.Value; } return false; } } [HarmonyPatch("AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static bool AdvanceHour(RoundManager __instance) { if (!NoEnemies) { return true; } __instance.currentHour += __instance.hourTimeBetweenEnemySpawnBatches; return false; } [HarmonyPatch("SpawnEnemiesOutside")] [HarmonyPrefix] private static bool Outside() { return !NoEnemies; } [HarmonyPatch("SpawnDaytimeEnemiesOutside")] [HarmonyPrefix] private static bool Daytime() { return !NoEnemies; } [HarmonyPatch("SpawnMapObjects")] [HarmonyPrefix] private static bool MapObjects() { if (Plugin.Enabled.Value) { return !Plugin.DisableTraps.Value; } return true; } } [HarmonyPatch(typeof(ShotgunItem))] internal static class ShotgunPatches { internal static PlayerControllerB CurrentShooter; [HarmonyPatch("ItemActivate")] [HarmonyPrefix] private static bool ItemActivate() { return !ManorPvPManager.MatchActive; } [HarmonyPatch("Update")] [HarmonyPrefix] private static void Update(ShotgunItem __instance) { if (ManorPvPManager.MatchActive) { __instance.misfireTimer = 999f; __instance.hasHitGroundWithSafetyOff = true; } } [HarmonyPatch("ShootGun")] [HarmonyPrefix] private static bool ShootGun(ShotgunItem __instance) { CurrentShooter = null; if (!ManorPvPManager.MatchActive) { return true; } if (ManorPvPManager.Instance.ConsumeEcho(__instance)) { return false; } CurrentShooter = ((GrabbableObject)__instance).playerHeldBy; return true; } [HarmonyPatch("ShootGun")] [HarmonyPostfix] private static void ShootGunEnd() { CurrentShooter = null; } } [HarmonyPatch(typeof(Landmine))] internal static class LandminePatches { internal static Landmine CurrentMine; private static bool IgnoresLocal(Landmine mine, Collider other) { if (!((Component)other).CompareTag("Player")) { return false; } PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && (Object)(object)component == (Object)(object)GameNetworkManager.Instance.localPlayerController) { return ManorPvPManager.Instance.MineIgnores(mine, component); } return false; } [HarmonyPatch("OnTriggerEnter")] [HarmonyPrefix] private static bool Enter(Landmine __instance, Collider other) { return !IgnoresLocal(__instance, other); } [HarmonyPatch("OnTriggerExit")] [HarmonyPrefix] private static bool Exit(Landmine __instance, Collider other) { return !IgnoresLocal(__instance, other); } [HarmonyPatch("Detonate")] [HarmonyPrefix] private static void DetonateStart(Landmine __instance) { CurrentMine = __instance; } [HarmonyPatch("Detonate")] [HarmonyPostfix] private static void DetonateEnd() { CurrentMine = null; } } [HarmonyPatch(typeof(RemoteProp), "ItemActivate")] internal static class RemoteActivatePatch { private static bool Prefix(RemoteProp __instance, bool buttonDown) { if (!ManorPvPManager.MatchActive || !ManorPvPManager.Instance.IsMineTool((GrabbableObject)(object)__instance)) { return true; } if (((NetworkBehaviour)__instance).IsOwner && buttonDown) { ManorPvPManager.Instance.TryPlaceMine((GrabbableObject)(object)__instance); } return false; } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class DamagePatches { private static bool FriendlyHit(PlayerControllerB victim) { if (!ManorPvPManager.MatchActive) { return false; } ManorPvPManager instance = ManorPvPManager.Instance; if ((Object)(object)ShotgunPatches.CurrentShooter != (Object)null && instance.AreTeammates(ShotgunPatches.CurrentShooter, victim)) { return true; } if ((Object)(object)LandminePatches.CurrentMine != (Object)null && instance.MineIgnores(LandminePatches.CurrentMine, victim)) { return true; } return false; } [HarmonyPatch("DamagePlayer")] [HarmonyPrefix] private static bool Damage(PlayerControllerB __instance, ref int damageNumber, CauseOfDeath causeOfDeath) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 if (FriendlyHit(__instance)) { return false; } if (ManorPvPManager.MatchActive && (int)causeOfDeath == 7 && damageNumber > 0) { damageNumber = ManorPvPManager.Settings.Damage; } return true; } [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static bool Kill(PlayerControllerB __instance) { return !FriendlyHit(__instance); } } [BepInPlugin("atilla.ManorPvP", "Manor PvP", "1.3.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "atilla.ManorPvP"; public const string Name = "Manor PvP"; public const string Version = "1.3.0"; internal static ManualLogSource Log; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<string> MoonName; internal static ConfigEntry<bool> GiveGun; internal static ConfigEntry<float> FireRate; internal static ConfigEntry<int> Damage; internal static ConfigEntry<bool> InfiniteAmmo; internal static ConfigEntry<int> MagazineSize; internal static ConfigEntry<float> ReloadTime; internal static ConfigEntry<int> KeyCount; internal static ConfigEntry<bool> GiveMineTool; internal static ConfigEntry<bool> TeamMode; internal static ConfigEntry<int> TeamCount; internal static ConfigEntry<bool> TeamsSpawnTogether; internal static ConfigEntry<bool> DisableEnemies; internal static ConfigEntry<bool> DisableTraps; internal static ConfigEntry<bool> AutoLeaveOnWin; internal static ConfigEntry<Key> MenuKey; internal static ConfigFile Cfg; private void Awake() { //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Cfg = ((BaseUnityPlugin)this).Config; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "ModAktif", true, "Mod açık mı (kapalıysa oyun normal oynanır)"); MenuKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Genel", "MenuTusu", (Key)101, "Menüyü açıp kapatan tuş"); MoonName = ((BaseUnityPlugin)this).Config.Bind<string>("Mac", "Ay", "Rend", "Maçın oynanacağı ay (iç harita her zaman malikane)"); DisableEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("Mac", "CanavarlariKapat", true, "Canavarlar doğmasın"); DisableTraps = ((BaseUnityPlugin)this).Config.Bind<bool>("Mac", "TuzaklariKapat", true, "Taret / mayın / tuzak doğmasın"); AutoLeaveOnWin = ((BaseUnityPlugin)this).Config.Bind<bool>("Mac", "KazanincaGemiKalksin", true, "Tek kişi kalınca gemi otomatik kalksın"); GiveGun = ((BaseUnityPlugin)this).Config.Bind<bool>("Silah", "SilahVer", true, "Herkesin eline otomatik silah verilsin"); FireRate = ((BaseUnityPlugin)this).Config.Bind<float>("Silah", "AtesHizi", 6f, "Saniyede atış sayısı"); Damage = ((BaseUnityPlugin)this).Config.Bind<int>("Silah", "Hasar", 20, "Mermi başına hasar (oyuncu canı 100)"); InfiniteAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("Silah", "SinirsizMermi", false, "Sınırsız mermi"); MagazineSize = ((BaseUnityPlugin)this).Config.Bind<int>("Silah", "SarjorBoyutu", 30, "Şarjördeki mermi sayısı"); ReloadTime = ((BaseUnityPlugin)this).Config.Bind<float>("Silah", "SarjorDegistirmeSuresi", 2.5f, "Şarjör değiştirme süresi (saniye)"); KeyCount = ((BaseUnityPlugin)this).Config.Bind<int>("Esya", "AnahtarSayisi", 1, "Her oyuncuya verilecek anahtar sayısı (0-2)"); GiveMineTool = ((BaseUnityPlugin)this).Config.Bind<bool>("Esya", "MayinKoyucuVer", true, "Herkese mayın koyucu (kumanda) verilsin, her kumanda 1 mayın koyar"); TeamMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Takim", "TakimModu", false, "Takımlı oyun (takım arkadaşları birbirine hasar vermez)"); TeamCount = ((BaseUnityPlugin)this).Config.Bind<int>("Takim", "TakimSayisi", 2, "Takım sayısı (2-4)"); TeamsSpawnTogether = ((BaseUnityPlugin)this).Config.Bind<bool>("Takim", "TakimlarBeraberDogsun", true, "Takım arkadaşları yan yana doğsun, takımlar birbirinden uzak"); ((BaseUnityPlugin)this).Config.Save(); new Harmony("atilla.ManorPvP").PatchAll(typeof(Plugin).Assembly); GameObject val = new GameObject("ManorPvP_Manager"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<ManorPvPManager>(); Log.LogInfo((object)"Manor PvP 1.3.0 yüklendi"); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }