Jump to content

v1.03 getInventory().contains and getNpcs().getAll()


Czar

Recommended Posts

WTF.. a client restart solved the npcs.getall() there are just here for reference now

	@Override
	public boolean validate() throws InterruptedException {
//		return !ctx.getInventory().contains(ctx.getMyFood());
		if (ctx.atFightArea()) {
			ctx.log("Not at fight area lel: "+(ctx.getInventory().contains("Salmon"))+".");
			return !ctx.getInventory().contains("Salmon");
		} else {
			ctx.log("At fightarea, no layout");
			return !ctx.hasLayout();
		}
	}
Excuse the messy parts, it doesn't detect salmon whatsoever:

 

JAjTPcI.png

 

and for npcs:

	public void refreshList() {
		listModel.removeAllElements();
		added.clear();

		for (NPC n : ctx.getNpcs().getAll()) {
			if (!n.hasAction("Attack")) {
				continue;
			}
//			if (!inAdded(n) && !inAdded2(n)) {
				CzarNPC npc = new CzarNPC(n.getName(), n.getLevel());
				npc.setPosition(n.getPosition());
				added.add(npc);
				ctx.log("Added 1 : " + n.getName() + " - (" + n.getLevel()
						+ ")");
				listModel.addElement(npc);
//			}
		}
	}
Again, excuse the messy code, nothing appears in mirror client, yet both these features work in the normal client mode.

 

knuEN9H.png

 

(after clicking refresh, no npcs pop up in mirror client)

Edited by Czar
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...