Clean up with Prettier and add Discord emojis
This commit is contained in:
parent
368af782bd
commit
8a606359a1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules
|
162
index.html
162
index.html
@ -1,24 +1,40 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.box {
|
.box {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
padding: 10px
|
padding: 0.75rem;
|
||||||
}
|
}
|
||||||
.box > * {
|
.box > * {
|
||||||
padding: 3px;
|
padding: 0.25rem;
|
||||||
}
|
}
|
||||||
.box > button {
|
.box > button {
|
||||||
padding: 3px 0;
|
padding: 0.25rem 0;
|
||||||
}
|
margin-bottom: 0.25rem;
|
||||||
p {
|
}
|
||||||
margin: 0;
|
.emojis {
|
||||||
}
|
display: flex;
|
||||||
</style>
|
align-items: center;
|
||||||
|
padding: 0.25rem 0;
|
||||||
|
}
|
||||||
|
.emojis > button {
|
||||||
|
margin: 0;
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.emojis > button > span {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-left: 0.375rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@ -30,27 +46,63 @@ p {
|
|||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<p><span id="discordServers">0</span> Discord servers</p>
|
<p><span id="discordServers">0</span> Discord servers</p>
|
||||||
<button id="createDiscordServer" onClick="createDiscordServerClicked()">Create Discord server</button>
|
<button id="createDiscordServer" onClick="createDiscordServerClicked()">
|
||||||
|
Create Discord server
|
||||||
|
</button>
|
||||||
|
<div id="discordEmojis" class="emojis" style="display: none">
|
||||||
|
<button onClick="discordEmojiClicked(0)">
|
||||||
|
💜 <span id="discordEmoji1"></span>
|
||||||
|
</button>
|
||||||
|
<button onClick="discordEmojiClicked(1)">
|
||||||
|
🥰 <span id="discordEmoji2"></span>
|
||||||
|
</button>
|
||||||
|
<button onClick="discordEmojiClicked(2)">
|
||||||
|
🥺 <span id="discordEmoji3"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<p><span id="twitchChannels">0</span> Twitch channels</p>
|
<p><span id="twitchChannels">0</span> Twitch channels</p>
|
||||||
<p><span id="twitchFollowers">0</span> followers</p>
|
<p><span id="twitchFollowers">0</span> followers</p>
|
||||||
<button id="createTwitchChannel" onClick="createTwitchChannelClicked()">Create Twitch channel</button>
|
<button id="createTwitchChannel" onClick="createTwitchChannelClicked()">
|
||||||
|
Create Twitch channel
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<p><span id="catEars">0</span> cat ears</p>
|
<p><span id="catEars">0</span> cat ears</p>
|
||||||
<button id="buyCatEars" onClick="buyCatEarsClicked()">Buy cat ears</button>
|
<button id="buyCatEars" onClick="buyCatEarsClicked()">
|
||||||
|
Buy cat ears
|
||||||
|
</button>
|
||||||
<p>Cat ears cost: $ <span id="catEarsCost">5.00</span></p>
|
<p>Cat ears cost: $ <span id="catEarsCost">5.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<p><span id="minecraftServers">0</span> Minecraft servers <span id="percentRunning"></span></p>
|
<p>
|
||||||
<button id="launchMinecraftServer" onClick="launchMinecraftServerClicked()">Launch Minecraft server</button>
|
<span id="minecraftServers">0</span> Minecraft servers
|
||||||
<button id="deployCloudOrchestration" onClick="deployCloudOrchestrationClicked()" style="display: none">Deploy cloud orchestration</button>
|
<span id="percentRunning"></span>
|
||||||
<p>Cloud instance cost: $ <span id="minecraftServersCost">12.00</span> / month</p>
|
</p>
|
||||||
|
<button
|
||||||
|
id="launchMinecraftServer"
|
||||||
|
onClick="launchMinecraftServerClicked()"
|
||||||
|
>
|
||||||
|
Launch Minecraft server
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
id="deployCloudOrchestration"
|
||||||
|
onClick="deployCloudOrchestrationClicked()"
|
||||||
|
style="display: none"
|
||||||
|
>
|
||||||
|
Deploy cloud orchestration
|
||||||
|
</button>
|
||||||
|
<p>
|
||||||
|
Cloud instance cost: $ <span id="minecraftServersCost">12.00</span> /
|
||||||
|
month
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<p><span id="synthesizers">0</span> synthesizers</p>
|
<p><span id="synthesizers">0</span> synthesizers</p>
|
||||||
<button id="buySynthesizer" onClick="buySynthesizerClicked()">Buy synthesizer</button>
|
<button id="buySynthesizer" onClick="buySynthesizerClicked()">
|
||||||
|
Buy synthesizer
|
||||||
|
</button>
|
||||||
<p>Synthesizer cost: $ <span id="synthesizersCost">100.00</span></p>
|
<p>Synthesizer cost: $ <span id="synthesizersCost">100.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -58,12 +110,13 @@ p {
|
|||||||
var cutieCount = 0;
|
var cutieCount = 0;
|
||||||
var funds = 0;
|
var funds = 0;
|
||||||
var discordServers = 0;
|
var discordServers = 0;
|
||||||
|
var discordEmoji = [0, 0, 0];
|
||||||
var twitchChannels = 0;
|
var twitchChannels = 0;
|
||||||
var twitchFollowers = 0;
|
var twitchFollowers = 0;
|
||||||
var catEars = 0;
|
var catEars = 0;
|
||||||
var catEarsCost = 5.00;
|
var catEarsCost = 5.0;
|
||||||
var minecraftServers = 0;
|
var minecraftServers = 0;
|
||||||
var minecraftServersCost = 12.00;
|
var minecraftServersCost = 12.0;
|
||||||
var minecraftServersTotalCost = 0;
|
var minecraftServersTotalCost = 0;
|
||||||
var cloudOrchestration = false;
|
var cloudOrchestration = false;
|
||||||
var synthesizers = 0;
|
var synthesizers = 0;
|
||||||
@ -72,14 +125,23 @@ p {
|
|||||||
var cutiesElement = document.getElementById("cuties");
|
var cutiesElement = document.getElementById("cuties");
|
||||||
var fundsElement = document.getElementById("funds");
|
var fundsElement = document.getElementById("funds");
|
||||||
var discordServersElement = document.getElementById("discordServers");
|
var discordServersElement = document.getElementById("discordServers");
|
||||||
|
var discordEmojisElement = document.getElementById("discordEmojis");
|
||||||
|
var discordEmojiElements = [];
|
||||||
|
discordEmojiElements.push(document.getElementById("discordEmoji1"));
|
||||||
|
discordEmojiElements.push(document.getElementById("discordEmoji2"));
|
||||||
|
discordEmojiElements.push(document.getElementById("discordEmoji3"));
|
||||||
var twitchChannelsElement = document.getElementById("twitchChannels");
|
var twitchChannelsElement = document.getElementById("twitchChannels");
|
||||||
var twitchFollowersElement = document.getElementById("twitchFollowers");
|
var twitchFollowersElement = document.getElementById("twitchFollowers");
|
||||||
var catEarsElement = document.getElementById("catEars");
|
var catEarsElement = document.getElementById("catEars");
|
||||||
var buyCatEarsElement = document.getElementById("buyCatEars");
|
var buyCatEarsElement = document.getElementById("buyCatEars");
|
||||||
var catEarsCostElement = document.getElementById("catEarsCost");
|
var catEarsCostElement = document.getElementById("catEarsCost");
|
||||||
var minecraftServersElement = document.getElementById("minecraftServers");
|
var minecraftServersElement = document.getElementById("minecraftServers");
|
||||||
var minecraftServersCostElement = document.getElementById("minecraftServersCost");
|
var minecraftServersCostElement = document.getElementById(
|
||||||
var deployCloudOrchestrationElement = document.getElementById("deployCloudOrchestration");
|
"minecraftServersCost",
|
||||||
|
);
|
||||||
|
var deployCloudOrchestrationElement = document.getElementById(
|
||||||
|
"deployCloudOrchestration",
|
||||||
|
);
|
||||||
var percentRunningElement = document.getElementById("percentRunning");
|
var percentRunningElement = document.getElementById("percentRunning");
|
||||||
var buySynthesizerElement = document.getElementById("buySynthesizer");
|
var buySynthesizerElement = document.getElementById("buySynthesizer");
|
||||||
var synthesizersElement = document.getElementById("synthesizers");
|
var synthesizersElement = document.getElementById("synthesizers");
|
||||||
@ -91,6 +153,11 @@ p {
|
|||||||
|
|
||||||
function createDiscordServerClicked() {
|
function createDiscordServerClicked() {
|
||||||
discordServers++;
|
discordServers++;
|
||||||
|
discordEmojisElement.style.display = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function discordEmojiClicked(index) {
|
||||||
|
discordEmoji[index]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTwitchChannelClicked() {
|
function createTwitchChannelClicked() {
|
||||||
@ -125,18 +192,29 @@ p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fundsBaseRate = 0.00001227;
|
var fundsBaseRate = 0.00001227;
|
||||||
var discordRate = 0.00001;
|
var discordRate = 0.001;
|
||||||
var streamerBaseRate = 0.01;
|
var streamerBaseRate = 0.01;
|
||||||
var streamerWithCatEarsRate = 0.005;
|
var streamerWithCatEarsRate = 0.005;
|
||||||
var twitchEarningRate = 0.00001;
|
var twitchEarningRate = 0.00001;
|
||||||
var synthRepRate = 0.0001;
|
var synthRepRate = 0.0001;
|
||||||
|
|
||||||
window.setInterval(function() {
|
window.setInterval(function () {
|
||||||
if (discordServers > 0) {
|
if (discordServers > 0) {
|
||||||
cutieCount += Math.min(discordServers, cutieCount / 100) * cutieCount * discordRate;
|
cutieCount +=
|
||||||
|
Math.min(discordServers, cutieCount / 100.0) * discordRate;
|
||||||
|
|
||||||
|
const emoji = Math.floor(Math.random() * 1000 * (100 / cutieCount));
|
||||||
|
if (emoji < 3) {
|
||||||
|
discordEmoji[emoji]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var streamers = Math.min(twitchChannels, cutieCount * (streamerBaseRate + Math.min(cutieCount, catEars) * streamerWithCatEarsRate));
|
var streamers = Math.min(
|
||||||
|
twitchChannels,
|
||||||
|
cutieCount *
|
||||||
|
(streamerBaseRate +
|
||||||
|
Math.min(cutieCount, catEars) * streamerWithCatEarsRate),
|
||||||
|
);
|
||||||
if (streamers > 0) {
|
if (streamers > 0) {
|
||||||
if (twitchFollowers < streamers * 10000) {
|
if (twitchFollowers < streamers * 10000) {
|
||||||
twitchFollowers += 0.01 * (streamers * 10000 - twitchFollowers);
|
twitchFollowers += 0.01 * (streamers * 10000 - twitchFollowers);
|
||||||
@ -145,10 +223,12 @@ p {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
funds += cutieCount * fundsBaseRate + twitchFollowers * twitchEarningRate;
|
funds +=
|
||||||
|
cutieCount * fundsBaseRate + twitchFollowers * twitchEarningRate;
|
||||||
|
|
||||||
if (minecraftServers > 0) {
|
if (minecraftServers > 0) {
|
||||||
var cloudServerCosts = minecraftServersTotalCost / (12 * 24 * 60 * 60 * 100);
|
var cloudServerCosts =
|
||||||
|
minecraftServersTotalCost / (12 * 24 * 60 * 60 * 100);
|
||||||
if (cloudServerCosts < funds) {
|
if (cloudServerCosts < funds) {
|
||||||
percentRunningElement.style.display = "none";
|
percentRunningElement.style.display = "none";
|
||||||
funds -= cloudServerCosts;
|
funds -= cloudServerCosts;
|
||||||
@ -158,7 +238,10 @@ p {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
percentRunningElement.style.display = "";
|
percentRunningElement.style.display = "";
|
||||||
percentRunningElement.innerHTML = "(" + Math.floor(100 * funds / cloudServerCosts) + " % running)"
|
percentRunningElement.innerHTML =
|
||||||
|
"(" +
|
||||||
|
Math.floor((100 * funds) / cloudServerCosts) +
|
||||||
|
" % running)";
|
||||||
funds = 0;
|
funds = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,6 +251,9 @@ p {
|
|||||||
cutiesElement.innerHTML = Math.floor(cutieCount);
|
cutiesElement.innerHTML = Math.floor(cutieCount);
|
||||||
fundsElement.innerHTML = funds.toFixed(2);
|
fundsElement.innerHTML = funds.toFixed(2);
|
||||||
discordServersElement.innerHTML = discordServers;
|
discordServersElement.innerHTML = discordServers;
|
||||||
|
for (const [index, element] of discordEmojiElements.entries()) {
|
||||||
|
element.innerHTML = discordEmoji[index];
|
||||||
|
}
|
||||||
twitchChannelsElement.innerHTML = twitchChannels;
|
twitchChannelsElement.innerHTML = twitchChannels;
|
||||||
twitchFollowersElement.innerHTML = Math.floor(twitchFollowers);
|
twitchFollowersElement.innerHTML = Math.floor(twitchFollowers);
|
||||||
catEarsElement.innerHTML = catEars;
|
catEarsElement.innerHTML = catEars;
|
||||||
|
1296
package-lock.json
generated
Normal file
1296
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
18
package.json
Normal file
18
package.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "polycule",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"main": "index.html",
|
||||||
|
"scripts": {
|
||||||
|
"style": "npx prettier index.html -w"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.blorp.dev/zo/polycule"
|
||||||
|
},
|
||||||
|
"author": "zoe.gauthier@blorp.dev",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"prettier": "^3.3.3"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user