Added RaidTemplates and TimerService to create weekly raids
This commit is contained in:
parent
c215ed058f
commit
ab6602710d
13 changed files with 270 additions and 53 deletions
|
@ -10,53 +10,19 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
RandomEliteSpecialization = 3,
|
||||
}
|
||||
|
||||
public class Raid
|
||||
public class Raid : RaidBase
|
||||
{
|
||||
public int RaidId { get; private set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "Title too long (100 character limit).")]
|
||||
public string Title { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(1000, ErrorMessage = "Description too long (1000 character limit).")]
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset StartTimeUTC { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public DateTimeOffset EndTimeUTC { get; set; }
|
||||
|
||||
public string TimeZone { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Organizer too long (50 character limit).")]
|
||||
public string Organizer { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Guild too long (50 character limit).")]
|
||||
public string Guild { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "VoiceChat too long (50 character limit).")]
|
||||
public string VoiceChat { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
public RaidType RaidType { get; set; }
|
||||
|
||||
public bool IsRandomized { get; set; } = false;
|
||||
|
||||
public int Frequency { get; set; }
|
||||
|
||||
public string RequiredRole { get; set; } = String.Empty;
|
||||
|
||||
public DateTimeOffset FreeForAllTimeUTC { get; set; }
|
||||
|
||||
//role name, number of spots
|
||||
public ICollection<PlannedRaidRole> Roles { get; set; } = new HashSet<PlannedRaidRole>();
|
||||
|
||||
public ICollection<RaidReminder> Reminders { get; set; } = new List<RaidReminder>();
|
||||
public bool IsRandomized { get; set; } = false;
|
||||
|
||||
public ICollection<RaidSignUp> SignUps { get; set; } = new HashSet<RaidSignUp>();
|
||||
|
||||
|
@ -65,8 +31,46 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
//used to edit the Discord message
|
||||
public ulong DiscordMessageId { get; set; }
|
||||
|
||||
public ulong DiscordChannelId { get; set; }
|
||||
public Raid() { }
|
||||
|
||||
public Raid(RaidTemplate template)
|
||||
{
|
||||
this.Title = template.Title;
|
||||
this.Description = template.Description;
|
||||
this.Organizer = template.Organizer;
|
||||
this.Guild = template.Guild;
|
||||
this.VoiceChat = template.VoiceChat;
|
||||
this.RaidType = template.RaidType;
|
||||
this.RequiredRole = template.RequiredRole;
|
||||
this.DiscordChannelId = template.DiscordChannelId;
|
||||
this.DiscordGuildId = template.DiscordGuildId;
|
||||
|
||||
foreach(PlannedRaidRole role in template.Roles)
|
||||
{
|
||||
this.Roles.Add(new PlannedRaidRole()
|
||||
{
|
||||
Description = role.Description,
|
||||
Name = role.Name,
|
||||
Spots = role.Spots
|
||||
});
|
||||
}
|
||||
foreach(RaidReminder reminder in template.Reminders)
|
||||
{
|
||||
this.Reminders.Add(new RaidReminder()
|
||||
{
|
||||
ChannelId = reminder.ChannelId,
|
||||
HoursBeforeRaid = reminder.HoursBeforeRaid,
|
||||
Message = reminder.Message,
|
||||
Sent = reminder.Sent,
|
||||
Type = reminder.Type
|
||||
});
|
||||
}
|
||||
|
||||
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(template.TimeZone);
|
||||
StartTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.StartTime, timeZone);
|
||||
EndTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.EndTime, timeZone);
|
||||
FreeForAllTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.FreeForAllTime, timeZone);
|
||||
}
|
||||
|
||||
public ulong DiscordGuildId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
42
Lieb/Models/GuildWars2/Raid/RaidBase.cs
Normal file
42
Lieb/Models/GuildWars2/Raid/RaidBase.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class RaidBase
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "Title too long (100 character limit).")]
|
||||
public string Title { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(1000, ErrorMessage = "Description too long (1000 character limit).")]
|
||||
public string Description { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Organizer too long (50 character limit).")]
|
||||
public string Organizer { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "Guild too long (50 character limit).")]
|
||||
public string Guild { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "VoiceChat too long (50 character limit).")]
|
||||
public string VoiceChat { get; set; } = String.Empty;
|
||||
|
||||
[Required]
|
||||
public RaidType RaidType { get; set; }
|
||||
|
||||
public string RequiredRole { get; set; } = String.Empty;
|
||||
|
||||
//role name, number of spots
|
||||
public ICollection<PlannedRaidRole> Roles { get; set; } = new HashSet<PlannedRaidRole>();
|
||||
|
||||
public ICollection<RaidReminder> Reminders { get; set; } = new List<RaidReminder>();
|
||||
|
||||
//used to edit the Discord message
|
||||
public ulong DiscordChannelId { get; set; }
|
||||
|
||||
public ulong DiscordGuildId { get; set; }
|
||||
}
|
||||
}
|
|
@ -6,26 +6,21 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
{
|
||||
public enum ReminderType
|
||||
{
|
||||
User = 0,
|
||||
Channel = 1
|
||||
}
|
||||
|
||||
public RaidReminder(ReminderType type, string message, double hoursBeforeRaid, ulong channelId = 0)
|
||||
{
|
||||
Type = type;
|
||||
Message = message;
|
||||
HoursBeforeRaid = hoursBeforeRaid;
|
||||
ChannelId = channelId;
|
||||
User = 1,
|
||||
Channel = 2
|
||||
}
|
||||
|
||||
public int RaidReminderId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Range(1, 2, ErrorMessage = "Please select a reminder type")]
|
||||
public ReminderType Type { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(1000, ErrorMessage = "Message too long (1000 character limit).")]
|
||||
public string Message { get; set; }
|
||||
|
||||
[Required]
|
||||
public double HoursBeforeRaid { get; set; }
|
||||
|
||||
public ulong ChannelId { get; set; }
|
||||
|
|
23
Lieb/Models/GuildWars2/Raid/RaidTemplate.cs
Normal file
23
Lieb/Models/GuildWars2/Raid/RaidTemplate.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Lieb.Models.GuildWars2.Raid
|
||||
{
|
||||
public class RaidTemplate : RaidBase
|
||||
{
|
||||
public int RaidTemplateId { get; private set; }
|
||||
|
||||
[Required]
|
||||
public DateTime StartTime { get; set; } = DateTime.Now;
|
||||
|
||||
[Required]
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
public DateTime FreeForAllTime { get; set; }
|
||||
|
||||
public string TimeZone { get; set; } = String.Empty;
|
||||
|
||||
public int Frequency { get; set; }
|
||||
|
||||
public int CreateDaysBefore { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue