Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added RailJack turrets #644

Merged
merged 6 commits into from
Oct 21, 2024

Conversation

SlayerOrnstein
Copy link
Member

@SlayerOrnstein SlayerOrnstein commented Oct 20, 2024

What did you fix?

Include Railjack turrets in weapon data, only turrets seem to be available in the export


Reproduction steps


Evidence/screenshot/link to line

Considerations

  • Does this contain a new dependency? No
  • Does this introduce opinionated data formatting or manual data entry? Yes
  • Does this pr include updated data files in a separate commit that can be reverted for a clean code-only pr? Yes
  • Have I run the linter? Yes
  • Is is a bug fix, feature request, or enhancement? Feature

Summary by CodeRabbit

  • New Features

    • Enhanced categorization for weapons, adding 'Railjack' items based on specific slot values.
    • Improved data aggregation for weapon and upgrade categories, ensuring comprehensive results.
    • Introduced a new item type for 'Railjack Turret' to expand gameplay categorization.
    • Added multiple new weapon entries under the "CrewShip" category, including various tiers for different weapon types.
  • Bug Fixes

    • Adjusted logic to ensure accurate classification of items in the weapons and upgrades categories.
  • Documentation

    • Minor updates to comments and formatting for clarity.

@SlayerOrnstein SlayerOrnstein requested a review from a team as a code owner October 20, 2024 10:52
Copy link

coderabbitai bot commented Oct 20, 2024

Walkthrough

The changes in this pull request enhance the categorization and data handling of weapon and upgrade items within the application. A new condition is added to the addCategory method in build/parser.mjs to classify items with a slot value of 14 as 'Railjack'. In build/scraper.mjs, modifications to the fetchResources method allow for better aggregation of weapon and upgrade data. Additionally, a new item type for 'Railjack Turret' is introduced in config/itemTypes.json, expanding the existing item types. TypeScript declarations in index.d.ts are also comprehensively restored.

Changes

File Change Summary
build/parser.mjs Modified addCategory method to categorize items with slot value 14 as 'Railjack'; updated addImageName for naming conventions.
build/scraper.mjs Updated fetchResources method to include additional weapon data for 'Weapons' category and mapped raw.ExportModSet for 'Upgrades'.
config/itemTypes.json Added new item type: {"id": "Weapons/CrewShip", "regex": true, "name": "Railjack Turret"}.
index.d.ts Restored multiple interfaces, classes, and types related to item definitions, maintaining original structures and documentation.
data/cache/.images.json Added multiple new weapon entries under "CrewShip" category, including various tiers for different weapon types.

Poem

In the land where weapons gleam,
A Railjack Turret reigns supreme.
With categories anew,
Our data's fresh and true,
Hopping through code, we chase our dream! 🐇✨


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
build/scraper.mjs (2)

96-97: LGTM! Consider adding a comment for clarity.

The implementation correctly adds both regular weapons and Railjack weapons to the data array, addressing the gap in available weapon data as mentioned in the PR objectives.

Consider adding a brief comment to explain the purpose of this addition:

// Include both regular weapons and Railjack weapons in the data array
if (category === 'Weapons') data.push(...raw.ExportWeapons, ...raw.ExportRailjackWeapons);

Line range hint 98-104: LGTM! Consider consistent type assignment for all upgrade items.

The implementation correctly adds various types of upgrades to the data array and improves data categorization by adding a 'type' property to mod sets.

For consistency, consider adding type properties to avionics and focus upgrades as well:

if (category === 'Upgrades') {
  const modSets = raw.ExportModSet.map((modSet) => ({ ...modSet, type: 'Mod Set' }));
  const avionics = raw.ExportAvionics.map((avionic) => ({ ...avionic, type: 'Avionic' }));
  const focusUpgrades = raw.ExportFocusUpgrades.map((upgrade) => ({ ...upgrade, type: 'Focus Upgrade' }));
  data.push(...modSets, ...avionics, ...focusUpgrades);
}

This approach ensures that all upgrade items have a consistent structure with a 'type' property.

build/parser.mjs (2)

655-655: LGTM! Consider adding a comment for clarity.

The addition of the condition else if (item.slot === 14) item.category = 'Railjack'; correctly implements the categorization of Railjack turrets as per the PR objective. This change is consistent with the existing structure and logic of the method.

Consider adding a brief comment explaining that slot 14 corresponds to Railjack turrets. This would improve code readability and make it easier for future maintainers to understand the significance of this specific slot number. For example:

+ // Slot 14 corresponds to Railjack turrets
else if (item.slot === 14) item.category = 'Railjack';

Line range hint 1-1026: Consider future refactoring opportunities (not required for this PR).

The Parser class is quite complex with numerous methods and responsibilities. While not directly related to this PR, future improvements could include:

  1. Breaking down large methods (e.g., filter, addComponents) into smaller, more focused functions.
  2. Adding more inline documentation to explain complex logic.
  3. Considering the use of TypeScript for improved type safety and self-documentation.

These suggestions are for future consideration and are not necessary for the current PR.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5edca7a and a7178fc.

📒 Files selected for processing (3)
  • build/parser.mjs (1 hunks)
  • build/scraper.mjs (1 hunks)
  • config/itemTypes.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (5)
build/scraper.mjs (1)

Line range hint 96-104: Overall, the changes effectively address the PR objectives.

The modifications to the fetchResources method successfully include Railjack turrets in the weapon data and enhance item categorization for upgrades. The implementation is correct, uses modern JavaScript features, and maintains good code quality.

Consider the minor suggestions provided in the previous comments to further improve clarity and consistency.

config/itemTypes.json (3)

1024-1028: New entry for Railjack Turret looks good!

The new entry for "Railjack Turret" has been added correctly:

  1. It follows the existing format and structure of other entries.
  2. The placement within the array seems logical, as it's near other weapon-related entries.
  3. The regex flag is set to true, which is appropriate for matching multiple items.
  4. The name "Railjack Turret" is clear and consistent with the naming convention used in other entries.
  5. This addition aligns with the PR objective of including Railjack turrets in the weapon data.

Line range hint 1-1028: LGTM! File structure and content are well-maintained.

The addition of the Railjack Turret entry maintains the overall structure and consistency of the itemTypes.json file. The file continues to provide a comprehensive and well-organized list of item types for various game elements.


1024-1028: Verify integration with existing item type handling

While the new entry for "Railjack Turret" is correctly formatted and placed, it's important to ensure it integrates smoothly with the rest of the system:

  1. There don't appear to be any direct conflicts with existing entries, but it's worth double-checking that no other entry uses a similar pattern that might cause unexpected categorization.
  2. The addition of this new item type might require updates in other parts of the codebase that handle item categorization or display.
  3. Any parsing or filtering logic that relies on item types should be reviewed to ensure it can handle this new category correctly.

To confirm the proper integration of this new item type, you can run the following script:

This script will help identify any potential conflicts in item type definitions, files that might need updating to handle the new item type, and any existing references to Railjack turrets that might need adjustment.

build/parser.mjs (1)

Line range hint 1-1026: Summary: PR successfully implements Railjack turret categorization.

The changes in this PR effectively address the stated objective of including Railjack turrets in the weapon data. The implementation is minimal and focused, integrating well with the existing code structure. While there are opportunities for future refactoring to improve the overall code quality, these are not necessary for the current PR.

Overall, the changes look good and achieve the desired outcome without introducing unnecessary complexity or potential issues.

Copy link

@coderabbitai coderabbitai bot left a comment

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 (4)
index.d.ts (4)

65-70: Clarify the use of 'SentinelWeapons' in 'ItemsOptions.category'.

The property category is defined as Array<Category | 'SentinelWeapons'>. Since 'SentinelWeapons' is already included in the Category type as per line 693, including it separately may be redundant. Consider removing 'SentinelWeapons' from the union type for clarity.


276-280: Unused property 'buffSet' in 'ModSet' interface.

The property buffSet is set to true, but it's unclear how it is used within the application. If this property is not utilized, consider removing it to simplify the interface.


675-694: Redundancy in 'Category' type definition.

The Category type includes both explicit categories and Weapon['category'], which may overlap with already listed categories like 'Primary', 'Secondary', etc. Consider consolidating the categories to avoid duplication.


386-455: 'Component' interface has many optional properties, leading to potential complexity.

The Component interface includes numerous optional properties, some of which may not be relevant to all components. Evaluate if the interface can be broken down into more specific interfaces or if some properties can be moved to more appropriate interfaces to enhance maintainability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a7178fc and 788fe17.

📒 Files selected for processing (1)
  • index.d.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (4)
index.d.ts (4)

243-253: Ensure consistency of 'tradable' property in 'Arcane' interface.

The Arcane interface explicitly sets tradable: true, but since it doesn't extend Droppable like other items, it might be missing other properties related to drops and tradability. Verify whether Arcane should extend Droppable to maintain consistency across tradable items.


302-318: Potential deprecation warning for 'isUtility' in 'Mod' interface.

There's a comment indicating that isUtility is deprecated and possibly replaced by isExilus. Ensure that any references to isUtility are updated to isExilus throughout the codebase to avoid confusion.


918-939: Update 'SystemName' to include any new star chart locations.

Ensure that the SystemName type includes all current locations in the game's star chart. If new systems have been added since this code was written, they should be included to keep the type up to date.


704-705: Confirm all projectile types are accounted for in 'Projectile' type.

The Projectile type includes 'Discharge', 'Hitscan', 'Projectile', and 'Thrown'. Verify that there are no additional projectile types needed, such as 'Beam' or 'Continuous', to ensure comprehensive type coverage.

✅ Verification successful

All projectile types are accounted for in the 'Projectile' type.

  • The Projectile type includes additional categories: Common, Uncommon, Rare, and Legendary.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all unique values assigned to the 'projectile' property in the codebase.

rg "projectile: ['\"][^'\"]+['\"]" -o | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/" | sort | uniq

Length of output: 106


Script:

#!/bin/bash
# Description: Enhanced search for all unique values assigned to the 'projectile' property in the codebase.
# This script accounts for possible variations in spacing and different quotation marks.

rg -i "projectile\s*:\s*['\"][^'\"]+['\"]" -o | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/" | sort | uniq

Length of output: 114


Script:

#!/bin/bash
# Description: Extract all defined values within the 'Projectile' type from index.d.ts

rg -A 5 "type Projectile" index.d.ts | grep -oE "'[^']+'" | sed "s/'//g" | sort | uniq

Length of output: 175

index.d.ts Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (1)
index.d.ts (1)

23-27: Consider adding JSDoc comments for the Items class

The Items class extends Array<Item> and includes additional properties. To improve documentation, consider adding JSDoc comments to describe the purpose of this class and its properties, especially the options and i18n fields.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 788fe17 and 55eb1b4.

📒 Files selected for processing (1)
  • index.d.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (4)
index.d.ts (4)

3-21: LGTM: ColorMap and RawColors interfaces look well-defined

The ColorMap and RawColors interfaces are clearly defined and provide a good structure for color-related data in the Warframe context. The use of optional properties allows for flexibility in color definitions.


29-32: LGTM: ModResolveable, Palette, PaletteEntry, and Pixel interfaces are well-structured

These interfaces provide a clear structure for mod-related data, color palettes, and pixel information. The Pixel class, in particular, has a good set of methods for working with color data.

Also applies to: 34-49, 51-63


72-97: LGTM: Comprehensive Item type definition

The Item type union covers a wide range of item types in the game, providing good type coverage for various scenarios.


1-941: Overall assessment: Well-structured with room for improvement

The index.d.ts file provides a comprehensive set of type definitions for the Warframe game items and related concepts. It offers a solid foundation for type-safe development within the module. However, there are several opportunities to enhance the code:

  1. Implement enums for string literal unions (e.g., ModType, Polarity) to improve type safety and maintainability.
  2. Use interface extension and generics to reduce duplication in related interfaces, particularly for weapon-related types.
  3. Break down large union types (e.g., Type) into smaller, more manageable categories.
  4. Add JSDoc comments to improve documentation, especially for complex types and classes.
  5. Make small adjustments for consistency and correctness, such as making fusionPoints optional in the Resource interface.

Implementing these changes will result in a more robust, maintainable, and developer-friendly type definition file.

index.d.ts Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
index.d.ts Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

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)
data/cache/.images.json (1)

57326-57905: Approve the addition of CrewShip weapon data with suggestions for improvement

The addition of CrewShip weapon data is comprehensive and well-structured. It aligns with the PR objective of including Railjack turrets in the weapon data. However, I have a few suggestions for potential improvements:

  1. Consider using a more compact representation for the repetitive data. For example, you could group weapons by type and tier, reducing redundancy.

  2. Verify the consistency of hash values within weapon types. While this appears intentional, it's worth confirming that identical hashes for different tiers of the same weapon type are correct.

  3. The isComponent field is consistently set to false for all entries. If this is always the case for CrewShip weapons, consider omitting this field to reduce data size, or document why it's necessary to explicitly set it to false.

Would you like assistance in implementing any of these suggestions?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a9e36db and e05236a.

⛔ Files ignored due to path filters (11)
  • data/img/apoc.png is excluded by !**/*.png
  • data/img/bahul-decoy.png is excluded by !**/*.png
  • data/img/carcinnox.png is excluded by !**/*.png
  • data/img/cryophon.png is excluded by !**/*.png
  • data/img/glazio.png is excluded by !**/*.png
  • data/img/jasvin-smoke.png is excluded by !**/*.png
  • data/img/laith.png is excluded by !**/*.png
  • data/img/photor.png is excluded by !**/*.png
  • data/img/pulsar.png is excluded by !**/*.png
  • data/img/talyn.png is excluded by !**/*.png
  • data/img/vort.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • build/parser.mjs (3 hunks)
  • data/cache/.images.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
data/cache/.images.json (1)

57326-57905: Summary: Approve the CrewShip weapon data additions with suggestions

The additions to data/cache/.images.json successfully implement the PR objective of including Railjack turrets in the weapon data. The structure is consistent and comprehensive, covering various weapon types, manufacturers, and tiers.

Key points:

  1. The data structure is well-organized and consistent.
  2. All entries include the required fields: uniqueName, hash, and isComponent.
  3. The additions cover multiple weapon types, manufacturers (Lavan, Vidar, Zekti), and tiers (A, B, C).

Suggestions for improvement:

  1. Consider a more compact data representation to reduce redundancy.
  2. Verify the intentional use of identical hashes for different tiers of the same weapon type.
  3. Evaluate the necessity of the isComponent field, which is consistently set to false.
  4. Run the provided verification script to ensure completeness of the weapon data.

Overall, this is a solid addition to the weapon data, aligning well with the PR objectives. Please consider the suggestions for potential optimizations and verifications.

build/parser.mjs (2)

Line range hint 542-581: LGTM. Verify impact on existing image naming conventions.

The new conditions for 'Arcane', 'Blueprint', and 'CrewShipWeapons' items improve the image naming logic. These changes align with the PR objective of including Railjack turrets in the weapon data.

To ensure these changes don't unintentionally affect other items, please run the following script:


670-670: LGTM. Verify consistency with existing weapon categories.

The new condition for categorizing items with slot value 14 as 'Railjack' aligns with the PR objective of including Railjack turrets in the weapon data.

To ensure this categorization is consistent and doesn't conflict with existing categories, please run the following script:

✅ Verification successful

Railjack category assignment verified and consistent.

The new condition categorizing items with slot value 14 as 'Railjack' aligns with existing weapon categorization logic and does not conflict with other categories.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency in weapon categorization

# Test: Look for other occurrences of slot-based categorization
rg "item\.slot\s*===?\s*\d+" -A 5

# Test: Check for any existing 'Railjack' categories
rg "category\s*=\s*['\"]\s*Railjack" -A 5

Length of output: 1479

data/cache/.images.json Show resolved Hide resolved
@SlayerOrnstein SlayerOrnstein added the Scope: Data How data is represented or cleaned up label Oct 20, 2024
Copy link
Member

@TobiTenno TobiTenno left a comment

Choose a reason for hiding this comment

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

i don't love the types reformat, but the rest is fine

@TobiTenno TobiTenno merged commit 53810e3 into WFCD:master Oct 21, 2024
10 checks passed
@wfcd-bot-boi
Copy link
Collaborator

🎉 This PR is included in version 1.1264.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@SlayerOrnstein SlayerOrnstein deleted the feat-railjack-armaments branch October 21, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Scope: Data How data is represented or cleaned up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants