Merge pull request #984 from sethtroll/fixmountedglory

Poh plugin: fix mounted glory minimap icon
This commit is contained in:
Adam
2018-03-16 18:23:15 -04:00
committed by GitHub
2 changed files with 26 additions and 5 deletions

View File

@@ -29,9 +29,9 @@ import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.TileObject;
import static net.runelite.client.plugins.poh.PohPlugin.BURNER_LIT;
import static net.runelite.client.plugins.poh.PohPlugin.BURNER_UNLIT;
import net.runelite.client.ui.overlay.Overlay;
@@ -82,9 +82,9 @@ public class BurnerOverlay extends Overlay
return null;
}
private void drawBurner(Graphics2D graphics, String text, GameObject gameObject, Color color, java.awt.Point parent)
private void drawBurner(Graphics2D graphics, String text, TileObject tileObject, Color color, java.awt.Point parent)
{
Point canvasText = Perspective.getCanvasTextLocation(client, graphics, gameObject.getLocalLocation(), text, 200);
Point canvasText = Perspective.getCanvasTextLocation(client, graphics, tileObject.getLocalLocation(), text, 200);
if (canvasText == null)
{
@@ -97,6 +97,6 @@ public class BurnerOverlay extends Overlay
textComponent.render(graphics, parent);
//render tile
OverlayUtil.renderPolygon(graphics, gameObject.getCanvasTilePoly(), color);
OverlayUtil.renderPolygon(graphics, tileObject.getCanvasTilePoly(), color);
}
}

View File

@@ -35,6 +35,7 @@ import java.util.Set;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.DecorativeObject;
import net.runelite.api.GameObject;
import net.runelite.api.GameState;
import static net.runelite.api.ObjectID.INCENSE_BURNER;
@@ -44,7 +45,10 @@ import static net.runelite.api.ObjectID.INCENSE_BURNER_13211;
import static net.runelite.api.ObjectID.INCENSE_BURNER_13212;
import static net.runelite.api.ObjectID.INCENSE_BURNER_13213;
import net.runelite.api.Tile;
import net.runelite.api.TileObject;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.DecorativeObjectDespawned;
import net.runelite.api.events.DecorativeObjectSpawned;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
@@ -62,7 +66,7 @@ public class PohPlugin extends Plugin
static final Set<Integer> BURNER_LIT = Sets.newHashSet(INCENSE_BURNER_13209, INCENSE_BURNER_13211, INCENSE_BURNER_13213);
@Getter(AccessLevel.PACKAGE)
private final Map<GameObject, Tile> pohObjects = new HashMap<>();
private final Map<TileObject, Tile> pohObjects = new HashMap<>();
@Inject
private PohOverlay overlay;
@@ -117,6 +121,23 @@ public class PohPlugin extends Plugin
pohObjects.remove(gameObject);
}
@Subscribe
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
DecorativeObject decorativeObject = event.getDecorativeObject();
if (PohIcons.getIcon(decorativeObject.getId()) != null)
{
pohObjects.put(decorativeObject, event.getTile());
}
}
@Subscribe
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
DecorativeObject decorativeObject = event.getDecorativeObject();
pohObjects.remove(decorativeObject);
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{