Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package extremetk.dialog;
- import java.nio.ByteBuffer;
- import java.util.Iterator;
- import java.util.LinkedList;
- import extremetk.TKMain;
- public abstract class TKDialog {
- public int npcGuid = 0;
- protected LinkedList<TKDialogComponent> components = new LinkedList<TKDialogComponent>();
- protected byte dialogType = 0;
- protected TKMain main;
- public TKDialog(TKMain main) {
- this.main = main;
- }
- public byte[] getData() {
- int bufsize = 0;
- bufsize += 7;
- Iterator<TKDialogComponent> it = components.iterator();
- while(it.hasNext()) {
- TKDialogComponent com = it.next();
- bufsize += com.getData().length;
- }
- ByteBuffer bb = ByteBuffer.allocate(bufsize);
- bb.put(dialogType);
- bb.put((byte)0x1); //FIXME don't know what this is
- bb.putInt(npcGuid);
- bb.put((byte)0x1); //FIXME don't know what this is
- it = components.iterator();
- while(it.hasNext()) {
- TKDialogComponent com = it.next();
- bb.put(com.getData());
- }
- return bb.array();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement