use of net.runelite.api.NPCComposition in project runelite by runelite.
the class MenuManager method removeNpcMenuOption.
public void removeNpcMenuOption(String option) {
npcMenuOptions.remove(option);
// remove this option from all npc compositions
Client client = clientProvider.get();
if (client == null) {
return;
}
for (NPC npc : client.getNpcs()) {
NPCComposition composition = npc.getComposition();
removeNpcOption(composition, option);
}
}
use of net.runelite.api.NPCComposition in project runelite by runelite.
the class MenuManager method addNpcMenuOption.
public void addNpcMenuOption(String option) {
npcMenuOptions.add(option);
// add to surrounding npcs
Client client = clientProvider.get();
if (client == null) {
return;
}
for (NPC npc : client.getNpcs()) {
NPCComposition composition = npc.getComposition();
addNpcOption(composition, option);
}
}
use of net.runelite.api.NPCComposition in project runelite by runelite.
the class NpcIndicatorsPlugin method onGameTick.
@Subscribe
public void onGameTick(GameTick tick) {
highlightedNpcs = buildNpcsToHighlight();
taggedNpcs.clear();
if (npcTags.isEmpty() || !config.isTagEnabled()) {
return;
}
for (NPC npc : client.getNpcs()) {
if (npcTags.contains(npc.getIndex())) {
NPCComposition composition = getComposition(npc);
if (composition == null || composition.getName() == null)
continue;
taggedNpcs.add(npc);
}
}
}
use of net.runelite.api.NPCComposition in project runelite by runelite.
the class NpcIndicatorsPlugin method buildNpcsToHighlight.
private Map<NPC, String> buildNpcsToHighlight() {
String configNpcs = config.getNpcToHighlight().toLowerCase();
if (configNpcs.isEmpty())
return Collections.EMPTY_MAP;
Map<NPC, String> npcMap = new HashMap<>();
List<String> highlightedNpcs = Arrays.asList(configNpcs.split(DELIMITER_REGEX));
for (NPC npc : client.getNpcs()) {
NPCComposition composition = getComposition(npc);
if (npc == null || composition == null || composition.getName() == null)
continue;
for (String highlight : highlightedNpcs) {
String name = composition.getName().replace('\u00A0', ' ');
if (WildcardMatcher.matches(highlight, name)) {
npcMap.put(npc, name);
}
}
}
return npcMap;
}
use of net.runelite.api.NPCComposition in project runelite by runelite.
the class NpcClickboxOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
Map<NPC, String> npcMap = plugin.getHighlightedNpcs();
for (NPC npc : npcMap.keySet()) {
renderNpcOverlay(graphics, npc, npcMap.get(npc), config.getNpcColor());
}
for (NPC npc : plugin.getTaggedNpcs()) {
NPCComposition composition = plugin.getComposition(npc);
if (composition == null || composition.getName() == null)
continue;
String name = composition.getName().replace('\u00A0', ' ');
renderNpcOverlay(graphics, npc, name, config.getTagColor());
}
return null;
}
Aggregations