muddesigner/MudGame/Scripts/CommandSay.cs
Scionwest_cp c7d227745c MudEngine:
- Set the Game.PlayerCollection property to Protected. You can no longer modify this list unless the class inherits from Game. Only 1 script is allowed to inherit from Game.
 - Created Game.GetPlayerCollection() method for retrieving a read-only reference to the playerCollection so scripts can access player data it might needs.
 - Updated various classes and scripts due to no longer being able to access the PlayerCollection property.
2010-08-20 14:55:06 -07:00

26 lines
No EOL
882 B
C#

public class CommandSay : IGameCommand
{
public Boolean Override { get; set; }
public String Name { get; set; }
public List<String> Help { 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.GetPlayerCollection())
{
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);
}
}