private static void SpawnTwins(Frostspark.Server.Entities.Player player, int amount, bool on_self = false) { for (int i = 0; i < amount; i++) { if (on_self) { Terraria.NPC.NewNPC(new EntitySource_DebugCommand(), (int)player.Position.X, (int)player.Position.Y, 125); Terraria.NPC.NewNPC(new EntitySource_DebugCommand(), (int)player.Position.X, (int)player.Position.Y, 126); } else { int plyx = (int)player.Position.X / 16; int plyy = (int)player.Position.Y / 16; (int x, int y) = TileUtils.GetRandomClearTile(plyx, plyy, 100, 50); Terraria.NPC.NewNPC(new EntitySource_DebugCommand(), x * 16, y * 16, 125); (x, y) = TileUtils.GetRandomClearTile(plyx, plyy, 100, 50); Terraria.NPC.NewNPC(new EntitySource_DebugCommand(), x * 16, y * 16, 126); } } var infocol = EssentialsPlugin.Server.Colors.Info; var emphasis = EssentialsPlugin.Server.Colors.TargetEmphasis; player.SendFormattedMessage($"Spawned {emphasis}{amount}{infocol} pair(s) of {emphasis}Twins{infocol}.", infocol); EssentialsPlugin.Server.Commands.LogCommandActivity(player, $"Spawned {amount} pairs of Twins."); }
public void SpawnItem(Player player, [ItemID] int item_id, int stack = 1, byte prefix = 0) { Terraria.Item.NewItem(new EntitySource_DebugCommand(), player.Handle.position, Vector2.Zero, item_id, stack, false, prefix, true, false); var infocol = EssentialsPlugin.Server.Colors.Info; var emphasis = EssentialsPlugin.Server.Colors.TargetEmphasis; string item_name = Lang.GetItemNameValue(item_id); Sender.SendFormattedMessage($"Gave {emphasis}{player.Name}{infocol} {emphasis}{stack}{infocol} of {emphasis}{item_name}{infocol}.", infocol); player.SendFormattedMessage($"{emphasis}{Sender.LogName}{infocol} gave you {emphasis}{stack}{infocol} of {emphasis}{item_name}{infocol}", infocol); EssentialsPlugin.Server.Commands.LogCommandActivity(Sender, $"Gave {player.Name} {stack} of {item_name}."); }
private static void SpawnWOF(Frostspark.Server.Entities.Player player, int amount, bool on_self = false) { if (Main.wofNPCIndex != -1 || player.Position.Y / 16 < (Main.maxTilesY - 205)) { player.SendErrorMessage("Wall of Flesh cannot be spawned at your current location."); } else { Terraria.NPC.SpawnWOF(XNAConversions.FSToXNA(player.Position)); var infocol = EssentialsPlugin.Server.Colors.Info; var emph = EssentialsPlugin.Server.Colors.TargetEmphasis; player.SendFormattedMessage($"Spawned {emph}Wall of Flesh{infocol}.", infocol); EssentialsPlugin.Server.Commands.LogCommandActivity(player, $"Spawned Wall of Flesh."); } }