Beer Event - Remaining Rewards

Developer
Size
2,537 Kb
Views
22,264

How do I make an beer event - remaining rewards?

What is a beer event - remaining rewards? How do you make a beer event - remaining rewards? This script and codes were developed by Steven on 05 October 2022, Wednesday.

Beer Event - Remaining Rewards Previews

Beer Event - Remaining Rewards - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Beer Event - Remaining Rewards</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> Override expected remaining tickets: <input type="number" id="inputTickets"><br>
<p id="output"></p> <script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.0/moment.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Beer Event - Remaining Rewards - Script Codes CSS Codes

table { border-collapse: collapse; padding: 2px;
}
td { padding: 2px 5px;
}

Beer Event - Remaining Rewards - Script Codes JS Codes

console.clear();
let inputTickets = document.getElementById("inputTickets");
let output = document.getElementById("output");
let now = new moment();
let future = new moment("2016-12-07"); // Festival end date
let diff = (future - now) ? future-now : 0;
let timeToEnd = moment.duration(diff);
let minutesUntilEnd = timeToEnd.asMinutes();
let beers = minutesUntilEnd / 5;
let tickets = Math.floor(beers / 95)*5;
function doOutput() { output.innerHTML = ``; let string = `` string += `From now until the end of Beer Festival (Assuming midnight, 6th December)` string += `(${timeToEnd.asMinutes().toFixed(0)} minutes... ${timeToEnd.humanize()})<br>` string += `${Math.floor(beers)} beers. ${Math.floor(tickets)} tickets. (${Math.floor(beers % 95)} spare beers)<br>` let EP = (tickets*.7); string += `You can expect roughly ${(EP*30).toFixed(0)} Event Points. (Range ${Math.floor(EP*20)}-${Math.floor(EP*40)})<br>`; let RG = (tickets*.1); string += `You can expect roughly ${Math.floor(RG*6.5)} Red Gems. (Range ${Math.floor(RG*3)}-${Math.floor(RG*10)})<br>`; let RP = (tickets*.075); string += `You can expect roughly ${Math.floor(RP*4)} Raid Points. (Range ${Math.floor(RP*2)}-${Math.floor(RP*6)})<br>`; let RL = (tickets*.04); string += `You can expect roughly ${Math.floor(RL*3.5)} Raid Loots. (Range ${Math.floor(RL*2)}-${Math.floor(RL*7)})<br>`; let ET = (tickets*.045); string += `You can expect roughly ${Math.floor(ET*2.5)} Event Tickets. (Range ${Math.floor(ET*2)}-${Math.floor(ET*3)})<br>`; let AC = Math.floor(tickets*.01); string += `You can expect roughly ${Math.floor(AC)} Ancient Crystals.<br>`; string += `<br>Assuming 0.5% flat rate per crystal, individually:<br>Chance over ${tickets} tickets<br><br>`; string += `<table border="solid"><tr><td>Current<br>Crystals</td><td>Chance</td><td>Odds</td></tr>`; string += `<td><center>0</center></td><td>${ (1-Math.pow(0.975,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.975,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>1</center></td><td>${ (1-Math.pow(0.980,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.980,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>2</center></td><td>${ (1-Math.pow(0.985,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.985,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>3</center></td><td>${ (1-Math.pow(0.990,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.990,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>4</center></td><td>${ (1-Math.pow(0.995,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.995,tickets))*100) ).toFixed(0) }</td></tr>`; string += `</table>`; string += `<br><br>Assuming 1% flat rate per crystal, individually:<br>Chance over ${tickets} tickets<br><br>`; string += `<table border="solid"><tr><td>Current<br>Crystals</td><td>Chance</td><td>Odds</td></tr>` string += `<td><center>0</center></td><td>${ (1-Math.pow(0.950,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.950,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>1</center></td><td>${ (1-Math.pow(0.960,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.960,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>2</center></td><td>${ (1-Math.pow(0.970,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.970,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>3</center></td><td>${ (1-Math.pow(0.980,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.980,tickets))*100) ).toFixed(0) }</td></tr>`; string += `<td><center>4</center></td><td>${ (1-Math.pow(0.990,tickets) ).toFixed(5) }</td><td>1 in ${ ( 100 / ((1-Math.pow(0.990,tickets))*100) ).toFixed(0) }</td></tr>`; string += `</table>`; output.innerHTML = string;
}
inputTickets.addEventListener("input", function() { tickets = (Number(inputTickets.value) > 0) ? Number(inputTickets.value) : Math.floor(beers / 95)*5; doOutput();
})
doOutput();
Beer Event - Remaining Rewards - Script Codes
Beer Event - Remaining Rewards - Script Codes
Home Page Home
Developer Steven
Username volv
Uploaded October 05, 2022
Rating 3
Size 2,537 Kb
Views 22,264
Do you need developer help for Beer Event - Remaining Rewards?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Steven (volv) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!