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

fix(stats): push new enemy object after aplying changes to it (#3448)

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

7b8d5890
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

1 个文件 +3 -4
Modified src/services/statsService.ts +3 -4
@@ -148,10 +148,8 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
148 148
149 149 for (const [type, count] of Object.entries(data as IUploadEntry)) {
150 150 let enemy = playerStats.Enemies.find(element => element.type === type);
151 if (!enemy) {
152 enemy = { type: type };
153 playerStats.Enemies.push(enemy);
154 }
151 const isNew = !enemy;
152 if (!enemy) enemy = { type };
155 153 if (category === "KILL_ENEMY") {
156 154 enemy.kills ??= 0;
157 155 const captureCount = (actionData as IStatsAdd)["CAPTURE_ENEMY"]?.[type];
@@ -166,6 +164,7 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
166 164 enemy[enemyStatKey] ??= 0;
167 165 enemy[enemyStatKey] += count;
168 166 }
167 if (isNew) playerStats.Enemies.push(enemy);
169 168 }
170 169 break;
171 170 }