Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 8 additions & 16 deletions SecretAPI/Features/CustomKeycards/CustomMetalKeycardInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,33 @@
/// <summary>
/// Handles info related to <see cref="ItemType.KeycardCustomMetalCase"/>.
/// </summary>
public abstract class CustomMetalKeycardInfo : CustomKeycardInfo
public abstract class CustomMetalKeycardInfo : CustomKeycardInfo, IHolderCardInfo, ILabelCardInfo, ISerialLabelCardInfo
{
/// <inheritdoc />
public override ItemType ItemType => ItemType.KeycardCustomMetalCase;

/// <summary>
/// Gets or sets the name of the holder of the card.
/// </summary>
public abstract string HolderName { get; set; }

/// <summary>
/// Gets or sets the label of the card.
/// </summary>
/// <inheritdoc />
public abstract string CardLabel { get; set; }

/// <summary>
/// Gets or sets the color of the label.
/// </summary>
/// <inheritdoc />
public abstract Color LabelColor { get; set; }

/// <summary>
/// Gets or sets the wear level.
/// </summary>
public abstract byte WearLevel { get; set; }

/// <summary>
/// Gets or sets the label of the serial.
/// </summary>
/// <inheritdoc />
public abstract string SerialLabel { get; set; }

/// <inheritdoc />
public abstract string GetHolderName(Player player);

/// <inheritdoc />
public override KeycardItem GiveKeycard(Player player) => KeycardItem.CreateCustomKeycardMetal(
player,
ItemName,
HolderName,
GetHolderName(player),
CardLabel,
KeycardPermissions,
PermissionsColor,
Expand Down
20 changes: 7 additions & 13 deletions SecretAPI/Features/CustomKeycards/CustomSite02KeycardInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,30 @@
/// <summary>
/// Handles info related to <see cref="ItemType.KeycardCustomSite02"/>.
/// </summary>
public abstract class CustomSite02KeycardInfo : CustomKeycardInfo
public abstract class CustomSite02KeycardInfo : CustomKeycardInfo, IHolderCardInfo, ILabelCardInfo
{
/// <inheritdoc />
public override ItemType ItemType => ItemType.KeycardCustomSite02;

/// <summary>
/// Gets or sets the label of the card.
/// </summary>
/// <inheritdoc />
public abstract string CardLabel { get; set; }

/// <summary>
/// Gets or sets the name of the holder of the card.
/// </summary>
public abstract string HolderName { get; set; }

/// <summary>
/// Gets or sets the color of the label.
/// </summary>
/// <inheritdoc />
public abstract Color LabelColor { get; set; }

/// <summary>
/// Gets or sets the wear level.
/// </summary>
public abstract byte WearLevel { get; set; }

/// <inheritdoc />
public abstract string GetHolderName(Player player);

/// <inheritdoc />
public override KeycardItem GiveKeycard(Player player) => KeycardItem.CreateCustomKeycardSite02(
player,
ItemName,
HolderName,
GetHolderName(player),
CardLabel,
KeycardPermissions,
KeycardColor,
Expand Down
16 changes: 6 additions & 10 deletions SecretAPI/Features/CustomKeycards/CustomTaskForceKeycardInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@
/// <summary>
/// Handles info related to <see cref="ItemType.KeycardCustomTaskForce"/>.
/// </summary>
public abstract class CustomTaskForceKeycardInfo : CustomKeycardInfo
public abstract class CustomTaskForceKeycardInfo : CustomKeycardInfo, IHolderCardInfo, ISerialLabelCardInfo
{
/// <inheritdoc />
public override ItemType ItemType => ItemType.KeycardCustomTaskForce;

/// <summary>
/// Gets or sets the name of the holder of the card.
/// </summary>
public abstract string HolderName { get; set; }

/// <summary>
/// Gets or sets the label of the serial.
/// </summary>
/// <inheritdoc/>
public abstract string SerialLabel { get; set; }

/// <summary>
/// Gets or sets rank index.
/// </summary>
public abstract int RankIndex { get; set; }

/// <inheritdoc />
public abstract string GetHolderName(Player player);

/// <inheritdoc />
public override KeycardItem GiveKeycard(Player player) => KeycardItem.CreateCustomKeycardTaskForce(
player,
ItemName,
HolderName,
GetHolderName(player),
KeycardPermissions,
KeycardColor,
PermissionsColor,
Expand Down
17 changes: 17 additions & 0 deletions SecretAPI/Features/CustomKeycards/IHolderCardInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace SecretAPI.Features.CustomKeycards
{
using LabApi.Features.Wrappers;

/// <summary>
/// Interface for keycards with a Holder Name.
/// </summary>
public interface IHolderCardInfo
{
/// <summary>
/// Gets a holder name based on a player.
/// </summary>
/// <param name="player">The player to get holder name based on.</param>
/// <returns>The holder name to give.</returns>
public string GetHolderName(Player player);
}
}
20 changes: 20 additions & 0 deletions SecretAPI/Features/CustomKeycards/ILabelCardInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace SecretAPI.Features.CustomKeycards
{
using UnityEngine;

/// <summary>
/// Interface for cards with a Label.
/// </summary>
public interface ILabelCardInfo
{
/// <summary>
/// Gets or sets the label of the card.
/// </summary>
public string CardLabel { get; set; }

/// <summary>
/// Gets or sets the color of the label.
/// </summary>
public Color LabelColor { get; set; }
}
}
13 changes: 13 additions & 0 deletions SecretAPI/Features/CustomKeycards/ISerialLabelCardInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace SecretAPI.Features.CustomKeycards
{
/// <summary>
/// Interface for cards with a Serial Label.
/// </summary>
public interface ISerialLabelCardInfo
{
/// <summary>
/// Gets or sets the label of the serial.
/// </summary>
public string SerialLabel { get; set; }
}
}