diff --git a/bin/sig/HousingTracker.class b/bin/sig/HousingTracker.class index 13d7284..816d95c 100644 Binary files a/bin/sig/HousingTracker.class and b/bin/sig/HousingTracker.class differ diff --git a/screenshot.png b/screenshot.png index de81dfe..3cde427 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/src/sig/HousingTracker.java b/src/sig/HousingTracker.java index 9f67770..e8872b2 100644 --- a/src/sig/HousingTracker.java +++ b/src/sig/HousingTracker.java @@ -11,6 +11,7 @@ import java.awt.Robot; import java.awt.event.KeyEvent; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +26,7 @@ public class HousingTracker{ public static final int SCANSTART_X = 601; public static final int SCANSTART_Y = 415; public static final Rectangle SCANSTART_REGION = new Rectangle(601,415,330,24); - public static final Rectangle NAMESTART_REGION = new Rectangle(119,0,16,11); + public static final Rectangle NAMESTART_REGION = new Rectangle(119,0,4,11); public static Map> PLOTSTATE = new HashMap>(); public static final String[] REGIONS = new String[] {"Kugane","Gridania","Uldah","Limsa"}; @@ -35,6 +36,14 @@ public class HousingTracker{ try { r = new Robot(); + for (String REGION : REGIONS) { + List house_list = new ArrayList(); + PLOTSTATE.put(REGION,house_list); + for (int i=0;i<1440;i++) { + house_list.add(true); + } + } + r.delay(3000); //Starts at 601,415 /*BufferedImage i = CaptureScreen(env, r); @@ -45,7 +54,9 @@ public class HousingTracker{ }*/ //CompleteALoadingPhase(); //Walk(Direction.RIGHT,1000); - //OpenResidentialMenu(); + if (OpenResidentialMenu()) { + CaptureResidentialData(); + } } catch (AWTException e) { e.printStackTrace(); } @@ -54,19 +65,62 @@ public class HousingTracker{ private static void CaptureResidentialData() { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); BufferedImage i = null; - try { - i = CaptureScreen(env); - } catch (IOException e1) { - e1.printStackTrace(); - } - for (int x=0;x<2;x++) { - for (int y=0;y<15;y++) { - Image plot_img = i.getSubimage(SCANSTART_REGION.x+SCANSTART_REGION.width*x,SCANSTART_REGION.y+SCANSTART_REGION.height*y,SCANSTART_REGION.width,NAMESTART_REGION.height); + for (int ward=0;ward<24;ward++) { + for (int tab=0;tab<2;tab++) { + try { + i = CaptureScreen(env); + } catch (IOException e1) { + e1.printStackTrace(); + } + for (int x=0;x<2;x++) { + for (int y=0;y<15;y++) { + BufferedImage plot_img = i.getSubimage(SCANSTART_REGION.x+SCANSTART_REGION.width*x,SCANSTART_REGION.y+SCANSTART_REGION.height*y,SCANSTART_REGION.width,NAMESTART_REGION.height); + boolean found=false; + for (int xx=0;xx150||col.getGreen()>150) { + found=true; + break; + } + } + if (found) { + break; + } + } + if (found) { + //Ignore this plot, it is taken. + PLOTSTATE.get(REGIONS[CURRENT_REGION]).set(x*15+y+ward*60+tab*30,found); + System.out.println("Plot "+((x*15+y+tab*30)+1)+" in Ward "+(ward+1)+" is taken."); + } else { + //Ignore this plot, it is taken. + if (PLOTSTATE.get(REGIONS[CURRENT_REGION]).get(x*15+y+ward*60+tab*30)) { + AnnounceNewOpenPlot(REGIONS[CURRENT_REGION],ward+1,(x*15+y+tab*30)+1,"Small"); + } + PLOTSTATE.get(REGIONS[CURRENT_REGION]).set(x*15+y+ward*60+tab*30,found); + } + } + } + PressKey(KeyEvent.VK_F10);r.delay(500); } + PressKey(KeyEvent.VK_F9);r.delay(200); + PressKeyWithModifier(KeyEvent.VK_SHIFT,KeyEvent.VK_F10);r.delay(200); + PressKey(KeyEvent.VK_NUMPAD0);r.delay(1000); } } - private static void OpenResidentialMenu() { + private static void AnnounceNewOpenPlot(String region,int ward,int plot,String size) { + System.out.println("A new "+size+" plot has become available in "+region+", Ward "+ward+", Plot "+plot+"!"); + } + + private static void PressKeyWithModifier(int modifier,int keycode) { + r.keyPress(modifier); + r.keyPress(keycode); + r.keyRelease(keycode);r.delay(100); + r.keyRelease(modifier); + } + + private static boolean OpenResidentialMenu() { PressKey(KeyEvent.VK_ESCAPE);r.delay(500); PressKey(KeyEvent.VK_ESCAPE);r.delay(500); PressKey(KeyEvent.VK_NUMPAD0); @@ -79,8 +133,10 @@ public class HousingTracker{ PressKey(KeyEvent.VK_NUMPAD0);r.delay(2000); PressKey(KeyEvent.VK_NUMPAD7);r.delay(200); PressKey(KeyEvent.VK_NUMPAD0);r.delay(2000); + return true; } else { System.out.println("Could not select Aetheryte!! Moving on..."); + return false; } }