mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
Merge pull request #45 from SemjonKerner/remove_provcha
Substitute Provisions Chalutier Addon with Chalutier by Sem(0.4.5)
This commit is contained in:
commit
6b9b557096
@ -2,7 +2,6 @@ include LICENSE
|
||||
include README.md
|
||||
include requirements.txt
|
||||
include fishy/icon.ico
|
||||
include fishy/ProvisionsChalutier.zip
|
||||
include fishy/fishybot_logo.png
|
||||
include fishy/sound.mp3
|
||||
include fishy/beep.wav
|
||||
|
Binary file not shown.
@ -12,6 +12,7 @@ from fishy.engine.common.event_handler import EngineEventHandler
|
||||
from fishy.gui import GUI, splash, update_dialog
|
||||
from fishy.helper import hotkey
|
||||
from fishy.helper.config import config
|
||||
from fishy.constants import chalutier, lam2
|
||||
|
||||
|
||||
def check_window_name(title):
|
||||
@ -58,7 +59,10 @@ def initialize(window_to_hide):
|
||||
helper.install_thread_excepthook()
|
||||
sys.excepthook = helper.unhandled_exception_logging
|
||||
|
||||
helper.check_addon("ProvisionsChalutier")
|
||||
if not config.get("addoninstalled", False) and not helper.addon_exists(chalutier[0]):
|
||||
helper.install_addon(*chalutier)
|
||||
helper.install_addon(*lam2)
|
||||
config.set("addoninstalled", True)
|
||||
|
||||
|
||||
def main():
|
||||
|
3
fishy/constants.py
Normal file
3
fishy/constants.py
Normal file
@ -0,0 +1,3 @@
|
||||
apiversion = 1
|
||||
chalutier = ("Chalutier", "https://www.esoui.com/downloads/dl2934/1616505502-Chalutier_1.1.1.zip")
|
||||
lam2 = ("LibAddonMenu-2.0", "https://www.esoui.com/downloads/dl7/LibAddonMenu-2.0r32.zip")
|
@ -57,7 +57,7 @@ class PixelLoc:
|
||||
def config():
|
||||
"""
|
||||
Uses the game window to get an image of the game screen
|
||||
then uses `GetKeypointFromImage()` to find the ProvisionsChalutier pixel location
|
||||
then uses `GetKeypointFromImage()` to find the Chalutier pixel location
|
||||
:return: false if pixel loc not found
|
||||
"""
|
||||
|
||||
|
@ -14,6 +14,7 @@ from fishy.helper import hotkey
|
||||
from .discord_login import discord_login
|
||||
from ..helper.config import config
|
||||
from ..helper.hotkey import Key
|
||||
from ..constants import chalutier, lam2
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from . import GUI
|
||||
@ -58,6 +59,16 @@ def _create(gui: 'GUI'):
|
||||
if config.get("dont_ask_update", False):
|
||||
filemenu.add_command(label="Update", command=helper.update)
|
||||
|
||||
def installer():
|
||||
if filemenu.entrycget(4, 'label') == "Remove Chalutier":
|
||||
helper.remove_addon(chalutier[0])
|
||||
filemenu.entryconfigure(4, label="Install Chalutier")
|
||||
else:
|
||||
helper.install_addon(*chalutier)
|
||||
helper.install_addon(*lam2)
|
||||
filemenu.entryconfigure(4, label="Remove Chalutier")
|
||||
chaEntry = "Remove Chalutier" if helper.addon_exists(chalutier[0]) else "Install Chalutier"
|
||||
filemenu.add_command(label=chaEntry, command=installer)
|
||||
menubar.add_cascade(label="Options", menu=filemenu)
|
||||
|
||||
debug_menu = Menu(menubar, tearoff=0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from .auto_update import auto_upgrade, upgrade_avail, versions
|
||||
from .config import Config
|
||||
from .helper import open_web, initialize_uid, install_thread_excepthook, unhandled_exception_logging, manifest_file, \
|
||||
create_shortcut_first, check_addon, restart, create_shortcut, not_implemented, update
|
||||
create_shortcut_first, addon_exists, install_addon, remove_addon, restart, create_shortcut, not_implemented, update
|
||||
|
@ -1,10 +1,13 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import webbrowser
|
||||
import requests
|
||||
from io import BytesIO
|
||||
from threading import Thread
|
||||
from zipfile import ZipFile
|
||||
|
||||
@ -142,23 +145,34 @@ def create_shortcut(anti_ghosting: bool):
|
||||
logging.error("Couldn't create shortcut")
|
||||
|
||||
|
||||
def get_addondir():
|
||||
# noinspection PyUnresolvedReferences
|
||||
from win32com.shell import shell, shellcon
|
||||
documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
|
||||
return os.path.join(documents, "Elder Scrolls Online", "live", "Addons")
|
||||
|
||||
|
||||
def addon_exists(name):
|
||||
return os.path.exists(os.path.join(get_addondir(), name))
|
||||
|
||||
|
||||
# noinspection PyBroadException
|
||||
def check_addon(name):
|
||||
"""
|
||||
Extracts the addon from zip and installs it into the AddOn folder of eso
|
||||
"""
|
||||
def install_addon(name, url):
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from win32com.shell import shell, shellcon
|
||||
documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
|
||||
addon_dir = os.path.join(documents, "Elder Scrolls Online", "live", "Addons")
|
||||
if not os.path.exists(os.path.join(addon_dir, name)):
|
||||
logging.info(f"{name} Addon not found, installing it...")
|
||||
with ZipFile(manifest_file(f"{name}.zip"), 'r') as z:
|
||||
z.extractall(path=addon_dir)
|
||||
logging.info("Please make sure you enable \"Allow outdated addons\" in-game")
|
||||
except Exception:
|
||||
logging.error("couldn't install addon, try doing it manually")
|
||||
r = requests.get(url, stream=True)
|
||||
z = ZipFile(BytesIO(r.content))
|
||||
z.extractall(path=get_addondir())
|
||||
logging.info("Add-On "+name+" installed successfully!\nPlease make sure to enable \"Allow outdated addons\" in ESO")
|
||||
except Exception as ex:
|
||||
logging.error("Could not install Add-On "+name+", try doing it manually")
|
||||
|
||||
|
||||
def remove_addon(name):
|
||||
try:
|
||||
shutil.rmtree(os.path.join(get_addondir(), name))
|
||||
logging.info("Add-On "+name+" removed!")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
def get_documents():
|
||||
|
@ -1 +0,0 @@
|
||||
apiversion = 1
|
@ -6,7 +6,7 @@ from fishy import helper
|
||||
from . import urls
|
||||
from .decorators import fallback, uses_session
|
||||
from ..helper.config import config
|
||||
from .constants import apiversion
|
||||
from ..constants import apiversion
|
||||
|
||||
_session_id = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user