(level, practiceOnly)
| 1356 | } |
| 1357 | |
| 1358 | const findNextLevel = (level, practiceOnly) => { |
| 1359 | for (const nextLevelOriginal of level.nextLevels) { |
| 1360 | const nextLevel = _.find(orderedLevels, { original: nextLevelOriginal }) |
| 1361 | if (!nextLevel || nextLevel.locked) { continue } |
| 1362 | if (practiceOnly && !this.campaign.levelIsPractice(nextLevel)) { continue } |
| 1363 | if (this.campaign.levelIsAssessment(nextLevel)) { continue } |
| 1364 | if (this.campaign.levelIsAssessment(level) && this.campaign.levelIsPractice(nextLevel)) { continue } |
| 1365 | |
| 1366 | // // If it's a challenge level, we efficiently determine whether we actually do want to point it out. |
| 1367 | // // 2021-09-21: disabling for now, guessing it doesn't work well and makes experiments harder |
| 1368 | // if (false && (nextLevel.slug === 'kithgard-mastery') && !this.levelStatusMap[nextLevel.slug] && (this.calculateExperienceScore() >= 3)) { |
| 1369 | // const timesPointedOut = storage.load(`pointed-out-${nextLevel.slug}`) || 0 |
| 1370 | // if (timesPointedOut <= 3) { |
| 1371 | // // We may determineNextLevel more than once per render, so we can't just do this once. But we do give up after a couple highlights. |
| 1372 | // dontPointTo = _.without(dontPointTo, nextLevel.slug) |
| 1373 | // storage.save(`pointed-out-${nextLevel.slug}`, timesPointedOut + 1) |
| 1374 | // } |
| 1375 | // } |
| 1376 | |
| 1377 | // Should we point this level out? |
| 1378 | if (!nextLevel.disabled && (this.levelStatusMap[nextLevel.slug] !== COMPLETE_STATUS) && !dontPointTo.includes(nextLevel.slug) && |
| 1379 | !nextLevel.replayable && ( |
| 1380 | me.isPremium() || !nextLevel.requiresSubscription || // nextLevel.adventurer or # Disable adventurer stuff for now |
| 1381 | _.any(subscriptionPrompts, prompt => (nextLevel.slug === prompt.slug) && !this.levelStatusMap[prompt.unless]) |
| 1382 | )) { |
| 1383 | if (nextLevel.practice === true && nextLevel.slug.match(level.slug.replace(/-[a-z]$/, ''))) { |
| 1384 | // If this is a practice level for the current level, we don't want to point it out |
| 1385 | // This is a bit of a hack, but it's the best way to handle this for now |
| 1386 | // It works for the Junior levels where they have the same slug with a -a or -b at the end |
| 1387 | continue |
| 1388 | } else { |
| 1389 | nextLevel.next = true |
| 1390 | } |
| 1391 | return true |
| 1392 | } |
| 1393 | } |
| 1394 | return false |
| 1395 | } |
| 1396 | |
| 1397 | let foundNext = false |
| 1398 | for (let levelIndex = 0; levelIndex < orderedLevels.length; levelIndex++) { |
nothing calls this directly
no test coverage detected