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

feat(webui): change SupportedSyndicate (#923)

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

90b6d139
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

5 个文件 +44 -1
Modified src/controllers/custom/getItemListsController.ts +8 -0
@@ -8,6 +8,7 @@ import {
8 8 ExportRecipes,
9 9 ExportResources,
10 10 ExportSentinels,
11 ExportSyndicates,
11 12 ExportUpgrades,
12 13 ExportWarframes,
13 14 ExportWeapons
@@ -36,6 +37,7 @@ const getItemListsController: RequestHandler = (req, response) => {
36 37 res.SpaceSuits = [];
37 38 res.MechSuits = [];
38 39 res.miscitems = [];
40 res.Syndicates = [];
39 41 for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
40 42 if (
41 43 item.productCategory == "Suits" ||
@@ -160,6 +162,12 @@ const getItemListsController: RequestHandler = (req, response) => {
160 162 badItems[uniqueName] = true;
161 163 }
162 164 }
165 for (const [uniqueName, syndicate] of Object.entries(ExportSyndicates)) {
166 res.Syndicates.push({
167 uniqueName,
168 name: getString(syndicate.name, lang)
169 });
170 }
163 171
164 172 response.json({
165 173 badItems,
Modified static/webui/index.html +9 -0
@@ -465,6 +465,15 @@
465 465 <div class="card-body">
466 466 <p><button class="btn btn-primary" onclick="doUnlockAllFocusSchools();" data-loc="cheats_unlockAllFocusSchools"></button></p>
467 467 <button class="btn btn-primary" onclick="doHelminthUnlockAll();" data-loc="cheats_helminthUnlockAll"></button>
468 <form class="mt-2" onsubmit="doChangeSupportedSyndicate(); return false;">
469 <label class="form-label" for="changeSyndicate" data-loc="cheats_changeSupportedSyndicate"></label>
470 <div class="input-group">
471 <select class="form-control" id="changeSyndicate">
472 <option value="" data-loc="cheats_none"></option>
473 </select>
474 <button class="btn btn-primary" type="submit" data-loc="cheats_changeButton"></button>
475 </div>
476 </form>
468 477 </div>
469 478 </div>
470 479 </div>
Modified static/webui/script.js +20 -0
@@ -191,6 +191,15 @@ function fetchItemList() {
191 191 });
192 192 } else if (type == "uniqueLevelCaps") {
193 193 uniqueLevelCaps = items;
194 } else if (type == "Syndicates") {
195 items.forEach(item => {
196 if (item.uniqueName.startsWith("RadioLegion")) item.name += " (" + item.uniqueName + ")";
197 const option = document.createElement("option");
198 option.value = item.uniqueName;
199 option.innerHTML = item.name;
200 document.getElementById("changeSyndicate").appendChild(option);
201 itemMap[item.uniqueName] = { ...item, type };
202 });
194 203 } else if (type != "badItems") {
195 204 items.forEach(item => {
196 205 if (item.uniqueName in data.badItems) {
@@ -524,6 +533,8 @@ function updateInventory() {
524 533 single.loadRoute("/webui/inventory");
525 534 }
526 535 }
536
537 document.getElementById("changeSyndicate").value = data.SupportedSyndicate ?? "";
527 538 });
528 539 });
529 540 }
@@ -1096,3 +1107,12 @@ function doImport() {
1096 1107 });
1097 1108 });
1098 1109 }
1110
1111 function doChangeSupportedSyndicate() {
1112 const uniqueName = document.getElementById("changeSyndicate").value;
1113 revalidateAuthz(() => {
1114 $.get("/api/setSupportedSyndicate.php?" + window.authz + "&syndicate=" + uniqueName).done(function () {
1115 updateInventory();
1116 });
1117 });
1118 }
Modified static/webui/translations/en.js +3 -0
@@ -106,6 +106,9 @@ dict = {
106 106 cheats_account: `Account`,
107 107 cheats_unlockAllFocusSchools: `Unlock All Focus Schools`,
108 108 cheats_helminthUnlockAll: `Fully Level Up Helminth`,
109 cheats_changeSupportedSyndicate: `Supported syndicate`,
110 cheats_changeButton: `Change`,
111 cheats_none: `None`,
109 112 import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
110 113 import_submit: `Submit`,
111 114 }
Modified static/webui/translations/ru.js +4 -1
@@ -107,6 +107,9 @@ dict = {
107 107 cheats_account: `Аккаунт`,
108 108 cheats_unlockAllFocusSchools: `Разблокировать все школы фокуса`,
109 109 cheats_helminthUnlockAll: `Полностью улучшить Гельминта`,
110 cheats_changeSupportedSyndicate: `Поддерживаемый синдикат`,
111 cheats_changeButton: `Изменить`,
112 cheats_none: `Отсутствует`,
110 113 import_importNote: `Вы можете загрузить полный или частичный ответ инвентаря (клиентское представление) здесь. Все поддерживаемые поля <b>будут перезаписаны</b> в вашем аккаунте.`,
111 114 import_submit: `Отправить`,
112 }
115 }