Skip to content

Conversation

@Letale-vc
Copy link

This pull request introduces a customizable ignore rules system for minimap icons, allowing users to define their own rules for hiding entities based on metadata or name patterns. The system includes a new UI section in the plugin settings, supports rule persistence in a config file, and integrates with the icon rendering logic to filter out entities according to user-defined rules.

Custom Ignore Rules System:

  • Added a new CustomIgnoreSettings section to the plugin settings UI, allowing users to enable custom ignore rules, add new rules, reload rules from file, and open the config folder. (MapIconsSettings.cs, IgnoreRules/CustomIgnoreSettings.cs) [1] [2]
  • Introduced the IgnoreRule and IgnoreRuleType classes to represent individual ignore rules, supporting various match types (exact, starts with, contains) for both metadata and entity names. (IgnoreRules/IgnoreRule.cs)
  • Implemented IgnoreRulesManager to manage loading, saving, parsing, and applying custom ignore rules from a persistent config file (custom_ignore_rules.txt). (IgnoreRules/IgnoreRulesManager.cs, config/custom_ignore_rules.txt) [1] [2]

Integration with Plugin Logic:

  • Integrated the custom ignore rules system into the icon rendering pipeline, so entities matching any enabled custom rule are excluded from rendering. (MinimapIcons.cs) [1] [2]
  • Hooked up UI event handlers for adding, reloading, and managing custom ignore rules, ensuring changes are reflected immediately and persisted. (MinimapIcons.cs)

These changes make it much easier for users to control which entities appear on their minimap by adding, disabling, or removing custom ignore rules through the plugin's settings interface.

Copilot AI review requested due to automatic review settings October 23, 2025 16:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a customizable ignore rules system that allows users to define their own rules for hiding entities from the minimap through a persistent configuration file and UI controls.

Key Changes:

  • Adds a new ignore rules system supporting metadata and entity name matching with multiple match types (exact, starts with, contains)
  • Implements UI controls in plugin settings for managing custom ignore rules
  • Integrates the custom rules into the icon rendering pipeline to filter entities

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
config/custom_ignore_rules.txt Template configuration file with documentation for custom ignore rule syntax
MinimapIcons.cs Integrated custom ignore rules manager and wired up UI event handlers for rule management
MapIconsSettings.cs Added CustomIgnoreSettings section to plugin settings menu
IgnoreRules/IgnoreRulesManager.cs Core manager for loading, saving, parsing, and applying custom ignore rules with caching
IgnoreRules/IgnoreRule.cs Rule representation with matching logic for different rule types
IgnoreRules/CustomIgnoreSettings.cs UI settings definition for custom ignore rules controls

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -0,0 +1,25 @@
# Custom Ignore Rules for MinimapIcons
#
# Rule formats:
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'formats' to 'format' to match line 63.

Suggested change
# Rule formats:
# Rule format:

Copilot uses AI. Check for mistakes.

public override bool Initialise()
{
_ignoreRulesManager = new IgnoreRulesManager(DirectoryFullName);
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Consider adding null check or error handling for IgnoreRulesManager initialization. If initialization fails (e.g., directory creation issues), the plugin will crash on first use of _ignoreRulesManager.

Copilot uses AI. Check for mistakes.
Comment on lines +191 to +192
var configPath = System.IO.Path.Combine(DirectoryFullName, "config");
Process.Start("explorer.exe", configPath);
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Opening the config folder assumes Windows (explorer.exe). This will fail on other operating systems. Consider using a cross-platform approach or checking the OS before launching explorer.exe.

Copilot uses AI. Check for mistakes.
if (!Settings.DrawMonsters && icon.Entity.Type == EntityType.Monster)
continue;


Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Remove extra blank line before comment for consistency with the codebase style.

Suggested change

Copilot uses AI. Check for mistakes.
continue;
}

// hardcoded ignore list
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Capitalize comment to 'Hardcoded ignore list' for consistency with comment style on line 306.

Suggested change
// hardcoded ignore list
// Hardcoded ignore list

Copilot uses AI. Check for mistakes.
if (IgnoreCache.GetOrAdd(icon.Entity.Path, () => Ignored.Any(x => icon.Entity.Path.StartsWith(x))))
continue;


Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Remove extra blank line for consistency with the codebase style.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +52
catch
{
// Silent fail - error will be handled by caller
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Catching all exceptions without logging prevents debugging of file parsing issues. Consider logging the exception details or at minimum the exception type to help users diagnose configuration file problems.

Suggested change
catch
{
// Silent fail - error will be handled by caller
catch (Exception ex)
{
Console.Error.WriteLine($"[IgnoreRulesManager] Failed to load custom rules from '{_customRulesFilePath}': {ex.GetType().Name}: {ex.Message}");

Copilot uses AI. Check for mistakes.
var lines = new List<string>
{
"# Custom Ignore Rules for MinimapIcons",
"# Format examples:",
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Inconsistency between documentation here ('Format examples:') and the template file ('Rule formats:'). They should use the same wording for consistency.

Suggested change
"# Format examples:",
"# Rule formats:",

Copilot uses AI. Check for mistakes.
Comment on lines +92 to +95
catch
{
// Silent fail - error will be handled by caller
}
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Catching all exceptions without logging prevents debugging of file save issues. Consider logging the exception details to help users diagnose permission or disk space problems.

Copilot uses AI. Check for mistakes.
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.

1 participant