increase max wait time, null pointer catch

This commit is contained in:
RedSparr0w
2019-10-21 10:41:55 +13:00
parent 09cb97bdca
commit ee0c396a24
2 changed files with 9 additions and 10 deletions
-3
View File
@@ -3,10 +3,7 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment=""> <list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ParaScript.iml" beforeDir="false" afterPath="$PROJECT_DIR$/ParaScript.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Npcs.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Npcs.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Thieving.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Thieving.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Thieving.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Thieving.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@@ -32,17 +32,19 @@ public class Thieving implements Strategy {
public void execute() { public void execute() {
victim.interact(Npcs.Option.PICKPOCKET); victim.interact(Npcs.Option.PICKPOCKET);
Time.sleep(1000); Time.sleep(1000);
//Wait for the Player to finish pickpocketing //Wait for the Player to finish pickpocketing (max 2 seconds)
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500); Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 2000);
} }
private Npc victim(){ private Npc victim(){
int[] npc_to_thieve = Variables.thieving_npc_selected.getIDs(); try {
for(Npc victim : Npcs.getNearest(npc_to_thieve)){ int[] npc_to_thieve = Variables.thieving_npc_selected.getIDs();
if(victim != null){ for (Npc victim : Npcs.getNearest(npc_to_thieve)) {
return victim; if (victim != null) {
return victim;
}
} }
} } catch (Exception err){}
return null; return null;
} }
} }