- Fixed the ScriptEngine and CommandEngine not loading Custom game commands from scripts. - BaseCharacter's Create, Initialize, Send and FlushConsole are now overridable via scripts. - Invalid commands are now printed to the player "Invalid Command." MudGame: - Added CommandSay script that adds primitive chatting support. Only players within the same Room can see the messages. - Renamed California script to WorldCalifornia - Renamed MyGame script to EarthGame. - Added Clear command script for and Say command script for showing how to build custom commands for use with the game. The commands can only be added server-side, but used client-side.
26 lines
No EOL
835 B
C#
26 lines
No EOL
835 B
C#
public class CommandSay : IGameCommand
|
|
{
|
|
public Boolean Override { get; set; }
|
|
public String Name { get; set; }
|
|
|
|
public void Execute(String command, BaseCharacter player)
|
|
{
|
|
if (command.Length <= 4) //user only sent 'Say' or 'Say '
|
|
{
|
|
return; //nothing to say, don't say anything at all.
|
|
}
|
|
|
|
String message = command.Substring("Say ".Length);
|
|
|
|
foreach (BaseCharacter p in player.ActiveGame.PlayerCollection)
|
|
{
|
|
if ((p.CurrentRoom.Realm == player.CurrentRoom.Realm) && (p.CurrentRoom.Zone == player.CurrentRoom.Zone) && (p.CurrentRoom.Filename == player.CurrentRoom.Filename))
|
|
{
|
|
p.Send(player.Name + " says: " + message);
|
|
}
|
|
}
|
|
|
|
player.Send("You say: " + message);
|
|
|
|
}
|
|
} |