forked from dclamage/dclamage.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
540 lines (508 loc) · 27.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4ZKMVH3RXW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-4ZKMVH3RXW');
</script>
<title>Paragon Calculator</title>
<link rel="shortcut icon" href="ressources/D3Icon.png" type="image/x-icon">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" async>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" crossorigin="anonymous" referrerpolicy="no-referrer" async>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/bignumber.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.min.js" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
<script src="ressources/paragonUtils.js"></script>
<script>
'use strict';
function CalculateParagonSum() {
const p1 = document.getElementById('p1').value;
const p2 = document.getElementById('p2').value;
localStorage.setItem('p1', p1);
localStorage.setItem('p2', p2);
const xpsum = BigNumber(GetParagonLevelXP(p1)).plus(BigNumber(GetParagonLevelXP(p2)));
document.getElementById('psum').value = GetParagonLevel(xpsum);
}
function CalculateParagon() {
const current = document.getElementById('current').value;
const desired = document.getElementById('desired').value;
const xpHrInput = document.getElementById('xphr').value;
const hrsPerDayInput = document.getElementById('hrsperday').value;
localStorage.setItem('current', current);
localStorage.setItem('desired', desired);
localStorage.setItem('xphr', xpHrInput);
localStorage.setItem('hrsperday', hrsPerDayInput);
const xpHr = BigNumber('1000000000000').multipliedBy(BigNumber(xpHrInput));
const hrsPerDay = BigNumber(hrsPerDayInput);
const xpNeeded = DiffParagon(desired, current);
const hours = xpNeeded.dividedBy(xpHr);
const days = hours.dividedBy(hrsPerDay);
let unit = 1;
while (unit < 1000000000000000 && xpNeeded.isGreaterThan(unit * 500)) {
unit *= 1000;
}
if (unit === 1) {
document.getElementById('xpresultlabel').value = 'XP Needed';
} else if (unit === 1000) {
document.getElementById('xpresultlabel').value = 'Thousand XP Needed';
} else if (unit === 1000000) {
document.getElementById('xpresultlabel').value = 'Million XP Needed';
} else if (unit === 1000000000) {
document.getElementById('xpresultlabel').value = 'Billion XP Needed';
} else if (unit === 1000000000000) {
document.getElementById('xpresultlabel').value = 'Trillion XP Needed';
} else if (unit === 1000000000000000) {
document.getElementById('xpresultlabel').value = 'Quadrillion XP Needed';
}
document.getElementById('xpresult').value = xpNeeded.dividedBy(unit).toFixed(3, 4);
document.getElementById('hoursresult').value = hours.toFixed(1, 4);
document.getElementById('daysresult').value = days.toFixed(1, 4);
UpdateChart(days.toNumber());
}
const billion = BigNumber('1000000000');
const million = BigNumber('1000000');
const thousand = BigNumber('1000');
const Humanize = number => {
if (number.isGreaterThan(billion)) return `${number.dividedBy(billion).toFixed(2, 4)} billion`;
if (number.isGreaterThan(million)) return `${number.dividedBy(million).toFixed(2, 4)} million`;
if (number.isGreaterThan(thousand)) return `${number.dividedBy(thousand).toFixed(2, 4)} thousand`;
return `${number.toFixed(2, 4)}`;
}
function CalculatePools() {
let paragon = document.getElementById('poolsparagon').value;
if (paragon <= 1 || isNaN(paragon)) {
paragon = 2;
}
localStorage.setItem('poolsparagon', paragon);
let level = document.getElementById('poolsgrlevel').value;
if (level <= 0 || isNaN(paragon)) {
level = 1;
}
localStorage.setItem('poolsgrlevel', level);
let numPlayers = document.getElementById('poolsnumplayers').value;
if (numPlayers <= 0 || isNaN(paragon)) {
numPlayers = 1;
} else if (numPlayers > 4) {
numPlayers = 4;
}
localStorage.setItem('poolsnumplayers', numPlayers);
let xpFromGear = document.getElementById('poolsxpgear').value;
if (xpFromGear < 0 || isNaN(xpFromGear)) {
xpFromGear = 0;
}
localStorage.setItem('poolsxpgear', xpFromGear);
const xpBonusTotal = (1.0 + xpFromGear / numPlayers * 0.01) * (0.9 + numPlayers * .1);
const riftXP = GetRiftXP(level).multipliedBy(xpBonusTotal);
const closeXP = GetCloseXP(level);
const totalXP = riftXP.plus(closeXP);
const poolXP = DiffParagon(paragon, paragon - 1).dividedBy(10);
const riftPoolConsumed = riftXP.dividedBy(4);
const closePoolConsumed = closeXP.multipliedBy(0.3125);
const totalPoolConsumed = riftPoolConsumed.plus(closePoolConsumed);
const riftNumPools = riftPoolConsumed.dividedBy(poolXP);
const closeNumPools = closePoolConsumed.dividedBy(poolXP);
const totalNumPools = totalPoolConsumed.dividedBy(poolXP);
document.getElementById('baseriftxp').value = Humanize(riftXP);
document.getElementById('pooledriftxp').value = Humanize(riftXP.multipliedBy(1.25));
document.getElementById('baseclosexp').value = Humanize(closeXP);
document.getElementById('pooledclosexp').value = Humanize(closeXP.multipliedBy(1.5625));
document.getElementById('basetotalxp').value = Humanize(riftXP.plus(closeXP));
document.getElementById('closepooledtotalxp').value = Humanize(riftXP.plus(closeXP.multipliedBy(1.5625)));
document.getElementById('allpooledtotalxp').value = Humanize(riftXP.multipliedBy(1.25).plus(closeXP.multipliedBy(1.5625)));
document.getElementById('poolsresultrift').value = riftNumPools.toFixed(2, 4);
document.getElementById('poolsresultclose').value = closeNumPools.toFixed(2, 4);
document.getElementById('poolsresulttotal').value = totalNumPools.toFixed(2, 4);
}
const GetLocalStorage = (key, def) => localStorage.getItem(key) || def;
function HaveParagon() {
// Add paragons
document.getElementById('p1').value = GetLocalStorage('p1', '1000');
document.getElementById('p2').value = GetLocalStorage('p2', '1000');
CalculateParagonSum();
// Pools
document.getElementById('poolsparagon').value = GetLocalStorage('poolsparagon', '2000');
document.getElementById('poolsgrlevel').value = GetLocalStorage('poolsgrlevel', '115');
document.getElementById('poolsnumplayers').value = GetLocalStorage('poolsnumplayers', '4');
document.getElementById('poolsxpgear').value = GetLocalStorage('poolsxpgear', '0');
CalculatePools();
// Goal
document.getElementById('current').value = GetLocalStorage('current', '0');
document.getElementById('desired').value = GetLocalStorage('desired', '2000');
document.getElementById('xphr').value = GetLocalStorage('xphr', '2000');
document.getElementById('hrsperday').value = GetLocalStorage('hrsperday', '8');
CalculateParagon();
}
let existingChart;
function UpdateChart(numDays) {
const days = []
const level = []
let curXP = GetParagonLevelXP(parseInt(document.getElementById('current').value));
const xpHr = BigNumber('1000000000').multipliedBy(BigNumber(document.getElementById('xphr').value));
const hrsPerDay = BigNumber(document.getElementById('hrsperday').value);
let xpDay = xpHr.multipliedBy(hrsPerDay);
if (xpDay.isLessThanOrEqualTo(BigNumber('0'))) return;
numDays = Math.ceil(numDays);
const increment = Math.max(1, Math.floor(numDays / 30) + 1)
xpDay = xpDay.multipliedBy(BigNumber(increment))
for (let i = 0; i <= numDays; i += increment) {
days.push(i)
level.push(GetParagonLevel(curXP))
curXP = curXP.plus(xpDay)
}
let width, height, gradient;
const CHART_COLORS = {
red: 'rgb(255, 99, 132)',
orange: 'rgb(255, 159, 64)',
yellow: 'rgb(255, 205, 86)',
green: 'rgb(75, 192, 192)',
greener: 'rgb(75, 192, 75)',
blue: 'rgb(54, 162, 235)',
purple: 'rgb(153, 102, 255)',
grey: 'rgb(201, 203, 207)'
};
const getGradient = (ctx, chartArea) => {
const chartWidth = chartArea.right - chartArea.left;
const chartHeight = chartArea.bottom - chartArea.top;
if (!gradient || width !== chartWidth || height !== chartHeight) {
// Create the gradient because this is either the first render or the size of the chart has changed
width = chartWidth;
height = chartHeight;
gradient = ctx.createLinearGradient(0, chartArea.bottom, 0, chartArea.top);
gradient.addColorStop(0, CHART_COLORS.blue);
gradient.addColorStop(0.1, CHART_COLORS.purple);
gradient.addColorStop(0.3, CHART_COLORS.red);
gradient.addColorStop(0.6, CHART_COLORS.yellow);
gradient.addColorStop(0.7, CHART_COLORS.green);
gradient.addColorStop(1, CHART_COLORS.greener);
}
return gradient;
}
if (existingChart) existingChart.destroy();
existingChart = new Chart(document.getElementById('paragonChart'), {
type: 'line',
data: {
labels: days,
datasets: [{
label: 'Paragon Level',
data: level,
backgroundColor: context => {
const chart = context.chart;
const {ctx, chartArea} = chart;
if (!chartArea) {
// This case happens on initial chart load
return;
}
return getGradient(ctx, chartArea);
},
borderColor: CHART_COLORS.grey,
fill: true
}]
},
options: {
responsive: true,
maintainAspectRatio: true,
title: {
display: true,
text: 'Paragon Level Over Time'
},
plugins: {
tooltip: {
enabled: true,
mode: 'index',
intersect: false
}
},
interaction: {
mode: 'nearest',
intersect: true
},
scales: {
x: {
display: true,
title: {
display: true,
text: 'Day'
}
},
y: {
display: true,
title: {
display: true,
text: 'Paragon Level'
}
}
}
}
});
}
const loader = setInterval(() => {
if (document.readyState !== 'complete') return;
clearInterval(loader);
return LoadParagon(HaveParagon);
}, 300);
</script>
</head>
<body class="bg-dark">
<div class="container-sm pb-md-3">
<div class="container bg-light rounded-3">
<div class="row text-center">
<h1>Paragon Calculator</h1>
</div>
</div>
<div class="container mt-md-2">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary rounded-3">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<img src="ressources/D3Icon.png" alt="D3" width="35" height="35">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#addPara">Add two paragons</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#pools">Pools</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#goal">How many days to reach your goal ?</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div class="container mt-md-2 pt-md-2 pb-md-2 bg-light rounded-3" id="addPara">
<div class="row align-items-center">
<h3>Add two paragons</h3>
</div>
<div class="row align-items-center">
<div class="col-2">
<input id="p1" type="number" oninput="CalculateParagonSum()" class="form-control" placeholder="Paragon NS" max="20000">
</div>
<div class="col-1">
<p class="text-center"><i class="bi bi-plus-lg align-middle"></i></p>
</div>
<div class="col-2">
<input id="p2" type="number" oninput="CalculateParagonSum()" class="form-control" placeholder="Paragon Season" max="20000">
</div>
<div class="col-1">
<p class="text-center"><i class="bi bi-arrow-right align-middle"></i></p>
</div>
<div class="col-2">
<input id="psum" type="number" class="form-control" placeholder="Paragon Total" max="20000" readonly>
</div>
</div>
</div>
<div class="container mt-md-2 pt-md-2 bg-light rounded-3" id="pools">
<div class="row align-items-center">
<h3>Pools</h3>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsparagon-addon1">Current paragon</span>
<input id="poolsparagon" type="number" oninput="CalculatePools()" class="form-control" placeholder="number" max="20000" aria-describedby="poolsparagon-addon1">
</div>
</div>
<div class="col-1">
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsgrlevel-addon1">GR Level</span>
<input id="poolsgrlevel" type="number" oninput="CalculatePools()" class="form-control" placeholder="number" max="150" aria-describedby="poolsgrlevel-addon1">
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsnumplayers-addon1">Number of Players</span>
<input id="poolsnumplayers" type="number" oninput="CalculatePools()" class="form-control" placeholder="number" max="4" aria-describedby="poolsnumplayers-addon1">
</div>
</div>
<div class="col-1">
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsxpgear-addon1">XP From Gear</span>
<input id="poolsxpgear" type="number" oninput="CalculatePools()" class="form-control" placeholder="number" aria-describedby="poolsxpgear-addon1">
<span class="input-group-text"><i class="bi bi-percent"></i></span>
</div>
</div>
</div>
<div class="row align-items-center">
<h4>Result</h3>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsresultrift-addon1">Pools For Rift</span>
<input id="poolsresultrift" type="number" class="form-control" placeholder="Pools For Rift" aria-describedby="poolsresultrift-addon1" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsresultclose-addon1">Pools For Close</span>
<input id="poolsresultclose" type="number" class="form-control" placeholder="Pools For Close" aria-describedby="poolsresultclose-addon1" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="poolsresulttotal-addon1">Total Pools</span>
<input id="poolsresulttotal" type="number" class="form-control" placeholder="Total Pools" aria-describedby="poolsresulttotal-addon1" readonly>
<span class="input-group-text" data-bs-toggle="tooltip" data-bs-placement="top" title="Below 0.75 is generally when you want to start picking pool">
<i class="bi bi-info-square"></i>
</span>
</div>
</div>
</div>
<div class="row align-items-center">
<p>
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#rawxpnumbers"
aria-expanded="false" aria-controls="rawxpnumbers">
Raw XP Numbers
</button>
</p>
<div class="collapse" id="rawxpnumbers">
<div class="card card-body">
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="baseriftxp-addon1">Rift [Unpooled]</span>
<input id="baseriftxp" type="text" class="form-control" placeholder="Rift [Unpooled]" aria-describedby="baseriftxp-addon1" readonly>
</div>
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="pooledriftxp-addon1">Rift [Pooled]</span>
<input id="pooledriftxp" type="text" class="form-control" placeholder="Rift [Pooled]" aria-describedby="pooledriftxp-addon1" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="baseclosexp-addon1">Close XP [Unpooled]</span>
<input id="baseclosexp" type="text" class="form-control" placeholder="Rift [Unpooled]" aria-describedby="baseclosexp-addon1" readonly>
</div>
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="pooledclosexp-addon1">Close XP [Pooled]</span>
<input id="pooledclosexp" type="text" class="form-control" placeholder="Rift [Pooled]" aria-describedby="pooledclosexp-addon1" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="basetotalxp-addon1">Total XP [Unpooled]</span>
<input id="basetotalxp" type="text" class="form-control" placeholder="Rift [Unpooled]" aria-describedby="basetotalxp-addon1" readonly>
</div>
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="closepooledtotalxp-addon1">Total XP [Pooled]</span>
<input id="closepooledtotalxp" type="text" class="form-control" placeholder="Rift [Pooled]" aria-describedby="closepooledtotalxp-addon1" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="allpooledtotalxp-addon1">Total XP [Fully Pooled]</span>
<input id="allpooledtotalxp" type="text" class="form-control" placeholder="Rift [Pooled]" aria-describedby="allpooledtotalxp-addon1" readonly>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container mt-md-2 pt-md-2 bg-light rounded-3" id="goal">
<div class="row align-items-center">
<h3>How many days to reach your goal ?</h3>
</div>
<div class="row align-items-center">
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="current-addon1">Current paragon</span>
<input id="current" type="number" oninput="CalculateParagon()" class="form-control" placeholder="number" max="20000" aria-describedby="current-addon1">
</div>
</div>
<div class="col-1">
<p class="text-center"><i class="bi bi-arrow-right align-middle"></i></p>
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="desired-addon1">Desired paragon</span>
<input id="desired" type="number" oninput="CalculateParagon()" class="form-control" placeholder="number" max="20000" aria-describedby="desired-addon1">
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="xphr-addon1">Trillion XP / Hour</span>
<input id="xphr" type="number" oninput="CalculateParagon()" class="form-control" placeholder="number" aria-describedby="xphr-addon1">
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="hrsperday-addon1">Hours Played / Day</span>
<input id="hrsperday" type="number" oninput="CalculateParagon()" class="form-control" placeholder="number" max="24" aria-describedby="hrsperday-addon1">
</div>
</div>
</div>
<div class="row align-items-center">
<h4>Result</h3>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="xpresultlabel">Trillion XP Needed</span>
<input id="xpresult" type="number" class="form-control" placeholder="Trillion XP Needed" aria-describedby="xpresultlabel" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="hoursresult-addon1">Hours Needed</span>
<input id="hoursresult" type="number" class="form-control" placeholder="Hours Needed" aria-describedby="hoursresult-addon1" readonly>
</div>
</div>
<div class="col-1">
</div>
<div class="col-3">
<div class="input-group mb-3">
<span class="input-group-text" id="daysresult-addon1">Days Needed</span>
<input id="daysresult" type="number" class="form-control" placeholder="Days Needed" aria-describedby="daysresult-addon1" readonly>
</div>
</div>
</div>
<div class="row align-items-center">
<div class="col-7">
<canvas id="paragonChart" width="400" height="400"></canvas>
</div>
</div>
</div>
</div>
</div>
</body>
</html>