@ -417,22 +417,33 @@ function requestDeck(itemData = null){
letforPlayer=0;// TODO: Change to actually have each player select a deck
letforPlayer=0;// TODO: Change to actually have each player select a deck
// Loop and create the deck first
// Loop and create the deck first
// DECKS TODO: REDO FOR itemData.component instead of existing itemData
decks.forEach((deck)=>{
decks.forEach((deck)=>{
item.push(itemCount);// Add new item to add stuff for
item.push(itemCount);// Add new item to add stuff for
itemData.component.deck[itemCount]={'deckId':deck.deckId,'playerId':deck.playerId,'deckName':deck.deckName,'deckSize':0};// Probably remove maxlength or change how I've just done it?
player[itemCount]=forPlayer;// TODO: Actually set to the correct player somehow
deckData[itemCount]={'deckId':deck.deckId,'playerId':deck.playerId,'deckName':deck.deckName,'maxLength':0};// Max length for listPositioning later in cardBuild
deckData[itemCount]={'deckId':deck.deckId,'playerId':deck.playerId,'deckName':deck.deckName,'maxLength':0};// Max length for listPositioning later in cardBuild
boardElement[itemCount]='realDeck';
boardElement[itemCount]='realDeck';
cardFace[itemCount]=0;// Face down for deck
cardFace[itemCount]=0;// Face down for deck
player[itemCount]=forPlayer;
itemCount++;// Needed/good
itemCount++;// Needed/good
forPlayer++;// Jank/bad
forPlayer++;// Jank/bad
})
})
//console.log(deckData);
//console.log(deckList);
// CARDS IN DECKS
// TODO: REDO FOR itemData.component instead of existing itemData
// Loop each item in the deckList
// Loop each item in the deckList
// Loop inside it X times where X is cardCount
// Loop inside it X times where X is cardCount
// Add the builtCard with same cardId as deckList item X times
// Add the builtCard with same cardId as deckList item X times
// and load that deck for them. This just sets first deck to player0 to players.length
// and load that deck for them. This just sets first deck to player0 to players.length
deckList.forEach((deckListItem)=>{
deckList.forEach((deckListItem)=>{
@ -441,6 +452,8 @@ function requestDeck(itemData = null){
for(keyindeckData){
for(keyindeckData){
//Object.keys(deckData).forEach(function(key) { // Less efficient than for
//Object.keys(deckData).forEach(function(key) { // Less efficient than for
// Needs to check deck AND player id, as that's the primary key (together)
// Needs to check deck AND player id, as that's the primary key (together)
// TODO: change deckData[key] to itemData.component.deck[key] allover then remove deckData