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(webui): update currency owned text in guild view after adding to it (#3819)

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

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

代码差异

2 个文件 +9 -2
Modified src/controllers/custom/addCurrencyController.ts +1 -0
@@ -19,6 +19,7 @@ export const addCurrencyController: RequestHandler = async (req, res) => {
19 19 guild[request.currency] ??= 0;
20 20 guild[request.currency]! += request.delta;
21 21 await guild.save();
22 res.json(guild[request.currency]);
22 23 }
23 24 } else {
24 25 inventory[request.currency] += request.delta;
Modified static/webui/script.js +8 -2
@@ -4427,8 +4427,14 @@ function doAddCurrency(currency) {
4427 4427 currency,
4428 4428 delta: document.getElementById(currency + "-delta").valueAsNumber
4429 4429 })
4430 }).then(function () {
4431 updateInventory();
4430 }).then(function (newValue) {
4431 if (currency.startsWith("Vault")) {
4432 document.getElementById(currency + "-owned").textContent = loc("guildView_currency_owned")
4433 .split("|COUNT|")
4434 .join((newValue ?? 0).toLocaleString());
4435 } else {
4436 updateInventory();
4437 }
4432 4438 });
4433 4439 });
4434 4440 }