|
18 | 18 | import net.runelite.client.plugins.microbot.api.player.Rs2PlayerCache; |
19 | 19 | import net.runelite.client.plugins.microbot.util.player.Rs2PlayerModel; |
20 | 20 | import net.runelite.client.plugins.microbot.util.reachable.Rs2Reachable; |
| 21 | +import net.runelite.client.plugins.microbot.util.walker.Rs2Walker; |
21 | 22 |
|
22 | 23 | import javax.inject.Inject; |
23 | 24 | import java.util.ArrayList; |
@@ -56,59 +57,26 @@ public boolean run() { |
56 | 57 | try { |
57 | 58 | if (!Microbot.isLoggedIn()) return; |
58 | 59 |
|
59 | | -/* |
60 | | - if (Microbot.getClient().getTopLevelWorldView().getScene().isInstance()) { |
61 | | - LocalPoint l = LocalPoint.fromWorld(Microbot.getClient().getTopLevelWorldView(), Microbot.getClient().getLocalPlayer().getWorldLocation()); |
62 | | - System.out.println("was here"); |
63 | | - WorldPoint.fromLocalInstance(Microbot.getClient(), l); |
64 | | - } else { |
65 | | - System.out.println("was here lol"); |
66 | | - // this needs to ran on client threaad if we are on the sea |
67 | | - var a = Microbot.getClient().getLocalPlayer().getWorldLocation(); |
68 | | - System.out.println(a); |
69 | | - }*/ |
70 | | - |
71 | | - var shipwreck = rs2TileObjectCache.query() |
72 | | - .where(x -> x.getName() != null && x.getName().toLowerCase().contains("shipwreck")) |
73 | | - .within(5) |
74 | | - .nearestOnClientThread(); |
75 | | - var player = new Rs2PlayerModel(); |
76 | | - |
77 | | - var isInvFull = Rs2Inventory.count() >= Rs2Random.between(24, 28); |
78 | | - if (isInvFull && Rs2Inventory.count("salvage") > 0 && player.getAnimation() == -1) { |
79 | | - // Rs2Inventory.dropAll("large salvage"); |
80 | | - rs2TileObjectCache.query() |
81 | | - .fromWorldView() |
82 | | - .where(x -> x.getName() != null && x.getName().equalsIgnoreCase("salvaging station")) |
83 | | - .where(x -> x.getWorldView().getId() == new Rs2PlayerModel().getWorldView().getId()) |
84 | | - .nearestOnClientThread() |
85 | | - .click(); |
86 | | - sleepUntil(() -> Rs2Inventory.count("salvage") == 0, 60000); |
87 | | - } else if (isInvFull) { |
88 | | - dropJunk(); |
89 | | - } else { |
90 | | - if (player.getAnimation() != -1) { |
91 | | - log.info("Currently salvaging, waiting..."); |
92 | | - sleep(5000, 10000); |
93 | | - return; |
94 | | - } |
| 60 | + if (Rs2Inventory.isFull()) { |
| 61 | + Rs2Inventory.dropAll("Logs"); |
| 62 | + return; |
| 63 | + } |
95 | 64 |
|
96 | | - if (shipwreck == null) { |
97 | | - log.info("No shipwreck found nearby"); |
98 | | - sleep(5000); |
99 | | - dropJunk(); |
100 | | - return; |
101 | | - } |
| 65 | + if (Rs2Player.isAnimating()) return; |
102 | 66 |
|
103 | | - rs2TileObjectCache.query().fromWorldView().where(x -> x.getName() != null && x.getName().toLowerCase().contains("salvaging hook")).nearestOnClientThread().click("Deploy"); |
104 | | - sleepUntil(() -> player.getAnimation() != -1, 5000); |
| 67 | + var tree = Microbot.getRs2TileObjectCache().query() |
| 68 | + .withName("Tree") |
| 69 | + .nearest(); |
105 | 70 |
|
| 71 | + if (tree != null) { |
| 72 | + tree.click("Chop down"); |
| 73 | + sleepUntil(Rs2Player::isAnimating, 3000); |
106 | 74 | } |
107 | 75 |
|
108 | 76 | } catch (Exception ex) { |
109 | | - log.error("Error in performance test loop", ex); |
| 77 | + log.error("Error in example script", ex); |
110 | 78 | } |
111 | | - }, 0, 1000, TimeUnit.MILLISECONDS); |
| 79 | + }, 0, 600, TimeUnit.MILLISECONDS); |
112 | 80 |
|
113 | 81 | return true; |
114 | 82 | } |
|
0 commit comments