feat: infiniteHelminthMaterials cheat (#985)
Closes #728 Reviewed-on: #985 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>
This commit is contained in:
parent
a3873a1710
commit
9203e0bf4d
@ -20,6 +20,7 @@
|
||||
"infinitePlatinum": true,
|
||||
"infiniteEndo": true,
|
||||
"infiniteRegalAya": true,
|
||||
"infiniteHelminthMaterials": false,
|
||||
"unlockAllShipFeatures": true,
|
||||
"unlockAllShipDecorations": true,
|
||||
"unlockAllFlavourItems": true,
|
||||
|
@ -6,7 +6,9 @@ import { IOid } from "@/src/types/commonTypes";
|
||||
import {
|
||||
IConsumedSuit,
|
||||
IHelminthFoodRecord,
|
||||
IInfestedFoundryClient,
|
||||
IInfestedFoundryDatabase,
|
||||
IInventoryClient,
|
||||
IMiscItem,
|
||||
ITypeCount
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
@ -16,6 +18,7 @@ import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/invento
|
||||
import { toMongoDate } from "@/src/helpers/inventoryHelpers";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { colorToShard } from "@/src/helpers/shardHelper";
|
||||
import { config } from "@/src/services/configService";
|
||||
|
||||
export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
@ -69,18 +72,22 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
// remove from suit
|
||||
suit.ArchonCrystalUpgrades![request.Slot] = {};
|
||||
|
||||
if (!config.infiniteHelminthMaterials) {
|
||||
// remove bile
|
||||
const bile = inventory.InfestedFoundry!.Resources!.find(
|
||||
x => x.ItemType == "/Lotus/Types/Items/InfestedFoundry/HelminthBile"
|
||||
)!;
|
||||
bile.Count -= 300;
|
||||
}
|
||||
|
||||
await inventory.save();
|
||||
|
||||
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
|
||||
applyCheatsToInfestedFoundry(infestedFoundry);
|
||||
res.json({
|
||||
InventoryChanges: {
|
||||
MiscItems: miscItemChanges,
|
||||
InfestedFoundry: inventory.toJSON().InfestedFoundry
|
||||
InfestedFoundry: infestedFoundry
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -105,6 +112,12 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
|
||||
case "c": {
|
||||
// consume items
|
||||
|
||||
if (config.infiniteHelminthMaterials) {
|
||||
res.status(400).end();
|
||||
return;
|
||||
}
|
||||
|
||||
const request = getJSONfromString<IHelminthFeedRequest>(String(req.body));
|
||||
const inventory = await getInventory(accountId);
|
||||
inventory.InfestedFoundry ??= {};
|
||||
@ -210,9 +223,11 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
inventory.InfestedFoundry.InvigorationsApplied = 0;
|
||||
}
|
||||
await inventory.save();
|
||||
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
|
||||
applyCheatsToInfestedFoundry(infestedFoundry);
|
||||
res.json({
|
||||
InventoryChanges: {
|
||||
InfestedFoundry: inventory.toJSON().InfestedFoundry
|
||||
InfestedFoundry: infestedFoundry
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -223,12 +238,14 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
const request = getJSONfromString<IHelminthSubsumeRequest>(String(req.body));
|
||||
const inventory = await getInventory(accountId);
|
||||
const recipe = getRecipe(request.Recipe)!;
|
||||
if (!config.infiniteHelminthMaterials) {
|
||||
for (const ingredient of recipe.secretIngredients!) {
|
||||
const resource = inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == ingredient.ItemType);
|
||||
if (resource) {
|
||||
resource.Count -= ingredient.ItemCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
const suit = inventory.Suits.id(request.SuitId.$oid)!;
|
||||
inventory.Suits.pull(suit);
|
||||
const consumedSuit: IConsumedSuit = { s: suit.ItemType };
|
||||
@ -247,6 +264,8 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry!, 1600_00);
|
||||
addRecipes(inventory, recipeChanges);
|
||||
await inventory.save();
|
||||
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
|
||||
applyCheatsToInfestedFoundry(infestedFoundry);
|
||||
res.json({
|
||||
InventoryChanges: {
|
||||
Recipes: recipeChanges,
|
||||
@ -260,7 +279,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
platinum: 0,
|
||||
Slots: 1
|
||||
},
|
||||
InfestedFoundry: inventory.toJSON().InfestedFoundry
|
||||
InfestedFoundry: infestedFoundry
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -272,11 +291,13 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
const currencyChanges = updateCurrency(inventory, 50, true);
|
||||
const recipeChanges = handleSubsumeCompletion(inventory);
|
||||
await inventory.save();
|
||||
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
|
||||
applyCheatsToInfestedFoundry(infestedFoundry);
|
||||
res.json({
|
||||
InventoryChanges: {
|
||||
...currencyChanges,
|
||||
Recipes: recipeChanges,
|
||||
InfestedFoundry: inventory.toJSON().InfestedFoundry
|
||||
InfestedFoundry: infestedFoundry
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -292,13 +313,17 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
suit.UpgradesExpiry = upgradesExpiry;
|
||||
const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry!, 4800_00);
|
||||
addRecipes(inventory, recipeChanges);
|
||||
if (!config.infiniteHelminthMaterials) {
|
||||
for (let i = 0; i != request.ResourceTypes.length; ++i) {
|
||||
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == request.ResourceTypes[i])!.Count -=
|
||||
request.ResourceCosts[i];
|
||||
}
|
||||
}
|
||||
inventory.InfestedFoundry!.InvigorationsApplied ??= 0;
|
||||
inventory.InfestedFoundry!.InvigorationsApplied += 1;
|
||||
await inventory.save();
|
||||
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
|
||||
applyCheatsToInfestedFoundry(infestedFoundry);
|
||||
res.json({
|
||||
SuitId: request.SuitId,
|
||||
OffensiveUpgrade: request.OffensiveUpgradeType,
|
||||
@ -306,7 +331,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
UpgradesExpiry: toMongoDate(upgradesExpiry),
|
||||
InventoryChanges: {
|
||||
Recipes: recipeChanges,
|
||||
InfestedFoundry: inventory.toJSON().InfestedFoundry
|
||||
InfestedFoundry: infestedFoundry
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -453,6 +478,19 @@ export const handleSubsumeCompletion = (inventory: TInventoryDatabaseDocument):
|
||||
return recipeChanges;
|
||||
};
|
||||
|
||||
export const applyCheatsToInfestedFoundry = (infestedFoundry: IInfestedFoundryClient): void => {
|
||||
if (config.infiniteHelminthMaterials) {
|
||||
infestedFoundry.Resources = [
|
||||
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthCalx", Count: 1000 },
|
||||
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthBiotics", Count: 1000 },
|
||||
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthSynthetics", Count: 1000 },
|
||||
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthPheromones", Count: 1000 },
|
||||
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthBile", Count: 1000 },
|
||||
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthOxides", Count: 1000 }
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
interface IHelminthOfferingsUpdate {
|
||||
OfferingsIndex: number;
|
||||
SuitTypes: string[];
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
ExportResources,
|
||||
ExportVirtuals
|
||||
} from "warframe-public-export-plus";
|
||||
import { handleSubsumeCompletion } from "./infestedFoundryController";
|
||||
import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "./infestedFoundryController";
|
||||
import { allDailyAffiliationKeys } from "@/src/services/inventoryService";
|
||||
|
||||
export const inventoryController: RequestHandler = async (request, response) => {
|
||||
@ -212,6 +212,10 @@ export const getInventoryResponse = async (
|
||||
}
|
||||
}
|
||||
|
||||
if (inventoryResponse.InfestedFoundry) {
|
||||
applyCheatsToInfestedFoundry(inventoryResponse.InfestedFoundry);
|
||||
}
|
||||
|
||||
// Fix for #380
|
||||
inventoryResponse.NextRefill = { $date: { $numberLong: "9999999999999" } };
|
||||
|
||||
|
@ -12,6 +12,7 @@ import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/se
|
||||
import { getRecipeByResult } from "@/src/services/itemDataService";
|
||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
|
||||
import { addInfestedFoundryXP } from "./infestedFoundryController";
|
||||
import { config } from "@/src/services/configService";
|
||||
|
||||
export const upgradesController: RequestHandler = async (req, res) => {
|
||||
const accountId = await getAccountIdForRequest(req);
|
||||
@ -48,10 +49,12 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
const recipe = getRecipeByResult(operation.UpgradeRequirement)!;
|
||||
for (const ingredient of recipe.ingredients) {
|
||||
totalPercentagePointsConsumed += ingredient.ItemCount / 10;
|
||||
if (!config.infiniteHelminthMaterials) {
|
||||
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == ingredient.ItemType)!.Count -=
|
||||
ingredient.ItemCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const entry of operation.PolarityRemap) {
|
||||
suit.Configs[entry.Slot] ??= {};
|
||||
|
@ -46,6 +46,7 @@ interface IConfig {
|
||||
infinitePlatinum?: boolean;
|
||||
infiniteEndo?: boolean;
|
||||
infiniteRegalAya?: boolean;
|
||||
infiniteHelminthMaterials?: boolean;
|
||||
unlockAllShipFeatures?: boolean;
|
||||
unlockAllShipDecorations?: boolean;
|
||||
unlockAllFlavourItems?: boolean;
|
||||
|
@ -473,6 +473,10 @@
|
||||
<input class="form-check-input" type="checkbox" id="infiniteRegalAya" />
|
||||
<label class="form-check-label" for="infiniteRegalAya" data-loc="cheats_infiniteRegalAya"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="infiniteHelminthMaterials" />
|
||||
<label class="form-check-label" for="infiniteHelminthMaterials" data-loc="cheats_infiniteHelminthMaterials"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" />
|
||||
<label class="form-check-label" for="unlockAllShipFeatures" data-loc="cheats_unlockAllShipFeatures"></label>
|
||||
|
@ -99,6 +99,7 @@ dict = {
|
||||
cheats_infinitePlatinum: `Infinite Platinum`,
|
||||
cheats_infiniteEndo: `Infinite Endo`,
|
||||
cheats_infiniteRegalAya: `Infinite Regal Aya`,
|
||||
cheats_infiniteHelminthMaterials: `Infinite Helminth Materials`,
|
||||
cheats_unlockAllShipFeatures: `Unlock All Ship Features`,
|
||||
cheats_unlockAllShipDecorations: `Unlock All Ship Decorations`,
|
||||
cheats_unlockAllFlavourItems: `Unlock All <abbr title=\"Animation Sets, Glyphs, Plattes, etc.\">Flavor Items</abbr>`,
|
||||
|
@ -100,6 +100,7 @@ dict = {
|
||||
cheats_infinitePlatinum: `Бесконечная платина`,
|
||||
cheats_infiniteEndo: `Бесконечное эндо`,
|
||||
cheats_infiniteRegalAya: `Бесконечная Королевская Айя`,
|
||||
cheats_infiniteHelminthMaterials: `[UNTRANSLATED] Infinite Helminth Materials`,
|
||||
cheats_unlockAllShipFeatures: `Разблокировать все функции корабля`,
|
||||
cheats_unlockAllShipDecorations: `Разблокировать все украшения корабля`,
|
||||
cheats_unlockAllFlavourItems: `Разблокировать все <abbr title=\"Наборы анимаций, глифы, палитры и т. д.\">уникальные предметы</abbr>`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user