Skip to content

Return to instances with SaveMap property - #389

Merged
AngeloTadeucci merged 2 commits into
masterfrom
field-instance
Mar 28, 2025
Merged

Return to instances with SaveMap property#389
AngeloTadeucci merged 2 commits into
masterfrom
field-instance

Conversation

@AngeloTadeucci

@AngeloTadeucci AngeloTadeucci commented Mar 28, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Updated logic for player spawning to allow for broader scenarios in setting return map IDs.
  • Refactor
    • Streamlined handling of field instances by updating data structures and initialization processes.
    • Modified how field instance data is written to packets, focusing on specific attributes.
  • Bug Fixes
    • Removed obsolete FieldInstance class, enhancing overall system efficiency.

@coderabbitai

coderabbitai Bot commented Mar 28, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This PR involves the complete removal of the FieldInstance class from the Maple2.Model.Game namespace, which included functionality for instance representation and serialization. The FieldManager class has been updated to replace references to FieldInstance with InstanceFieldMetadata, altering how field instances are managed. Additionally, the logic for player spawning in FieldManager.State and field loading in DungeonManager has been adjusted to accommodate these changes, specifically focusing on the new property Type instead of the removed class.

Changes

File(s) Summary
Maple2.Model/Game/FieldInstance.cs FieldInstance class removed, eliminating its functionality related to instance representation and serialization.
Maple2.Server/Game/Manager/Field/FieldManager/FieldManager.State.cs Updated SpawnPlayer method condition to check FieldInstance.Type and FieldInstance.SaveField, altering logic for setting player's ReturnMapId.
Maple2.Server/Game/Manager/Field/FieldManager/FieldManager.cs Changed FieldInstance property type from FieldInstance to InstanceFieldMetadata, updated initialization in constructor and Init method to directly reference instanceField.
Maple2.Server/Game/Manager/DungeonManager.cs Modified LoadField method to check session.Field.FieldInstance.Type instead of session.Field.FieldInstance.InstanceType, maintaining logic flow for sending DungeonWaitingPacket.
Maple2.Server/Game/Manager/Field/FieldManager/IField.cs Updated FieldInstance property type in IField interface from FieldInstance to InstanceFieldMetadata.
Maple2.Server/Game/Packets/FieldEnterPacket.cs Changed packet writing logic to write FieldInstance.Type and FieldInstance.InstanceId separately instead of writing the entire FieldInstance class.

Possibly related PRs

Suggested reviewers

  • Zintixx

Poem

In the meadow of code, I softly hop,
The FieldInstance has taken a drop.
With InstanceFieldMetadata now in play,
We dance through the fields in a brand new way.
A rabbit's delight in each code-filled day! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 835d886 and 3a6c302.

📒 Files selected for processing (6)
  • Maple2.Model/Game/FieldInstance.cs (0 hunks)
  • Maple2.Server.Game/Manager/DungeonManager.cs (1 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.State.cs (1 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs (3 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager/IField.cs (1 hunks)
  • Maple2.Server.Game/Packets/FieldEnterPacket.cs (1 hunks)
💤 Files with no reviewable changes (1)
  • Maple2.Model/Game/FieldInstance.cs
🚧 Files skipped from review as they are similar to previous changes (5)
  • Maple2.Server.Game/Manager/DungeonManager.cs
  • Maple2.Server.Game/Manager/Field/FieldManager/IField.cs
  • Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.State.cs
  • Maple2.Server.Game/Packets/FieldEnterPacket.cs
  • Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

Comment thread Maple2.Model/Game/FieldInstance.cs Outdated
@AngeloTadeucci
AngeloTadeucci merged commit da9b1dd into master Mar 28, 2025
@AngeloTadeucci
AngeloTadeucci deleted the field-instance branch March 28, 2025 06:36
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.

2 participants