style: 统一变量命名规则

This commit is contained in:
3cxc
2026-02-12 18:02:23 +08:00
parent c1ed092161
commit d785df3c53
3 changed files with 28 additions and 24 deletions

View File

@@ -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,37 @@ 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, @$"{Server.Port}.txt");
[Description("管理日志地址")]
public string AdminLogPath { get; set; } = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}\\Admins.txt";
[Description("Management logger settings / 管理日志保存路径")]
public string AdminLogPath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
/// /////////////////////////////////////////////////
[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;
}
}

View File

@@ -52,7 +52,7 @@ namespace EasyTools.Events
Timing.RunCoroutine(Util.AutoServerBroadcast());
}
if (Config.heal_scp)
if (Config.EnableHealSCP)
{
Timing.RunCoroutine(ScpReal.AutoReal());
}
@@ -82,9 +82,10 @@ 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)
{
@@ -102,9 +103,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)
@@ -116,7 +118,7 @@ namespace EasyTools.Events
public override void OnPlayerHurting(PlayerHurtingEventArgs ev)
{
if (Config.harmless_207)
if (Config.Harmless207)
{
if (ev.DamageHandler is UniversalDamageHandler && ev.DamageHandler.DeathScreenText.Contains("SCP-207"))
{
@@ -124,7 +126,7 @@ namespace EasyTools.Events
}
}
if (Config.harmless_1853)
if (Config.Harmless1853)
{
if (ev.DamageHandler is UniversalDamageHandler && ev.DamageHandler.DeathScreenText.Contains("poison"))
{
@@ -258,12 +260,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 +274,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();

View File

@@ -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;