Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

@PluginDescriptor(
name = "Quest Helper",
version = "1.0.7",
version = "1.0.8",
description = "Helps you with questing",
tags = { "quest", "helper", "overlay" }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1977,11 +1977,15 @@ private String chooseCorrectItemOption(QuestStep step, int itemId) {
private boolean applyDetailedQuestStep(DetailedQuestStep conditionalStep) {
if (conditionalStep instanceof NpcStep) return false;

WorldPoint stepWorldPoint = conditionalStep.getDefinedPoint() == null
? null
: conditionalStep.getDefinedPoint().getWorldPoint();

if (conditionalStep.getIconItemID() != -1
&& conditionalStep.getDefinedPoint().getWorldPoint() != null
&& !conditionalStep.getDefinedPoint().getWorldPoint().toWorldArea().hasLineOfSightTo(Microbot.getClient().getTopLevelWorldView(), Rs2Player.getWorldLocation())) {
if (Rs2Tile.areSurroundingTilesWalkable(conditionalStep.getDefinedPoint().getWorldPoint(), 1, 1)) {
WorldPoint nearestUnreachableWalkableTile = Rs2Tile.getNearestWalkableTileWithLineOfSight(conditionalStep.getDefinedPoint().getWorldPoint());
&& stepWorldPoint != null
&& !stepWorldPoint.toWorldArea().hasLineOfSightTo(Microbot.getClient().getTopLevelWorldView(), Rs2Player.getWorldLocation())) {
if (Rs2Tile.areSurroundingTilesWalkable(stepWorldPoint, 1, 1)) {
WorldPoint nearestUnreachableWalkableTile = Rs2Tile.getNearestWalkableTileWithLineOfSight(stepWorldPoint);
if (nearestUnreachableWalkableTile != null) {
return Rs2Walker.walkTo(nearestUnreachableWalkableTile, 0);
}
Expand All @@ -2008,11 +2012,11 @@ private boolean applyDetailedQuestStep(DetailedQuestStep conditionalStep) {
}
}

if (!usingItems && conditionalStep.getDefinedPoint().getWorldPoint() != null && !Rs2Walker.walkTo(conditionalStep.getDefinedPoint().getWorldPoint()))
if (!usingItems && stepWorldPoint != null && !Rs2Walker.walkTo(stepWorldPoint))
return true;

if (conditionalStep.getIconItemID() != -1 && conditionalStep.getDefinedPoint().getWorldPoint() != null
&& conditionalStep.getDefinedPoint().getWorldPoint().toWorldArea().hasLineOfSightTo(Microbot.getClient().getTopLevelWorldView(), Rs2Player.getWorldLocation())) {
if (conditionalStep.getIconItemID() != -1 && stepWorldPoint != null
&& stepWorldPoint.toWorldArea().hasLineOfSightTo(Microbot.getClient().getTopLevelWorldView(), Rs2Player.getWorldLocation())) {
if (conditionalStep.getQuestHelper().getQuest() == QuestHelperQuest.ZOGRE_FLESH_EATERS) {
if (conditionalStep.getIconItemID() == 4836) { // strange potion
lootGroundItem(ItemID.CUP_OF_TEA_4838, 20);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package net.runelite.client.plugins.microbot.questhelper;

import java.lang.reflect.Method;
import net.runelite.client.plugins.microbot.questhelper.steps.DetailedQuestStep;
import org.junit.Test;

import static org.junit.Assert.assertFalse;

public class QuestDetailedStepTest
{
@Test
public void locationlessDetailedStepDoesNotCrash() throws Exception
{
QuestScript script = new QuestScript();
DetailedQuestStep step = new DetailedQuestStep(null, "Read the notes.");
Method applyDetailedQuestStep = QuestScript.class.getDeclaredMethod(
"applyDetailedQuestStep", DetailedQuestStep.class);
applyDetailedQuestStep.setAccessible(true);

assertFalse((boolean) applyDetailedQuestStep.invoke(script, step));
}
}
Loading