Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakuliv authored Mar 5, 2021
1 parent d062bd5 commit d96d927
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scp_682.sln
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.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "scp_682", "scp_682\scp_682.csproj", "{090755B8-595A-40DA-9986-044FB19E65CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{090755B8-595A-40DA-9986-044FB19E65CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{090755B8-595A-40DA-9986-044FB19E65CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{090755B8-595A-40DA-9986-044FB19E65CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{090755B8-595A-40DA-9986-044FB19E65CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5A086530-19B3-41BA-89BF-6583CE55C1C7}
EndGlobalSection
EndGlobal
34 changes: 34 additions & 0 deletions scp_682/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Exiled.API.Interfaces;

namespace scp_682
{
public class Config : IConfig
{
public bool IsEnabled { get; set; } = true;
public int spawn_chance { get; set; } = 100;
public string spawn_message { get; set; } = "<b>You are <color=red>SCP-682</color></b>";
public ushort spawn_message_duration { get; set; } = 10;
[Description("is the SCP-682 supposed to kill with one bite")]
public bool can_kill_on_oneshot { get; set; } = true;
[Description("whether SCP-682 is to be able to Pry Gates?")]
public bool can_PryGates { get; set; } = true;
[Description("how much hp should SCP-682 get when he damage a human")]
public int heal_hp_when_eat { get; set; } = 5;
[Description("max hp")]
public int MaxHP { get; set; } = 2200;
[Description("every how many seconds SCP-682 health should regenerate?")]
public int heal_time { get; set; } = 5;
[Description("how much hp should be regenerated?")]
public int heal_hp { get; set; } = 5;
[Description("can scp 682 destroy doors?")]
public bool scp682_can_destroy_door { get; set; } = true;
[Description("how many % chance should SCP-682 have to destroy the door")]
public int scp682_destroy_door_chance { get; set; } = 100;
}
}
122 changes: 122 additions & 0 deletions scp_682/EventHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Exiled.API.Enums;
using Exiled.API.Extensions;
using Exiled.API.Features;
using Exiled.Events.EventArgs;
using Interactables.Interobjects;
using MEC;


namespace scp_682
{
public class EventHandler
{
public List<CoroutineHandle> coroutines = new List<CoroutineHandle>();
public static List<string> scp682 = new List<string>();

public void OnDoorAccess(InteractingDoorEventArgs ev)
{
if (scp682.Contains(ev.Player.UserId) && ev.Door is PryableDoor pdoor)
{
if (SCP682.Singleton.Config.can_PryGates == true)
{
pdoor.TryPryGate();
}
}
else if (SCP682.Singleton.Config.scp682_can_destroy_door == true && scp682.Contains(ev.Player.UserId))
{
int d = new Random().Next(0, 100);
if (d <= SCP682.Singleton.Config.scp682_destroy_door_chance)
{
ev.Door.BreakDoor();
}
}
}

public void OnPlayerDie(DiedEventArgs ev)
{
if (ev.Target.Role == RoleType.Scp93989)
{
if (scp682.Contains(ev.Target.UserId))
{
scp682.Remove(ev.Target.UserId);
ev.Target.RefreshTag();
}
}
}

public void OnPlayerHurt(HurtingEventArgs ev)
{
if (scp682.Contains(ev.Attacker.UserId) && ev.Target.Team != Team.SCP && ev.DamageType != DamageTypes.Nuke && ev.DamageType != DamageTypes.Wall && ev.DamageType != DamageTypes.Tesla)
{
if (SCP682.Singleton.Config.can_kill_on_oneshot == true)
{
ev.Target.Kill(DamageTypes.Scp939);
}
if (ev.Attacker.Health < SCP682.Singleton.Config.MaxHP)
{
ev.Attacker.Health = ev.Attacker.Health + SCP682.Singleton.Config.heal_hp_when_eat;
}
}
}

public void OnSetRole(ChangingRoleEventArgs ev)
{
if (ev.NewRole == RoleType.Scp93989 && !scp682.Contains(ev.Player.UserId))
{
int s = new Random().Next(0, 100);
if (s <= SCP682.Singleton.Config.spawn_chance)
{
ev.Player.MaxHealth = SCP682.Singleton.Config.MaxHP;
ev.Player.Health = SCP682.Singleton.Config.MaxHP;
ev.Player.Broadcast(SCP682.Singleton.Config.spawn_message_duration, SCP682.Singleton.Config.spawn_message);
ev.Player.Scale = new UnityEngine.Vector3(1.30f, 1, 1.50f);
scp682.Add(ev.Player.UserId);
coroutines.Add(Timing.RunCoroutine(HealSCP682()));
Timing.CallDelayed(0.1f, () =>
{
ev.Player.SetRank("", "default");
});
Timing.CallDelayed(0.5f, () =>
{
ev.Player.RankName = "SCP-682";
ev.Player.RankColor = "red";
});
}
}
else if (scp682.Contains(ev.Player.UserId))
{
scp682.Remove(ev.Player.UserId);
ev.Player.RefreshTag();
ev.Player.Scale = new UnityEngine.Vector3(1, 1, 1);
foreach (CoroutineHandle coroutine in coroutines)
{
Timing.KillCoroutines(coroutine);
}
coroutines.Clear();
}
}
public IEnumerator<float> HealSCP682()
{
for (; ; )
{
foreach (Player a in Player.List)
{
if (a.Role == RoleType.Scp93989 && scp682.Contains(a.UserId) && a.Health < SCP682.Singleton.Config.MaxHP)
{
a.Health = a.Health + SCP682.Singleton.Config.heal_hp;
}
}
yield return Timing.WaitForSeconds(SCP682.Singleton.Config.heal_time);
}
}
public void OnRoundEnd(RoundEndedEventArgs ev)
{
scp682.Clear();
}
}
}
26 changes: 26 additions & 0 deletions scp_682/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Exiled.API.Features;

namespace scp_682
{
public static class Extensions
{
internal static bool hasTag;
internal static bool isHidden;

public static void SetRank(this Player player, string rank, string color = "default")
{
player.ReferenceHub.serverRoles.NetworkMyText = rank;
player.ReferenceHub.serverRoles.NetworkMyColor = color;
}

public static void RefreshTag(this Player player)
{
player.ReferenceHub.serverRoles.HiddenBadge = null; player.ReferenceHub.serverRoles.RpcResetFixed(); player.ReferenceHub.serverRoles.RefreshPermissions(true);
}
}
}
36 changes: 36 additions & 0 deletions scp_682/Properties/AssemblyInfo.cs
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;

// Ogólne informacje o zestawie są kontrolowane poprzez następujący
// zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje
// powiązane z zestawem.
[assembly: AssemblyTitle("scp_682")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("scp_682")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne
// dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z
// COM, ustaw wartość true dla atrybutu ComVisible tego typu.
[assembly: ComVisible(false)]

// Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM
[assembly: Guid("090755b8-595a-40da-9986-044fb19e65cb")]

// Informacje o wersji zestawu zawierają następujące cztery wartości:
//
// Wersja główna
// Wersja pomocnicza
// Numer kompilacji
// Poprawka
//
// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
// przy użyciu symbolu „*”, tak jak pokazano poniżej:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
49 changes: 49 additions & 0 deletions scp_682/SCP682.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Linq;
using Exiled.API.Enums;
using Exiled.API.Features;
using Exiled.Loader;
using System.Reflection;

using PlayerEv = Exiled.Events.Handlers.Player;
using ServerEv = Exiled.Events.Handlers.Server;
using MEC;

namespace scp_682
{
public class SCP682 : Plugin<Config>
{
public override string Name { get; } = "SCP-682";
public override string Author { get; } = "Cwaniak U.G";
public override Version Version => new Version(1, 0, 0);
public override Version RequiredExiledVersion => new Version(2, 3, 4);

private EventHandler handler;

public override void OnEnabled()
{
handler = new EventHandler();
SCP682.Singleton = this;
ServerEv.RoundEnded += handler.OnRoundEnd;
PlayerEv.ChangingRole += handler.OnSetRole;
PlayerEv.Hurting += handler.OnPlayerHurt;
PlayerEv.Died += handler.OnPlayerDie;
PlayerEv.InteractingDoor += handler.OnDoorAccess;

base.OnEnabled();
}

public override void OnDisabled()
{
ServerEv.RoundEnded -= handler.OnRoundEnd;
PlayerEv.ChangingRole -= handler.OnSetRole;
PlayerEv.Hurting -= handler.OnPlayerHurt;
PlayerEv.Died -= handler.OnPlayerDie;
PlayerEv.InteractingDoor -= handler.OnDoorAccess;
handler = null;

base.OnDisabled();
}
public static SCP682 Singleton;
}
}
4 changes: 4 additions & 0 deletions scp_682/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EXILED" version="2.3.4" targetFramework="net472" />
</packages>
93 changes: 93 additions & 0 deletions scp_682/scp_682.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?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>{090755B8-595A-40DA-9986-044FB19E65CB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>scp_682</RootNamespace>
<AssemblyName>scp_682</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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>
</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>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=2.3.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Bootstrap, Version=2.3.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="Exiled.CreditTags, Version=2.3.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=2.3.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=2.3.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=2.3.4.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.2.3.4\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\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">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="EventHandler.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="SCP682.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

0 comments on commit d96d927

Please sign in to comment.