本文整理汇总了Java中org.rev317.min.api.wrappers.Npc类的典型用法代码示例。如果您正苦于以下问题:Java Npc类的具体用法?Java Npc怎么用?Java Npc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Npc类属于org.rev317.min.api.wrappers包,在下文中一共展示了Npc类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNpcs
import org.rev317.min.api.wrappers.Npc; //导入依赖的package包/类
/**
* Gets all Npcs except local Npc
*
* @param filter
*
* @return all Npcs
*/
public static final Npc[] getNpcs(final Filter<Npc> filter) {
final Client client = Loader.getClient();
ArrayList<Npc> npcList = new ArrayList<>();
final org.rev317.min.accessors.Npc[] accNpcs = client.getNpcs();
for (int i = 0; i < accNpcs.length; i++) {
if (accNpcs[i] == null) {
continue;
}
final Npc npc = new Npc(accNpcs[i], i);
if (filter.accept(npc)) {
npcList.add(npc);
}
}
return npcList.toArray(new Npc[npcList.size()]);
}
示例2: getNearest
import org.rev317.min.api.wrappers.Npc; //导入依赖的package包/类
/**
* Gets nearest npcs which hold given id(s)
*
* @param ids
*
* @return array of npcs with the first index to be the nearest
*/
public static final Npc[] getNearest(final int... ids) {
final Npc[] npcs = getNpcs(new Filter<Npc>() {
@Override
public boolean accept(Npc npc) {
if (npc.getDef() != null) {
for (final int id : ids) {
if (id == npc.getDef().getId()) {
return true;
}
}
}
return false;
}
});
Arrays.sort(npcs, NEAREST_SORTER);
return npcs;
}
示例3: open
import org.rev317.min.api.wrappers.Npc; //导入依赖的package包/类
/**
* Opens bank using banker or bank booth
*
* @return <b>true</b> if successfully interacted
*/
public static boolean open() {
if (isOpen()) {
return false;
}
SceneObject bank = getBank();
Npc banker = getBanker();
if (bank != null) {
bank.interact(SceneObjects.Option.USE);
return true;
} else if (banker != null) {
banker.interact(Npcs.Option.BANK);
return true;
}
return false;
}
示例4: getClosest
import org.rev317.min.api.wrappers.Npc; //导入依赖的package包/类
/**
* Gets the closest npc which matches the given filter
*
* @param filter
*
* @return closest npc
*/
public static final Npc getClosest(final Filter<Npc> filter) {
Npc[] npcs = getNearest(filter);
if (npcs == null || npcs.length == 0) {
return null;
}
return npcs[0];
}
示例5: toggle
import org.rev317.min.api.wrappers.Npc; //导入依赖的package包/类
@Override
public void toggle() {
for (Npc n : Npcs.getNearest()) {
System.out.println("ID: " + n.getDef().getId() + " Distance: " + n.distanceTo() + " Location: " + n.getLocation().toString());
}
}
示例6: getBanker
import org.rev317.min.api.wrappers.Npc; //导入依赖的package包/类
/**
* Gets nearest banker
*
* @return nearest banker
*/
public static Npc getBanker() {
return Npcs.getClosest(BANKERS);
}