public static bool Prefix(MapCountOverlay __instance) { var localPlayer = PlayerControl.LocalPlayer; if (!localPlayer.Is(RoleEnum.Spy)) { return(true); } __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; var sabotaged = PlayerTask.PlayerHasTaskOfType <IHudOverrideTask>(localPlayer); if (sabotaged != __instance.isSab) { SetSabotaged(__instance, sabotaged); } if (!sabotaged) { UpdateBlips(__instance); } return(false); }
public static void Postfix(MapCountOverlay __instance) { if (adminBool) { __instance.BackgroundColor.SetColor(Palette.DisabledGrey); } }
public AdminGenerator(Minimap map) { countObj = map.prefab.transform.FindChild("CountOverlay").gameObject; count = countObj.GetComponent <MapCountOverlay>(); count.CountAreas = new UnhollowerBaseLib.Il2CppReferenceArray <CounterArea>(0); AssetHelper.ClearChildren(countObj.transform); }
public static void SetSabotaged(MapCountOverlay __instance, bool sabotaged) { __instance.isSab = sabotaged; __instance.BackgroundColor.SetColor(sabotaged ? Palette.DisabledGrey : Color.green); __instance.SabotageText.gameObject.SetActive(sabotaged); if (sabotaged) { foreach (var area in __instance.CountAreas) { area.UpdateCount(0); } } }
public static bool Prefix(MapCountOverlay __instance) { //Delay before display (Among Us code) __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } //Toggle ON/OFF depending on minPlayerVitals parameter if (!__instance.isSab && adminBool) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); } return(!adminBool); }
public static void UpdateBlips(MapCountOverlay __instance) { var rooms = ShipStatus.Instance.FastRooms; foreach (var area in __instance.CountAreas) { if (!rooms.ContainsKey(area.RoomType)) { continue; } var room = rooms[area.RoomType]; if (room.roomArea == null) { continue; } var objectsInRoom = room.roomArea.OverlapCollider(__instance.filter, __instance.buffer); var colorMap = new List <int>(); for (var i = 0; i < objectsInRoom; i++) { var collider = __instance.buffer[i]; if (collider.tag == "DeadBody") { var playerId = collider.GetComponent <DeadBody>().ParentId; colorMap.Add(GameData.Instance.GetPlayerById(playerId).ColorId); continue; } var player = collider.GetComponent <PlayerControl>(); var data = player?.Data; if (data != null && !data.Disconnected && !data.IsDead) { colorMap.Add(data.ColorId); } } UpdateBlips(area, colorMap); } }
static bool Prefix(MapCountOverlay __instance) { // Save colors for the Hacker __instance.HAHFHCCIEGH += Time.deltaTime; if (__instance.HAHFHCCIEGH < 0.1f) { return(false); } __instance.HAHFHCCIEGH = 0f; players = new Dictionary <SystemTypes, List <Color> >(); bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.KGMLJDGMIND && commsActive) { __instance.KGMLJDGMIND = true; __instance.BackgroundColor.SetColor(Palette.JMELLHINKGM); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.KGMLJDGMIND && !commsActive) { __instance.KGMLJDGMIND = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); players.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.EMIBABGLHIO[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.CGAANOHJEKD, __instance.BLDONECDJFJ); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.BLDONECDJFJ[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.IDOFAMCIJKE == null || component.IDOFAMCIJKE.GBPMEHJFECK || component.IDOFAMCIJKE.FGNJJFABIHJ) { num2--; } else if (component?.LNMJKMLHMIM?.material != null) { Color color = component.LNMJKMLHMIM.material.GetColor("_BodyColor"); if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.CALCLMEEPGL.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.CALCLMEEPGL[7] : Palette.CALCLMEEPGL[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.OFKOJOKOOAK OFKOJOKOOAK = GameData.Instance.GetPlayerById(component.ParentId); if (OFKOJOKOOAK != null) { var color = Palette.CALCLMEEPGL[OFKOJOKOOAK.JFHFMIKFHGG]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(OFKOJOKOOAK.JFHFMIKFHGG) ? Palette.CALCLMEEPGL[7] : Palette.CALCLMEEPGL[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static bool Prefix(MapCountOverlay __instance) { adminTimer += Time.deltaTime; if (adminTimer > 0.1f) { UseAdminTime(); } // Save colors for the Hacker __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; playerColors = new Dictionary <SystemTypes, List <Color> >(); if (MapOptions.restrictDevices > 0 && MapOptions.restrictAdmin) { if (OutOfTime == null) { OutOfTime = UnityEngine.Object.Instantiate(__instance.SabotageText, __instance.SabotageText.transform.parent); OutOfTime.text = ModTranslation.getString("restrictOutOfTime"); } if (TimeRemaining == null) { TimeRemaining = UnityEngine.Object.Instantiate(HudManager.Instance.TaskText, __instance.transform); TimeRemaining.alignment = TMPro.TextAlignmentOptions.BottomRight; TimeRemaining.transform.position = Vector3.zero; TimeRemaining.transform.localPosition = new Vector3(3.25f, 5.25f); TimeRemaining.transform.localScale *= 2f; TimeRemaining.color = Palette.White; } if (PlayerControl.LocalPlayer.isRole(RoleType.EvilHacker) || PlayerControl.LocalPlayer.isRole(RoleType.MimicA)) { TimeRemaining.gameObject.SetActive(false); } else { if (MapOptions.restrictAdminTime <= 0f) { __instance.BackgroundColor.SetColor(Palette.DisabledGrey); OutOfTime.gameObject.SetActive(true); TimeRemaining.gameObject.SetActive(false); if (clearedIcons == false) { foreach (CounterArea ca in __instance.CountAreas) { ca.UpdateCount(0); } clearedIcons = true; } return(false); } clearedIcons = false; OutOfTime.gameObject.SetActive(false); string timeString = TimeSpan.FromSeconds(MapOptions.restrictAdminTime).ToString(@"mm\:ss\.ff"); TimeRemaining.text = String.Format(ModTranslation.getString("timeRemaining"), timeString); //TimeRemaining.color = MapOptions.restrictAdminTime > 10f ? Palette.AcceptedGreen : Palette.ImpostorRed; TimeRemaining.gameObject.SetActive(true); } } bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.isSab && commsActive) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); OutOfTime.gameObject.SetActive(false); return(false); } if (__instance.isSab && !commsActive) { __instance.isSab = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); OutOfTime.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); playerColors.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.FastRooms[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.filter, __instance.buffer); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.buffer[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead) { num2--; } else if (component.isRole(RoleType.Puppeteer) && Puppeteer.stealthed) { num2--; } else if (component == Puppeteer.dummy && !Puppeteer.stealthed) { num2--; } else if (component?.MyRend?.material != null) { // Color color = component.myRend.material.GetColor("_BodyColor"); Color color = Palette.PlayerColors[component.Data.DefaultOutfit.ColorId]; if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.PlayerColors.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.PlayerInfo playerInfo = GameData.Instance.GetPlayerById(component.ParentId); if (playerInfo != null) { var color = Palette.PlayerColors[playerInfo.Object.CurrentOutfit.ColorId]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(playerInfo.Object.CurrentOutfit.ColorId) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static void Prefix(MapCountOverlay __instance) { UseAdminTime(); }
static void Prefix(MapCountOverlay __instance) { adminTimer = 0f; }
public static bool Prefix(MapCountOverlay __instance) { if (!PlayerControl.LocalPlayer.Is(RoleEnum.Spy)) { return(true); } __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; AllRooms = new Dictionary <SystemTypes, List <int> >(); var task = PlayerControl.LocalPlayer.myTasks.ToArray() .FirstOrDefault(x => x.TaskType == TaskTypes.FixComms); var flag = task != null; if (!__instance.isSab && flag) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.isSab && !flag) { __instance.isSab = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; var colourList = new List <int>(); AllRooms.Add(counterArea.RoomType, colourList); if (!PlayerTask.PlayerHasTaskOfType <HudOverrideTask>(PlayerControl.LocalPlayer)) { PlainShipRoom plainShipRoom; if (ShipStatus.Instance.FastRooms.ContainsKey(counterArea.RoomType)) { plainShipRoom = ShipStatus.Instance.FastRooms[counterArea.RoomType]; if (!plainShipRoom.roomArea) { continue; } int num = plainShipRoom.roomArea.OverlapCollider(__instance.filter, __instance.buffer); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.buffer[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead) { num2--; } else { colourList.Add(component.Data.ColorId); } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static bool Prefix(MapCountOverlay __instance) { // Save colors for the Hacker __instance.timer += Time.deltaTime; if (__instance.timer < 0.1f) { return(false); } __instance.timer = 0f; players = new Dictionary <SystemTypes, List <Color> >(); bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.isSab && commsActive) { __instance.isSab = true; __instance.BackgroundColor.SetColor(Palette.DisabledGrey); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.isSab && !commsActive) { __instance.isSab = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); players.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.FastRooms[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.filter, __instance.buffer); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.buffer[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead) { num2--; } else if (component?.myRend?.material != null) { Color color = component.myRend.material.GetColor("_BodyColor"); if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.PlayerColors.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.PlayerInfo playerInfo = GameData.Instance.GetPlayerById(component.ParentId); if (playerInfo != null) { var color = Palette.PlayerColors[playerInfo.ColorId]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(playerInfo.ColorId) ? Palette.PlayerColors[7] : Palette.PlayerColors[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }
static bool Prefix(MapCountOverlay __instance) { // Save colors for the Hacker __instance.PPKFBIONLAL += Time.deltaTime; if (__instance.PPKFBIONLAL < 0.1f) { return(false); } __instance.PPKFBIONLAL = 0f; players = new Dictionary <SystemTypes, List <Color> >(); bool commsActive = false; foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks) { if (task.TaskType == TaskTypes.FixComms) { commsActive = true; } } if (!__instance.PIMGCOPFDBG && commsActive) { __instance.PIMGCOPFDBG = true; __instance.BackgroundColor.SetColor(Palette.EGHCBLDNCGP); __instance.SabotageText.gameObject.SetActive(true); return(false); } if (__instance.PIMGCOPFDBG && !commsActive) { __instance.PIMGCOPFDBG = false; __instance.BackgroundColor.SetColor(Color.green); __instance.SabotageText.gameObject.SetActive(false); } for (int i = 0; i < __instance.CountAreas.Length; i++) { CounterArea counterArea = __instance.CountAreas[i]; List <Color> roomColors = new List <Color>(); players.Add(counterArea.RoomType, roomColors); if (!commsActive) { PlainShipRoom plainShipRoom = ShipStatus.Instance.DFAAPCDKCCO[counterArea.RoomType]; if (plainShipRoom != null && plainShipRoom.roomArea) { int num = plainShipRoom.roomArea.OverlapCollider(__instance.CMCPAKBKLDP, __instance.HMNBGCJAGLM); int num2 = num; for (int j = 0; j < num; j++) { Collider2D collider2D = __instance.HMNBGCJAGLM[j]; if (!(collider2D.tag == "DeadBody")) { PlayerControl component = collider2D.GetComponent <PlayerControl>(); if (!component || component.PPMOEEPBHJO == null || component.PPMOEEPBHJO.MFFAGDHDHLO || component.PPMOEEPBHJO.IAGJEKLJCCI) { num2--; } else if (component?.KJAENOGGEOK?.material != null) { Color color = component.KJAENOGGEOK.material.GetColor("_BodyColor"); if (Hacker.onlyColorType) { var id = Mathf.Max(0, Palette.AEDCMKGJKAG.IndexOf(color)); color = Helpers.isLighterColor((byte)id) ? Palette.AEDCMKGJKAG[7] : Palette.AEDCMKGJKAG[6]; } roomColors.Add(color); } } else { DeadBody component = collider2D.GetComponent <DeadBody>(); if (component) { GameData.LGBOMGHJELL LGBOMGHJELL = GameData.Instance.GetPlayerById(component.ParentId); if (LGBOMGHJELL != null) { var color = Palette.AEDCMKGJKAG[LGBOMGHJELL.IMMNCAGJJJC]; if (Hacker.onlyColorType) { color = Helpers.isLighterColor(LGBOMGHJELL.IMMNCAGJJJC) ? Palette.AEDCMKGJKAG[7] : Palette.AEDCMKGJKAG[6]; } roomColors.Add(color); } } } } counterArea.UpdateCount(num2); } else { Debug.LogWarning("Couldn't find counter for:" + counterArea.RoomType); } } else { counterArea.UpdateCount(0); } } return(false); }