feat: create window client app
This commit is contained in:
18
Client/Domain/DTO/Message.cs
Normal file
18
Client/Domain/DTO/Message.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Client.Domain.Enums;
|
||||
|
||||
namespace Client.Domain.DTO
|
||||
{
|
||||
public class Message
|
||||
{
|
||||
public readonly MessageTypeEnum Type;
|
||||
public readonly MessageOperationEnum Operation;
|
||||
public readonly string Content;
|
||||
|
||||
public Message(MessageTypeEnum type, MessageOperationEnum operation, string content)
|
||||
{
|
||||
Type = type;
|
||||
Operation = operation;
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
}
|
24
Client/Domain/Entities/Drop.cs
Normal file
24
Client/Domain/Entities/Drop.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Client.Domain.ValueObjects;
|
||||
|
||||
namespace Client.Domain.Entities
|
||||
{
|
||||
public class Drop : EntityInterface
|
||||
{
|
||||
public uint Id { get; set; }
|
||||
public Transform Transform { get; set; }
|
||||
public uint ItemId { get; set; }
|
||||
public uint Amount { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string IconName { get; set; }
|
||||
|
||||
public Drop(uint id, Transform transform, uint itemId, uint amount, string name, string iconName)
|
||||
{
|
||||
Id = id;
|
||||
Transform = transform;
|
||||
ItemId = itemId;
|
||||
Amount = amount;
|
||||
Name = name;
|
||||
IconName = iconName;
|
||||
}
|
||||
}
|
||||
}
|
13
Client/Domain/Entities/EntityInterface.cs
Normal file
13
Client/Domain/Entities/EntityInterface.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Entities
|
||||
{
|
||||
public interface EntityInterface
|
||||
{
|
||||
public uint Id { get; set; }
|
||||
}
|
||||
}
|
36
Client/Domain/Entities/Hero.cs
Normal file
36
Client/Domain/Entities/Hero.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Client.Domain.ValueObjects;
|
||||
|
||||
namespace Client.Domain.Entities
|
||||
{
|
||||
public class Hero : EntityInterface
|
||||
{
|
||||
public uint Id { get; set; }
|
||||
public Transform Transform { get; set; }
|
||||
public FullName FullName { get; set; }
|
||||
public VitalStats VitalStats { get; set; }
|
||||
public Phenotype Phenotype { get; set; }
|
||||
public ExperienceInfo ExperienceInfo { get; set; }
|
||||
public PermanentStats PermanentStats { get; set; }
|
||||
public VariableStats VariableStats { get; set; }
|
||||
public Reputation Reputation { get; set; }
|
||||
public InventoryInfo InventoryInfo { get; set; }
|
||||
public uint TargetId { get; set; }
|
||||
public bool IsStanding { get; set; }
|
||||
|
||||
public Hero(uint id, Transform transform, FullName fullName, VitalStats vitalStats, Phenotype phenotype, ExperienceInfo experienceInfo, PermanentStats permanentStats, VariableStats variableStats, Reputation reputation, InventoryInfo inventoryInfo, uint targetId, bool isStanding)
|
||||
{
|
||||
Id = id;
|
||||
Transform = transform;
|
||||
FullName = fullName;
|
||||
VitalStats = vitalStats;
|
||||
Phenotype = phenotype;
|
||||
ExperienceInfo = experienceInfo;
|
||||
PermanentStats = permanentStats;
|
||||
VariableStats = variableStats;
|
||||
Reputation = reputation;
|
||||
InventoryInfo = inventoryInfo;
|
||||
TargetId = targetId;
|
||||
IsStanding = isStanding;
|
||||
}
|
||||
}
|
||||
}
|
102
Client/Domain/Enums/ClassEnum.cs
Normal file
102
Client/Domain/Enums/ClassEnum.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Enums
|
||||
{
|
||||
public enum ClassEnum : uint
|
||||
{
|
||||
None = 255,
|
||||
HumanFighter = 0,
|
||||
Warrior,
|
||||
Gladiator,
|
||||
Warlord,
|
||||
HumanKnight,
|
||||
Paladin,
|
||||
DarkAvenger,
|
||||
Rogue,
|
||||
TreasureHunter,
|
||||
Hawkeye,
|
||||
HumanMystic,
|
||||
HumanWizard,
|
||||
Sorceror,
|
||||
Necromancer,
|
||||
Warlock,
|
||||
Cleric,
|
||||
Bishop,
|
||||
Prophet,
|
||||
ElvenFighter,
|
||||
ElvenKnight,
|
||||
TempleKnight,
|
||||
Swordsinger,
|
||||
ElvenScout,
|
||||
PlainsWalker,
|
||||
SilverRanger,
|
||||
ElvenMystic,
|
||||
ElvenWizard,
|
||||
Spellsinger,
|
||||
ElementalSummoner,
|
||||
ElvenOracle,
|
||||
ElvenElder,
|
||||
DarkElvenFighter,
|
||||
PalusKnight,
|
||||
ShillienKnight,
|
||||
Bladedancer,
|
||||
Assassin,
|
||||
AbyssWalker,
|
||||
PhantomRanger,
|
||||
DarkElvenMystic,
|
||||
DarkElvenWizard,
|
||||
Spellhowler,
|
||||
PhantomSummoner,
|
||||
ShillienOracle,
|
||||
ShillienElder,
|
||||
OrcFighter,
|
||||
OrcRaider,
|
||||
Destroyer,
|
||||
OrcMonk,
|
||||
Tyrant,
|
||||
OrcMystic,
|
||||
OrcShaman,
|
||||
Overlord,
|
||||
Warcryer,
|
||||
DwarvenFighter,
|
||||
DwarvenScavenger,
|
||||
BountyHunter,
|
||||
DwarvenArtisan,
|
||||
Warsmith,
|
||||
Duelist = 88,
|
||||
Dreadnought,
|
||||
PhoenixKnight,
|
||||
HellKnight,
|
||||
Sagittarius,
|
||||
Adventurer,
|
||||
Archmage,
|
||||
Soultaker,
|
||||
ArcanaLord,
|
||||
Cardinal,
|
||||
Hierophant,
|
||||
EvaTemplar,
|
||||
SwordMuse,
|
||||
WindRider,
|
||||
MoonlightSentinel,
|
||||
MysticMuse,
|
||||
ElementalMaster,
|
||||
EvaSaint,
|
||||
ShillienTemplar,
|
||||
SpectralDancer,
|
||||
GhostHunter,
|
||||
GhostSentinel,
|
||||
StormScreamer,
|
||||
SpectralMaster,
|
||||
ShillienSaint,
|
||||
Titan,
|
||||
GrandKhauatari,
|
||||
Dominator,
|
||||
Doomcryer,
|
||||
FortuneSeeker,
|
||||
Maestro
|
||||
}
|
||||
}
|
13
Client/Domain/Enums/MessageOperationEnum.cs
Normal file
13
Client/Domain/Enums/MessageOperationEnum.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Enums
|
||||
{
|
||||
public enum MessageOperationEnum
|
||||
{
|
||||
None, Create, Update, Delete
|
||||
}
|
||||
}
|
22
Client/Domain/Enums/MessageTypeEnum.cs
Normal file
22
Client/Domain/Enums/MessageTypeEnum.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Client.Domain.Entities;
|
||||
|
||||
namespace Client.Domain.Enums
|
||||
{
|
||||
public enum MessageTypeEnum
|
||||
{
|
||||
None,
|
||||
Hero,
|
||||
Drop,
|
||||
NPC,
|
||||
Player,
|
||||
Skill,
|
||||
Item,
|
||||
AbnormalEffect,
|
||||
Chat
|
||||
}
|
||||
}
|
18
Client/Domain/Enums/RaceEnum.cs
Normal file
18
Client/Domain/Enums/RaceEnum.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Enums
|
||||
{
|
||||
public enum RaceEnum : uint
|
||||
{
|
||||
None = 255,
|
||||
DarkElf = 2,
|
||||
Dwarf = 4,
|
||||
Elf = 1,
|
||||
Human = 0,
|
||||
Orc = 3
|
||||
}
|
||||
}
|
12
Client/Domain/Exception/ParserException.cs
Normal file
12
Client/Domain/Exception/ParserException.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Exception
|
||||
{
|
||||
public class ParserException : System.Exception
|
||||
{
|
||||
}
|
||||
}
|
15
Client/Domain/Factories/EntityFactoryInterface.cs
Normal file
15
Client/Domain/Factories/EntityFactoryInterface.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Client.Domain.Entities;
|
||||
|
||||
namespace Client.Domain.Factories
|
||||
{
|
||||
public interface EntityFactoryInterface<T>
|
||||
{
|
||||
public T? Create(string data);
|
||||
public void Update(T entity, string data);
|
||||
}
|
||||
}
|
15
Client/Domain/Factories/EntityHandlerFactoryInterface.cs
Normal file
15
Client/Domain/Factories/EntityHandlerFactoryInterface.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Client.Domain.Enums;
|
||||
using Client.Domain.Service;
|
||||
|
||||
namespace Client.Domain.Factories
|
||||
{
|
||||
public interface EntityHandlerFactoryInterface
|
||||
{
|
||||
HandlerInterface GetHandler(MessageTypeEnum type);
|
||||
}
|
||||
}
|
13
Client/Domain/Parsers/MessageParserInterface.cs
Normal file
13
Client/Domain/Parsers/MessageParserInterface.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Parsers
|
||||
{
|
||||
public interface MessageParserInterface
|
||||
{
|
||||
DTO.Message Parse(string message);
|
||||
}
|
||||
}
|
52
Client/Domain/Service/EntityHandler.cs
Normal file
52
Client/Domain/Service/EntityHandler.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Client.Domain.DTO;
|
||||
using Client.Domain.Entities;
|
||||
using Client.Domain.Enums;
|
||||
using Client.Domain.Factories;
|
||||
|
||||
namespace Client.Domain.Service
|
||||
{
|
||||
public class EntityHandler<T> : HandlerInterface where T : EntityInterface
|
||||
{
|
||||
public void Update(MessageOperationEnum operation, string content)
|
||||
{
|
||||
var entity = factory.Create(content);
|
||||
if (operation == MessageOperationEnum.Create)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(entity));
|
||||
}
|
||||
entities[entity.Id] = entity;
|
||||
|
||||
|
||||
}
|
||||
else if (operation == MessageOperationEnum.Update)
|
||||
{
|
||||
if (entity != null && entities.ContainsKey(entity.Id))
|
||||
{
|
||||
factory.Update(entities[entity.Id], content);
|
||||
}
|
||||
}
|
||||
else if (operation == MessageOperationEnum.Delete)
|
||||
{
|
||||
if (entity != null)
|
||||
{
|
||||
entities.Remove(entity.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EntityHandler(EntityFactoryInterface<T> factory)
|
||||
{
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
private readonly EntityFactoryInterface<T> factory;
|
||||
private Dictionary<uint, T> entities = new Dictionary<uint, T>();
|
||||
}
|
||||
}
|
15
Client/Domain/Service/HandlerInterface.cs
Normal file
15
Client/Domain/Service/HandlerInterface.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Client.Domain.DTO;
|
||||
using Client.Domain.Enums;
|
||||
|
||||
namespace Client.Domain.Service
|
||||
{
|
||||
public interface HandlerInterface
|
||||
{
|
||||
void Update(MessageOperationEnum operation, string content);
|
||||
}
|
||||
}
|
20
Client/Domain/Transports/TransportInterface.cs
Normal file
20
Client/Domain/Transports/TransportInterface.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Transports
|
||||
{
|
||||
public interface TransportInterface
|
||||
{
|
||||
public event DelegateMessage Message;
|
||||
|
||||
bool IsConnected();
|
||||
Task ConnectAsync();
|
||||
Task SendAsync(string data);
|
||||
Task StartReceiveAsync();
|
||||
|
||||
public delegate void DelegateMessage(string args);
|
||||
}
|
||||
}
|
16
Client/Domain/ValueObjects/ExperienceInfo.cs
Normal file
16
Client/Domain/ValueObjects/ExperienceInfo.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class ExperienceInfo
|
||||
{
|
||||
public uint Level { get; set; }
|
||||
public uint Exp { get; set; }
|
||||
public uint Sp { get; set; }
|
||||
|
||||
public ExperienceInfo(uint level, uint exp, uint sp)
|
||||
{
|
||||
Level = level;
|
||||
Exp = exp;
|
||||
Sp = sp;
|
||||
}
|
||||
}
|
||||
}
|
14
Client/Domain/ValueObjects/FullName.cs
Normal file
14
Client/Domain/ValueObjects/FullName.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class FullName
|
||||
{
|
||||
public string Nickname { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
public FullName(string nickname, string title)
|
||||
{
|
||||
Nickname = nickname;
|
||||
Title = title;
|
||||
}
|
||||
}
|
||||
}
|
16
Client/Domain/ValueObjects/InventoryInfo.cs
Normal file
16
Client/Domain/ValueObjects/InventoryInfo.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class InventoryInfo
|
||||
{
|
||||
public uint MaxWeight { get; set; }
|
||||
public uint Weight { get; set; }
|
||||
public uint Slots { get; set; }
|
||||
|
||||
public InventoryInfo(uint maxWeight, uint weight, uint slots)
|
||||
{
|
||||
MaxWeight = maxWeight;
|
||||
Weight = weight;
|
||||
Slots = slots;
|
||||
}
|
||||
}
|
||||
}
|
22
Client/Domain/ValueObjects/PermanentStats.cs
Normal file
22
Client/Domain/ValueObjects/PermanentStats.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class PermanentStats
|
||||
{
|
||||
public uint Str { get; set; }
|
||||
public uint Dex { get; set; }
|
||||
public uint Con { get; set; }
|
||||
public uint Int { get; set; }
|
||||
public uint Men { get; set; }
|
||||
public uint Wit { get; set; }
|
||||
|
||||
public PermanentStats(uint str, uint dex, uint con, uint @int, uint men, uint wit)
|
||||
{
|
||||
Str = str;
|
||||
Dex = dex;
|
||||
Con = con;
|
||||
Int = @int;
|
||||
Men = men;
|
||||
Wit = wit;
|
||||
}
|
||||
}
|
||||
}
|
20
Client/Domain/ValueObjects/Phenotype.cs
Normal file
20
Client/Domain/ValueObjects/Phenotype.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Client.Domain.Enums;
|
||||
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class Phenotype
|
||||
{
|
||||
public RaceEnum Race { get; set; }
|
||||
public bool IsMale { get; set; }
|
||||
public ClassEnum Class { get; set; }
|
||||
public ClassEnum ActiveClass { get; set; }
|
||||
|
||||
public Phenotype(RaceEnum race, bool isMale, ClassEnum @class, ClassEnum activeClass)
|
||||
{
|
||||
Race = race;
|
||||
IsMale = isMale;
|
||||
Class = @class;
|
||||
ActiveClass = activeClass;
|
||||
}
|
||||
}
|
||||
}
|
20
Client/Domain/ValueObjects/Reputation.cs
Normal file
20
Client/Domain/ValueObjects/Reputation.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class Reputation
|
||||
{
|
||||
public uint Karma { get; set; }
|
||||
public uint PkKills { get; set; }
|
||||
public uint PvpKills { get; set; }
|
||||
public uint RecRemaining { get; set; }
|
||||
public uint EvalScore { get; set; }
|
||||
|
||||
public Reputation(uint karma, uint pkKills, uint pvpKills, uint recRemaining, uint evalScore)
|
||||
{
|
||||
Karma = karma;
|
||||
PkKills = pkKills;
|
||||
PvpKills = pvpKills;
|
||||
RecRemaining = recRemaining;
|
||||
EvalScore = evalScore;
|
||||
}
|
||||
}
|
||||
}
|
18
Client/Domain/ValueObjects/Transform.cs
Normal file
18
Client/Domain/ValueObjects/Transform.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class Transform
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
public Vector3 Rotation { get; set; }
|
||||
public Vector3 Velocity { get; set; }
|
||||
public Vector3 Acceleration { get; set; }
|
||||
|
||||
public Transform(Vector3 position, Vector3 rotation, Vector3 velocity, Vector3 acceleration)
|
||||
{
|
||||
Position = position;
|
||||
Rotation = rotation;
|
||||
Velocity = velocity;
|
||||
Acceleration = acceleration;
|
||||
}
|
||||
}
|
||||
}
|
28
Client/Domain/ValueObjects/VariableStats.cs
Normal file
28
Client/Domain/ValueObjects/VariableStats.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class VariableStats
|
||||
{
|
||||
public uint Accuracy { get; set; }
|
||||
public uint CritRate { get; set; }
|
||||
public uint PAttack { get; set; }
|
||||
public uint AttackSpeed { get; set; }
|
||||
public uint PDefense { get; set; }
|
||||
public uint Evasion { get; set; }
|
||||
public uint MAttack { get; set; }
|
||||
public uint MDefense { get; set; }
|
||||
public uint CastingSpeed { get; set; }
|
||||
|
||||
public VariableStats(uint accuracy, uint critRate, uint pAttack, uint attackSpeed, uint pDefense, uint evasion, uint mAttack, uint mDefense, uint castingSpeed)
|
||||
{
|
||||
Accuracy = accuracy;
|
||||
CritRate = critRate;
|
||||
PAttack = pAttack;
|
||||
AttackSpeed = attackSpeed;
|
||||
PDefense = pDefense;
|
||||
Evasion = evasion;
|
||||
MAttack = mAttack;
|
||||
MDefense = mDefense;
|
||||
CastingSpeed = castingSpeed;
|
||||
}
|
||||
}
|
||||
}
|
16
Client/Domain/ValueObjects/Vector3.cs
Normal file
16
Client/Domain/ValueObjects/Vector3.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class Vector3
|
||||
{
|
||||
public float X { get; set; }
|
||||
public float Y { get; set; }
|
||||
public float Z { get; set; }
|
||||
|
||||
public Vector3(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
}
|
||||
}
|
22
Client/Domain/ValueObjects/VitalStats.cs
Normal file
22
Client/Domain/ValueObjects/VitalStats.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Client.Domain.ValueObjects
|
||||
{
|
||||
public class VitalStats
|
||||
{
|
||||
public uint Hp { get; set; }
|
||||
public uint MaxHp { get; set; }
|
||||
public uint Mp { get; set; }
|
||||
public uint MaxMp { get; set; }
|
||||
public uint Cp { get; set; }
|
||||
public uint MaxCp { get; set; }
|
||||
|
||||
public VitalStats(uint hp, uint maxHp, uint mp, uint maxMp, uint cp, uint maxCp)
|
||||
{
|
||||
Hp = hp;
|
||||
MaxHp = maxHp;
|
||||
Mp = mp;
|
||||
MaxMp = maxMp;
|
||||
Cp = cp;
|
||||
MaxCp = maxCp;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user