-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f43d00e
commit b3c9c65
Showing
16 changed files
with
3,721 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,37 @@ | ||
# webfisher | ||
A Nim based fishing script Webfishing | ||
|
||
# TODO | ||
- [x] Config loading | ||
- [x] Find the true user (The user running with sudo) | ||
- [x] Load config file | ||
- [x] Create config file | ||
- [x] Update config file | ||
- [ ] Hot-reloading (just internally restart the program) | ||
- [x] CLI | ||
- [x] `-h | --help` (Print out other flags) | ||
- [x] `-v | --version` | ||
- [x] `-f | --file` (Config file to load) | ||
- [x] `-d | --device` (Device for input) | ||
- [x] mode argument (fish, bucket, or combo) | ||
- [ ] Sensory | ||
- [x] Capture screen and analyze pixels (X11 wrapper) | ||
- [ ] Receive/send keyboard inputs (libevdev wrapper) | ||
- [ ] Fishing game | ||
- [ ] Casting/reeling | ||
- [x] Game detection | ||
- [ ] Game completion | ||
- [ ] Bucket game | ||
- [ ] Dumb mode (Periodically press "e") | ||
- [ ] Combined game (fishing and bucket) | ||
- [ ] Testing/ECC | ||
- [ ] Error check config | ||
- [ ] parse test constJson | ||
- Other goals | ||
- [ ] Variable verbosity output | ||
A Nim based fishing script for Webfishing | ||
|
||
> [!CAUTION] | ||
> I am not responsible for any bans or data loss as a result of using this. This was a project for me to learn Nim. If you are worried about getting banned, don't use it and be a legitimate player :) | ||
> I am not responsible for any bans or data loss as a result of using this. This was a project for me to learn Nim. If you have any concerns, don't use it and be a legitimate player :) | ||
# Dependencies | ||
- Linux. <b>This is not supported on Windows or MacOS.</b> | ||
- X11. This is not supported on Wayland. | ||
- Sudo. This requires access to input devices. | ||
- Nim packages: `libevdev, x11` | ||
- A user in the "input" group or sudo privileges. | ||
- Nimble packages: `x11` | ||
|
||
# Usage | ||
### Nix: | ||
- You can get the package in my [flake repository](https://github.com/PassiveLemon/lemonake). </br> | ||
- You can get the package in my [flake repository](https://github.com/PassiveLemon/lemonake). | ||
### Source: | ||
- Clone the repo, cd to src | ||
- Run `nim c -r webfisher` | ||
- Edit the generated config file in your `~/.config/webfisher/config.json`. You can also supply a config file with `-f <path to config.json`. Please read the configuration below, you need to configure the file to enable functionality. </br> | ||
- Edit the generated config file in your `~/.config/webfisher/config.json`. You can also supply a config file with `-f <path to config.json`. | ||
- Arguments can be found by tacking `-h` or `--help` | ||
|
||
In order to use this script, you must enable the built-in autoclicker in the Webfishing main settings. | ||
|
||
# Configuration (config.json) | ||
| Setting | Default | Details | | ||
| :- | :- | :- | | ||
| castOnStart | `false` (Boolean) | Whether to cast the rod upon starting the script. When set to `false`, this will not do anything until the rod is cast and the fishing task is detected. | | ||
| castTime | `1.0` (Float) | How long to cast the rod (in seconds). | | ||
| checkInterval | `0.25` (Float) | How often to check for visual input (in seconds). | | ||
|
||
# TODO | ||
- [ ] Timestamps | ||
- [ ] Verbose and quiet output | ||
- [ ] parse test constJson | ||
- [ ] Periodic sodas (Player config for slot) | ||
- [ ] Auto shop (Needs cursor movement) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,70 @@ | ||
import | ||
std/os | ||
std / [ | ||
os, | ||
times | ||
] | ||
|
||
import | ||
webfisher / [ | ||
config, | ||
pixel | ||
evdev, | ||
screen, | ||
task, | ||
] | ||
|
||
import | ||
x11/xlib | ||
|
||
|
||
type | ||
GlobalState* = object | ||
fishingGameActive: bool | ||
bucketGameActive: bool | ||
comboGameActive: bool | ||
lineCast: bool | ||
bucketTime: float | ||
# sodaTime: float | ||
# shopCount: int | ||
|
||
var globalState*: GlobalState | ||
|
||
block webfisher: | ||
let | ||
config: Config = initConfig() | ||
display: PDisplay = XOpenDisplay(nil) | ||
var globalState*: GlobalState = GlobalState( | ||
lineCast: true, | ||
bucketTime: epochTime(), | ||
# sodaTime: epochTime(), | ||
# shopCount: 0 | ||
) | ||
|
||
|
||
echo config | ||
echo "Config loaded." | ||
block webfisher: | ||
let config = initConfig() | ||
if config.castOnStart == true: | ||
globalState.lineCast = false | ||
initDisplay() | ||
initDevice() | ||
|
||
while true: | ||
echo "Simulated main loop" | ||
if getFishingGame(display): | ||
echo "Fishing game found" | ||
sleep((config.checkInterval * 1000).int) | ||
if (config.gameMode == "fish" or config.gameMode == "combo") and getFishingGame(): | ||
echo "Doing fishing task" | ||
doFish() | ||
sleep(3000) | ||
if getCatchMenu(): | ||
echo "Clicking through menu" | ||
clickCatchMenu() | ||
else: | ||
echo "No catch detected" | ||
globalState.lineCast = false | ||
sleep(1000) | ||
|
||
if (config.gameMode == "bucket" or config.gameMode == "combo") and ((epochTime() - globalState.bucketTime) > 30) and globalState.lineCast == false: | ||
echo "Doing bucket task" | ||
doBucket() | ||
sleep(1000) | ||
if getCatchMenu(): | ||
echo "Clicking through menu" | ||
clickCatchMenu() | ||
else: | ||
echo "No catch detected" | ||
globalState.bucketTime = epochTime() | ||
sleep(1000) | ||
|
||
discard XCloseDisplay(display) | ||
if globalState.lineCast == false: | ||
sleep(1000) | ||
echo "Casting line" | ||
castLine(config.castTime) | ||
globalState.lineCast = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.