Skretzo / shortest-path

Pathfinding for Old School RuneScape
BSD 2-Clause "Simplified" License
14 stars 27 forks source link

Add transports for player items #68

Closed SpecialMike closed 4 months ago

SpecialMike commented 5 months ago

Closes #27

This adds support for item transports from teleportation items in the player's inventory and equipment. This is done by adding new transport definitions with no origin, then adding in those transports during the pathfinding process - this is due to the wilderness's teleportation restrictions, so the pathfinder finds the closest valid tile the item can be used before adding it. In addition, transports are also noted on the tooltip when hovering over the tile just before the transport on the world map.

A sample path from deep wilderness to GE: image

The options presented to the user are an enum so that they can choose different modes. They are essentially a choice between all or held items, and consumable or not. Let me know if the wording I landed on makes sense, there's only so much room in the settings UI for the setting name and the options.

Before getting this pulled in though, I'd like to spend a bit more time adding in a bunch of item transports. This currently just has most of the enchanted jewelry along with the ardy cape. Are you fine with adding transports that I can't directly test? It should all work since it's just different requirements and destinations, but I'm not super far in the game so there's only so much I can test for each item.

Another question I had on this is about the items.tsv file. I had to add two new columns, but they're going to be useless for all other transport types (except spells probably). Is that fine, or do you think it would be a good idea to have a sort-of "transport-specific" column in the tsv files where arbitrary data specific to that transport can be held?

Finally, this also fixes a small bug in the renderTransports function where transports' origin was being compared to itself for the plane check.

Skretzo commented 5 months ago

Are you fine with adding transports that I can't directly test?

Yes. You might already know about this, but the wiki has crowdsourced most teleport locations (not up-to-date, but still usually good enough) which can be viewed as pins on a map that can be hovered to see destination tiles and clicked to see which teleport option was used: mejrs map. Most teleports have a radius, so pick the centre coordinate. image

I had to add two new columns, but they're going to be useless for all other transport types (except spells probably). Is that fine, or do you think it would be a good idea to have a sort-of "transport-specific" column in the tsv files where arbitrary data specific to that transport can be held?

What you have done now is good. We might change some of this later if we find a better format, but it seems good enough for now. As for transport-specific info I want to eventually incorporate varbits similar to how the Quest Helper does to know for certain that the player has/has not access to certain transports, so the format probably needs to change at some point regardless of this feature.

SpecialMike commented 5 months ago

Yes. You might already know about this, but the wiki has crowdsourced most teleport locations (not up-to-date, but still usually good enough) which can be viewed as pins on a map that can be hovered to see destination tiles and clicked to see which teleport option was used: mejrs map. Most teleports have a radius, so pick the centre coordinate.

Thanks for that additional source of information! I've been mostly looking at the wiki's teleports list, and looking at the map widget's source on each item's page to figure out the center of the radius they have on there.

I want to eventually incorporate varbits similar to how the Quest Helper does to know for certain that the player has/has not access to certain transports, so the format probably needs to change at some point regardless of this feature.

I'm actually thinking of adding a varbit column for the items for some items that can change their destinations, like the Digsite Pendant and Home Teleport Tablet. Something simple for now like a semi-colon delimited list of <varbit_id>=<value>, where the id can be passed directly to client.getVarbitValue(). I'm not very experienced with runelite development, so let me know if that's not likely to be sufficient.

SpecialMike commented 5 months ago

Took a little while, but I got all of the teleportation items listed on the wiki added. Along with those, I added varbit checks for some of them that I was able to find. There are a few more items with varbits that need to be checked, but someone will have to test to figure those out.

I think this is ready for you to look over.