Skip to content

Instantly share code, notes, and snippets.

@kryogenic
Created March 9, 2015 07:00
Show Gist options
  • Save kryogenic/f303f2ecee06d519bf2a to your computer and use it in GitHub Desktop.
Save kryogenic/f303f2ecee06d519bf2a to your computer and use it in GitHub Desktop.
WλneAlcher
package org.kryogenic.powerbot;
import org.powerbot.script.*;
import org.powerbot.script.rt4.ClientContext;
import org.powerbot.script.rt4.GroundItem;
import org.powerbot.script.rt4.Magic;
import java.awt.*;
/**
* @author: Kale
* @date: 2015-03-08
*/
@Script.Manifest(name = "WλneAlcher", description = "Tele-grabs and alchs wine of Zamorak")
public class WyneAlcher extends PollingScript<ClientContext> implements MessageListener, PaintListener {
boolean outOfRunes;
int wineId = 245;
GroundItem wine;
@Override
public void poll() {
if(outOfRunes) {
stop();
} else if(ctx.camera.pitch() != 99) {
ctx.camera.pitch(true);
} else if(!ctx.groundItems.select().id(wineId).isEmpty()) {
System.out.println("grabbing");
ctx.magic.cast(Magic.Spell.TELEKINETIC_GRAB);
wine = ctx.groundItems.poll();
wine.interact(false, "Cast", "Telekinetic Grab -> Wine of zamorak");
wine = null;
} else if(!ctx.inventory.select().id(wineId).isEmpty()) {
System.out.println("alching");
if(ctx.magic.cast(Magic.Spell.LOW_LEVEL_ALCHEMY)) {
ctx.inventory.poll().click();
} else {
System.out.println("walking");
ctx.movement.step(ctx.players.local().tile());
}
}
}
@Override
public void messaged(MessageEvent e) {
if(e.text().contains("runes to cast this spell")) {
outOfRunes = true;
}
}
@Override
public void repaint(Graphics g) {
g.setColor(Color.RED);
if(wine != null)
wine.draw(g);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment