update for API 11

This commit is contained in:
2024-11-22 21:56:41 +01:00
parent 0669b2cecb
commit 5b75e305eb
2 changed files with 30 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
using Lumina.Excel; using Lumina.Excel;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
namespace Pilz.Dalamud.ActivityContexts; namespace Pilz.Dalamud.ActivityContexts;
@@ -36,44 +36,35 @@ public class ActivityContextManager : IDisposable
private void CheckCurrentTerritory() private void CheckCurrentTerritory()
{ {
var content = contentFinderConditionsSheet.FirstOrDefault(c => c.TerritoryType.Row == PluginServices.ClientState.TerritoryType); var content = contentFinderConditionsSheet.FirstOrDefault(c => c.TerritoryType.RowId == PluginServices.ClientState.TerritoryType);
ActivityType newActivityContext; ActivityType newActivityContext;
ZoneType newZoneType; ZoneType newZoneType;
if (content == null) if (content.PvP)
{ {
// No content found, so we must be on the overworld newActivityContext = ActivityType.PvpDuty;
newActivityContext = ActivityType.None; newZoneType = ZoneType.Pvp;
newZoneType = ZoneType.Overworld;
} }
else else
{ {
if (content.PvP) newActivityContext = ActivityType.PveDuty;
{
newActivityContext = ActivityType.PvpDuty;
newZoneType = ZoneType.Pvp;
}
else
{
newActivityContext = ActivityType.PveDuty;
// Find correct member type // Find correct member type
var memberType = content.ContentMemberType.Row; var memberType = content.ContentMemberType.RowId;
if (content.RowId == 16 || content.RowId == 15) if (content.RowId == 16 || content.RowId == 15)
memberType = 2; // Praetorium and Castrum Meridianum memberType = 2; // Praetorium and Castrum Meridianum
else if (content.RowId == 735 || content.RowId == 778) else if (content.RowId == 735 || content.RowId == 778)
memberType = 127; // Bozja memberType = 127; // Bozja
// Check for ZoneType // Check for ZoneType
newZoneType = memberType switch newZoneType = memberType switch
{ {
2 => ZoneType.Doungen, 2 => ZoneType.Doungen,
3 => ZoneType.Raid, 3 => ZoneType.Raid,
4 => ZoneType.AllianceRaid, 4 => ZoneType.AllianceRaid,
127 => ZoneType.Foray, 127 => ZoneType.Foray,
_ => ZoneType.Doungen, _ => ZoneType.Doungen,
}; };
}
} }
CurrentActivityContext = new(newActivityContext, newZoneType); CurrentActivityContext = new(newActivityContext, newZoneType);

View File

@@ -1,4 +1,7 @@
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Lumina.Text.ReadOnly;
using System.Runtime.CompilerServices;
using System.Text;
namespace Pilz.Dalamud; namespace Pilz.Dalamud;
@@ -32,4 +35,10 @@ public static class Extensions
} }
} }
} }
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static string ParseString(this ReadOnlySeString readOnlySeString)
{
return Encoding.UTF8.GetString(readOnlySeString);
}
} }