Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added rudimentary support for BNCS (chat service)
- Loading branch information
1 parent
c009982
commit b64900c
Showing
10 changed files
with
474 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package com.riiablo.net.packet.bncs; | ||
|
||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class BNCS extends Table { | ||
public static BNCS getRootAsBNCS(ByteBuffer _bb) { return getRootAsBNCS(_bb, new BNCS()); } | ||
public static BNCS getRootAsBNCS(ByteBuffer _bb, BNCS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; } | ||
public BNCS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public byte dataType() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; } | ||
public Table data(Table obj) { int o = __offset(6); return o != 0 ? __union(obj, o) : null; } | ||
|
||
public static int createBNCS(FlatBufferBuilder builder, | ||
byte data_type, | ||
int dataOffset) { | ||
builder.startObject(2); | ||
BNCS.addData(builder, dataOffset); | ||
BNCS.addDataType(builder, data_type); | ||
return BNCS.endBNCS(builder); | ||
} | ||
|
||
public static void startBNCS(FlatBufferBuilder builder) { builder.startObject(2); } | ||
public static void addDataType(FlatBufferBuilder builder, byte dataType) { builder.addByte(0, dataType, 0); } | ||
public static void addData(FlatBufferBuilder builder, int dataOffset) { builder.addOffset(1, dataOffset, 0); } | ||
public static int endBNCS(FlatBufferBuilder builder) { | ||
int o = builder.endObject(); | ||
return o; | ||
} | ||
public static void finishBNCSBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } | ||
public static void finishSizePrefixedBNCSBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package com.riiablo.net.packet.bncs; | ||
|
||
public final class BNCSData { | ||
private BNCSData() { } | ||
public static final byte NONE = 0; | ||
public static final byte ChatEvent = 1; | ||
|
||
public static final String[] names = { "NONE", "ChatEvent", }; | ||
|
||
public static String name(int e) { return names[e]; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package com.riiablo.net.packet.bncs; | ||
|
||
import com.google.flatbuffers.FlatBufferBuilder; | ||
import com.google.flatbuffers.Table; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
@SuppressWarnings("unused") | ||
public final class ChatEvent extends Table { | ||
public static ChatEvent getRootAsChatEvent(ByteBuffer _bb) { return getRootAsChatEvent(_bb, new ChatEvent()); } | ||
public static ChatEvent getRootAsChatEvent(ByteBuffer _bb, ChatEvent obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } | ||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; } | ||
public ChatEvent __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } | ||
|
||
public byte eid() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 19; } | ||
public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } | ||
public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); } | ||
public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); } | ||
public String text() { int o = __offset(8); return o != 0 ? __string(o + bb_pos) : null; } | ||
public ByteBuffer textAsByteBuffer() { return __vector_as_bytebuffer(8, 1); } | ||
public ByteBuffer textInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 8, 1); } | ||
|
||
public static int createChatEvent(FlatBufferBuilder builder, | ||
byte eid, | ||
int nameOffset, | ||
int textOffset) { | ||
builder.startObject(3); | ||
ChatEvent.addText(builder, textOffset); | ||
ChatEvent.addName(builder, nameOffset); | ||
ChatEvent.addEid(builder, eid); | ||
return ChatEvent.endChatEvent(builder); | ||
} | ||
|
||
public static void startChatEvent(FlatBufferBuilder builder) { builder.startObject(3); } | ||
public static void addEid(FlatBufferBuilder builder, byte eid) { builder.addByte(0, eid, 19); } | ||
public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(1, nameOffset, 0); } | ||
public static void addText(FlatBufferBuilder builder, int textOffset) { builder.addOffset(2, textOffset, 0); } | ||
public static int endChatEvent(FlatBufferBuilder builder) { | ||
int o = builder.endObject(); | ||
return o; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
package com.riiablo.net.packet.bncs; | ||
|
||
public final class EID { | ||
private EID() { } | ||
public static final byte EID_SHOWUSER = 1; | ||
public static final byte EID_JOIN = 2; | ||
public static final byte EID_LEAVE = 3; | ||
public static final byte EID_WHISPER = 4; | ||
public static final byte EID_TALK = 5; | ||
public static final byte EID_BROADCAST = 6; | ||
public static final byte EID_CHANNEL = 7; | ||
public static final byte EID_USERFLAGS = 9; | ||
public static final byte EID_WHISPERSENT = 10; | ||
public static final byte EID_CHANNELFULL = 13; | ||
public static final byte EID_CHANNELDOESNOTEXIST = 14; | ||
public static final byte EID_CHANNELRESTRICTED = 15; | ||
public static final byte EID_INFO = 18; | ||
public static final byte EID_ERROR = 19; | ||
public static final byte EID_IGNORE = 21; | ||
public static final byte EID_ACCEPT = 22; | ||
public static final byte EID_EMOTE = 23; | ||
|
||
public static final String[] names = { "EID_SHOWUSER", "EID_JOIN", "EID_LEAVE", "EID_WHISPER", "EID_TALK", "EID_BROADCAST", "EID_CHANNEL", "", "EID_USERFLAGS", "EID_WHISPERSENT", "", "", "EID_CHANNELFULL", "EID_CHANNELDOESNOTEXIST", "EID_CHANNELRESTRICTED", "", "", "EID_INFO", "EID_ERROR", "", "EID_IGNORE", "EID_ACCEPT", "EID_EMOTE", }; | ||
|
||
public static String name(int e) { return names[e - EID_SHOWUSER]; } | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
include "ChatEvent.fbs"; | ||
|
||
namespace com.riiablo.net.packet.bncs; | ||
|
||
union BNCSData { | ||
ChatEvent, | ||
} | ||
|
||
table BNCS { | ||
data:BNCSData; | ||
} | ||
|
||
root_type BNCS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace com.riiablo.net.packet.bncs; | ||
|
||
enum EID : byte { | ||
EID_SHOWUSER = 0x01, // User in channel | ||
EID_JOIN = 0x02, // User joined channel | ||
EID_LEAVE = 0x03, // User left channel | ||
EID_WHISPER = 0x04, // Recieved whisper | ||
EID_TALK = 0x05, // Chat text | ||
EID_BROADCAST = 0x06, // Server broadcast | ||
EID_CHANNEL = 0x07, // Channel information | ||
EID_USERFLAGS = 0x09, // Flags update | ||
EID_WHISPERSENT = 0x0A, // Sent whisper | ||
EID_CHANNELFULL = 0x0D, // Channel full | ||
EID_CHANNELDOESNOTEXIST = 0x0E, // Channel doesn't exist | ||
EID_CHANNELRESTRICTED = 0x0F, // Channel is restricted | ||
EID_INFO = 0x12, // Information | ||
EID_ERROR = 0x13, // Error message | ||
EID_IGNORE = 0x15, // Notifies that a user has been ignored (DEFUNCT) | ||
EID_ACCEPT = 0x16, // Notifies that a user has been unignored (DEFUNCT) | ||
EID_EMOTE = 0x17, // Emote | ||
} | ||
|
||
table ChatEvent { | ||
eid:EID = EID_ERROR; | ||
name:string; | ||
text:string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apply plugin: "java" | ||
|
||
sourceCompatibility = 1.7 | ||
sourceSets.main.java.srcDirs = [ "src/" ] | ||
sourceSets.test.java.srcDirs = [ "test/" ] | ||
|
||
project.ext.mainClassName = "com.riiablo.server.bncs.BNCS" | ||
project.ext.assetsDir = new File("../android/assets"); | ||
|
||
task run(dependsOn: classes, type: JavaExec) { | ||
main = project.mainClassName | ||
classpath = sourceSets.main.runtimeClasspath | ||
standardInput = System.in | ||
workingDir = project.assetsDir | ||
ignoreExitValue = true | ||
} | ||
|
||
task dist(type: Jar) { | ||
from files(sourceSets.main.output.classesDir) | ||
from files(sourceSets.main.output.resourcesDir) | ||
from {configurations.compile.collect {zipTree(it)}} | ||
from files(project.assetsDir); | ||
|
||
manifest { | ||
attributes 'Server-Class': project.mainClassName | ||
} | ||
} | ||
|
||
dist.dependsOn classes |
Oops, something went wrong.