返回提交历史
Modified
src/services/importService.ts
+18
-18
XFEstudio/XFESpaceNinjaServer
fix: slight logic error in importService (#846)
90f05c47
代码差异
1 个文件
+18
-18
@@ -129,18 +129,18 @@ const convertDialogueHistory = (client: IDialogueHistoryClient): IDialogueHistor
129
129
130
130
export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<IInventoryClient>): void => {
131
131
for (const key of equipmentKeys) {
132
if (client[key]) {
132
if (client[key] !== undefined) {
133
133
replaceArray<IEquipmentDatabase>(db[key], client[key].map(convertEquipment));
134
134
}
135
135
}
136
if (client.WeaponSkins) {
136
if (client.WeaponSkins !== undefined) {
137
137
replaceArray<IWeaponSkinDatabase>(db.WeaponSkins, client.WeaponSkins.map(convertWeaponSkin));
138
138
}
139
if (client.Upgrades) {
139
if (client.Upgrades !== undefined) {
140
140
replaceArray<IUpgradeDatabase>(db.Upgrades, client.Upgrades.map(convertUpgrade));
141
141
}
142
142
for (const key of ["RawUpgrades", "MiscItems"] as const) {
143
if (client[key]) {
143
if (client[key] !== undefined) {
144
144
db[key].splice(0, db[key].length);
145
145
client[key].forEach(x => {
146
146
db[key].push({
@@ -151,7 +151,7 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
151
151
}
152
152
}
153
153
for (const key of ["OperatorLoadOuts", "AdultOperatorLoadOuts"] as const) {
154
if (client[key]) {
154
if (client[key] !== undefined) {
155
155
replaceArray<IOperatorConfigDatabase>(db[key], client[key].map(convertOperatorConfig));
156
156
}
157
157
}
@@ -169,11 +169,11 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
169
169
"OperatorAmpBin",
170
170
"CrewShipSalvageBin"
171
171
] as const) {
172
if (client[key]) {
172
if (client[key] !== undefined) {
173
173
replaceSlots(db[key], client[key]);
174
174
}
175
175
}
176
if (client.UseAdultOperatorLoadout) {
176
if (client.UseAdultOperatorLoadout !== undefined) {
177
177
db.UseAdultOperatorLoadout = client.UseAdultOperatorLoadout;
178
178
}
179
179
for (const key of [
@@ -184,42 +184,42 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
184
184
"FusionPoints",
185
185
"PrimeTokens"
186
186
] as const) {
187
if (client[key]) {
187
if (client[key] !== undefined) {
188
188
db[key] = client[key];
189
189
}
190
190
}
191
191
for (const key of ["ThemeStyle", "ThemeBackground", "ThemeSounds", "EquippedInstrument", "FocusAbility"] as const) {
192
if (client[key]) {
192
if (client[key] !== undefined) {
193
193
db[key] = client[key];
194
194
}
195
195
}
196
196
for (const key of ["EquippedGear", "EquippedEmotes", "NodeIntrosCompleted"] as const) {
197
if (client[key]) {
197
if (client[key] !== undefined) {
198
198
db[key] = client[key];
199
199
}
200
200
}
201
if (client.XPInfo) {
201
if (client.XPInfo !== undefined) {
202
202
db.XPInfo = client.XPInfo;
203
203
}
204
if (client.CurrentLoadOutIds) {
204
if (client.CurrentLoadOutIds !== undefined) {
205
205
db.CurrentLoadOutIds = client.CurrentLoadOutIds;
206
206
}
207
if (client.Affiliations) {
207
if (client.Affiliations !== undefined) {
208
208
db.Affiliations = client.Affiliations;
209
209
}
210
if (client.FusionTreasures) {
210
if (client.FusionTreasures !== undefined) {
211
211
db.FusionTreasures = client.FusionTreasures;
212
212
}
213
if (client.FocusUpgrades) {
213
if (client.FocusUpgrades !== undefined) {
214
214
db.FocusUpgrades = client.FocusUpgrades;
215
215
}
216
if (client.CrewShips) {
216
if (client.CrewShips !== undefined) {
217
217
replaceArray<ICrewShipDatabase>(db.CrewShips, client.CrewShips.map(convertCrewShip));
218
218
}
219
if (client.InfestedFoundry) {
219
if (client.InfestedFoundry !== undefined) {
220
220
db.InfestedFoundry = convertInfestedFoundry(client.InfestedFoundry);
221
221
}
222
if (client.DialogueHistory) {
222
if (client.DialogueHistory !== undefined) {
223
223
db.DialogueHistory = convertDialogueHistory(client.DialogueHistory);
224
224
}
225
225
};