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

chore: simplify syncing of challenge 'Completed' field (#2603)

Challenges are mostly client-authoritative, so narrow the special-casing to "challengeRewards". Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2603 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

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

代码差异

1 个文件 +5 -2
Modified src/services/inventoryService.ts +5 -2
@@ -1980,17 +1980,20 @@ export const addChallenges = async (
1980 1980 dbChallenge.Completed ??= [];
1981 1981 for (const completion of Completed!) {
1982 1982 if (dbChallenge.Completed.indexOf(completion) == -1) {
1983 dbChallenge.Completed.push(completion);
1983 1984 if (completion == "challengeRewards") {
1984 1985 if (Name in challengeRewardsInboxMessages) {
1985 1986 await createMessage(account._id, [challengeRewardsInboxMessages[Name]]);
1986 dbChallenge.Completed.push(completion);
1987 1987 // Would love to somehow let the client know about inbox or inventory changes, but there doesn't seem to anything for updateChallengeProgress.
1988 1988 continue;
1989 1989 }
1990 logger.warn(`ignoring unknown challenge completion`, { challenge: Name, completion });
1991 dbChallenge.Completed = [];
1990 1992 }
1991 logger.warn(`ignoring unknown challenge completion`, { challenge: Name, completion });
1992 1993 }
1993 1994 }
1995 } else {
1996 dbChallenge.Completed = Completed;
1994 1997 }
1995 1998 }
1996 1999