-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
f3f64fd
commit 0c2e1e6
Showing
25 changed files
with
959 additions
and
400 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
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
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
81 changes: 81 additions & 0 deletions
81
UncreatedWarfare/Events/Models/Players/PlayerChatRequested.cs
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 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Uncreated.Warfare.Players; | ||
|
||
namespace Uncreated.Warfare.Events.Models.Players; | ||
|
||
/// <summary> | ||
/// Invoked when a player tries to send a chat message. | ||
/// </summary> | ||
[EventModel(SynchronizationContext = EventSynchronizationContext.PerPlayer)] | ||
public class PlayerChatRequested : CancellablePlayerEvent | ||
{ | ||
private EChatMode _chatMode; | ||
|
||
/// <summary> | ||
/// The text that will be sent to everyone else. | ||
/// </summary> | ||
public required string Text { get; set; } | ||
|
||
/// <summary> | ||
/// If the caller has permission to bypass checks for chat. | ||
/// </summary> | ||
public required bool HasAdminChatPermissions { get; init; } | ||
|
||
/// <summary> | ||
/// The original text the player sent. | ||
/// </summary> | ||
public required string OriginalText { get; init; } | ||
|
||
/// <summary> | ||
/// The player's names to be formatted into the message for each player. | ||
/// </summary> | ||
public required PlayerNames PlayerName { get; set; } | ||
|
||
/// <summary> | ||
/// The text that will be sent in front of the message. | ||
/// </summary> | ||
public required string Prefix { get; set; } | ||
|
||
/// <summary> | ||
/// The color of the message. | ||
/// </summary> | ||
public required Color MessageColor { get; set; } | ||
|
||
/// <summary> | ||
/// If the message came from an event hook. | ||
/// </summary> | ||
public required bool IsUnityMessage { get; init; } | ||
|
||
/// <summary> | ||
/// If rich text should be allowed. | ||
/// </summary> | ||
public required bool AllowRichText { get; set; } | ||
|
||
/// <summary> | ||
/// Custom icon to use instead of the player's profile picture. | ||
/// </summary> | ||
/// <remarks><see langword="null"/> = the sender's profile picture.</remarks> | ||
public string? IconUrlOverride { get; set; } | ||
|
||
/// <summary> | ||
/// The broadcast mode. | ||
/// </summary> | ||
/// <exception cref="ArgumentOutOfRangeException"/> | ||
public required EChatMode ChatMode | ||
{ | ||
get => _chatMode; | ||
set | ||
{ | ||
if (value is not EChatMode.GLOBAL and not EChatMode.LOCAL and not EChatMode.GROUP) | ||
throw new ArgumentOutOfRangeException(nameof(value)); | ||
|
||
_chatMode = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Getter for a list of all players the message should be sent to. | ||
/// </summary> | ||
public required Func<PlayerChatRequested, IEnumerable<WarfarePlayer>> TargetPlayers { get; set; } | ||
} |
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,50 @@ | ||
using Uncreated.Warfare.Players; | ||
|
||
namespace Uncreated.Warfare.Events.Models.Players; | ||
|
||
/// <summary> | ||
/// Invoked after a player sends a chat message. | ||
/// </summary> | ||
public class PlayerChatSent : PlayerEvent | ||
{ | ||
/// <summary> | ||
/// The text that will be sent to everyone else. | ||
/// </summary> | ||
public required string Text { get; init; } | ||
|
||
/// <summary> | ||
/// The original text the player sent. | ||
/// </summary> | ||
public required string OriginalText { get; init; } | ||
|
||
/// <summary> | ||
/// The player's names to be formatted into the message for each player. | ||
/// </summary> | ||
public required PlayerNames PlayerName { get; init; } | ||
|
||
/// <summary> | ||
/// The text that will be sent in front of the message. | ||
/// </summary> | ||
public required string Prefix { get; init; } | ||
|
||
/// <summary> | ||
/// The color of the message. | ||
/// </summary> | ||
public required Color MessageColor { get; init; } | ||
|
||
/// <summary> | ||
/// If rich text should be allowed. | ||
/// </summary> | ||
public required bool AllowRichText { get; init; } | ||
|
||
/// <summary> | ||
/// Custom icon to use instead of the player's profile picture. | ||
/// </summary> | ||
/// <remarks><see langword="null"/> = the sender's profile picture.</remarks> | ||
public string? IconUrlOverride { get; init; } | ||
|
||
/// <summary> | ||
/// The broadcast mode. | ||
/// </summary> | ||
public required EChatMode ChatMode { get; init; } | ||
} |
Oops, something went wrong.