mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-11-19 13:16:56 +00:00
CTA AU side code, Fix /r, Try fixing mid-game chat, Try fixing black screen
This commit is contained in:
1 parent
d0fc9dc773
commit
d58338988c
46 files changed
+598
-414
No files matched your search
@@ -1,6 +1,4 @@
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace EHR;
|
||||
|
||||
namespace EHR;
|
||||
|
||||
public enum CustomRoles
|
||||
{
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
d:DesignHeight="720" d:DesignWidth="1280"
|
||||
Title="Play-Set Lister">
|
||||
|
||||
<Page.Resources>
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHR;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using EHR;
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
@@ -45,17 +41,17 @@ namespace CustomTeamAssigner
|
||||
switch (e)
|
||||
{
|
||||
case NullReferenceException:
|
||||
MessageBox.Show("The file is empty.", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"The file is empty.\nAt line: {line}", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case InvalidOperationException:
|
||||
case IndexOutOfRangeException:
|
||||
MessageBox.Show("The file is not formatted correctly.", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"The file is not formatted correctly.\nAt line: {line}", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
case ArgumentException:
|
||||
MessageBox.Show("A team member role could not be recognized from the given string.", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"A team member role could not be recognized from the given string.\nAt line: {line}", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show(e.Message, "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"{e.Message}\nAt line: {line}", "Error while importing", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -91,5 +87,13 @@ namespace CustomTeamAssigner
|
||||
RoleRevealScreenBackgroundColor = "#00ffa5";
|
||||
TeamMembers = [];
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is not Team team) return false;
|
||||
return TeamName == team.TeamName;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => TeamName.GetHashCode();
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800" FontSize="17"
|
||||
d:DesignHeight="720" d:DesignWidth="1280" FontSize="24"
|
||||
Title="Team Editor">
|
||||
|
||||
<Page.Resources>
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
<!-- 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="500" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" MaxLines="1"/>
|
||||
<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"/>
|
||||
@@ -119,15 +119,15 @@
|
||||
|
||||
<!-- 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="500" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLines="1"/>
|
||||
<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="500" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLines="1"/>
|
||||
<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="Center">
|
||||
<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">
|
||||
<Grid Name="TeamMembersGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -140,8 +140,8 @@
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="6" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<ComboBox x:Name="MemberComboBox" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Width="250"/>
|
||||
<Button Content=" Add Member " FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Click="AddMember"/>
|
||||
<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"/>
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EHR;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using EHR;
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
@@ -28,6 +17,9 @@ namespace CustomTeamAssigner
|
||||
EditingTeamMembers = team.TeamMembers;
|
||||
InitializeMembersGrid();
|
||||
InitializeComboBox();
|
||||
OverrideColorCheckBox.IsChecked = EditingTeam.RoleRevealScreenBackgroundColor != "*";
|
||||
OverrideTitleCheckBox.IsChecked = EditingTeam.RoleRevealScreenTitle != "*";
|
||||
OverrideSubTitleCheckBox.IsChecked = EditingTeam.RoleRevealScreenSubtitle != "*";
|
||||
}
|
||||
|
||||
void InitializeMembersGrid()
|
||||
@@ -51,8 +43,20 @@ namespace CustomTeamAssigner
|
||||
Utils.GetAllValidRoles().Do(role => MemberComboBox.Items.Add(Utils.GetActualRoleName(role)));
|
||||
}
|
||||
|
||||
void UpdateComboBox()
|
||||
{
|
||||
MemberComboBox.Items.Clear();
|
||||
Utils.GetAllValidRoles().Except(EditingTeamMembers).Do(role => MemberComboBox.Items.Add(Utils.GetActualRoleName(role)));
|
||||
}
|
||||
|
||||
void Save(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Utils.Teams.Any(x => x.TeamName == TeamNameTextBox.Text) || string.IsNullOrWhiteSpace(TeamNameTextBox.Text) || EditingTeamMembers.Count == 0)
|
||||
{
|
||||
MessageBox.Show("The team name is already taken, or the team name is empty, or there are no team members.", "Invalid Team", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
EditingTeam.TeamName = TeamNameTextBox.Text;
|
||||
|
||||
EditingTeam.RoleRevealScreenTitle = OverrideTitleCheckBox.IsChecked == true ? TeamTitleTextBox.Text : "*";
|
||||
@@ -88,6 +92,7 @@ namespace CustomTeamAssigner
|
||||
|
||||
var role = Enum.Parse<CustomRoles>(((string)MemberComboBox.SelectedItem).GetInternalRoleName().ToString());
|
||||
EditingTeamMembers.Add(role);
|
||||
MemberComboBox.Items.RemoveAt(MemberComboBox.SelectedIndex);
|
||||
AddMemberToGrid(role);
|
||||
}
|
||||
|
||||
@@ -102,6 +107,7 @@ namespace CustomTeamAssigner
|
||||
Content = Utils.GetActualRoleName(role),
|
||||
Background = Brushes.Black,
|
||||
Foreground = new SolidColorBrush(Colors.LightGray),
|
||||
FontSize = 20,
|
||||
Margin = new(2),
|
||||
Padding = new(2),
|
||||
Tag = role
|
||||
@@ -111,6 +117,7 @@ namespace CustomTeamAssigner
|
||||
{
|
||||
Button element = (Button)sender;
|
||||
EditingTeamMembers.Remove((CustomRoles)element.Tag);
|
||||
UpdateComboBox();
|
||||
int index = TeamMembersGrid.Children.IndexOf(element);
|
||||
TeamMembersGrid.Children.Remove(element);
|
||||
for (int i = index; i < TeamMembersGrid.Children.Count; i++)
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHR;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using EHR;
|
||||
|
||||
namespace CustomTeamAssigner
|
||||
{
|
||||
@@ -57,7 +53,7 @@ namespace CustomTeamAssigner
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Color.FromRgb(200, 200, 200);
|
||||
return Color.FromRgb(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +65,11 @@ namespace CustomTeamAssigner
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<CustomRoles> GetAllValidRoles() => Enum.GetValues<CustomRoles>().Where(x => !x.ToString().Contains("TOHE") && x < CustomRoles.NotAssigned && x is not (CustomRoles.KB_Normal or CustomRoles.Killer or CustomRoles.Tasker or CustomRoles.Potato or CustomRoles.Hider or CustomRoles.Seeker or CustomRoles.Fox or CustomRoles.Troll or CustomRoles.GM or CustomRoles.Convict or CustomRoles.Impostor or CustomRoles.Shapeshifter or CustomRoles.Crewmate or CustomRoles.Engineer or CustomRoles.Scientist or CustomRoles.GuardianAngel));
|
||||
public static IEnumerable<CustomRoles> GetAllValidRoles() => Enum.GetValues<CustomRoles>().Where(x => !Teams.Any(t => t.TeamMembers.Contains(x)) && !x.ToString().Contains("TOHE") && x < CustomRoles.NotAssigned && x is not (CustomRoles.KB_Normal or CustomRoles.Killer or CustomRoles.Tasker or CustomRoles.Potato or CustomRoles.Hider or CustomRoles.Seeker or CustomRoles.Fox or CustomRoles.Troll or CustomRoles.GM or CustomRoles.Convict or CustomRoles.Impostor or CustomRoles.Shapeshifter or CustomRoles.Crewmate or CustomRoles.Engineer or CustomRoles.Scientist or CustomRoles.GuardianAngel));
|
||||
|
||||
public static string GetActualRoleName(CustomRoles role)
|
||||
{
|
||||
if (RoleNames.TryGetValue(role, out string roleName))
|
||||
if (RoleNames.TryGetValue(role, out var roleName))
|
||||
{
|
||||
return roleName;
|
||||
}
|
||||
@@ -88,13 +84,18 @@ namespace CustomTeamAssigner
|
||||
}
|
||||
}
|
||||
|
||||
if (sb.ToString().EndsWith("Role"))
|
||||
{
|
||||
sb.Remove(sb.Length - 4, 4);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static CustomRoles GetInternalRoleName(this string roleName)
|
||||
{
|
||||
var role = RoleNames.FirstOrDefault(x => x.Value == roleName).Key;
|
||||
return role != default ? role : Enum.Parse<CustomRoles>(roleName.Replace(" ", ""));
|
||||
return role != default ? role : Enum.Parse<CustomRoles>(roleName.Replace(" ", string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -50,10 +50,10 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Target Name="Roles" AfterTargets="Build">
|
||||
<Copy SourceFiles="CustomRoles.cs" DestinationFolder="CTA/CustomTeamAssigner/" />
|
||||
</Target>
|
||||
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" />
|
||||
</Target>
|
||||
<Target Name="Copy" AfterTargets="Build">
|
||||
<Copy SourceFiles="CustomRoles.cs" DestinationFolder="CTA/CustomTeamAssigner/" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -116,7 +116,7 @@ namespace EHR
|
||||
{
|
||||
if (target.Is(CustomRoles.Seeker))
|
||||
{
|
||||
color = Main.roleColors[CustomRoles.Seeker];
|
||||
color = Main.RoleColors[CustomRoles.Seeker];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace EHR
|
||||
if (!isHUD && seer.IsModClient()) return string.Empty;
|
||||
if (isHUD || TimeLeft <= 60)
|
||||
{
|
||||
return $"<color={Main.roleColors[CustomRoles.Hider]}>{Translator.GetString("TimeLeft")}:</color> {TimeLeft}s";
|
||||
return $"<color={Main.RoleColors[CustomRoles.Hider]}>{Translator.GetString("TimeLeft")}:</color> {TimeLeft}s";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+52
-52
@@ -23,66 +23,66 @@ internal static class FFAManager
|
||||
public static string LatestChatMessage = string.Empty;
|
||||
|
||||
//Options
|
||||
public static OptionItem FFA_GameTime;
|
||||
public static OptionItem FFA_KCD;
|
||||
public static OptionItem FFA_LowerVision;
|
||||
public static OptionItem FFA_IncreasedSpeed;
|
||||
public static OptionItem FFA_DecreasedSpeed;
|
||||
public static OptionItem FFA_ShieldDuration;
|
||||
public static OptionItem FFA_ModifiedVisionDuration;
|
||||
public static OptionItem FFA_ModifiedSpeedDuration;
|
||||
public static OptionItem FFA_DisableVentingWhenTwoPlayersAlive;
|
||||
public static OptionItem FFA_DisableVentingWhenKCDIsUp;
|
||||
public static OptionItem FFA_EnableRandomAbilities;
|
||||
public static OptionItem FFA_EnableRandomTwists;
|
||||
public static OptionItem FFA_ShieldIsOneTimeUse;
|
||||
public static OptionItem FFA_ChatDuringGame;
|
||||
public static OptionItem FFAGameTime;
|
||||
public static OptionItem FFAKcd;
|
||||
public static OptionItem FFALowerVision;
|
||||
public static OptionItem FFAIncreasedSpeed;
|
||||
public static OptionItem FFADecreasedSpeed;
|
||||
public static OptionItem FFAShieldDuration;
|
||||
public static OptionItem FFAModifiedVisionDuration;
|
||||
public static OptionItem FFAModifiedSpeedDuration;
|
||||
public static OptionItem FFADisableVentingWhenTwoPlayersAlive;
|
||||
public static OptionItem FFADisableVentingWhenKcdIsUp;
|
||||
public static OptionItem FFAEnableRandomAbilities;
|
||||
public static OptionItem FFAEnableRandomTwists;
|
||||
public static OptionItem FFAShieldIsOneTimeUse;
|
||||
public static OptionItem FFAChatDuringGame;
|
||||
|
||||
public static void SetupCustomOption()
|
||||
{
|
||||
FFA_GameTime = IntegerOptionItem.Create(67_223_001, "FFA_GameTime", new(30, 600, 10), 300, TabGroup.GameSettings, false)
|
||||
FFAGameTime = IntegerOptionItem.Create(67_223_001, "FFA_GameTime", new(30, 600, 10), 300, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetHeader(true);
|
||||
FFA_KCD = FloatOptionItem.Create(67_223_002, "FFA_KCD", new(1f, 60f, 1f), 10f, TabGroup.GameSettings, false)
|
||||
FFAKcd = FloatOptionItem.Create(67_223_002, "FFA_KCD", new(1f, 60f, 1f), 10f, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
FFA_DisableVentingWhenTwoPlayersAlive = BooleanOptionItem.Create(67_223_003, "FFA_DisableVentingWhenTwoPlayersAlive", true, TabGroup.GameSettings, false)
|
||||
FFADisableVentingWhenTwoPlayersAlive = BooleanOptionItem.Create(67_223_003, "FFA_DisableVentingWhenTwoPlayersAlive", true, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue));
|
||||
FFA_DisableVentingWhenKCDIsUp = BooleanOptionItem.Create(67_223_004, "FFA_DisableVentingWhenKCDIsUp", true, TabGroup.GameSettings, false)
|
||||
FFADisableVentingWhenKcdIsUp = BooleanOptionItem.Create(67_223_004, "FFA_DisableVentingWhenKCDIsUp", true, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue));
|
||||
FFA_EnableRandomAbilities = BooleanOptionItem.Create(67_223_005, "FFA_EnableRandomAbilities", true, TabGroup.GameSettings, false)
|
||||
FFAEnableRandomAbilities = BooleanOptionItem.Create(67_223_005, "FFA_EnableRandomAbilities", true, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue));
|
||||
FFA_ShieldDuration = FloatOptionItem.Create(67_223_006, "FFA_ShieldDuration", new(1f, 70f, 1f), 7f, TabGroup.GameSettings, false)
|
||||
FFAShieldDuration = FloatOptionItem.Create(67_223_006, "FFA_ShieldDuration", new(1f, 70f, 1f), 7f, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
FFA_IncreasedSpeed = FloatOptionItem.Create(67_223_007, "FFA_IncreasedSpeed", new(0.1f, 5f, 0.1f), 1.5f, TabGroup.GameSettings, false)
|
||||
FFAIncreasedSpeed = FloatOptionItem.Create(67_223_007, "FFA_IncreasedSpeed", new(0.1f, 5f, 0.1f), 1.5f, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
FFA_DecreasedSpeed = FloatOptionItem.Create(67_223_008, "FFA_DecreasedSpeed", new(0.1f, 5f, 0.1f), 1f, TabGroup.GameSettings, false)
|
||||
FFADecreasedSpeed = FloatOptionItem.Create(67_223_008, "FFA_DecreasedSpeed", new(0.1f, 5f, 0.1f), 1f, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
FFA_ModifiedSpeedDuration = FloatOptionItem.Create(67_223_009, "FFA_ModifiedSpeedDuration", new(1f, 60f, 1f), 10f, TabGroup.GameSettings, false).SetGameMode(CustomGameMode.FFA).SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
FFAModifiedSpeedDuration = FloatOptionItem.Create(67_223_009, "FFA_ModifiedSpeedDuration", new(1f, 60f, 1f), 10f, TabGroup.GameSettings, false).SetGameMode(CustomGameMode.FFA).SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
FFA_LowerVision = FloatOptionItem.Create(67_223_010, "FFA_LowerVision", new(0f, 1f, 0.05f), 0.5f, TabGroup.GameSettings, false).SetGameMode(CustomGameMode.FFA).SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
FFALowerVision = FloatOptionItem.Create(67_223_010, "FFA_LowerVision", new(0f, 1f, 0.05f), 0.5f, TabGroup.GameSettings, false).SetGameMode(CustomGameMode.FFA).SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Multiplier);
|
||||
FFA_ModifiedVisionDuration = FloatOptionItem.Create(67_223_011, "FFA_ModifiedVisionDuration", new(1f, 70f, 1f), 5f, TabGroup.GameSettings, false).SetGameMode(CustomGameMode.FFA).SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
FFAModifiedVisionDuration = FloatOptionItem.Create(67_223_011, "FFA_ModifiedVisionDuration", new(1f, 70f, 1f), 5f, TabGroup.GameSettings, false).SetGameMode(CustomGameMode.FFA).SetColor(new Color32(0, 255, 165, byte.MaxValue))
|
||||
.SetValueFormat(OptionFormat.Seconds);
|
||||
FFA_EnableRandomTwists = BooleanOptionItem.Create(67_223_012, "FFA_EnableRandomTwists", true, TabGroup.GameSettings, false)
|
||||
FFAEnableRandomTwists = BooleanOptionItem.Create(67_223_012, "FFA_EnableRandomTwists", true, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue));
|
||||
FFA_ShieldIsOneTimeUse = BooleanOptionItem.Create(67_223_013, "FFA_ShieldIsOneTimeUse", true, TabGroup.GameSettings, false)
|
||||
FFAShieldIsOneTimeUse = BooleanOptionItem.Create(67_223_013, "FFA_ShieldIsOneTimeUse", true, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue));
|
||||
FFA_ChatDuringGame = BooleanOptionItem.Create(67_223_014, "FFA_ChatDuringGame", false, TabGroup.GameSettings, false)
|
||||
FFAChatDuringGame = BooleanOptionItem.Create(67_223_014, "FFA_ChatDuringGame", false, TabGroup.GameSettings, false)
|
||||
.SetGameMode(CustomGameMode.FFA)
|
||||
.SetColor(new Color32(0, 255, 165, byte.MaxValue));
|
||||
}
|
||||
@@ -98,14 +98,14 @@ internal static class FFAManager
|
||||
|
||||
originalSpeed = [];
|
||||
KillCount = [];
|
||||
RoundTime = FFA_GameTime.GetInt() + 8;
|
||||
RoundTime = FFAGameTime.GetInt() + 8;
|
||||
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
KillCount[pc.PlayerId] = 0;
|
||||
}
|
||||
|
||||
if (FFA_ChatDuringGame.GetBool()) _ = new LateTask(Utils.SetChatVisible, 7f, "Set Chat Visible for Everyone");
|
||||
if (FFAChatDuringGame.GetBool()) _ = new LateTask(Utils.SetChatVisible, 12f, "Set Chat Visible for Everyone");
|
||||
}
|
||||
|
||||
private static void SendRPCSyncFFAPlayer(byte playerId)
|
||||
@@ -193,8 +193,8 @@ internal static class FFAManager
|
||||
if (FFAShieldedList.TryGetValue(target.PlayerId, out var dur))
|
||||
{
|
||||
killer.Notify(GetString("FFA_TargetIsShielded"));
|
||||
Logger.Info($"{killer.GetRealName().RemoveHtmlTags()} attacked shielded player {target.GetRealName().RemoveHtmlTags()}, their shield expires in {FFA_ShieldDuration.GetInt() - (Utils.TimeStamp - dur)}s", "FFA");
|
||||
if (FFA_ShieldIsOneTimeUse.GetBool())
|
||||
Logger.Info($"{killer.GetRealName().RemoveHtmlTags()} attacked shielded player {target.GetRealName().RemoveHtmlTags()}, their shield expires in {FFAShieldDuration.GetInt() - (Utils.TimeStamp - dur)}s", "FFA");
|
||||
if (FFAShieldIsOneTimeUse.GetBool())
|
||||
{
|
||||
FFAShieldedList.Remove(target.PlayerId);
|
||||
target.Notify(GetString("FFA_ShieldBroken"));
|
||||
@@ -221,7 +221,7 @@ internal static class FFAManager
|
||||
Logger.Info($"The last 2 players ({killer.GetRealName().RemoveHtmlTags()} & {otherPC?.GetRealName().RemoveHtmlTags()}) now have an arrow toward each other", "FFA");
|
||||
}
|
||||
|
||||
if (FFA_EnableRandomAbilities.GetBool())
|
||||
if (FFAEnableRandomAbilities.GetBool())
|
||||
{
|
||||
bool sync = false;
|
||||
bool mark = false;
|
||||
@@ -237,8 +237,8 @@ internal static class FFAManager
|
||||
{
|
||||
case 0:
|
||||
FFAShieldedList.TryAdd(killer.PlayerId, Utils.TimeStamp);
|
||||
killer.Notify(GetString("FFA-Event-GetShield"), FFA_ShieldDuration.GetFloat());
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
killer.Notify(GetString("FFA-Event-GetShield"), FFAShieldDuration.GetFloat());
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
break;
|
||||
case 1:
|
||||
if (FFAIncreasedSpeedList.ContainsKey(killer.PlayerId))
|
||||
@@ -250,20 +250,20 @@ internal static class FFAManager
|
||||
{
|
||||
FFAIncreasedSpeedList.TryAdd(killer.PlayerId, Utils.TimeStamp);
|
||||
originalSpeed.TryAdd(killer.PlayerId, Main.AllPlayerSpeed[killer.PlayerId]);
|
||||
Main.AllPlayerSpeed[killer.PlayerId] = FFA_IncreasedSpeed.GetFloat();
|
||||
Main.AllPlayerSpeed[killer.PlayerId] = FFAIncreasedSpeed.GetFloat();
|
||||
}
|
||||
|
||||
killer.Notify(GetString("FFA-Event-GetIncreasedSpeed"), FFA_ModifiedSpeedDuration.GetFloat());
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
killer.Notify(GetString("FFA-Event-GetIncreasedSpeed"), FFAModifiedSpeedDuration.GetFloat());
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
mark = true;
|
||||
break;
|
||||
case 2:
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = Math.Clamp(FFA_KCD.GetFloat() - 3f, 1f, 60f);
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = Math.Clamp(FFAKcd.GetFloat() - 3f, 1f, 60f);
|
||||
killer.Notify(GetString("FFA-Event-GetLowKCD"));
|
||||
sync = true;
|
||||
break;
|
||||
default:
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -283,26 +283,26 @@ internal static class FFAManager
|
||||
{
|
||||
FFADecreasedSpeedList.TryAdd(killer.PlayerId, Utils.TimeStamp);
|
||||
originalSpeed.TryAdd(killer.PlayerId, Main.AllPlayerSpeed[killer.PlayerId]);
|
||||
Main.AllPlayerSpeed[killer.PlayerId] = FFA_DecreasedSpeed.GetFloat();
|
||||
Main.AllPlayerSpeed[killer.PlayerId] = FFADecreasedSpeed.GetFloat();
|
||||
}
|
||||
|
||||
killer.Notify(GetString("FFA-Event-GetDecreasedSpeed"), FFA_ModifiedSpeedDuration.GetFloat());
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
killer.Notify(GetString("FFA-Event-GetDecreasedSpeed"), FFAModifiedSpeedDuration.GetFloat());
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
mark = true;
|
||||
break;
|
||||
case 1:
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = Math.Clamp(FFA_KCD.GetFloat() + 3f, 1f, 60f);
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = Math.Clamp(FFAKcd.GetFloat() + 3f, 1f, 60f);
|
||||
killer.Notify(GetString("FFA-Event-GetHighKCD"));
|
||||
sync = true;
|
||||
break;
|
||||
case 2:
|
||||
FFALowerVisionList.TryAdd(killer.PlayerId, Utils.TimeStamp);
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
killer.Notify(GetString("FFA-Event-GetLowVision"));
|
||||
mark = true;
|
||||
break;
|
||||
default:
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ internal static class FFAManager
|
||||
{
|
||||
_ = new LateTask(() => { killer.TPtoRndVent(); }, 0.5f, "FFA-Event-TP");
|
||||
killer.Notify(GetString("FFA-Event-GetTP"));
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFA_KCD.GetFloat();
|
||||
Main.AllPlayerKillCooldown[killer.PlayerId] = FFAKcd.GetFloat();
|
||||
}
|
||||
|
||||
if (sync || nowKCD != Main.AllPlayerKillCooldown[killer.PlayerId])
|
||||
@@ -397,7 +397,7 @@ internal static class FFAManager
|
||||
bool FFAdoTP = false;
|
||||
if (FFAdoTPdecider == 0) FFAdoTP = true;
|
||||
|
||||
if (FFA_EnableRandomTwists.GetBool() && FFAdoTP)
|
||||
if (FFAEnableRandomTwists.GetBool() && FFAdoTP)
|
||||
{
|
||||
Logger.Info("Swap everyone with someone", "FFA");
|
||||
|
||||
@@ -439,7 +439,7 @@ internal static class FFAManager
|
||||
|
||||
bool sync = false;
|
||||
|
||||
if (FFADecreasedSpeedList.TryGetValue(pc.PlayerId, out var dstime) && dstime + FFA_ModifiedSpeedDuration.GetInt() < now)
|
||||
if (FFADecreasedSpeedList.TryGetValue(pc.PlayerId, out var dstime) && dstime + FFAModifiedSpeedDuration.GetInt() < now)
|
||||
{
|
||||
Logger.Info(pc.GetRealName() + "'s decreased speed expired", "FFA");
|
||||
FFADecreasedSpeedList.Remove(pc.PlayerId);
|
||||
@@ -448,7 +448,7 @@ internal static class FFAManager
|
||||
sync = true;
|
||||
}
|
||||
|
||||
if (FFAIncreasedSpeedList.TryGetValue(pc.PlayerId, out var istime) && istime + FFA_ModifiedSpeedDuration.GetInt() < now)
|
||||
if (FFAIncreasedSpeedList.TryGetValue(pc.PlayerId, out var istime) && istime + FFAModifiedSpeedDuration.GetInt() < now)
|
||||
{
|
||||
Logger.Info(pc.GetRealName() + "'s increased speed expired", "FFA");
|
||||
FFAIncreasedSpeedList.Remove(pc.PlayerId);
|
||||
@@ -457,14 +457,14 @@ internal static class FFAManager
|
||||
sync = true;
|
||||
}
|
||||
|
||||
if (FFALowerVisionList.TryGetValue(pc.PlayerId, out var lvtime) && lvtime + FFA_ModifiedSpeedDuration.GetInt() < now)
|
||||
if (FFALowerVisionList.TryGetValue(pc.PlayerId, out var lvtime) && lvtime + FFAModifiedSpeedDuration.GetInt() < now)
|
||||
{
|
||||
Logger.Info(pc.GetRealName() + "'s lower vision effect expired", "FFA");
|
||||
FFALowerVisionList.Remove(pc.PlayerId);
|
||||
sync = true;
|
||||
}
|
||||
|
||||
if (FFAShieldedList.TryGetValue(pc.PlayerId, out var stime) && stime + FFA_ShieldDuration.GetInt() < now)
|
||||
if (FFAShieldedList.TryGetValue(pc.PlayerId, out var stime) && stime + FFAShieldDuration.GetInt() < now)
|
||||
{
|
||||
Logger.Info(pc.GetRealName() + "'s shield expired", "FFA");
|
||||
FFAShieldedList.Remove(pc.PlayerId);
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace EHR
|
||||
|
||||
DefaultSpeed = Main.AllPlayerSpeed[0];
|
||||
|
||||
if (Chat.GetBool()) _ = new LateTask(Utils.SetChatVisible, 10f, "Set Chat Visible for Everyone");
|
||||
if (Chat.GetBool()) _ = new LateTask(Utils.SetChatVisible, 12f, "Set Chat Visible for Everyone");
|
||||
}
|
||||
|
||||
public static void OnGameStart()
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Counter(int totalGreenTime, int totalRedTime, long startTimeStamp,
|
||||
}
|
||||
|
||||
private static int TotalYellowTime => 3;
|
||||
private static Color32 Orange => new(255, 165, 0, 255);
|
||||
private static Color Orange => new(255, 165, 0, 255);
|
||||
|
||||
public int Timer
|
||||
{
|
||||
@@ -62,7 +62,7 @@ public class Counter(int totalGreenTime, int totalRedTime, long startTimeStamp,
|
||||
|
||||
public string ColoredTimerString
|
||||
{
|
||||
get => IsYellow ? Utils.ColorString(Color.black, "00") : Utils.ColorString(IsRed ? Color.red : Color.green, Timer < 10 ? $"0{Timer}" : Timer.ToString());
|
||||
get => IsYellow ? Utils.ColorString(Color.clear, "00") : Utils.ColorString(IsRed ? Color.red : Color.green, Timer < 10 ? $"0{Timer}" : Timer.ToString());
|
||||
}
|
||||
|
||||
public string ColoredArrow
|
||||
@@ -74,20 +74,26 @@ public class Counter(int totalGreenTime, int totalRedTime, long startTimeStamp,
|
||||
{
|
||||
if (Timer <= 0)
|
||||
{
|
||||
if (!IsRed && !IsYellow) // Change from green to yellow
|
||||
switch (IsRed)
|
||||
{
|
||||
IsYellow = true;
|
||||
}
|
||||
else if (IsRed && !IsYellow) // Change from red to green
|
||||
{
|
||||
TotalGreenTime = MoveAndStop ? MoveAndStopManager.RandomGreenTime(Symbol) : Asthmatic.RandomGreenTime();
|
||||
IsRed = false;
|
||||
}
|
||||
else if (IsYellow && !IsRed) // Change from yellow to red
|
||||
{
|
||||
TotalRedTime = MoveAndStop ? MoveAndStopManager.RandomRedTime(Symbol) : Asthmatic.RandomRedTime();
|
||||
IsYellow = false;
|
||||
IsRed = true;
|
||||
// Change from green to yellow
|
||||
case false when !IsYellow:
|
||||
IsYellow = true;
|
||||
break;
|
||||
// Change from red to green
|
||||
case true when !IsYellow:
|
||||
TotalGreenTime = MoveAndStop ? MoveAndStopManager.RandomGreenTime(Symbol) : Asthmatic.RandomGreenTime();
|
||||
IsRed = false;
|
||||
break;
|
||||
default:
|
||||
if (IsYellow && !IsRed) // Change from yellow to red
|
||||
{
|
||||
TotalRedTime = MoveAndStop ? MoveAndStopManager.RandomRedTime(Symbol) : Asthmatic.RandomRedTime();
|
||||
IsYellow = false;
|
||||
IsRed = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
StartTimeStamp = Utils.TimeStamp;
|
||||
@@ -95,7 +101,7 @@ public class Counter(int totalGreenTime, int totalRedTime, long startTimeStamp,
|
||||
}
|
||||
}
|
||||
|
||||
class MoveAndStopPlayerData(Counter leftCounter, Counter middleCounter, Counter rightCounter, float position_x, float position_y)
|
||||
class MoveAndStopPlayerData(Counter leftCounter, Counter middleCounter, Counter rightCounter, float positionX, float positionY)
|
||||
{
|
||||
public Counter LeftCounter
|
||||
{
|
||||
@@ -115,16 +121,16 @@ class MoveAndStopPlayerData(Counter leftCounter, Counter middleCounter, Counter
|
||||
set => rightCounter = value;
|
||||
}
|
||||
|
||||
public float Position_X
|
||||
public float PositionX
|
||||
{
|
||||
get => position_x;
|
||||
set => position_x = value;
|
||||
get => positionX;
|
||||
set => positionX = value;
|
||||
}
|
||||
|
||||
public float Position_Y
|
||||
public float PositionY
|
||||
{
|
||||
get => position_y;
|
||||
set => position_y = value;
|
||||
get => positionY;
|
||||
set => positionY = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -152,13 +158,8 @@ internal class MoveAndStopManager
|
||||
private static Dictionary<byte, MoveAndStopPlayerData> AllPlayerTimers = [];
|
||||
|
||||
private static IRandom Random => IRandom.Instance;
|
||||
private static int roundTime;
|
||||
|
||||
public static int RoundTime
|
||||
{
|
||||
get => roundTime;
|
||||
set => roundTime = value;
|
||||
}
|
||||
public static int RoundTime { get; set; }
|
||||
|
||||
private static int StartingGreenTime => (MapNames)Main.NormalOptions.MapId == MapNames.Airship ? 25 : 20;
|
||||
|
||||
@@ -263,7 +264,6 @@ internal class MoveAndStopManager
|
||||
_ = new LateTask(() => { FixedUpdatePatch.DoChecks = true; }, 10f, log: false);
|
||||
|
||||
long now = Utils.TimeStamp;
|
||||
float limit;
|
||||
|
||||
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
|
||||
{
|
||||
@@ -273,11 +273,12 @@ internal class MoveAndStopManager
|
||||
new(StartingGreenTime, RandomRedTime('→'), now, '→', false),
|
||||
pc.Pos().x, pc.Pos().y));
|
||||
|
||||
float limit;
|
||||
try
|
||||
{
|
||||
limit = pc.GetClient().PlatformData.Platform is Platforms.Unknown or Platforms.IPhone or Platforms.Android or Platforms.Switch or Platforms.Xbox or Platforms.Playstation
|
||||
? 2f // If the player has a joystick, the game is a lot harder
|
||||
: 0.5f; // On PC you have WASD, you can't mess up
|
||||
: 0.5f; // On PC, you have WASD, you can't mess up
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -322,12 +323,12 @@ internal class MoveAndStopManager
|
||||
|
||||
if (AllPlayerTimers.TryGetValue(pc.PlayerId, out var data))
|
||||
{
|
||||
Vector2 previousPosition = new(data.Position_X, data.Position_Y);
|
||||
Vector2 previousPosition = new(data.PositionX, data.PositionY);
|
||||
|
||||
// Update the player's position
|
||||
Vector2 currentPosition = pc.transform.position;
|
||||
currentPosition.x += data.Position_X * Time.deltaTime;
|
||||
currentPosition.y += data.Position_Y * Time.deltaTime;
|
||||
currentPosition.x += data.PositionX * Time.deltaTime;
|
||||
currentPosition.y += data.PositionY * Time.deltaTime;
|
||||
|
||||
// Calculate the direction of movement
|
||||
Vector2 direction = currentPosition - previousPosition;
|
||||
@@ -341,46 +342,55 @@ internal class MoveAndStopManager
|
||||
|
||||
float limit = Limit.GetValueOrDefault(pc.PlayerId, 2f);
|
||||
|
||||
// Now we can check the components of the direction vector to determine the movement direction
|
||||
if (direction.x > 0) // Player is moving right
|
||||
switch (direction.x)
|
||||
{
|
||||
if (data.RightCounter.IsRed && distanceX > limit) // If: Right counter is red && player moved more than their limit
|
||||
// Now we can check the components of the direction vector to determine the movement direction
|
||||
// Player is moving right
|
||||
case > 0:
|
||||
{
|
||||
pc.Suicide(); // Player suicides
|
||||
goto End; // Skip the upcoming checks, the player is already dead
|
||||
}
|
||||
switch (data.RightCounter.IsRed)
|
||||
{
|
||||
// If: Right counter is red && player moved more than their limit
|
||||
case true when distanceX > limit:
|
||||
pc.Suicide(); // Player suicides
|
||||
goto End; // Skip the upcoming checks, the player is already dead
|
||||
// Else If: Right counter is yellow or green
|
||||
case false:
|
||||
data.PositionX = currentPosition.x; // Update the player's last position regardless of the distance
|
||||
break;
|
||||
}
|
||||
|
||||
if (!data.RightCounter.IsRed) // Else If: Right counter is yellow or green
|
||||
{
|
||||
data.Position_X = currentPosition.x; // Update the player's last position regardless of the distance
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (direction.x < 0) // Player is moving left
|
||||
{
|
||||
if (data.LeftCounter.IsRed && distanceX < -limit) // The distance is negative here because it's the opposite direction as right
|
||||
// Player is moving left
|
||||
case < 0:
|
||||
{
|
||||
pc.Suicide();
|
||||
goto End;
|
||||
}
|
||||
switch (data.LeftCounter.IsRed)
|
||||
{
|
||||
// The distance is negative here because it's the opposite direction as right
|
||||
case true when distanceX < -limit:
|
||||
pc.Suicide();
|
||||
goto End;
|
||||
case false:
|
||||
data.PositionX = currentPosition.x;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!data.LeftCounter.IsRed)
|
||||
{
|
||||
data.Position_X = currentPosition.x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (direction.y is > 0 or < 0) // y > 0 means the player is moving up, y < 0 means the player is moving down
|
||||
{
|
||||
if (data.MiddleCounter.IsRed && (distanceY > limit || distanceY < -limit)) // The player dies if either they moved up OR down too far
|
||||
switch (data.MiddleCounter.IsRed)
|
||||
{
|
||||
pc.Suicide();
|
||||
goto End;
|
||||
}
|
||||
|
||||
if (!data.MiddleCounter.IsRed)
|
||||
{
|
||||
data.Position_Y = currentPosition.y;
|
||||
// The player dies if either they moved up OR down too far
|
||||
case true when (distanceY > limit || distanceY < -limit):
|
||||
pc.Suicide();
|
||||
goto End;
|
||||
case false:
|
||||
data.PositionY = currentPosition.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace EHR.Modules
|
||||
{
|
||||
internal static class CustomTeamManager
|
||||
{
|
||||
internal class CustomTeam
|
||||
{
|
||||
public readonly string RoleRevealScreenTitle;
|
||||
public readonly string RoleRevealScreenSubtitle;
|
||||
public readonly string RoleRevealScreenBackgroundColor;
|
||||
public readonly string TeamName;
|
||||
|
||||
public List<CustomRoles> TeamMembers { get; set; } = [];
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is not CustomTeam team) return false;
|
||||
return TeamName == team.TeamName;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => TeamName.GetHashCode();
|
||||
|
||||
public CustomTeam(string line)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] parts = line.Split(';');
|
||||
|
||||
TeamName = parts[0];
|
||||
RoleRevealScreenTitle = parts[1];
|
||||
RoleRevealScreenSubtitle = parts[2];
|
||||
RoleRevealScreenBackgroundColor = parts[3];
|
||||
|
||||
TeamMembers = parts[4].Split(',').Select(x => Enum.Parse<CustomRoles>(x, true)).ToList();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.ThrowException(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CustomTeams.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static HashSet<CustomTeam> CustomTeams = [];
|
||||
public static CustomTeam WinnerTeam;
|
||||
|
||||
public static void LoadCustomTeams()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists("./EHR_DATA/CTA_Data.txt")) return;
|
||||
|
||||
CustomTeams.Clear();
|
||||
// ReSharper disable once ObjectCreationAsStatement
|
||||
#pragma warning disable CA1806
|
||||
File.ReadAllLines("./EHR_DATA/CTA_Data.txt").Do(x => new CustomTeam(x));
|
||||
#pragma warning restore CA1806
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.ThrowException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckCustomTeamGameEnd()
|
||||
{
|
||||
if (CustomTeams.Count == 0) return false;
|
||||
|
||||
var alivePlayerRoles = Main.PlayerStates
|
||||
.IntersectBy(Main.AllAlivePlayerControls.Select(x => x.PlayerId), x => x.Key)
|
||||
.ToDictionary(x => x.Key, x => x.Value.MainRole);
|
||||
|
||||
var customTeams = alivePlayerRoles
|
||||
.GroupBy(x => CustomTeams.FirstOrDefault(t => t.TeamMembers.Contains(alivePlayerRoles[x.Key])), x => x.Key)
|
||||
.ToDictionary(x => x.Key, x => x.ToHashSet());
|
||||
|
||||
if (customTeams.Count == 1)
|
||||
{
|
||||
WinnerTeam = customTeams.Keys.First();
|
||||
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.CustomTeam);
|
||||
CustomWinnerHolder.WinnerIds = customTeams.Values.First();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static CustomTeam GetCustomTeam(byte id) => CustomTeams.FirstOrDefault(x => x.TeamMembers.Contains(Main.PlayerStates[id].MainRole));
|
||||
|
||||
public static bool AreInSameCustomTeam(byte id1, byte id2)
|
||||
{
|
||||
if (CustomTeams.Count == 0) return false;
|
||||
|
||||
var team1 = GetCustomTeam(id1);
|
||||
var team2 = GetCustomTeam(id2);
|
||||
|
||||
return team1 != null && team2 != null && team1.Equals(team2);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -14,7 +14,7 @@ class Webhook
|
||||
{
|
||||
public static void Send(string text)
|
||||
{
|
||||
if (Main.WebhookURL.Value == "none") return;
|
||||
if (Main.WebhookUrl.Value == "none") return;
|
||||
HttpClient httpClient = new();
|
||||
Dictionary<string, string> strs = new()
|
||||
{
|
||||
@@ -23,7 +23,7 @@ class Webhook
|
||||
{ "avatar_url", "https://npm.elemecdn.com/hexo-static@1.0.1/img/avatar.webp" }
|
||||
};
|
||||
TaskAwaiter<HttpResponseMessage> awaiter = httpClient.PostAsync(
|
||||
Main.WebhookURL.Value, new FormUrlEncodedContent(strs)).GetAwaiter();
|
||||
Main.WebhookUrl.Value, new FormUrlEncodedContent(strs)).GetAwaiter();
|
||||
awaiter.GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@ static class ExtendedPlayerControl
|
||||
Main.AllPlayerKillCooldown[player.PlayerId] = player.GetCustomRole() switch
|
||||
{
|
||||
CustomRoles.KB_Normal => SoloKombatManager.KB_ATKCooldown.GetFloat(),
|
||||
CustomRoles.Killer => FFAManager.FFA_KCD.GetFloat(),
|
||||
CustomRoles.Killer => FFAManager.FFAKcd.GetFloat(),
|
||||
_ => Main.AllPlayerKillCooldown[player.PlayerId]
|
||||
};
|
||||
if (player.PlayerId == LastImpostor.currentId)
|
||||
@@ -872,7 +872,8 @@ static class ExtendedPlayerControl
|
||||
DestroyableSingleton<HudManager>.Instance.OpenMeetingRoom(reporter);
|
||||
reporter.RpcStartMeeting(target);
|
||||
}
|
||||
public static bool IsModClient(this PlayerControl player) => Main.playerVersion.ContainsKey(player.PlayerId);
|
||||
|
||||
public static bool IsModClient(this PlayerControl player) => Main.PlayerVersion.ContainsKey(player.PlayerId);
|
||||
|
||||
public static List<PlayerControl> GetPlayersInAbilityRangeSorted(this PlayerControl player, bool ignoreColliders = false) => GetPlayersInAbilityRangeSorted(player, _ => true, ignoreColliders);
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ public class PlayerGameOptionsSender(PlayerControl player) : GameOptionsSender
|
||||
if (FFAManager.FFALowerVisionList.ContainsKey(player.PlayerId))
|
||||
{
|
||||
opt.SetVision(true);
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, FFAManager.FFA_LowerVision.GetFloat());
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, FFAManager.FFA_LowerVision.GetFloat());
|
||||
opt.SetFloat(FloatOptionNames.CrewLightMod, FFAManager.FFALowerVision.GetFloat());
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, FFAManager.FFALowerVision.GetFloat());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ModUpdater
|
||||
InfoPopup.TextAreaTMP.GetComponent<RectTransform>().sizeDelta = new(2.5f, 2f);
|
||||
if (!isChecked)
|
||||
{
|
||||
bool done = CheckReleaseFromGithub(Main.BetaBuildURL.Value != "").GetAwaiter().GetResult();
|
||||
bool done = CheckReleaseFromGithub(Main.BetaBuildUrl.Value != "").GetAwaiter().GetResult();
|
||||
Logger.Warn("done: " + done, "CheckRelease");
|
||||
Logger.Info("hasupdate: " + hasUpdate, "CheckRelease");
|
||||
Logger.Info("forceupdate: " + forceUpdate, "CheckRelease");
|
||||
@@ -108,8 +108,8 @@ public class ModUpdater
|
||||
}
|
||||
}
|
||||
|
||||
hasUpdate = latestVersion.CompareTo(Main.version) > 0;
|
||||
hasOutdate = latestVersion.CompareTo(Main.version) < 0;
|
||||
hasUpdate = latestVersion.CompareTo(Main.Version) > 0;
|
||||
hasOutdate = latestVersion.CompareTo(Main.Version) < 0;
|
||||
}
|
||||
|
||||
Logger.Info("hasupdate: " + hasUpdate, "GitHub");
|
||||
|
||||
+51
-48
@@ -56,25 +56,28 @@ public static class NameColorManager
|
||||
if (Stained.VioletNameList.Contains(target.PlayerId)) color = "#ff00ff";
|
||||
|
||||
// Impostors and Madmates
|
||||
if (seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoleTypes.Impostor)) color = (target.Is(CustomRoles.Egoist) && Options.ImpEgoistVisibalToAllies.GetBool() && seer != target) ? Main.roleColors[CustomRoles.Egoist] : Main.ImpostorColor;
|
||||
if (seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoleTypes.Impostor)) color = (target.Is(CustomRoles.Egoist) && Options.ImpEgoistVisibalToAllies.GetBool() && seer != target) ? Main.RoleColors[CustomRoles.Egoist] : Main.ImpostorColor;
|
||||
if (seer.Is(CustomRoles.Madmate) && target.Is(CustomRoleTypes.Impostor) && Options.MadmateKnowWhosImp.GetBool()) color = Main.ImpostorColor;
|
||||
if (seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Madmate) && Options.ImpKnowWhosMadmate.GetBool()) color = Main.roleColors[CustomRoles.Madmate];
|
||||
if (seer.Is(CustomRoles.Madmate) && target.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool()) color = Main.roleColors[CustomRoles.Madmate];
|
||||
if (Blackmailer.On && Main.PlayerStates[seer.PlayerId].Role is Blackmailer { IsEnable: true } bm && bm.BlackmailedPlayerId == target.PlayerId) color = Main.roleColors[CustomRoles.Electric];
|
||||
if (seer.Is(CustomRoleTypes.Impostor) && target.Is(CustomRoles.Madmate) && Options.ImpKnowWhosMadmate.GetBool()) color = Main.RoleColors[CustomRoles.Madmate];
|
||||
if (seer.Is(CustomRoles.Madmate) && target.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosMadmate.GetBool()) color = Main.RoleColors[CustomRoles.Madmate];
|
||||
if (Blackmailer.On && Main.PlayerStates[seer.PlayerId].Role is Blackmailer { IsEnable: true } bm && bm.BlackmailedPlayerId == target.PlayerId) color = Main.RoleColors[CustomRoles.Electric];
|
||||
if (Commander.On && seer.Is(Team.Impostor))
|
||||
{
|
||||
if (Commander.PlayerList.Any(x => x.MarkedPlayer == target.PlayerId)) color = Main.roleColors[CustomRoles.Sprayer];
|
||||
if (Commander.PlayerList.Any(x => x.MarkedPlayer == target.PlayerId)) color = Main.RoleColors[CustomRoles.Sprayer];
|
||||
if (Commander.PlayerList.Any(x => x.DontKillMarks.Contains(target.PlayerId))) color = "#0daeff";
|
||||
}
|
||||
|
||||
// Custom Teams
|
||||
if (CustomTeamManager.AreInSameCustomTeam(seer.PlayerId, target.PlayerId)) color = Main.RoleColors[target.GetCustomRole()];
|
||||
|
||||
// Add-ons
|
||||
if (seer.Is(CustomRoles.Rogue) && target.Is(CustomRoles.Rogue) && Options.RogueKnowEachOther.GetBool()) color = Main.roleColors[CustomRoles.Rogue];
|
||||
if (seer.Is(CustomRoles.Recruit) && target.Is(CustomRoles.Recruit) && Options.SidekickKnowOtherSidekick.GetBool()) color = Main.roleColors[CustomRoles.Jackal];
|
||||
if (target.Is(CustomRoles.Glow) && Utils.IsActive(SystemTypes.Electrical)) color = Main.roleColors[CustomRoles.Glow];
|
||||
if (target.Is(CustomRoles.Mare) && Utils.IsActive(SystemTypes.Electrical) && !isMeeting) color = Main.roleColors[CustomRoles.Mare];
|
||||
if (seer.Is(CustomRoles.Contagious) && target.Is(CustomRoles.Contagious) && Virus.TargetKnowOtherTarget.GetBool()) color = Main.roleColors[CustomRoles.Virus];
|
||||
if (seer.Is(CustomRoles.Charmed) && target.Is(CustomRoles.Charmed) && Succubus.TargetKnowOtherTarget.GetBool()) color = Main.roleColors[CustomRoles.Charmed];
|
||||
if (seer.Is(CustomRoles.Undead) && target.Is(CustomRoles.Undead)) color = Main.roleColors[CustomRoles.Undead];
|
||||
if (seer.Is(CustomRoles.Rogue) && target.Is(CustomRoles.Rogue) && Options.RogueKnowEachOther.GetBool()) color = Main.RoleColors[CustomRoles.Rogue];
|
||||
if (seer.Is(CustomRoles.Recruit) && target.Is(CustomRoles.Recruit) && Options.SidekickKnowOtherSidekick.GetBool()) color = Main.RoleColors[CustomRoles.Jackal];
|
||||
if (target.Is(CustomRoles.Glow) && Utils.IsActive(SystemTypes.Electrical)) color = Main.RoleColors[CustomRoles.Glow];
|
||||
if (target.Is(CustomRoles.Mare) && Utils.IsActive(SystemTypes.Electrical) && !isMeeting) color = Main.RoleColors[CustomRoles.Mare];
|
||||
if (seer.Is(CustomRoles.Contagious) && target.Is(CustomRoles.Contagious) && Virus.TargetKnowOtherTarget.GetBool()) color = Main.RoleColors[CustomRoles.Virus];
|
||||
if (seer.Is(CustomRoles.Charmed) && target.Is(CustomRoles.Charmed) && Succubus.TargetKnowOtherTarget.GetBool()) color = Main.RoleColors[CustomRoles.Charmed];
|
||||
if (seer.Is(CustomRoles.Undead) && target.Is(CustomRoles.Undead)) color = Main.RoleColors[CustomRoles.Undead];
|
||||
|
||||
// Ghost roles
|
||||
if (GhostRolesManager.AssignedGhostRoles.TryGetValue(target.PlayerId, out var ghostRole))
|
||||
@@ -99,65 +102,65 @@ public static class NameColorManager
|
||||
// If 2 players have the same role and that role is a NK role, they can see each other's name color
|
||||
if (seerRole.IsNK() && seerRole == targetRole)
|
||||
{
|
||||
color = Main.roleColors[seerRole];
|
||||
color = Main.RoleColors[seerRole];
|
||||
}
|
||||
|
||||
// Specific seer-target role combinations (excluding NK roles)
|
||||
color = (seerRole, targetRole) switch
|
||||
{
|
||||
(CustomRoles.Necromancer, CustomRoles.Deathknight) => Main.roleColors[CustomRoles.Deathknight],
|
||||
(CustomRoles.Deathknight, CustomRoles.Necromancer) => Main.roleColors[CustomRoles.Necromancer],
|
||||
(CustomRoles.Deathknight, CustomRoles.Deathknight) => Main.roleColors[CustomRoles.Deathknight],
|
||||
(CustomRoles.Necromancer, CustomRoles.Deathknight) => Main.RoleColors[CustomRoles.Deathknight],
|
||||
(CustomRoles.Deathknight, CustomRoles.Necromancer) => Main.RoleColors[CustomRoles.Necromancer],
|
||||
(CustomRoles.Deathknight, CustomRoles.Deathknight) => Main.RoleColors[CustomRoles.Deathknight],
|
||||
_ => color,
|
||||
};
|
||||
|
||||
// Check if the seer can see the target's role color
|
||||
color = seerRole switch
|
||||
{
|
||||
CustomRoles.Gangster when target.Is(CustomRoles.Madmate) => Main.roleColors[CustomRoles.Madmate],
|
||||
CustomRoles.Gangster when target.Is(CustomRoles.Madmate) => Main.RoleColors[CustomRoles.Madmate],
|
||||
CustomRoles.Crewpostor when target.Is(CustomRoleTypes.Impostor) && Options.CrewpostorKnowsAllies.GetBool() => Main.ImpostorColor,
|
||||
CustomRoles.Succubus when target.Is(CustomRoles.Charmed) => Main.roleColors[CustomRoles.Charmed],
|
||||
CustomRoles.Necromancer or CustomRoles.Deathknight when target.Is(CustomRoles.Undead) => Main.roleColors[CustomRoles.Undead],
|
||||
CustomRoles.Necromancer or CustomRoles.Deathknight when Necromancer.PartiallyRecruitedIds.Contains(target.PlayerId) => Main.roleColors[CustomRoles.Deathknight],
|
||||
CustomRoles.Virus when target.Is(CustomRoles.Contagious) => Main.roleColors[CustomRoles.Contagious],
|
||||
CustomRoles.Monarch when target.Is(CustomRoles.Knighted) => Main.roleColors[CustomRoles.Knighted],
|
||||
CustomRoles.Spiritcaller when target.Is(CustomRoles.EvilSpirit) => Main.roleColors[CustomRoles.EvilSpirit],
|
||||
CustomRoles.Sidekick when target.Is(CustomRoles.Sidekick) && Options.SidekickKnowOtherSidekick.GetBool() => Main.roleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Sidekick when target.Is(CustomRoles.Recruit) && Options.SidekickKnowOtherSidekick.GetBool() => Main.roleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Jackal when target.Is(CustomRoles.Recruit) => Main.roleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Refugee when target.Is(CustomRoleTypes.Impostor) => Main.roleColors[CustomRoles.ImpostorTOHE],
|
||||
CustomRoles.Succubus when target.Is(CustomRoles.Charmed) => Main.RoleColors[CustomRoles.Charmed],
|
||||
CustomRoles.Necromancer or CustomRoles.Deathknight when target.Is(CustomRoles.Undead) => Main.RoleColors[CustomRoles.Undead],
|
||||
CustomRoles.Necromancer or CustomRoles.Deathknight when Necromancer.PartiallyRecruitedIds.Contains(target.PlayerId) => Main.RoleColors[CustomRoles.Deathknight],
|
||||
CustomRoles.Virus when target.Is(CustomRoles.Contagious) => Main.RoleColors[CustomRoles.Contagious],
|
||||
CustomRoles.Monarch when target.Is(CustomRoles.Knighted) => Main.RoleColors[CustomRoles.Knighted],
|
||||
CustomRoles.Spiritcaller when target.Is(CustomRoles.EvilSpirit) => Main.RoleColors[CustomRoles.EvilSpirit],
|
||||
CustomRoles.Sidekick when target.Is(CustomRoles.Sidekick) && Options.SidekickKnowOtherSidekick.GetBool() => Main.RoleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Sidekick when target.Is(CustomRoles.Recruit) && Options.SidekickKnowOtherSidekick.GetBool() => Main.RoleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Jackal when target.Is(CustomRoles.Recruit) => Main.RoleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Refugee when target.Is(CustomRoleTypes.Impostor) => Main.RoleColors[CustomRoles.ImpostorTOHE],
|
||||
CustomRoles.HeadHunter when ((HeadHunter)Main.PlayerStates[seer.PlayerId].Role).Targets.Contains(target.PlayerId) => "000000",
|
||||
CustomRoles.BountyHunter when (Main.PlayerStates[seer.PlayerId].Role as BountyHunter)?.GetTarget(seer) == target.PlayerId => "000000",
|
||||
CustomRoles.Pyromaniac when ((Pyromaniac)Main.PlayerStates[seer.PlayerId].Role).DousedList.Contains(target.PlayerId) => "#BA4A00",
|
||||
CustomRoles.Glitch when Glitch.hackedIdList.ContainsKey(target.PlayerId) => Main.roleColors[CustomRoles.Glitch],
|
||||
CustomRoles.Escort when Glitch.hackedIdList.ContainsKey(target.PlayerId) => Main.roleColors[CustomRoles.Escort],
|
||||
CustomRoles.Consort when Glitch.hackedIdList.ContainsKey(target.PlayerId) => Main.roleColors[CustomRoles.Glitch],
|
||||
CustomRoles.Aid when Aid.ShieldedPlayers.ContainsKey(target.PlayerId) => Main.roleColors[CustomRoles.Aid],
|
||||
CustomRoles.Glitch when Glitch.hackedIdList.ContainsKey(target.PlayerId) => Main.RoleColors[CustomRoles.Glitch],
|
||||
CustomRoles.Escort when Glitch.hackedIdList.ContainsKey(target.PlayerId) => Main.RoleColors[CustomRoles.Escort],
|
||||
CustomRoles.Consort when Glitch.hackedIdList.ContainsKey(target.PlayerId) => Main.RoleColors[CustomRoles.Glitch],
|
||||
CustomRoles.Aid when Aid.ShieldedPlayers.ContainsKey(target.PlayerId) => Main.RoleColors[CustomRoles.Aid],
|
||||
CustomRoles.Spy when Spy.SpyRedNameList.ContainsKey(target.PlayerId) => "#BA4A00",
|
||||
CustomRoles.Mastermind when Mastermind.ManipulateDelays.ContainsKey(target.PlayerId) => "#00ffa5",
|
||||
CustomRoles.Mastermind when Mastermind.ManipulatedPlayers.ContainsKey(target.PlayerId) => Main.roleColors[CustomRoles.Arsonist],
|
||||
CustomRoles.Mastermind when Mastermind.ManipulatedPlayers.ContainsKey(target.PlayerId) => Main.RoleColors[CustomRoles.Arsonist],
|
||||
CustomRoles.Hitman when (Main.PlayerStates[seer.PlayerId].Role as Hitman)?.TargetId == target.PlayerId => "000000",
|
||||
CustomRoles.Postman when (Main.PlayerStates[seer.PlayerId].Role as Postman)?.Target == target.PlayerId => Main.roleColors[CustomRoles.Postman],
|
||||
CustomRoles.Mycologist when ((Mycologist)Main.PlayerStates[seer.PlayerId].Role).InfectedPlayers.Contains(target.PlayerId) => Main.roleColors[CustomRoles.Mycologist],
|
||||
CustomRoles.Bubble when Bubble.EncasedPlayers.ContainsKey(target.PlayerId) => Main.roleColors[CustomRoles.Bubble],
|
||||
CustomRoles.Hookshot when (Main.PlayerStates[seer.PlayerId].Role as Hookshot)?.MarkedPlayerId == target.PlayerId => Main.roleColors[CustomRoles.Hookshot],
|
||||
CustomRoles.SoulHunter when SoulHunter.IsSoulHunterTarget(target.PlayerId) => Main.roleColors[CustomRoles.SoulHunter],
|
||||
CustomRoles.Kamikaze when ((Kamikaze)Main.PlayerStates[seer.PlayerId].Role).MarkedPlayers.Contains(target.PlayerId) => Main.roleColors[CustomRoles.Electric],
|
||||
CustomRoles.Postman when (Main.PlayerStates[seer.PlayerId].Role as Postman)?.Target == target.PlayerId => Main.RoleColors[CustomRoles.Postman],
|
||||
CustomRoles.Mycologist when ((Mycologist)Main.PlayerStates[seer.PlayerId].Role).InfectedPlayers.Contains(target.PlayerId) => Main.RoleColors[CustomRoles.Mycologist],
|
||||
CustomRoles.Bubble when Bubble.EncasedPlayers.ContainsKey(target.PlayerId) => Main.RoleColors[CustomRoles.Bubble],
|
||||
CustomRoles.Hookshot when (Main.PlayerStates[seer.PlayerId].Role as Hookshot)?.MarkedPlayerId == target.PlayerId => Main.RoleColors[CustomRoles.Hookshot],
|
||||
CustomRoles.SoulHunter when SoulHunter.IsSoulHunterTarget(target.PlayerId) => Main.RoleColors[CustomRoles.SoulHunter],
|
||||
CustomRoles.Kamikaze when ((Kamikaze)Main.PlayerStates[seer.PlayerId].Role).MarkedPlayers.Contains(target.PlayerId) => Main.RoleColors[CustomRoles.Electric],
|
||||
_ => color,
|
||||
};
|
||||
|
||||
// Check if the target can see the seer's role color
|
||||
color = targetRole switch
|
||||
{
|
||||
CustomRoles.Sidekick when seer.Is(CustomRoles.Recruit) && Options.SidekickKnowOtherSidekick.GetBool() => Main.roleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Jackal when seer.Is(CustomRoles.Recruit) => Main.roleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Virus when seer.Is(CustomRoles.Contagious) => Main.roleColors[CustomRoles.Virus],
|
||||
CustomRoles.Refugee when seer.Is(CustomRoleTypes.Impostor) => Main.roleColors[CustomRoles.Refugee],
|
||||
CustomRoles.Speedrunner when !seer.Is(Team.Crewmate) && target.GetTaskState().CompletedTasksCount >= Options.SpeedrunnerNotifyAtXTasksLeft.GetInt() && Options.SpeedrunnerNotifyKillers.GetBool() => Main.roleColors[CustomRoles.Speedrunner],
|
||||
CustomRoles.SoulHunter when SoulHunter.IsSoulHunterTarget(seer.PlayerId) => Main.roleColors[CustomRoles.SoulHunter],
|
||||
CustomRoles.Necromancer or CustomRoles.Deathknight when seer.Is(CustomRoles.Undead) => Main.roleColors[targetRole],
|
||||
CustomRoles.Succubus when seer.Is(CustomRoles.Charmed) => Main.roleColors[CustomRoles.Succubus],
|
||||
CustomRoles.Crewpostor when seer.Is(CustomRoleTypes.Impostor) && Options.AlliesKnowCrewpostor.GetBool() => Main.roleColors[CustomRoles.Madmate],
|
||||
CustomRoles.Sidekick when seer.Is(CustomRoles.Recruit) && Options.SidekickKnowOtherSidekick.GetBool() => Main.RoleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Jackal when seer.Is(CustomRoles.Recruit) => Main.RoleColors[CustomRoles.Jackal],
|
||||
CustomRoles.Virus when seer.Is(CustomRoles.Contagious) => Main.RoleColors[CustomRoles.Virus],
|
||||
CustomRoles.Refugee when seer.Is(CustomRoleTypes.Impostor) => Main.RoleColors[CustomRoles.Refugee],
|
||||
CustomRoles.Speedrunner when !seer.Is(Team.Crewmate) && target.GetTaskState().CompletedTasksCount >= Options.SpeedrunnerNotifyAtXTasksLeft.GetInt() && Options.SpeedrunnerNotifyKillers.GetBool() => Main.RoleColors[CustomRoles.Speedrunner],
|
||||
CustomRoles.SoulHunter when SoulHunter.IsSoulHunterTarget(seer.PlayerId) => Main.RoleColors[CustomRoles.SoulHunter],
|
||||
CustomRoles.Necromancer or CustomRoles.Deathknight when seer.Is(CustomRoles.Undead) => Main.RoleColors[targetRole],
|
||||
CustomRoles.Succubus when seer.Is(CustomRoles.Charmed) => Main.RoleColors[CustomRoles.Succubus],
|
||||
CustomRoles.Crewpostor when seer.Is(CustomRoleTypes.Impostor) && Options.AlliesKnowCrewpostor.GetBool() => Main.RoleColors[CustomRoles.Madmate],
|
||||
_ => color
|
||||
};
|
||||
|
||||
@@ -185,7 +188,7 @@ public static class NameColorManager
|
||||
}
|
||||
|
||||
// Global (important)
|
||||
if (Bubble.EncasedPlayers.TryGetValue(target.PlayerId, out var ts) && ((ts + Bubble.NotifyDelay.GetInt() < Utils.TimeStamp) || seer.Is(CustomRoles.Bubble))) color = Main.roleColors[CustomRoles.Bubble];
|
||||
if (Bubble.EncasedPlayers.TryGetValue(target.PlayerId, out var ts) && ((ts + Bubble.NotifyDelay.GetInt() < Utils.TimeStamp) || seer.Is(CustomRoles.Bubble))) color = Main.RoleColors[CustomRoles.Bubble];
|
||||
|
||||
// If the color was determined, return true, else, check if the seer can see the target's role color without knowing the color
|
||||
if (color != "") return true;
|
||||
|
||||
@@ -350,6 +350,8 @@ 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;
|
||||
@@ -357,7 +359,6 @@ public static class Options
|
||||
public static OptionItem AirshipChance;
|
||||
public static OptionItem FungleChance;
|
||||
|
||||
// UNDERDOG
|
||||
public static OptionItem UnderdogKillCooldown;
|
||||
public static OptionItem UnderdogMaximumPlayersNeededToKill;
|
||||
public static OptionItem UnderdogKillCooldownWithMorePlayersAlive;
|
||||
@@ -2155,6 +2156,10 @@ 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)
|
||||
.SetColor(new Color32(217, 218, 255, byte.MaxValue));
|
||||
@@ -2197,10 +2202,6 @@ public static class Options
|
||||
CustomRoleCounts.Add(role, countOption);
|
||||
}
|
||||
|
||||
private static void SetupLoversRoleOptionsToggle(int id, CustomGameMode customGameMode = CustomGameMode.Standard)
|
||||
{
|
||||
}
|
||||
|
||||
public static void SetupAdtRoleOptions(int id, CustomRoles role, CustomGameMode customGameMode = CustomGameMode.Standard, bool canSetNum = false, TabGroup tab = TabGroup.Addons, bool canSetChance = true)
|
||||
{
|
||||
var spawnOption = StringOptionItem.Create(id, role.ToString(), ratesZeroOne, 0, tab, false).SetColor(Utils.GetRoleColor(role))
|
||||
|
||||
+9
-9
@@ -247,12 +247,12 @@ internal class RPCHandlerPatch
|
||||
Version version = Version.Parse(reader.ReadString());
|
||||
string tag = reader.ReadString();
|
||||
string forkId = reader.ReadString();
|
||||
Main.playerVersion[__instance.PlayerId] = new(version, tag, forkId);
|
||||
Main.PlayerVersion[__instance.PlayerId] = new(version, tag, forkId);
|
||||
|
||||
if (Main.VersionCheat.Value && __instance.PlayerId == 0) RPC.RpcVersionCheck();
|
||||
|
||||
if (Main.VersionCheat.Value && AmongUsClient.Instance.AmHost)
|
||||
Main.playerVersion[__instance.PlayerId] = Main.playerVersion[0];
|
||||
Main.PlayerVersion[__instance.PlayerId] = Main.PlayerVersion[0];
|
||||
|
||||
// Kick Unmached Player Start
|
||||
if (AmongUsClient.Instance.AmHost && tag != $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})")
|
||||
@@ -717,7 +717,7 @@ internal static class RPC
|
||||
if (targetId != -1)
|
||||
{
|
||||
var client = Utils.GetClientById(targetId);
|
||||
if (client == null || client.Character == null || !Main.playerVersion.ContainsKey(client.Character.PlayerId)) return;
|
||||
if (client == null || client.Character == null || !Main.PlayerVersion.ContainsKey(client.Character.PlayerId)) return;
|
||||
}
|
||||
|
||||
if (!AmongUsClient.Instance.AmHost || PlayerControl.AllPlayerControls.Count <= 1 || (AmongUsClient.Instance.AmHost == false && PlayerControl.LocalPlayer == null)) return;
|
||||
@@ -744,7 +744,7 @@ internal static class RPC
|
||||
if (targetId != -1)
|
||||
{
|
||||
var client = Utils.GetClientById(targetId);
|
||||
if (client == null || client.Character == null || !Main.playerVersion.ContainsKey(client.Character.PlayerId))
|
||||
if (client == null || client.Character == null || !Main.PlayerVersion.ContainsKey(client.Character.PlayerId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -841,17 +841,17 @@ internal static class RPC
|
||||
public static async void RpcVersionCheck()
|
||||
{
|
||||
while (PlayerControl.LocalPlayer == null) await Task.Delay(500);
|
||||
if (Main.playerVersion.ContainsKey(0) || !Main.VersionCheat.Value)
|
||||
if (Main.PlayerVersion.ContainsKey(0) || !Main.VersionCheat.Value)
|
||||
{
|
||||
bool cheating = Main.VersionCheat.Value;
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VersionCheck);
|
||||
writer.Write(cheating ? Main.playerVersion[0].version.ToString() : Main.PluginVersion);
|
||||
writer.Write(cheating ? Main.playerVersion[0].tag : $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})");
|
||||
writer.Write(cheating ? Main.playerVersion[0].forkId : Main.ForkId);
|
||||
writer.Write(cheating ? Main.PlayerVersion[0].version.ToString() : Main.PluginVersion);
|
||||
writer.Write(cheating ? Main.PlayerVersion[0].tag : $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})");
|
||||
writer.Write(cheating ? Main.PlayerVersion[0].forkId : Main.ForkId);
|
||||
writer.EndMessage();
|
||||
}
|
||||
|
||||
Main.playerVersion[PlayerControl.LocalPlayer.PlayerId] = new(Main.PluginVersion, $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})", Main.ForkId);
|
||||
Main.PlayerVersion[PlayerControl.LocalPlayer.PlayerId] = new(Main.PluginVersion, $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})", Main.ForkId);
|
||||
}
|
||||
|
||||
public static void SendDeathReason(byte playerId, PlayerState.DeathReason deathReason)
|
||||
|
||||
+62
-22
@@ -315,9 +315,17 @@ public static class Utils
|
||||
if (Options.HideGameSettings.GetBool() && Main.AllPlayerControls.Length > 1)
|
||||
return string.Empty;
|
||||
|
||||
string mode = !role.IsAdditionRole()
|
||||
? GetString($"Rate{role.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role].GetInt()}");
|
||||
string mode;
|
||||
try
|
||||
{
|
||||
mode = !role.IsAdditionRole()
|
||||
? GetString($"Rate{role.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role].GetInt()}");
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
mode = GetString("Rate0");
|
||||
}
|
||||
|
||||
mode = mode.Replace("color=", string.Empty);
|
||||
return parentheses ? $"({mode})" : mode;
|
||||
@@ -330,14 +338,14 @@ public static class Utils
|
||||
|
||||
public static Color GetRoleColor(CustomRoles role)
|
||||
{
|
||||
var hexColor = Main.roleColors.GetValueOrDefault(role, "#ffffff");
|
||||
var hexColor = Main.RoleColors.GetValueOrDefault(role, "#ffffff");
|
||||
_ = ColorUtility.TryParseHtmlString(hexColor, out Color c);
|
||||
return c;
|
||||
}
|
||||
|
||||
public static string GetRoleColorCode(CustomRoles role)
|
||||
{
|
||||
var hexColor = Main.roleColors.GetValueOrDefault(role, "#ffffff");
|
||||
var hexColor = Main.RoleColors.GetValueOrDefault(role, "#ffffff");
|
||||
return hexColor;
|
||||
}
|
||||
|
||||
@@ -716,6 +724,7 @@ public static class Utils
|
||||
__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor) && Options.AlliesKnowCrewpostor.GetBool() ||
|
||||
__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Impostor) && Options.ImpKnowAlliesRole.GetBool() ||
|
||||
__instance.Is(CustomRoleTypes.Impostor) && PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) && Options.MadmateKnowWhosImp.GetBool() ||
|
||||
CustomTeamManager.AreInSameCustomTeam(__instance.PlayerId, PlayerControl.LocalPlayer.PlayerId) ||
|
||||
Totocalcio.KnowRole(PlayerControl.LocalPlayer, __instance) ||
|
||||
Romantic.KnowRole(PlayerControl.LocalPlayer, __instance) ||
|
||||
Lawyer.KnowRole(PlayerControl.LocalPlayer, __instance) ||
|
||||
@@ -741,7 +750,7 @@ public static class Utils
|
||||
|
||||
public static string GetProgressText(PlayerControl pc)
|
||||
{
|
||||
if (!Main.playerVersion.ContainsKey(0)) return string.Empty; //ホストがMODを入れていなければ未記入を返す
|
||||
if (!Main.PlayerVersion.ContainsKey(0)) return string.Empty; //ホストがMODを入れていなければ未記入を返す
|
||||
var taskState = pc.GetTaskState();
|
||||
var Comms = false;
|
||||
if (taskState.hasTasks)
|
||||
@@ -756,7 +765,7 @@ public static class Utils
|
||||
|
||||
public static string GetProgressText(byte playerId, bool comms = false)
|
||||
{
|
||||
if (!Main.playerVersion.ContainsKey(0)) return string.Empty; //ホストがMODを入れていなければ未記入を返す
|
||||
if (!Main.PlayerVersion.ContainsKey(0)) return string.Empty; //ホストがMODを入れていなければ未記入を返す
|
||||
if (Options.CurrentGameMode == CustomGameMode.MoveAndStop) return GetTaskCount(playerId, comms, moveAndStop: true);
|
||||
var ProgressText = new StringBuilder();
|
||||
PlayerControl pc = GetPlayerById(playerId);
|
||||
@@ -940,9 +949,17 @@ public static class Utils
|
||||
{
|
||||
if (!role.Key.IsEnable()) continue;
|
||||
|
||||
string mode = !role.Key.IsAdditionRole()
|
||||
? GetString($"Rate{role.Key.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role.Key].GetInt()}");
|
||||
string mode;
|
||||
try
|
||||
{
|
||||
mode = !role.Key.IsAdditionRole()
|
||||
? GetString($"Rate{role.Key.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role.Key].GetInt()}");
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mode = mode.Replace("color=", string.Empty);
|
||||
|
||||
@@ -980,9 +997,17 @@ public static class Utils
|
||||
{
|
||||
if (!role.Key.IsEnable()) continue;
|
||||
|
||||
string mode = !role.Key.IsAdditionRole()
|
||||
? GetString($"Rate{role.Key.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role.Key].GetInt()}");
|
||||
string mode;
|
||||
try
|
||||
{
|
||||
mode = !role.Key.IsAdditionRole()
|
||||
? GetString($"Rate{role.Key.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role.Key].GetInt()}");
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mode = mode.Replace("color=", string.Empty);
|
||||
|
||||
@@ -1026,9 +1051,17 @@ public static class Utils
|
||||
|
||||
foreach (var role in EnumHelper.GetAllValues<CustomRoles>())
|
||||
{
|
||||
string mode = !role.IsAdditionRole()
|
||||
? GetString($"Rate{role.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role].GetInt()}");
|
||||
string mode;
|
||||
try
|
||||
{
|
||||
mode = !role.IsAdditionRole()
|
||||
? GetString($"Rate{role.GetMode()}")
|
||||
: GetString($"Rate{Options.CustomAdtRoleSpawnRate[role].GetInt()}");
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mode = mode.Replace("color=", string.Empty);
|
||||
|
||||
@@ -1097,7 +1130,7 @@ public static class Utils
|
||||
sb.Append("<#ffffff><u>Role Summary:</u></color><size=70%>");
|
||||
|
||||
List<byte> cloneRoles = [.. Main.PlayerStates.Keys];
|
||||
foreach (byte id in Main.winnerList.ToArray())
|
||||
foreach (byte id in Main.WinnerList.ToArray())
|
||||
{
|
||||
if (EndGamePatch.SummaryText[id].Contains("<INVALID:NotAssigned>")) continue;
|
||||
sb.Append("\n<#c4aa02>\u2605</color> ").Append(EndGamePatch.SummaryText[id] /*.RemoveHtmlTags()*/);
|
||||
@@ -1576,11 +1609,11 @@ public static class Utils
|
||||
if (!AmongUsClient.Instance.AmHost || player == null) return;
|
||||
if (!(player.AmOwner || player.FriendCode.GetDevUser().HasTag())) return;
|
||||
string name = Main.AllPlayerNames.TryGetValue(player.PlayerId, out var n) ? n : string.Empty;
|
||||
if (Main.nickName != string.Empty && player.AmOwner) name = Main.nickName;
|
||||
if (Main.NickName != string.Empty && player.AmOwner) name = Main.NickName;
|
||||
if (name == string.Empty) return;
|
||||
if (AmongUsClient.Instance.IsGameStarted)
|
||||
{
|
||||
if (Options.FormatNameMode.GetInt() == 1 && Main.nickName == string.Empty) name = Palette.GetColorName(player.Data.DefaultOutfit.ColorId);
|
||||
if (Options.FormatNameMode.GetInt() == 1 && Main.NickName == string.Empty) name = Palette.GetColorName(player.Data.DefaultOutfit.ColorId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1900,7 +1933,7 @@ public static class Utils
|
||||
{
|
||||
case CustomGameMode.FFA:
|
||||
SelfSuffix.Append(FFAManager.GetPlayerArrow(seer));
|
||||
if (FFAManager.FFA_ChatDuringGame.GetBool()) SelfSuffix.Append(SelfSuffix.Length > 0 && FFAManager.LatestChatMessage != string.Empty ? "\n" : string.Empty).Append(FFAManager.LatestChatMessage);
|
||||
if (FFAManager.FFAChatDuringGame.GetBool()) SelfSuffix.Append(SelfSuffix.Length > 0 && FFAManager.LatestChatMessage != string.Empty ? "\n" : string.Empty).Append(FFAManager.LatestChatMessage);
|
||||
break;
|
||||
case CustomGameMode.SoloKombat:
|
||||
SelfSuffix.Append(SoloKombatManager.GetDisplayHealth(seer));
|
||||
@@ -2108,6 +2141,7 @@ public static class Utils
|
||||
(target.Is(CustomRoles.Mayor) && Mayor.MayorRevealWhenDoneTasks.GetBool() && target.GetTaskState().IsTaskFinished) ||
|
||||
(seer.Is(CustomRoleTypes.Crewmate) && target.Is(CustomRoles.Marshall) && target.GetTaskState().IsTaskFinished) ||
|
||||
(Main.PlayerStates[target.PlayerId].deathReason == PlayerState.DeathReason.Vote && Options.SeeEjectedRolesInMeeting.GetBool()) ||
|
||||
CustomTeamManager.AreInSameCustomTeam(seer.PlayerId, target.PlayerId) ||
|
||||
Totocalcio.KnowRole(seer, target) ||
|
||||
Romantic.KnowRole(seer, target) ||
|
||||
Lawyer.KnowRole(seer, target) ||
|
||||
@@ -2397,7 +2431,13 @@ public static class Utils
|
||||
}, Options.TruantWaitingTime.GetFloat(), $"Truant Waiting: {pc.GetNameWithRole()}");
|
||||
}
|
||||
|
||||
if (!pc.IsModClient()) pc.ReactorFlash(0.2f); // This should fix black screens
|
||||
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);
|
||||
|
||||
@@ -2870,5 +2910,5 @@ public static class Utils
|
||||
public static bool IsAllAlive => Main.PlayerStates.Values.All(state => state.countTypes == CountTypes.OutOfGame || !state.IsDead);
|
||||
public static int PlayersCount(CountTypes countTypes) => Main.PlayerStates.Values.Count(state => state.countTypes == countTypes);
|
||||
public static int AlivePlayersCount(CountTypes countTypes) => Main.AllAlivePlayerControls.Count(pc => pc.Is(countTypes));
|
||||
public static bool IsPlayerModClient(this byte id) => Main.playerVersion.ContainsKey(id);
|
||||
public static bool IsPlayerModClient(this byte id) => Main.PlayerVersion.ContainsKey(id);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ class ChatBubbleSetRightPatch
|
||||
{
|
||||
public static void Postfix(ChatBubble __instance)
|
||||
{
|
||||
if (Main.isChatCommand) __instance.SetLeft();
|
||||
if (Main.IsChatCommand) __instance.SetLeft();
|
||||
}
|
||||
}
|
||||
[HarmonyPatch(typeof(ChatBubble), nameof(ChatBubble.SetName))]
|
||||
|
||||
+13
-13
@@ -46,7 +46,7 @@ internal class ChatCommands
|
||||
string[] args = text.Split(' ');
|
||||
var canceled = false;
|
||||
var cancelVal = string.Empty;
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
|
||||
Logger.Info(text, "SendChat");
|
||||
|
||||
@@ -76,19 +76,19 @@ internal class ChatCommands
|
||||
case "/v":
|
||||
case "/version":
|
||||
canceled = true;
|
||||
string version_text = Main.playerVersion.OrderBy(pair => pair.Key).Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}:{Main.AllPlayerNames[kvp.Key]}:{kvp.Value.forkId}/{kvp.Value.version}({kvp.Value.tag})\n");
|
||||
string version_text = Main.PlayerVersion.OrderBy(pair => pair.Key).Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}:{Main.AllPlayerNames[kvp.Key]}:{kvp.Value.forkId}/{kvp.Value.version}({kvp.Value.tag})\n");
|
||||
|
||||
if (version_text != string.Empty) HudManager.Instance.Chat.AddChat(PlayerControl.LocalPlayer, (PlayerControl.LocalPlayer.FriendCode.GetDevUser().HasTag() ? "\n" : string.Empty) + version_text);
|
||||
break;
|
||||
default:
|
||||
Main.isChatCommand = false;
|
||||
Main.IsChatCommand = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
var localPlayerId = PlayerControl.LocalPlayer.PlayerId;
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
string subArgs;
|
||||
switch (args[0])
|
||||
{
|
||||
@@ -96,8 +96,8 @@ internal class ChatCommands
|
||||
case "/win":
|
||||
case "/winner":
|
||||
canceled = true;
|
||||
if (Main.winnerNameList.Count == 0) Utils.SendMessage(GetString("NoInfoExists"));
|
||||
else Utils.SendMessage("<b><u>Winners:</b></u>\n" + string.Join(", ", Main.winnerNameList));
|
||||
if (Main.WinnerNameList.Count == 0) Utils.SendMessage(GetString("NoInfoExists"));
|
||||
else Utils.SendMessage("<b><u>Winners:</b></u>\n" + string.Join(", ", Main.WinnerNameList));
|
||||
break;
|
||||
|
||||
case "/l":
|
||||
@@ -115,7 +115,7 @@ internal class ChatCommands
|
||||
if (args.Length < 1) break;
|
||||
if (args[1].Length is > 50 or < 1)
|
||||
Utils.SendMessage(GetString("Message.AllowNameLength"), localPlayerId);
|
||||
else Main.nickName = args[1];
|
||||
else Main.NickName = args[1];
|
||||
break;
|
||||
|
||||
case "/hn":
|
||||
@@ -247,7 +247,7 @@ internal class ChatCommands
|
||||
else Main.SetRoles[targetPc.PlayerId] = roleToSet;
|
||||
|
||||
var playername = $"<b>{Utils.ColorString(Main.PlayerColors.TryGetValue(resultId, out var textColor) ? textColor : Color.white, targetPc.GetRealName())}</b>";
|
||||
var rolename = $"<color={Main.roleColors[roleToSet]}> {GetString(roleToSet.ToString())} </color>";
|
||||
var rolename = $"<color={Main.RoleColors[roleToSet]}> {GetString(roleToSet.ToString())} </color>";
|
||||
Utils.SendMessage("\n", localPlayerId, string.Format(GetString("RoleSelected"), playername, rolename));
|
||||
|
||||
break;
|
||||
@@ -696,7 +696,7 @@ internal class ChatCommands
|
||||
break;
|
||||
|
||||
default:
|
||||
Main.isChatCommand = false;
|
||||
Main.IsChatCommand = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ internal class ChatCommands
|
||||
|
||||
goto Skip;
|
||||
Canceled:
|
||||
Main.isChatCommand = false;
|
||||
Main.IsChatCommand = false;
|
||||
canceled = true;
|
||||
Skip:
|
||||
if (canceled)
|
||||
@@ -931,12 +931,12 @@ internal class ChatCommands
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
var title = $"<{Main.roleColors[rl]}>{roleName}</color> {Utils.GetRoleMode(rl)}";
|
||||
var title = $"<{Main.RoleColors[rl]}>{roleName}</color> {Utils.GetRoleMode(rl)}";
|
||||
_ = sb.Append($"{GetString($"{rl}InfoLong")}");
|
||||
var settings = new StringBuilder();
|
||||
if (Options.CustomRoleSpawnChances.TryGetValue(rl, out StringOptionItem chance))
|
||||
{
|
||||
settings.AppendLine($"<size=70%><u>{GetString("SettingsForRoleText")} <{Main.roleColors[rl]}>{roleName}</color>:</u>");
|
||||
settings.AppendLine($"<size=70%><u>{GetString("SettingsForRoleText")} <{Main.RoleColors[rl]}>{roleName}</color>:</u>");
|
||||
Utils.ShowChildrenSettings(chance, ref settings, disableColor: false);
|
||||
settings.Append("</size>");
|
||||
var txt = $"<size=90%>{sb}</size>";
|
||||
@@ -1082,7 +1082,7 @@ internal class ChatCommands
|
||||
if (!GameStates.IsInGame || player.IsAlive()) break;
|
||||
var killer = player.GetRealKiller();
|
||||
if (killer == null) break;
|
||||
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("DeathCommand"), Utils.ColorString(Main.PlayerColors.TryGetValue(killer.PlayerId, out var pcColor) ? pcColor : Color.white, killer.GetRealName()), $"<{Main.roleColors[killer.GetCustomRole()]}>{GetString(killer.GetCustomRole().ToString())}</color>"));
|
||||
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("DeathCommand"), Utils.ColorString(Main.PlayerColors.TryGetValue(killer.PlayerId, out var pcColor) ? pcColor : Color.white, killer.GetRealName()), $"<{Main.RoleColors[killer.GetCustomRole()]}>{GetString(killer.GetCustomRole().ToString())}</color>"));
|
||||
break;
|
||||
|
||||
case "/colour":
|
||||
|
||||
@@ -353,6 +353,8 @@ class GameEndChecker
|
||||
|
||||
if (CustomRoles.Sunnyboy.RoleExist() && Main.AllAlivePlayerControls.Length > 1) return false;
|
||||
|
||||
if (CustomTeamManager.CheckCustomTeamGameEnd()) return true;
|
||||
|
||||
if (Main.AllAlivePlayerControls.All(p => p.Is(CustomRoles.Lovers)))
|
||||
{
|
||||
reason = GameOverReason.ImpostorByKill;
|
||||
|
||||
@@ -40,10 +40,11 @@ public static class OptionsMenuBehaviourStartPatch
|
||||
|
||||
if (UnlockFPS == null || UnlockFPS.ToggleButton == null)
|
||||
{
|
||||
UnlockFPS = ClientOptionItem.Create("UnlockFPS", Main.UnlockFPS, __instance, UnlockFPSButtonToggle);
|
||||
UnlockFPS = ClientOptionItem.Create("UnlockFPS", Main.UnlockFps, __instance, UnlockFPSButtonToggle);
|
||||
|
||||
static void UnlockFPSButtonToggle()
|
||||
{
|
||||
Application.targetFrameRate = Main.UnlockFPS.Value ? 165 : 60;
|
||||
Application.targetFrameRate = Main.UnlockFps.Value ? 165 : 60;
|
||||
Logger.SendInGame(string.Format(Translator.GetString("FPSSetTo"), Application.targetFrameRate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,13 +148,13 @@ internal class ControllerManagerUpdatePatch
|
||||
|
||||
if (GetKeysDown(KeyCode.N, KeyCode.LeftShift, KeyCode.LeftControl))
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
Utils.ShowActiveSettingsHelp();
|
||||
}
|
||||
|
||||
if (GetKeysDown(KeyCode.N, KeyCode.LeftControl) && !Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
Utils.ShowActiveSettings();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ internal class PingTrackerUpdatePatch
|
||||
|
||||
Sb.Clear();
|
||||
|
||||
Sb.Append(Main.credentialsText);
|
||||
Sb.Append(Main.CredentialsText);
|
||||
|
||||
var ping = AmongUsClient.Instance.Ping;
|
||||
string color = ping switch
|
||||
@@ -57,10 +57,10 @@ internal class VersionShowerStartPatch
|
||||
{
|
||||
private static void Postfix(VersionShower __instance)
|
||||
{
|
||||
Main.credentialsText = $"<size=1.5><color={Main.ModColor}>Endless Host Roles</color> v{Main.PluginDisplayVersion} <color=#a54aff>by</color> <color=#ffff00>Gurge44</color>";
|
||||
Main.CredentialsText = $"<size=1.5><color={Main.ModColor}>Endless Host Roles</color> v{Main.PluginDisplayVersion} <color=#a54aff>by</color> <color=#ffff00>Gurge44</color>";
|
||||
string menuText = $"\r\n<color={Main.ModColor}>Endless Host Roles</color> v{Main.PluginDisplayVersion}\r\n<color=#a54aff>By</color> <color=#ffff00>Gurge44</color>";
|
||||
|
||||
if (Main.IsAprilFools) Main.credentialsText = "<color=#00bfff>Endless Madness</color> v11.45.14 <color=#a54aff>by</color> <color=#ffff00>No one</color>";
|
||||
if (Main.IsAprilFools) Main.CredentialsText = "<color=#00bfff>Endless Madness</color> v11.45.14 <color=#a54aff>by</color> <color=#ffff00>No one</color>";
|
||||
|
||||
var credentials = Object.Instantiate(__instance.text);
|
||||
credentials.text = menuText;
|
||||
@@ -69,7 +69,7 @@ internal class VersionShowerStartPatch
|
||||
credentials.fontSize = credentials.fontSizeMax = credentials.fontSizeMin = 2f;
|
||||
|
||||
ErrorText.Create(__instance.text);
|
||||
if (Main.hasArgumentException && ErrorText.Instance != null)
|
||||
if (Main.HasArgumentException && ErrorText.Instance != null)
|
||||
{
|
||||
ErrorText.Instance.AddError(ErrorCode.Main_DictionaryError);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public static class VentSetButtonsPatch
|
||||
// Fix arrows buttons in vent on Dleks map and "Index was outside the bounds of the array" errors
|
||||
private static bool Prefix( /*Vent __instance,*/ [HarmonyArgument(0)] ref bool enabled)
|
||||
{
|
||||
if (Main.CurrentMap == MapNames.Dleks && Main.introDestroyed)
|
||||
if (Main.CurrentMap == MapNames.Dleks && Main.IntroDestroyed)
|
||||
{
|
||||
enabled = false;
|
||||
if (GameStates.IsMeeting)
|
||||
@@ -58,7 +58,7 @@ public static class VentSetButtonsPatch
|
||||
public static void Postfix(Vent __instance, [HarmonyArgument(0)] bool enabled)
|
||||
{
|
||||
if (Main.CurrentMap != MapNames.Dleks) return;
|
||||
if (enabled || !Main.introDestroyed) return;
|
||||
if (enabled || !Main.IntroDestroyed) return;
|
||||
|
||||
var setActive = ShowButtons || !PlayerControl.LocalPlayer.inVent && !GameStates.IsMeeting;
|
||||
switch (__instance.Id)
|
||||
|
||||
@@ -139,10 +139,10 @@ public class GameStartManagerPatch
|
||||
|
||||
if (Main.AutoStart != null && Main.AutoStart.Value)
|
||||
{
|
||||
Main.updateTime++;
|
||||
if (Main.updateTime >= 50)
|
||||
Main.UpdateTime++;
|
||||
if (Main.UpdateTime >= 50)
|
||||
{
|
||||
Main.updateTime = 0;
|
||||
Main.UpdateTime = 0;
|
||||
if (((GameData.Instance.PlayerCount >= minPlayer && timer <= minWait) || timer <= maxWait) && !GameStates.IsCountDown)
|
||||
{
|
||||
var invalidColor = Main.AllPlayerControls.Where(p => p.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= p.Data.DefaultOutfit.ColorId);
|
||||
@@ -266,9 +266,9 @@ public class GameStartManagerPatch
|
||||
|
||||
private static bool MatchVersions(byte playerId, bool acceptVanilla = false)
|
||||
{
|
||||
if (!Main.playerVersion.TryGetValue(playerId, out var version)) return acceptVanilla;
|
||||
if (!Main.PlayerVersion.TryGetValue(playerId, out var version)) return acceptVanilla;
|
||||
return Main.ForkId == version.forkId
|
||||
&& Main.version.CompareTo(version.version) == 0
|
||||
&& Main.Version.CompareTo(version.version) == 0
|
||||
&& version.tag == $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})";
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -93,7 +93,7 @@ class HudManagerPatch
|
||||
{
|
||||
var pc = Utils.GetPlayerById(item.Key);
|
||||
string prefix = first ? string.Empty : "\n";
|
||||
string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <color={Main.roleColors.GetValueOrDefault(item.Value, "#ffffff")}>{GetString(item.Value.ToString())}</color>";
|
||||
string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <color={Main.RoleColors.GetValueOrDefault(item.Value, "#ffffff")}>{GetString(item.Value.ToString())}</color>";
|
||||
resultText[item.Key] = text;
|
||||
first = false;
|
||||
}
|
||||
@@ -106,13 +106,13 @@ class HudManagerPatch
|
||||
var pc = Utils.GetPlayerById(item.Key);
|
||||
if (resultText.ContainsKey(item.Key))
|
||||
{
|
||||
string text = $" <#ffffff>(</color><color={Main.roleColors.GetValueOrDefault(role, "#ffffff")}>{GetString(role.ToString())}</color><#ffffff>)</color>";
|
||||
string text = $" <#ffffff>(</color><color={Main.RoleColors.GetValueOrDefault(role, "#ffffff")}>{GetString(role.ToString())}</color><#ffffff>)</color>";
|
||||
resultText[item.Key] += text;
|
||||
}
|
||||
else
|
||||
{
|
||||
string prefix = first ? string.Empty : "\n";
|
||||
string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <#ffffff>(</color><color={Main.roleColors.GetValueOrDefault(role, "#ffffff")}>{GetString(role.ToString())}</color><#ffffff>)</color>";
|
||||
string text = $"{prefix}{(item.Key == 0 ? "Host" : $"{(pc == null ? $"ID {item.Key}" : $"{pc.GetRealName()}")}")} - <#ffffff>(</color><color={Main.RoleColors.GetValueOrDefault(role, "#ffffff")}>{GetString(role.ToString())}</color><#ffffff>)</color>";
|
||||
resultText[item.Key] = text;
|
||||
first = false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public static class HudSpritePatch
|
||||
var player = PlayerControl.LocalPlayer;
|
||||
if (player == null || !GameStates.IsModHost) return;
|
||||
if (!SetHudActivePatch.IsActive || !player.IsAlive()) return;
|
||||
if (!AmongUsClient.Instance.IsGameStarted || !Main.introDestroyed)
|
||||
if (!AmongUsClient.Instance.IsGameStarted || !Main.IntroDestroyed)
|
||||
{
|
||||
Kill = null;
|
||||
Ability = null;
|
||||
|
||||
+30
-26
@@ -4,6 +4,8 @@ using Il2CppSystem.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using EHR.Modules;
|
||||
using EHR.Roles.Neutral;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
|
||||
@@ -111,7 +113,7 @@ class CoBeginPatch
|
||||
{
|
||||
var text = pc.AmOwner ? "[*]" : " ";
|
||||
text += $"{pc.PlayerId,-2}:{pc.Data?.PlayerName?.PadRightV2(20)}:{pc.GetClient()?.PlatformData?.Platform.ToString().Replace("Standalone", string.Empty),-11}";
|
||||
if (Main.playerVersion.TryGetValue(pc.PlayerId, out PlayerVersion pv))
|
||||
if (Main.PlayerVersion.TryGetValue(pc.PlayerId, out PlayerVersion pv))
|
||||
text += $":Mod({pv.forkId}/{pv.version}:{pv.tag})";
|
||||
else
|
||||
text += ":Vanilla";
|
||||
@@ -150,34 +152,23 @@ class BeginCrewmatePatch
|
||||
{
|
||||
public static bool Prefix(IntroCutscene __instance, ref List<PlayerControl> teamToDisplay)
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.Is(CustomRoleTypes.Neutral) && !PlayerControl.LocalPlayer.Is(CustomRoles.Parasite))
|
||||
if (PlayerControl.LocalPlayer.Is(CustomRoleTypes.Neutral) && !PlayerControl.LocalPlayer.GetCustomRole().IsMadmate())
|
||||
{
|
||||
teamToDisplay = new();
|
||||
teamToDisplay.Add(PlayerControl.LocalPlayer);
|
||||
}
|
||||
|
||||
if (PlayerControl.LocalPlayer.Is(CustomRoleTypes.Neutral) && !PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor))
|
||||
{
|
||||
teamToDisplay = new();
|
||||
teamToDisplay.Add(PlayerControl.LocalPlayer);
|
||||
byte id = PlayerControl.LocalPlayer.PlayerId;
|
||||
switch (Main.PlayerStates[id].Role)
|
||||
{
|
||||
case Lawyer:
|
||||
teamToDisplay.Add(Utils.GetPlayerById(Lawyer.Target[id]));
|
||||
break;
|
||||
case Executioner:
|
||||
teamToDisplay.Add(Utils.GetPlayerById(Executioner.Target[id]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (PlayerControl.LocalPlayer.Is(CustomRoles.Madmate))
|
||||
{
|
||||
teamToDisplay = new();
|
||||
teamToDisplay.Add(PlayerControl.LocalPlayer);
|
||||
__instance.BeginImpostor(teamToDisplay);
|
||||
__instance.overlayHandle.color = Palette.ImpostorRed;
|
||||
return false;
|
||||
}
|
||||
else if (PlayerControl.LocalPlayer.Is(CustomRoles.Crewpostor))
|
||||
{
|
||||
teamToDisplay = new();
|
||||
teamToDisplay.Add(PlayerControl.LocalPlayer);
|
||||
__instance.BeginImpostor(teamToDisplay);
|
||||
__instance.overlayHandle.color = Palette.ImpostorRed;
|
||||
return false;
|
||||
}
|
||||
else if (PlayerControl.LocalPlayer.GetCustomRole().IsMadmate())
|
||||
else if (PlayerControl.LocalPlayer.Is(CustomRoles.Madmate) || PlayerControl.LocalPlayer.GetCustomRole().IsMadmate())
|
||||
{
|
||||
teamToDisplay = new();
|
||||
teamToDisplay.Add(PlayerControl.LocalPlayer);
|
||||
@@ -400,6 +391,19 @@ class BeginCrewmatePatch
|
||||
__instance.ImpostorText.text = GetString("SubText.Madmate");
|
||||
}
|
||||
|
||||
if (CustomTeamManager.CustomTeams.Count > 0)
|
||||
{
|
||||
var team = CustomTeamManager.GetCustomTeam(PlayerControl.LocalPlayer.PlayerId);
|
||||
if (team != null)
|
||||
{
|
||||
if (team.RoleRevealScreenTitle != "*") __instance.TeamTitle.text = team.RoleRevealScreenTitle;
|
||||
if (team.RoleRevealScreenBackgroundColor != "*" && ColorUtility.TryParseHtmlString(team.RoleRevealScreenBackgroundColor, out var bgColor))
|
||||
__instance.TeamTitle.color = __instance.BackgroundBar.material.color = bgColor;
|
||||
__instance.ImpostorText.gameObject.SetActive(team.RoleRevealScreenSubtitle != "*");
|
||||
__instance.ImpostorText.text = team.RoleRevealScreenSubtitle;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Options.CurrentGameMode)
|
||||
{
|
||||
case CustomGameMode.SoloKombat:
|
||||
@@ -538,7 +542,7 @@ class IntroCutsceneDestroyPatch
|
||||
public static void Postfix( /*IntroCutscene __instance*/)
|
||||
{
|
||||
if (!GameStates.IsInGame) return;
|
||||
Main.introDestroyed = true;
|
||||
Main.IntroDestroyed = true;
|
||||
if (AmongUsClient.Instance.AmHost)
|
||||
{
|
||||
if (Main.NormalOptions.MapId != 4)
|
||||
@@ -550,7 +554,7 @@ class IntroCutsceneDestroyPatch
|
||||
else pc.AddAbilityCD(includeDuration: false);
|
||||
}
|
||||
|
||||
if (Options.StartingKillCooldown.GetInt() != 10 && Options.StartingKillCooldown.GetInt() > 0)
|
||||
if (Options.StartingKillCooldown.GetInt() is not 10 and > 0)
|
||||
{
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ public static class FindAGameManagerHandleListPatch
|
||||
{
|
||||
List<GameListing> newList = [];
|
||||
|
||||
var nameList = TranslationController.Instance.currentLanguage.languageID is SupportedLangs.SChinese or SupportedLangs.TChinese ? Main.TName_Snacks_CN : Main.TName_Snacks_EN;
|
||||
var nameList = TranslationController.Instance.currentLanguage.languageID is SupportedLangs.SChinese or SupportedLangs.TChinese ? Main.NameSnacksCn : Main.NameSnacksEn;
|
||||
|
||||
foreach (var game in games)
|
||||
{
|
||||
|
||||
@@ -119,6 +119,6 @@ public class MainMenuManagerPatch
|
||||
passiveCreditsButton.OnClick = new();
|
||||
passiveCreditsButton.OnClick.AddListener((Action)(() => { CredentialsPatch.LogoPatch.CreditsPopup?.SetActive(true); }));
|
||||
|
||||
Application.targetFrameRate = Main.UnlockFPS.Value ? 165 : 60;
|
||||
Application.targetFrameRate = Main.UnlockFps.Value ? 165 : 60;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EHR.Modules;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
using Object = UnityEngine.Object;
|
||||
@@ -508,7 +509,7 @@ class CheckForEndVotingPatch
|
||||
foreach (var playerId in playerIds)
|
||||
{
|
||||
var id = playerId;
|
||||
if (CustomRoles.Lovers.IsEnable() && !Main.isLoversDead && Main.LoversPlayers.Find(lp => lp.PlayerId == id) != null)
|
||||
if (CustomRoles.Lovers.IsEnable() && !Main.IsLoversDead && Main.LoversPlayers.Find(lp => lp.PlayerId == id) != null)
|
||||
FixedUpdatePatch.LoversSuicide(playerId, true);
|
||||
if (Main.PlayerStates.TryGetValue(id, out var state) && state.SubRoles.Contains(CustomRoles.Avanger))
|
||||
RevengeOnExile(playerId /*, deathReason*/);
|
||||
@@ -778,6 +779,7 @@ class MeetingHudStartPatch
|
||||
(pc.Is(CustomRoles.Mayor) && Mayor.MayorRevealWhenDoneTasks.GetBool() && pc.GetTaskState().IsTaskFinished) ||
|
||||
(pc.Is(CustomRoles.Marshall) && PlayerControl.LocalPlayer.Is(CustomRoleTypes.Crewmate) && pc.GetTaskState().IsTaskFinished) ||
|
||||
(Main.PlayerStates[pc.PlayerId].deathReason == PlayerState.DeathReason.Vote && Options.SeeEjectedRolesInMeeting.GetBool()) ||
|
||||
CustomTeamManager.AreInSameCustomTeam(pc.PlayerId, PlayerControl.LocalPlayer.PlayerId) ||
|
||||
Totocalcio.KnowRole(PlayerControl.LocalPlayer, pc) ||
|
||||
Romantic.KnowRole(PlayerControl.LocalPlayer, pc) ||
|
||||
EvilDiviner.IsShowTargetRole(PlayerControl.LocalPlayer, pc) ||
|
||||
|
||||
+24
-12
@@ -83,17 +83,17 @@ class EndGamePatch
|
||||
winner.AddRange(Main.AllPlayerControls.Where(p => p.Is(team) && !winner.Contains(p)));
|
||||
}
|
||||
|
||||
Main.winnerNameList = [];
|
||||
Main.winnerList = [];
|
||||
Main.winnerRolesList = [];
|
||||
Main.WinnerNameList = [];
|
||||
Main.WinnerList = [];
|
||||
Main.WinnerRolesList = [];
|
||||
foreach (PlayerControl pc in winner)
|
||||
{
|
||||
if (CustomWinnerHolder.WinnerTeam is not CustomWinner.Draw && pc.Is(CustomRoles.GM)) continue;
|
||||
|
||||
TempData.winners.Add(new(pc.Data));
|
||||
Main.winnerList.Add(pc.PlayerId);
|
||||
Main.winnerNameList.Add(pc.GetRealName());
|
||||
Main.winnerRolesList.Add(pc.GetCustomRole());
|
||||
Main.WinnerList.Add(pc.PlayerId);
|
||||
Main.WinnerNameList.Add(pc.GetRealName());
|
||||
Main.WinnerRolesList.Add(pc.GetCustomRole());
|
||||
}
|
||||
|
||||
Arsonist.IsDoused = [];
|
||||
@@ -126,7 +126,7 @@ class SetEverythingUpPatch
|
||||
|
||||
public static void Postfix(EndGameManager __instance)
|
||||
{
|
||||
if (!Main.playerVersion.ContainsKey(0)) return;
|
||||
if (!Main.PlayerVersion.ContainsKey(0)) return;
|
||||
//#######################################
|
||||
// ==Victory faction display==
|
||||
//#######################################
|
||||
@@ -181,13 +181,13 @@ class SetEverythingUpPatch
|
||||
|
||||
Vector3 defaultPos = poolablePlayer.cosmetics.nameText.transform.localPosition;
|
||||
|
||||
for (int j = 0; j < Main.winnerList.Count; j++)
|
||||
for (int j = 0; j < Main.WinnerList.Count; j++)
|
||||
{
|
||||
byte id = Main.winnerList[j];
|
||||
if (Main.winnerNameList[j].RemoveHtmlTags() != data.PlayerName.RemoveHtmlTags()) continue;
|
||||
byte id = Main.WinnerList[j];
|
||||
if (Main.WinnerNameList[j].RemoveHtmlTags() != data.PlayerName.RemoveHtmlTags()) continue;
|
||||
var role = Main.PlayerStates[id].MainRole;
|
||||
|
||||
var color = Main.roleColors[role];
|
||||
var color = Main.RoleColors[role];
|
||||
var rolename = Utils.GetRoleName(role);
|
||||
|
||||
poolablePlayer.cosmetics.nameText.text += $"\n<color={color}>{rolename}</color>";
|
||||
@@ -253,6 +253,16 @@ class SetEverythingUpPatch
|
||||
}
|
||||
}
|
||||
|
||||
if (CustomWinnerHolder.WinnerTeam == CustomWinner.CustomTeam)
|
||||
{
|
||||
var team = CustomTeamManager.WinnerTeam;
|
||||
CustomWinnerText = string.Format(GetString("CustomWinnerText"), team.TeamName);
|
||||
CustomWinnerColor = team.RoleRevealScreenBackgroundColor == "*" ? Main.NeutralColor : team.RoleRevealScreenBackgroundColor;
|
||||
__instance.BackgroundBar.material.color = ColorUtility.TryParseHtmlString(team.RoleRevealScreenBackgroundColor, out var color) ? color : Utils.GetRoleColor(CustomRoles.Sprayer);
|
||||
AdditionalWinnerText = team.TeamMembers.Join(x => Utils.ColorString(Utils.GetRoleColor(x), GetString($"{x}"))) + GetString("Win");
|
||||
goto Skip;
|
||||
}
|
||||
|
||||
var winnerRole = (CustomRoles)CustomWinnerHolder.WinnerTeam;
|
||||
if (winnerRole >= 0)
|
||||
{
|
||||
@@ -333,6 +343,8 @@ class SetEverythingUpPatch
|
||||
AdditionalWinnerText += "\n" + Utils.ColorString(Utils.GetRoleColor(addWinnerRole), GetAdditionalWinnerRoleName(addWinnerRole));
|
||||
}
|
||||
|
||||
Skip:
|
||||
|
||||
if (CustomWinnerHolder.WinnerTeam is not CustomWinner.Draw and not CustomWinner.None and not CustomWinner.Error)
|
||||
{
|
||||
WinnerText.text = AdditionalWinnerText == string.Empty ? $"<size=100%><color={CustomWinnerColor}>{CustomWinnerText}</color></size>" : $"<size=100%><color={CustomWinnerColor}>{CustomWinnerText}</color></size><size=50%>{AdditionalWinnerText}</size>";
|
||||
@@ -355,7 +367,7 @@ class SetEverythingUpPatch
|
||||
|
||||
StringBuilder sb = new($"{GetString("RoleSummaryText")}\n<b>");
|
||||
List<byte> cloneRoles = [.. Main.PlayerStates.Keys];
|
||||
foreach (byte id in Main.winnerList)
|
||||
foreach (byte id in Main.WinnerList)
|
||||
{
|
||||
if (EndGamePatch.SummaryText[id].Contains("<INVALID:NotAssigned>")) continue;
|
||||
sb.Append('\n').Append(EndGamePatch.SummaryText[id]);
|
||||
|
||||
@@ -12,6 +12,7 @@ using HarmonyLib;
|
||||
using Hazel;
|
||||
using InnerNet;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -1213,11 +1214,11 @@ class FixedUpdatePatch
|
||||
{
|
||||
if (GameStates.IsLobby)
|
||||
{
|
||||
if (Main.playerVersion.TryGetValue(playerId, out var ver))
|
||||
if (Main.PlayerVersion.TryGetValue(playerId, out var ver))
|
||||
{
|
||||
if (Main.ForkId != ver.forkId)
|
||||
__instance.cosmetics.nameText.text = $"<color=#ff0000><size=1.2>{ver.forkId}</size>\n{__instance?.name}</color>";
|
||||
else if (Main.version.CompareTo(ver.version) == 0)
|
||||
else if (Main.Version.CompareTo(ver.version) == 0)
|
||||
__instance.cosmetics.nameText.text = ver.tag == $"{ThisAssembly.Git.Commit}({ThisAssembly.Git.Branch})" ? $"<color=#87cefa>{__instance.name}</color>" : $"<color=#ffff00><size=1.2>{ver.tag}</size>\n{__instance?.name}</color>";
|
||||
else __instance.cosmetics.nameText.text = $"<color=#ff0000><size=1.2>v{ver.version}</size>\n{__instance?.name}</color>";
|
||||
}
|
||||
@@ -1499,7 +1500,7 @@ class FixedUpdatePatch
|
||||
{
|
||||
case CustomGameMode.FFA:
|
||||
Suffix.Append(FFAManager.GetPlayerArrow(seer, target));
|
||||
if (self && FFAManager.FFA_ChatDuringGame.GetBool()) Suffix.Append((Suffix.Length > 0 && FFAManager.LatestChatMessage != string.Empty ? "\n" : string.Empty) + FFAManager.LatestChatMessage);
|
||||
if (self && FFAManager.FFAChatDuringGame.GetBool()) Suffix.Append((Suffix.Length > 0 && FFAManager.LatestChatMessage != string.Empty ? "\n" : string.Empty) + FFAManager.LatestChatMessage);
|
||||
break;
|
||||
case CustomGameMode.MoveAndStop when self:
|
||||
Suffix.Append(MoveAndStopManager.GetSuffixText(seer));
|
||||
@@ -1605,12 +1606,12 @@ class FixedUpdatePatch
|
||||
public static void LoversSuicide(byte deathId = 0x7f, bool isExiled = false)
|
||||
{
|
||||
if (Main.LoversPlayers.Count == 0) return;
|
||||
if (Options.LoverSuicide.GetBool() && !Main.isLoversDead)
|
||||
if (Options.LoverSuicide.GetBool() && !Main.IsLoversDead)
|
||||
{
|
||||
foreach (PlayerControl loversPlayer in Main.LoversPlayers)
|
||||
{
|
||||
if (!loversPlayer.Data.IsDead && loversPlayer.PlayerId != deathId) continue;
|
||||
Main.isLoversDead = true;
|
||||
Main.IsLoversDead = true;
|
||||
foreach (var partnerPlayer in Main.LoversPlayers)
|
||||
{
|
||||
if (loversPlayer.PlayerId == partnerPlayer.PlayerId) continue;
|
||||
@@ -1747,7 +1748,7 @@ class CoEnterVentPatch
|
||||
|
||||
switch (Options.CurrentGameMode)
|
||||
{
|
||||
case CustomGameMode.FFA when FFAManager.FFA_DisableVentingWhenTwoPlayersAlive.GetBool() && Main.AllAlivePlayerControls.Length <= 2:
|
||||
case CustomGameMode.FFA when FFAManager.FFADisableVentingWhenTwoPlayersAlive.GetBool() && Main.AllAlivePlayerControls.Length <= 2:
|
||||
var pc = __instance.myPlayer;
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
@@ -1755,7 +1756,7 @@ class CoEnterVentPatch
|
||||
pc?.MyPhysics?.RpcBootFromVent(id);
|
||||
}, 0.5f);
|
||||
return true;
|
||||
case CustomGameMode.FFA when FFAManager.FFA_DisableVentingWhenKCDIsUp.GetBool() && Main.KillTimers[__instance.myPlayer.PlayerId] <= 0:
|
||||
case CustomGameMode.FFA when FFAManager.FFADisableVentingWhenKcdIsUp.GetBool() && Main.KillTimers[__instance.myPlayer.PlayerId] <= 0:
|
||||
_ = new LateTask(() =>
|
||||
{
|
||||
__instance.myPlayer?.Notify(GetString("FFA-NoVentingBecauseKCDIsUP"), 7f);
|
||||
|
||||
@@ -19,7 +19,7 @@ class OnGameJoinedPatch
|
||||
{
|
||||
while (!Options.IsLoaded) Task.Delay(1);
|
||||
Logger.Info($"{__instance.GameId} joined lobby", "OnGameJoined");
|
||||
Main.playerVersion = [];
|
||||
Main.PlayerVersion = [];
|
||||
if (!Main.VersionCheat.Value) RPC.RpcVersionCheck();
|
||||
SoundManager.Instance?.ChangeAmbienceVolume(DataManager.Settings.Audio.AmbienceVolume);
|
||||
|
||||
@@ -34,7 +34,7 @@ class OnGameJoinedPatch
|
||||
{
|
||||
GameStartManagerPatch.GameStartManagerUpdatePatch.exitTimer = -1;
|
||||
Main.DoBlockNameChange = false;
|
||||
Main.newLobby = true;
|
||||
Main.NewLobby = true;
|
||||
EAC.DeNum = new();
|
||||
Main.AllPlayerNames = [];
|
||||
|
||||
@@ -137,7 +137,7 @@ class OnPlayerLeftPatch
|
||||
{
|
||||
foreach (var lovers in Main.LoversPlayers)
|
||||
{
|
||||
Main.isLoversDead = true;
|
||||
Main.IsLoversDead = true;
|
||||
Main.LoversPlayers.Remove(lovers);
|
||||
Main.PlayerStates[lovers.PlayerId].RemoveSubRole(CustomRoles.Lovers);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ class OnPlayerLeftPatch
|
||||
{
|
||||
Main.SayStartTimes.Remove(__instance.ClientId);
|
||||
Main.SayBanwordsTimes.Remove(__instance.ClientId);
|
||||
Main.playerVersion.Remove(data?.Character?.PlayerId ?? byte.MaxValue);
|
||||
Main.PlayerVersion.Remove(data?.Character?.PlayerId ?? byte.MaxValue);
|
||||
}
|
||||
|
||||
Utils.CountAlivePlayers(true);
|
||||
@@ -302,7 +302,7 @@ class CreatePlayerPatch
|
||||
if (Main.OverrideWelcomeMsg != string.Empty) Utils.SendMessage(Main.OverrideWelcomeMsg, client.Character.PlayerId);
|
||||
else TemplateManager.SendTemplate("welcome", client.Character.PlayerId, true);
|
||||
}, 3f, "Welcome Message");
|
||||
if (Main.OverrideWelcomeMsg == string.Empty && Main.PlayerStates.Count > 0 && Main.clientIdList.Contains(client.Id))
|
||||
if (Main.OverrideWelcomeMsg == string.Empty && Main.PlayerStates.Count > 0 && Main.ClientIdList.Contains(client.Id))
|
||||
{
|
||||
if (Options.AutoDisplayKillLog.GetBool())
|
||||
{
|
||||
@@ -310,7 +310,7 @@ class CreatePlayerPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.IsGameStarted && client.Character != null)
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
Utils.ShowKillLog(client.Character.PlayerId);
|
||||
}
|
||||
}, 1f, "DisplayKillLog");
|
||||
@@ -322,7 +322,7 @@ class CreatePlayerPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.IsGameStarted && client.Character != null)
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
Utils.ShowLastAddOns(client.Character.PlayerId);
|
||||
}
|
||||
}, 1.1f, "DisplayLastAddOns");
|
||||
@@ -334,7 +334,7 @@ class CreatePlayerPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.IsGameStarted && client.Character != null)
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
Utils.ShowLastRoles(client.Character.PlayerId);
|
||||
}
|
||||
}, 1.2f, "DisplayLastRoles");
|
||||
@@ -346,7 +346,7 @@ class CreatePlayerPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.IsGameStarted && client.Character != null)
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
Utils.ShowLastResult(client.Character.PlayerId);
|
||||
}
|
||||
}, 1.3f, "DisplayLastResult");
|
||||
@@ -358,7 +358,7 @@ class CreatePlayerPatch
|
||||
{
|
||||
if (!AmongUsClient.Instance.IsGameStarted && client.Character != null)
|
||||
{
|
||||
Main.isChatCommand = true;
|
||||
Main.IsChatCommand = true;
|
||||
// Utils.SendMessage($"{GetString("Message.YTPlanNotice")} {PlayerControl.LocalPlayer.FriendCode.GetDevUser().UpName}", client.Character.PlayerId);
|
||||
}
|
||||
}, 1.4f, "DisplayUpWarnning");
|
||||
|
||||
@@ -84,7 +84,7 @@ internal class ChangeRoleSettings
|
||||
|
||||
Main.AfterMeetingDeathPlayers = [];
|
||||
Main.ResetCamPlayerList = [];
|
||||
Main.clientIdList = [];
|
||||
Main.ClientIdList = [];
|
||||
|
||||
Main.CheckShapeshift = [];
|
||||
Main.ShapeshiftTarget = [];
|
||||
@@ -113,7 +113,7 @@ internal class ChangeRoleSettings
|
||||
if (Options.CurrentGameMode == CustomGameMode.MoveAndStop) GameOptionsManager.Instance.currentNormalGameOptions.NumImpostors = 0;
|
||||
Main.RealOptionsData = new(GameOptionsManager.Instance.CurrentGameOptions);
|
||||
|
||||
Main.introDestroyed = false;
|
||||
Main.IntroDestroyed = false;
|
||||
|
||||
RandomSpawn.CustomNetworkTransformPatch.NumOfTP = [];
|
||||
|
||||
@@ -163,7 +163,7 @@ internal class ChangeRoleSettings
|
||||
RandomSpawn.CustomNetworkTransformPatch.NumOfTP.Add(pc.PlayerId, 0);
|
||||
var outfit = pc.Data.DefaultOutfit;
|
||||
Camouflage.PlayerSkins[pc.PlayerId] = new GameData.PlayerOutfit().Set(outfit.PlayerName, outfit.ColorId, outfit.HatId, outfit.SkinId, outfit.VisorId, outfit.PetId, outfit.NamePlateId);
|
||||
Main.clientIdList.Add(pc.GetClientId());
|
||||
Main.ClientIdList.Add(pc.GetClientId());
|
||||
}
|
||||
|
||||
Main.VisibleTasksCount = true;
|
||||
@@ -211,6 +211,7 @@ internal class ChangeRoleSettings
|
||||
SabotageSystemTypeRepairDamagePatch.Initialize();
|
||||
DoorsReset.Initialize();
|
||||
GhostRolesManager.Initialize();
|
||||
CustomTeamManager.LoadCustomTeams();
|
||||
|
||||
IRandom.SetInstanceById(Options.RoleAssigningAlgorithm.GetValue());
|
||||
|
||||
@@ -473,7 +474,7 @@ internal class SelectRolesPatch
|
||||
if (Main.SetAddOns.Count(x => x.Value.Contains(CustomRoles.Lovers)) == 2)
|
||||
{
|
||||
Main.LoversPlayers.Clear();
|
||||
Main.isLoversDead = false;
|
||||
Main.IsLoversDead = false;
|
||||
overrideLovers = true;
|
||||
Logger.Warn("Lovers overridden by host's pre-set add-ons", "CustomRoleSelector");
|
||||
}
|
||||
@@ -720,7 +721,7 @@ internal class SelectRolesPatch
|
||||
if (CustomRoles.Lovers.IsEnable())
|
||||
{
|
||||
Main.LoversPlayers.Clear();
|
||||
Main.isLoversDead = false;
|
||||
Main.IsLoversDead = false;
|
||||
AssignLoversRoles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3036,6 +3036,8 @@
|
||||
"InvalidUndeadTarget": "Target cannot be recruited",
|
||||
"Undead-": "Undead ",
|
||||
"BypassShields": "Bypass Shields When Killing",
|
||||
"CustomWinnerText": "{0} Wins!",
|
||||
"TryFixBlackScreen": "Try Fixing Black Screen",
|
||||
"Impartial": "Impartial",
|
||||
"ImpartialInfo": "Kill Specified Number of Players in Each Team",
|
||||
"ImpartialInfoLong": "(Neutral):\\nAs the Impartial, you must kill a specified number of players from each team to win. You can see how many players you need to kill from each team next to your role name.",
|
||||
|
||||
@@ -17,10 +17,11 @@ namespace EHR.Roles.AddOns.Common
|
||||
.SetHeader(true)
|
||||
.SetGameMode(customGameMode) as StringOptionItem;
|
||||
|
||||
LoverSpawnChances = IntegerOptionItem.Create(id + 2, "LoverSpawnChances", new(0, 100, 5), 50, TabGroup.Addons, false)
|
||||
var rateOption = IntegerOptionItem.Create(id + 2, "LoverSpawnChances", new(0, 100, 5), 50, TabGroup.Addons, false)
|
||||
.SetParent(spawnOption)
|
||||
.SetValueFormat(OptionFormat.Percent)
|
||||
.SetGameMode(customGameMode);
|
||||
.SetGameMode(customGameMode) as IntegerOptionItem;
|
||||
LoverSpawnChances = rateOption;
|
||||
|
||||
LoverKnowRoles = BooleanOptionItem.Create(id + 4, "LoverKnowRoles", true, TabGroup.Addons, false)
|
||||
.SetParent(spawnOption)
|
||||
@@ -50,6 +51,8 @@ namespace EHR.Roles.AddOns.Common
|
||||
|
||||
CustomRoleSpawnChances.Add(role, spawnOption);
|
||||
CustomRoleCounts.Add(role, countOption);
|
||||
|
||||
CustomAdtRoleSpawnRate.Add(role, rateOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class Doppelganger : RoleBase
|
||||
DGId = playerId;
|
||||
TotalSteals.Add(playerId, 0);
|
||||
var pc = Utils.GetPlayerById(playerId);
|
||||
if (playerId == PlayerControl.LocalPlayer.PlayerId && Main.nickName.Length != 0) DoppelVictim[playerId] = Main.nickName;
|
||||
if (playerId == PlayerControl.LocalPlayer.PlayerId && Main.NickName.Length != 0) DoppelVictim[playerId] = Main.NickName;
|
||||
else DoppelVictim[playerId] = pc.Data.PlayerName;
|
||||
DoppelDefaultSkin[playerId] = pc.CurrentOutfit;
|
||||
StealTimeStamp = 0;
|
||||
@@ -171,10 +171,10 @@ public class Doppelganger : RoleBase
|
||||
dg.StealTimeStamp = Utils.TimeStamp;
|
||||
|
||||
string kname;
|
||||
if (killer.PlayerId == PlayerControl.LocalPlayer.PlayerId && Main.nickName.Length != 0) kname = Main.nickName;
|
||||
if (killer.PlayerId == PlayerControl.LocalPlayer.PlayerId && Main.NickName.Length != 0) kname = Main.NickName;
|
||||
else kname = killer.Data.PlayerName;
|
||||
string tname;
|
||||
if (target.PlayerId == PlayerControl.LocalPlayer.PlayerId && Main.nickName.Length != 0) tname = Main.nickName;
|
||||
if (target.PlayerId == PlayerControl.LocalPlayer.PlayerId && Main.NickName.Length != 0) tname = Main.NickName;
|
||||
else tname = target.Data.PlayerName;
|
||||
|
||||
var killerSkin = Set(new(), kname, killer.CurrentOutfit.ColorId, killer.CurrentOutfit.HatId, killer.CurrentOutfit.SkinId, killer.CurrentOutfit.VisorId, killer.CurrentOutfit.PetId, killer.CurrentOutfit.NamePlateId);
|
||||
|
||||
@@ -40,12 +40,12 @@ public class Main : BasePlugin
|
||||
public static readonly string SupportedAUVersion = "2024.3.5";
|
||||
|
||||
public Harmony Harmony { get; } = new(PluginGuid);
|
||||
public static Version version = Version.Parse(PluginVersion);
|
||||
public static Version Version = Version.Parse(PluginVersion);
|
||||
public static ManualLogSource Logger;
|
||||
public static bool hasArgumentException;
|
||||
public static bool HasArgumentException;
|
||||
public static string ExceptionMessage;
|
||||
public static bool ExceptionMessageIsShown;
|
||||
public static string credentialsText;
|
||||
public static string CredentialsText;
|
||||
|
||||
public static NormalGameOptionsV07 NormalOptions => GameOptionsManager.Instance.currentNormalGameOptions;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Main : BasePlugin
|
||||
public static ConfigEntry<string> HideColor { get; private set; }
|
||||
public static ConfigEntry<int> MessageWait { get; private set; }
|
||||
public static ConfigEntry<bool> GM { get; private set; }
|
||||
public static ConfigEntry<bool> UnlockFPS { get; private set; }
|
||||
public static ConfigEntry<bool> UnlockFps { get; private set; }
|
||||
public static ConfigEntry<bool> AutoStart { get; private set; }
|
||||
public static ConfigEntry<bool> ForceOwnLanguage { get; private set; }
|
||||
public static ConfigEntry<bool> ForceOwnLanguageRoleName { get; private set; }
|
||||
@@ -65,7 +65,7 @@ public class Main : BasePlugin
|
||||
public static ConfigEntry<bool> GodMode { get; private set; }
|
||||
public static ConfigEntry<bool> DarkTheme { get; private set; }
|
||||
|
||||
public static Dictionary<byte, PlayerVersion> playerVersion = [];
|
||||
public static Dictionary<byte, PlayerVersion> PlayerVersion = [];
|
||||
|
||||
//Preset Name Options
|
||||
public static ConfigEntry<string> Preset1 { get; private set; }
|
||||
@@ -76,8 +76,8 @@ public class Main : BasePlugin
|
||||
public static ConfigEntry<string> Preset5 { get; private set; }
|
||||
|
||||
//Other Configs
|
||||
public static ConfigEntry<string> WebhookURL { get; private set; }
|
||||
public static ConfigEntry<string> BetaBuildURL { get; private set; }
|
||||
public static ConfigEntry<string> WebhookUrl { get; private set; }
|
||||
public static ConfigEntry<string> BetaBuildUrl { get; private set; }
|
||||
public static ConfigEntry<float> LastKillCooldown { get; private set; }
|
||||
public static ConfigEntry<float> LastShapeshifterCooldown { get; private set; }
|
||||
public const string NeutralColor = "#ffab1b";
|
||||
@@ -92,7 +92,7 @@ public class Main : BasePlugin
|
||||
public static Dictionary<(byte, byte), string> LastNotifyNames;
|
||||
public static Dictionary<byte, Color32> PlayerColors = [];
|
||||
public static Dictionary<byte, PlayerState.DeathReason> AfterMeetingDeathPlayers = [];
|
||||
public static Dictionary<CustomRoles, string> roleColors;
|
||||
public static Dictionary<CustomRoles, string> RoleColors;
|
||||
public static Dictionary<byte, CustomRoles> SetRoles = [];
|
||||
public static Dictionary<byte, List<CustomRoles>> SetAddOns = [];
|
||||
public static Dictionary<CustomRoles, CustomRoles> AlwaysSpawnTogetherCombos = [];
|
||||
@@ -109,18 +109,18 @@ public class Main : BasePlugin
|
||||
public static byte PhysicistPlayer = byte.MaxValue;
|
||||
public static byte BloodlustPlayer = byte.MaxValue;
|
||||
public static List<byte> ResetCamPlayerList = [];
|
||||
public static List<byte> winnerList = [];
|
||||
public static List<CustomRoles> winnerRolesList = [];
|
||||
public static List<string> winnerNameList = [];
|
||||
public static List<int> clientIdList = [];
|
||||
public static List<byte> WinnerList = [];
|
||||
public static List<CustomRoles> WinnerRolesList = [];
|
||||
public static List<string> WinnerNameList = [];
|
||||
public static List<int> ClientIdList = [];
|
||||
public static Dictionary<byte, float> AllPlayerKillCooldown = [];
|
||||
public static Dictionary<byte, Vent> LastEnteredVent = [];
|
||||
public static Dictionary<byte, Vector2> LastEnteredVentLocation = [];
|
||||
public static List<(string MESSAGE, byte RECEIVER_ID, string TITLE)> MessagesToSend = [];
|
||||
public static bool isChatCommand;
|
||||
public static bool IsChatCommand;
|
||||
public static bool DoBlockNameChange;
|
||||
public static int updateTime;
|
||||
public static bool newLobby;
|
||||
public static int UpdateTime;
|
||||
public static bool NewLobby;
|
||||
public static Dictionary<int, int> SayStartTimes = [];
|
||||
public static Dictionary<int, int> SayBanwordsTimes = [];
|
||||
public static Dictionary<byte, float> AllPlayerSpeed = [];
|
||||
@@ -131,8 +131,8 @@ public class Main : BasePlugin
|
||||
public static Dictionary<byte, bool> CheckShapeshift = [];
|
||||
public static Dictionary<byte, byte> ShapeshiftTarget = [];
|
||||
public static bool VisibleTasksCount;
|
||||
public static string nickName = "";
|
||||
public static bool introDestroyed;
|
||||
public static string NickName = "";
|
||||
public static bool IntroDestroyed;
|
||||
public static float DefaultCrewmateVision;
|
||||
public static float DefaultImpostorVision;
|
||||
public static bool IsAprilFools = DateTime.Now.Month == 4 && DateTime.Now.Day is 1;
|
||||
@@ -141,7 +141,7 @@ public class Main : BasePlugin
|
||||
public static byte ShieldPlayer = byte.MaxValue;
|
||||
|
||||
public static List<PlayerControl> LoversPlayers = [];
|
||||
public static bool isLoversDead = true;
|
||||
public static bool IsLoversDead = true;
|
||||
public static List<byte> CyberStarDead = [];
|
||||
public static List<byte> BaitAlive = [];
|
||||
public static Dictionary<byte, int> KilledDiseased = [];
|
||||
@@ -189,13 +189,13 @@ public class Main : BasePlugin
|
||||
|
||||
public static Dictionary<byte, List<int>> GuessNumber = [];
|
||||
|
||||
public static List<string> TName_Snacks_CN = ["冰激凌", "奶茶", "巧克力", "蛋糕", "甜甜圈", "可乐", "柠檬水", "冰糖葫芦", "果冻", "糖果", "牛奶", "抹茶", "烧仙草", "菠萝包", "布丁", "椰子冻", "曲奇", "红豆土司", "三彩团子", "艾草团子", "泡芙", "可丽饼", "桃酥", "麻薯", "鸡蛋仔", "马卡龙", "雪梅娘", "炒酸奶", "蛋挞", "松饼", "西米露", "奶冻", "奶酥", "可颂", "奶糖"];
|
||||
public static List<string> NameSnacksCn = ["冰激凌", "奶茶", "巧克力", "蛋糕", "甜甜圈", "可乐", "柠檬水", "冰糖葫芦", "果冻", "糖果", "牛奶", "抹茶", "烧仙草", "菠萝包", "布丁", "椰子冻", "曲奇", "红豆土司", "三彩团子", "艾草团子", "泡芙", "可丽饼", "桃酥", "麻薯", "鸡蛋仔", "马卡龙", "雪梅娘", "炒酸奶", "蛋挞", "松饼", "西米露", "奶冻", "奶酥", "可颂", "奶糖"];
|
||||
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
public static List<string> TName_Snacks_EN = ["Ice cream", "Milk tea", "Chocolate", "Cake", "Donut", "Coke", "Lemonade", "Candied haws", "Jelly", "Candy", "Milk", "Matcha", "Burning Grass Jelly", "Pineapple Bun", "Pudding", "Coconut Jelly", "Cookies", "Red Bean Toast", "Three Color Dumplings", "Wormwood Dumplings", "Puffs", "Can be Crepe", "Peach Crisp", "Mochi", "Egg Waffle", "Macaron", "Snow Plum Niang", "Fried Yogurt", "Egg Tart", "Muffin", "Sago Dew", "panna cotta", "soufflé", "croissant", "toffee"];
|
||||
public static List<string> NameSnacksEn = ["Ice cream", "Milk tea", "Chocolate", "Cake", "Donut", "Coke", "Lemonade", "Candied haws", "Jelly", "Candy", "Milk", "Matcha", "Burning Grass Jelly", "Pineapple Bun", "Pudding", "Coconut Jelly", "Cookies", "Red Bean Toast", "Three Color Dumplings", "Wormwood Dumplings", "Puffs", "Can be Crepe", "Peach Crisp", "Mochi", "Egg Waffle", "Macaron", "Snow Plum Niang", "Fried Yogurt", "Egg Tart", "Muffin", "Sago Dew", "panna cotta", "soufflé", "croissant", "toffee"];
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static string Get_TName_Snacks => TranslationController.Instance.currentLanguage.languageID is SupportedLangs.SChinese or SupportedLangs.TChinese ? TName_Snacks_CN[IRandom.Instance.Next(0, TName_Snacks_CN.Count)] : TName_Snacks_EN[IRandom.Instance.Next(0, TName_Snacks_EN.Count)];
|
||||
public static string Get_TName_Snacks => TranslationController.Instance.currentLanguage.languageID is SupportedLangs.SChinese or SupportedLangs.TChinese ? NameSnacksCn[IRandom.Instance.Next(0, NameSnacksCn.Count)] : NameSnacksEn[IRandom.Instance.Next(0, NameSnacksEn.Count)];
|
||||
|
||||
public static GameData.PlayerInfo LastVotedPlayerInfo { get; set; }
|
||||
|
||||
@@ -211,7 +211,7 @@ public class Main : BasePlugin
|
||||
DebugKeyInput = Config.Bind("Authentication", "Debug Key", string.Empty);
|
||||
AutoStart = Config.Bind("Client Options", "AutoStart", false);
|
||||
GM = Config.Bind("Client Options", "GM", false);
|
||||
UnlockFPS = Config.Bind("Client Options", "UnlockFPS", false);
|
||||
UnlockFps = Config.Bind("Client Options", "UnlockFPS", false);
|
||||
AutoStart = Config.Bind("Client Options", "AutoStart", false);
|
||||
ForceOwnLanguage = Config.Bind("Client Options", "ForceOwnLanguage", false);
|
||||
ForceOwnLanguageRoleName = Config.Bind("Client Options", "ForceOwnLanguageRoleName", false);
|
||||
@@ -261,17 +261,17 @@ public class Main : BasePlugin
|
||||
Preset3 = Config.Bind("Preset Name Options", "Preset3", "Preset_3");
|
||||
Preset4 = Config.Bind("Preset Name Options", "Preset4", "Preset_4");
|
||||
Preset5 = Config.Bind("Preset Name Options", "Preset5", "Preset_5");
|
||||
WebhookURL = Config.Bind("Other", "WebhookURL", "none");
|
||||
BetaBuildURL = Config.Bind("Other", "BetaBuildURL", string.Empty);
|
||||
WebhookUrl = Config.Bind("Other", "WebhookURL", "none");
|
||||
BetaBuildUrl = Config.Bind("Other", "BetaBuildURL", string.Empty);
|
||||
MessageWait = Config.Bind("Other", "MessageWait", 0);
|
||||
LastKillCooldown = Config.Bind("Other", "LastKillCooldown", (float)30);
|
||||
LastShapeshifterCooldown = Config.Bind("Other", "LastShapeshifterCooldown", (float)30);
|
||||
|
||||
hasArgumentException = false;
|
||||
HasArgumentException = false;
|
||||
ExceptionMessage = string.Empty;
|
||||
try
|
||||
{
|
||||
roleColors = new()
|
||||
RoleColors = new()
|
||||
{
|
||||
// Vanilla
|
||||
{ CustomRoles.Crewmate, "#8cffff" },
|
||||
@@ -553,13 +553,13 @@ public class Main : BasePlugin
|
||||
{ CustomRoles.Fox, "#00ff00" },
|
||||
{ CustomRoles.Troll, "#ff00ff" }
|
||||
};
|
||||
Enum.GetValues(typeof(CustomRoles)).Cast<CustomRoles>().Where(x => x.GetCustomRoleTypes() == CustomRoleTypes.Impostor).Do(x => roleColors.TryAdd(x, "#ff1919"));
|
||||
Enum.GetValues(typeof(CustomRoles)).Cast<CustomRoles>().Where(x => x.GetCustomRoleTypes() == CustomRoleTypes.Impostor).Do(x => RoleColors.TryAdd(x, "#ff1919"));
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
EHR.Logger.Error("错误:字典出现重复项", "LoadDictionary");
|
||||
EHR.Logger.Exception(ex, "LoadDictionary");
|
||||
hasArgumentException = true;
|
||||
HasArgumentException = true;
|
||||
ExceptionMessage = ex.Message;
|
||||
ExceptionMessageIsShown = false;
|
||||
}
|
||||
@@ -637,6 +637,9 @@ public enum CustomWinner
|
||||
Error = -4,
|
||||
Neutrals = -5,
|
||||
|
||||
// CTA
|
||||
CustomTeam = -6,
|
||||
|
||||
// Hide And Seek
|
||||
Hider = CustomRoles.Hider,
|
||||
Seeker = CustomRoles.Seeker,
|
||||
|
||||
Reference in new issue
Block a user