|
|
@@ -95,7 +95,8 @@ Rapido.prototype.resetScores = function() {
|
|
|
}
|
|
|
|
|
|
Rapido.prototype.endWord = function() {
|
|
|
- clearTimeout(this.wordTimeout);
|
|
|
+ this.wordTimeout && clearTimeout(this.wordTimeout);
|
|
|
+ this.wordTimeout = 0;
|
|
|
this.currentWord = null;
|
|
|
this.currentPoints = [];
|
|
|
this.wordRequest = [];
|
|
|
@@ -103,6 +104,8 @@ Rapido.prototype.endWord = function() {
|
|
|
}
|
|
|
|
|
|
Rapido.prototype.onWordTimeout = function() {
|
|
|
+ this.wordTimeout = 0;
|
|
|
+ ++(this.setProgression);
|
|
|
if (this.currentPoints.length) {
|
|
|
this.currentPoints = this.currentPoints.map((i, index) => {
|
|
|
const time = i.time -this.wordStart;
|
|
|
@@ -123,9 +126,17 @@ Rapido.prototype.onWordTimeout = function() {
|
|
|
});
|
|
|
} else {
|
|
|
this.bot.sendMsg(this.room, "Bah alors ? " +this.wordRequest.join(", ") +" vous fichez quoi ?");
|
|
|
- this.bot.sendMsg(this.room, "fin du temps réglementaire, tapez !next pour une prochaine partie.");
|
|
|
}
|
|
|
this.endWord();
|
|
|
+ if (this.setProgression >= this.config.WORD_IN_SET)
|
|
|
+ this.bot.sendMsg(this.room, "fin du temps réglementaire, tapez !next pour une prochaine partie.");
|
|
|
+ else
|
|
|
+ this.startNextWordTimer();
|
|
|
+}
|
|
|
+
|
|
|
+Rapido.prototype.startNewSet = function() {
|
|
|
+ this.setProgression = 0;
|
|
|
+ this.startNextWordTimer();
|
|
|
}
|
|
|
|
|
|
Rapido.prototype.startNextWordTimer = function() {
|
|
|
@@ -133,7 +144,8 @@ Rapido.prototype.startNextWordTimer = function() {
|
|
|
this.currentWord = this.words[Math.floor(Math.random() * this.words.length)];
|
|
|
console.log(this.currentWord);
|
|
|
_this.bot.sendMsg(this.room, "Attention attention, prochain mot dans " +Math.floor(this.config.NEXT_WORD_DELAY / 1000) +" secondes");
|
|
|
- _this.bot.sendMsg(this.room, "Rappel : il faut taper le plus vite possible en minuscule et sans espaces le mot proposé");
|
|
|
+ if (this.setProgression == 0)
|
|
|
+ _this.bot.sendMsg(this.room, "Rappel : il faut taper le plus vite possible en minuscule et sans espaces le mot proposé");
|
|
|
setTimeout(() => {
|
|
|
var wordEsc = _this.currentWord.replace(/(\w)/g, ' $1').toUpperCase().trimStart();
|
|
|
_this.bot.sendMsg(_this.room, wordEsc);
|
|
|
@@ -186,7 +198,7 @@ Rapido.prototype.onMessageInternal = function(username, user, msg) {
|
|
|
if (this.wordRequest.indexOf(username) === -1)
|
|
|
this.wordRequest.push(username);
|
|
|
if (!this.currentWord && this.wordRequest.length >= this.config.MIN_PLAYERS)
|
|
|
- this.startNextWordTimer();
|
|
|
+ this.startNewSet();
|
|
|
}
|
|
|
else if (lmsg.startsWith("!score")) {
|
|
|
this.sendScore();
|