-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
334 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30611.23 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CassieFacilityScan", "CassieFacilityScan\CassieFacilityScan.csproj", "{2910A33D-86A9-44DB-ACFB-B8A1A5DFAEE0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2910A33D-86A9-44DB-ACFB-B8A1A5DFAEE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2910A33D-86A9-44DB-ACFB-B8A1A5DFAEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2910A33D-86A9-44DB-ACFB-B8A1A5DFAEE0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2910A33D-86A9-44DB-ACFB-B8A1A5DFAEE0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {07A2ABA1-34F5-4985-9A1A-34170E56FF00} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using MEC; | ||
|
||
namespace CassieFacilityScan | ||
{ | ||
using System; | ||
using Exiled.API.Enums; | ||
using Exiled.API.Features; | ||
using Server = Exiled.Events.Handlers.Server; | ||
|
||
public class CassieFacilityScan : Plugin<Config> | ||
{ | ||
private static readonly Lazy<CassieFacilityScan> LazyInstance = new Lazy<CassieFacilityScan>(() => new CassieFacilityScan()); | ||
public static CassieFacilityScan Instance => LazyInstance.Value; | ||
|
||
public override PluginPriority Priority { get; } = PluginPriority.Medium; | ||
|
||
private Handlers.Server server; | ||
|
||
private CassieFacilityScan() {} | ||
|
||
public override void OnEnabled() | ||
{ | ||
base.OnEnabled(); | ||
|
||
RegisterEvents(); | ||
} | ||
|
||
public override void OnDisabled() | ||
{ | ||
base.OnDisabled(); | ||
|
||
UnregisterEvents(); | ||
} | ||
|
||
public void RegisterEvents() | ||
{ | ||
server = new Handlers.Server(); | ||
|
||
Server.RoundStarted += server.OnRoundStarted; | ||
} | ||
|
||
public void UnregisterEvents() | ||
{ | ||
Server.RoundStarted -= server.OnRoundStarted; | ||
|
||
server = null; | ||
|
||
// Kill the coroutines when disabled | ||
Timing.KillCoroutines("cassiefacilityscan_timer"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?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>{2910A33D-86A9-44DB-ACFB-B8A1A5DFAEE0}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CassieFacilityScan</RootNamespace> | ||
<AssemblyName>CassieFacilityScan</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> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</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> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>..\..\EXILED\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp-firstpass"> | ||
<HintPath>..\..\..\..\..\Games\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp_publicized"> | ||
<HintPath>..\..\EXILED\Assembly-CSharp_publicized.dll</HintPath> | ||
</Reference> | ||
<Reference Include="CommandSystem.Core"> | ||
<HintPath>..\..\..\..\..\Games\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\CommandSystem.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Exiled.API"> | ||
<HintPath>..\..\EXILED\EXILED\Plugins\dependencies\Exiled.API.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Exiled.Events"> | ||
<HintPath>..\..\EXILED\EXILED\Plugins\Exiled.Events.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Exiled.Loader"> | ||
<HintPath>..\..\EXILED\EXILED\Exiled.Loader.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Mirror"> | ||
<HintPath>..\..\..\..\..\Games\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.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.CoreModule"> | ||
<HintPath>..\..\..\..\..\Games\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="CassieFacilityScan.cs" /> | ||
<Compile Include="Config.cs" /> | ||
<Compile Include="Extention.cs" /> | ||
<Compile Include="Handlers\Server.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.ComponentModel; | ||
|
||
namespace CassieFacilityScan | ||
{ | ||
using Exiled.API.Interfaces; | ||
public sealed class Config : IConfig | ||
{ | ||
public bool IsEnabled { get; set; } = true; | ||
|
||
[Description("Start of the scan before every class is listed.")] | ||
public string ScanBegin { get; set; } = | ||
"BELL_START ATTENTION . COMMENCING FACILITY SCAN .g4 . . . SCAN COMPLETED . DETECTED"; | ||
|
||
|
||
[Description("Name of class d personnel count. (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string ClassDName { get; set; } = "CLASSD PERSONNEL"; | ||
|
||
[Description("Name of science personnel count. (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string ScientistName { get; set; } = "SCIENCE PERSONNEL"; | ||
|
||
[Description("Name of mtf unit count. (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string MtfName { get; set; } = "MTFUNIT{s}"; | ||
|
||
[Description("Name of scps. (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string ScpName { get; set; } = "NOT CONTAINED SCPSUBJECT{s}"; | ||
|
||
[Description("Name of choas insurgency count. (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string ChoasInsurgencyName { get; set; } = "CHAOSINSURGENCY"; | ||
|
||
[Description("Name of serpents hand count. (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string SerpentsHandName { get; set; } = "SERPENTS HAND"; | ||
|
||
[Description("End of the scan message after every class is listed.")] | ||
public string ScanEnd { get; set; } = "BELL_END"; | ||
|
||
[Description("Boolean wether chaos insurgency and serpents hand should be combined into one count.")] | ||
public bool CombineIntoUnauthorizedLifeForms { get; set; } = false; | ||
|
||
[Description("Name of unauthorized life forms (chaos insurgency and serpents hand) (Use {s} for optional s, if count is greater than 1 or zero)")] | ||
public string UnauthorizedLifeFormsName { get; set; } = "UNAUTHORIZED LIFE FORM{s}"; | ||
|
||
[Description("Instead of saying 'no' when none of one class is detected, say 'zero'.")] | ||
public bool SayZeroInsteadOfNo { get; set; } = false; | ||
|
||
[Description("Broadcast the message at start of the round.")] | ||
public bool BroadcastAtStartOfRound { get; set; } = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Linq; | ||
|
||
namespace CassieFacilityScan | ||
{ | ||
using Exiled.API.Features; | ||
using MEC; | ||
using System.Collections.Generic; | ||
public static class Extension | ||
{ | ||
public static IEnumerator<float> DelayedCassieMessage(string msg, bool makeHold, bool makeNoise, float delay) | ||
{ | ||
yield return Timing.WaitForSeconds(delay); | ||
Cassie.Message(msg, makeHold, makeNoise); | ||
} | ||
|
||
public static string GenerateCassieMessage() | ||
{ | ||
int classDCount = Player.Get(RoleType.ClassD).Count(); | ||
int scientistCount = Player.Get(RoleType.Scientist).Count(); | ||
int mtfCount = Player.Get(Team.MTF).Count(); | ||
int scpCount = Player.Get(Team.SCP).Count(); | ||
int chaosInsurgencyCount = Player.Get(Team.CHI).Count(); | ||
int serpentsHandCount = Player.Get(Team.TUT).Count(); // Tutorial is Serpents Hand | ||
|
||
string message = $"{CassieFacilityScan.Instance.Config.ScanBegin} "; | ||
|
||
message += GenerateClassMessage(classDCount, CassieFacilityScan.Instance.Config.ClassDName); | ||
message += GenerateClassMessage(scientistCount, CassieFacilityScan.Instance.Config.ScientistName); | ||
message += GenerateClassMessage(mtfCount, CassieFacilityScan.Instance.Config.MtfName); | ||
message += GenerateClassMessage(scpCount, CassieFacilityScan.Instance.Config.ScpName); | ||
|
||
if (CassieFacilityScan.Instance.Config.CombineIntoUnauthorizedLifeForms) | ||
{ | ||
int unauthorizedLifeForms = chaosInsurgencyCount + serpentsHandCount; | ||
message += GenerateClassMessage(unauthorizedLifeForms, | ||
CassieFacilityScan.Instance.Config.UnauthorizedLifeFormsName); | ||
} | ||
else | ||
{ | ||
message += GenerateClassMessage(chaosInsurgencyCount, CassieFacilityScan.Instance.Config.ChoasInsurgencyName); | ||
message += GenerateClassMessage(serpentsHandCount, CassieFacilityScan.Instance.Config.SerpentsHandName); | ||
} | ||
|
||
message += $"{CassieFacilityScan.Instance.Config.ScanEnd}"; | ||
|
||
Log.Info("Broadcasting facility scan message."); | ||
return message; | ||
} | ||
|
||
public static string GenerateClassMessage(int classCount, string classStringConfig) | ||
{ | ||
return | ||
$"{(classCount > 0 ? classCount.ToString() : (CassieFacilityScan.Instance.Config.SayZeroInsteadOfNo ? "0" : "NO"))} {classStringConfig.Replace("{s}", (classCount == 1 ? "" : "s"))} . "; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections; | ||
using Exiled.API.Features; | ||
using MEC; | ||
|
||
namespace CassieFacilityScan.Handlers | ||
{ | ||
using Exiled.Events.EventArgs; | ||
using System.Collections.Generic; | ||
|
||
class Server | ||
{ | ||
public void OnRoundStarted() | ||
{ | ||
// Kill old corountines before creating new one | ||
Timing.KillCoroutines("cassiefacilityscan_timer"); | ||
Timing.RunCoroutine(CassieFacilityScanMessage(), "cassiefacilityscan_timer"); | ||
} | ||
|
||
public static IEnumerator<float> CassieFacilityScanMessage() | ||
{ | ||
yield return Timing.WaitForSeconds(0.1f); | ||
|
||
if (CassieFacilityScan.Instance.Config.BroadcastAtStartOfRound) | ||
{ | ||
Timing.RunCoroutine(Extension.DelayedCassieMessage(Extension.GenerateCassieMessage(), false, false, 0), "cassiefacilityscan_timer"); | ||
} | ||
|
||
while (RoundSummary.RoundInProgress()) | ||
{ | ||
yield return Timing.WaitForSeconds(480f); | ||
Timing.RunCoroutine(Extension.DelayedCassieMessage(Extension.GenerateCassieMessage(), false, false, 0), | ||
"cassiefacilityscan_timer"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("CassieFacilityScan")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("CassieFacilityScan")] | ||
[assembly: AssemblyCopyright("Copyright © 2020")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("2910a33d-86a9-44db-acfb-b8a1a5dfaee0")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |