mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-05 16:49:04 +00:00
Add consistent formatting.
This commit is contained in:
@@ -41,6 +41,7 @@ public final class FileSystemConstants {
|
|||||||
* Default private constructor to prevent instantiation.
|
* Default private constructor to prevent instantiation.
|
||||||
*/
|
*/
|
||||||
private FileSystemConstants() {
|
private FileSystemConstants() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -40,9 +40,8 @@ public final class ItemDefinitionDecoder {
|
|||||||
ByteBuffer data = config.getEntry("obj.dat").getBuffer();
|
ByteBuffer data = config.getEntry("obj.dat").getBuffer();
|
||||||
ByteBuffer idx = config.getEntry("obj.idx").getBuffer();
|
ByteBuffer idx = config.getEntry("obj.idx").getBuffer();
|
||||||
|
|
||||||
int count = idx.getShort();
|
int count = idx.getShort(), index = 2;
|
||||||
int[] indices = new int[count];
|
int[] indices = new int[count];
|
||||||
int index = 2;
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
indices[i] = index;
|
indices[i] = index;
|
||||||
index += idx.getShort();
|
index += idx.getShort();
|
||||||
|
|||||||
@@ -40,9 +40,8 @@ public final class NpcDefinitionDecoder {
|
|||||||
ByteBuffer data = config.getEntry("npc.dat").getBuffer();
|
ByteBuffer data = config.getEntry("npc.dat").getBuffer();
|
||||||
ByteBuffer idx = config.getEntry("npc.idx").getBuffer();
|
ByteBuffer idx = config.getEntry("npc.idx").getBuffer();
|
||||||
|
|
||||||
int count = idx.getShort();
|
int count = idx.getShort(), index = 2;
|
||||||
int[] indices = new int[count];
|
int[] indices = new int[count];
|
||||||
int index = 2;
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
indices[i] = index;
|
indices[i] = index;
|
||||||
index += idx.getShort();
|
index += idx.getShort();
|
||||||
@@ -66,37 +65,37 @@ public final class NpcDefinitionDecoder {
|
|||||||
*/
|
*/
|
||||||
private NpcDefinition decode(int id, ByteBuffer buffer) {
|
private NpcDefinition decode(int id, ByteBuffer buffer) {
|
||||||
NpcDefinition definition = new NpcDefinition(id);
|
NpcDefinition definition = new NpcDefinition(id);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int code = buffer.get() & 0xFF;
|
int opcode = buffer.get() & 0xFF;
|
||||||
if (code == 0) {
|
|
||||||
|
if (opcode == 0) {
|
||||||
return definition;
|
return definition;
|
||||||
} else if (code == 1) {
|
} else if (opcode == 1) {
|
||||||
int length = buffer.get() & 0xFF;
|
int length = buffer.get() & 0xFF;
|
||||||
int[] npcModels = new int[length];
|
int[] models = new int[length];
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
npcModels[i] = buffer.getShort();
|
models[i] = buffer.getShort();
|
||||||
}
|
}
|
||||||
} else if (code == 2) {
|
} else if (opcode == 2) {
|
||||||
definition.setName(BufferUtil.readString(buffer));
|
definition.setName(BufferUtil.readString(buffer));
|
||||||
} else if (code == 3) {
|
} else if (opcode == 3) {
|
||||||
definition.setDescription(BufferUtil.readString(buffer));
|
definition.setDescription(BufferUtil.readString(buffer));
|
||||||
} else if (code == 12) {
|
} else if (opcode == 12) {
|
||||||
definition.setSize(buffer.get());
|
definition.setSize(buffer.get());
|
||||||
} else if (code == 13) {
|
} else if (opcode == 13) {
|
||||||
definition.setStandAnimation(buffer.getShort());
|
definition.setStandAnimation(buffer.getShort());
|
||||||
} else if (code == 14) {
|
} else if (opcode == 14) {
|
||||||
definition.setWalkAnimation(buffer.getShort());
|
definition.setWalkAnimation(buffer.getShort());
|
||||||
} else if (code == 17) {
|
} else if (opcode == 17) {
|
||||||
definition
|
definition
|
||||||
.setWalkAnimations(buffer.getShort(), buffer.getShort(), buffer.getShort(), buffer.getShort());
|
.setWalkAnimations(buffer.getShort(), buffer.getShort(), buffer.getShort(), buffer.getShort());
|
||||||
} else if (code >= 30 && code < 40) {
|
} else if (opcode >= 30 && opcode < 40) {
|
||||||
String str = BufferUtil.readString(buffer);
|
String str = BufferUtil.readString(buffer);
|
||||||
if (str.equals("hidden")) {
|
if (str.equals("hidden")) {
|
||||||
str = null;
|
str = null;
|
||||||
}
|
}
|
||||||
definition.setInteraction(code - 30, str);
|
definition.setInteraction(opcode - 30, str);
|
||||||
} else if (code == 40) {
|
} else if (opcode == 40) {
|
||||||
int length = buffer.get() & 0xFF;
|
int length = buffer.get() & 0xFF;
|
||||||
int[] originalColours = new int[length];
|
int[] originalColours = new int[length];
|
||||||
int[] replacementColours = new int[length];
|
int[] replacementColours = new int[length];
|
||||||
@@ -104,45 +103,33 @@ public final class NpcDefinitionDecoder {
|
|||||||
originalColours[i] = buffer.getShort();
|
originalColours[i] = buffer.getShort();
|
||||||
replacementColours[i] = buffer.getShort();
|
replacementColours[i] = buffer.getShort();
|
||||||
}
|
}
|
||||||
} else if (code == 60) {
|
} else if (opcode == 60) {
|
||||||
int length = buffer.get() & 0xFF;
|
int length = buffer.get() & 0xFF;
|
||||||
int[] additionalModels = new int[length];
|
int[] additionalModels = new int[length];
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
additionalModels[i] = buffer.getShort();
|
additionalModels[i] = buffer.getShort();
|
||||||
}
|
}
|
||||||
} else if (code == 90) {
|
} else if (opcode == 90) {
|
||||||
buffer.getShort(); // Dummy
|
buffer.getShort(); // Dummy
|
||||||
} else if (code == 91) {
|
} else if (opcode == 91) {
|
||||||
buffer.getShort(); // Dummy
|
buffer.getShort(); // Dummy
|
||||||
} else if (code == 92) {
|
} else if (opcode == 92) {
|
||||||
buffer.getShort(); // Dummy
|
buffer.getShort(); // Dummy
|
||||||
} else if (code == 93) {
|
} else if (opcode == 95) {
|
||||||
@SuppressWarnings("unused")
|
|
||||||
boolean drawMinimapDot = false;
|
|
||||||
} else if (code == 95) {
|
|
||||||
definition.setCombatLevel(buffer.getShort());
|
definition.setCombatLevel(buffer.getShort());
|
||||||
} else if (code == 97) {
|
} else if (opcode == 97) {
|
||||||
@SuppressWarnings("unused")
|
buffer.getShort();
|
||||||
int scaleXZ = buffer.getShort();
|
} else if (opcode == 98) {
|
||||||
} else if (code == 98) {
|
buffer.getShort();
|
||||||
@SuppressWarnings("unused")
|
} else if (opcode == 100) {
|
||||||
int scaleY = buffer.getShort();
|
buffer.get();
|
||||||
} else if (code == 99) {
|
} else if (opcode == 101) {
|
||||||
@SuppressWarnings("unused")
|
buffer.get();
|
||||||
boolean unknown = true;
|
} else if (opcode == 102) {
|
||||||
} else if (code == 100) {
|
buffer.getShort();
|
||||||
@SuppressWarnings("unused")
|
} else if (opcode == 103) {
|
||||||
int lightModifier = buffer.get();
|
buffer.getShort();
|
||||||
} else if (code == 101) {
|
} else if (opcode == 106) {
|
||||||
@SuppressWarnings("unused")
|
|
||||||
int shadowModifier = buffer.get() * 5;
|
|
||||||
} else if (code == 102) {
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
int headIcon = buffer.getShort();
|
|
||||||
} else if (code == 103) {
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
int degreesToRotate = buffer.getShort();
|
|
||||||
} else if (code == 106) {
|
|
||||||
int morphVariableBitsIndex = buffer.getShort();
|
int morphVariableBitsIndex = buffer.getShort();
|
||||||
if (morphVariableBitsIndex == 65535) {
|
if (morphVariableBitsIndex == 65535) {
|
||||||
morphVariableBitsIndex = -1;
|
morphVariableBitsIndex = -1;
|
||||||
@@ -161,7 +148,7 @@ public final class NpcDefinitionDecoder {
|
|||||||
}
|
}
|
||||||
morphisms[i] = morphism;
|
morphisms[i] = morphism;
|
||||||
}
|
}
|
||||||
} else if (code == 107) {
|
} else if (opcode == 107) {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
boolean clickable = false;
|
boolean clickable = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,8 @@ public final class ObjectDefinitionDecoder {
|
|||||||
ByteBuffer data = config.getEntry("loc.dat").getBuffer();
|
ByteBuffer data = config.getEntry("loc.dat").getBuffer();
|
||||||
ByteBuffer idx = config.getEntry("loc.idx").getBuffer();
|
ByteBuffer idx = config.getEntry("loc.idx").getBuffer();
|
||||||
|
|
||||||
int count = idx.getShort();
|
int count = idx.getShort(), index = 2;
|
||||||
int[] indices = new int[count];
|
int[] indices = new int[count];
|
||||||
int index = 2;
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
indices[i] = index;
|
indices[i] = index;
|
||||||
index += idx.getShort();
|
index += idx.getShort();
|
||||||
@@ -65,7 +64,6 @@ public final class ObjectDefinitionDecoder {
|
|||||||
*/
|
*/
|
||||||
public ObjectDefinition decode(int id, ByteBuffer data) {
|
public ObjectDefinition decode(int id, ByteBuffer data) {
|
||||||
ObjectDefinition definition = new ObjectDefinition(id);
|
ObjectDefinition definition = new ObjectDefinition(id);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int opcode = data.get() & 0xFF;
|
int opcode = data.get() & 0xFF;
|
||||||
|
|
||||||
@@ -74,8 +72,8 @@ public final class ObjectDefinitionDecoder {
|
|||||||
} else if (opcode == 1) {
|
} else if (opcode == 1) {
|
||||||
int amount = data.get() & 0xFF;
|
int amount = data.get() & 0xFF;
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
data.getShort(); // model id
|
data.getShort();
|
||||||
data.get(); // model position
|
data.get();
|
||||||
}
|
}
|
||||||
} else if (opcode == 2) {
|
} else if (opcode == 2) {
|
||||||
definition.setName(BufferUtil.readString(data));
|
definition.setName(BufferUtil.readString(data));
|
||||||
@@ -84,7 +82,7 @@ public final class ObjectDefinitionDecoder {
|
|||||||
} else if (opcode == 5) {
|
} else if (opcode == 5) {
|
||||||
int amount = data.get() & 0xFF;
|
int amount = data.get() & 0xFF;
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
data.getShort(); // model id
|
data.getShort();
|
||||||
}
|
}
|
||||||
} else if (opcode == 14) {
|
} else if (opcode == 14) {
|
||||||
definition.setWidth(data.get() & 0xFF);
|
definition.setWidth(data.get() & 0xFF);
|
||||||
@@ -96,18 +94,12 @@ public final class ObjectDefinitionDecoder {
|
|||||||
definition.setImpenetrable(false);
|
definition.setImpenetrable(false);
|
||||||
} else if (opcode == 19) {
|
} else if (opcode == 19) {
|
||||||
definition.setInteractive((data.get() & 0xFF) == 1);
|
definition.setInteractive((data.get() & 0xFF) == 1);
|
||||||
} else if (opcode == 21) {
|
|
||||||
// boolean contouredGround = true;
|
|
||||||
} else if (opcode == 22) {
|
|
||||||
// boolean delayShading = true;
|
|
||||||
} else if (opcode == 23) {
|
|
||||||
// boolean occlues = true;
|
|
||||||
} else if (opcode == 24) {
|
} else if (opcode == 24) {
|
||||||
data.getShort(); // animation
|
data.getShort();
|
||||||
} else if (opcode == 28) {
|
} else if (opcode == 28) {
|
||||||
data.get(); // decorDisplacement
|
data.get();
|
||||||
} else if (opcode == 29) {
|
} else if (opcode == 29) {
|
||||||
data.get(); // ambientLight
|
data.get();
|
||||||
} else if (opcode >= 30 && opcode < 39) {
|
} else if (opcode >= 30 && opcode < 39) {
|
||||||
String[] actions = definition.getMenuActions();
|
String[] actions = definition.getMenuActions();
|
||||||
if (actions == null) {
|
if (actions == null) {
|
||||||
@@ -117,41 +109,33 @@ public final class ObjectDefinitionDecoder {
|
|||||||
actions[opcode - 30] = action;
|
actions[opcode - 30] = action;
|
||||||
definition.setMenuActions(actions);
|
definition.setMenuActions(actions);
|
||||||
} else if (opcode == 39) {
|
} else if (opcode == 39) {
|
||||||
data.get(); // light diffusion
|
data.get();
|
||||||
} else if (opcode == 40) {
|
} else if (opcode == 40) {
|
||||||
int amount = data.get() & 0xFF;
|
int amount = data.get() & 0xFF;
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
data.getShort(); // original colour
|
data.getShort();
|
||||||
data.getShort(); // replacement colour
|
data.getShort();
|
||||||
}
|
}
|
||||||
} else if (opcode == 60) {
|
} else if (opcode == 60) {
|
||||||
data.getShort(); // minimap function
|
data.getShort();
|
||||||
} else if (opcode == 62) {
|
|
||||||
// boolean inverted = true
|
|
||||||
} else if (opcode == 64) {
|
|
||||||
// boolean castsShadow = false;
|
|
||||||
} else if (opcode == 65) {
|
} else if (opcode == 65) {
|
||||||
data.getShort(); // scale X
|
data.getShort();
|
||||||
} else if (opcode == 66) {
|
} else if (opcode == 66) {
|
||||||
data.getShort(); // scale Y
|
data.getShort();
|
||||||
} else if (opcode == 67) {
|
} else if (opcode == 67) {
|
||||||
data.getShort(); // scale Z
|
data.getShort();
|
||||||
} else if (opcode == 68) {
|
} else if (opcode == 68) {
|
||||||
data.getShort(); // map scene
|
data.getShort();
|
||||||
} else if (opcode == 69) {
|
} else if (opcode == 69) {
|
||||||
data.get(); // surroundings
|
data.get();
|
||||||
} else if (opcode == 70) {
|
} else if (opcode == 70) {
|
||||||
data.getShort(); // translate dX
|
data.getShort();
|
||||||
} else if (opcode == 71) {
|
} else if (opcode == 71) {
|
||||||
data.getShort(); // translate dY
|
data.getShort();
|
||||||
} else if (opcode == 72) {
|
} else if (opcode == 72) {
|
||||||
data.getShort(); // translate dZ
|
data.getShort();
|
||||||
} else if (opcode == 73) {
|
|
||||||
// boolean obstructiveGround = true;
|
|
||||||
} else if (opcode == 74) {
|
|
||||||
// boolean ethereal = true;
|
|
||||||
} else if (opcode == 75) {
|
} else if (opcode == 75) {
|
||||||
data.get(); // support items
|
data.get();
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ public final class GameService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
world.pulse();
|
world.pulse();
|
||||||
|
|
||||||
synchronizer.synchronize();
|
synchronizer.synchronize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,17 +70,15 @@ public enum Direction {
|
|||||||
return Direction.NORTH_EAST;
|
return Direction.NORTH_EAST;
|
||||||
} else if (deltaX == 0) {
|
} else if (deltaX == 0) {
|
||||||
return Direction.NORTH;
|
return Direction.NORTH;
|
||||||
} else {
|
|
||||||
return Direction.NORTH_WEST;
|
|
||||||
}
|
}
|
||||||
|
return Direction.NORTH_WEST;
|
||||||
} else if (deltaY == -1) {
|
} else if (deltaY == -1) {
|
||||||
if (deltaX == 1) {
|
if (deltaX == 1) {
|
||||||
return Direction.SOUTH_EAST;
|
return Direction.SOUTH_EAST;
|
||||||
} else if (deltaX == 0) {
|
} else if (deltaX == 0) {
|
||||||
return Direction.SOUTH;
|
return Direction.SOUTH;
|
||||||
} else {
|
|
||||||
return Direction.SOUTH_WEST;
|
|
||||||
}
|
}
|
||||||
|
return Direction.SOUTH_WEST;
|
||||||
} else {
|
} else {
|
||||||
if (deltaX == 1) {
|
if (deltaX == 1) {
|
||||||
return Direction.EAST;
|
return Direction.EAST;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public final class Npc extends Mob {
|
|||||||
*/
|
*/
|
||||||
public void transform(int id) {
|
public void transform(int id) {
|
||||||
if (id < 0 || id >= NpcDefinition.count()) {
|
if (id < 0 || id >= NpcDefinition.count()) {
|
||||||
throw new IllegalArgumentException("Id to transform to is out of bounds");
|
throw new IllegalArgumentException("id to transform to is out of bounds");
|
||||||
}
|
}
|
||||||
definition = NpcDefinition.lookup(id);
|
definition = NpcDefinition.lookup(id);
|
||||||
blockSet.add(SynchronizationBlock.createTransformBlock(id));
|
blockSet.add(SynchronizationBlock.createTransformBlock(id));
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public final class SkillSet {
|
|||||||
*/
|
*/
|
||||||
private void init() {
|
private void init() {
|
||||||
for (int id = 0; id < skills.length; id++) {
|
for (int id = 0; id < skills.length; id++) {
|
||||||
skills[id] = id == Skill.HITPOINTS ? new Skill(1154, 10, 10) : new Skill(0, 1, 1);
|
skills[id] = (id == Skill.HITPOINTS ? new Skill(1154, 10, 10) : new Skill(0, 1, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,15 +211,15 @@ public final class SkillSet {
|
|||||||
*/
|
*/
|
||||||
public void normalize() {
|
public void normalize() {
|
||||||
for (int id = 0; id < skills.length; id++) {
|
for (int id = 0; id < skills.length; id++) {
|
||||||
int cur = skills[id].getCurrentLevel();
|
int current = skills[id].getCurrentLevel();
|
||||||
int max = skills[id].getMaximumLevel();
|
int max = skills[id].getMaximumLevel();
|
||||||
|
|
||||||
if (cur == max) {
|
if (current == max) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cur += cur < max ? 1 : -1;
|
current += current < max ? 1 : -1;
|
||||||
|
|
||||||
setSkill(id, new Skill(skills[id].getExperience(), cur, max));
|
setSkill(id, new Skill(skills[id].getExperience(), current, max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,9 +147,9 @@ public final class WalkingQueue {
|
|||||||
Direction direction = Direction.fromDeltas(deltaX, deltaY);
|
Direction direction = Direction.fromDeltas(deltaX, deltaY);
|
||||||
|
|
||||||
if (direction != Direction.NONE) {
|
if (direction != Direction.NONE) {
|
||||||
Point p = new Point(new Position(x, y, mob.getPosition().getHeight()), direction);
|
Point point = new Point(new Position(x, y, mob.getPosition().getHeight()), direction);
|
||||||
points.add(p);
|
points.add(point);
|
||||||
oldPoints.add(p);
|
oldPoints.add(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ public final class World {
|
|||||||
* Creates the world.
|
* Creates the world.
|
||||||
*/
|
*/
|
||||||
private World() {
|
private World() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,9 +157,6 @@ public final class World {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the player repository.
|
* Gets the player repository.
|
||||||
* <p>
|
|
||||||
* Note: players should be registered and unregistered using {@link World#register(Player)} and
|
|
||||||
* {@link World#unregister(Player)} respectively, not by adding to or removing from this repository directly.
|
|
||||||
*
|
*
|
||||||
* @return The player repository.
|
* @return The player repository.
|
||||||
*/
|
*/
|
||||||
@@ -209,18 +207,18 @@ public final class World {
|
|||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
NpcDefinitionDecoder npcDefParser = new NpcDefinitionDecoder(fs);
|
NpcDefinitionDecoder npcDecoder = new NpcDefinitionDecoder(fs);
|
||||||
NpcDefinition[] npcDefs = npcDefParser.decode();
|
NpcDefinition[] npcDefs = npcDecoder.decode();
|
||||||
NpcDefinition.init(npcDefs);
|
NpcDefinition.init(npcDefs);
|
||||||
logger.info("Loaded " + npcDefs.length + " npc definitions.");
|
logger.info("Loaded " + npcDefs.length + " npc definitions.");
|
||||||
|
|
||||||
ObjectDefinitionDecoder objDefParser = new ObjectDefinitionDecoder(fs);
|
ObjectDefinitionDecoder objectDecoder = new ObjectDefinitionDecoder(fs);
|
||||||
ObjectDefinition[] objDefs = objDefParser.decode();
|
ObjectDefinition[] objDefs = objectDecoder.decode();
|
||||||
ObjectDefinition.init(objDefs);
|
ObjectDefinition.init(objDefs);
|
||||||
logger.info("Loaded " + objDefs.length + " object definitions.");
|
logger.info("Loaded " + objDefs.length + " object definitions.");
|
||||||
|
|
||||||
StaticObjectDecoder objectParser = new StaticObjectDecoder(fs);
|
StaticObjectDecoder staticDecoder = new StaticObjectDecoder(fs);
|
||||||
StaticObject[] objects = objectParser.decode();
|
StaticObject[] objects = staticDecoder.decode();
|
||||||
placeEntities(objects);
|
placeEntities(objects);
|
||||||
logger.info("Loaded " + objects.length + " static objects.");
|
logger.info("Loaded " + objects.length + " static objects.");
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public final class WorldConstants {
|
|||||||
* Default private constructor to prevent instantiation by other classes.
|
* Default private constructor to prevent instantiation by other classes.
|
||||||
*/
|
*/
|
||||||
private WorldConstants() {
|
private WorldConstants() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -57,6 +57,7 @@ public class InterfaceConstants {
|
|||||||
* Prevent instantiation.
|
* Prevent instantiation.
|
||||||
*/
|
*/
|
||||||
private InterfaceConstants() {
|
private InterfaceConstants() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,4 +43,4 @@ public final class PhasedSynchronizationTask extends SynchronizationTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,4 +36,4 @@ public final class PostPlayerSynchronizationTask extends SynchronizationTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,4 +10,4 @@ import org.apollo.game.sync.ClientSynchronizer;
|
|||||||
*/
|
*/
|
||||||
public abstract class SynchronizationTask implements Runnable {
|
public abstract class SynchronizationTask implements Runnable {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,5 +3,4 @@
|
|||||||
* {@link org.apollo.game.sync.task.SynchronizationTask}s, small chunks of work
|
* {@link org.apollo.game.sync.task.SynchronizationTask}s, small chunks of work
|
||||||
* executed during the client synchronization process.
|
* executed during the client synchronization process.
|
||||||
*/
|
*/
|
||||||
package org.apollo.game.sync.task;
|
package org.apollo.game.sync.task;
|
||||||
|
|
||||||
@@ -7,6 +7,26 @@ package org.apollo.net.codec.login;
|
|||||||
*/
|
*/
|
||||||
public final class LoginConstants {
|
public final class LoginConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exchange data login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_EXCHANGE_DATA = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delay for 2 seconds login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_DELAY = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OK login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_OK = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalid credentials login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_INVALID_CREDENTIALS = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account disabled login status.
|
* Account disabled login status.
|
||||||
*/
|
*/
|
||||||
@@ -17,51 +37,31 @@ public final class LoginConstants {
|
|||||||
*/
|
*/
|
||||||
public static final int STATUS_ACCOUNT_ONLINE = 5;
|
public static final int STATUS_ACCOUNT_ONLINE = 5;
|
||||||
|
|
||||||
/**
|
|
||||||
* Bad session id login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_BAD_SESSION_ID = 10;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Could not complete login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_COULD_NOT_COMPLETE = 13;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delay for 2 seconds login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_DELAY = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exchange data login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_EXCHANGE_DATA = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Game updated login status.
|
* Game updated login status.
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_GAME_UPDATED = 6;
|
public static final int STATUS_GAME_UPDATED = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standing in members area on free world status.
|
* Server full login status.
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_IN_MEMBERS_AREA = 17;
|
public static final int STATUS_SERVER_FULL = 7;
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalid credentials login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_INVALID_CREDENTIALS = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalid login server status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_INVALID_LOGIN_SERVER = 20;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Login server offline login status.
|
* Login server offline login status.
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_LOGIN_SERVER_OFFLINE = 8;
|
public static final int STATUS_LOGIN_SERVER_OFFLINE = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Too many connections login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_TOO_MANY_CONNECTIONS = 9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bad session id login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_BAD_SESSION_ID = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Login server rejected session login status.
|
* Login server rejected session login status.
|
||||||
*/
|
*/
|
||||||
@@ -73,34 +73,9 @@ public final class LoginConstants {
|
|||||||
public static final int STATUS_MEMBERS_ACCOUNT_REQUIRED = 12;
|
public static final int STATUS_MEMBERS_ACCOUNT_REQUIRED = 12;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OK login status.
|
* Could not complete login status.
|
||||||
*/
|
*/
|
||||||
public static final int STATUS_OK = 2;
|
public static final int STATUS_COULD_NOT_COMPLETE = 13;
|
||||||
|
|
||||||
/**
|
|
||||||
* Profile transfer login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_PROFILE_TRANSFER = 21;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reconnection OK login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_RECONNECTION_OK = 15;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Server full login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_SERVER_FULL = 7;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Too many connections login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_TOO_MANY_CONNECTIONS = 9;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Too many login attempts login status.
|
|
||||||
*/
|
|
||||||
public static final int STATUS_TOO_MANY_LOGINS = 16;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server updating login status.
|
* Server updating login status.
|
||||||
@@ -108,15 +83,40 @@ public final class LoginConstants {
|
|||||||
public static final int STATUS_UPDATING = 14;
|
public static final int STATUS_UPDATING = 14;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reconnection login type id.
|
* Reconnection OK login status.
|
||||||
*/
|
*/
|
||||||
public static final int TYPE_RECONNECTION = 18;
|
public static final int STATUS_RECONNECTION_OK = 15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Too many login attempts login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_TOO_MANY_LOGINS = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standing in members area on free world status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_IN_MEMBERS_AREA = 17;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalid login server status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_INVALID_LOGIN_SERVER = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profile transfer login status.
|
||||||
|
*/
|
||||||
|
public static final int STATUS_PROFILE_TRANSFER = 21;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard login type id.
|
* Standard login type id.
|
||||||
*/
|
*/
|
||||||
public static final int TYPE_STANDARD = 16;
|
public static final int TYPE_STANDARD = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconnection login type id.
|
||||||
|
*/
|
||||||
|
public static final int TYPE_RECONNECTION = 18;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default private constructor to prevent instantiation.
|
* Default private constructor to prevent instantiation.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,13 +4,12 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||||
import io.netty.handler.codec.ReplayingDecoder;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A stateful implementation of a {@link FrameDecoder} which may be extended and used by other classes. The current
|
* A stateful implementation of a {@link ByteToMessageDecoder} which may be extended and used by other classes. The
|
||||||
* state is tracked by this class and is a user-specified enumeration.
|
* current state is tracked by this class and is a user-specified enumeration.
|
||||||
*
|
*
|
||||||
* The state may be changed by calling the {@link StatefulFrameDecoder#setState(Enum)} method.
|
* The state may be changed by calling the {@link StatefulFrameDecoder#setState(Enum)} method.
|
||||||
*
|
*
|
||||||
@@ -20,8 +19,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* This class is not thread safe: it is recommended that the state is only set in the decode methods overriden.
|
* This class is not thread safe: it is recommended that the state is only set in the decode methods overriden.
|
||||||
*
|
*
|
||||||
* {@code null} states are not permitted. This means you cannot use {@link VoidEnum} like used in a
|
* {@code null} states are not permitted.
|
||||||
* {@link ReplayingDecoder}. If you do not need state management, the {@link FrameDecoder} class should be used instead.
|
|
||||||
*
|
*
|
||||||
* @author Graham
|
* @author Graham
|
||||||
* @param <T> The state enumeration.
|
* @param <T> The state enumeration.
|
||||||
|
|||||||
@@ -5,9 +5,13 @@ package org.apollo.util.plugin;
|
|||||||
*
|
*
|
||||||
* @author Graham
|
* @author Graham
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public final class DependencyException extends Exception {
|
public final class DependencyException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generated serial version id.
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -3335727281501054641L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the dependency exception.
|
* Creates the dependency exception.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ public final class RubyPluginEnvironment implements PluginEnvironment {
|
|||||||
* @throws IOException If an I/O error occurs.
|
* @throws IOException If an I/O error occurs.
|
||||||
*/
|
*/
|
||||||
private void parseBootstrapper() throws IOException {
|
private void parseBootstrapper() throws IOException {
|
||||||
File f = new File("./data/plugins/bootstrap.rb");
|
File bootstrap = new File("./data/plugins/bootstrap.rb");
|
||||||
InputStream is = new FileInputStream(f);
|
InputStream is = new FileInputStream(bootstrap);
|
||||||
try {
|
try {
|
||||||
parse(is, f.getAbsolutePath());
|
parse(is, bootstrap.getAbsolutePath());
|
||||||
} finally {
|
} finally {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user