mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #2414 from Haselnussbomber/sestring-evaluator-and-creator-fixes
SeString Evaluator/Creator fixes
This commit is contained in:
commit
0bc44154aa
2 changed files with 56 additions and 33 deletions
|
|
@ -1643,13 +1643,15 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
if (entryEnd == -1)
|
if (entryEnd == -1)
|
||||||
entryEnd = ranges.Length;
|
entryEnd = ranges.Length;
|
||||||
|
|
||||||
|
var entry = ranges.AsSpan(0, entryEnd);
|
||||||
|
|
||||||
if (ranges.StartsWith("noun", StringComparison.Ordinal))
|
if (ranges.StartsWith("noun", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
isNoun = true;
|
isNoun = true;
|
||||||
}
|
}
|
||||||
else if (ranges.StartsWith("col", StringComparison.Ordinal) && colIndex < cols.Length)
|
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))
|
else if (ranges.StartsWith("tail", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
|
|
@ -1659,18 +1661,18 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var dash = ranges.IndexOf('-');
|
var dash = entry.IndexOf('-');
|
||||||
|
|
||||||
hasRanges |= true;
|
hasRanges |= true;
|
||||||
|
|
||||||
if (dash == -1)
|
if (dash == -1)
|
||||||
{
|
{
|
||||||
isInRange |= int.Parse(ranges.AsSpan(0, entryEnd)) == rowId;
|
isInRange |= int.Parse(entry) == rowId;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isInRange |= rowId >= int.Parse(ranges.AsSpan(0, dash))
|
isInRange |= rowId >= int.Parse(entry[..dash])
|
||||||
&& rowId <= int.Parse(ranges.AsSpan(dash + 1, entryEnd - dash - 1));
|
&& rowId <= int.Parse(entry[(dash + 1)..]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2061,7 +2063,7 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
value = (uint)MacroDecoder.GetMacroTime()->tm_mday;
|
value = (uint)MacroDecoder.GetMacroTime()->tm_mday;
|
||||||
return true;
|
return true;
|
||||||
case ExpressionType.Weekday:
|
case ExpressionType.Weekday:
|
||||||
value = (uint)MacroDecoder.GetMacroTime()->tm_wday;
|
value = (uint)MacroDecoder.GetMacroTime()->tm_wday + 1;
|
||||||
return true;
|
return true;
|
||||||
case ExpressionType.Month:
|
case ExpressionType.Month:
|
||||||
value = (uint)MacroDecoder.GetMacroTime()->tm_mon + 1;
|
value = (uint)MacroDecoder.GetMacroTime()->tm_mon + 1;
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Configuration.Internal;
|
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
|
|
@ -13,12 +13,13 @@ using Dalamud.Game.Text.Noun.Enums;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Memory;
|
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.System.String;
|
using FFXIVClientStructs.FFXIV.Client.System.String;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||||
using FFXIVClientStructs.FFXIV.Component.Text;
|
using FFXIVClientStructs.FFXIV.Component.Text;
|
||||||
|
|
||||||
using Lumina.Data;
|
using Lumina.Data;
|
||||||
using Lumina.Data.Files.Excel;
|
using Lumina.Data.Files.Excel;
|
||||||
using Lumina.Data.Structs.Excel;
|
using Lumina.Data.Structs.Excel;
|
||||||
|
|
@ -146,6 +147,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
private SeStringParameter[]? localParameters = [Util.GetScmVersion()];
|
private SeStringParameter[]? localParameters = [Util.GetScmVersion()];
|
||||||
private ReadOnlySeString input;
|
private ReadOnlySeString input;
|
||||||
private ClientLanguage? language;
|
private ClientLanguage? language;
|
||||||
|
private Task? validImportSheetNamesTask;
|
||||||
private int importSelectedSheetName;
|
private int importSelectedSheetName;
|
||||||
private int importRowId;
|
private int importRowId;
|
||||||
private string[]? validImportSheetNames;
|
private string[]? validImportSheetNames;
|
||||||
|
|
@ -313,13 +315,13 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
ImGui.Text(i switch
|
ImGui.Text(i switch
|
||||||
{
|
{
|
||||||
0 => "Player Name",
|
0 => "Player Name",
|
||||||
1 => "Temp Player 1 Name",
|
1 => "Temp Entity 1: Name",
|
||||||
2 => "Temp Player 2 Name",
|
2 => "Temp Entity 2: Name",
|
||||||
3 => "Player Sex",
|
3 => "Player Sex",
|
||||||
4 => "Temp Player 1 Sex",
|
4 => "Temp Entity 1: Sex",
|
||||||
5 => "Temp Player 2 Sex",
|
5 => "Temp Entity 2: Sex",
|
||||||
6 => "Temp Player 1 Unk 1",
|
6 => "Temp Entity 1: ObjStrId",
|
||||||
7 => "Temp Player 2 Unk 1",
|
7 => "Temp Entity 2: ObjStrId",
|
||||||
10 => "Eorzea Time Hours",
|
10 => "Eorzea Time Hours",
|
||||||
11 => "Eorzea Time Minutes",
|
11 => "Eorzea Time Minutes",
|
||||||
12 => "ColorSay",
|
12 => "ColorSay",
|
||||||
|
|
@ -368,14 +370,19 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
62 => "ColorLoot",
|
62 => "ColorLoot",
|
||||||
63 => "ColorCraft",
|
63 => "ColorCraft",
|
||||||
64 => "ColorGathering",
|
64 => "ColorGathering",
|
||||||
65 => "Temp Player 1 Unk 2",
|
65 => "Temp Entity 1: Name starts with Vowel",
|
||||||
66 => "Temp Player 2 Unk 2",
|
66 => "Temp Entity 2: Name starts with Vowel",
|
||||||
67 => "Player ClassJobId",
|
67 => "Player ClassJobId",
|
||||||
68 => "Player Level",
|
68 => "Player Level",
|
||||||
|
69 => "Player StartTown",
|
||||||
70 => "Player Race",
|
70 => "Player Race",
|
||||||
71 => "Player Synced Level",
|
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",
|
78 => "Player BirthMonth",
|
||||||
|
79 => "PadMode",
|
||||||
82 => "Datacenter Region",
|
82 => "Datacenter Region",
|
||||||
83 => "ColorCWLS2",
|
83 => "ColorCWLS2",
|
||||||
84 => "ColorCWLS3",
|
84 => "ColorCWLS3",
|
||||||
|
|
@ -396,6 +403,11 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
100 => "LogSetRoleColor 1: LogColorOtherClass",
|
100 => "LogSetRoleColor 1: LogColorOtherClass",
|
||||||
101 => "LogSetRoleColor 2: LogColorOtherClass",
|
101 => "LogSetRoleColor 2: LogColorOtherClass",
|
||||||
102 => "Has Login Security Token",
|
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,
|
_ => string.Empty,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -510,7 +522,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetClipboardText(sb.ToReadOnlySeString().ToString());
|
ImGui.SetClipboardText(sb.ToReadOnlySeString().ToMacroString());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
@ -555,22 +567,31 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
|
|
||||||
var dataManager = Service<DataManager>.Get();
|
var dataManager = Service<DataManager>.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<ExcelHeaderFile>($"exd/{sheetName}.exh");
|
try
|
||||||
if (headerFile.Header.Variant != ExcelVariant.Default)
|
{
|
||||||
return false;
|
var headerFile = dataManager.GameData.GetFile<ExcelHeaderFile>($"exd/{sheetName}.exh");
|
||||||
|
if (headerFile.Header.Variant != ExcelVariant.Default)
|
||||||
|
return false;
|
||||||
|
|
||||||
var sheet = dataManager.Excel.GetSheet<RawRow>(Language.English, sheetName);
|
var sheet = dataManager.Excel.GetSheet<RawRow>(Language.English, sheetName);
|
||||||
return sheet.Columns.Any(col => col.Type == ExcelColumnDataType.String);
|
return sheet.Columns.Any(col => col.Type == ExcelColumnDataType.String);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).OrderBy(sheetName => sheetName, StringComparer.InvariantCulture).ToArray();
|
}).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);
|
var sheetChanged = ImGui.Combo("Sheet Name", ref this.importSelectedSheetName, this.validImportSheetNames);
|
||||||
|
|
||||||
|
|
@ -625,7 +646,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
ImGui.Text(i.ToString());
|
ImGui.Text(i.ToString());
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
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)
|
foreach (var payload in value)
|
||||||
{
|
{
|
||||||
|
|
@ -696,7 +717,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
|
||||||
ImGui.TableNextColumn(); // Text
|
ImGui.TableNextColumn(); // Text
|
||||||
var message = entry.Message;
|
var message = entry.Message;
|
||||||
ImGui.SetNextItemWidth(-1);
|
ImGui.SetNextItemWidth(-1);
|
||||||
if (ImGui.InputText($"##{i}_Message", ref message, 255))
|
if (ImGui.InputText($"##{i}_Message", ref message, 2048))
|
||||||
{
|
{
|
||||||
entry.Message = message;
|
entry.Message = message;
|
||||||
updateString |= true;
|
updateString |= true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue