Files
systemrevivalserver/data/entities/DungeonPersistence.cs
T

79 lines
2.1 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DataServer.Data.Entities;
/// <summary>
/// Persisted dungeon data for dungeons that become inactive but remain "open"
/// </summary>
[Table("dungeon_instances")]
public class DungeonPersistence
{
[Key]
public Guid Id { get; set; }
public int Tier { get; set; }
public int Seed { get; set; }
// Level bracket
public int LevelBracketMin { get; set; }
public int LevelBracketMax { get; set; }
// Creator info
public ulong CreatorCharacterId { get; set; }
public string CreatorName { get; set; } = "";
public int CreatorLevel { get; set; }
// Timestamps
public DateTime CreatedAt { get; set; }
public DateTime LastActivity { get; set; }
public DateTime? PersistedAt { get; set; }
// State
public bool BossKilled { get; set; } = false;
public bool IsCleared { get; set; } = false;
/// <summary>
/// Serialized mob state (JSON) - only alive mobs with their positions/health
/// </summary>
[Column(TypeName = "json")]
public string? MobStateJson { get; set; }
/// <summary>
/// Serialized chest state (JSON) - which chests are opened
/// </summary>
[Column(TypeName = "json")]
public string? ChestStateJson { get; set; }
/// <summary>
/// Serialized loot chest state (JSON) - personal loot chests
/// </summary>
[Column(TypeName = "json")]
public string? LootChestStateJson { get; set; }
// Navigation
public virtual DungeonCharacter? Creator { get; set; }
}
/// <summary>
/// Serializable mob state for persistence
/// </summary>
public class PersistedMobState
{
public int Id { get; set; }
public int DefinitionId { get; set; }
public float X { get; set; }
public float Y { get; set; }
public int Health { get; set; }
public bool IsAlive { get; set; }
}
/// <summary>
/// Serializable chest state for persistence
/// </summary>
public class PersistedChestState
{
public int Id { get; set; }
public bool IsOpened { get; set; }
}