This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjects.cs
More file actions
72 lines (63 loc) · 2.12 KB
/
Copy pathObjects.cs
File metadata and controls
72 lines (63 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using Exiled.API.Features;
using PlayerRoles;
using System.ComponentModel;
using Exiled.API.Extensions;
namespace AutoBroadcast;
public class BroadCassie
{
public BroadcastSystem? Broadcast { get; set; }
public CassieBroadcast? Cassie { get; set; }
}
public class BroadcastSystem
{
[Description("How long the hint/broadcast should show")]
public ushort Duration { get; set; } = 3;
[Description("The message shown on the broadcast")]
public string Message { get; set; } = string.Empty;
[Description("Override broadcasts")]
public bool Override { get; set; }
[Description("Whether or not to use hints instead")]
public bool UseHints { get; set; }
public void Show()
{
if (UseHints)
Map.ShowHint(Message, Duration);
else
Map.Broadcast(Duration, Message, default, Override);
}
public void Show(Player player)
{
if (UseHints)
player.ShowHint(Message, Duration);
else
player.Broadcast(Duration, Message, default, Override);
}
}
public class CassieBroadcast
{
[Description("The CASSIE message to be sent")]
public string Message { get; set; } = "";
[Description("The text to be shown")]
public string Translation { get; set; } = string.Empty;
[Description("Whether or not to hide the subtitle for the cassie message")]
public bool ShowSubtitles { get; set; } = true;
public void Send()
{
Cassie.MessageTranslated(Message,Translation.IsEmpty() ? Message : Translation, isSubtitles: ShowSubtitles);
}
public void Send(Player player)
{
player.MessageTranslated(Message, Translation.IsEmpty() ? Message : Translation, isSubtitles: ShowSubtitles);
}
/// <summary>
/// Sends the CASSIE to all players replacing "{role}" with <paramref name="role"/>'s full name.
/// </summary>
/// <remarks>Used by <see cref="Handler.OnDied"/></remarks>
public void Send(RoleTypeId role)
{
Cassie.MessageTranslated(
Message.Replace("{role}", RoleExtensions.GetTeam(role).ToString()),
Translation.IsEmpty() ? Message.Replace("{role}", RoleExtensions.GetTeam(role).ToString()) : Translation.Replace("{role}", role.GetFullName()),
isSubtitles: ShowSubtitles);
}
}