Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a66dd7174 |
@@ -291,6 +291,14 @@
|
||||
.sessions-table td.dim{font-size:12px;color:var(--text-dim);}
|
||||
.hist-empty{padding:40px 0;text-align:center;color:var(--text-dim);font-size:14px;line-height:1.8;}
|
||||
@media(max-width:760px){.charts-2col{grid-template-columns:1fr;}}
|
||||
|
||||
/* ---------- Graphes en direct ---------- */
|
||||
.charts-3col{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;}
|
||||
@media(max-width:760px){.charts-3col{grid-template-columns:1fr;}}
|
||||
.live-chart-header{display:flex;justify-content:space-between;align-items:baseline;
|
||||
font-family:var(--font-mono);font-size:11px;margin-bottom:5px;}
|
||||
.live-chart-header .chart-label{color:var(--text-dim);}
|
||||
.live-chart-header .chart-val{font-size:12px;font-weight:600;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -394,6 +402,38 @@
|
||||
</div>
|
||||
<p class="economy-note">Le jeu ne transmet pas les ventes : fixe un prix par item dans le tableau « Loot » ci-dessous. Tes prix sont sauvegardés automatiquement.</p>
|
||||
|
||||
<div class="panel" id="liveChartsPanel" hidden>
|
||||
<div class="panel-head-row">
|
||||
<h2>Progression dans le temps <span class="muted">— snapshot toutes les 30s</span></h2>
|
||||
</div>
|
||||
<div class="charts-3col">
|
||||
<div>
|
||||
<div class="live-chart-header">
|
||||
<span class="chart-label">Kills / min</span>
|
||||
<span class="chart-val" id="liveChartKillsVal" style="color:var(--moss)">—</span>
|
||||
</div>
|
||||
<div class="chart-wrap" id="liveChartKills"></div>
|
||||
<div class="chart-label-row" id="liveChartKillsTime"><span></span><span></span></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="live-chart-header">
|
||||
<span class="chart-label">XP / min</span>
|
||||
<span class="chart-val" id="liveChartExpVal" style="color:var(--gold)">—</span>
|
||||
</div>
|
||||
<div class="chart-wrap" id="liveChartExp"></div>
|
||||
<div class="chart-label-row" id="liveChartExpTime"><span></span><span></span></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="live-chart-header">
|
||||
<span class="chart-label">Cols / min</span>
|
||||
<span class="chart-val" id="liveChartColsVal" style="color:var(--copper)">—</span>
|
||||
</div>
|
||||
<div class="chart-wrap" id="liveChartCols"></div>
|
||||
<div class="chart-label-row" id="liveChartColsTime"><span></span><span></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-toolbar">
|
||||
<h2>Stats de farm — cette session</h2>
|
||||
</div>
|
||||
@@ -875,7 +915,9 @@
|
||||
itemRows: new Map(),
|
||||
mobFilter: '',
|
||||
itemFilter: '',
|
||||
selectedDropMob: null
|
||||
selectedDropMob: null,
|
||||
timeline: [],
|
||||
timelineTimer: null
|
||||
};
|
||||
|
||||
// Retourne les stats à afficher : communauté si dispo et activé, sinon perso
|
||||
@@ -936,6 +978,8 @@
|
||||
renderAll();
|
||||
startPolling();
|
||||
startClock();
|
||||
if (resetCounters) state.timeline = [];
|
||||
startTimelineTimer();
|
||||
persistAppState(true);
|
||||
}
|
||||
|
||||
@@ -945,6 +989,7 @@
|
||||
state.paused = true;
|
||||
state.pauseStartedAt = Date.now();
|
||||
stopPolling();
|
||||
stopTimelineTimer();
|
||||
setStatus('paused', 'En pause');
|
||||
pauseBtn.textContent = '▶ Reprendre';
|
||||
flashMessage('Suivi en pause — le chrono et les cadences sont gelés.');
|
||||
@@ -958,6 +1003,7 @@
|
||||
setStatus('live', 'En direct — ' + state.logPath);
|
||||
pauseBtn.textContent = '⏸ Pause';
|
||||
startPolling();
|
||||
startTimelineTimer();
|
||||
flashMessage('Suivi repris.');
|
||||
}
|
||||
});
|
||||
@@ -977,9 +1023,13 @@
|
||||
state.pausedAccum = 0;
|
||||
if (state.paused) state.pauseStartedAt = Date.now();
|
||||
state.lastEventAt = null;
|
||||
state.timeline = [];
|
||||
const sizeRes = await window.api.getFileSize(state.logPath);
|
||||
state.lastSize = sizeRes.size || 0;
|
||||
state.carry = '';
|
||||
$('liveChartsPanel').hidden = true;
|
||||
stopTimelineTimer();
|
||||
if (!state.paused) startTimelineTimer();
|
||||
renderAll();
|
||||
persistAppState(true);
|
||||
flashMessage('Session réinitialisée (les chances de drop ne sont pas affectées).');
|
||||
@@ -1222,6 +1272,83 @@
|
||||
updateClock();
|
||||
}
|
||||
function pad(n){ return String(n).padStart(2,'0'); }
|
||||
|
||||
// ---------- Timeline / graphes en direct ----------
|
||||
|
||||
function snapshotTimeline(){
|
||||
if (!state.sessionStart || state.paused) return;
|
||||
const totalKills = sumValues(state.mobCounts);
|
||||
state.timeline.push({ t: Date.now(), kills: totalKills, exp: state.expTotal, cols: state.killCols });
|
||||
if (state.timeline.length > 180) state.timeline.shift();
|
||||
renderLiveCharts();
|
||||
}
|
||||
function startTimelineTimer(){
|
||||
stopTimelineTimer();
|
||||
snapshotTimeline();
|
||||
state.timelineTimer = setInterval(snapshotTimeline, 30000);
|
||||
}
|
||||
function stopTimelineTimer(){
|
||||
if (state.timelineTimer){ clearInterval(state.timelineTimer); state.timelineTimer = null; }
|
||||
}
|
||||
|
||||
function drawLiveChart(container, rates, colorHex){
|
||||
if (rates.length < 2){
|
||||
container.innerHTML = '<p class="chart-empty" style="font-size:11px;padding:6px 0;">En attente…</p>';
|
||||
return;
|
||||
}
|
||||
const W=400,H=55,padL=4,padR=4,padT=6,padB=4;
|
||||
const plotW=W-padL-padR,plotH=H-padT-padB,n=rates.length;
|
||||
const maxV=Math.max(...rates,0.01);
|
||||
const xs=rates.map((_,i)=>padL+(n===1?plotW/2:(i/(n-1))*plotW));
|
||||
const ys=rates.map(v=>padT+plotH-(Math.max(0,v)/maxV)*plotH);
|
||||
const linePath=xs.map((x,i)=>(i===0?'M':'L')+x.toFixed(1)+','+ys[i].toFixed(1)).join(' ');
|
||||
const areaPath=linePath+' L'+xs[n-1].toFixed(1)+','+(padT+plotH)+' L'+xs[0].toFixed(1)+','+(padT+plotH)+' Z';
|
||||
const grid=[0.5,1.0].map(pct=>{
|
||||
const y=(padT+plotH*(1-pct)).toFixed(1);
|
||||
return '<line x1="'+padL+'" y1="'+y+'" x2="'+(W-padR)+'" y2="'+y+'" stroke="#26301F" stroke-width="1"/>';
|
||||
}).join('');
|
||||
container.innerHTML=
|
||||
'<svg viewBox="0 0 '+W+' '+H+'" width="100%" height="'+H+'" xmlns="http://www.w3.org/2000/svg">'
|
||||
+grid
|
||||
+'<path d="'+areaPath+'" fill="'+colorHex+'" fill-opacity="0.13"/>'
|
||||
+'<path d="'+linePath+'" stroke="'+colorHex+'" fill="none" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>'
|
||||
+'</svg>';
|
||||
}
|
||||
|
||||
function fmtHHMM(ts){ const d=new Date(ts); return pad(d.getHours())+':'+pad(d.getMinutes()); }
|
||||
|
||||
function renderLiveCharts(){
|
||||
const snap = state.timeline;
|
||||
const panel = $('liveChartsPanel');
|
||||
if (snap.length < 1){ panel.hidden = true; return; }
|
||||
panel.hidden = false;
|
||||
|
||||
const killRates=[], expRates=[], colRates=[];
|
||||
for (let i=1; i<snap.length; i++){
|
||||
const dt=(snap[i].t-snap[i-1].t)/60000;
|
||||
if (dt<=0) continue;
|
||||
killRates.push((snap[i].kills-snap[i-1].kills)/dt);
|
||||
expRates.push((snap[i].exp-snap[i-1].exp)/dt);
|
||||
colRates.push((snap[i].cols-snap[i-1].cols)/dt);
|
||||
}
|
||||
|
||||
drawLiveChart($('liveChartKills'), killRates, '#6B8F5C');
|
||||
drawLiveChart($('liveChartExp'), expRates, '#F2C94C');
|
||||
drawLiveChart($('liveChartCols'), colRates, '#C97B4A');
|
||||
|
||||
const last = arr => arr.length ? arr[arr.length-1] : 0;
|
||||
$('liveChartKillsVal').textContent = fmt(last(killRates),1)+'/min';
|
||||
$('liveChartExpVal').textContent = fmt(last(expRates),1)+'/min';
|
||||
$('liveChartColsVal').textContent = fmt(last(colRates),1)+'/min';
|
||||
|
||||
if (snap.length >= 2){
|
||||
const t1=fmtHHMM(snap[0].t), t2=fmtHHMM(snap[snap.length-1].t);
|
||||
['KillsTime','ExpTime','ColsTime'].forEach(id=>{
|
||||
const el=$('liveChart'+id);
|
||||
if (el) el.innerHTML='<span>'+t1+'</span><span>'+t2+'</span>';
|
||||
});
|
||||
}
|
||||
}
|
||||
function sumValues(map){ let t=0; for (const v of map.values()) t+=v; return t; }
|
||||
|
||||
async function saveCurrentSessionToHistory(){
|
||||
|
||||
Reference in New Issue
Block a user