-
-
Notifications
You must be signed in to change notification settings - Fork 497
Add worldhopping and gem bag to Fortis Gem Stall #1482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a5f4662
2239281
5ddaf5a
06d0851
41bcd2e
61a4b25
cf098c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,11 +3,17 @@ | |||||||||||||||||||||||||||||||
| import net.runelite.api.GameObject; | ||||||||||||||||||||||||||||||||
| import net.runelite.api.Skill; | ||||||||||||||||||||||||||||||||
| import net.runelite.api.coords.WorldPoint; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.bank.Rs2Bank; | ||||||||||||||||||||||||||||||||
| import net.runelite.api.gameval.ItemID; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.Global; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.bank.Rs2Bank; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.gameobject.Rs2GameObject; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.inventory.Rs2Gembag; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.inventory.Rs2ItemModel; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.player.Rs2Player; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.walker.Rs2Walker; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.Microbot; | ||||||||||||||||||||||||||||||||
| import net.runelite.client.plugins.microbot.util.security.Login; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| import javax.inject.Inject; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -30,24 +36,85 @@ public void thieve() { | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if (Rs2Player.hopIfPlayerDetected(1, 0, 2)) { | ||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| final GameObject stall = Rs2GameObject.getGameObject(STALL_ID, SAFESPOT, 2); | ||||||||||||||||||||||||||||||||
| if (stall == null) { | ||||||||||||||||||||||||||||||||
| boolean started = Microbot.hopToWorld(Login.getRandomWorld(Rs2Player.isMember())); | ||||||||||||||||||||||||||||||||
| if (started) { | ||||||||||||||||||||||||||||||||
| Global.sleepUntil(Microbot::isLoggedIn, 15000); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if (!Rs2GameObject.hasAction(Rs2GameObject.convertToObjectComposition(stall), "Steal-from")) { | ||||||||||||||||||||||||||||||||
| boolean started = Microbot.hopToWorld(Login.getRandomWorld(Rs2Player.isMember())); | ||||||||||||||||||||||||||||||||
| if (started) { | ||||||||||||||||||||||||||||||||
| Global.sleepUntil(Microbot::isLoggedIn, 15000); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||
|
Comment on lines
+52
to
57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix wrong method arity for convertToObjectComposition (likely compile error). convertToObjectComposition requires the ignoreImpostor boolean. Without it, this won’t compile. - if (!Rs2GameObject.hasAction(Rs2GameObject.convertToObjectComposition(stall), "Steal-from")) {
+ if (!Rs2GameObject.hasAction(Rs2GameObject.convertToObjectComposition(stall, false), "Steal-from")) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Rs2GameObject.interact(stall, "Steal-from"); | ||||||||||||||||||||||||||||||||
| Rs2Player.waitForXpDrop(Skill.THIEVING); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if (Rs2Gembag.hasGemBag()) { | ||||||||||||||||||||||||||||||||
| if (Rs2Gembag.isUnknown()) { | ||||||||||||||||||||||||||||||||
| Rs2Gembag.checkGemBag(); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| if (!isGemBagCompletelyFull()) { | ||||||||||||||||||||||||||||||||
| if (Rs2Inventory.hasItem(ItemID.GEM_BAG)) { | ||||||||||||||||||||||||||||||||
| Rs2Inventory.interact(ItemID.GEM_BAG, "Open"); | ||||||||||||||||||||||||||||||||
| Global.sleepUntil(Rs2Gembag::isGemBagOpen, 2000); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| if (Rs2Gembag.isGemBagOpen() && hasAnyUncutGemInInventory()) { | ||||||||||||||||||||||||||||||||
| Rs2Inventory.interact(ItemID.GEM_BAG_OPEN, "Fill"); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||
| public void bank() { | ||||||||||||||||||||||||||||||||
| Rs2Bank.walkToBankAndUseBank(); | ||||||||||||||||||||||||||||||||
| Rs2Bank.depositAll(); | ||||||||||||||||||||||||||||||||
| if (!Rs2Bank.isOpen()) return; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Rs2Bank.depositAll(ItemID.UNCUT_SAPPHIRE); | ||||||||||||||||||||||||||||||||
| Rs2Bank.depositAll(ItemID.UNCUT_EMERALD); | ||||||||||||||||||||||||||||||||
| Rs2Bank.depositAll(ItemID.UNCUT_RUBY); | ||||||||||||||||||||||||||||||||
| Rs2Bank.depositAll(ItemID.UNCUT_DIAMOND); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Rs2Bank.emptyGemBag(); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Rs2Bank.depositAllExcept(ItemID.GEM_BAG, ItemID.GEM_BAG_OPEN); | ||||||||||||||||||||||||||||||||
| Rs2Bank.closeBank(); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||
| public Integer[] getItemIdsToDrop() { | ||||||||||||||||||||||||||||||||
| return new Integer[0]; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| private boolean hasAnyUncutGemInInventory() { | ||||||||||||||||||||||||||||||||
| return Rs2Inventory.items(this::isUncutGem).findAny().isPresent(); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| private boolean isUncutGem(Rs2ItemModel item) { | ||||||||||||||||||||||||||||||||
| int id = item.getId(); | ||||||||||||||||||||||||||||||||
| return id == ItemID.UNCUT_SAPPHIRE || | ||||||||||||||||||||||||||||||||
| id == ItemID.UNCUT_EMERALD || | ||||||||||||||||||||||||||||||||
| id == ItemID.UNCUT_RUBY || | ||||||||||||||||||||||||||||||||
| id == ItemID.UNCUT_DIAMOND; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| private boolean isGemBagCompletelyFull() { | ||||||||||||||||||||||||||||||||
| if (Rs2Gembag.isUnknown()) return false; | ||||||||||||||||||||||||||||||||
| int sapphire = Rs2Gembag.getGemBagContents().stream().filter(i -> i.getId() == ItemID.UNCUT_SAPPHIRE).findFirst().map(Rs2ItemModel::getQuantity).orElse(0); | ||||||||||||||||||||||||||||||||
| int emerald = Rs2Gembag.getGemBagContents().stream().filter(i -> i.getId() == ItemID.UNCUT_EMERALD).findFirst().map(Rs2ItemModel::getQuantity).orElse(0); | ||||||||||||||||||||||||||||||||
| int ruby = Rs2Gembag.getGemBagContents().stream().filter(i -> i.getId() == ItemID.UNCUT_RUBY).findFirst().map(Rs2ItemModel::getQuantity).orElse(0); | ||||||||||||||||||||||||||||||||
| int diamond = Rs2Gembag.getGemBagContents().stream().filter(i -> i.getId() == ItemID.UNCUT_DIAMOND).findFirst().map(Rs2ItemModel::getQuantity).orElse(0); | ||||||||||||||||||||||||||||||||
| return sapphire >= 60 && emerald >= 60 && ruby >= 60 && diamond >= 60; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.