From ea56c35bc39fb3c3864f3d7b89bf3da4af7b9ce1 Mon Sep 17 00:00:00 2001 From: Kyle Kemp Date: Thu, 29 Aug 2024 06:56:32 -0500 Subject: [PATCH] requireHeld can be pinpointed --- src/app/pinpoint/pinpoint.component.html | 10 +++++++-- src/app/services/pinpoint.service.ts | 26 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/app/pinpoint/pinpoint.component.html b/src/app/pinpoint/pinpoint.component.html index 8cdc56d..05f1793 100644 --- a/src/app/pinpoint/pinpoint.component.html +++ b/src/app/pinpoint/pinpoint.component.html @@ -73,7 +73,7 @@ @let itemInfo = pinpointService.itemInformation(); - @if(itemInfo.length === 0) { + @if(itemInfo.length === 0 && pinpointService.pinpointItem()) {
@@ -126,6 +126,12 @@ } + @if(entry.mapAndObjectName) { + + MAPOBJECT: {{ entry.mapAndObjectName }} + + } + {{ entry.extraDescription }} @@ -151,7 +157,7 @@
- @if(npcInfo.uses.length === 0) { + @if(npcInfo.uses.length === 0 && pinpointService.pinpointNPC()) {
diff --git a/src/app/services/pinpoint.service.ts b/src/app/services/pinpoint.service.ts index 25eef3a..9965533 100644 --- a/src/app/services/pinpoint.service.ts +++ b/src/app/services/pinpoint.service.ts @@ -20,6 +20,7 @@ interface ItemUseDescriptor { containingItemName?: string; npcScriptName?: string; droptableName?: string; + mapAndObjectName?: string; extraDescription?: string; } @@ -321,6 +322,20 @@ export class PinpointService { f.drops.some((d) => d.result === item) ); + const heldItemsOnMap = mod.maps + .map((map) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return { + mapName: map.name, + helds: map.map.layers[8].objects + .filter((o: any) => (o.properties?.requireHeld as string) === item) + .flat(), + }; + }) + .filter((m) => m.helds.length > 0); + + console.log(heldItemsOnMap); + // format usages const containingItemDescs: ItemUseDescriptor[] = containingItems.map( (c) => ({ @@ -347,6 +362,16 @@ export class PinpointService { 'npcName' ); + const heldDescs: ItemUseDescriptor[] = heldItemsOnMap + .map((m) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + return m.helds.map((h: any) => ({ + mapAndObjectName: `${m.mapName} (${h.x / 64}, ${h.y / 64 - 1})`, + extraDescription: 'UNLOCKS', + })); + }) + .flat(); + const npcScriptDescs: ItemUseDescriptor[] = npcScriptUses.map((sc) => ({ npcScriptName: sc.tag, extraDescription: 'EQUIPMENT', @@ -364,6 +389,7 @@ export class PinpointService { ...npcDescs, ...npcScriptDescs, ...droptableDescs, + ...heldDescs, ] as ItemUseDescriptor[]; }