返回提交历史
Modified
config.json.example
+4
-0
Modified
src/services/configService.ts
+4
-0
Modified
src/services/purchaseService.ts
+51
-39
Modified
static/webui/index.html
+18
-2
Modified
static/webui/translations/de.js
+5
-1
Modified
static/webui/translations/en.js
+5
-1
Modified
static/webui/translations/es.js
+4
-0
Modified
static/webui/translations/fr.js
+5
-1
Modified
static/webui/translations/ru.js
+5
-1
Modified
static/webui/translations/zh.js
+5
-1
XFEstudio/XFESpaceNinjaServer
feat: dontSubtractVendor{Credit,Platinum,Item,Standing}Cost cheats (#2209)
Closes #1586 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2209 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
88d4ba63
代码差异
10 个文件
+106
-46
@@ -20,6 +20,10 @@
20
20
"infiniteRegalAya": false,
21
21
"infiniteHelminthMaterials": false,
22
22
"claimingBlueprintRefundsIngredients": false,
23
"dontSubtractPurchaseCreditCost": false,
24
"dontSubtractPurchasePlatinumCost": false,
25
"dontSubtractPurchaseItemCost": false,
26
"dontSubtractPurchaseStandingCost": false,
23
27
"dontSubtractVoidTraces": false,
24
28
"dontSubtractConsumables": false,
25
29
"unlockAllShipFeatures": false,
@@ -25,6 +25,10 @@ export interface IConfig {
25
25
infiniteRegalAya?: boolean;
26
26
infiniteHelminthMaterials?: boolean;
27
27
claimingBlueprintRefundsIngredients?: boolean;
28
dontSubtractPurchaseCreditCost?: boolean;
29
dontSubtractPurchasePlatinumCost?: boolean;
30
dontSubtractPurchaseItemCost?: boolean;
31
dontSubtractPurchaseStandingCost?: boolean;
28
32
dontSubtractVoidTraces?: boolean;
29
33
dontSubtractConsumables?: boolean;
30
34
unlockAllShipFeatures?: boolean;
@@ -67,25 +67,31 @@ export const handlePurchase = async (
67
67
if (!offer) {
68
68
throw new Error(`unknown vendor offer: ${ItemId ? ItemId : purchaseRequest.PurchaseParams.StoreItem}`);
69
69
}
70
if (offer.RegularPrice) {
71
combineInventoryChanges(
72
prePurchaseInventoryChanges,
73
updateCurrency(inventory, offer.RegularPrice[0], false)
74
);
70
if (!config.dontSubtractPurchaseCreditCost) {
71
if (offer.RegularPrice) {
72
combineInventoryChanges(
73
prePurchaseInventoryChanges,
74
updateCurrency(inventory, offer.RegularPrice[0], false)
75
);
76
}
75
77
}
76
if (offer.PremiumPrice) {
77
combineInventoryChanges(
78
prePurchaseInventoryChanges,
79
updateCurrency(inventory, offer.PremiumPrice[0], true)
80
);
78
if (!config.dontSubtractPurchasePlatinumCost) {
79
if (offer.PremiumPrice) {
80
combineInventoryChanges(
81
prePurchaseInventoryChanges,
82
updateCurrency(inventory, offer.PremiumPrice[0], true)
83
);
84
}
81
85
}
82
if (offer.ItemPrices) {
83
handleItemPrices(
84
inventory,
85
offer.ItemPrices,
86
purchaseRequest.PurchaseParams.Quantity,
87
prePurchaseInventoryChanges
88
);
86
if (!config.dontSubtractPurchaseItemCost) {
87
if (offer.ItemPrices) {
88
handleItemPrices(
89
inventory,
90
offer.ItemPrices,
91
purchaseRequest.PurchaseParams.Quantity,
92
prePurchaseInventoryChanges
93
);
94
}
89
95
}
90
96
if (offer.LocTagRandSeed !== undefined) {
91
97
seed = BigInt(offer.LocTagRandSeed);
@@ -179,21 +185,25 @@ export const handlePurchase = async (
179
185
x => x.ItemType == purchaseRequest.PurchaseParams.StoreItem
180
186
);
181
187
if (offer) {
182
combineInventoryChanges(
183
purchaseResponse.InventoryChanges,
184
updateCurrency(inventory, offer.RegularPrice, false)
185
);
188
if (!config.dontSubtractPurchaseCreditCost) {
189
combineInventoryChanges(
190
purchaseResponse.InventoryChanges,
191
updateCurrency(inventory, offer.RegularPrice, false)
192
);
193
}
186
194
if (purchaseRequest.PurchaseParams.ExpectedPrice) {
187
195
throw new Error(`vendor purchase should not have an expected price`);
188
196
}
189
197
190
const invItem: IMiscItem = {
191
ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks",
192
ItemCount: offer.PrimePrice * purchaseRequest.PurchaseParams.Quantity * -1
193
};
194
addMiscItems(inventory, [invItem]);
195
purchaseResponse.InventoryChanges.MiscItems ??= [];
196
purchaseResponse.InventoryChanges.MiscItems.push(invItem);
198
if (!config.dontSubtractPurchaseItemCost) {
199
const invItem: IMiscItem = {
200
ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks",
201
ItemCount: offer.PrimePrice * purchaseRequest.PurchaseParams.Quantity * -1
202
};
203
addMiscItems(inventory, [invItem]);
204
purchaseResponse.InventoryChanges.MiscItems ??= [];
205
purchaseResponse.InventoryChanges.MiscItems.push(invItem);
206
}
197
207
}
198
208
break;
199
209
}
@@ -211,7 +221,7 @@ export const handlePurchase = async (
211
221
Title: lastTitle
212
222
}
213
223
];
214
} else {
224
} else if (!config.dontSubtractPurchaseStandingCost) {
215
225
const syndicate = ExportSyndicates[syndicateTag];
216
226
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
217
227
if (syndicate) {
@@ -239,19 +249,19 @@ export const handlePurchase = async (
239
249
const vendor = ExportVendors[purchaseRequest.PurchaseParams.SourceId!];
240
250
const offer = vendor.items.find(x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem);
241
251
if (offer) {
242
if (typeof offer.credits == "number") {
252
if (typeof offer.credits == "number" && !config.dontSubtractPurchaseCreditCost) {
243
253
combineInventoryChanges(
244
254
purchaseResponse.InventoryChanges,
245
255
updateCurrency(inventory, offer.credits, false)
246
256
);
247
257
}
248
if (typeof offer.platinum == "number") {
258
if (typeof offer.platinum == "number" && !config.dontSubtractPurchasePlatinumCost) {
249
259
combineInventoryChanges(
250
260
purchaseResponse.InventoryChanges,
251
261
updateCurrency(inventory, offer.platinum, true)
252
262
);
253
263
}
254
if (offer.itemPrices) {
264
if (offer.itemPrices && !config.dontSubtractPurchaseItemCost) {
255
265
handleItemPrices(
256
266
inventory,
257
267
offer.itemPrices,
@@ -278,15 +288,17 @@ export const handlePurchase = async (
278
288
);
279
289
if (offer) {
280
290
if (offer.RegularPrice) {
281
const invItem: IMiscItem = {
282
ItemType: "/Lotus/Types/Items/MiscItems/SchismKey",
283
ItemCount: offer.RegularPrice * purchaseRequest.PurchaseParams.Quantity * -1
284
};
291
if (!config.dontSubtractPurchaseItemCost) {
292
const invItem: IMiscItem = {
293
ItemType: "/Lotus/Types/Items/MiscItems/SchismKey",
294
ItemCount: offer.RegularPrice * purchaseRequest.PurchaseParams.Quantity * -1
295
};
285
296
286
addMiscItems(inventory, [invItem]);
297
addMiscItems(inventory, [invItem]);
287
298
288
purchaseResponse.InventoryChanges.MiscItems ??= [];
289
purchaseResponse.InventoryChanges.MiscItems.push(invItem);
299
purchaseResponse.InventoryChanges.MiscItems ??= [];
300
purchaseResponse.InventoryChanges.MiscItems.push(invItem);
301
}
290
302
} else if (!config.infiniteRegalAya) {
291
303
inventory.PrimeTokens -= offer.PrimePrice! * purchaseRequest.PurchaseParams.Quantity;
292
304
@@ -604,13 +604,29 @@
604
604
<input class="form-check-input" type="checkbox" id="infiniteRegalAya" />
605
605
<label class="form-check-label" for="infiniteRegalAya" data-loc="cheats_infiniteRegalAya"></label>
606
606
</div>
607
<div class="form-check">
608
<input class="form-check-input" type="checkbox" id="infiniteHelminthMaterials" />
609
<label class="form-check-label" for="infiniteHelminthMaterials" data-loc="cheats_infiniteHelminthMaterials"></label>
610
</div>
607
611
<div class="form-check">
608
612
<input class="form-check-input" type="checkbox" id="claimingBlueprintRefundsIngredients" />
609
613
<label class="form-check-label" for="claimingBlueprintRefundsIngredients" data-loc="cheats_claimingBlueprintRefundsIngredients"></label>
610
614
</div>
611
615
<div class="form-check">
612
<input class="form-check-input" type="checkbox" id="infiniteHelminthMaterials" />
613
<label class="form-check-label" for="infiniteHelminthMaterials" data-loc="cheats_infiniteHelminthMaterials"></label>
616
<input class="form-check-input" type="checkbox" id="dontSubtractPurchaseCreditCost" />
617
<label class="form-check-label" for="dontSubtractPurchaseCreditCost" data-loc="cheats_dontSubtractPurchaseCreditCost"></label>
618
</div>
619
<div class="form-check">
620
<input class="form-check-input" type="checkbox" id="dontSubtractPurchasePlatinumCost" />
621
<label class="form-check-label" for="dontSubtractPurchasePlatinumCost" data-loc="cheats_dontSubtractPurchasePlatinumCost"></label>
622
</div>
623
<div class="form-check">
624
<input class="form-check-input" type="checkbox" id="dontSubtractPurchaseItemCost" />
625
<label class="form-check-label" for="dontSubtractPurchaseItemCost" data-loc="cheats_dontSubtractPurchaseItemCost"></label>
626
</div>
627
<div class="form-check">
628
<input class="form-check-input" type="checkbox" id="dontSubtractPurchaseStandingCost" />
629
<label class="form-check-label" for="dontSubtractPurchaseStandingCost" data-loc="cheats_dontSubtractPurchaseStandingCost"></label>
614
630
</div>
615
631
<div class="form-check">
616
632
<input class="form-check-input" type="checkbox" id="dontSubtractVoidTraces" />
@@ -135,11 +135,15 @@ dict = {
135
135
cheats_infiniteRegalAya: `Unendlich Reines Aya`,
136
136
cheats_infiniteHelminthMaterials: `Unendlich Helminth-Materialien`,
137
137
cheats_claimingBlueprintRefundsIngredients: `Fertige Blaupausen erstatten Ressourcen zurück`,
138
cheats_dontSubtractPurchaseCreditCost: `[UNTRANSLATED] Don't Subtract Purchase Credit Cost`,
139
cheats_dontSubtractPurchasePlatinumCost: `[UNTRANSLATED] Don't Subtract Purchase Platinum Cost`,
140
cheats_dontSubtractPurchaseItemCost: `[UNTRANSLATED] Don't Subtract Purchase Item Cost`,
141
cheats_dontSubtractPurchaseStandingCost: `[UNTRANSLATED] Don't Subtract Purchase Standing Cost`,
138
142
cheats_dontSubtractVoidTraces: `Void-Spuren nicht verbrauchen`,
139
143
cheats_dontSubtractConsumables: `Verbrauchsgegenstände (Ausrüstung) nicht verbrauchen`,
140
144
cheats_unlockAllShipFeatures: `Alle Schiffs-Funktionen freischalten`,
141
145
cheats_unlockAllShipDecorations: `Alle Schiffsdekorationen freischalten`,
142
cheats_unlockAllFlavourItems: `Alle <abbr title=\"Animationssets, Glyphen, Farbpaletten usw.\">Sammlerstücke</abbr> freischalten`,
146
cheats_unlockAllFlavourItems: `Alle <abbr title="Animationssets, Glyphen, Farbpaletten usw.">Sammlerstücke</abbr> freischalten`,
143
147
cheats_unlockAllSkins: `Alle Skins freischalten`,
144
148
cheats_unlockAllCapturaScenes: `Alle Photora-Szenen freischalten`,
145
149
cheats_unlockAllDecoRecipes: `Alle Dojo-Deko-Baupläne freischalten`,
@@ -134,11 +134,15 @@ dict = {
134
134
cheats_infiniteRegalAya: `Infinite Regal Aya`,
135
135
cheats_infiniteHelminthMaterials: `Infinite Helminth Materials`,
136
136
cheats_claimingBlueprintRefundsIngredients: `Claiming Blueprint Refunds Ingredients`,
137
cheats_dontSubtractPurchaseCreditCost: `Don't Subtract Purchase Credit Cost`,
138
cheats_dontSubtractPurchasePlatinumCost: `Don't Subtract Purchase Platinum Cost`,
139
cheats_dontSubtractPurchaseItemCost: `Don't Subtract Purchase Item Cost`,
140
cheats_dontSubtractPurchaseStandingCost: `Don't Subtract Purchase Standing Cost`,
137
141
cheats_dontSubtractVoidTraces: `Don't Subtract Void Traces`,
138
142
cheats_dontSubtractConsumables: `Don't Subtract Consumables`,
139
143
cheats_unlockAllShipFeatures: `Unlock All Ship Features`,
140
144
cheats_unlockAllShipDecorations: `Unlock All Ship Decorations`,
141
cheats_unlockAllFlavourItems: `Unlock All <abbr title=\"Animation Sets, Glyphs, Palettes, etc.\">Flavor Items</abbr>`,
145
cheats_unlockAllFlavourItems: `Unlock All <abbr title="Animation Sets, Glyphs, Palettes, etc.">Flavor Items</abbr>`,
142
146
cheats_unlockAllSkins: `Unlock All Skins`,
143
147
cheats_unlockAllCapturaScenes: `Unlock All Captura Scenes`,
144
148
cheats_unlockAllDecoRecipes: `Unlock All Dojo Deco Recipes`,
@@ -135,6 +135,10 @@ dict = {
135
135
cheats_infiniteRegalAya: `Aya Real infinita`,
136
136
cheats_infiniteHelminthMaterials: `Materiales Helminto infinitos`,
137
137
cheats_claimingBlueprintRefundsIngredients: `Reclamar ingredientes devueltos por planos`,
138
cheats_dontSubtractPurchaseCreditCost: `[UNTRANSLATED] Don't Subtract Purchase Credit Cost`,
139
cheats_dontSubtractPurchasePlatinumCost: `[UNTRANSLATED] Don't Subtract Purchase Platinum Cost`,
140
cheats_dontSubtractPurchaseItemCost: `[UNTRANSLATED] Don't Subtract Purchase Item Cost`,
141
cheats_dontSubtractPurchaseStandingCost: `[UNTRANSLATED] Don't Subtract Purchase Standing Cost`,
138
142
cheats_dontSubtractVoidTraces: `No descontar vestigios del Vacío`,
139
143
cheats_dontSubtractConsumables: `No restar consumibles`,
140
144
cheats_unlockAllShipFeatures: `Desbloquear todas las funciones de nave`,
@@ -135,11 +135,15 @@ dict = {
135
135
cheats_infiniteRegalAya: `Aya Raffiné infini`,
136
136
cheats_infiniteHelminthMaterials: `Ressources d'Helminth infinies`,
137
137
cheats_claimingBlueprintRefundsIngredients: `Récupérer les items rend les ressources`,
138
cheats_dontSubtractPurchaseCreditCost: `[UNTRANSLATED] Don't Subtract Purchase Credit Cost`,
139
cheats_dontSubtractPurchasePlatinumCost: `[UNTRANSLATED] Don't Subtract Purchase Platinum Cost`,
140
cheats_dontSubtractPurchaseItemCost: `[UNTRANSLATED] Don't Subtract Purchase Item Cost`,
141
cheats_dontSubtractPurchaseStandingCost: `[UNTRANSLATED] Don't Subtract Purchase Standing Cost`,
138
142
cheats_dontSubtractVoidTraces: `Ne pas consommer de Void Traces`,
139
143
cheats_dontSubtractConsumables: `Ne pas retirer de consommables`,
140
144
cheats_unlockAllShipFeatures: `Débloquer tous les segments du vaisseau`,
141
145
cheats_unlockAllShipDecorations: `Débloquer toutes les décorations du vaisseau`,
142
cheats_unlockAllFlavourItems: `Débloquer tous les <abbr title=\"Animations, Glyphes, Palettes, etc.\">Flavor Items</abbr>`,
146
cheats_unlockAllFlavourItems: `Débloquer tous les <abbr title="Animations, Glyphes, Palettes, etc.">Flavor Items</abbr>`,
143
147
cheats_unlockAllSkins: `Débloquer tous les skins`,
144
148
cheats_unlockAllCapturaScenes: `Débloquer toutes les scènes captura`,
145
149
cheats_unlockAllDecoRecipes: `Débloquer toutes les recherches dojo`,
@@ -135,11 +135,15 @@ dict = {
135
135
cheats_infiniteRegalAya: `Бесконечная Королевская Айя`,
136
136
cheats_infiniteHelminthMaterials: `Бесконечные Выделения Гельминта`,
137
137
cheats_claimingBlueprintRefundsIngredients: `[UNTRANSLATED] Claiming Blueprint Refunds Ingredients`,
138
cheats_dontSubtractPurchaseCreditCost: `[UNTRANSLATED] Don't Subtract Purchase Credit Cost`,
139
cheats_dontSubtractPurchasePlatinumCost: `[UNTRANSLATED] Don't Subtract Purchase Platinum Cost`,
140
cheats_dontSubtractPurchaseItemCost: `[UNTRANSLATED] Don't Subtract Purchase Item Cost`,
141
cheats_dontSubtractPurchaseStandingCost: `[UNTRANSLATED] Don't Subtract Purchase Standing Cost`,
138
142
cheats_dontSubtractVoidTraces: `[UNTRANSLATED] Don't Subtract Void Traces`,
139
143
cheats_dontSubtractConsumables: `Не уменьшать количество расходников`,
140
144
cheats_unlockAllShipFeatures: `Разблокировать все функции корабля`,
141
145
cheats_unlockAllShipDecorations: `Разблокировать все украшения корабля`,
142
cheats_unlockAllFlavourItems: `Разблокировать все <abbr title=\"Наборы анимаций, глифы, палитры и т. д.\">уникальные предметы</abbr>`,
146
cheats_unlockAllFlavourItems: `Разблокировать все <abbr title="Наборы анимаций, глифы, палитры и т. д.">уникальные предметы</abbr>`,
143
147
cheats_unlockAllSkins: `Разблокировать все скины`,
144
148
cheats_unlockAllCapturaScenes: `Разблокировать все сцены Каптуры`,
145
149
cheats_unlockAllDecoRecipes: `Разблокировать все рецепты декораций Дoдзё`,
@@ -135,11 +135,15 @@ dict = {
135
135
cheats_infiniteRegalAya: `无限御品阿耶`,
136
136
cheats_infiniteHelminthMaterials: `无限Helminth材料`,
137
137
cheats_claimingBlueprintRefundsIngredients: `取消蓝图制造时返还材料`,
138
cheats_dontSubtractPurchaseCreditCost: `[UNTRANSLATED] Don't Subtract Purchase Credit Cost`,
139
cheats_dontSubtractPurchasePlatinumCost: `[UNTRANSLATED] Don't Subtract Purchase Platinum Cost`,
140
cheats_dontSubtractPurchaseItemCost: `[UNTRANSLATED] Don't Subtract Purchase Item Cost`,
141
cheats_dontSubtractPurchaseStandingCost: `[UNTRANSLATED] Don't Subtract Purchase Standing Cost`,
138
142
cheats_dontSubtractVoidTraces: `虚空光体无消耗`,
139
143
cheats_dontSubtractConsumables: `消耗物品使用时无损耗`,
140
144
cheats_unlockAllShipFeatures: `解锁所有飞船功能`,
141
145
cheats_unlockAllShipDecorations: `解锁所有飞船装饰`,
142
cheats_unlockAllFlavourItems: `解锁所有<abbr title=\"动画组合、图标、调色板等\">装饰物品</abbr>`,
146
cheats_unlockAllFlavourItems: `解锁所有<abbr title="动画组合、图标、调色板等">装饰物品</abbr>`,
143
147
cheats_unlockAllSkins: `解锁所有外观`,
144
148
cheats_unlockAllCapturaScenes: `解锁所有Captura场景`,
145
149
cheats_unlockAllDecoRecipes: `解锁所有道场配方`,