This commit is contained in:
choelzl 2022-02-14 15:16:07 +01:00
parent 2f392585df
commit 14a4ca4efd
Signed by: sora
GPG Key ID: A362EA0491E2EEA0

View File

@ -108,14 +108,15 @@
streak: 0,
});
guesses.round = seed.round - 1;
sendData('guesses',JSON.stringify(guesses));
sendGuessData();
}
function sendData(tpe, data) {
function sendGuessData() {
guesses.rounds = seed.rounds;
$.panelsocketserver.sendJSONToAll(JSON.stringify({
'eventFamily': 'chatguessr',
'eventType': tpe,
'data': data
'eventType': 'guesse',
'data': JSON.stringify(guesses)
}));
}
@ -139,12 +140,12 @@
seed = fetchSeed(args[1]);
scale = calculateScale(seed.bounds);
guesses.round = seed.round - 1;
sendData('guesses',JSON.stringify(guesses));
sendGuessData();
}else if(action.equalsIgnoreCase('end')){
$.setIniDbBoolean('cgstatus', 'isOpen', false)
guesses = {};
seed = {};
sendData('guesses',JSON.stringify(guesses));
sendGuessData();
}else if(action.equalsIgnoreCase('refresh')){
if(seed.token == undefined) return;
var newseed = fetchSeed(seed.token);
@ -156,22 +157,21 @@
if(newseed.state=="finished"){
$.setIniDbBoolean('chatguessr', 'isOpen',false) //FINISHED
//Compute total scores + give reward
sendGuessData();
}else{
$.setIniDbBoolean('chatguessr', 'isOpen',true) //NEW ROUD /Guess
guesses.round = seed.round - 1;
sendData('guesses',JSON.stringify(guesses));
sendGuessData();
}
}
seed = newseed;
}else if(action.equalsIgnoreCase('gg')){
sendData('guesses',JSON.stringify(guesses));
sendGuessData();
}else if(action.equalsIgnoreCase('fg')){
addGuess("Alpha","0,0");
addGuess("Beta","40,0");
addGuess("Charlie","0,60");
addGuess("Delta","80,80");
guesses.round = seed.round - 1;
sendData('guesses',JSON.stringify(guesses));
}
}
});