[Activity] Change event to minigame and add event

This commit is contained in:
2023-04-10 11:56:49 +02:00
parent ca3e951d9a
commit 224fe4cb25
6 changed files with 26 additions and 23 deletions

View File

@@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="AppAny.Quartz.EntityFrameworkCore.Migrations.SQLite" Version="0.4.0" />
<PackageReference Include="Discord.Net" Version="3.9.0" />
<PackageReference Include="Discord.Net" Version="3.10.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -31,7 +31,7 @@ public class ActivityFormatter
ActivityName.InterstellarExploration => "Porte interstellaire",
ActivityName.BreakFromDestiny => "Échapper au destin (3v3)",
ActivityName.CriticalAbyss => "Abîme critique (8v8)",
ActivityName.Event => "Évènement",
ActivityName.Minigame => "Évènement",
ActivityName.Fishing => "Pêche",
ActivityName.MirroriaRace => "Course Mirroria",
_ => throw new ArgumentOutOfRangeException(nameof(activityName), activityName, null)
@@ -77,16 +77,19 @@ public class ActivityFormatter
fields.Add(playersField);
string countTitlePart = activity.MaxPlayers == ActivityHelper.UnlimitedPlayers
? ""
: $"({participants.Length}/{activity.MaxPlayers})";
var title = activity switch
{
StagedActivity stagedActivity =>
$"{FormatActivityName(activity.Name)} ({participants.Length}/{activity.MaxPlayers}) - Étage {stagedActivity.Stage}",
$"{FormatActivityName(activity.Name)} {countTitlePart} - Étage {stagedActivity.Stage}",
InterstellarActivity interstellar =>
$"{FormatActivityName(activity.Name)} {_interstellarFormatter.FormatInterstellarColor(interstellar.Color)} ({players.Count}/{activity.MaxPlayers})",
$"{FormatActivityName(activity.Name)} {_interstellarFormatter.FormatInterstellarColor(interstellar.Color)} {countTitlePart}",
OrganizedActivity =>
$"{(ActivityHelper.IsEventActivity(activity.Type) ? "Organisation d'évènement" : $"Proposition d'aide - {FormatActivityName(activity.Name)}")} ({participants.Length}/{activity.MaxPlayers})",
$"{(ActivityHelper.IsEventActivity(activity.Type) ? "Organisation d'évènement" : $"Proposition d'aide - {FormatActivityName(activity.Name)}")} {countTitlePart}",
_ =>
$"{FormatActivityName(activity.Name)} ({participants.Length}/{activity.MaxPlayers})"
$"{FormatActivityName(activity.Name)} {countTitlePart}"
};
// Build description
@@ -156,7 +159,7 @@ public class ActivityFormatter
ActivityName.BreakFromDestiny => "BR",
ActivityName.CriticalAbyss => "CA",
ActivityName.Fishing => "FI",
ActivityName.Event => "EV",
ActivityName.Minigame => "EV",
ActivityName.MirroriaRace => "MR",
_ => "NA"
};

View File

@@ -9,7 +9,7 @@ namespace Cocotte.Modules.Activities;
public class ActivityHelper
{
private const uint UnlimitedPlayers = uint.MaxValue;
public const uint UnlimitedPlayers = uint.MaxValue;
private readonly ActivityOptions _options;
private readonly ActivitiesRepository _activitiesRepository;
@@ -57,32 +57,31 @@ public class ActivityHelper
ActivityName.BreakFromDestiny => ActivityType.Pvp3Players,
ActivityName.Event or
ActivityName.Fishing => ActivityType.Event8Players,
ActivityName.Minigame => ActivityType.Other8Players,
ActivityName.MirroriaRace => ActivityType.Event4Players,
ActivityName.MirroriaRace => ActivityType.Other4Players,
_ => ActivityType.Other
_ => ActivityType.OtherUnlimitedPlayers
};
public static uint ActivityTypeToMaxPlayers(ActivityType activityType) => activityType switch
{
ActivityType.Pve4Players or
ActivityType.Event4Players => 4,
ActivityType.Other4Players => 4,
ActivityType.Pve8Players or
ActivityType.Pvp8Players or
ActivityType.Event8Players => 8,
ActivityType.Other8Players => 8,
ActivityType.Pvp3Players => 3,
ActivityType.Other => UnlimitedPlayers,
ActivityType.OtherUnlimitedPlayers => UnlimitedPlayers,
_ => 0
};
public static bool IsEventActivity(ActivityType activityType) =>
activityType is ActivityType.Event8Players or ActivityType.Event4Players or ActivityType.Other;
activityType is ActivityType.Other8Players or ActivityType.Other4Players or ActivityType.OtherUnlimitedPlayers;
public bool IsOrganizer(OrganizedActivity organizedActivity, SocketGuildUser user)
{

View File

@@ -142,12 +142,12 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
[SlashCommand("evenement", "Créer un groupe pour les évènements")]
[Alias("event")]
public async Task ActivityEvent(
public async Task ActivityMinigame(
[Summary("joueurs", "Nombre de joueurs maximum pour cette activité")] [MinValue(2), MaxValue(16)]
uint maxPlayers = 8, [Summary("heure", "Heure à laquelle l'activité est prévue")] string? timeInput = null,
[Summary("description", "Message accompagnant la demande de groupe")] string description = "")
{
await CreateActivity(ActivityName.Event, timeInput, description, areRolesEnabled: false,
await CreateActivity(ActivityName.Minigame, timeInput, description, areRolesEnabled: false,
maxPlayers: maxPlayers);
}

View File

@@ -12,6 +12,7 @@ public enum ActivityName
BreakFromDestiny,
CriticalAbyss,
Fishing,
Event,
MirroriaRace
Minigame,
MirroriaRace,
Event
}

View File

@@ -6,7 +6,7 @@ public enum ActivityType
Pve8Players,
Pvp8Players,
Pvp3Players,
Event8Players,
Event4Players,
Other
Other8Players,
Other4Players,
OtherUnlimitedPlayers
}