Skip to content

Commit

Permalink
version 1.0.4
Browse files Browse the repository at this point in the history
Add NWAPI-Version[NoMusic]
  • Loading branch information
Supper-Steve authored Jan 7, 2025
1 parent 9411308 commit 11cdf8f
Show file tree
Hide file tree
Showing 16 changed files with 784 additions and 0 deletions.
66 changes: 66 additions & 0 deletions UNGOC-nw/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using PlayerRoles;
using System.Collections.Generic;
using System.ComponentModel;

namespace UNGOC_NW
{
public class Config
{
[Description("启动Debug / Enable Debug")]
public bool Debug { get; set; } = false;
[Description("如果刷新九尾狐,第几次将刷新UNGOC(如果为0则跳过) / If Respawn Ntf , What times will spawn UNGOC? (If 0 , Skip)")]
public ushort SpawnTimes { get; set; } = 1;

[Description("如果刷新UNGOC,启动广播/If Respawn UNGOC , Enable Announcement")]
public bool EnableAnnouncement { get; set; } = true;
[Description("如果刷新UNGOC,启动全图播报Broadcase? /If Respawn UNGOC , Enable Map Broadcast")]
public bool EnableBroadcast { get; set; } = true;
[Description("UNGOC指挥官物品 / UNGOC Captain Item List")]
public List<ItemType> RespawnItems_Captain { get; set; } = new List<ItemType>()
{
ItemType.GunFRMG0,
ItemType.ArmorHeavy,
ItemType.Adrenaline,
ItemType.Medkit,
ItemType.GrenadeHE,
ItemType.KeycardMTFCaptain,
ItemType.Radio
};
[Description("UNGOC列兵物品 / UNGOC Private Personnel Item List")]
public List<ItemType> RespawnItems_Private { get; set; } = new List<ItemType>()
{
ItemType.GunE11SR,
ItemType.ArmorCombat,
ItemType.Adrenaline,
ItemType.Medkit,
ItemType.KeycardMTFOperative,
ItemType.Radio
};
[Description("UNGOC列兵弹药类型 / UNGOC Private Personnel Ammo Type")]
public ItemType RespawnAmmo_Private { get; set; } = ItemType.Ammo556x45;
[Description("UNGOC列兵弹药数量 / UNGOC Private Personnel Ammos")]
public ushort RespawnAmmos_Private { get; set; } = 60;
[Description("UNGOC指挥官弹药类型 / UNGOC Captain Personnel Ammo Type")]
public ItemType RespawnAmmo_Captain { get; set; } = ItemType.Ammo556x45;
[Description("UNGOC指挥官弹药数量 / UNGOC Private Personnel Ammos")]
public ushort RespawnAmmos_Captain { get; set; } = 100;
[Description("UNGOC指挥官启用SCP1853效果 / Enable UNGOC Captain SCP1853 Effect")]
public bool UNGOCCaptain_SCP1853Effect { get; set; } = true;

[Description("UNGOC指挥官角色类型 / UNGOC Captain Role")]
public RoleTypeId UNGOCCaptain_Role { get; set; } = RoleTypeId.NtfSergeant;
[Description("UNGOC列兵角色类型 / UNGOC Private Role")]
public RoleTypeId UNGOCPrivate_Role { get; set; } = RoleTypeId.NtfSpecialist;
[Description("如果刷新UNGOC,则播报CASSIE广播文本 / If Respawn UNGOC , Send CASSIE Announcement text")]
public string Announcement { get; set; } = "Attention all site Foundation personnel . U N G O C personnel into the facility gate B . G O C personnel will help NINETAILEDFOX containment all SCPSubjects";

[Description("如果刷新UNGOC,则播报CASSIE广播本地化文本(语言文本) / If Respawn UNGOC , Send CASSIE Announcement Translation")]
public string Announcement_Translation { get; set; } = "所有设施基金会人员注意<split>UNGOC人员已进入设施B大门,GOC人员将协助九尾狐收容所有SCP项目。";
[Description("如果刷新UNGOC,则全图播报文本 / If Respawn UNGOC , Send Map Broadcast text")]
public string Broadcast { get; set; } = "<size=65%>[<color=#00FFF6>C.A.S.S.I.E.</color>] 全球超自然联盟已进入设施协助基金会收容异常,请所有非战斗人员请撤离设施!</size>";
[Description("UNGOC指挥官信息介绍 / UNGOC Captain Role Info")]
public string UNGOCCaptain_Info { get; set; } = "<size=65%>你是 </size><size=100%><color=#00FFF6>\nUNGOC - 指挥官</color></size>\n<size=45%>与基金会合作\n------清除设施威胁------</size>";
[Description("UNGOC列兵信息介绍 / UNGOC Private Role Info")]
public string UNGOCPrivate_Info { get; set; } = "<size=65%>你是 </size><size=100%><color=#00FFF6>\nUNGOC - 作战专家</color></size>\n<size=45%>与基金会合作\n------清除设施威胁------</size>";
}
}
97 changes: 97 additions & 0 deletions UNGOC-nw/EventHandlers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using CustomPlayerEffects;
using InventorySystem;
using MEC;
using PluginAPI.Core;
using PluginAPI.Core.Attributes;
using PluginAPI.Events;
using System.Collections.Generic;

namespace UNGOC_NW
{
internal class EventHandlers
{
public static List<Player> UNGOC_C = new List<Player>();
[PluginEvent(PluginAPI.Enums.ServerEventType.RoundStart)]
public void OnRoundStart()
{
Respawning.WaveManager.OnWaveSpawned += OnTeamRespawning;
if (Plugin.Config.Debug)
Log.Debug("Round Start!");
SpawnTimes = 0;
UNGOC_C.Clear();
}
public ushort SpawnTimes = 0;
public IEnumerator<float> RespawnTeam(List<Player> Players)
{
if (Plugin.Config.Debug)
Log.Debug(" 刷新UNGOC! / Respawn UNGOC!");
if (Plugin.Config.EnableBroadcast)
Map.Broadcast(7, Plugin.Config.Broadcast);
if (Plugin.Config.EnableAnnouncement)
{
Cassie.Clear();
SteveAPI.Cassie.MessageTranslated(Plugin.Config.Announcement, Plugin.Config.Announcement_Translation);
}
yield return Timing.WaitForSeconds(0.5f);
foreach (Player player in Players)
{
if (UNGOC_C.Count < 1)
{
UNGOC_TeamRespawn.PlayerSpawn_GOCC(player);
}
if (!UNGOC_C.Contains(player))
{
UNGOC_TeamRespawn.PlayerSpawn_GOCP(player);
}
}
UNGOC_C.Clear();
}

private void OnTeamRespawning(Respawning.Waves.SpawnableWaveBase arg1, List<ReferenceHub> arg2)
{
if (Plugin.Config.Debug)
Log.Debug("Respawn Team!");
if (arg1.TargetFaction != PlayerRoles.Faction.FoundationStaff)
return;
SpawnTimes++;
if (SpawnTimes == Plugin.Config.SpawnTimes)
{
var PlayerList = new List<Player>();
foreach(ReferenceHub hub in arg2)
{
PlayerList.Add(Player.Get(hub));
}
Timing.RunCoroutine(RespawnTeam(PlayerList));
}
}

private class UNGOC_TeamRespawn
{
public static void PlayerSpawn_GOCP(Player player)
{
player.SetRole(Plugin.Config.UNGOCPrivate_Role);
player.ClearInventory();
foreach (ItemType item in Plugin.Config.RespawnItems_Private)
{
player.ReferenceHub.inventory.ServerAddItem(item, InventorySystem.Items.ItemAddReason.AdminCommand);
}
player.AddAmmo(Plugin.Config.RespawnAmmo_Private, Plugin.Config.RespawnAmmos_Private);
player.SendBroadcast(Plugin.Config.UNGOCPrivate_Info,5);
}
public static void PlayerSpawn_GOCC(Player player)
{
UNGOC_C.Add(player);
player.SetRole(Plugin.Config.UNGOCCaptain_Role);
player.ClearInventory();
if(Plugin.Config.UNGOCCaptain_SCP1853Effect)
player.EffectsManager.EnableEffect<Scp1853>();
foreach(ItemType item in Plugin.Config.RespawnItems_Captain)
{
player.ReferenceHub.inventory.ServerAddItem(item,InventorySystem.Items.ItemAddReason.AdminCommand);
}
player.AddAmmo(Plugin.Config.RespawnAmmo_Captain, Plugin.Config.RespawnAmmos_Captain);
player.SendBroadcast(Plugin.Config.UNGOCCaptain_Info, 5);
}
}
}
}
21 changes: 21 additions & 0 deletions UNGOC-nw/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using PluginAPI.Core;
using PluginAPI.Core.Attributes;
using PluginAPI.Events;

namespace UNGOC_NW
{
public class Plugin
{
[PluginConfig]
public static Config Config;
private static EventHandlers Handlers { get; set; } = new EventHandlers();
[PluginEntryPoint("UNGOC-NWAPI","1.0.4","SCP:SL UNGOC Plugin","史蒂夫")]
internal void OnEnabled()
{
Log.Info("成功加载UNGOC插件 / Enable Plugin \"UNGOC\" By 史蒂夫");
Log.Info("如果你在某些购物平台购买到这个插件,请立刻退款并投诉!");
Log.Info("插件作者: 萌新社区服务器 & 史蒂夫 ,GitHub仓库:https://github.com/MengXinSheQu/UNGOC");
EventManager.RegisterEvents(Handlers);
}
}
}
33 changes: 33 additions & 0 deletions UNGOC-nw/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("UNGOC-NWAPI")]
[assembly: AssemblyDescription("全球超自然联盟[UNGOC]")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("微软中国")]
[assembly: AssemblyProduct("UNGOC-NWAPI")]
[assembly: AssemblyCopyright("萌新社区服务器 & 史蒂夫 ©2024")]
[assembly: AssemblyTrademark("萌新社区服务器")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("19d00bfa-ffb8-46f2-9e04-099e55599c92")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.1.3")]
[assembly: AssemblyFileVersion("1.0.4.4")]
23 changes: 23 additions & 0 deletions UNGOC-nw/SteveAPI/Cassie.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Respawning;
using SteveAPI.Pools;
using System.Text;

namespace SteveAPI
{
public static class Cassie
{
public static void MessageTranslated(string message, string translation, bool isHeld = false, bool isNoisy = true, bool isSubtitles = true)
{
StringBuilder stringBuilder = StringBuilderPool.Pool.Get();
string[] array = message.Split('\n');
string[] array2 = translation.Split('\n');
for (int i = 0; i < array.Length; i++)
{
stringBuilder.Append(array2[i].Replace(' ', '\u2005') + "<size=0> " + array[i] + " </size><split>");
}
RespawnEffectsController.PlayCassieAnnouncement(stringBuilder.ToString(), isHeld, isNoisy, isSubtitles);
StringBuilderPool.Pool.Return(stringBuilder);
}
public static void Clear() => RespawnEffectsController.ClearQueue();
}
}
8 changes: 8 additions & 0 deletions UNGOC-nw/SteveAPI/Interfaces/IPool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace SteveAPI.Interfaces
{
internal interface IPool<T>
{
T Get();
void Return(T obj);
}
}
18 changes: 18 additions & 0 deletions UNGOC-nw/SteveAPI/Pools/StringBuilderPool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text;
using SteveAPI.Interfaces;

namespace SteveAPI.Pools
{
internal class StringBuilderPool : IPool<StringBuilder>
{
public static StringBuilderPool Pool { get; } = new StringBuilderPool();
public StringBuilder Get()
{
return NorthwoodLib.Pools.StringBuilderPool.Shared.Rent();
}
public void Return(StringBuilder obj)
{
NorthwoodLib.Pools.StringBuilderPool.Shared.Return(obj);
}
}
}
84 changes: 84 additions & 0 deletions UNGOC-nw/UNGOC_NW.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A7ADA447-7248-43C6-810F-4CD1C8033D52}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UNGOC_NW</RootNamespace>
<AssemblyName>UNGOC-NW</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="PluginAPI">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\PluginAPI.dll</HintPath>
</Reference>
<Reference Include="Pooling">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Pooling.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\..\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="EventHandlers.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SteveAPI\Cassie.cs" />
<Compile Include="SteveAPI\Interfaces\IPool.cs" />
<Compile Include="SteveAPI\Pools\StringBuilderPool.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
31 changes: 31 additions & 0 deletions UNGOC.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNGOC", "UNGOC\UNGOC.csproj", "{19D00BFA-FFB8-46F2-9E04-099E55599C92}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNGOC_NW", "UNGOC-nw\UNGOC_NW.csproj", "{A7ADA447-7248-43C6-810F-4CD1C8033D52}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19D00BFA-FFB8-46F2-9E04-099E55599C92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19D00BFA-FFB8-46F2-9E04-099E55599C92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19D00BFA-FFB8-46F2-9E04-099E55599C92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19D00BFA-FFB8-46F2-9E04-099E55599C92}.Release|Any CPU.Build.0 = Release|Any CPU
{A7ADA447-7248-43C6-810F-4CD1C8033D52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7ADA447-7248-43C6-810F-4CD1C8033D52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7ADA447-7248-43C6-810F-4CD1C8033D52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7ADA447-7248-43C6-810F-4CD1C8033D52}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {50BDD41C-D6A4-47F1-94E1-BA1AFC0D9C3A}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 11cdf8f

Please sign in to comment.