[Linux-only] basically bloxstap for sober

fix floor counting (and skipping floors)

+14 -17
+14 -17
src/features/regretevator-daily-challenge.ts
··· 12 12 let regretevator: boolean = false; 13 13 let floorNumStart = 999999; 14 14 let floorNumEnd = 999999; 15 - let numFloors = 50; 15 + let numFloorsGoal = 50; 16 16 let numFloorsDeath = 5; 17 17 let numFloorsDead = 0; 18 18 let challengeDone: boolean = false; ··· 23 23 regretevator = false; 24 24 floorNumStart = 999999; 25 25 floorNumEnd = 999999; 26 - numFloorsDead = 0; 26 + numFloorsGoal = 50; 27 27 challengeDone = false; 28 28 dead = false; 29 29 activeFloorCount = 0; ··· 58 58 ); 59 59 if (floorNumStart === 999999) { 60 60 floorNumStart = f; 61 - floorNumEnd = f + numFloors; 61 + floorNumEnd = f + numFloorsGoal; 62 62 console.log( 63 63 "[RegretevatorDailyChallenge]", 64 64 `Detected Regretevator, floor ${floorNumStart}, target floor ${floorNumEnd}` 65 65 ); 66 66 exec( 67 - `notify-send -a "tuxstrap" -u low "Regretevator" "Challenge: Survive ${ 68 - floorNumEnd - floorNumStart 69 - } floors"` 67 + `notify-send -a "tuxstrap" -u low "Regretevator" "Challenge: Survive ${numFloorsGoal} floors"` 70 68 ); 71 69 return; 72 70 } 73 - if (!dead) { 74 - activeFloorCount++; 75 - } 76 - if (activeFloorCount === numFloors) { 71 + activeFloorCount++; 72 + if (activeFloorCount === numFloorsGoal) { 77 73 challengeDone = true; 78 74 (process as any).REGRETEVATOR_DAILY_CHALLENGE_ACTIVE = 79 75 false; 80 76 exec( 81 - `notify-send -a "tuxstrap" -u low "Regretevator" "You survived ${numFloors} floors, congrats! :3"` 77 + `notify-send -a "tuxstrap" -u low "Regretevator" "You survived ${numFloorsGoal} floors, congrats! :3"` 82 78 ); 83 79 console.log( 84 80 "[RegretevatorDailyChallenge]", 85 - `Finished challenge, floors survived: ${numFloors}` 81 + `Finished challenge, floors survived: ${numFloorsGoal}` 86 82 ); 87 83 return; 88 84 } 89 85 console.log( 90 86 "[RegretevatorDailyChallenge]", 91 - `On floor ${f}, active floor ${activeFloorCount}/${numFloors}` 87 + `On floor ${f}, active floor ${activeFloorCount}/${numFloorsGoal}` 92 88 ); 93 89 exec( 94 - `notify-send -a "tuxstrap" -u low "Regretevator" "Floor ${f} - ${activeFloorCount}/${numFloors}"` 90 + `notify-send -a "tuxstrap" -u low "Regretevator" "Floor ${f} - ${activeFloorCount}/50"` 95 91 ); 96 92 } else if ((data.state as string) === "Going up!") { 97 93 // exec(`notify-send -a "tuxstrap" -u low "Regretevator" "Going Up!"`); 98 94 } else if ((data.state as string) === "Lounging in the lobby") { 99 95 if (!dead) { 100 - dead = true; 96 + floorNumEnd += numFloorsDeath; 101 97 numFloorsDead++; 98 + numFloorsGoal += numFloorsDeath; 102 99 console.log( 103 100 "[RegretevatorDailyChallenge]", 104 - `Player died, resetting active floor count` 101 + `Player died` 105 102 ); 106 103 exec( 107 104 `notify-send -a "tuxstrap" -u low "Regretevator" "haha im making you do ${numFloorsDeath} more floors >:3"` ··· 113 110 } 114 111 } catch (e_) {} 115 112 } else { 116 - floorNumStart = 999999; 113 + floorNumStart = 50; 117 114 regretevator = false; 118 115 (process as any).REGRETEVATOR_DAILY_CHALLENGE_ACTIVE = false; 119 116 }