pretty
This commit is contained in:
@@ -24,26 +24,28 @@ export type RegretevatorState = DeadUnknownState | InElevatorState;
|
||||
export function getRegretevatorState(): null | RegretevatorState {
|
||||
if (!existsSync(STATE_FILE_PATH)) return null;
|
||||
try {
|
||||
const {text, tooltip}: { text: string, tooltip: string } = JSON.parse(readFileSync(STATE_FILE_PATH).toString('utf-8'))
|
||||
const { text, tooltip }: { text: string; tooltip: string } = JSON.parse(
|
||||
readFileSync(STATE_FILE_PATH).toString("utf-8"),
|
||||
);
|
||||
if (/^On Floor ([0-9]+)$/.test(tooltip)) {
|
||||
const floorNum = tooltip.match(/^On Floor ([0-9]+)$/)![1]
|
||||
const floorNum = tooltip.match(/^On Floor ([0-9]+)$/)![1];
|
||||
return {
|
||||
floor: Number(floorNum),
|
||||
state: "INGAME",
|
||||
isGoingUp: false
|
||||
}
|
||||
isGoingUp: false,
|
||||
};
|
||||
}
|
||||
if (/^Floor ([0-9]+)/.test(tooltip)) {
|
||||
const floorNum = tooltip.match(/^Floor ([0-9]+)/)![1]
|
||||
const floorNum = tooltip.match(/^Floor ([0-9]+)/)![1];
|
||||
return {
|
||||
floor: Number(floorNum),
|
||||
state: "INGAME",
|
||||
isGoingUp: true
|
||||
}
|
||||
isGoingUp: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
state: "UNKNOWN"
|
||||
}
|
||||
state: "UNKNOWN",
|
||||
};
|
||||
} catch {}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user