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): don't send off 2 addXp requests at once (#2815)

One would likely fail due to Mongoose's array versioning Closes #2811 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2815 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

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

代码差异

1 个文件 +7 -12
Modified static/webui/script.js +7 -12
@@ -837,10 +837,9 @@ function updateInventory() {
837 837 a.href = "#";
838 838 a.onclick = function (event) {
839 839 event.preventDefault();
840 revalidateAuthz().then(() => {
841 const promises = [];
840 revalidateAuthz().then(async () => {
842 841 if (item.XP < maxXP) {
843 promises.push(addGearExp(category, item.ItemId.$oid, maxXP - item.XP));
842 await addGearExp(category, item.ItemId.$oid, maxXP - item.XP);
844 843 }
845 844 if ("exalted" in itemMap[item.ItemType]) {
846 845 for (const exaltedType of itemMap[item.ItemType].exalted) {
@@ -851,20 +850,16 @@ function updateInventory() {
851 850 const exaltedCap =
852 851 itemMap[exaltedType]?.type == "weapons" ? 800_000 : 1_600_000;
853 852 if (exaltedItem.XP < exaltedCap) {
854 promises.push(
855 addGearExp(
856 "SpecialItems",
857 exaltedItem.ItemId.$oid,
858 exaltedCap - exaltedItem.XP
859 )
853 await addGearExp(
854 "SpecialItems",
855 exaltedItem.ItemId.$oid,
856 exaltedCap - exaltedItem.XP
860 857 );
861 858 }
862 859 }
863 860 }
864 861 }
865 Promise.all(promises).then(() => {
866 updateInventory();
867 });
862 updateInventory();
868 863 });
869 864 };
870 865 a.title = loc("code_maxRank");