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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

feat: add spoofMasteryRank config (#229)

Co-authored-by: Sainan <Sainan@users.noreply.github.com>

2e8c94d3
Sainan <sainan@calamity.gg>
提交于

代码差异

3 个文件 +26 -1
Modified config.json.example +2 -1
@@ -17,5 +17,6 @@
17 17 "infiniteResources": true,
18 18 "unlockallShipFeatures": true,
19 19 "unlockAllShipDecorations": true,
20 "unlockAllFlavourItems": true
20 "unlockAllFlavourItems": true,
21 "spoofMasteryRank": -1
21 22 }
Modified src/controllers/api/inventoryController.ts +23 -0
@@ -51,7 +51,30 @@ const inventoryController: RequestHandler = async (request: Request, response: R
51 51 if (config.unlockAllShipDecorations) inventoryResponse.ShipDecorations = allShipDecorations;
52 52 if (config.unlockAllFlavourItems) inventoryResponse.FlavourItems = allFlavourItems satisfies IFlavourItem[];
53 53
54 if (
55 typeof config.spoofMasteryRank === "number" &&
56 config.spoofMasteryRank >= 0 &&
57 config.spoofMasteryRank <= 5030
58 ) {
59 inventoryResponse.PlayerLevel = config.spoofMasteryRank;
60 inventoryResponse.XPInfo = [];
61 let numFrames = getExpRequiredForMr(config.spoofMasteryRank) / 6000;
62 while (numFrames-- > 0) {
63 inventoryResponse.XPInfo.push({
64 ItemType: "/Lotus/Powersuits/Mag/Mag",
65 XP: 1_600_000
66 });
67 }
68 }
69
54 70 response.json(inventoryResponse);
55 71 };
56 72
73 const getExpRequiredForMr = (rank: number): number => {
74 if (rank <= 30) {
75 return 2500 * rank * rank;
76 }
77 return 2_250_000 + 147_500 * (rank - 30);
78 };
79
57 80 export { inventoryController };
Modified src/services/configService.ts +1 -0
@@ -16,6 +16,7 @@ interface IConfig {
16 16 unlockallShipFeatures?: boolean;
17 17 unlockAllShipDecorations?: boolean;
18 18 unlockAllFlavourItems?: boolean;
19 spoofMasteryRank?: number;
19 20 }
20 21
21 22 interface ILoggerConfig {