forked from hex-agon/mastering-mixology
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-order-count-infobox
- Loading branch information
Showing
14 changed files
with
525 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/work/fking/masteringmixology/InventoryPotionOverlay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package work.fking.masteringmixology; | ||
|
||
import net.runelite.api.widgets.WidgetItem; | ||
import net.runelite.client.ui.FontManager; | ||
import net.runelite.client.ui.overlay.WidgetItemOverlay; | ||
|
||
import javax.inject.Inject; | ||
import java.awt.Color; | ||
import java.awt.Graphics2D; | ||
|
||
public class InventoryPotionOverlay extends WidgetItemOverlay { | ||
|
||
private final MasteringMixologyPlugin plugin; | ||
private final MasteringMixologyConfig config; | ||
|
||
@Inject | ||
InventoryPotionOverlay(MasteringMixologyPlugin plugin, MasteringMixologyConfig config) { | ||
this.plugin = plugin; | ||
this.config = config; | ||
showOnInventory(); | ||
} | ||
|
||
@Override | ||
public void renderItemOverlay(Graphics2D graphics2D, int itemId, WidgetItem widgetItem) { | ||
if (!plugin.isInLab() || !config.identifyPotions()) { | ||
return; | ||
} | ||
|
||
var potion = PotionType.fromItemId(itemId); | ||
if (potion == null) { | ||
return; | ||
} | ||
|
||
var bounds = widgetItem.getCanvasBounds(); | ||
graphics2D.setFont(FontManager.getRunescapeSmallFont()); | ||
|
||
graphics2D.setColor(Color.WHITE); | ||
graphics2D.drawString(potion.abbreviation(), bounds.x - 1, bounds.y + 15); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.