diff --git a/ProvisionsChalutier/Chalutier.lua b/ProvisionsChalutier/Chalutier.lua new file mode 100644 index 0000000..f780a58 --- /dev/null +++ b/ProvisionsChalutier/Chalutier.lua @@ -0,0 +1,129 @@ +local FSH_STATE_WAITING = 0 +local FSH_STATE_FISHING = 1 +local FSH_STATE_GOT = 2 +local FSH_STATE_CAUGHT = 3 + +local FSH_STATE_NAME = { + "WAITING", + "FISHING", + "GOT", + "CAUGHT" +} + +local currentState +local function changeState(state, arg2) + if currentState == state then return end + + if state == FSH_STATE_WAITING then + if currentState == FSH_STATE_CAUGHT and not arg2 then return end + ProvCha.UI.Icon:SetTexture("ProvisionsChalutier/textures/icon_dds/waiting.dds") + ProvCha.UI.blocInfo:SetColor(0.3961, 0.2706, 0) + + EVENT_MANAGER:UnregisterForUpdate(ProvCha.name .. "antiJobFictif") + EVENT_MANAGER:UnregisterForEvent(ProvCha.name .. "OnSlotUpdate", EVENT_INVENTORY_SINGLE_SLOT_UPDATE) + elseif state == FSH_STATE_FISHING then + ProvCha.UI.Icon:SetTexture("ProvisionsChalutier/textures/icon_dds/fishing.dds") + ProvCha.UI.blocInfo:SetColor(0.2980, 0.6118, 0.8392) + + EVENT_MANAGER:RegisterForEvent(ProvCha.name .. "OnSlotUpdate", EVENT_INVENTORY_SINGLE_SLOT_UPDATE, Chalutier_OnSlotUpdate) + elseif state == FSH_STATE_GOT then + ProvCha.UI.Icon:SetTexture("ProvisionsChalutier/textures/icon_dds/got.dds") + ProvCha.UI.blocInfo:SetColor(0, 0.8, 0) + + EVENT_MANAGER:RegisterForUpdate(ProvCha.name .. "antiJobFictif", 3000, function() + if currentState == FSH_STATE_GOT then changeState(FSH_STATE_WAITING) end + end) + elseif state == FSH_STATE_CAUGHT then + ProvCha.UI.Icon:SetTexture("ProvisionsChalutier/textures/icon_dds/in_bag.dds") + ProvCha.UI.blocInfo:SetColor(0.3961, 0.2706, 0) + + EVENT_MANAGER:UnregisterForUpdate(ProvCha.name .. "antiJobFictif") + EVENT_MANAGER:UnregisterForEvent(ProvCha.name .. "OnSlotUpdate", EVENT_INVENTORY_SINGLE_SLOT_UPDATE) + + EVENT_MANAGER:RegisterForUpdate(ProvCha.name .. "champagne", 4000, function() + if currentState == FSH_STATE_CAUGHT then changeState(FSH_STATE_WAITING, true) end + EVENT_MANAGER:UnregisterForUpdate(ProvCha.name .. "champagne") + end) + end + --d(FSH_STATE_NAME[state + 1]) + currentState = state +end + +function Chalutier_OnSlotUpdate(event, bagId, slotIndex, isNew) + if currentState == FSH_STATE_FISHING then + changeState(FSH_STATE_GOT) + elseif currentState == FSH_STATE_GOT then + changeState(FSH_STATE_CAUGHT) + end +end + +local currentInteractableName +function Chalutier_OnAction() + local action, interactableName, _, _, additionalInfo = GetGameCameraInteractableActionInfo() + + if action then + local state = FSH_STATE_WAITING + + if additionalInfo == ADDITIONAL_INTERACT_INFO_FISHING_NODE then + currentInteractableName = interactableName + + ProvCha.UI.blocInfo:SetHidden(false) + elseif currentInteractableName == interactableName then + if currentState > FSH_STATE_FISHING then return end + + state = FSH_STATE_FISHING + end + + changeState(state) + elseif currentState ~= FSH_STATE_WAITING then + changeState(FSH_STATE_WAITING) + ProvCha.UI.blocInfo:SetHidden(true) + else + ProvCha.UI.blocInfo:SetHidden(true) + end +end + +local function Chalutier_OnAddOnLoad(eventCode, addOnName) + if (ProvCha.name ~= addOnName) then return end + + ProvCha.vars = ZO_SavedVars:NewAccountWide("ProvChaSV", 1, nil, ProvCha.defaults) + + ProvCha.UI = WINDOW_MANAGER:CreateControl(nil, GuiRoot, CT_TOPLEVELCONTROL) + ProvCha.UI:SetMouseEnabled(true) + ProvCha.UI:SetClampedToScreen(true) + ProvCha.UI:SetMovable(true) + ProvCha.UI:SetDimensions(64, 92) + ProvCha.UI:SetDrawLevel(0) + ProvCha.UI:SetDrawLayer(0) + ProvCha.UI:SetDrawTier(0) + + ProvCha.UI:SetHidden(not ProvCha.vars.enabled) + ProvCha.UI:ClearAnchors() + ProvCha.UI:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 0, 0) + + ProvCha.UI.blocInfo = WINDOW_MANAGER:CreateControl(nil, ProvCha.UI, CT_TEXTURE) + ProvCha.UI.blocInfo:SetDimensions(64, 6) + ProvCha.UI.blocInfo:SetColor(0.396, 0.27, 0) + ProvCha.UI.blocInfo:SetAnchor(TOP, ProvCha.UI, TOP, 0, blocInfo) + ProvCha.UI.blocInfo:SetHidden(true) + ProvCha.UI.blocInfo:SetDrawLevel(2) + + ProvCha.UI.Icon = WINDOW_MANAGER:CreateControl(nil, ProvCha.UI, CT_TEXTURE) + ProvCha.UI.Icon:SetBlendMode(TEX_BLEND_MODE_ALPHA) + ProvCha.UI.Icon:SetTexture("ProvisionsChalutier/textures/icon_dds/waiting.dds") + ProvCha.UI.Icon:SetDimensions(64, 64) + ProvCha.UI.Icon:SetAnchor(TOPLEFT, ProvCha.UI, TOPLEFT, 0, 18) + ProvCha.UI.Icon:SetHidden(false) + ProvCha.UI.Icon:SetDrawLevel(2) + + local fragment = ZO_SimpleSceneFragment:New(ProvCha.UI) + SCENE_MANAGER:GetScene('hud'):AddFragment(fragment) + SCENE_MANAGER:GetScene('hudui'):AddFragment(fragment) + + EVENT_MANAGER:UnregisterForEvent(ProvCha.name, EVENT_ADD_ON_LOADED) + + ZO_PreHookHandler(RETICLE.interact, "OnEffectivelyShown", Chalutier_OnAction) + ZO_PreHookHandler(RETICLE.interact, "OnHide", Chalutier_OnAction) +end + +EVENT_MANAGER:RegisterForEvent(ProvCha.name, EVENT_ADD_ON_LOADED, function(...) Chalutier_OnAddOnLoad(...) end) diff --git a/ProvisionsChalutier/ProvisionsChalutier.txt b/ProvisionsChalutier/ProvisionsChalutier.txt new file mode 100644 index 0000000..d415891 --- /dev/null +++ b/ProvisionsChalutier/ProvisionsChalutier.txt @@ -0,0 +1,11 @@ +## Title: |c00C000Prov|r's Chalutier 1.0.3 (Fishing) +## Description: Pour la pêche. (For fishing) +## Author: |c00C000Provision|r +## SavedVariables: ProvChaSV +## APIVersion: 100025, 100026 +## Version: 1.0.3 + +; Trawler +header.lua + +Chalutier.lua diff --git a/ProvisionsChalutier/README.md b/ProvisionsChalutier/README.md new file mode 100644 index 0000000..0544a09 --- /dev/null +++ b/ProvisionsChalutier/README.md @@ -0,0 +1,11 @@ +ProvisionsChalutier 1.0.3 +============= + +[![Esoui Prov's Chalutier page](https://img.shields.io/badge/esoui.com-Provision%27s%20Chalutier-green.svg)](https://www.esoui.com/downloads/info2203-ProvisionsChalutierFishing.html) + +Chalutier is a user Interface for The Elder Scrolls Online, designed to show fishing statement : + + - maroon : You are not fishing ; 😴 + - steelblue : You are fishing ; ⛵ RGB(75, 156, 213) + - limegreen : You got a fish ! You have to caught it ! 🎣 RGB(0, 204, 0) + - maroon : You caught it ! 💰 RGB(101, 69, 0) diff --git a/ProvisionsChalutier/chalutier_low.jpg b/ProvisionsChalutier/chalutier_low.jpg new file mode 100644 index 0000000..94a220f Binary files /dev/null and b/ProvisionsChalutier/chalutier_low.jpg differ diff --git a/ProvisionsChalutier/header.lua b/ProvisionsChalutier/header.lua new file mode 100644 index 0000000..d606c2e --- /dev/null +++ b/ProvisionsChalutier/header.lua @@ -0,0 +1,16 @@ +ProvCha = +{ + name = "ProvisionsChalutier", + namePublic = "Prov's Chalutier", + nameColor = "|c3BC6DCChalutier|r", + author = "|c00C000Provision|r", + version = "1.0.3", --4 endroits + CPL = nil, + defaults = + { --Don't forget header.lua + enabled = true, + + posx = GuiRoot:GetWidth() / 2 - 485, + posy = 0 + } +} diff --git a/ProvisionsChalutier/textures/icon_dds/caught.dds b/ProvisionsChalutier/textures/icon_dds/caught.dds new file mode 100644 index 0000000..2548b97 Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/caught.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/caught_one.dds b/ProvisionsChalutier/textures/icon_dds/caught_one.dds new file mode 100644 index 0000000..46b9101 Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/caught_one.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/fish.dds b/ProvisionsChalutier/textures/icon_dds/fish.dds new file mode 100644 index 0000000..3f28d00 Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/fish.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/fish_crown.dds b/ProvisionsChalutier/textures/icon_dds/fish_crown.dds new file mode 100644 index 0000000..628f4ba Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/fish_crown.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/fishing.dds b/ProvisionsChalutier/textures/icon_dds/fishing.dds new file mode 100644 index 0000000..b3f4077 Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/fishing.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/got.dds b/ProvisionsChalutier/textures/icon_dds/got.dds new file mode 100644 index 0000000..10c560d Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/got.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/in_bag.dds b/ProvisionsChalutier/textures/icon_dds/in_bag.dds new file mode 100644 index 0000000..13ac6d6 Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/in_bag.dds differ diff --git a/ProvisionsChalutier/textures/icon_dds/waiting.dds b/ProvisionsChalutier/textures/icon_dds/waiting.dds new file mode 100644 index 0000000..bfd7432 Binary files /dev/null and b/ProvisionsChalutier/textures/icon_dds/waiting.dds differ diff --git a/README.md b/README.md index a253560..f64f128 100644 --- a/README.md +++ b/README.md @@ -17,19 +17,19 @@ Don't forget to star this repository if you really liked it :) ### How to configure Project Requirements: -- Install [Provision's Chalutier : Fishing Mod](https://www.esoui.com/downloads/info2203-ProvisionsChalutierFishing.html) addon for ESO. - Download/Clone the project. -- Install [Python v3.7.3](https://www.python.org/downloads/release/python-373/). -- Open the project folder then, `SHIFT + RIGHT CLICK` on the folder and press `Open Power Shell window here`. -- Type command `pip install -r requirements.txt` and press enter. +- Copy Provision's Chalutier folder into `Documents\Elder Scrolls Online\live\AddOns`. +- Install [Python v3.7.3](https://www.python.org/downloads/release/python-373/) (make sure you tick, `Add Python to PATH`). +- Run `install_modules.bat` file. Executing the Bot: - Start the game. -- Type the command `python fishy.py` (For phone notification configuration, follow the instructions below instead). +- Run `run_fishybot.bat` file. +- Optional: To add additional parameters, you will need to run the bot using powershell, to do so open powershell then use `cd ` command, eg. `cd C:\fishyboteso-master`. Then type `python fishy.py` followed by the parameters you wish to use. Starting fishing: -- Look at a fishing hole (don't start fishing) - Press `f9` to start the bot. +- Look at a fishing hole, bot will automatically start fishing. - After the fishing is done, just move to next hole and look at it, fishing will start automatically. - **IMPORTANT**: Keep the window focus on the game, even when controlling the bot. @@ -48,39 +48,45 @@ To increase the check rate of the bot, try changing `--check-frequency` option t ### FAQs Will I get baned using this bot? -> Botting does violate ESO's terms of service, so technically you could get banned. But this bot doesn't read or write memory from ESO so they won't know you are using a bot. This software doesn't come with any Liability or Warranty, I am not responsible if you do get banned. +> Botting does violate ESO's terms of service, so technically you could get banned. But this bot doesn't read or write memory from ESO so they won't know you are using a bot. **This software doesn't come with any Liability or Warranty, I am not responsible if you do get banned.** How much automation does this bot provide? > It's not a fully automated bot, it does fishing on its own but you will have to move from one hole to another manually (although I was developing a fully automated bot, I didn't get a positive feedback from the community so I discontinued it) +Why am I getting this `pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program.`? + +> Python and Pip are not in path variables, follow [this guide](https://www.youtube.com/watch?v=UTUlp6L2zkw) to add it. + +I'm hitting the `F9` key but nothing is happening + +> - Certain keyboards have the F9 key assigned to another function. Try remapping your F9 key to its intended function. +> - Windows messing up with input. Try running powershell/cmd as admin. Then use `cd ` to get into the fishybot project folder. eg, `cd C:\fishyboteso-master\`. + The bot says `look at a fishing hole before starting` but I am looking at a fishing hole > The bot isn't able to detect the graphic/color created by `Provision's Chalutier : Fishing Mod`, this could be because, > - Addon is not properly configured > - Make sure you have copied the addon folder to `Elder Scrolls Online\live\AddOns` directory and turn on "Allow out of date addons" in ESO -> - Try installing the addon from [Minion](https://minion.mmoui.com/) > - Something is overlapping or bot can't find it -> - Move the emoji by pressing the `.` key and dragging it towards the center -> - Post processing effects (turn it off) +> - Make sure that the addon is aligned on top-left in the game. +> - Move the emoji by pressing the `.` key. +> - Post processing effects (turn it off). > > If it is still not working, try disabling all other addons in ESO. -The bot says `STARTED` but nothing is happening +~~The bot says `STARTED` but nothing is happenin~~ -> This is a known issue with the bot, try reducing the window size of the game. Don't use it on fullscreen mode. +> [FIXED] ~~This is a known issue with the bot, try reducing the window size of the game. Don't use it on fullscreen mode.~~ + +Bot doesn't work in full screen. + +> Run the bot with added option `--borderless` for starting the bot, like `python fishy.py --borderless`. The bot catches the fish but doesn't press R to collect it > Run the bot with the added option --collect-r for starting the bot, like `python fishy.py --collect-r` -I'm hitting the `F9` key but nothing is happening -> Certain keyboards have the F9 key assigned to another function. Try remapping your F9 key to its intended function. -> For example: -> - The Razer BlackWidow Chroma keyboard has the F9 key set to be a macro recording key. -> - Simply go into Razer Synapse and reassign the F9 key from `Macro` to `Default` - - ### Contact If you have any problems or you want to contact me for future ideas or want to collaborate in development you can contact me at the [DefineX Community discord server](https://discord.gg/V6e2fpc). diff --git a/fishy.py b/fishy.py index 5001fec..deff965 100644 --- a/fishy.py +++ b/fishy.py @@ -1,4 +1,4 @@ -from pixel_loc import * +from systems.pixel_loc import * """ Start reading from `init.py` """ @@ -25,7 +25,7 @@ def on_release(key): print("STARTED") G.pause = False else: - print("look on a fishing hole before starting") + print("addon properly not installed, if it is installed try restarting the game.") elif c[0] == Control.Keywords.Debug: G.debug = not G.debug diff --git a/install_modules.bat b/install_modules.bat new file mode 100644 index 0000000..65b392f --- /dev/null +++ b/install_modules.bat @@ -0,0 +1,3 @@ +@echo off +pip install -r requirements.txt +PAUSE \ No newline at end of file diff --git a/run_fishybot.bat b/run_fishybot.bat new file mode 100644 index 0000000..a5a580f --- /dev/null +++ b/run_fishybot.bat @@ -0,0 +1,3 @@ +@echo off +python fishy.py +PAUSE \ No newline at end of file diff --git a/controls.py b/systems/controls.py similarity index 98% rename from controls.py rename to systems/controls.py index a405637..690fb1b 100644 --- a/controls.py +++ b/systems/controls.py @@ -1,4 +1,4 @@ -from init import * +from systems.init import * class Control: diff --git a/fishing_event.py b/systems/fishing_event.py similarity index 98% rename from fishing_event.py rename to systems/fishing_event.py index fc4a22a..c4bf0dc 100644 --- a/fishing_event.py +++ b/systems/fishing_event.py @@ -1,4 +1,4 @@ -from fishing_mode import * +from systems.fishing_mode import * """ Defines different fishing modes (states) which acts as state for state machine diff --git a/fishing_mode.py b/systems/fishing_mode.py similarity index 98% rename from fishing_mode.py rename to systems/fishing_mode.py index 45cfe18..6e5b22d 100644 --- a/fishing_mode.py +++ b/systems/fishing_mode.py @@ -1,4 +1,4 @@ -from window import * +from systems.window import * class FishingMode: diff --git a/fishy_network.py b/systems/fishy_network.py similarity index 100% rename from fishy_network.py rename to systems/fishy_network.py diff --git a/init.py b/systems/init.py similarity index 91% rename from init.py rename to systems/init.py index c742b63..e9a0a36 100644 --- a/init.py +++ b/systems/init.py @@ -3,7 +3,7 @@ Usage: fishy.py -h | --help fishy.py -v | --version - fishy.py [--debug] [--ip=] [--hook-threshold=] [--check-frequency=] [--collect-r] + fishy.py [--debug] [--ip=] [--hook-threshold=] [--check-frequency=] [--collect-r] [--borderless] Options: -h, --help Show this screen. @@ -12,9 +12,10 @@ Options: --hook-threshold= Threshold amount for classifier after which label changes [default: 1]. --check-frequency= Sleep after loop in s [default: 1]. --debug Start program in debug controls. + --borderless Use if the game is in fullscreen or borderless window """ -VERSION = "0.1.2" +VERSION = "0.1.3" print("Fishy " + VERSION + " for Elder Scrolls Online") try: @@ -32,7 +33,7 @@ try: import cv2 import pyautogui import time - import fishy_network as net + from systems import fishy_network as net from pynput.keyboard import Key, Listener from decimal import Decimal from win32api import GetSystemMetrics @@ -44,7 +45,10 @@ try: import sys import numpy as np import math + import os + import re except Exception: + print("Modules not installed properly, try running `pip install -r requirements.txt`") raise ''' diff --git a/log.py b/systems/log.py similarity index 97% rename from log.py rename to systems/log.py index ec81386..ce9c047 100644 --- a/log.py +++ b/systems/log.py @@ -1,4 +1,4 @@ -from controls import * +from systems.controls import * class Log: diff --git a/pixel_loc.py b/systems/pixel_loc.py similarity index 87% rename from pixel_loc.py rename to systems/pixel_loc.py index 473fa3d..8907398 100644 --- a/pixel_loc.py +++ b/systems/pixel_loc.py @@ -1,5 +1,4 @@ -from fishing_event import * - +from systems.fishing_event import * def GetKeypointFromImage(img): """ @@ -60,11 +59,7 @@ class PixelLoc: then uses `GetKeypointFromImage()` to find the ProvisionsChalutier pixel location :return: false if pixel loc not found """ - win = Window() - t = GetKeypointFromImage(win.getCapture()) - if t is None: - return False + PixelLoc.val = (0, 0, 1, 1) - PixelLoc.val = (t[0], t[1], t[0] + 1, t[1] + 1) return True diff --git a/window.py b/systems/window.py similarity index 95% rename from window.py rename to systems/window.py index ef0dc70..d9dfac0 100644 --- a/window.py +++ b/systems/window.py @@ -1,4 +1,4 @@ -from log import * +from systems.log import * class Window: @@ -34,6 +34,9 @@ class Window: clientRect = win32gui.GetClientRect(Window.hwnd) Window.windowOffset = math.floor(((rect[2] - rect[0]) - clientRect[2]) / 2) Window.titleOffset = ((rect[3] - rect[1]) - clientRect[3]) - Window.windowOffset + if arguments["--borderless"]: + Window.titleOffset = 0 + except pywintypes.error: print("Game window not found") quit() @@ -59,7 +62,7 @@ class Window: Window.Screen = tempScreen[crop[1]:crop[3], crop[0]:crop[2]] if Window.Screen.size == 0: - print("Don't drag game window outside the screen") + print("Don't minimize or drag game window outside the screen") quit(1) @staticmethod