mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-19 15:51:58 +00:00
CTA license, fix ghost role assignment, april fools patch try-catch, Warden everlasting speed fix, fix Seekers being able to kill each other in H&S
This commit is contained in:
1 parent
12cd2ca7d6
commit
8855ad19d5
21 files changed
+228
-122
No files matched your search
@@ -1,4 +1,12 @@
|
||||
<Window x:Class="CustomTeamAssigner.MainWindow"
|
||||
<!--
|
||||
Copyright (c) 2024, Gurge44
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the BSD-style license found in the
|
||||
README file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<Window x:Class="CustomTeamAssigner.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
@@ -6,7 +14,6 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Custom Team Assigner" Height="720" Width="1280" FontSize="20" ResizeMode="CanMinimize" WindowStyle="None">
|
||||
|
||||
<!--Create a default style for the buttons (modern style)-->
|
||||
<Window.Resources>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="LightGray"/>
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024, Gurge44
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* README file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<Page x:Class="CustomTeamAssigner.PlaySetListerPage"
|
||||
<!--
|
||||
Copyright (c) 2024, Gurge44
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the BSD-style license found in the
|
||||
README file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<Page x:Class="CustomTeamAssigner.PlaySetListerPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024, Gurge44
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* README file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
public partial class PlaySetListerPage : Page
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024, Gurge44
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* README file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
public class Team(string teamName)
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<Page x:Class="CustomTeamAssigner.TeamEditorPage"
|
||||
<!--
|
||||
Copyright (c) 2024, Gurge44
|
||||
All rights reserved.
|
||||
|
||||
This source code is licensed under the BSD-style license found in the
|
||||
README file in the root directory of this source tree.
|
||||
-->
|
||||
|
||||
<Page x:Class="CustomTeamAssigner.TeamEditorPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -84,7 +92,7 @@
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid Name="MainGrid">
|
||||
<Grid>
|
||||
<Grid.Background>
|
||||
<ImageBrush ImageSource="bg.jpg"/>
|
||||
</Grid.Background>
|
||||
@@ -109,23 +117,18 @@
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Team Name -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Team Name" FontWeight="Bold"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="2" x:Name="TeamNameTextBox" Text="Really Cool Team" Width="720" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" MaxLines="1"/>
|
||||
|
||||
<!-- Team Color (with a CheckBox deciding whether to override this) -->
|
||||
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="OverrideColorCheckBox" Content=" Override Team Color" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="OverrideColorCheck" Unchecked="OverrideColorCheck"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" x:Name="TeamColorTextBox" Text="#00ffa5" Width="128" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLength="9" MaxLines="1" TextChanged="ColorTextChanged"/>
|
||||
|
||||
<!-- Team Display Title (with a CheckBox deciding whether to override this) -->
|
||||
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="OverrideTitleCheckBox" Content=" Override Team Display Title" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="OverrideTitleCheck" Unchecked="OverrideTitleCheck"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" x:Name="TeamTitleTextBox" Text="Teamed" Width="720" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLines="1"/>
|
||||
|
||||
<!-- Team Display SubTitle (with a CheckBox deciding whether to override this) -->
|
||||
<CheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="OverrideSubTitleCheckBox" Content=" Override Team Display Subtitle" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="OverrideSubTitleCheck" Unchecked="OverrideSubTitleCheck"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="2" x:Name="TeamSubTitleTextBox" Text="You're in a Custom Team!" Width="720" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLines="1"/>
|
||||
|
||||
<!-- Left 2 columns: ListBox (for the members of the team), right side: "Members" label, ComboBox containing all values of the CustomRoles enum, and 2 buttons to add a member or remove one -->
|
||||
<Label Grid.Row="5" Grid.Column="2" Content="Team Members" FontWeight="Bold" Margin="0" VerticalContentAlignment="Top" VerticalAlignment="Top"/>
|
||||
<Grid Grid.Row="5" Grid.Column="0" Grid.RowSpan="4" Grid.ColumnSpan="2" x:Name="TeamMembersGridBase" Background="DarkGray" HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
@@ -143,10 +146,8 @@
|
||||
<ComboBox x:Name="MemberComboBox" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Width="300"/>
|
||||
<Button Content=" Add Member " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Click="AddMember"/>
|
||||
</StackPanel>
|
||||
<!-- Add a label that tells the user to click on a member to remove it -->
|
||||
<Label Grid.Row="8" Grid.Column="2" Content="Click on a member to remove it" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
|
||||
<!-- Cancel, Delete and Save Buttons -->
|
||||
<Button Grid.Row="10" Grid.Column="0" Content=" Cancel " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Click="Cancel"/>
|
||||
<Button Grid.Row="10" Grid.Column="1" Content=" Delete Team " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" Click="Delete"/>
|
||||
<Button Grid.Row="10" Grid.Column="2" Content=" Save " FontWeight="Bold" HorizontalAlignment="Right" VerticalAlignment="Center" Click="Save"/>
|
||||
|
||||
@@ -3,6 +3,14 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024, Gurge44
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* README file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
public partial class TeamEditorPage : Page
|
||||
|
||||
@@ -4,6 +4,14 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024, Gurge44
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* README file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
internal static class Utils
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AU/@EntryIndexedValue">AU</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CD/@EntryIndexedValue">CD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CK/@EntryIndexedValue">CK</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DLL/@EntryIndexedValue">DLL</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DY/@EntryIndexedValue">DY</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EHR/@EntryIndexedValue">EHR</s:String>
|
||||
@@ -9,6 +10,11 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FPS/@EntryIndexedValue">FPS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GM/@EntryIndexedValue">GM</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HUD/@EntryIndexedValue">HUD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NB/@EntryIndexedValue">NB</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NC/@EntryIndexedValue">NC</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NE/@EntryIndexedValue">NE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NK/@EntryIndexedValue">NK</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NNK/@EntryIndexedValue">NNK</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RPC/@EntryIndexedValue">RPC</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SK/@EntryIndexedValue">SK</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TMP/@EntryIndexedValue">TMP</s:String>
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace EHR
|
||||
|
||||
public static void OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer == null || target == null || !killer.Is(CustomRoles.Seeker)) return;
|
||||
if (killer == null || target == null || !killer.Is(CustomRoles.Seeker) || target.Is(CustomRoles.Seeker)) return;
|
||||
|
||||
killer.Kill(target);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using EHR.Roles.Crewmate;
|
||||
using EHR.Roles.Impostor;
|
||||
using EHR.Roles.Neutral;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -867,7 +868,7 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Autopsy when pc.Is(CustomRoles.Doctor) || pc.Is(CustomRoles.Tracefinder) || pc.Is(CustomRoles.Scientist) || pc.Is(CustomRoles.ScientistEHR) || pc.Is(CustomRoles.Sunnyboy) => false,
|
||||
CustomRoles.Necroview when pc.Is(CustomRoles.Doctor) => false,
|
||||
CustomRoles.Lazy when pc.Is(CustomRoles.Speedrunner) => false,
|
||||
CustomRoles.Mischievous when pc.Is(Team.Impostor) || pc.GetCustomRole().GetDYRole() != RoleTypes.Impostor || !pc.IsNeutralKiller() => false,
|
||||
CustomRoles.Mischievous when pc.Is(Team.Impostor) || pc.GetCustomRole().GetDYRole() != RoleTypes.Impostor || !pc.IsNeutralKiller() || Main.PlayerStates[pc.PlayerId].Role.CanUseSabotage(pc) => false,
|
||||
CustomRoles.Loyal when pc.IsCrewmate() && !Options.CrewCanBeLoyal.GetBool() => false,
|
||||
CustomRoles.DualPersonality when pc.IsCrewmate() && !Options.CrewCanBeDualPersonality.GetBool() => false,
|
||||
CustomRoles.Lazy when pc.Is(CustomRoles.Needy) || pc.Is(CustomRoles.Snitch) || pc.Is(CustomRoles.Marshall) || pc.Is(CustomRoles.Transporter) || pc.Is(CustomRoles.Guardian) => false,
|
||||
@@ -887,7 +888,8 @@ internal static class CustomRolesHelper
|
||||
CustomRoles.Egoist when !pc.GetCustomRole().IsImpostor() => false,
|
||||
CustomRoles.Damocles when pc.GetCustomRole() is CustomRoles.Bomber or CustomRoles.Nuker or CustomRoles.SerialKiller or CustomRoles.Cantankerous => false,
|
||||
CustomRoles.Damocles when !pc.CanUseKillButton() => false,
|
||||
CustomRoles.Flashman when pc.Is(CustomRoles.Swiftclaw) => false,
|
||||
CustomRoles.Flashman when pc.Is(CustomRoles.Swiftclaw) || pc.Is(CustomRoles.Giant) => false,
|
||||
CustomRoles.Giant when pc.Is(CustomRoles.Flashman) => false,
|
||||
CustomRoles.Necroview when pc.Is(CustomRoles.Visionary) => false,
|
||||
CustomRoles.Mimic when pc.Is(CustomRoles.Mafia) => false,
|
||||
CustomRoles.Rascal when !pc.IsCrewmate() => false,
|
||||
@@ -1230,6 +1232,9 @@ internal static class CustomRolesHelper
|
||||
public static string ToColoredString(this CustomRoles role) => Utils.ColorString(Utils.GetRoleColor(role), Translator.GetString($"{role}"));
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0079
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
#pragma warning restore IDE0079
|
||||
public enum RoleOptionType
|
||||
{
|
||||
Impostor,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using AmongUs.GameOptions;
|
||||
using System;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Roles.AddOns.GhostRoles;
|
||||
using HarmonyLib;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EHR.Modules
|
||||
{
|
||||
@@ -14,7 +16,6 @@ namespace EHR.Modules
|
||||
public static void Initialize()
|
||||
{
|
||||
AssignedGhostRoles = [];
|
||||
if (GhostRoles.Count > 0) return;
|
||||
GhostRoles = EnumHelper.GetAllValues<CustomRoles>().Where(x => x != CustomRoles.EvilSpirit && x.IsGhostRole() && x.IsEnable()).ToList();
|
||||
|
||||
Logger.Msg($"Ghost roles: {GhostRoles.Join()}", "GhostRoles");
|
||||
@@ -30,7 +31,7 @@ namespace EHR.Modules
|
||||
|
||||
pc.RpcSetCustomRole(suitableRole);
|
||||
pc.RpcSetRole(RoleTypes.GuardianAngel);
|
||||
IGhostRole instance = Utils.CreateGhostRoleInstance(suitableRole);
|
||||
IGhostRole instance = CreateGhostRoleInstance(suitableRole);
|
||||
instance.OnAssign(pc);
|
||||
AssignedGhostRoles[pc.PlayerId] = (suitableRole, instance);
|
||||
}
|
||||
@@ -42,7 +43,7 @@ namespace EHR.Modules
|
||||
var pc = Utils.GetPlayerById(id);
|
||||
if (set) pc.RpcSetRole(RoleTypes.GuardianAngel);
|
||||
|
||||
IGhostRole instance = Utils.CreateGhostRoleInstance(role);
|
||||
IGhostRole instance = CreateGhostRoleInstance(role);
|
||||
instance.OnAssign(pc);
|
||||
AssignedGhostRoles[id] = (role, instance);
|
||||
}
|
||||
@@ -56,7 +57,7 @@ namespace EHR.Modules
|
||||
var suitableRole = GetSuitableGhostRole(pc);
|
||||
return suitableRole.IsGhostRole() && !AssignedGhostRoles.Any(x => x.Key == pc.PlayerId || x.Value.Role == suitableRole);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.ThrowException(e);
|
||||
return false;
|
||||
@@ -65,7 +66,27 @@ namespace EHR.Modules
|
||||
|
||||
public static CustomRoles GetSuitableGhostRole(PlayerControl pc)
|
||||
{
|
||||
return GhostRoles.FirstOrDefault(x => AssignedGhostRoles.All(r => r.Value.Role != x) && (Utils.CreateGhostRoleInstance(x)?.Team & pc.GetTeam()) != 0);
|
||||
return GhostRoles.FirstOrDefault(x => AssignedGhostRoles.All(r => r.Value.Role != x) && (CreateGhostRoleInstance(x)?.Team & pc.GetTeam()) != 0);
|
||||
}
|
||||
|
||||
public static IGhostRole CreateGhostRoleInstance(CustomRoles ghostRole)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ghostRoleClass = Assembly.GetExecutingAssembly().GetTypes().First(x => typeof(IGhostRole).IsAssignableFrom(x) && !x.IsInterface && x.Name == $"{ghostRole}");
|
||||
var ghostRoleInstance = (IGhostRole)Activator.CreateInstance(ghostRoleClass);
|
||||
return ghostRoleInstance;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
Logger.Error($"Ghost role {ghostRole} not found", "CreateGhostRoleInstance");
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.ThrowException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -360,8 +360,6 @@ public static class Options
|
||||
public static OptionItem SpeedrunnerNotifyAtXTasksLeft;
|
||||
public static OptionItem ReportBaitAtAllCost;
|
||||
|
||||
public static OptionItem TryFixBlackScreen;
|
||||
|
||||
public static OptionItem SkeldChance;
|
||||
public static OptionItem MiraChance;
|
||||
public static OptionItem PolusChance;
|
||||
@@ -2180,9 +2178,6 @@ public static class Options
|
||||
.SetGameMode(CustomGameMode.Standard)
|
||||
.SetColor(new Color32(193, 255, 209, byte.MaxValue));
|
||||
|
||||
TryFixBlackScreen = BooleanOptionItem.Create(24451, "TryFixBlackScreen", false, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.Standard)
|
||||
.SetColor(new Color32(193, 255, 209, byte.MaxValue));
|
||||
|
||||
TextOptionItem.Create(100029, "MenuTitle.Ghost", TabGroup.GameSettings)
|
||||
.SetGameMode(CustomGameMode.Standard)
|
||||
|
||||
+17
-29
@@ -649,26 +649,6 @@ public static class Utils
|
||||
|
||||
public static int TotalTaskCount => Main.RealOptionsData.GetInt(Int32OptionNames.NumCommonTasks) + Main.RealOptionsData.GetInt(Int32OptionNames.NumLongTasks) + Main.RealOptionsData.GetInt(Int32OptionNames.NumShortTasks);
|
||||
|
||||
public static IGhostRole CreateGhostRoleInstance(CustomRoles ghostRole)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ghostRoleClass = Assembly.GetExecutingAssembly().GetTypes().First(x => typeof(IGhostRole).IsAssignableFrom(x) && !x.IsInterface && x.Name == $"{ghostRole}");
|
||||
var ghostRoleInstance = (IGhostRole)Activator.CreateInstance(ghostRoleClass);
|
||||
return ghostRoleInstance;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
Logger.Error($"Ghost role {ghostRole} not found", "CreateGhostRoleInstance");
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ThrowException(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanBeMadmate(this PlayerControl pc)
|
||||
{
|
||||
return pc != null && pc.IsCrewmate() && !pc.Is(CustomRoles.Madmate)
|
||||
@@ -1954,7 +1934,23 @@ public static class Utils
|
||||
|
||||
if (!isForMeeting && MeetingStates.FirstMeeting && Options.ChangeNameToRoleInfo.GetBool() && Options.CurrentGameMode is not CustomGameMode.FFA and not CustomGameMode.MoveAndStop and not CustomGameMode.HotPotato)
|
||||
{
|
||||
if (Options.CurrentGameMode == CustomGameMode.HideAndSeek)
|
||||
var team = CustomTeamManager.GetCustomTeam(seer.PlayerId);
|
||||
if (team != null)
|
||||
{
|
||||
SeerRealName = ColorString(
|
||||
team.RoleRevealScreenBackgroundColor == "*" || !ColorUtility.TryParseHtmlString(team.RoleRevealScreenBackgroundColor, out var teamColor)
|
||||
? Color.yellow
|
||||
: teamColor,
|
||||
string.Format(
|
||||
GetString("CustomTeamHelp"),
|
||||
team.RoleRevealScreenTitle == "*"
|
||||
? team.TeamName
|
||||
: team.RoleRevealScreenTitle,
|
||||
team.RoleRevealScreenSubtitle == "*"
|
||||
? string.Empty
|
||||
: team.RoleRevealScreenSubtitle));
|
||||
}
|
||||
else if (Options.CurrentGameMode == CustomGameMode.HideAndSeek)
|
||||
{
|
||||
SeerRealName = CustomHideAndSeekManager.GetRoleInfoText(seer);
|
||||
}
|
||||
@@ -2433,14 +2429,6 @@ public static class Utils
|
||||
}, Options.TruantWaitingTime.GetFloat(), $"Truant Waiting: {pc.GetNameWithRole()}");
|
||||
}
|
||||
|
||||
if (Options.TryFixBlackScreen.GetBool() && !pc.IsModClient())
|
||||
{
|
||||
pc.ReactorFlash(0.2f); // This should fix black screens
|
||||
var pos = pc.Pos();
|
||||
pc.MyPhysics?.RpcBootFromVent(0);
|
||||
_ = new LateTask(() => { pc.TP(pos); }, 0.5f, log: false);
|
||||
}
|
||||
|
||||
if (Options.UsePets.GetBool()) pc.AddAbilityCD(includeDuration: false);
|
||||
|
||||
Main.PlayerStates[pc.PlayerId].Role.AfterMeetingTasks();
|
||||
|
||||
+87
-61
@@ -39,51 +39,57 @@ public static class GetHnsBodyTypePatch
|
||||
{
|
||||
public static void Postfix(ref PlayerBodyTypes __result, [HarmonyArgument(0)] PlayerControl player)
|
||||
{
|
||||
if (player == null || player.Data == null || player.Data.Role == null)
|
||||
try
|
||||
{
|
||||
if (Main.HorseMode.Value)
|
||||
if (player == null || player.Data == null || player.Data.Role == null)
|
||||
{
|
||||
__result = PlayerBodyTypes.Horse;
|
||||
return;
|
||||
}
|
||||
if (Main.HorseMode.Value)
|
||||
{
|
||||
__result = PlayerBodyTypes.Horse;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Main.LongMode.Value)
|
||||
{
|
||||
__result = PlayerBodyTypes.Long;
|
||||
return;
|
||||
}
|
||||
if (Main.LongMode.Value)
|
||||
{
|
||||
__result = PlayerBodyTypes.Long;
|
||||
return;
|
||||
}
|
||||
|
||||
__result = PlayerBodyTypes.Normal;
|
||||
}
|
||||
else if (Main.HorseMode.Value)
|
||||
{
|
||||
if (player.Data.Role.IsImpostor)
|
||||
{
|
||||
__result = PlayerBodyTypes.Normal;
|
||||
return;
|
||||
}
|
||||
|
||||
__result = PlayerBodyTypes.Horse;
|
||||
}
|
||||
else if (Main.LongMode.Value)
|
||||
{
|
||||
if (player.Data.Role.IsImpostor)
|
||||
else if (Main.HorseMode.Value)
|
||||
{
|
||||
__result = PlayerBodyTypes.LongSeeker;
|
||||
return;
|
||||
}
|
||||
if (player.Data.Role.IsImpostor)
|
||||
{
|
||||
__result = PlayerBodyTypes.Normal;
|
||||
return;
|
||||
}
|
||||
|
||||
__result = PlayerBodyTypes.Long;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.Data.Role.IsImpostor)
|
||||
__result = PlayerBodyTypes.Horse;
|
||||
}
|
||||
else if (Main.LongMode.Value)
|
||||
{
|
||||
__result = PlayerBodyTypes.Seeker;
|
||||
return;
|
||||
}
|
||||
if (player.Data.Role.IsImpostor)
|
||||
{
|
||||
__result = PlayerBodyTypes.LongSeeker;
|
||||
return;
|
||||
}
|
||||
|
||||
__result = PlayerBodyTypes.Normal;
|
||||
__result = PlayerBodyTypes.Long;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.Data.Role.IsImpostor)
|
||||
{
|
||||
__result = PlayerBodyTypes.Seeker;
|
||||
return;
|
||||
}
|
||||
|
||||
__result = PlayerBodyTypes.Normal;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,10 +101,17 @@ public static class LongBoiPatches
|
||||
[HarmonyPrefix]
|
||||
public static bool LongBoyAwake_Patch(LongBoiPlayerBody __instance)
|
||||
{
|
||||
__instance.cosmeticLayer.OnSetBodyAsGhost += (Action)__instance.SetPoolableGhost;
|
||||
__instance.cosmeticLayer.OnColorChange += (Action<int>)__instance.SetHeightFromColor;
|
||||
__instance.cosmeticLayer.OnCosmeticSet += (Action<string, int, CosmeticKind>)__instance.OnCosmeticSet;
|
||||
__instance.gameObject.layer = 8;
|
||||
try
|
||||
{
|
||||
__instance.cosmeticLayer.OnSetBodyAsGhost += (Action)__instance.SetPoolableGhost;
|
||||
__instance.cosmeticLayer.OnColorChange += (Action<int>)__instance.SetHeightFromColor;
|
||||
__instance.cosmeticLayer.OnCosmeticSet += (Action<string, int, CosmeticKind>)__instance.OnCosmeticSet;
|
||||
__instance.gameObject.layer = 8;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -106,31 +119,37 @@ public static class LongBoiPatches
|
||||
[HarmonyPrefix]
|
||||
public static bool LongBoyStart_Patch(LongBoiPlayerBody __instance)
|
||||
{
|
||||
__instance.ShouldLongAround = true;
|
||||
if (__instance.hideCosmeticsQC)
|
||||
try
|
||||
{
|
||||
__instance.cosmeticLayer.SetHatVisorVisible(false);
|
||||
}
|
||||
|
||||
__instance.SetupNeckGrowth();
|
||||
if (__instance.isExiledPlayer)
|
||||
{
|
||||
ShipStatus instance = ShipStatus.Instance;
|
||||
if (instance == null || instance.Type != ShipStatus.MapType.Fungle)
|
||||
__instance.ShouldLongAround = true;
|
||||
if (__instance.hideCosmeticsQC)
|
||||
{
|
||||
__instance.cosmeticLayer.AdjustCosmeticRotations(-17.75f);
|
||||
__instance.cosmeticLayer.SetHatVisorVisible(false);
|
||||
}
|
||||
|
||||
__instance.SetupNeckGrowth();
|
||||
if (__instance.isExiledPlayer)
|
||||
{
|
||||
ShipStatus instance = ShipStatus.Instance;
|
||||
if (instance == null || instance.Type != ShipStatus.MapType.Fungle)
|
||||
{
|
||||
__instance.cosmeticLayer.AdjustCosmeticRotations(-17.75f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!__instance.isPoolablePlayer)
|
||||
{
|
||||
__instance.cosmeticLayer.ValidateCosmetics();
|
||||
}
|
||||
|
||||
if (__instance.myPlayerControl)
|
||||
{
|
||||
__instance.StopAllCoroutines();
|
||||
__instance.SetHeightFromColor(__instance.myPlayerControl.Data.DefaultOutfit.ColorId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!__instance.isPoolablePlayer)
|
||||
catch
|
||||
{
|
||||
__instance.cosmeticLayer.ValidateCosmetics();
|
||||
}
|
||||
|
||||
if (__instance.myPlayerControl)
|
||||
{
|
||||
__instance.StopAllCoroutines();
|
||||
__instance.SetHeightFromColor(__instance.myPlayerControl.Data.DefaultOutfit.ColorId);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -140,8 +159,15 @@ public static class LongBoiPatches
|
||||
[HarmonyPrefix]
|
||||
public static bool LongBoyNeckSize_Patch(LongBoiPlayerBody __instance, ref float distance)
|
||||
{
|
||||
__instance.targetHeight = distance / 10f + 0.5f;
|
||||
__instance.SetupNeckGrowth(true);
|
||||
try
|
||||
{
|
||||
__instance.targetHeight = distance / 10f + 0.5f;
|
||||
__instance.SetupNeckGrowth(true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,11 @@ class GameEndChecker
|
||||
.Do(p => WinnerIds.Add(p.PlayerId));
|
||||
}
|
||||
|
||||
if (WinnerTeam != CustomWinner.CustomTeam)
|
||||
{
|
||||
WinnerIds.RemoveWhere(x => CustomTeamManager.GetCustomTeam(x) != null);
|
||||
}
|
||||
|
||||
if (WinnerTeam == CustomWinner.Lovers || WinnerIds.Any(x => Main.PlayerStates[x].SubRoles.Contains(CustomRoles.Lovers)))
|
||||
{
|
||||
if (WinnerTeam != CustomWinner.Lovers) AdditionalWinnerTeams.Add(AdditionalWinners.Lovers);
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ class HudManagerPatch
|
||||
bool usesPetInsteadOfKill = player.GetCustomRole().UsesPetInsteadOfKill();
|
||||
if (usesPetInsteadOfKill)
|
||||
{
|
||||
__instance.PetButton?.OverrideText("KillButtonText");
|
||||
__instance.PetButton?.OverrideText(GetString("KillButtonText"));
|
||||
}
|
||||
|
||||
ActionButton usedButton = __instance.KillButton;
|
||||
|
||||
@@ -720,7 +720,7 @@ internal class SelectRolesPatch
|
||||
|
||||
private static void AssignLoversRolesFromList()
|
||||
{
|
||||
if (CustomRoles.Lovers.IsEnable())
|
||||
if (CustomRoles.Lovers.IsEnable() && !RoleResult.ContainsValue(CustomRoles.Romantic))
|
||||
{
|
||||
Main.LoversPlayers.Clear();
|
||||
Main.IsLoversDead = false;
|
||||
|
||||
@@ -2895,6 +2895,7 @@
|
||||
"SpawnAdditionalRefugeeMinAlivePlayers": "Minimum Number of Alive Players to Spawn",
|
||||
"HorseMode": "Horse Mode",
|
||||
"LongMode": "Long Mode",
|
||||
"CustomTeamHelp": "You are in the {0}!{1}\\nWork with your team members to win together!",
|
||||
"NoPetActionMsg1": "You just ate a cookie",
|
||||
"NoPetActionMsg2": "You look around",
|
||||
"NoPetActionMsg3": "You start wondering whether you are sus or not",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace EHR.Roles.AddOns.GhostRoles
|
||||
using System;
|
||||
|
||||
namespace EHR.Roles.AddOns.GhostRoles
|
||||
{
|
||||
internal class Warden : IGhostRole, ISettingHolder
|
||||
{
|
||||
@@ -10,6 +12,7 @@
|
||||
public void OnProtect(PlayerControl pc, PlayerControl target)
|
||||
{
|
||||
float speed = Main.AllPlayerSpeed[target.PlayerId];
|
||||
if (Math.Abs(speed - (speed + ExtraSpeed.GetFloat())) < 0.1f || speed > speed + ExtraSpeed.GetFloat()) return;
|
||||
Main.AllPlayerSpeed[target.PlayerId] += ExtraSpeed.GetFloat();
|
||||
target.MarkDirtySettings();
|
||||
target.Notify(Translator.GetString("WardenNotify"));
|
||||
@@ -27,7 +30,7 @@
|
||||
ExtraSpeedDuration = IntegerOptionItem.Create(649202, "ExpressSpeedDur", new(1, 90, 1), 5, TabGroup.OtherRoles, false)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Warden])
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
ExtraSpeed = FloatOptionItem.Create(649203, "ExpressSpeed", new(0.5f, 3f, 0.1f), 1.5f, TabGroup.OtherRoles, false)
|
||||
ExtraSpeed = FloatOptionItem.Create(649203, "ExpressSpeed", new(0.5f, 3f, 0.1f), 0.25f, TabGroup.OtherRoles, false)
|
||||
.SetParent(Options.CustomRoleSpawnChances[CustomRoles.Warden])
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public class Main : BasePlugin
|
||||
public const string DebugKeySalt = "59687b";
|
||||
public static ConfigEntry<string> DebugKeyInput { get; private set; }
|
||||
public const string PluginGuid = "com.gurge44.endlesshostroles";
|
||||
public const string PluginVersion = "3.1.0";
|
||||
public const string PluginDisplayVersion = "3.1.0";
|
||||
public const string PluginVersion = "3.1.1";
|
||||
public const string PluginDisplayVersion = "3.1.1";
|
||||
public static readonly string SupportedAUVersion = "2024.3.5";
|
||||
|
||||
public Harmony Harmony { get; } = new(PluginGuid);
|
||||
|
||||
Reference in new issue
Block a user