Graze prints upgrade details, fixed dialog bug

This commit is contained in:
2018-11-05 16:56:00 +11:00
parent be48756819
commit 8077d260da
3 changed files with 48 additions and 1 deletions

View File

@@ -34,8 +34,17 @@ exports.GenerateDialogFunction = function(dialogJson) {
result = dialogJson[key];
}
//handle no result
if (typeof(result) === "undefined") {
return dialogJson["noResult"];
const noResult = dialogJson["noResult"];
if (typeof(noResult) === "undefined") {
return ""; //nothing at all to show
}
if (Array.isArray(noResult)) {
result = noResult[Math.floor(Math.random() * noResult.length)];
} else {
result = noResult;
}
}
let counter = 0;