From a3c7564ceae31ed6aaad0e500c5612f174d78b84 Mon Sep 17 00:00:00 2001 From: Cai <13110818005@qq.com> Date: Wed, 1 May 2024 12:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E7=94=A8UTF-8=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E9=83=A8=E5=88=86=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PvPer/Commands.cs | 144 ++++++++++++++++++++--------------------- PvPer/Configuration.cs | 46 ++++++------- PvPer/PvPer.cs | 2 +- 3 files changed, 96 insertions(+), 96 deletions(-) diff --git a/PvPer/Commands.cs b/PvPer/Commands.cs index 400cd432..5981c422 100644 --- a/PvPer/Commands.cs +++ b/PvPer/Commands.cs @@ -3,31 +3,31 @@ namespace PvPer -{ +{ public class Commands { public static void Duel(CommandArgs args) { if (args.Parameters.Count == 0) { - args.Player.SendMessage($" [c/42B2CE:/pvp help] [c/F25E61:ҳ]", Color.YellowGreen); + args.Player.SendMessage($"请输入 [c/42B2CE:/pvp help] [c/F25E61:共两页]", Color.YellowGreen); return; } switch (args.Parameters[0].ToLower()) { case "h": case "help": - case "˵": + case "菜单": args.Parameters.RemoveAt(0); HelpCmd(args); return; case "0": case "add": - case "": + case "邀请": if (args.Parameters.Count < 2) { - args.Player.SendErrorMessage("ָĿҵơ"); + args.Player.SendErrorMessage("请指定目标玩家的名称。"); } else { @@ -37,47 +37,47 @@ public static void Duel(CommandArgs args) case "1": case "yes": - case "": + case "接受": AcceptCmd(args); return; case "2": case "no": - case "ܾ": + case "拒绝": RejectCommand(args); return; case "data": case "mark": - case "ս": + case "战绩": StatsCommand(args); return; case "l": case "list": - case "": + case "排名": LeaderboardCommand(args); return; case "wl": - args.Player.SendMessage($"ע⣺/pvp.WL миӢַ[c/F75454:㡱 . ]", Color.YellowGreen); + args.Player.SendMessage($"注意:/pvp.WL 中间有个英文字符[c/F75454:“点”【 . 】]", Color.YellowGreen); return; case "bl": - args.Player.SendMessage($"ע⣺/pvp.BL миӢַ[c/F75454:㡱 . ]", Color.YellowGreen); + args.Player.SendMessage($"注意:/pvp.BL 中间有个英文字符[c/F75454:“点”【 . 】]", Color.YellowGreen); return; case "bb": - args.Player.SendMessage($"ע⣺/pvp.BB миӢַ[c/F75454:㡱 . ]", Color.YellowGreen); + args.Player.SendMessage($"注意:/pvp.BB 中间有个英文字符[c/F75454:“点”【 . 】]", Color.YellowGreen); return; case "bw": - args.Player.SendMessage($"ע⣺/pvp.BW миӢ[c/F75454:㡱 . ]", Color.YellowGreen); + args.Player.SendMessage($"注意:/pvp.BW 中间有个英文[c/F75454:“点”【 . 】]", Color.YellowGreen); return; case "s": case "set": - case "": + case "设置": { int result; if (args.Parameters.Count == 2 && int.TryParse(args.Parameters[1], out result) && IsValidLocationType(result)) @@ -90,31 +90,31 @@ public static void Duel(CommandArgs args) case 1: PvPer.Config.Player1PositionX = x; PvPer.Config.Player1PositionY = y; - args.Player.SendMessage($"ѽڵλΪ[c/F75454:]͵㣬Ϊ({x}, {y})", Color.CadetBlue); - Console.WriteLine($"ϵͳߴ͵ãΪ({x}, {y})", Color.BurlyWood); + args.Player.SendMessage($"已将你所在的位置设置为[c/F75454:邀请者]传送点,坐标为({x}, {y})", Color.CadetBlue); + Console.WriteLine($"【决斗系统】邀请者传送点已设置,坐标为({x}, {y})", Color.BurlyWood); break; case 2: PvPer.Config.Player2PositionX = x; PvPer.Config.Player2PositionY = y; - args.Player.SendMessage($"ѽڵλΪ[c/49B3D6:]͵㣬Ϊ({x}, {y})", Color.CadetBlue); - Console.WriteLine($"ϵͳߴ͵ãΪ({x}, {y})", Color.BurlyWood); + args.Player.SendMessage($"已将你所在的位置设置为[c/49B3D6:受邀者]传送点,坐标为({x}, {y})", Color.CadetBlue); + Console.WriteLine($"【决斗系统】受邀者传送点已设置,坐标为({x}, {y})", Color.BurlyWood); break; case 3: PvPer.Config.ArenaPosX1 = x; PvPer.Config.ArenaPosY1 = y; - args.Player.SendMessage($"ѽڵλΪ[c/9487D6:]ϽǣΪ({x}, {y})", Color.Yellow); - Console.WriteLine($"ϵͳϽãΪ({x}, {y})", Color.Yellow); + args.Player.SendMessage($"已将你所在的位置设置为[c/9487D6:竞技场]左上角,坐标为({x}, {y})", Color.Yellow); + Console.WriteLine($"【决斗系统】竞技场左上角已设置,坐标为({x}, {y})", Color.Yellow); break; case 4: PvPer.Config.ArenaPosX2 = x; PvPer.Config.ArenaPosY2 = y; - args.Player.SendMessage($"ѽڵλΪ[c/9487D6:]½ǣΪ({x}, {y})", Color.Yellow); - Console.WriteLine($"ϵͳ½ãΪ({x}, {y})", Color.Yellow); + args.Player.SendMessage($"已将你所在的位置设置为[c/9487D6:竞技场]右下角,坐标为({x}, {y})", Color.Yellow); + Console.WriteLine($"【决斗系统】竞技场右下角已设置,坐标为({x}, {y})", Color.Yellow); break; default: - args.Player.SendErrorMessage("[i:4080]ָ! [c/CCEB60:ȷָ: /pvp set [1/2/3/4]]"); + args.Player.SendErrorMessage("[i:4080]指令错误! [c/CCEB60:正确指令: /pvp set [1/2/3/4]]"); return; } @@ -122,21 +122,21 @@ public static void Duel(CommandArgs args) } else { - args.Player.SendErrorMessage("[i:4080]ָ! \nȷָ: /pvp set [1/2/3/4] - [c/7EE874:1/2λ 3/4߽]"); + args.Player.SendErrorMessage("[i:4080]指令错误! \n正确指令: /pvp set [1/2/3/4] - [c/7EE874:1/2玩家位置 3/4竞技场边界]"); } break; } case "r": case "reset": - case "": + case "重置": if (args.Parameters.Count < 2) { var name = args.Player.Name; if (!args.Player.HasPermission("pvper.admin")) { - args.Player.SendErrorMessage("ûþϵͳݱȨޡ"); - TShock.Log.ConsoleInfo($"{name}ͼִþϵͳָ"); + args.Player.SendErrorMessage("你没有重置决斗系统数据表的权限。"); + TShock.Log.ConsoleInfo($"{name}试图执行重置决斗系统数据指令"); return; } else @@ -144,9 +144,9 @@ public static void Duel(CommandArgs args) ClearAllData(args); } } - return; // + return; //结束 default: - args.Player.SendErrorMessage($"/pvp help [c/F75454:ҳ]", Color.YellowGreen); + args.Player.SendErrorMessage($"请输入/pvp help [c/F75454:共两页]", Color.YellowGreen); return; } } @@ -174,24 +174,24 @@ private static void HelpCmd(CommandArgs args) switch (page) { case 1: - helpMessage = "\n " + - "ϵͳ 1ҳ 1/2\n " + - "[c/FFFE80:/pvp add /pvp ] - [c/7EE874:ҲμӾ] \n " + - "[c/74D3E8:/pvp yes /pvp ] - [c/7EE874:ܾ] \n " + - "[c/74D3E8:/pvp no /pvp ܾ] - [c/7EE874:ܾ] \n " + - "[c/74D3E8:/pvp data /pvp ս] - [c/7EE874:սѯ]\n " + - "[c/74D3E8:/pvp list /pvp ] - [c/7EE874:]\n " + - "[c/FFFE80:/pvp s /pvp 1 2 3 4] - [c/7EE874:1/2λ 3/4߽]"; + helpMessage = "———————\n " + + "《决斗系统》 第1页 (1/2):\n " + + "[c/FFFE80:/pvp add 或 /pvp 邀请 玩家名] - [c/7EE874:邀请玩家参加决斗] \n " + + "[c/74D3E8:/pvp yes 或 /pvp 接受] - [c/7EE874:接受决斗] \n " + + "[c/74D3E8:/pvp no 或 /pvp 拒绝] - [c/7EE874:拒绝决斗] \n " + + "[c/74D3E8:/pvp data 或 /pvp 战绩] - [c/7EE874:战绩查询]\n " + + "[c/74D3E8:/pvp list 或 /pvp 排名] - [c/7EE874:排名]\n " + + "[c/FFFE80:/pvp s 或 /pvp 设置 1 2 3 4] - [c/7EE874:1/2玩家位置 3/4竞技场边界]"; break; case 2: - helpMessage = "\n " + - "ϵͳ 2ҳ 2/2\n " + - "[c/74D3E8:/pvp.WL ] - [c/7EE874:鿴]\n " + - "[c/74D3E8:/pvp.BL ] - [c/7EE874:鿴]\n " + - "[c/74D3E8:/pvp.BW add|del <> ] - [c/7EE874:ָ]\n " + - "[c/74D3E8:/pvp.BB add|del ] - [c/7EE874:ָBuff]\n " + - "[c/74D3E8:/pvp R /pvp ] - [c/7EE874:ݿ]"; + helpMessage = "———————\n " + + "《决斗系统》 第2页 (2/2):\n " + + "[c/74D3E8:/pvp.WL ] - [c/7EE874:查看封禁武器表]\n " + + "[c/74D3E8:/pvp.BL ] - [c/7EE874:查看封禁增益表]\n " + + "[c/74D3E8:/pvp.BW add|del <武器名> ] - [c/7EE874:封禁指定武器]\n " + + "[c/74D3E8:/pvp.BB add|del <增益名/ID> ] - [c/7EE874:封禁指定Buff]\n " + + "[c/74D3E8:/pvp R 或 /pvp 重置] - [c/7EE874:重置玩家数据库]"; break; default: @@ -203,19 +203,19 @@ private static void HelpCmd(CommandArgs args) } } - #region ʹָݿ⡢λ÷ + #region 使用指令清理数据库、设置位置方法 private static void ClearAllData(CommandArgs args) { - // Դݿɾ + // 尝试从数据库中删除所有玩家数据 if (DbManager.ClearData()) { - args.Player.SendSuccessMessage("ݿҵľѱɹ"); - TShock.Log.ConsoleInfo("ݿҵľѱɹ"); + args.Player.SendSuccessMessage("数据库中所有玩家的决斗数据已被成功清除。"); + TShock.Log.ConsoleInfo("数据库中所有玩家的决斗数据已被成功清除。"); } else { - args.Player.SendErrorMessage("Ҿʱ"); - TShock.Log.ConsoleInfo("Ҿʱ"); + args.Player.SendErrorMessage("清除所有玩家决斗数据时发生错误。"); + TShock.Log.ConsoleInfo("清除所有玩家决斗数据时发生错误。"); } } #endregion @@ -232,13 +232,13 @@ private static void InviteCmd(CommandArgs args) if (plrList.Count == 0) { - args.Player.SendErrorMessage("δҵָҡ"); + args.Player.SendErrorMessage("未找到指定玩家。"); return; } if (Utils.IsPlayerInADuel(args.Player.Index)) { - args.Player.SendErrorMessage("Ѿھˡ"); + args.Player.SendErrorMessage("您现在已经在决斗中了。"); return; } @@ -246,19 +246,19 @@ private static void InviteCmd(CommandArgs args) if (targetPlr.Index == args.Player.Index) { - args.Player.SendErrorMessage("Լ"); + args.Player.SendErrorMessage("您不能与自己决斗!"); return; } if (Utils.IsPlayerInADuel(targetPlr.Index)) { - args.Player.SendErrorMessage($"{targetPlr.Name} ڽһ"); + args.Player.SendErrorMessage($"{targetPlr.Name} 正在进行一场决斗。"); return; } PvPer.Invitations.Add(new Pair(args.Player.Index, targetPlr.Index)); - args.Player.SendSuccessMessage($"ɹ {targetPlr.Name} о"); - targetPlr.SendMessage($"{args.Player.Name} [c/FE7F81:;] \n [c/CCFFCC:/pvp yes ] [c/FFE6CC:/pvp noܾ] ", 255, 204, 255); + args.Player.SendSuccessMessage($"成功邀请 {targetPlr.Name} 进行决斗。"); + targetPlr.SendMessage($"{args.Player.Name} [c/FE7F81:已向您发送决斗邀请] \n请输入 [c/CCFFCC:/pvp yes 接受] 或 [c/FFE6CC:/pvp no拒绝] ", 255, 204, 255); } private static void AcceptCmd(CommandArgs args) @@ -267,7 +267,7 @@ private static void AcceptCmd(CommandArgs args) if (invitation == null) { - args.Player.SendErrorMessage("[c/FE7F81:ǰûյκξ]"); + args.Player.SendErrorMessage("[c/FE7F81:您当前没有收到任何决斗邀请]"); return; } @@ -280,11 +280,11 @@ private static void RejectCommand(CommandArgs args) if (invitation == null) { - args.Player.SendErrorMessage("[c/FE7F81:ǰûյκξ]"); + args.Player.SendErrorMessage("[c/FE7F81:您当前没有收到任何决斗邀请]"); return; } - TShock.Players[invitation.Player1].SendErrorMessage("[c/FFCB80:ԷѾܾľ]"); + TShock.Players[invitation.Player1].SendErrorMessage("[c/FFCB80:对方玩家已拒绝您的决斗邀请]。"); PvPer.Invitations.Remove(invitation); } @@ -295,15 +295,15 @@ private static void StatsCommand(CommandArgs args) try { DPlayer plr = PvPer.DbManager.GetDPlayer(args.Player.Account.ID); - args.Player.SendInfoMessage("[c/FFCB80:ս:]\n" + - $"[c/63DC5A:ɱ: ]{plr.Kills}\n" + - $"[c/F56469::] {plr.Deaths}\n" + - $"[c/F56469:ʤ:] {plr.WinStreak}\n" + - $"ɱ/ [c/5993DB:ʤֵ: ]{plr.GetKillDeathRatio()}"); + args.Player.SendInfoMessage("[c/FFCB80:您的战绩:]\n" + + $"[c/63DC5A:击杀: ]{plr.Kills}\n" + + $"[c/F56469:死亡:] {plr.Deaths}\n" + + $"[c/F56469:连胜:] {plr.WinStreak}\n" + + $"击杀/死亡 [c/5993DB:胜负值: ]{plr.GetKillDeathRatio()}"); } catch (NullReferenceException) { - args.Player.SendErrorMessage("δҵ"); + args.Player.SendErrorMessage("玩家未找到!"); } } else @@ -315,20 +315,20 @@ private static void StatsCommand(CommandArgs args) if (matchedAccounts.Count == 0) { - args.Player.SendErrorMessage("δҵ"); + args.Player.SendErrorMessage("玩家未找到!"); return; } DPlayer plr = PvPer.DbManager.GetDPlayer(matchedAccounts[0].ID); - args.Player.SendInfoMessage("[c/FFCB80:ս:]\n" + - $"[c/63DC5A:ɱ: ]{plr.Kills}\n" + - $"[c/F56469::] {plr.Deaths}\n" + - $"[c/F56469:ʤ:] {plr.WinStreak}\n" + - $"ɱ/ [c/5993DB:ʤֵ: ]{plr.GetKillDeathRatio()}"); + args.Player.SendInfoMessage("[c/FFCB80:您的战绩:]\n" + + $"[c/63DC5A:击杀: ]{plr.Kills}\n" + + $"[c/F56469:死亡:] {plr.Deaths}\n" + + $"[c/F56469:连胜:] {plr.WinStreak}\n" + + $"击杀/死亡 [c/5993DB:胜负值: ]{plr.GetKillDeathRatio()}"); } catch (NullReferenceException) { - args.Player.SendErrorMessage("δҵ"); + args.Player.SendErrorMessage("玩家未找到!"); } } } diff --git a/PvPer/Configuration.cs b/PvPer/Configuration.cs index c985478a..0553cbb4 100644 --- a/PvPer/Configuration.cs +++ b/PvPer/Configuration.cs @@ -6,51 +6,51 @@ namespace PvPer { public class Configuration { - [JsonProperty("Ȩ")] + [JsonProperty("插件权限名")] public string README1 = "pvper.use / pvper.admin"; - [JsonProperty("߽˵")] - public string README2 = "/pvp set 3 4 ҪҴ߻3"; - [JsonProperty("߽˵2")] - public string README3 = "ȡΧҳ,صĵָλãΪλã,رɱѡĬϿѪ"; - [JsonProperty("ü")] + [JsonProperty("竞技场边界说明")] + public string README2 = "/pvp set 3 4 要比玩家传送坐标高或低3格设置"; + [JsonProperty("竞技场边界说明2")] + public string README3 = "拉取范围:会从玩家冲出竞技场方向,拉回到竞技场中心的指定反向位置(当为负数则是正向位置),关闭杀死玩家选项后默认开启扣血"; + [JsonProperty("启用检查")] public bool CheckaAll = true; - [JsonProperty("Ƿ7Ʒ")] + [JsonProperty("是否检查第7个饰品栏")] public bool Check7 = false; - [JsonProperty("ؾ")] + [JsonProperty("拉回竞技场")] public bool PullArena = true; - [JsonProperty("ȡΧ")] + [JsonProperty("拉取范围")] public int PullRange = -20; - [JsonProperty("뿪ɱ")] + [JsonProperty("离开竞技场杀死玩家")] public bool KillPlayer = false; - [JsonProperty("볡Ѫ")] + [JsonProperty("离场扣血")] public int SlapPlayer = 20; - [JsonProperty("ߴ.X")] + [JsonProperty("邀请者传送坐标.X")] public int Player1PositionX = 0; - [JsonProperty("ߴ.Y")] + [JsonProperty("邀请者传送坐标.Y")] public int Player1PositionY = 0; - [JsonProperty("ߴ.X")] + [JsonProperty("受邀者传送坐标.X")] public int Player2PositionX = 0; - [JsonProperty("ߴ.Y")] + [JsonProperty("受邀者传送坐标.Y")] public int Player2PositionY = 0; - [JsonProperty("Ͻ.X")] + [JsonProperty("竞技场左上角坐标.X")] public int ArenaPosX1 = 0; - [JsonProperty("Ͻ.Y")] + [JsonProperty("竞技场左上角坐标.Y")] public int ArenaPosY1 = 0; - [JsonProperty("½.X")] + [JsonProperty("竞技场右下角坐标.X")] public int ArenaPosX2 = 0; - [JsonProperty("½.Y")] + [JsonProperty("竞技场右下角坐标.Y")] public int ArenaPosY2 = 0; - public static readonly string FilePath = Path.Combine(TShock.SavePath + "/ϵͳ.json"); + public static readonly string FilePath = Path.Combine(TShock.SavePath + "/决斗系统.json"); - [JsonProperty("")] + [JsonProperty("禁武器表")] public List WeaponList { get; set; } = new List(); - [JsonProperty("BUFF")] + [JsonProperty("禁BUFF表")] public List BuffList { get; set; } = new List(); - #region ļȡ + #region 配置文件读取创建方法 public void Write(string path) { using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write)) diff --git a/PvPer/PvPer.cs b/PvPer/PvPer.cs index 5f0925c3..2f672641 100644 --- a/PvPer/PvPer.cs +++ b/PvPer/PvPer.cs @@ -1,4 +1,4 @@ -using Microsoft.Data.Sqlite; +using Microsoft.Data.Sqlite; using Microsoft.Xna.Framework; using Terraria; using TerrariaApi.Server;