diff --git a/roomMod.js b/roomMod.js index 615fac7..2b26e17 100644 --- a/roomMod.js +++ b/roomMod.js @@ -13,16 +13,18 @@ function startItemCount(){ return(returns); } -function setPlayers(playerCount = 2, itemData){ +function setPlayers(playerData, itemData){ itemData.player = {}; //let player = {}; // Player item belongs to itemData.players = []; // List of the players (an associated playerItem?) let playerNo = 0 + itemData['itemCount']; // Start loop from current itemCount - playerCount = playerCount + itemData['itemCount']; // End at playerCount diff from itemCount + playerCount = playerData.length + itemData['itemCount']; // End at playerCount diff from itemCount + let i = 0; for(playerNo; playerNo < playerCount; playerNo++){ - itemData['players'].push(playerNo); // Add player no to array so can be looped + itemData['players'].push([playerNo, playerData[i]]); // Add player no to array so can be looped + i++; } @@ -37,12 +39,20 @@ function setTeams(){ function roomGeneration(playerCount, teamCount = null, playerTeams = null){ return new Promise((resolve, reject) => { (async () => { + let itemData = startItemCount(); + // This will be passed by the joinRoom for each player, then built + // on startGame) + let playerData = [ + {'playerId': 1, 'deck':{'playerId':1,'deckId':1}}, + {'playerId': 2, 'deck':{'playerId':2,'deckId':1}}, + ]; + // Add players for the room - itemData = setPlayers(playerCount, itemData); + itemData = setPlayers(playerData, itemData); - // TODO: Get their selected decks (will need to pass somewhere) + // TODO: Get their selected decks // Add all the empty components to the room itemData itemData.component = components.component;