Skip to content

Commit

Permalink
inventory things
Browse files Browse the repository at this point in the history
  • Loading branch information
sphexator committed Jan 18, 2025
1 parent e98d0d2 commit 01751c1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Hanekawa.Application/Services/InventoryService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Hanekawa.Entities.Users;

namespace Hanekawa.Application.Services;

public class InventoryService
{

}

public interface IInventoryService
{
ValueTask<GuildUser> GetInventoryAsync(ulong userId);
ValueTask UpdateInventoryAsync(GuildUser user);
ValueTask AddItemAsync(GuildUser user, Guid itemId, int amount);
ValueTask RemoveItemAsync(GuildUser user, Guid itemId, int amount);
ValueTask<bool> HasItemAsync(GuildUser user, Guid itemId, int amount);
ValueTask<bool> HasItemAsync(GuildUser user, Guid itemId);
ValueTask<int> GetItemCountAsync(ulong userId, Guid itemId);
}
1 change: 1 addition & 0 deletions Hanekawa.Bot/Hanekawa.Bot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Folder Include="Commands\Slash\AutoMessage\" />
<Folder Include="Commands\Slash\Board\" />
<Folder Include="Commands\Slash\Boost\" />
<Folder Include="Data\Background\" />
<Folder Include="Extensions\" />
<Folder Include="Validators\" />
</ItemGroup>
Expand Down
46 changes: 45 additions & 1 deletion Hanekawa/Entities/Users/User.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Hanekawa.Interfaces;
using System.ComponentModel.DataAnnotations;
using Hanekawa.Interfaces;

namespace Hanekawa.Entities.Users;

Expand All @@ -7,4 +8,47 @@ public class User : IEntity
public ulong Id { get; set; }
public DateTimeOffset? PremiumExpiration { get; set; }
public List<GuildUser> GuildUsers { get; set; } = [];
}

public class Equipment : IEntity
{
public ulong Id { get; set; }

public Guid BackgroundId { get; set; }
public Inventory Background { get; set; } = null!;
}

public class Inventory
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();

public Guid ItemId { get; set; }
public Item Item { get; set; } = null!;
public int Amount { get; set; } = 0;

public ulong UserId { get; set; }
public User User { get; set; } = null!;
}

public class Item
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = null!;
public string Description { get; set; } = null!;
public int Price { get; set; } = 0;

public ItemType Type { get; set; } = null!;
public Guid TypeId { get; set; }
}

public class ItemType
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = null!;
public bool Equippable { get; set; }
public bool Consumable { get; set; }
public bool Stackable { get; set; }
public bool Sellable { get; set; }
public bool Tradable { get; set; }
}

0 comments on commit 01751c1

Please sign in to comment.