mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
SeStringEvaluator: Add support for SwitchPlatform (#2360)
This commit is contained in:
parent
8fcf633f02
commit
184c8c8fa2
2 changed files with 27 additions and 1 deletions
|
|
@ -247,6 +247,9 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
case MacroCode.Switch:
|
case MacroCode.Switch:
|
||||||
return this.TryResolveSwitch(in context, payload);
|
return this.TryResolveSwitch(in context, payload);
|
||||||
|
|
||||||
|
case MacroCode.SwitchPlatform:
|
||||||
|
return this.TryResolveSwitchPlatform(in context, payload);
|
||||||
|
|
||||||
case MacroCode.PcName:
|
case MacroCode.PcName:
|
||||||
return this.TryResolvePcName(in context, payload);
|
return this.TryResolvePcName(in context, payload);
|
||||||
|
|
||||||
|
|
@ -450,6 +453,29 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool TryResolveSwitchPlatform(in SeStringContext context, in ReadOnlySePayloadSpan payload)
|
||||||
|
{
|
||||||
|
if (!payload.TryGetExpression(out var expr1))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!expr1.TryGetInt(out var intVal))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Our version of the game uses IsMacClient() here and the
|
||||||
|
// Xbox version seems to always return 7 for the platform.
|
||||||
|
var platform = Util.IsWine() ? 5 : 3;
|
||||||
|
|
||||||
|
// The sheet is seeminly split into first 20 rows for wired controllers
|
||||||
|
// and the last 20 rows for wireless controllers.
|
||||||
|
var rowId = (uint)((20 * ((intVal - 1) / 20)) + (platform - 4 < 2 ? 2 : 1));
|
||||||
|
|
||||||
|
if (!this.dataManager.GetExcelSheet<Platform>().TryGetRow(rowId, out var platformRow))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
context.Builder.Append(platformRow.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private unsafe bool TryResolvePcName(in SeStringContext context, in ReadOnlySePayloadSpan payload)
|
private unsafe bool TryResolvePcName(in SeStringContext context, in ReadOnlySePayloadSpan payload)
|
||||||
{
|
{
|
||||||
if (!payload.TryGetExpression(out var eEntityId))
|
if (!payload.TryGetExpression(out var eEntityId))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<!-- Dependency versions -->
|
<!-- Dependency versions -->
|
||||||
<PropertyGroup Label="Dependency Versions">
|
<PropertyGroup Label="Dependency Versions">
|
||||||
<LuminaVersion>6.3.0</LuminaVersion>
|
<LuminaVersion>6.4.0</LuminaVersion>
|
||||||
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
|
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue