restructured project, added bat files to make it user friendly, added addon inside repo itself, changed addon to be fixed on top left

This commit is contained in:
DESKTOP-JVKHS7I\Adam 2019-11-13 17:28:45 +05:30
parent 3078ab1130
commit 721ba1375a
25 changed files with 218 additions and 37 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -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
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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 <project-dir>` 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 <directory-of-fishybot>` 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).

View File

@ -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

3
install_modules.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
pip install -r requirements.txt
PAUSE

3
run_fishybot.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
python fishy.py
PAUSE

View File

@ -1,4 +1,4 @@
from init import *
from systems.init import *
class Control:

View File

@ -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

View File

@ -1,4 +1,4 @@
from window import *
from systems.window import *
class FishingMode:

View File

@ -3,7 +3,7 @@
Usage:
fishy.py -h | --help
fishy.py -v | --version
fishy.py [--debug] [--ip=<ipv4>] [--hook-threshold=<int>] [--check-frequency=<hz>] [--collect-r]
fishy.py [--debug] [--ip=<ipv4>] [--hook-threshold=<int>] [--check-frequency=<hz>] [--collect-r] [--borderless]
Options:
-h, --help Show this screen.
@ -12,9 +12,10 @@ Options:
--hook-threshold=<int> Threshold amount for classifier after which label changes [default: 1].
--check-frequency=<hz> 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
'''

View File

@ -1,4 +1,4 @@
from controls import *
from systems.controls import *
class Log:

View File

@ -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

View File

@ -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