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.3.5.3 #53

Merged
merged 14 commits into from
Apr 10, 2024
Prev Previous commit
Next Next commit
feature: send history
Hyz-sui committed Apr 2, 2024
commit 30efd998ad228cb30138af4e6b2ab60ce6510fa4
22 changes: 15 additions & 7 deletions Patches/OutroPatch.cs
Original file line number Diff line number Diff line change
@@ -254,22 +254,30 @@ public static void Postfix(EndGameManager __instance)
// ==Discordに結果を送信==
//#######################################

if (PlayerControl.LocalPlayer.PlayerId == 0 && Main.SendResultToDiscord.Value)
if (PlayerControl.LocalPlayer.PlayerId == 0)
{
if (CustomWinnerHolder.WinnerTeam == CustomWinner.Draw)
Logger.Info("廃村のため試合結果の送信をキャンセル", "Webhook");
else
{
var resultMessage = "";
foreach (var id in Main.winnerList)
if (Main.SendResultToDiscord.Value)
{
resultMessage += Utils.ColorIdToDiscordEmoji(Palette.PlayerColors.IndexOf(Main.PlayerColors[id]), !PlayerState.GetByPlayerId(id).IsDead) + ":star:" + EndGamePatch.SummaryText[id].RemoveHtmlTags() + "\n";
var resultMessage = "";
foreach (var id in Main.winnerList)
{
resultMessage += Utils.ColorIdToDiscordEmoji(Palette.PlayerColors.IndexOf(Main.PlayerColors[id]), !PlayerState.GetByPlayerId(id).IsDead) + ":star:" + EndGamePatch.SummaryText[id].RemoveHtmlTags() + "\n";
}
foreach (var id in cloneRoles)
{
resultMessage += Utils.ColorIdToDiscordEmoji(Palette.PlayerColors.IndexOf(Main.PlayerColors[id]), !PlayerState.GetByPlayerId(id).IsDead) + "\u3000" + EndGamePatch.SummaryText[id].RemoveHtmlTags() + "\n";
}
Utils.SendWebhook(resultMessage, GetString("LastResult"));
}
foreach (var id in cloneRoles)
if (Main.SendHistoryToDiscord.Value)
{
resultMessage += Utils.ColorIdToDiscordEmoji(Palette.PlayerColors.IndexOf(Main.PlayerColors[id]), !PlayerState.GetByPlayerId(id).IsDead) + "\u3000" + EndGamePatch.SummaryText[id].RemoveHtmlTags() + "\n";
var historyMessage = EventHistory.CurrentInstance.ToDiscordString();
Utils.SendWebhook(historyMessage, "ゲーム記録");
}
Utils.SendWebhook(resultMessage, GetString("LastResult"));
}
}