/annoy (currently disabled)
This commit is contained in:
parent
ec39d41654
commit
08843714a3
2 changed files with 51 additions and 0 deletions
|
|
@ -167,6 +167,7 @@ namespace TShockAPI
|
|||
ChatCommands.Add(new Command("cfg", Broadcast, "broadcast", "bc"));
|
||||
ChatCommands.Add(new Command("whisper", Whisper, "whisper", "w", "tell"));
|
||||
ChatCommands.Add(new Command("whisper", Reply, "reply", "r"));
|
||||
//ChatCommands.Add(new Command("annoy", Annoy, "annoy"));
|
||||
if (TShock.Config.DistributationAgent != "terraria-online")
|
||||
{
|
||||
ChatCommands.Add(new Command("kill", Kill, "kill"));
|
||||
|
|
@ -1487,6 +1488,29 @@ namespace TShockAPI
|
|||
else
|
||||
args.Player.SendMessage("You haven't previously received any whispers. Please use /whisper to whisper to other people.", Color.Red);
|
||||
}
|
||||
|
||||
private static void Annoy(CommandArgs args)
|
||||
{
|
||||
if (args.Parameters.Count != 2)
|
||||
{
|
||||
args.Player.SendMessage("Invalid syntax! Proper syntax: /annoy <player> <seconds to annoy>", Color.Red);
|
||||
return;
|
||||
}
|
||||
int annoy = 5;
|
||||
int.TryParse(args.Parameters[1], out annoy);
|
||||
|
||||
var players = Tools.FindPlayer(args.Parameters[0]);
|
||||
if (players.Count == 0)
|
||||
args.Player.SendMessage("Invalid player!", Color.Red);
|
||||
else if (players.Count > 1)
|
||||
args.Player.SendMessage("More than one player matched!", Color.Red);
|
||||
else
|
||||
{
|
||||
var ply = players[0];
|
||||
args.Player.SendMessage("Annoying " + ply.Name + " for " + annoy.ToString() + " seconds.");
|
||||
(new Thread(new ParameterizedThreadStart(ply.Whoopie))).Start(annoy);
|
||||
}
|
||||
}
|
||||
#endregion General Commands
|
||||
|
||||
#region Cheat Commands
|
||||
|
|
|
|||
|
|
@ -259,6 +259,33 @@ namespace TShockAPI
|
|||
NetMessage.SendData((int)PacketTypes.TogglePVP, -1, -1, "", Index);
|
||||
}
|
||||
|
||||
public virtual void Whoopie(object time)
|
||||
{
|
||||
var time2 = (int)time;
|
||||
var launch = DateTime.UtcNow;
|
||||
var player = 0;
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
if (Main.player[i] != null & Main.player[i].active && i != Index)
|
||||
player = i;
|
||||
|
||||
var oriinv = Main.player[0].inventory[player];
|
||||
while ((DateTime.UtcNow - launch).TotalSeconds < time2)
|
||||
{
|
||||
Main.player[0].inventory[player].SetDefaults("Whoopie Cushion");
|
||||
SendData(TerrariaAPI.PacketTypes.PlayerSlot, "Whoopie Cushion", player, 0f);
|
||||
Main.player[player].position = TPlayer.position;
|
||||
Main.player[player].selectedItem = 0;
|
||||
Main.player[player].controlUseItem = true;
|
||||
SendData(TerrariaAPI.PacketTypes.PlayerUpdate, number: player);
|
||||
Main.player[player].controlUseItem = false;
|
||||
Main.player[player].controlJump = true;
|
||||
SendData(TerrariaAPI.PacketTypes.PlayerUpdate, number: player);
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
Main.player[0].inventory[0] = oriinv;
|
||||
SendData(TerrariaAPI.PacketTypes.PlayerSlot, oriinv.name, player, 0f);
|
||||
}
|
||||
|
||||
//Todo: Separate this into a few functions. SendTo, SendToAll, etc
|
||||
public void SendData(PacketTypes msgType, string text = "", int number = 0, float number2 = 0f, float number3 = 0f, float number4 = 0f, int number5 = 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue