[Linux-only] basically bloxstap for sober

fix floor counting (and skipping floors)

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