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: steel path rewards (#4010)

Closes #3980 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4010 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

450c1c27
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

4 个文件 +178 -68
Modified src/controllers/api/inventoryController.ts +2 -1
@@ -33,6 +33,7 @@ import {
33 33 cleanupInventory,
34 34 createLibraryDailyTask,
35 35 ensureUserHasFounderHonoria,
36 ensureUserHasSteelPathRewards,
36 37 getCalendarProgress,
37 38 handleTauMemories,
38 39 PRE_U40_MAX_KUBROW_EGGS
@@ -251,7 +252,7 @@ export const inventoryController: RequestHandler = async (request, response) =>
251 252 if (inventory.Founder) {
252 253 await ensureUserHasFounderHonoria(inventory);
253 254 }
254
255 await ensureUserHasSteelPathRewards(inventory);
255 256 cleanupInventory(inventory);
256 257
257 258 inventory.NextRefill = new Date((today + 1) * 86400000); // tomorrow at 0 UTC
Modified src/controllers/custom/completeAllMissionsController.ts +60 -65
@@ -1,5 +1,5 @@
1 1 import { addString } from "../../helpers/stringHelpers.ts";
2 import { addChallenges, getInventory } from "../../services/inventoryService.ts";
2 import { addChallenges, ensureUserHasSteelPathRewards, getInventory } from "../../services/inventoryService.ts";
3 3 import { getAccountForRequest, getAccountIdForRequest } from "../../services/loginService.ts";
4 4 import { addFixedLevelRewards } from "../../services/missionInventoryUpdateService.ts";
5 5 import { handleStoreItemAcquisition } from "../../services/purchaseService.ts";
@@ -35,70 +35,65 @@ export const completeAllMissionsController: RequestHandler = async (req, res) =>
35 35 for (const reward of MissionRewards) {
36 36 await handleStoreItemAcquisition(reward.StoreItem, inventory, reward.ItemCount, undefined, true);
37 37 }
38 await addChallenges(
39 account,
40 inventory,
41 [
42 {
43 Progress: 1,
44 Name: `KillPhorid`
45 },
46 {
47 Progress: 1,
48 Name: `SaviourOfCeres`
49 },
50 {
51 Progress: 1,
52 Name: `SaviourOfEarth`
53 },
54 {
55 Progress: 1,
56 Name: `SaviourOfEuropa`
57 },
58 {
59 Progress: 1,
60 Name: `SaviourOfJupiter`
61 },
62 {
63 Progress: 1,
64 Name: `SaviourOfMars`
65 },
66 {
67 Progress: 1,
68 Name: `SaviourOfMercury`
69 },
70 {
71 Progress: 1,
72 Name: `SaviourOfNeptune`
73 },
74 {
75 Progress: 1,
76 Name: `SaviourOfPhobos`
77 },
78 {
79 Progress: 1,
80 Name: `SaviourOfPluto`
81 },
82 {
83 Progress: 1,
84 Name: `SaviourOfSaturn`
85 },
86 {
87 Progress: 1,
88 Name: `SaviourOfSedna`
89 },
90 {
91 Progress: 1,
92 Name: `SaviourOfUranus`
93 },
94 {
95 Progress: 1,
96 Name: `SaviourOfVenus`
97 }
98 ],
99 [],
100 {}
101 );
38 await addChallenges(account, inventory, [
39 {
40 Progress: 1,
41 Name: `KillPhorid`
42 },
43 {
44 Progress: 1,
45 Name: `SaviourOfCeres`
46 },
47 {
48 Progress: 1,
49 Name: `SaviourOfEarth`
50 },
51 {
52 Progress: 1,
53 Name: `SaviourOfEuropa`
54 },
55 {
56 Progress: 1,
57 Name: `SaviourOfJupiter`
58 },
59 {
60 Progress: 1,
61 Name: `SaviourOfMars`
62 },
63 {
64 Progress: 1,
65 Name: `SaviourOfMercury`
66 },
67 {
68 Progress: 1,
69 Name: `SaviourOfNeptune`
70 },
71 {
72 Progress: 1,
73 Name: `SaviourOfPhobos`
74 },
75 {
76 Progress: 1,
77 Name: `SaviourOfPluto`
78 },
79 {
80 Progress: 1,
81 Name: `SaviourOfSaturn`
82 },
83 {
84 Progress: 1,
85 Name: `SaviourOfSedna`
86 },
87 {
88 Progress: 1,
89 Name: `SaviourOfUranus`
90 },
91 {
92 Progress: 1,
93 Name: `SaviourOfVenus`
94 }
95 ]);
96 await ensureUserHasSteelPathRewards(inventory, true);
102 97 addString(inventory.NodeIntrosCompleted, "TeshinHardModeUnlocked");
103 98 addString(inventory.NodeIntrosCompleted, "CetusInvasionNodeIntro");
104 99 addString(inventory.NodeIntrosCompleted, "CetusSyndicate_IntroJob");
Modified src/services/inventoryService.ts +112 -2
@@ -60,9 +60,11 @@ import {
60 60 ExportKeys,
61 61 ExportRailjackWeapons,
62 62 ExportRecipes,
63 ExportRegions,
63 64 ExportResources,
64 65 ExportSentinels,
65 66 ExportSyndicates,
67 ExportSystems,
66 68 ExportUpgrades,
67 69 ExportWarframes,
68 70 ExportWeapons
@@ -2528,8 +2530,8 @@ export const addChallenges = async (
2528 2530 account: TAccountDocument,
2529 2531 inventory: TInventoryDatabaseDocument,
2530 2532 ChallengeProgress: IChallengeProgress[],
2531 SeasonChallengeCompletions: ISeasonChallenge[] | undefined,
2532 inventoryChanges: IInventoryChanges
2533 SeasonChallengeCompletions?: ISeasonChallenge[],
2534 inventoryChanges: IInventoryChanges = {}
2533 2535 ): Promise<IAffiliationMods[]> => {
2534 2536 for (const { Name, Progress, Completed } of ChallengeProgress) {
2535 2537 let dbChallenge = inventory.ChallengeProgress.find(x => x.Name == Name);
@@ -3264,3 +3266,111 @@ export const updateIncentiveStates = async (
3264 3266 }
3265 3267 }
3266 3268 };
3269
3270 const steelPathSystems: [number, string][] = [
3271 [0, "Mercury"],
3272 [1, "Venus"],
3273 [2, "Earth"],
3274 [3, "Mars"],
3275 [4, "Jupiter"],
3276 [5, "Saturn"],
3277 [6, "Uranus"],
3278 [7, "Neptune"],
3279 [8, "Pluto"],
3280 [9, "Ceres"],
3281 [10, "Eris"],
3282 [11, "Sedna"],
3283 [12, "Europa"],
3284 [14, "Void"],
3285 [15, "Phobos"],
3286 [16, "Deimos"],
3287 [17, "Lua"],
3288 [18, "KuvaFortress"],
3289 [21, "Zariman"],
3290 [22, "Duviri"],
3291 [23, "1999"],
3292 [24, "Perita"]
3293 ];
3294
3295 export const ensureUserHasSteelPathRewards = async (
3296 inventory: TInventoryDatabaseDocument,
3297 silent?: true
3298 ): Promise<void> => {
3299 const completedNodes = new Set<string>();
3300 for (const mission of inventory.Missions) {
3301 if (mission.Tier) {
3302 completedNodes.add(mission.Tag);
3303 }
3304 }
3305
3306 const eligibleSystems = new Set<number>(steelPathSystems.map(x => x[0]));
3307 for (const [tag, region] of Object.entries(ExportRegions)) {
3308 if (!completedNodes.has(tag)) {
3309 eligibleSystems.delete(region.systemIndex);
3310 }
3311 }
3312
3313 for (const systemIndex of eligibleSystems) {
3314 const systemShortName = steelPathSystems.find(x => x[0] == systemIndex)![1];
3315 const emoteItem = `/Lotus/Types/Items/Emotes/Hardmode${systemShortName}Emote`;
3316 if (!inventory.FlavourItems.some(x => x.ItemType == emoteItem)) {
3317 const countedAtt: ITypeCount[] = [];
3318
3319 const trophyItem: ITypeCount = {
3320 ItemType: `/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophy${systemShortName}Bronze`,
3321 ItemCount: 1
3322 };
3323 addShipDecorations(inventory, [trophyItem]);
3324 countedAtt.push(trophyItem);
3325
3326 if (systemIndex == 16) {
3327 const otherTropyItem: ITypeCount = {
3328 ItemType: `/Lotus/Types/Items/ShipDecos/PlanetTrophies/PlanetTrophyDerelictBronze`,
3329 ItemCount: 1
3330 };
3331 addShipDecorations(inventory, [otherTropyItem]);
3332 countedAtt.push(otherTropyItem);
3333 }
3334
3335 inventory.FlavourItems.push({ ItemType: emoteItem });
3336 countedAtt.push({
3337 ItemType: emoteItem,
3338 ItemCount: 1
3339 });
3340
3341 if (systemIndex == 16) {
3342 addCustomization(inventory, "/Lotus/Types/Items/Emotes/HardmodeDerelictEmote");
3343 countedAtt.push({
3344 ItemType: "/Lotus/Types/Items/Emotes/HardmodeDerelictEmote",
3345 ItemCount: 1
3346 });
3347 }
3348
3349 addMiscItem(inventory, "/Lotus/Types/Items/MiscItems/SteelEssence", 25);
3350 countedAtt.push({
3351 ItemType: "/Lotus/Types/Items/MiscItems/SteelEssence",
3352 ItemCount: 25
3353 });
3354
3355 if (!silent) {
3356 await createMessage(inventory.accountOwnerId, [
3357 {
3358 sndr: "/Lotus/Language/Bosses/Teshin",
3359 msg: "/Lotus/Language/Inbox/HardModeRewardMsgBody",
3360 arg: [
3361 {
3362 Key: "PLANET_NAME",
3363 Tag: ExportSystems[systemIndex].name
3364 }
3365 ],
3366 countedAtt,
3367 attVisualOnly: true,
3368 sub: "/Lotus/Language/Inbox/HardModeRewardMsgTitle",
3369 icon: "/Lotus/Interface/Icons/Npcs/Teshin.png",
3370 highPriority: true
3371 }
3372 ]);
3373 }
3374 }
3375 }
3376 };
Modified src/services/missionInventoryUpdateService.ts +4 -0
@@ -44,6 +44,7 @@ import {
44 44 applyClientEquipmentUpdates,
45 45 combineInventoryChanges,
46 46 CurrencyType,
47 ensureUserHasSteelPathRewards,
47 48 getDialogue,
48 49 giveNemesisPetRecipe,
49 50 giveNemesisWeaponRecipe,
@@ -367,6 +368,9 @@ export const addMissionInventoryUpdates = async (
367 368 }
368 369 case "Missions":
369 370 addMissionComplete(inventory, value);
371 if (value.Tier) {
372 await ensureUserHasSteelPathRewards(inventory);
373 }
370 374 break;
371 375 case "LastRegionPlayed":
372 376 if (!(config.unfaithfulBugFixes?.ignore1999LastRegionPlayed && value === "1999MapName")) {