Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/09/2023 in all areas

  1. Worked a little bit on it: import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.SceneObject; import com.epicbot.api.shared.model.Area; import com.epicbot.api.shared.model.Skill; import com.epicbot.api.shared.model.Tile; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.time.Time; import com.epicbot.api.shared.util.time.Timer; import java.awt.*; @ScriptManifest(name = "Woodcutting.retard", gameType = GameType.OS) public class F2PWoodcuting extends LoopScript { private long startTime; private int experienceGained, startExperience = 0; private final Timer experienceTimer = new Timer(5_000); private final Area BANK_AREA = new Area(new Tile(3165, 3486, 0), new Tile(3170, 3492, 0)); private final Area OAK_AREA = new Area(new Tile(3188, 3465, 0), new Tile(3197,3458,0)); @Override public boolean onStart(String... strings) { startTime = System.currentTimeMillis(); return true; } @Override protected int loop() { if ( !getAPIContext().inventory().contains("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe") && !getAPIContext().equipment().contains("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe")) { getAxe(); } if (getAPIContext().walking().getRunEnergy() > 30 && !getAPIContext().walking().isRunEnabled()){ getAPIContext().walking().setRun(true); } else { if (getAPIContext().inventory().isFull()) { bank(); } else { handleCalculations(); chop(); } } return 0; } public void getAxe() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(1000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); Time.sleep(4000, () -> getAPIContext().bank().isOpen()); } if (getAPIContext().bank().isOpen()) { System.out.println("Bank is open"); getAPIContext().bank().withdraw(1,"Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe"); Time.sleep(4000, () -> APIContext.get().inventory().contains("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe")); System.out.println("Closing bank"); if (getAPIContext().bank().isOpen()){ getAPIContext().bank().close(); Time.sleep(1000); } if (getAPIContext().inventory().contains("Adamant axe")){ getAPIContext().inventory().interactItem("Wield" ,"Adamant axe"); Time.sleep(2000); } else if(getAPIContext().inventory().contains("Mithril axe")) { getAPIContext().inventory().interactItem("Wield" ,"Mithril axe"); Time.sleep(2000); } else{ getAPIContext().inventory().interactItem("Wield" ,"Bronze axe"); Time.sleep(2000); } } } } public void bank() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(1000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); Time.sleep(4000, () -> getAPIContext().bank().isOpen()); } if (getAPIContext().bank().isOpen()) { System.out.println("Bank is open"); getAPIContext().bank().depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe"); System.out.println("Closing bank"); getAPIContext().bank().close(); } } } public void chop() { if (!OAK_AREA.contains(getAPIContext().localPlayer().getLocation())) { System.out.println("Walking to oak area"); getAPIContext().walking().walkTo(OAK_AREA.getCentralTile()); Time.sleep(3000); } else if (!this.isChopping()) { SceneObject tree = getAPIContext().objects().query().nameContains(new String[]{"Oak"}).results().nearest(); if (tree != null && tree.interact()) { System.out.println("Chopping"); Time.sleep(4000, () -> getAPIContext().localPlayer().isAnimating()); } } } public boolean isChopping() { return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving(); } // Credit to Pseudo for this function. private void handleCalculations() { if (startExperience == 0) { startExperience = getAPIContext().skills().get(Skill.Skills.WOODCUTTING).getExperience(); } else { if (!experienceTimer.isRunning()) { experienceGained = getAPIContext().skills().get(Skill.Skills.WOODCUTTING).getExperience() - startExperience; experienceTimer.reset(); } } } private int getExperienceGainedString() { return experienceGained; } @Override protected void onPaint(Graphics2D g, APIContext ctx) { PaintFrame pf = new PaintFrame(); pf.setTitle("Script by Michaud.retard"); pf.addLine("Runtime: ", Time.getFormattedRuntime(startTime)); pf.addLine("Experience Gain: ",getExperienceGainedString()); pf.addLine("Lv.",getAPIContext().skills().woodcutting().getCurrentLevel()); pf.draw(g, 4, 110, ctx); } } F2PWoodcuting.class
    1 point
×
×
  • Create New...