返回提交历史
Added
static/webui/RivenParser.js
+1178
-0
Modified
static/webui/index.html
+17
-4
Modified
static/webui/script.js
+71
-2
Modified
static/webui/style.css
+6
-0
XFEstudio/XFESpaceNinjaServer
feat(webui): Add list of owned rivens (#241)
Co-authored-by: Sainan <Sainan@users.noreply.github.com>
cfcdaae6
代码差异
4 个文件
+1272
-6
@@ -51,8 +51,12 @@
51
51
</div>
52
52
<div class="offcanvas-body">
53
53
<ul>
54
<li><a href="/webui/inventory">Inventory</a></li>
55
<li><a href="/webui/mods">Mods</a></li>
54
<li>
55
<a href="/webui/inventory" data-bs-dismiss="offcanvas" data-bs-target="#sidebar"
56
>Inventory</a
57
>
58
</li>
59
<li><a href="/webui/mods" data-bs-dismiss="offcanvas" data-bs-target="#sidebar">Mods</a></li>
56
60
</ul>
57
61
</div>
58
62
</div>
@@ -87,7 +91,7 @@
87
91
<div class="card mb-4">
88
92
<h5 class="card-header">Warframes</h5>
89
93
<div class="card-body">
90
<table class="table table-striped w-100">
94
<table class="table table-hover w-100">
91
95
<tbody id="warframe-list"></tbody>
92
96
</table>
93
97
<form class="input-group" onsubmit="doAcquireWarframe();return false;">
@@ -105,7 +109,7 @@
105
109
<div class="card mb-4">
106
110
<h5 class="card-header">Weapons</h5>
107
111
<div class="card-body">
108
<table class="table table-striped w-100">
112
<table class="table table-hover w-100">
109
113
<tbody id="weapon-list"></tbody>
110
114
</table>
111
115
<form class="input-group" onsubmit="doAcquireWeapon();return false;">
@@ -139,6 +143,14 @@
139
143
<a href="https://riven.builds.wf/" target="_blank">Need help with the fingerprint?</a>
140
144
</form>
141
145
</div>
146
<div class="card mb-4 col-xxl-6">
147
<h5 class="card-header">Rivens</h5>
148
<div class="card-body">
149
<table class="table table-hover w-100">
150
<tbody id="riven-list"></tbody>
151
</table>
152
</div>
153
</div>
142
154
</div>
143
155
</div>
144
156
</div>
@@ -152,6 +164,7 @@
152
164
></script>
153
165
<script src="https://cdn.jsdelivr.net/gh/angeal185/whirlpool-js/dist/whirlpool-js.min.js"></script>
154
166
<script src="single.js"></script>
167
<script src="RivenParser.js"></script>
155
168
<script src="script.js"></script>
156
169
<script
157
170
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
@@ -95,6 +95,14 @@ window.itemListPromise = new Promise(resolve => {
95
95
});
96
96
});
97
97
98
const rivenGenericCompatNames = {
99
"/Lotus/Weapons/Tenno/Archwing/Primary/ArchGun": "Archgun",
100
"/Lotus/Weapons/Tenno/Melee/PlayerMeleeWeapon": "Melee",
101
"/Lotus/Weapons/Tenno/Pistol/LotusPistol": "Pistol",
102
"/Lotus/Weapons/Tenno/Rifle/LotusRifle": "Rifle",
103
"/Lotus/Weapons/Tenno/Shotgun/LotusShotgun": "Shotgun"
104
};
105
98
106
function updateInventory() {
99
107
const req = $.get("/api/inventory.php?" + window.authz);
100
108
req.done(data => {
@@ -180,6 +188,65 @@ function updateInventory() {
180
188
document.getElementById("weapon-list").appendChild(tr);
181
189
});
182
190
});
191
192
document.getElementById("riven-list").innerHTML = "";
193
data.Upgrades.forEach(item => {
194
if (item.ItemType.substr(0, 32) == "/Lotus/Upgrades/Mods/Randomized/") {
195
const rivenType = item.ItemType.substr(32);
196
const fingerprint = JSON.parse(item.UpgradeFingerprint);
197
198
const tr = document.createElement("tr");
199
{
200
const td = document.createElement("td");
201
td.textContent =
202
itemMap[fingerprint.compat]?.name ??
203
rivenGenericCompatNames[fingerprint.compat] ??
204
fingerprint.compat;
205
td.textContent += " " + RivenParser.parseRiven(rivenType, fingerprint, 1).name;
206
td.innerHTML += " <span title='Number of buffs'>▲ " + fingerprint.buffs.length + "</span>";
207
td.innerHTML += " <span title='Number of curses'>▼ " + fingerprint.curses.length + "</span>";
208
td.innerHTML +=
209
" <span title='Number of rerolls'>⟳ " + parseInt(fingerprint.rerolls) + "</span>";
210
tr.appendChild(td);
211
}
212
{
213
const td = document.createElement("td");
214
td.classList = "text-end";
215
{
216
const a = document.createElement("a");
217
a.href =
218
"https://riven.builds.wf/#" +
219
encodeURIComponent(
220
JSON.stringify({
221
rivenType: rivenType,
222
omegaAttenuation: 1,
223
fingerprint: fingerprint
224
})
225
);
226
a.target = "_blank";
227
a.textContent = "View Stats";
228
td.appendChild(a);
229
}
230
{
231
const span = document.createElement("span");
232
span.innerHTML = " · ";
233
td.appendChild(span);
234
}
235
{
236
const a = document.createElement("a");
237
a.href = "#";
238
a.onclick = function (event) {
239
event.preventDefault();
240
disposeOfGear("Upgrades", item.ItemId.$oid);
241
};
242
a.textContent = "Remove";
243
td.appendChild(a);
244
}
245
tr.appendChild(td);
246
}
247
document.getElementById("riven-list").appendChild(tr);
248
}
249
});
183
250
});
184
251
});
185
252
}
@@ -272,7 +339,8 @@ function disposeOfGear(category, oid) {
272
339
};
273
340
data.Items[category] = [
274
341
{
275
String: oid
342
String: oid,
343
Count: 0
276
344
}
277
345
];
278
346
revalidateAuthz(() => {
@@ -365,7 +433,8 @@ function doAcquireRiven() {
365
433
FusionPointCost: 0
366
434
})
367
435
}).done(function () {
368
alert("Successfully added.");
436
$("#addriven-fingerprint").val("");
437
updateInventory();
369
438
});
370
439
break;
371
440
}
@@ -5,6 +5,12 @@
5
5
gap: 1.5rem;
6
6
}
7
7
8
body.logged-in #sidebar {
9
position: sticky;
10
top: 5rem;
11
height: 100px;
12
}
13
8
14
body:not(.logged-in) #sidebar {
9
15
display: none;
10
16
}