فهرست منبع

API11 update.

SheepGoMeh 1 سال پیش
والد
کامیت
fefac1eccf
4فایلهای تغییر یافته به همراه47 افزوده شده و 54 حذف شده
  1. 2 2
      HuntBuddy/HuntBuddy.csproj
  2. 11 12
      HuntBuddy/Location.cs
  3. 22 28
      HuntBuddy/Plugin.cs
  4. 12 12
      HuntBuddy/packages.lock.json

+ 2 - 2
HuntBuddy/HuntBuddy.csproj

@@ -3,7 +3,7 @@
     <PropertyGroup>
         <TargetFramework>net8-windows</TargetFramework>
         <Nullable>enable</Nullable>
-        <AssemblyVersion>1.2.0.2</AssemblyVersion>
+        <AssemblyVersion>1.2.0.3</AssemblyVersion>
         <FileVersion>$(AssemblyVersion)</FileVersion>
         <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
         <RootNamespace>HuntBuddy</RootNamespace>
@@ -54,6 +54,6 @@
         </Reference>
     </ItemGroup>
     <ItemGroup>
-        <PackageReference Include="DalamudPackager" Version="2.1.13" />
+        <PackageReference Include="DalamudPackager" Version="11.0.0" />
     </ItemGroup>
 </Project>

+ 11 - 12
HuntBuddy/Location.cs

@@ -5,7 +5,7 @@ using System.Numerics;
 
 using FFXIVClientStructs.FFXIV.Client.UI.Agent;
 
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
 
 using MapType = FFXIVClientStructs.FFXIV.Client.UI.Agent.MapType;
 
@@ -621,7 +621,7 @@ public static class Location {
 	}
 
 	private static (int X, int Y) MapToWorldCoordinates(Vector2 pos, uint mapId) {
-		ushort scale = Service.DataManager.GetExcelSheet<Map>()?.GetRow(mapId)?.SizeFactor ?? 100;
+		ushort scale = Service.DataManager.GetExcelSheet<Map>().GetRowOrDefault(mapId)?.SizeFactor ?? 100;
 		float num = scale / 100f;
 		float x = (float)(((pos.X - 1.0) * num / 41.0 * 2048.0) - 1024.0) / num * 1000f;
 		float y = (float)(((pos.Y - 1.0) * num / 41.0 * 2048.0) - 1024.0) / num * 1000f;
@@ -644,35 +644,34 @@ public static class Location {
 	}
 
 	public static void TeleportToNearestAetheryte(uint territoryType, uint mapId, uint mobHuntId) {
-		Map? mapRow = Service.DataManager.Excel.GetSheet<Map>()?.GetRow(mapId);
+		Map? mapRow = Service.DataManager.Excel.GetSheet<Map>().GetRowOrDefault(mapId);
 
 		if (mapRow == null) {
 			return;
 		}
 
-		ushort? nearestAetheryteId = Service.DataManager.Excel.GetSheet<MapMarker>()
-			?.Where(x => x.DataType == 3 && x.RowId == mapRow.MapMarkerRange)
+		uint? nearestAetheryteId = Service.DataManager.GetSubrowExcelSheet<MapMarker>()[mapRow.Value.MapMarkerRange]
+			.Where(x => x.DataType == 3 && x.RowId == mapRow.Value.MapMarkerRange)
 			.Select(
 				x => new {
 					distance = Vector2.DistanceSquared(
 						Database[mobHuntId].Coordinate,
-						ConvertPixelPositionToMapCoordinate(x.X, x.Y, mapRow.SizeFactor)),
-					rowId = x.DataKey
+						ConvertPixelPositionToMapCoordinate(x.X, x.Y, mapRow.Value.SizeFactor)),
+					rowId = x.DataKey.RowId
 				})
 			.OrderBy(x => x.distance)
 			.FirstOrDefault()?.rowId;
 
 		Aetheryte? nearestAetheryte =
 			territoryType == 399 // Support the unique case of aetheryte not being in the same map
-				? mapRow.TerritoryType?.Value?.Aetheryte.Value
-				: Service.DataManager.Excel.GetSheet<Aetheryte>()?.FirstOrDefault(
-					x =>
-						x.IsAetheryte && x.Territory.Row == territoryType && x.RowId == nearestAetheryteId);
+				? mapRow.Value.TerritoryType.ValueNullable?.Aetheryte.Value
+				: Service.DataManager.GetExcelSheet<Aetheryte>().FirstOrDefault(x =>
+					x.IsAetheryte && x.Territory.Value.RowId == territoryType && x.RowId == nearestAetheryteId);
 
 		if (nearestAetheryte == null) {
 			return;
 		}
 
-		Plugin.TeleportConsumer?.Teleport(nearestAetheryte.RowId);
+		Plugin.TeleportConsumer?.Teleport(nearestAetheryte.Value.RowId);
 	}
 }

+ 22 - 28
HuntBuddy/Plugin.cs

@@ -19,8 +19,9 @@ using HuntBuddy.Windows;
 using ImGuiNET;
 
 using Lumina.Excel;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
 using Lumina.Text;
+using Lumina.Text.ReadOnly;
 
 namespace HuntBuddy;
 
@@ -171,18 +172,15 @@ public class Plugin: IDalamudPlugin {
 							openType = this.Configuration.IncludeAreaOnMap
 								? Location.OpenType.ShowOpen
 								: Location.OpenType.MarkerOpen;
-							SeString? expansion =
-								Service.DataManager.Excel.GetSheet<TerritoryType>()!.GetRow(Service.ClientState
-									.TerritoryType)!.ExVersion.Value!.Name;
+							string expansion = Service.DataManager.GetExcelSheet<TerritoryType>()
+								.GetRow(Service.ClientState.TerritoryType).ExVersion.Value.Name.ToString();
 							Service.PluginLog.Information(
 								$"Player is in a zone from {expansion}; known expansions are {string.Join(", ", this.MobHuntEntries.Keys)}");
-							List<MobHuntEntry> candidates = this.MobHuntEntries.ContainsKey(expansion)
-								? this.MobHuntEntries[expansion]
-									.Values
-									.SelectMany(l => l)
-									.Where(filterPredicate)
-									.ToList()
-								: [];
+							List<MobHuntEntry> candidates =
+								this.MobHuntEntries.TryGetValue(expansion,
+									out Dictionary<KeyValuePair<uint, string>, List<MobHuntEntry>>? entry)
+									? entry.Values.SelectMany(l => l).Where(filterPredicate).ToList()
+									: [];
 							// if we didn't find any candidates, we try a different method to fill it
 							if (candidates.Count == 0) {
 								Service.PluginLog.Information(
@@ -261,7 +259,7 @@ public class Plugin: IDalamudPlugin {
 	public unsafe void ReloadData() {
 		this.MobHuntEntries.Clear();
 		List<MobHuntEntry> mobHuntList = [];
-		ExcelSheet<MobHuntOrder>? mobHuntOrderSheet = Service.DataManager.Excel.GetSheet<MobHuntOrder>()!;
+		SubrowExcelSheet<MobHuntOrder> mobHuntOrderSheet = Service.DataManager.GetSubrowExcelSheet<MobHuntOrder>();
 
 		foreach (BillEnum billNumber in Enum.GetValues<BillEnum>()) {
 			if (!this.MobHuntStruct->ObtainedBillEnumFlags.HasFlag((ObtainedBillEnum)(1 << (int)billNumber))) {
@@ -274,32 +272,28 @@ public class Plugin: IDalamudPlugin {
 			uint rowId = mobHuntOrderTypeRow.OrderStart.Value!.RowId +
 						 (uint)(this.MobHuntStruct->BillOffset[mobHuntOrderTypeRow.RowId] - 1);
 
-			if (rowId > mobHuntOrderSheet.RowCount) {
-				continue;
-			}
-
-			IEnumerable<MobHuntOrder> mobHuntOrderRows = mobHuntOrderSheet.Where(x => x.RowId == rowId);
+			IEnumerable<MobHuntOrder> mobHuntOrderRows = mobHuntOrderSheet[rowId];
 
 			foreach (MobHuntOrder mobHuntOrderRow in mobHuntOrderRows) {
 				MobHuntEntry? mobHuntEntry =
-					mobHuntList.FirstOrDefault(x => x.MobHuntId == mobHuntOrderRow.Target.Value!.Name.Row);
+					mobHuntList.FirstOrDefault(x => x.MobHuntId == mobHuntOrderRow.Target.Value.Name.RowId);
 
 				if (mobHuntEntry == null) {
 					mobHuntList.Add(
 						new MobHuntEntry {
 							Name = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(
-								mobHuntOrderRow.Target.Value!.Name.Value!.Singular),
+								mobHuntOrderRow.Target.Value.Name.Value.Singular.ToString()),
 							TerritoryName =
-								mobHuntOrderRow.Target.Value!.TerritoryType.Value!.PlaceName.Value!.Name,
-							ExpansionName = mobHuntOrderRow.Target.Value!.TerritoryType.Value.TerritoryType.Value!
-								.ExVersion.Value!.Name,
-							ExpansionId = mobHuntOrderRow.Target.Value!.TerritoryType.Value.TerritoryType.Value!
-								.ExVersion.Row,
-							MapId = mobHuntOrderRow.Target.Value!.TerritoryType.Row,
-							TerritoryType = mobHuntOrderRow.Target.Value!.TerritoryType.Value.TerritoryType.Row,
-							MobHuntId = mobHuntOrderRow.Target.Value!.Name.Row,
+								mobHuntOrderRow.Target.Value.TerritoryType.Value.PlaceName.Value.Name.ToString(),
+							ExpansionName = mobHuntOrderRow.Target.Value.TerritoryType.Value.TerritoryType.Value
+								.ExVersion.Value.Name.ToString(),
+							ExpansionId = mobHuntOrderRow.Target.Value.TerritoryType.Value.TerritoryType.Value
+								.ExVersion.RowId,
+							MapId = mobHuntOrderRow.Target.Value.TerritoryType.RowId,
+							TerritoryType = mobHuntOrderRow.Target.Value.TerritoryType.Value.TerritoryType.RowId,
+							MobHuntId = mobHuntOrderRow.Target.Value.Name.RowId,
 							IsEliteMark = mobHuntOrderTypeRow.Type == 2,
-							CurrentKillsOffset = (5 * (uint)billNumber) + mobHuntOrderRow.SubRowId,
+							CurrentKillsOffset = (5 * (uint)billNumber) + mobHuntOrderRow.SubrowId,
 							NeededKills = mobHuntOrderRow.NeededKills,
 							Icon = mobHuntOrderRow.Target.Value.Icon,
 						});

+ 12 - 12
HuntBuddy/packages.lock.json

@@ -1,13 +1,13 @@
 {
-	"version": 1,
-	"dependencies": {
-		"net8.0-windows7.0": {
-			"DalamudPackager": {
-				"type": "Direct",
-				"requested": "[2.1.13, )",
-				"resolved": "2.1.13",
-				"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
-			}
-		}
-	}
-}
+  "version": 1,
+  "dependencies": {
+    "net8.0-windows7.0": {
+      "DalamudPackager": {
+        "type": "Direct",
+        "requested": "[11.0.0, )",
+        "resolved": "11.0.0",
+        "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
+      }
+    }
+  }
+}