Quest/Achievement Condition: Check Party Count & More conditions implemented - #347
Conversation
WalkthroughThis update integrates guild-related information across the codebase. Two new properties, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GameServer
participant UpdateEvent as PlayerInfoUpdateEvent
participant UpdateExt as PlayerInfoUpdateExtensions
participant Proto as ProtoLayer
Client->>GameServer: Send PlayerUpdateRequest (with guild_id, guild_name)
GameServer->>UpdateEvent: Create update event
UpdateEvent->>UpdateEvent: Check for guild info changes
UpdateEvent->>UpdateExt: Trigger update with guild properties
UpdateExt->>Proto: Map and assign guild_id and guild_name
Proto->>Client: Return updated PlayerInfoResponse with guild details
Possibly related PRs
Suggested reviewers
Poem
✨ 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:
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: 0
🧹 Nitpick comments (1)
Maple2.Server.Game/Session/GameSession.cs (1)
375-384: Improved map exploration logic with guild and continental trackingThe updated exploration logic correctly implements hierarchical tracking by checking if the player's map is unlocked before adding experience and updating exploration conditions. The three different condition updates (explore_continent, continent, explore) provide appropriate granularity for tracking player progression.
However, there's a potential inefficiency where continent conditions are updated twice (lines 381-382) - once for explore_continent and once for continent.
Consider combining these two updates if the intention is just to track the same continent information twice:
- ConditionUpdate(ConditionType.explore_continent, codeLong: (int) Field.Metadata.Property.Continent); - ConditionUpdate(ConditionType.continent, codeLong: (int) Field.Metadata.Property.Continent); + int continentCode = (int) Field.Metadata.Property.Continent; + ConditionUpdate(ConditionType.explore_continent, codeLong: continentCode); + ConditionUpdate(ConditionType.continent, codeLong: continentCode);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
Maple2.Model/Game/User/IPlayerInfo.cs(1 hunks)Maple2.Model/Game/User/PlayerInfo.cs(6 hunks)Maple2.Server.Core/Sync/PlayerInfoUpdateEvent.cs(1 hunks)Maple2.Server.Core/Sync/PlayerInfoUpdateExtensions.cs(2 hunks)Maple2.Server.Core/proto/sync.proto(2 hunks)Maple2.Server.Game/Manager/PartyManager.cs(1 hunks)Maple2.Server.Game/Manager/QuestManager.cs(1 hunks)Maple2.Server.Game/Manager/StatsManager.cs(1 hunks)Maple2.Server.Game/PacketHandlers/InstrumentHandler.cs(3 hunks)Maple2.Server.Game/Session/GameSession.cs(1 hunks)Maple2.Server.Game/Util/ConditionUtil.cs(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (20)
Maple2.Model/Game/User/IPlayerInfo.cs (1)
36-38: Guild properties added correctly.The additions of
GuildIdandGuildNameproperties are well-organized with appropriate types and clearly marked with the "Guild" comment section. These properties will allow tracking guild affiliation across the player information system.Maple2.Server.Game/Manager/PartyManager.cs (1)
309-311: Well-implemented guild member count method.This method efficiently counts party members who share the same guild as the current player. Good use of the null-conditional operator (
Party?) to handle the case when no party exists, and proper LINQ syntax for filtering members by guild ID.Maple2.Server.Game/Manager/StatsManager.cs (1)
140-140: Appropriate condition update for gear score.This addition correctly triggers the condition update system when gear score changes, which supports the quest/achievement condition functionality mentioned in the PR title. It's properly placed after the gear score calculation.
Maple2.Server.Core/Sync/PlayerInfoUpdateExtensions.cs (2)
76-77: Guild properties properly handled in profile updates.The guild properties are correctly included in the profile update process, maintaining consistency with how other profile attributes are handled.
129-130: Guild information correctly included in request fields.These additions ensure guild information is properly included when constructing player update requests, maintaining data consistency across systems.
Maple2.Server.Core/Sync/PlayerInfoUpdateEvent.cs (1)
52-55: Guild information now part of profile updatesThe implementation correctly adds guild-related conditions for updating the player's profile information. This follows the same pattern as existing conditions and ensures that changes to guild ID and guild name trigger appropriate profile updates.
Maple2.Server.Game/Manager/QuestManager.cs (1)
186-189: Restrict progress map validation to FieldMission quests onlyThe implementation now only applies the progress map validation to quests of type
FieldMission, allowing other quest types to bypass this restriction. While the implementation is correct, the comment "Testing only on FieldMission for now" suggests this might be experimental.Can you confirm if this is intended to be a permanent change or if there's a plan to extend this functionality to other quest types in the future?
Maple2.Server.Game/PacketHandlers/InstrumentHandler.cs (3)
144-145: Added tracking for score playing conditionsThis addition correctly implements tracking for when a player plays a musical score, capturing both the score ID and the map ID where it was played.
224-224: Added ensemble map trackingThis condition update correctly tracks the map ID for ensemble participation, which enables map-specific ensemble challenges or achievements.
175-178:Details
✅ Verification successful
Added instrument and ensemble play time tracking
The condition updates for tracking instrument play time and ensemble play time are correctly implemented. Both conditions include the total time played in seconds, which can be used for quests or achievements related to musical performances.
There appears to be a typo in the condition type name: "play_ensenble_time" (should be "play_ensemble_time"), but verify if this is consistent with other code.
🏁 Script executed:
#!/bin/bash # Search for both spellings of "ensemble" in condition types rg -i "ensenble|ensemble" --type=csLength of output: 3922
Action: Confirm consistency for instrument and ensemble tracking
The condition updates for tracking instrument and ensemble play time are correctly implemented, and the total play time is accurately passed in seconds for potential quests/achievements. Note that although the enum value is named
play_ensenble_time(which appears to be a typo), the recent search confirms that this spelling is consistently used in theConditionTypeenum (seeMaple2.Model/Enum/ConditionType.cs). If you plan to rename it for clarity, be sure to update all references across the codebase.Maple2.Model/Game/User/PlayerInfo.cs (4)
34-36: Guild information added to PlayerInfo conversionThese additions correctly assign guild-related properties during Player to PlayerInfo conversion.
77-78: Guild information serialization addedGuild ID and name are now correctly serialized in the WriteTo method, ensuring this information is available when the player info is transmitted.
131-134: Guild properties added to CharacterInfoThese new properties allow for storing guild-related information at the character level, consistent with the PR objective of implementing guild-related condition checks.
161-162: Guild properties correctly initialized in constructors and conversionsThe implementation ensures guild information is properly copied in the copy constructor and during Player to CharacterInfo conversion.
Also applies to: 177-179
Maple2.Server.Game/Util/ConditionUtil.cs (4)
111-116: Added music and exploration condition typesNew condition types for music performance and exploration tracking have been correctly added to the CheckCode method's switch case.
217-220: Music performance conditions in CheckTarget methodMusic-related conditions are properly added to the CheckTarget method with appropriate numeric range checks.
287-290: Exploration and gear score conditions added to target checksNew condition types for exploration and gear score are correctly added to the list of conditions that always return true in the CheckTarget method.
9-19:Details
✅ Verification successful
Guild party count check implementation
The implementation correctly validates both party size and guild member count within parties. This addresses the PR objective of checking party count conditions.
To ensure the
GuildMemberCount()method is properly implemented:
🏁 Script executed:
#!/bin/bash # Search for the GuildMemberCount method implementation rg -A 10 "GuildMemberCount" --type csLength of output: 2096
Approval: Guild party count check is implemented correctly.
The
GuildMemberCount()method inMaple2.Server.Game/Manager/PartyManager.cscorrectly counts guild members using a null-safe approach and filtering byGuildId. Its use inMaple2.Server.Game/Util/ConditionUtil.csaccurately validates the party's guild member count according to the condition. The verification confirms that both party size and guild member count validations align with the PR requirements.Maple2.Server.Core/proto/sync.proto (2)
96-102: Added guild information to PlayerInfoResponseGuild fields have been properly added to the PlayerInfoResponse with consistent field numbering, matching the request structure. This ensures consistent guild data synchronization between servers.
61-70:Details
✅ Verification successful
Added guild information to PlayerUpdateRequest
The proto message has been appropriately extended to include guild_id and guild_name, with proper field numbering. This enables the server to track guild-related conditions.
Let's confirm the corresponding player info model changes are implemented:
🏁 Script executed:
#!/bin/bash # Check for implementation of guild properties in player models rg -A 5 "GuildId|GuildName" --type csLength of output: 52901
Guild information integration in PlayerUpdateRequest is confirmed
The proto message in
Maple2.Server.Core/proto/sync.protonow correctly adds theguild_id(field 15) andguild_name(field 16) fields. Our verification using codebase searches confirms that these guild properties are consistently implemented across the player models (e.g., inMaple2.Model/Game/User/PlayerInfo.cs,Maple2.Model/Game/User/IPlayerInfo.cs, and various sync & database components). This ensures that the server can properly track and manage guild-related conditions.
Summary by CodeRabbit
New Features
Gameplay Improvements