namespace SilkroadBot.Domain.Models;
///
/// Represents a 2D position in the Silkroad world.
///
public record struct WorldPosition(short RegionId, float X, float Y, float Z)
{
public double DistanceTo(WorldPosition other)
{
if (RegionId != other.RegionId) return double.MaxValue;
var dx = X - other.X;
var dy = Y - other.Y;
var dz = Z - other.Z;
return Math.Sqrt(dx * dx + dy * dy + dz * dz);
}
public override string ToString() => $"[{RegionId}] ({X:F1}, {Y:F1}, {Z:F1})";
}
///
/// Represents a game character (player, NPC, or monster).
///
public class GameEntity
{
public uint UniqueId { get; set; }
public uint ModelId { get; set; }
public string Name { get; set; } = string.Empty;
public WorldPosition Position { get; set; }
public int Level { get; set; }
public bool IsAlive { get; set; } = true;
public EntityType Type { get; set; }
}
public enum EntityType
{
Player,
NPC,
Monster,
Pet,
Item,
Structure
}
///
/// Represents the player's character state.
///
public class CharacterState
{
public string Name { get; set; } = string.Empty;
public int Level { get; set; }
public long Experience { get; set; }
public long MaxExperience { get; set; }
public int HP { get; set; }
public int MaxHP { get; set; }
public int MP { get; set; }
public int MaxMP { get; set; }
public WorldPosition Position { get; set; }
public uint Gold { get; set; }
public int SkillPoints { get; set; }
public int StatPoints { get; set; }
public byte Speed { get; set; }
public bool IsInCombat { get; set; }
public bool IsDead => HP <= 0;
public double HPPercentage => MaxHP > 0 ? (double)HP / MaxHP * 100 : 0;
public double MPPercentage => MaxMP > 0 ? (double)MP / MaxMP * 100 : 0;
}
///
/// Represents an item in the inventory.
///
public class InventoryItem
{
public byte Slot { get; set; }
public uint ItemId { get; set; }
public string Name { get; set; } = string.Empty;
public ushort Quantity { get; set; }
public byte Enhancement { get; set; }
public Enums.InventorySlot SlotType { get; set; }
}
///
/// Represents a skill.
///
public class Skill
{
public uint SkillId { get; set; }
public string Name { get; set; } = string.Empty;
public byte Level { get; set; }
public bool IsPassive { get; set; }
public int CooldownMs { get; set; }
public DateTime LastUsed { get; set; } = DateTime.MinValue;
public bool IsOnCooldown => (DateTime.UtcNow - LastUsed).TotalMilliseconds < CooldownMs;
}
///
/// Represents a party member.
///
public class PartyMember
{
public uint UniqueId { get; set; }
public string Name { get; set; } = string.Empty;
public int Level { get; set; }
public int HP { get; set; }
public int MaxHP { get; set; }
public WorldPosition Position { get; set; }
}