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

Add SanctionReason #595

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Impostor.Api.Innersloth.Generator/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
enumGenerator.Generate("ColorType", "Impostor.Api.Innersloth.Customization");

enumGenerator.Generate("DisconnectReason", sourceName: "DisconnectReasons");
enumGenerator.Generate("SanctionReason", sourceName: "SanctionReasons");
NikoCat233 marked this conversation as resolved.
Show resolved Hide resolved
enumGenerator.Generate("GameKeywords", flags: true, underlyingType: CSharpEnumUnderlyingType.UnsignedInt);
enumGenerator.Generate("GameOverReason", underlyingType: CSharpEnumUnderlyingType.Byte);
enumGenerator.Generate("Platforms");
Expand Down
23 changes: 23 additions & 0 deletions src/Impostor.Api/Innersloth/Data/enums/SanctionReasons.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you manually create this file? It should be automatically generated using Dumpostor: https://github.com/Impostor/Dumpostor/blob/master/Dumpostor/DumpostorPlugin.cs#L90

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm what is this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh i see, i will gen it

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"None": 0,
"ImpersonationCeleb": 1,
"Spamming": 2,
"InappropriateNameUnsportsmanlike": 3,
"UnsportsmanlikeConduct": 4,
"ImpersonationDevelopers": 5,
"InappropriateChatPersonalInfo": 6,
"InappropriateNameDerogatory": 7,
"InappropriateNameNsfw": 8,
"Bullying": 9,
"CheatingHacking": 10,
"InappropriateChatDating": 11,
"WeaponizingRules": 12,
"RepeatOffender3": 13,
"SexualMisconduct": 14,
"Doxing": 15,
"IllegalActivity": 16,
"Harassment": 17,
"SelfHarmPromotion": 18,
"RepeatOffender10": 19,
"InvalidUser": 20
}
6 changes: 3 additions & 3 deletions src/Impostor.Api/Innersloth/Data/info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dumpostorVersion": "1.0.0",
"dumpostorVersion": "1.0.0-dev",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be regenerated with release dumpostor before merging

"gameVersion": "2024.3.5",
"platformType": "StandaloneItch"
}
"platformType": "StandaloneSteamPC"
}
10 changes: 9 additions & 1 deletion src/Impostor.Server/Http/GamesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,21 @@ public MatchmakerResponse(MatchmakerError error)
private class MatchmakerError
{
[SetsRequiredMembers]
public MatchmakerError(DisconnectReason reason)
public MatchmakerError(DisconnectReason reason, SanctionReason sanctionReason = SanctionReason.None, DateTimeOffset? endsAt = null)
{
Reason = reason;
SanctionReason = sanctionReason;
EndsAt = endsAt;
}

[JsonPropertyName("Reason")]
public required DisconnectReason Reason { get; init; }

[JsonPropertyName("SanctionReason")]
public required SanctionReason SanctionReason { get; init; }

[JsonPropertyName("EndsAt")]
public required DateTimeOffset? EndsAt { get; init; }
}

private class GameListing
Expand Down