本文整理汇总了Java中skadistats.clarity.processor.stringtables.StringTables类的典型用法代码示例。如果您正苦于以下问题:Java StringTables类的具体用法?Java StringTables怎么用?Java StringTables使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringTables类属于skadistats.clarity.processor.stringtables包,在下文中一共展示了StringTables类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHeroItem
import skadistats.clarity.processor.stringtables.StringTables; //导入依赖的package包/类
/**
* Uses "EntityNames" string table and Entities processor
* @param ctx Context
* @param eHero Hero entity
* @param idx 0-5 - inventory, 6-8 - backpack, 9-16 - stash
* @return {@code null} - empty slot. Throws @{@link UnknownItemFoundException} if item information can't be extracted
*/
private Item getHeroItem(Context ctx, Entity eHero, int idx) throws UnknownItemFoundException {
StringTable stEntityNames = ctx.getProcessor(StringTables.class).forName("EntityNames");
Entities entities = ctx.getProcessor(Entities.class);
Integer hItem = eHero.getProperty("m_hItems." + Util.arrayIdxToString(idx));
if (hItem == 0xFFFFFF) {
return null;
}
Entity eItem = entities.getByHandle(hItem);
if(eItem == null) {
throw new UnknownItemFoundException(String.format("Can't find item by its handle (%d)", hItem));
}
String itemName = stEntityNames.getNameByIndex(eItem.getProperty("m_pEntity.m_nameStringableIndex"));
if(itemName == null) {
throw new UnknownItemFoundException("Can't get item name from EntityName string table");
}
Item item = new Item();
item.id = itemName;
int numCharges = eItem.getProperty("m_iCurrentCharges");
if(numCharges != 0) {
item.num_charges = numCharges;
}
int numSecondaryCharges = eItem.getProperty("m_iSecondaryCharges");
if(numSecondaryCharges != 0) {
item.num_secondary_charges = numSecondaryCharges;
}
return item;
}
示例2: runSeek
import skadistats.clarity.processor.stringtables.StringTables; //导入依赖的package包/类
public void runSeek(String[] args) throws Exception {
Runner runner = new SimpleRunner(new MappedFileSource(args[0])).runWith(this);
StringTables st = runner.getContext().getProcessor(StringTables.class);
for (String name : names) {
StringTable t = st.forName(name);
System.out.println(t.toString());
}
}
示例3: run
import skadistats.clarity.processor.stringtables.StringTables; //导入依赖的package包/类
public void run(String[] args) throws Exception {
long tStart = System.currentTimeMillis();
int tick = Integer.valueOf(args[0]);
String demoName = args[1];
ControllableRunner r = new ControllableRunner(new MappedFileSource(demoName)).runWith(this);
r.seek(tick);
r.halt();
Context ctx = r.getContext();
File dir = new File(String.format("baselines%s%s", File.separator, ctx.getBuildNumber() == -1 ? "latest" : ctx.getBuildNumber()));
if (!dir.exists()) {
dir.mkdirs();
}
FieldReader fieldReader = ctx.getEngineType().getNewFieldReader();
StringTables stringTables = ctx.getProcessor(StringTables.class);
DTClasses dtClasses = ctx.getProcessor(DTClasses.class);
StringTable baselines = stringTables.forName("instancebaseline");
for (int i = 0; i < baselines.getEntryCount(); i++) {
DTClass dtClass = dtClasses.forClassId(Integer.valueOf(baselines.getNameByIndex(i)));
String fileName = String.format("%s%s%s.txt", dir.getPath(), File.separator, dtClass.getDtName());
log.info("writing {}", fileName);
fieldReader.DEBUG_STREAM = new PrintStream(new FileOutputStream(fileName), true, "UTF-8");
BitStream bs = BitStream.createBitStream(baselines.getValueByIndex(i));
try {
fieldReader.readFields(bs, dtClass, dtClass.getEmptyStateArray(), true);
if (bs.remaining() < 0 || bs.remaining() > 7) {
log.info("-- OFF: {} remaining", bs.remaining());
}
} catch (Exception e) {
log.info("-- FAIL: {}", e.getMessage());
e.printStackTrace(fieldReader.DEBUG_STREAM);
} finally {
}
}
long tMatch = System.currentTimeMillis() - tStart;
log.info("total time taken: {}s", (tMatch) / 1000.0);
}