refactor(personajes): replace per-character capacity table with single reference table (lv0-lv3, baseWeight 115.230)
CI / Build Native (push) Successful in 6m45s
CI / Build Native (push) Successful in 6m45s
This commit is contained in:
@@ -27,6 +27,12 @@ window.shots = {
|
|||||||
return w > 0 ? Math.floor(maxW / w) : 0;
|
return w > 0 ? Math.floor(maxW / w) : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
referenceCapacity(tipo, grado, skillLevel, baseWeight = 115230) {
|
||||||
|
const pesoMax = baseWeight * (1 + skillLevel);
|
||||||
|
const w = this.itemWeight(tipo, grado);
|
||||||
|
return w > 0 ? Math.floor(pesoMax / w) : 0;
|
||||||
|
},
|
||||||
|
|
||||||
totalCapacityOf(c) {
|
totalCapacityOf(c) {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
for (const t of this.TIPOS) {
|
for (const t of this.TIPOS) {
|
||||||
|
|||||||
@@ -157,65 +157,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article x-show="characters.length > 0">
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h2>💼 Capacidad de inventario de shots (por peso)</h2>
|
<h2>💼 Capacidad de inventario — Referencia (baseWeight 115.230)</h2>
|
||||||
<p class="text-sm text-muted">Cuántos shots de cada tipo×grado caben en el inventario según el pasivo de cada personaje. Peso máx = baseWeight × (1 + skillLevel).</p>
|
<p class="text-sm text-muted">Shots que entran según skill del personaje (peso máx = 115.230 × (1 + skillLevel)). Variará si tu personaje tiene otro baseWeight.</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="table-wrapper" style="overflow-x: auto;">
|
<div class="table-wrapper" style="overflow-x: auto;">
|
||||||
<table style="font-size: 0.75rem;">
|
<table style="font-size: 0.75rem;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="cell-label text-left" rowspan="2">Personaje</th>
|
<th class="cell-label text-left">Tipo</th>
|
||||||
<th class="cell-label text-center" rowspan="2">Clase / Lv</th>
|
<th class="cell-label text-center">Grado</th>
|
||||||
<th class="cell-label text-right" rowspan="2">Peso máx</th>
|
<th class="cell-label text-right">lv0 (×1)<br/><span class="text-xs text-mono" style="font-weight: normal;">115.230</span></th>
|
||||||
<template x-for="t in shots.TIPOS" :key="t">
|
<th class="cell-label text-right">lv1 (×2)<br/><span class="text-xs text-mono" style="font-weight: normal;">230.460</span></th>
|
||||||
<th class="cell-label text-center" colspan="5" x-text="shots.tipoShort(t)"></th>
|
<th class="cell-label text-right">lv2 (×3)<br/><span class="text-xs text-mono" style="font-weight: normal;">345.690</span></th>
|
||||||
</template>
|
<th class="cell-label text-right">lv3 (×4)<br/><span class="text-xs text-mono" style="font-weight: normal;">460.920</span></th>
|
||||||
<th class="cell-label text-right" rowspan="2">Total shots</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<template x-for="t in shots.TIPOS" :key="'h-' + t">
|
|
||||||
<template x-for="g in shots.GRADOS" :key="t + '-' + g">
|
|
||||||
<th class="cell-label text-center" x-text="g"></th>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<template x-for="c in characters" :key="c.id">
|
<template x-for="t in shots.TIPOS" :key="'row-' + t">
|
||||||
<tr>
|
<template x-for="g in shots.GRADOS" :key="'cell-' + t + '-' + g">
|
||||||
<td class="text-bold" x-text="c.name"></td>
|
<tr>
|
||||||
<td class="text-muted" style="white-space: nowrap;"
|
<td class="text-bold" x-text="t"></td>
|
||||||
x-text="c.characterClass + ' · Lv ' + c.level"></td>
|
<td class="text-center"><span class="grade-badge" x-text="g"></span></td>
|
||||||
<td class="text-right text-mono">
|
<td class="text-right text-mono" x-text="fmtAdena(shots.referenceCapacity(t, g, 0))"></td>
|
||||||
<span x-text="fmtAdena(shots.maxWeight(c))"></span>
|
<td class="text-right text-mono" x-text="fmtAdena(shots.referenceCapacity(t, g, 1))"></td>
|
||||||
<span class="text-xs"
|
<td class="text-right text-mono" x-text="fmtAdena(shots.referenceCapacity(t, g, 2))"></td>
|
||||||
:class="c.skillLevel > 0 ? 'badge-success' : 'badge-muted'"
|
<td class="text-right text-mono" x-text="fmtAdena(shots.referenceCapacity(t, g, 3))"></td>
|
||||||
style="margin-left: 0.25rem;"
|
</tr>
|
||||||
x-text="c.skillLevel === 0 ? 'sin pasivo' : '+' + (c.skillLevel * 100) + '%'"></span>
|
</template>
|
||||||
</td>
|
|
||||||
<template x-for="t in shots.TIPOS" :key="'r-' + t">
|
|
||||||
<template x-for="g in shots.GRADOS" :key="c.id + '-' + t + '-' + g">
|
|
||||||
<td class="text-right text-mono" x-text="fmtAdena(shots.capacityOf(c, t, g))"></td>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<td class="text-right text-mono text-bold" x-text="fmtAdena(shots.totalCapacityOf(c))"></td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
</template>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td class="cell-label" colspan="3">Totales</td>
|
|
||||||
<template x-for="t in shots.TIPOS" :key="'f-' + t">
|
|
||||||
<template x-for="g in shots.GRADOS" :key="'f-' + t + '-' + g">
|
|
||||||
<td class="text-right text-mono text-bold" x-text="fmtAdena(columnTotals[t + '-' + g])"></td>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<td class="text-right text-mono text-bold" x-text="fmtAdena(rowTotal())"></td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
@@ -228,11 +201,11 @@
|
|||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="/static/js/defaults.js?v=6"></script>
|
<script src="/static/js/defaults.js?v=7"></script>
|
||||||
<script src="/static/js/api.js?v=6"></script>
|
<script src="/static/js/api.js?v=7"></script>
|
||||||
<script src="/static/js/shots.js?v=6"></script>
|
<script src="/static/js/shots.js?v=7"></script>
|
||||||
<script src="/static/js/app.js?v=6"></script>
|
<script src="/static/js/app.js?v=7"></script>
|
||||||
<script defer src="/static/js/alpine.min.js?v=6"></script>
|
<script defer src="/static/js/alpine.min.js?v=7"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('alpine:init', () => {
|
document.addEventListener('alpine:init', () => {
|
||||||
@@ -266,7 +239,6 @@
|
|||||||
async loadCharacters() {
|
async loadCharacters() {
|
||||||
try {
|
try {
|
||||||
this.characters = await window.api.listCharacters();
|
this.characters = await window.api.listCharacters();
|
||||||
this.updateColumnTotals();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.error = e.message || 'Error cargando personajes';
|
this.error = e.message || 'Error cargando personajes';
|
||||||
} finally {
|
} finally {
|
||||||
@@ -302,47 +274,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
tipoShort(tipo) {
|
|
||||||
return window.shots.tipoShort(tipo);
|
|
||||||
},
|
|
||||||
|
|
||||||
maxWeightOf(c) {
|
maxWeightOf(c) {
|
||||||
return window.shots.maxWeight(c);
|
return window.shots.maxWeight(c);
|
||||||
},
|
}, async updateLevel(c) {
|
||||||
|
|
||||||
capacityOf(c, tipo, grado) {
|
|
||||||
return window.shots.capacityOf(c, tipo, grado);
|
|
||||||
},
|
|
||||||
|
|
||||||
totalCapacityOf(c) {
|
|
||||||
return window.shots.totalCapacityOf(c);
|
|
||||||
},
|
|
||||||
|
|
||||||
columnTotals: {},
|
|
||||||
|
|
||||||
rowTotal() {
|
|
||||||
let total = 0;
|
|
||||||
for (const c of this.characters) {
|
|
||||||
total += window.shots.totalCapacityOf(c);
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
},
|
|
||||||
|
|
||||||
updateColumnTotals() {
|
|
||||||
const totals = {};
|
|
||||||
for (const t of window.shots.TIPOS) {
|
|
||||||
for (const g of window.shots.GRADOS) {
|
|
||||||
let sum = 0;
|
|
||||||
for (const c of this.characters) {
|
|
||||||
sum += window.shots.capacityOf(c, t, g);
|
|
||||||
}
|
|
||||||
totals[t + '-' + g] = sum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.columnTotals = totals;
|
|
||||||
},
|
|
||||||
|
|
||||||
async updateLevel(c) {
|
|
||||||
if (c.level <= 0 || c.level > 100) {
|
if (c.level <= 0 || c.level > 100) {
|
||||||
c.level = Math.min(100, Math.max(1, c.level));
|
c.level = Math.min(100, Math.max(1, c.level));
|
||||||
}
|
}
|
||||||
@@ -360,7 +294,6 @@
|
|||||||
c.skillLevel = sk;
|
c.skillLevel = sk;
|
||||||
try {
|
try {
|
||||||
await window.api.updateCharacterWeight(c.id, bw, sk);
|
await window.api.updateCharacterWeight(c.id, bw, sk);
|
||||||
this.updateColumnTotals();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.error = e.message || 'Error al actualizar peso/skill';
|
this.error = e.message || 'Error al actualizar peso/skill';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user