[Activity] Change event to minigame and add event
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AppAny.Quartz.EntityFrameworkCore.Migrations.SQLite" Version="0.4.0" />
|
<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">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class ActivityFormatter
|
|||||||
ActivityName.InterstellarExploration => "Porte interstellaire",
|
ActivityName.InterstellarExploration => "Porte interstellaire",
|
||||||
ActivityName.BreakFromDestiny => "Échapper au destin (3v3)",
|
ActivityName.BreakFromDestiny => "Échapper au destin (3v3)",
|
||||||
ActivityName.CriticalAbyss => "Abîme critique (8v8)",
|
ActivityName.CriticalAbyss => "Abîme critique (8v8)",
|
||||||
ActivityName.Event => "Évènement",
|
ActivityName.Minigame => "Évènement",
|
||||||
ActivityName.Fishing => "Pêche",
|
ActivityName.Fishing => "Pêche",
|
||||||
ActivityName.MirroriaRace => "Course Mirroria",
|
ActivityName.MirroriaRace => "Course Mirroria",
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(activityName), activityName, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(activityName), activityName, null)
|
||||||
@@ -77,16 +77,19 @@ public class ActivityFormatter
|
|||||||
|
|
||||||
fields.Add(playersField);
|
fields.Add(playersField);
|
||||||
|
|
||||||
|
string countTitlePart = activity.MaxPlayers == ActivityHelper.UnlimitedPlayers
|
||||||
|
? ""
|
||||||
|
: $"({participants.Length}/{activity.MaxPlayers})";
|
||||||
var title = activity switch
|
var title = activity switch
|
||||||
{
|
{
|
||||||
StagedActivity stagedActivity =>
|
StagedActivity stagedActivity =>
|
||||||
$"{FormatActivityName(activity.Name)} ({participants.Length}/{activity.MaxPlayers}) - Étage {stagedActivity.Stage}",
|
$"{FormatActivityName(activity.Name)} {countTitlePart} - Étage {stagedActivity.Stage}",
|
||||||
InterstellarActivity interstellar =>
|
InterstellarActivity interstellar =>
|
||||||
$"{FormatActivityName(activity.Name)} {_interstellarFormatter.FormatInterstellarColor(interstellar.Color)} ({players.Count}/{activity.MaxPlayers})",
|
$"{FormatActivityName(activity.Name)} {_interstellarFormatter.FormatInterstellarColor(interstellar.Color)} {countTitlePart}",
|
||||||
OrganizedActivity =>
|
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
|
// Build description
|
||||||
@@ -156,7 +159,7 @@ public class ActivityFormatter
|
|||||||
ActivityName.BreakFromDestiny => "BR",
|
ActivityName.BreakFromDestiny => "BR",
|
||||||
ActivityName.CriticalAbyss => "CA",
|
ActivityName.CriticalAbyss => "CA",
|
||||||
ActivityName.Fishing => "FI",
|
ActivityName.Fishing => "FI",
|
||||||
ActivityName.Event => "EV",
|
ActivityName.Minigame => "EV",
|
||||||
ActivityName.MirroriaRace => "MR",
|
ActivityName.MirroriaRace => "MR",
|
||||||
_ => "NA"
|
_ => "NA"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Cocotte.Modules.Activities;
|
|||||||
|
|
||||||
public class ActivityHelper
|
public class ActivityHelper
|
||||||
{
|
{
|
||||||
private const uint UnlimitedPlayers = uint.MaxValue;
|
public const uint UnlimitedPlayers = uint.MaxValue;
|
||||||
|
|
||||||
private readonly ActivityOptions _options;
|
private readonly ActivityOptions _options;
|
||||||
private readonly ActivitiesRepository _activitiesRepository;
|
private readonly ActivitiesRepository _activitiesRepository;
|
||||||
@@ -57,32 +57,31 @@ public class ActivityHelper
|
|||||||
|
|
||||||
ActivityName.BreakFromDestiny => ActivityType.Pvp3Players,
|
ActivityName.BreakFromDestiny => ActivityType.Pvp3Players,
|
||||||
|
|
||||||
ActivityName.Event or
|
ActivityName.Minigame => ActivityType.Other8Players,
|
||||||
ActivityName.Fishing => ActivityType.Event8Players,
|
|
||||||
|
|
||||||
ActivityName.MirroriaRace => ActivityType.Event4Players,
|
ActivityName.MirroriaRace => ActivityType.Other4Players,
|
||||||
|
|
||||||
_ => ActivityType.Other
|
_ => ActivityType.OtherUnlimitedPlayers
|
||||||
};
|
};
|
||||||
|
|
||||||
public static uint ActivityTypeToMaxPlayers(ActivityType activityType) => activityType switch
|
public static uint ActivityTypeToMaxPlayers(ActivityType activityType) => activityType switch
|
||||||
{
|
{
|
||||||
ActivityType.Pve4Players or
|
ActivityType.Pve4Players or
|
||||||
ActivityType.Event4Players => 4,
|
ActivityType.Other4Players => 4,
|
||||||
|
|
||||||
ActivityType.Pve8Players or
|
ActivityType.Pve8Players or
|
||||||
ActivityType.Pvp8Players or
|
ActivityType.Pvp8Players or
|
||||||
ActivityType.Event8Players => 8,
|
ActivityType.Other8Players => 8,
|
||||||
|
|
||||||
ActivityType.Pvp3Players => 3,
|
ActivityType.Pvp3Players => 3,
|
||||||
|
|
||||||
ActivityType.Other => UnlimitedPlayers,
|
ActivityType.OtherUnlimitedPlayers => UnlimitedPlayers,
|
||||||
|
|
||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
|
|
||||||
public static bool IsEventActivity(ActivityType activityType) =>
|
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)
|
public bool IsOrganizer(OrganizedActivity organizedActivity, SocketGuildUser user)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,12 +142,12 @@ public partial class ActivityModule : InteractionModuleBase<SocketInteractionCon
|
|||||||
|
|
||||||
[SlashCommand("evenement", "Créer un groupe pour les évènements")]
|
[SlashCommand("evenement", "Créer un groupe pour les évènements")]
|
||||||
[Alias("event")]
|
[Alias("event")]
|
||||||
public async Task ActivityEvent(
|
public async Task ActivityMinigame(
|
||||||
[Summary("joueurs", "Nombre de joueurs maximum pour cette activité")] [MinValue(2), MaxValue(16)]
|
[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,
|
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 = "")
|
[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);
|
maxPlayers: maxPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public enum ActivityName
|
|||||||
BreakFromDestiny,
|
BreakFromDestiny,
|
||||||
CriticalAbyss,
|
CriticalAbyss,
|
||||||
Fishing,
|
Fishing,
|
||||||
Event,
|
Minigame,
|
||||||
MirroriaRace
|
MirroriaRace,
|
||||||
|
Event
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ public enum ActivityType
|
|||||||
Pve8Players,
|
Pve8Players,
|
||||||
Pvp8Players,
|
Pvp8Players,
|
||||||
Pvp3Players,
|
Pvp3Players,
|
||||||
Event8Players,
|
Other8Players,
|
||||||
Event4Players,
|
Other4Players,
|
||||||
Other
|
OtherUnlimitedPlayers
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user