32 lines
1,013 B
C#
32 lines
1,013 B
C#
using System;
|
|
using Server;
|
|
using Server.Commands;
|
|
using Server.Mobiles; // Needed to access HintCrier
|
|
|
|
namespace Server.Scripts.Commands
|
|
{
|
|
public class BroadcastCrierCommand
|
|
{
|
|
public static void Initialize()
|
|
{
|
|
// Registers the command so only GameMasters or higher can use it
|
|
CommandSystem.Register( "BroadcastCrier", AccessLevel.GameMaster, new CommandEventHandler( BroadcastCrier_OnCommand ) );
|
|
}
|
|
|
|
[Usage( "BroadcastCrier <message>" )]
|
|
[Description( "Forces all HintCriers to shout a custom message to test the AnnounceEvent method." )]
|
|
public static void BroadcastCrier_OnCommand( CommandEventArgs e )
|
|
{
|
|
// Make sure the GM actually typed a message
|
|
if ( string.IsNullOrWhiteSpace( e.ArgString ) )
|
|
{
|
|
e.Mobile.SendMessage( "Usage: [BroadcastCrier <message>" );
|
|
return;
|
|
}
|
|
|
|
// Pass whatever the GM typed directly into our static AnnounceEvent method
|
|
HintCrier.AnnounceEvent( e.ArgString );
|
|
e.Mobile.SendMessage( "Event announced to all Hint Criers." );
|
|
}
|
|
}
|
|
}
|