- Update broken delegates

- Replace hardcoded offsets with CS version
This commit is contained in:
Infi
2024-07-03 20:06:00 +02:00
parent c8e11ecb9b
commit c031739650
4 changed files with 24 additions and 52 deletions
+7 -28
View File
@@ -46,15 +46,6 @@ internal unsafe class GameFunctions : IDisposable
Marshal.FreeHGlobal(PlaceholderNamePtr);
}
internal nint GetInfoProxyByIndex(InfoProxyId proxyId)
{
var infoModule = InfoModule.Instance();
if (infoModule == null)
return nint.Zero;
return (nint) infoModule->GetInfoProxyById(proxyId);
}
internal void SendFriendRequest(string name, ushort world)
{
ListCommand(name, world, "friendlist");
@@ -114,31 +105,19 @@ internal unsafe class GameFunctions : IDisposable
if (agent == null || addon == null)
return;
var agentPtr = (nint) agent;
// addresses mentioned here are 7.0
// see the call near the end of AgentItemDetail.Update
// offsets valid as of 7.0
// Switch goes down to default, which is what we want
*(byte*) (agentPtr + 0x118) = itemKind == ItemPayload.ItemKind.EventItem ? (byte)8 : (byte)1;
// Item id when hovering over item in chat
*(uint*) (agentPtr + 0x11C) = id;
// Always 0 when hovering over item in chat
*(uint*) (agentPtr + 0x120) = 0;
// Skips a check to do with inventory
*(byte*) (agentPtr + 0x128) &= 0xEF;
// Is also set to the ID of the item when in chat
agent->ItemKind = itemKind == ItemPayload.ItemKind.EventItem ? ItemDetailKind.ChatEventItem : ItemDetailKind.ChatItem;
agent->TypeOrId = id;
agent->Index = 0;
agent->Flag1 &= 0xEF;
agent->ItemId = id;
// When set to 1, lets everything continue (one frame)
*(byte*) (agentPtr + 0x1B2) = 1;
// Skips early return
*(byte*) (agentPtr + 0x1B6) = 0;
agent->Flag2 = 1;
agent->Flag3 = 0;
// This just probably needs to be set
agent->AddonId = addon->Id;
// Skips early return
*(byte*) ((nint) atkStage + 0x2B4) |= 2;
atkStage->TooltipManager.Flag1 |= 2;
addon->Show(false, 15);
}