Skip to content

Commit

Permalink
Chore: Update TODO and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveLemon committed Dec 31, 2024
1 parent 95dccd0 commit f43d00e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ A Nim based fishing script Webfishing
- [x] `-d | --device` (Device for input)
- [x] mode argument (fish, bucket, or combo)
- [ ] Sensory
- [ ] Capture screen and analyze pixels (X11 wrapper)
- [x] Capture screen and analyze pixels (X11 wrapper)
- [ ] Receive/send keyboard inputs (libevdev wrapper)
- [ ] Fishing game
- [ ] Casting/reeling
- [ ] Game detection/completion
- [x] Game detection
- [ ] Game completion
- [ ] Bucket game
- [ ]? Smart mode (Pixel detections)
- [ ] Dumb mode (Periodically press "e")
- [ ] Combined game (fishing and bucketting)
- [ ] Combined game (fishing and bucket)
- [ ] Testing/ECC
- [ ] Error check config
- [ ] parse test constJson
Expand Down
25 changes: 12 additions & 13 deletions src/webfisher/pixel.nim
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ type
PixelList = seq[tuple[x, y, r, g, b: int]]


const# 428, 745
const
fishingGamePixels: PixelList = @[(428, 785, 156, 145, 74), (388, 745, 156, 145, 74), (428, 705, 156, 145, 74), (468, 745, 156, 145, 74)]


# saveToPPM: https://github.com/nim-lang/x11/blob/29aca5e519ebf5d833f63a6a2769e62ec7bfb83a/examples/xshmex.nim#L40
proc saveToPPM(image: PXImage, filePath: string) =
var f = open(filePath, fmWrite)
defer: f.close
writeLine(f, "P6")
writeLine(f, image.width, " ", image.height)
writeLine(f, 255)
for i in 0..<(image.width * image.height):
f.write(image.data[i * 4 + 2])
f.write(image.data[i * 4 + 1])
f.write(image.data[i * 4 + 0])
# Only here for testing
# proc saveToPPM(image: PXImage, filePath: string) =
# var f = open(filePath, fmWrite)
# defer: f.close
# writeLine(f, "P6")
# writeLine(f, image.width, " ", image.height)
# writeLine(f, 255)
# for i in 0..<(image.width * image.height):
# f.write(image.data[i * 4 + 2])
# f.write(image.data[i * 4 + 1])
# f.write(image.data[i * 4 + 0])

proc getScreenshot(display: PDisplay): PXImage =
return XGetImage(display, RootWindow(display, DefaultScreen(display)), 1920, 0, 1920, 1080, AllPlanes, ZPixmap)
Expand All @@ -53,8 +54,6 @@ proc getFishingGame*(display: PDisplay): bool =
# screenshot.saveToPPM("./screenshot.ppm")
for gamePixel in fishingGamePixels:
let pixel: Pixel = getPixelColor(display, screenshot, gamePixel.x, gamePixel.y)
#echo pixel
#echo gamePixel
if
pixel.r == gamePixel.r and
pixel.g == gamePixel.g and
Expand Down

0 comments on commit f43d00e

Please sign in to comment.