From ae2c63f56eb1b2540da7c8d392e8c026f07eae0f Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Fri, 2 Aug 2024 20:47:02 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BetterWhitelist/Main.cs | 73 +++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/BetterWhitelist/Main.cs b/BetterWhitelist/Main.cs index ba35a4b3..da8dd7c3 100644 --- a/BetterWhitelist/Main.cs +++ b/BetterWhitelist/Main.cs @@ -1,29 +1,24 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Newtonsoft.Json; -using Terraria; +using Newtonsoft.Json; using TerrariaApi.Server; using TShockAPI; namespace BetterWhitelist { - [ApiVersion(2, 1)] - public class Main : TerrariaPlugin - { - public Main(Terraria.Main game) : base(game) - { - Order = 9999; - } + [ApiVersion(2, 1)] + public class Main : TerrariaPlugin + { + public Main(Terraria.Main game) : base(game) + { + Order = 9999; + } - public override string Name => "BetterWhitelist"; + public override string Name => "BetterWhitelist"; - public override Version Version => new Version(2, 3); + public override Version Version => new Version(2, 3); - public override string Author => "豆沙,肝帝熙恩修改"; + public override string Author => "豆沙,肝帝熙恩修改"; - public override string Description => "通过检查玩家姓名的玩家白名单"; + public override string Description => "通过检查玩家姓名的玩家白名单"; public override void Initialize() { string path = Path.Combine(TShock.SavePath, "BetterWhitelist"); @@ -36,15 +31,15 @@ public override void Initialize() Commands.ChatCommands.Add(new Command("bwl.use", new CommandDelegate(this.bwl), new string[] { "bwl" })); ServerApi.Hooks.ServerJoin.Register(this, OnJoin); - ServerApi.Hooks.ServerLeave.Register(this,OnLeave); + ServerApi.Hooks.ServerLeave.Register(this, OnLeave); } private void OnLeave(LeaveEventArgs args) - { - TSPlayer tsplayer = new TSPlayer(args.Who); + { + TSPlayer tsplayer = new TSPlayer(args.Who); players.Remove(tsplayer.Name); - } + } private void bwl(CommandArgs args) { if (args.Parameters.Count < 1) @@ -182,27 +177,27 @@ private void OnJoin(JoinEventArgs args) } private void Load() - { - Main._config = BConfig.Load(Main.config_path); - File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); - } + { + Main._config = BConfig.Load(Main.config_path); + File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); + } - protected override void Dispose(bool disposing) - { - if (disposing) - { - ServerApi.Hooks.ServerJoin.Deregister(this, OnJoin); - ServerApi.Hooks.ServerLeave.Deregister(this, OnLeave); - } - base.Dispose(disposing); - } + protected override void Dispose(bool disposing) + { + if (disposing) + { + ServerApi.Hooks.ServerJoin.Deregister(this, OnJoin); + ServerApi.Hooks.ServerLeave.Deregister(this, OnLeave); + } + base.Dispose(disposing); + } - public static string bwldir = Path.Combine(TShock.SavePath, "BetterWhitelist"); + public static string bwldir = Path.Combine(TShock.SavePath, "BetterWhitelist"); - public static string config_path = Path.Combine(Main.bwldir, "config.json"); + public static string config_path = Path.Combine(Main.bwldir, "config.json"); - public static BConfig _config; + public static BConfig _config; - public static Dictionary players = new Dictionary(); - } + public static Dictionary players = new Dictionary(); + } } From 7edc251891442f85abf33baffaea75dd0d5457ed Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Fri, 2 Aug 2024 21:25:58 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=9AAutoReset=20=E5=AE=8C=E5=85=A8=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoReset/AutoReset.csproj | 5 + AutoReset/AutoResetPlugin.cs | 404 +++++++++++++++++++++++++++++++++++ AutoReset/README.md | 58 +++++ AutoReset/ResetConfig.cs | 62 ++++++ AutoReset/Status.cs | 8 + AutoReset/Utils.cs | 30 +++ Plugin.sln | 10 + 7 files changed, 577 insertions(+) create mode 100644 AutoReset/AutoReset.csproj create mode 100644 AutoReset/AutoResetPlugin.cs create mode 100644 AutoReset/README.md create mode 100644 AutoReset/ResetConfig.cs create mode 100644 AutoReset/Status.cs create mode 100644 AutoReset/Utils.cs diff --git a/AutoReset/AutoReset.csproj b/AutoReset/AutoReset.csproj new file mode 100644 index 00000000..639adc02 --- /dev/null +++ b/AutoReset/AutoReset.csproj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/AutoReset/AutoResetPlugin.cs b/AutoReset/AutoResetPlugin.cs new file mode 100644 index 00000000..e27f93ca --- /dev/null +++ b/AutoReset/AutoResetPlugin.cs @@ -0,0 +1,404 @@ +using Microsoft.Xna.Framework; +using Newtonsoft.Json; +using Terraria; +using Terraria.GameContent.UI.States; +using Terraria.IO; +using Terraria.Utilities; +using Terraria.WorldBuilding; +using TerrariaApi.Server; +using TShockAPI; +using TShockAPI.DB; +using TShockAPI.Hooks; + +namespace AutoReset.MainPlugin; + +[ApiVersion(2, 1)] +public class AutoResetPlugin : TerrariaPlugin +{ + public static ResetConfig Config; + + private static string AllPath = Path.Combine(TShock.SavePath, "AutoReset"); + + private readonly string _configPath = Path.Combine(AllPath, "reset_config.json"); + private readonly string _filePath = Path.Combine(AllPath, "backup_files"); + + private Status _status; + + public GenerationProgress? GenerationProgress; + + public AutoResetPlugin(Main game) : base(game) + { + } + + public override string Name => "AutoReset"; + + public override Version Version => new(2024, 8, 2); + + public override string Author => "cc04 & Leader & 棱镜 & Cai & 肝帝熙恩"; + + public override string Description => "完全自动重置插件"; + + public override void Initialize() + { + string _AllPath = Path.Combine(TShock.SavePath, "AutoReset"); + if (!Directory.Exists(_AllPath)) + Directory.CreateDirectory(_AllPath); + if (!Directory.Exists(_filePath)) + Directory.CreateDirectory(_filePath); + if (!File.Exists(_configPath)) + { + Config = new ResetConfig + { + KillToReset = new ResetConfig.AutoReset(), + SetWorld = new ResetConfig.SetWorldConfig(), + PreResetCommands = new string[] { "/结算金币" }, + PostResetCommands = new string[] { "/reload","/初始化进度补给箱","/rpg reset" }, + SqLs = new[] + { + "DELETE FROM tsCharacter" + }, + Files = new Dictionary() + { + {"/tshock/原神.json","原神.json"}, + {"/tshock/XSB数据缓存.json",""} + } + }; + File.WriteAllText(_configPath, Config.ToJson()); + } + else + { + Config = JsonConvert.DeserializeObject(File.ReadAllText(_configPath))!; + } + + Commands.ChatCommands.Add(new Command("reset.admin", ResetCmd, "reset", "重置世界")); + Commands.ChatCommands.Add(new Command("", OnWho, "who", "playing", "online")); + + Commands.ChatCommands.Add(new Command("reset.admin", ResetSetting, "rs", "重置设置")); + ServerApi.Hooks.ServerJoin.Register(this, OnServerJoin, int.MaxValue); + ServerApi.Hooks.WorldSave.Register(this, OnWorldSave, int.MaxValue); + ServerApi.Hooks.NpcKilled.Register(this, CountKill); + GeneralHooks.ReloadEvent += delegate(ReloadEventArgs e) + { + if (File.Exists(_configPath)) + { + Config = JsonConvert.DeserializeObject(File.ReadAllText(_configPath))!; + } + else + { + Config = new ResetConfig + { + KillToReset = new ResetConfig.AutoReset(), + SetWorld = new ResetConfig.SetWorldConfig(), + PreResetCommands = Array.Empty(), + PostResetCommands = Array.Empty(), + SqLs = new[] + { + "DELETE FROM tsCharacter" + }, + Files = new Dictionary() + }; + File.WriteAllText(_configPath, Config.ToJson()); + } + + e.Player.SendSuccessMessage("[AutoReset]自动重置插件配置已重载"); + }; + } + + + private void OnWho(CommandArgs args) + { + if (Config.KillToReset.KillCount != 0 && Config.KillToReset.KillCount != Config.KillToReset.NeedKillCount) + { + if (args.Player.RealPlayer) + args.Player.SendInfoMessage( + $"[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})"); + } + + Status status = _status; + switch (status) + { + case Status.Cleaning: + args.Player.SendInfoMessage("重置数据中, 请稍后..."); + break; + case Status.Generating: + args.Player.SendInfoMessage("生成地图中: " + GetProgress()); + break; + case Status.Available: + break; + } + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + ServerApi.Hooks.NpcKilled.Deregister(this, CountKill); + ServerApi.Hooks.ServerJoin.Deregister(this, OnServerJoin); + ServerApi.Hooks.WorldSave.Deregister(this, OnWorldSave); + } + + base.Dispose(disposing); + } + + private void CountKill(NpcKilledEventArgs args) + { + + if (Config.KillToReset.Enable &&args.npc.netID == Config.KillToReset.NpcId) + { + Config.KillToReset.KillCount++; + File.WriteAllText(_configPath, Config.ToJson()); + TShock.Utils.Broadcast( + string.Format( + $"[自动重置]服务器中已经击杀{Lang.GetNPCName(Config.KillToReset.NpcId)}{Config.KillToReset.KillCount}/{Config.KillToReset.NeedKillCount}"), + Color.Orange); + if (Config.KillToReset.NeedKillCount <= Config.KillToReset.KillCount) + ResetCmd(null); + } + } + + private void ResetCmd(CommandArgs e) + { + if (_status != Status.Available) return; + Task.Run(delegate + { + _status = Status.Cleaning; + TShock.Utils.Broadcast("[自动重置]服务器即将开始重置...", Color.Orange); + for (int i = 60; i >= 0; i--) + { + TShock.Utils.Broadcast(string.Format("[自动重置]{0}s后关闭服务器...", i), Color.Orange); + Thread.Sleep(1000); + } + + TShock.Players.ForEach(delegate(TSPlayer? p) + { + if (p != null) p.Kick("[自动重置]服务器已开始重置...", true, true); + }); + + + Config.PreResetCommands.ForEach(delegate(string c) { Commands.HandleCommand(TSPlayer.Server, c); }); + Main.WorldFileMetadata = null; + Main.gameMenu = true; + string seed; + if (!string.IsNullOrEmpty(Config.SetWorld.Seed)) + seed = Config.SetWorld.Seed; + else + seed = ""; + seed = seed.Trim(); + if (string.IsNullOrEmpty(seed)) + Main.ActiveWorldFileData.SetSeedToRandom(); + else + Main.ActiveWorldFileData.SetSeed(seed); + UIWorldCreation.ProcessSpecialWorldSeeds(seed); + WorldGen.generatingWorld = true; + Main.rand = new UnifiedRandom(Main.ActiveWorldFileData.Seed); + Main.menuMode = 10; + GenerationProgress = new GenerationProgress(); + Task task = WorldGen.CreateNewWorld(GenerationProgress); + _status = Status.Generating; + while (!task.IsCompleted) + { + TShock.Log.ConsoleInfo(GetProgress()); + Thread.Sleep(1000); + } + + _status = Status.Cleaning; + Main.rand = new UnifiedRandom((int)DateTime.Now.Ticks); + WorldFile.LoadWorld(false); + Main.dayTime = WorldFile._tempDayTime; + Main.time = WorldFile._tempTime; + Main.raining = WorldFile._tempRaining; + Main.rainTime = WorldFile._tempRainTime; + Main.maxRaining = WorldFile._tempMaxRain; + Main.cloudAlpha = WorldFile._tempMaxRain; + Main.moonPhase = WorldFile._tempMoonPhase; + Main.bloodMoon = WorldFile._tempBloodMoon; + Main.eclipse = WorldFile._tempEclipse; + Main.gameMenu = false; + try + { + if (Config.SetWorld.Name != null) Main.worldName = Config.SetWorld.Name; + PostReset(); + Config.KillToReset.KillCount = 0; + Config.SetWorld = new ResetConfig.SetWorldConfig(); + File.WriteAllText(_configPath, Config.ToJson()); + } + finally + { + Utils.CallApi(); + GenerationProgress = null; + _status = Status.Available; + } + }); + } + + + private void ResetSetting(CommandArgs args) + { + TSPlayer op = args.Player; + + #region help + + void ShowHelpText() + { + if (!PaginationTools.TryParsePageNumber(args.Parameters, 1, op, out int pageNumber)) + return; + + List lines = new() + { + "/rs info", + "/rs name <地图名>", + "/rs seed <种子>", + "或", + "/rs 信息", + "/rs 名字 <地图名>", + "/rs 种子 <种子>" + }; + + PaginationTools.SendPage( + op, pageNumber, lines, + new PaginationTools.Settings + { + HeaderFormat = "帮助 ({0}/{1}):", + FooterFormat = "输入 {0}rs help {{0}} 查看更多".SFormat(Commands.Specifier) + } + ); + } + + if (args.Parameters.Count == 0) + { + ShowHelpText(); + return; + } + + + switch (args.Parameters[0].ToLowerInvariant()) + { + // 帮助 + case "help": + ShowHelpText(); + return; + + default: + ShowHelpText(); + break; + + // 世界信息 + case "信息": + case "info": + op.SendInfoMessage($"地图名: {(Config.SetWorld.Name == null ? Main.worldName : Config.SetWorld.Name)}\n" + + $"种子: {(Config.SetWorld.Seed == null ? "随机" : Config.SetWorld.Seed)}"); + break; + case "名字": + case "name": + if (args.Parameters.Count < 2) + { + Config.SetWorld.Name = null; + File.WriteAllText(_configPath, Config.ToJson()); + op.SendSuccessMessage("世界名字已设置为跟随原世界"); + } + else + { + Config.SetWorld.Name = args.Parameters[1]; + File.WriteAllText(_configPath, Config.ToJson()); + op.SendSuccessMessage("世界名字已设置为 " + args.Parameters[1]); + } + + break; + case "种子": + case "seed": + if (args.Parameters.Count < 2) + { + Config.SetWorld.Seed = null; + File.WriteAllText(_configPath, Config.ToJson()); + op.SendSuccessMessage("世界种子已设为随机"); + } + else + { + bool flag = true; + List seedParts = new(); + foreach (string? i in args.Parameters) + { + if (flag) + { + flag = false; + continue; + } + + seedParts.Add(i); + } + + Config.SetWorld.Seed = string.Join(" ", seedParts); + File.WriteAllText(_configPath, Config.ToJson()); + op.SendSuccessMessage("世界种子已设置为:" + Config.SetWorld.Seed); + } + + break; + } + } + + private void PostReset() + { + Config.SqLs.ForEach(delegate(string c) + { + try + { + TShock.DB.Query(c, Array.Empty()); + } + catch (Exception ex) + { + TShock.Log.ConsoleWarn($"[AutoReset]重置SQL({c})执行失败: {ex.Message}"); + } + }); + foreach (KeyValuePair keyValuePair in Config.Files!) + try + { + if (!string.IsNullOrEmpty(keyValuePair.Value)) + File.Copy(Path.Combine(_filePath, keyValuePair.Value), + Path.Combine(Environment.CurrentDirectory, keyValuePair.Key), true); + else + File.Delete(keyValuePair.Key); + } + catch (Exception ex) + { + TShock.Log.ConsoleWarn($"[AutoReset]重置文件({keyValuePair.Key})替换失败: {ex.Message}"); + } + + Config.PostResetCommands.ForEach(delegate(string c) { Commands.HandleCommand(TSPlayer.Server, c); }); + } + + private string GetProgress() + { + return string.Format("{0:0.0%} - " + GenerationProgress!.Message + " - {1:0.0%}", + GenerationProgress.TotalProgress, GenerationProgress.Value); + } + + private void OnServerJoin(JoinEventArgs args) + { + TSPlayer? plr = TShock.Players[args.Who]; + + Status status = _status; + switch (status) + { + case Status.Cleaning: + plr.Disconnect("[AutoReset]重置数据中,请稍后..."); + args.Handled = true; + break; + case Status.Generating: + plr.Disconnect("[AutoReset]生成地图中:\n" + GetProgress()); + args.Handled = true; + break; + case Status.Available: + break; + } + } + + private void OnWorldSave(WorldSaveEventArgs args) + { + args.Handled = _status != Status.Available && Main.WorldFileMetadata == null; + } +} + +#endregion diff --git a/AutoReset/README.md b/AutoReset/README.md new file mode 100644 index 00000000..8e4b7b88 --- /dev/null +++ b/AutoReset/README.md @@ -0,0 +1,58 @@ +# AutoReset 完全自动重置插件 + +- 作者: cc04 & Leader & 棱镜 & Cai & 肝帝熙恩 +- 完全自动重置插件,自定义要重置什么 + + +## 更新日志 + +``` +暂无 +``` + +## 指令 + +| 语法 | 权限 | 说明 | +| -------------- | :-----------------: | :------: | +| /reset 或 /重置世界 | reset.admin | 重置世界| +| /rs 或 /重置设置 | reset.admin | 重置设置| + + +## 文件位置 +> tshock/AutoReset/reset_config.json +```json +{ + "替换文件": { + "/tshock/原神.json": "原神.json", + "/tshock/XSB数据缓存.json": "" + }, + "击杀重置": { + "击杀重置开关": false, + "已击杀次数": 0, + "生物ID": 50, + "需要击杀次数": 50 + }, + "重置后指令": [ + "/reload", + "/初始化进度补给箱", + "/rpg reset" + ], + "重置前指令": [ + "/结算金币" + ], + "重置后SQL命令": [ + "DELETE FROM tsCharacter" + ], + "地图预设": { + "地图名": null, + "地图种子": null + }, + "重置提醒": false, + "CaiBot服务器令牌": "西江超级可爱喵" +} +``` + +## 反馈 +- 优先发issued -> 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin +- 次优先:TShock官方群:816771079 +- 大概率看不到但是也可以:国内社区trhub.cn ,bbstr.net , tr.monika.love diff --git a/AutoReset/ResetConfig.cs b/AutoReset/ResetConfig.cs new file mode 100644 index 00000000..c4d96957 --- /dev/null +++ b/AutoReset/ResetConfig.cs @@ -0,0 +1,62 @@ +using System.Text.Json.Serialization; +using Newtonsoft.Json; + +namespace AutoReset.MainPlugin; + +[JsonObject] +public class ResetConfig +{ + [JsonProperty("CaiBot服务器令牌",Order = 8)] + public string CaiBotToken = "西江超级可爱喵"; + + [JsonProperty("替换文件",Order = 1)] + public Dictionary? Files; + + [JsonProperty("击杀重置",Order = 2)] + public AutoReset KillToReset = new(); + + [JsonProperty("重置后指令",Order = 3)] + public string[]? PostResetCommands; + + [JsonProperty("重置前指令",Order = 4)] + public string[]? PreResetCommands; + + [JsonProperty("重置提醒",Order = 7)] + public bool ResetCaution; + + [JsonProperty("地图预设",Order = 6)] + public SetWorldConfig SetWorld = new(); + + [JsonProperty("重置后SQL命令",Order = 5)] + public string[]? SqLs; + + + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + public class SetWorldConfig + { + [JsonProperty("地图名",Order = 0)] + public string? Name; + + [JsonProperty("地图种子",Order = 1)] + public string? Seed; + } + + public class AutoReset + { + [JsonProperty("击杀重置开关",Order = 0)] + public bool Enable; + + [JsonProperty("已击杀次数",Order = 1)] + public int KillCount; + + [JsonProperty("需要击杀次数",Order = 3)] + public int NeedKillCount = 50; + + [JsonProperty("生物ID",Order = 2)] + public int NpcId = 50; + } +} \ No newline at end of file diff --git a/AutoReset/Status.cs b/AutoReset/Status.cs new file mode 100644 index 00000000..79e04de1 --- /dev/null +++ b/AutoReset/Status.cs @@ -0,0 +1,8 @@ +namespace AutoReset.MainPlugin; + +internal enum Status +{ + Available, + Generating, + Cleaning +} \ No newline at end of file diff --git a/AutoReset/Utils.cs b/AutoReset/Utils.cs new file mode 100644 index 00000000..b4484276 --- /dev/null +++ b/AutoReset/Utils.cs @@ -0,0 +1,30 @@ +using System.Net; +using Terraria; +using TShockAPI; + +namespace AutoReset.MainPlugin; + +internal class Utils +{ + public static void CallApi() + { + if (AutoResetPlugin.Config.ResetCaution) + try + { + HttpClient client = new(); + HttpResponseMessage? response; + client.Timeout = TimeSpan.FromSeconds(5.0); + response = client.GetAsync($"http://api.terraria.ink:22334/bot/send_reset?" + + $"token={AutoResetPlugin.Config.CaiBotToken}" + + $"&server_name={Main.worldName}" + + $"&seed={(Main.ActiveWorldFileData.SeedText == "" ? Main.ActiveWorldFileData.Seed : Main.ActiveWorldFileData.SeedText)}") + .Result; + if (response.StatusCode != HttpStatusCode.OK) + TShock.Log.ConsoleWarn($"[自动重置]调用API失败! (状态码: {(int)response.StatusCode})"); + } + catch (Exception ex) + { + TShock.Log.Error(ex.Message); + } + } +} diff --git a/Plugin.sln b/Plugin.sln index ff3b1028..3a7a73ea 100644 --- a/Plugin.sln +++ b/Plugin.sln @@ -220,6 +220,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaiCustomEmojiCommand", "Ca EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterWhitelist", "BetterWhitelist\BetterWhitelist.csproj", "{5A3A8B24-9E4D-400C-B4DD-A1EB3EE756AD}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoReset", "AutoReset\AutoReset.csproj", "{023244CF-F536-4621-9C89-6BCD0D242878}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1076,6 +1078,14 @@ Global {5A3A8B24-9E4D-400C-B4DD-A1EB3EE756AD}.Release|Any CPU.Build.0 = Release|Any CPU {5A3A8B24-9E4D-400C-B4DD-A1EB3EE756AD}.Release|x64.ActiveCfg = Release|Any CPU {5A3A8B24-9E4D-400C-B4DD-A1EB3EE756AD}.Release|x64.Build.0 = Release|Any CPU + {023244CF-F536-4621-9C89-6BCD0D242878}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {023244CF-F536-4621-9C89-6BCD0D242878}.Debug|Any CPU.Build.0 = Debug|Any CPU + {023244CF-F536-4621-9C89-6BCD0D242878}.Debug|x64.ActiveCfg = Debug|x64 + {023244CF-F536-4621-9C89-6BCD0D242878}.Debug|x64.Build.0 = Debug|x64 + {023244CF-F536-4621-9C89-6BCD0D242878}.Release|Any CPU.ActiveCfg = Release|Any CPU + {023244CF-F536-4621-9C89-6BCD0D242878}.Release|Any CPU.Build.0 = Release|Any CPU + {023244CF-F536-4621-9C89-6BCD0D242878}.Release|x64.ActiveCfg = Release|x64 + {023244CF-F536-4621-9C89-6BCD0D242878}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From afd1fc3fba9e27185d8a54703c60ccd630e5226c Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Fri, 2 Aug 2024 21:26:13 +0800 Subject: [PATCH 03/19] =?UTF-8?q?doc=EF=BC=9A=20PluginManager=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoPluginManager/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AutoPluginManager/README.md b/AutoPluginManager/README.md index 17fd5369..fef8789b 100644 --- a/AutoPluginManager/README.md +++ b/AutoPluginManager/README.md @@ -29,5 +29,6 @@ V2.0.0.0 暂无 ``` ## 反馈 -- 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin -- 国内社区trhub.cn 或 TShock官方群等 +- 优先发issued -> 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin +- 次优先:TShock官方群:816771079 +- 大概率看不到但是也可以:国内社区trhub.cn ,bbstr.net , tr.monika.love From d9a8012603b09bad6837394fe156b5bfd41034c3 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Fri, 2 Aug 2024 21:27:42 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E6=8F=92=E4=BB=B6=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?config=E5=86=85=E5=AE=B9=E9=A1=BA=E5=BA=8F=EF=BC=8C=E6=95=B4?= =?UTF-8?q?=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BetterWhitelist/BConfig.cs | 6 ++-- BetterWhitelist/Main.cs | 60 +++++++++++++++++++------------------- BetterWhitelist/README.md | 9 ++---- Yaaiomni | 2 +- 4 files changed, 37 insertions(+), 40 deletions(-) diff --git a/BetterWhitelist/BConfig.cs b/BetterWhitelist/BConfig.cs index a17096d6..361c6ab5 100644 --- a/BetterWhitelist/BConfig.cs +++ b/BetterWhitelist/BConfig.cs @@ -7,11 +7,11 @@ namespace BetterWhitelist { public class BConfig { - [JsonProperty("插件开关")] + [JsonProperty("插件开关",Order = 0)] public bool Disabled { get; set; } - [JsonProperty("连接时不在白名单提示")] + [JsonProperty("连接时不在白名单提示", Order = 1)] public string NotInWhiteList { get; set; } = "你不在服务器白名单中!"; - [JsonProperty("白名单玩家")] + [JsonProperty("白名单玩家", Order = 3)] public List WhitePlayers = new List(); public static BConfig Load(string path) { diff --git a/BetterWhitelist/Main.cs b/BetterWhitelist/Main.cs index da8dd7c3..d7b0b55d 100644 --- a/BetterWhitelist/Main.cs +++ b/BetterWhitelist/Main.cs @@ -14,7 +14,7 @@ public Main(Terraria.Main game) : base(game) public override string Name => "BetterWhitelist"; - public override Version Version => new Version(2, 3); + public override Version Version => new Version(2, 4); public override string Author => "豆沙,肝帝熙恩修改"; @@ -27,9 +27,9 @@ public override void Initialize() Directory.CreateDirectory(path); } - this.Load(); + Load(); - Commands.ChatCommands.Add(new Command("bwl.use", new CommandDelegate(this.bwl), new string[] { "bwl" })); + Commands.ChatCommands.Add(new Command("bwl.use", bwl, "bwl")); ServerApi.Hooks.ServerJoin.Register(this, OnJoin); ServerApi.Hooks.ServerLeave.Register(this, OnLeave); } @@ -65,51 +65,51 @@ private void bwl(CommandArgs args) break; case "false": - if (Main._config.Disabled) + if (_config.Disabled) { args.Player.SendErrorMessage("禁用失败 ! 插件已是关闭状态"); } else { - Main._config.Disabled = true; + _config.Disabled = true; args.Player.SendSuccessMessage("禁用成功!"); - File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); + File.WriteAllText(config_path, JsonConvert.SerializeObject(_config, Formatting.Indented)); } break; case "true": - if (!Main._config.Disabled) + if (!_config.Disabled) { args.Player.SendErrorMessage("启用失败 ! 插件已是打开状态"); } else { - Main._config.Disabled = false; + _config.Disabled = false; args.Player.SendSuccessMessage("启用成功!"); - if (Main.players.Count > 0) + if (players.Count > 0) { - if (Main._config.WhitePlayers.Count > 0) + if (_config.WhitePlayers.Count > 0) { - foreach (TSPlayer tsplayer in Main.players.Values.Where(player => !Main._config.WhitePlayers.Contains(player.Name))) + foreach (TSPlayer tsplayer in players.Values.Where(player => !_config.WhitePlayers.Contains(player.Name))) { tsplayer.Disconnect(_config.NotInWhiteList); } } else { - foreach (TSPlayer tsplayer in Main.players.Values) + foreach (TSPlayer tsplayer in players.Values) { tsplayer.Disconnect(_config.NotInWhiteList); } } } - File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); + File.WriteAllText(config_path, JsonConvert.SerializeObject(_config, Formatting.Indented)); } break; case "add": - if (Main._config.Disabled) + if (_config.Disabled) { args.Player.SendErrorMessage("插件开关已被禁用,请检查配置文件!"); } @@ -117,11 +117,11 @@ private void bwl(CommandArgs args) { string playerNameToAdd = args.Parameters.ElementAtOrDefault(1); - if (playerNameToAdd != null && !Main._config.WhitePlayers.Contains(playerNameToAdd)) + if (playerNameToAdd != null && !_config.WhitePlayers.Contains(playerNameToAdd)) { - Main._config.WhitePlayers.Add(playerNameToAdd); + _config.WhitePlayers.Add(playerNameToAdd); args.Player.SendSuccessMessage("添加成功!"); - File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); + File.WriteAllText(config_path, JsonConvert.SerializeObject(_config, Formatting.Indented)); } else { @@ -131,12 +131,12 @@ private void bwl(CommandArgs args) break; case "reload": - Main._config = JsonConvert.DeserializeObject(File.ReadAllText(Main.config_path)); + _config = JsonConvert.DeserializeObject(File.ReadAllText(config_path)); args.Player.SendSuccessMessage("重载成功!"); break; case "del": - if (Main._config.Disabled) + if (_config.Disabled) { args.Player.SendErrorMessage("插件开关已被禁用,请检查配置文件!"); } @@ -144,15 +144,15 @@ private void bwl(CommandArgs args) { string playerNameToDelete = args.Parameters.ElementAtOrDefault(1); - if (playerNameToDelete != null && Main._config.WhitePlayers.Contains(playerNameToDelete)) + if (playerNameToDelete != null && _config.WhitePlayers.Contains(playerNameToDelete)) { - Main._config.WhitePlayers.Remove(playerNameToDelete); + _config.WhitePlayers.Remove(playerNameToDelete); args.Player.SendSuccessMessage("删除成功!"); - File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); + File.WriteAllText(config_path, JsonConvert.SerializeObject(_config, Formatting.Indented)); - if (Main.players.ContainsKey(playerNameToDelete)) + if (players.ContainsKey(playerNameToDelete)) { - Main.players[playerNameToDelete].Disconnect("你已经不在白名单中!"); + players[playerNameToDelete].Disconnect("你已经不在白名单中!"); } } } @@ -164,13 +164,13 @@ private void bwl(CommandArgs args) private void OnJoin(JoinEventArgs args) { TSPlayer tsplayer = new TSPlayer(args.Who); - Main.players.Add(tsplayer.Name, tsplayer); + players.Add(tsplayer.Name, tsplayer); - if (!Main._config.Disabled && !Main._config.WhitePlayers.Contains(tsplayer.Name)) + if (!_config.Disabled && !_config.WhitePlayers.Contains(tsplayer.Name)) { tsplayer.Disconnect(_config.NotInWhiteList); } - else if (Main._config.Disabled) + else if (_config.Disabled) { TShock.Log.ConsoleInfo("插件开关已被禁用,请检查配置文件!"); } @@ -178,8 +178,8 @@ private void OnJoin(JoinEventArgs args) private void Load() { - Main._config = BConfig.Load(Main.config_path); - File.WriteAllText(Main.config_path, JsonConvert.SerializeObject(Main._config, Formatting.Indented)); + _config = BConfig.Load(config_path); + File.WriteAllText(config_path, JsonConvert.SerializeObject(_config, Formatting.Indented)); } protected override void Dispose(bool disposing) @@ -194,7 +194,7 @@ protected override void Dispose(bool disposing) public static string bwldir = Path.Combine(TShock.SavePath, "BetterWhitelist"); - public static string config_path = Path.Combine(Main.bwldir, "config.json"); + public static string config_path = Path.Combine(bwldir, "config.json"); public static BConfig _config; diff --git a/BetterWhitelist/README.md b/BetterWhitelist/README.md index efea9974..9f896602 100644 --- a/BetterWhitelist/README.md +++ b/BetterWhitelist/README.md @@ -25,12 +25,9 @@ > 配置文件位置:tshock/BetterWhitelist/config.json ```json { - "启用白名单": true, - - "白名单": [ - "豆沙", - "熙恩" - ] + "白名单玩家": [], + "插件开关": false, + "连接时不在白名单提示": "你不在服务器白名单中!" } ``` ## 反馈 diff --git a/Yaaiomni b/Yaaiomni index 1dc79675..a4bda5bf 160000 --- a/Yaaiomni +++ b/Yaaiomni @@ -1 +1 @@ -Subproject commit 1dc7967580c9bfbca9b756e924f073d924a6f581 +Subproject commit a4bda5bff9f28a31d0476483c144454c281f99ec From a749e033bb35b21b475812b4f451c1fb86fe3e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=9D=E5=B8=9D=E7=86=99=E6=81=A9?= <111548550+THEXN@users.noreply.github.com> Date: Fri, 2 Aug 2024 21:31:16 +0800 Subject: [PATCH 05/19] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 99496b03..c3771d55 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ | [CaiRewardChest](CaiRewardChest/README.md) | 将自然生成的箱子变为所有人都可以领一次的奖励箱 | 无 | | [CaiCustomEmojiCommand](CaiCustomEmojiCommand/README.md) | 自定义表情命令 | 无 | | [BetterWhitelist](BetterWhitelist/README.md) | 白名单插件 | 无 | +| [AutoReset](AutoReset/README.md) | 完全自动重置 | 无 | From 0275b4ba6be47af34ef73f26d2f5c7441641920c Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Fri, 2 Aug 2024 21:57:43 +0800 Subject: [PATCH 06/19] =?UTF-8?q?doc=EF=BC=9A=E4=BF=AE=E6=94=B9AutoReset?= =?UTF-8?q?=20=E5=AE=8C=E5=85=A8=E8=87=AA=E5=8A=A8=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AutoReset/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutoReset/README.md b/AutoReset/README.md index 8e4b7b88..5744fb1d 100644 --- a/AutoReset/README.md +++ b/AutoReset/README.md @@ -24,7 +24,7 @@ { "替换文件": { "/tshock/原神.json": "原神.json", - "/tshock/XSB数据缓存.json": "" + "/tshock/XSB数据缓存.json": ""//表示删除/tshock/XSB数据缓存.json }, "击杀重置": { "击杀重置开关": false, From 8bf7179b385c384cdd1346d757b5d1b22bb984a9 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 21:31:32 +0800 Subject: [PATCH 07/19] =?UTF-8?q?doc=EF=BC=9A=E6=96=87=E6=A1=A3=E5=90=8D?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BetterWhitelist/Main.cs | 1 + BetterWhitelist/README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/BetterWhitelist/Main.cs b/BetterWhitelist/Main.cs index 8404187e..0ae4d3c0 100644 --- a/BetterWhitelist/Main.cs +++ b/BetterWhitelist/Main.cs @@ -1,6 +1,7 @@ using Newtonsoft.Json; using TerrariaApi.Server; using TShockAPI; +using Terraria; namespace BetterWhitelist; diff --git a/BetterWhitelist/README.md b/BetterWhitelist/README.md index d16aa56a..47e3a209 100644 --- a/BetterWhitelist/README.md +++ b/BetterWhitelist/README.md @@ -1,6 +1,6 @@ # BetterWhitelist 更好的白名单 -- 作者: 豆沙,肝帝熙恩修改 +- 作者: 豆沙,肝帝熙恩修,Cai改 - 出处: [gitee](https://gitee.com/Crafty/BetterWhitelist) - 将玩家名字加入白名单,仅在白名单内的玩家可进入游戏 From 4e817e03bac696b940c2a442ea7e260de3e8ed27 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 21:41:01 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9AEzperm=20?= =?UTF-8?q?=E4=BE=BF=E6=8D=B7=E6=9D=83=E9=99=90=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=AE=8C=E5=96=84=E5=8D=B8=E8=BD=BD?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ezperm/Ezperm.cs | 18 ++++++++++-------- Ezperm/README.md | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Ezperm/Ezperm.cs b/Ezperm/Ezperm.cs index 780437af..091819c7 100644 --- a/Ezperm/Ezperm.cs +++ b/Ezperm/Ezperm.cs @@ -11,7 +11,7 @@ public class Ezperm : TerrariaPlugin public override string Name => "Ezperm"; public override string Author => "大豆子,肝帝熙恩优化1449"; public override string Description => "一个指令帮助小白给初始服务器添加缺失的权限,还可以批量添删权限"; - public override Version Version => new Version(1, 2, 0); + public override Version Version => new Version(1, 2, 1); internal static Configuration Config; public Ezperm(Main game) : base(game) { @@ -33,14 +33,16 @@ private static void ReloadConfig(ReloadEventArgs args) public override void Initialize() { GeneralHooks.ReloadEvent += ReloadConfig; - Commands.ChatCommands.Add(new Command(new List - { - "inperms.admin" - }, new CommandDelegate(this.Cmd), new string[] + Commands.ChatCommands.Add(new Command("inperms.admin",Cmd,"inperms","批量改权限")); + } + protected override void Dispose(bool disposing) + { + if (disposing) { - "inperms", - "批量改权限" - })); + Commands.ChatCommands.RemoveAll(x => x.CommandDelegate == Cmd); + GeneralHooks.ReloadEvent -= ReloadConfig; + } + base.Dispose(disposing); } private void Cmd(CommandArgs args) { diff --git a/Ezperm/README.md b/Ezperm/README.md index 83d341d0..c51157f3 100644 --- a/Ezperm/README.md +++ b/Ezperm/README.md @@ -8,7 +8,8 @@ ## 更新日志 ``` -暂无 +v1.2.1 +优化代码,完善卸载函数 ``` ## 指令 From fe25cd2ea00c13527e8516b9f17aa5bfcaae778e Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 21:46:19 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9AGenerateMap?= =?UTF-8?q?=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GenerateMap/Plugin.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GenerateMap/Plugin.cs b/GenerateMap/Plugin.cs index a6ce7335..036aeea7 100644 --- a/GenerateMap/Plugin.cs +++ b/GenerateMap/Plugin.cs @@ -3,6 +3,7 @@ using Terraria; using TerrariaApi.Server; using TShockAPI; +using TShockAPI.Hooks; namespace GenerateMap; @@ -27,6 +28,15 @@ public override void Initialize() Commands.ChatCommands.Add(new("generate.map", CGenerate, "生成地图")); } + protected override void Dispose(bool disposing) + { + if (disposing) + { + Commands.ChatCommands.RemoveAll(x => x.CommandDelegate == CGenerate); + } + base.Dispose(disposing); + } + private object RestGenerateMap(RestRequestArgs args) { var bytes = CaiLib.CaiMap.CreateMapBytes(); From 29d26ebcb497c2388e2edaa797463e2ec29fae0e Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 21:46:34 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E5=AE=8C?= =?UTF-8?q?=E5=96=84GolfRewards=20=E9=AB=98=E5=B0=94=E5=A4=AB=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GolfRewards/GolfRewards.cs | 5 +++-- GolfRewards/README.md | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/GolfRewards/GolfRewards.cs b/GolfRewards/GolfRewards.cs index 2c4d9766..e1a541a4 100644 --- a/GolfRewards/GolfRewards.cs +++ b/GolfRewards/GolfRewards.cs @@ -11,7 +11,7 @@ public class GolfRewards : TerrariaPlugin public override string Name => "高尔夫奖励"; public override string Author => "GK 阁下 由 鸽子 定制,肝帝熙恩更新适配1449"; public override string Description => "将高尔夫打入球洞会得到奖励."; - public override Version Version => new Version(1, 0, 5); + public override Version Version => new Version(1, 0, 6); public GolfRewards(Main game) : base(game) { @@ -33,7 +33,7 @@ private void OnInitialize(EventArgs args) public override void Initialize() { - GeneralHooks.ReloadEvent -= CMD; + GeneralHooks.ReloadEvent += CMD; ServerApi.Hooks.NetGetData.Register(this, GetData); ServerApi.Hooks.GameInitialize.Register(this, OnInitialize); @@ -52,6 +52,7 @@ protected override void Dispose(bool disposing) { if (disposing) { + GeneralHooks.ReloadEvent -= CMD; ServerApi.Hooks.NetGetData.Deregister(this, GetData); ServerApi.Hooks.GameInitialize.Deregister(this, OnInitialize); diff --git a/GolfRewards/README.md b/GolfRewards/README.md index d3390c27..64f82225 100644 --- a/GolfRewards/README.md +++ b/GolfRewards/README.md @@ -8,7 +8,8 @@ ## 更新日志 ``` -暂无 +v1.0.6 +完善卸载函数 ``` ## 指令 From 0d3e444b1dd03f0c9eafb1af9d6e407f6db1ea44 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 21:50:51 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E5=AE=8C?= =?UTF-8?q?=E5=96=84InvincibilityPlugin=20=E9=99=90=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=95=8C=E7=9A=84=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Invincibility/InvincibilityPlugin.cs | 3 ++- Invincibility/README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Invincibility/InvincibilityPlugin.cs b/Invincibility/InvincibilityPlugin.cs index 0a4a76fe..95090c5a 100644 --- a/Invincibility/InvincibilityPlugin.cs +++ b/Invincibility/InvincibilityPlugin.cs @@ -12,7 +12,7 @@ public class InvincibilityPlugin : TerrariaPlugin public override string Author => "肝帝熙恩"; public override string Description => "在命令中给予玩家一段时间的无敌状态。"; public override string Name => "InvincibilityPlugin"; - public override Version Version => new Version(1, 0, 5); + public override Version Version => new Version(1, 0, 6); public static Configuration Config; private readonly Dictionary invincibleDurations = new(); @@ -46,6 +46,7 @@ protected override void Dispose(bool disposing) { if (disposing) { + GeneralHooks.ReloadEvent -= ReloadConfig; ServerApi.Hooks.GameInitialize.Deregister(this, OnInitialize); ServerApi.Hooks.GameUpdate.Deregister(this, OnUpdate); } diff --git a/Invincibility/README.md b/Invincibility/README.md index 2af02ee2..da3c80b1 100644 --- a/Invincibility/README.md +++ b/Invincibility/README.md @@ -9,7 +9,8 @@ ## 更新日志 ``` -暂无 +v1.0.6 +完善卸载函数 ``` ## 指令 From a2eae9d452b1a3d31679e5a9f4312feef51d44fc Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 21:52:38 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E7=9B=B4=E5=88=B0=E9=A6=96=E5=AD=97=E6=AF=8D=E4=B8=BA?= =?UTF-8?q?I=E7=9A=84=E6=8F=92=E4=BB=B6=EF=BC=88=E9=99=A4=E4=BA=86ec?= =?UTF-8?q?=E5=92=8Chelp=E6=8F=92=E4=BB=B6=EF=BC=89=E4=BB=A5=E5=A4=96?= =?UTF-8?q?=E7=9A=84=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ItemPreserver/ItemPreserver.cs | 3 ++- ItemPreserver/README.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ItemPreserver/ItemPreserver.cs b/ItemPreserver/ItemPreserver.cs index 70045077..024780fb 100644 --- a/ItemPreserver/ItemPreserver.cs +++ b/ItemPreserver/ItemPreserver.cs @@ -11,7 +11,7 @@ public class ItemPreserver : TerrariaPlugin public override string Author => "肝帝熙恩 & 少司命"; public override string Description => "指定物品不消耗"; public override string Name => "ItemPreserver"; - public override Version Version => new(1, 0, 6); + public override Version Version => new(1, 0, 7); public static Configuration Config = new(); public class Pitem @@ -120,6 +120,7 @@ protected override void Dispose(bool disposing) if (disposing) { GeneralHooks.ReloadEvent -= ReloadConfig; + GetDataHandlers.PlayerSlot.UnRegister(OnSlot); } base.Dispose(disposing); } diff --git a/ItemPreserver/README.md b/ItemPreserver/README.md index 4c1b4d04..607f0206 100644 --- a/ItemPreserver/README.md +++ b/ItemPreserver/README.md @@ -8,6 +8,8 @@ ## 更新日志 ``` +v1.0.7 +完善卸载函数 V1.0.6 1. 添加数量条件 ``` From 058a1e9dbe8affe2c2f6e94a4ac0ffb89eb4a38d Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 22:05:25 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9AjourneyUnlock?= =?UTF-8?q?=20=E8=A7=A3=E9=94=81=E6=97=85=E9=80=94=E7=89=A9=E5=93=81?= =?UTF-8?q?=E7=9A=84=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- journeyUnlock/README.md | 3 ++- journeyUnlock/journeyUnlock.cs | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/journeyUnlock/README.md b/journeyUnlock/README.md index e79bac3e..2e946b93 100644 --- a/journeyUnlock/README.md +++ b/journeyUnlock/README.md @@ -7,7 +7,8 @@ ## 更新日志 ``` -暂无 +v1.0.1.1 +完善卸载函数 ``` ## 指令 diff --git a/journeyUnlock/journeyUnlock.cs b/journeyUnlock/journeyUnlock.cs index d1d89b72..f7bbf68a 100644 --- a/journeyUnlock/journeyUnlock.cs +++ b/journeyUnlock/journeyUnlock.cs @@ -4,6 +4,7 @@ using Terraria.Net; using TerrariaApi.Server; using TShockAPI; +using TShockAPI.Hooks; namespace journeyUnlock { @@ -16,7 +17,7 @@ public class journeyUnlock : TerrariaPlugin public override string Name => "journeyUnlock"; - public override Version Version => new(1, 0, 1, 0); + public override Version Version => new(1, 0, 1, 1); public journeyUnlock(Main game) : base(game) { @@ -24,16 +25,19 @@ public journeyUnlock(Main game) : base(game) public override void Initialize() { - Commands.ChatCommands.Add(new Command( - permissions: new List { "journeyunlock.unlock" }, - cmd: this.unlockCommand, - "journeyunlock", "junlock", "i解锁") + Commands.ChatCommands.Add(new Command("journeyunlock.unlock" ,unlockCommand,"journeyunlock", "junlock", "i解锁") { AllowServer = false }); - Commands.ChatCommands.Add(new Command( - permissions: new List { "journeyunlock.unlockfor" }, - cmd: this.unlockForCommand, - "unlockfor", "unlockf", "g解锁玩家")); + Commands.ChatCommands.Add(new Command("journeyunlock.unlockfor",unlockForCommand,"unlockfor", "unlockf", "g解锁玩家")); + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + Commands.ChatCommands.RemoveAll(x => x.CommandDelegate == unlockCommand || x.CommandDelegate == unlockForCommand); + } + base.Dispose(disposing); } private void unlock(Player tplayer, TSPlayer sender, string parameter, bool isSelf) From 27919fa0866d345f29f115e7de7227e938817ab4 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 22:15:35 +0800 Subject: [PATCH 14/19] =?UTF-8?q?=E6=80=9D=E8=80=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugin.sln | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/Plugin.sln b/Plugin.sln index 3a7a73ea..556d907d 100644 --- a/Plugin.sln +++ b/Plugin.sln @@ -138,12 +138,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShortCommand", "ShortComman EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTEntryBlock", "DTEntryBlock\DTEntryBlock.csproj", "{1486C0F5-9A7D-4530-B73F-4D1938F0B083}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin", "Yaaiomni\Core\Plugin.csproj", "{E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Misc", "Yaaiomni\Misc\Misc.csproj", "{9A5A7344-A47A-4DC4-A23D-56B92B7F051B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGen", "Yaaiomni\SourceGen\SourceGen.csproj", "{C9B00432-3802-489F-B2D1-C27C36B17DA1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaiBot", "CaiBot\CaiBot.csproj", "{78EA1806-A757-47F3-A1C5-DF2FC3B8288B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HouseRegion", "HouseRegion\HouseRegion.csproj", "{4FEDE121-FE96-4B51-B598-0CDD3C5AA078}" @@ -750,30 +744,6 @@ Global {1486C0F5-9A7D-4530-B73F-4D1938F0B083}.Release|Any CPU.Build.0 = Release|Any CPU {1486C0F5-9A7D-4530-B73F-4D1938F0B083}.Release|x64.ActiveCfg = Release|Any CPU {1486C0F5-9A7D-4530-B73F-4D1938F0B083}.Release|x64.Build.0 = Release|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Debug|x64.ActiveCfg = Debug|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Debug|x64.Build.0 = Debug|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Release|Any CPU.Build.0 = Release|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Release|x64.ActiveCfg = Release|Any CPU - {E384B4DB-BC07-46B8-97A8-F9A1CDBB20C1}.Release|x64.Build.0 = Release|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Debug|x64.ActiveCfg = Debug|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Debug|x64.Build.0 = Debug|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Release|Any CPU.Build.0 = Release|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Release|x64.ActiveCfg = Release|Any CPU - {9A5A7344-A47A-4DC4-A23D-56B92B7F051B}.Release|x64.Build.0 = Release|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Debug|x64.ActiveCfg = Debug|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Debug|x64.Build.0 = Debug|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Release|Any CPU.Build.0 = Release|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Release|x64.ActiveCfg = Release|Any CPU - {C9B00432-3802-489F-B2D1-C27C36B17DA1}.Release|x64.Build.0 = Release|Any CPU {78EA1806-A757-47F3-A1C5-DF2FC3B8288B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78EA1806-A757-47F3-A1C5-DF2FC3B8288B}.Debug|Any CPU.Build.0 = Debug|Any CPU {78EA1806-A757-47F3-A1C5-DF2FC3B8288B}.Debug|x64.ActiveCfg = Debug|Any CPU From 98d22c5f836207f2cca60c3609f0a1b323f3d8b0 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 22:24:51 +0800 Subject: [PATCH 15/19] =?UTF-8?q?Revert=20"=E6=9B=B4=E6=96=B0=EF=BC=9Ajour?= =?UTF-8?q?neyUnlock=20=E8=A7=A3=E9=94=81=E6=97=85=E9=80=94=E7=89=A9?= =?UTF-8?q?=E5=93=81=E7=9A=84=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 058a1e9dbe8affe2c2f6e94a4ac0ffb89eb4a38d. --- journeyUnlock/README.md | 3 +-- journeyUnlock/journeyUnlock.cs | 22 +++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/journeyUnlock/README.md b/journeyUnlock/README.md index 2e946b93..e79bac3e 100644 --- a/journeyUnlock/README.md +++ b/journeyUnlock/README.md @@ -7,8 +7,7 @@ ## 更新日志 ``` -v1.0.1.1 -完善卸载函数 +暂无 ``` ## 指令 diff --git a/journeyUnlock/journeyUnlock.cs b/journeyUnlock/journeyUnlock.cs index f7bbf68a..d1d89b72 100644 --- a/journeyUnlock/journeyUnlock.cs +++ b/journeyUnlock/journeyUnlock.cs @@ -4,7 +4,6 @@ using Terraria.Net; using TerrariaApi.Server; using TShockAPI; -using TShockAPI.Hooks; namespace journeyUnlock { @@ -17,7 +16,7 @@ public class journeyUnlock : TerrariaPlugin public override string Name => "journeyUnlock"; - public override Version Version => new(1, 0, 1, 1); + public override Version Version => new(1, 0, 1, 0); public journeyUnlock(Main game) : base(game) { @@ -25,19 +24,16 @@ public journeyUnlock(Main game) : base(game) public override void Initialize() { - Commands.ChatCommands.Add(new Command("journeyunlock.unlock" ,unlockCommand,"journeyunlock", "junlock", "i解锁") + Commands.ChatCommands.Add(new Command( + permissions: new List { "journeyunlock.unlock" }, + cmd: this.unlockCommand, + "journeyunlock", "junlock", "i解锁") { AllowServer = false }); - Commands.ChatCommands.Add(new Command("journeyunlock.unlockfor",unlockForCommand,"unlockfor", "unlockf", "g解锁玩家")); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - Commands.ChatCommands.RemoveAll(x => x.CommandDelegate == unlockCommand || x.CommandDelegate == unlockForCommand); - } - base.Dispose(disposing); + Commands.ChatCommands.Add(new Command( + permissions: new List { "journeyunlock.unlockfor" }, + cmd: this.unlockForCommand, + "unlockfor", "unlockf", "g解锁玩家")); } private void unlock(Player tplayer, TSPlayer sender, string parameter, bool isSelf) From 5b1ae709791a4e77ad05ebb4e2c51c3ede4cba98 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 22:38:16 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=8A=8A?= =?UTF-8?q?=E6=81=8B=E6=81=8B=E6=8F=92=E4=BB=B6=E5=8A=A0=E5=9B=9E=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugin.sln | 30 ++++++++++++++++++++++++++++++ Yaaiomni | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Plugin.sln b/Plugin.sln index 556d907d..19496019 100644 --- a/Plugin.sln +++ b/Plugin.sln @@ -216,6 +216,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetterWhitelist", "BetterWh EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoReset", "AutoReset\AutoReset.csproj", "{023244CF-F536-4621-9C89-6BCD0D242878}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin", "Yaaiomni\Core\Plugin.csproj", "{951F0545-1630-4E9B-B365-535D7FE9A845}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Misc", "Yaaiomni\Misc\Misc.csproj", "{44B035E4-3049-4AB1-A8C1-212A427371A3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGen", "Yaaiomni\SourceGen\SourceGen.csproj", "{0CD78DBF-DC60-4B91-B5EF-4910172547CE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1056,6 +1062,30 @@ Global {023244CF-F536-4621-9C89-6BCD0D242878}.Release|Any CPU.Build.0 = Release|Any CPU {023244CF-F536-4621-9C89-6BCD0D242878}.Release|x64.ActiveCfg = Release|x64 {023244CF-F536-4621-9C89-6BCD0D242878}.Release|x64.Build.0 = Release|x64 + {951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|Any CPU.Build.0 = Debug|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|x64.ActiveCfg = Debug|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Debug|x64.Build.0 = Debug|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Release|Any CPU.ActiveCfg = Release|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Release|Any CPU.Build.0 = Release|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Release|x64.ActiveCfg = Release|Any CPU + {951F0545-1630-4E9B-B365-535D7FE9A845}.Release|x64.Build.0 = Release|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|x64.ActiveCfg = Debug|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Debug|x64.Build.0 = Debug|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|Any CPU.Build.0 = Release|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|x64.ActiveCfg = Release|Any CPU + {44B035E4-3049-4AB1-A8C1-212A427371A3}.Release|x64.Build.0 = Release|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|x64.ActiveCfg = Debug|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Debug|x64.Build.0 = Debug|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|Any CPU.Build.0 = Release|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|x64.ActiveCfg = Release|Any CPU + {0CD78DBF-DC60-4B91-B5EF-4910172547CE}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Yaaiomni b/Yaaiomni index a4bda5bf..b29b9e99 160000 --- a/Yaaiomni +++ b/Yaaiomni @@ -1 +1 @@ -Subproject commit a4bda5bff9f28a31d0476483c144454c281f99ec +Subproject commit b29b9e99f4fc3cd09c3fb3e098d3b3bb0bcb7055 From d1e305eece100a2b7f461e22a8beafb87d82c9cd Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 23:15:35 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9AjourneyUnlock?= =?UTF-8?q?=20=E8=A7=A3=E9=94=81=E6=97=85=E9=80=94=E7=89=A9=E5=93=81?= =?UTF-8?q?=E7=9A=84=E5=8D=B8=E8=BD=BD=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- journeyUnlock/README.md | 3 ++- journeyUnlock/journeyUnlock.cs | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/journeyUnlock/README.md b/journeyUnlock/README.md index e79bac3e..6f02ff7b 100644 --- a/journeyUnlock/README.md +++ b/journeyUnlock/README.md @@ -7,7 +7,8 @@ ## 更新日志 ``` -暂无 +v1.0.1.1 +补全卸载函数 ``` ## 指令 diff --git a/journeyUnlock/journeyUnlock.cs b/journeyUnlock/journeyUnlock.cs index d1d89b72..1f9d92ad 100644 --- a/journeyUnlock/journeyUnlock.cs +++ b/journeyUnlock/journeyUnlock.cs @@ -16,7 +16,7 @@ public class journeyUnlock : TerrariaPlugin public override string Name => "journeyUnlock"; - public override Version Version => new(1, 0, 1, 0); + public override Version Version => new(1, 0, 1, 1); public journeyUnlock(Main game) : base(game) { @@ -24,16 +24,10 @@ public journeyUnlock(Main game) : base(game) public override void Initialize() { - Commands.ChatCommands.Add(new Command( - permissions: new List { "journeyunlock.unlock" }, - cmd: this.unlockCommand, - "journeyunlock", "junlock", "i解锁") + Commands.ChatCommands.Add(new Command("journeyunlock.unlock",unlockCommand,"journeyunlock", "junlock", "i解锁") { AllowServer = false }); - Commands.ChatCommands.Add(new Command( - permissions: new List { "journeyunlock.unlockfor" }, - cmd: this.unlockForCommand, - "unlockfor", "unlockf", "g解锁玩家")); + Commands.ChatCommands.Add(new Command("journeyunlock.unlockfor",unlockForCommand,"unlockfor", "unlockf", "g解锁玩家")); } private void unlock(Player tplayer, TSPlayer sender, string parameter, bool isSelf) From f0a18e712fdcb5fa95902d5306ff632bdac4d202 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Sat, 3 Aug 2024 23:20:10 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=B0=91?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- journeyUnlock/journeyUnlock.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/journeyUnlock/journeyUnlock.cs b/journeyUnlock/journeyUnlock.cs index 1f9d92ad..e2e07a36 100644 --- a/journeyUnlock/journeyUnlock.cs +++ b/journeyUnlock/journeyUnlock.cs @@ -4,6 +4,7 @@ using Terraria.Net; using TerrariaApi.Server; using TShockAPI; +using TShockAPI.Hooks; namespace journeyUnlock { @@ -30,6 +31,15 @@ public override void Initialize() Commands.ChatCommands.Add(new Command("journeyunlock.unlockfor",unlockForCommand,"unlockfor", "unlockf", "g解锁玩家")); } + protected override void Dispose(bool disposing) + { + if (disposing) + { + Commands.ChatCommands.RemoveAll(x => x.CommandDelegate == unlockCommand || x.CommandDelegate == unlockForCommand); + } + base.Dispose(disposing); + } + private void unlock(Player tplayer, TSPlayer sender, string parameter, bool isSelf) { From c2691a3d09bc7dd954bc1ecf1928664aafdf8241 Mon Sep 17 00:00:00 2001 From: xien <2383759126@qq.com> Date: Thu, 8 Aug 2024 20:44:56 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E8=BF=9E?= =?UTF-8?q?=E9=94=81=E6=8C=96=E7=9F=BF=EF=BC=8C=E5=BD=93=E7=9F=BF=E7=9F=B3?= =?UTF-8?q?=E4=B8=8A=E6=96=B9=E6=9C=89=E6=8C=87=E5=AE=9A=E6=96=B9=E5=9D=97?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8D=E4=BC=9A=E8=A7=A6=E5=8F=91=E8=BF=9E?= =?UTF-8?q?=E9=94=81=E6=8C=96=E7=9F=BF=EF=BC=88=E9=81=BF=E5=85=8D=E5=88=B7?= =?UTF-8?q?=E7=9F=BF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VeinMiner/Config.cs | 6 ++- VeinMiner/README.md | 3 +- VeinMiner/VeinMiner.cs | 104 ++++++++++++++++++++++++----------------- 3 files changed, 68 insertions(+), 45 deletions(-) diff --git a/VeinMiner/Config.cs b/VeinMiner/Config.cs index c41b5d49..317c6c90 100644 --- a/VeinMiner/Config.cs +++ b/VeinMiner/Config.cs @@ -22,7 +22,8 @@ public static void Load(ReloadEventArgs args = null) //Item = new() { { 953, 1 }, { 2425, 5 } } } }, - Tile = new() { 7, 166, 6, 167, 9, 168, 8, 169, 37, 22, 204, 56, 58, 107, 221, 108, 222, 111, 223, 211, 408, 123, 224, 404, 178, 63, 64, 65, 66, 67, 68 } + Tile = new() { 7, 166, 6, 167, 9, 168, 8, 169, 37, 22, 204, 56, 58, 107, 221, 108, 222, 111, 223, 211, 408, 123, 224, 404, 178, 63, 64, 65, 66, 67, 68 }, + NotMine = new() { 21 ,26 ,88 } }, Formatting.Indented)); VeinMiner.Config = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(TShock.SavePath, "VeinMiner.json"))); @@ -48,6 +49,9 @@ public static void Load(ReloadEventArgs args = null) [JsonProperty("矿石类型")] public List Tile { get; set; } = new(); + [JsonProperty("当矿石上方有这些物品时,该处矿石不被挖掘")] + public List NotMine { get; set; } = new(); + [JsonProperty("兑换规则")] public List Exchange { get; set; } = new(); } diff --git a/VeinMiner/README.md b/VeinMiner/README.md index b23e7126..4a8d5061 100644 --- a/VeinMiner/README.md +++ b/VeinMiner/README.md @@ -11,7 +11,8 @@ ## 更新日志 ``` -暂无 +v1.6.0.3 +添加配置,当矿石上方有指定方块时,不会触发连锁挖矿(避免刷矿) ``` ## 指令 diff --git a/VeinMiner/VeinMiner.cs b/VeinMiner/VeinMiner.cs index fa17fa87..5b00c7d2 100644 --- a/VeinMiner/VeinMiner.cs +++ b/VeinMiner/VeinMiner.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using TerrariaApi.Server; using TShockAPI; @@ -9,7 +10,7 @@ namespace VeinMiner public class VeinMiner : TerrariaPlugin { public override string Name => "VeinMiner"; - public override Version Version => new Version(1, 6, 0, 2); + public override Version Version => new Version(1, 6, 0, 3); public override string Author => "Megghy|YSpoof|Maxthegreat99|肝帝熙恩"; public override string Description => "VeinMiner by Megghy 适用于 TShock 5.2 支持!"; @@ -84,47 +85,72 @@ void Mine(TSPlayer plr, int x, int y, int type) var list = GetVein(new(), x, y, type).Result; var count = list.Count; var item = Utils.GetItemFromTile(x, y); - if (Config.Exchange.Where(e => e.Type == type && count >= e.MinSize).ToList() is { Count: > 0 } exchangeList) - exchangeList.ForEach(e => + var mineableList = new List(); + + // 过滤出可挖的矿石坐标 + foreach (var point in list) + { + if (point.Y > 0 && Config.NotMine.Contains(Main.tile[point.X, point.Y - 1].type)) { - if (e.Item.Count <= plr.GetBlankSlot()) + continue; + } + + mineableList.Add(point); + } + + var mineCount = mineableList.Count; + if (mineCount > 0) + { + list = mineableList; + + if (Config.Exchange.Where(e => e.Type == type && mineCount >= e.MinSize).ToList() is { Count: > 0 } exchangeList) + exchangeList.ForEach(e => { - e.Item.ForEach(ex => plr.GiveItem(ex.Key, ex.Value)); - if (e.OnlyGiveItem) - KillTileAndSend(list, true); + if (e.Item.Count <= plr.GetBlankSlot()) + { + e.Item.ForEach(ex => plr.GiveItem(ex.Key, ex.Value)); + if (e.OnlyGiveItem) + KillTileAndSend(list, true); + else + GiveItem(); + plr.SendMessage($"[c/95CFA6:] 挖掘了 [c/95CFA6: {mineCount} {(item.type == 0 ? "未知" : item.Name)}].", Color.White); + return; + } else - GiveItem(); - plr.SendMessage($"[c/95CFA6:] 挖掘了 [c/95CFA6: {count} {(item.type == 0 ? "未知" : item.Name)}].", Color.White); - return; - } - else - { - plr.SendInfoMessage($"[c/95CFA6:] 背包已满,还需空位:[c/95CFA6:{e.Item.Count}] ."); - plr.SendTileSquareCentered(x, y, 1); - return; - } - }); - else - GiveItem(); - void GiveItem() - { - if (Config.PutInInventory) + { + plr.SendInfoMessage($"[c/95CFA6:] 背包已满,还需空位:[c/95CFA6:{e.Item.Count}] ."); + plr.SendTileSquareCentered(x, y, 1); + return; + } + }); + else + GiveItem(); + + void GiveItem() { - if (plr.IsSpaceEnough(item.netID, count)) + if (Config.PutInInventory) { - plr.GiveItem(item.netID, count); - KillTileAndSend(list, true); + if (plr.IsSpaceEnough(item.netID, mineCount)) + { + plr.GiveItem(item.netID, mineCount); + KillTileAndSend(list, true); + } + else + { + WorldGen.KillTile(x, y); + plr.SendInfoMessage($"[c/95CFA6:] 背包已满,需额外空位:[c/95CFA6:{mineCount}] 以放入 [c/95CFA6:{item.Name}] ."); + } } else - { - WorldGen.KillTile(x, y); - plr.SendInfoMessage($"[c/95CFA6:] 背包已满,需额外空位:[c/95CFA6:{count}] 以放入 [c/95CFA6:{item.Name}] ."); - } + KillTileAndSend(list, false); + + if (plr.GetData("VeinMiner").EnableBroadcast && Config.Broadcast && mineCount > 1) + plr.SendMessage($"[c/95CFA6:] 正在挖掘 [c/95CFA6:{mineCount} {(item.type == 0 ? "未知" : item.Name)}].", Color.White); } - else - KillTileAndSend(list, false); - if (plr.GetData("VeinMiner").EnableBroadcast && Config.Broadcast && count > 1) - plr.SendMessage($"[c/95CFA6:] 正在挖掘 [c/95CFA6:{count} {(item.type == 0 ? "未知" : item.Name)}].", Color.White); + } + else if (count > 0) + { + plr.SendMessage($"[c/95CFA6:] 无法挖取矿石,可能是因为矿石上方有不可破坏的物体.", Color.White); } } @@ -134,20 +160,12 @@ public static void KillTileAndSend(List list, bool noItem) { if (!list.Any()) return; - /*var minX = list[0].X; - var minY = list[0].Y; - var maxX = minX; - var maxY = minY;*/ + list.ForEach(p => { - /*if (p.X < minX) minX = p.X; - if (p.X > maxX) maxX = p.X; - if (p.Y < minY) minY = p.Y; - if (p.Y > maxY) maxY = p.Y;*/ WorldGen.KillTile(p.X, p.Y, false, false, noItem); NetMessage.SendData(17, -1, -1, null, 4, p.X, p.Y, false.GetHashCode()); }); - //NetMessage.SendTileSquare(-1, minX, minY, maxX - minX + 1, maxY - minY + 1, Terraria.ID.TileChangeType.None); }); }