From 336998c9eec94674364bb37d1b178e9c43d24494 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Thu, 19 Jun 2025 18:21:44 +0200 Subject: [PATCH] feat: dontSubtractVendor{Credit,Platinum,Item,Standing}Cost cheats --- config.json.example | 4 ++ src/services/configService.ts | 4 ++ src/services/purchaseService.ts | 90 +++++++++++++++++++-------------- static/webui/index.html | 20 +++++++- static/webui/translations/de.js | 4 ++ static/webui/translations/en.js | 4 ++ static/webui/translations/es.js | 4 ++ static/webui/translations/fr.js | 4 ++ static/webui/translations/ru.js | 4 ++ static/webui/translations/zh.js | 4 ++ 10 files changed, 101 insertions(+), 41 deletions(-) diff --git a/config.json.example b/config.json.example index 8f839751..ecae09aa 100644 --- a/config.json.example +++ b/config.json.example @@ -20,6 +20,10 @@ "infiniteRegalAya": false, "infiniteHelminthMaterials": false, "claimingBlueprintRefundsIngredients": false, + "dontSubtractPurchaseCreditCost": false, + "dontSubtractPurchasePlatinumCost": false, + "dontSubtractPurchaseItemCost": false, + "dontSubtractPurchaseStandingCost": false, "dontSubtractVoidTraces": false, "dontSubtractConsumables": false, "unlockAllShipFeatures": false, diff --git a/src/services/configService.ts b/src/services/configService.ts index 0c09eb23..6dde7d53 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -25,6 +25,10 @@ export interface IConfig { infiniteRegalAya?: boolean; infiniteHelminthMaterials?: boolean; claimingBlueprintRefundsIngredients?: boolean; + dontSubtractPurchaseCreditCost?: boolean; + dontSubtractPurchasePlatinumCost?: boolean; + dontSubtractPurchaseItemCost?: boolean; + dontSubtractPurchaseStandingCost?: boolean; dontSubtractVoidTraces?: boolean; dontSubtractConsumables?: boolean; unlockAllShipFeatures?: boolean; diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index 59a431c3..4fb5bb2d 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -67,25 +67,31 @@ export const handlePurchase = async ( if (!offer) { throw new Error(`unknown vendor offer: ${ItemId ? ItemId : purchaseRequest.PurchaseParams.StoreItem}`); } - if (offer.RegularPrice) { - combineInventoryChanges( - prePurchaseInventoryChanges, - updateCurrency(inventory, offer.RegularPrice[0], false) - ); + if (!config.dontSubtractPurchaseCreditCost) { + if (offer.RegularPrice) { + combineInventoryChanges( + prePurchaseInventoryChanges, + updateCurrency(inventory, offer.RegularPrice[0], false) + ); + } } - if (offer.PremiumPrice) { - combineInventoryChanges( - prePurchaseInventoryChanges, - updateCurrency(inventory, offer.PremiumPrice[0], true) - ); + if (!config.dontSubtractPurchasePlatinumCost) { + if (offer.PremiumPrice) { + combineInventoryChanges( + prePurchaseInventoryChanges, + updateCurrency(inventory, offer.PremiumPrice[0], true) + ); + } } - if (offer.ItemPrices) { - handleItemPrices( - inventory, - offer.ItemPrices, - purchaseRequest.PurchaseParams.Quantity, - prePurchaseInventoryChanges - ); + if (!config.dontSubtractPurchaseItemCost) { + if (offer.ItemPrices) { + handleItemPrices( + inventory, + offer.ItemPrices, + purchaseRequest.PurchaseParams.Quantity, + prePurchaseInventoryChanges + ); + } } if (offer.LocTagRandSeed !== undefined) { seed = BigInt(offer.LocTagRandSeed); @@ -179,21 +185,25 @@ export const handlePurchase = async ( x => x.ItemType == purchaseRequest.PurchaseParams.StoreItem ); if (offer) { - combineInventoryChanges( - purchaseResponse.InventoryChanges, - updateCurrency(inventory, offer.RegularPrice, false) - ); + if (!config.dontSubtractPurchaseCreditCost) { + combineInventoryChanges( + purchaseResponse.InventoryChanges, + updateCurrency(inventory, offer.RegularPrice, false) + ); + } if (purchaseRequest.PurchaseParams.ExpectedPrice) { throw new Error(`vendor purchase should not have an expected price`); } - const invItem: IMiscItem = { - ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks", - ItemCount: offer.PrimePrice * purchaseRequest.PurchaseParams.Quantity * -1 - }; - addMiscItems(inventory, [invItem]); - purchaseResponse.InventoryChanges.MiscItems ??= []; - purchaseResponse.InventoryChanges.MiscItems.push(invItem); + if (!config.dontSubtractPurchaseItemCost) { + const invItem: IMiscItem = { + ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks", + ItemCount: offer.PrimePrice * purchaseRequest.PurchaseParams.Quantity * -1 + }; + addMiscItems(inventory, [invItem]); + purchaseResponse.InventoryChanges.MiscItems ??= []; + purchaseResponse.InventoryChanges.MiscItems.push(invItem); + } } break; } @@ -211,7 +221,7 @@ export const handlePurchase = async ( Title: lastTitle } ]; - } else { + } else if (!config.dontSubtractPurchaseStandingCost) { const syndicate = ExportSyndicates[syndicateTag]; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (syndicate) { @@ -239,19 +249,19 @@ export const handlePurchase = async ( const vendor = ExportVendors[purchaseRequest.PurchaseParams.SourceId!]; const offer = vendor.items.find(x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem); if (offer) { - if (typeof offer.credits == "number") { + if (typeof offer.credits == "number" && !config.dontSubtractPurchaseCreditCost) { combineInventoryChanges( purchaseResponse.InventoryChanges, updateCurrency(inventory, offer.credits, false) ); } - if (typeof offer.platinum == "number") { + if (typeof offer.platinum == "number" && !config.dontSubtractPurchasePlatinumCost) { combineInventoryChanges( purchaseResponse.InventoryChanges, updateCurrency(inventory, offer.platinum, true) ); } - if (offer.itemPrices) { + if (offer.itemPrices && !config.dontSubtractPurchaseItemCost) { handleItemPrices( inventory, offer.itemPrices, @@ -278,15 +288,17 @@ export const handlePurchase = async ( ); if (offer) { if (offer.RegularPrice) { - const invItem: IMiscItem = { - ItemType: "/Lotus/Types/Items/MiscItems/SchismKey", - ItemCount: offer.RegularPrice * purchaseRequest.PurchaseParams.Quantity * -1 - }; + if (!config.dontSubtractPurchaseItemCost) { + const invItem: IMiscItem = { + ItemType: "/Lotus/Types/Items/MiscItems/SchismKey", + ItemCount: offer.RegularPrice * purchaseRequest.PurchaseParams.Quantity * -1 + }; - addMiscItems(inventory, [invItem]); + addMiscItems(inventory, [invItem]); - purchaseResponse.InventoryChanges.MiscItems ??= []; - purchaseResponse.InventoryChanges.MiscItems.push(invItem); + purchaseResponse.InventoryChanges.MiscItems ??= []; + purchaseResponse.InventoryChanges.MiscItems.push(invItem); + } } else if (!config.infiniteRegalAya) { inventory.PrimeTokens -= offer.PrimePrice! * purchaseRequest.PurchaseParams.Quantity; diff --git a/static/webui/index.html b/static/webui/index.html index 9b9015a2..b6d87db4 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -604,13 +604,29 @@ +