mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Support & Fix Secondary Ability Button role color text (#394)
* Update IntroPatch.cs * Update HudPatch.cs * Update PlayerControlPatch.cs * Update Main.cs * Update CustomRolesHelper.cs * Update ExtendedPlayerControl.cs * Update HudSpritePatch.cs * Update CopyCat.cs * Update Visionary.cs
This commit is contained in:
1 parent
cbe990e64d
commit
68ca57fd75
9 files changed
+53
-28
No files matched your search
@@ -747,11 +747,11 @@ public class Main : BasePlugin
|
||||
{ CustomRoles.Mare, "#ff1919" },
|
||||
{ CustomRoles.Underdog, "#ff1919" },
|
||||
|
||||
// SoloPVP
|
||||
// Solo PVP
|
||||
{ CustomRoles.KB_Normal, "#f55252" },
|
||||
// FFA
|
||||
{ CustomRoles.Killer, "#00ffff" },
|
||||
// Move And Stop
|
||||
// Stop And Go
|
||||
{ CustomRoles.Tasker, "#00ffa5" },
|
||||
// Hot Potato
|
||||
{ CustomRoles.Potato, "#e8cd46" },
|
||||
@@ -1198,3 +1198,4 @@ public enum TieMode
|
||||
|
||||
|
||||
public class Coroutines : MonoBehaviour { }
|
||||
|
||||
@@ -404,7 +404,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Agent => CustomRoles.Impostor,
|
||||
CustomRoles.Taskinator => CustomRoles.Crewmate,
|
||||
|
||||
// Move And Stop
|
||||
// Stop And Go
|
||||
CustomRoles.Tasker => CustomRoles.Crewmate,
|
||||
// Hot Potato
|
||||
CustomRoles.Potato => CustomRoles.Crewmate,
|
||||
@@ -458,7 +458,7 @@ internal static class CustomRolesHelper
|
||||
|
||||
return role switch
|
||||
{
|
||||
// SoloPVP
|
||||
// Solo PVP
|
||||
CustomRoles.KB_Normal => RoleTypes.Impostor,
|
||||
// FFA
|
||||
CustomRoles.Killer => RoleTypes.Impostor,
|
||||
@@ -2008,3 +2008,4 @@ public enum CountTypes
|
||||
|
||||
Coven
|
||||
}
|
||||
|
||||
@@ -1421,11 +1421,11 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
return pc.GetCustomRole() switch
|
||||
{
|
||||
// SoloPVP
|
||||
// Solo PVP
|
||||
CustomRoles.KB_Normal => pc.SoloAlive(),
|
||||
// FFA
|
||||
CustomRoles.Killer => pc.IsAlive(),
|
||||
// Move And Stop
|
||||
// Stop And Go
|
||||
CustomRoles.Tasker => false,
|
||||
// Hot Potato
|
||||
CustomRoles.Potato => HotPotato.CanPassViaKillButton && HotPotato.GetState().HolderID == pc.PlayerId,
|
||||
@@ -2267,4 +2267,5 @@ internal static class ExtendedPlayerControl
|
||||
if (pc.IsModdedClient() || pc.IsTrusted() || pc.FriendCode.GetDevUser().HasTag()) return false;
|
||||
return !Main.GamesPlayed.TryGetValue(pc.FriendCode, out int gamesPlayed) || gamesPlayed < 4;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -13,7 +13,6 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
|
||||
|
||||
namespace EHR.Patches;
|
||||
|
||||
//[HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))]
|
||||
@@ -1170,7 +1169,7 @@ internal static class TaskPanelBehaviourPatch
|
||||
if (Options.CurrentGameMode is CustomGameMode.Standard or CustomGameMode.StopAndGo or CustomGameMode.HideAndSeek or CustomGameMode.Speedrun)
|
||||
{
|
||||
var tabText = __instance.tab.transform.FindChild("TabText_TMP").GetComponent<TextMeshPro>();
|
||||
bool fakeTasks = Options.CurrentGameMode == CustomGameMode.Standard && !Utils.HasTasks(PlayerControl.LocalPlayer.Data, forRecompute: false);
|
||||
bool fakeTasks = Options.CurrentGameMode is CustomGameMode.Standard or CustomGameMode.HideAndSeek && !Utils.HasTasks(PlayerControl.LocalPlayer.Data, forRecompute: false);
|
||||
string sideText = TranslationController.Instance.GetString(fakeTasks ? StringNames.FakeTasks : StringNames.Tasks);
|
||||
if (fakeTasks) sideText = Utils.ColorString(Utils.GetRoleColor(CustomRoles.ImpostorEHR), sideText.TrimEnd(':'));
|
||||
tabText.SetText($"{sideText}{Utils.GetTaskCount(PlayerControl.LocalPlayer.PlayerId, Utils.IsActive(SystemTypes.Comms))}");
|
||||
@@ -1309,4 +1308,5 @@ internal static class RepairSender
|
||||
{
|
||||
return SystemType + "(" + (SystemTypes)SystemType + ")\r\n" + Amount;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public static class HudSpritePatch
|
||||
Sprite newSabotageButton = DefaultIcons[3];
|
||||
Sprite newPetButton = DefaultIcons[4];
|
||||
Sprite newReportButton = DefaultIcons[5];
|
||||
Sprite newSecondaryAbilityButton = DefaultIcons[6];
|
||||
|
||||
bool usesPetInsteadOfKill = player.UsesPetInsteadOfKill();
|
||||
bool shapeshifting = player.IsShifted();
|
||||
@@ -477,7 +478,8 @@ public static class HudSpritePatch
|
||||
__instance.ImpostorVentButton.graphic,
|
||||
__instance.SabotageButton.graphic,
|
||||
__instance.PetButton.graphic,
|
||||
__instance.ReportButton.graphic
|
||||
__instance.ReportButton.graphic,
|
||||
__instance.SecondaryAbilityButton.graphic
|
||||
}.Do(x => x.SetCooldownNormalizedUvs());
|
||||
|
||||
ForceUpdate = false;
|
||||
@@ -486,7 +488,7 @@ public static class HudSpritePatch
|
||||
{
|
||||
var roleColor = Utils.GetRoleColor(player.GetCustomRole());
|
||||
|
||||
foreach (var button in new ActionButton[] { __instance.KillButton, __instance.AbilityButton, __instance.ImpostorVentButton, __instance.SabotageButton, __instance.PetButton, __instance.ReportButton })
|
||||
foreach (var button in new ActionButton[] { __instance.KillButton, __instance.AbilityButton, __instance.ImpostorVentButton, __instance.SabotageButton, __instance.PetButton, __instance.ReportButton, __instance.SecondaryAbilityButton })
|
||||
button.buttonLabelText.SetOutlineColor(roleColor);
|
||||
}
|
||||
}
|
||||
@@ -500,4 +502,3 @@ public static class HudSpritePatch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-8
@@ -645,11 +645,13 @@ internal static class BeginCrewmatePatch
|
||||
CustomRoles.TaskManager
|
||||
=> HudManager.Instance.TaskUpdateSound,
|
||||
|
||||
CustomRoles.Inhibitor or
|
||||
CustomRoles.Doorjammer or
|
||||
CustomRoles.Inhibitor or
|
||||
CustomRoles.Mechanic or
|
||||
CustomRoles.Provocateur or
|
||||
CustomRoles.Saboteur or
|
||||
CustomRoles.SecurityGuard or
|
||||
CustomRoles.Provocateur
|
||||
CustomRoles.Technician
|
||||
=> ShipStatus.Instance.SabotageSound,
|
||||
|
||||
CustomRoles.KillingMachine or
|
||||
@@ -697,7 +699,8 @@ internal static class BeginCrewmatePatch
|
||||
=> GetIntroSound(RoleTypes.Crewmate),
|
||||
|
||||
CustomRoles.Curser or
|
||||
CustomRoles.Nightmare
|
||||
CustomRoles.Nightmare or
|
||||
CustomRoles.Thief
|
||||
=> GetIntroSound(RoleTypes.Impostor),
|
||||
|
||||
CustomRoles.Astral or
|
||||
@@ -712,6 +715,8 @@ internal static class BeginCrewmatePatch
|
||||
|
||||
CustomRoles.Engineer or
|
||||
CustomRoles.EngineerEHR or
|
||||
CustomRoles.Adventurer or
|
||||
CustomRoles.Alchemist or
|
||||
CustomRoles.Clerk or
|
||||
CustomRoles.Dealer or
|
||||
CustomRoles.Detour or
|
||||
@@ -730,9 +735,12 @@ internal static class BeginCrewmatePatch
|
||||
|
||||
CustomRoles.Tracker
|
||||
or CustomRoles.TrackerEHR
|
||||
or CustomRoles.Coroner
|
||||
or CustomRoles.Captain
|
||||
or CustomRoles.Catcher
|
||||
or CustomRoles.Coroner
|
||||
or CustomRoles.Druid
|
||||
or CustomRoles.EvilTracker
|
||||
or CustomRoles.Hacker
|
||||
or CustomRoles.Scout
|
||||
or CustomRoles.Lookout
|
||||
=> GetIntroSound(RoleTypes.Tracker),
|
||||
@@ -761,15 +769,17 @@ internal static class BeginCrewmatePatch
|
||||
or CustomRoles.Leery
|
||||
or CustomRoles.Mortician
|
||||
or CustomRoles.Oracle
|
||||
or CustomRoles.Witness
|
||||
=> GetIntroSound(RoleTypes.Detective),
|
||||
|
||||
CustomRoles.Noisemaker
|
||||
or CustomRoles.NoisemakerEHR
|
||||
or CustomRoles.Markseeker
|
||||
or CustomRoles.Soothsayer
|
||||
or CustomRoles.Phantasm
|
||||
or CustomRoles.Specter
|
||||
or CustomRoles.SuperStar
|
||||
or CustomRoles.Sunnyboy
|
||||
or CustomRoles.Vacuum
|
||||
=> GetIntroSound(RoleTypes.Noisemaker),
|
||||
|
||||
CustomRoles.Phantom
|
||||
@@ -1335,12 +1345,13 @@ internal static class IntroCutsceneDestroyPatch
|
||||
hud.ImpostorVentButton.graphic.sprite,
|
||||
hud.SabotageButton.graphic.sprite,
|
||||
hud.PetButton.graphic.sprite,
|
||||
hud.ReportButton.graphic.sprite
|
||||
hud.ReportButton.graphic.sprite,
|
||||
hud.SecondaryAbilityButton.graphic.sprite
|
||||
];
|
||||
|
||||
hud.SetRolePanelOpen(true);
|
||||
|
||||
if (Options.CurrentGameMode == CustomGameMode.Standard && !Utils.HasTasks(PlayerControl.LocalPlayer.Data, forRecompute: false))
|
||||
if (Options.CurrentGameMode is CustomGameMode.Standard or CustomGameMode.HideAndSeek && !Utils.HasTasks(PlayerControl.LocalPlayer.Data, forRecompute: false))
|
||||
hud.TaskPanel.open = false;
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost || !Lovers.PrivateChat.GetBool()) return;
|
||||
@@ -1354,4 +1365,5 @@ internal static class IntroCutsceneDestroyPatch
|
||||
PlayerControl.LocalPlayer.NetTransform.SnapTo(new(15.5f, 0.0f), (ushort)(PlayerControl.LocalPlayer.NetTransform.lastSequenceId + 8));
|
||||
}, 4f, "Airship Spawn FailSafe");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2025,7 +2025,7 @@ internal static class FixedUpdatePatch
|
||||
{
|
||||
if (Main.HasJustStarted || !player.IsAlive()) return;
|
||||
|
||||
float add = GetSettingNameAndValueForRole(player.GetCustomRole(), "InspectorChargesWhenFinishedTasks");
|
||||
float add = GetSettingNameAndValueForRole(player.GetCustomRole(), "AbilityChargesWhenFinishedTasks");
|
||||
|
||||
if (Math.Abs(add - float.MaxValue) > 0.5f && add > 0)
|
||||
{
|
||||
@@ -2434,4 +2434,4 @@ internal static class BootFromVentPatch
|
||||
{
|
||||
return !GameStates.IsInTask || ExileController.Instance || __instance == null || __instance.myPlayer == null || !__instance.myPlayer.IsAlive() || !__instance.myPlayer.Is(CustomRoles.Nimble);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,13 +123,13 @@ public class CopyCat : RoleBase
|
||||
CustomRoles.Eraser => CustomRoles.NiceEraser,
|
||||
CustomRoles.Visionary => CustomRoles.Oracle,
|
||||
CustomRoles.Workaholic or CustomRoles.Pawn => CustomRoles.Snitch,
|
||||
CustomRoles.Sunnyboy => new[] {CustomRoles.Doctor, CustomRoles.ScientistEHR}.RandomElement(),
|
||||
CustomRoles.Sunnyboy or CustomRoles.Fabricator => new[] {CustomRoles.Doctor, CustomRoles.ScientistEHR}.RandomElement(),
|
||||
CustomRoles.Vindicator or CustomRoles.Pickpocket => CustomRoles.Mayor,
|
||||
CustomRoles.Councillor or CustomRoles.Magistrate => CustomRoles.Judge,
|
||||
CustomRoles.EvilGuesser or CustomRoles.Doomsayer or CustomRoles.Augur => CustomRoles.NiceGuesser,
|
||||
CustomRoles.EvilGuesser or CustomRoles.Doomsayer or CustomRoles.NecroGuesser or CustomRoles.Augur => CustomRoles.NiceGuesser,
|
||||
CustomRoles.Vengeance => CustomRoles.Adrenaline,
|
||||
CustomRoles.Occultist => CustomRoles.Altruist,
|
||||
CustomRoles.Dealer => CustomRoles.Merchant,
|
||||
CustomRoles.Dealer or CustomRoles.Catalyst => CustomRoles.Merchant,
|
||||
CustomRoles.Romantic => CustomRoles.Aid,
|
||||
CustomRoles.Chemist => CustomRoles.Alchemist,
|
||||
CustomRoles.Bomber or CustomRoles.Nuker => CustomRoles.Tree,
|
||||
@@ -139,9 +139,11 @@ public class CopyCat : RoleBase
|
||||
CustomRoles.BloodKnight or CustomRoles.Wildling => CustomRoles.Safeguard,
|
||||
CustomRoles.PlagueBearer => CustomRoles.Socialite,
|
||||
CustomRoles.Demon => CustomRoles.Spy,
|
||||
CustomRoles.Undertaker or CustomRoles.Vortex => CustomRoles.Vacuum,
|
||||
CustomRoles.Kidnapper => CustomRoles.Autocrat,
|
||||
CustomRoles.Capitalism => CustomRoles.Helper,
|
||||
CustomRoles.Technician or CustomRoles.Saboteur => CustomRoles.Mechanic,
|
||||
CustomRoles.Inhibitor => CustomRoles.Doorjammer,
|
||||
CustomRoles.Magician or CustomRoles.Curser => CustomRoles.Wizard,
|
||||
CustomRoles.Penguin => CustomRoles.Goose,
|
||||
CustomRoles.Anonymous => CustomRoles.Paranoia,
|
||||
@@ -155,6 +157,7 @@ public class CopyCat : RoleBase
|
||||
CustomRoles.Hookshot or CustomRoles.Ninja => new[] {CustomRoles.Tether, CustomRoles.Transmitter}.RandomElement(),
|
||||
CustomRoles.Hypocrite or CustomRoles.Specter => CustomRoles.Speedrunner,
|
||||
CustomRoles.Bandit => CustomRoles.Cleanser,
|
||||
CustomRoles.Centralizer => CustomRoles.Convener,
|
||||
CustomRoles.Weatherman => CustomRoles.Tornado,
|
||||
_ => role
|
||||
};
|
||||
@@ -195,4 +198,5 @@ public class CopyCat : RoleBase
|
||||
SetKillCooldown(pc.PlayerId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,4 +74,9 @@ internal class Visionary : RoleBase
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetButtonTexts(HudManager hud, byte id)
|
||||
{
|
||||
hud.AbilityButton?.OverrideText(Translator.GetString("InvestigatorKillButtonText"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user