mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-21 20:22:48 +00:00
fix(dashboard): coins, universe score, imagination, reputation and life from the locale
Pages label the game's currencies and stats with the client's words (UI_COINS, UI_UNIVERSE_SCORE, UI_IMAGINATION, UI_REPUTATION, UI_HEALTH) through game.terms and GameText.term instead of writing them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,9 +27,9 @@
|
||||
}).join('');
|
||||
var r = m.rewards, rewards = [];
|
||||
if (r) {
|
||||
if (r.coins) rewards.push(nf.format(r.coins) + ' coins');
|
||||
if (r.uscore) rewards.push(nf.format(r.uscore) + ' U-score');
|
||||
if (r.reputation) rewards.push(nf.format(r.reputation) + ' reputation');
|
||||
if (r.coins) rewards.push(nf.format(r.coins) + ' ' + GameText.term('coins'));
|
||||
if (r.uscore) rewards.push(nf.format(r.uscore) + ' ' + GameText.term('uscore'));
|
||||
if (r.reputation) rewards.push(nf.format(r.reputation) + ' ' + GameText.term('reputation'));
|
||||
r.items.forEach(function (i) { rewards.push(nf.format(i.count) + 'x ' + (i.name || 'LOT ' + i.lot)); });
|
||||
}
|
||||
return (tasks ? '<ul class="small mb-1">' + tasks + '</ul>' : '') +
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
function describeChanges() {
|
||||
var body = buildEdit(), parts = [];
|
||||
['coins', 'uscore', 'level'].forEach(function (k) { if (body[k] !== undefined) parts.push(k === 'uscore' ? 'U-score' : k); });
|
||||
['coins', 'uscore', 'level'].forEach(function (k) { if (body[k] !== undefined) parts.push(k === 'level' ? k : GameText.term(k)); });
|
||||
if (body.counts) parts.push(Object.keys(body.counts).length + ' count(s)');
|
||||
if (body.remove) parts.push(body.remove.length + ' removed');
|
||||
if (body.add) parts.push(body.add.length + ' added');
|
||||
@@ -148,8 +148,8 @@
|
||||
|
||||
function compare(before, after) {
|
||||
var rows = [];
|
||||
[['coins', 'Coins'], ['uscore', 'U-score'], ['level', 'Level'], ['missions_done', 'Missions done']].forEach(function (f) {
|
||||
if (before[f[0]] !== after[f[0]]) rows.push('<tr><td>' + f[1] + '</td><td>' + nf.format(before[f[0]]) + '</td><td>' + nf.format(after[f[0]]) + '</td></tr>');
|
||||
[['coins', GameText.term('coins')], ['uscore', GameText.term('uscore')], ['level', 'Level'], ['missions_done', 'Missions done']].forEach(function (f) {
|
||||
if (before[f[0]] !== after[f[0]]) rows.push('<tr><td>' + esc(f[1]) + '</td><td>' + nf.format(before[f[0]]) + '</td><td>' + nf.format(after[f[0]]) + '</td></tr>');
|
||||
});
|
||||
var a = itemsById(before), b = itemsById(after);
|
||||
Object.keys(a).forEach(function (id) {
|
||||
|
||||
@@ -495,14 +495,14 @@
|
||||
switch (type) {
|
||||
case 'treasure_hunt':
|
||||
return '<div class="mb-2"><label class="form-label small" for="evp-' + i + '-lot">Treasure</label><input class="form-control form-control-sm" id="evp-' + i + '-lot" data-search="treasure" data-p="' + i + '" data-f="config.lot" data-value="' + esc(c.lot || '') + '" value="' + esc(c.lot ? 'LOT ' + c.lot : '') + '" placeholder="Search objects"></div>' +
|
||||
'<div class="row g-2">' + ['count|Treasures|1', 'coins|Coins per find|0', 'radius|Pickup distance|2'].map(function (x) {
|
||||
'<div class="row g-2">' + ['count|Treasures|1', 'coins|' + esc(GameText.term('coins')) + ' per find|0', 'radius|Pickup distance|2'].map(function (x) {
|
||||
var bits = x.split('|');
|
||||
return '<div class="col-4">' + field(i, 'config.' + bits[0], bits[1], c[bits[0]], 'type="number" min="' + bits[2] + '" step="any"') + '</div>';
|
||||
}).join('') + '</div>' +
|
||||
'<div class="row g-2"><div class="col-8"><label class="form-label small" for="evp-' + i + '-item">Item reward <span class="text-body-secondary">(optional)</span></label><input class="form-control form-control-sm" id="evp-' + i + '-item" data-search="item" data-p="' + i + '" data-f="config.itemLot" data-value="' + esc(c.itemLot || '') + '" value="' + esc(c.itemLot ? 'LOT ' + c.itemLot : '') + '" placeholder="Search items"></div>' +
|
||||
'<div class="col-4">' + field(i, 'config.itemCount', 'Count', c.itemCount, 'type="number" min="1" max="999"') + '</div></div>';
|
||||
case 'bonus':
|
||||
return '<div class="row g-2">' + ['coins|Coins ×', 'uscore|U-score ×', 'lootChance|Loot chance ×'].map(function (x) {
|
||||
return '<div class="row g-2">' + ['coins|' + esc(GameText.term('coins')) + ' ×', 'uscore|' + esc(GameText.term('uscore')) + ' ×', 'lootChance|Loot chance ×'].map(function (x) {
|
||||
var bits = x.split('|');
|
||||
return '<div class="col-4">' + field(i, 'config.' + bits[0], bits[1], c[bits[0]], 'type="number" min="1" step="0.1"') + '</div>';
|
||||
}).join('') + '</div>';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
var set = o ? esc(o.price) + ' coins' + (o.periodDays ? ' / ' + esc(o.periodDays) + ' days' : '') +
|
||||
'<div class="small text-body-secondary">' + esc(o.updated_by) + ', ' + esc(fmt.unix(o.updated_at)) + '</div>' : '<span class="text-body-secondary">Template</span>';
|
||||
var edit = canManage ? '<form class="d-flex gap-1 justify-content-end" data-map="' + esc(w.mapId) + '">' +
|
||||
'<input type="number" class="form-control form-control-sm" style="width:7rem" min="0" name="price" placeholder="Coins" value="' + (o ? esc(o.price) : '') + '" aria-label="Price">' +
|
||||
'<input type="number" class="form-control form-control-sm" style="width:7rem" min="0" name="price" placeholder="' + esc(GameText.term('coins')) + '" value="' + (o ? esc(o.price) : '') + '" aria-label="Price">' +
|
||||
'<input type="number" class="form-control form-control-sm" style="width:6rem" min="0" name="days" placeholder="Days" value="' + (o && o.periodDays ? esc(o.periodDays) : '') + '" aria-label="Period in days">' +
|
||||
'<button type="submit" class="btn btn-sm btn-primary">Save</button>' +
|
||||
(o ? '<button type="button" class="btn btn-sm btn-outline-secondary" data-reset="' + esc(w.mapId) + '">Template</button>' : '') + '</form>' : '';
|
||||
|
||||
@@ -246,8 +246,8 @@
|
||||
sourceTable(document.getElementById(ids.sources), summary, labels);
|
||||
}
|
||||
|
||||
var COIN_LABELS = { title: 'Coins', up: 'Coins gained', down: 'Coins spent' };
|
||||
var USCORE_LABELS = { title: 'U-score', up: 'U-score gained', down: 'U-score lost' };
|
||||
var COIN_LABELS = { title: GameText.term('coins'), up: GameText.term('coins') + ' gained', down: GameText.term('coins') + ' spent' };
|
||||
var USCORE_LABELS = { title: GameText.term('uscore'), up: GameText.term('uscore') + ' gained', down: GameText.term('uscore') + ' lost' };
|
||||
var ITEM_LABELS = { title: 'Items', up: 'Items created', down: 'Items destroyed' };
|
||||
|
||||
function loadCoins() {
|
||||
@@ -575,7 +575,7 @@
|
||||
|
||||
// ---- Saved views ----
|
||||
var TAB_TARGETS = { coins: '#tabCoins', uscore: '#tabUScore', items: '#tabItems', activity: '#tabActivity', map: '#tabMap', transfers: '#tabTransfers', trace: '#tabTrace', dupes: '#tabDupes', flags: '#tabFlags' };
|
||||
var TAB_NAMES = { coins: 'Coins', uscore: 'U-Score', items: 'Items', activity: 'Activity', map: 'World Map', transfers: 'Trades & Mail', trace: 'Trace', dupes: 'Duplicates', flags: 'Flags' };
|
||||
var TAB_NAMES = { coins: GameText.term('coins'), uscore: GameText.term('uscore'), items: 'Items', activity: 'Activity', map: 'World Map', transfers: 'Trades & Mail', trace: 'Trace', dupes: 'Duplicates', flags: 'Flags' };
|
||||
var views = [], emailReady = false;
|
||||
|
||||
function currentTab() {
|
||||
@@ -699,7 +699,7 @@
|
||||
transfersTable = serverTable('#transfersTable', '/api/reports/transfers', [
|
||||
{ data: 'time', orderable: false, render: function (d) { return esc(fmt.unix(d)); } },
|
||||
{ data: 'method', orderable: false, render: function (d) { return methodBadge(d); } },
|
||||
{ data: 'lot', orderable: false, render: function (d, t, row) { return d ? itemLink(d, row.name) : '<span class="text-body-secondary">Coins</span>'; } },
|
||||
{ data: 'lot', orderable: false, render: function (d, t, row) { return d ? itemLink(d, row.name) : '<span class="text-body-secondary">' + esc(GameText.term('coins')) + '</span>'; } },
|
||||
{ data: 'count', orderable: false, className: 'text-end', render: function (d) { return d ? num(d) : ''; } },
|
||||
{ data: 'coins', orderable: false, className: 'text-end', render: function (d) { return d ? num(d) : ''; } },
|
||||
{ data: 'from_character', orderable: false, render: function (d, t, row) { return charLink(d, row.from_name); } },
|
||||
@@ -852,7 +852,7 @@
|
||||
el.innerHTML = '<p class="text-body-secondary mb-0">Nothing recorded.</p>';
|
||||
} else {
|
||||
el.innerHTML = '<table class="table table-sm align-middle mb-0"><thead><tr><th>Time</th><th>How</th><th>From</th><th>To</th><th>Zone</th>' +
|
||||
'<th class="text-end">Count</th><th class="text-end">Coins</th><th>Old ID → new ID</th></tr></thead><tbody>' +
|
||||
'<th class="text-end">Count</th><th class="text-end">' + esc(GameText.term('coins')) + '</th><th>Old ID → new ID</th></tr></thead><tbody>' +
|
||||
history.map(function (h) {
|
||||
var marks = [];
|
||||
if (h.role === 'BRANCH') marks.push('<span class="badge text-bg-light border" title="Another part of a stack this item came from">other part</span>');
|
||||
|
||||
Reference in New Issue
Block a user