本文整理汇总了Java中tools.data.input.GenericSeekableLittleEndianAccessor类的典型用法代码示例。如果您正苦于以下问题:Java GenericSeekableLittleEndianAccessor类的具体用法?Java GenericSeekableLittleEndianAccessor怎么用?Java GenericSeekableLittleEndianAccessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GenericSeekableLittleEndianAccessor类属于tools.data.input包,在下文中一共展示了GenericSeekableLittleEndianAccessor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: messageReceived
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
@Override
public void messageReceived(IoSession session, Object message) {
byte[] content = (byte[]) message;
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(content));
short packetId = slea.readShort();
MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
final MaplePacketHandler packetHandler = processor.getHandler(packetId);
if (packetHandler != null && packetHandler.validateState(client)) {
try {
packetHandler.handlePacket(slea, client);
} catch (final Throwable t) {
FilePrinter.printError(FilePrinter.PACKET_HANDLER + packetHandler.getClass().getName() + ".txt", t, "Error for " + (client.getPlayer() == null ? "" : "player ; " + client.getPlayer() + " on map ; " + client.getPlayer().getMapId() + " - ") + "account ; " + client.getAccountName() + "\r\n" + slea.toString());
//client.announce(MaplePacketCreator.enableActions());//bugs sometimes
}
}
}
示例2: messageReceived
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
byte[] content = (byte[]) message;
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(content));
short opcode = slea.readShort();
GMPacketHandler packetHandler = processor.getHandler(opcode);
if (packetHandler != null) {
try {
packetHandler.handlePacket(slea, session);
} catch (Throwable t) {
}
}
}
示例3: WZIMGFile
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
public WZIMGFile(File wzfile, WZFileEntry file, boolean provideImages, boolean modernImg) throws IOException {
RandomAccessFile raf = new RandomAccessFile(wzfile, "r");
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf));
slea.seek(file.getOffset());
this.file = file;
this.provideImages = provideImages;
root = new WZIMGEntry(file.getParent());
root.setName(file.getName());
root.setType(MapleDataType.EXTENDED);
this.modernImg = modernImg;
parseExtended(root, slea, 0);
root.finish();
raf.close();
}
示例4: WZFile
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
public WZFile(File wzfile, boolean provideImages) throws IOException {
this.wzfile = wzfile;
lea = new GenericLittleEndianAccessor(new InputStreamByteStream(new BufferedInputStream(new FileInputStream(wzfile))));
RandomAccessFile raf = new RandomAccessFile(wzfile, "r");
slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf));
root = new WZDirectoryEntry(wzfile.getName(), 0, 0, null);
this.provideImages = provideImages;
load();
}
示例5: messageReceived
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
@Override
public void messageReceived(IoSession session, Object message) {
if (message == null || session == null) {
return;
}
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream((byte[]) message));
if (slea.available() < 1) {
FileoutputUtil.log("数据包长度异常:" + slea.toString());
return;
}
MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
if (client == null || !client.isReceiving()) {
return;
}
short packetId = slea.readByte();
for (RecvPacketOpcode recv : RecvPacketOpcode.values()) {
if (recv.getValue() == packetId) {
if (recv.NeedsChecking() && !client.isLoggedIn()) {
FileoutputUtil.log("客户端没有登录,丢弃包!");
return;
}
try {
handlePacket(recv, slea, client);
} catch (InterruptedException e) {
FileoutputUtil.log(FileoutputUtil.Packet_Ex, new StringBuilder().append("封包: ").append(lookupRecv(packetId)).append("\r\n").append(slea.toString(true)).toString());
FileoutputUtil.outputFileError(FileoutputUtil.Packet_Ex, e);
}
return;
}
}
}
示例6: WZIMGFile
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
public WZIMGFile(File wzfile, WZFileEntry file, boolean provideImages, boolean modernImg) throws IOException {
try (RandomAccessFile raf = new RandomAccessFile(wzfile, "r")) {
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new RandomAccessByteStream(raf));
slea.seek(file.getOffset());
this.file = file;
this.provideImages = provideImages;
root = new WZIMGEntry(file.getParent());
root.setName(file.getName());
root.setType(MapleDataType.EXTENDED);
this.modernImg = modernImg;
parseExtended(root, slea, 0);
root.finish();
}
}
示例7: main
import tools.data.input.GenericSeekableLittleEndianAccessor; //导入依赖的package包/类
public static void main(String[] args) {
System.out.println("LOADING :: Please wait...");
//String out = args[0];
//String out = "CrusaderItemDump";
//File dir = new File(out);
File text = new File("Codex.txt");
//dir.mkdir();
BufferedReader b = null;
MapleDataProvider data = MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.fileInWZPath("Item.wz"));
try {
String s;
text.createNewFile();
b = new BufferedReader(new FileReader("monsterbook.txt"));
StringBuilder sb = new StringBuilder();
try (PrintWriter writer = new PrintWriter(new FileOutputStream(text))) {
while ((s = b.readLine()) != null) {
byte[] bArray = HexTool.getByteArrayFromHexString(s);
SeekableLittleEndianAccessor slea = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(bArray));
int card = slea.readInt();
int size = slea.readShort();
MapleData consume = data.getData("Consume/0238.img").getChildByPath("0" + String.valueOf(card));
int monsterid = MapleDataTool.getIntConvert("info/mob", consume, 0);
// Don't forget to insert the card, along with the rest of the drops.
sb.append("INSERT INTO `drop_data` (`dropperid`, `itemid`, `questid`, `chance`) VALUES (").append(monsterid).append(", ").append(card).append(", 0, 400);\r\n");
for (int i = 0; i < size; i++) {
int itemid = slea.readInt();
sb.append("INSERT INTO `drop_data` (`dropperid`, `itemid`, `questid`, `chance`) VALUES ");
sb.append("(").append(monsterid).append(", ").append(itemid).append(", 0, ").append(getChance(itemid) == -1 ? -1 : getChance(itemid) * 10).append(");\r\n");
}
writer.println(sb.toString());
sb.delete(0, sb.length());
}
writer.flush();
}
System.out.println("Success! The task has been completed.");
} catch (IOException e) {
} finally {
try {
if (b != null) {
b.close();
}
} catch (IOException ex) {
}
}
}