Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.9.4.0 #66

Merged
merged 20 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0db493a
SetRole RPCの発行数を最適化。DesyncImpostorにも正しく配役
kou-hetare Jul 14, 2024
362694f
DesyncImpostorのRole判定が逆だったため修正
kou-hetare Jul 15, 2024
b77028b
NoiseのDesyncImpostor対応
kou-hetare Jul 15, 2024
85a65e4
Merge pull request #495 from tukasa0001/refact/SetRole
kou-hetare Jul 15, 2024
b9dc135
Merge pull request #498 from tukasa0001/fix/NoiseOnDesyncImp
kou-hetare Jul 18, 2024
88b5126
20240813対応
yurinakira Aug 13, 2024
7b1ee20
バージョンを5.1.8に変更
yurinakira Aug 13, 2024
1880523
サポートされている最低のAmongUsバージョンを2024.8.13に変更
yurinakira Aug 13, 2024
bf516e9
README AmongUsバージョンを6.18に更新
yurinakira Aug 14, 2024
f9d09e0
5.1.8でプレリリース外し
yurinakira Aug 14, 2024
a7928e4
Merge pull request #500 from tukasa0001/fix/Support20240813
yurinakira Aug 14, 2024
570cead
Merge pull request #501 from tukasa0001/verUp/5.1.8
yurinakira Aug 14, 2024
7a8d1cb
Merge pull request #502 from tukasa0001/doc/Readme5.1.8
yurinakira Aug 14, 2024
3199bf4
Merge pull request #503 from tukasa0001/feature/5.1.8_not_Prerelease
yurinakira Aug 14, 2024
4a2b76a
Merge pull request #1323 from tukasa0001/develop-5.1.8
yurinakira Aug 14, 2024
11bd2ec
Merge branch 'main' into work/Merge5.1.8
Hyz-sui Sep 15, 2024
5bc349b
Merge pull request #65 from Hyz-sui/work/Merge5.1.8
Hyz-sui Sep 15, 2024
c8315e8
version 2024.9.4.0
Hyz-sui Sep 17, 2024
55c5183
doc: for non-Japanese speakers
Hyz-sui Sep 17, 2024
8e34168
doc: twitter has gone
Hyz-sui Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Modules/AURoleOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,10 @@ public static bool ShapeshifterLeaveSkin
get => Opt.GetBool(BoolOptionNames.ShapeshifterLeaveSkin);
set => Opt.SetBool(BoolOptionNames.ShapeshifterLeaveSkin, value);
}
public static bool NoisemakerImpostorAlert
{
get => Opt.GetBool(BoolOptionNames.NoisemakerImpostorAlert);
set => Opt.SetBool(BoolOptionNames.NoisemakerImpostorAlert, value);
}
}
}
4 changes: 4 additions & 0 deletions Modules/GameOptionsSender/PlayerGameOptionsSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public override IGameOptions BuildGameOptions()
opt.SetBool(BoolOptionNames.AnonymousVotes, false);
break;
}
if (!role.IsImpostor())
{
AURoleOptions.NoisemakerImpostorAlert = true;
}

var roleClass = player.GetRoleClass();
roleClass?.ApplyGameOptions(opt);
Expand Down
8 changes: 4 additions & 4 deletions Patches/ExilePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public static void Postfix(ExileController __instance)
{
try
{
WrapUpPostfix(__instance.exiled);
WrapUpPostfix(__instance.initData.networkedPlayer);
}
finally
{
WrapUpFinalizer(__instance.exiled);
WrapUpFinalizer(__instance.initData.networkedPlayer);
}
}
}
Expand All @@ -33,11 +33,11 @@ public static void Postfix(AirshipExileController __instance)
{
try
{
WrapUpPostfix(__instance.exiled);
WrapUpPostfix(__instance.initData.networkedPlayer);
}
finally
{
WrapUpFinalizer(__instance.exiled);
WrapUpFinalizer(__instance.initData.networkedPlayer);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Patches/GameOptionsMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public static void Postfix()
OptionItem.SyncAllOptions();
}
}
[HarmonyPatch(typeof(RolesSettingsMenu), nameof(RolesSettingsMenu.Start))]
[HarmonyPatch(typeof(RolesSettingsMenu), nameof(RolesSettingsMenu.InitialSetup))]
public static class RolesSettingsMenuPatch
{
public static void Postfix(RolesSettingsMenu __instance)
Expand Down
83 changes: 28 additions & 55 deletions Patches/onGameStartedPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,13 @@ public static void Prefix()
PlayerControl.LocalPlayer.RpcSetRole(RoleTypes.Crewmate);
PlayerControl.LocalPlayer.Data.IsDead = true;
}
Dictionary<(byte, byte), RoleTypes> rolesMap = new();
foreach (var (role, info) in CustomRoleManager.AllRolesInfo)
{
if (info.IsDesyncImpostor)
{
AssignDesyncRole(role, AllPlayers, senders, rolesMap, BaseRole: info.BaseRoleType.Invoke());
AssignDesyncRole(role, AllPlayers, senders, BaseRole: info.BaseRoleType.Invoke());
}
}
MakeDesyncSender(senders, rolesMap);
}
//以下、バニラ側の役職割り当てが入る
}
Expand All @@ -173,7 +171,7 @@ public static void Postfix()

// 不要なオブジェクトの削除
RpcSetRoleReplacer.senders = null;
RpcSetRoleReplacer.OverriddenSenderList = null;
RpcSetRoleReplacer.DesyncImpostorList = null;
RpcSetRoleReplacer.StoragedData = null;

//Utils.ApplySuffix();
Expand Down Expand Up @@ -345,7 +343,7 @@ public static void Postfix()
Utils.SyncAllSettings();
SetColorPatch.IsAntiGlitchDisabled = false;
}
private static void AssignDesyncRole(CustomRoles role, List<PlayerControl> AllPlayers, Dictionary<byte, CustomRpcSender> senders, Dictionary<(byte, byte), RoleTypes> rolesMap, RoleTypes BaseRole, RoleTypes hostBaseRole = RoleTypes.Crewmate)
private static void AssignDesyncRole(CustomRoles role, List<PlayerControl> AllPlayers, Dictionary<byte, CustomRpcSender> senders, RoleTypes BaseRole, RoleTypes hostBaseRole = RoleTypes.Crewmate)
{
if (!role.IsPresent()) return;

Expand All @@ -358,53 +356,26 @@ private static void AssignDesyncRole(CustomRoles role, List<PlayerControl> AllPl
var player = AllPlayers[rand.Next(0, AllPlayers.Count)];
AllPlayers.Remove(player);
PlayerState.GetByPlayerId(player.PlayerId).SetMainRole(role);
RpcSetRoleReplacer.DesyncImpostorList.Add(player.PlayerId);

var selfRole = player.PlayerId == hostId ? hostBaseRole : BaseRole;
var othersRole = player.PlayerId == hostId ? RoleTypes.Crewmate : RoleTypes.Scientist;

//Desync役職視点
foreach (var target in Main.AllPlayerControls)
var hostRole = player.PlayerId == hostId ? hostBaseRole : RoleTypes.Crewmate;
foreach (var seer in Main.AllPlayerControls)
{
if (player.PlayerId != target.PlayerId)
if (seer.PlayerId == hostId)
{
rolesMap[(player.PlayerId, target.PlayerId)] = othersRole;
//ホスト視点は即確定
player.StartCoroutine(player.CoSetRole(hostRole, false));
}
else
{
rolesMap[(player.PlayerId, target.PlayerId)] = selfRole;
}
}

//他者視点
foreach (var seer in Main.AllPlayerControls)
{
if (player.PlayerId != seer.PlayerId)
{
rolesMap[(seer.PlayerId, player.PlayerId)] = othersRole;
var assignRole = seer.PlayerId == player.PlayerId ? BaseRole : RoleTypes.Scientist;
senders[player.PlayerId].RpcSetRole(player, assignRole, seer.GetClientId());
}
}
RpcSetRoleReplacer.OverriddenSenderList.Add(senders[player.PlayerId]);
//ホスト視点はロール決定
player.StartCoroutine(player.CoSetRole(othersRole, false));
//vailla配役の回避
player.Data.IsDead = true;
}
}
public static void MakeDesyncSender(Dictionary<byte, CustomRpcSender> senders, Dictionary<(byte, byte), RoleTypes> rolesMap)
{
var hostId = PlayerControl.LocalPlayer.PlayerId;
foreach (var seer in Main.AllPlayerControls)
{
var sender = senders[seer.PlayerId];
foreach (var target in Main.AllPlayerControls)
{
if (rolesMap.TryGetValue((seer.PlayerId, target.PlayerId), out var role))
{
sender.RpcSetRole(seer, role, target.GetClientId());
}
}
}
}

private static List<PlayerControl> AssignCustomRolesFromList(CustomRoles role, List<PlayerControl> players, int RawCount = -1)
{
if (players == null || players.Count <= 0) return null;
Expand Down Expand Up @@ -480,8 +451,7 @@ class RpcSetRoleReplacer
public static bool doReplace = false;
public static Dictionary<byte, CustomRpcSender> senders;
public static List<(PlayerControl, RoleTypes)> StoragedData = new();
// 役職Desyncなど別の処理でSetRoleRpcを書き込み済みなため、追加の書き込みが不要なSenderのリスト
public static List<CustomRpcSender> OverriddenSenderList;
public static List<byte> DesyncImpostorList;
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] RoleTypes roleType)
{
if (doReplace && senders != null)
Expand All @@ -493,29 +463,32 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] RoleTyp
}
public static void Release()
{
foreach (var sender in senders)
foreach (var (player, role) in StoragedData)
{
if (OverriddenSenderList.Contains(sender.Value)) continue;
if (sender.Value.CurrentState != CustomRpcSender.State.InRootMessage)
throw new InvalidOperationException("A CustomRpcSender had Invalid State.");
//ホスト視点は即確定
player.StartCoroutine(player.CoSetRole(role, false));

foreach (var pair in StoragedData)
var impostorRole = role is RoleTypes.Impostor or RoleTypes.Shapeshifter or RoleTypes.Phantom;
if (impostorRole && DesyncImpostorList.Count != 0)
{
foreach (var seer in Main.AllPlayerControls)
{
var assignRole = DesyncImpostorList.Contains(seer.PlayerId) ? RoleTypes.Scientist : role;
senders[player.PlayerId].RpcSetRole(player, assignRole, seer.GetClientId());
}
}
else
{
pair.Item1.StartCoroutine(pair.Item1.CoSetRole(pair.Item2, false));
sender.Value.AutoStartRpc(pair.Item1.NetId, (byte)RpcCalls.SetRole, Utils.GetPlayerById(sender.Key).GetClientId())
.Write((ushort)pair.Item2)
.Write(false)
.EndRpc();
senders[player.PlayerId].RpcSetRole(player, role);
}
sender.Value.EndMessage();
}
doReplace = false;
}
public static void StartReplace(Dictionary<byte, CustomRpcSender> senders)
{
RpcSetRoleReplacer.senders = senders;
StoragedData = new();
OverriddenSenderList = new();
DesyncImpostorList = new();
doReplace = true;
}
}
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,22 @@
</div>
<!-- markdownlint-enable MD033 -->

<details><p><summary>English (Click)</summary></p>

**TownOfHost-H** is a fork of [Town Of Host](https://github.com/tukasa0001/TownOfHost), a host-only mod for AMONG US.
Everything is made for Japanese players and is all in Japanese.

If you don't understand Japanese and want to play AMONG US (i.e., you are not looking for resources or knowledge for software development), there is nothing here that you want. I recommend you to use [Town Of Host](https://github.com/tukasa0001/TownOfHost) or any other mod instead.

----

</details>

各機能や詳細な説明は[wiki](https://github.com/Hyz-sui/TownOfHost-H/wiki)を,フォーク元から変更されていない機能については[TownOfHostのreadme](https://github.com/tukasa0001/TownOfHost/blob/main/README.md#town-of-host)を参照してください

- 公開ルームは**永遠に**封印
- 知人以外からの質問やバグ報告等は[Issues](https://github.com/Hyz-sui/TownOfHost-H/issues/new)**のみ**受け付けています
TwitterやDiscord等では受け付けていません
製作者のSNSアカウントやDiscord等では受け付けていません
- 既存の説明を読めばわかるもの,低レベルなもの,日本語のコミュニケーションが怪しいもの,聞く相手を間違ってるもの等々には基本対応しません
- 11人2狼村(0-2イビルハッカー, 1シェリフ, 1マッド)以外の役職構成や特定の設定の組み合わせで発生するバグ等については低優先度で扱います
- 多言語対応はしていませんし,する予定もありません
Expand Down
6 changes: 3 additions & 3 deletions main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ public class Main : BasePlugin
// ==========
//Sorry for many Japanese comments.

public static readonly string ForkVersion = "2024.6.18.0";
public static readonly string ForkVersion = "2024.9.4.0";
public static readonly Version ParsedForkVersion = Version.Parse(ForkVersion);

public const string PluginGuid = "com.emptybottle.townofhost";
public const string PluginVersion = "5.1.7";
public const string PluginVersion = "5.1.8";
// サポートされている最低のAmongUsバージョン
public static readonly string LowestSupportedVersion = "2024.6.18";
public static readonly string LowestSupportedVersion = "2024.8.13";
// このバージョンのみで公開ルームを無効にする場合
public static readonly bool IsPublicAvailableOnThisVersion = false;
// プレリリースかどうか
Expand Down