diff --git a/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs b/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs index 6ad58ccd8..9f898bcca 100644 --- a/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs +++ b/Dalamud/Game/Text/Evaluator/SeStringEvaluator.cs @@ -1643,13 +1643,15 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator if (entryEnd == -1) entryEnd = ranges.Length; + var entry = ranges.AsSpan(0, entryEnd); + if (ranges.StartsWith("noun", StringComparison.Ordinal)) { isNoun = true; } else if (ranges.StartsWith("col", StringComparison.Ordinal) && colIndex < cols.Length) { - cols[colIndex++] = int.Parse(ranges.AsSpan(4, entryEnd - 4)); + cols[colIndex++] = int.Parse(entry[4..]); } else if (ranges.StartsWith("tail", StringComparison.Ordinal)) { @@ -1659,18 +1661,18 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator } else { - var dash = ranges.IndexOf('-'); + var dash = entry.IndexOf('-'); hasRanges |= true; if (dash == -1) { - isInRange |= int.Parse(ranges.AsSpan(0, entryEnd)) == rowId; + isInRange |= int.Parse(entry) == rowId; } else { - isInRange |= rowId >= int.Parse(ranges.AsSpan(0, dash)) - && rowId <= int.Parse(ranges.AsSpan(dash + 1, entryEnd - dash - 1)); + isInRange |= rowId >= int.Parse(entry[..dash]) + && rowId <= int.Parse(entry[(dash + 1)..]); } } @@ -2061,7 +2063,7 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator value = (uint)MacroDecoder.GetMacroTime()->tm_mday; return true; case ExpressionType.Weekday: - value = (uint)MacroDecoder.GetMacroTime()->tm_wday; + value = (uint)MacroDecoder.GetMacroTime()->tm_wday + 1; return true; case ExpressionType.Month: value = (uint)MacroDecoder.GetMacroTime()->tm_mon + 1; diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs index d2d0cb3b2..a88f576f9 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/SeStringCreatorWidget.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Text; +using System.Threading.Tasks; using Dalamud.Bindings.ImGui; -using Dalamud.Configuration.Internal; using Dalamud.Data; using Dalamud.Game; using Dalamud.Game.ClientState; @@ -13,12 +13,13 @@ using Dalamud.Game.Text.Noun.Enums; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; -using Dalamud.Memory; using Dalamud.Utility; + using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Misc; using FFXIVClientStructs.FFXIV.Component.Text; + using Lumina.Data; using Lumina.Data.Files.Excel; using Lumina.Data.Structs.Excel; @@ -146,6 +147,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget private SeStringParameter[]? localParameters = [Util.GetScmVersion()]; private ReadOnlySeString input; private ClientLanguage? language; + private Task? validImportSheetNamesTask; private int importSelectedSheetName; private int importRowId; private string[]? validImportSheetNames; @@ -313,13 +315,13 @@ internal class SeStringCreatorWidget : IDataWindowWidget ImGui.Text(i switch { 0 => "Player Name", - 1 => "Temp Player 1 Name", - 2 => "Temp Player 2 Name", + 1 => "Temp Entity 1: Name", + 2 => "Temp Entity 2: Name", 3 => "Player Sex", - 4 => "Temp Player 1 Sex", - 5 => "Temp Player 2 Sex", - 6 => "Temp Player 1 Unk 1", - 7 => "Temp Player 2 Unk 1", + 4 => "Temp Entity 1: Sex", + 5 => "Temp Entity 2: Sex", + 6 => "Temp Entity 1: ObjStrId", + 7 => "Temp Entity 2: ObjStrId", 10 => "Eorzea Time Hours", 11 => "Eorzea Time Minutes", 12 => "ColorSay", @@ -368,14 +370,19 @@ internal class SeStringCreatorWidget : IDataWindowWidget 62 => "ColorLoot", 63 => "ColorCraft", 64 => "ColorGathering", - 65 => "Temp Player 1 Unk 2", - 66 => "Temp Player 2 Unk 2", + 65 => "Temp Entity 1: Name starts with Vowel", + 66 => "Temp Entity 2: Name starts with Vowel", 67 => "Player ClassJobId", 68 => "Player Level", + 69 => "Player StartTown", 70 => "Player Race", 71 => "Player Synced Level", - 77 => "Client/Plattform?", + 73 => "Quest#66047: Has met Alphinaud and Alisaie", + 74 => "PlayStation Generation", + 75 => "Is Legacy Player", + 77 => "Client/Platform?", 78 => "Player BirthMonth", + 79 => "PadMode", 82 => "Datacenter Region", 83 => "ColorCWLS2", 84 => "ColorCWLS3", @@ -396,6 +403,11 @@ internal class SeStringCreatorWidget : IDataWindowWidget 100 => "LogSetRoleColor 1: LogColorOtherClass", 101 => "LogSetRoleColor 2: LogColorOtherClass", 102 => "Has Login Security Token", + 103 => "Is subscribed to PlayStation Plus", + 104 => "PadMouseMode", + 106 => "Preferred World Bonus Max Level", + 107 => "Occult Crescent Support Job Level", + 108 => "Deep Dungeon Id", _ => string.Empty, }); } @@ -510,7 +522,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget } } - ImGui.SetClipboardText(sb.ToReadOnlySeString().ToString()); + ImGui.SetClipboardText(sb.ToReadOnlySeString().ToMacroString()); } ImGui.SameLine(); @@ -555,22 +567,31 @@ internal class SeStringCreatorWidget : IDataWindowWidget var dataManager = Service.Get(); - this.validImportSheetNames ??= dataManager.Excel.SheetNames.Where(sheetName => + this.validImportSheetNamesTask ??= Task.Run(() => { - try + this.validImportSheetNames = dataManager.Excel.SheetNames.Where(sheetName => { - var headerFile = dataManager.GameData.GetFile($"exd/{sheetName}.exh"); - if (headerFile.Header.Variant != ExcelVariant.Default) - return false; + try + { + var headerFile = dataManager.GameData.GetFile($"exd/{sheetName}.exh"); + if (headerFile.Header.Variant != ExcelVariant.Default) + return false; - var sheet = dataManager.Excel.GetSheet(Language.English, sheetName); - return sheet.Columns.Any(col => col.Type == ExcelColumnDataType.String); - } - catch - { - return false; - } - }).OrderBy(sheetName => sheetName, StringComparer.InvariantCulture).ToArray(); + var sheet = dataManager.Excel.GetSheet(Language.English, sheetName); + return sheet.Columns.Any(col => col.Type == ExcelColumnDataType.String); + } + catch + { + return false; + } + }).OrderBy(sheetName => sheetName, StringComparer.InvariantCulture).ToArray(); + }); + + if (this.validImportSheetNames == null) + { + ImGui.Text("Loading sheets..."u8); + return; + } var sheetChanged = ImGui.Combo("Sheet Name", ref this.importSelectedSheetName, this.validImportSheetNames); @@ -625,7 +646,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget ImGui.Text(i.ToString()); ImGui.TableNextColumn(); - if (ImGui.Selectable($"{value.ToString().Truncate(100)}###Column{i}")) + if (ImGui.Selectable($"{value.ToMacroString().Truncate(100)}###Column{i}")) { foreach (var payload in value) { @@ -696,7 +717,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget ImGui.TableNextColumn(); // Text var message = entry.Message; ImGui.SetNextItemWidth(-1); - if (ImGui.InputText($"##{i}_Message", ref message, 255)) + if (ImGui.InputText($"##{i}_Message", ref message, 2048)) { entry.Message = message; updateString |= true;