iutils: walking no longer attempts to eat rock cakes if low health (360noscope3dchessAI), add withoutNamePart to InventoryItemStream

This commit is contained in:
illumineawake 2021-08-13 22:59:09 +10:00
parent e3aaa83349
commit c21b1cab43
5 changed files with 12 additions and 3 deletions

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "4.4.0"
version = "4.4.1"
project.extra["PluginName"] = "iUtils"
project.extra["PluginDescription"] = "Illumine - Utils required for plugins to function with added automation"

View File

@ -76,6 +76,14 @@ public class InventoryItemStream extends RandomizedStreamAdapter<InventoryItem,
return filter(o -> Arrays.stream(names).anyMatch(name -> o.name().toLowerCase().contains(name.toLowerCase())));
}
/**
* Returns a stream consisting of the elements of this stream that don't match
* any of the given {@link InventoryItem#name()}s
*/
public InventoryItemStream withoutNamePart(String... names) {
return filter(o -> Arrays.stream(names).noneMatch(name -> o.name().toLowerCase().contains(name.toLowerCase())));
}
/**
* Returns a stream consisting of the elements of this stream with
* any of the given {@link InventoryItem#actions()}s

View File

@ -1,6 +1,7 @@
package net.runelite.client.plugins.iutils.walking;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ItemID;
import net.runelite.api.Skill;
import net.runelite.client.plugins.iutils.game.Game;
import net.runelite.client.plugins.iutils.game.iTile;
@ -333,7 +334,7 @@ public class Walking {
}
if (game.modifiedLevel(Skill.HITPOINTS) < 8 || game.modifiedLevel(Skill.HITPOINTS) < game.baseLevel(Skill.HITPOINTS) - 22) {
var food = game.inventory().withAction("Eat").first();
var food = game.inventory().withoutId(ItemID.DWARVEN_ROCK_CAKE_7510).withAction("Eat").first();
if (food != null) {
food.interact("Eat");

File diff suppressed because one or more lines are too long