1+ using Cassie ;
2+ using Exiled . API . Extensions ;
3+ using JetBrains . Annotations ;
4+ using SER . Code . ArgumentSystem . Arguments ;
5+ using SER . Code . ArgumentSystem . BaseArguments ;
6+ using SER . Code . Helpers ;
7+ using SER . Code . MethodSystem . BaseMethods . Synchronous ;
8+ using SER . Code . MethodSystem . MethodDescriptors ;
9+ using SER . Code . MethodSystem . Structures ;
10+ using Player = Exiled . API . Features . Player ;
11+
12+
13+ namespace SER . Code . MethodSystem . Methods . BroadcastMethods ;
14+
15+ [ UsedImplicitly ]
16+ public class PlayerAnimatedBroadcastMethod : SynchronousMethod , IAdditionalDescription , IDependOnFramework
17+ {
18+ public override string Description => "Sends an animated broadcast to all players." ;
19+
20+ public override Argument [ ] ExpectedArguments { get ; } =
21+ [
22+ new PlayersArgument ( "players" ) ,
23+ new DurationArgument ( "duration" ) ,
24+ new TextArgument ( "content" ) ,
25+ new IntArgument ( "line break length" )
26+ {
27+ Description = "How many characters are needed to make a new line" ,
28+ DefaultValue = new ( 60 , null )
29+ }
30+ ] ;
31+
32+ public override void Execute ( )
33+ {
34+ var content = Args . GetText ( "content" ) ;
35+ var duration = Args . GetDuration ( "duration" ) . TotalSeconds ;
36+
37+ foreach ( var plr in Args . GetPlayers ( "players" ) . Select ( Player . Get ) )
38+ {
39+ plr . Connection . Send ( new CassieTtsPayload ( string . Empty , string . Empty , false ) ) ;
40+ plr . MessageTranslated (
41+ $ "$SLEEP_{ duration - 1 } .",
42+ null ! ,
43+ AnimatedBroadcastMethod . Helper . FormatToCassieCentralScreenSubtitles ( content , Args . GetInt ( "line break length" ) )
44+ ) ;
45+ }
46+ }
47+
48+ public string AdditionalDescription =>
49+ "Uses CASSIE to make an animated broadcast - if there is CASSIE playing, it will be stopped. " +
50+ "Keep custom formatting to a minimum, this system is very limited." ;
51+
52+ public FrameworkBridge . Type DependsOn => FrameworkBridge . Type . Exiled ;
53+ }
0 commit comments