[UserScript] Leech List Burn-Only Upgrade

I wasn’t expecting this thread to be so old. It’s amazing the script still works after all this time. I see that OP hasn’t been seen in a bit over a year, but I thought it good to share here anyway. I noticed today a couple of problems with the script: that the config for get_items has an error, resulting in open framework returning all items on WaniKani; and that a couple of items that should have been marked 不可能 were not. This original method to determine if a leech will only reach a value of 1.00 by burning is not correct.

If anyone wants to edit the code manually, here’s what to do.

The correct config is:
const config = {
    wk_items: {
        options: {
            review_statistics: true,
            assignments: true
        },
        filters: {
            srs: {value: '-1,0,9', invert: true}
        }
    }
};
To fix the calculation of 'impossible':

We can replace the line that sets item.startleech and the entire switch statement that follows with:

item.mustBurn = (item.highestincorrect - item.highestincorrectstreak) + item.assignments.srs_stage >= 9
if (item.mustBurn) {
    item.impossible = "不可能";
    item.impcnt = 1;
}
else {
    item.impossible = " ";
    item.impcnt = 0;
}

Furthermore, we can replace the srs stage name switch by making use of a const declared near the beginning of the function and a single line to replace the switch:

Better code for assigning stage name
// near top of function, probably right after globals comment
const srs_stages = [
    'Initiate',
    'Apprentice 1',
    'Apprentice 2',
    'Apprentice 3',
    'Apprentice 4',
    'Guru 1',
    'Guru 2',
    'Master',
    'Enlightened',
    'Burned'
];

// then replace switch(item.assignments.srs_stages) with the following line
item.srsstagename = srs_stages[item.assignments.srs_stage];

If you’re still around using this, I hope these fixes help :3

1 Like