Skip to content

Commit

Permalink
Merge branch 'apis-rework' into devscp244
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 authored Feb 4, 2024
2 parents b3af4a1 + 1dac1ef commit 62e2904
Show file tree
Hide file tree
Showing 441 changed files with 7,991 additions and 4,470 deletions.
33 changes: 5 additions & 28 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[*.cs]
csharp_style_var_for_built_in_types = false:error
csharp_style_var_when_type_is_apparent = false:error
csharp_style_var_elsewhere = false:error

# ReSharper properties
resharper_csharp_max_line_length = 400
dotnet_diagnostic.SA1009.severity = none
Expand Down Expand Up @@ -79,34 +84,6 @@ ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false

[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_add_space = false
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p
ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span, pre, textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal

[{*.markdown,*.md}]
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/Resonance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Exiled Resonance CI

on:
push:
branches:
- apis-rework
pull_request:
branches:
- apis-rework
workflow_dispatch:

env:
EXILED_REFERENCES_URL: https://misaka-zerotwo.github.io/SL-References/Dev.zip
EXILED_REFERENCES_PATH: ${{ github.workspace }}/References
EXILED_DLL_ARCHIVER_URL: https://github.com/Exiled-Team/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe

jobs:

build:

runs-on: windows-latest
# Prevent double running for push & pull_request events from the main repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'Exiled-Team/Exiled'

steps:

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.7.2

- name: Setup Nuget
uses: iRebbok/setup-nuget@master

- uses: actions/checkout@v2.3.4

- name: Get references
shell: pwsh
run: |
Invoke-WebRequest -Uri ${{ env.EXILED_REFERENCES_URL }} -OutFile ${{ github.workspace }}/References.zip
Expand-Archive -Path References.zip -DestinationPath ${{ env.EXILED_REFERENCES_PATH }}
- name: Build
env:
EXILED_REFERENCES: ${{ env.EXILED_REFERENCES_PATH }}
shell: pwsh
run: |
./build.ps1 -BuildNuGet
$File = (Get-ChildItem -Path . -Include 'EXILED.*.nupkg' -Recurse).Name
Out-File -FilePath ${{ github.env }} -InputObject "PackageFile=$File" -Encoding utf-8 -Append
- name: Upload nuget package
uses: actions/upload-artifact@v2
with:
name: ${{ env.PackageFile }}
path: ${{ env.PackageFile }}

- name: Get references
shell: pwsh
run: |
Invoke-WebRequest -Uri ${{ env.EXILED_DLL_ARCHIVER_URL }} -OutFile ${{ github.workspace }}/EXILED-DLL-Archiver.exe
- name: Packaging results as tar.gz
shell: pwsh
run: ./packaging.ps1

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Build Result
path: bin/Release/Exiled.tar.gz
3 changes: 2 additions & 1 deletion EXILED.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@

<PropertyGroup>
<!-- This is the global version and is used for all projects that don't have a version -->
<Version Condition="$(Version) == ''">8.4.3</Version>
<Version Condition="$(Version) == ''">8.7.3</Version>
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
<PublicBeta>false</PublicBeta>

<HarmonyVersion>2.2.2</HarmonyVersion>
<StyleCopVersion>1.1.118</StyleCopVersion>
<SemanticVersioningVersion>2.0.2</SemanticVersioningVersion>
<YamlDotNetVersion>13.7.1</YamlDotNetVersion>

<Copyright>Copyright © $(Authors) 2020 - $([System.DateTime]::Now.ToString("yyyy"))</Copyright>
<RepositoryType>Git</RepositoryType>
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Enums/UEBranchType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Exiled.API.Enums
{
using Exiled.API.Features.Core.Generics;
using Exiled.API.Features.Core.Generic;

/// <summary>
/// All available branch environments.
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Enums/UUKeypressTriggerType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Exiled.API.Enums
{
using Exiled.API.Features.Core.Generics;
using Exiled.API.Features.Core.Generic;

#pragma warning disable SA1310 // Field names should not contain underscore

Expand Down
4 changes: 4 additions & 0 deletions Exiled.API/Exiled.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Exiled.Events</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Exiled.Loader</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopVersion)" IncludeAssets="All" PrivateAssets="All" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)" />
<PackageReference Include="YamlDotNet" Version="$(YamlDotNetVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
48 changes: 48 additions & 0 deletions Exiled.API/Extensions/AnimationCurveExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// -----------------------------------------------------------------------
// <copyright file="AnimationCurveExtensions.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Extensions
{
using System;
using System.Collections.Generic;

using UnityEngine;

/// <summary>
/// A set of extensions for animation curves.
/// </summary>
public static class AnimationCurveExtensions
{
/// <summary>
/// Modify the curve with the amount used.
/// </summary>
/// <param name="curve">The AnimationCurve to modify.</param>
/// <param name="amount">The multiplier number.</param>
/// <returns>The new modified curve.</returns>
public static AnimationCurve Multiply(this AnimationCurve curve, float amount)
{
for (int i = 0; i < curve.length; i++)
curve.keys[i].value *= amount;

return curve;
}

/// <summary>
/// Modify the curve with the amount used.
/// </summary>
/// <param name="curve">The AnimationCurve to modify.</param>
/// <param name="amount">The add number.</param>
/// <returns>The new modified curve.</returns>
public static AnimationCurve Add(this AnimationCurve curve, float amount)
{
for (int i = 0; i < curve.length; i++)
curve.keys[i].value += amount;

return curve;
}
}
}
67 changes: 0 additions & 67 deletions Exiled.API/Extensions/CommonExtensions.cs

This file was deleted.

54 changes: 11 additions & 43 deletions Exiled.API/Extensions/DamageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Exiled.API.Extensions
{
using System.Collections.Generic;
using System.Linq;

using Enums;

Expand All @@ -20,37 +21,6 @@ namespace Exiled.API.Extensions
/// </summary>
public static class DamageTypeExtensions
{
private static readonly Dictionary<byte, DamageType> TranslationIdConversionInternal = new()
{
{ DeathTranslations.Asphyxiated.Id, DamageType.Asphyxiation },
{ DeathTranslations.Bleeding.Id, DamageType.Bleeding },
{ DeathTranslations.Crushed.Id, DamageType.Crushed },
{ DeathTranslations.Decontamination.Id, DamageType.Decontamination },
{ DeathTranslations.Explosion.Id, DamageType.Explosion },
{ DeathTranslations.Falldown.Id, DamageType.Falldown },
{ DeathTranslations.Poisoned.Id, DamageType.Poison },
{ DeathTranslations.Recontained.Id, DamageType.Recontainment },
{ DeathTranslations.Scp049.Id, DamageType.Scp049 },
{ DeathTranslations.Scp096.Id, DamageType.Scp096 },
{ DeathTranslations.Scp173.Id, DamageType.Scp173 },
{ DeathTranslations.Scp207.Id, DamageType.Scp207 },
{ DeathTranslations.Scp939Lunge.Id, DamageType.Scp939 },
{ DeathTranslations.Scp939Other.Id, DamageType.Scp939 },
{ DeathTranslations.Scp3114Slap.Id, DamageType.Scp3114 },
{ DeathTranslations.Tesla.Id, DamageType.Tesla },
{ DeathTranslations.Unknown.Id, DamageType.Unknown },
{ DeathTranslations.Warhead.Id, DamageType.Warhead },
{ DeathTranslations.Zombie.Id, DamageType.Scp0492 },
{ DeathTranslations.BulletWounds.Id, DamageType.Firearm },
{ DeathTranslations.PocketDecay.Id, DamageType.PocketDimension },
{ DeathTranslations.SeveredHands.Id, DamageType.SeveredHands },
{ DeathTranslations.FriendlyFireDetector.Id, DamageType.FriendlyFireDetector },
{ DeathTranslations.UsedAs106Bait.Id, DamageType.FemurBreaker },
{ DeathTranslations.MicroHID.Id, DamageType.MicroHid },
{ DeathTranslations.Hypothermia.Id, DamageType.Hypothermia },
{ DeathTranslations.MarshmallowMan.Id, DamageType.Marshmallow },
};

private static readonly Dictionary<DeathTranslation, DamageType> TranslationConversionInternal = new()
{
{ DeathTranslations.Asphyxiated, DamageType.Asphyxiation },
Expand Down Expand Up @@ -104,7 +74,7 @@ public static class DamageTypeExtensions
/// <summary>
/// Gets conversion information between <see cref="DeathTranslation.Id"/>s and <see cref="DamageType"/>s.
/// </summary>
public static IReadOnlyDictionary<byte, DamageType> TranslationIdConversion => TranslationIdConversionInternal;
public static IReadOnlyDictionary<byte, DamageType> TranslationIdConversion { get; } = TranslationConversionInternal.ToDictionary(x => x.Key.Id, y => y.Value);

/// <summary>
/// Gets conversion information between <see cref="DeathTranslation"/>s and <see cref="DamageType"/>s.
Expand Down Expand Up @@ -199,28 +169,26 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase)

case ScpDamageHandler scpDamageHandler:
{
DeathTranslation translation = DeathTranslations.TranslationsById[scpDamageHandler._translationId];
if (translation.Id == DeathTranslations.PocketDecay.Id)
if (scpDamageHandler._translationId == DeathTranslations.PocketDecay.Id)
return DamageType.Scp106;

return TranslationIdConversion.ContainsKey(translation.Id)
? TranslationIdConversion[translation.Id]
return TranslationIdConversion.ContainsKey(scpDamageHandler._translationId)
? TranslationIdConversion[scpDamageHandler._translationId]
: DamageType.Scp;
}

case UniversalDamageHandler universal:
{
DeathTranslation translation = DeathTranslations.TranslationsById[universal.TranslationId];
if (TranslationIdConversion.ContainsKey(universal.TranslationId))
return TranslationIdConversion[universal.TranslationId];

if (TranslationIdConversion.ContainsKey(translation.Id))
return TranslationIdConversion[translation.Id];

Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(UniversalDamageHandler)} with ID {translation.Id}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs.");
Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(UniversalDamageHandler)} with ID {universal.TranslationId}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs.");
return DamageType.Unknown;
}
}

return DamageType.Unknown;
default:
return DamageType.Unknown;
}
}
}
}
Loading

0 comments on commit 62e2904

Please sign in to comment.