From fa68622ed1625337464956a6797e4c33b2fb2d92 Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Tue, 30 Sep 2025 22:46:22 +0300 Subject: [PATCH] Interfaces woohoo --- .../Models/DTO/MissionCompletionResult.cs | 11 +++++++++++ .../Models/DTO/MissionValidationResult.cs | 8 ++++++++ LctMonolith/Models/DTO/PlayerProgress.cs | 15 +++++++++++++++ LctMonolith/Models/DTO/SkillProgress.cs | 9 +++++++++ .../Services/Contracts/IDialogueService.cs | 12 ++++++++++++ .../Contracts/IMissionCategoryService.cs | 14 ++++++++++++++ .../Services/Contracts/IMissionService.cs | 17 +++++++++++++++++ .../Services/Contracts/IPlayerService.cs | 14 ++++++++++++++ .../Contracts/IProgressTrackingService.cs | 14 ++++++++++++++ LctMonolith/Services/Contracts/IRankService.cs | 15 +++++++++++++++ .../Services/Contracts/IRewardService.cs | 11 +++++++++++ .../Contracts/IRuleValidationService.cs | 10 ++++++++++ LctMonolith/Services/Contracts/ISkillService.cs | 16 ++++++++++++++++ 13 files changed, 166 insertions(+) create mode 100644 LctMonolith/Models/DTO/MissionCompletionResult.cs create mode 100644 LctMonolith/Models/DTO/MissionValidationResult.cs create mode 100644 LctMonolith/Models/DTO/PlayerProgress.cs create mode 100644 LctMonolith/Models/DTO/SkillProgress.cs create mode 100644 LctMonolith/Services/Contracts/IDialogueService.cs create mode 100644 LctMonolith/Services/Contracts/IMissionCategoryService.cs create mode 100644 LctMonolith/Services/Contracts/IMissionService.cs create mode 100644 LctMonolith/Services/Contracts/IPlayerService.cs create mode 100644 LctMonolith/Services/Contracts/IProgressTrackingService.cs create mode 100644 LctMonolith/Services/Contracts/IRankService.cs create mode 100644 LctMonolith/Services/Contracts/IRewardService.cs create mode 100644 LctMonolith/Services/Contracts/IRuleValidationService.cs create mode 100644 LctMonolith/Services/Contracts/ISkillService.cs diff --git a/LctMonolith/Models/DTO/MissionCompletionResult.cs b/LctMonolith/Models/DTO/MissionCompletionResult.cs new file mode 100644 index 0000000..2492a12 --- /dev/null +++ b/LctMonolith/Models/DTO/MissionCompletionResult.cs @@ -0,0 +1,11 @@ +namespace LctMonolith.Models.DTO; + +public class MissionCompletionResult +{ + public bool Success { get; set; } + public string Message { get; set; } = string.Empty; + public int ExperienceGained { get; set; } + public int ManaGained { get; set; } + public List SkillsProgress { get; set; } = new(); + public List UnlockedMissions { get; set; } = new(); +} diff --git a/LctMonolith/Models/DTO/MissionValidationResult.cs b/LctMonolith/Models/DTO/MissionValidationResult.cs new file mode 100644 index 0000000..a33dc76 --- /dev/null +++ b/LctMonolith/Models/DTO/MissionValidationResult.cs @@ -0,0 +1,8 @@ +namespace LctMonolith.Models.DTO; + +public class MissionValidationResult +{ + public bool IsValid { get; set; } + public string Message { get; set; } = string.Empty; + public int? SuggestedExperience { get; set; } +} diff --git a/LctMonolith/Models/DTO/PlayerProgress.cs b/LctMonolith/Models/DTO/PlayerProgress.cs new file mode 100644 index 0000000..a4e6750 --- /dev/null +++ b/LctMonolith/Models/DTO/PlayerProgress.cs @@ -0,0 +1,15 @@ +using LctMonolith.Models.Database; + +namespace LctMonolith.Models.DTO; + +public class PlayerProgress +{ + public Guid PlayerId { get; set; } + public string PlayerName { get; set; } = string.Empty; + public Rank? CurrentRank { get; set; } + public int TotalExperience { get; set; } + public int TotalMana { get; set; } + public int CompletedMissions { get; set; } + public int TotalAvailableMissions { get; set; } + public Dictionary SkillLevels { get; set; } = new(); +} diff --git a/LctMonolith/Models/DTO/SkillProgress.cs b/LctMonolith/Models/DTO/SkillProgress.cs new file mode 100644 index 0000000..d54693f --- /dev/null +++ b/LctMonolith/Models/DTO/SkillProgress.cs @@ -0,0 +1,9 @@ +namespace LctMonolith.Models.DTO; + +public class SkillProgress +{ + public Guid SkillId { get; set; } + public string SkillTitle { get; set; } = string.Empty; + public int PreviousLevel { get; set; } + public int NewLevel { get; set; } +} diff --git a/LctMonolith/Services/Contracts/IDialogueService.cs b/LctMonolith/Services/Contracts/IDialogueService.cs new file mode 100644 index 0000000..0f46d1f --- /dev/null +++ b/LctMonolith/Services/Contracts/IDialogueService.cs @@ -0,0 +1,12 @@ +using LctMonolith.Models.Database; + +namespace LctMonolith.Services.Interfaces; + +public interface IDialogueService +{ + Task GetDialogueByMissionIdAsync(Guid missionId); + Task CreateDialogueAsync(Dialogue dialogue); + Task GetDialogueMessageByIdAsync(Guid messageId); + Task> GetResponseOptionsAsync(Guid messageId); + Task ProcessDialogueResponseAsync(Guid messageId, Guid responseOptionId, Guid playerId); +} diff --git a/LctMonolith/Services/Contracts/IMissionCategoryService.cs b/LctMonolith/Services/Contracts/IMissionCategoryService.cs new file mode 100644 index 0000000..2e751d0 --- /dev/null +++ b/LctMonolith/Services/Contracts/IMissionCategoryService.cs @@ -0,0 +1,14 @@ +using LctMonolith.Models.Database; + +namespace LctMonolith.Services.Interfaces; + +public interface IMissionCategoryService +{ + // CRUD should be enough + Task GetCategoryByIdAsync(Guid categoryId); + Task GetCategoryByTitleAsync(string title); + Task> GetAllCategoriesAsync(); + Task CreateCategoryAsync(MissionCategory category); + Task UpdateCategoryAsync(MissionCategory category); + Task DeleteCategoryAsync(Guid categoryId); +} diff --git a/LctMonolith/Services/Contracts/IMissionService.cs b/LctMonolith/Services/Contracts/IMissionService.cs new file mode 100644 index 0000000..4c4c2ec --- /dev/null +++ b/LctMonolith/Services/Contracts/IMissionService.cs @@ -0,0 +1,17 @@ +using LctMonolith.Models.Database; +using LctMonolith.Models.DTO; + +namespace GamificationService.Services.Interfaces; + +public interface IMissionService +{ + Task GetMissionByIdAsync(Guid missionId); + Task> GetMissionsByCategoryAsync(Guid categoryId); + Task> GetAvailableMissionsForPlayerAsync(Guid playerId); + Task> GetChildMissionsAsync(Guid parentMissionId); + Task CreateMissionAsync(Mission mission); + Task UpdateMissionAsync(Mission mission); + Task DeleteMissionAsync(Guid missionId); + Task IsMissionAvailableForPlayerAsync(Guid missionId, Guid playerId); + Task CompleteMissionAsync(Guid missionId, Guid playerId, object? missionProof = null); +} diff --git a/LctMonolith/Services/Contracts/IPlayerService.cs b/LctMonolith/Services/Contracts/IPlayerService.cs new file mode 100644 index 0000000..26ba5eb --- /dev/null +++ b/LctMonolith/Services/Contracts/IPlayerService.cs @@ -0,0 +1,14 @@ +using LctMonolith.Models.Database; + +namespace GamificationService.Services.Interfaces; + +public interface IPlayerService +{ + Task GetPlayerByUserIdAsync(string userId); + Task CreatePlayerAsync(string userId, string username); + Task UpdatePlayerRankAsync(Guid playerId, Guid newRankId); + Task AddPlayerExperienceAsync(Guid playerId, int experience); + Task AddPlayerManaAsync(Guid playerId, int mana); + Task> GetTopPlayersAsync(int topCount, TimeSpan timeFrame); + Task GetPlayerWithProgressAsync(Guid playerId); +} diff --git a/LctMonolith/Services/Contracts/IProgressTrackingService.cs b/LctMonolith/Services/Contracts/IProgressTrackingService.cs new file mode 100644 index 0000000..9f7418a --- /dev/null +++ b/LctMonolith/Services/Contracts/IProgressTrackingService.cs @@ -0,0 +1,14 @@ +using LctMonolith.Models.Database; +using LctMonolith.Models.DTO; + +namespace GamificationService.Services.Interfaces; + +public interface IProgressTrackingService +{ + Task StartMissionAsync(Guid missionId, Guid playerId); + Task UpdateMissionProgressAsync(Guid playerMissionId, int progressPercentage, object? proof = null); + Task CompleteMissionAsync(Guid playerMissionId, object? proof = null); + Task> GetPlayerMissionsAsync(Guid playerId); + Task GetPlayerMissionAsync(Guid playerId, Guid missionId); + Task GetPlayerOverallProgressAsync(Guid playerId); +} diff --git a/LctMonolith/Services/Contracts/IRankService.cs b/LctMonolith/Services/Contracts/IRankService.cs new file mode 100644 index 0000000..184cb25 --- /dev/null +++ b/LctMonolith/Services/Contracts/IRankService.cs @@ -0,0 +1,15 @@ +using LctMonolith.Models.Database; + +namespace GamificationService.Services.Interfaces; + +public interface IRankService +{ + Task GetRankByIdAsync(Guid rankId); + Task GetRankByTitleAsync(string title); + Task> GetAllRanksAsync(); + Task CreateRankAsync(Rank rank); + Task UpdateRankAsync(Rank rank); + Task DeleteRankAsync(Guid rankId); + Task CanPlayerAdvanceToRankAsync(Guid playerId, Guid rankId); + Task GetNextRankAsync(Guid currentRankId); +} diff --git a/LctMonolith/Services/Contracts/IRewardService.cs b/LctMonolith/Services/Contracts/IRewardService.cs new file mode 100644 index 0000000..5ab5876 --- /dev/null +++ b/LctMonolith/Services/Contracts/IRewardService.cs @@ -0,0 +1,11 @@ +using LctMonolith.Models.Database; + +namespace LctMonolith.Services.Interfaces; + +public interface IRewardService +{ + Task> GetMissionSkillRewardsAsync(Guid missionId); + Task> GetMissionItemRewardsAsync(Guid missionId); + Task DistributeMissionRewardsAsync(Guid missionId, Guid playerId); + Task CanClaimRewardAsync(Guid rewardId, Guid playerId); +} diff --git a/LctMonolith/Services/Contracts/IRuleValidationService.cs b/LctMonolith/Services/Contracts/IRuleValidationService.cs new file mode 100644 index 0000000..f83a37f --- /dev/null +++ b/LctMonolith/Services/Contracts/IRuleValidationService.cs @@ -0,0 +1,10 @@ +using LctMonolith.Models.Database; + +namespace LctMonolith.Services.Interfaces; + +public interface IRuleValidationService +{ + Task ValidateMissionRankRulesAsync(Guid missionId, Guid playerId); + Task ValidateRankAdvancementRulesAsync(Guid playerId, Guid targetRankId); + Task> GetApplicableRankRulesAsync(Guid missionId); +} diff --git a/LctMonolith/Services/Contracts/ISkillService.cs b/LctMonolith/Services/Contracts/ISkillService.cs new file mode 100644 index 0000000..f3495a3 --- /dev/null +++ b/LctMonolith/Services/Contracts/ISkillService.cs @@ -0,0 +1,16 @@ +using LctMonolith.Models.Database; + +namespace LctMonolith.Services.Interfaces; + +public interface ISkillService +{ + Task GetSkillByIdAsync(Guid skillId); + Task GetSkillByTitleAsync(string title); + Task> GetAllSkillsAsync(); + Task CreateSkillAsync(Skill skill); + Task UpdateSkillAsync(Skill skill); + Task DeleteSkillAsync(Guid skillId); + Task UpdatePlayerSkillAsync(Guid playerId, Guid skillId, int level); + Task> GetPlayerSkillsAsync(Guid playerId); + Task GetPlayerSkillLevelAsync(Guid playerId, Guid skillId); +}