Merge branch 'master' into v9

This commit is contained in:
Ava Chaney 2023-06-18 00:45:43 -07:00
commit 2e0e46384c
70 changed files with 2694 additions and 623 deletions

View file

@ -19,7 +19,7 @@ public static class AsyncUtils
/// <param name="tasks">A list of tasks to race.</param>
/// <typeparam name="T">The return type of all raced tasks.</typeparam>
/// <exception cref="AggregateException">Thrown when all tasks given to this method fail.</exception>
/// <returns>Returns the first task that completes, according to <see cref="Task{TResult}.IsCompletedSuccessfully"/>.</returns>
/// <returns>Returns the first task that completes, according to <see cref="Task.IsCompletedSuccessfully"/>.</returns>
public static Task<T> FirstSuccessfulTask<T>(ICollection<Task<T>> tasks)
{
var tcs = new TaskCompletionSource<T>();

View file

@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using FFXIVClientStructs.FFXIV.Client.Graphics;
namespace Dalamud.Utility.Numerics;

View file

@ -11,6 +11,7 @@ using System.Runtime.CompilerServices;
using System.Text;
using Dalamud.Configuration.Internal;
using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Interface;
@ -18,6 +19,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Logging.Internal;
using Dalamud.Networking.Http;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
using Microsoft.Win32;
using Serilog;
@ -635,6 +637,19 @@ public static class Util
File.Move(tmpPath, path, true);
}
/// <summary>
/// Gets a random, inoffensive, human-friendly string.
/// </summary>
/// <returns>A random human-friendly name.</returns>
internal static string GetRandomName()
{
var data = Service<DataManager>.Get();
var names = data.GetExcelSheet<BNpcName>(ClientLanguage.English)!;
var rng = new Random();
return names.ElementAt(rng.Next(0, names.Count() - 1)).Singular.RawString;
}
private static unsafe void ShowValue(ulong addr, IEnumerable<string> path, Type type, object value)
{
if (type.IsPointer)