2016-06-29 17:21:09 +00:00
|
|
|
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);
|
|
|
|
});
|
2016-06-30 01:26:39 +00:00
|
|
|
},
|
2016-06-30 01:37:58 +00:00
|
|
|
getLastFlag: function(flagName){
|
|
|
|
return Object.keys(Game.flags).reduce(function(m,f) {
|
|
|
|
if (f.startsWith(flagName)){
|
|
|
|
m = Math.max(m, f.slice(flagName.length));
|
|
|
|
}
|
|
|
|
return m;
|
|
|
|
},
|
|
|
|
-1);
|
2016-06-30 01:26:39 +00:00
|
|
|
},
|
2016-06-29 17:21:09 +00:00
|
|
|
};
|
|
|
|
|
2016-06-29 02:12:51 +00:00
|
|
|
module.exports = helpers;
|