feat(webui): more equipment #826

Merged
AMelonInsideLemon merged 3 commits from webui-more-equipment into main 2025-01-19 06:03:34 -08:00
AMelonInsideLemon commented 2025-01-19 05:36:38 -08:00 (Migrated from github.com)

Closes #811 Closes #809 Closes #620 Closes #440

Closes #811 Closes #809 Closes #620 Closes #440
coderabbitai[bot] commented 2025-01-19 05:36:44 -08:00 (Migrated from github.com)

Warning

Rate limit exceeded

@AMelonInsideLemon has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 56 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 425ec568ee and 463a7d8f14.

📒 Files selected for processing (1)
  • src/controllers/custom/addItemsController.ts (1 hunks)

Walkthrough

The pull request introduces comprehensive changes across multiple files to expand the inventory and equipment management system. The modifications include adding support for new item types such as SpaceSuits, SpaceGuns, SpaceMelee, Sentinels, SentinelWeapons, OperatorAmps, and Hoverboards. The changes span several key files including the sell controller, add items controller, item lists controller, purchase helpers, inventory service, and the web UI (HTML and JavaScript). The updates involve modifying interfaces, enums, and functions to accommodate these new item categories, ensuring consistent handling across the application's inventory management system.

Assessment against linked issues

Objective Addressed Explanation
Add K-Drive support to WebUI
Modular K-Drive implementation The changes include Hoverboards/K-Drives in the inventory system without complex adding mechanisms

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- This is an auto-generated comment: rate limited by coderabbit.ai --> > [!WARNING] > ## Rate limit exceeded > > @AMelonInsideLemon has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **21 minutes and 56 seconds** before requesting another review. > > <details> > <summary>⌛ How to resolve this issue?</summary> > > After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. > > We recommend that you space out your commits to avoid hitting the rate limit. > > </details> > > > <details> > <summary>🚦 How do rate limits work?</summary> > > CodeRabbit enforces hourly rate limits for each developer per organization. > > Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. > > Please see our [FAQ](https://docs.coderabbit.ai/faq) for further information. > > </details> > > <details> > <summary>📥 Commits</summary> > > Reviewing files that changed from the base of the PR and between 425ec568ee2c50b19a36f034ee69414569c0568a and 463a7d8f14e9c277d7a1934634eb5b633774b757. > > </details> > > <details> > <summary>📒 Files selected for processing (1)</summary> > > * `src/controllers/custom/addItemsController.ts` (1 hunks) > > </details> <!-- end of auto-generated comment: rate limited by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough The pull request introduces comprehensive changes across multiple files to expand the inventory and equipment management system. The modifications include adding support for new item types such as SpaceSuits, SpaceGuns, SpaceMelee, Sentinels, SentinelWeapons, OperatorAmps, and Hoverboards. The changes span several key files including the sell controller, add items controller, item lists controller, purchase helpers, inventory service, and the web UI (HTML and JavaScript). The updates involve modifying interfaces, enums, and functions to accommodate these new item categories, ensuring consistent handling across the application's inventory management system. ## Assessment against linked issues | Objective | Addressed | Explanation | |----------------------------------------|-----------|-----------------------------------------------------------------------------| | Add K-Drive support to WebUI | ✅ | | | Modular K-Drive implementation | ✅ | The changes include Hoverboards/K-Drives in the inventory system without complex adding mechanisms | <!-- walkthrough_end --> <!-- internal state start --> <!-- FAHghAtBAEAqAWBLAztF0CGA7TBXALgPYQDmAplmQE4b5kAm0AxoQLasX4Bc0ADldEIAjAFZkm+RADcyqIQE9mhetQxChifADoMiaFAB8wY+CjGAxOegAFAErQAyrnYYq84wjJ9cAGx/QqMgBHXFl8aEl8HwZoACIAMzJaAAoAdzIhXEQASh5WQkDoYKzeDix8WOhUjFRkXCFWTTpGBQj4L1xkamgAQQBZMh9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xFCATTmfmeslhPPF6QIAFgrLCvArY3wsq+9U+ljSRIn0v4dk4qplgE4AIhON9CpKfx96YCL+ypNMaOihHrdTx8gPBlSQUGaglBbAlQZwK0DcDCByU3AaAOSDpTMpCubKawMyD5S1BhU+anFMz4JSF+l/HqMlLdE48AxsgdTmNSkY5TlBb4VQXnAanFSvOnUncPb1PFsJKpOCaqblNqlDSCpRU9AWf054PckpXnGMf6PyYS9ZpdWfqTVPYHDT1BY0ubttKV419ppsgfaQXhYELTjpy0+anaToigAGIeWdUepA4iBk04ukfiAZCMiCDFAFkZQFZA0A2R5I9kN6VAF4jXMAA+pMGQBwyBslcBgHDJZRsY7IDkRSKRldAAB2fYLaAwCnAjR1oOCc+Q9BwSDgeMpgAcCEC2gTgRo20GaFtAc48ZdMpgOTLglGivACkd6a6CODkzOZJwA4InCOCczrQQgFmRgCNEnB4g1oI0a6ETgnBbQroM0K6DgkqymAZMkWSOlek4zdImgBGVjGRnVFUZ9AOGUxCxlAA= --> <!-- internal state end --> <!-- tips_start --> --- 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? <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. ([Beta](https://docs.coderabbit.ai/early-access#beta)) - `@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. ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-01-19 05:39:28 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 4

🧹 Nitpick comments (6)
src/helpers/purchaseHelpers.ts (2)

14-25: Enhance type safety for product categories.

Consider using an enum or union type for product categories instead of string literals to prevent typos and ensure type safety.

+export type ProductCategory =
+  | "Suits"
+  | "Pistols"
+  | "Melee"
+  | "LongGuns"
+  | "SpaceSuits"
+  | "SpaceGuns"
+  | "SpaceMelee"
+  | "Sentinels"
+  | "SentinelWeapons"
+  | "MechSuits";

-export const productCategoryToSlotName: Record<string, SlotNames> = {
+export const productCategoryToSlotName: Record<ProductCategory, SlotNames> = {

14-25: Add JSDoc documentation for the mapping constant.

Document the purpose and usage of this mapping to improve maintainability.

+/**
+ * Maps product categories to their corresponding inventory slots.
+ * Used by controllers to determine the appropriate slot for different item types.
+ * @example
+ * const slot = productCategoryToSlotName["Suits"]; // Returns InventorySlot.SUITS
+ */
export const productCategoryToSlotName: Record<string, SlotNames> = {
src/controllers/api/sellController.ts (1)

148-154: Add type safety for inventory categories.

The ISellRequest interface should align with the inventory model to prevent runtime errors.

+import { InventoryModel } from '@/src/models/inventory';

+type InventoryItemTypes = {
+    [K in keyof InventoryModel]: InventoryModel[K] extends any[] ? K : never;
+}[keyof InventoryModel];

 interface ISellRequest {
     Items: {
-        SpaceSuits?: ISellItem[];
-        SpaceGuns?: ISellItem[];
-        SpaceMelee?: ISellItem[];
-        Sentinels?: ISellItem[];
-        SentinelWeapons?: ISellItem[];
-        OperatorAmps?: ISellItem[];
-        Hoverboards?: ISellItem[];
+        [K in InventoryItemTypes]?: ISellItem[];
     };
src/controllers/custom/getItemListsController.ts (2)

54-60: Improve path-based filtering logic.

Using string splits for path filtering is fragile. Consider using a more robust approach.

+const MODULAR_PATHS = {
+    OPERATOR_AMPLIFIERS: '/Lotus/Weapons/OperatorAmplifiers',
+    SU_MODULAR_SECONDARY: '/Lotus/Weapons/SUModularSecondarySet1',
+    SU_MODULAR_PRIMARY: '/Lotus/Weapons/SUModularPrimarySet1',
+    INF_KIT_GUN: '/Lotus/Weapons/InfKitGun',
+    HOVERBOARD_PARTS: '/Lotus/Weapons/HoverboardParts'
+};

-if (
-    uniqueName.split("/")[4] == "OperatorAmplifiers" ||
-    uniqueName.split("/")[5] == "SUModularSecondarySet1" ||
-    uniqueName.split("/")[5] == "SUModularPrimarySet1" ||
-    uniqueName.split("/")[5] == "InfKitGun" ||
-    uniqueName.split("/")[5] == "HoverboardParts"
-) {
+if (Object.values(MODULAR_PATHS).some(path => uniqueName.startsWith(path))) {

27-34: Type-safe initialization of response object.

Initialize the response object with a type-safe structure to prevent runtime errors.

+type ItemListResponse = {
+    [K in 'LongGuns' | 'Melee' | 'ModularParts' | 'Pistols' | 'Sentinels' |
+        'SentinelWeapons' | 'SpaceGuns' | 'SpaceMelee' | 'SpaceSuits' | 'Suits']: ListedItem[]
+};

-const res: Record<string, ListedItem[]> = {};
+const res = {} as ItemListResponse;
static/webui/script.js (1)

Line range hint 548-565: Functions refactored for better reusability.

The addMissingEquipment and maxRankAllEquipment functions have been generalized to handle multiple equipment categories, improving code maintainability.

Consider extracting the XP calculation logic into a separate function to avoid duplication:

+function getMaxXPForCategory(category) {
+    return category === "Suits" ||
+           category === "SpaceSuits" ||
+           category === "Sentinels" ||
+           category === "Hoverboards"
+        ? 1_600_000
+        : 800_000;
+}

 function maxRankAllEquipment(categories) {
     // ...
-    const maxXP =
-        category === "Suits" ||
-        category === "SpaceSuits" ||
-        category === "Sentinels" ||
-        category === "Hoverboards"
-            ? 1_600_000
-            : 800_000;
+    const maxXP = getMaxXPForCategory(category);
     // ...
 }

Also applies to: 569-620

🧰 Tools
🪛 eslint

[error] 548-548: 'addMissingEquipment' is defined but never used.

(@typescript-eslint/no-unused-vars)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c99b748dc and ad47be9a26.

📒 Files selected for processing (7)
  • src/controllers/api/sellController.ts (2 hunks)
  • src/controllers/custom/addItemsController.ts (2 hunks)
  • src/controllers/custom/getItemListsController.ts (2 hunks)
  • src/helpers/purchaseHelpers.ts (2 hunks)
  • src/services/inventoryService.ts (1 hunks)
  • static/webui/index.html (6 hunks)
  • static/webui/script.js (8 hunks)
🧰 Additional context used
🪛 eslint
static/webui/script.js

[error] 505-505: 'doAcquireEquipment' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 531-531: '$' is not defined.

(no-undef)


[error] 532-532: '$' is not defined.

(no-undef)


[error] 548-548: 'addMissingEquipment' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 569-569: 'maxRankAllEquipment' is defined but never used.

(@typescript-eslint/no-unused-vars)


[error] 570-570: '$' is not defined.

(no-undef)

🔇 Additional comments (10)
src/services/inventoryService.ts (1)

368-368: LGTM! XP tracking added for sentinel weapons.

The addition of XP: 0 initialization for sentinel weapons aligns with the XP tracking pattern used for other equipment types in the system.

Let's verify that all equipment types consistently initialize XP:

Verification successful

Verified: XP initialization is consistent across all combat equipment

The addition of XP: 0 for sentinel weapons matches the existing pattern where all combat equipment (Sentinels, Suits, MechSuits, SpaceSuits) initializes XP to 0, while cosmetic and utility items correctly omit XP tracking.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify XP initialization consistency across equipment types
# Test: Search for equipment creation patterns. Expect: All equipment types initialize XP to 0

rg -A 1 "push\(\{.*ItemType:" src/services/inventoryService.ts

Length of output: 1320

static/webui/script.js (5)

152-157: LGTM! New equipment types added to itemMap.

The additions are well-structured and maintain consistency with existing entries.


197-209: LGTM! Equipment categories array updated.

The array of equipment categories is properly structured and includes all new equipment types.


220-226: LGTM! ModularParts handling added.

The implementation correctly handles the display of modular parts in the equipment list.


531-533: LGTM! Input validation handler added.

The jQuery event handler properly removes the 'is-invalid' class on input, improving user experience.

🧰 Tools
🪛 eslint

[error] 531-531: '$' is not defined.

(no-undef)


[error] 532-532: '$' is not defined.

(no-undef)


Line range hint 505-527: Function generalized to handle all equipment types.

The doAcquireEquipment function has been refactored to handle any equipment category, improving code reusability.

Let's verify that all equipment types are properly handled:

Verification successful

Generalized equipment handling verified successfully

The function is properly generalized and consistently used across all 9 equipment categories (Regular, Space, and Sentinel equipment types) in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify equipment type handling
# Test: Search for equipment type references. Expect: All equipment types use doAcquireEquipment

rg "doAcquireEquipment\(" static/webui/

Length of output: 1406

static/webui/index.html (4)

102-103: LGTM! Form submissions updated consistently.

All equipment acquisition forms have been updated to use the generalized doAcquireEquipment function.

Also applies to: 116-119, 132-135, 146-149


157-254: LGTM! New equipment sections added with consistent structure.

The new sections for Archwing, Sentinel, Amp, and K-Drive equipment follow the established pattern and maintain UI consistency.


257-273: LGTM! Bulk actions updated for new equipment types.

The bulk actions section has been properly updated to include all new equipment categories.


497-506: LGTM! Datalist elements added for new equipment types.

All necessary datalist elements have been added to support the new equipment types.

**Actionable comments posted: 4** <details> <summary>🧹 Nitpick comments (6)</summary><blockquote> <details> <summary>src/helpers/purchaseHelpers.ts (2)</summary><blockquote> `14-25`: **Enhance type safety for product categories.** Consider using an enum or union type for product categories instead of string literals to prevent typos and ensure type safety. ```diff +export type ProductCategory = + | "Suits" + | "Pistols" + | "Melee" + | "LongGuns" + | "SpaceSuits" + | "SpaceGuns" + | "SpaceMelee" + | "Sentinels" + | "SentinelWeapons" + | "MechSuits"; -export const productCategoryToSlotName: Record<string, SlotNames> = { +export const productCategoryToSlotName: Record<ProductCategory, SlotNames> = { ``` --- `14-25`: **Add JSDoc documentation for the mapping constant.** Document the purpose and usage of this mapping to improve maintainability. ```diff +/** + * Maps product categories to their corresponding inventory slots. + * Used by controllers to determine the appropriate slot for different item types. + * @example + * const slot = productCategoryToSlotName["Suits"]; // Returns InventorySlot.SUITS + */ export const productCategoryToSlotName: Record<string, SlotNames> = { ``` </blockquote></details> <details> <summary>src/controllers/api/sellController.ts (1)</summary><blockquote> `148-154`: **Add type safety for inventory categories.** The ISellRequest interface should align with the inventory model to prevent runtime errors. ```diff +import { InventoryModel } from '@/src/models/inventory'; +type InventoryItemTypes = { + [K in keyof InventoryModel]: InventoryModel[K] extends any[] ? K : never; +}[keyof InventoryModel]; interface ISellRequest { Items: { - SpaceSuits?: ISellItem[]; - SpaceGuns?: ISellItem[]; - SpaceMelee?: ISellItem[]; - Sentinels?: ISellItem[]; - SentinelWeapons?: ISellItem[]; - OperatorAmps?: ISellItem[]; - Hoverboards?: ISellItem[]; + [K in InventoryItemTypes]?: ISellItem[]; }; ``` </blockquote></details> <details> <summary>src/controllers/custom/getItemListsController.ts (2)</summary><blockquote> `54-60`: **Improve path-based filtering logic.** Using string splits for path filtering is fragile. Consider using a more robust approach. ```diff +const MODULAR_PATHS = { + OPERATOR_AMPLIFIERS: '/Lotus/Weapons/OperatorAmplifiers', + SU_MODULAR_SECONDARY: '/Lotus/Weapons/SUModularSecondarySet1', + SU_MODULAR_PRIMARY: '/Lotus/Weapons/SUModularPrimarySet1', + INF_KIT_GUN: '/Lotus/Weapons/InfKitGun', + HOVERBOARD_PARTS: '/Lotus/Weapons/HoverboardParts' +}; -if ( - uniqueName.split("/")[4] == "OperatorAmplifiers" || - uniqueName.split("/")[5] == "SUModularSecondarySet1" || - uniqueName.split("/")[5] == "SUModularPrimarySet1" || - uniqueName.split("/")[5] == "InfKitGun" || - uniqueName.split("/")[5] == "HoverboardParts" -) { +if (Object.values(MODULAR_PATHS).some(path => uniqueName.startsWith(path))) { ``` --- `27-34`: **Type-safe initialization of response object.** Initialize the response object with a type-safe structure to prevent runtime errors. ```diff +type ItemListResponse = { + [K in 'LongGuns' | 'Melee' | 'ModularParts' | 'Pistols' | 'Sentinels' | + 'SentinelWeapons' | 'SpaceGuns' | 'SpaceMelee' | 'SpaceSuits' | 'Suits']: ListedItem[] +}; -const res: Record<string, ListedItem[]> = {}; +const res = {} as ItemListResponse; ``` </blockquote></details> <details> <summary>static/webui/script.js (1)</summary><blockquote> Line range hint `548-565`: **Functions refactored for better reusability.** The `addMissingEquipment` and `maxRankAllEquipment` functions have been generalized to handle multiple equipment categories, improving code maintainability. Consider extracting the XP calculation logic into a separate function to avoid duplication: ```diff +function getMaxXPForCategory(category) { + return category === "Suits" || + category === "SpaceSuits" || + category === "Sentinels" || + category === "Hoverboards" + ? 1_600_000 + : 800_000; +} function maxRankAllEquipment(categories) { // ... - const maxXP = - category === "Suits" || - category === "SpaceSuits" || - category === "Sentinels" || - category === "Hoverboards" - ? 1_600_000 - : 800_000; + const maxXP = getMaxXPForCategory(category); // ... } ``` Also applies to: 569-620 <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 548-548: 'addMissingEquipment' is defined but never used. (@typescript-eslint/no-unused-vars) </details> </details> </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 3c99b748dce4df06e2623f06ed5210a1832f38a1 and ad47be9a26305ef40587c8b963919ff78bc5e53e. </details> <details> <summary>📒 Files selected for processing (7)</summary> * `src/controllers/api/sellController.ts` (2 hunks) * `src/controllers/custom/addItemsController.ts` (2 hunks) * `src/controllers/custom/getItemListsController.ts` (2 hunks) * `src/helpers/purchaseHelpers.ts` (2 hunks) * `src/services/inventoryService.ts` (1 hunks) * `static/webui/index.html` (6 hunks) * `static/webui/script.js` (8 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🪛 eslint</summary> <details> <summary>static/webui/script.js</summary> [error] 505-505: 'doAcquireEquipment' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 531-531: '$' is not defined. (no-undef) --- [error] 532-532: '$' is not defined. (no-undef) --- [error] 548-548: 'addMissingEquipment' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 569-569: 'maxRankAllEquipment' is defined but never used. (@typescript-eslint/no-unused-vars) --- [error] 570-570: '$' is not defined. (no-undef) </details> </details> </details> <details> <summary>🔇 Additional comments (10)</summary><blockquote> <details> <summary>src/services/inventoryService.ts (1)</summary> `368-368`: **LGTM! XP tracking added for sentinel weapons.** The addition of `XP: 0` initialization for sentinel weapons aligns with the XP tracking pattern used for other equipment types in the system. Let's verify that all equipment types consistently initialize XP: <details> <summary>✅ Verification successful</summary> <!-- [monologue] [task verify_xp_1/1] Verify XP initialization consistency across equipment types. [observations] Found all equipment creation patterns in inventoryService.ts: 1. Combat Equipment (with XP): - Sentinels: { ItemType, Configs, XP: 0 } - SentinelWeapons: { ItemType, XP: 0 } - Suits: { ItemType, Configs, UpgradeVer: 101, XP: 0 } - MechSuits: { ItemType, Configs, UpgradeVer: 101, XP: 0 } - SpaceSuits: { ItemType, Configs, UpgradeVer: 101, XP: 0 } 2. Cosmetic/Non-Combat Items (without XP): - FlavourItems: { ItemType } - WeaponSkins: { ItemType } - CrewShips: { ItemType } - modsToGive: { ItemType, ItemCount } [analysis] - Clear pattern emerges: Combat equipment consistently initializes XP to 0 - Cosmetic items (FlavourItems, WeaponSkins) and utility items (CrewShips, mods) don't track XP - SentinelWeapons follows the same pattern as other combat equipment - The implementation is consistent with the game's design where only combat equipment tracks experience [actions] Generate final response confirming the verification is successful --> **Verified: XP initialization is consistent across all combat equipment** The addition of `XP: 0` for sentinel weapons matches the existing pattern where all combat equipment (Sentinels, Suits, MechSuits, SpaceSuits) initializes XP to 0, while cosmetic and utility items correctly omit XP tracking. </details> <details> <summary>🏁 Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Verify XP initialization consistency across equipment types # Test: Search for equipment creation patterns. Expect: All equipment types initialize XP to 0 rg -A 1 "push\(\{.*ItemType:" src/services/inventoryService.ts ``` Length of output: 1320 </details> </details> <details> <summary>static/webui/script.js (5)</summary> `152-157`: **LGTM! New equipment types added to itemMap.** The additions are well-structured and maintain consistency with existing entries. --- `197-209`: **LGTM! Equipment categories array updated.** The array of equipment categories is properly structured and includes all new equipment types. --- `220-226`: **LGTM! ModularParts handling added.** The implementation correctly handles the display of modular parts in the equipment list. --- `531-533`: **LGTM! Input validation handler added.** The jQuery event handler properly removes the 'is-invalid' class on input, improving user experience. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 eslint</summary> [error] 531-531: '$' is not defined. (no-undef) --- [error] 532-532: '$' is not defined. (no-undef) </details> </details> --- Line range hint `505-527`: **Function generalized to handle all equipment types.** The `doAcquireEquipment` function has been refactored to handle any equipment category, improving code reusability. Let's verify that all equipment types are properly handled: <details> <summary>✅ Verification successful</summary> <!-- [monologue] [task verify_equipment_handling_1/1] [observations] 1. The `doAcquireEquipment` function is defined in script.js and takes a category parameter 2. Found 9 different equipment categories in index.html using this function: - Regular: Suits, LongGuns, Pistols, Melee - Space: SpaceSuits, SpaceGuns, SpaceMelee - Sentinel: SentinelWeapons, Sentinels 3. All equipment acquisition forms consistently use the same function with different category parameters 4. The function implementation shown in the snippet handles the category parameter generically: - Uses category for element ID construction: "acquire-type-" + category - Passes category in the request payload as 'type' [analysis] 1. The function is indeed generalized: - Takes a category parameter instead of hardcoded values - Uses consistent DOM element IDs across all categories - Handles form validation and submission uniformly 2. All equipment types in the UI use this generalized function 3. The implementation correctly uses the category parameter throughout 4. No special cases or type-specific logic found, confirming true generalization [actions] 1. Verify the review comment as correct 2. Confirm the generalization is properly implemented 3. No additional verification needed as we have clear evidence --> **Generalized equipment handling verified successfully** The function is properly generalized and consistently used across all 9 equipment categories (Regular, Space, and Sentinel equipment types) in the codebase. </details> <details> <summary>🏁 Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Verify equipment type handling # Test: Search for equipment type references. Expect: All equipment types use doAcquireEquipment rg "doAcquireEquipment\(" static/webui/ ``` Length of output: 1406 </details> </details> <details> <summary>static/webui/index.html (4)</summary> `102-103`: **LGTM! Form submissions updated consistently.** All equipment acquisition forms have been updated to use the generalized `doAcquireEquipment` function. Also applies to: 116-119, 132-135, 146-149 --- `157-254`: **LGTM! New equipment sections added with consistent structure.** The new sections for Archwing, Sentinel, Amp, and K-Drive equipment follow the established pattern and maintain UI consistency. --- `257-273`: **LGTM! Bulk actions updated for new equipment types.** The bulk actions section has been properly updated to include all new equipment categories. --- `497-506`: **LGTM! Datalist elements added for new equipment types.** All necessary datalist elements have been added to support the new equipment types. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -54,0 +85,4 @@
payload.Items.Hoverboards.forEach(sellItem => {
inventory.Hoverboards.pull({ _id: sellItem.String });
});
}
coderabbitai[bot] (Migrated from github.com) commented 2025-01-19 05:39:28 -08:00

🛠️ Refactor suggestion

Reduce code duplication in item removal logic.

The item removal logic is repeated for each item type. Consider extracting this into a reusable function.

+const removeItems = (
+    inventory: any,
+    items: ISellItem[] | undefined,
+    category: keyof typeof inventory
+) => {
+    if (items) {
+        items.forEach(sellItem => {
+            inventory[category].pull({ _id: sellItem.String });
+        });
+    }
+};

-if (payload.Items.SpaceSuits) {
-    payload.Items.SpaceSuits.forEach(sellItem => {
-        inventory.SpaceSuits.pull({ _id: sellItem.String });
-    });
-}
+removeItems(inventory, payload.Items.SpaceSuits, 'SpaceSuits');
// Apply similar changes to other item types
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    const removeItems = (
        inventory: any,
        items: ISellItem[] | undefined,
        category: keyof typeof inventory
    ) => {
        if (items) {
            items.forEach(sellItem => {
                inventory[category].pull({ _id: sellItem.String });
            });
        }
    };

    removeItems(inventory, payload.Items.SpaceSuits, 'SpaceSuits');
    removeItems(inventory, payload.Items.SpaceGuns, 'SpaceGuns');
    removeItems(inventory, payload.Items.SpaceMelee, 'SpaceMelee');
    removeItems(inventory, payload.Items.Sentinels, 'Sentinels');
    removeItems(inventory, payload.Items.SentinelWeapons, 'SentinelWeapons');
    removeItems(inventory, payload.Items.OperatorAmps, 'OperatorAmps');
    removeItems(inventory, payload.Items.Hoverboards, 'Hoverboards');
_:hammer_and_wrench: Refactor suggestion_ **Reduce code duplication in item removal logic.** The item removal logic is repeated for each item type. Consider extracting this into a reusable function. ```diff +const removeItems = ( + inventory: any, + items: ISellItem[] | undefined, + category: keyof typeof inventory +) => { + if (items) { + items.forEach(sellItem => { + inventory[category].pull({ _id: sellItem.String }); + }); + } +}; -if (payload.Items.SpaceSuits) { - payload.Items.SpaceSuits.forEach(sellItem => { - inventory.SpaceSuits.pull({ _id: sellItem.String }); - }); -} +removeItems(inventory, payload.Items.SpaceSuits, 'SpaceSuits'); // Apply similar changes to other item types ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion const removeItems = ( inventory: any, items: ISellItem[] | undefined, category: keyof typeof inventory ) => { if (items) { items.forEach(sellItem => { inventory[category].pull({ _id: sellItem.String }); }); } }; removeItems(inventory, payload.Items.SpaceSuits, 'SpaceSuits'); removeItems(inventory, payload.Items.SpaceGuns, 'SpaceGuns'); removeItems(inventory, payload.Items.SpaceMelee, 'SpaceMelee'); removeItems(inventory, payload.Items.Sentinels, 'Sentinels'); removeItems(inventory, payload.Items.SentinelWeapons, 'SentinelWeapons'); removeItems(inventory, payload.Items.OperatorAmps, 'OperatorAmps'); removeItems(inventory, payload.Items.Hoverboards, 'Hoverboards'); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -21,3 +20,4 @@
addEquipment(inventory, request.type, request.internalName);
break;
}
}
coderabbitai[bot] (Migrated from github.com) commented 2025-01-19 05:39:27 -08:00

💡 Codebase verification

Type safety improvements needed in productCategoryToSlotName

  • Change type from Record<string, SlotNames> to Record<ItemType, SlotNames> in purchaseHelpers.ts
  • Consider adding LongGuns and MechSuits to ItemType enum or remove them from the mapping if unused
🔗 Analysis chain

Ensure type safety between ItemType and productCategoryToSlotName.

The ItemType enum values should be guaranteed to exist in productCategoryToSlotName to prevent runtime errors.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that all ItemType values have corresponding entries in productCategoryToSlotName
ast-grep --pattern 'enum ItemType {
  $$$
}' | grep -o 'Suits\|SpaceSuits\|Pistols\|Melee\|SpaceGuns\|SpaceMelee\|SentinelWeapons\|Sentinels' | sort > /tmp/item_types.txt

rg -o '"[^"]*":\s*InventorySlot\.' src/helpers/purchaseHelpers.ts | cut -d'"' -f2 | sort > /tmp/slot_mappings.txt

diff /tmp/item_types.txt /tmp/slot_mappings.txt

Length of output: 486


Script:

#!/bin/bash
# Find the file containing productCategoryToSlotName
rg "productCategoryToSlotName" -l

# Show the context of productCategoryToSlotName definition
rg "productCategoryToSlotName" -B 2 -A 10

Length of output: 3392

_:bulb: Codebase verification_ **Type safety improvements needed in productCategoryToSlotName** - Change type from `Record<string, SlotNames>` to `Record<ItemType, SlotNames>` in purchaseHelpers.ts - Consider adding `LongGuns` and `MechSuits` to ItemType enum or remove them from the mapping if unused <details> <summary>🔗 Analysis chain</summary> **Ensure type safety between ItemType and productCategoryToSlotName.** The ItemType enum values should be guaranteed to exist in productCategoryToSlotName to prevent runtime errors. </details> <details> <summary>🏁 Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Verify that all ItemType values have corresponding entries in productCategoryToSlotName ast-grep --pattern 'enum ItemType { $$$ }' | grep -o 'Suits\|SpaceSuits\|Pistols\|Melee\|SpaceGuns\|SpaceMelee\|SentinelWeapons\|Sentinels' | sort > /tmp/item_types.txt rg -o '"[^"]*":\s*InventorySlot\.' src/helpers/purchaseHelpers.ts | cut -d'"' -f2 | sort > /tmp/slot_mappings.txt diff /tmp/item_types.txt /tmp/slot_mappings.txt ``` Length of output: 486 --- Script: ```shell #!/bin/bash # Find the file containing productCategoryToSlotName rg "productCategoryToSlotName" -l # Show the context of productCategoryToSlotName definition rg "productCategoryToSlotName" -B 2 -A 10 ``` Length of output: 3392 </details> <!-- This is an auto-generated comment by CodeRabbit -->
@ -25,9 +25,28 @@ export const addItemsController: RequestHandler = async (req, res) => {
res.end();
};
const productCategoryToSlotName: Record<ItemType, SlotNames> = {
coderabbitai[bot] (Migrated from github.com) commented 2025-01-19 05:39:27 -08:00

⚠️ Potential issue

Add error handling for unknown item types.

The default case assumes the item type exists in productCategoryToSlotName. Add validation to prevent runtime errors.

 default:
+    if (!(request.type in productCategoryToSlotName)) {
+        throw new Error(`Unknown item type: ${request.type}`);
+    }
     updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1);
     addEquipment(inventory, request.type, request.internalName);
     break;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

            default:
                if (!(request.type in productCategoryToSlotName)) {
                    throw new Error(`Unknown item type: ${request.type}`);
                }
                updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1);
                addEquipment(inventory, request.type, request.internalName);
                break;
_:warning: Potential issue_ **Add error handling for unknown item types.** The default case assumes the item type exists in productCategoryToSlotName. Add validation to prevent runtime errors. ```diff default: + if (!(request.type in productCategoryToSlotName)) { + throw new Error(`Unknown item type: ${request.type}`); + } updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1); addEquipment(inventory, request.type, request.internalName); break; ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion default: if (!(request.type in productCategoryToSlotName)) { throw new Error(`Unknown item type: ${request.type}`); } updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1); addEquipment(inventory, request.type, request.internalName); break; ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] (Migrated from github.com) commented 2025-01-19 05:39:28 -08:00

⚠️ Potential issue

Remove duplicate push operation for ModularParts.

The same item is being pushed twice to ModularParts when the path doesn't contain 'SentTrainingAmplifier'.

 res.ModularParts.push({
     uniqueName,
     name: getString(item.name, lang)
 });
-if (uniqueName.split("/")[5] != "SentTrainingAmplifier") {
-    res.ModularParts.push({
-        uniqueName,
-        name: getString(item.name, lang)
-    });
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

            res.ModularParts.push({
                uniqueName,
                name: getString(item.name, lang)
            });
_:warning: Potential issue_ **Remove duplicate push operation for ModularParts.** The same item is being pushed twice to ModularParts when the path doesn't contain 'SentTrainingAmplifier'. ```diff res.ModularParts.push({ uniqueName, name: getString(item.name, lang) }); -if (uniqueName.split("/")[5] != "SentTrainingAmplifier") { - res.ModularParts.push({ - uniqueName, - name: getString(item.name, lang) - }); -} ``` <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. `````suggestion res.ModularParts.push({ uniqueName, name: getString(item.name, lang) }); ````` </details> <!-- suggestion_end --> <!-- This is an auto-generated comment by CodeRabbit -->
coderabbitai[bot] (Migrated from github.com) reviewed 2025-01-19 05:42:55 -08:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/controllers/custom/getItemListsController.ts (4)

27-34: Consider grouping related equipment categories together.

While the initialization is functionally correct, consider organizing related categories together for better maintainability:

 const res: Record<string, ListedItem[]> = {};
+// Character equipment
+res.Suits = [];
+res.SpaceSuits = [];
+
+// Primary weapons
 res.LongGuns = [];
-res.Melee = [];
+res.SpaceGuns = [];
+
+// Secondary weapons
+res.Pistols = [];
+
+// Melee weapons
+res.Melee = [];
+res.SpaceMelee = [];
+
+// Companion equipment
+res.Sentinels = [];
+res.SentinelWeapons = [];
+
+// Modular items
 res.ModularParts = [];
-res.Pistols = [];
-res.Sentinels = [];
-res.SentinelWeapons = [];
-res.SpaceGuns = [];
-res.SpaceMelee = [];
-res.SpaceSuits = [];
-res.Suits = [];

36-44: Add type safety for product categories.

Consider using a type-safe approach for product categories to prevent potential runtime errors:

// Add at the top of the file
type WarframeCategory = 'Suits' | 'SpaceSuits';

// Modify the condition
if (item.productCategory as WarframeCategory in res) {
    res[item.productCategory as WarframeCategory].push({
        uniqueName,
        name: getString(item.name, lang),
        exalted: item.exalted
    });
}

45-52: Simplify Sentinels processing logic.

Since ExportSentinels should only contain Sentinel items, the productCategory check might be redundant:

 for (const [uniqueName, item] of Object.entries(ExportSentinels)) {
-    if (item.productCategory == "Sentinels") {
-        res[item.productCategory].push({
-            uniqueName,
-            name: getString(item.name, lang)
-        });
-    }
+    res.Sentinels.push({
+        uniqueName,
+        name: getString(item.name, lang)
+    });
 }

65-70: Add a comment explaining the miscitems duplication logic.

The logic for adding items to both ModularParts and miscitems (except for SentTrainingAmplifier) needs documentation:

+// Add modular parts to miscitems for backwards compatibility,
+// except for Sentinel Training Amplifiers which are handled separately
 if (uniqueName.split("/")[5] != "SentTrainingAmplifier") {
     res.miscitems.push({
         uniqueName: "MiscItems:" + uniqueName,
         name: getString(item.name, lang)
     });
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad47be9a26 and 425ec568ee.

📒 Files selected for processing (1)
  • src/controllers/custom/getItemListsController.ts (2 hunks)
🔇 Additional comments (2)
src/controllers/custom/getItemListsController.ts (2)

8-8: LGTM! Import and interface changes are well-structured.

The addition of ExportSentinels and the exalted property aligns with the PR's objective of expanding equipment support.

Also applies to: 19-19


71-78: LGTM! Weapon categories are properly handled.

The logic for categorizing weapons based on their productCategory and totalDamage is correct and aligns with the PR objectives.

**Actionable comments posted: 1** <details> <summary>🧹 Nitpick comments (4)</summary><blockquote> <details> <summary>src/controllers/custom/getItemListsController.ts (4)</summary><blockquote> `27-34`: **Consider grouping related equipment categories together.** While the initialization is functionally correct, consider organizing related categories together for better maintainability: ```diff const res: Record<string, ListedItem[]> = {}; +// Character equipment +res.Suits = []; +res.SpaceSuits = []; + +// Primary weapons res.LongGuns = []; -res.Melee = []; +res.SpaceGuns = []; + +// Secondary weapons +res.Pistols = []; + +// Melee weapons +res.Melee = []; +res.SpaceMelee = []; + +// Companion equipment +res.Sentinels = []; +res.SentinelWeapons = []; + +// Modular items res.ModularParts = []; -res.Pistols = []; -res.Sentinels = []; -res.SentinelWeapons = []; -res.SpaceGuns = []; -res.SpaceMelee = []; -res.SpaceSuits = []; -res.Suits = []; ``` --- `36-44`: **Add type safety for product categories.** Consider using a type-safe approach for product categories to prevent potential runtime errors: ```typescript // Add at the top of the file type WarframeCategory = 'Suits' | 'SpaceSuits'; // Modify the condition if (item.productCategory as WarframeCategory in res) { res[item.productCategory as WarframeCategory].push({ uniqueName, name: getString(item.name, lang), exalted: item.exalted }); } ``` --- `45-52`: **Simplify Sentinels processing logic.** Since `ExportSentinels` should only contain Sentinel items, the productCategory check might be redundant: ```diff for (const [uniqueName, item] of Object.entries(ExportSentinels)) { - if (item.productCategory == "Sentinels") { - res[item.productCategory].push({ - uniqueName, - name: getString(item.name, lang) - }); - } + res.Sentinels.push({ + uniqueName, + name: getString(item.name, lang) + }); } ``` --- `65-70`: **Add a comment explaining the miscitems duplication logic.** The logic for adding items to both ModularParts and miscitems (except for SentTrainingAmplifier) needs documentation: ```diff +// Add modular parts to miscitems for backwards compatibility, +// except for Sentinel Training Amplifiers which are handled separately if (uniqueName.split("/")[5] != "SentTrainingAmplifier") { res.miscitems.push({ uniqueName: "MiscItems:" + uniqueName, name: getString(item.name, lang) }); } ``` </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: .coderabbit.yaml** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between ad47be9a26305ef40587c8b963919ff78bc5e53e and 425ec568ee2c50b19a36f034ee69414569c0568a. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/controllers/custom/getItemListsController.ts` (2 hunks) </details> <details> <summary>🔇 Additional comments (2)</summary><blockquote> <details> <summary>src/controllers/custom/getItemListsController.ts (2)</summary> `8-8`: **LGTM! Import and interface changes are well-structured.** The addition of `ExportSentinels` and the `exalted` property aligns with the PR's objective of expanding equipment support. Also applies to: 19-19 --- `71-78`: **LGTM! Weapon categories are properly handled.** The logic for categorizing weapons based on their productCategory and totalDamage is correct and aligns with the PR objectives. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -33,3 +78,4 @@
item.productCategory == "SentinelWeapons"
) {
res[item.productCategory].push({
uniqueName,
coderabbitai[bot] (Migrated from github.com) commented 2025-01-19 05:42:54 -08:00

🛠️ Refactor suggestion

Refactor path-based checks for better maintainability.

The current implementation uses hard-coded path components which is fragile. Consider using an enum or constant for these paths:

// Add at the top of the file
const MODULAR_CATEGORIES = {
    OPERATOR_AMPLIFIERS: 'OperatorAmplifiers',
    MODULAR_SETS: {
        SECONDARY: 'SUModularSecondarySet1',
        PRIMARY: 'SUModularPrimarySet1'
    },
    KIT_GUN: 'InfKitGun',
    HOVERBOARD: 'HoverboardParts',
    SENTINEL_AMPLIFIER: 'SentTrainingAmplifier'
} as const;

// Then use in the condition
if (
    uniqueName.split("/")[4] === MODULAR_CATEGORIES.OPERATOR_AMPLIFIERS ||
    uniqueName.split("/")[5] === MODULAR_CATEGORIES.MODULAR_SETS.SECONDARY ||
    // ... etc
)
_:hammer_and_wrench: Refactor suggestion_ **Refactor path-based checks for better maintainability.** The current implementation uses hard-coded path components which is fragile. Consider using an enum or constant for these paths: ```typescript // Add at the top of the file const MODULAR_CATEGORIES = { OPERATOR_AMPLIFIERS: 'OperatorAmplifiers', MODULAR_SETS: { SECONDARY: 'SUModularSecondarySet1', PRIMARY: 'SUModularPrimarySet1' }, KIT_GUN: 'InfKitGun', HOVERBOARD: 'HoverboardParts', SENTINEL_AMPLIFIER: 'SentTrainingAmplifier' } as const; // Then use in the condition if ( uniqueName.split("/")[4] === MODULAR_CATEGORIES.OPERATOR_AMPLIFIERS || uniqueName.split("/")[5] === MODULAR_CATEGORIES.MODULAR_SETS.SECONDARY || // ... etc ) ``` <!-- This is an auto-generated comment by CodeRabbit -->

I'm sure it was totally necessary for you to modify sellController as part of a PR that supposedly only touches the WebUI instead of moving those changes into a seperate PR.

I'm sure it was totally necessary for you to modify sellController as part of a PR that supposedly only touches the WebUI instead of moving those changes into a seperate PR.

YOLO

YOLO
Sign in to join this conversation.
No description provided.