From 1b8ecea55cb0a459511990af5f46b20f1ea2fa40 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:04:21 +0100 Subject: [PATCH] feat: add events for character skills --- .../Errors/SkillOnCooldownError.cs | 15 ++++++++++++++ .../Characters/ReceivedCharacterDataEvent.cs | 20 +++++++++++++++++++ .../Events/Characters/SkillReadyEvent.cs | 14 +++++++++++++ .../Events/Characters/SkillsReceivedEvent.cs | 11 ++++++++++ .../Events/Players/SkillUsedEvent.cs | 13 ++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 Core/NosSmooth.Game/Errors/SkillOnCooldownError.cs create mode 100644 Core/NosSmooth.Game/Events/Characters/ReceivedCharacterDataEvent.cs create mode 100644 Core/NosSmooth.Game/Events/Characters/SkillReadyEvent.cs create mode 100644 Core/NosSmooth.Game/Events/Characters/SkillsReceivedEvent.cs create mode 100644 Core/NosSmooth.Game/Events/Players/SkillUsedEvent.cs diff --git a/Core/NosSmooth.Game/Errors/SkillOnCooldownError.cs b/Core/NosSmooth.Game/Errors/SkillOnCooldownError.cs new file mode 100644 index 0000000..0c6c455 --- /dev/null +++ b/Core/NosSmooth.Game/Errors/SkillOnCooldownError.cs @@ -0,0 +1,15 @@ +// +// SkillOnCooldownError.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. + +using NosSmooth.Game.Data.Characters; +using Remora.Results; + +namespace NosSmooth.Game.Errors; + +/// +/// Acts as an error specifying the skill is on cooldown. +/// +public record SkillOnCooldownError(Skill skill) : ResultError("The skill is on cooldown."); \ No newline at end of file diff --git a/Core/NosSmooth.Game/Events/Characters/ReceivedCharacterDataEvent.cs b/Core/NosSmooth.Game/Events/Characters/ReceivedCharacterDataEvent.cs new file mode 100644 index 0000000..984f8ae --- /dev/null +++ b/Core/NosSmooth.Game/Events/Characters/ReceivedCharacterDataEvent.cs @@ -0,0 +1,20 @@ +// +// ReceivedCharacterDataEvent.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. + +using NosSmooth.Game.Data.Characters; + +namespace NosSmooth.Game.Events.Characters; + +/// +/// Represents received new updated character data. +/// +/// The old data. +/// The newly received data. +public record ReceivedCharacterDataEvent +( + Character? OldCharacter, + Character Character +) : IGameEvent; \ No newline at end of file diff --git a/Core/NosSmooth.Game/Events/Characters/SkillReadyEvent.cs b/Core/NosSmooth.Game/Events/Characters/SkillReadyEvent.cs new file mode 100644 index 0000000..8504559 --- /dev/null +++ b/Core/NosSmooth.Game/Events/Characters/SkillReadyEvent.cs @@ -0,0 +1,14 @@ +// +// SkillReadyEvent.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. + +using NosSmooth.Game.Data.Characters; + +namespace NosSmooth.Game.Events.Characters; + +/// +/// The skill cooldown has been up. +/// +public record SkillReadyEvent(Skill? Skill, long SkillVNum) : IGameEvent; \ No newline at end of file diff --git a/Core/NosSmooth.Game/Events/Characters/SkillsReceivedEvent.cs b/Core/NosSmooth.Game/Events/Characters/SkillsReceivedEvent.cs new file mode 100644 index 0000000..58e6a89 --- /dev/null +++ b/Core/NosSmooth.Game/Events/Characters/SkillsReceivedEvent.cs @@ -0,0 +1,11 @@ +// +// SkillsReceivedEvent.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. + +using NosSmooth.Game.Data.Characters; + +namespace NosSmooth.Game.Events.Characters; + +public record SkillsReceivedEvent(Skills Skills) : IGameEvent; \ No newline at end of file diff --git a/Core/NosSmooth.Game/Events/Players/SkillUsedEvent.cs b/Core/NosSmooth.Game/Events/Players/SkillUsedEvent.cs new file mode 100644 index 0000000..58e2551 --- /dev/null +++ b/Core/NosSmooth.Game/Events/Players/SkillUsedEvent.cs @@ -0,0 +1,13 @@ +// +// SkillUsedEvent.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. + +using NosSmooth.Game.Data.Characters; +using NosSmooth.Game.Data.Entities; +using NosSmooth.Game.Data.Info; + +namespace NosSmooth.Game.Events.Players; + +public record SkillUsedEvent(ILivingEntity? Entity, long EntityId, Skill? Skill, long SkillVNum, long TargetId, Position? TargetPosition) : IGameEvent; \ No newline at end of file -- 2.49.0