Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Turbo.Catalog/Grains/LtdRaffleGrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private async Task<double> CalculateWeightAsync(int playerId, CancellationToken

if (cfg.RespectsReceived.Enabled)
weight += Math.Min(
profile.StarGemCount * cfg.RespectsReceived.BonusPerUnit,
profile.RespectTotal * cfg.RespectsReceived.BonusPerUnit,
cfg.RespectsReceived.MaxBonus
);

Expand Down
2 changes: 2 additions & 0 deletions Turbo.Database/Context/ITurboDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public interface ITurboDbContext : IDisposable

public DbSet<PlayerEntity>? Players { get; set; }

public DbSet<PlayerRespectEntity>? PlayerRespects { get; set; }

public DbSet<RoomBanEntity>? RoomBans { get; set; }

public DbSet<RoomChatlogEntity>? Chatlogs { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Turbo.Database/Context/TurboDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class TurboDbContext(DbContextOptions<TurboDbContext> options)

public DbSet<PlayerCurrencyEntity> PlayerCurrencies { get; init; }
public DbSet<PlayerEntity> Players { get; init; }
public DbSet<PlayerRespectEntity> PlayerRespects { get; init; }

public DbSet<RoomBanEntity> RoomBans { get; init; }

Expand Down
3 changes: 3 additions & 0 deletions Turbo.Database/Entities/Players/PlayerEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class PlayerEntity : TurboEntity
[Column("room_chat_style_id")]
public int? RoomChatStyleId { get; set; }

[InverseProperty("PlayerEntity")]
public PlayerRespectEntity? PlayerRespect { get; set; }

[InverseProperty("PlayerEntity")]
public List<PlayerBadgeEntity>? PlayerBadges { get; set; }

Expand Down
36 changes: 36 additions & 0 deletions Turbo.Database/Entities/Players/PlayerRespectEntity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace Turbo.Database.Entities.Players;

[Table("player_respects")]
[Index(nameof(PlayerEntityId), IsUnique = true)]
public class PlayerRespectEntity : TurboEntity
{
[Column("player_id")]
public required int PlayerEntityId { get; set; }

[Column("respect_total")]
[DefaultValue(0)]
public int RespectTotal { get; set; }

[Column("respect_left")]
[DefaultValue(0)]
public int RespectLeft { get; set; }

[Column("pet_respect_left")]
[DefaultValue(0)]
public int PetRespectLeft { get; set; }

[Column("respect_replenishes_left")]
[DefaultValue(1)]
public int RespectReplenishesLeft { get; set; }

[Column("last_respect_reset")]
public DateTime? LastRespectReset { get; set; }

[ForeignKey(nameof(PlayerEntityId))]
public PlayerEntity? PlayerEntity { get; set; }
}
Loading
Loading