XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

feat: replace infiniteResources with infiniteCredits & infinitePlatinum (#588)

8a43eae2
Sainan <sainan@calamity.inc>
提交于

代码差异

7 个文件 +29 -20
Modified config.json.example +2 -1
@@ -16,7 +16,8 @@
16 16 "unlockAllMissions": true,
17 17 "unlockAllQuests": true,
18 18 "completeAllQuests": false,
19 "infiniteResources": true,
19 "infiniteCredits": true,
20 "infinitePlatinum": true,
20 21 "unlockAllShipFeatures": true,
21 22 "unlockAllShipDecorations": true,
22 23 "unlockAllFlavourItems": true,
Modified src/controllers/api/getCreditsController.ts +13 -12
@@ -13,21 +13,22 @@ export const getCreditsController: RequestHandler = async (req, res) => {
13 13 return;
14 14 }
15 15
16 if (config.infiniteResources) {
17 res.json({
18 RegularCredits: 999999999,
19 TradesRemaining: 999999999,
20 PremiumCreditsFree: 999999999,
21 PremiumCredits: 999999999
22 });
23 return;
24 }
25
26 16 const inventory = await getInventory(accountId);
27 res.json({
17
18 const response = {
28 19 RegularCredits: inventory.RegularCredits,
29 20 TradesRemaining: inventory.TradesRemaining,
30 21 PremiumCreditsFree: inventory.PremiumCreditsFree,
31 22 PremiumCredits: inventory.PremiumCredits
32 });
23 };
24
25 if (config.infiniteCredits) {
26 response.RegularCredits = 999999999;
27 }
28 if (config.infinitePlatinum) {
29 response.PremiumCreditsFree = 999999999;
30 response.PremiumCredits = 999999999;
31 }
32
33 res.json(response);
33 34 };
Modified src/controllers/api/inventoryController.ts +3 -2
@@ -33,9 +33,10 @@ const inventoryController: RequestHandler = async (request, response) => {
33 33
34 34 const inventoryResponse = toInventoryResponse(inventoryJSON);
35 35
36 if (config.infiniteResources) {
36 if (config.infiniteCredits) {
37 37 inventoryResponse.RegularCredits = 999999999;
38 inventoryResponse.TradesRemaining = 999999999;
38 }
39 if (config.infinitePlatinum) {
39 40 inventoryResponse.PremiumCreditsFree = 999999999;
40 41 inventoryResponse.PremiumCredits = 999999999;
41 42 }
Modified src/services/configService.ts +2 -1
@@ -33,7 +33,8 @@ interface IConfig {
33 33 unlockAllMissions?: boolean;
34 34 unlockAllQuests?: boolean;
35 35 completeAllQuests?: boolean;
36 infiniteResources?: boolean;
36 infiniteCredits?: boolean;
37 infinitePlatinum?: boolean;
37 38 unlockAllShipFeatures?: boolean;
38 39 unlockAllShipDecorations?: boolean;
39 40 unlockAllFlavourItems?: boolean;
Modified src/services/inventoryService.ts +1 -1
@@ -419,7 +419,7 @@ export const updateSlots = async (accountId: string, slotName: SlotNames, slotAm
419 419 };
420 420
421 421 export const updateCurrency = async (price: number, usePremium: boolean, accountId: string) => {
422 if (config.infiniteResources) {
422 if (usePremium ? config.infinitePlatinum : config.infiniteCredits) {
423 423 return {};
424 424 }
425 425
Modified static/webui/index.html +6 -2
@@ -209,8 +209,12 @@
209 209 <label class="form-check-label" for="completeAllQuests">Complete All Quests</label>
210 210 </div>
211 211 <div class="form-check">
212 <input class="form-check-input" type="checkbox" id="infiniteResources" />
213 <label class="form-check-label" for="infiniteResources">Infinite Credits and Platinum</label>
212 <input class="form-check-input" type="checkbox" id="infiniteCredits" />
213 <label class="form-check-label" for="infiniteCredits">Infinite Credits</label>
214 </div>
215 <div class="form-check">
216 <input class="form-check-input" type="checkbox" id="infinitePlatinum" />
217 <label class="form-check-label" for="infinitePlatinum">Infinite Platinum</label>
214 218 </div>
215 219 <div class="form-check">
216 220 <input class="form-check-input" type="checkbox" id="unlockAllShipFeatures" />
Modified static/webui/script.js +2 -1
@@ -736,7 +736,8 @@ const uiConfigs = [
736 736 "unlockAllMissions",
737 737 "unlockAllQuests",
738 738 "completeAllQuests",
739 "infiniteResources",
739 "infiniteCredits",
740 "infinitePlatinum",
740 741 "unlockAllShipFeatures",
741 742 "unlockAllShipDecorations",
742 743 "unlockAllFlavourItems",