Download src/SilkroadBot.Domain/Models/GameModels.cs from Ahmedramadan24/SilkroadBot: direct link, hf CLI and curl.
- Browser
- Download file 3.06 kB
-
https://huggingface.co/Ahmedramadan24/SilkroadBot/resolve/main/src/SilkroadBot.Domain/Models/GameModels.cs
- Command line
-
hf download hf://Ahmedramadan24/SilkroadBot/src/SilkroadBot.Domain/Models/GameModels.cs
-
curl -L -o GameModels.cs https://huggingface.co/Ahmedramadan24/SilkroadBot/resolve/main/src/SilkroadBot.Domain/Models/GameModels.cs
3.06 kB
| namespace SilkroadBot.Domain.Models; | |
| /// <summary> | |
| /// Represents a 2D position in the Silkroad world. | |
| /// </summary> | |
| 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})"; | |
| } | |
| /// <summary> | |
| /// Represents a game character (player, NPC, or monster). | |
| /// </summary> | |
| 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 | |
| } | |
| /// <summary> | |
| /// Represents the player's character state. | |
| /// </summary> | |
| 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; | |
| } | |
| /// <summary> | |
| /// Represents an item in the inventory. | |
| /// </summary> | |
| 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; } | |
| } | |
| /// <summary> | |
| /// Represents a skill. | |
| /// </summary> | |
| 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; | |
| } | |
| /// <summary> | |
| /// Represents a party member. | |
| /// </summary> | |
| 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; } | |
| } | |