Skip to content

Commit

Permalink
requireHeld can be pinpointed
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 29, 2024
1 parent 6ee29fc commit ea56c35
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/pinpoint/pinpoint.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

@let itemInfo = pinpointService.itemInformation();

@if(itemInfo.length === 0) {
@if(itemInfo.length === 0 && pinpointService.pinpointItem()) {
<div class="flex flex-row gap-2 flex-wrap w-full">
<div class="form-column">
<div class="form-row">
Expand Down Expand Up @@ -126,6 +126,12 @@
</span>
}

@if(entry.mapAndObjectName) {
<span class="ml-1">
MAPOBJECT: {{ entry.mapAndObjectName }}
</span>
}

<span class="ml-1">
{{ entry.extraDescription }}
</span>
Expand All @@ -151,7 +157,7 @@

<div class="form-column">

@if(npcInfo.uses.length === 0) {
@if(npcInfo.uses.length === 0 && pinpointService.pinpointNPC()) {
<div class="flex flex-row gap-2 flex-wrap w-full">
<div class="form-column">
<div class="form-row">
Expand Down
26 changes: 26 additions & 0 deletions src/app/services/pinpoint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface ItemUseDescriptor {
containingItemName?: string;
npcScriptName?: string;
droptableName?: string;
mapAndObjectName?: string;

extraDescription?: string;
}
Expand Down Expand Up @@ -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) => ({
Expand All @@ -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',
Expand All @@ -364,6 +389,7 @@ export class PinpointService {
...npcDescs,
...npcScriptDescs,
...droptableDescs,
...heldDescs,
] as ItemUseDescriptor[];
}

Expand Down

0 comments on commit ea56c35

Please sign in to comment.