fixed cron job, fixed bug with activating dreamwolves

This commit is contained in:
Alec Maier
2020-06-07 16:16:09 -04:00
parent be90d52dec
commit e52be63367
3 changed files with 41 additions and 6 deletions

View File

@@ -9,11 +9,12 @@ module.exports = class {
this.timers = {};
// cron job for periodically clearing finished games
const scope = this;
this.job = new CronJob('0 0 */2 * * *', function() {
console.log(this.activeGames);
for (const key in this.activeGames) {
if (this.activeGames.hasOwnProperty(key) && (Math.abs((new Date()) - (new Date(this.activeGames[key].startTime))) / 36e5) >= 2) {
delete this.activeGames[key];
console.log(scope.activeGames);
for (const key in scope.activeGames) {
if (scope.activeGames.hasOwnProperty(key) && (Math.abs((new Date()) - (new Date(scope.activeGames[key].startTime))) / 36e5) >= 2) {
delete scope.activeGames[key];
}
}
console.log("Games pruned at: " + (new Date().toDateString()) + " " + (new Date()).toTimeString());
@@ -34,7 +35,7 @@ module.exports = class {
game.killedRole = player.card.role;
game.message = player.name + ", a " + player.card.role + ", was killed!";
console.log(game.message);
if (player.card.role === "Werewolf" && game.hasDreamWolf) {
if (player.card.isTypeOfWerewolf && game.hasDreamWolf) {
this.activateDreamWolvesIfNeeded(game);
}
const winCheck = module.exports.teamWon(game);

View File

@@ -381,7 +381,7 @@ html, body {
position: absolute;
bottom: 0;
width: 100%;
height: 5rem;
margin-bottom: 1.5em;
font-size: 0.75em;
text-align: center;
align-items: center;
@@ -390,6 +390,36 @@ html, body {
justify-content: center;
}
.bmc-button span:nth-child(1) {
font-size: 20px;
}
.bmc-button {
line-height: 35px !important;
height:40px !important;
text-decoration: none !important;
display:inline-flex !important;
align-items: center !important;
margin-bottom: 3em !important;
color:#ffffff !important;
background-color:#FF5F5F !important;
border-radius: 5px !important;
border: 1px solid transparent !important;
padding: 7px 15px 7px 10px !important;
font-size: 15px !important;
box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5) !important;
-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;
font-family: sitewide-sans-serif, sans-serif !important;
-webkit-box-sizing: border-box !important;
box-sizing: border-box !important;
}
.bmc-button:hover, .bmc-button:active, .bmc-button:focus {
-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;
text-decoration: none !important;box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;
opacity: 0.85 !important;color:#ffffff !important;
}
#footer div {
display: flex;
align-items: center;

View File

@@ -28,6 +28,10 @@
</div>
</div>
<footer id="footer">
<a class="bmc-button" target="_blank" href="https://www.buymeacoffee.com/alecm33">
<span alt="Buy me a beer">🍺</span>
<span style="margin-left:5px;">Buy me a beer</span>
</a>
<div>
<a href="http://vanilla-js.com/">
<img src="../assets/images/vanilla_js.png">