Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.65 KB | None | 0 0
  1. import apoc.*;
  2. import haven.*;
  3. import java.util.ArrayList;
  4.  
  5. public class GlassScript extends Thread{
  6.     public String scriptName = "Glass Script";
  7.     public String[] options = {
  8.         "Template 1", "Template 2", "Template 3",
  9.     };
  10.    
  11.     HavenUtil m_util;
  12.     //int m_modify;
  13.     int m_startAt;
  14.         boolean m_cycleOn;
  15.         int m_directive;
  16.         ArrayList<Gob> m_Kilns = new ArrayList<Gob>();
  17.         ArrayList<Gob> m_lChests = new ArrayList<Gob>();
  18.         ArrayList<Coord> m_tilesAround = new ArrayList<Coord>();
  19.         ArrayList<Coord> m_sandAround = new ArrayList<Coord>();
  20.         Coord m_closestSandTile;
  21.        
  22.        
  23.         public void ApocScript(HavenUtil util, int option, int modify){
  24.         m_util = util;
  25.         m_option = option;
  26.         m_modify = modify;
  27.     }
  28.        
  29.        
  30.         ArrayList<Gob> getKilnList(){
  31.         ArrayList<Gob> list = new ArrayList<Gob>();
  32.         ArrayList<Gob> sorted = new ArrayList<Gob>();
  33.        
  34.         list = m_util.getObjectsInRange("kiln", 1000);
  35.         sorted = m_util.superSortGobList(list, false, false, false);
  36.                 return sorted;
  37.         }
  38.        
  39.     ArrayList<Gob> getChestList() {
  40.             ArrayList<Gob> listLC = new ArrayList<Gob>();
  41.             ArrayList<Gob> sortedLC = new ArrayList<Gob>();
  42.            
  43.             listLC = m_util.getObjectsInRange("lchest", 1000);
  44.             sortedLC = m_util.superSortGobList(listLC, false, false, false);
  45.             return sortedLC;
  46.            
  47.         }
  48.        
  49.         ArrayList<Coord> getTilesAround() {
  50.             ArrayList<Coord> getTilesAround = new ArrayList<Coord>();
  51.             Coord playerPos;
  52.             playerPos = m_util.getPlayerCoord();
  53.                    
  54.             getTilesAround = getTilesInRegion(playerPos.add(-100, -100), playerPos.add(100, 100), 0);
  55.             return getTilesAround;
  56.  
  57.         }
  58.        
  59.         ArrayList<Coord> getSandTiles() {
  60.             ArrayList<Coord> getSandTiles = new ArrayList<Coord>();
  61.             for ( Coord i : m_tilesAround) {
  62.                 int tileIDs = m_util.getTileID(i);
  63.                 if(tileIDs == 20) {
  64.                     getSandTiles.add(i);
  65.                 }
  66.             }
  67.             return getSandTiles;
  68.         }
  69.        
  70.         ArrayList<Coord> getClosestSandTile() {
  71.             double min = 1000;
  72.         Coord closestSand = null;
  73.         for(Coord g : m_sandAround){
  74.             double dist = g.dist(m_util.getPlayerCoord());
  75.             if(closestSand == null){
  76.                 min = dist;
  77.                 closestSand = g;
  78.             }else if(min > dist){
  79.                 min = dist;
  80.                 closestSand = g;
  81.             }
  82.         }
  83.         return closestSand;
  84.         }
  85.        
  86.         void starter(){
  87.             m_util.setPlayerSpeed(2);
  88.             m_util.openInventory();
  89.             m_Kilns = getKilnList();
  90.             m_lChests = getChestList();
  91.             m_tilesAround = getTilesAround();
  92.             m_sandAround = getSandTiles();
  93.             m_closestSandTile = getClosestSandTile();
  94.             if(m_closestSandTile == null) {
  95.                 m_util.sendSlenmessage("Did not find sand tiles");
  96.             }
  97.     }
  98.        
  99.        
  100.         Gob hearth(){
  101.             m_util.sendAcction("theTrav", "hearth");
  102.             while(!m_util.hasHourglass() && !m_util.stop){ m_util.wait(50);}
  103.             while(m_util.hasHourglass() && !m_util.stop){ m_util.wait(50);}
  104.            
  105.             Gob hh = null;
  106.             while( hh == null && !m_util.stop){
  107.             hh = m_util.findClosestObjectInRange("hearth-play", 10);
  108.             m_util.wait(500);
  109.                 }
  110.            
  111.             return hh;
  112.             }
  113.        
  114.        
  115.        
  116.        
  117.        
  118.        
  119.        
  120.     public void run(){
  121.                 hearth();
  122.         starter();
  123.                
  124.                
  125.     }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement