Add itemdata/cardData filter to frontend debug

develop
Nathan Steel 1 year ago
parent b86e41c010
commit afee6247fc

@ -1087,7 +1087,8 @@ function createDeckList(playerId){
item.push(itemCount);
// Set card data for new item
// Use the ID from the deckList of player, and return the card of that ID from cardList/DB
cardData[itemCount] = cardArray[deckList[deckItem]];
// ID 1 was adding id 0 as array index. Changed to +1 for now (will correct in DB form)
cardData[itemCount] = cardArray[deckList[deckItem]+1];
// Set to base position of 'deck'
boardElement[itemCount] = 'deck';
// Set Attack, ManaCost, ManaColours TODO: When these are implemented seperately
@ -1313,12 +1314,18 @@ function getItemsAndPrintFrontEnd(){
if(cardStatusId == ""){ cardStatusId = null; }
let listPositionId = document.getElementById("listPositionId").value;
if(listPositionId == ""){ listPositionId = null; }
getItemsAndPrint(boardElementId, playerId, cardStatusId, listPositionId);
let itemOrCard = document.getElementById("itemOrCardData").value;
getItemsAndPrint(boardElementId, playerId, cardStatusId, listPositionId, itemOrCard);
}
function getItemsAndPrint(boardElementId = null, playerId = null, cardStatusId = null, listPositionId = null){
function getItemsAndPrint(boardElementId = null, playerId = null, cardStatusId = null, listPositionId = null, itemOrCard = 'item'){
let items = board.getItems(boardElementId, playerId, cardStatusId, listPositionId);
console.log('----- Items -----');
if(itemOrCard == 'card'){
console.log('----- CardData -----');
printCardData(items);
}else{
console.log('----- ItemData -----');
printECSData(items);
}
console.log('Items array length: '+items.length);
}
function printECSData(items){
@ -1335,6 +1342,15 @@ function printECSData(items){
);
}
}
function printCardData(items){
let cardArray = [];
for(let item = 0; item < items.length; item++){
let itemKey = items[item];
cardArray.push(cardData[itemKey]);
}
console.log(cardArray);
}
function echoCards(){
console.log(cardArray);
}

@ -49,6 +49,11 @@
<option value="attacking">Attacking</option>
<option value="tapped">Tapped</option>
</select>
<select name="itemOrCardData" id="itemOrCardData">
<option value="item">Item Data</option>
<option value="card">Card Data</option>
</select>
</div>
<script src="/socket.io/socket.io.js"></script>

Loading…
Cancel
Save