diff --git a/InstallTShock.ps1 b/InstallTShock.ps1
deleted file mode 100644
index 14cc0022..00000000
--- a/InstallTShock.ps1
+++ /dev/null
@@ -1,109 +0,0 @@
-Add-Type -AssemblyName System.Windows.Forms
-
-function Get-DownloadUrl {
- [CmdletBinding()]
- param(
- [Parameter(Mandatory=$false, Position=0)]
- [string]$url = "https://api.github.com/repos/Pryaxis/TShock/releases/latest"
- )
-
- process {
- try {
- $response = Invoke-WebRequest -Uri $url -UseBasicParsing
-
- # 检查HTTP状态码
- if ($response.StatusCode -ne 200) {
- throw "Failed to retrieve the resource at '$url'. Status code: $($response.StatusCode)"
- }
-
- $json = $response.Content | ConvertFrom-Json
-
- if (-not ($json -and $json.assets[3].browser_download_url)) {
- throw "The JSON content at '$url' does not contain a valid 'browser_download_url' property."
- }
-
- return $json.assets[3].browser_download_url
- }
- catch [System.Net.WebException], [System.Management.Automation.PSInvocationException] {
- # 处理可能的网络异常和JSON解析异常
- throw "Error when attempting to get version from '$url': $_"
- }
- }
-}
-
-function Get-Dotnet{
- $dotnetVersions = dotnet --list-runtimes
- $hasNet6OrHigher = $false
- foreach ($version in $dotnetVersions) {
- if ($version -match "^Microsoft\.NETCore\.App\s+(\d+\.\d+)\.") {
- $majorVersion = [int]$Matches[1]
- if ($majorVersion -ge 6) {
- $hasNet6OrHigher = $true
- break
- }
- }
- }
- if(-not $hasNet6OrHigher){
- Write-Host ".net6 is not installed, start installing .net"
- $scriptUrl = "https://dot.net/v1/dotnet-install.ps1"
- # 下载并执行安装脚本
- Invoke-WebRequest -Uri $scriptUrl -OutFile "dotnet-install.ps1"
- powershell -ExecutionPolicy ByPass -File ./dotnet-install.ps1 -Runtime "dotnet" -NoPath
- }
-}
-
-
-function Get-TShockZip{
- param(
- [Parameter(Mandatory=$true)]
- [string]$proxy
- )
-
- process {
- try {
- $download_url = Get-DownloadUrl
- $url = $proxy + $download_url
- if($null -eq $download_url){
- throw "Not Get TShock Version Info!"
- }
- Write-Host "Download $url...."
- #禁用进度条,进度条可能会导致下载变慢!
- #$ProgressPreference = 'SilentlyContinue'
- $zipFile = "./TShock.zip"
-
- $response = Invoke-WebRequest -Uri $url -UseBasicParsing
- # 检查HTTP状态码
- if ($response.StatusCode -ne 200) {
- throw "Failed to retrieve the resource at '$url'. Status code: $($response.StatusCode)"
- }
- [IO.File]::WriteAllBytes($zipFile, $response.Content)
- Write-Host "Ready to start unzipping TShock.zip...."
- Expand-Archive -Path "./TShock.zip" -DestinationPath "./TShockServer/"
- Remove-Item -Path $zipFile -Force
- $result = [System.Windows.Forms.MessageBox]::Show("Start TShock.Server ?", "Hint", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Question)
- if ($result -eq [System.Windows.Forms.DialogResult]::Yes) {
- Set-Location ./TShockServer
- Start-Process -FilePath ./TShock.Server.exe -ArgumentList "-lang 7"
- }
- }catch [System.Net.WebException], [System.Management.Automation.PSInvocationException] {
- # 处理可能的网络异常
- throw "Error when attempting to get zip from '$url': $_"
- }
- }
-}
-
-Get-Dotnet
-$proxys = "https://gh.ddlc.top/","https://gh.llkk.cc/","https://mirror.ghproxy.com/","https://github.moeyy.xyz/","https://ghproxy.net/"
-Write-Host "Places Choice Proxy Download TShock!"
-$i = 1
-foreach($url in $proxys){
- Write-Host $i"." $url
- $i = $i + 1
-}
-$choice = Read-Host
-$index = [int]$choice
-if ($proxys -ge 0 -and ($index -1) -lt $proxys.Length){
- Get-TShockZip -proxy $proxys[$index - 1]
-}else{
- Write-Host "Input Number Error!"
-}
\ No newline at end of file
diff --git a/README.md b/README.md
index 8b62d95e..c413bb23 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
[![TShockPlugin](https://socialify.git.ci/UnrealMultiple/TShockPlugin/image?description=1&descriptionEditable=%E4%B8%80%E4%B8%AATShock%E6%94%B6%E9%9B%86%E4%BB%93%E5%BA%93&font=Inter&forks=1&issues=1&language=1&logo=https%3A%2F%2Fgithub.com%2FUnrealMultiple%2FTShockPlugin%2Fblob%2Fmaster%2Ficon.png%3Fraw%3Dtrue&name=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Auto)](https://github.com/UnrealMultiple/TShockPlugin)
-[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/UnrealMultiple/TShockPlugin/.github%2Fworkflows%2Fplugins_publish.yml)](https://github.com/UnrealMultiple/TShockPlugin/actions)
+[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/UnrealMultiple/TShockPlugin/.github%2Fworkflows%2Fbuild.yml)](https://github.com/UnrealMultiple/TShockPlugin/actions)
[![GitHub contributors](https://img.shields.io/github/contributors/UnrealMultiple/TShockPlugin?style=flat)](https://github.com/UnrealMultiple/TShockPlugin/graphs/contributors)
[![NET6](https://img.shields.io/badge/Core-%20.NET_6-blue)](https://dotnet.microsoft.com/zh-cn/)
[![QQ](https://img.shields.io/badge/QQ-EB1923?logo=tencent-qq&logoColor=white)](https://qm.qq.com/cgi-bin/qm/qr?k=54tOesIU5g13yVBNFIuMBQ6AzjgE6f0m&jump_from=webapi&authKey=6jzafzJEqQGzq7b2mAHBw+Ws5uOdl83iIu7CvFmrfm/Xxbo2kNHKSNXJvDGYxhSW)
@@ -30,13 +30,10 @@
- Gitee发布(国内推荐): [Plugins.zip](https://gitee.com/kksjsj/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip)
- Github发布: [Plugins.zip](https://github.com/UnrealMultiple/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip)
-
-## 如何安装TShock
-- 如果你是Window用户可以选择使用以下命令一次性安装(在pwsh中运行此命令即可)
-```
-curl -o install.ps1 https://gitee.com/kksjsj/TShockPlugin/raw/master/InstallTShock.ps1
-powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
-```
+#### AutoPluginManager插件 (本仓库推出的插件管理器)
+ /apm l 列出所有插件
+ /apm i <插件名> 一键安装插件
+ /apm u [插件名] 检查并且更新插件
## 开发者注意事项
diff --git a/README_en.md b/README_en.md
index 593783d9..d74d568a 100644
--- a/README_en.md
+++ b/README_en.md
@@ -29,14 +29,10 @@
- Github Release: [Plugins.zip](https://github.com/UnrealMultiple/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip)
- Gitee Release: [Plugins.zip](https://gitee.com/kksjsj/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip)
-
-## How to Install TShock
-- If you are a Windows user, you can choose to install it using the following command (run this command in pwsh):
-```powershell
-curl -o install.ps1 https://github.com/UnrealMultiple/TShockPlugin/blob/master/InstallTShock.ps1
-powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
-```
-
+#### AutoPluginManager
+ /apm l List all plugins
+ /apm i
One-click install plugin
+ /apm u [plugin name] Check and update plugin
## Developer Notes
> Coding Standards
@@ -60,8 +56,8 @@ powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
Plugin List
-| Plugin Name | Plugin Description | Precondition |
-|------------------------------------------------------------------|:----------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------:|
+| Plugin Name | Plugin Description | Precondition |
+|----------------------------------------------------------------------|:----------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------:|
| [ChattyBridge](src/ChattyBridge/README.md) | Used for cross-server chat. | No |
| [EconomicsAPI](src/EconomicsAPI/README.md) | Economic plugin prerequisite | No |
| [Economics.RPG](src/Economics.RPG/README.md) | RPG | [EconomicsAPI](src/EconomicsAPI/README.md) |
@@ -75,7 +71,7 @@ powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
| [Economics.Task](src/Economics.Task/README.md) | Task plugin | [EconomicsAPI](src/EconomicsAPI/README.md)
[Economics.RPG](src/https://github.com/UnrealMultiple/TShockPlugin/blob/master/Economics.RPG/README.md) |
| [CreateSpawn](src/CreateSpawn/README.md) | Spawn point building generation | No |
| [AutoBroadcast](src/AutoBroadcast/README.md) | Automatic broadcast | No |
-| [AutoTeam](src/AutoTeam/README.md) | AutoTeam | No |
+| [AutoTeam](src/AutoTeam/README_EN.md) | AutoTeam | No |
| [BridgeBuilder](src/BridgeBuilder/README.md) | Quick bridge laying | No |
| [OnlineGiftPackage](src/OnlineGiftPackage/README.md) | Online gift pack | No |
| [LifemaxExtra](src/LifemaxExtra/README.md) | Eat more Life Fruits/Life Crystal | No |
@@ -84,9 +80,9 @@ powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
| [ShortCommand](src/ShortCommand/README.md) | Short Command | No |
| [ProgressBag](src/ProgressBag/README.md) | Progress gift pack | No |
| [CriticalHit](src/CriticalHit/README.md) | Hit prompt | No |
-| [Back](src/Back/README.md) | Return to the point of death | No |
+| [Back](src/Back/README_EN.md) | Return to the point of death | No |
| [BanNpc](src/BanNpc/README.md) | Prevent monster generation | No |
-| [MapTeleport](src/MapTp/README.md) | Double-click the map to teleport. | No |
+| [MapTeleport](src/MapTp/READM_EN.md) | Double-click the map to teleport. | No |
| [RandReSpawn](src/RandRespawn/README.md) | Random spawn point | No |
| [CGive](src/CGive/README.md) | Offline commands | No |
| [RainbowChat](src/RainbowChat/README.md) | Random chat color | No |
@@ -115,7 +111,7 @@ powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
| [AutoClear](src/Autoclear/README.md) | Intelligent automatic cleaning | No |
| [EssentialsPlus](src/EssentialsPlus/README.md) | More management commands | No |
| [ShowArmors](src/ShowArmors/README.md) | Display equipment bar | No |
-| [VeinMiner](src/VeinMiner/README.md) | Chain mining | No |
+| [VeinMiner](src/VeinMiner/README_EN.md) | Chain mining | No |
| [PersonalPermission](src/PersonalPermission/README.md) | Set permissions individually for players | No |
| [ItemPreserver](src/ItemPreserver/README.md) | Specified items do not consume | No |
| [SimultaneousUseFix](src/SimultaneousUseFix/README.md) | Solve problems like stuck double hammer and star spin machine gun | [Chireiden.TShock.Omni](src/https://github.com/sgkoishi/yaaiomni/releases) |
@@ -124,14 +120,14 @@ powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
| [BuildMaster](src/BuildMaster/README.md) | Red Bean Mini Game·Master Builder Mode | [MiniGamesAPI](src/MiniGamesAPI/README.md) |
| [journeyUnlock](src/journeyUnlock/README.md) | Unlock Journey Items | No |
| [ListPlugins](src/ListPlugins/README.md) | List Installed Plugins | No |
-| [BagPing](src/BagPing/README.md) | Mark Treasure Bag on Map | No |
+| [BagPing](src/BagPing/README_EN.md) | Mark Treasure Bag on Map | No |
| [ServerTools](src/ServerTools/README.md) | Server Management Tools | No |
| [Platform](src/Platform/README.md) | Determine Player Device | No |
| [CaiLib](src/CaiLib/README.md) | Cai’s Preload Library | No |
| [GenerateMap](src/GenerateMap/README.md) | Generate Map Image | [CaiLib](src/CaiLib/README.md) |
| [RestInventory](src/RestInventory/README.md) | Provide REST Query Backpack Interface | No |
| [WikiLangPackLoader](src/WikiLangPackLoader/README.md) | Load Chinese Wiki Language Pack for Server | No |
-| [HelpPlus](src/HelpPlus/README.md) | Fix and Enhance Help Command | No |
+| [HelpPlus](src/HelpPlus/README_EN.md) | Fix and Enhance Help Command | No |
| [CaiBot](src/CaiBot/README.md) | CaiBot(QQ) Adapter Plugin | Built-in Precondition |
| [HouseRegion](src/HouseRegion/README.md) | Land Claiming Plugin | No |
| [SignInSign](src/SignInSign/README.md) | Signboard Login Plugin | No |
@@ -160,7 +156,7 @@ powershell -ExecutionPolicy ByPass -File ./install.ps1 -verb runas
| [SpawnInfra](src/SpawnInfra/README.md) | Generate Basic Infrastructure | No |
| [CNPCShop](src/CNPCShop/README.md) | Custom NPC Shop | No |
| [SessionSentinel](src/SessionSentinel/README.md) | Handle Players Not Sending Data Packets for a Long Time | No |
-| [TeleportRequest](src/TeleportRequest/README.md) | Teleport Request | No |
+| [TeleportRequest](src/TeleportRequest/README_EN.md) | Teleport Request | No |
| [CaiRewardChest](src/CaiRewardChest/README.md) | Convert Naturally Generated Chests into Reward Chests that Everyone Can Claim Once | No |
| [ProxyProtocolSocket](src/ProxyProtocolSocket/README.md) | Accept proxy protocol connections | No |
| [UnseenInventory](src/UnseenInventory/README.md) | Allows the server to generate items that are normally 'unobtainable'. | No |
diff --git a/Usage.txt b/Usage.txt
index 8817c786..c3cc9d47 100644
--- a/Usage.txt
+++ b/Usage.txt
@@ -1,3 +1,4 @@
+简体中文:
[使用说明]
1. 本仓库所有插件都开源免费,按GNU General Public License v3.0许可授权使用。
2. 使用插件前请详细阅读每个插件的文档(md,或在 https://tr.monika.love/resources/104/ 查看)
@@ -8,4 +9,17 @@ pdb: 插件的调试文件,和dll放在一起即可,安装后插件报错可
md: 仓库插件的READEME文件,如果没有md查看器,可以在 https://tr.monika.love/resources/104/ 的插件列表中查看每个插件的文档、
LICENSE: 插件仓库的开源协议(GNU General Public License v3.0)
Plugins.json: 插件仓库插件的版本信息,一般用于自动更新
-TShockPlugin.md: 插件仓库的文档文件,有插件列表和一些说明
\ No newline at end of file
+TShockPlugin.md: 插件仓库的文档文件,有插件列表和一些说明
+
+English:
+[Instructions]
+1. All plugins in this repository are open-source and free to use under the GNU General Public License v3.0.
+2. Please read the documentation for each plugin (md files, or view at https://tr.monika.love/resources/104/) before using the plugins.
+3. If you encounter any issues while using the latest version of the plugins from this repository, you can ask questions on GitHub through Issues.
+[File Functions]
+dll: The main plugin file, to be placed in the ServerPlugins folder.
+pdb: The plugin’s debug file, to be placed together with the dll. It provides more detailed error messages to help developers quickly locate errors.
+md: The README file for the repository plugins. If you don’t have an md viewer, you can view the documentation for each plugin in the plugin list at https://tr.monika.love/resources/104/.
+LICENSE: The open-source license for the plugin repository (GNU General Public License v3.0).
+Plugins.json: The version information for the repository plugins, generally used for automatic updates.
+TShockPlugin.md: The documentation file for the plugin repository, containing the plugin list and some instructions.
\ No newline at end of file
diff --git a/scripts/BuildHelper.py b/scripts/BuildHelper.py
deleted file mode 100644
index ffcfdb97..00000000
--- a/scripts/BuildHelper.py
+++ /dev/null
@@ -1,91 +0,0 @@
-import os
-import glob
-import shutil
-import sys
-import zipfile
-import requests
-
-def zip_files_in_folder(folder_path, zip_file_path):
- with zipfile.ZipFile(zip_file_path, 'w', compression=zipfile.ZIP_DEFLATED, compresslevel=9) as zipf:
- for foldername, subfolders, filenames in os.walk(folder_path):
- for filename in filenames:
- file_path = os.path.join(foldername, filename)
- arcname = os.path.relpath(file_path, folder_path)
- zipf.write(file_path, arcname=arcname)
- print(f"📦 压缩包已生成: {zip_file_path}")
-
-
-if __name__ == '__main__':
- print(f"🚀 开始执行打包脚本...(By Cai 😋)")
- build_type = sys.argv[1]
-
- print(f"🗑️ 开始删除json文件...")
- for file in glob.glob(os.path.join(f"out/{build_type}/", "*.json")):
- os.remove(file)
- print(f"✅ 已删除文件: {file}")
- print("✅ json文件删除成功!")
-
- print("📝 开始移动README.md...")
- cwd = os.getcwd()
- for dir_name in os.listdir(cwd):
- dir_path = os.path.join(cwd, dir_name)
- if os.path.isdir(dir_path):
- for file_name in os.listdir(dir_path):
- try:
- if file_name.endswith('.csproj'):
- source_path = os.path.join(dir_path, 'README.md')
- destination_path = os.path.join(cwd, 'out', f'{build_type}', file_name.replace('.csproj', '.md'))
- shutil.copyfile(source_path, destination_path)
- print(f"🔍 找到README.md({destination_path})")
- except:
- print(f"⚠️ README移动失败({file_name})")
-
-
- os.makedirs(f'out/{build_type}/Plugins', exist_ok=True)
-
- out_dir = f'out/{build_type}'
- files = [f for f in os.listdir(out_dir) if os.path.isfile(os.path.join(out_dir, f))]
-
-
- for file in files:
- shutil.move(os.path.join(out_dir, file), os.path.join(f'out/{build_type}/Plugins', file))
-
- shutil.copyfile('README.md', f"out/{build_type}/TShockPlugin.md")
- print("✅ README.md移动成功!")
-
- shutil.copyfile('Usage.txt', f"out/{build_type}/使用前须知.txt")
- print("✅ 使用前须知.txt移动成功!")
-
- shutil.copyfile('Plugins.json', f"out/{build_type}/Plugins.json")
- print("✅ Plugins.json移动成功!")
-
- shutil.copyfile('LICENSE', f"out/{build_type}/LICENSE")
- print("✅ 开源协议移动成功!")
-
- print("📦 准备打包插件...")
- zip_files_in_folder(f"out/{build_type}", "Plugins.zip")
- print("📦 插件打包成功!")
- if build_type == "Release" and len(sys.argv) > 2:
- gitee_token = sys.argv[2]
- owner = 'kksjsj'
- repo = 'TShockPlugin'
- release_id = 431070
- headers = {
- 'Authorization': f'token {gitee_token}'
- }
- files = {
- 'file': open('Plugins.zip', 'rb')
- }
- attachments = requests.get(f"https://gitee.com/api/v5/repos/{owner}/{repo}/releases/{release_id}/attach_files?&page=1&per_page=100&direction=asc",headers=headers).json()
- for attachment in attachments:
- response = requests.delete(f"https://gitee.com/api/v5/repos/{owner}/{repo}/releases/{release_id}/attach_files/{attachment['id']}",headers=headers)
- print(f'🗑️ 附件 {attachment["name"]} 删除{"成功" if response.status_code == 204 else "失败"}:{response.status_code}')
-
- response = requests.post(f"https://gitee.com/api/v5/repos/{owner}/{repo}/releases/{release_id}/attach_files", headers=headers, files=files)
- if response.status_code == 201:
- print('✨ Gitee插件包上传成功!')
- print('下载链接:', response.json()['browser_download_url'])
- else:
- print('❓Gitee插件包上传失败:', response.status_code)
- print(response.json())
-
diff --git a/src/AutoReset/AutoResetPlugin.cs b/src/AutoReset/AutoResetPlugin.cs
index 37a022b9..b7cc1a1a 100644
--- a/src/AutoReset/AutoResetPlugin.cs
+++ b/src/AutoReset/AutoResetPlugin.cs
@@ -32,7 +32,7 @@ public AutoResetPlugin(Main game) : base(game)
public override string Name => "AutoReset";
- public override Version Version => new(2024, 8, 25);
+ public override Version Version => new(2024, 9, 1);
public override string Author => "cc04 & Leader & 棱镜 & Cai & 肝帝熙恩";
@@ -42,8 +42,8 @@ public override void Initialize()
{
this.LoadConfig();
Commands.ChatCommands.Add(new Command("reset.admin", this.ResetCmd, "reset", "重置世界"));
+ Commands.ChatCommands.Add(new Command("reset.admin", this.ResetDataCmd, "resetdata", "重置数据"));
Commands.ChatCommands.Add(new Command("", this.OnWho, "who", "playing", "online"));
-
Commands.ChatCommands.Add(new Command("reset.admin", this.ResetSetting, "rs", "重置设置"));
ServerApi.Hooks.ServerJoin.Register(this, this.OnServerJoin, int.MaxValue);
ServerApi.Hooks.WorldSave.Register(this, this.OnWorldSave, int.MaxValue);
@@ -52,6 +52,12 @@ public override void Initialize()
;
}
+ private void ResetDataCmd(CommandArgs args)
+ {
+ this.PostReset();
+ TSPlayer.All.SendSuccessMessage(GetString("[AutoReset]服务器数据重置成功~"));
+ }
+
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -89,7 +95,7 @@ private void ReloadConfig(ReloadEventArgs e)
File.WriteAllText(this._configPath, Config.ToJson());
}
- e.Player.SendSuccessMessage("[AutoReset]自动重置插件配置已重载");
+ e.Player.SendSuccessMessage(GetString("[AutoReset]自动重置插件配置已重载"));
}
private void LoadConfig()
@@ -138,12 +144,12 @@ private void OnWho(CommandArgs args)
if (args.Player.RealPlayer)
{
args.Player.SendInfoMessage(
- $"[i:3611]击杀自动重置:{Lang.GetNPCName(Config.KillToReset.NpcId)}({Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount})");
+ GetString($"[i:3611]击杀自动重置:{Lang.GetNPCName(Config.KillToReset.NpcId)}({Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount})"));
}
else
{
args.Player.SendInfoMessage(
- $"📝击杀自动重置:{Lang.GetNPCName(Config.KillToReset.NpcId)}({Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount})");
+ GetString($"📝击杀自动重置:{Lang.GetNPCName(Config.KillToReset.NpcId)}({Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount})"));
}
}
@@ -151,10 +157,10 @@ private void OnWho(CommandArgs args)
switch (status)
{
case Status.Cleaning:
- args.Player.SendInfoMessage("重置数据中, 请稍后...");
+ args.Player.SendInfoMessage(GetString("重置数据中, 请稍后..."));
break;
case Status.Generating:
- args.Player.SendInfoMessage("生成地图中: " + this.GetProgress());
+ args.Player.SendInfoMessage(GetString("生成地图中: ") + this.GetProgress());
break;
case Status.Available:
break;
@@ -170,7 +176,7 @@ private void CountKill(NpcKilledEventArgs args)
File.WriteAllText(this._configPath, Config.ToJson());
TShock.Utils.Broadcast(
string.Format(
- $"[自动重置]服务器中已经击杀{Lang.GetNPCName(Config.KillToReset.NpcId)}{Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount}"),
+ GetString($"[AutoReset]服务器中已经击杀{Lang.GetNPCName(Config.KillToReset.NpcId)}{Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount}")),
Color.Orange);
if (Config.KillToReset.NeedKillCount <= Config.KillToReset.KillCount)
{
@@ -189,16 +195,16 @@ private void ResetCmd(CommandArgs e)
Task.Run(delegate
{
this._status = Status.Cleaning;
- TShock.Utils.Broadcast("[自动重置]服务器即将开始重置...", Color.Orange);
+ TShock.Utils.Broadcast(GetString("[AutoReset]服务器即将开始重置..."), Color.Orange);
for (var i = 60; i >= 0; i--)
{
- TShock.Utils.Broadcast(string.Format("[自动重置]{0}s后关闭服务器...", i), Color.Orange);
+ TShock.Utils.Broadcast(string.Format(GetString("[AutoReset]{0}s后关闭服务器..."), i), Color.Orange);
Thread.Sleep(1000);
}
TShock.Players.ForEach(delegate (TSPlayer? p)
{
- p?.Kick("[自动重置]服务器已开始重置...", true, true);
+ p?.Kick(GetString("[AutoReset]服务器已开始重置..."), true, true);
});
@@ -280,20 +286,16 @@ void ShowHelpText()
List lines = new()
{
"/rs info",
- "/rs name <地图名>",
- "/rs seed <种子>",
- "或",
- "/rs 信息",
- "/rs 名字 <地图名>",
- "/rs 种子 <种子>"
+ GetString("/rs name <地图名>"),
+ GetString("/rs seed <种子>"),
};
PaginationTools.SendPage(
op, pageNumber, lines,
new PaginationTools.Settings
{
- HeaderFormat = "帮助 ({0}/{1}):",
- FooterFormat = "输入 {0}rs help {{0}} 查看更多".SFormat(Commands.Specifier)
+ HeaderFormat = GetString("帮助 ({0}/{1}):"),
+ FooterFormat = GetString("输入 {0}rs help {{0}} 查看更多").SFormat(Commands.Specifier)
}
);
}
@@ -319,8 +321,8 @@ void ShowHelpText()
// 世界信息
case "信息":
case "info":
- op.SendInfoMessage($"地图名: {(Config.SetWorld.Name ?? Main.worldName)}\n" +
- $"种子: {(Config.SetWorld.Seed ?? "随机")}");
+ op.SendInfoMessage(GetString($"地图名: {(Config.SetWorld.Name ?? Main.worldName)}\n") +
+ GetString($"种子: {(Config.SetWorld.Seed ?? GetString("随机"))}"));
break;
case "名字":
case "name":
@@ -328,13 +330,13 @@ void ShowHelpText()
{
Config.SetWorld.Name = null;
File.WriteAllText(this._configPath, Config.ToJson());
- op.SendSuccessMessage("世界名字已设置为跟随原世界");
+ op.SendSuccessMessage(GetString("世界名字已设置为跟随原世界"));
}
else
{
Config.SetWorld.Name = args.Parameters[1];
File.WriteAllText(this._configPath, Config.ToJson());
- op.SendSuccessMessage("世界名字已设置为 " + args.Parameters[1]);
+ op.SendSuccessMessage(GetString("世界名字已设置为 ") + args.Parameters[1]);
}
break;
@@ -344,7 +346,7 @@ void ShowHelpText()
{
Config.SetWorld.Seed = null;
File.WriteAllText(this._configPath, Config.ToJson());
- op.SendSuccessMessage("世界种子已设为随机");
+ op.SendSuccessMessage(GetString("世界种子已设为随机"));
}
else
{
@@ -363,7 +365,7 @@ void ShowHelpText()
Config.SetWorld.Seed = string.Join(" ", seedParts);
File.WriteAllText(this._configPath, Config.ToJson());
- op.SendSuccessMessage("世界种子已设置为:" + Config.SetWorld.Seed);
+ op.SendSuccessMessage(GetString("世界种子已设置为:") + Config.SetWorld.Seed);
}
break;
@@ -380,7 +382,7 @@ private void PostReset()
}
catch (Exception ex)
{
- TShock.Log.ConsoleWarn($"[AutoReset]重置SQL({c})执行失败: {ex.Message}");
+ TShock.Log.ConsoleWarn(GetString($"[AutoReset]重置SQL({c})执行失败: {ex.Message}"));
}
});
foreach (var keyValuePair in Config.Files!)
@@ -399,7 +401,7 @@ private void PostReset()
}
catch (Exception ex)
{
- TShock.Log.ConsoleWarn($"[AutoReset]重置文件({keyValuePair.Key})替换失败: {ex.Message}");
+ TShock.Log.ConsoleWarn(GetString($"[AutoReset]重置文件({keyValuePair.Key})替换失败: {ex.Message}"));
}
}
@@ -420,11 +422,11 @@ private void OnServerJoin(JoinEventArgs args)
switch (status)
{
case Status.Cleaning:
- plr.Disconnect("[AutoReset]重置数据中,请稍后...");
+ plr.Disconnect(GetString("[AutoReset]重置数据中,请稍后..."));
args.Handled = true;
break;
case Status.Generating:
- plr.Disconnect("[AutoReset]生成地图中:\n" + this.GetProgress());
+ plr.Disconnect(GetString("[AutoReset]生成地图中:\n") + this.GetProgress());
args.Handled = true;
break;
case Status.Available:
diff --git a/src/AutoReset/README.md b/src/AutoReset/README.md
index 798e28fa..da86abae 100644
--- a/src/AutoReset/README.md
+++ b/src/AutoReset/README.md
@@ -7,18 +7,19 @@
## 更新日志
```
-v.2024.8.25
-
+v.2024.9.1
+添加英文翻译,添加resetdata以重置数据不生成地图
v.2024.8.24
尝试完善卸载函数
```
## 指令
-| 语法 | 权限 | 说明 |
-| -------------- | :-----------------: | :------: |
-| /reset 或 /重置世界 | reset.admin | 重置世界|
-| /rs 或 /重置设置 | reset.admin | 重置设置|
+| 语法 | 权限 | 说明 |
+|---------------------| :-----------------: |:----:|
+| /reset 或 /重置世界 | reset.admin | 重置世界 |
+| /resetdata 或 /重置数据 | reset.admin | 重置数据 |
+| /rs 或 /重置设置 | reset.admin | 重置设置 |
## 文件位置
diff --git a/src/AutoReset/README_EN.md b/src/AutoReset/README_EN.md
new file mode 100644
index 00000000..7ab1a735
--- /dev/null
+++ b/src/AutoReset/README_EN.md
@@ -0,0 +1,52 @@
+# AutoReset / OneKeyReset
+
+- Authors: cc04 & Leader & 棱镜 & Cai & 肝帝熙恩
+- Fully automatic reset plugin, fully customizable reset, freeing your hands.
+
+## Commands
+
+| Command | Permission | Details |
+|-------------|:-----------:|:-----------------------------:|
+| /reset | reset.admin | Generating map and reset data |
+| /resetdata | reset.admin | Only reset data |
+| /rs | reset.admin | Reset Setting |
+
+
+## Config
+> Configuration file location:tshock/AutoReset/reset_config.json
+```json
+{
+ "替换文件": { //Replace Files
+ "/tshock/原神.json": "原神.json", // Replace /tshock/原神.json with 原神.json
+ "/tshock/XSB数据缓存.json": "" // Delete /tshock/XSB数据缓存.json
+ },
+ "击杀重置": { // Kill to reset setting
+ "击杀重置开关": false, // Enable or disable the kill to reset feature
+ "已击杀次数": 0, // Current kill count
+ "生物ID": 50, // NPC ID of the creature to be killed
+ "需要击杀次数": 50 // Number of kills required to trigger the reset
+ },
+ "重置后指令": [ // Commands to execute after reset
+ "/reload", // Reload the server
+ "/初始化进度补给箱",
+ "/rpg reset"
+ ],
+ "重置前指令": [ // Commands to execute before reset
+ "/结算金币"
+ ],
+ "重置后SQL命令": [ // SQL commands to execute after reset
+ "DELETE FROM tsCharacter" // Delete all characters from the tsCharacter table
+ ],
+ "地图预设": { // Map presets
+ "地图名": null, // Name of the map
+ "地图种子": null // Seed of the map
+ },
+ "重置提醒": false, // Enable or disable CaiBot reset reminders (CaiBot is a QQ Group BOT)
+ "CaiBot服务器令牌": "西江超级可爱喵" // CaiBot server token
+}
+```
+
+## FeedBack
+- Github Issue -> TShockPlugin Repo: https://github.com/UnrealMultiple/TShockPlugin
+- TShock QQ Group: 816771079
+- China Terraria Forum: trhub.cn, bbstr.net, tr.monika.love
diff --git a/src/AutoReset/Utils.cs b/src/AutoReset/Utils.cs
index 6fd0ac5e..29965ba9 100644
--- a/src/AutoReset/Utils.cs
+++ b/src/AutoReset/Utils.cs
@@ -22,7 +22,7 @@ public static void CallApi()
.Result;
if (response.StatusCode != HttpStatusCode.OK)
{
- TShock.Log.ConsoleWarn($"[自动重置]调用API失败! (状态码: {(int) response.StatusCode})");
+ TShock.Log.ConsoleWarn(GetString($"[自动重置]调用API失败! (状态码: {(int) response.StatusCode})"));
}
}
catch (Exception ex)
diff --git a/src/AutoReset/i18n/en-US.po b/src/AutoReset/i18n/en-US.po
new file mode 100644
index 00000000..2cf81852
--- /dev/null
+++ b/src/AutoReset/i18n/en-US.po
@@ -0,0 +1,124 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: AutoReset\n"
+"POT-Creation-Date: 2024-09-01 11:28:02+0800\n"
+"PO-Revision-Date: 2024-09-01 10:15+0800\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: en_US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 3.5\n"
+
+#: ..\..\Utils.cs:25
+#, csharp-format
+msgid "[自动重置]调用API失败! (状态码: {0})"
+msgstr "[AutoReset] API call failed! (Status code: {0})"
+
+#: ..\..\AutoResetPlugin.cs:325
+#, csharp-format
+msgid "种子: {0}"
+msgstr "Seed: {0}"
+
+#: ..\..\AutoResetPlugin.cs:290
+msgid "/rs seed <种子>"
+msgstr "/rs seed "
+
+#: ..\..\AutoResetPlugin.cs:349
+msgid "世界种子已设为随机"
+msgstr "The world seed has been set to random"
+
+#: ..\..\AutoResetPlugin.cs:324
+#, csharp-format
+msgid "地图名: {0}\n"
+msgstr "Map name: {0}\n"
+
+#: ..\..\AutoResetPlugin.cs:198
+msgid "[AutoReset]服务器即将开始重置..."
+msgstr "[AutoReset] The server is about to reset…"
+
+#: ..\..\AutoResetPlugin.cs:385
+#, csharp-format
+msgid "[AutoReset]重置SQL({0})执行失败: {1}"
+msgstr "[AutoReset] Resetting SQL ({0}) failed: {1}"
+
+#: ..\..\AutoResetPlugin.cs:160
+msgid "重置数据中, 请稍后..."
+msgstr "Resetting data, please wait…"
+
+#: ..\..\AutoResetPlugin.cs:333
+msgid "世界名字已设置为跟随原世界"
+msgstr "The world name has been set to follow the original world"
+
+#: ..\..\AutoResetPlugin.cs:368
+msgid "世界种子已设置为:"
+msgstr "The world seed has been set to:"
+
+#: ..\..\AutoResetPlugin.cs:163
+msgid "生成地图中: "
+msgstr "Generating map… "
+
+#: ..\..\AutoResetPlugin.cs:404
+#, csharp-format
+msgid "[AutoReset]重置文件({0})替换失败: {1}"
+msgstr "[AutoReset] Resetting file ({0}) failed: {1}"
+
+#: ..\..\AutoResetPlugin.cs:298
+msgid "输入 {0}rs help {{0}} 查看更多"
+msgstr "Type {0}rs help {{0}} for more information"
+
+#: ..\..\AutoResetPlugin.cs:98
+msgid "[AutoReset]自动重置插件配置已重载"
+msgstr "[AutoReset] Auto-reset plugin configuration reloaded"
+
+#: ..\..\AutoResetPlugin.cs:58
+msgid "[AutoReset]服务器数据重置成功~"
+msgstr "[AutoReset] Server data reset successfully~"
+
+#: ..\..\AutoResetPlugin.cs:425
+msgid "[AutoReset]重置数据中,请稍后..."
+msgstr "[AutoReset] Resetting data, please wait…"
+
+#: ..\..\AutoResetPlugin.cs:147
+#, csharp-format
+msgid "[i:3611]击杀自动重置:{0}({1}/{2})"
+msgstr "[i:3611] Auto-reset on kill: {0} ({1}/{2})"
+
+#: ..\..\AutoResetPlugin.cs:339
+msgid "世界名字已设置为 "
+msgstr "[AutoReset] The world name has been set to "
+
+#: ..\..\AutoResetPlugin.cs:429
+msgid "[AutoReset]生成地图中:\n"
+msgstr "[AutoReset] Generating map…\n"
+
+#: ..\..\AutoResetPlugin.cs:297
+msgid "帮助 ({0}/{1}):"
+msgstr "Help ({0}/{1}):"
+
+#: ..\..\AutoResetPlugin.cs:289
+msgid "/rs name <地图名>"
+msgstr "/rs name