not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

65 lines
1.4 KiB

module.exports=
{
/**
* Returns a random word
* @returns {string}
*/
roomOpen : function(name, rooms)
{
rooms.foreach(function(r)
{
if(name === r.roomName)
{
return false;
}
});
return true;
},
userAvailable : function(name, players)
{
// players.foreach(function(p)
// {
// if(name === p.roomName)
// {
// return false;
// }
// });
if(players[name] != null)
return false
return true;
},
generateSendRoomsJSON : function(rooms)
{
var obj = new Object();
obj.rooms = [];
rooms.forEach(function(r)
{
var roomObj = new Object();
if(r.password.password == null)
{
roomObj.passwordBool = false;
}
else
{
roomObj.passwordBool = r.password;
}
roomObj.capacity = r.capacity;
roomObj.occupents = r.users.length;
obj.rooms.push(roomObj);
});
return obj;
},
getOpenIndex : function(rooms)
{
}
};