WIP
This commit is contained in:
parent
48e507ec30
commit
76819c6885
@ -85,8 +85,8 @@
|
|||||||
return countryCodesNames.find((country) => country.code === normalized || GameHelper.isMatch(normalized, country.names.toLowerCase()));
|
return countryCodesNames.find((country) => country.code === normalized || GameHelper.isMatch(normalized, country.names.toLowerCase()));
|
||||||
};
|
};
|
||||||
|
|
||||||
var isOpen = $.getSetIniDbBoolean('chatguessr', 'isOpen', false),
|
$.getSetIniDbBoolean('chatguessr', 'isOpen', false);
|
||||||
seed = {},
|
var seed = {},
|
||||||
scale,
|
scale,
|
||||||
guesses = {};
|
guesses = {};
|
||||||
|
|
||||||
@ -126,13 +126,12 @@
|
|||||||
action = args[0];
|
action = args[0];
|
||||||
|
|
||||||
if (command.equalsIgnoreCase('g')) {
|
if (command.equalsIgnoreCase('g')) {
|
||||||
if(isOpen) addGuess(sender,args);
|
if($.getIniDbBoolean('chatguessr', 'isOpen')) addGuess(sender,args);
|
||||||
}else if (command.equalsIgnoreCase('cg')) {
|
}else if (command.equalsIgnoreCase('cg')) {
|
||||||
//send url
|
//send url
|
||||||
//$.say($.whisperPrefix(sender) + $.lang.get('chatguessr.help', ' Use "!cg [open | close | ...]" to open/close the feature.'));
|
//$.say($.whisperPrefix(sender) + $.lang.get('chatguessr.help', ' Use "!cg [open | close | ...]" to open/close the feature.'));
|
||||||
}else if(command.equalsIgnoreCase('cga')){
|
}else if(command.equalsIgnoreCase('cga')){
|
||||||
if(action.equalsIgnoreCase('open')){
|
if(action.equalsIgnoreCase('open')){
|
||||||
isOpen = true;
|
|
||||||
$.setIniDbBoolean('cgstatus', 'isOpen', true);
|
$.setIniDbBoolean('cgstatus', 'isOpen', true);
|
||||||
}else if(action.equalsIgnoreCase('close')){
|
}else if(action.equalsIgnoreCase('close')){
|
||||||
$.setIniDbBoolean('cgstatus', 'isOpen', false)
|
$.setIniDbBoolean('cgstatus', 'isOpen', false)
|
||||||
@ -140,18 +139,26 @@
|
|||||||
seed = fetchSeed(args[1]);
|
seed = fetchSeed(args[1]);
|
||||||
scale = calculateScale(seed.bounds)
|
scale = calculateScale(seed.bounds)
|
||||||
}else if(action.equalsIgnoreCase('end')){
|
}else if(action.equalsIgnoreCase('end')){
|
||||||
isOpen = false;
|
|
||||||
$.setIniDbBoolean('cgstatus', 'isOpen', false)
|
$.setIniDbBoolean('cgstatus', 'isOpen', false)
|
||||||
guesses = {};
|
guesses = {};
|
||||||
seed = {};
|
seed = {};
|
||||||
sendData('guesses',JSON.stringify(guesses));
|
sendData('guesses',JSON.stringify(guesses));
|
||||||
}else if(action.equalsIgnoreCase('refresh')){
|
}else if(action.equalsIgnoreCase('refresh')){
|
||||||
var newseed = fetchSeed(args[1]);
|
var newseed = fetchSeed(args[1]);
|
||||||
|
if(newseed.player.guesses.length() > seed.player.guesses.length()){
|
||||||
|
$.setIniDbBoolean('chatguessr', 'isOpen',false)
|
||||||
|
//NEW ROUND /Score
|
||||||
|
var gp = newseed.player.guesses[seed.round - 1].lat+","+newseed.player.guesses[seed.round - 1].lng
|
||||||
|
addGuess($.channelName,gp);
|
||||||
|
}else{
|
||||||
if(newseed.state=="finished"){
|
if(newseed.state=="finished"){
|
||||||
//FINISHED
|
$.setIniDbBoolean('chatguessr', 'isOpen',false) //FINISHED
|
||||||
}else if(newseed.player.guesses.length() > seed.player.guesses.length()){
|
//Compute total scores + give reward
|
||||||
//NEW ROUND !
|
}else{
|
||||||
|
$.setIniDbBoolean('chatguessr', 'isOpen',true) //NEW ROUD /Guess
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
seed = newseed;
|
||||||
guesses.round = seed.round - 1;
|
guesses.round = seed.round - 1;
|
||||||
}else if(action.equalsIgnoreCase('gg')){
|
}else if(action.equalsIgnoreCase('gg')){
|
||||||
sendData('guesses',JSON.stringify(guesses));
|
sendData('guesses',JSON.stringify(guesses));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user