diff --git a/AstralExpress.bat b/AstralExpress.bat index 3bded1627..2cf6d8408 100644 --- a/AstralExpress.bat +++ b/AstralExpress.bat @@ -1,6 +1,5 @@ @echo off -cd %CD%\Resources\Astral - +cd %CD% \Resources\Astral python -c "import pkg_resources" 2> nul if errorlevel 1 ( echo "Python is not installed. Please install Python first." diff --git a/Resources/Astral/AstralExpress.py b/Resources/Astral/AstralExpress.py index af475448b..856c1b394 100644 --- a/Resources/Astral/AstralExpress.py +++ b/Resources/Astral/AstralExpress.py @@ -1,55 +1,123 @@ -import customtkinter -import subprocess +from customtkinter import * import tkinter as tk +import subprocess +import configparser import os +import time from pypresence import Presence +from pypresence.exceptions import DiscordNotFound rpc = Presence(client_id="1200190629897052181") -rpc.connect() -rpc.update( - large_image="plus", - details="Space anime game server tool!", - buttons=[ - {"label": "Github", "url": "https://github.com/AstralPlus/AstralExpress"} - ] -) +try: + rpc.connect() + rpc.update( + large_image="plus", + details="Space anime game server tool", + buttons=[ + {"label": "Github", "url": "https://github.com/AstralPlus/AstralExpress"} + ] + ) +except DiscordNotFound: + print("Discord not detected. RPC will not run.") -customtkinter.set_appearance_mode("dark") -customtkinter.set_default_color_theme("blue") +current_dir = os.path.dirname(os.path.abspath(__file__)) -app = customtkinter.CTk() -app.geometry("325x160") -app.configure(bg="#242424") -app.resizable(False, False) +app = CTk() +app.geometry("355x255") +app.resizable(True, False) -current_dir = os.path.dirname(os.path.abspath(__file__)) app.wm_iconbitmap(os.path.join(current_dir, 'astral.ico')) -app.wm_title("Astral Express v2.1") -title = tk.Label(app, text="Welcome to Astral Express", font=("Arial", 20, "bold"), bg="#242424", fg="white") -title.pack() +set_default_color_theme("blue") +app.wm_title("Astral Express v2.2") -current_dir = os.path.dirname(os.path.realpath(__file__)) +tabview = CTkTabview(master=app) +tabview.pack(padx=0, pady=0) +tabview.add("Game") +tabview.add("Settings") -def button_callback1(): - subprocess.run(f'cmd /c start cmd /k "cd /d {current_dir} && scripts.bat 1"', shell=True) +launch_game = tk.BooleanVar() +game_path = tk.StringVar() +close_game_on_exit = tk.BooleanVar() +script_dir = os.path.dirname(os.path.realpath(__file__)) +scripts_path = os.path.join(script_dir, 'scripts.bat') -def button_callback2(): - subprocess.run(f'cmd /c start cmd /k "cd /d {current_dir} && scripts.bat 2"', shell=True) +def launch_program(): + subprocess.Popen(f'"{scripts_path}" 1', shell=True) + if launch_game.get() and game_path.get(): + time.sleep(5) + game_path_full = game_path.get() + subprocess.Popen(game_path_full, shell=True) -def button_callback3(): - subprocess.run(f'cmd /c start cmd /k "cd /d {current_dir} && scripts.bat 3"', shell=True) +def rebuild_server(): + cmd = f'{scripts_path} 2' + subprocess.Popen(["start", "cmd", "/k", cmd], shell=True) + +def proxyOFF_exit(): + subprocess.Popen(f'"{scripts_path}" 3', shell=True) app.destroy() +button1 = CTkButton(master=tabview.tab("Game"), text="Start server", command=launch_program, fg_color="#C6829B", hover_color="#843E58") +button2 = CTkButton(master=tabview.tab("Game"), text="Rebuild server", command=rebuild_server, fg_color="#668cbd", hover_color="#37506F") +button3 = CTkButton(master=tabview.tab("Game"), text="Stop proxy & exit", command=proxyOFF_exit, fg_color="#A60003", hover_color="dark red") +button1.pack(padx=10, pady=10) +button2.pack(padx=10, pady=10) +button3.pack(padx=10, pady=10) + + +def update_button_text(*args): + if launch_game.get() and game_path.get(): + button1.configure(text="Start server & launch game") + else: + button1.configure(text="Start server") + +launch_game.trace_add("write", update_button_text) +game_path.trace_add("write", update_button_text) + +label1 = CTkLabel(master=tabview.tab("Settings"), text="Launch game with server") +label1.grid(row=0, column=0, sticky='w', padx=10, pady=10) +checkbox = CTkCheckBox(master=tabview.tab("Settings"), text="", variable=launch_game) +checkbox.grid(row=0, column=1, sticky='e', padx=10, pady=10) + +label2 = CTkLabel(master=tabview.tab("Settings"), text="Game Path") +label2.grid(row=1, column=0, sticky='w', padx=10, pady=0) +textbox = CTkEntry(master=tabview.tab("Settings"), textvariable=game_path) +textbox.grid(row=1, column=1, sticky='e', padx=10, pady=0) + +def update_game_path_visibility(*args): + if launch_game.get(): + label2.grid() + textbox.grid() + else: + label2.grid_remove() + textbox.grid_remove() + +launch_game.trace_add("write", update_game_path_visibility) + +def save_settings(): + config = configparser.ConfigParser() + config['DEFAULT'] = {'LaunchGame': launch_game.get(), + 'CloseGameOnExit': close_game_on_exit.get(), + 'GamePath': game_path.get().replace("\\", "\\\\")} + script_dir = os.path.dirname(os.path.realpath(__file__)) + settings_path = os.path.join(script_dir, 'settings.ini') + with open(settings_path, 'w') as configfile: + config.write(configfile) -button1 = customtkinter.CTkButton(app, text="Start server & enable proxy", command=button_callback1, fg_color="#C6829B", hover_color="#843E58") -button1.pack(pady=5) +save_button = CTkButton(master=tabview.tab("Settings"), text="Save Settings", command=save_settings) +save_button.grid(row=3, column=0, columnspan=2, padx=10, pady=10) -button2 = customtkinter.CTkButton(app, text="Build/repair server", command=button_callback2, fg_color="#7DABE6", hover_color="#37506F") -button2.pack(pady=5) +config = configparser.ConfigParser() +script_dir = os.path.dirname(os.path.realpath(__file__)) +settings_path = os.path.join(script_dir, 'settings.ini') +config.read(settings_path) +if 'DEFAULT' in config: + launch_game.set(config['DEFAULT'].getboolean('LaunchGame', False)) + close_game_on_exit.set(config['DEFAULT'].getboolean('CloseGameOnExit', False)) + game_path.set(config['DEFAULT'].get('GamePath', '')) -button3 = customtkinter.CTkButton(app, text="Stop proxy & exit", command=button_callback3, fg_color="#A60003", hover_color="dark red") -button3.pack(pady=5) +update_button_text() +update_game_path_visibility() app.mainloop() \ No newline at end of file diff --git a/Resources/Astral/scripts.bat b/Resources/Astral/scripts.bat index 340ad4dc6..a020f6c49 100644 --- a/Resources/Astral/scripts.bat +++ b/Resources/Astral/scripts.bat @@ -10,7 +10,7 @@ goto end cd ..\LunarCore start cmd /k "java -jar LunarCore.jar" cd ..\Astral\proxy -call StarRail.HttpProxy.exe +start StarRail.HttpProxy.exe exit goto end @@ -31,11 +31,6 @@ taskkill /f /im StarRail.HttpProxy.exe certutil -user -delstore root ae8fe14dc72938ad5b1ed3889dd8e2ec619a50cf reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f -cls -color 3 -echo The proxy has been disabled. -echo You have to close the server terminal manually. -pause exit goto end diff --git a/Resources/Astral/settings.ini b/Resources/Astral/settings.ini new file mode 100644 index 000000000..09dc29c48 --- /dev/null +++ b/Resources/Astral/settings.ini @@ -0,0 +1,4 @@ +[DEFAULT] +launchgame = False +gamepath = + diff --git a/Resources/LunarCore/docs/README_fr-FR.md b/Resources/LunarCore/docs/README_fr-FR.md deleted file mode 100644 index a91a0f680..000000000 --- a/Resources/LunarCore/docs/README_fr-FR.md +++ /dev/null @@ -1,83 +0,0 @@ -![LunarCore](https://socialify.git.ci/Melledy/LunarCore/image?description=1&descriptionEditable=A%20game%20server%20reimplementation%20for%20version%201.5.0%20of%20a%20certain%20turn-based%20anime%20game%20for%20educational%20purposes.%20&font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Light) -
GitHub release (latest by date) GitHub GitHub last commit GitHub Workflow Status
- -
Discord - Grasscutter
- -[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [JP](README_ja-JP.md) | [RU](README_ru-RU.md) | [FR](README_fr-FR.md) | [KR](README_ko-KR.md) - -**Attention:** Pour tout soutien supplémentaire, questions ou discussions, consultez notre [Discord](https://discord.gg/cfPKJ6N5hw). - -### Caractéristiques notables -- Fonctionnalités de base du jeu : Connexion, configuration de l'équipe, inventaire, gestion de base des scènes et des entités -- Les batailles de monstres fonctionnent -- Apparition de monstres/prop/NPC dans le monde naturel -- La plupart des techniques de personnages sont gérées -- Les boutiques de PNJ sont gérées -- Système de Gacha -- Système de courrier -- Système d'amis (les aides ne fonctionnent pas encore) -- Salle oubliée (avec les fonctionnalités de la 1.4.0) -- Univers simulé (les runs peuvent être terminés, mais il manque de nombreuses fonctionnalités) - -# Exécution du serveur et du client - -### Prérequis -* [Java 17 JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) - -### Recommandé -* [MongoDB 4.0+](https://www.mongodb.com/try/download/community) - -### Compilation du serveur -1. Ouvrez votre terminal système, et compilez le serveur avec `./gradlew jar` -2. Créez un dossier nommé `resources` dans le répertoire de votre serveur. -3. Téléchargez les dossiers `Config`, `TextMap`, et `ExcelBin` depuis [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) et placez-les dans votre dossier resources. -4. Téléchargez le dossier `Config` depuis [https://gitlab.com/Melledy/LunarCore-Configs](https://gitlab.com/Melledy/LunarCore-Configs) et placez-le dans votre dossier resources. Remplacez tous les fichiers demandés par votre système. Ceux-ci sont destinés à l'apparition des mondes et sont très importants pour le serveur. -5. Lancez le serveur avec `java -jar LunarCore.jar` depuis votre terminal. Lunar Core est livré avec un serveur MongoDB interne intégré pour sa base de données, donc aucune installation de Mongodb n'est nécessaire. Cependant, il est fortement recommandé d'installer Mongodb de toute façon. -6. Si vous avez mis `autoCreateAccount` à true dans la configuration, alors vous pouvez sauter la création d'un compte. Sinon, utilisez la commande `/account` dans la console du serveur pour en créer un. - -### Connexion avec le client (Fiddler) -1. **Connectez-vous avec le client à un serveur officiel et à un compte Hoyoverse au moins une fois pour télécharger les données du jeu**. -2. Installez et lancez [Fiddler Classic](https://www.telerik.com/fiddler). -3. Configurez fiddler pour décrypter le trafic https. (Tools -> Options -> HTTPS -> Decrypt HTTPS traffic) Assurez-vous que `ignore server certificate errors` est également coché. -4. Copiez et collez le code suivant dans l'onglet Fiddlerscript de Fiddler Classic : - -``` -import System; -import System.Windows.Forms; -import Fiddler; -import System.Text.RegularExpressions; - -class Handlers -{ - static function OnBeforeRequest(oS: Session) { - if (oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".mihoyo.com") || oS.host.EndsWith(".bhsr.com")) { - oS.host = "localhost"; // Elle peut également être remplacée par une autre adresse IP. - } - } -}; -``` - -5. Connectez-vous avec votre nom de compte, le mot de passe peut être défini comme vous le souhaitez. - -### Commandes du serveur -Les commandes du serveur peuvent être exécutées dans la console du serveur ou dans le jeu. Il y a un utilisateur fictif nommé "Server" dans la liste d'amis de chaque joueur auquel vous pouvez envoyer un message pour utiliser les commandes dans le jeu. - -``` -/account {create | delete} [username] (reserved player uid). Crée ou supprime un compte. -/avatar lv(level) p(ascension) r(eidolon) s(skill levels). Définit les propriétés de l'avatar actuel. -/clear {relics | lightcones | materials | items}. Supprime les objets filtrés de l'inventaire du joueur. -/gender {male | female}. Définit le sexe du joueur. -/give [item id] x[amount] lv[number]. Donne un objet au joueur ciblé. -/giveall {materials | avatars | lightcones | relics}. Donne des objets au joueur ciblé. -/heal. Guérit vos avatars. -/help. Affiche une liste des commandes disponibles. -/kick @[player id]. Expulse un joueur du serveur. -/mail [content]. Envoie un message système au joueur ciblé. -/permission {add | remove | clear} [permission]. Donne/retire une permission au joueur ciblé. -/refill. Recharge vos points de compétence en monde ouvert. -/reload. Recharge la configuration du serveur. -/scene [scene id] [floor id]. Téléporte le joueur vers la scène spécifiée. -/spawn [monster/prop id] x[amount] s[stage id]. Fait apparaître un monstre ou un accessoire à proximité du joueur ciblé. -/unstuck @[player id]. Décroche un joueur hors ligne s'il se trouve dans une scène qui ne se charge pas. -/worldlevel [world level]. Fixe le niveau d'équilibre du joueur ciblé. -``` diff --git a/Resources/LunarCore/docs/README_ja-JP.md b/Resources/LunarCore/docs/README_ja-JP.md deleted file mode 100644 index 61628e656..000000000 --- a/Resources/LunarCore/docs/README_ja-JP.md +++ /dev/null @@ -1,83 +0,0 @@ -![LunarCore](https://socialify.git.ci/Melledy/LunarCore/image?description=1&descriptionEditable=A%20game%20server%20reimplementation%20for%20version%201.5.0%20of%20a%20certain%20turn-based%20anime%20game%20for%20educational%20purposes.%20&font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Light) -
GitHub release (latest by date) GitHub GitHub last commit GitHub Workflow Status
- -
Discord - Grasscutter
- -[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [JP](README_ja-JP.md) | [RU](README_ru-RU.md) | [FR](README_fr-FR.md) | [KR](README_ko-KR.md) - -**Attention:** 追加のサポート、質問、または議論がある場合は、 [Discord](https://discord.gg/cfPKJ6N5hw). - -### 注目すべき機能 -- 基本ゲーム機能:ログイン、チームのセットアップ、バッグ、基本的なシーン/エンティティの管理 -- モンスター戦闘 -- オーバーワールドのモンスター/プロップ/NPCのスポーン -- ほぼ全ての秘技 -- NPCショップ -- ガチャシステム -- メールシステム -- フレンドシステム(アシストはまだ機能していません) -- 忘却の庭(1.4.0の機能付き) -- 模擬宇宙(ランは終了できますが、多くの機能が不足しています) - -# サーバーとクライアントの実行 - -### 必要条件 -* [Java 17 JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) - -### お勧め -* [MongoDB 4.0+](https://www.mongodb.com/try/download/community) - -### サーバーのコンパイル -1. システムのターミナルを開き、`./gradlew jar` でサーバーをコンパイルします。 -2. サーバーディレクトリに `resources` という名前のフォルダを作成します。 -3. [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) から `Config`、`TextMap`、および `ExcelBin` フォルダをダウンロードし、それらをリソースフォルダに配置します。 -4. [https://gitlab.com/Melledy/LunarCore-Configs](https://gitlab.com/Melledy/LunarCore-Configs) から `Config` フォルダをダウンロードし、それをリソースフォルダに配置します。システムが問い合わせているファイルはすべて置き換えます。これらはワールドの生成に関するもので、サーバーにとって非常に重要です。 -5. システムのターミナルから `java -jar LunarCore.jar` を使用してサーバーを実行します。Lunar Coreにはデータベースのための組み込みの内部MongoDBサーバーが付属しているため、MongoDBのインストールは必要ありません。ただし、MongoDBのインストールを強くお勧めします。 -6. 設定で `autoCreateAccount` をtrueに設定している場合は、アカウントの作成をスキップできます。そうでない場合は、サーバーコンソールで `/account` コマンドを使用してアカウントを作成します。 - -### クライアントとの接続(Fiddler) -1. **同じクライアントで公式サーバーとHoyoverseアカウントに少なくとも一度ログインしてゲームデータをダウンロードしてください。** -2. [Fiddler Classic](https://www.telerik.com/fiddler) をインストールし、実行します。 -3. Fiddlerをhttpsトラフィックを復号化するように設定します(ツール -> オプション -> HTTPS -> HTTPSトラフィックを復号化)。 `サーバー証明書のエラーを無視する` がチェックされていることを確認してください。 -4. Fiddler ClassicのFiddlerscriptタブに以下のコードをコピーして貼り付けます: - -```javascript -import System; -import System.Windows.Forms; -import Fiddler; -import System.Text.RegularExpressions; - -class Handlers -{ - static function OnBeforeRequest(oS: Session) { - if (oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".mihoyo.com") || oS.host.EndsWith(".bhsr.com")) { - oS.host = "localhost"; // これは別のIPアドレスに置き換えることもできます。 - } - } -}; -``` - -5. 作成したアカウント名と任意のパスワードでログインします。 - -### サーバーコマンド -サーバーコマンドはサーバーコンソールまたはゲーム内で実行できます。各プレイヤーのフレンドリストには、ゲーム内でコマンドを使用するための "Server" という名前のユーザーがいます。 - -``` -/account {create | delete} [username] (予約プレイヤーuid). アカウントを作成または削除します。 -/avatar lv(level) p(ascension) r(eidolon) s(skill levels). 現在のアバターのプロパティを設定します。 -/clear {relics | lightcones | materials | items}. プレイヤーのインベントリからフィルタリングされたアイテムを削除します。 -/gender {male | female}. プレイヤーの性別を設定します。 -/give [item id] x[amount] lv[number]. ターゲットのプレイヤーにアイテムを与えます。 -/giveall {materials | avatars}. ターゲットのプレイヤーにアイテムを与えます。 -/heal. あなたのキャラクターを癒します。 -/help. 利用可能なコマンドの一覧を表示します。 -/kick @[player id]. サーバーからプレーヤーをキックする。 -/mail [content]. ターゲットのプレイヤーにシステムメールを送信します。 -/permission {add | remove | clear} [permission]. ターゲットのプレイヤーから権限を付与/削除します。 -/refill. SPを回復します。 -/reload. サーバーコンフィギュレーションを再読み込みします。 -/scene [scene id] [floor id]. プレイヤーを指定したシーンにテレポートします。 -/spawn [monster/prop id] x[amount] s[stage id]. ターゲットのプレイヤーの近くにモンスターまたはプロップを生成します。 -/unstuck @[player id]. オフラインプレイヤーが読み込み不可のシーンにいる場合、スタックを解除します。 -/worldlevel [world level]. ターゲットのプレイヤーの平衡レベルを設定します。 -``` diff --git a/Resources/LunarCore/docs/README_ko-KR.md b/Resources/LunarCore/docs/README_ko-KR.md deleted file mode 100644 index 137f9dec9..000000000 --- a/Resources/LunarCore/docs/README_ko-KR.md +++ /dev/null @@ -1,83 +0,0 @@ -![LunarCore](https://socialify.git.ci/Melledy/LunarCore/image?description=1&descriptionEditable=A%20game%20server%20reimplementation%20for%20version%201.5.0%20of%20a%20certain%20turn-based%20anime%20game%20for%20educational%20purposes.%20&font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Light) -
GitHub release (latest by date) GitHub GitHub last commit GitHub Workflow Status
- -
Discord - Grasscutter
- -[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [JP](README_ja-JP.md) | [RU](README_ru-RU.md) | [FR](README_fr-FR.md) | [KR](README_ko-KR.md) - -**주의: **추가 지원, 질문 또는 토론이 필요한 경우, [Discord](https://discord.gg/cfPKJ6N5hw) 를 확인하세요. - -### 주목할 만한 기능 -- 기본적인 게임 기능: 로그인, 팀 설정, 인벤토리, 기본 장면/엔티티 관리 -- 몬스터 전투 작동 -- 자연계 몬스터/소품/NPC 생성 -- 대부분의 캐릭터 기술 처리 -- NPC 상점 처리 -- 뽑기 시스템 -- 메일 시스템 -- 친구 시스템(어시스트는 아직 작동하지 않음) -- 잊혀진 홀 (1.4.0 기능 포함) -- 시뮬레이션된 우주(실행은 가능하지만 많은 기능이 누락됨) - -# 서버 및 클라이언트 실행 - -### 전제 조건 -* [Java 17 JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) - -### 추천 -* [MongoDB 4.0+](https://www.mongodb.com/try/download/community) - -서버 컴파일하기 ### -1. 시스템 터미널을 열고 다음을 사용하여 서버를 컴파일합니다. `./gradlew jar` -2. 서버 디렉터리에 `resources`라는 이름의 폴더를 만듭니다. -3. [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) 에서 `Config`, `TextMap`, `ExcelBin` 폴더를 다운로드하여 리소스 폴더에 넣습니다. -4. [https://gitlab.com/Melledy/LunarCore-Configs](https://gitlab.com/Melledy/LunarCore-Configs) 에서 `Config` 폴더를 다운로드하여 리소스 폴더에 넣습니다. 시스템에서 요청하는 파일을 모두 교체하세요. 이 파일들은 월드 스폰을 위한 것으로 서버에 매우 중요합니다. -5. 시스템 터미널에서 `java -jar LunarCore.jar`로 서버를 실행합니다. Lunar Core에는 데이터베이스를 위한 내부 MongoDB 서버가 내장되어 있으므로 Mongodb를 설치할 필요가 없습니다. 하지만 어쨌든 Mongodb를 설치하는 것을 적극 권장합니다. -6. 설정에서 `autoCreateAccount`가 true로 설정되어 있으면 계정 생성을 건너뛸 수 있습니다. 그렇지 않은 경우 서버 콘솔에서 `/account` 명령을 사용하여 계정을 생성합니다. - -### 클라이언트와 연결하기(피들러) -1. **게임 데이터를 다운로드하려면 클라이언트로 공식 서버와 호오버스 계정에 한 번 이상 로그인합니다. -2. [Fiddler Classic](https://www.telerik.com/fiddler) 을 설치하여 실행합니다. -3. 피들러가 https 트래픽을 복호화하도록 설정합니다. (도구 -> 옵션 -> HTTPS -> HTTPS 트래픽 복호화) '서버 인증서 오류 무시'도 체크되어 있는지 확인합니다. -4. 피들러 클래식의 피들러스크립트 탭에 다음 코드를 복사하여 붙여넣습니다: - -``` -import System; -import System.Windows.Forms; -import Fiddler; -import System.Text.RegularExpressions; - -class Handlers -{ - static function OnBeforeRequest(oS: Session) { - if (oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".mihoyo.com") || oS.host.EndsWith(".bhsr.com")) { - oS.host = "localhost"; // 이 주소는 다른 IP 주소로 대체할 수도 있습니다. - } - } -}; -``` - -5. 계정 이름으로 로그인하며, 비밀번호는 아무거나 설정할 수 있습니다. - -### 서버 명령 -서버 명령은 서버 콘솔이나 게임 내에서 실행할 수 있습니다. 모든 플레이어의 친구 목록에 "서버"라는 이름의 더미 사용자가 있으며, 이 사용자에게 게임 내 명령을 사용하도록 메시지를 보낼 수 있습니다. - -``` -/account {create | delete} [username] (reserved player uid). 계정을 만들거나 삭제합니다. -/avatar lv(level) p(ascension) r(eidolon) s(skill levels). 현재 아바타의 속성을 설정합니다. -/clear {relics | lightcones | materials | items}. 플레이어 인벤토리에서 필터링된 아이템을 제거합니다. -/gender {male | female}. 플레이어 성별을 설정합니다. -/give [item id] x[amount] lv[number]. 대상 플레이어에게 아이템을 부여합니다. -/giveall {materials | avatars | lightcones | relics}. 대상 플레이어에게 아이템을 부여합니다. -/heal. 아바타를 치료합니다. -/help. 사용 가능한 명령 목록을 표시합니다. -/kick @[player id]. 플레이어를 서버에서 내쫓습니다. -/mail [content]. 대상 플레이어에게 시스템 메일을 보냅니다. -/permission {add | remove | clear} [permission]. 대상 플레이어에게 권한을 부여/제거합니다. -/refill. 오픈 월드에서 스킬 포인트를 다시 채웁니다. -/reload. 서버 구성을 다시 로드합니다. -/scene [scene id] [floor id]. 플레이어를 지정된 장면으로 순간이동시킵니다. -/spawn [monster/prop id] x[amount] s[stage id]. 대상 플레이어 근처에 몬스터나 소품을 스폰합니다. -/unstuck @[player id]. 오프라인 플레이어가 로딩되지 않는 장면에 있을 경우 플레이어를 고정 해제합니다. -/worldlevel [world level]. 대상 플레이어의 평형 레벨을 설정합니다. -``` diff --git a/Resources/LunarCore/docs/README_ru-RU.md b/Resources/LunarCore/docs/README_ru-RU.md deleted file mode 100644 index a2a9a1f6d..000000000 --- a/Resources/LunarCore/docs/README_ru-RU.md +++ /dev/null @@ -1,83 +0,0 @@ -![LunarCore](https://socialify.git.ci/Melledy/LunarCore/image?description=1&descriptionEditable=A%20game%20server%20reimplementation%20for%20version%201.5.0%20of%20a%20certain%20turn-based%20anime%20game%20for%20educational%20purposes.%20&font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Light) -
GitHub release (latest by date) GitHub GitHub last commit GitHub Workflow Status
- -
Discord - Grasscutter
- -[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [JP](README_ja-JP.md) | [RU](README_ru-RU.md) | [FR](README_fr-FR.md) | [KR](README_ko-KR.md) - -**Внимание:** Для получения дополнительной поддержки, вопросов или обсуждений заходите на наш [Discord](https://discord.gg/cfPKJ6N5hw). - -### Примечательные особенности -- Основные возможности игры: Вход в игру, настройка команды, инвентарь, базовое управление сценой/содержимым -- Работают сражения с монстрами -- Спавны монстров/природы/NPC в естественном мире -- Работает большинство техник персонажей -- Работают магазины Npc -- Система гача -- Почтовая система -- Система друзей (помощники пока не работают) -- Забытый зал (с функциями 1.4.0) -- Симулированная вселенная (Запуск может быть закончен, но многие функции отсутствуют) - -# Запуск сервера и клиента - -### Необходимые условия -* [Java 17 JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) - -### Рекомендуем -* [MongoDB 4.0+](https://www.mongodb.com/try/download/community) - -Компиляция сервера -1. Откройте системный терминал и скомпилируйте сервер с помощью `./gradlew jar`. -2. Создайте папку с именем `resources` в каталоге сервера. -3. Скачайте папки `Config`, `TextMap` и `ExcelBin` с сайта [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) и поместите их в папку resources. -4. Скачайте папку `Config` с сайта [https://gitlab.com/Melledy/LunarCore-Configs](https://gitlab.com/Melledy/LunarCore-Configs) и поместите ее в папку resources. Замените все файлы, которые запрашивает ваша система. Они предназначены для спавна мира и очень важны для сервера. -5. Запустите сервер с помощью команды `java -jar LunarCore.jar` из системного терминала. Lunar Core поставляется со встроенным внутренним сервером MongoDB для своей базы данных, поэтому установка Mongodb не требуется. Однако настоятельно рекомендуется установить Mongodb в любом случае. -6. Если в конфиге `autoCreateAccount` установлено значение true, то создание учетной записи можно пропустить. В противном случае используйте команду `/account` в консоли сервера для ее создания. - -### Подключение к клиенту (Fiddler) -1. **Войдите с клиентом на официальный сервер и в аккаунт Hoyoverse хотя бы один раз, чтобы загрузить игровые данные**. -2. Установите и запустите [Fiddler Classic](https://www.telerik.com/fiddler). -3. Настройте fiddler на расшифровку https-трафика. (Tools -> Options -> HTTPS -> Decrypt HTTPS traffic) Убедитесь, что `ignore server certificate errors` также отмечен. -4. Скопируйте и вставьте следующий код во вкладку Fiddlerscript в Fiddler Classic: - -``` -import System; -import System.Windows.Forms; -import Fiddler; -import System.Text.RegularExpressions; - -class Handlers -{ - static function OnBeforeRequest(oS: Session) { - if (oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".mihoyo.com") || oS.host.EndsWith(".bhsr.com")) { - oS.host = "localhost"; // Его также можно заменить другим IP-адресом. - } - } -}; -``` - -5. Войдите в систему под своим именем, пароль может быть любым. - -### Команды сервера -Команды сервера можно выполнять в консоли сервера или в игре. В списке друзей каждого игрока есть фиктивный пользователь с именем "Сервер", которому можно написать сообщение, чтобы использовать внутриигровые команды. - -``` -/account {create | delete} [username] (reserved player uid). Создает или удаляет учетную запись. -/avatar lv(level) p(ascension) r(eidolon) s(skill levels). Устанавливает свойства текущего аватара. -/clear {relics | lightcones | materials | items}. Удаляет отфильтрованные предметы из инвентаря игрока. -/gender {male | female}. Устанавливает пол игрока. -/give [item id] x[amount] lv[number]. Дает целевому игроку предмет. -/giveall {materials | avatars | lightcones | relics}. Дает целевому игроку предметы. -/heal. Лечит ваши аватары. -/help. Отображает список доступных команд. -/kick @[player id]. Выгоняет игрока с сервера. -/mail [content]. Отправляет целевому игроку системное письмо. -/permission {add | remove | clear} [permission]. Дает/снимает разрешение с выбранного игрока. -/refill. Пополнение очков навыков в открытом мире. -/reload. Перезагружает конфигурацию сервера. -/scene [scene id] [floor id]. Телепортирует игрока в указанную сцену. -/spawn [monster/prop id] x[amount] s[stage id]. Порождает монстра или реквизит рядом с игроком. -/unstuck @[player id]. Отключает оффлайн-игрока, если он находится в сцене, которая не загружается. -/worldlevel [world level]. Устанавливает равновесный уровень целевого игрока. -``` diff --git a/Resources/LunarCore/docs/README_zh-CN.md b/Resources/LunarCore/docs/README_zh-CN.md deleted file mode 100644 index d9f6c3a86..000000000 --- a/Resources/LunarCore/docs/README_zh-CN.md +++ /dev/null @@ -1,83 +0,0 @@ -![LunarCore](https://socialify.git.ci/Melledy/LunarCore/image?description=1&descriptionEditable=A%20game%20server%20reimplementation%20for%20version%201.5.0%20of%20a%20certain%20turn-based%20anime%20game%20for%20educational%20purposes.%20&font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Light) -
GitHub release (latest by date) GitHub GitHub last commit GitHub Workflow Status
- -
Discord - Grasscutter
- -[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [JP](README_ja-JP.md) | [RU](README_ru-RU.md) | [FR](README_fr-FR.md) | [KR](README_ko-KR.md) - -**注意:** 如果需要任何额外的支持、问题或者讨论,请查看我们的 [Discord](https://discord.gg/cfPKJ6N5hw). - -### 显著特点 -- 基本游戏功能:登录、队伍配置、背包、基本场景/实体管理 -- 战斗功能 -- 自然世界怪物/道具/NPC生成 -- 大多数角色技能已处理 -- NPC商店已处理 -- 祈愿系统 -- 邮件系统 -- 好友系统(好友支援尚未实现) -- 忘却之庭(带有1.4.0功能) -- 模拟宇宙(可以运行,但缺少许多功能) - -# 运行服务端和客户端 - -### 必需条件 -* [Java 17 JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) - -### 推荐安装 -* [MongoDB 4.0+](https://www.mongodb.com/try/download/community) - -### 编译服务端核心 -1. 打开系统终端,使用 `./gradlew jar` 编译服务端核心 -2. 在服务器目录中创建一个名为 `resources` 的文件夹 -3. 从 [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) 下载 `Config`、`TextMap` 和 `ExcelBin` 文件夹,并将它们放入资源文件夹 -4. 从 [https://gitlab.com/Melledy/LunarCore-Configs](https://gitlab.com/Melledy/LunarCore-Configs) 下载 `Config` 文件夹,并将其放入资源文件夹。替换系统询问的任何文件。这些文件用于世界生成,对服务器非常重要。 -5. 从系统终端使用 `java -jar LunarCore.jar` 运行服务端。Lunar Core带有一个内置的MongoDB数据库服务,因此不需要安装MongoDB。但是,强烈建议安装MongoDB。 -6. 如果在配置中将 `autoCreateAccount` 设置为true,则可以跳过创建帐户的步骤。否则,需要在服务器控制台使用 `/account` 命令创建一个帐户。 - -### 与客户端(Fiddler)连接 -1. **使用客户端至少一次登录到官方服务器和Hoyoverse账户以下载游戏数据。** -2. 安装并运行 [Fiddler Classic](https://www.telerik.com/fiddler)。 -3. 将Fiddler设置为解密https流量(工具 -> 选项 -> HTTPS -> 解密HTTPS流量),确保选中 `忽略服务器证书错误`。 -4. 将以下代码复制并粘贴到Fiddler Classic的Fiddlerscript选项卡中: - -```javascript -import System; -import System.Windows.Forms; -import Fiddler; -import System.Text.RegularExpressions; - -class Handlers -{ - static function OnBeforeRequest(oS: Session) { - if (oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".mihoyo.com") || oS.host.EndsWith(".bhsr.com")) { - oS.host = "localhost"; // 这也可以替换为其他IP地址。 - } - } -}; -``` - -5. 使用您的帐户名称登录,密码可以设置为任何值。 - -### 服务器命令 -服务器命令可以在服务器控制台或游戏中运行。每个玩家的好友列表中都有一个名为 "Server" 的虚拟用户,您可以向其发送消息以使用游戏中的命令。 - -``` -/account {create | delete} [username] (保留玩家uid). 创建或删除一个帐户。 -/avatar lv(level) p(ascension) r(eidolon) s(skill levels). 设置当前角色的属性。 -/clear {relics | lightcones | materials | items}. 从玩家库存中删除过滤的物品。 -/gender {male | female}. 设置玩家性别。 -/give [item id] x[amount] lv[number]. 给予目标玩家一个物品。 -/giveall {materials | avatars}. 给予目标玩家物品。 -/heal. 治疗你的角色。 -/help 显示可用命令列表。 -/kick @[player id]. 将一名玩家踢出服务器。 -/mail [content]. 发送系统邮件给目标玩家。 -/permission {add | remove | clear} [permission]. 向目标玩家授予/移除权限。 -/refill. 在开放世界中补充战技点。 -/reload. 重载服务器配置。 -/scene [scene id] [floor id]. 将玩家传送到指定的场景。 -/spawn [monster/prop id] x[amount] s[stage id]. 在目标玩家附近生成怪物或道具。 -/unstuck @[player id]. 如果离线玩家卡在不加载的场景中,解除卡住。 -/worldlevel [world level]. 设置目标玩家的均衡等级。 -``` diff --git a/Resources/LunarCore/docs/README_zh-TW.md b/Resources/LunarCore/docs/README_zh-TW.md deleted file mode 100644 index 88b2bd600..000000000 --- a/Resources/LunarCore/docs/README_zh-TW.md +++ /dev/null @@ -1,83 +0,0 @@ -![LunarCore](https://socialify.git.ci/Melledy/LunarCore/image?description=1&descriptionEditable=A%20game%20server%20reimplementation%20for%20version%201.5.0%20of%20a%20certain%20turn-based%20anime%20game%20for%20educational%20purposes.%20&font=Inter&forks=1&issues=1&language=1&name=1&owner=1&pulls=1&stargazers=1&theme=Light) -
GitHub release (latest by date) GitHub GitHub last commit GitHub Workflow Status
- -
Discord - Grasscutter
- -[EN](../README.md) | [简中](README_zh-CN.md) | [繁中](README_zh-TW.md) | [JP](README_ja-JP.md) | [RU](README_ru-RU.md) | [FR](README_fr-FR.md) | [KR](README_ko-KR.md) - -**請注意:** 如果需要任何額外的支持、問題或者討論,請查看我們的 [Discord](https://discord.gg/cfPKJ6N5hw). - -### 當前功能 -- 基本遊戲功能:登錄、隊伍配置、背包、基本場景/實體管理 -- 戰鬥功能 -- 自然世界怪物/道具/NPC生成 -- 大多數角色技能 -- NPC商店 -- 躍遷/抽卡系統 -- 郵件系統 -- 好友系統(支援角色尚未實現) -- 忘卻之庭(帶有1.4.0功能) -- 模擬宇宙(可以運行,但缺少許多功能) - -# 運行伺服器端和用戶端 - -### 必需條件 -* [Java 17 JDK](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) - -### 推薦安裝 -* [MongoDB 4.0+](https://www.mongodb.com/try/download/community) - -### 編譯伺服器端核心 -1. 打開系統終端,使用 `./gradlew jar` 編譯伺服器端核心 -2. 在伺服器目錄中創建一個名為 `resources` 的文件夾 -3. 從 [https://github.com/Dimbreath/StarRailData](https://github.com/Dimbreath/StarRailData) 下載 `Config`、`TextMap` 和 `ExcelBin` 文件夾,並將它們放入資源文件夾 -4. 從 [https://gitlab.com/Melledy/LunarCore-Configs](https://gitlab.com/Melledy/LunarCore-Configs) 下載 `Config` 文件夾,並將其放入資源文件夾。替換系統詢問的任何文件。這些文件用於世界生成,對伺服器非常重要。 -5. 從系統終端使用 `java -jar LunarCore.jar` 運行伺服器端。Lunar Core帶有一個內建的MongoDB資料庫服務,因此不需要安裝MongoDB。但是還是強烈建議安裝MongoDB。 -6. 如果在配置中將 `autoCreateAccount` 設置為true,則可以跳過創建帳戶的步驟。否則,需要在伺服器控制台使用 `/account` 命令創建一個帳戶。 - -### 與用戶端連接(Fiddler) -1. **使用用戶端至少一次登錄到官方伺服器和Hoyoverse帳戶以下載遊戲數據。** -2. 安裝並運行 [Fiddler Classic](https://www.telerik.com/fiddler)。 -3. 將Fiddler設置為解密https流量(工具 -> 選項 -> HTTPS -> 解密HTTPS流量),確保選中 `忽略伺服器證書錯誤 (Ignore server certificate errors)`。 -4. 將以下代碼複製並黏貼到Fiddler Classic的Fiddlerscript選項卡中: - -``` -import System; -import System.Windows.Forms; -import Fiddler; -import System.Text.RegularExpressions; - -class Handlers -{ - static function OnBeforeRequest(oS: Session) { - if (oS.host.EndsWith(".starrails.com") || oS.host.EndsWith(".hoyoverse.com") || oS.host.EndsWith(".mihoyo.com") || oS.host.EndsWith(".bhsr.com")) { - oS.host = "localhost"; // 這也可以替換為其他IP位址。 - } - } -}; -``` - -5. 使用您的帳戶名稱登入,密碼可以隨機輸入。 - -### 伺服器命令 -伺服器命令可以在伺服器控制台或遊戲中運行。每個玩家的好友列表中都有一個名為 "Server" 的虛擬用戶,您可以向其發送消息以使用遊戲中的命令。 - -``` -/account {create | delete} [username] (玩家UID). 創建或刪除一個帳戶。 -/avatar lv(level) p(ascension) r(eidolon) s(skill levels) 設置當前角色的屬性。 -/clear {relics | lightcones | materials | items} 從玩家庫存中刪除過濾的物品。 -/gender {male | female} 設置目標玩家性別。 -/give [item id] x[amount] lv[number] 給予目標玩家指定物品。 -/giveall {materials | avatars} 給予目標玩家所有物品/角色。 -/heal. 治癒你的角色。 -/help 顯示可用命令列表。 -/kick @[player id]. 將一名玩家踢出伺服器。 -/mail [content] 發送系統郵件給目標玩家。 -/permission {add | remove | clear} [permission] 向目標玩家授予/移除權限。 -/refill. 在開放世界中補充戰技點。 -/reload 重載伺服器配置。 -/scene [scene id] [floor id] 將玩家傳送到指定的場景。 -/spawn [monster/prop id] x[amount] s[stage id] 在目標玩家附近生成怪物或實體。 -/unstuck @[player id]. 如果離線目標玩家卡在無法載入的場景中,將會把目標玩家傳送到初始場景。 -/worldlevel [world level]. 設置目標玩家的均衡等級。 -``` diff --git a/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/Plugin.java b/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/Plugin.java index fa0d296d0..d8c307e95 100644 --- a/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/Plugin.java +++ b/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/Plugin.java @@ -65,7 +65,6 @@ public record Config( * * @return True if the config is valid, false otherwise. */ - @SuppressWarnings("BooleanMethodIsAlwaysInverted") public boolean validate() { return name != null && description != null && mainClass != null && api != null; } diff --git a/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/PluginManager.java b/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/PluginManager.java index 90bc02b04..13c1c3ce3 100644 --- a/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/PluginManager.java +++ b/Resources/LunarCore/src/main/java/emu/lunarcore/plugin/PluginManager.java @@ -38,6 +38,7 @@ public final class PluginManager { * Loads all plugins from the plugins directory. * This can only be called once. */ + @SuppressWarnings("resource") public void loadPlugins() throws IOException { if (this.pluginsLoaded) throw new IllegalStateException("Plugins have already been loaded."); @@ -143,6 +144,7 @@ public void loadPlugins() throws IOException { )); } else try { pluginInstance.onLoad(); + this.plugins.put(pluginInstance.getName(), pluginInstance); } catch (Throwable exception) { this.getLogger().warn("Failed to load plugin {}.", pluginFile.getName()); } @@ -179,6 +181,7 @@ public void loadPlugins() throws IOException { // Load the plugin. pluginData.instance().onLoad(); + this.plugins.put(pluginData.instance().getName(), pluginData.instance()); } catch (Throwable exception) { this.getLogger().warn("Failed to load plugin {}.", exception.getMessage()); depth++;