mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-11-19 13:16:56 +00:00
some fixes
This commit is contained in:
1 parent
3861754eff
commit
330af450ce
8 files changed
+36
-23
No files matched your search
@@ -53,9 +53,9 @@ public class Main : BaseUnityPlugin
|
||||
private const string DebugKeyHash = "c0fd562955ba56af3ae20d7ec9e64c664f0facecef4b3e366e109306adeae29d";
|
||||
private const string DebugKeySalt = "59687b";
|
||||
public const string PluginGuid = "com.gurge44.endlesshostroles";
|
||||
public const string PluginVersion = "8.0.3";
|
||||
public const string PluginDisplayVersion = "8.0.3";
|
||||
public const int TestBuildNumber = 0; // 0 = Release
|
||||
public const string PluginVersion = "8.1.0";
|
||||
public const string PluginDisplayVersion = "8.1.0";
|
||||
public const int TestBuildNumber = 1; // 0 = Release
|
||||
|
||||
public const string NeutralColor = "#ffab1b";
|
||||
public const string ImpostorColor = "#ff1919";
|
||||
|
||||
@@ -78,6 +78,7 @@ public class PlayerState(byte playerId)
|
||||
Shot,
|
||||
Diseased,
|
||||
Stoned,
|
||||
Collected,
|
||||
|
||||
// Natural Disasters
|
||||
Meteor,
|
||||
|
||||
@@ -2411,8 +2411,10 @@ internal static class ChatCommands
|
||||
|
||||
private static void SayCommand(PlayerControl player, string text, string[] args)
|
||||
{
|
||||
if (!player.IsHost() && !IsPlayerModerator(player.FriendCode)) return;
|
||||
if (args.Length > 1) Utils.SendMessage(args[1..].Join(delimiter: " "), title: $"<color=#ff0000>{GetString(player.IsHost() ? "MessageFromTheHost" : "SayTitle")}</color>", importance: player.IsHost() ? MessageImportance.High : MessageImportance.Medium);
|
||||
if (!player.IsHost() && !IsPlayerModerator(player.FriendCode) || args.Length <= 1) return;
|
||||
|
||||
string title = player.IsHost() ? GetString("MessageFromTheHost") : $"{GetString("SayTitle")} [{player.PlayerId.ColoredPlayerName()}]";
|
||||
Utils.SendMessage(args[1..].Join(delimiter: " "), title: $"<color=#ff0000>{title}</color>", importance: player.IsHost() ? MessageImportance.High : MessageImportance.Medium);
|
||||
}
|
||||
|
||||
private static void DeathCommand(PlayerControl player, string text, string[] args)
|
||||
|
||||
@@ -218,7 +218,7 @@ internal static class CustomSettingsUIPatches
|
||||
List<int> irrelevantOptionIds =
|
||||
[
|
||||
.. Options.CustomRoleSpawnChances.Values
|
||||
.Concat(Options.CustomRoleSpawnChances.Values.SelectMany(x => x.Children))
|
||||
.Concat(Options.CustomRoleSpawnChances.Values.SelectMany(GetAllChildren))
|
||||
.Concat(Options.CustomRoleCounts.Values)
|
||||
.Concat(Options.AddonGuessSettings.Values)
|
||||
.Concat(Options.CustomAdtRoleSpawnRate.Values)
|
||||
@@ -1090,7 +1090,11 @@ internal static class CustomSettingsUIPatches
|
||||
private static void ValueChanged(OptionBehaviour obj)
|
||||
{
|
||||
RolesSettingsMenu instance = GameSettingMenu.Instance.RoleSettingsTab;
|
||||
#if IL2CPP
|
||||
if (obj.TryCastFast(out RoleOptionSetting roleOptionSetting))
|
||||
#else
|
||||
if (obj is RoleOptionSetting roleOptionSetting)
|
||||
#endif
|
||||
{
|
||||
CustomRoles role = OptionItem.SettingObjectNameToRole[roleOptionSetting.name];
|
||||
Options.CustomRoleSpawnChances[role].SetValue(roleOptionSetting.RoleChance / 5);
|
||||
@@ -1098,7 +1102,8 @@ internal static class CustomSettingsUIPatches
|
||||
Options.CustomRoleCounts[role].SetValue(Math.Max(roleOptionSetting.RoleMaxCount - 1, 0));
|
||||
else
|
||||
roleOptionSetting.roleMaxCount = Math.Clamp(roleOptionSetting.roleMaxCount, 0, 1);
|
||||
roleOptionSetting.CountMinusBtn.transform.parent.Find($"MODDED_{role}_AdvancedSettingsButton").gameObject.SetActive(role.IsEnable());
|
||||
Transform transform = roleOptionSetting.CountMinusBtn.transform.parent.Find($"MODDED_{role}_AdvancedSettingsButton");
|
||||
if (transform) transform.gameObject.SetActive(role.IsEnable());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1131,7 +1136,6 @@ internal static class CustomSettingsUIPatches
|
||||
GameOptionsManager.Instance.CurrentGameOptions.SetBool(BoolOptionNames.IsDefaults, false);
|
||||
RefreshChildren();
|
||||
GameOptionsManager.Instance.GameHostOptions = GameOptionsManager.Instance.CurrentGameOptions;
|
||||
GameManager.Instance.LogicOptions.SyncOptions();
|
||||
}
|
||||
|
||||
private static void CreateAdvancedSettings(CustomRoles role)
|
||||
@@ -1242,18 +1246,6 @@ internal static class CustomSettingsUIPatches
|
||||
instance.InitializeControllerNavigation();
|
||||
instance.scrollBar.ScrollToTop();
|
||||
}
|
||||
|
||||
private static IEnumerable<OptionItem> GetAllChildren(OptionItem optionItem)
|
||||
{
|
||||
for (var index = 0; index < optionItem.Children.Count; index++)
|
||||
{
|
||||
OptionItem child = optionItem.Children[index];
|
||||
yield return child;
|
||||
|
||||
foreach (OptionItem descendant in GetAllChildren(child))
|
||||
yield return descendant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(RoleOptionSetting))]
|
||||
@@ -1611,6 +1603,8 @@ internal static class CustomSettingsUIPatches
|
||||
Options.CompileAutoGMRotationSettings();
|
||||
|
||||
Options.AutoSetFactionMinMaxSettings();
|
||||
|
||||
GameManager.Instance.LogicOptions.SyncOptions();
|
||||
|
||||
NotificationPopperPatch.ReleaseRpcs();
|
||||
}
|
||||
@@ -1710,6 +1704,9 @@ internal static class CustomSettingsUIPatches
|
||||
{
|
||||
if (!OptionItem.BehaviourNameToItem.TryGetValue(__instance.name, out OptionItem item)) return true;
|
||||
|
||||
if (item.Name.Contains("KillCooldown", StringComparison.OrdinalIgnoreCase) && (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)))
|
||||
__instance.Value = Main.NormalOptions?.KillCooldown ?? Options.FallBackKillCooldownValue.GetFloat();
|
||||
|
||||
switch (item)
|
||||
{
|
||||
case IntegerOptionItem integerOptionItem:
|
||||
@@ -2032,4 +2029,16 @@ internal static class CustomSettingsUIPatches
|
||||
if (!titleText) titleText = optionBehaviour.transform.Find("Title Text").GetComponent<TextMeshPro>();
|
||||
return titleText;
|
||||
}
|
||||
|
||||
private static IEnumerable<OptionItem> GetAllChildren(OptionItem optionItem)
|
||||
{
|
||||
for (var index = 0; index < optionItem.Children.Count; index++)
|
||||
{
|
||||
OptionItem child = optionItem.Children[index];
|
||||
yield return child;
|
||||
|
||||
foreach (OptionItem descendant in GetAllChildren(child))
|
||||
yield return descendant;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9794,6 +9794,7 @@
|
||||
"DeathReason.Bugged": "Bugged",
|
||||
"DeathReason.Bombed": "Exploded",
|
||||
"DeathReason.Collapsed": "Collapsed",
|
||||
"DeathReason.Collected": "Collected",
|
||||
"DeathReason.Consumed": "Consumed",
|
||||
"DeathReason.Curse": "Cursed",
|
||||
"DeathReason.Cursed": "Cursed",
|
||||
|
||||
@@ -10,6 +10,6 @@ internal class Lazy : IAddon
|
||||
|
||||
public void SetupCustomOption()
|
||||
{
|
||||
SetupAdtRoleOptions(14100, CustomRoles.Lazy, canSetNum: true);
|
||||
SetupAdtRoleOptions(14100, CustomRoles.Lazy, canSetNum: true, teamSpawnOptions: true);
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class MoonDancer : CovenBase
|
||||
|
||||
void GiveAddon()
|
||||
{
|
||||
CustomRoles addon = Options.GroupedAddons[target.Is(Team.Coven) ? AddonTypes.Helpful : AddonTypes.Harmful].Where(x => !target.Is(x) && !x.IsNotAssignableMidGame() && !x.IsConverted() && CustomRolesHelper.CheckAddonConflict(x, target)).RandomElement();
|
||||
CustomRoles addon = Options.GroupedAddons[target.Is(Team.Coven) ? AddonTypes.Helpful : AddonTypes.Harmful].Where(x => !target.Is(x) && x.IsEnable() && !x.IsNotAssignableMidGame() && !x.IsConverted() && CustomRolesHelper.CheckAddonConflict(x, target)).RandomElement();
|
||||
if (addon == default(CustomRoles))
|
||||
return;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SoulCollector : RoleBase
|
||||
|
||||
if (Main.PlayerStates.TryGetValue(target.PlayerId, out PlayerState state))
|
||||
{
|
||||
state.deathReason = PlayerState.DeathReason.Kill;
|
||||
state.deathReason = PlayerState.DeathReason.Collected;
|
||||
state.SetDead();
|
||||
target.SetRealKiller(killer);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user