Equipment Tracker

IntermediateData

Tracks what items you're wearing and displays them. Shows how to access equipment data.

12 min read

What It Does

Tracks what items you're wearing and displays them. Shows how to access equipment data.

Source Code

java
1package com.example;
2
3import net.runelite.api.Client;
4import net.runelite.api.ItemContainer;
5import net.runelite.api.Item;
6import net.runelite.client.plugins.Plugin;
7import net.runelite.client.plugins.PluginDescriptor;
8import javax.inject.Inject;
9
10@PluginDescriptor(
11    name = "Equipment Tracker",
12    description = "Tracks equipped items"
13)
14public class EquipmentTrackerPlugin extends Plugin {
15    @Inject
16    private Client client;
17
18    @Subscribe
19    public void onGameTick(GameTick event) {
20        ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT);
21        if (equipment != null) {
22            Item[] items = equipment.getItems();
23            System.out.println("Equipment:");
24            for (Item item : items) {
25                if (item.getId() != -1) {
26                    System.out.println("  Slot: " + item.getSlot() + ", Item ID: " + item.getId());
27                }
28            }
29        }
30    }
31}

Code Annotations

Line 18

Get equipment container

Line 21

Iterate through equipment slots

Line 23

Check if slot has an item (ID != -1)

API Classes Used

Key Concepts

  • Get equipment container
  • Iterate through equipment slots
  • Check if slot has an item (ID != -1)

Next Steps

  • Learn about equipment slot IDs
  • Add overlay to display equipment
  • Track equipment changes