Skip to content

Feat: portal cubes - #264

Merged
AngeloTadeucci merged 8 commits into
masterfrom
function-cubes
Sep 28, 2024
Merged

Feat: portal cubes#264
AngeloTadeucci merged 8 commits into
masterfrom
function-cubes

Conversation

@AngeloTadeucci

@AngeloTadeucci AngeloTadeucci commented Sep 27, 2024

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Enhanced HomeLayoutCube and UgcMapCube classes with new properties: HousingCategory and CubeSettings.
    • Introduced FunctionCubeMetadata and related storage and mapping classes to manage function cube data.
    • Added new methods for managing portals in the FieldManager and improved cube placement logic in the HousingManager.
    • Implemented functionality for migrating game sessions to specified home locations.
  • Bug Fixes

    • Improved checks for cube placement restrictions based on housing categories.
  • Documentation

    • Updated migration scripts to reflect new database structures for home layouts and portal settings.

@coderabbitai

coderabbitai Bot commented Sep 27, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce new properties and methods to the HomeLayoutCube, UgcMapCube, and FunctionCubeMetadata classes, enhancing their functionality with properties like HousingCategory and CubeSettings. Modifications to implicit conversion operators and entity configurations ensure that the new attributes are properly integrated into the existing data model. Additionally, the HousingManager class has been updated to improve the logic for cube placement and removal, particularly regarding housing categories and portal handling.

Changes

File Path Change Summary
Maple2.Database/Model/Map/HomeLayoutCube.cs Added properties HousingCategory and CubeSettings; updated conversion operator and copy constructor.
Maple2.Database/Model/Map/UgcMapCube.cs Added properties HousingCategory and CubeSettings; updated conversion operator.
Maple2.Database/Context/MetadataContext.cs Added DbSet<FunctionCubeMetadata> and configuration for the entity.
Maple2.Database/Storage/Metadata/FunctionCubeMetadataStorage.cs Introduced FunctionCubeMetadataStorage class for managing function cube metadata.
Maple2.Server.Game/Manager/HousingManager.cs Updated TryPlaceCube and TryRemoveCube methods for enhanced cube placement and removal logic.
Maple2.Server.Game/Session/GameSession.cs Added property FunctionCubeMetadata and method MigrateToHome for session migration.
Maple2.Server.Game/Packets/FunctionCubePacket.cs Introduced methods for handling function cube packets, including SendCubes and AddFunctionCube.

Assessment against linked issues

Objective Addressed Explanation
Handle adding portal cube and spawn point (Issue #230)
Implement a method to check if a plot has portal entry points (Issue #230)

Possibly related PRs

  • Feat: House Decor Planner #229: The HomeLayoutCube class has been modified to include new properties and updates to its implicit conversion operator, which aligns with the changes in the UgcMapCube class that also introduced similar properties and conversion logic.
  • Feat: UGC Blueprints #239: The introduction of the HomeLayout class and its properties directly relates to the modifications in the HomeLayoutCube class, as both are focused on enhancing the management of home layouts and user-generated content.
  • Handle Blueprints in Meret Market #259: The addition of the Blueprint property to the UgcMarketItem class enhances the data model by allowing it to hold detailed information related to item blueprints, which is relevant to the new properties added in the HomeLayoutCube class that also deal with blueprints and layouts.

Suggested reviewers

  • Zintixx

Poem

In Maple's realm where cubes align,
New homes are built, oh how divine!
With portals set and categories bright,
A rabbit hops in pure delight.
Let's celebrate these changes grand,
For every cube, a new adventure planned! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 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: 26

🧹 Outside diff range and nitpick comments (23)
Maple2.Model/Enum/HousingCategory.cs (1)

3-36: Consider adding XML documentation and evaluating the use of [Flags] attribute.

To improve code readability and provide context for developers:

  1. Consider adding XML documentation comments to the enum and its members. This will help explain the purpose of each category and any specific usage notes.

  2. Evaluate if using the [Flags] attribute would be appropriate for this enum. It could potentially improve usability for related categories (e.g., UgcBlock, UgcBed, UgcTable, UgcStairs). However, this would require changing the value assignments and might not be suitable for all use cases.

Example of adding XML documentation:

/// <summary>
/// Represents categories of housing items in the game.
/// </summary>
public enum HousingCategory
{
    /// <summary>
    /// Represents no specific category.
    /// </summary>
    None = 0,

    /// <summary>
    /// Represents bed items in housing.
    /// </summary>
    Bed = 1,

    // ... (add comments for other members)
}
Maple2.Model/Game/Cube/CubePortalSettings.cs (1)

15-18: Consider initializing all properties in the constructor.

While initializing PortalName and DestinationTarget to empty strings is good, consider initializing all properties in the constructor to ensure they have default values. This can prevent unexpected behavior if these properties are accessed before being explicitly set.

Here's a suggested modification:

 public CubePortalSettings() {
     PortalName = string.Empty;
     DestinationTarget = string.Empty;
+    Method = default;
+    Destination = default;
+    PortalObjectId = default;
 }
Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.cs (2)

9-23: LGTM: Proper implementation of the Up method with a minor suggestion.

The Up method correctly adds the PortalSettings column to both ugcmap-cube and home-layout-cube tables. The use of json type, nullable property, and utf8mb4 character set are appropriate choices for storing complex settings.

Consider extracting the common column definition into a separate method to reduce code duplication:

private void AddPortalSettingsColumn(MigrationBuilder migrationBuilder, string tableName)
{
    migrationBuilder.AddColumn<string>(
        name: "PortalSettings",
        table: tableName,
        type: "json",
        nullable: true)
        .Annotation("MySql:CharSet", "utf8mb4");
}

Then, you can call this method twice in the Up method:

protected override void Up(MigrationBuilder migrationBuilder)
{
    AddPortalSettingsColumn(migrationBuilder, "ugcmap-cube");
    AddPortalSettingsColumn(migrationBuilder, "home-layout-cube");
}

This approach would make the code more maintainable and reduce the risk of inconsistencies if you need to add the same column to more tables in the future.


25-34: LGTM: Proper implementation of the Down method with a minor suggestion.

The Down method correctly removes the PortalSettings column from both ugcmap-cube and home-layout-cube tables, effectively reverting the changes made in the Up method.

Similar to the suggestion for the Up method, consider extracting the common operation into a separate method to reduce code duplication:

private void DropPortalSettingsColumn(MigrationBuilder migrationBuilder, string tableName)
{
    migrationBuilder.DropColumn(
        name: "PortalSettings",
        table: tableName);
}

Then, you can call this method twice in the Down method:

protected override void Down(MigrationBuilder migrationBuilder)
{
    DropPortalSettingsColumn(migrationBuilder, "ugcmap-cube");
    DropPortalSettingsColumn(migrationBuilder, "home-layout-cube");
}

This approach would make the code more maintainable and reduce the risk of inconsistencies if you need to remove the same column from more tables in the future.

Maple2.Database/Model/Map/CubePortalSettings.cs (1)

7-11: LGTM! Consider adding property constraints.

The class structure looks good. The internal access modifier is appropriate for a database model class. The properties cover the necessary information for a cube portal.

Consider adding input validation or constraints to the properties. For example:

  • Ensure PortalName is not null or empty.
  • Add an allowed range for Method and Destination if they are enums.
  • Validate DestinationTarget based on its expected format.

Example implementation:

public string PortalName
{
    get => _portalName;
    set => _portalName = !string.IsNullOrEmpty(value) ? value : throw new ArgumentException("PortalName cannot be null or empty");
}
private string _portalName;
Maple2.Server.Game/Packets/HomeActionPacket.cs (1)

36-50: LGTM: Method implements portal cube settings correctly.

The SendCubePortalSettings method aligns well with the PR objective of adding portal cubes functionality. It correctly constructs a packet with the necessary data for portal settings.

Consider adding production-safe null checking for cube.PortalSettings. While the Debug.Assert is useful for development, it won't protect against null reference exceptions in production. You could add a null check and return an error packet or throw a custom exception if PortalSettings is null.

Example:

if (cube.PortalSettings == null)
{
    // Either return an error packet or throw a custom exception
    throw new InvalidOperationException("PortalSettings cannot be null");
}
Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.cs (1)

9-37: Consider adding a default value for InteractId.

The Up method correctly adds the new columns to both tables. However, making InteractId non-nullable without a default value might cause issues if there's existing data in the tables.

Consider adding a default value for InteractId, for example:

 migrationBuilder.AddColumn<string>(
     name: "InteractId",
     table: "ugcmap-cube",
     type: "longtext",
     nullable: false,
+    defaultValue: "")
     .Annotation("MySql:CharSet", "utf8mb4");

 // ... (apply the same change to the "home-layout-cube" table)

This ensures that existing rows will have a valid (empty) string for InteractId.

Maple2.Server.Game/Packets/FunctionCubePacket.cs (1)

9-15: Consider adding XML documentation to the Command enum.

While the enum values are self-explanatory, adding XML documentation would improve code readability and maintainability. This is especially useful for other developers who might work on this code in the future.

Here's an example of how you could add the documentation:

private enum Command : byte {
    /// <summary>
    /// Command to send multiple cubes.
    /// </summary>
    SendCubes = 2,
    
    /// <summary>
    /// Command to add a single cube.
    /// </summary>
    Add = 3,
    
    // ... (continue for other enum values)
}
Maple2.Server.Game/PacketHandlers/LoadUgcMapHandler.cs (1)

59-67: Add comments to explain the new entry portal logic

To improve code documentation and make it easier for other developers to understand the new functionality, consider adding comments to explain the entry portal logic.

Here's a suggestion for adding comments:

// Check for entry portals in the plot cubes
List<PlotCube> entryPortals = plotCubes.Where(x => x.ItemId is Constant.PortalEntryId).ToList();
if (entryPortals.Count > 0)
{
    // Randomly select an entry portal and set player position
    PlotCube entryPortal = entryPortals.OrderBy(_ => Random.Shared.Next()).First();
    session.Player.Position = entryPortal.Position;
    
    // Set player rotation based on the portal's rotation
    // Note: Subtracting 180 degrees to face the correct direction when spawning
    session.Player.Rotation = new Vector3(0, 0, entryPortal.Rotation);
    session.Player.Rotation -= new Vector3(0, 0, 180);
}
else
{
    // Fall back to the calculated safe position if no entry portals are found
    session.Player.Position = home.CalculateSafePosition(plotCubes);
}

These comments provide context for the new logic and explain the reasoning behind certain operations, such as the rotation adjustment.

Maple2.Server.World/Migrations/20240918062829_MeretMarketRework.cs (1)

Line range hint 11-30: Consider revising the SoldTime column configuration.

The Up method correctly implements the intended changes by dropping the premium-market-item table and creating the new meret-market-sold table. However, there's a potential issue with the SoldTime column configuration:

SoldTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
    .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)

Using IdentityColumn for a DateTime field is unusual and might not behave as expected. Consider using a default value or a trigger to set the current timestamp instead.

Suggestion: Replace the SoldTime column configuration with:

SoldTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP(6)")

This will automatically set the SoldTime to the current timestamp when a new record is inserted.

Maple2.Server.Game/PacketHandlers/RequestCubeHandler.cs (3)

231-233: LGTM! Consider adding a comment for clarity.

The addition of special handling for interactive furnishing items is a good improvement. It ensures that these items are properly registered with the game system when placed.

Consider adding a brief comment explaining the purpose of this block:

+                // Broadcast additional packet for interactive furnishing items
                 if (plotCube.ItemType.IsInteractFurnishing) {
                     session.Field.Broadcast(FunctionCubePacket.AddFunctionCube(plotCube));
                 }

Line range hint 274-283: Consider adding special handling for removing interactive furnishing items.

To maintain consistency with the HandlePlaceCube method, consider adding special handling for removing interactive furnishing items. This ensures that these items are properly unregistered from the game system when removed.

Add the following code after line 279:

         session.Field.Broadcast(CubePacket.RemoveCube(session.Player.ObjectId, position));

+        if (cube.ItemType.IsInteractFurnishing) {
+            session.Field.Broadcast(FunctionCubePacket.RemoveFunctionCube(cube));
+        }

         if (plot.IsPlanner) {
             return;
         }

Line range hint 4-4: Address the TODO comment about adding tests.

The TODO comment indicates that tests are missing. It's important to ensure proper test coverage for the code.

Would you like me to generate some unit test templates for this class or open a GitHub issue to track this task?

Maple2.Model/Metadata/Constants.cs (2)

103-104: LGTM. Consider adding comments for clarity.

The new constants InteriorPortalCubeId and PortalEntryId are correctly implemented and follow the existing naming conventions. Their purpose seems clear from the names, but consider adding brief comments to explain their specific use in the game, which would enhance code maintainability.

You could add comments like this:

// ID for the interior portal cube object
public const int InteriorPortalCubeId = 50400158;

// ID for the portal entry object
public const int PortalEntryId = 50400190;

Line range hint 1-1010: Consider organizing constants into categories for improved maintainability.

While the current changes are minimal and correctly implemented, the file contains a large number of constants covering various aspects of the game. In the future, consider organizing these constants into more specific categories or separate files (e.g., PortalConstants.cs, CharacterConstants.cs, etc.) to improve code organization and maintainability.

Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs (2)

751-763: LGTM with a suggestion for InteractId.

The new properties HousingCategory, InteractId, and PortalSettings are good additions to the HomeLayoutCube entity. They provide more context and functionality for housing-related features.

However, consider reviewing the column type for InteractId:

The "longtext" type for InteractId might be excessive for an identifier. Consider using a more appropriate type like "varchar" with a reasonable maximum length, which could improve performance and storage efficiency.

b.Property<string>("InteractId")
    .IsRequired()
-   .HasColumnType("longtext");
+   .HasColumnType("varchar(100)");

Adjust the length (100 in this example) based on your specific requirements.


1309-1321: LGTM with suggestions for improvement.

The new properties HousingCategory, InteractId, and PortalSettings in the UgcMapCube entity are consistent with the changes made to HomeLayoutCube, which is good for maintaining uniformity across related entities.

However, there are two points to consider:

  1. As mentioned for HomeLayoutCube, consider changing the column type for InteractId:
b.Property<string>("InteractId")
    .IsRequired()
-   .HasColumnType("longtext");
+   .HasColumnType("varchar(100)");
  1. Given that HomeLayoutCube and UgcMapCube now share identical properties, consider refactoring these common properties into a base class or interface. This would promote code reuse and make future changes easier to manage.

Example:

public interface IHousingCube
{
    int HousingCategory { get; set; }
    string InteractId { get; set; }
    string PortalSettings { get; set; }
}

public class HomeLayoutCube : IHousingCube
{
    // Implement interface and add other properties
}

public class UgcMapCube : IHousingCube
{
    // Implement interface and add other properties
}

This refactoring would need to be done in the actual model classes, not in this migration snapshot.

Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.Designer.cs (1)

1-1701: Overall migration review and considerations.

This migration adds the InteractId property to HomeLayoutCube and UgcMapCube entities. While the changes are straightforward, consider the following:

  1. Database Impact: This migration will alter existing tables. Ensure you have a backup of your database before applying this migration in production.
  2. Data Migration: If you have existing data, you'll need to provide a strategy to populate the new InteractId field for existing records.
  3. Application Code: Update any relevant application code to handle the new InteractId property, including data access and business logic layers.
  4. Testing: Thoroughly test the migration in a non-production environment to ensure it doesn't cause any unexpected issues with existing data or functionality.

Consider creating a separate data migration script to handle populating the InteractId for existing records if necessary. This can be done using a separate migration or a manual script run after this migration is applied.

Maple2.Model/Game/Cube/PlotCube.cs (1)

25-25: Consider using a property instead of a public readonly field for ItemType

Using a public readonly field ItemType exposes the internal implementation directly. To improve encapsulation and maintainability, consider using a read-only property instead.

Apply this diff to convert ItemType to a property:

-public readonly ItemType ItemType;
+public ItemType ItemType { get; }
Maple2.Database/Model/Map/UgcMapCube.cs (1)

20-22: Consider default values and nullability for new properties.

  • InteractId: Initialized to an empty string. If an empty string is a valid default value in your context, this is acceptable. Otherwise, consider making it nullable to represent the absence of a value.
  • HousingCategory: As an enum, it will default to the zero value (default(HousingCategory)). Ensure that this default value is valid within your application's logic or assign a specific default value if necessary.
  • PortalSettings: Declared as a nullable property (CubePortalSettings?). This is appropriate if PortalSettings can be absent. Ensure that the rest of the codebase correctly handles cases where PortalSettings is null.
Maple2.Server.World/Migrations/20240919045503_AddHomeLayoutsAndCubesTable.cs (1)

Line range hint 69-74: Potential unintended drop of 'Layouts' column in Down method

In the Down method, there is a DropColumn call for "Layouts" on the "home" table. However, the Up method does not include an AddColumn call for "Layouts". Dropping a column that wasn't added in this migration might lead to unintended data loss or errors during rollback if the column exists from previous migrations.

Maple2.Server.Game/PacketHandlers/HomeActionHandler.cs (1)

42-45: Add logging when plot is null to aid debugging

In both HandleChangePortalSettings and HandleSendPortalSettings, if plot is null, the method returns without any log message. This can make it harder to diagnose issues related to the plot not being available.

Consider adding a warning log to indicate that plot is null:

 if (plot == null) {
+    Logger.Warning("Plot is null for session {0}", session.SessionId);
     return;
 }

This will help identify situations where the plot is unexpectedly null.

Also applies to: 86-89

Maple2.Server.Game/Manager/Field/FieldManager.State.cs (1)

171-182: Add a default case to the switch statement to handle unexpected destinations

Adding a default case to the switch ensures that any unexpected Destination values are handled, which can prevent potential runtime errors if new enum values are introduced in the future.

Modify the switch statement as follows:

switch (plotCube.PortalSettings.Destination) {
    case CubePortalDestination.PortalInHome:
        targetMapId = Constant.DefaultHomeMapId;
        break;
    case CubePortalDestination.SelectedMap:
        // Existing code
        break;
    case CubePortalDestination.FriendHome:
        // Existing code
        break;
+   default:
+       throw new InvalidOperationException($"Unsupported Destination type: {plotCube.PortalSettings.Destination}");
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 71d3ed5 and ec6135f.

📒 Files selected for processing (30)
  • Maple2.Database/Model/Map/CubePortalSettings.cs (1 hunks)
  • Maple2.Database/Model/Map/HomeLayoutCube.cs (4 hunks)
  • Maple2.Database/Model/Map/UgcMapCube.cs (4 hunks)
  • Maple2.File.Ingest/Mapper/ItemMapper.cs (1 hunks)
  • Maple2.Model/Enum/HousingCategory.cs (1 hunks)
  • Maple2.Model/Game/Cube/CubePortalSettings.cs (1 hunks)
  • Maple2.Model/Game/Cube/PlotCube.cs (1 hunks)
  • Maple2.Model/Metadata/Constants.cs (1 hunks)
  • Maple2.Model/Metadata/ItemMetadata.cs (1 hunks)
  • Maple2.Server.Core/Constants/RecvOp.cs (1 hunks)
  • Maple2.Server.Core/Constants/SendOp.cs (1 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager.State.cs (2 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager.cs (2 hunks)
  • Maple2.Server.Game/Manager/HousingManager.cs (4 hunks)
  • Maple2.Server.Game/PacketHandlers/HomeActionHandler.cs (1 hunks)
  • Maple2.Server.Game/PacketHandlers/LoadUgcMapHandler.cs (1 hunks)
  • Maple2.Server.Game/PacketHandlers/MoveFieldHandler.cs (2 hunks)
  • Maple2.Server.Game/PacketHandlers/RequestCubeHandler.cs (2 hunks)
  • Maple2.Server.Game/Packets/FunctionCubePacket.cs (1 hunks)
  • Maple2.Server.Game/Packets/HomeActionPacket.cs (1 hunks)
  • Maple2.Server.Game/Session/GameSession.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240918062829_MeretMarketRework.cs (3 hunks)
  • Maple2.Server.World/Migrations/20240919045503_AddHomeLayoutsAndCubesTable.cs (5 hunks)
  • Maple2.Server.World/Migrations/20240921185307_AddHomePropertiesToLayouts.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240922093312_AddItemBlueprintToUgcMarketItem.cs (2 hunks)
  • Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.Designer.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.Designer.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.cs (1 hunks)
  • Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.Designer.cs
🧰 Additional context used
📓 Learnings (4)
Maple2.Server.Game/PacketHandlers/LoadUgcMapHandler.cs (1)
Learnt from: AngeloTadeucci
PR: AngeloTadeucci/Maple2#229
File: Maple2.Server.Game/PacketHandlers/LoadUgcMapHandler.cs:58-58
Timestamp: 2024-09-12T21:13:25.002Z
Learning: When requested to create a GitHub issue, use the GitHub CLI (gh) to create an issue with a descriptive title and body, including relevant context from the code and pull request.
Maple2.Server.Game/PacketHandlers/RequestCubeHandler.cs (2)
Learnt from: AngeloTadeucci
PR: AngeloTadeucci/Maple2#236
File: Maple2.Server.Game/PacketHandlers/RequestCubeHandler.cs:375-422
Timestamp: 2024-09-16T07:50:30.281Z
Learning: In `RequestCubeHandler`, the `HandleLoadLayout` method is responsible for applying the layout to the plot after missing cubes are calculated in `HandleRequestLayout`.
Learnt from: AngeloTadeucci
PR: AngeloTadeucci/Maple2#239
File: Maple2.Server.Game/PacketHandlers/RequestCubeHandler.cs:856-856
Timestamp: 2024-09-19T04:38:53.438Z
Learning: In static methods, use `Log.Logger` instead of `Logger` for logging.
Maple2.Server.World/Migrations/20240919045503_AddHomeLayoutsAndCubesTable.cs (1)
Learnt from: AngeloTadeucci
PR: AngeloTadeucci/Maple2#239
File: Maple2.Server.World/Migrations/20240918223130_AddHomeLayoutsAndCubesTable.cs:33-34
Timestamp: 2024-09-19T04:29:56.024Z
Learning: Avoid making suggestions on migrations.
Maple2.Server.World/Migrations/20240921185307_AddHomePropertiesToLayouts.cs (1)
Learnt from: AngeloTadeucci
PR: AngeloTadeucci/Maple2#239
File: Maple2.Server.World/Migrations/20240918223130_AddHomeLayoutsAndCubesTable.cs:33-34
Timestamp: 2024-09-19T04:29:56.024Z
Learning: Avoid making suggestions on migrations.
🔇 Additional comments (45)
Maple2.Model/Enum/HousingCategory.cs (2)

1-1: LGTM: Namespace declaration is appropriate.

The namespace Maple2.Model.Enum follows C# naming conventions and accurately reflects the enum's purpose and location in the project structure.


3-36: LGTM: Enum declaration and members are well-structured.

The HousingCategory enum is well-defined with clear, descriptive names for its members. The explicit value assignments allow for future additions without breaking existing code.

A couple of observations:

  1. There are gaps in the value sequence (e.g., between 21 and 91, 97 and 204). This might be intentional for future expansion or alignment with an external system.
  2. The Misc category has a significantly higher value (10000) compared to others, which ensures it's always the last item when sorted by value.

These design choices seem deliberate and don't pose any immediate issues.

Maple2.Server.World/Migrations/20240922093312_AddItemBlueprintToUgcMarketItem.cs (5)

5-5: LGTM: Namespace declaration is correct.

The namespace Maple2.Server.World.Migrations correctly reflects the file's location in the project structure.


7-7: LGTM: Migration class declaration is correct.

The class AddItemBlueprintToUgcMarketItem is correctly declared as a partial class inheriting from Migration. The name clearly describes the purpose of the migration.


Line range hint 20-24: LGTM: Down method implementation is correct.

The Down method correctly removes the 'Blueprint' column from the 'ugc-market-item' table, providing a proper way to revert the migration if needed.


Line range hint 1-26: Overall, the migration looks good with a point to consider.

This migration file correctly adds a new 'Blueprint' column of type 'json' to the 'ugc-market-item' table. The implementation follows EF Core migration standards, and both Up and Down methods are correctly implemented.

However, please consider the following:

  1. Adding a non-nullable column to an existing table might cause issues if there are existing rows. Consider if it would be better to make the column nullable or provide a meaningful default value.

To ensure this change aligns with the existing model, let's check for the corresponding model class:

#!/bin/bash
# Search for the model class that corresponds to the 'ugc-market-item' table
rg --type csharp "class.*UgcMarketItem"

Line range hint 9-17: LGTM with considerations: Up method implementation is correct.

The Up method correctly adds the 'Blueprint' column to the 'ugc-market-item' table. However, please consider the following points:

  1. The use of 'json' type implies this is for a MySQL database. Ensure this is compatible with other database providers if used.
  2. The default value '{}' suggests an empty JSON object. Confirm if this is the intended default state for the Blueprint.
  3. The column is set as not nullable. Verify that this won't cause issues with existing rows in the table.

To ensure compatibility across the codebase, let's check for any existing references to the 'ugc-market-item' table:

✅ Verification successful

Blueprint column addition verified successfully.

The Blueprint column has been correctly added to the ugc-market-item table and is appropriately utilized across the codebase.

  • Verified that the Blueprint column is mapped in UgcMarketItem.cs.
  • Confirmed that related business logic handles the Blueprint field correctly.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for references to the 'ugc-market-item' table
rg --type csharp "ugc-market-item"

Length of output: 711


Script:

#!/bin/bash
# Search for references to the 'Blueprint' column in the codebase
rg --type csharp "Blueprint"

Length of output: 18017

Maple2.Model/Game/Cube/CubePortalSettings.cs (4)

1-7: LGTM: Appropriate namespace and imports.

The namespace Maple2.Model.Game is suitable for this game-related class, and the imports seem relevant to the class's functionality.


32-36: LGTM: Well-defined enum for portal destinations.

The CubePortalDestination enum is well-defined with clear, descriptive names for different types of portal destinations. Using byte as the underlying type is memory-efficient, which is a good practice.


27-29: Clarify the SetName method's behavior and consider potential improvements.

The SetName method generates a consistent naming scheme for portals based on their position. However, there are a few points to consider:

  1. Using absolute values might lead to name collisions for symmetrically opposite positions. Is this intentional?
  2. The two-digit formatting limits each coordinate to the range 00-99. Is this sufficient for all possible positions in the game world?
  3. Consider adding input validation to ensure the Vector3B is within expected bounds.

To better understand the usage of this method, let's search for its invocations:

#!/bin/bash
# Description: Find usages of the SetName method

# Test: Search for SetName method calls
rg --type csharp 'SetName\s*\('

8-13: Verify the existence of PortalActionType enum.

The class structure looks good and appropriate for representing portal settings. However, please ensure that the PortalActionType enum is defined elsewhere in the project, as it's not present in this file.

Let's verify the existence of the PortalActionType enum:

✅ Verification successful

Retry searching for the PortalActionType enum definition with the corrected shell script.


PortalActionType enum exists in the codebase.

The PortalActionType enum is defined in Maple2.Model/Enum/Portal.cs, ensuring proper reference in CubePortalSettings.cs.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for the definition of PortalActionType enum

# Test: Search for PortalActionType definition
rg --type csharp 'enum\s+PortalActionType'

Length of output: 605


Script:

#!/bin/bash
# Description: Check for the definition of PortalActionType enum

# Test: Search for PortalActionType definition
rg --type csharp 'enum\s+PortalActionType'

Length of output: 103

Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.cs (1)

1-7: LGTM: Proper namespace and class declaration.

The migration class is correctly defined within the Maple2.Server.World.Migrations namespace. The class name AddPortalSettings accurately describes the purpose of the migration, and it properly inherits from the Migration base class.

Maple2.Database/Model/Map/CubePortalSettings.cs (3)

13-21: LGTM! Conversion operator is well-implemented.

The implicit conversion operator from Maple2.Model.Game.CubePortalSettings? to CubePortalSettings? is correctly implemented. The [return: NotNullIfNotNull(nameof(other))] attribute is appropriately used for null propagation.


23-31: LGTM! Symmetric conversion operator is well-implemented.

The implicit conversion operator from CubePortalSettings? to Maple2.Model.Game.CubePortalSettings? is correctly implemented. It maintains symmetry with the previous operator, allowing for bidirectional conversion between the two types.


1-32: 🛠️ Refactor suggestion

Consider adding documentation and verify usage.

The CubePortalSettings class is well-structured and provides seamless conversion between database and game models. To improve maintainability:

  1. Consider adding XML documentation to the class and its members to explain their purpose and usage.
  2. Verify that this new class is being used correctly throughout the codebase.

Add XML documentation to the class:

/// <summary>
/// Represents the settings for a cube portal in the database model.
/// This class provides implicit conversion to and from the game model equivalent.
/// </summary>
internal class CubePortalSettings
{
    // Add similar documentation to properties and conversion operators
}

Let's verify the usage of this new class:

Maple2.Server.World/Migrations/20240921185307_AddHomePropertiesToLayouts.cs (1)

Line range hint 5-44: LGTM! Migration looks good.

The migration adds three new columns (Background, Camera, and Lighting) to the home-layout table, each as a byte type with appropriate SQL mapping. The Down method correctly removes these columns, providing proper rollback functionality.

This change appears to align with the PR objective of "Feat: portal cubes" by adding new properties to home layouts, which could be related to customizing the appearance or behavior of portal cubes in the game.

Maple2.Server.Game/Packets/HomeActionPacket.cs (3)

1-9: LGTM: Imports and namespace are appropriate.

The imports cover all necessary dependencies for the functionality provided in this file. The namespace is correctly defined and consistent with the file location.


12-34: LGTM: Enums are well-structured and align with PR objective.

The enums provide a clear categorization of different home actions, including the new PortalCube functionality. Using byte as the underlying type is efficient for network communication.

The inclusion of PortalCube = 6 in the HomeActionCommand enum directly supports the PR objective of adding portal cubes functionality.


1-51: Overall: Well-implemented functionality for portal cubes.

This new file, HomeActionPacket.cs, successfully implements the functionality for handling home actions, with a particular focus on portal cube settings. The code is well-structured, efficient, and aligns perfectly with the PR objective of adding portal cubes functionality.

Key points:

  1. Appropriate use of enums for categorizing different home actions.
  2. Efficient packet construction for sending cube portal settings.
  3. Flexibility in handling multiple portal names.

The only minor suggestion is to add production-safe null checking for cube.PortalSettings to enhance robustness.

Great job on implementing this feature!

Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.cs (2)

1-7: LGTM: Migration structure and naming are appropriate.

The migration follows Entity Framework Core best practices:

  • Clear, descriptive naming (AddInteractIdToCubes)
  • Proper inheritance from Migration
  • Standard file naming convention
  • Appropriate use of #nullable disable

39-56: LGTM: Down method correctly reverts changes.

The Down method properly drops the added columns from both tables, effectively reverting the changes made in the Up method. The order of operations is correct, and there are no potential data loss issues in the rollback process.

Maple2.Server.Game/Packets/FunctionCubePacket.cs (1)

1-8: LGTM: File structure and imports are appropriate.

The namespaces and imports are correctly defined, and the class is appropriately declared as public and static.

Maple2.Model/Metadata/ItemMetadata.cs (1)

112-115: LGTM! Consider verifying impact and updating documentation.

The changes to ItemMetadataHousing look good and align with the PR objectives. The addition of HousingCategory and IsNotAllowedInBlueprint properties enhances the metadata for housing items, allowing for more detailed categorization and restrictions.

To ensure these changes don't cause issues elsewhere in the codebase, please run the following verification script:

Additionally, please ensure that any relevant documentation is updated to reflect these new properties and their usage.

✅ Verification successful

Verified: No issues found.

The changes to ItemMetadataHousing have been successfully verified. The new properties HousingCategory and IsNotAllowedInBlueprint are properly utilized in ItemMapper.cs, and the HousingCategory enum is correctly defined with appropriate categories.

Please ensure that all relevant documentation has been updated to reflect these new properties and their usage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential impacts of ItemMetadataHousing changes

# Search for usages of ItemMetadataHousing
echo "Searching for ItemMetadataHousing usages:"
rg --type csharp -A 5 "ItemMetadataHousing"

# Search for HousingCategory enum definition
echo "Searching for HousingCategory enum definition:"
rg --type csharp -A 10 "enum HousingCategory"

Length of output: 2343

Maple2.Server.Game/PacketHandlers/MoveFieldHandler.cs (3)

Line range hint 1-13: Verify the impact of removed dependencies

The removal of several using directives and dependency injection properties (including WorldClient) suggests a change in how dependencies are managed. Please ensure that:

  1. The removed using statements were indeed unused.
  2. The functionality previously provided by the removed properties (especially WorldClient) is still accessible where needed.
  3. The dependency injection is now handled appropriately elsewhere if required.

To check for any remaining usage of WorldClient in this file, run:

#!/bin/bash
# Search for any remaining usage of WorldClient in the current file
rg 'World(?:\s*\.\s*|\s*\-\>\s*)' Maple2.Server.Game/PacketHandlers/MoveFieldHandler.cs

90-90: Approve simplification, verify error handling

The simplification of the HandleVisitHome method improves code readability and maintainability. The single call to session.MigrateToHome(home) replaces a more complex block of code.

Please ensure that:

  1. The MigrateToHome method handles all necessary logic and potential error cases previously covered in the removed code.
  2. Any RPC exceptions that could occur are properly handled, either within MigrateToHome or at a higher level.

To verify the implementation of MigrateToHome, run:

#!/bin/bash
# Search for the MigrateToHome method definition
ast-grep --lang csharp --pattern 'public $_ MigrateToHome($_) { $$ }'

Line range hint 1-124: Summary of changes and final verification

The changes in this file appear to be part of a larger refactoring effort to simplify the codebase. The main modifications include:

  1. Removal of unused dependencies and properties.
  2. Simplification of the HandleVisitHome method.

These changes improve code readability and maintainability. However, to ensure the refactoring hasn't introduced any regressions:

  1. Verify that all use cases for visiting a home are still properly handled:

  2. Check if error handling for home visits is now handled at a higher level:

  3. Ensure that the MoveFieldHandler class is still properly integrated with the rest of the system:

These verifications will help ensure that the refactoring hasn't inadvertently broken any functionality or error handling related to home visits and field movement.

Maple2.Server.World/Migrations/20240918062829_MeretMarketRework.cs (1)

Line range hint 33-77: Verify data migration strategy for this schema change.

The Down method correctly reverts the changes made in the Up method by dropping the meret-market-sold table and recreating the premium-market-item table with its original structure. This implementation ensures that the migration can be rolled back if needed.

However, given the significant difference in structure between the old and new tables, it's crucial to ensure that there's a proper data migration strategy in place. Please verify:

  1. Is there a separate data migration script to handle the transition of data from the old structure to the new one?
  2. Has the impact on existing queries and application logic been assessed?

Run the following script to check for any related data migration files or scripts:

This will help ensure that all aspects of this significant schema change have been addressed.

✅ Verification successful

Data Migration Strategy Verified

The data migration logic is present within the migration files, specifically in Maple2.Server.World/Migrations/20231002044140_UgcMarket.cs, which includes methods like UpdateData. Additionally, no TODO comments related to data migration were found in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for potential data migration scripts related to this change.

# Test: Look for files that might contain data migration logic
echo "Searching for potential data migration files:"
fd -e cs -e sql -e py | rg -i 'migrat|meret.*market|premium.*market'

# Test: Search for TODO comments related to data migration in the codebase
echo "\nSearching for TODO comments related to data migration:"
rg -i 'TODO.*migrat.*data' --type cs --type sql --type py

Length of output: 7560


Script:

#!/bin/bash
# Description: Search within migration files for data migration logic.

# Define the list of migration files identified previously
migration_files=(
    "Maple2.Model/Error/MigrationError.cs"
    "Maple2.Server.World/Migrations/20221027102305_InitialCreate.Designer.cs"
    "Maple2.Server.World/Migrations/20221027102305_InitialCreate.cs"
    "Maple2.Server.World/Migrations/20221028040609_PetConfig.Designer.cs"
    "Maple2.Model/Metadata/Table/MeretMarketCategoryTable.cs"
    "Maple2.Model/Metadata/ServerTable/MeretMarketTable.cs"
    "Maple2.Server.World/Migrations/20221028040609_PetConfig.cs"
    "Maple2.Model/Enum/MeretMarket.cs"
    "Maple2.Server.World/Migrations/20221029043947_PetCollection.Designer.cs"
    "Maple2.Server.World/Migrations/20221029043947_PetCollection.cs"
    "Maple2.Server.World/Migrations/20221030212055_MesoMarket.Designer.cs"
    "Maple2.Server.World/Migrations/20221030212055_MesoMarket.cs"
    "Maple2.Server.World/Migrations/20221104071153_Mail.Designer.cs"
    "Maple2.Server.World/Migrations/20221104071153_Mail.cs"
    "Maple2.Server.World/Migrations/20221106164324_ChatSticker.Designer.cs"
    "Maple2.Server.World/Migrations/20221106164324_ChatSticker.cs"
    "Maple2.Server.World/Migrations/20221107075015_Mastery.Designer.cs"
    "Maple2.Server.World/Migrations/20221120234504_FishAlbum.Designer.cs"
    "Maple2.Server.World/Migrations/20221114194917_RenameStatOption.cs"
    "Maple2.Server.World/Migrations/20221120234504_FishAlbum.cs"
    "Maple2.Server.World/Migrations/20221123050131_LapenshardAndQuest.Designer.cs"
    "Maple2.Server.World/Migrations/20221123050131_LapenshardAndQuest.cs"
    "Maple2.Server.World/Migrations/20221128025545_Guild.Designer.cs"
    "Maple2.Server.World/Migrations/20221114194917_RenameStatOption.Designer.cs"
    "Maple2.Server.World/Migrations/20221114042939_MasteryRewards.cs"
    "Maple2.Server.World/Migrations/20221128025545_Guild.cs"
    "Maple2.Server.World/Migrations/20221114042939_MasteryRewards.Designer.cs"
    "Maple2.Server.World/Migrations/20230131235322_PremiumClub.Designer.cs"
    "Maple2.Server.World/Migrations/20230131235322_PremiumClub.cs"
    "Maple2.Server.World/Migrations/20230202170503_GameEvent.Designer.cs"
    "Maple2.Server.World/Migrations/20230202170503_GameEvent.cs"
    "Maple2.Server.World/Migrations/20221108171412_ItemJson.cs"
    "Maple2.Server.World/Migrations/20221108171412_ItemJson.Designer.cs"
    "Maple2.Server.World/Migrations/20221107075015_Mastery.cs"
    "Maple2.Server.World/Migrations/20230222192335_GameEventUserValue.Designer.cs"
    "Maple2.Server.World/Migrations/20230222192335_GameEventUserValue.cs"
    "Maple2.Server.World/Migrations/20230224050109_Shop.Designer.cs"
    "Maple2.Server.World/Migrations/20230224050109_Shop.cs"
    "Maple2.Server.World/Migrations/20230228063504_CharacterAndAccountAddFields.Designer.cs"
    "Maple2.Server.World/Migrations/20230228063504_CharacterAndAccountAddFields.cs"
    "Maple2.Server.World/Migrations/20230604024657_GachaDismantle.Designer.cs"
    "Maple2.Server.World/Migrations/20230604024657_GachaDismantle.cs"
    "Maple2.Server.World/Migrations/20230702192843_BeautyShop.Designer.cs"
    "Maple2.Server.World/Migrations/20230702192843_BeautyShop.cs"
    "Maple2.Server.World/Migrations/20230822011738_Achievement.Designer.cs"
    "Maple2.Server.World/Migrations/20230822011738_Achievement.cs"
    "Maple2.Server.World/Migrations/20230826013538_WebStorage.Designer.cs"
    "Maple2.Server.World/Migrations/20230826013538_WebStorage.cs"
    "Maple2.Server.World/Migrations/20230827232716_MeretMarket.Designer.cs"
    "Maple2.Server.World/Migrations/20230827232716_MeretMarket.cs"
    "Maple2.Server.World/Migrations/20230905222135_Quest.Designer.cs"
    "Maple2.Server.World/Migrations/20230905222135_Quest.cs"
    "Maple2.Server.World/Migrations/20230911045230_SkillCooldown.Designer.cs"
    "Maple2.Server.World/Migrations/20230911045230_SkillCooldown.cs"
    "Maple2.Server.World/Migrations/20230911161332_Gathering.Designer.cs"
    "Maple2.Server.World/Migrations/20231002044140_UgcMarket.cs"
    "Maple2.Server.World/Migrations/20240501000613_DeathPenalty.Designer.cs"
    "Maple2.Server.World/Migrations/20240501000613_DeathPenalty.cs"
    "Maple2.Server.World/Migrations/20231002044140_UgcMarket.Designer.cs"
    "Maple2.Server.World/Migrations/20230921034534_ShopsPart2.cs"
    "Maple2.Server.World/Migrations/20240516033423_SurvivalStats.Designer.cs"
    "Maple2.Server.World/Migrations/20240516033423_SurvivalStats.cs"
    "Maple2.Server.World/Migrations/20230921034534_ShopsPart2.Designer.cs"
    "Maple2.Server.World/Migrations/20230911161332_Gathering.cs"
    "Maple2.Server.World/Migrations/20240517172222_Prestige.cs"
    "Maple2.Server.World/Migrations/20240517172222_Prestige.Designer.cs"
    "Maple2.Server.World/Migrations/20240518200914_ServerInfo.Designer.cs"
    "Maple2.Server.World/Migrations/20240518200914_ServerInfo.cs"
    "Maple2.Server.World/Migrations/20240519031103_BlackMarket.Designer.cs"
    "Maple2.Server.World/Migrations/20240519031103_BlackMarket.cs"
    "Maple2.Server.World/Migrations/20240522171131_GuideRecord.Designer.cs"
    "Maple2.Server.World/Migrations/20240522171131_GuideRecord.cs"
    "Maple2.Server.World/Migrations/20240528031038_SkillPoints.cs"
    "Maple2.Server.World/Migrations/20240528031038_SkillPoints.Designer.cs"
    "Maple2.Server.World/Migrations/20240610175759_Medal.cs"
    "Maple2.Server.World/Migrations/20240709075218_RemoveGameEvent.cs"
    "Maple2.Server.World/Migrations/20240709075218_RemoveGameEvent.Designer.cs"
    "Maple2.Server.World/Migrations/20240821010240_ugc-banner-slots.Designer.cs"
    "Maple2.Server.World/Service/WorldService.Migrate.cs"
    "Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs"
    "Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.cs"
    "Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.Designer.cs"
    "Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.cs"
    "Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.Designer.cs"
    "Maple2.Server.World/Migrations/20240922093312_AddItemBlueprintToUgcMarketItem.cs"
    "Maple2.Server.World/Migrations/20240921185307_AddHomePropertiesToLayouts.cs"
    "Maple2.Server.World/Migrations/20240919045503_AddHomeLayoutsAndCubesTable.cs"
    "Maple2.Server.World/Migrations/20240922093312_AddItemBlueprintToUgcMarketItem.Designer.cs"
    "Maple2.Server.World/Migrations/20240918062829_MeretMarketRework.cs"
    "Maple2.Model/Game/Market/PremiumMarketPromoData.cs"
    "Maple2.Model/Game/Market/PremiumMarketItem.cs"
    "Maple2.Model/Game/Market/MeretMarketSearch.cs"
    "Maple2.Server.World/Migrations/20240921185307_AddHomePropertiesToLayouts.Designer.cs"
    "Maple2.Server.World/Migrations/20240919045503_AddHomeLayoutsAndCubesTable.Designer.cs"
    "Maple2.Server.World/Migrations/20240918062829_MeretMarketRework.Designer.cs"
    "Maple2.Server.World/Migrations/20240916014720_RemoveBeautyShops.cs"
    "Maple2.Server.World/Migrations/20240916014720_RemoveBeautyShops.Designer.cs"
    "Maple2.Server.World/Migrations/20240915233502_AddHomeLayouts.cs"
    "Maple2.Server.World/Migrations/20240915233502_AddHomeLayouts.Designer.cs"
    "Maple2.Server.World/Migrations/20240914074826_RemoveShops.cs"
    "Maple2.Server.World/Migrations/20240914074826_RemoveShops.Designer.cs"
    "Maple2.Server.World/Migrations/20240821010240_ugc-banner-slots.cs"
    "Maple2.Server.World/Migrations/20240610175759_Medal.Designer.cs"
    "Maple2.Server.World/Migrations/20240609073700_Club.cs"
    "Maple2.Server.World/Migrations/20240609073700_Club.Designer.cs"
    "Maple2.Server.World/Migrations/20240530004923_StatPoints.cs"
    "Maple2.Server.World/Migrations/20240530004923_StatPoints.Designer.cs"
    "Maple2.Server.Game/PacketHandlers/MeretMarketHandler.cs"
    "Maple2.Server.Game/Packets/MeretMarketPacket.cs"
    "Maple2.Server.Core/Packets/MigrationPacket.cs"
    "Maple2.Database/Model/Market/SoldMeretMarketItem.cs"
)

# Search for data migration methods within the identified migration files
echo "Searching for data migration methods in migration files:"
for file in "${migration_files[@]}"; do
    rg -i 'InsertData|UpdateData|DeleteData|CustomMigrationMethod' "$file" && echo "Match found in $file"
done

# Search for comments indicating data migration logic
echo -e "\nSearching for comments related to data migration in migration files:"
for file in "${migration_files[@]}"; do
    rg -i 'data migration|migrate data|data transfer' "$file"
done

Length of output: 43756

Maple2.Server.Core/Constants/RecvOp.cs (1)

147-147: Approve rename and verify usage

The rename from HomeGame to HomeAction improves consistency with other enum members and potentially better reflects its functionality. This change is approved.

To ensure this change doesn't introduce any issues, please verify all usages of this enum member in the codebase. Run the following script to find any occurrences of the old name:

If any occurrences are found, they should be updated to use HomeAction.

Maple2.Server.Core/Constants/SendOp.cs (1)

237-237: Approve rename, but verify usage across codebase

The rename from HomeGame to HomeAction appears to be a semantic improvement, clarifying the enum's purpose. The hexadecimal value remains unchanged, which should maintain consistency in the network protocol.

To ensure this change doesn't introduce any issues, please run the following script to check for any remaining references to SendOp.HomeGame that might need updating:

If any results are found, they will need to be updated to use SendOp.HomeAction.

Maple2.File.Ingest/Mapper/ItemMapper.cs (1)

139-143: LGTM! Consider handling multiple category tags.

The implementation for parsing the housing category and updating the ItemMetadataHousing constructor looks good. However, there are a couple of points to consider:

  1. The current implementation only uses the first category tag if multiple are present. Consider if this is the intended behavior or if you need to handle multiple categories.

  2. Ensure that the HousingCategory enum includes all possible values that can be parsed from the categoryTag.

To verify the HousingCategory enum values, please run the following script:

Compare the output to ensure all category tags have corresponding enum values.

Also applies to: 147-149

Maple2.Server.Game/PacketHandlers/RequestCubeHandler.cs (1)

279-279: LGTM! Improves code readability.

The addition of a blank line helps to separate logical blocks of code, improving readability.

Maple2.Server.World/Migrations/20240926202541_AddInteractIdToCubes.Designer.cs (1)

11-16: Migration class declaration looks good.

The migration class is correctly defined with appropriate attributes and naming convention.

Maple2.Model/Game/Cube/PlotCube.cs (1)

11-19: Position property implementation looks good

The custom getter and setter for the Position property correctly encapsulate the position field and update InteractId when appropriate.

Maple2.Database/Model/Map/UgcMapCube.cs (4)

4-4: Approved the addition of the using directive.

The using Maple2.Model.Enum; directive is necessary for accessing the HousingCategory enum and is correctly included.


50-52: Approved the property assignments in the reverse implicit operator.

The properties InteractId, HousingCategory, and PortalSettings are correctly mapped in the reverse conversion from PlotCube to UgcMapCube.


33-35: ⚠️ Potential issue

Correct the syntax in the conditional expression for InteractState.

The current expression uses the is operator with or, which is not valid syntax for comparing enum values in C#. Instead, use equality checks (==) combined with the logical OR operator (||).

Apply this diff to correct the expression:

- InteractState = other.HousingCategory is HousingCategory.Ranching or HousingCategory.Farming
+ InteractState = (other.HousingCategory == HousingCategory.Ranching || other.HousingCategory == HousingCategory.Farming)
     ? InteractCubeState.InUse
     : InteractCubeState.None,

This ensures that InteractState is correctly set based on the HousingCategory.

Likely invalid or redundant comment.


65-65: Verify JSON conversion handles nullable PortalSettings correctly.

Since PortalSettings is a nullable property (CubePortalSettings?), ensure that HasJsonConversion() correctly serializes and deserializes null values without causing errors.

Run the following script to check how HasJsonConversion() is used with nullable properties elsewhere in the codebase:

This will help confirm that the pattern used for PortalSettings is consistent and handled appropriately.

Maple2.Database/Model/Map/HomeLayoutCube.cs (4)

4-4: Approved: Added necessary namespace for HousingCategory

The addition of using Maple2.Model.Enum; is appropriate to access the HousingCategory enum.


20-22: Approved: New properties enhance the data model

The introduction of InteractId, HousingCategory, and PortalSettings adds necessary information to HomeLayoutCube. Initializing InteractId to an empty string helps avoid null reference exceptions.


48-50: Approved: Correct mapping in reverse implicit conversion operator

The properties InteractId, HousingCategory, and PortalSettings are correctly mapped in the implicit operator from PlotCube? to HomeLayoutCube?.


63-63: Approved: Configuring JSON conversion for PortalSettings

Including builder.Property(cube => cube.PortalSettings).HasJsonConversion(); ensures that PortalSettings is properly serialized and deserialized when interacting with the database.

Maple2.Server.Game/PacketHandlers/HomeActionHandler.cs (1)

75-78: Avoid redundant broadcasting when spawning portals

In the loop where new portals are spawned, session.Field.SpawnCubePortal(cubePortal) might already handle broadcasting to all sessions. If session.Field.Broadcast(PortalPacket.Add(fieldPortal)) is redundant, it can be removed.

Please verify whether SpawnCubePortal already broadcasts the addition of the portal. If so, remove the redundant broadcast call.

 foreach (PlotCube cubePortal in cubePortals) {
     FieldPortal fieldPortal = session.Field.SpawnCubePortal(cubePortal);
-    session.Field.Broadcast(PortalPacket.Add(fieldPortal));
 }

To confirm, run the following script:

Maple2.Server.Game/Manager/HousingManager.cs (2)

393-397: HousingCategory assignment ensures correct categorization upon placement.

Assigning HousingCategory in the PlotCube initialization ensures that the cube is properly categorized when placed.


429-430: Consistent assignment of HousingCategory after placement.

Setting result.HousingCategory ensures that the cube retains its housing category information after placement.

Maple2.Server.Game/Manager/Field/FieldManager.State.cs (1)

48-48: Method GetPortals implementation looks good

This method correctly returns the collection of field portals.

Comment thread Maple2.Model/Game/Cube/CubePortalSettings.cs Outdated
Comment thread Maple2.Server.World/Migrations/20240926232205_AddPortalSettings.cs Outdated
Comment thread Maple2.Server.Game/Packets/FunctionCubePacket.cs
Comment thread Maple2.Server.Game/Packets/FunctionCubePacket.cs
Comment thread Maple2.Server.Game/Manager/Field/FieldManager.cs Outdated
Comment thread Maple2.Server.Game/Manager/Field/FieldManager.cs Outdated
Comment thread Maple2.Server.Game/Manager/HousingManager.cs
Comment thread Maple2.Server.Game/Manager/HousingManager.cs Outdated
Comment thread Maple2.Server.Game/Manager/Field/FieldManager.State.cs
@AngeloTadeucci

Copy link
Copy Markdown
Collaborator Author

@coderabbitai configuration

@coderabbitai

coderabbitai Bot commented Sep 27, 2024

Copy link
Copy Markdown
Contributor
CodeRabbit configuration
language: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
  profile: chill
  request_changes_workflow: true
  high_level_summary: true
  high_level_summary_placeholder: '@coderabbitai summary'
  auto_title_placeholder: '@coderabbitai'
  review_status: true
  poem: true
  collapse_walkthrough: false
  sequence_diagrams: true
  changed_files_summary: true
  labeling_instructions: []
  path_filters: []
  path_instructions: []
  abort_on_close: true
  auto_review:
    enabled: true
    auto_incremental_review: true
    ignore_title_keywords: []
    labels: []
    drafts: false
    base_branches: []
  tools:
    shellcheck:
      enabled: true
    ruff:
      enabled: true
    markdownlint:
      enabled: true
    github-checks:
      enabled: true
      timeout_ms: 90000
    languagetool:
      enabled: true
      enabled_only: false
      level: default
      disabled_rules:
        - EN_UNPAIRED_BRACKETS
        - EN_UNPAIRED_QUOTES
      disabled_categories:
        - TYPOS
        - TYPOGRAPHY
        - CASING
    biome:
      enabled: true
    hadolint:
      enabled: true
    swiftlint:
      enabled: true
    phpstan:
      enabled: true
      level: default
    golangci-lint:
      enabled: true
    yamllint:
      enabled: true
    gitleaks:
      enabled: true
    checkov:
      enabled: true
    detekt:
      enabled: true
    eslint:
      enabled: true
    rubocop:
      enabled: true
    buf:
      enabled: true
    regal:
      enabled: true
    actionlint:
      enabled: true
    pmd:
      enabled: true
    cppcheck:
      enabled: true
    semgrep:
      enabled: true
    circleci:
      enabled: true
chat:
  auto_reply: true
knowledge_base:
  opt_out: false
  learnings:
    scope: auto
  issues:
    scope: auto
  jira:
    project_keys: []
  linear:
    team_keys: []
  pull_requests:
    scope: auto

@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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ec6135f and 3921126.

📒 Files selected for processing (7)
  • Maple2.Database/Model/Map/HomeLayoutCube.cs (4 hunks)
  • Maple2.Database/Model/Map/UgcMapCube.cs (4 hunks)
  • Maple2.Model/Game/Cube/HeldCube.cs (1 hunks)
  • Maple2.Model/Game/Cube/PlotCube.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240927033527_AddPortalSettings.Designer.cs (1 hunks)
  • Maple2.Server.World/Migrations/20240927033527_AddPortalSettings.cs (1 hunks)
  • Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • Maple2.Database/Model/Map/HomeLayoutCube.cs
  • Maple2.Database/Model/Map/UgcMapCube.cs
  • Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs
🔇 Additional comments (13)
Maple2.Model/Game/Cube/HeldCube.cs (1)

12-13: LGTM! Consider updating serialization methods.

The addition of the ItemType property is a good improvement, allowing for more detailed categorization of held cubes. The protected set ensures proper encapsulation.

However, please consider the following:

  1. Update the WriteTo and ReadFrom methods to include serialization and deserialization of the new ItemType property.
  2. Ensure that any code interacting with HeldCube is updated to account for this new property if necessary.

Here's a suggested update for the serialization methods:

public void WriteTo(IByteWriter writer) {
    writer.WriteInt(ItemId);
+   writer.WriteEnum(ItemType);
    writer.WriteLong(Id);
    // ... rest of the method
}

public void ReadFrom(IByteReader reader) {
    ItemId = reader.ReadInt();
+   ItemType = reader.ReadEnum<ItemType>();
    Id = reader.ReadLong();
    // ... rest of the method
}

To ensure all usages of HeldCube are updated, you can run the following script:

This will help identify any areas that might need updates due to the new ItemType property.

Maple2.Server.World/Migrations/20240927033527_AddPortalSettings.cs (4)

1-9: LGTM: Migration structure is well-defined.

The migration class is correctly structured with proper naming, inheritance, and namespace. The use of a partial class allows for potential extensions if needed.


43-60: LGTM: Down method correctly reverts changes.

The Down method properly drops the columns added in the Up method, ensuring that the migration can be rolled back if needed.


1-62: Verify application code compatibility with new columns.

While the migration itself shouldn't cause issues with existing data, it's important to ensure that the application code is updated to handle these new columns appropriately:

  1. Verify that the default value of 0 for HousingCategory is meaningful in the context of your application.
  2. Ensure that any code reading from these tables can handle the potentially null PortalSettings column.

To check for potential issues, you can search for usages of these tables in the codebase:

#!/bin/bash
# Search for usages of the affected tables
rg -t cs '(ugcmap-cube|home-layout-cube)'

Review the results to ensure that the code interacting with these tables is updated to handle the new columns.


11-40: LGTM: Up method implementation is correct.

The Up method correctly adds the new columns to both tables. The use of json type for PortalSettings with utf8mb4 character set is appropriate for flexible data storage.

Consider verifying if int type for HousingCategory provides sufficient range for future needs. If you expect a large number of categories or need to support custom categories, you might want to use a different type or structure.

To check existing enum values or constants related to housing categories, you can run:

✅ Verification successful

Verified: The HousingCategory is defined as an enum, ensuring that using an int type for the column is appropriate and sufficient for current and future categories.

  • The HousingCategory enum provides a clear and limited set of values, aligning with the int type used in the migration.
  • No issues found regarding the range or scalability of the HousingCategory field.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for housing category related enums or constants
rg -t cs -i '(enum|const).*housing.*category'

Length of output: 9824


Script:

#!/bin/bash
# Search for enums or constants related to HousingCategory in C# files
rg -t cs -i '^(public\s+)?(enum|const)\s+\w*\s*HousingCategory\b'

Length of output: 134

Maple2.Model/Game/Cube/PlotCube.cs (4)

25-31: Properties are properly defined and initialized

The added properties InteractId, InteractState, InteractUnkByte, HousingCategory, and PortalSettings are appropriately defined and initialized.


39-41: Previous review comment still valid


50-52: Previous review comment still valid


56-59: Enum InteractCubeState is well-defined

The InteractCubeState enum is correctly defined with appropriate values representing the interaction states.

Maple2.Server.World/Migrations/20240927033527_AddPortalSettings.Designer.cs (4)

1434-1447: Review usage of 'DeleteBehavior.Cascade' in 'Buddy' relationships

In the Buddy entity configuration, the relationships to Character entities use OnDelete(DeleteBehavior.Cascade). This means that deleting a Character will cascade and delete associated Buddy records, and vice versa. Please verify that this cascading delete behavior is intended to prevent unintended data loss, especially since buddies might represent mutual relationships.


1451-1455: Confirm cascading delete behavior between 'Character' and 'Account'

The Character entity has a foreign key to the Account entity with OnDelete(DeleteBehavior.Cascade). Deleting an Account will result in all associated Character records being deleted. Ensure that this behavior aligns with the application's requirements for data retention and complies with any data deletion policies.


860-864: Validate default value for 'UnlockTime' in 'Item' entity

The UnlockTime property in the Item entity is defined as a long without a default value or nullability specification. If this property represents a timestamp, ensure that a default value of zero is appropriate, or consider making it nullable to avoid potential issues with date calculations.


761-762: Ensure database supports 'json' column type

The PortalSettings property for both HomeLayoutCube and UgcMapCube entities is set with the column type "json". Verify that the target database system supports the json data type. If not, you may need to use an alternative data type like longtext or handle JSON serialization/deserialization manually.

To check if the json data type is supported, you can run the following script:

Also applies to: 1315-1316

✅ Verification successful

To gather the necessary information to confirm the database provider, let's run a search for the database context configuration.


JSON column type is supported by the database

The codebase consistently uses MySQL as the database provider, which has supported the JSON data type since version 5.7 (released in 2015). The widespread use of 'HasColumnType("json")' across multiple migration files from 2022 to 2024 confirms that the project is designed to work with MySQL versions that support JSON columns.

No further action is required regarding the use of JSON column types in this project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the database supports the 'json' column type.

# Test: Search for usage of 'HasColumnType("json")' in the codebase to assess prevalence.
rg --type cs 'HasColumnType\("json"\)'

# If the database is MySQL version 5.7 or higher, 'json' is supported by default.
# For other databases, consult the documentation or check the database schema.

Length of output: 304260


Script:

#!/bin/bash
# Search for database context configuration
rg --type cs 'UseMySql|UseNpgsql|UseSqlServer' -A 5

Length of output: 3098

Comment thread Maple2.Model/Game/Cube/PlotCube.cs
Comment thread Maple2.Server.World/Migrations/20240927033527_AddPortalSettings.Designer.cs Outdated
Comment thread Maple2.Server.World/Migrations/20240927033527_AddPortalSettings.Designer.cs Outdated
Comment thread Maple2.Database/Model/Map/UgcMapCube.cs Outdated
Comment thread Maple2.Model/Game/Cube/PlotCube.cs Outdated

@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: 3

🧹 Outside diff range and nitpick comments (1)
Maple2.Model/Enum/InteractCubeState.cs (1)

4-7: LGTM: Enum members are well-defined. Consider adding XML documentation.

The enum members are clearly named and logically ordered with explicit value assignments. This is good practice, especially if the enum will be serialized or stored.

Consider adding XML documentation to describe each state:

public enum InteractCubeState
{
    /// <summary>
    /// Represents an uninitialized or default state.
    /// </summary>
    None = 0,

    /// <summary>
    /// Indicates that the cube is currently in use.
    /// </summary>
    InUse = 1,

    /// <summary>
    /// Indicates that the cube is available for interaction.
    /// </summary>
    Available = 2,
}

This will provide more context for developers using this enum in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3921126 and 600b2ea.

📒 Files selected for processing (3)
  • Maple2.Model/Enum/InteractCubeState.cs (1 hunks)
  • Maple2.Model/Game/Cube/PlotCube.cs (1 hunks)
  • Maple2.Server.Game/Packets/FunctionCubePacket.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Maple2.Server.Game/Packets/FunctionCubePacket.cs
🔇 Additional comments (7)
Maple2.Model/Enum/InteractCubeState.cs (2)

1-1: LGTM: Namespace declaration is correct and follows conventions.

The namespace Maple2.Model.Enum is properly declared and aligns with the file structure.


3-3: LGTM: Enum declaration is well-defined.

The InteractCubeState enum is correctly declared as public and follows proper naming conventions.

Maple2.Model/Game/Cube/PlotCube.cs (5)

2-3: LGTM: Added necessary using statement

The addition of using Maple2.Model.Enum; is appropriate given the introduction of enum-based properties in the class.


25-30: LGTM: New properties added, but clarification needed

The addition of InteractId, InteractState, InteractUnkByte, and HousingCategory properties enhances the state management of the PlotCube. However, the purpose of InteractUnkByte is not clear from its name.

Could you please clarify the purpose of InteractUnkByte and consider renaming it to something more descriptive if appropriate?


31-32: LGTM: Added PortalSettings property

The addition of the nullable PortalSettings property with an init accessor is a good design choice. It allows for immutability after initialization and appropriately handles cases where not all PlotCubes have portal settings.


44-49: LGTM: Detailed method comment added

The addition of a detailed XML comment for the AsHexadecimal method is excellent. It clearly explains the method's purpose and provides a helpful example, which greatly enhances code readability and maintainability.


1-52: Summary of PlotCube.cs changes

The modifications to the PlotCube class significantly enhance its functionality and state management capabilities. Key improvements include:

  1. Addition of new properties for better state representation.
  2. Implementation of a custom setter for the Position property.
  3. Introduction of the AsHexadecimal method for coordinate conversion.
  4. Enhanced constructor logic for initializing PortalSettings.

While these changes are generally positive, a few minor issues need to be addressed:

  1. Potential NullReferenceException in the Position setter.
  2. Incorrect use of the is operator for integer comparison.
  3. Potential issues with handling negative coordinates in AsHexadecimal.

Addressing these issues will further improve the robustness and correctness of the class. Additionally, consider clarifying the purpose of the InteractUnkByte property.

Overall, these changes represent a significant improvement to the PlotCube class, enhancing its capabilities and maintainability.

Comment thread Maple2.Model/Game/Cube/PlotCube.cs
Comment thread Maple2.Model/Game/Cube/PlotCube.cs
Comment thread Maple2.Model/Game/Cube/PlotCube.cs

@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: 2

🧹 Outside diff range and nitpick comments (1)
Maple2.Model/Enum/CubePortalDestination.cs (1)

1-7: LGTM! Consider adding XML documentation.

The enum CubePortalDestination is well-structured and follows good practices:

  • Using byte as the underlying type is memory-efficient for small enums.
  • Explicit value assignment is good for maintaining backwards compatibility and serialization.
  • The naming is clear and follows C# conventions.

Consider adding XML documentation to the enum and its members to provide more context about their usage. Here's an example:

 namespace Maple2.Model.Enum;

+/// <summary>
+/// Represents the possible destinations for a cube portal.
+/// </summary>
 public enum CubePortalDestination : byte {
+    /// <summary>
+    /// Destination is a portal within the home.
+    /// </summary>
     PortalInHome = 0,
+    /// <summary>
+    /// Destination is a selected map.
+    /// </summary>
     SelectedMap = 1,
+    /// <summary>
+    /// Destination is a friend's home.
+    /// </summary>
     FriendHome = 2,
 }

This addition would improve the code's self-documentation and make it easier for other developers to understand the enum's purpose and usage.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 600b2ea and 5f4ce86.

⛔ Files ignored due to path filters (3)
  • Maple2.Server.World/Migrations/20240927044107_AddCubeSettings.Designer.cs is excluded by !Maple2.Server.World/Migrations/*
  • Maple2.Server.World/Migrations/20240927044107_AddCubeSettings.cs is excluded by !Maple2.Server.World/Migrations/*
  • Maple2.Server.World/Migrations/Ms2ContextModelSnapshot.cs is excluded by !Maple2.Server.World/Migrations/*
📒 Files selected for processing (12)
  • Maple2.Database/Model/Map/CubeHelper.cs (1 hunks)
  • Maple2.Database/Model/Map/CubePortalSettings.cs (1 hunks)
  • Maple2.Database/Model/Map/HomeLayoutCube.cs (4 hunks)
  • Maple2.Database/Model/Map/UgcMapCube.cs (4 hunks)
  • Maple2.Model/Enum/CubePortalDestination.cs (1 hunks)
  • Maple2.Model/Game/Cube/CubePortalSettings.cs (1 hunks)
  • Maple2.Model/Game/Cube/PlotCube.cs (1 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager.State.cs (2 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager.cs (2 hunks)
  • Maple2.Server.Game/Manager/HousingManager.cs (4 hunks)
  • Maple2.Server.Game/PacketHandlers/HomeActionHandler.cs (1 hunks)
  • Maple2.Server.Game/Packets/HomeActionPacket.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • Maple2.Database/Model/Map/CubePortalSettings.cs
  • Maple2.Database/Model/Map/HomeLayoutCube.cs
  • Maple2.Database/Model/Map/UgcMapCube.cs
  • Maple2.Model/Game/Cube/PlotCube.cs
  • Maple2.Server.Game/Manager/Field/FieldManager.State.cs
  • Maple2.Server.Game/Manager/Field/FieldManager.cs
  • Maple2.Server.Game/Manager/HousingManager.cs
  • Maple2.Server.Game/PacketHandlers/HomeActionHandler.cs
  • Maple2.Server.Game/Packets/HomeActionPacket.cs
🔇 Additional comments (6)
Maple2.Database/Model/Map/CubeHelper.cs (3)

1-6: LGTM: Overall structure is well-organized.

The file structure is clean and follows good practices:

  • Appropriate using statements
  • Correct namespace definition
  • Internal static class for utility methods

1-24: Overall, good addition with room for minor improvements.

This new CubeHelper class introduces useful functionality for managing cube settings and interact states. The code is clean, concise, and uses modern C# features. To further enhance this addition:

  1. Add class-level XML documentation to explain the purpose of CubeHelper.
  2. Consider creating constants or an enum for the "InUse" state to avoid magic strings/values.
  3. If this class is likely to grow, consider preparing it for extension by making it non-static and using dependency injection.

Great work on this feature! These small refinements will make the code even more robust and maintainable.


7-15: 🛠️ Refactor suggestion

Consider simplifying the code and clarify future implementations.

The GetCubeSettings method looks good overall, but there are a few points to consider:

  1. You could simplify the null check and casting using the null-conditional operator:

    return cube.CubePortalSettings as CubeSettings;
  2. The comment "// Other settings" suggests that there might be more implementation needed. Could you clarify what other settings are planned to be added here?

  3. Consider adding XML documentation to describe the method's purpose, parameters, and return value.

Here's a suggested refactor:

/// <summary>
/// Retrieves the cube settings for a given plot cube.
/// </summary>
/// <param name="cube">The plot cube to get settings for.</param>
/// <returns>The cube settings if available; otherwise, null.</returns>
public static CubeSettings? GetCubeSettings(PlotCube cube)
{
    return cube.CubePortalSettings as CubeSettings;

    // TODO: Implement other settings retrieval
}

To ensure CubeSettings inherits from or is related to CubePortalSettings, let's verify their relationship:

Maple2.Model/Game/Cube/CubePortalSettings.cs (3)

31-36: Add serialization for PortalObjectId in WriteTo method.

The WriteTo method is missing the serialization of the PortalObjectId property. This could lead to incomplete data when the object is deserialized.

Refer to the previous review comment for the suggested changes.


38-40: Ensure Vector3B is defined and used correctly in SetName method.

The SetName method depends on Vector3B. Verify that Vector3B is defined and that its properties X, Y, and Z are of types compatible with Math.Abs.

Run the following script to confirm the existence and structure of Vector3B:

#!/bin/bash
# Description: Verify that Vector3B is defined and its properties are compatible with Math.Abs.

# Test: Search for the Vector3B struct or class definition.
# Expect: Vector3B is defined with integer properties X, Y, and Z.

rg --type cs 'public\s+(struct|class)\s+Vector3B\s*{[^}]*\bpublic\b\s+\w+\s+X\b[^}]*\bpublic\b\s+\w+\s+Y\b[^}]*\bpublic\b\s+\w+\s+Z\b[^}]*}'

22-24: 🛠️ Refactor suggestion

Consider deep copying reference types in the Clone method.

The Clone method uses MemberwiseClone(), which performs a shallow copy. If Destination is a reference type with mutable state, changes to the cloned object's Destination property may affect the original object.

Run the following script to verify if CubePortalDestination requires deep copying:

If CubePortalDestination is a class with mutable properties and provides a Clone method, modify the Clone method as follows:

 public override CubeSettings Clone() {
-    return (CubePortalSettings) MemberwiseClone();
+    var clone = (CubePortalSettings) MemberwiseClone();
+    clone.Destination = this.Destination?.Clone();
+    return clone;
 }

Ensure that CubePortalDestination implements a Clone method to perform a deep copy.

Comment thread Maple2.Database/Model/Map/CubeHelper.cs Outdated
Comment thread Maple2.Model/Game/Cube/CubePortalSettings.cs

@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: 4

🧹 Outside diff range and nitpick comments (7)
Maple2.Model/Metadata/FunctionCubeMetadata.cs (1)

5-10: Consider adding XML documentation comments.

To improve code readability and maintainability, consider adding XML documentation comments for the record and its properties. This will provide valuable information for developers who will use this type in the future.

Here's an example of how you could add documentation:

/// <summary>
/// Represents metadata for a function cube.
/// </summary>
/// <param name="Id">The unique identifier of the function cube.</param>
/// <param name="DefaultState">The default interaction state of the cube.</param>
/// <param name="AutoStateChange">An array of states to which the cube can automatically change.</param>
/// <param name="AutoStateChangeTime">The time duration for the automatic state change.</param>
public record FunctionCubeMetadata(
    int Id,
    InteractCubeState DefaultState,
    int[] AutoStateChange,
    int AutoStateChangeTime
);
Maple2.Database/Storage/Metadata/FunctionCubeMetadataStorage.cs (1)

7-16: LGTM: Class definition and constructor are well-structured.

The FunctionCubeMetadataStorage class is well-defined, inheriting from the appropriate base class and using a dictionary for efficient data retrieval. The constructor correctly initializes and populates the dictionary.

Consider adding a comment explaining the choice of 500 as the capacity in the base constructor call. This would help future maintainers understand the reasoning behind this specific value.

Maple2.File.Ingest/Mapper/FunctionCubeMapper.cs (1)

16-25: LGTM: Efficient implementation of the Map method.

The Map method is well-implemented:

  • It correctly overrides the base method and uses yield return for efficient enumeration.
  • The mapping logic from FunctionCube to FunctionCubeMetadata is clear and concise.

Consider adding a comment explaining the cast from functionCube.DefaultState to InteractCubeState. This would improve code readability and maintainability. For example:

// Cast DefaultState to InteractCubeState as they represent the same concept in different contexts
DefaultState: (InteractCubeState) functionCube.DefaultState,
Maple2.Database/Storage/Game/GameStorage.cs (1)

22-22: Consider maintaining consistent parameter ordering in the constructor.

The addition of the functionCubeMetadata parameter and its assignment in the constructor body are correct and follow the existing pattern. However, consider maintaining a consistent order of parameters by placing the logger parameter last:

public GameStorage(DbContextOptions options, 
                   ItemMetadataStorage itemMetadata, 
                   MapMetadataStorage mapMetadata, 
                   AchievementMetadataStorage achievementMetadata,
                   QuestMetadataStorage questMetadata, 
                   TableMetadataStorage tableMetadata, 
                   ServerTableMetadataStorage serverTableMetadata, 
                   FunctionCubeMetadataStorage functionCubeMetadata,
                   ILogger<GameStorage> logger)

This would maintain consistency with common conventions where loggers are typically the last parameter.

Also applies to: 29-29

Maple2.Database/Context/MetadataContext.cs (1)

231-235: LGTM: Configuration method for FunctionCubeMetadata

The ConfigureFunctionCubeMetadata method is well-implemented and consistent with other entity configurations in the class. It correctly sets the table name, primary key, and JSON conversion for the AutoStateChange property.

Consider adding a comment explaining the purpose of the FunctionCubeMetadata entity and its relationship to house portals for better code documentation.

Maple2.Server.Game/Session/GameSession.cs (1)

518-539: LGTM with suggestions: New MigrateToHome method

The MigrateToHome method looks well-structured and handles the migration process appropriately. However, consider the following improvements:

  1. Add inline comments to explain the purpose of each step in the migration process. This will enhance code readability and maintainability.
  2. Consider logging the exception details server-side for debugging purposes. This can help in troubleshooting issues in production.

Here's a suggested refactor with added comments and logging:

 public void MigrateToHome(Home home) {
     try {
+        // Prepare migration request with session details
         var request = new MigrateOutRequest {
             AccountId = AccountId,
             CharacterId = CharacterId,
             MachineId = MachineId.ToString(),
             Server = Server.World.Service.Server.Game,
             MapId = home.Indoor.MapId,
             OwnerId = home.Indoor.OwnerId,
         };

+        // Initiate migration process
         MigrateOutResponse response = World.MigrateOut(request);
+        // Create endpoint for the new game server
         var endpoint = new IPEndPoint(IPAddress.Parse(response.IpAddress), response.Port);
+        // Send migration packet to the client
         Send(MigrationPacket.GameToGame(endpoint, response.Token, home.Indoor.MapId));
+        // Update session state
         State = SessionState.ChangeMap;
     } catch (RpcException ex) {
+        // Log exception details for server-side debugging
+        Logger.Error(ex, "Failed to migrate to home for AccountId: {AccountId}, CharacterId: {CharacterId}", AccountId, CharacterId);
+        // Send error packet to the client
         Send(MigrationPacket.GameToGameError(MigrationError.s_move_err_default));
         Send(NoticePacket.Disconnect(new InterfaceText(ex.Message)));
     } finally {
+        // Ensure the session is always disconnected after migration attempt
         Disconnect();
     }
 }
Maple2.Server.Game/Manager/Field/FieldManager.State.cs (1)

613-618: LGTM: Added cube information sending for home maps.

The new code block in OnAddPlayer() method adds functionality to send farming and ranching cube information to players when they enter their home map. This is a good addition for supporting player housing features.

A minor optimization suggestion:

Consider extracting the LINQ query into a separate method for better readability and reusability. For example:

private List<PlotCube> GetLifeSkillCubes()
{
    return Plots.FirstOrDefault().Value.Cubes.Values
        .Where(x => x.HousingCategory is HousingCategory.Farming or HousingCategory.Ranching)
        .ToList();
}

Then you can use it in the OnAddPlayer() method:

if (MapId is Constant.DefaultHomeMapId)
{
    List<PlotCube> lifeSkillCubes = GetLifeSkillCubes();
    added.Session.Send(FunctionCubePacket.SendCubes(lifeSkillCubes));
}

This change would improve code organization and make it easier to reuse this logic if needed elsewhere.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8d1363d and 8f431cf.

⛔ Files ignored due to path filters (1)
  • Maple2.Server.World/Migrations/20240927044107_AddCubeSettings.cs is excluded by !Maple2.Server.World/Migrations/*
📒 Files selected for processing (15)
  • Maple2.Database/Context/MetadataContext.cs (3 hunks)
  • Maple2.Database/Model/Map/CubeHelper.cs (1 hunks)
  • Maple2.Database/Model/Map/HomeLayoutCube.cs (4 hunks)
  • Maple2.Database/Model/Map/UgcMapCube.cs (4 hunks)
  • Maple2.Database/Storage/Game/GameStorage.Map.cs (3 hunks)
  • Maple2.Database/Storage/Game/GameStorage.cs (1 hunks)
  • Maple2.Database/Storage/Metadata/FunctionCubeMetadataStorage.cs (1 hunks)
  • Maple2.File.Ingest/Mapper/FunctionCubeMapper.cs (1 hunks)
  • Maple2.File.Ingest/Program.cs (1 hunks)
  • Maple2.Model/Metadata/FunctionCubeMetadata.cs (1 hunks)
  • Maple2.Server.Core/Modules/DataDbModule.cs (1 hunks)
  • Maple2.Server.Game/Manager/Field/FieldManager.State.cs (3 hunks)
  • Maple2.Server.Game/Manager/HousingManager.cs (5 hunks)
  • Maple2.Server.Game/Packets/FunctionCubePacket.cs (1 hunks)
  • Maple2.Server.Game/Session/GameSession.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • Maple2.Database/Model/Map/CubeHelper.cs
  • Maple2.Database/Model/Map/HomeLayoutCube.cs
  • Maple2.Database/Model/Map/UgcMapCube.cs
  • Maple2.Server.Game/Manager/HousingManager.cs
  • Maple2.Server.Game/Packets/FunctionCubePacket.cs
🔇 Additional comments (21)
Maple2.Model/Metadata/FunctionCubeMetadata.cs (2)

1-10: LGTM! Well-structured record for FunctionCubeMetadata.

The overall structure and design of the FunctionCubeMetadata record look good. It appropriately encapsulates the necessary properties for managing function cubes, which aligns well with the PR objectives related to implementing house portals.


5-10: Verify the usage of FunctionCubeMetadata in the codebase.

As this is a new record type, it's important to ensure it's being used correctly in other parts of the codebase, particularly in the RequestCubeHandler.cs and LoadUgcMapHandler.cs files mentioned in the PR objectives.

Let's run a script to check its usage:

Maple2.Database/Storage/Metadata/FunctionCubeMetadataStorage.cs (4)

1-3: LGTM: Import statements are appropriate.

The import statements are relevant to the class being defined. They include necessary namespaces for attributes, database context, and metadata models.


5-5: LGTM: Namespace declaration is correct.

The namespace Maple2.Database.Storage is consistent with the file path and the expected structure for a storage-related class in the Maple2 database.


18-20: LGTM: TryGet method is well-implemented.

The TryGet method follows the common C# pattern for such methods. The use of the [NotNullWhen(true)] attribute is appropriate for null analysis, and the implementation is concise and efficient.


1-21: Overall, the implementation looks solid and aligns with the PR objectives.

This new FunctionCubeMetadataStorage class provides an efficient way to store and retrieve FunctionCubeMetadata, which could be crucial for implementing house portals as mentioned in the PR objectives. The class is well-structured, follows C# best practices, and should integrate well with the existing codebase.

To ensure this new class is properly integrated and used in the context of house portals, let's verify its usage:

Maple2.File.Ingest/Mapper/FunctionCubeMapper.cs (4)

1-5: LGTM: Import statements are appropriate.

The import statements are concise and relevant to the functionality of the FunctionCubeMapper class. They cover the necessary dependencies for IO operations, parsing, and metadata handling.


9-14: LGTM: Well-structured class definition and constructor.

The FunctionCubeMapper class is well-defined:

  • It properly inherits from TypeMapper<FunctionCubeMetadata>.
  • The constructor uses dependency injection for M2dReader, promoting flexibility and testability.
  • The parser field is correctly marked as private and readonly.

This structure follows good object-oriented design principles.


1-26: Great implementation aligning with PR objectives.

The FunctionCubeMapper class is well-implemented and aligns perfectly with the PR objectives:

  • It provides the necessary functionality for mapping function cubes, which is crucial for implementing house portals in the LoadUgcMapHandler.
  • The code is clean, well-organized, and follows C# best practices.
  • It adheres to the single responsibility principle by focusing solely on the mapping functionality.

This implementation is a solid foundation for the "Feat: portal cubes" feature and contributes directly to resolving issue #230.


1-26: Verify complete implementation of PR objectives.

While the FunctionCubeMapper class is well-implemented and contributes to the "Feat: portal cubes" feature, let's ensure all PR objectives are met:

  1. Verify the usage of FunctionCubeMapper in the LoadUgcMapHandler.
  2. Check for implementations related to spawn point handling, as mentioned in the linked issue.

To verify these points, please run the following script:

This script will help ensure that all aspects of the house portals feature, including portal cubes and spawn points, are properly implemented across the codebase.

Maple2.Server.Core/Modules/DataDbModule.cs (2)

49-49: LGTM: FunctionCubeMetadataStorage registration added correctly.

The addition of FunctionCubeMetadataStorage as a singleton is consistent with the existing pattern for other metadata storage types. This change aligns with the PR objective of implementing house portals, as function cubes could be integral to the portal functionality.


49-49: Verify related components for FunctionCubeMetadataStorage.

While the registration of FunctionCubeMetadataStorage is correct, it's important to ensure that all necessary components for the function cube feature are in place.

Please run the following script to check for the existence and usage of FunctionCubeMetadataStorage:

This will help ensure that the FunctionCubeMetadataStorage class is properly implemented and used throughout the codebase.

✅ Verification successful

Verification Successful: FunctionCubeMetadataStorage is properly implemented and integrated.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of FunctionCubeMetadataStorage

# Check if FunctionCubeMetadataStorage class exists
echo "Checking for FunctionCubeMetadataStorage class:"
rg --type csharp "class FunctionCubeMetadataStorage"

# Check for usage of FunctionCubeMetadataStorage
echo "\nChecking for usage of FunctionCubeMetadataStorage:"
rg --type csharp "FunctionCubeMetadataStorage"

# Check for any TODO comments related to function cubes or portals
echo "\nChecking for related TODO comments:"
rg --type csharp "TODO.*(?:function.*cube|portal)"

Length of output: 1677

Maple2.Database/Storage/Game/GameStorage.cs (2)

17-17: LGTM: New field added for function cube metadata.

The addition of the functionCubeMetadata field is consistent with the existing code structure and follows good practices for dependency injection.


Line range hint 1-71: Overall, the changes look good and align with the PR objectives.

The addition of the FunctionCubeMetadataStorage field and its integration into the constructor are consistent with the existing code structure and the goal of implementing house portals. These changes provide the necessary foundation for handling function cube metadata, which is likely related to the portal cube functionality mentioned in the PR objectives.

To ensure full implementation:

  1. Verify that the FunctionCubeMetadataStorage class is properly implemented and contains the necessary methods for managing portal cube data.
  2. Check if any additional methods in the GameStorage class need to be updated or added to utilize the new functionCubeMetadata field.
  3. Confirm that these changes are properly integrated with the RequestCubeHandler.cs and LoadUgcMapHandler.cs files mentioned in the PR objectives.
✅ Verification successful

Verification Successful: FunctionCubeMetadataStorage Integration Confirmed

The FunctionCubeMetadataStorage class exists and is properly integrated. The functionCubeMetadata field is utilized in GameStorage.Map.cs and HousingManager.cs as expected, ensuring functionality related to portal cubes is correctly implemented.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of FunctionCubeMetadataStorage and its usage

# Test 1: Check if FunctionCubeMetadataStorage class exists
echo "Checking for FunctionCubeMetadataStorage class:"
rg --type csharp "class FunctionCubeMetadataStorage"

# Test 2: Look for methods in GameStorage that use functionCubeMetadata
echo "\nChecking for methods using functionCubeMetadata in GameStorage:"
rg --type csharp "functionCubeMetadata\." Maple2.Database/Storage/Game/GameStorage.cs

# Test 3: Check for changes in RequestCubeHandler.cs related to portal cubes
echo "\nChecking for portal cube related changes in RequestCubeHandler.cs:"
rg --type csharp "portal.*cube" "**/RequestCubeHandler.cs"

# Test 4: Check for changes in LoadUgcMapHandler.cs related to portal entry points
echo "\nChecking for portal entry point related changes in LoadUgcMapHandler.cs:"
rg --type csharp "portal.*entry" "**/LoadUgcMapHandler.cs"

Length of output: 1097


Script:

#!/bin/bash
# Description: Locate RequestCubeHandler.cs and LoadUgcMapHandler.cs in the repository

echo "Searching for RequestCubeHandler.cs:"
fd "RequestCubeHandler\.cs$" || echo "RequestCubeHandler.cs not found."

echo "\nSearching for LoadUgcMapHandler.cs:"
fd "LoadUgcMapHandler\.cs$" || echo "LoadUgcMapHandler.cs not found."

echo "\nSearching for any usage of functionCubeMetadata outside GameStorage.cs:"
rg --type csharp "functionCubeMetadata\." --ignore-file .gitignore

Length of output: 1673

Maple2.Database/Context/MetadataContext.cs (3)

30-30: LGTM: New DbSet property for FunctionCubeMetadata

The addition of the FunctionCubeMetadata DbSet property is consistent with the existing pattern in the MetadataContext class and aligns with the PR objectives for implementing house portals.


54-54: LGTM: FunctionCubeMetadata configuration added to OnModelCreating

The addition of FunctionCubeMetadata configuration to the OnModelCreating method is correct and follows the established pattern for entity configurations in this class.


30-30: Summary: FunctionCubeMetadata integration aligns with PR objectives

The changes made to the MetadataContext class, including the addition of the FunctionCubeMetadata DbSet, its configuration method, and integration into OnModelCreating, are well-implemented and consistent with the existing code patterns. These modifications align with the PR objectives for implementing house portals, specifically addressing the task of handling the addition of a portal cube as mentioned in the linked issue #230.

To ensure that the FunctionCubeMetadata entity is properly integrated and there are no conflicts with existing code, please run the following verification script:

This script will help identify any potential issues with the integration of FunctionCubeMetadata across the codebase.

Also applies to: 54-54, 231-235

✅ Verification successful

Verification Successful: FunctionCubeMetadata integration confirmed

All references to FunctionCubeMetadata across the codebase are appropriate, with no duplicate table names or conflicts found in the OnModelCreating method. The integration aligns with the PR objectives and maintains consistency with existing code patterns.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify FunctionCubeMetadata integration and usage

# Check for any references to FunctionCubeMetadata in other files
echo "Checking for FunctionCubeMetadata references:"
rg --type csharp "FunctionCubeMetadata" --glob "!Maple2.Database/Context/MetadataContext.cs"

# Verify that there are no duplicate table names
echo "Checking for duplicate table names:"
rg --type csharp 'ToTable\("([^"]+)"\)' | sort | uniq -d

# Check for any potential conflicts in OnModelCreating method
echo "Checking for potential conflicts in OnModelCreating:"
rg --type csharp "OnModelCreating.*FunctionCubeMetadata" --glob "!Maple2.Database/Context/MetadataContext.cs"

Length of output: 3788

Maple2.Server.Game/Session/GameSession.cs (1)

65-65: LGTM: New property for FunctionCubeMetadata

The addition of the FunctionCubeMetadata property looks good. It follows the existing pattern for dependency injection in the class and uses the required modifier to ensure proper initialization.

Maple2.Server.Game/Manager/Field/FieldManager.State.cs (1)

48-48: LGTM: New method to retrieve field portals.

The GetPortals() method provides a clean way to access all portals in the field. This addition enhances the API of the FieldManager class, allowing other parts of the system to easily retrieve portal information.

Maple2.Database/Storage/Game/GameStorage.Map.cs (2)

170-177: Ensure Consistent InteractState Initialization After Saving Cubes

After saving cubes, the InteractState for each PlotCube is initialized. Verify that this initialization is necessary at this point and that it doesn't overwrite any state that should be preserved from earlier in the process.


222-226: Verify InteractState Correctness in Plot Conversion

When converting UgcMap.Cubes to Plot.Cubes, the InteractState is set based on the default state from FunctionCubeMetadata. Ensure that this correctly reflects the intended state for the cubes and that any existing state is not inadvertently overwritten.

Comment thread Maple2.File.Ingest/Program.cs
Comment thread Maple2.Server.Game/Manager/Field/FieldManager.State.cs
Comment thread Maple2.Database/Storage/Game/GameStorage.Map.cs
Comment thread Maple2.Database/Storage/Game/GameStorage.Map.cs
Comment thread Maple2.Database/Model/Map/CubeHelper.cs

@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: 1

🧹 Outside diff range and nitpick comments (1)
Maple2.Database/Extensions/CubeHelper.cs (1)

1-4: Enhance code clarity and maintainability.

To improve the code's readability and maintainability:

  1. Consider using fully qualified type names instead of aliases, unless there's a specific reason for the aliases.
  2. Add a using directive for the PlotCube type if it's from a different namespace.
  3. Add comments explaining the purpose of the CubeHelper class and its relationship to other parts of the system.

Example:

using Maple2.Model.Game;
using Maple2.Database.Model;

namespace Maple2.Database.Extensions;

/// <summary>
/// Provides helper methods for working with cube-related settings in the database layer.
/// </summary>
internal static class CubeHelper
{
    // ... existing code ...
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8f431cf and 5025da1.

📒 Files selected for processing (1)
  • Maple2.Database/Extensions/CubeHelper.cs (1 hunks)
🔇 Additional comments (1)
Maple2.Database/Extensions/CubeHelper.cs (1)

5-7: LGTM: Appropriate namespace and class declaration.

The CubeHelper class is correctly placed in the Maple2.Database.Extensions namespace. The internal static modifiers are appropriate for a utility class that should only be accessible within the assembly.

Comment thread Maple2.Database/Extensions/CubeHelper.cs
@AngeloTadeucci
AngeloTadeucci merged commit d1b4362 into master Sep 28, 2024
@AngeloTadeucci
AngeloTadeucci deleted the function-cubes branch October 4, 2024 17:19
This was referenced Oct 7, 2024
@coderabbitai coderabbitai Bot mentioned this pull request Oct 28, 2024
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.

Implement House Portals

2 participants