16 lines
477 B
JavaScript
16 lines
477 B
JavaScript
var helpers = {
|
|
generateName: function(role){
|
|
return role + '_xxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
|
return v.toString(16);
|
|
});
|
|
},
|
|
getLastFlag: function(flagName){
|
|
return _(Object.keys(Game.flags))
|
|
.filter((f) => f.startsWith(flagName))
|
|
.map((f) => f.slice(flagName.length))
|
|
.max();
|
|
},
|
|
};
|
|
|
|
module.exports = helpers; |