mirror of
https://gitee.com/cssfw/EasyTools.git
synced 2026-03-28 03:51:36 +08:00
Compare commits
11 Commits
c19d4c2f9f
...
1e6c40593a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e6c40593a | ||
|
|
ec92dcab22 | ||
|
|
69bb0e948e | ||
|
|
182ccd037b | ||
|
|
4da01efcc5 | ||
|
|
639682fd50 | ||
|
|
86367839ac | ||
|
|
0777192d57 | ||
|
|
289822708a | ||
|
|
d785df3c53 | ||
|
|
c1ed092161 |
@@ -8,13 +8,13 @@ using System;
|
||||
namespace EasyTools.Commands
|
||||
{
|
||||
[CommandHandler(typeof(ClientCommandHandler))]
|
||||
public class RescueCommand : ICommand
|
||||
public class KillMeCommand : ICommand
|
||||
{
|
||||
public string Command => "killme";
|
||||
|
||||
public string[] Aliases => ["suicide"];
|
||||
|
||||
public string Description => "防卡死命令";
|
||||
public string Description => "自救命令";
|
||||
|
||||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
using LabApi.Loader.Features.Paths;
|
||||
using LabApi.Features.Wrappers;
|
||||
using LabApi.Loader.Features.Paths;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -69,37 +70,41 @@ namespace EasyTools.Configs
|
||||
[Description("Logger module settings / 日志模块设置")]
|
||||
public bool EnableLogger { get; set; } = true;
|
||||
|
||||
[Description("Logger module settings / 日志保存路径")]
|
||||
public string LoggerSavePath { get; set; } = Path.Combine(PathManager.Configs.FullName ?? Environment.CurrentDirectory, @"JoinLogs.txt");
|
||||
[Description("Player logger settings / 玩家日志保存路径")]
|
||||
public string PlayerLogPath { get; set; } = Path.Combine(PathManager.Configs.FullName ?? Environment.CurrentDirectory, "/JoinLogs");
|
||||
|
||||
[Description("管理日志地址")]
|
||||
public string AdminLogPath { get; set; } = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\\Admins.txt";
|
||||
[Description("Management logger settings / 管理日志保存路径")]
|
||||
public string AdminLogPath { get; set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "/AdminLogs");
|
||||
|
||||
/// /////////////////////////////////////////////////
|
||||
[Description("Is 207 harmless? / 是否开启207(可乐)无害?")]
|
||||
public bool harmless_207 { get; set; } = true;
|
||||
public bool Harmless207 { get; set; } = true;
|
||||
|
||||
|
||||
[Description("Is 1853 harmless? / 是否开启1853(洗手液)无害?")]
|
||||
public bool harmless_1853 { get; set; } = true;
|
||||
public bool Harmless1853 { get; set; } = true;
|
||||
|
||||
|
||||
/// /////////////////////////////////////////////////
|
||||
[Description("SCP静止回血?")]
|
||||
public bool heal_scp { get; set; } = true;
|
||||
public bool EnableHealSCP { get; set; } = true;
|
||||
|
||||
|
||||
[Description("等待多少秒后持续回血")]
|
||||
public float heal_scp_secend { get; set; } = 6;
|
||||
[Description("等待多少秒后开始回血")]
|
||||
public float HealSCPSecend { get; set; } = 6;
|
||||
|
||||
[Description("受伤检测")]
|
||||
public float heal_atk_secend { get; set; } = 2;
|
||||
public float HealATKSecend { get; set; } = 2;
|
||||
|
||||
[Description("回血量")]
|
||||
public int heal_scp_x { get; set; } = 2;
|
||||
public int HealSCPQuantity { get; set; } = 2;
|
||||
|
||||
/// /////////////////////////////////////////////////
|
||||
[Description("开启硬币抽卡?")]
|
||||
public bool coin { get; set; } = true;
|
||||
public bool Coin { get; set; } = true;
|
||||
|
||||
/// /////////////////////////////////////////////////
|
||||
[Description("开启回合结束友伤?")]
|
||||
public bool EnableFriendFire { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
31
Configs/HUDInfoConfig.cs
Normal file
31
Configs/HUDInfoConfig.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace EasyTools.Configs
|
||||
{
|
||||
public class HUDInfoConfig
|
||||
{
|
||||
[Description("是否显示SCP914提示信息")]
|
||||
public bool info_914 { get; set; } = true;
|
||||
[Description("是否显示电梯提示信息")]
|
||||
public bool info_elevator { get; set; } = true;
|
||||
|
||||
/// /////////////////////////////////////////////////
|
||||
[Description("914显示,X轴坐标(0为正中,-为左,+为右):")]
|
||||
public float _914_x { get; set; } = 0;
|
||||
[Description("914显示,Y轴坐标(屏幕最上端大概100,最下端大概1000):")]
|
||||
public float _914_y { get; set; } = 80;
|
||||
[Description("914显示,字体大小:")]
|
||||
public int _914_font { get; set; } = 20;
|
||||
|
||||
/// /////////////////////////////////////////////////
|
||||
[Description("电梯显示,X轴坐标(0为正中,-为左,+为右):")]
|
||||
public float _elev_x { get; set; } = 0;
|
||||
[Description("电梯显示,Y轴坐标(屏幕最上端大概100,最下端大概1000):")]
|
||||
public float _elev_y { get; set; } = 800;
|
||||
[Description("电梯显示,字体大小:")]
|
||||
public int _elev_font { get; set; } = 20;
|
||||
|
||||
[Description("电梯提示显示可见范围(操作者为中心):")]
|
||||
public float elev_range { get; set; } = 10f;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using EasyTools.Utils;
|
||||
using PlayerRoles;
|
||||
using Scp914;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -7,11 +8,11 @@ namespace EasyTools.Configs
|
||||
{
|
||||
public class TranslateConfig
|
||||
{
|
||||
[Description("卡虚空自救指令_错误")]
|
||||
[Description("自救指令_错误")]
|
||||
public string RescueCommandError { get; set; } = "执行指令时发生错误,请稍后再试";
|
||||
[Description("卡虚空自救指令_失败")]
|
||||
[Description("自救指令_失败")]
|
||||
public string RescueCommandFailed { get; set; } = "失败,可能指令未启用或者身份不允许等";
|
||||
[Description("卡虚空自救指令_成功")]
|
||||
[Description("自救指令_成功")]
|
||||
public string RescueCommandOk { get; set; } = "成功";
|
||||
[Description("聊天指令_错误")]
|
||||
public string ChatCommandError { get; set; } = "发送消息时出现错误,请稍后重试";
|
||||
@@ -73,5 +74,21 @@ namespace EasyTools.Configs
|
||||
{Team.ChaosInsurgency , "混沌阵营" },
|
||||
{Team.FoundationForces , "九尾狐阵营" },
|
||||
};
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Description("电梯显示模板(HEX color写死, {p_operator}表示操作人, 没有的话自动为未知):")]
|
||||
public string elev_template { get; set; } = "[Elevator] 电梯使用者: <color=#B952FA>{p_operator}</color>";
|
||||
[Description("SCP914显示模板(HEX color写死, {mode}表示操作模式, {p_operator}表示操作人, 没有的话自动为未知):")]
|
||||
public string scp914_template { get; set; } = "[Scp914] 已启动! 模式: <color=#F7C73E>{mode}</color>, 操作人: <color=#0080FF>{p_operator}</color>";
|
||||
[Description("SCP914, Rough模式翻译:")]
|
||||
public Dictionary<Scp914KnobSetting, string> scp914_trans { get; set; } = new Dictionary<Scp914KnobSetting, string>()
|
||||
{
|
||||
{ Scp914KnobSetting.Rough, "粗加" },
|
||||
{ Scp914KnobSetting.Coarse, "半粗" },
|
||||
{ Scp914KnobSetting.OneToOne, "1:1" },
|
||||
{ Scp914KnobSetting.Fine, "精加" },
|
||||
{ Scp914KnobSetting.VeryFine, "超精加工" }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
15
DataBase/Serialization/HintData.cs
Normal file
15
DataBase/Serialization/HintData.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace EasyTools.DataBase.Serialization
|
||||
{
|
||||
public struct HintData
|
||||
{
|
||||
public float x, y;
|
||||
public int font;
|
||||
|
||||
public HintData(float x, float y, int font)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.font = font;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
DataBase/Serialization/PlayerHint.cs
Normal file
64
DataBase/Serialization/PlayerHint.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using HintServiceMeow.Core.Enum;
|
||||
using HintServiceMeow.Core.Extension;
|
||||
using HintServiceMeow.Core.Models.Hints;
|
||||
using HintServiceMeow.Core.Utilities;
|
||||
using LabApi.Features.Wrappers;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace EasyTools.DataBase.Serialization
|
||||
{
|
||||
public struct PlayerHint : IDisposable
|
||||
{
|
||||
private readonly List<Hint> _hints = new();
|
||||
|
||||
private Hint hint_914;
|
||||
private Hint hint_elevator;
|
||||
|
||||
public PlayerHint(Player player, HintData data_914, HintData data_elevator)
|
||||
{
|
||||
hint_914 = new Hint
|
||||
{
|
||||
Text = "",
|
||||
XCoordinate = data_914.x,
|
||||
YCoordinate = data_914.y,
|
||||
FontSize = data_914.font,
|
||||
YCoordinateAlign = HintVerticalAlign.Bottom
|
||||
};
|
||||
|
||||
hint_elevator = new Hint
|
||||
{
|
||||
Text = "",
|
||||
XCoordinate = data_elevator.x,
|
||||
YCoordinate = data_elevator.y,
|
||||
FontSize = data_elevator.font,
|
||||
YCoordinateAlign = HintVerticalAlign.Bottom
|
||||
};
|
||||
|
||||
var display = PlayerDisplay.Get(player);
|
||||
_hints.AddRange(new[] { hint_914, hint_elevator });
|
||||
_hints.ForEach(display.AddHint);
|
||||
}
|
||||
|
||||
public void Show914(string text)
|
||||
{
|
||||
hint_914.Text = text;
|
||||
hint_914.Hide = false;
|
||||
hint_914.HideAfter(15f);
|
||||
}
|
||||
|
||||
public void ShowElevator(string text)
|
||||
{
|
||||
hint_elevator.Text = text;
|
||||
hint_elevator.Hide = false;
|
||||
hint_elevator.HideAfter(7f);
|
||||
}
|
||||
|
||||
public void Start() { }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var h in _hints) h.Hide = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,15 +125,18 @@
|
||||
<Compile Include="Commands\Chat\AcCommand.cs" />
|
||||
<Compile Include="Commands\Chat\BcCommand.cs" />
|
||||
<Compile Include="Commands\Chat\CCommand.cs" />
|
||||
<Compile Include="Commands\RescueCommand.cs" />
|
||||
<Compile Include="Commands\KillMeCommand.cs" />
|
||||
<Compile Include="Configs\BadgeConfig.cs" />
|
||||
<Compile Include="Configs\Config.cs" />
|
||||
<Compile Include="Configs\CustomRoleConfig.cs" />
|
||||
<Compile Include="Configs\DataBaseConfig.cs" />
|
||||
<Compile Include="Configs\HUDInfoConfig.cs" />
|
||||
<Compile Include="Configs\TranslateConfig.cs" />
|
||||
<Compile Include="DataBase\DataAPI.cs" />
|
||||
<Compile Include="DataBase\InfoExtension.cs" />
|
||||
<Compile Include="DataBase\Serialization\HintData.cs" />
|
||||
<Compile Include="DataBase\Serialization\PlayerData.cs" />
|
||||
<Compile Include="DataBase\Serialization\PlayerHint.cs" />
|
||||
<Compile Include="Events\CustomEventHandler.cs" />
|
||||
<Compile Include="Plugins.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
using EasyTools.BadgeSystem;
|
||||
using EasyTools.Configs;
|
||||
using EasyTools.DataBase.Serialization;
|
||||
using EasyTools.Utils;
|
||||
using Hints;
|
||||
using InventorySystem.Items;
|
||||
using LabApi.Events.Arguments.PlayerEvents;
|
||||
using LabApi.Events.Arguments.Scp914Events;
|
||||
using LabApi.Events.Arguments.ServerEvents;
|
||||
using LabApi.Events.CustomHandlers;
|
||||
using LabApi.Features.Wrappers;
|
||||
using MapGeneration;
|
||||
using MEC;
|
||||
using PlayerRoles;
|
||||
using PlayerStatsSystem;
|
||||
@@ -30,8 +34,14 @@ namespace EasyTools.Events
|
||||
|
||||
public static DataBaseConfig DataBaseConfig;
|
||||
|
||||
public static HUDInfoConfig HUDInfoConfig;
|
||||
|
||||
public static CoroutineHandle Badge_Coroutine;
|
||||
|
||||
public static readonly Dictionary<Player, PlayerHint> _huds = new();
|
||||
|
||||
public static HintData data_914, data_elevator;
|
||||
|
||||
public override void OnServerWaitingForPlayers()
|
||||
{
|
||||
base.OnServerWaitingForPlayers();
|
||||
@@ -41,6 +51,8 @@ namespace EasyTools.Events
|
||||
Badge.rainbw.Clear();
|
||||
Badge_Coroutine = Timing.RunCoroutine(Badge.Rainbw());
|
||||
}
|
||||
|
||||
Server.FriendlyFire = false;
|
||||
}
|
||||
|
||||
public override void OnServerRoundStarted()
|
||||
@@ -52,10 +64,11 @@ namespace EasyTools.Events
|
||||
Timing.RunCoroutine(Util.AutoServerBroadcast());
|
||||
}
|
||||
|
||||
if (Config.heal_scp)
|
||||
if (Config.EnableHealSCP)
|
||||
{
|
||||
Timing.RunCoroutine(ScpReal.AutoReal());
|
||||
}
|
||||
_huds.Values.ToList().ForEach(h => h.Start());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,6 +80,12 @@ namespace EasyTools.Events
|
||||
{
|
||||
Timing.KillCoroutines(Badge_Coroutine);
|
||||
}
|
||||
|
||||
if (Config.EnableFriendFire)
|
||||
{
|
||||
Server.FriendlyFire = true;
|
||||
Server.SendBroadcast($"\n<b><size=25><color=#00CC00>🎉 回合结束,友伤已开启~</color></size></b>", 5);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerJoined(PlayerJoinedEventArgs ev)
|
||||
@@ -82,15 +101,18 @@ namespace EasyTools.Events
|
||||
if (Config.EnableLogger)
|
||||
{
|
||||
string playerInfo = $"[JOIN] Date: {DateTime.Now} | Player: {player.Nickname} | IP: {player.IpAddress} | Steam64ID: {player.UserId}";
|
||||
string path = Path.Combine(CustomEventHandler.Config.PlayerLogPath, $"{Server.Port}.ini");
|
||||
Log.Info(playerInfo);
|
||||
|
||||
File.AppendAllText(Config.LoggerSavePath, playerInfo + Environment.NewLine);
|
||||
File.AppendAllText(path, playerInfo + Environment.NewLine);
|
||||
}
|
||||
if (BadgeConfig.Enable)
|
||||
{
|
||||
Badge.Handler(player);
|
||||
}
|
||||
|
||||
_huds[player] = new PlayerHint(player, data_914, data_elevator);
|
||||
|
||||
}
|
||||
|
||||
public override void OnPlayerLeft(PlayerLeftEventArgs ev)
|
||||
@@ -102,9 +124,10 @@ namespace EasyTools.Events
|
||||
if (Config.EnableLogger)
|
||||
{
|
||||
string playerInfo = $"[EXIT] Date: {DateTime.Now} | Player: {player.Nickname} | IP: {player.IpAddress} | Steam64ID: {player.UserId}";
|
||||
string path = Path.Combine(CustomEventHandler.Config.PlayerLogPath, $"{Server.Port}.ini");
|
||||
Log.Info(playerInfo);
|
||||
|
||||
File.AppendAllText(Config.LoggerSavePath, playerInfo + Environment.NewLine);
|
||||
File.AppendAllText(path, playerInfo + Environment.NewLine);
|
||||
}
|
||||
|
||||
if (BadgeConfig.Enable)
|
||||
@@ -112,54 +135,9 @@ namespace EasyTools.Events
|
||||
Badge.Remove(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void OnPlayerHurting(PlayerHurtingEventArgs ev)
|
||||
if (_huds.ContainsKey(player))
|
||||
{
|
||||
if (Config.harmless_207)
|
||||
{
|
||||
if (ev.DamageHandler is UniversalDamageHandler && ev.DamageHandler.DeathScreenText.Contains("SCP-207"))
|
||||
{
|
||||
ev.IsAllowed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.harmless_1853)
|
||||
{
|
||||
if (ev.DamageHandler is UniversalDamageHandler && ev.DamageHandler.DeathScreenText.Contains("poison"))
|
||||
{
|
||||
ev.IsAllowed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerEscaping(PlayerEscapingEventArgs ev)
|
||||
{
|
||||
if (Config.GuardsCanEscape)
|
||||
{
|
||||
RoleTypeId id;
|
||||
switch (Config.EscapedGuardRole)
|
||||
{
|
||||
case "NtfSergeant":
|
||||
id = RoleTypeId.NtfSergeant;
|
||||
break;
|
||||
case "NtfPrivate":
|
||||
id = RoleTypeId.NtfPrivate;
|
||||
break;
|
||||
case "NtfSpecialist":
|
||||
id = RoleTypeId.NtfSpecialist;
|
||||
break;
|
||||
default:
|
||||
id = RoleTypeId.NtfCaptain;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (ev.Player.Role == RoleTypeId.FacilityGuard)
|
||||
{
|
||||
ev.Player.SetRole(id);
|
||||
ev.IsAllowed = true;
|
||||
}
|
||||
_huds.Remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +145,7 @@ namespace EasyTools.Events
|
||||
|
||||
public override void OnPlayerSpawning(PlayerSpawningEventArgs ev)
|
||||
{
|
||||
if (CustomRoleConfig.spawn_scp_3114 && Player.ReadyList.Count() >= CustomRoleConfig.spawn_scp_3114_limit && !scp_3114_spawned)
|
||||
if (CustomRoleConfig.spawn_scp_3114 && !scp_3114_spawned && Player.ReadyList.Count() >= CustomRoleConfig.spawn_scp_3114_limit)
|
||||
{
|
||||
foreach (Player p in Player.ReadyList)
|
||||
{
|
||||
@@ -182,6 +160,7 @@ namespace EasyTools.Events
|
||||
});
|
||||
}
|
||||
}
|
||||
scp_3114_spawned = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +212,55 @@ namespace EasyTools.Events
|
||||
|
||||
}
|
||||
|
||||
public override void OnPlayerHurting(PlayerHurtingEventArgs ev)
|
||||
{
|
||||
if (Config.Harmless207)
|
||||
{
|
||||
if (ev.DamageHandler is UniversalDamageHandler && ev.DamageHandler.DeathScreenText.Contains("SCP-207"))
|
||||
{
|
||||
ev.IsAllowed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.Harmless1853)
|
||||
{
|
||||
if (ev.DamageHandler is UniversalDamageHandler && ev.DamageHandler.DeathScreenText.Contains("poison"))
|
||||
{
|
||||
ev.IsAllowed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerEscaping(PlayerEscapingEventArgs ev)
|
||||
{
|
||||
if (Config.GuardsCanEscape)
|
||||
{
|
||||
RoleTypeId id;
|
||||
switch (Config.EscapedGuardRole)
|
||||
{
|
||||
case "NtfSergeant":
|
||||
id = RoleTypeId.NtfSergeant;
|
||||
break;
|
||||
case "NtfPrivate":
|
||||
id = RoleTypeId.NtfPrivate;
|
||||
break;
|
||||
case "NtfSpecialist":
|
||||
id = RoleTypeId.NtfSpecialist;
|
||||
break;
|
||||
default:
|
||||
id = RoleTypeId.NtfCaptain;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (ev.Player.Role == RoleTypeId.FacilityGuard)
|
||||
{
|
||||
ev.Player.SetRole(id);
|
||||
ev.IsAllowed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerInteractingScp330(PlayerInteractingScp330EventArgs ev)
|
||||
{
|
||||
if (Config.EnablePinkCandy)
|
||||
@@ -258,12 +286,13 @@ namespace EasyTools.Events
|
||||
|
||||
|
||||
string note = $"Date: {DateTime.Now} | Player: {player.Nickname} | Command: {command} | Steam64ID: {player.UserId}";
|
||||
string path = Path.Combine(CustomEventHandler.Config.AdminLogPath, $"{Server.Port}.ini");
|
||||
Log.Info(note);
|
||||
try
|
||||
{
|
||||
if (!File.Exists(Config.AdminLogPath))
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
FileStream fs1 = new(Config.AdminLogPath, FileMode.Create, FileAccess.Write);
|
||||
FileStream fs1 = new(path, FileMode.Create, FileAccess.Write);
|
||||
StreamWriter sw = new(fs1);
|
||||
sw.WriteLine(note);
|
||||
sw.Close();
|
||||
@@ -271,7 +300,7 @@ namespace EasyTools.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
FileStream fs = new(Config.AdminLogPath, FileMode.Append, FileAccess.Write);
|
||||
FileStream fs = new(path, FileMode.Append, FileAccess.Write);
|
||||
StreamWriter sr = new(fs);
|
||||
sr.WriteLine(note);
|
||||
sr.Close();
|
||||
@@ -288,7 +317,7 @@ namespace EasyTools.Events
|
||||
public override void OnPlayerFlippingCoin(PlayerFlippingCoinEventArgs ev)
|
||||
{
|
||||
if (!ev.IsAllowed) return;
|
||||
if (!Config.coin) return;
|
||||
if (!Config.Coin) return;
|
||||
if (ev.Player.Items.Count() == 8)
|
||||
{
|
||||
ev.Player.SendBroadcast($"\n<b><size=25><color=#00CC00>你的背包空间不足,无法继续抽卡!</color></size></b>", 2);
|
||||
@@ -455,5 +484,41 @@ namespace EasyTools.Events
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void OnScp914Activating(Scp914ActivatingEventArgs ev)
|
||||
{
|
||||
if (HUDInfoConfig.info_914 == false) return;
|
||||
|
||||
Scp914.Scp914KnobSetting knob = ev.KnobSetting;
|
||||
string mode = TranslateConfig.scp914_trans[knob];
|
||||
|
||||
var p_operator = ev.Player.Nickname ?? "未知";
|
||||
|
||||
string msg = TranslateConfig.scp914_template.Replace("{mode}", mode)
|
||||
.Replace("{p_operator}", p_operator);
|
||||
|
||||
foreach (var p in Player.List)
|
||||
{
|
||||
if (p.IsAlive && p != null && p.Room.Name == RoomName.Lcz914)// 检测914附近玩家,然后告诉他们914正在运行
|
||||
{
|
||||
_huds[p].Show914(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPlayerInteractingElevator(PlayerInteractingElevatorEventArgs ev)
|
||||
{
|
||||
if (HUDInfoConfig.info_elevator == false) return;
|
||||
|
||||
IEnumerable<Player> near = Player.List.Where(p =>
|
||||
Vector3.Distance(p.Position, ev.Player.Position) <= HUDInfoConfig.elev_range);
|
||||
|
||||
var p_operator = ev.Player.Nickname ?? "未知";
|
||||
string text = TranslateConfig.elev_template.Replace("{p_operator}", p_operator);
|
||||
foreach (var p in near)
|
||||
{
|
||||
_huds[p].ShowElevator(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
Plugins.cs
19
Plugins.cs
@@ -1,4 +1,5 @@
|
||||
using EasyTools.Configs;
|
||||
using EasyTools.DataBase.Serialization;
|
||||
using EasyTools.Events;
|
||||
using LabApi.Events.CustomHandlers;
|
||||
using LabApi.Features;
|
||||
@@ -20,6 +21,21 @@ namespace EasyTools
|
||||
CustomEventHandler.BadgeConfig = this.LoadConfig<BadgeConfig>("badgeConfig.yml");
|
||||
CustomEventHandler.CustomRoleConfig = this.LoadConfig<CustomRoleConfig>("customRoleConfig.yml");
|
||||
CustomEventHandler.DataBaseConfig = this.LoadConfig<DataBaseConfig>("dataBaseConfig.yml");
|
||||
CustomEventHandler.HUDInfoConfig = this.LoadConfig<HUDInfoConfig>("HUDInfoConfig.yml");
|
||||
|
||||
CustomEventHandler.data_914 = new HintData
|
||||
(
|
||||
CustomEventHandler.HUDInfoConfig._914_x,
|
||||
CustomEventHandler.HUDInfoConfig._914_y,
|
||||
CustomEventHandler.HUDInfoConfig._914_font
|
||||
);
|
||||
|
||||
CustomEventHandler.data_elevator = new HintData
|
||||
(
|
||||
CustomEventHandler.HUDInfoConfig._elev_x,
|
||||
CustomEventHandler.HUDInfoConfig._elev_y,
|
||||
CustomEventHandler.HUDInfoConfig._elev_font
|
||||
);
|
||||
|
||||
if (!Directory.Exists(CustomEventHandler.BadgeConfig.Pach))
|
||||
{
|
||||
@@ -54,6 +70,9 @@ namespace EasyTools
|
||||
CustomHandlersManager.UnregisterEventsHandler(Events);
|
||||
|
||||
Instance = null;
|
||||
|
||||
foreach (var hud in CustomEventHandler._huds.Values) hud.Dispose();
|
||||
CustomEventHandler._huds.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,5 +49,4 @@ EasyTools 是一个基于 LabAPI 的插件,它提供了一些简单的自定
|
||||
## 基于项目
|
||||
- [HelpSense](https://github.com/XLittleLeft/HelpSense) 本项目的基础代码来源
|
||||
- [NewDIR](https://github.com/YF-OFFICE/NewDIR) 称号系统
|
||||
- HUDInfo 914合成提示
|
||||
- UsefulAdditions 快速刷新(快速重生)
|
||||
- HUDInfo 914合成提示, 电梯使用提示
|
||||
|
||||
@@ -50,13 +50,13 @@ namespace EasyTools.Utils
|
||||
// 检测是否正在受伤
|
||||
if (_lastDamageTime.TryGetValue(p, out var lastDamageTime))
|
||||
{
|
||||
if (DateTime.UtcNow - lastDamageTime < TimeSpan.FromSeconds(CustomEventHandler.Config.heal_atk_secend)) { canceled = true; }
|
||||
if (DateTime.UtcNow - lastDamageTime < TimeSpan.FromSeconds(CustomEventHandler.Config.HealATKSecend)) { canceled = true; }
|
||||
}
|
||||
|
||||
if (!canceled && DateTime.UtcNow - last.time > TimeSpan.FromSeconds(CustomEventHandler.Config.heal_scp_secend))
|
||||
if (!canceled && DateTime.UtcNow - last.time > TimeSpan.FromSeconds(CustomEventHandler.Config.HealSCPSecend))
|
||||
{
|
||||
float old_health = p.Health;
|
||||
float new_health = old_health + CustomEventHandler.Config.heal_scp_x;
|
||||
float new_health = old_health + CustomEventHandler.Config.HealSCPQuantity;
|
||||
if (new_health <= p.MaxHealth)
|
||||
{
|
||||
p.Health = new_health;
|
||||
|
||||
Reference in New Issue
Block a user