本文整理匯總了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);
}