[CLASS REWRITE] Rewritten Mysterious Old Man random.

This commit is contained in:
Fryslan
2016-06-06 13:35:59 +02:00
parent e76a96c716
commit 2b961d94b9
2 changed files with 18 additions and 12 deletions
+2 -1
View File
@@ -68,4 +68,5 @@ fabric.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.iml
*.iml
.i€dea
@@ -12,32 +12,37 @@ import org.rev317.min.api.wrappers.Npc;
*/
public class MysteriousOldMan implements Random {
Npc man;
private Npc man;
private final int ID = 410;
@Override
public boolean activate() {
for (Npc npc : Npcs.getNearest(410)) {
if (npc != null && npc.getDef() != null && npc.getInteractingCharacter().equals(Players.getMyPlayer())) {
man = npc;
return true;
}
}
return false;
this.man = man();
return man != null;
}
@Override
public void execute() {
if (man != null && man.getDef() != null && man.getInteractingCharacter().equals(Players.getMyPlayer())) {
man.interact(0);
if (this.man != null) {
man.interact(Npcs.Option.TALK_TO);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return !man.getInteractingCharacter().equals(Players.getMyPlayer());
return man == null || !man.getInteractingCharacter().equals(Players.getMyPlayer());
}
}, 1500);
}
}
private Npc man() {
for (Npc man : Npcs.getNearest(ID)) {
if (man != null && man.getDef() != null && man.getInteractingCharacter().equals(Players.getMyPlayer())) {
return man;
}
}
return null;
}
@Override
public String getName() {
return "Mysterious Old Man Solver";