Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import apoc.*;
- import haven.*;
- import java.util.ArrayList;
- public class GlassScript extends Thread{
- public String scriptName = "Glass Script";
- public String[] options = {
- "Template 1", "Template 2", "Template 3",
- };
- HavenUtil m_util;
- //int m_modify;
- int m_startAt;
- boolean m_cycleOn;
- int m_directive;
- ArrayList<Gob> m_Kilns = new ArrayList<Gob>();
- ArrayList<Gob> m_lChests = new ArrayList<Gob>();
- ArrayList<Coord> m_tilesAround = new ArrayList<Coord>();
- ArrayList<Coord> m_sandAround = new ArrayList<Coord>();
- Coord m_closestSandTile;
- public void ApocScript(HavenUtil util, int option, int modify){
- m_util = util;
- m_option = option;
- m_modify = modify;
- }
- ArrayList<Gob> getKilnList(){
- ArrayList<Gob> list = new ArrayList<Gob>();
- ArrayList<Gob> sorted = new ArrayList<Gob>();
- list = m_util.getObjectsInRange("kiln", 1000);
- sorted = m_util.superSortGobList(list, false, false, false);
- return sorted;
- }
- ArrayList<Gob> getChestList() {
- ArrayList<Gob> listLC = new ArrayList<Gob>();
- ArrayList<Gob> sortedLC = new ArrayList<Gob>();
- listLC = m_util.getObjectsInRange("lchest", 1000);
- sortedLC = m_util.superSortGobList(listLC, false, false, false);
- return sortedLC;
- }
- ArrayList<Coord> getTilesAround() {
- ArrayList<Coord> getTilesAround = new ArrayList<Coord>();
- Coord playerPos;
- playerPos = m_util.getPlayerCoord();
- getTilesAround = getTilesInRegion(playerPos.add(-100, -100), playerPos.add(100, 100), 0);
- return getTilesAround;
- }
- ArrayList<Coord> getSandTiles() {
- ArrayList<Coord> getSandTiles = new ArrayList<Coord>();
- for ( Coord i : m_tilesAround) {
- int tileIDs = m_util.getTileID(i);
- if(tileIDs == 20) {
- getSandTiles.add(i);
- }
- }
- return getSandTiles;
- }
- ArrayList<Coord> getClosestSandTile() {
- double min = 1000;
- Coord closestSand = null;
- for(Coord g : m_sandAround){
- double dist = g.dist(m_util.getPlayerCoord());
- if(closestSand == null){
- min = dist;
- closestSand = g;
- }else if(min > dist){
- min = dist;
- closestSand = g;
- }
- }
- return closestSand;
- }
- void starter(){
- m_util.setPlayerSpeed(2);
- m_util.openInventory();
- m_Kilns = getKilnList();
- m_lChests = getChestList();
- m_tilesAround = getTilesAround();
- m_sandAround = getSandTiles();
- m_closestSandTile = getClosestSandTile();
- if(m_closestSandTile == null) {
- m_util.sendSlenmessage("Did not find sand tiles");
- }
- }
- Gob hearth(){
- m_util.sendAcction("theTrav", "hearth");
- while(!m_util.hasHourglass() && !m_util.stop){ m_util.wait(50);}
- while(m_util.hasHourglass() && !m_util.stop){ m_util.wait(50);}
- Gob hh = null;
- while( hh == null && !m_util.stop){
- hh = m_util.findClosestObjectInRange("hearth-play", 10);
- m_util.wait(500);
- }
- return hh;
- }
- public void run(){
- hearth();
- starter();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement