diff --git a/GatheringPaths/7.x - Dawntrail/Yak T'el/970__MIN.json b/GatheringPaths/7.x - Dawntrail/Yak T'el/970__MIN.json index a6abea06..3cafe531 100644 --- a/GatheringPaths/7.x - Dawntrail/Yak T'el/970__MIN.json +++ b/GatheringPaths/7.x - Dawntrail/Yak T'el/970__MIN.json @@ -104,7 +104,7 @@ "Y": 17.44523, "Z": -79.501 }, - "MinimumAngle": -100, + "MinimumAngle": -55, "MaximumAngle": 35 } ] diff --git a/Questionable/Controller/GatheringController.cs b/Questionable/Controller/GatheringController.cs index 18cb157f..446c38c2 100644 --- a/Questionable/Controller/GatheringController.cs +++ b/Questionable/Controller/GatheringController.cs @@ -120,8 +120,6 @@ internal sealed unsafe class GatheringController : MiniTaskController 0) return; - var currentNode = _currentRequest.Nodes[_currentRequest.CurrentIndex++ % _currentRequest.Nodes.Count]; - var director = UIState.Instance()->DirectorTodo.Director; if (director != null && director->EventHandlerInfo != null && director->EventHandlerInfo->EventId.ContentId == EventHandlerType.GatheringLeveDirector) @@ -132,6 +130,10 @@ internal sealed unsafe class GatheringController : MiniTaskController() .With(_currentRequest.Root.TerritoryId, MountTask.EMountIf.Always)); if (currentNode.Locations.Count > 1) @@ -184,6 +186,41 @@ internal sealed unsafe class GatheringController : MiniTaskController + /// For leves in particular, there's a good chance you're close enough to all nodes in the next group + /// but none are targetable (if they're not part of the randomly-picked route). + /// + private GatheringNode? FindNextTargetableNodeAndUpdateIndex(CurrentRequest currentRequest) + { + for (int i = 0; i < currentRequest.Nodes.Count; ++i) + { + int currentIndex = (currentRequest.CurrentIndex + i) % currentRequest.Nodes.Count; + var currentNode = currentRequest.Nodes[currentIndex]; + var locationsAsObjects = currentNode.Locations.Select(x => + _objectTable.FirstOrDefault(y => + currentNode.DataId == y.DataId && Vector3.Distance(x.Position, y.Position) < 0.1f)) + .ToList(); + + // Are any of the nodes too far away to be found? This is likely around ~100 yalms. All closer gathering + // points are always in the object table, even if they're not targetable. + if (locationsAsObjects.Any(x => x == null)) + { + currentRequest.CurrentIndex = (currentIndex + 1) % currentRequest.Nodes.Count; + return currentNode; + } + + // If any are targetable, this group should be targeted as part of the route. + if (locationsAsObjects.Any(x => x is { IsTargetable: true })) + { + currentRequest.CurrentIndex = (currentIndex + 1) % currentRequest.Nodes.Count; + return currentNode; + } + } + + // unsure what to even do here + return null; + } + public override IList GetRemainingTaskNames() { if (_currentTask != null)