Advertisement
Guest User

checkForWP

a guest
Mar 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. checkForWP: function () {
  2. if(this.checkedWPs.indexOf(me.area) > -1) { return false; }
  3. if(this.debugPather) { print("Pather: checkForWP"); }
  4. /*
  5. Pather.checkForWP();
  6. returns true = took wp false = couldn't / already have
  7. */
  8. if(me.inTown || this.wpAreas.indexOf(me.area) == -1 || getWaypoint(me.area)) {
  9. //If in town, not in an area with a wp or already have the area wp, ignore it
  10. //print("in town, not in an area with a wp or already have the area wp");
  11. }else{
  12. if(this.checkedWPs.length > 0) {
  13. if(this.checkedWPs.indexOf(me.area) > -1){
  14. return false;
  15. }
  16. }
  17. if(this.checkedWPs.length == 0) { this.checkedWPs = []; }
  18.  
  19. //Find the wp and see if it's worth taking it
  20. var wp = getUnit(2, "waypoint");
  21. //print("should take wp " + this.getAreaName(me.area) + ": " + !getWaypoint(me.area));
  22. //print("Distance to wp: " + getDistance(me,wp));
  23. if(wp) {
  24. if(!getWaypoint(me.area)) {
  25. //print("Trying to get wp");
  26. this.getWP(me.area);
  27. this.checkedWPs.push(me.area);
  28. return true;
  29. }
  30. }
  31. }
  32. this.checkedWPs.push(me.area);
  33. return false;
  34. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement