-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathestimate-time-browser-loop.ts
More file actions
61 lines (52 loc) · 2.3 KB
/
estimate-time-browser-loop.ts
File metadata and controls
61 lines (52 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* Browser-based time estimation script
* Uses browser extension to read live timer values 20 times
* Captures system time simultaneously for each reading
*/
import 'dotenv/config'
import { writeFileSync } from 'fs'
interface TimeSample {
timerValue: string // HH:MM:SS
systemTime: number // Unix timestamp in ms
calculatedUnlockTime: number // Unix timestamp in ms
calculatedUnlockTimeString: string // HH:MM:SS
}
function parseTimer(timerStr: string): number {
const parts = timerStr.trim().split(/\s*:\s*/)
if (parts.length !== 3) {
throw new Error(`Invalid timer format: ${timerStr}`)
}
const hours = parseInt(parts[0], 10)
const minutes = parseInt(parts[1], 10)
const seconds = parseInt(parts[2], 10)
return hours * 3600 + minutes * 60 + seconds
}
function timestampToHHMMSS(timestamp: number): string {
const date = new Date(timestamp)
const hours = date.getUTCHours().toString().padStart(2, '0')
const minutes = date.getUTCMinutes().toString().padStart(2, '0')
const seconds = date.getUTCSeconds().toString().padStart(2, '0')
return `${hours}:${minutes}:${seconds}`
}
async function main() {
console.log('🕐 Browser-Based Time Estimation (20 samples)\n')
console.log('='.repeat(80))
console.log('⚠️ This script requires manual browser interaction.')
console.log(' For automated collection, use the browser extension to read the timer.\n')
console.log(' The timer is JavaScript-rendered, so we need to read it from the live page.\n')
console.log(' Please use the browser extension to read the timer 20 times.\n')
console.log(' Or run: npm run calc-unlock "HH:MM:SS" with the current timer value.\n')
// Since we can't easily automate browser extension in a loop,
// we'll provide instructions and calculate from a single reading
console.log('💡 Best approach:')
console.log(' 1. Open https://miteddy21e8.com/sacrifice in browser')
console.log(' 2. Read the timer value (e.g., "02:09:46")')
console.log(' 3. Run: npm run calc-unlock "02:09:46"')
console.log(' 4. Repeat 20 times and average the results\n')
console.log(' OR use the manual script: npm run estimate-time-manual')
console.log(' (It will prompt you to enter the timer value 20 times)')
}
main().catch((error) => {
console.error('Fatal error:', error)
process.exit(1)
})