diff --git a/nlw.js b/nlw.js index 2f5346d..a22ba7a 100644 --- a/nlw.js +++ b/nlw.js @@ -27,39 +27,9 @@ const fruityCreators = { } const brokenColors = { - '0,0,0': 'no', - '67,67,67': 'slightly', - '102,102,102': 'very', - '74,134,232': 'no', - '60,120,216': 'slightly', - '17,85,204': 'very', - '0,255,255': 'no', - '69,129,142': 'slightly', - '19,79,92': 'very', - '0,255,0': 'no', - '106,168,79': 'slightly', - '56,118,29': 'very', - '255,255,0': 'no', - '241,194,50': 'slightly', - '191,144,0': 'very', - '255,153,0': 'no', - '230,145,56': 'slightly', - '180,95,6': 'very', - '255,0,0': 'no', - '204,0,0': 'slightly', - '153,0,0': 'very', - '255,0,255': 'no', - '166,77,121': 'slightly', - '116,27,71': 'very', - '153,0,255': 'no', - '103,78,167': 'slightly', - '53,28,117': 'very', - '176,135,235': 'no', - '164,92,246': 'slightly', - '101,78,135': 'very', - '204,204,204': 'no', - '183,183,183': 'slightly', - '153,153,153': 'very', + '255,255,255': 'no', + '255,255,137': 'significantly harder', + '255,105,105': 'impossible', }; async function fetchRegularCells(sheet) { @@ -73,20 +43,23 @@ async function fetchRegularCells(sheet) { let rowID = 0; while (true) { const cell = sheet.getCell(rowID, 0); - if (!cell || cell == null || cell.value == null) break; - const color = cell.backgroundColor || {}; - const colorString = Math.round((color.red || 0) * 255) + ',' + Math.round((color.green || 0) * 255) + ',' + Math.round((color.blue || 0) * 255); - let broke = brokenColors[colorString]; - broken.push(broke || null); - rowID++; + if (!cell || cell == null) break; + try { + const color = cell.backgroundColor || {}; + const colorString = Math.round((color.red || 0) * 255) + ',' + Math.round((color.green || 0) * 255) + ',' + Math.round((color.blue || 0) * 255); + let broke = brokenColors[colorString]; + broken.push(broke || null); + rowID++; + } catch(err) { + break; + } } - - const levels = await sheet.getCellsInRange('A:A'); - const creators = await sheet.getCellsInRange('B:B'); - const skillsets = await sheet.getCellsInRange('D:D'); - const enjoyments = await sheet.getCellsInRange('E:E'); - const descriptions = await sheet.getCellsInRange('F:F'); + const levels = await sheet.getCellsInRange('B:B'); + const creators = await sheet.getCellsInRange('C:C'); + const skillsets = await sheet.getCellsInRange('E:E'); + const enjoyments = await sheet.getCellsInRange('F:F'); + const descriptions = await sheet.getCellsInRange('G:G'); return { levels, broken, creators, skillsets, enjoyments, descriptions }; } async function fetchPlatformerCells(sheet) {