Trophy Rankings, Ranking Packets, & WIP Mentoring - #440
Conversation
WalkthroughThis update introduces extensive mentoring and ranking features across the Maple2 server and model layers. It adds new properties and enums for mentor roles, implements mentor and ranking packet handlers, expands protobuf definitions, and updates serialization logic. Several new classes, methods, and constants support mentoring missions, ranking retrieval, and system shop interactions. The changes also restructure some namespaces and add new data tables for seasonal content. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GameSession
participant MentoringManager
participant Database
Client->>GameSession: Mentor command (e.g., AssignMentee)
GameSession->>MentoringManager: UpdateRole(Mentee)
MentoringManager->>Database: Query for ReturnUser event
Database-->>MentoringManager: Return event metadata
MentoringManager->>GameSession: Send MentorPacket.UpdateRole
MentoringManager->>GameSession: Load mentoring state (send packets)
GameSession-->>Client: Mentor state packets
sequenceDiagram
participant WebClient
participant WebController
participant GameStorage
participant Database
WebClient->>WebController: POST irrq.aspx (Ranking request)
WebController->>GameStorage: GetTrophyRankings()
GameStorage->>Database: Query characters/achievements
Database-->>GameStorage: Character & achievement data
GameStorage-->>WebController: TrophyRankInfo list
WebController->>WebClient: Compressed ranking packet
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 16
🧹 Nitpick comments (19)
Maple2.Database/Model/Ranking/TrophyRankInfo.cs (1)
5-5: Add XML documentation to explain record purpose and propertiesThis record is clear and concise but lacks documentation to explain its purpose and the meaning of each property. Consider adding XML documentation comments to help other developers understand how this record is used in the trophy ranking system.
+/// <summary> +/// Represents trophy ranking information for a character +/// </summary> +/// <param name="Rank">The character's position in the ranking</param> +/// <param name="CharacterId">Unique identifier for the character</param> +/// <param name="Name">Character's display name</param> +/// <param name="Profile">Character's profile information</param> +/// <param name="Trophy">Achievement information for the trophy</param> public record TrophyRankInfo(int Rank, long CharacterId, string Name, string Profile, AchievementInfo Trophy);Maple2.Tools/Extensions/PacketExtensions.cs (1)
147-157: Consider adding a maximum string length checkWithout an upper limit on string length, very large strings could potentially be written to packets, which might lead to memory issues or become a vector for denial of service attacks if processing untrusted input.
public static T WriteUnicodeStringWithLength<T>(this T writer, string value = "") where T : IByteWriter { if (string.IsNullOrEmpty(value)) { writer.WriteInt(0); return writer; } + // Optional: Consider implementing a maximum length check + const int MaxStringLength = 8192; // Example maximum length in characters + if (value.Length > MaxStringLength) { + throw new ArgumentException($"String exceeds maximum length of {MaxStringLength} characters"); + } byte[] stringBytes = Encoding.Unicode.GetBytes(value); writer.WriteInt(stringBytes.Length); writer.WriteBytes(stringBytes); return writer; }Maple2.Server.Game/Session/GameSession.cs (1)
334-335: Consider documenting mentoring packet purposes.The two mentoring packets are sent after user enters server, but the
Unknown12()method name is not descriptive of its purpose.Consider renaming the
Unknown12()method to better reflect its purpose, or add a comment explaining what it does:- Send(MentorPacket.Unknown12()); + Send(MentorPacket.InitializeMentorSystem()); // Or another appropriate nameAlternatively, add a comment explaining the packet's purpose above this line.
Maple2.Server.Game/Packets/InGameRankPacket.cs (1)
7-17: Add documentation for the InGameRankPacket parameters.The packet writes hardcoded values (31, 120, 60) without explanation of their meaning or purpose.
Consider adding XML documentation to explain the purpose of this method and what the hardcoded values represent:
+ /// <summary> + /// Creates a packet to initialize the in-game ranking system. + /// </summary> + /// <returns>A ByteWriter containing the initialization packet for in-game ranking.</returns> + /// <remarks> + /// The packet contains: + /// - Byte 31: [purpose of this value] + /// - Int 120: [purpose of this value, e.g. update interval in seconds] + /// - Int 60: [purpose of this value, e.g. cache duration in seconds] + /// </remarks> public static ByteWriter Load() { var pWriter = Packet.Of(SendOp.InGameRank); pWriter.WriteByte(31); pWriter.WriteInt(120); pWriter.WriteInt(60); return pWriter; }Maple2.Database/Model/Character.cs (1)
25-25: Consider initializing the MentorRole property with a default value.The new
MentorRoleproperty is added without an explicit default value. While it will default to the first enum value (likelyNone), it would be clearer to initialize it explicitly, especially if new characters should start with a specific role.- public MentorRole MentorRole { get; set; } + public MentorRole MentorRole { get; set; } = MentorRole.None;Maple2.Server.Core/proto/sync.proto (1)
107-108: Consider making mentor_role field optionality consistent.The
mentor_rolefield is optional inPlayerUpdateRequestbut not marked as optional inPlayerInfoResponse. Consider making this consistent unless there's a specific reason for this difference.- int32 mentor_role = 23; + optional int32 mentor_role = 23;Maple2.Model/Enum/GameRankingType.cs (2)
5-39: Consider adding documentation to enum values.The
GameRankingTypeenum has many values with specific meanings. Consider adding XML documentation comments to explain what each ranking type represents and how they're used.Example:
+/// <summary> +/// Represents the different types of rankings in the game. +/// </summary> public enum GameRankingType { + /// <summary> + /// Personal guild trophy rankings. + /// </summary> PersonalGuildTrophy = 12, // Add similar comments for other enum values🧰 Tools
🪛 GitHub Actions: Format
[error] 22-22: dotnet format whitespace error: Fix whitespace formatting. Insert '\s'.
5-39: Consider grouping related enum values with regions or comments.The enum values follow a logical grouping pattern (trophies, dark descent, PvP, etc.). Consider adding region directives or comment headers to make these groupings more explicit.
Example:
public enum GameRankingType { + // Trophy Rankings PersonalGuildTrophy = 12, GuildTrophy = 14, PersonalTrophy = 22, Trophy = 24, + + // Dark Descent Rankings DarkDescentPersonal = 31, // ... and so on🧰 Tools
🪛 GitHub Actions: Format
[error] 22-22: dotnet format whitespace error: Fix whitespace formatting. Insert '\s'.
Maple2.File.Ingest/Mapper/ServerTableMapper.cs (1)
1044-1052: New game event type: ReturnUserCandidateThis implementation parses four values to properly handle returning user candidates, including season identifiers, minimum level requirements, and a relevant date.
However, the property name
UnknownDateis not descriptive enough to understand its purpose.Consider renaming this property to something more descriptive based on its actual purpose in the game logic.
Maple2.Server.Game/Packets/MentorPacket.cs (3)
140-147: Updated LoginPoints method with meaningful valuesThe renamed method now writes specific point values and timestamps instead of empty placeholders, making it functionally complete for the mentoring system.
Consider making the hardcoded points value (100) configurable rather than hardcoded.
- pWriter.WriteInt(100); // points received + pWriter.WriteInt(Configuration.MentorSystem.LoginPointsAmount); // points received
149-157: Updated DailyPoints method with meaningful valuesThe renamed method now writes specific point values and timestamps, including a reset timestamp 2 days in the future.
The hardcoded values (1000, 0, +2 days) should ideally be configurable parameters rather than embedded in the code.
Consider extracting these values to configuration constants for better maintainability and flexibility.
162-166: Updated Unknown12 and Unknown16 methodsThese methods have been updated to write specific parameters, with Unknown16 now explicitly setting a boolean flag and integer value.
The methods still have unclear names that don't indicate their purpose.
Consider renaming these methods to better reflect their actual purpose in the mentoring system, similar to how you renamed LoginPoints and DailyPoints.
Also applies to: 199-206
Maple2.Model/Metadata/ServerTable/GameEventTable.cs (1)
101-129: Added new game event record types for user tracking and rewardsFour new record types have been added to support different user scenarios:
NewUser: For tracking newly created charactersReturnUserCandidate: For identifying potential returning usersActiveUser: For tracking active users and providing mail rewardsReturnUserYearRound: For handling year-round return user events with cooldown periodsThese new types properly extend the GameEventData base record with appropriate properties.
The
ReturnUserCandidaterecord contains a property namedUnknownDatewhich lacks clarity.Rename the
UnknownDateproperty to something more descriptive based on its actual purpose in the game mechanics.Maple2.Server.Game/PacketHandlers/MentorHandler.cs (1)
44-56: Added dedicated handler methods for mentor commandsNew methods HandleReward, HandleAssignMentee, and HandleMentorList have been implemented to handle the respective commands, each with appropriate packet responses.
In HandleMentorList, there's an unused variable:
- int unknown = packet.ReadInt(); // 0 + // Read but not used, possibly for future features + int version = packet.ReadInt(); // 0Maple2.Database/Storage/Game/GameStorage.Web.cs (1)
108-122: Randomised mentor list can duplicate accounts
OrderBy(_ => Random.Shared.Next())shuffles correctly, butRandom.Sharedis process-wide.
If this method is called concurrently the same RNG instance is shared, producing identical sequences for simultaneous requests.
For a fair rotation create a localRandom:var rng = new Random(); return filteredCharacterIds .OrderBy(_ => rng.Next()) .Take(50) .ToList();Also prefer
DateTime.UtcNowinstead ofDateTime.Nowto avoid TZ issues for servers hosted outside player locale.Maple2.Server.Web/Packet/InGameRankPacket.cs (2)
14-26: Timestamp should use UTC / be parameterisedAll packet methods write
DateTime.Nowwhich depends on server locale and cannot be reproduced by clients in different time-zones.
Either:
- Switch to
DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"), or- Pass the timestamp in as an argument so the caller can apply its own policy.
40-58: Repeated boilerplate – extract helper to reduce duplicationEach packet writer begins with identical 5 lines (ranking type, mode, timestamp, count).
A small private helper would collapse ~150 duplicated LOC and make future changes (e.g. timestamp format) one-shot.private static ByteWriter Start(GameRankingType type, int mode = 0, int count = 1) { var w = new ByteWriter(); w.Write(type); w.WriteInt(mode); w.WriteUnicodeStringWithLength(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")); w.WriteInt(count); return w; }Maple2.Server.Web/Controllers/WebController.cs (2)
288-295: C# 12 target-typednew []initializer may break older toolchains
List<TrophyRankInfo> rankInfos = [];compiles only with the C# 12 feature flag (<LangVersion>preview</LangVersion>or .NET 8 SDK).
If the project still targets LTS tooling (C# 11/.NET 7) replace withnew()for broader compatibility.
327-333:ByteWriterbuffer is copied twice – avoid extra allocation
ZlibCompresswrites the wholewriter.Bufferwhich is already sized towriter.Length.
An overload taking(byte[] buffer, int length)would avoid writing trailing zeroes (if any) and skip an extra allocation.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
Maple2.Server.World/Migrations/20250506175402_Mentor.Designer.csis excluded by!Maple2.Server.World/Migrations/*Maple2.Server.World/Migrations/20250506175402_Mentor.csis excluded by!Maple2.Server.World/Migrations/*Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.csis excluded by!Maple2.Server.World/Migrations/*
📒 Files selected for processing (48)
Maple2.Database/Model/Character.cs(3 hunks)Maple2.Database/Model/Ranking/TrophyRankInfo.cs(1 hunks)Maple2.Database/Storage/Game/GameStorage.User.cs(2 hunks)Maple2.Database/Storage/Game/GameStorage.Web.cs(1 hunks)Maple2.File.Ingest/Maple2.File.Ingest.csproj(1 hunks)Maple2.File.Ingest/Mapper/ItemMapper.cs(2 hunks)Maple2.File.Ingest/Mapper/QuestMapper.cs(1 hunks)Maple2.File.Ingest/Mapper/ServerTableMapper.cs(1 hunks)Maple2.File.Ingest/Mapper/TableMapper.cs(3 hunks)Maple2.Model/Common/TableNames.cs(1 hunks)Maple2.Model/Enum/GameRankingType.cs(1 hunks)Maple2.Model/Enum/Mentoring.cs(1 hunks)Maple2.Model/Game/Event/GameEvent.cs(1 hunks)Maple2.Model/Game/User/Character.cs(1 hunks)Maple2.Model/Game/User/IPlayerInfo.cs(1 hunks)Maple2.Model/Game/User/PlayerInfo.cs(6 hunks)Maple2.Model/Metadata/Constants.cs(2 hunks)Maple2.Model/Metadata/QuestMetadata.cs(2 hunks)Maple2.Model/Metadata/ServerTable/GameEventTable.cs(4 hunks)Maple2.Model/Metadata/Table/SeasonDataTable.cs(1 hunks)Maple2.Model/Metadata/TableMetadata.cs(1 hunks)Maple2.Server.Core/Sync/PlayerInfoUpdateExtensions.cs(3 hunks)Maple2.Server.Core/proto/common.proto(1 hunks)Maple2.Server.Core/proto/sync.proto(2 hunks)Maple2.Server.Game/Manager/MentoringManager.cs(1 hunks)Maple2.Server.Game/Manager/QuestManager.cs(2 hunks)Maple2.Server.Game/PacketHandlers/MentorHandler.cs(2 hunks)Maple2.Server.Game/PacketHandlers/QuestHandler.cs(1 hunks)Maple2.Server.Game/PacketHandlers/SystemShopHandler.cs(3 hunks)Maple2.Server.Game/Packets/FieldPacket.cs(1 hunks)Maple2.Server.Game/Packets/InGameRankPacket.cs(1 hunks)Maple2.Server.Game/Packets/MentorPacket.cs(6 hunks)Maple2.Server.Game/Packets/SystemShopPacket.cs(2 hunks)Maple2.Server.Game/Session/GameSession.cs(3 hunks)Maple2.Server.Game/Util/Sync/PlayerInfoStorage.cs(1 hunks)Maple2.Server.Web/Controllers/Ugc/BannerController.cs(1 hunks)Maple2.Server.Web/Controllers/Ugc/BlueprintController.cs(1 hunks)Maple2.Server.Web/Controllers/Ugc/GuildController.cs(1 hunks)Maple2.Server.Web/Controllers/Ugc/ItemController.cs(1 hunks)Maple2.Server.Web/Controllers/Ugc/ItemIconController.cs(1 hunks)Maple2.Server.Web/Controllers/Ugc/ProfileController.cs(1 hunks)Maple2.Server.Web/Controllers/WebController.cs(3 hunks)Maple2.Server.Web/Maple2.Server.Web.csproj(1 hunks)Maple2.Server.Web/Packet/InGameRankPacket.cs(1 hunks)Maple2.Server.Web/Packet/MentorPacket.cs(1 hunks)Maple2.Server.Web/Program.cs(1 hunks)Maple2.Server.World/Service/WorldService.Sync.cs(1 hunks)Maple2.Tools/Extensions/PacketExtensions.cs(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (6)
Maple2.Model/Metadata/TableMetadata.cs (1)
Maple2.File.Ingest/Mapper/TableMapper.cs (1)
SeasonDataTable(1741-1774)
Maple2.Server.Web/Program.cs (3)
Maple2.Server.Core/Modules/WebDbModule.cs (2)
WebDbModule(10-49)WebDbModule(15-31)Maple2.Server.Core/Modules/DataDbModule.cs (2)
DataDbModule(10-58)DataDbModule(13-29)Maple2.Server.Core/Modules/GameDbModule.cs (2)
GameDbModule(10-49)GameDbModule(15-31)
Maple2.Server.Game/Manager/QuestManager.cs (2)
Maple2.Database/Model/Quest.cs (1)
Quest(11-65)Maple2.Model/Game/Quest/Quest.cs (2)
Quest(9-47)Quest(20-23)
Maple2.Model/Game/Event/GameEvent.cs (1)
Maple2.Server.Core/Helpers/DebugByteWriter.cs (1)
WriteInt(70-73)
Maple2.Tools/Extensions/PacketExtensions.cs (3)
Maple2.Tools/Extensions/ClassSerializationExtensions.cs (1)
T(13-16)Maple2.Tools/Extensions/StructSerializationExtensions.cs (1)
T(19-28)Maple2.Server.Core/Helpers/DebugByteWriter.cs (1)
WriteInt(70-73)
Maple2.Server.Web/Packet/InGameRankPacket.cs (6)
Maple2.Server.Core/Packets/Packet.cs (1)
Packet(9-25)Maple2.Server.Game/Packets/InGameRankPacket.cs (2)
InGameRankPacket(7-17)ByteWriter(9-16)Maple2.Database/Storage/Game/GameStorage.Web.cs (4)
IList(61-101)IList(104-123)TrophyRankInfo(14-50)TrophyRankInfo(52-59)Maple2.Database/Model/Character.cs (1)
Profile(150-155)Maple2.Database/Storage/Game/GameStorage.Achievement.cs (1)
AchievementInfo(30-46)Maple2.Model/ModelExtensions.cs (1)
JobCode(11-13)
🪛 GitHub Actions: Format
Maple2.Server.Game/Manager/QuestManager.cs
[error] 194-194: dotnet format whitespace error: Fix whitespace formatting. Delete 1 characters.
Maple2.File.Ingest/Mapper/TableMapper.cs
[error] 1769-1769: dotnet format whitespace error: Fix whitespace formatting. Insert '\s'.
Maple2.Model/Enum/GameRankingType.cs
[error] 22-22: dotnet format whitespace error: Fix whitespace formatting. Insert '\s'.
Maple2.Server.Game/PacketHandlers/MentorHandler.cs
[error] 59-59: dotnet format whitespace error: Fix whitespace formatting. Replace 10 characters with '\r\n\s\s\s\s\s\s\s\s'.
[error] 61-61: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s'.
[error] 62-62: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s'.
[error] 63-63: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s\s'.
[error] 64-64: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s\s'.
[error] 65-65: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s\s'.
[error] 66-66: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s'.
[error] 66-66: dotnet format whitespace error: Fix whitespace formatting. Replace 10 characters with '\r\n\s\s\s\s\s\s\s\s'.
[error] 67-67: dotnet format whitespace error: Fix whitespace formatting. Replace 10 characters with '\r\n\s\s\s\s\s\s\s\s'.
[error] 68-68: dotnet format whitespace error: Fix whitespace formatting. Replace 6 characters with '\r\n\s\s\s\s'.
Maple2.Server.Game/Manager/MentoringManager.cs
[error] 34-34: dotnet format whitespace error: Fix whitespace formatting. Insert '\s\s'.
[error] 34-34: dotnet format whitespace error: Fix whitespace formatting. Replace 12 characters with '\r\n\r\n\s\s\s\s\s\s\s\s'.
[error] 36-36: dotnet format whitespace error: Fix whitespace formatting. Replace 10 characters with '\r\n\s\s\s\s\s\s\s\s'.
[error] 37-37: dotnet format whitespace error: Fix whitespace formatting. Replace 6 characters with '\r\n\s\s\s\s'.
Maple2.Server.Web/Packet/InGameRankPacket.cs
[error] 133-133: dotnet format whitespace error: Fix whitespace formatting. Insert '\s'.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build
- GitHub Check: build
🔇 Additional comments (67)
Maple2.File.Ingest/Maple2.File.Ingest.csproj (1)
22-22:Details
❓ Verification inconclusive
Verify compatibility with updated Parser package
The Maple2.File.Parser.Tadeucci package has been updated to version 2.2.9, which supports new features for the trophy ranking and mentoring systems. Ensure all code that depends on this package has been updated to handle any potential breaking changes or new APIs.
🏁 Script executed:
#!/bin/bash # Check for any usage of Parser.Tadeucci that might be affected by the update # Look for usages of the parser package in the codebase echo "Searching for classes using Parser.Tadeucci..." rg -l "Parser\.Tadeucci" --type csharp # Specifically look for any code that might parse season data echo -e "\nSearching for season data parsing..." rg "Season(Data)?" --type csharp -A 2 -B 2Length of output: 12997
Verify Parser.Tadeucci v2.2.9 compatibility in ingestion mappings
I didn’t find any direct references to
Maple2.File.Parser.Tadeucciin the code (the RG search returned no matches), but we do call its APIs via theparserobject in several mappers. Please confirm the following after upgrading to 2.2.9:
- TableMapper (Maple2.File.Ingest/Mapper/TableMapper.cs):
– Allparser.ParseSeasonData*()methods (Arcade, BossColosseum, DarkStream, GuildPvp, MapleSurvival, MapleSurvivalSquad, Pvp, UgcMapCommendation, WorldChampion) still exist and have the same signatures.- QuestMapper (Maple2.File.Ingest/Mapper/QuestMapper.cs):
– Thedata.mentoringMission.mentoringSeasonproperty remains correctly named and typed for the new mentoring-mission API.- Trophy-ranking features: if v2.2.9 introduced new enums or fields for ranking/mentoring, ensure
Maple2.Model/Enum/GameRankingTypeand related mapping logic are updated accordingly.- Run a full build and all ingestion/integration tests to catch any signature or serialization changes.
Maple2.Server.Web/Maple2.Server.Web.csproj (1)
35-37:Details
❌ Incorrect review comment
Ensure Model folder content is included in build
The addition of an empty Model folder to the project structure suggests it will contain new model classes for the mentoring and ranking systems. If models have been created but not included in the project structure, they may not be compiled correctly.
🏁 Script executed:
#!/bin/bash # Check for any model files in the Model directory that might not be included in the project # Look for any files in the Model folder echo "Checking for files in Model directory:" find "Maple2.Server.Web/Model" -type f 2>/dev/null || echo "No files found in Model directory" # Check for any model classes in the codebase that might be related to mentoring or ranking systems echo -e "\nLooking for model classes related to mentoring/ranking:" rg -l "class.*Mentor|class.*Rank" --type csharp "Maple2.Server.Web/"Length of output: 484
🏁 Script executed:
#!/bin/bash # Display the beginning of the project file to determine SDK style and implicit include settings head -n 30 Maple2.Server.Web/Maple2.Server.Web.csprojLength of output: 1431
Ignore the empty
<Folder>entry—SDK-style projects auto-include all.csfilesThe project uses the .NET SDK’s default globbing (there’s no
<EnableDefaultCompileItems>override), so any C# files you add underMaple2.Server.Web/Modelwill be picked up automatically. Currently that folder is empty, hence nothing is missing from the build. You can safely remove the empty<Folder Include="Model\" />if it isn’t needed.Likely an incorrect or invalid review comment.
Maple2.Server.Web/Controllers/Ugc/BannerController.cs (1)
6-6: Apply file-scoped namespace for UGC controllers
The namespace has been updated toMaple2.Server.Web.Controllers.Ugc, correctly reflecting the new folder structure and grouping all UGC-related controllers.Maple2.Server.Web/Controllers/Ugc/ProfileController.cs (1)
6-6: Apply file-scoped namespace for UGC controllers
The namespace has been updated toMaple2.Server.Web.Controllers.Ugc, correctly reflecting the new folder structure and grouping all UGC-related controllers.Maple2.Server.Web/Controllers/Ugc/ItemController.cs (1)
6-6: Apply file-scoped namespace for UGC controllers
The namespace has been updated toMaple2.Server.Web.Controllers.Ugc, correctly reflecting the new folder structure and grouping all UGC-related controllers.Maple2.Server.Web/Controllers/Ugc/GuildController.cs (1)
6-6: Apply file-scoped namespace for UGC controllers
The namespace has been updated toMaple2.Server.Web.Controllers.Ugc, correctly reflecting the new folder structure and grouping all UGC-related controllers.Maple2.Server.Web/Controllers/Ugc/ItemIconController.cs (1)
6-6: Apply file-scoped namespace for UGC controllers
The namespace has been updated toMaple2.Server.Web.Controllers.Ugc, correctly reflecting the new folder structure and grouping all UGC-related controllers.Maple2.Model/Game/User/Character.cs (1)
56-56: LGTM: MentorRole field properly addedThe
MentorRolefield has been correctly added to theCharacterclass alongside other character state fields. This change aligns with the mentoring system integration across the codebase.Maple2.Server.Game/Util/Sync/PlayerInfoStorage.cs (1)
48-49: LGTM: MentorRole properly synchronized from responseThe changes correctly extract and cast the mentor role and death state fields from the PlayerInfoResponse. The synchronization ensures that the CharacterInfo object is properly populated with these fields from the server response.
Maple2.Server.Web/Controllers/Ugc/BlueprintController.cs (1)
1-1: LGTM: Namespace organization improvedMoving the BlueprintController to the
Maple2.Server.Web.Controllers.Ugcnamespace improves code organization by grouping related UGC controllers together. The unused System namespace has also been correctly removed.Also applies to: 6-6
Maple2.Server.Web/Program.cs (1)
56-59: Enhanced database module registration for extended functionality.The update to comment from "Database" to "Database modules" accurately reflects the expanded scope, with the addition of both
DataDbModuleandGameDbModulealongside the existingWebDbModule. This change supports the trophy ranking and mentoring features being implemented in this PR.Maple2.Model/Common/TableNames.cs (1)
42-42: Addition of SEASON_DATA constant aligns with ranking feature implementation.The new constant for season data XML files follows the established naming pattern and uses the wildcard convention consistently with other table names. This addition properly supports the seasonal trophy ranking system described in the PR objectives.
Maple2.Model/Game/User/IPlayerInfo.cs (1)
22-22: Appropriate extension of player model to support mentoring system.Adding the
MentorRoleproperty to theIPlayerInfointerface ensures all player implementations can track mentoring status, which is essential for the mentoring system being introduced. The property is well-placed among other player attributes.Maple2.Model/Enum/Mentoring.cs (1)
8-11: Improved enum naming for clarity while preserving values.Renaming from verbose
RegistedMenteeto conciseMentee(and similar forMentor) improves code readability while maintaining the original byte values. This ensures that existing data remains compatible while making the code more maintainable.Maple2.Model/Metadata/QuestMetadata.cs (2)
18-18: Addition of mentoring mission support looks good.This change adds a new nullable property for quest mentoring missions, extending the metadata to support the mentoring system mentioned in the PR objectives.
89-91: Well-structured record for mentoring mission data.The new record contains the essential properties for mentoring missions: opening day timing and season identifier. This implementation properly supports the mentoring system mentioned in the PR objectives.
Maple2.File.Ingest/Mapper/ItemMapper.cs (2)
9-9: Good use of alias to simplify references.Creating an alias for the Slot type improves code readability by avoiding fully qualified names.
34-34: Improved type safety with explicit generic parameter.Adding the explicit
<ItemData>generic parameter to the Parse call improves type safety and makes the code intent clearer.Maple2.Server.Game/Manager/QuestManager.cs (2)
192-197: Good implementation of mentoring mission timing.This code correctly implements the time-gating mechanism for mentoring missions, preventing them from progressing until the configured number of days have passed since the start time. This aligns with the mentoring system mentioned in the PR objectives.
🧰 Tools
🪛 GitHub Actions: Format
[error] 194-194: dotnet format whitespace error: Fix whitespace formatting. Delete 1 characters.
422-422: Simplified quest removal.The quest removal logic has been simplified to unconditionally remove the quest when it expires. Make sure this doesn't affect any special handling that might have been needed for quests with event tags.
Maple2.Server.Core/proto/common.proto (1)
353-362: Well-structured mentor request message.The new MentorRequest protobuf message has a clean design that:
- Includes the requester_id for authentication/tracking
- Uses a nested Invite message with receiver_id for the invitation recipient
- Employs the oneof pattern for extensibility to support additional request types in the future
This implementation aligns with the mentoring system mentioned in the PR objectives.
Maple2.Server.Game/Session/GameSession.cs (2)
111-111: Integration of mentoring system with the game session.This addition introduces a new property for managing mentoring functionality, consistent with other game systems.
186-186: Mentoring manager initialization follows established pattern.The MentoringManager is correctly instantiated following the same pattern as other managers in this method.
Maple2.File.Ingest/Mapper/QuestMapper.cs (1)
83-86: Quest metadata extended with mentoring mission support.The addition of mentoring mission data to quest metadata properly connects the mentoring system with the quest system.
Maple2.Server.World/Service/WorldService.Sync.cs (1)
117-117: Mentor role included in player info synchronization.The addition of the MentorRole field in the PlayerInfoResponse ensures that mentor role information is properly synchronized across the system.
Maple2.Model/Metadata/TableMetadata.cs (1)
85-85: Added serialization support for the new SeasonDataTable type.This change properly registers the SeasonDataTable class with the JSON polymorphic type system using the "seasondata" discriminator, ensuring correct deserialization of season data objects from JSON.
Maple2.Server.Game/Packets/SystemShopPacket.cs (2)
11-12: Added new Mentee and Mentor commands to the SystemShop enum.These additions support the new mentoring system functionality mentioned in the PR objectives.
32-46: Implemented packet writers for the new Mentee and Mentor shop commands.The implementations follow the established pattern of existing methods in this file, maintaining consistency in the codebase. These methods create packets that allow the client to request mentor/mentee shop data from the server.
Maple2.Database/Storage/Game/GameStorage.User.cs (2)
95-95: Improved character name lookup with case-insensitive comparison.This change ensures that character lookups work regardless of case differences, which is a good usability improvement. This supports features in the PR like mentoring and rankings where character identification is critical.
451-451: Initialized Channel property to -1 for new characters.This ensures new characters have a consistent initial state for the Channel property, preventing potential null reference issues if the property is accessed before being explicitly set.
Maple2.Database/Model/Character.cs (3)
79-79: LGTM! MentorRole properly synchronized in Character conversion.The
MentorRoleis correctly assigned when converting from the game model to the database model.
110-110: LGTM! MentorRole properly synchronized in reverse conversion.The
MentorRoleis correctly assigned when converting from the database model back to the game model.
122-142:Details
❌ Incorrect review comment
Verify database persistence configuration for MentorRole.
The
Configuremethod doesn't include explicit configuration for theMentorRoleproperty. Verify that it's properly persisted in the database with the correct column mapping and any necessary conversions.
🏁 Script executed:
#!/bin/bash # Check if there are any conversion methods or configurations for enum properties rg "HasConversion|HasJsonConversion" --type cs "Maple2.Database/Extensions/"Length of output: 343
#!/bin/bash # Locate MentorRole property in the Character model rg "MentorRole" -n Maple2.Database/Model/Character.cs # Find the MentorRole enum declaration rg "enum MentorRole" -n Maple2.Database
#!/bin/bash # Locate the MentorRole property declaration in the Character model rg -n "MentorRole" Maple2.Database/Model/Character.cs # Find the enum declaration for MentorRole anywhere in the repo rg -n "enum MentorRole" -n .
🏁 Script executed:
#!/bin/bash # Locate MentorRole property in Character model rg -n "MentorRole" Maple2.Database/Model/Character.cs # Find the enum declaration for MentorRole anywhere in the repo rg -n "enum MentorRole" -n .Length of output: 294
Enum mapping for MentorRole is handled by convention
EF Core natively supports enum properties (including byte‐backed enums) and will mapMentorRoleto a column of the appropriate integer type by default. No explicitbuilder.Property(…)or conversion is required for this property.Likely an incorrect or invalid review comment.
Maple2.Server.Core/Sync/PlayerInfoUpdateExtensions.cs (3)
25-27: LGTM! MentorRole update handling added correctly.The MentorRole is properly handled in the Update method, consistent with the pattern used for other properties.
90-90: LGTM! MentorRole correctly synchronized between player info instances.The MentorRole property is properly copied from one IPlayerInfo instance to another.
146-146: LGTM! MentorRole correctly set in request fields.The MentorRole is properly cast to an integer and assigned to the request, consistent with other enum properties.
Maple2.Server.Core/proto/sync.proto (2)
69-70: Ensure all clients are updated when changing protobuf field tags.Adding the new
mentor_rolefield with tag 23 and shiftingasyncto tag 24 could cause backward compatibility issues if any clients are using the old version of the protocol. They might interpret the mentor_role field as the async field.Verify that all clients will be updated simultaneously with this change, or consider adding the new field with a new tag (e.g., 25) instead of reusing tag 23.
72-73:Details
❓ Verification inconclusive
Assess impact of moving the async field tag.
The
asyncfield has been moved from tag 23 to tag 24. While this is generally not recommended in Protocol Buffers for backward compatibility reasons, it might be acceptable if all clients are updated together.
🏁 Script executed:
#!/bin/bash # Search for usages of the PlayerUpdateRequest.async field to assess impact rg "async" --type cs -C 5 | grep -i "playerupdaterequest"Length of output: 160
Backward compatibility risk for
asyncfield tag changeMoving the
asyncfield from tag 23 to tag 24 is a breaking change in Protobuf. Although our server code doesn’t referencerequest.Asyncanywhere (no usages found inPlayerInfoLookup.cs), any clients or persisted data relying on the old tag will fail to deserialize correctly.• File: Maple2.Server.Core/proto/sync.proto (lines 72–73)
bool async = 23; // old -bool async = 24; // new• Recommendations:
- If you must renumber, reserve the old tag (
23) to prevent reuse.- Coordinate a simultaneous update of all client code and serialized data.
- Regenerate Protobuf stubs everywhere and perform integration tests to verify RPC calls still succeed.
Please confirm that all clients and stored data are updated together or revert to using a new field number instead of reassigning.
Maple2.Server.Game/Packets/FieldPacket.cs (1)
338-338: Correctly implemented MentorRole serialization.The change clearly integrates the mentor role by writing the enum value in the character data packet, which aligns with the overall mentoring functionality being added across the codebase.
Maple2.Server.Web/Packet/MentorPacket.cs (1)
10-27: Well-structured mentee list packet serialization.The implementation follows established patterns for packet serialization and correctly includes all necessary player information for mentees.
Maple2.File.Ingest/Mapper/TableMapper.cs (1)
1741-1773: Well-implemented SeasonDataTable parsing with DateTime conversion.The seasonal data parsing implementation correctly reads multiple season data types and properly converts string timestamps into DateTime objects.
🧰 Tools
🪛 GitHub Actions: Format
[error] 1769-1769: dotnet format whitespace error: Fix whitespace formatting. Insert '\s'.
Maple2.Server.Game/Manager/MentoringManager.cs (2)
15-28: Good implementation of the MentoringManager class structure.The class is properly designed with a reference to the GameSession and provides access to the player's mentor role. The constructor and Dispose method follow best practices.
40-52: Robust implementation of mentor role update with quest integration.The UpdateRole method correctly identifies users returning to the game and starts any quests associated with their return. It also properly updates the client with the new role information.
Maple2.Model/Metadata/Constants.cs (2)
106-106: Implementation of MaxMentees constant supports mentoring system.The new constant specifying a maximum of 3 mentees is appropriately placed and will support the mentoring system features being implemented. This matches the constant values mentioned in the PR description.
949-954: New system shop NPC constants properly defined for integration with handlers.These NPC ID constants are well-structured and appropriately named to support the mentioned trophy ranking and mentoring systems. The constants will be used to identify specific NPCs for shop interactions.
Maple2.Server.Game/PacketHandlers/SystemShopHandler.cs (6)
17-18: Addition of new command enum values appropriately extends shop functionality.The Mentee and Mentor enum values are logically added to the existing Command enum to support the new mentoring system.
31-36: New switch cases properly direct to appropriate handlers.The implementation follows the established pattern for handling shop commands, ensuring consistent behavior across the system.
50-54: Updated constant references for Arena shop handling.The code now uses the new
SystemShopNPCIDHonorTokenconstant instead of the removedPvpArenaNpcId, maintaining functionality while improving constant naming consistency.
64-68: Updated constant references for Fishing shop handling.Similarly, the code now uses the new
SystemShopNPCIDFishingconstant instead of the removedFishingNpcId, maintaining functionality while improving naming consistency.
72-85: Mentee shop handler follows established pattern.The implementation properly checks for shop opening/closing state, retrieves NPC metadata, loads the shop with the correct ID, and sends the appropriate packet to the client.
87-100: Mentor shop handler follows established pattern.The implementation properly checks for shop opening/closing state, retrieves NPC metadata, loads the shop with the correct ID, and sends the appropriate packet to the client.
Maple2.Model/Game/User/PlayerInfo.cs (6)
36-37: Added MentorRole and explicit Channel assignment to Player conversion.The implicit conversion properly includes the MentorRole from the player character and ensures the Channel property is explicitly set rather than relying on default initialization.
46-47: Proper initialization of MentorRole and Channel in constructor.These additions ensure that the MentorRole and Channel properties are properly propagated when creating a new PlayerInfo from a CharacterInfo.
101-101: MentorRole serialization added to WriteTo method.The MentorRole is now properly serialized when writing player information to binary packets, ensuring it's transmitted to clients.
142-142: Added MentorRole property to CharacterInfo class.This properly extends the CharacterInfo class to include mentoring role information, ensuring it's available throughout the inheritance hierarchy.
169-169: MentorRole properly copied in CharacterInfo copy constructor.This ensures the MentorRole value is preserved when copying a CharacterInfo object, maintaining data consistency.
186-186: MentorRole set in implicit conversion from Player to CharacterInfo.This ensures the MentorRole is properly set when converting from a Player object to a CharacterInfo object.
Maple2.Model/Metadata/Table/SeasonDataTable.cs (1)
1-17: New SeasonDataTable record structure for seasonal data management.This well-structured record implements the Table abstraction and provides dictionaries for various season types. The Entry record clearly defines the season data structure with appropriate fields for season timing and grading. This supports the trophy ranking system mentioned in the PR.
Maple2.File.Ingest/Mapper/ServerTableMapper.cs (2)
1022-1032: Support for both date-based and days-based inactivity trackingThis change enhances the flexibility of the
ReturnUserevent by supporting two formats for inactivity tracking:
- A datetime string in "yyyy-MM-dd-HH-mm" format
- A simple integer representing days of inactivity
The implementation properly initializes both fields and renames
Seasonto the more descriptiveSeasonId.
1034-1043: New game event type: NewUserThe added support for the
NewUserevent type enables tracking of new player creation dates and associating them with seasons, which is essential for the mentoring system implementation.Maple2.Server.Game/Packets/MentorPacket.cs (2)
21-22: Improved enum naming for clarityRenaming
Unknown10andUnknown11toLoginPointsandDailyPointsimproves code readability and maintainability by providing clear semantics about their purpose.
29-36: New Init method for player mentor role initializationThe new
Initmethod creates a packet containing essential player information needed for the mentoring system, including mentor role, object ID, and character ID. This provides a clean entry point for initializing mentor-related information.Maple2.Model/Metadata/ServerTable/GameEventTable.cs (3)
93-99: Updated ReturnUser record with improved fieldsThe ReturnUser record has been enhanced with:
- Renamed
Seasonto the more descriptiveSeasonId- Added
DateInactiveSinceto track when a user became inactive- Added
DaysInactiveto support simple day-based inactivity trackingThis provides more flexibility in handling different types of returning user scenarios.
249-257: Added DailyLoginReward record typeThe new DailyLoginReward record type supports sending daily mail rewards to users who log in each day, documented with appropriate XML comments.
272-275: Updated JSON serialization for new record typesThe polymorphic JSON serialization configuration has been properly updated to include all the new record types, ensuring they can be correctly serialized and deserialized.
Also applies to: 290-290
Maple2.Server.Game/PacketHandlers/MentorHandler.cs (2)
16-24: Updated Command enum with specific mentor actionsThe Command enum has been enhanced with renamed and added values that better describe the mentor-related actions: MentorList, AssignMentee, AcceptMentor, and DeclineMentor.
29-41: Enhanced packet handling with new command casesThe Handle method has been updated to handle the new commands with dedicated methods, improving the organization of the code.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor
Chores