fix: update for 6.0 changes
This commit is contained in:
parent
61fffed0df
commit
6444e4375a
|
@ -24,9 +24,10 @@ namespace GoodMemory {
|
|||
Miscellaneous = 2_633, // riding maps, blu totems, emotes/dances, hairstyles
|
||||
Cards = 3_357, // cards
|
||||
GathererBooks = 4_107, // gatherer books
|
||||
OrchestrionRolls = 5_845, // orchestrion rolls
|
||||
OrchestrionRolls = 25_183, // orchestrion rolls
|
||||
// these appear to be server-side
|
||||
// FieldNotes = 19_743, // bozjan field notes
|
||||
FashionAccessories = 20_086, // fashion accessories
|
||||
// missing: 2_894 (always false)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace GoodMemory {
|
|||
public class GameFunctions {
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
private delegate byte HasItemActionUnlockedDelegate(long itemActionId);
|
||||
private delegate byte HasItemActionUnlockedDelegate(IntPtr mem);
|
||||
|
||||
private readonly HasItemActionUnlockedDelegate _hasItemActionUnlocked;
|
||||
|
||||
|
@ -19,9 +19,9 @@ namespace GoodMemory {
|
|||
public GameFunctions(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
|
||||
var hasIaUnlockedPtr = this.Plugin.SigScanner.ScanText("48 83 EC 28 E8 ?? ?? ?? ?? 48 85 C0 0F 84 ?? ?? ?? ??");
|
||||
var hasCardPtr = this.Plugin.SigScanner.ScanText("40 53 48 83 EC 20 48 8B D9 66 85 D2 74 ??");
|
||||
this._cardStaticAddr = this.Plugin.SigScanner.GetStaticAddressFromSig("41 0F B7 17 48 8D 0D ?? ?? ?? ??");
|
||||
var hasIaUnlockedPtr = this.Plugin.SigScanner.ScanText("E8 ?? ?? ?? ?? 84 C0 75 A9");
|
||||
var hasCardPtr = this.Plugin.SigScanner.ScanText("40 53 48 83 EC 20 48 8B D9 66 85 D2 74");
|
||||
this._cardStaticAddr = this.Plugin.SigScanner.GetStaticAddressFromSig("41 0F B7 17 48 8D 0D");
|
||||
|
||||
if (hasIaUnlockedPtr == IntPtr.Zero || hasCardPtr == IntPtr.Zero || this._cardStaticAddr == IntPtr.Zero) {
|
||||
throw new ApplicationException("Could not get pointers for game functions");
|
||||
|
@ -41,7 +41,7 @@ namespace GoodMemory {
|
|||
var type = (ActionType) action.Type;
|
||||
|
||||
if (type != ActionType.Cards) {
|
||||
return this.HasItemActionUnlocked(action.RowId);
|
||||
return this.HasItemActionUnlocked(item);
|
||||
}
|
||||
|
||||
var cardId = item.AdditionalData;
|
||||
|
@ -49,8 +49,26 @@ namespace GoodMemory {
|
|||
return card != null && this.HasCard((ushort) card.RowId);
|
||||
}
|
||||
|
||||
private bool HasItemActionUnlocked(long itemActionId) {
|
||||
return this._hasItemActionUnlocked(itemActionId) == 1;
|
||||
private unsafe bool HasItemActionUnlocked(Item item) {
|
||||
var itemAction = item.ItemAction.Value;
|
||||
if (itemAction == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var type = (ActionType) itemAction.Type;
|
||||
|
||||
var mem = Marshal.AllocHGlobal(256);
|
||||
*(uint*) (mem + 142) = itemAction.RowId;
|
||||
|
||||
if (type == ActionType.OrchestrionRolls) {
|
||||
*(uint*) (mem + 112) = item.AdditionalData;
|
||||
}
|
||||
|
||||
var ret = this._hasItemActionUnlocked(mem) == 1;
|
||||
|
||||
Marshal.FreeHGlobal(mem);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private bool HasCard(ushort cardId) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>1.0.9</Version>
|
||||
<Version>1.0.10</Version>
|
||||
<TargetFramework>net5-windows</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
@ -24,8 +24,8 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.2"/>
|
||||
<PackageReference Include="XivCommon" Version="3.0.1"/>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.5"/>
|
||||
<PackageReference Include="XivCommon" Version="4.0.0-alpha.1"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\icon.png" Link="images/icon.png" CopyToOutputDirectory="PreserveNewest" Visible="false"/>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using Dalamud.Plugin;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game;
|
||||
|
@ -63,20 +62,18 @@ namespace GoodMemory {
|
|||
// Faded Copies
|
||||
if (item.FilterGroup == 12 && item.ItemUICategory.Value?.RowId == 94 && item.LevelItem.Value?.RowId == 1) {
|
||||
var recipeResults = this.DataManager.GetExcelSheet<Recipe>()!
|
||||
.Where(recipe => recipe.UnkStruct5.Any(ritem => ritem.ItemIngredient == item.RowId))
|
||||
.Where(recipe => recipe.UnkData5.Any(ritem => ritem.ItemIngredient == item.RowId))
|
||||
.Select(recipe => recipe.ItemResult.Value)
|
||||
.Where(result => result != null)
|
||||
.ToArray();
|
||||
|
||||
foreach (var result in recipeResults) {
|
||||
var resultAction = result?.ItemAction?.Value;
|
||||
if (!ActionTypeExt.IsValidAction(resultAction)) {
|
||||
if (result == null || (ActionType?) resultAction?.Type != ActionType.OrchestrionRolls) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Debug.Assert(resultAction != null, nameof(resultAction) + " != null");
|
||||
|
||||
uint orchId = resultAction.Data[0];
|
||||
var orchId = result.AdditionalData;
|
||||
var orch = this.DataManager.GetExcelSheet<Orchestrion>()!.GetRow(orchId);
|
||||
if (orch == null) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue