Code:
internal class TossEffCommand : Command
{
public TossEffCommand()
: base("tosseff", 1)
{
}
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (args.Length != 2)
{
player.SendHelp("Usage: /tosseff <PlayerName> <Effectname or Effectnumber>");
return false;
}
try
{
foreach (KeyValuePair<string, Client> i in player.Manager.Clients.Where(i => i.Value.Player.Name.EqualsIgnoreCase(args[0])))
{
i.Value.Player.ApplyConditionEffect(new ConditionEffect
{
Effect =
(ConditionEffectIndex) Enum.Parse(typeof (ConditionEffectIndex), args[1].Trim(), true),
DurationMS = -1
});
player.SendInfo("Success!");
}
}
catch
{
player.SendError("Invalid effect or player name! ");
return false;
}
return true;
}
}