feat: archon shard fusion #785
51
src/controllers/api/archonFusionController.ts
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
import { RequestHandler } from "express";
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
import { addMiscItems, getInventory } from "@/src/services/inventoryService";
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
import { colorToShard, combineColors, shardToColor } from "@/src/helpers/shardHelper";
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
export const archonFusionController: RequestHandler = async (req, res) => {
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
const request = JSON.parse(String(req.body)) as IArchonFusionRequest;
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
const inventory = await getInventory(accountId);
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
request.Consumed.forEach(x => {
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
x.ItemCount *= -1;
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
});
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
addMiscItems(inventory, request.Consumed);
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
const newArchons: IMiscItem[] = [];
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
switch (request.FusionType) {
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
case "AFT_ASCENT":
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
newArchons.push({
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
ItemType: request.Consumed[0].ItemType + "Mythic",
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
ItemCount: 1
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
});
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
break;
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
case "AFT_COALESCENT":
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
newArchons.push({
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
ItemType:
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
colorToShard[
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
combineColors(
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
shardToColor[request.Consumed[0].ItemType],
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
shardToColor[request.Consumed[1].ItemType]
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
)
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
],
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
ItemCount: 1
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
});
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
break;
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
default:
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
throw new Error(`unknown archon fusion type: ${request.FusionType}`);
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
}
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
addMiscItems(inventory, newArchons);
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
await inventory.save();
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
res.json({
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
NewArchons: newArchons
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
});
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
};
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
interface IArchonFusionRequest {
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
Consumed: IMiscItem[];
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
FusionType: string;
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
StatResultType: "SRT_NEW_STAT"; // ???
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
||||
}
|
||||
![]() 🛠️ Refactor suggestion Add input validation for the request. The controller needs validation for:
Consider adding this validation at the start of the controller:
_:hammer_and_wrench: Refactor suggestion_
**Add input validation for the request.**
The controller needs validation for:
1. Empty or undefined `request.Consumed` array
2. Minimum required items for each fusion type
3. Invalid color combinations that could crash the `combineColors` function
Consider adding this validation at the start of the controller:
```typescript
if (!request.Consumed?.length) {
throw new Error("No items provided for fusion");
}
switch (request.FusionType) {
case "AFT_ASCENT":
if (request.Consumed.length < 1) {
throw new Error("AFT_ASCENT requires at least 1 item");
}
break;
case "AFT_COALESCENT":
if (request.Consumed.length < 2) {
throw new Error("AFT_COALESCENT requires at least 2 items");
}
// Validate colors exist in shardToColor mapping
const color1 = shardToColor[request.Consumed[0].ItemType];
const color2 = shardToColor[request.Consumed[1].ItemType];
if (!color1 || !color2) {
throw new Error("Invalid shard types provided");
}
break;
default:
throw new Error(`Unknown fusion type: ${request.FusionType}`);
}
```
<!-- This is an auto-generated comment by CodeRabbit -->
![]() ⚠️ Potential issue Fix the item count negation logic. The line Apply this diff to fix the negation:
📝 Committable suggestion
_:warning: Potential issue_
**Fix the item count negation logic.**
The line `request.Consumed.forEach(x => x.ItemCount * -1)` performs the multiplication but doesn't assign the result back to `x.ItemCount`.
Apply this diff to fix the negation:
```diff
-request.Consumed.forEach(x => x.ItemCount * -1);
+request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
```
<!-- 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
request.Consumed.forEach(x => x.ItemCount = x.ItemCount * -1);
`````
</details>
<!-- suggestion_end -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
@ -15,6 +15,7 @@ import { getRecipe } from "@/src/services/itemDataService";
|
||||
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
|
||||
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { colorToShard } from "@/src/helpers/shardHelper";
|
||||
|
||||
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
@ -355,21 +356,6 @@ interface IHelminthFeedRequest {
|
||||
}[];
|
||||
}
|
||||
|
||||
const colorToShard: Record<string, string> = {
|
||||
ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar",
|
||||
ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic",
|
||||
ACC_YELLOW: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNira",
|
||||
ACC_YELLOW_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNiraMythic",
|
||||
ACC_BLUE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBoreal",
|
||||
ACC_BLUE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBorealMythic",
|
||||
ACC_GREEN: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreen",
|
||||
ACC_GREEN_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreenMythic",
|
||||
ACC_ORANGE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrange",
|
||||
ACC_ORANGE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrangeMythic",
|
||||
ACC_PURPLE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet",
|
||||
ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
|
||||
};
|
||||
|
||||
export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number): ITypeCount[] => {
|
||||
const recipeChanges: ITypeCount[] = [];
|
||||
infestedFoundry.XP ??= 0;
|
||||
|
66
src/helpers/shardHelper.ts
Normal file
@ -0,0 +1,66 @@
|
||||
export const colorToShard: Record<string, string> = {
|
||||
ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar",
|
||||
ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic",
|
||||
ACC_YELLOW: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNira",
|
||||
ACC_YELLOW_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNiraMythic",
|
||||
ACC_BLUE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBoreal",
|
||||
ACC_BLUE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBorealMythic",
|
||||
ACC_GREEN: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreen",
|
||||
ACC_GREEN_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreenMythic",
|
||||
ACC_ORANGE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrange",
|
||||
ACC_ORANGE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrangeMythic",
|
||||
ACC_PURPLE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet",
|
||||
ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
|
||||
};
|
||||
|
||||
export const shardToColor: Record<string, string> = {
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar": "ACC_RED",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic": "ACC_RED_MYTHIC",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNira": "ACC_YELLOW",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalNiraMythic": "ACC_YELLOW_MYTHIC",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBoreal": "ACC_BLUE",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalBorealMythic": "ACC_BLUE_MYTHIC",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreen": "ACC_GREEN",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalGreenMythic": "ACC_GREEN_MYTHIC",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrange": "ACC_ORANGE",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalOrangeMythic": "ACC_ORANGE_MYTHIC",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet": "ACC_PURPLE",
|
||||
"/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic": "ACC_PURPLE_MYTHIC"
|
||||
};
|
||||
|
||||
export const combineColors = (a: string, b: string): string => {
|
||||
return (
|
||||
combinePlainColors(a.replace("_MYTHIC", ""), b.replace("_MYTHIC", "")) +
|
||||
(a.indexOf("_MYTHIC") != -1 ? "_MYTHIC" : "")
|
||||
);
|
||||
};
|
||||
|
||||
const combinePlainColors = (a: string, b: string): string => {
|
||||
switch (a) {
|
||||
case "ACC_RED":
|
||||
switch (b) {
|
||||
case "ACC_YELLOW":
|
||||
return "ACC_ORANGE";
|
||||
case "ACC_BLUE":
|
||||
return "ACC_PURPLE";
|
||||
}
|
||||
break;
|
||||
case "ACC_YELLOW":
|
||||
switch (b) {
|
||||
case "ACC_RED":
|
||||
return "ACC_ORANGE";
|
||||
case "ACC_BLUE":
|
||||
return "ACC_GREEN";
|
||||
}
|
||||
break;
|
||||
case "ACC_BLUE":
|
||||
switch (b) {
|
||||
case "ACC_RED":
|
||||
return "ACC_PURPLE";
|
||||
case "ACC_YELLOW":
|
||||
return "ACC_GREEN";
|
||||
}
|
||||
break;
|
||||
}
|
||||
throw new Error(`invalid color combination request: ${a} and ${b}`);
|
||||
};
|
||||
![]() 🛠️ Refactor suggestion Complete the color combination matrix. The
Consider this more complete implementation:
_:hammer_and_wrench: Refactor suggestion_
**Complete the color combination matrix.**
The `combinePlainColors` function only handles some color combinations. It's missing:
1. Reverse combinations (e.g., YELLOW + RED should equal ORANGE)
2. Invalid combinations should be explicitly handled
Consider this more complete implementation:
```typescript
const combinePlainColors = (a: string, b: string): string => {
// Normalize order for consistent combinations
const [color1, color2] = [a, b].sort();
const combination = `${color1}:${color2}`;
switch (combination) {
case "ACC_RED:ACC_YELLOW":
return "ACC_ORANGE";
case "ACC_RED:ACC_BLUE":
return "ACC_PURPLE";
case "ACC_YELLOW:ACC_BLUE":
return "ACC_GREEN";
default:
throw new Error(`Invalid color combination: ${a} and ${b}`);
}
};
```
<!-- This is an auto-generated comment by CodeRabbit -->
|
@ -2,6 +2,7 @@ import express from "express";
|
||||
import { activateRandomModController } from "@/src/controllers/api/activateRandomModController";
|
||||
import { addFriendImageController } from "@/src/controllers/api/addFriendImageController";
|
||||
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
|
||||
import { archonFusionController } from "@/src/controllers/api/archonFusionController";
|
||||
import { artifactsController } from "../controllers/api/artifactsController";
|
||||
import { checkDailyMissionBonusController } from "@/src/controllers/api/checkDailyMissionBonusController";
|
||||
import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompletedRecipeController";
|
||||
@ -114,6 +115,7 @@ apiRouter.get("/updateSession.php", updateSessionGetController);
|
||||
apiRouter.post("/activateRandomMod.php", activateRandomModController);
|
||||
apiRouter.post("/addFriendImage.php", addFriendImageController);
|
||||
apiRouter.post("/arcaneCommon.php", arcaneCommonController);
|
||||
apiRouter.post("/archonFusion.php", archonFusionController);
|
||||
apiRouter.post("/artifacts.php", artifactsController);
|
||||
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
|
||||
apiRouter.post("/createGuild.php", createGuildController);
|
||||
|
🛠️ Refactor suggestion
Add input validation for the request.
The controller needs validation for:
request.Consumed
arraycombineColors
functionConsider adding this validation at the start of the controller:
⚠️ Potential issue
Fix the item count negation logic.
The line
request.Consumed.forEach(x => x.ItemCount * -1)
performs the multiplication but doesn't assign the result back tox.ItemCount
.Apply this diff to fix the negation:
📝 Committable suggestion
🛠️ Refactor suggestion
Add input validation for the request.
The controller needs validation for:
request.Consumed
arraycombineColors
functionConsider adding this validation at the start of the controller:
⚠️ Potential issue
Fix the item count negation logic.
The line
request.Consumed.forEach(x => x.ItemCount * -1)
performs the multiplication but doesn't assign the result back tox.ItemCount
.Apply this diff to fix the negation:
📝 Committable suggestion