public static void SendPage(TSPlayer player, int pageNumber, IList dataToPaginate, Settings settings = null) { PaginationTools.SendPage(player, pageNumber, dataToPaginate, dataToPaginate.Count, settings); }
private void OnTileEdit(object sender, GetDataHandlers.TileEditEventArgs e) { var player = e.Player; #region Region Information Display if (player.AwaitingName) { bool includeUnprotected = false; bool includeZIndexes = false; bool persistentMode = false; foreach (string nameParameter in player.AwaitingNameParameters) { // If this flag is passed the final output will include unprotected regions, i.e regions // that have the DisableBuild flag set to false if (nameParameter.Equals("-u", StringComparison.InvariantCultureIgnoreCase)) { includeUnprotected = true; } // If this flag is passed the final output will include a region's Z index if (nameParameter.Equals("-z", StringComparison.InvariantCultureIgnoreCase)) { includeZIndexes = true; } // If this flag is passed the player will continue to receive region information upon editing tiles if (nameParameter.Equals("-p", StringComparison.InvariantCultureIgnoreCase)) { persistentMode = true; } } var output = new List <string>(); foreach (Region region in _regionManager.Regions.OrderBy(r => r.Z).Reverse()) { // Ensure that the specified tile is region protected if (e.X < region.Area.Left || e.X > region.Area.Right) { continue; } if (e.Y < region.Area.Top || e.Y > region.Area.Bottom) { continue; } // Do not include the current region if it has not been protected and the includeUnprotected flag has not been set if (!region.DisableBuild && !includeUnprotected) { continue; } output.Add($"{region.Name} {(includeZIndexes ? $"(Z:{region.Z}" : string.Empty)}"); } if (output.Count == 0) { player.SendInfoMessage(includeUnprotected ? "There are no regions at this point." : "There are no regions at this point, or they are not protected."); } else { player.SendInfoMessage(includeUnprotected ? "Regions at this point: " : "Protected regions at this point: "); foreach (string line in PaginationTools.BuildLinesFromTerms(output)) { player.SendMessage(line, Color.White); } } if (!persistentMode) { player.AwaitingName = false; player.AwaitingNameParameters = null; } // Revert all tile changes and handle the event player.SendTileSquare(e.X, e.Y, 4); e.Handled = true; } #endregion #region TempPoints Setup if (player.AwaitingTempPoint != 0) { // Set temp point coordinates to current tile coordinates player.TempPoints[player.AwaitingTempPoint - 1].X = e.X; player.TempPoints[player.AwaitingTempPoint - 1].Y = e.Y; player.SendInfoMessage($"Set temp point {player.AwaitingTempPoint}."); // Reset the awaiting temp point player.AwaitingTempPoint = 0; // Revert all tile changes and handle the event player.SendTileSquare(e.X, e.Y, 4); e.Handled = true; } #endregion }