add handlebars value comparison helper
This commit is contained in:
+20
-1
@@ -65,12 +65,31 @@ Hooks.once('init', async function () {
|
||||
return outStr;
|
||||
});
|
||||
|
||||
|
||||
Handlebars.registerHelper('toLowerCase', function (str) {
|
||||
return str.toLowerCase();
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('compare', function (varType, varOne, comparator, varTwo) {
|
||||
if (varType === 'str') {
|
||||
if (eval('"' + varOne + '"' + comparator + '"' + varTwo+ '"')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else if (varType === 'int') {
|
||||
if (eval(varOne + comparator + varTwo)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Hooks.once("ready", async function () {
|
||||
// Wait to register hotbar drop hook on ready so that modules could register earlier if they want to
|
||||
Hooks.on("hotbarDrop", (bar, data, slot) => createMothershipMacro(data, slot));
|
||||
|
||||
Reference in New Issue
Block a user