elliebot/src/EllieBot/Modules/Games/Fish/Db/UserFishItem.cs
Toastie 0a1797700c
.fishop and .finv
You can list items in `.fishop`
Buy with `.fibuy`
See your inventory with `.finv`
Equip with `.fiuse`
Items are defined in items: array at the bottom of fish.yml
Items will show up in your .fili and bonuses will show up when you do .fish
The migrations for quests were meant to be sorted in 4c2b42ab7f but it kind of decided to be very stupid.
2025-03-29 20:33:25 +13:00

70 lines
No EOL
1.8 KiB
C#

using System;
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using EllieBot.Db;
using EllieBot.Modules.Games.Fish;
namespace EllieBot.Modules.Games.Fish.Db;
/// <summary>
/// Represents a fishing item owned by a user.
/// </summary>
public class UserFishItem
{
/// <summary>
/// The unique identifier for this user fish item.
/// </summary>
[Key]
public int Id { get; set; }
/// <summary>
/// The ID of the user who owns this item.
/// </summary>
public ulong UserId { get; set; }
/// <summary>
/// The type of the fishing item.
/// </summary>
public FishItemType ItemType { get; set; }
/// <summary>
/// The ID of the fishing item.
/// </summary>
public int ItemId { get; set; }
/// <summary>
/// Indicates whether the item is currently equipped by the user.
/// </summary>
public bool IsEquipped { get; set; }
/// <summary>
/// The number of uses left for this item. Null means unlimited uses.
/// </summary>
public int? UsesLeft { get; set; }
/// <summary>
/// The date and time when this item expires. Null means the item doesn't expire.
/// </summary>
public DateTime? ExpiresAt { get; set; }
public int? ExpiryFromNowInMinutes()
{
if (ExpiresAt is null)
return null;
return (int)(ExpiresAt.Value - DateTime.UtcNow).TotalMinutes;
}
}
/// <summary>
/// Entity configuration for UserFishItem.
/// </summary>
public class UserFishItemConfiguration : IEntityTypeConfiguration<UserFishItem>
{
public void Configure(EntityTypeBuilder<UserFishItem> builder)
{
builder.HasIndex(x => new { x.UserId });
}
}