From 5b75e305eb748ceeeec9c007ebf59f9cfee715fd Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Fri, 22 Nov 2024 21:56:41 +0100 Subject: [PATCH] update for API 11 --- .../ActivityContextManager.cs | 51 ++++++++----------- Pilz.Dalamud/Extensions.cs | 9 ++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Pilz.Dalamud/ActivityContexts/ActivityContextManager.cs b/Pilz.Dalamud/ActivityContexts/ActivityContextManager.cs index 35f5878..bec34f4 100644 --- a/Pilz.Dalamud/ActivityContexts/ActivityContextManager.cs +++ b/Pilz.Dalamud/ActivityContexts/ActivityContextManager.cs @@ -1,5 +1,5 @@ using Lumina.Excel; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace Pilz.Dalamud.ActivityContexts; @@ -36,44 +36,35 @@ public class ActivityContextManager : IDisposable 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; ZoneType newZoneType; - if (content == null) + if (content.PvP) { - // No content found, so we must be on the overworld - newActivityContext = ActivityType.None; - newZoneType = ZoneType.Overworld; + newActivityContext = ActivityType.PvpDuty; + newZoneType = ZoneType.Pvp; } else { - if (content.PvP) - { - newActivityContext = ActivityType.PvpDuty; - newZoneType = ZoneType.Pvp; - } - else - { - newActivityContext = ActivityType.PveDuty; + newActivityContext = ActivityType.PveDuty; - // Find correct member type - var memberType = content.ContentMemberType.Row; - if (content.RowId == 16 || content.RowId == 15) - memberType = 2; // Praetorium and Castrum Meridianum - else if (content.RowId == 735 || content.RowId == 778) - memberType = 127; // Bozja + // Find correct member type + var memberType = content.ContentMemberType.RowId; + if (content.RowId == 16 || content.RowId == 15) + memberType = 2; // Praetorium and Castrum Meridianum + else if (content.RowId == 735 || content.RowId == 778) + memberType = 127; // Bozja - // Check for ZoneType - newZoneType = memberType switch - { - 2 => ZoneType.Doungen, - 3 => ZoneType.Raid, - 4 => ZoneType.AllianceRaid, - 127 => ZoneType.Foray, - _ => ZoneType.Doungen, - }; - } + // Check for ZoneType + newZoneType = memberType switch + { + 2 => ZoneType.Doungen, + 3 => ZoneType.Raid, + 4 => ZoneType.AllianceRaid, + 127 => ZoneType.Foray, + _ => ZoneType.Doungen, + }; } CurrentActivityContext = new(newActivityContext, newZoneType); diff --git a/Pilz.Dalamud/Extensions.cs b/Pilz.Dalamud/Extensions.cs index 5f195b0..924e7e2 100644 --- a/Pilz.Dalamud/Extensions.cs +++ b/Pilz.Dalamud/Extensions.cs @@ -1,4 +1,7 @@ using Dalamud.Game.Text.SeStringHandling; +using Lumina.Text.ReadOnly; +using System.Runtime.CompilerServices; +using System.Text; 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); + } }