From 0f1e903964594a97c4639735fc64424f712f3683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 26 Dec 2021 23:03:30 +0100 Subject: [PATCH] feat: implement character and player properties --- .../Data/Characters/Character.cs | 110 ++++++++++++++++-- Core/NosSmooth.Game/Data/Entities/IEntity.cs | 6 +- .../Data/Entities/LivingEntity.cs | 14 ++- Core/NosSmooth.Game/Data/Entities/Player.cs | 72 ++++++++++-- 4 files changed, 176 insertions(+), 26 deletions(-) diff --git a/Core/NosSmooth.Game/Data/Characters/Character.cs b/Core/NosSmooth.Game/Data/Characters/Character.cs index 1004b9d..3dd7aaf 100644 --- a/Core/NosSmooth.Game/Data/Characters/Character.cs +++ b/Core/NosSmooth.Game/Data/Characters/Character.cs @@ -1,12 +1,102 @@ -// -// Character.cs -// -// Copyright (c) Christofel authors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +// Character.cs +// +// Copyright (c) František Boháček. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace NosSmooth.Game.Entities; +using NosCore.Packets.Enumerations; +using NosCore.Shared.Enumerations; +using NosSmooth.Game.Data.Chat; +using NosSmooth.Game.Data.Entities; +using NosSmooth.Game.Data.Info; +using NosSmooth.Game.Data.Social; -public class Character : Player -{ - -} \ No newline at end of file +namespace NosSmooth.Game.Data.Characters; + +/// +/// Represents the client character. +/// +/// The character's inventory with items. +/// The family of the character, if any.. +/// The friends of the character. +/// The current skill set of the character. +/// The group the character is in, if any. Contains pets and partners as well. +/// The skill cp amount used for learning new skills. +/// The id of the character entity. +/// The name of the character entity. +/// The position of the character. +/// The movement speed of the character. +/// The +/// The +/// The +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public record Character +( + Inventory.Inventory? Inventory = default, + Family? Family = default, + IReadOnlyList? Friends = default, + Skills? Skills = default, + Group? Group = default, + int? SkillCp = default, + long Id = default, + string? Name = default, + Position? Position = default, + byte? Speed = default, + Level? Level = default, + Level? JobLevel = default, + Level? HeroLevel = default, + byte? Direction = default, + Health? Hp = default, + Health? Mp = default, + FactionType? Faction = default, + short Size = default, + AuthorityType AuthorityType = default, + GenderType Gender = default, + HairStyleType HairStyle = default, + HairColorType HairColor = default, + CharacterClassType Class = default, + byte? Icon = default, + short? Compliment = default, + Morph? Morph = default, + bool? ArenaWinner = default, + bool? Invisible = default, + long? Reputation = default +) : Player( + Id, + Name, + Position, + Speed, + Level, + HeroLevel, + Direction, + Hp, + Mp, + Faction, + Size, + AuthorityType, + Gender, + HairStyle, + HairColor, + Class, + Icon, + Compliment, + Morph, + ArenaWinner, + Invisible, + Reputation +); \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Entities/IEntity.cs b/Core/NosSmooth.Game/Data/Entities/IEntity.cs index e007c25..7a75c50 100644 --- a/Core/NosSmooth.Game/Data/Entities/IEntity.cs +++ b/Core/NosSmooth.Game/Data/Entities/IEntity.cs @@ -5,9 +5,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using NosCore.Shared.Enumerations; -using NosSmooth.Game.Data; +using NosSmooth.Game.Data.Info; -namespace NosSmooth.Game.Entities; +namespace NosSmooth.Game.Data.Entities; /// /// Base type for entities. @@ -27,7 +27,7 @@ public interface IEntity /// /// Gets the position of the entity. /// - public Position Position { get; } + public Position? Position { get; } /// /// Gets the type of the entity. diff --git a/Core/NosSmooth.Game/Data/Entities/LivingEntity.cs b/Core/NosSmooth.Game/Data/Entities/LivingEntity.cs index 7f23b6d..f15ea3c 100644 --- a/Core/NosSmooth.Game/Data/Entities/LivingEntity.cs +++ b/Core/NosSmooth.Game/Data/Entities/LivingEntity.cs @@ -5,10 +5,9 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using NosCore.Packets.Enumerations; -using NosCore.Shared.Enumerations; -using NosSmooth.Game.Data; +using NosSmooth.Game.Data.Info; -namespace NosSmooth.Game.Entities; +namespace NosSmooth.Game.Data.Entities; /// /// Represents any nostale living entity such as monster, npc, player. @@ -33,15 +32,20 @@ public interface ILivingEntity : IEntity /// /// Gets the percentage of the health points of the entity. May be null if unknown. /// - public byte? HpPercentage { get; } + public Health? Hp { get; } /// /// Gets the percentage of the mana points of the entity. May be null if unknown. /// - public byte? MpPercentage { get; } + public Health? Mp { get; } /// /// Gets the faction of the entity. May be null if unknown. /// public FactionType? Faction { get; } + + /// + /// Gets the size of the entity. + /// + public short Size { get; } } \ No newline at end of file diff --git a/Core/NosSmooth.Game/Data/Entities/Player.cs b/Core/NosSmooth.Game/Data/Entities/Player.cs index 50efa78..5a9f12d 100644 --- a/Core/NosSmooth.Game/Data/Entities/Player.cs +++ b/Core/NosSmooth.Game/Data/Entities/Player.cs @@ -1,12 +1,68 @@ -// -// Player.cs -// -// Copyright (c) Christofel authors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +// Player.cs +// +// Copyright (c) František Boháček. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace NosSmooth.Game.Entities; +using NosCore.Packets.Enumerations; +using NosCore.Shared.Enumerations; +using NosSmooth.Game.Data.Characters; +using NosSmooth.Game.Data.Info; -public class Player +namespace NosSmooth.Game.Data.Entities; + +/// +/// Represents nostale player entity. +/// +/// The id of the player. +/// The name of the player. +/// The position the player is at. +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +public record Player +( + long Id, + string? Name = default, + Position? Position = default, + byte? Speed = default, + Level? Level = default, + Level? HeroLevel = default, + byte? Direction = default, + Health? Hp = default, + Health? Mp = default, + FactionType? Faction = default, + short Size = default, + AuthorityType AuthorityType = default, + GenderType Gender = default, + HairStyleType HairStyle = default, + HairColorType HairColor = default, + CharacterClassType Class = default, + byte? Icon = default, + short? Compliment = default, + Morph? Morph = default, + bool? ArenaWinner = default, + bool? Invisible = default, + long? Reputation = default +) : ILivingEntity { - + /// + ushort? ILivingEntity.Level => Level?.Lvl; + + /// + public VisualType Type => VisualType.Player; } \ No newline at end of file -- 2.49.0