Added /me

Turned back on logger
Stopped logging send message events(spam!)
Closes #28
This commit is contained in:
Shank 2011-06-05 22:37:56 -06:00
parent 3c46003f04
commit d9df2bf962
4 changed files with 21 additions and 9 deletions

View file

@ -102,10 +102,7 @@ namespace TShockAPI
commands.Add(new Command("debug-config", "cfg", new CommandDelegate(DebugConfiguration)));
commands.Add(new Command("playing", "", new CommandDelegate(Playing)));
commands.Add(new Command("auth", "", new CommandDelegate(AuthToken)));
//TShock.admincommandList.Add("debug-config", new CommandDelegate(DebugConfiguration));
//TShock.admincommandList.Add("playing", new CommandDelegate(Playing));
//TShock.commandList.Add("help", new CommandDelegate(Help));
//TShock.commandList.Add("playing", new CommandDelegate(Playing)););
commands.Add(new Command("me", "", new CommandDelegate(ThirdPerson)));
if (ConfigurationManager.distributationAgent != "terraria-online")
{
commands.Add(new Command("kill", "kill", new CommandDelegate(Kill)));
@ -117,6 +114,12 @@ namespace TShockAPI
#region Command Methods
public static void ThirdPerson(CommandArgs args)
{
string msg = args.Message.Remove(0, 3);
Tools.Broadcast("*" + Tools.FindPlayer(args.PlayerID) + " " + msg, new float[] {205, 133, 63 });
}
public static void Playing(CommandArgs args)
{
Tools.SendMessage(args.PlayerID, Tools.GetPlayers());

View file

@ -84,7 +84,7 @@ namespace TShockAPI
String text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture) + " - " + caller + message;
//Console.WriteLine(text);
Console.WriteLine(text);
if (!MayWriteType(level))
{

View file

@ -15,7 +15,7 @@ namespace TShockAPI
public static string saveDir = "./tshock/";
public static Version VersionNum = new Version(1, 9, 0, 0);
public static Version VersionNum = new Version(1, 8, 0, 1);
public static string VersionCodename = "Squashing Bugs";
@ -204,7 +204,7 @@ namespace TShockAPI
var flag = CheckSpawn(x, y);
if (flag)
{
Tools.SendMessage(e.Msg.whoAmI, "The spawn is protected!", new float[] { 255f, 0f, 0f });
Tools.SendMessage(e.Msg.whoAmI, "Spawn protected from changes.", new float[] { 255f, 0f, 0f });
e.Handled = true;
}
}

View file

@ -85,6 +85,16 @@ namespace TShockAPI
Log.Info("Broadcast: " + msg);
}
public static void Broadcast(string msg, float[] color)
{
for (int i = 0; i < Main.player.Length; i++)
{
SendMessage(i, msg, color);
}
Log.Info("Broadcast: " + msg);
}
/// <summary>
/// Sends a message out to a single player
/// </summary>
@ -94,7 +104,6 @@ namespace TShockAPI
public static void SendMessage(int ply, string msg, float[] color)
{
NetMessage.SendData(0x19, ply, -1, msg, 255, color[0], color[1], color[2]);
Log.Info("Said: " + msg + " - To: " + Tools.FindPlayer(ply));
}
/// <summary>
@ -105,7 +114,6 @@ namespace TShockAPI
public static void SendMessage(int ply, string message)
{
NetMessage.SendData(0x19, ply, -1, message, 255, 0f, 255f, 0f);
Log.Info("Said: " + message + " - To: " + Tools.FindPlayer(ply));
}
/// <summary>
@ -377,5 +385,6 @@ namespace TShockAPI
}
public Tools() { }
}
}