public void run() { targetName = (Settings.getFindTargetName() == null) ? "gfx/kritter/dragonfly/dragonfly" : Settings.getFindTargetName(); BotUtils.sysMsg("Target " + targetName, Color.WHITE); window = BotUtils.gui().add(new StatusWindow(), 300, 200); ui.root.findchild(FlowerMenu.class); while (BotUtils.getItemAtHand() == null) { GameUI gui = HavenPanel.lui.root.findchild(GameUI.class); IMeter.Meter stam = gui.getmeter("stam", 0); // Check energy stop if it is lower than 1500 IMeter.Meter nrj = gui.getmeter("nrj", 0); if (nrj.a <= 30) { t.stop(); return; } else if (stam.a <= 30 && nrj.a >= 95) { BotUtils.drink(); } // if (!BotUtils.isMoving()) { Gob gob = BotUtils.findObjectByNames(BotUtils.player().rc, 1000, targetName); if (gob != null) { BotUtils.goToCoord(gob.rc, 200, true); BotUtils.doClick(gob, 3, 0); } // } if (gob.getres().name.contains("terobjs")) { sleep(800); } sleep(800); } window.destroy(); t.stop(); }
public void draw(GOut g) { Tex at = null; if (none) { } else if (myown != null) { at = myown; } else { Gob gob = ui.sess.glob.oc.getgob(avagob); Avatar ava = null; if (gob != null) ava = gob.getattr(Avatar.class); if (ava != null) at = ava.rend; } GOut g2 = g.reclip(Window.wbox.tloff().add(unborder.inv()), asz); int yo; if (at == null) { at = missing; yo = 0; } else { g2.image(Equipory.bg, new Coord(Equipory.bg.sz().x / 2 - asz.x / 2, 20).inv()); yo = (20 * asz.y) / dasz.y; } Coord tsz = new Coord((at.sz().x * asz.x) / dasz.x, (at.sz().y * asz.y) / dasz.y); g2.image(at, new Coord(tsz.x / 2 - asz.x / 2, yo).inv(), tsz); g.chcolor(color); Window.wbox.draw(g, Coord.z, asz.add(Window.wbox.bisz()).add(unborder.mul(2).inv())); }
public void tick(int dt) { if (fo != null) { for (Collection<Gob> fol : fo) { for (Gob fo : fol) fo.ctick(dt); } } }
private void makeflavor() { @SuppressWarnings("unchecked") Collection<Gob>[] fo = (Collection<Gob>[]) new Collection[cutn.x * cutn.y]; for (int i = 0; i < fo.length; i++) fo[i] = new LinkedList<Gob>(); Coord c = new Coord(0, 0); Coord tc = gc.mul(cmaps); int i = 0; Random rnd = new Random(id); for (c.y = 0; c.y < cmaps.x; c.y++) { for (c.x = 0; c.x < cmaps.y; c.x++, i++) { Tileset set = tileset(tiles[i]); if (set.flavobjs.size() > 0) { if (rnd.nextInt(set.flavprob) == 0) { Resource r = set.flavobjs.pick(rnd); double a = rnd.nextDouble() * 2 * Math.PI; Gob g = new Flavobj(c.add(tc).mul(tilesz).add(tilesz.div(2)), a); g.setattr(new ResDrawable(g, r)); Coord cc = c.div(cutsz); fo[cc.x + (cc.y * cutn.x)].add(g); } } } } this.fo = fo; }
public synchronized void linbeg(int id, int frame, Coord s, Coord t, int c) { Gob g = getgob(id, frame); if (g == null) return; LinMove lm = new LinMove(g, s, t, c); g.setattr(lm); if (isplayerid(id)) ismoving = true; }
public void draw(GOut g) { Coord2d mc = MapView.pllastcc; if (mc == null) return; Gob gob = (Gob) owner; Coord3f pc = gob.getc(); double lcx = mc.x; double lcy = mc.y; double x = lcx - pc.x; double y = -lcy + pc.y; double z = Math.sqrt(x * x + y * y) >= 44 * 11 ? 0 : gob.glob.map.getcz(lcx, lcy) - pc.z; g.apply(); BGL gl = g.gl; gl.glLineWidth(2.0F); gl.glEnable(GL2.GL_BLEND); gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL2.GL_LINE_SMOOTH); gl.glHint(GL2.GL_LINE_SMOOTH_HINT, GL2.GL_NICEST); gl.glBegin(GL2.GL_LINES); gl.glVertex3f(0, 0, 0); gl.glVertex3f((float) x, (float) y, (float) z); gl.glEnd(); gl.glDisable(GL2.GL_LINE_SMOOTH); }
public synchronized void cres(int id, int frame, Indir<Resource> res, Message sdt) { Gob g = getgob(id, frame); if (g == null) return; ResDrawable d = (ResDrawable) g.getattr(Drawable.class); if ((d == null) || (d.res != res) || (d.sdt.blob.length > 0) || (sdt.blob.length > 0)) { g.setattr(new ResDrawable(g, res, sdt)); } }
public Sprite create(Owner owner, Resource res, Message sdt) { Gob gob = (Gob) owner; Glob glob = gob.glob; Tileset t = glob.map.tileset(glob.map.gettile(new Coord2d(gob.getc()).floor(MCache.tilesz))); for (int i = 0; i < tag.length; i++) { if (Arrays.binarySearch(t.tags, tag[i]) >= 0) return (sub[i].create(owner, res, sdt)); } return ((def == null) ? null : def.create(owner, res, sdt)); }
public synchronized void homocoord(int id, int frame, Coord tc, int v) { Gob g = getgob(id, frame); if (g == null) return; Homing h**o = g.getattr(Homing.class); if (h**o != null) { h**o.tc = tc; h**o.v = v; } }
public synchronized void avatar(int id, int frame, List<Indir<Resource>> layers) { Gob g = getgob(id, frame); if (g == null) return; Avatar ava = g.getattr(Avatar.class); if (ava == null) { ava = new Avatar(g); g.setattr(ava); } ava.setlayers(layers); }
public synchronized void layers( int id, int frame, Indir<Resource> base, List<Indir<Resource>> layers) { Gob g = getgob(id, frame); if (g == null) return; Layered lay = (Layered) g.getattr(Drawable.class); if ((lay == null) || (lay.base != base)) { lay = new Layered(g, base); g.setattr(lay); } lay.setlayers(layers); }
public void ctick() { long now; int dt; now = System.currentTimeMillis(); if (lastctick == 0) dt = 0; else dt = (int) (System.currentTimeMillis() - lastctick); synchronized (this) { for (Gob g : objs.values()) g.ctick(dt); } lastctick = now; }
public synchronized void buddy(int id, int frame, String name, int group, int type) { Gob g = getgob(id, frame); if (g == null) return; if ((name.length() == 0) && (group == 0) && (type == 0)) { g.delattr(KinInfo.class); } else { KinInfo b = g.getattr(KinInfo.class); if (b == null) { g.setattr(new KinInfo(g, name, group, type)); } else { b.update(name, group, type); } } }
public synchronized void speak(int id, int frame, Coord off, String text) { Gob g = getgob(id, frame); if (g == null) return; if (text.length() < 1) { g.delattr(Speaking.class); } else { Speaking m = g.getattr(Speaking.class); if (m == null) { g.setattr(new Speaking(g, off, text)); } else { m.off = off; m.update(text); } } }
public synchronized void drawoff(int id, int frame, Coord off) { Gob g = getgob(id, frame); if (g == null) return; if ((off.x == 0) && (off.y == 0)) { g.delattr(DrawOffset.class); } else { DrawOffset dro = g.getattr(DrawOffset.class); if (dro == null) { dro = new DrawOffset(g, off); g.setattr(dro); } else { dro.off = off; } } }
public void drawicons(GOut g) { OCache oc = ui.sess.glob.oc; synchronized (oc) { for (Gob gob : oc) { try { GobIcon icon = gob.getattr(GobIcon.class); if (icon != null) { Coord gc = p2c(gob.rc); Tex tex = icon.tex(); g.image(tex, gc.sub(tex.sz().div(2))); } } catch (Loading l) { } } } }
public synchronized void follow(int id, int frame, int oid, Coord off, int szo) { Gob g = getgob(id, frame); if (g == null) return; if (oid == -1) { g.delattr(Following.class); } else { Following flw = g.getattr(Following.class); if (flw == null) { flw = new Following(g, oid, off, szo); g.setattr(flw); } else { flw.tgt = oid; flw.doff = off; flw.szo = szo; } } }
public Gob findicongob(Coord c) { OCache oc = ui.sess.glob.oc; synchronized (oc) { for (Gob gob : oc) { try { GobIcon icon = gob.getattr(GobIcon.class); if (icon != null) { Coord gc = p2c(gob.rc); Coord sz = icon.tex().sz(); if (c.isect(gc.sub(sz.div(2)), sz)) return (gob); } } catch (Loading l) { } } } return (null); }
public synchronized void overlay( int id, int frame, int olid, boolean prs, Indir<Resource> resid, Message sdt) { Gob g = getgob(id, frame); if (g == null) return; Gob.Overlay ol = g.findol(olid); if (resid != null) { if (ol == null) { g.ols.add(ol = new Gob.Overlay(olid, resid, sdt)); } else if (!ol.sdt.equals(sdt)) { g.ols.remove(ol); g.ols.add(ol = new Gob.Overlay(olid, resid, sdt)); } ol.delign = prs; } else { if ((ol != null) && (ol.spr instanceof Gob.Overlay.CDel)) ((Gob.Overlay.CDel) ol.spr).delete(); else g.ols.remove(ol); } }
public synchronized void linstep(int id, int frame, int l) { boolean isplayer = isplayerid(id); Gob g = getgob(id, frame); if (g == null) return; Moving m = g.getattr(Moving.class); if ((m == null) || !(m instanceof LinMove)) return; LinMove lm = (LinMove) m; if ((l < 0) || (l >= lm.c)) { g.delattr(Moving.class); if (isplayer) { ismoving = false; checkqueue(); } } else { lm.setl(l); if (isplayer) { ismoving = true; } } }
public synchronized void tick() { for (Gob g : objs.values()) { g.tick(); } }
public synchronized void health(int id, int frame, int hp) { Gob g = getgob(id, frame); if (g == null) return; g.setattr(new GobHealth(g, hp)); }
@Override public void run() { synchronized (gui.map.glob.oc) { for (Gob gob : gui.map.glob.oc) { Resource res = gob.getres(); if (res != null && (res.name.equals("gfx/terobjs/oven") || res.name.equals("gfx/terobjs/smelter") || res.name.equals("gfx/terobjs/steelcrucible") || res.name.equals("gfx/terobjs/kiln"))) { if (this.gob == null) this.gob = gob; else if (gob.rc.dist(gui.map.player().rc) < this.gob.rc.dist(gui.map.player().rc)) this.gob = gob; } } } try { if (gob == null) { gui.error("No ovens/smelters/steelboxes/kilns found."); return; } Equipory e = gui.getequipory(); WItem l = e.quickslots[6]; WItem r = e.quickslots[7]; boolean noltorch = true; boolean nortorch = true; if (l != null) { String lname = l.item.getname(); if (lname.contains("Lit Torch")) noltorch = false; } if (r != null) { String rname = r.item.getname(); if (rname.contains("Lit Torch")) nortorch = false; } if (noltorch && nortorch) { gui.error("No lit torch is equipped."); return; } WItem w = e.quickslots[noltorch ? 7 : 6]; w.mousedown(new Coord(w.sz.x / 2, w.sz.y / 2), 1); try { Thread.sleep(100); } catch (InterruptedException ie) { e.wdgmsg("drop", noltorch ? 7 : 6); return; } gui.map.wdgmsg("itemact", Coord.z, gob.rc, 0, 0, (int) gob.id, gob.rc, 0, -1); if (!Utils.waitForProgressFinish( gui, TIMEOUT_ACT, "Oops something went wrong. Timeout when trying to light with torch.")) { e.wdgmsg("drop", noltorch ? 7 : 6); return; } e.wdgmsg("drop", noltorch ? 7 : 6); } catch (InterruptedException ie) { } }
public synchronized void homing(int id, int frame, int oid, Coord tc, int v) { Gob g = getgob(id, frame); if (g == null) return; g.setattr(new Homing(g, oid, tc, v)); }
public synchronized void homostop(int id, int frame) { Gob g = getgob(id, frame); if (g == null) return; g.delattr(Homing.class); }
public synchronized void lumin(int id, int frame, Coord off, int sz, int str) { Gob g = getgob(id, frame); if (g == null) return; g.setattr(new Lumin(g, off, sz, str)); }
public synchronized void move(int id, int frame, Coord c) { Gob g = getgob(id, frame); if (g == null) return; g.move(c); }