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

fix: apply 'Title' from AffilationChanges in mission report (#4340)

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

864d8d83
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +27 -15
Modified src/services/inventoryService.ts +22 -2
@@ -32,7 +32,7 @@ import type {
32 32 } from "../types/inventoryTypes/inventoryTypes.ts";
33 33 import { eInventorySlot, equipmentKeys, slotNames } from "../types/inventoryTypes/inventoryTypes.ts";
34 34 import type { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdateTypes.ts";
35 import type { IGoalsProgress, IKeyChainRequest } from "../types/requestTypes.ts";
35 import type { IAffiliationChange, IGoalsProgress, IKeyChainRequest } from "../types/requestTypes.ts";
36 36 import { logger } from "../utils/logger.ts";
37 37 import {
38 38 convertInboxMessage,
@@ -1886,7 +1886,6 @@ const updateStandingLimit = (
1886 1886
1887 1887 export const eStandingSource = {
1888 1888 Medallion: 0b101, // Effect on daily cap depends on syndicate. Propagates to aligned syndicates.
1889 Mission: 0b000, // Does not apply/update daily cap. Does not propagate to aligned syndicates. (In mission report, the client provides all the affiliation & bin changes.)
1890 1889 Alignment: 0b010, // Applies & updates daily cap. Does not propagate to aligned syndicates (to avoid infinite recursion).
1891 1890 Misc: 0b011 // Applies & updates daily cap. Propagates to aligned syndicates.
1892 1891 };
@@ -2869,6 +2868,27 @@ export const setBooster = (ItemType: string, expiryTimeSecs: number, inventory:
2869 2868 }
2870 2869 };
2871 2870
2871 export const updateSyndicate = (
2872 inventory: Pick<TInventoryDatabaseDocument, "Affiliations">,
2873 syndicateUpdate: IAffiliationChange[]
2874 ): void => {
2875 for (const affiliation of syndicateUpdate) {
2876 const syndicate = inventory.Affiliations.find(x => x.Tag == affiliation.Tag);
2877 if (syndicate !== undefined) {
2878 syndicate.Standing += affiliation.Standing;
2879 syndicate.Title = syndicate.Title === undefined ? affiliation.Title : syndicate.Title + affiliation.Title;
2880 } else {
2881 inventory.Affiliations.push({
2882 Standing: affiliation.Standing,
2883 Title: affiliation.Title,
2884 Tag: affiliation.Tag,
2885 FreeFavorsEarned: [],
2886 FreeFavorsUsed: []
2887 });
2888 }
2889 }
2890 };
2891
2872 2892 /**
2873 2893 * @returns object with inventory keys of changes or empty object when no items were added
2874 2894 */
Modified src/services/missionInventoryUpdateService.ts +4 -12
@@ -46,7 +46,6 @@ import {
46 46 combineInventoryChanges,
47 47 CurrencyType,
48 48 ensureUserHasSteelPathRewards,
49 eStandingSource,
50 49 getDialogue,
51 50 giveNemesisPetRecipe,
52 51 giveNemesisWeaponRecipe,
@@ -55,7 +54,8 @@ import {
55 54 processGoalProgressUpdates,
56 55 updateCurrency,
57 56 updateEntratiVault,
58 updateIncentiveStates
57 updateIncentiveStates,
58 updateSyndicate
59 59 } from "./inventoryService.ts";
60 60 import { addQuestKey, updateQuestKey } from "./questService.ts";
61 61 import { Types } from "mongoose";
@@ -364,16 +364,8 @@ export const addMissionInventoryUpdates = async (
364 364 await updateQuestKey(inventory, value);
365 365 break;
366 366 case "AffiliationChanges":
367 for (const affiliation of value) {
368 await addStanding(
369 inventory,
370 buildLabel,
371 affiliation.Tag,
372 affiliation.Standing,
373 undefined,
374 eStandingSource.Mission
375 );
376 }
367 // Update 'Standing' and 'Title'. Associated alignment & limit bin updates are also provided by the client.
368 updateSyndicate(inventory, value);
377 369 break;
378 370 // Incarnon Challenges
379 371 case "EvolutionProgress": {
Modified src/types/requestTypes.ts +1 -1
@@ -32,7 +32,7 @@ import type { ILoadOutPresets } from "./saveLoadoutTypes.ts";
32 32 import type { IEquipmentClient } from "./equipmentTypes.ts";
33 33 import type { TMissionType } from "warframe-public-export-plus";
34 34
35 interface IAffiliationChange {
35 export interface IAffiliationChange {
36 36 Tag: string;
37 37 Standing: number;
38 38 Title: number;