Skip to content

Commit

Permalink
添加了一个新的功能,给予玩家状态
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl-Frellett authored Sep 7, 2024
1 parent d8fdad2 commit ff5af46
Show file tree
Hide file tree
Showing 13 changed files with 545 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
using Exiled.API.Features;
using Exiled.API.Enums;
using CustomPlayerEffects;
using System;
using InventorySystem.Items.Usables.Scp244.Hypothermia;

namespace JBAPI.Effect
{
public static class Effect
{
/// <summary>
/// 这是为指定添加效果,目前它处于测试效果,所有效果均源自于“EffectType”枚举
/// </summary>
/// <param name="玩家"></param>
/// <param name="效果类型"></param>
/// <param name="持续时间"></param>
/// <exception cref="ArgumentException"></exception>
public static void AddEffects(this Player 玩家, EffectType 效果类型, float 持续时间)
{
switch (效果类型)
{
case EffectType.AmnesiaItems:
玩家.EnableEffect<AmnesiaItems>(持续时间);
break;
case EffectType.AmnesiaVision:
玩家.EnableEffect<AmnesiaVision>(持续时间);
break;
case EffectType.AntiScp207:
玩家.EnableEffect<AntiScp207>(持续时间);
break;
case EffectType.Asphyxiated:
玩家.EnableEffect<Asphyxiated>(持续时间);
break;
case EffectType.CardiacArrest:
玩家.EnableEffect<CardiacArrest>(持续时间);
break;
case EffectType.Bleeding:
玩家.EnableEffect<Bleeding>(持续时间);
break;
case EffectType.Blinded:
玩家.EnableEffect<Blinded>(持续时间);
break;
case EffectType.BodyshotReduction:
玩家.EnableEffect<BodyshotReduction>(持续时间);
break;
case EffectType.Burned:
玩家.EnableEffect<Burned>(持续时间);
break;
case EffectType.Concussed:
玩家.EnableEffect<Concussed>(持续时间);
break;
case EffectType.Corroding:
玩家.EnableEffect<Corroding>(持续时间);
break;
case EffectType.DamageReduction:
玩家.EnableEffect<DamageReduction>(持续时间);
break;
case EffectType.Deafened:
玩家.EnableEffect<Deafened>(持续时间);
break;
case EffectType.Decontaminating:
玩家.EnableEffect<Decontaminating>(持续时间);
break;
case EffectType.Disabled:
玩家.EnableEffect<Disabled>(持续时间);
break;
case EffectType.Ensnared:
玩家.EnableEffect<Ensnared>(持续时间);
break;
case EffectType.Exhausted:
玩家.EnableEffect<Exhausted>(持续时间);
break;
case EffectType.Flashed:
玩家.EnableEffect<Flashed>(持续时间);
break;
case EffectType.FogControl:
玩家.EnableEffect<FogControl>(持续时间);
break;
case EffectType.Ghostly:
玩家.EnableEffect<Ghostly>(持续时间);
break;
case EffectType.Hemorrhage:
玩家.EnableEffect<Hemorrhage>(持续时间);
break;
case EffectType.Hypothermia:
玩家.EnableEffect<Hypothermia>(持续时间);
break;
case EffectType.InsufficientLighting:
玩家.EnableEffect<InsufficientLighting>(持续时间);
break;
case EffectType.Invigorated:
玩家.EnableEffect<Invigorated>(持续时间);
break;
case EffectType.Invisible:
玩家.EnableEffect<Invisible>(持续时间);
break;
case EffectType.MovementBoost:
玩家.EnableEffect<MovementBoost>(持续时间);
break;
case EffectType.None:
break;
case EffectType.PocketCorroding:
玩家.EnableEffect<PocketCorroding>(持续时间);
break;
case EffectType.Poisoned:
玩家.EnableEffect<Poisoned>(持续时间);
break;
case EffectType.RainbowTaste:
玩家.EnableEffect<RainbowTaste>(持续时间);
break;
case EffectType.Scanned:
玩家.EnableEffect<Scanned>(持续时间);
break;
case EffectType.Scp1853:
玩家.EnableEffect<Scp1853>(持续时间);
break;
case EffectType.Scp207:
玩家.EnableEffect<Scp207>(持续时间);
break;
case EffectType.SeveredHands:
玩家.EnableEffect<SeveredHands>(持续时间);
break;
case EffectType.SilentWalk:
玩家.EnableEffect<SilentWalk>(持续时间);
break;
case EffectType.SinkHole:
玩家.EnableEffect<Sinkhole>(持续时间);
break;
case EffectType.Slowness:
玩家.EnableEffect<Slowness>(持续时间);
break;
case EffectType.SoundtrackMute:
玩家.EnableEffect<SoundtrackMute>(持续时间);
break;
case EffectType.SpawnProtected:
玩家.EnableEffect<SpawnProtected>(持续时间);
break;
case EffectType.Stained:
玩家.EnableEffect<Stained>(持续时间);
break;
case EffectType.Strangled:
玩家.EnableEffect<Strangled>(持续时间);
break;
case EffectType.Traumatized:
玩家.EnableEffect<Traumatized>(持续时间);
break;
case EffectType.Vitality:
玩家.EnableEffect<Vitality>(持续时间);
break;
default:
throw new ArgumentException("从未见过的效果类型:" + 效果类型.ToString());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Exiled.API.Features;
using JBAPI.Log;
using JBPI.Log;
using MEC;
using RueI.Displays;
using RueI.Elements;
using System.Collections.Generic;

namespace JBAPI.hint
{
public static class PosRuelHint
{
public static class 显示中心
{
private static Dictionary<ReferenceHub, Display> 显示 = new Dictionary<ReferenceHub, Display>();

public static Display GetOrCreateDisplay(ReferenceHub hub)
{
if (!显示.ContainsKey(hub))
{
显示[hub] = new Display(hub);
}
return 显示[hub];
}
}

/// <summary>
/// 一个RuelHint的变种,常用于如"bc","经验提示"之类的不允许重叠的Hint
/// </summary>
/// <param name="玩家"></param>
/// <param name="位置"></param>
/// <param name="文本"></param>
/// <param name="时间"></param>
public static void PosHint(this Player 玩家, float 位置, string 文本, int 时间 = 5)
{
if (玩家 != null && 玩家.ReferenceHub != null)
{
Display 显示 = 显示中心.GetOrCreateDisplay(玩家.ReferenceHub);

float 向下的位置 = -显示.Elements.Count * 30f;

SetElement 元素 = new SetElement(位置 + 向下的位置, 文本)
{
Position = 位置 + 向下的位置,
};

显示.Elements.Add(元素);

显示.Update();

Timing.CallDelayed(时间, () =>
{
显示.Elements.Remove(元素);
显示.Update();
});
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Exiled.API.Features;
using JBPI.Log;
using MEC;
using RueI.Displays;
using RueI.Elements;
using System.Collections.Generic;

namespace JBAPI.hint
{
public static class _RuelHint
{
public static class 显示中心
{
private static Dictionary<ReferenceHub, Display> 显示 = new Dictionary<ReferenceHub, Display>();

public static Display GetOrCreateDisplay(ReferenceHub hub)
{
if (!显示.ContainsKey(hub))
{
显示[hub] = new Display(hub);
}
return 显示[hub];
}
}

/// <summary>
/// RuelHint,多显示框架
/// </summary>
/// <param name="玩家"></param>
/// <param name="位置"></param>
/// <param name="文本"></param>
/// <param name="时间"></param>
public static void RuelHint(this Player 玩家, float 位置, string 文本, int 时间 = 5)
{
if (玩家 != null && 玩家.ReferenceHub != null)
{
Display 显示 = 显示中心.GetOrCreateDisplay(玩家.ReferenceHub);

SetElement 元素 = new SetElement(位置, 文本)
{
Position = 位置,
};

显示.Elements.Add(元素);

显示.Update();

Timing.CallDelayed(时间, () =>
{
显示.Elements.Remove(元素);
显示.Update();
});
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Exiled.API.Features;
using JBAPI.Effect;
using JBPI.Log;
using MEC;

namespace JBAPI.Tag
{
public static class Onlycolor
{
/// <summary>
/// 这是单色称号的API 您可以对指定的玩家进行添加称号
/// </summary>
/// <param name="玩家"></param>
/// <param name="文本"></param>
/// <param name="颜色"></param>
public static void ORTag(this Player 玩家, string 文本, string 颜色)
{
Timing.CallContinuously(2f, () =>
{
玩家.RankName = 文本;
玩家.RankColor = 颜色;
ServerCC.日志($"JBAPI.OnlyColor调用 玩家 {玩家.Nickname} ({玩家.UserId})");
});
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Exiled.API.Features;
using UnityEngine;
using JBAPI.UnityScript;
using JBPI.Log;
using MEC;

namespace JBAPI.Tag
{
public static class somecolor
{
/// <summary>
/// 存储可用颜色
/// </summary>
private static readonly string[] 颜色 = new[]
{
"pink", "red", "brown", "silver",
"light_green", "crimson", "cyan",
"aqua","deep_pink","tomato",
"yellow","magenta","blue_green",
"orange","lime","green",
"emerald","carmine","nickel",
"mint","army_green","pumpkin"
};
/// <summary>
/// 彩色称号,您可以给予指定玩家一个可以不断变换颜色的称号
/// </summary>
/// <param name="玩家"></param>
/// <param name="文本"></param>
/// <param name="频率"></param>
/// <param name="是否启用"></param>
public static void RTag(this Player 玩家, string 文本, long 频率, bool 是否启用)
{
Timing.CallContinuously(2f, () =>
{
玩家.RankName = 文本;
if (!是否启用)
{
var 神威 = 玩家.GameObject.GetComponent<TagController>();
if (神威 != null)
{
Object.Destroy(神威);
}
玩家.RankColor = "red";
return;
}

var 霸王龙 = 玩家.GameObject.GetComponent<TagController>();

ServerCC.日志($"JBAPI.somecolor调用 玩家 {玩家.Nickname} ({玩家.UserId})");


if (霸王龙 == null)
{
霸王龙 = 玩家.GameObject.AddComponent<TagController>();
霸王龙.Colors = 颜色;
霸王龙.Interval = 频率;//孩子,时间越快服务器越容易崩,如果你改了,服务器爆炸概不负责
}

});
}
}
}
Loading

0 comments on commit ff5af46

Please sign in to comment.