Tsunder / Pardus-Sweetener

A browser extension that enhances the user interface of the online game Pardus
3 stars 3 forks source link

Mission destination tracking and syndicates #111

Closed SognoSapphire closed 3 years ago

SognoSapphire commented 3 years ago

Describe the bug On universes where I am a member of a syndicate the minimap no longer displays the coordinates of the mission destination. I am using the condensed mission listing on bulletin board (the table one, without the " wants you to ..." text)

To Reproduce

  1. Get premium and enable the condensed mission listing
  2. Join a sindicate
  3. Select a mission with coordinates (deliver to destination or kill NPC at destination)
  4. Go to nav, look at the minimap, coordinates of destination are not highlighted
  5. Leave syndicate (or try other universe): repeat step 3 and 4, mission destination shows up

Expected behavior Coordinates for the target on the minimap should still be highlighted

Additional context Developer console has this log (expanded)

Mission.parseMission @ VM3607 missions.js:125
clickedMission @ VM3608 bulletinboard.js:49
childList (async)
(anonymous) @ bulletin_board_accept.php?m=188600729:4

The issue seems to be that the code extracts information from the mission table using indexes which are offset by 1 when member of a syndicate (there is an additional column added): https://github.com/Tsunder/Pardus-Sweetener/blob/7762d63cfab738304cd431331e62da4e5c46d5d7/chrome/missions.js#L120-L149

Perhaps we need a check like this at the beginning?

... // existing code
var data = mission.getElementsByTagName( 'td' ); 

// new code here
syndicate_member_offset = data.length == 11 ? 1 : 0;

// existing code that gets updated
output[ 'faction' ] = data[0 + syndicate_member_offset].firstChild.src; 
Tsunder commented 3 years ago

redressed in #114