diff --git a/EconomicsAPI/Configured/Setting.cs b/EconomicsAPI/Configured/Setting.cs index f8f081408..cdd34ef04 100644 --- a/EconomicsAPI/Configured/Setting.cs +++ b/EconomicsAPI/Configured/Setting.cs @@ -25,6 +25,12 @@ public class Setting [JsonProperty("显示信息")] public bool StatusText = true; + [JsonProperty("显示信息左移")] + public int StatusTextShiftLeft = 60; + + [JsonProperty("显示信息下移")] + public int StatusTextShiftDown = 0; + [JsonProperty("查询提示")] public string QueryFormat = "[c/FFA500:你当前拥有{0}{1}个]"; } \ No newline at end of file diff --git a/EconomicsAPI/Economics.cs b/EconomicsAPI/Economics.cs index 30067f3df..0fa3b6541 100644 --- a/EconomicsAPI/Economics.cs +++ b/EconomicsAPI/Economics.cs @@ -66,13 +66,13 @@ public override void Initialize() private void PlayerHandler_OnPlayerCountertop(PlayerCountertopArgs args) { - args.Messages.Add(new($"当前延迟:{args.Ping.GetPing():F1}", 7)); - args.Messages.Add(new($"玩家名称:{args.Player.Name}", 1)); - args.Messages.Add(new($"{Setting.CurrencyName}数量:{CurrencyManager.GetUserCurrency(args.Player.Name)}", 3)); - args.Messages.Add(new($"在线人数:{TShock.Utils.GetActivePlayerCount()}/{Main.maxPlayers}", 4)); - args.Messages.Add(new($"世界名称:{Main.worldName}", 9)); - args.Messages.Add(new($"当前生命:{args.Player.TPlayer.statLife}/{args.Player.TPlayer.statLifeMax}", 5)); - args.Messages.Add(new($"当前魔力:{args.Player.TPlayer.statMana} / {args.Player.TPlayer.statManaMax}", 6)); + args.Messages.Add(new($"当前延迟: {args.Ping.GetPing():F1}ms", 7)); + args.Messages.Add(new($"玩家名称: {args.Player.Name}", 1)); + args.Messages.Add(new($"{Setting.CurrencyName}数量: {CurrencyManager.GetUserCurrency(args.Player.Name)}", 3)); + args.Messages.Add(new($"在线人数: {TShock.Utils.GetActivePlayerCount()}/{Main.maxPlayers}", 4)); + args.Messages.Add(new($"世界名称: {Main.worldName}", 9)); + args.Messages.Add(new($"当前生命: {args.Player.TPlayer.statLife}/{args.Player.TPlayer.statLifeMax}", 5)); + args.Messages.Add(new($"当前魔力: {args.Player.TPlayer.statMana}/{args.Player.TPlayer.statManaMax}", 6)); } private void OnKillMe(object? sender, GetDataHandlers.KillMeEventArgs e) diff --git a/EconomicsAPI/Utils/Helper.cs b/EconomicsAPI/Utils/Helper.cs index 5846258d4..66550c81c 100644 --- a/EconomicsAPI/Utils/Helper.cs +++ b/EconomicsAPI/Utils/Helper.cs @@ -1,7 +1,6 @@ using EconomicsAPI.Attributes; using EconomicsAPI.EventArgs.PlayerEventArgs; using EconomicsAPI.Extensions; -using EconomicsAPI.Model; using Rests; using System.Reflection; using System.Text; @@ -74,17 +73,13 @@ internal static void InitPluginAttributes() public static void CountertopUpdate(PlayerCountertopArgs args) { StringBuilder sb = new(); - string EndLine9 = new('\n', 9); - string EndLine15 = new('\n', 15); - sb.Append(EndLine9); - sb.Append("\n\n"); - args.Messages.OrderBy(x => x.Order).ForEach(x => sb.AppendLine(x.Message)); - sb.Append(EndLine15); - sb.Append(EndLine15); - sb.Append(EndLine15); - if (args.Ping.TSPlayer != null) + string down = new('\n', Economics.Setting.StatusTextShiftDown); + string Left = new(' ', Economics.Setting.StatusTextShiftLeft); + sb.AppendLine(down); + args.Messages.OrderBy(x => x.Order).ForEach(x => sb.AppendLine(x.Message + Left)); + if (args.Player != null) { - args.Ping.TSPlayer.SendData(PacketTypes.Status, sb.ToString(), 0, 0); + args.Player.SendData(PacketTypes.Status, sb.ToString(), 0, 1); } }