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

Develop 5.1.4 #1305

Merged
merged 49 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1d1cb7c
キノコカオス効果時間変更のオプションと翻訳を追加
Hyz-sui Nov 3, 2023
45e5514
キノコカオス効果時間変更処理を作成
Hyz-sui Nov 3, 2023
d6d34d1
ファングルリアクター時間制限のオプションと翻訳を作成
Hyz-sui Nov 3, 2023
46fbf0b
リアクターカウントダウン変更処理を作成
Hyz-sui Nov 3, 2023
f03bab5
デバッグビルド時にオプションIDが重複していた場合のErrorを作成
Hyz-sui Nov 6, 2023
27ec47e
Merge pull request #436 from tukasa0001/feature/FungleReactorDuration
Hyz-sui Nov 8, 2023
2719f2e
Merge branch 'develop' into feature/MushroomMixupDuration
Hyz-sui Nov 8, 2023
c4524e9
Merge pull request #437 from tukasa0001/feature/MushroomMixupDuration
Hyz-sui Nov 8, 2023
ee738f6
RoleAssignInfoにAssignRoleType追加
Masami4711 Nov 8, 2023
64900b4
RoleAssignManagerにAssignRoleTypeを適用
Masami4711 Nov 8, 2023
85c0ddd
EgoistのAssignRoleTypeを変更
Masami4711 Nov 8, 2023
7f5c1b1
Merge pull request #442 from tukasa0001/feature/OptionIdDuplicateError
Hyz-sui Nov 14, 2023
7e97944
Airshipの初期配置判定をタスクターン前のもので判定するよう変更
kou-hetare Nov 22, 2023
aaac548
AirshipのランダムスポーンでGMの初期位置を指定
kou-hetare Nov 22, 2023
703516c
ゲーム終了時のメッセージ群をCustomRpcSenderに纏めず,遅延を挟んで個別に送るよう変更
Hyz-sui Nov 22, 2023
1ee5165
CustomWinnerHolderの同期でのint型の送受信をPackedIntに変更
Hyz-sui Nov 22, 2023
a62ede4
FirstTPの初期値をtrueに変更
kou-hetare Nov 23, 2023
453922b
最終結果チャットの水平位置の装飾を削除
Hyz-sui Nov 24, 2023
1aeb562
Merge pull request #444 from tukasa0001/fix/AssignEgoist
Masami4711 Nov 24, 2023
a764c6e
FirstTPの定義位置変更。会議後の初期化ミスの修正
kou-hetare Nov 25, 2023
32c8b08
Airshipのスポーン判定の見直し
kou-hetare Nov 25, 2023
5316957
RpcSnapToの作成。TPの削除
kou-hetare Nov 26, 2023
809e557
早湧きが他視点で表示されない点の対策
kou-hetare Nov 26, 2023
71f6640
ログ削減
kou-hetare Nov 26, 2023
fc8cff3
RpcSnapToPatchのPrefix削除漏れ
kou-hetare Nov 27, 2023
4277c5f
ヘリサボ直しの再突入禁止
kou-hetare Nov 30, 2023
b683d95
属性の場合はRoleBaseを破棄しない
kou-hetare Nov 30, 2023
30c3d85
ShowActiveSettingsに改ページを挟むよう変更
kou-hetare Dec 3, 2023
f061962
コメント修正
kou-hetare Dec 3, 2023
091fb55
Merge pull request #447 from tukasa0001/fix/ResultChatNotDelivered
Hyz-sui Dec 6, 2023
e814101
Merge pull request #448 from tukasa0001/fix/SabotageMasterFixHeliSabo
kou-hetare Dec 7, 2023
7df38c1
Merge pull request #449 from tukasa0001/fix/LastImpostorCannotUseSabo…
kou-hetare Dec 7, 2023
6a049d3
現在のマップのみ表示する
kou-hetare Dec 7, 2023
aa1a9b4
ランダムスポーンOFFのマップは展開しないようにする
kou-hetare Dec 7, 2023
00bd678
RandomSpawnの後を確定改ページにしない
kou-hetare Dec 7, 2023
a5c65f5
スタンダードでは狐とトロールを表示しない
kou-hetare Dec 7, 2023
45e01fa
Merge pull request #450 from tukasa0001/fix/ShowActiveSettings
kou-hetare Dec 7, 2023
75ebf64
Merge pull request #446 from tukasa0001/fix/DisconnectAtGameEnd
Hyz-sui Dec 15, 2023
a47194d
GM、ランダムスポーン無し用のスポーン追加
kou-hetare Dec 30, 2023
fe4c39f
Merge pull request #445 from tukasa0001/fix/RandomSpawnAtAirship
kou-hetare Dec 30, 2023
e7995ed
PresetOptionItemにSetValueのオーバーロードのオーバーライドを追加
Hyz-sui Dec 31, 2023
b4f4398
Merge pull request #452 from tukasa0001/fix/PresetRefresh
Hyz-sui Dec 31, 2023
8eb8acd
readmeにファングルのリアクターとキノコカオスの時間変更を追加
Hyz-sui Jan 10, 2024
02e7615
対応アモアスバージョンを2023.11.28に変更
Hyz-sui Jan 10, 2024
3bb49b2
バージョンを5.1.4に変更
Hyz-sui Jan 10, 2024
8590ada
Crowdinの翻訳をインポート
tanakanira0118 Jan 10, 2024
279a281
Merge pull request #454 from tukasa0001/verUp/5.1.4
Hyz-sui Jan 11, 2024
1e04be1
Merge pull request #453 from tukasa0001/doc/ReadMe5.1.4
Hyz-sui Jan 11, 2024
0daba19
Merge pull request #455 from tukasa0001/import-translate
Hyz-sui Jan 11, 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
24 changes: 12 additions & 12 deletions Modules/CustomWinnerHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,38 +57,38 @@ public static void ResetAndSetWinner(CustomWinner winner)

public static MessageWriter WriteTo(MessageWriter writer)
{
writer.Write((int)WinnerTeam);
writer.WritePacked((int)WinnerTeam);

writer.Write(AdditionalWinnerRoles.Count);
writer.WritePacked(AdditionalWinnerRoles.Count);
foreach (var wr in AdditionalWinnerRoles)
writer.Write((int)wr);
writer.WritePacked((int)wr);

writer.Write(WinnerRoles.Count);
writer.WritePacked(WinnerRoles.Count);
foreach (var wr in WinnerRoles)
writer.Write((int)wr);
writer.WritePacked((int)wr);

writer.Write(WinnerIds.Count);
writer.WritePacked(WinnerIds.Count);
foreach (var id in WinnerIds)
writer.Write(id);

return writer;
}
public static void ReadFrom(MessageReader reader)
{
WinnerTeam = (CustomWinner)reader.ReadInt32();
WinnerTeam = (CustomWinner)reader.ReadPackedInt32();

AdditionalWinnerRoles = new();
int AdditionalWinnerRolesCount = reader.ReadInt32();
int AdditionalWinnerRolesCount = reader.ReadPackedInt32();
for (int i = 0; i < AdditionalWinnerRolesCount; i++)
AdditionalWinnerRoles.Add((CustomRoles)reader.ReadInt32());
AdditionalWinnerRoles.Add((CustomRoles)reader.ReadPackedInt32());

WinnerRoles = new();
int WinnerRolesCount = reader.ReadInt32();
int WinnerRolesCount = reader.ReadPackedInt32();
for (int i = 0; i < WinnerRolesCount; i++)
WinnerRoles.Add((CustomRoles)reader.ReadInt32());
WinnerRoles.Add((CustomRoles)reader.ReadPackedInt32());

WinnerIds = new();
int WinnerIdsCount = reader.ReadInt32();
int WinnerIdsCount = reader.ReadPackedInt32();
for (int i = 0; i < WinnerIdsCount; i++)
WinnerIds.Add(reader.ReadByte());
}
Expand Down
1 change: 1 addition & 0 deletions Modules/ErrorText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public enum ErrorCode
// ==========
// 001 Main
Main_DictionaryError = 0010003, // 001-000-3 Main Dictionary Error
OptionIDDuplicate = 001_010_3, // 001-010-3 オプションIDが重複している(DEBUGビルド時のみ)
// 002 サポート関連
UnsupportedVersion = 002_000_1, // 002-000-1 AmongUsのバージョンが古い
// ==========
Expand Down
24 changes: 20 additions & 4 deletions Modules/ExtendedPlayerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ public static void RpcSetCustomRole(this PlayerControl player, CustomRoles role)
}
if (AmongUsClient.Instance.AmHost)
{
var roleClass = player.GetRoleClass();
if (roleClass != null)
if (role < CustomRoles.NotAssigned)
{
roleClass.Dispose();
CustomRoleManager.CreateInstance(role, player);
var roleClass = player.GetRoleClass();
if (roleClass != null)
{
roleClass.Dispose();
CustomRoleManager.CreateInstance(role, player);
}
}

MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetCustomRole, Hazel.SendOption.Reliable, -1);
Expand Down Expand Up @@ -567,6 +570,19 @@ public static PlainShipRoom GetPlainShipRoom(this PlayerControl pc)
}
return null;
}
public static void RpcSnapTo(this PlayerControl pc, Vector2 position)
{
pc.NetTransform.RpcSnapTo(position);
}
public static void RpcSnapToDesync(this PlayerControl pc, PlayerControl target, Vector2 position)
{
var net = pc.NetTransform;
var num = (ushort)(net.lastSequenceId + 2);
MessageWriter messageWriter = AmongUsClient.Instance.StartRpcImmediately(net.NetId, (byte)RpcCalls.SnapTo, SendOption.None, target.GetClientId());
NetHelpers.WriteVector2(position, messageWriter);
messageWriter.Write(num);
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
}
public static bool IsProtected(this PlayerControl self) => self.protectedByGuardianId > -1;

//汎用
Expand Down
8 changes: 8 additions & 0 deletions Modules/OptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ public static CustomGameMode CurrentGameMode
public static OptionItem SabotageTimeControl;
public static OptionItem PolusReactorTimeLimit;
public static OptionItem AirshipReactorTimeLimit;
public static OptionItem FungleReactorTimeLimit;
public static OptionItem FungleMushroomMixupDuration;

// サボタージュのクールダウン変更
public static OptionItem ModifySabotageCooldown;
Expand Down Expand Up @@ -456,6 +458,12 @@ public static void Load()
AirshipReactorTimeLimit = FloatOptionItem.Create(100802, "AirshipReactorTimeLimit", new(1f, 90f, 1f), 60f, TabGroup.MainSettings, false).SetParent(SabotageTimeControl)
.SetValueFormat(OptionFormat.Seconds)
.SetGameMode(CustomGameMode.Standard);
FungleReactorTimeLimit = FloatOptionItem.Create(100803, "FungleReactorTimeLimit", new(1f, 90f, 1f), 60f, TabGroup.MainSettings, false).SetParent(SabotageTimeControl)
.SetValueFormat(OptionFormat.Seconds)
.SetGameMode(CustomGameMode.Standard);
FungleMushroomMixupDuration = FloatOptionItem.Create(100804, "FungleMushroomMixupDuration", new(1f, 20f, 1f), 10f, TabGroup.MainSettings, false).SetParent(SabotageTimeControl)
.SetValueFormat(OptionFormat.Seconds)
.SetGameMode(CustomGameMode.Standard);

// サボタージュのクールダウン変更
ModifySabotageCooldown = BooleanOptionItem.Create(100810, "ModifySabotageCooldown", false, TabGroup.MainSettings, false)
Expand Down
8 changes: 7 additions & 1 deletion Modules/OptionItem/OptionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public abstract class OptionItem
public static IReadOnlyDictionary<int, OptionItem> FastOptions => _fastOptions;
private static Dictionary<int, OptionItem> _fastOptions = new(1024);
public static int CurrentPreset { get; set; }
#if DEBUG
public static bool IdDuplicated { get; private set; } = false;
#endif
#endregion

// 必須情報 (コンストラクタで必ず設定させる必要がある値)
Expand Down Expand Up @@ -105,6 +108,9 @@ public OptionItem(int id, string name, int defaultValue, TabGroup tab, bool isSi
}
else
{
#if DEBUG
IdDuplicated = true;
#endif
Logger.Error($"ID:{id}が重複しています", "OptionItem");
}
}
Expand Down Expand Up @@ -179,7 +185,7 @@ public virtual void Refresh()
opt.oldValue = opt.Value = CurrentValue;
}
}
public void SetValue(int afterValue, bool doSave, bool doSync = true)
public virtual void SetValue(int afterValue, bool doSave, bool doSync = true)
{
int beforeValue = CurrentValue;
if (IsSingleValue)
Expand Down
5 changes: 5 additions & 0 deletions Modules/OptionItem/PresetOptionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ public override void SetValue(int value, bool doSync = true)
base.SetValue(Rule.RepeatIndex(value), doSync);
SwitchPreset(Rule.RepeatIndex(value));
}
public override void SetValue(int afterValue, bool doSave, bool doSync = true)
{
base.SetValue(Rule.RepeatIndex(afterValue), doSave, doSync);
SwitchPreset(Rule.RepeatIndex(afterValue));
}
}
}
102 changes: 79 additions & 23 deletions Modules/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -543,24 +543,68 @@ public static void ShowActiveSettings(byte PlayerId = byte.MaxValue)
if (RoleAssignManager.OptionAssignMode.GetBool())
{
ShowChildrenSettings(RoleAssignManager.OptionAssignMode, ref sb);
CheckPageChange(PlayerId, sb);
}
foreach (var role in Options.CustomRoleCounts)
{
if (!role.Key.IsEnable()) continue;
if (role.Key is CustomRoles.HASFox or CustomRoles.HASTroll) continue;

sb.Append($"\n【{GetRoleName(role.Key)}×{role.Key.GetCount()}】\n");
ShowChildrenSettings(Options.CustomRoleSpawnChances[role.Key], ref sb);
CheckPageChange(PlayerId, sb);
}
foreach (var opt in OptionItem.AllOptions.Where(x => x.GetBool() && x.Parent == null && x.Id >= 80000 && !x.IsHiddenOn(Options.CurrentGameMode)))
{
if (opt.Name is "KillFlashDuration" or "RoleAssigningAlgorithm")
sb.Append($"\n【{opt.GetName(true)}: {opt.GetString()}】\n");
if (opt.Name is "RandomSpawn")
{
foreach (var randomOpt in opt.Children)
{
if ((randomOpt.Id / 100) % 10 != mapId) continue;
//現在のマップのみ表示する
if (randomOpt.GetBool())
{
//Onの時は頭に改ページを入れる
CheckPageChange(PlayerId, sb, true);
sb.Append($"\n【{opt.GetName(true)}】");
sb.Append($"\n {randomOpt.GetName(true)}: {randomOpt.GetString()}\n");

ShowChildrenSettings(randomOpt, ref sb, 1);
}
else
{
//オフならそのままで大丈夫
sb.Append($"\n【{opt.GetName(true)}】");
sb.Append($"\n {randomOpt.GetName(true)}: {randomOpt.GetString()}\n");
}
}
CheckPageChange(PlayerId, sb);
}
else
sb.Append($"\n【{opt.GetName(true)}】\n");
ShowChildrenSettings(opt, ref sb);
{
if (opt.Name is "KillFlashDuration" or "RoleAssigningAlgorithm")
sb.Append($"\n【{opt.GetName(true)}: {opt.GetString()}】\n");
else
sb.Append($"\n【{opt.GetName(true)}】\n");
ShowChildrenSettings(opt, ref sb);
CheckPageChange(PlayerId, sb);
}
}
}
SendMessage(sb.ToString(), PlayerId, removeTags: false);
}

private static void CheckPageChange(byte PlayerId, StringBuilder sb, bool force = false)
{
//2Byte文字想定で1000byt越えるならページを変える
if (force || sb.Length > 500)
{
SendMessage(sb.ToString(), PlayerId, removeTags: false);
sb.Clear();
sb.AppendFormat("<size={0}>", ActiveSettingsSize);
}
}

public static void CopyCurrentSettings()
{
var sb = new StringBuilder();
Expand Down Expand Up @@ -1020,27 +1064,39 @@ public static void OpenDirectory(string path)
}
public static string SummaryTexts(byte id, bool isForChat)
{
// 全プレイヤー中最長の名前の長さからプレイヤー名の後の水平位置を計算する
// 1em ≒ 半角2文字
// 空白は0.5emとする
// SJISではアルファベットは1バイト,日本語は基本的に2バイト
var longestNameByteCount = Main.AllPlayerNames.Values.Select(name => name.GetByteCount()).OrderByDescending(byteCount => byteCount).FirstOrDefault();
//最大11.5emとする(★+日本語10文字分+半角空白)
var pos = Math.Min(((float)longestNameByteCount / 2) + 1.5f /* ★+末尾の半角空白 */ , 11.5f);

var builder = new StringBuilder();
builder.Append(isForChat ? Main.AllPlayerNames[id] : ColorString(Main.PlayerColors[id], Main.AllPlayerNames[id]));
builder.AppendFormat("<pos={0}em>", pos).Append(isForChat ? GetProgressText(id).RemoveColorTags() : GetProgressText(id)).Append("</pos>");
// "(00/00) " = 4em
pos += 4f;
builder.AppendFormat("<pos={0}em>", pos).Append(GetVitalText(id)).Append("</pos>");
// "Lover's Suicide " = 8em
// "回線切断 " = 4.5em
pos += DestroyableSingleton<TranslationController>.Instance.currentLanguage.languageID == SupportedLangs.English ? 8f : 4.5f;
builder.AppendFormat("<pos={0}em>", pos);
builder.Append(isForChat ? GetTrueRoleName(id, false).RemoveColorTags() : GetTrueRoleName(id, false));
builder.Append(isForChat ? GetSubRolesText(id).RemoveColorTags() : GetSubRolesText(id));
builder.Append("</pos>");
// チャットならposタグを使わない(文字数削減)
if (isForChat)
{
builder.Append(Main.AllPlayerNames[id]);
builder.Append(": ").Append(GetProgressText(id).RemoveColorTags());
builder.Append(' ').Append(GetVitalText(id));
builder.Append(' ').Append(GetTrueRoleName(id, false).RemoveColorTags());
builder.Append(' ').Append(GetSubRolesText(id).RemoveColorTags());
}
else
{
// 全プレイヤー中最長の名前の長さからプレイヤー名の後の水平位置を計算する
// 1em ≒ 半角2文字
// 空白は0.5emとする
// SJISではアルファベットは1バイト,日本語は基本的に2バイト
var longestNameByteCount = Main.AllPlayerNames.Values.Select(name => name.GetByteCount()).OrderByDescending(byteCount => byteCount).FirstOrDefault();
//最大11.5emとする(★+日本語10文字分+半角空白)
var pos = Math.Min(((float)longestNameByteCount / 2) + 1.5f /* ★+末尾の半角空白 */ , 11.5f);
builder.Append(ColorString(Main.PlayerColors[id], Main.AllPlayerNames[id]));
builder.AppendFormat("<pos={0}em>", pos).Append(GetProgressText(id)).Append("</pos>");
// "(00/00) " = 4em
pos += 4f;
builder.AppendFormat("<pos={0}em>", pos).Append(GetVitalText(id)).Append("</pos>");
// "Lover's Suicide " = 8em
// "回線切断 " = 4.5em
pos += DestroyableSingleton<TranslationController>.Instance.currentLanguage.languageID == SupportedLangs.English ? 8f : 4.5f;
builder.AppendFormat("<pos={0}em>", pos);
builder.Append(GetTrueRoleName(id, false));
builder.Append(GetSubRolesText(id));
builder.Append("</pos>");
}
return builder.ToString();
}
public static string RemoveHtmlTags(this string str) => Regex.Replace(str, "<[^>]*?>", "");
Expand Down
9 changes: 8 additions & 1 deletion Patches/AirshipStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ public static class AirshipStatusPrespawnStepPatch
{
public static bool Prefix()
{
return !PlayerControl.LocalPlayer.Is(CustomRoles.GM); // GMは湧き画面をスキップ
if (PlayerControl.LocalPlayer.Is(CustomRoles.GM))
{
RandomSpawn.hostReady = true;
RandomSpawn.AirshipSpawn(PlayerControl.LocalPlayer);
// GMは湧き画面をスキップ
return false;
}
return true;
}
}
}
Loading