mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
v09
This commit is contained in:
1 parent
c05823a424
commit
2ee88dc5df
3 files changed
+7
-98
No files matched your search
@@ -15,7 +15,7 @@ public static class IGameManagerEx
|
||||
opt.SetBool(name, value);
|
||||
}
|
||||
|
||||
public static void Set(this BoolOptionNames name, bool value, HideNSeekGameOptionsV08 opt)
|
||||
public static void Set(this BoolOptionNames name, bool value, HideNSeekGameOptionsV09 opt)
|
||||
{
|
||||
opt.SetBool(name, value);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public static class IGameManagerEx
|
||||
opt.SetInt(name, value);
|
||||
}
|
||||
|
||||
public static void Set(this Int32OptionNames name, int value, HideNSeekGameOptionsV08 opt)
|
||||
public static void Set(this Int32OptionNames name, int value, HideNSeekGameOptionsV09 opt)
|
||||
{
|
||||
opt.SetInt(name, value);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public static class IGameManagerEx
|
||||
opt.SetFloat(name, value);
|
||||
}
|
||||
|
||||
public static void Set(this FloatOptionNames name, float value, HideNSeekGameOptionsV08 opt)
|
||||
public static void Set(this FloatOptionNames name, float value, HideNSeekGameOptionsV09 opt)
|
||||
{
|
||||
opt.SetFloat(name, value);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public static class IGameManagerEx
|
||||
opt.SetByte(name, value);
|
||||
}
|
||||
|
||||
public static void Set(this ByteOptionNames name, byte value, HideNSeekGameOptionsV08 opt)
|
||||
public static void Set(this ByteOptionNames name, byte value, HideNSeekGameOptionsV09 opt)
|
||||
{
|
||||
opt.SetByte(name, value);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public static class IGameManagerEx
|
||||
opt.SetUInt(name, value);
|
||||
}
|
||||
|
||||
public static void Set(this UInt32OptionNames name, uint value, HideNSeekGameOptionsV08 opt)
|
||||
public static void Set(this UInt32OptionNames name, uint value, HideNSeekGameOptionsV09 opt)
|
||||
{
|
||||
opt.SetUInt(name, value);
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public abstract class GameOptionsSender
|
||||
|
||||
if (opt.TryCast(out NormalGameOptionsV09 normalOpt))
|
||||
NormalGameOptionsV09.Serialize(writer, normalOpt);
|
||||
else if (opt.TryCast(out HideNSeekGameOptionsV08 hnsOpt))
|
||||
HideNSeekGameOptionsV08.Serialize(writer, hnsOpt);
|
||||
else if (opt.TryCast(out HideNSeekGameOptionsV09 hnsOpt))
|
||||
HideNSeekGameOptionsV09.Serialize(writer, hnsOpt);
|
||||
else
|
||||
{
|
||||
writer.Recycle();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using AmongUs.GameOptions;
|
||||
using HarmonyLib;
|
||||
|
||||
@@ -33,94 +32,4 @@ internal static class SwitchGameModePatch
|
||||
Harmony.UnpatchAll();
|
||||
Main.Instance.Unload();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(NormalGameOptionsV09), nameof(NormalGameOptionsV09.SetRecommendations), typeof(int), typeof(bool), typeof(RulesPresets))]
|
||||
[HarmonyPatch(typeof(NormalGameOptionsV09), nameof(NormalGameOptionsV09.SetRecommendations), typeof(int), typeof(bool))]
|
||||
internal static class SetRecommendationsPatch
|
||||
{
|
||||
public static void Postfix(NormalGameOptionsV09 __instance,
|
||||
[HarmonyArgument(0)] int numPlayers,
|
||||
[HarmonyArgument(1)] bool isOnline)
|
||||
{
|
||||
numPlayers = Math.Clamp(numPlayers, 4, 15);
|
||||
__instance.PlayerSpeedMod = __instance.MapId == 4 ? 1.5f : 1.25f;
|
||||
__instance.CrewLightMod = 0.5f;
|
||||
__instance.ImpostorLightMod = 1.25f;
|
||||
__instance.KillCooldown = 27.5f;
|
||||
__instance.NumCommonTasks = 1;
|
||||
__instance.NumLongTasks = 3;
|
||||
__instance.NumShortTasks = 4;
|
||||
__instance.NumEmergencyMeetings = 1;
|
||||
__instance.NumImpostors = GetRecommendedImpostors();
|
||||
__instance.KillDistance = 1;
|
||||
__instance.DiscussionTime = 0;
|
||||
__instance.VotingTime = 120;
|
||||
__instance.IsDefaults = true;
|
||||
__instance.ConfirmImpostor = false;
|
||||
__instance.VisualTasks = false;
|
||||
|
||||
__instance.roleOptions.SetRoleRate(RoleTypes.Shapeshifter, 0, 0);
|
||||
__instance.roleOptions.SetRoleRate(RoleTypes.Scientist, 0, 0);
|
||||
__instance.roleOptions.SetRoleRate(RoleTypes.GuardianAngel, 0, 0);
|
||||
__instance.roleOptions.SetRoleRate(RoleTypes.Engineer, 0, 0);
|
||||
__instance.roleOptions.SetRoleRecommended(RoleTypes.Shapeshifter);
|
||||
__instance.roleOptions.SetRoleRecommended(RoleTypes.Scientist);
|
||||
__instance.roleOptions.SetRoleRecommended(RoleTypes.GuardianAngel);
|
||||
__instance.roleOptions.SetRoleRecommended(RoleTypes.Engineer);
|
||||
|
||||
switch (Options.CurrentGameMode)
|
||||
{
|
||||
case CustomGameMode.AllInOne:
|
||||
case CustomGameMode.SoloKombat:
|
||||
case CustomGameMode.FFA:
|
||||
case CustomGameMode.RoomRush:
|
||||
case CustomGameMode.NaturalDisasters:
|
||||
case CustomGameMode.HotPotato:
|
||||
case CustomGameMode.CaptureTheFlag:
|
||||
case CustomGameMode.KingOfTheZones:
|
||||
__instance.CrewLightMod = __instance.ImpostorLightMod = 1.25f;
|
||||
__instance.NumImpostors = 3;
|
||||
__instance.NumCommonTasks = 0;
|
||||
__instance.NumLongTasks = 0;
|
||||
__instance.NumShortTasks = 0;
|
||||
__instance.KillCooldown = 0f;
|
||||
__instance.NumEmergencyMeetings = 0;
|
||||
__instance.KillDistance = 0;
|
||||
break;
|
||||
case CustomGameMode.Speedrun:
|
||||
case CustomGameMode.MoveAndStop:
|
||||
__instance.CrewLightMod = 1.25f;
|
||||
__instance.ImpostorLightMod = 1.25f;
|
||||
__instance.KillCooldown = 60f;
|
||||
__instance.NumCommonTasks = 2;
|
||||
__instance.NumLongTasks = 3;
|
||||
__instance.NumShortTasks = 5;
|
||||
__instance.NumEmergencyMeetings = 0;
|
||||
__instance.VisualTasks = true;
|
||||
break;
|
||||
case CustomGameMode.HideAndSeek:
|
||||
__instance.CrewLightMod = 1.25f;
|
||||
__instance.ImpostorLightMod = 0.5f;
|
||||
__instance.KillCooldown = 10f;
|
||||
__instance.NumCommonTasks = 2;
|
||||
__instance.NumLongTasks = 3;
|
||||
__instance.NumShortTasks = 5;
|
||||
__instance.NumEmergencyMeetings = 0;
|
||||
__instance.VisualTasks = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
int GetRecommendedImpostors()
|
||||
{
|
||||
return numPlayers switch
|
||||
{
|
||||
> 13 => 3,
|
||||
> 8 => 2,
|
||||
_ => 1
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user