Created
February 22, 2015 02:30
-
-
Save lordgmage/f7b5df009cc61da69e08 to your computer and use it in GitHub Desktop.
LordPlank Option 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package LordPlank.strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.Menu; | |
import org.rev317.min.api.methods.Npcs; | |
import org.rev317.min.api.wrappers.Npc; | |
public class bankplank implements Strategy { | |
@Override | |
public boolean activate() { | |
return Inventory.getCount(1522) > 27 ; | |
} | |
@Override | |
public void execute() { | |
Npc[] mills = Npcs.getNearest(4250); | |
mills[0].interact(2); | |
Time.sleep(1000); | |
Menu.sendAction(431, 50, 0, 39008, 15477, 2); | |
Time.sleep(750); | |
System.out.print("Turning logs in to planks for gainz"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package LordPlank; | |
import LordPlank.strategies.plankbank; | |
import LordPlank.strategies.bankplank; | |
import org.parabot.environment.api.interfaces.Paintable; | |
import org.parabot.environment.scripts.Category; | |
import org.parabot.environment.scripts.Script; | |
import org.parabot.environment.scripts.ScriptManifest; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import java.awt.*; | |
import java.text.DecimalFormat; | |
import java.util.ArrayList; | |
@ScriptManifest(author = "LordgMage", | |
category = Category.OTHER, | |
description = "Makes Planks", | |
name = "LordPlank", | |
servers = { "Ikov" }, | |
version = 1.0) | |
public class LordPlank extends Script implements Paintable { | |
private ArrayList<Strategy> strategies = new ArrayList<Strategy>(); | |
private final Color color1 = new Color(255, 255, 255); | |
private final Font font1 = new Font("Arial", 0, 19); | |
private final Font font2 = new Font("Arial", 0, 10); | |
public static int PLANKS_MADE; | |
public static long startTime; | |
@Override | |
public boolean onExecute() { | |
startTime = System.currentTimeMillis(); | |
strategies.add(new plankbank()); | |
strategies.add(new bankplank()); | |
provide(strategies); | |
System.out.print ("Strategies running"); | |
return true; | |
} | |
@Override | |
public void onFinish() { | |
} | |
public static String runTime(long i) { | |
DecimalFormat nf = new DecimalFormat("00"); | |
long millis = System.currentTimeMillis() - i; | |
long hours = millis / (1000 * 60 * 60); | |
millis -= hours * (1000 * 60 * 60); | |
long minutes = millis / (1000 * 60); | |
millis -= minutes * (1000 * 60); | |
long seconds = millis / 1000; | |
return nf.format(hours) + ":" + nf.format(minutes) + ":" + nf.format(seconds); | |
} | |
public int getHourlyRate(int variable) { | |
return (int) (((double) (variable - 0) * 3600000D) / (double) (System.currentTimeMillis() - startTime)); | |
} | |
public void paint(Graphics g1) { | |
Graphics2D g = (Graphics2D)g1; | |
g.setFont(font1); | |
g.setColor(color1); | |
g.drawString("Time Run: " + runTime(startTime), 557, 238); | |
g.drawString("Planks Made:" + PLANKS_MADE, 556, 266); | |
g.setFont(font2); | |
g.drawString("Script by LordgMage", 557, 459); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package LordPlank.strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.rev317.min.api.methods.Bank; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.Menu; | |
import LordPlank.LordPlank; | |
public class plankbank implements Strategy { | |
@Override | |
public boolean activate() { | |
return Inventory.getCount(8779) > 27 && !Bank.isOpen(); | |
} | |
@Override | |
public void execute() { | |
LordPlank.PLANKS_MADE += 28; | |
Bank.open(); | |
Menu.sendAction(646, 1359, 2, 21012, 2213, 1); | |
Time.sleep(1000); | |
Menu.sendAction(431, 1521, 0 ,5382, 2213, 4); | |
Time.sleep(1000); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment