iutils: add isMoving() and inventoryList()

This commit is contained in:
illumineawake 2021-08-09 18:44:00 +10:00
parent 2601023e24
commit 4fdc54f491
6 changed files with 16 additions and 7 deletions

View File

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

View File

@ -110,8 +110,12 @@ public class iPlayer extends iActor {
return player.getPoseAnimation();
}
public boolean isMoving() {
return game.localPlayer().idlePoseAnimation() != game.localPlayer().poseAnimation();
}
public boolean isIdle() {
return game.localPlayer().idlePoseAnimation() == game.localPlayer().poseAnimation() && player.getAnimation() == -1;
return !isMoving() && player.getAnimation() == -1;
}
public boolean isFriend() {

View File

@ -121,16 +121,19 @@ public abstract class UtilsScript extends Plugin {
}
if (keepInventoryItems) {
items.addAll(game.inventory().all().stream()
.map(i -> new ItemQuantity(i.id(), i.quantity()))
.collect(Collectors.toList())
);
items.addAll(inventoryList());
log.info("Keeping items: {}", items.toString());
}
obtain(items.toArray(ItemQuantity[]::new));
}
protected List<ItemQuantity> inventoryList() {
return game.inventory().all().stream()
.map(i -> new ItemQuantity(i.id(), i.quantity()))
.collect(Collectors.toList());
}
protected void withdraw(ItemQuantity... items) {
Arrays.stream(items)
.map(i -> new ItemQuantity(i.id, i.quantity - game.inventory().withId(i.id).quantity()))

View File

@ -1,5 +1,7 @@
package net.runelite.client.plugins.iutils.util;
import net.runelite.client.plugins.iutils.game.ItemQuantity;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

File diff suppressed because one or more lines are too long