Added ground item ticks (#726)
* Added ground item ticks Signed-off-by: James Munson <jmunson@openpoll.io> * update config Signed-off-by: James Munson <jmunson@openpoll.io>
This commit is contained in:
@@ -46,6 +46,7 @@ class GroundItem
|
||||
private int offset;
|
||||
private boolean tradeable;
|
||||
private boolean isMine;
|
||||
private int ticks;
|
||||
private int durationMillis;
|
||||
private boolean isAlwaysPrivate;
|
||||
private boolean isOwnedByPlayer;
|
||||
|
||||
@@ -606,4 +606,16 @@ public interface GroundItemsConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showTimer",
|
||||
name = "Show ground item tick countdown timer",
|
||||
description = "Shows how many ticks left until disappearing.",
|
||||
position = 48,
|
||||
parent = "miscStub"
|
||||
)
|
||||
default boolean showTimer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,6 +277,13 @@ public class GroundItemsOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getTicks() > 0 && config.showTimer())
|
||||
{
|
||||
itemStringBuilder
|
||||
.append(" - ")
|
||||
.append(item.getTicks());
|
||||
}
|
||||
|
||||
final String itemString = itemStringBuilder.toString();
|
||||
itemStringBuilder.setLength(0);
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ import net.runelite.api.events.ItemDespawned;
|
||||
import net.runelite.api.events.ItemQuantityChanged;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -204,6 +205,16 @@ public class GroundItemsPlugin extends Plugin
|
||||
collectedGroundItems.clear();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
for (GroundItem item : collectedGroundItems.values())
|
||||
{
|
||||
if (item.getTicks() == -1) continue;
|
||||
item.setTicks(item.getTicks() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
@@ -461,6 +472,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
if (groundItem != null)
|
||||
{
|
||||
groundItem.setMine(true);
|
||||
groundItem.setTicks(200);
|
||||
|
||||
boolean shouldNotify = config.onlyShowLoot() && config.highlightedColor().equals(getHighlighted(
|
||||
groundItem.getName(),
|
||||
@@ -511,6 +523,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
.durationMillis(durationMillis)
|
||||
.isAlwaysPrivate(client.isInInstancedRegion() || (!itemComposition.isTradeable() && realItemId != COINS))
|
||||
.isOwnedByPlayer(tile.getWorldLocation().equals(playerLocation))
|
||||
.ticks(tile.getWorldLocation().equals(client.getLocalPlayer().getWorldLocation()) ? 200 : 100)
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user