Skip to content

Quest/Achievement Condition: Check Party Count & More conditions implemented - #347

Merged
AngeloTadeucci merged 1 commit into
MS2Community:masterfrom
Zintixx:fixes
Mar 6, 2025
Merged

Quest/Achievement Condition: Check Party Count & More conditions implemented#347
AngeloTadeucci merged 1 commit into
MS2Community:masterfrom
Zintixx:fixes

Conversation

@Zintixx

@Zintixx Zintixx commented Mar 6, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Guild affiliation details are now integrated into player profiles and party displays.
    • A new feature tracks the number of guild members in a party.
  • Gameplay Improvements

    • Enhanced tracking for music performance, gear score, and exploration progress.
    • Quest validations have been refined for more precise mission handling.

@coderabbitai

coderabbitai Bot commented Mar 6, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update integrates guild-related information across the codebase. Two new properties, GuildId and GuildName, are added to player-related models and interfaces. The changes update conversion logic, event processing, and protocol messages to correctly handle guild data. New conditional checks are added in event and condition update methods, and a method is introduced to count party members sharing the same guild. Additionally, updates in quest, gear score, musical performance, and exploration tracking are applied to incorporate the additional guild information.

Changes

Files Change Summary
Maple2.Model/Game/User/IPlayerInfo.cs
Maple2.Model/Game/User/PlayerInfo.cs
Added properties GuildId (long) and GuildName (string) to the IPlayerInfo interface and CharacterInfo class. Updated conversion operators and write methods to include guild data.
Maple2.Server.Core/Sync/PlayerInfoUpdateEvent.cs Introduced new checks in the constructor to update event type if the player's guild ID or name has changed.
Maple2.Server.Core/Sync/PlayerInfoUpdateExtensions.cs Updated the Update and SetFields methods to assign GuildId and GuildName when the UpdateField.Profile flag is set.
Maple2.Server.Core/proto/sync.proto Added new optional fields guild_id (int64) and guild_name (string) to PlayerUpdateRequest and corresponding fields to PlayerInfoResponse. Renumbered subsequent fields to accommodate the additions.
Maple2.Server.Game/Manager/PartyManager.cs Added a new public method GuildMemberCount() which calculates the number of party members sharing the same guild as the current player.
Maple2.Server.Game/Manager/QuestManager.cs Modified the quest update flow to process progress maps only for quests of type FieldMission, altering the control flow with a new condition check.
Maple2.Server.Game/Manager/StatsManager.cs Added a new line in the AddEquips method to update the player's gear score condition using ConditionUpdate.
Maple2.Server.Game/PacketHandlers/InstrumentHandler.cs Added condition updates in HandleStartScore, HandleStopScore, and HandleJoinEnsemble to track music play score, instrument time, and ensemble-related timings.
Maple2.Server.Game/Session/GameSession.cs Modified the EnterField method to nest experience addition and update exploration conditions based on map unlock status and explore type conditions.
Maple2.Server.Game/Util/ConditionUtil.cs Enhanced the Check method with additional validations for party and guild conditions and incorporated new condition types related to music, exploration, and gear score.

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
Loading

Possibly related PRs

  • Bug fixes #329: Introduced guild membership updates in the GuildManager class with guild-related condition updates, sharing a similar code-level integration of guild functionality.

Suggested reviewers

  • AngeloTadeucci

Poem

I'm a happy rabbit in the code burrow,
Hopping through changes as new fields grow.
GuildId and GuildName now spring to life,
In every module, ending old strife.
With a twitch of my nose and a joyful beat,
I celebrate these updates—truly neat! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Maple2.Server.Game/Session/GameSession.cs (1)

375-384: Improved map exploration logic with guild and continental tracking

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between 62a7aa4 and 0d69782.

📒 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 GuildId and GuildName properties 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 updates

The 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 only

The 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 conditions

This 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 tracking

This 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=cs

Length 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 the ConditionType enum (see Maple2.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 conversion

These additions correctly assign guild-related properties during Player to PlayerInfo conversion.


77-78: Guild information serialization added

Guild 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 CharacterInfo

These 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 conversions

The 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 types

New 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 method

Music-related conditions are properly added to the CheckTarget method with appropriate numeric range checks.


287-290: Exploration and gear score conditions added to target checks

New 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 cs

Length of output: 2096


Approval: Guild party count check is implemented correctly.

The GuildMemberCount() method in Maple2.Server.Game/Manager/PartyManager.cs correctly counts guild members using a null-safe approach and filtering by GuildId. Its use in Maple2.Server.Game/Util/ConditionUtil.cs accurately 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 PlayerInfoResponse

Guild 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 cs

Length of output: 52901


Guild information integration in PlayerUpdateRequest is confirmed

The proto message in Maple2.Server.Core/proto/sync.proto now correctly adds the guild_id (field 15) and guild_name (field 16) fields. Our verification using codebase searches confirms that these guild properties are consistently implemented across the player models (e.g., in Maple2.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[World] Quest Issue - Cannot finish quest and claim rewards

2 participants