mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
add Chalutier Add-On
This commit is contained in:
parent
f7d7583883
commit
6056449c4d
@ -12,6 +12,7 @@ from fishy.engine.common.event_handler import EngineEventHandler
|
|||||||
from fishy.gui import GUI, splash, update_dialog
|
from fishy.gui import GUI, splash, update_dialog
|
||||||
from fishy.helper import hotkey
|
from fishy.helper import hotkey
|
||||||
from fishy.helper.config import config
|
from fishy.helper.config import config
|
||||||
|
from fishy.constants import chalutier, lam2
|
||||||
|
|
||||||
|
|
||||||
def check_window_name(title):
|
def check_window_name(title):
|
||||||
@ -58,7 +59,10 @@ def initialize(window_to_hide):
|
|||||||
helper.install_thread_excepthook()
|
helper.install_thread_excepthook()
|
||||||
sys.excepthook = helper.unhandled_exception_logging
|
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():
|
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")
|
@ -14,6 +14,7 @@ from fishy.helper import hotkey
|
|||||||
from .discord_login import discord_login
|
from .discord_login import discord_login
|
||||||
from ..helper.config import config
|
from ..helper.config import config
|
||||||
from ..helper.hotkey import Key
|
from ..helper.hotkey import Key
|
||||||
|
from ..constants import chalutier, lam2
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from . import GUI
|
from . import GUI
|
||||||
@ -58,6 +59,16 @@ def _create(gui: 'GUI'):
|
|||||||
if config.get("dont_ask_update", False):
|
if config.get("dont_ask_update", False):
|
||||||
filemenu.add_command(label="Update", command=helper.update)
|
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)
|
menubar.add_cascade(label="Options", menu=filemenu)
|
||||||
|
|
||||||
debug_menu = Menu(menubar, tearoff=0)
|
debug_menu = Menu(menubar, tearoff=0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from .auto_update import auto_upgrade, upgrade_avail, versions
|
from .auto_update import auto_upgrade, upgrade_avail, versions
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .helper import open_web, initialize_uid, install_thread_excepthook, unhandled_exception_logging, manifest_file, \
|
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 logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
import requests
|
||||||
|
from io import BytesIO
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
@ -142,23 +145,34 @@ def create_shortcut(anti_ghosting: bool):
|
|||||||
logging.error("Couldn't create shortcut")
|
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
|
# noinspection PyBroadException
|
||||||
def check_addon(name):
|
def install_addon(name, url):
|
||||||
"""
|
|
||||||
Extracts the addon from zip and installs it into the AddOn folder of eso
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
# noinspection PyUnresolvedReferences
|
r = requests.get(url, stream=True)
|
||||||
from win32com.shell import shell, shellcon
|
z = ZipFile(BytesIO(r.content))
|
||||||
documents = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
|
z.extractall(path=get_addondir())
|
||||||
addon_dir = os.path.join(documents, "Elder Scrolls Online", "live", "Addons")
|
logging.info("Add-On "+name+" installed successfully!\nPlease make sure to enable \"Allow outdated addons\" in ESO")
|
||||||
if not os.path.exists(os.path.join(addon_dir, name)):
|
except Exception as ex:
|
||||||
logging.info(f"{name} Addon not found, installing it...")
|
logging.error("Could not install Add-On "+name+", try doing it manually")
|
||||||
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")
|
def remove_addon(name):
|
||||||
except Exception:
|
try:
|
||||||
logging.error("couldn't install addon, try doing it manually")
|
shutil.rmtree(os.path.join(get_addondir(), name))
|
||||||
|
logging.info("Add-On "+name+" removed!")
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def get_documents():
|
def get_documents():
|
||||||
|
@ -1 +0,0 @@
|
|||||||
apiversion = 1
|
|
@ -6,7 +6,7 @@ from fishy import helper
|
|||||||
from . import urls
|
from . import urls
|
||||||
from .decorators import fallback, uses_session
|
from .decorators import fallback, uses_session
|
||||||
from ..helper.config import config
|
from ..helper.config import config
|
||||||
from .constants import apiversion
|
from ..constants import apiversion
|
||||||
|
|
||||||
_session_id = None
|
_session_id = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user