iutils: add isMoving() and inventoryList()
This commit is contained in:
parent
2601023e24
commit
4fdc54f491
|
@ -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"
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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()))
|
||||
|
|
|
@ -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
Binary file not shown.
Loading…
Reference in New Issue