Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Xmas 2024 from xmas 2023 #325

Merged
merged 27 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
24d6fb5
Scp 559 events (#2345)
VALERA771 Dec 28, 2023
429d7e7
SCP-3114 ragdoll (#2368)
VALERA771 Dec 30, 2023
3b82358
Coffee API (#2360)
VALERA771 Jan 13, 2024
c15031e
Flamingo respawn event (#2362)
VALERA771 Dec 28, 2023
6ab45c1
SpawnReason::ItemUsage
louis1706 Dec 24, 2023
ec08926
Move File to the new place
louis1706 Dec 23, 2024
3699974
Lots of new API (#2342)
VALERA771 Dec 22, 2023
25fb4ea
revert
louis1706 Dec 23, 2024
f8f68a7
push
louis1706 Dec 23, 2024
60103fc
Finish Fix build
louis1706 Dec 23, 2024
090b2c4
fix AmbiguousMatchException
louis1706 Dec 23, 2024
6c0d86c
FindingPosition Fixed
louis1706 Dec 23, 2024
fbc9d9f
OpeningGiftEvent
louis1706 Dec 23, 2024
b45131c
GrantingGift Fix
louis1706 Dec 23, 2024
1feb1d8
Merge branch 'dev' into xmas-2024-from-xmas-2023
louis1706 Dec 25, 2024
5a4d66d
Fix SpawningFlamingos
louis1706 Dec 25, 2024
e00c9eb
DamageType::Scp1507
louis1706 Dec 25, 2024
7993d22
Merge branch 'xmas-2024' into xmas-2024-from-xmas-2023
louis1706 Dec 25, 2024
247f39f
DamageType::Scp956
louis1706 Dec 25, 2024
8814841
Merge branch 'xmas-2024-from-xmas-2023' of https://github.com/louis17…
louis1706 Dec 25, 2024
61afba1
SnowBall
louis1706 Dec 25, 2024
daf010a
Fix NPC not spawning
louis1706 Dec 25, 2024
90559ba
Flamingos
louis1706 Dec 25, 2024
e183f91
Obsolete Coffee because nw didn't added it in game
louis1706 Dec 25, 2024
b0e2aa8
patch fixes and optimization
IRacle1 Dec 26, 2024
26d09d4
flamingo event to right namespace
IRacle1 Dec 26, 2024
5b31a05
or not
IRacle1 Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions EXILED/Exiled.API/Enums/DamageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,20 @@ public enum DamageType
/// Damage caused by the marshmallow man.
/// </summary>
Marshmallow,

/// <summary>
/// Damage caused by <see cref="RoleTypeId.Flamingo"/> ,<see cref="RoleTypeId.AlphaFlamingo"/> or <see cref="RoleTypeId.ZombieFlamingo"/>.
/// </summary>
Scp1507,

/// <summary>
/// Damage caused by Scp956 the pinata.
/// </summary>
Scp956,

/// <summary>
/// Damage caused by <see cref="ItemType.Snowball"/>.
/// </summary>
SnowBall,
}
}
20 changes: 20 additions & 0 deletions EXILED/Exiled.API/Enums/EffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,25 @@ public enum EffectType
/// <see cref="CustomPlayerEffects.Blurred"/>.
/// </summary>
Blurred,

/// <summary>
/// Makes you a flamingo.
/// </summary>
BecomingFlamingo,

/// <summary>
/// Makes you a Child after eating Cake.
/// </summary>
Scp559,

/// <summary>
/// Scp956 found you.
/// </summary>
Scp956Target,

/// <summary>
/// you are snowed.
/// </summary>
Snowed,
}
}
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Enums/SpawnReason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,10 @@ public enum SpawnReason : byte // TOTO: Remove this file and use Basegame
/// The user will be destroyed.
/// </summary>
Destroyed,

/// <summary>
/// The user has been spawn by the usage of an Item.
/// </summary>
ItemUsage,
}
}
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Exiled.API.Extensions
using Enums;

using Features;
using PlayerRoles.PlayableScps.Scp1507;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerStatsSystem;

Expand Down Expand Up @@ -180,6 +181,12 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase)
return DamageType.MicroHid;
case DisruptorDamageHandler:
return DamageType.ParticleDisruptor;
case Scp1507DamageHandler:
return DamageType.Scp1507;
case Scp956DamageHandler:
return DamageType.Scp956;
case SnowballDamageHandler:
return DamageType.SnowBall;
case Scp049DamageHandler scp049DamageHandler:
return scp049DamageHandler.DamageSubType switch
{
Expand Down
4 changes: 4 additions & 0 deletions EXILED/Exiled.API/Extensions/EffectTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public static class EffectTypeExtension
{ EffectType.SeveredEyes, typeof(SeveredEyes) },
{ EffectType.PitDeath, typeof(PitDeath) },
{ EffectType.Blurred, typeof(Blurred) },
{ EffectType.BecomingFlamingo, typeof(BecomingFlamingo) },
{ EffectType.Scp559, typeof(Scp559Effect) },
{ EffectType.Scp956Target, typeof(Scp956Target) },
{ EffectType.Snowed, typeof(Snowed) },
});

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

namespace Exiled.API.Features
{
using System;
using System.Collections.Generic;
using System.Linq;

using Exiled.API.Extensions;
using Exiled.API.Interfaces;
using UnityEngine;

using BaseCoffee = global::Coffee;

/// <summary>
/// A wrapper for coffee cup.
/// </summary>
public class Coffee : IWrapper<BaseCoffee>
{
/// <summary>
/// Gets the <see cref="Dictionary{TKey,TValue}"/> containing <see cref="BaseCoffee"/> to <see cref="Coffee"/>.
/// </summary>
internal static readonly Dictionary<BaseCoffee, Coffee> BaseToWrapper = new();

/// <summary>
/// Initializes a new instance of the <see cref="Coffee"/> class.
/// </summary>
/// <param name="coffee"><inheritdoc cref="Base"/></param>
public Coffee(BaseCoffee coffee)
{
Base = coffee;

BaseToWrapper.Add(coffee, this);
}

/// <summary>
/// Gets or sets an <see cref="IEnumerable{T}"/> of players who cannot interact with coffee cups.
/// </summary>
public static IEnumerable<Player> BlacklistedPlayers
{
get => BaseCoffee.BlacklistedPlayers.Select(Player.Get);
set
{
BaseCoffee.BlacklistedPlayers.Clear();

foreach (Player player in value)
BaseCoffee.BlacklistedPlayers.Add(player.ReferenceHub);
}
}

/// <summary>
/// Gets the list with all available <see cref="Coffee"/> instanses.
/// </summary>
[Obsolete("This list will be empty")]
public static IReadOnlyCollection<Coffee> List => BaseToWrapper.Values;

/// <summary>
/// Gets the base coffee instance.
/// </summary>
public BaseCoffee Base { get; }

/// <summary>
/// Gets or sets a value indicating whether or not coffee has been drunk.
/// </summary>
public bool IsConsumed
{
get => Base.IsConsumed;
set => Base.NetworkIsConsumed = value;
}

/// <summary>
/// Gets or sets text which will be displayed to player when he drinks coffee.
/// </summary>
public CoffeeTranslation CoffeeTranslation
{
get => Base._drinkText;
set => Base._drinkText = value;
}

/// <summary>
/// Gets or sets the author of current <see cref="CoffeeTranslation"/>.
/// </summary>
public string TranslationAuthor
{
get => Base._author;
set => Base._author = value;
}

/// <summary>
/// Gets the color of a drink in a cup.
/// </summary>
public Color DrinkColor => Base._drinkColor;

/// <summary>
/// Gets a <see cref="Coffee"/> given a <see cref="BaseCoffee"/> instance.
/// </summary>
/// <param name="baseCoffee">The <see cref="BaseCoffee"/> instance.</param>
/// <returns>The <see cref="Coffee"/> instance.</returns>
public static Coffee Get(BaseCoffee baseCoffee) => BaseToWrapper.TryGetValue(baseCoffee, out Coffee coffee) ? coffee : new(baseCoffee);

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Coffee"/> matching the condition.
/// </summary>
/// <param name="predicate">The condition to satisfy.</param>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="Coffee"/> matching the condition.</returns>
[Obsolete("The respond list will be empty")]
public static IEnumerable<Coffee> Get(Func<Coffee, bool> predicate) => List.Where(predicate);

/// <summary>
/// Interacts with <see cref="Coffee"/>.
/// </summary>
/// <param name="player">The player who interacts. If <see langword="null"/>, it will be chosen randomly.</param>
public void Interact(Player player = null) => Base.ServerInteract((player ?? Player.Get(x => x.IsHuman).GetRandomValue()).ReferenceHub, byte.MaxValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Exiled.API.Features.DamageHandlers
using Enums;

using Extensions;
using PlayerRoles.PlayableScps.Scp1507;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerRoles.PlayableScps.Scp939;

Expand Down Expand Up @@ -116,6 +117,12 @@ public virtual DamageType Type
return DamageType.Scp939;
case JailbirdDamageHandler:
return DamageType.Jailbird;
case Scp1507DamageHandler:
return DamageType.Scp1507;
case Scp956DamageHandler:
return DamageType.Scp956;
case SnowballDamageHandler:
return DamageType.SnowBall;
case Scp3114DamageHandler scp3114DamageHandler:
return scp3114DamageHandler.Subtype switch
{
Expand Down
4 changes: 4 additions & 0 deletions EXILED/Exiled.API/Features/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ internal static void ClearCache()
Firearm.ItemTypeToFirearmInstance.Clear();
Firearm.BaseCodesValue.Clear();
Firearm.AvailableAttachmentsValue.Clear();

Scp559.CakeToWrapper.Clear();

Coffee.BaseToWrapper.Clear();
}
}
}
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Scp3114Ragdoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public bool IsPlayingAnimation
set => Base._playingAnimation = value;
}
}
}
}
136 changes: 136 additions & 0 deletions EXILED/Exiled.API/Features/Scp559.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// -----------------------------------------------------------------------
// <copyright file="Scp559.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features
{
using System;
using System.Collections.Generic;
using System.Linq;

using Exiled.API.Interfaces;
using MapGeneration;
using UnityEngine;

/// <summary>
/// Represents a cake.
/// </summary>
public class Scp559 : IWrapper<Scp559Cake>, IPosition
{
/// <summary>
/// <see cref="Dictionary{TKey,TValue}"/> <see cref="Scp559Cake"/> to <see cref="Scp559"/>.
/// </summary>
internal static readonly Dictionary<Scp559Cake, Scp559> CakeToWrapper = new();

/// <summary>
/// Initializes a new instance of the <see cref="Scp559"/> class.
/// </summary>
/// <param name="cakeBase">The <see cref="Scp559Cake"/> instance.</param>
public Scp559(Scp559Cake cakeBase)
{
Base = cakeBase;

CakeToWrapper.Add(cakeBase, this);
}

/// <summary>
/// Gets the list with all <see cref="Scp559"/> instances.
/// </summary>
public static IReadOnlyCollection<Scp559> List => CakeToWrapper.Values;

/// <summary>
/// Gets a <see cref="Dictionary{TKey,TValue}"/> with rooms and amount of people in them.
/// </summary>
public static Dictionary<Room, int> PopulatedRooms => Scp559Cake.PopulatedRooms.ToDictionary(x => Room.Get(x.Key), x => x.Value);

/// <summary>
/// Gets a <see cref="Dictionary{TKey,TValue}"/> with spawnpoint in rooms.
/// </summary>
public static Dictionary<RoomName, Vector4> SpawnPositions => Scp559Cake.Spawnpoints;

/// <summary>
/// Gets the list of all available spawnpoints.
/// </summary>
public static List<Vector4> AvailableSpawnpoints => Scp559Cake.PossiblePositions;

/// <summary>
/// Gets or sets offset for spawning near pedestals.
/// </summary>
public static Vector3 PedestalOffset
{
get => Scp559Cake.PedestalOffset;
set => Scp559Cake.PedestalOffset.Set(value.x, value.y, value.z);
}

/// <inheritdoc/>
public Scp559Cake Base { get; }

/// <summary>
/// Gets or sets how many slices are still on cake.
/// </summary>
public byte RemainingSlices
{
get => Base._remainingSlices;
set => Base.Network_remainingSlices = value;
}

/// <summary>
/// Gets or sets a value indicating whether or not cake is spawned.
/// </summary>
public bool IsSpawned
{
get => Base._isSpawned;
set => Base.Network_isSpawned = value;
}

/// <summary>
/// Gets or sets the time how much cake will still be usable.
/// </summary>
public float RemainingTime
{
get => Base._remainingTime;
set => Base._remainingTime = value;
}

/// <summary>
/// Gets or sets the minimum required time for cake to spawn.
/// </summary>
public float RespawnTime
{
get => Base._respawnTime;
set => Base._respawnTime = value;
}

/// <inheritdoc/>
public Vector3 Position
{
get => Base._position;
set => Base.Network_position = value;
}

/// <summary>
/// Gets the <see cref="Scp559"/> by it's game instance.
/// </summary>
/// <param name="cake">Game instance.</param>
/// <returns><see cref="Scp559"/>.</returns>
public static Scp559 Get(Scp559Cake cake) => CakeToWrapper.TryGetValue(cake, out Scp559 scp559) ? scp559 : new Scp559(cake);

/// <summary>
/// Gets the <see cref="IEnumerable{T}"/> of SCP-559 which matches the predicate.
/// </summary>
/// <param name="predicate">Predicate to match.</param>
/// <returns><see cref="IEnumerable{T}"/> of SCP-559.</returns>
public static IEnumerable<Scp559> Get(Func<Scp559, bool> predicate) => List.Where(predicate);

/// <summary>
/// Tries to get available spawn point for SCP-559.
/// </summary>
/// <param name="pos">Position of spawn.</param>
/// <param name="pedestal">Will be pedestal also spawned.</param>
/// <returns><see langword="true"/> if position was found. Otherwise, <see langword="false"/>.</returns>
public bool TryGetSpawnpoint(out Vector3 pos, out bool pedestal) => Base.TryGetSpawnPoint(out pos, out pedestal);
}
}
Loading
Loading