Skip to content

Commit 38837e0

Browse files
committed
Fast fertig alles funktioniert so weit nur paar bugg fixesa müssen noch gemacht werden im bezuge zu potion herstellen
1 parent 2fce0b5 commit 38837e0

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

runelite-client/src/main/java/net/runelite/client/plugins/microbot/SulphurNaguaAIO/SulphurNaguaScript.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package net.runelite.client.plugins.microbot.SulphurNaguaAIO;
22

33
import net.runelite.api.Skill;
4+
import java.util.List;
5+
import net.runelite.client.plugins.microbot.util.inventory.Rs2ItemModel;
46
import net.runelite.api.coords.WorldPoint;
57
import net.runelite.client.plugins.microbot.Microbot;
68
import net.runelite.client.plugins.microbot.Script;
@@ -386,11 +388,20 @@ private boolean anyPotionOnGround() {
386388
}
387389

388390
private void drinkMoonlightPotion() {
389-
for (int potionId : MOONLIGHT_POTION_IDS) {
390-
if (Rs2Inventory.hasItem(potionId)) {
391-
if (Rs2Inventory.interact(potionId, "Drink")) {
392-
lastPotionDrinkTime = System.currentTimeMillis();
393-
break;
391+
// 1. Get a list of all inventory items. The new API uses 'Rs2ItemModel'.
392+
List<Rs2ItemModel> inventoryItems = Rs2Inventory.all();
393+
394+
// 2. Loop through the items in the order of the inventory slots.
395+
for (net.runelite.client.plugins.microbot.util.inventory.Rs2ItemModel item : inventoryItems) {
396+
if (item != null) {
397+
// 3. Check if the item is a moonlight potion using 'item.id' (the new way).
398+
if (MOONLIGHT_POTION_IDS.contains(item.getId())) {
399+
400+
// 4. Drink the first one found and then stop.
401+
if (Rs2Inventory.interact(item.getId(), "Drink")) {
402+
lastPotionDrinkTime = System.currentTimeMillis();
403+
break; // This stops the loop so you only drink one.
404+
}
394405
}
395406
}
396407
}

0 commit comments

Comments
 (0)