Clean-up.

This commit is contained in:
Major-
2013-11-03 05:11:24 +00:00
parent a61b6e3845
commit b3598aeb81
105 changed files with 963 additions and 911 deletions
+15 -15
View File
@@ -45,21 +45,6 @@ public final class IsaacRandom {
*/ */
private static int MASK = SIZE - 1 << 2; private static int MASK = SIZE - 1 << 2;
/**
* The count through the results in the results array.
*/
private int count;
/**
* The results given to the user.
*/
private int[] rsl;
/**
* The internal state.
*/
private int[] mem;
/** /**
* The accumulator. * The accumulator.
*/ */
@@ -75,6 +60,21 @@ public final class IsaacRandom {
*/ */
private int c; private int c;
/**
* The count through the results in the results array.
*/
private int count;
/**
* The internal state.
*/
private int[] mem;
/**
* The results given to the user.
*/
private int[] rsl;
/** /**
* Creates the random number generator without an initial seed. * Creates the random number generator without an initial seed.
*/ */
+7 -7
View File
@@ -61,9 +61,9 @@ public final class Server {
} }
/** /**
* The {@link ServerBootstrap} for the service listener. * The server's context.
*/ */
private final ServerBootstrap serviceBootstrap = new ServerBootstrap(); private ServerContext context;
/** /**
* The {@link ServerBootstrap} for the HTTP listener. * The {@link ServerBootstrap} for the HTTP listener.
@@ -81,6 +81,11 @@ public final class Server {
*/ */
private final ExecutorService networkExecutor = Executors.newCachedThreadPool(); private final ExecutorService networkExecutor = Executors.newCachedThreadPool();
/**
* The {@link ServerBootstrap} for the service listener.
*/
private final ServerBootstrap serviceBootstrap = new ServerBootstrap();
/** /**
* The service manager. * The service manager.
*/ */
@@ -91,11 +96,6 @@ public final class Server {
*/ */
private final Timer timer = new HashedWheelTimer(); private final Timer timer = new HashedWheelTimer();
/**
* The server's context.
*/
private ServerContext context;
/** /**
* Creates the Apollo server. * Creates the Apollo server.
* *
+5 -5
View File
@@ -15,6 +15,11 @@ import org.jboss.netty.channel.group.DefaultChannelGroup;
*/ */
public final class ServerContext { public final class ServerContext {
/**
* The channel group.
*/
private final ChannelGroup group = new DefaultChannelGroup();
/** /**
* The current release. * The current release.
*/ */
@@ -25,11 +30,6 @@ public final class ServerContext {
*/ */
private final ServiceManager serviceManager; private final ServiceManager serviceManager;
/**
* The channel group.
*/
private final ChannelGroup group = new DefaultChannelGroup();
/** /**
* Creates a new server context. * Creates a new server context.
* *
+5 -5
View File
@@ -7,16 +7,16 @@ package org.apollo.fs;
*/ */
public final class FileDescriptor { public final class FileDescriptor {
/**
* The file type.
*/
private final int type;
/** /**
* The file id. * The file id.
*/ */
private final int file; private final int file;
/**
* The file type.
*/
private final int type;
/** /**
* Creates the file descriptor. * Creates the file descriptor.
* *
+16 -17
View File
@@ -7,41 +7,40 @@ package org.apollo.fs;
*/ */
public final class FileSystemConstants { public final class FileSystemConstants {
/**
* The number of caches.
*/
public static final int CACHE_COUNT = 5;
/** /**
* The number of archives in cache 0. * The number of archives in cache 0.
*/ */
public static final int ARCHIVE_COUNT = 9; public static final int ARCHIVE_COUNT = 9;
/**
* The size of an index.
*/
public static final int INDEX_SIZE = 6;
/**
* The size of a header.
*/
public static final int HEADER_SIZE = 8;
/** /**
* The size of a chunk. * The size of a chunk.
*/ */
public static final int CHUNK_SIZE = 512; public static final int CHUNK_SIZE = 512;
/**
* The size of a header.
*/
public static final int HEADER_SIZE = 8;
/** /**
* The size of a block. * The size of a block.
*/ */
public static final int BLOCK_SIZE = HEADER_SIZE + CHUNK_SIZE; public static final int BLOCK_SIZE = HEADER_SIZE + CHUNK_SIZE;
/**
* The number of caches.
*/
public static final int CACHE_COUNT = 5;
/**
* The size of an index.
*/
public static final int INDEX_SIZE = 6;
/** /**
* Default private constructor to prevent instantiation. * Default private constructor to prevent instantiation.
*/ */
private FileSystemConstants() { private FileSystemConstants() {
} }
} }
+5 -5
View File
@@ -25,16 +25,16 @@ public final class Index {
return new Index(size, block); return new Index(size, block);
} }
/**
* The size of the file.
*/
private final int size;
/** /**
* The first block of the file. * The first block of the file.
*/ */
private final int block; private final int block;
/**
* The size of the file.
*/
private final int size;
/** /**
* Creates the index. * Creates the index.
* *
+9 -9
View File
@@ -17,14 +17,9 @@ import java.util.zip.CRC32;
public final class IndexedFileSystem implements Closeable { public final class IndexedFileSystem implements Closeable {
/** /**
* Read only flag. * The cached CRC table.
*/ */
private final boolean readOnly; private ByteBuffer crcTable;
/**
* The index files.
*/
private RandomAccessFile[] indices = new RandomAccessFile[256];
/** /**
* The data file. * The data file.
@@ -32,9 +27,14 @@ public final class IndexedFileSystem implements Closeable {
private RandomAccessFile data; private RandomAccessFile data;
/** /**
* The cached CRC table. * The index files.
*/ */
private ByteBuffer crcTable; private RandomAccessFile[] indices = new RandomAccessFile[256];
/**
* Read only flag.
*/
private final boolean readOnly;
/** /**
* Creates the file system with the specified base directory. * Creates the file system with the specified base directory.
+5 -5
View File
@@ -9,16 +9,16 @@ import java.nio.ByteBuffer;
*/ */
public final class ArchiveEntry { public final class ArchiveEntry {
/**
* The identifier of this entry.
*/
private final int identifier;
/** /**
* The buffer of this entry. * The buffer of this entry.
*/ */
private final ByteBuffer buffer; private final ByteBuffer buffer;
/**
* The identifier of this entry.
*/
private final int identifier;
/** /**
* Creates a new archive entry. * Creates a new archive entry.
* *
+5 -5
View File
@@ -7,16 +7,16 @@ package org.apollo.game;
*/ */
public final class GameConstants { public final class GameConstants {
/**
* The delay between consecutive pulses, in milliseconds.
*/
public static final int PULSE_DELAY = 600;
/** /**
* The maximum events per pulse per session. * The maximum events per pulse per session.
*/ */
public static final int EVENTS_PER_PULSE = 10; public static final int EVENTS_PER_PULSE = 10;
/**
* The delay between consecutive pulses, in milliseconds.
*/
public static final int PULSE_DELAY = 600;
/** /**
* Default private constructor to prevent instantiation by other classes. * Default private constructor to prevent instantiation by other classes.
*/ */
+5 -5
View File
@@ -35,10 +35,9 @@ public final class GameService extends Service {
private static final int UNREGISTERS_PER_CYCLE = 50; private static final int UNREGISTERS_PER_CYCLE = 50;
/** /**
* The scheduled executor service. * The {@link EventHandlerChainGroup}.
*/ */
private final ScheduledExecutorService scheduledExecutor = Executors private EventHandlerChainGroup chainGroup;
.newSingleThreadScheduledExecutor(new NamedThreadFactory("GameService"));
/** /**
* A queue of players to remove. * A queue of players to remove.
@@ -46,9 +45,10 @@ public final class GameService extends Service {
private final Queue<Player> oldPlayers = new ConcurrentLinkedQueue<Player>(); private final Queue<Player> oldPlayers = new ConcurrentLinkedQueue<Player>();
/** /**
* The {@link EventHandlerChainGroup}. * The scheduled executor service.
*/ */
private EventHandlerChainGroup chainGroup; private final ScheduledExecutorService scheduledExecutor = Executors
.newSingleThreadScheduledExecutor(new NamedThreadFactory("GameService"));
/** /**
* The {@link ClientSynchronizer}. * The {@link ClientSynchronizer}.
@@ -12,25 +12,25 @@ import org.apollo.game.model.Position;
public abstract class DistancedAction<T extends Character> extends Action<T> { public abstract class DistancedAction<T extends Character> extends Action<T> {
/** /**
* The position to distance check with. * The delay once the threshold is reached.
*/ */
private final Position position; private final int delay;
/** /**
* The minimum distance before the action fires. * The minimum distance before the action fires.
*/ */
private final int distance; private final int distance;
/**
* The delay once the threshold is reached.
*/
private final int delay;
/** /**
* A flag indicating if this action fires immediately after the threshold is reached. * A flag indicating if this action fires immediately after the threshold is reached.
*/ */
private final boolean immediate; private final boolean immediate;
/**
* The position to distance check with.
*/
private final Position position;
/** /**
* A flag indicating if the distance has been reached yet. * A flag indicating if the distance has been reached yet.
*/ */
+5 -5
View File
@@ -7,16 +7,16 @@ package org.apollo.game.command;
*/ */
public final class Command { public final class Command {
/**
* The name of the command.
*/
private final String name;
/** /**
* The command's arguments. * The command's arguments.
*/ */
private final String[] arguments; private final String[] arguments;
/**
* The name of the command.
*/
private final String name;
/** /**
* Creates the command. * Creates the command.
* *
@@ -10,25 +10,25 @@ import org.apollo.game.event.Event;
public final class ChatEvent extends Event { public final class ChatEvent extends Event {
/** /**
* The message. * The text color.
*/ */
private final String message; private final int color;
/** /**
* The compressed message. * The compressed message.
*/ */
private final byte[] compressedMessage; private final byte[] compressedMessage;
/**
* The text color.
*/
private final int color;
/** /**
* The text effects. * The text effects.
*/ */
private final int effects; private final int effects;
/**
* The message.
*/
private final String message;
/** /**
* Creates a new chat event. * Creates a new chat event.
* *
@@ -2,12 +2,14 @@ package org.apollo.game.event.impl;
/** /**
* The fifth {@link ItemOptionEvent}, used mainly for dropping items. * The fifth {@link ItemOptionEvent}, used mainly for dropping items.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
public final class FifthItemOptionEvent extends ItemOptionEvent { public final class FifthItemOptionEvent extends ItemOptionEvent {
/** /**
* Creates the fifth item option event. * Creates the fifth item option event.
*
* @param interfaceId The interface id. * @param interfaceId The interface id.
* @param id The id. * @param id The id.
* @param slot The slot. * @param slot The slot.
@@ -2,12 +2,14 @@ package org.apollo.game.event.impl;
/** /**
* The first {@link ItemOptionEvent}, used for eating food or identifying herbs (amongst others). * The first {@link ItemOptionEvent}, used for eating food or identifying herbs (amongst others).
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
public final class FirstItemOptionEvent extends ItemOptionEvent { public final class FirstItemOptionEvent extends ItemOptionEvent {
/** /**
* Creates the first item option event. * Creates the first item option event.
*
* @param interfaceId The interface id. * @param interfaceId The interface id.
* @param id The id. * @param id The id.
* @param slot The slot. * @param slot The slot.
@@ -2,12 +2,14 @@ package org.apollo.game.event.impl;
/** /**
* The fourth {@link ItemOptionEvent}. * The fourth {@link ItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
public final class FourthItemOptionEvent extends ItemOptionEvent { public final class FourthItemOptionEvent extends ItemOptionEvent {
/** /**
* Creates the fourth item option event. * Creates the fourth item option event.
*
* @param interfaceId The interface id. * @param interfaceId The interface id.
* @param id The id. * @param id The id.
* @param slot The slot. * @param slot The slot.
@@ -11,9 +11,9 @@ import org.apollo.game.event.Event;
public abstract class InventoryItemEvent extends Event { public abstract class InventoryItemEvent extends Event {
/** /**
* The option number (1-5). * The item id.
*/ */
private final int option; private final int id;
/** /**
* The interface id. * The interface id.
@@ -21,9 +21,9 @@ public abstract class InventoryItemEvent extends Event {
private final int interfaceId; private final int interfaceId;
/** /**
* The item id. * The option number (1-5).
*/ */
private final int id; private final int option;
/** /**
* The item's slot. * The item's slot.
@@ -46,12 +46,12 @@ public abstract class InventoryItemEvent extends Event {
} }
/** /**
* Gets the option number. * Gets the item id.
* *
* @return The option number. * @return The item id.
*/ */
public final int getOption() { public final int getId() {
return option; return id;
} }
/** /**
@@ -64,12 +64,12 @@ public abstract class InventoryItemEvent extends Event {
} }
/** /**
* Gets the item id. * Gets the option number.
* *
* @return The item id. * @return The option number.
*/ */
public final int getId() { public final int getOption() {
return id; return option;
} }
/** /**
@@ -1,8 +1,9 @@
package org.apollo.game.event.impl; package org.apollo.game.event.impl;
/** /**
* An {@link InventoryItemEvent} which is sent by the client when an item's option is clicked (e.g. equip, * An {@link InventoryItemEvent} which is sent by the client when an item's option is clicked (e.g. equip, eat, drink,
* eat, drink, etc). * etc).
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
public abstract class ItemOptionEvent extends InventoryItemEvent { public abstract class ItemOptionEvent extends InventoryItemEvent {
@@ -14,6 +14,11 @@ import org.apollo.game.sync.seg.SynchronizationSegment;
*/ */
public class NpcSynchronizationEvent extends Event { public class NpcSynchronizationEvent extends Event {
/**
* The amount of local npcs.
*/
private final int localNpcs;
/** /**
* The npc's position. * The npc's position.
*/ */
@@ -24,11 +29,6 @@ public class NpcSynchronizationEvent extends Event {
*/ */
private final List<SynchronizationSegment> segments; private final List<SynchronizationSegment> segments;
/**
* The amount of local npcs.
*/
private final int localNpcs;
/** /**
* Creates a new {@link NpcSynchronizationEvent}. * Creates a new {@link NpcSynchronizationEvent}.
* *
@@ -10,16 +10,16 @@ import org.apollo.game.model.Position;
*/ */
public abstract class ObjectActionEvent extends Event { public abstract class ObjectActionEvent extends Event {
/**
* The option number (1-3).
*/
private final int option;
/** /**
* The object's id. * The object's id.
*/ */
private final int id; private final int id;
/**
* The option number (1-3).
*/
private final int option;
/** /**
* The object's position. * The object's position.
*/ */
@@ -18,6 +18,11 @@ public final class PlayerSynchronizationEvent extends Event {
*/ */
private final Position lastKnownRegion; private final Position lastKnownRegion;
/**
* The number of local players.
*/
private final int localPlayers;
/** /**
* The player's position. * The player's position.
*/ */
@@ -33,11 +38,6 @@ public final class PlayerSynchronizationEvent extends Event {
*/ */
private final SynchronizationSegment segment; private final SynchronizationSegment segment;
/**
* The number of local players.
*/
private final int localPlayers;
/** /**
* A list of segments. * A list of segments.
*/ */
@@ -2,12 +2,14 @@ package org.apollo.game.event.impl;
/** /**
* The second {@link ItemOptionEvent}, used for equipping an item (amongst others?). * The second {@link ItemOptionEvent}, used for equipping an item (amongst others?).
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
public final class SecondItemOptionEvent extends ItemOptionEvent { public final class SecondItemOptionEvent extends ItemOptionEvent {
/** /**
* Creates the second item option event. * Creates the second item option event.
*
* @param interfaceId The interface id. * @param interfaceId The interface id.
* @param id The id. * @param id The id.
* @param slot The slot. * @param slot The slot.
@@ -9,26 +9,26 @@ import org.apollo.game.event.Event;
*/ */
public final class SwitchItemEvent extends Event { public final class SwitchItemEvent extends Event {
/**
* The interface id.
*/
private final int interfaceId;
/** /**
* A flag indicating if insertion mode is enabled. * A flag indicating if insertion mode is enabled.
*/ */
private final boolean inserting; private final boolean inserting;
/** /**
* The old slot. * The interface id.
*/ */
private final int oldSlot; private final int interfaceId;
/** /**
* The new slot. * The new slot.
*/ */
private final int newSlot; private final int newSlot;
/**
* The old slot.
*/
private final int oldSlot;
/** /**
* Creates a new switch item event. * Creates a new switch item event.
* *
@@ -9,16 +9,16 @@ import org.apollo.game.event.Event;
*/ */
public final class SwitchTabInterfaceEvent extends Event { public final class SwitchTabInterfaceEvent extends Event {
/**
* The tab id.
*/
private final int tab;
/** /**
* The interface id. * The interface id.
*/ */
private final int interfaceId; private final int interfaceId;
/**
* The tab id.
*/
private final int tab;
/** /**
* Creates the switch interface event. * Creates the switch interface event.
* *
@@ -2,12 +2,14 @@ package org.apollo.game.event.impl;
/** /**
* The third {@link ItemOptionEvent}. * The third {@link ItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
public final class ThirdItemOptionEvent extends ItemOptionEvent { public final class ThirdItemOptionEvent extends ItemOptionEvent {
/** /**
* Creates the third item option event. * Creates the third item option event.
*
* @param interfaceId The interface id. * @param interfaceId The interface id.
* @param id The id. * @param id The id.
* @param slot The slot. * @param slot The slot.
@@ -10,16 +10,16 @@ import org.apollo.game.model.Position;
*/ */
public final class WalkEvent extends Event { public final class WalkEvent extends Event {
/**
* The steps.
*/
private final Position[] steps;
/** /**
* The running flag. * The running flag.
*/ */
private boolean run; private boolean run;
/**
* The steps.
*/
private final Position[] steps;
/** /**
* Creates the event. * Creates the event.
* *
+106 -106
View File
@@ -7,141 +7,61 @@ package org.apollo.game.model;
*/ */
public final class Animation { public final class Animation {
/**
* A special animation which stops the current animation.
*/
public static final Animation STOP_ANIMATION = new Animation(-1);
/**
* The yes animation.
*/
public static final Animation YES = new Animation(855);
/**
* The no animation.
*/
public static final Animation NO = new Animation(856);
/**
* The thinking animation.
*/
public static final Animation THINKING = new Animation(857);
/**
* The bow animation.
*/
public static final Animation BOW = new Animation(858);
/** /**
* The angry animation. * The angry animation.
*/ */
public static final Animation ANGRY = new Animation(859); public static final Animation ANGRY = new Animation(859);
/**
* The cry animation.
*/
public static final Animation CRY = new Animation(860);
/**
* The laugh animation.
*/
public static final Animation LAUGH = new Animation(861);
/**
* The cheer animation.
*/
public static final Animation CHEER = new Animation(862);
/**
* The wave animation.
*/
public static final Animation WAVE = new Animation(863);
/** /**
* The beckon animation. * The beckon animation.
*/ */
public static final Animation BECKON = new Animation(864); public static final Animation BECKON = new Animation(864);
/**
* The clap animation.
*/
public static final Animation CLAP = new Animation(865);
/**
* The dance animation.
*/
public static final Animation DANCE = new Animation(866);
/**
* The panic animation.
*/
public static final Animation PANIC = new Animation(2105);
/**
* The jig animation.
*/
public static final Animation JIG = new Animation(2106);
/**
* The spin animation.
*/
public static final Animation SPIN = new Animation(2107);
/**
* The head bang animation.
*/
public static final Animation HEAD_BANG = new Animation(2108);
/**
* The joy jump animation.
*/
public static final Animation JOY_JUMP = new Animation(2109);
/**
* The raspberry animation.
*/
public static final Animation RASPBERRY = new Animation(2110);
/**
* The yawn animation.
*/
public static final Animation YAWN = new Animation(2111);
/**
* The salute animation.
*/
public static final Animation SALUTE = new Animation(2112);
/**
* The shrug animation.
*/
public static final Animation SHRUG = new Animation(2113);
/** /**
* The blow kiss animation. * The blow kiss animation.
*/ */
public static final Animation BLOW_KISS = new Animation(1368); public static final Animation BLOW_KISS = new Animation(1368);
/** /**
* The glass wall animation. * The bow animation.
*/ */
public static final Animation GLASS_WALL = new Animation(1128); public static final Animation BOW = new Animation(858);
/** /**
* The lean animation. * The cheer animation.
*/ */
public static final Animation LEAN = new Animation(1129); public static final Animation CHEER = new Animation(862);
/**
* The clap animation.
*/
public static final Animation CLAP = new Animation(865);
/** /**
* The climb rope animation. * The climb rope animation.
*/ */
public static final Animation CLIMB_ROPE = new Animation(1130); public static final Animation CLIMB_ROPE = new Animation(1130);
/**
* The cry animation.
*/
public static final Animation CRY = new Animation(860);
/**
* The dance animation.
*/
public static final Animation DANCE = new Animation(866);
/** /**
* The glass box animation. * The glass box animation.
*/ */
public static final Animation GLASS_BOX = new Animation(1131); public static final Animation GLASS_BOX = new Animation(1131);
/**
* The glass wall animation.
*/
public static final Animation GLASS_WALL = new Animation(1128);
/** /**
* The goblin bow animation. * The goblin bow animation.
*/ */
@@ -153,15 +73,95 @@ public final class Animation {
public static final Animation GOBLIN_DANCE = new Animation(2128); public static final Animation GOBLIN_DANCE = new Animation(2128);
/** /**
* The id. * The head bang animation.
*/ */
private final int id; public static final Animation HEAD_BANG = new Animation(2108);
/**
* The jig animation.
*/
public static final Animation JIG = new Animation(2106);
/**
* The joy jump animation.
*/
public static final Animation JOY_JUMP = new Animation(2109);
/**
* The laugh animation.
*/
public static final Animation LAUGH = new Animation(861);
/**
* The lean animation.
*/
public static final Animation LEAN = new Animation(1129);
/**
* The no animation.
*/
public static final Animation NO = new Animation(856);
/**
* The panic animation.
*/
public static final Animation PANIC = new Animation(2105);
/**
* The raspberry animation.
*/
public static final Animation RASPBERRY = new Animation(2110);
/**
* The salute animation.
*/
public static final Animation SALUTE = new Animation(2112);
/**
* The shrug animation.
*/
public static final Animation SHRUG = new Animation(2113);
/**
* The spin animation.
*/
public static final Animation SPIN = new Animation(2107);
/**
* A special animation which stops the current animation.
*/
public static final Animation STOP_ANIMATION = new Animation(-1);
/**
* The thinking animation.
*/
public static final Animation THINKING = new Animation(857);
/**
* The wave animation.
*/
public static final Animation WAVE = new Animation(863);
/**
* The yawn animation.
*/
public static final Animation YAWN = new Animation(2111);
/**
* The yes animation.
*/
public static final Animation YES = new Animation(855);
/** /**
* The delay. * The delay.
*/ */
private final int delay; private final int delay;
/**
* The id.
*/
private final int id;
/** /**
* Creates a new animation with no delay. * Creates a new animation with no delay.
* *
+5 -5
View File
@@ -13,6 +13,11 @@ public final class Appearance {
public static final Appearance DEFAULT_APPEARANCE = new Appearance(Gender.MALE, new int[] { 0, 10, 18, 26, 33, 36, public static final Appearance DEFAULT_APPEARANCE = new Appearance(Gender.MALE, new int[] { 0, 10, 18, 26, 33, 36,
42 }, new int[5]); 42 }, new int[5]);
/**
* The array of clothing/skin colours.
*/
private final int[] colors;
/** /**
* The player's gender. * The player's gender.
*/ */
@@ -23,11 +28,6 @@ public final class Appearance {
*/ */
private final int[] style; private final int[] style;
/**
* The array of clothing/skin colours.
*/
private final int[] colors;
/** /**
* Creates the appearance with the specified gender, style and colors. * Creates the appearance with the specified gender, style and colors.
* *
+18 -18
View File
@@ -7,6 +7,16 @@ package org.apollo.game.model;
*/ */
public enum Direction { public enum Direction {
/**
* East movement.
*/
EAST(4),
/**
* No movement.
*/
NONE(-1),
/** /**
* North movement. * North movement.
*/ */
@@ -18,20 +28,20 @@ public enum Direction {
NORTH_EAST(2), NORTH_EAST(2),
/** /**
* East movement. * North west movement.
*/ */
EAST(4), NORTH_WEST(0),
/**
* South east movement.
*/
SOUTH_EAST(7),
/** /**
* South movement. * South movement.
*/ */
SOUTH(6), SOUTH(6),
/**
* South east movement.
*/
SOUTH_EAST(7),
/** /**
* South west movement. * South west movement.
*/ */
@@ -40,17 +50,7 @@ public enum Direction {
/** /**
* West movement. * West movement.
*/ */
WEST(3), WEST(3);
/**
* North west movement.
*/
NORTH_WEST(0),
/**
* No movement.
*/
NONE(-1);
/** /**
* An empty direction array. * An empty direction array.
@@ -8,59 +8,59 @@ package org.apollo.game.model;
public final class EquipmentConstants { public final class EquipmentConstants {
/** /**
* The hat slot. * The amulet slot.
*/ */
public static final int HAT = 0; public static final int AMULET = 2;
/**
* The arrows slot.
*/
public static final int ARROWS = 13;
/** /**
* The cape slot. * The cape slot.
*/ */
public static final int CAPE = 1; public static final int CAPE = 1;
/**
* The amulet slot.
*/
public static final int AMULET = 2;
/**
* The weapon slot.
*/
public static final int WEAPON = 3;
/** /**
* The chest slot. * The chest slot.
*/ */
public static final int CHEST = 4; public static final int CHEST = 4;
/**
* The shield slot.
*/
public static final int SHIELD = 5;
/**
* The legs slot.
*/
public static final int LEGS = 7;
/**
* The hands slot.
*/
public static final int HANDS = 9;
/** /**
* The feet slot. * The feet slot.
*/ */
public static final int FEET = 10; public static final int FEET = 10;
/**
* The hands slot.
*/
public static final int HANDS = 9;
/**
* The hat slot.
*/
public static final int HAT = 0;
/**
* The legs slot.
*/
public static final int LEGS = 7;
/** /**
* The ring slot. * The ring slot.
*/ */
public static final int RING = 12; public static final int RING = 12;
/** /**
* The arrows slot. * The shield slot.
*/ */
public static final int ARROWS = 13; public static final int SHIELD = 5;
/**
* The weapon slot.
*/
public static final int WEAPON = 3;
/** /**
* Default private constructor to prevent instantiation; * Default private constructor to prevent instantiation;
+6 -6
View File
@@ -7,15 +7,15 @@ package org.apollo.game.model;
*/ */
public enum Gender { public enum Gender {
/**
* The male gender.
*/
MALE(0),
/** /**
* The female gender. * The female gender.
*/ */
FEMALE(1); FEMALE(1),
/**
* The male gender.
*/
MALE(0);
/** /**
* An integer representation used by the client. * An integer representation used by the client.
+5 -5
View File
@@ -12,11 +12,6 @@ public final class Graphic {
*/ */
public static final Graphic STOP_GRAPHIC = new Graphic(-1); public static final Graphic STOP_GRAPHIC = new Graphic(-1);
/**
* The id.
*/
private final int id;
/** /**
* The delay. * The delay.
*/ */
@@ -27,6 +22,11 @@ public final class Graphic {
*/ */
private final int height; private final int height;
/**
* The id.
*/
private final int id;
/** /**
* Creates a new graphic with no delay and a height of zero. * Creates a new graphic with no delay and a height of zero.
* *
+4 -4
View File
@@ -32,9 +32,9 @@ import org.apollo.game.model.inter.InterfaceListener;
public final class InterfaceSet { public final class InterfaceSet {
/** /**
* The player whose interfaces are being managed. * The current enter amount listener.
*/ */
private final Player player; // TODO: maybe switch to a listener system like the inventory? private EnterAmountListener amountListener;
// TODO: maybe store the current inventory tab ids here?? // TODO: maybe store the current inventory tab ids here??
/** /**
@@ -48,9 +48,9 @@ public final class InterfaceSet {
private InterfaceListener listener; private InterfaceListener listener;
/** /**
* The current enter amount listener. * The player whose interfaces are being managed.
*/ */
private EnterAmountListener amountListener; private final Player player; // TODO: maybe switch to a listener system like the inventory?
/** /**
* Creates an interface set. * Creates an interface set.
+14 -14
View File
@@ -8,9 +8,19 @@ package org.apollo.game.model;
public enum InterfaceType { public enum InterfaceType {
/** /**
* A window is an interface which occupies the game screen. * A dialogue is an interface which appears in the chat box.
*/ */
WINDOW, DIALOGUE,
/**
* An interface which is shown behind a fullscreen window.
*/
FULLSCREEN_BACKGROUND,
/**
* An interface which is shown in full screen mode.
*/
FULLSCREEN_WINDOW,
/** /**
* An overlay is an interface which occupies the game screen like a window, however, you can walk around and perform * An overlay is an interface which occupies the game screen like a window, however, you can walk around and perform
@@ -18,24 +28,14 @@ public enum InterfaceType {
*/ */
OVERLAY, OVERLAY,
/**
* A dialogue is an interface which appears in the chat box.
*/
DIALOGUE,
/** /**
* An interface which displays over the inventory area. * An interface which displays over the inventory area.
*/ */
SIDEBAR, SIDEBAR,
/** /**
* An interface which is shown in full screen mode. * A window is an interface which occupies the game screen.
*/ */
FULLSCREEN_WINDOW, WINDOW;
/**
* An interface which is shown behind a fullscreen window.
*/
FULLSCREEN_BACKGROUND;
} }
+16 -16
View File
@@ -26,34 +26,39 @@ public final class Inventory implements Cloneable {
*/ */
STACK_ALWAYS, STACK_ALWAYS,
/**
* When in {@link #STACK_NEVER} mode, an {@link Inventory} will never stack items.
*/
STACK_NEVER,
/** /**
* When in {@link #STACK_STACKABLE_ITEMS} mode, an {@link Inventory} will stack items depending on their * When in {@link #STACK_STACKABLE_ITEMS} mode, an {@link Inventory} will stack items depending on their
* settings. * settings.
*/ */
STACK_STACKABLE_ITEMS, STACK_STACKABLE_ITEMS;
/**
* When in {@link #STACK_NEVER} mode, an {@link Inventory} will never stack items.
*/
STACK_NEVER;
} }
/**
* A list of inventory listeners.
*/
private final List<InventoryListener> listeners = new ArrayList<InventoryListener>();
/** /**
* The capacity of this inventory. * The capacity of this inventory.
*/ */
private final int capacity; private final int capacity;
/**
* A flag indicating if events are being fired.
*/
private boolean firingEvents = true; // TODO: make this reentrant
/** /**
* The items in this inventory. * The items in this inventory.
*/ */
private Item[] items; private Item[] items;
/**
* A list of inventory listeners.
*/
private final List<InventoryListener> listeners = new ArrayList<InventoryListener>();
/** /**
* The stacking mode. * The stacking mode.
*/ */
@@ -64,11 +69,6 @@ public final class Inventory implements Cloneable {
*/ */
private int size = 0; private int size = 0;
/**
* A flag indicating if events are being fired.
*/
private boolean firingEvents = true; // TODO: make this reentrant
/** /**
* Creates an inventory. * Creates an inventory.
* *
@@ -12,16 +12,16 @@ public final class InventoryConstants {
*/ */
public static final int BANK_CAPACITY = 352; public static final int BANK_CAPACITY = 352;
/**
* The capacity of the inventory.
*/
public static final int INVENTORY_CAPACITY = 28;
/** /**
* The capacity of the equipment inventory. * The capacity of the equipment inventory.
*/ */
public static final int EQUIPMENT_CAPACITY = 14; public static final int EQUIPMENT_CAPACITY = 14;
/**
* The capacity of the inventory.
*/
public static final int INVENTORY_CAPACITY = 28;
/** /**
* Default private constructor to prevent instantiation. * Default private constructor to prevent instantiation.
*/ */
+5 -5
View File
@@ -9,16 +9,16 @@ import org.apollo.game.model.def.ItemDefinition;
*/ */
public final class Item { public final class Item {
/**
* The item's id.
*/
private final int id;
/** /**
* The amount of items in the stack. * The amount of items in the stack.
*/ */
private final int amount; private final int amount;
/**
* The item's id.
*/
private final int id;
/** /**
* Creates an item with an amount of {@code 1}. * Creates an item with an amount of {@code 1}.
* *
+5 -5
View File
@@ -17,6 +17,11 @@ public final class Position {
*/ */
public static final int MAX_DISTANCE = 15; public static final int MAX_DISTANCE = 15;
/**
* The height level.
*/
private final int height;
/** /**
* The x coordinate. * The x coordinate.
*/ */
@@ -27,11 +32,6 @@ public final class Position {
*/ */
private final int y; private final int y;
/**
* The height level.
*/
private final int height;
/** /**
* Creates a position at the default height. * Creates a position at the default height.
* *
+58 -58
View File
@@ -7,60 +7,35 @@ package org.apollo.game.model;
*/ */
public final class Skill { public final class Skill {
/**
* The agility id.
*/
public static final int AGILITY = 16;
/** /**
* The attack id. * The attack id.
*/ */
public static final int ATTACK = 0; public static final int ATTACK = 0;
/**
* The defence id.
*/
public static final int DEFENCE = 1;
/**
* The strength id.
*/
public static final int STRENGTH = 2;
/**
* The hitpoints id.
*/
public static final int HITPOINTS = 3;
/**
* The ranged id.
*/
public static final int RANGED = 4;
/**
* The prayer id.
*/
public static final int PRAYER = 5;
/**
* The magic id.
*/
public static final int MAGIC = 6;
/** /**
* The cooking id. * The cooking id.
*/ */
public static final int COOKING = 7; public static final int COOKING = 7;
/** /**
* The woodcutting id. * The crafting id.
*/ */
public static final int WOODCUTTING = 8; public static final int CRAFTING = 12;
/** /**
* The fletching id. * The defence id.
*/ */
public static final int FLETCHING = 9; public static final int DEFENCE = 1;
/** /**
* The fishing id. * The farming id.
*/ */
public static final int FISHING = 10; public static final int FARMING = 19;
/** /**
* The firemaking id. * The firemaking id.
@@ -68,19 +43,14 @@ public final class Skill {
public static final int FIREMAKING = 11; public static final int FIREMAKING = 11;
/** /**
* The crafting id. * The fishing id.
*/ */
public static final int CRAFTING = 12; public static final int FISHING = 10;
/** /**
* The smithing id. * The fletching id.
*/ */
public static final int SMITHING = 13; public static final int FLETCHING = 9;
/**
* The mining id.rivate
*/
public static final int MINING = 14;
/** /**
* The herblore id. * The herblore id.
@@ -88,24 +58,29 @@ public final class Skill {
public static final int HERBLORE = 15; public static final int HERBLORE = 15;
/** /**
* The agility id. * The hitpoints id.
*/ */
public static final int AGILITY = 16; public static final int HITPOINTS = 3;
/** /**
* The thieving id. * The magic id.
*/ */
public static final int THIEVING = 17; public static final int MAGIC = 6;
/** /**
* The slayer id. * The mining id.rivate
*/ */
public static final int SLAYER = 18; public static final int MINING = 14;
/** /**
* The farming id. * The prayer id.
*/ */
public static final int FARMING = 19; public static final int PRAYER = 5;
/**
* The ranged id.
*/
public static final int RANGED = 4;
/** /**
* The runecrafting id. * The runecrafting id.
@@ -119,6 +94,31 @@ public final class Skill {
"Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining",
"Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecraft" }; "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecraft" };
/**
* The slayer id.
*/
public static final int SLAYER = 18;
/**
* The smithing id.
*/
public static final int SMITHING = 13;
/**
* The strength id.
*/
public static final int STRENGTH = 2;
/**
* The thieving id.
*/
public static final int THIEVING = 17;
/**
* The woodcutting id.
*/
public static final int WOODCUTTING = 8;
/** /**
* Gets the name of a skill. * Gets the name of a skill.
* *
@@ -129,16 +129,16 @@ public final class Skill {
return SKILL_NAMES[id]; return SKILL_NAMES[id];
} }
/**
* The experience.
*/
private final double experience;
/** /**
* The current level. * The current level.
*/ */
private final int currentLevel; private final int currentLevel;
/**
* The experience.
*/
private final double experience;
/** /**
* The maximum level. * The maximum level.
*/ */
+10 -10
View File
@@ -12,16 +12,16 @@ import org.apollo.game.model.skill.SkillListener;
*/ */
public final class SkillSet { public final class SkillSet {
/**
* The number of skills.
*/
private static final int SKILL_COUNT = 21;
/** /**
* The maximum allowed experience. * The maximum allowed experience.
*/ */
public static final double MAXIMUM_EXP = 200000000; public static final double MAXIMUM_EXP = 200000000;
/**
* The number of skills.
*/
private static final int SKILL_COUNT = 21;
/** /**
* Gets the minimum experience required for the specified level. * Gets the minimum experience required for the specified level.
* *
@@ -60,6 +60,11 @@ public final class SkillSet {
return 99; return 99;
} }
/**
* A flag indicating if events are being fired.
*/
private boolean firingEvents = true;
/** /**
* A list of skill listeners. * A list of skill listeners.
*/ */
@@ -70,11 +75,6 @@ public final class SkillSet {
*/ */
private final Skill[] skills = new Skill[SKILL_COUNT]; private final Skill[] skills = new Skill[SKILL_COUNT];
/**
* A flag indicating if events are being fired.
*/
private boolean firingEvents = true;
/** /**
* Creates the skill set. * Creates the skill set.
*/ */
+5 -5
View File
@@ -7,16 +7,16 @@ package org.apollo.game.model;
*/ */
public final class SlottedItem { public final class SlottedItem {
/**
* The slot.
*/
private final int slot;
/** /**
* The item. * The item.
*/ */
private final Item item; private final Item item;
/**
* The slot.
*/
private final int slot;
/** /**
* Creates a new slotted item. * Creates a new slotted item.
* *
+10 -10
View File
@@ -18,16 +18,16 @@ public final class WalkingQueue {
*/ */
private static final class Point { private static final class Point {
/**
* The point's position.
*/
private final Position position;
/** /**
* The direction to walk to this point. * The direction to walk to this point.
*/ */
private final Direction direction; private final Direction direction;
/**
* The point's position.
*/
private final Position position;
/** /**
* Creates a point. * Creates a point.
* *
@@ -56,16 +56,16 @@ public final class WalkingQueue {
*/ */
private Character character; private Character character;
/**
* The queue of directions.
*/
private Deque<Point> points = new ArrayDeque<Point>();
/** /**
* The old queue of directions. * The old queue of directions.
*/ */
private Deque<Point> oldPoints = new ArrayDeque<Point>(); private Deque<Point> oldPoints = new ArrayDeque<Point>();
/**
* The queue of directions.
*/
private Deque<Point> points = new ArrayDeque<Point>();
/** /**
* Flag indicating if this queue (only) should be ran. * Flag indicating if this queue (only) should be ran.
*/ */
@@ -7,6 +7,11 @@ package org.apollo.game.model.inter.bank;
*/ */
public final class BankConstants { public final class BankConstants {
/**
* The bank inventory id.
*/
public static final int BANK_INVENTORY_ID = 5382;
/** /**
* The bank window id. * The bank window id.
*/ */
@@ -17,11 +22,6 @@ public final class BankConstants {
*/ */
public static final int SIDEBAR_ID = 2005; public static final int SIDEBAR_ID = 2005;
/**
* The bank inventory id.
*/
public static final int BANK_INVENTORY_ID = 5382;
/** /**
* The sidebar inventory id. * The sidebar inventory id.
*/ */
@@ -10,6 +10,11 @@ import org.apollo.game.model.inter.EnterAmountListener;
*/ */
public final class BankDepositEnterAmountListener implements EnterAmountListener { public final class BankDepositEnterAmountListener implements EnterAmountListener {
/**
* The item id.
*/
private final int id;
/** /**
* The player. * The player.
*/ */
@@ -20,11 +25,6 @@ public final class BankDepositEnterAmountListener implements EnterAmountListener
*/ */
private final int slot; private final int slot;
/**
* The item id.
*/
private final int id;
/** /**
* Creates the bank deposit amount listener. * Creates the bank deposit amount listener.
* *
@@ -12,9 +12,9 @@ import org.apollo.game.model.inv.InventoryListener;
public final class BankInterfaceListener implements InterfaceListener { public final class BankInterfaceListener implements InterfaceListener {
/** /**
* The player. * The bank listener.
*/ */
private final Player player; private final InventoryListener bankListener;
/** /**
* The inventory listener. * The inventory listener.
@@ -22,9 +22,9 @@ public final class BankInterfaceListener implements InterfaceListener {
private final InventoryListener invListener; private final InventoryListener invListener;
/** /**
* The bank listener. * The player.
*/ */
private final InventoryListener bankListener; private final Player player;
/** /**
* Creates the bank interface listener. * Creates the bank interface listener.
@@ -10,6 +10,11 @@ import org.apollo.game.model.inter.EnterAmountListener;
*/ */
public final class BankWithdrawEnterAmountListener implements EnterAmountListener { public final class BankWithdrawEnterAmountListener implements EnterAmountListener {
/**
* The item id.
*/
private final int id;
/** /**
* The player. * The player.
*/ */
@@ -20,11 +25,6 @@ public final class BankWithdrawEnterAmountListener implements EnterAmountListene
*/ */
private final int slot; private final int slot;
/**
* The item id.
*/
private final int id;
/** /**
* Creates the bank withdraw amount listener. * Creates the bank withdraw amount listener.
* *
@@ -12,11 +12,6 @@ import org.apollo.game.model.Player;
*/ */
public final class FullInventoryListener extends InventoryAdapter { public final class FullInventoryListener extends InventoryAdapter {
/**
* The inventory full message.
*/
public static final String FULL_INVENTORY_MESSAGE = "Not enough inventory space.";
/** /**
* The bank full message. * The bank full message.
*/ */
@@ -28,15 +23,20 @@ public final class FullInventoryListener extends InventoryAdapter {
public static final String FULL_EQUIPMENT_MESSAGE = "Not enough equipment space."; // TODO confirm if possible public static final String FULL_EQUIPMENT_MESSAGE = "Not enough equipment space."; // TODO confirm if possible
/** /**
* The player. * The inventory full message.
*/ */
private final Player player; public static final String FULL_INVENTORY_MESSAGE = "Not enough inventory space.";
/** /**
* The event to send when the capacity has been exceeded. * The event to send when the capacity has been exceeded.
*/ */
private final Event event; private final Event event;
/**
* The player.
*/
private final Player player;
/** /**
* Creates the empty inventory listener. * Creates the empty inventory listener.
* *
@@ -14,26 +14,26 @@ import org.apollo.game.model.SlottedItem;
*/ */
public final class SynchronizationInventoryListener extends InventoryAdapter { public final class SynchronizationInventoryListener extends InventoryAdapter {
/**
* The inventory interface id.
*/
public static final int INVENTORY_ID = 3214;
/** /**
* The equipment interface id. * The equipment interface id.
*/ */
public static final int EQUIPMENT_ID = 1688; public static final int EQUIPMENT_ID = 1688;
/** /**
* The player. * The inventory interface id.
*/ */
private final Player player; public static final int INVENTORY_ID = 3214;
/** /**
* The interface id. * The interface id.
*/ */
private final int interfaceId; private final int interfaceId;
/**
* The player.
*/
private final Player player;
/** /**
* Creates the syncrhonization inventory listener. * Creates the syncrhonization inventory listener.
* *
+10 -10
View File
@@ -18,31 +18,31 @@ public final class StaticObject {
public static void init(StaticObject[] objects) { public static void init(StaticObject[] objects) {
} }
/**
* The object's id.
*/
private final short id;
/** /**
* The object's definition. * The object's definition.
*/ */
private final ObjectDefinition definition; private final ObjectDefinition definition;
/**
* The object's id.
*/
private final short id;
/** /**
* The object's position. * The object's position.
*/ */
private final Position position; private final Position position;
/**
* The object type.
*/
private final byte type;
/** /**
* The object's rotation. * The object's rotation.
*/ */
private final byte rotation; private final byte rotation;
/**
* The object type.
*/
private final byte type;
/** /**
* Creates a new static object. * Creates a new static object.
* *
@@ -7,11 +7,6 @@ package org.apollo.game.scheduling;
*/ */
public abstract class ScheduledTask { public abstract class ScheduledTask {
/**
* A flag indicating if the task is running.
*/
private boolean running = true;
/** /**
* The delay between executions of the task, in pulses. * The delay between executions of the task, in pulses.
*/ */
@@ -22,6 +17,11 @@ public abstract class ScheduledTask {
*/ */
private int pulses; private int pulses;
/**
* A flag indicating if the task is running.
*/
private boolean running = true;
/** /**
* Creates a new scheduled task. * Creates a new scheduled task.
* *
@@ -10,11 +10,6 @@ import org.apollo.game.model.Inventory;
*/ */
public final class AppearanceBlock extends SynchronizationBlock { public final class AppearanceBlock extends SynchronizationBlock {
/**
* The player's name.
*/
private final long name;
/** /**
* The player's appearance. * The player's appearance.
*/ */
@@ -25,31 +20,36 @@ public final class AppearanceBlock extends SynchronizationBlock {
*/ */
private final int combat; private final int combat;
/**
* The player's total skill level (or 0).
*/
private final int skill;
/** /**
* The player's equipment. * The player's equipment.
*/ */
private final Inventory equipment; private final Inventory equipment;
/**
* The player's prayer icon.
*/
private final int prayerIcon;
/** /**
* The player's head icon. * The player's head icon.
*/ */
private final int headIcon; private final int headIcon;
/**
* The player's name.
*/
private final long name;
/** /**
* The npc id this player is appearing as, if any. * The npc id this player is appearing as, if any.
*/ */
private final int npcId; private final int npcId;
/**
* The player's prayer icon.
*/
private final int prayerIcon;
/**
* The player's total skill level (or 0).
*/
private final int skill;
/** /**
* Creates the appearance block. * Creates the appearance block.
* *
@@ -10,16 +10,16 @@ import org.apollo.game.model.Player.PrivilegeLevel;
*/ */
public final class ChatBlock extends SynchronizationBlock { public final class ChatBlock extends SynchronizationBlock {
/**
* The privilege level.
*/
private final PrivilegeLevel privilegeLevel;
/** /**
* The chat event. * The chat event.
*/ */
private final ChatEvent chatEvent; private final ChatEvent chatEvent;
/**
* The privilege level.
*/
private final PrivilegeLevel privilegeLevel;
/** /**
* Creates the chat block. * Creates the chat block.
*/ */
@@ -15,15 +15,20 @@ import org.apollo.game.model.Position;
public class ForceMovementBlock extends SynchronizationBlock { public class ForceMovementBlock extends SynchronizationBlock {
/** /**
* The initial {@link Position} of the player. * The direction the player is moving.
*/ */
private final Position initialPosition; private final Direction direction;
/** /**
* The {@link Position} the player is being moved to. * The {@link Position} the player is being moved to.
*/ */
private final Position finalPosition; private final Position finalPosition;
/**
* The initial {@link Position} of the player.
*/
private final Position initialPosition;
/** /**
* The length of time (in game ticks) the player's movement along the X axis will last. * The length of time (in game ticks) the player's movement along the X axis will last.
*/ */
@@ -34,11 +39,6 @@ public class ForceMovementBlock extends SynchronizationBlock {
*/ */
private final int travelDurationY; private final int travelDurationY;
/**
* The direction the player is moving.
*/
private final Direction direction;
/** /**
* Creates a new Force Movement block. * Creates a new Force Movement block.
* *
@@ -8,26 +8,26 @@ package org.apollo.game.sync.block;
*/ */
public class HitUpdateBlock extends SynchronizationBlock { public class HitUpdateBlock extends SynchronizationBlock {
/**
* The amount of damage the hit will do.
*/
private final int damage;
/**
* The type of hit (e.g. normal, poison).
*/
private final int type;
/** /**
* The {@link org.apollo.game.model.Character}'s current health. * The {@link org.apollo.game.model.Character}'s current health.
*/ */
private final int currentHealth; private final int currentHealth;
/**
* The amount of damage the hit will do.
*/
private final int damage;
/** /**
* The {@link org.apollo.game.model.Character}'s maximum health. * The {@link org.apollo.game.model.Character}'s maximum health.
*/ */
private final int maximumHealth; private final int maximumHealth;
/**
* The type of hit (e.g. normal, poison).
*/
private final int type;
/** /**
* Creates a new Hit Update block. * Creates a new Hit Update block.
* *
@@ -9,26 +9,26 @@ package org.apollo.game.sync.block;
*/ */
public class SecondHitUpdateBlock extends SynchronizationBlock { public class SecondHitUpdateBlock extends SynchronizationBlock {
/**
* The amount of damage the hit will do.
*/
private final int damage;
/**
* The type of hit (e.g. normal, poison).
*/
private final int type;
/** /**
* The character's current health. * The character's current health.
*/ */
private final int currentHealth; private final int currentHealth;
/**
* The amount of damage the hit will do.
*/
private final int damage;
/** /**
* The character's maximum health. * The character's maximum health.
*/ */
private final int maximumHealth; private final int maximumHealth;
/**
* The type of hit (e.g. normal, poison).
*/
private final int type;
/** /**
* Creates a new Second Hit Update block. * Creates a new Second Hit Update block.
* *
@@ -15,16 +15,16 @@ public final class AddNpcSegment extends SynchronizationSegment {
*/ */
private final int index; private final int index;
/**
* The position.
*/
private final Position position;
/** /**
* The id of the npc. * The id of the npc.
*/ */
private final int npcId; private final int npcId;
/**
* The position.
*/
private final Position position;
/** /**
* Creates the add npc segment. * Creates the add npc segment.
* *
@@ -7,15 +7,20 @@ package org.apollo.game.sync.seg;
*/ */
public enum SegmentType { public enum SegmentType {
/**
* A segment where the character is added.
*/
ADD_CHARACTER,
/** /**
* A segment without any movement. * A segment without any movement.
*/ */
NO_MOVEMENT, NO_MOVEMENT,
/** /**
* A segment with movement in a single direction. * A segment where the character is removed.
*/ */
WALK, REMOVE_CHARACTER,
/** /**
* A segment with movement in two directions. * A segment with movement in two directions.
@@ -28,13 +33,8 @@ public enum SegmentType {
TELEPORT, TELEPORT,
/** /**
* A segment where the character is added. * A segment with movement in a single direction.
*/ */
ADD_CHARACTER, WALK;
/**
* A segment where the character is removed.
*/
REMOVE_CHARACTER;
} }
@@ -22,16 +22,16 @@ import org.xml.sax.SAXException;
*/ */
public final class EventHandlerChainParser { public final class EventHandlerChainParser {
/**
* The {@link XmlParser} instance.
*/
private final XmlParser parser;
/** /**
* The source {@link InputStream}. * The source {@link InputStream}.
*/ */
private final InputStream is; private final InputStream is;
/**
* The {@link XmlParser} instance.
*/
private final XmlParser parser;
/** /**
* Creates the event chain parser. * Creates the event chain parser.
* *
+5 -5
View File
@@ -20,16 +20,16 @@ public final class PluginMetaDataParser {
*/ */
private static final XmlNode[] EMPTY_NODE_ARRAY = new XmlNode[0]; private static final XmlNode[] EMPTY_NODE_ARRAY = new XmlNode[0];
/**
* The XML parser.
*/
private final XmlParser parser;
/** /**
* The input stream. * The input stream.
*/ */
private final InputStream is; private final InputStream is;
/**
* The XML parser.
*/
private final XmlParser parser;
/** /**
* Creates the plugin meta data parser. * Creates the plugin meta data parser.
* *
@@ -10,16 +10,16 @@ import org.apollo.net.codec.login.LoginConstants;
*/ */
public final class PlayerLoaderResponse { public final class PlayerLoaderResponse {
/**
* The status code.
*/
private final int status;
/** /**
* The player. * The player.
*/ */
private final Player player; private final Player player;
/**
* The status code.
*/
private final int status;
/** /**
* Creates a {@link PlayerLoaderResponse} with only a status code. * Creates a {@link PlayerLoaderResponse} with only a status code.
* *
+5 -5
View File
@@ -26,16 +26,16 @@ public final class PlayerLoaderWorker implements Runnable {
*/ */
private final PlayerLoader loader; private final PlayerLoader loader;
/**
* The session that submitted the request.
*/
private final LoginSession session;
/** /**
* The request. * The request.
*/ */
private final LoginRequest request; private final LoginRequest request;
/**
* The session that submitted the request.
*/
private final LoginSession session;
/** /**
* Creates a {@link PlayerLoaderWorker} which will do the work for a single player load request. * Creates a {@link PlayerLoaderWorker} which will do the work for a single player load request.
* *
+5 -5
View File
@@ -19,6 +19,11 @@ public final class PlayerSaverWorker implements Runnable {
*/ */
private static final Logger logger = Logger.getLogger(PlayerSaverWorker.class.getName()); private static final Logger logger = Logger.getLogger(PlayerSaverWorker.class.getName());
/**
* The player to save.
*/
private final Player player;
/** /**
* The player saver. * The player saver.
*/ */
@@ -29,11 +34,6 @@ public final class PlayerSaverWorker implements Runnable {
*/ */
private final GameSession session; private final GameSession session;
/**
* The player to save.
*/
private final Player player;
/** /**
* Creates the player saver worker. * Creates the player saver worker.
* *
@@ -22,9 +22,9 @@ import org.jboss.netty.util.Timer;
public final class JagGrabPipelineFactory implements ChannelPipelineFactory { public final class JagGrabPipelineFactory implements ChannelPipelineFactory {
/** /**
* The maximum length of a request, in bytes. * A buffer with two line feed (LF) characters in it.
*/ */
private static final int MAX_REQUEST_LENGTH = 8192; private static final ChannelBuffer DOUBLE_LINE_FEED_DELIMITER = ChannelBuffers.buffer(2);
/** /**
* The character set used in the request. * The character set used in the request.
@@ -32,9 +32,9 @@ public final class JagGrabPipelineFactory implements ChannelPipelineFactory {
private static final Charset JAGGRAB_CHARSET = Charset.forName("US-ASCII"); private static final Charset JAGGRAB_CHARSET = Charset.forName("US-ASCII");
/** /**
* A buffer with two line feed (LF) characters in it. * The maximum length of a request, in bytes.
*/ */
private static final ChannelBuffer DOUBLE_LINE_FEED_DELIMITER = ChannelBuffers.buffer(2); private static final int MAX_REQUEST_LENGTH = 8192;
/** /**
* Populates the double line feed buffer. * Populates the double line feed buffer.
+9 -9
View File
@@ -8,9 +8,14 @@ package org.apollo.net;
public final class NetworkConstants { public final class NetworkConstants {
/** /**
* The service port. * The HTTP port.
*/ */
public static final int SERVICE_PORT = 43594; public static final int HTTP_PORT = 80;
/**
* The number of seconds before a connection becomes idle.
*/
public static final int IDLE_TIME = 15;
/** /**
* The JAGGRAB port. * The JAGGRAB port.
@@ -18,20 +23,15 @@ public final class NetworkConstants {
public static final int JAGGRAB_PORT = 43595; public static final int JAGGRAB_PORT = 43595;
/** /**
* The HTTP port. * The service port.
*/ */
public static final int HTTP_PORT = 80; public static final int SERVICE_PORT = 43594;
/** /**
* The terminator of a string. * The terminator of a string.
*/ */
public static final int STRING_TERMINATOR = 10; public static final int STRING_TERMINATOR = 10;
/**
* The number of seconds before a connection becomes idle.
*/
public static final int IDLE_TIME = 15;
/** /**
* Default private constructor to prevent instantiation by other classes. * Default private constructor to prevent instantiation by other classes.
*/ */
@@ -7,14 +7,14 @@ package org.apollo.net.codec.game;
*/ */
public enum AccessMode { public enum AccessMode {
/**
* When in byte access modes, bytes are written directly to the buffer.
*/
BYTE_ACCESS,
/** /**
* When in bit access mode, bits can be written and packed into bytes. * When in bit access mode, bits can be written and packed into bytes.
*/ */
BIT_ACCESS; BIT_ACCESS,
/**
* When in byte access modes, bytes are written directly to the buffer.
*/
BYTE_ACCESS;
} }
+9 -9
View File
@@ -8,14 +8,9 @@ package org.apollo.net.codec.game;
public enum DataOrder { public enum DataOrder {
/** /**
* Least significant byte to most significant byte. * Most significant byte to least significant byte.
*/ */
LITTLE, BIG,
/**
* Also known as the V1 order.
*/
MIDDLE,
/** /**
* Also known as the V2 order. * Also known as the V2 order.
@@ -23,8 +18,13 @@ public enum DataOrder {
INVERSED_MIDDLE, INVERSED_MIDDLE,
/** /**
* Most significant byte to least significant byte. * Least significant byte to most significant byte.
*/ */
BIG; LITTLE,
/**
* Also known as the V1 order.
*/
MIDDLE;
} }
@@ -7,11 +7,6 @@ package org.apollo.net.codec.game;
*/ */
public enum DataTransformation { public enum DataTransformation {
/**
* No transformation is done.
*/
NONE,
/** /**
* Adds 128 to the value when it is written, takes 128 from the value when it is read (also known as type-A). * Adds 128 to the value when it is written, takes 128 from the value when it is read (also known as type-A).
*/ */
@@ -22,6 +17,11 @@ public enum DataTransformation {
*/ */
NEGATE, NEGATE,
/**
* No transformation is done.
*/
NONE,
/** /**
* Subtracts the value from 128 (also known as type-S). * Subtracts the value from 128 (also known as type-S).
*/ */
+11 -11
View File
@@ -12,16 +12,6 @@ public enum DataType {
*/ */
BYTE(1), BYTE(1),
/**
* A short.
*/
SHORT(2),
/**
* A 'tri byte' - a group of three bytes.
*/
TRI_BYTE(3),
/** /**
* An integer. * An integer.
*/ */
@@ -30,7 +20,17 @@ public enum DataType {
/** /**
* A long. * A long.
*/ */
LONG(8); LONG(8),
/**
* A short.
*/
SHORT(2),
/**
* A 'tri byte' - a group of three bytes.
*/
TRI_BYTE(3);
/** /**
* The number of bytes this type occupies. * The number of bytes this type occupies.
@@ -7,18 +7,18 @@ package org.apollo.net.codec.game;
*/ */
public enum GameDecoderState { public enum GameDecoderState {
/**
* The game opcode state waits for an encrypted opcode. It decrypts it, and will either set the next state to the
* length (if the packet is variably- sized) or the payload (if it is not variably-sized) state.
*/
GAME_OPCODE,
/** /**
* The game length state waits for the packet length. Once it has been received, it sets the state to the payload * The game length state waits for the packet length. Once it has been received, it sets the state to the payload
* state. * state.
*/ */
GAME_LENGTH, GAME_LENGTH,
/**
* The game opcode state waits for an encrypted opcode. It decrypts it, and will either set the next state to the
* length (if the packet is variably- sized) or the payload (if it is not variably-sized) state.
*/
GAME_OPCODE,
/** /**
* The payload state will wait for the whole packet to be received. Then, it will pass a {@link GamePacket} object * The payload state will wait for the whole packet to be received. Then, it will pass a {@link GamePacket} object
* to Netty and reset the state back to the game opcode state, ready for the next packet. * to Netty and reset the state back to the game opcode state, ready for the next packet.
+10 -10
View File
@@ -10,26 +10,26 @@ import org.jboss.netty.buffer.ChannelBuffer;
*/ */
public final class GamePacket { public final class GamePacket {
/**
* The opcode.
*/
private final int opcode;
/**
* The packet type.
*/
private final PacketType type;
/** /**
* The length. * The length.
*/ */
private final int length; private final int length;
/**
* The opcode.
*/
private final int opcode;
/** /**
* The payload. * The payload.
*/ */
private final ChannelBuffer payload; private final ChannelBuffer payload;
/**
* The packet type.
*/
private final PacketType type;
/** /**
* Creates the game packet. * Creates the game packet.
* *
@@ -13,14 +13,9 @@ import org.jboss.netty.buffer.ChannelBuffers;
public final class GamePacketBuilder { public final class GamePacketBuilder {
/** /**
* The opcode. * The current bit index.
*/ */
private final int opcode; private int bitIndex;
/**
* The {@link PacketType}.
*/
private final PacketType type;
/** /**
* The buffer. * The buffer.
@@ -33,9 +28,14 @@ public final class GamePacketBuilder {
private AccessMode mode = AccessMode.BYTE_ACCESS; private AccessMode mode = AccessMode.BYTE_ACCESS;
/** /**
* The current bit index. * The opcode.
*/ */
private int bitIndex; private final int opcode;
/**
* The {@link PacketType}.
*/
private final PacketType type;
/** /**
* Creates a raw {@link GamePacketBuilder}. * Creates a raw {@link GamePacketBuilder}.
@@ -19,30 +19,30 @@ import org.jboss.netty.channel.ChannelHandlerContext;
public final class GamePacketDecoder extends StatefulFrameDecoder<GameDecoderState> { public final class GamePacketDecoder extends StatefulFrameDecoder<GameDecoderState> {
/** /**
* The current release. * The current length.
*/ */
private final Release release; private int length;
/**
* The random number generator.
*/
private final IsaacRandom random;
/** /**
* The current opcode. * The current opcode.
*/ */
private int opcode; private int opcode;
/**
* The random number generator.
*/
private final IsaacRandom random;
/**
* The current release.
*/
private final Release release;
/** /**
* The packet type. * The packet type.
*/ */
private PacketType type; private PacketType type;
/**
* The current length.
*/
private int length;
/** /**
* Creates the {@link GamePacketDecoder}. * Creates the {@link GamePacketDecoder}.
* *
@@ -10,6 +10,11 @@ import org.jboss.netty.buffer.ChannelBuffer;
*/ */
public final class GamePacketReader { public final class GamePacketReader {
/**
* The current bit index.
*/
private int bitIndex;
/** /**
* The buffer. * The buffer.
*/ */
@@ -20,11 +25,6 @@ public final class GamePacketReader {
*/ */
private AccessMode mode = AccessMode.BYTE_ACCESS; private AccessMode mode = AccessMode.BYTE_ACCESS;
/**
* The current bit index.
*/
private int bitIndex;
/** /**
* Creates the reader. * Creates the reader.
* *
@@ -7,36 +7,6 @@ package org.apollo.net.codec.login;
*/ */
public final class LoginConstants { public final class LoginConstants {
/**
* Standard login type id.
*/
public static final int TYPE_STANDARD = 16;
/**
* Reconnection login type id.
*/
public static final int TYPE_RECONNECTION = 18;
/**
* 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.
*/ */
@@ -47,31 +17,51 @@ 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;
/** /**
* Server full login status. * Standing in members area on free world status.
*/ */
public static final int STATUS_SERVER_FULL = 7; public static final int STATUS_IN_MEMBERS_AREA = 17;
/**
* 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.
*/ */
@@ -83,39 +73,49 @@ public final class LoginConstants {
public static final int STATUS_MEMBERS_ACCOUNT_REQUIRED = 12; public static final int STATUS_MEMBERS_ACCOUNT_REQUIRED = 12;
/** /**
* Could not complete login status. * OK login status.
*/ */
public static final int STATUS_COULD_NOT_COMPLETE = 13; public static final int STATUS_OK = 2;
/** /**
* Server updating login status. * Profile transfer login status.
*/ */
public static final int STATUS_UPDATING = 14; public static final int STATUS_PROFILE_TRANSFER = 21;
/** /**
* Reconnection OK login status. * Reconnection OK login status.
*/ */
public static final int STATUS_RECONNECTION_OK = 15; 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. * Too many login attempts login status.
*/ */
public static final int STATUS_TOO_MANY_LOGINS = 16; public static final int STATUS_TOO_MANY_LOGINS = 16;
/** /**
* Standing in members area on free world status. * Server updating login status.
*/ */
public static final int STATUS_IN_MEMBERS_AREA = 17; public static final int STATUS_UPDATING = 14;
/** /**
* Invalid login server status. * Reconnection login type id.
*/ */
public static final int STATUS_INVALID_LOGIN_SERVER = 20; public static final int TYPE_RECONNECTION = 18;
/** /**
* Profile transfer login status. * Standard login type id.
*/ */
public static final int STATUS_PROFILE_TRANSFER = 21; public static final int TYPE_STANDARD = 16;
/** /**
* Default private constructor to prevent instantiation. * Default private constructor to prevent instantiation.
@@ -27,14 +27,9 @@ public final class LoginDecoder extends StatefulFrameDecoder<LoginDecoderState>
private static final SecureRandom random = new SecureRandom(); private static final SecureRandom random = new SecureRandom();
/** /**
* The username hash. * The login packet length.
*/ */
private int usernameHash; private int loginLength;
/**
* The server-side session key.
*/
private long serverSeed;
/** /**
* The reconnecting flag. * The reconnecting flag.
@@ -42,9 +37,14 @@ public final class LoginDecoder extends StatefulFrameDecoder<LoginDecoderState>
private boolean reconnecting; private boolean reconnecting;
/** /**
* The login packet length. * The server-side session key.
*/ */
private int loginLength; private long serverSeed;
/**
* The username hash.
*/
private int usernameHash;
/** /**
* Creates the login decoder with the default initial state. * Creates the login decoder with the default initial state.
@@ -10,21 +10,26 @@ import org.apollo.security.PlayerCredentials;
*/ */
public final class LoginRequest { public final class LoginRequest {
/**
* The archive CRCs.
*/
private final int[] archiveCrcs;
/** /**
* The player's credentials. * The player's credentials.
*/ */
private final PlayerCredentials credentials; private final PlayerCredentials credentials;
/**
* The pair of random number generators.
*/
private final IsaacRandomPair randomPair;
/** /**
* The low memory flag. * The low memory flag.
*/ */
private final boolean lowMemory; private final boolean lowMemory;
/**
* The pair of random number generators.
*/
private final IsaacRandomPair randomPair;
/** /**
* The reconnecting flag. * The reconnecting flag.
*/ */
@@ -35,11 +40,6 @@ public final class LoginRequest {
*/ */
private final int releaseNumber; private final int releaseNumber;
/**
* The archive CRCs.
*/
private final int[] archiveCrcs;
/** /**
* Creates a login request. * Creates a login request.
* *
@@ -7,11 +7,6 @@ package org.apollo.net.codec.login;
*/ */
public final class LoginResponse { public final class LoginResponse {
/**
* The login status.
*/
private final int status;
/** /**
* The flagged flag. * The flagged flag.
*/ */
@@ -22,6 +17,11 @@ public final class LoginResponse {
*/ */
private final int rights; private final int rights;
/**
* The login status.
*/
private final int status;
/** /**
* Creates the login response. * Creates the login response.
* *
@@ -21,16 +21,16 @@ public final class OnDemandRequest implements Comparable<OnDemandRequest> {
*/ */
HIGH(0), HIGH(0),
/**
* Medium priority - used while loading the 'bare minimum' required to run the game.
*/
MEDIUM(1),
/** /**
* Low priority - used when a file is not required urgently. The client login screen says * Low priority - used when a file is not required urgently. The client login screen says
* "loading extra files.." when low priority loading is being performed. * "loading extra files.." when low priority loading is being performed.
*/ */
LOW(2); LOW(2),
/**
* Medium priority - used while loading the 'bare minimum' required to run the game.
*/
MEDIUM(1);
/** /**
* Converts the integer value to a priority. * Converts the integer value to a priority.
@@ -10,6 +10,16 @@ import org.jboss.netty.buffer.ChannelBuffer;
*/ */
public final class OnDemandResponse { public final class OnDemandResponse {
/**
* The chunk data.
*/
private final ChannelBuffer chunkData;
/**
* The chunk id.
*/
private final int chunkId;
/** /**
* The file descriptor. * The file descriptor.
*/ */
@@ -20,16 +30,6 @@ public final class OnDemandResponse {
*/ */
private final int fileSize; private final int fileSize;
/**
* The chunk id.
*/
private final int chunkId;
/**
* The chunk data.
*/
private final ChannelBuffer chunkData;
/** /**
* Creates the 'on-demand' response. * Creates the 'on-demand' response.
* *
+5 -5
View File
@@ -39,16 +39,16 @@ public final class PacketMetaData {
return new PacketMetaData(PacketType.VARIABLE_SHORT, 0); return new PacketMetaData(PacketType.VARIABLE_SHORT, 0);
} }
/**
* The type of packet.
*/
private final PacketType type;
/** /**
* The length of this packet. * The length of this packet.
*/ */
private final int length; private final int length;
/**
* The type of packet.
*/
private final PacketType type;
/** /**
* Creates the packet meta data object. This should not be called directy. Use the {@link #createFixed(int)}, * Creates the packet meta data object. This should not be called directy. Use the {@link #createFixed(int)},
* {@link #createVariableByte()} and {@link #createVariableShort()} methods instead! * {@link #createVariableByte()} and {@link #createVariableShort()} methods instead!
+5 -5
View File
@@ -7,16 +7,16 @@ package org.apollo.net.meta;
*/ */
public enum PacketType { public enum PacketType {
/**
* A packet with no header.
*/
RAW,
/** /**
* A packet where the length is known by both the client and server already. * A packet where the length is known by both the client and server already.
*/ */
FIXED, FIXED,
/**
* A packet with no header.
*/
RAW,
/** /**
* A packet where the length is sent to its destination with it as a byte. * A packet where the length is sent to its destination with it as a byte.
*/ */
+5 -5
View File
@@ -14,11 +14,6 @@ import org.apollo.net.meta.PacketMetaDataGroup;
*/ */
public abstract class Release { public abstract class Release {
/**
* The release number, e.g. {@code 317}.
*/
private final int releaseNumber;
/** /**
* The decoders. * The decoders.
*/ */
@@ -34,6 +29,11 @@ public abstract class Release {
*/ */
private final PacketMetaDataGroup incomingPacketMetaData; private final PacketMetaDataGroup incomingPacketMetaData;
/**
* The release number, e.g. {@code 317}.
*/
private final int releaseNumber;
/** /**
* Creates the release. * Creates the release.
* *
@@ -9,6 +9,7 @@ import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link FifthItemOptionEvent}. * An {@link EventDecoder} for the {@link FifthItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class FifthItemOptionEventDecoder extends EventDecoder<FifthItemOptionEvent> { final class FifthItemOptionEventDecoder extends EventDecoder<FifthItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r317; package org.apollo.net.release.r317;
import org.apollo.game.event.impl.FirstItemOptionEvent; import org.apollo.game.event.impl.FirstItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link FirstItemOptionEvent}. * An {@link EventDecoder} for the {@link FirstItemOptionEvent}.
*
* @author Graham * @author Graham
*/ */
final class FirstItemOptionEventDecoder extends EventDecoder<FirstItemOptionEvent> { final class FirstItemOptionEventDecoder extends EventDecoder<FirstItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r317; package org.apollo.net.release.r317;
import org.apollo.game.event.impl.FourthItemOptionEvent; import org.apollo.game.event.impl.FourthItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link FourthItemOptionEvent}. * An {@link EventDecoder} for the {@link FourthItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class FourthItemOptionEventDecoder extends EventDecoder<FourthItemOptionEvent> { final class FourthItemOptionEventDecoder extends EventDecoder<FourthItemOptionEvent> {
@@ -9,6 +9,7 @@ import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link SecondItemOptionEvent}. * An {@link EventDecoder} for the {@link SecondItemOptionEvent}.
*
* @author Graham * @author Graham
*/ */
final class SecondItemOptionEventDecoder extends EventDecoder<SecondItemOptionEvent> { final class SecondItemOptionEventDecoder extends EventDecoder<SecondItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r317; package org.apollo.net.release.r317;
import org.apollo.game.event.impl.ThirdItemOptionEvent; import org.apollo.game.event.impl.ThirdItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link ThirdItemOptionEvent}. * An {@link EventDecoder} for the {@link ThirdItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class ThirdItemOptionEventDecoder extends EventDecoder<ThirdItemOptionEvent> { final class ThirdItemOptionEventDecoder extends EventDecoder<ThirdItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r377; package org.apollo.net.release.r377;
import org.apollo.game.event.impl.FifthItemOptionEvent; import org.apollo.game.event.impl.FifthItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link FifthItemOptionEvent}. * An {@link EventDecoder} for the {@link FifthItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class FifthItemOptionEventDecoder extends EventDecoder<FifthItemOptionEvent> { final class FifthItemOptionEventDecoder extends EventDecoder<FifthItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r377; package org.apollo.net.release.r377;
import org.apollo.game.event.impl.FirstItemOptionEvent; import org.apollo.game.event.impl.FirstItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link FirstItemOptionEvent}. * An {@link EventDecoder} for the {@link FirstItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class FirstItemOptionEventDecoder extends EventDecoder<FirstItemOptionEvent> { final class FirstItemOptionEventDecoder extends EventDecoder<FirstItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r377; package org.apollo.net.release.r377;
import org.apollo.game.event.impl.FourthItemOptionEvent; import org.apollo.game.event.impl.FourthItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link FourthItemOptionEvent}. * An {@link EventDecoder} for the {@link FourthItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class FourthItemOptionEventDecoder extends EventDecoder<FourthItemOptionEvent> { final class FourthItemOptionEventDecoder extends EventDecoder<FourthItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r377; package org.apollo.net.release.r377;
import org.apollo.game.event.impl.SecondItemOptionEvent; import org.apollo.game.event.impl.SecondItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link SecondItemOptionEvent}. * An {@link EventDecoder} for the {@link SecondItemOptionEvent}.
*
* @author Graham * @author Graham
*/ */
final class SecondItemOptionEventDecoder extends EventDecoder<SecondItemOptionEvent> { final class SecondItemOptionEventDecoder extends EventDecoder<SecondItemOptionEvent> {
@@ -1,11 +1,16 @@
package org.apollo.net.release.r377; package org.apollo.net.release.r377;
import org.apollo.game.event.impl.ThirdItemOptionEvent; import org.apollo.game.event.impl.ThirdItemOptionEvent;
import org.apollo.net.codec.game.*; import org.apollo.net.codec.game.DataOrder;
import org.apollo.net.codec.game.DataTransformation;
import org.apollo.net.codec.game.DataType;
import org.apollo.net.codec.game.GamePacket;
import org.apollo.net.codec.game.GamePacketReader;
import org.apollo.net.release.EventDecoder; import org.apollo.net.release.EventDecoder;
/** /**
* An {@link EventDecoder} for the {@link ThirdItemOptionEvent}. * An {@link EventDecoder} for the {@link ThirdItemOptionEvent}.
*
* @author Chris Fletcher * @author Chris Fletcher
*/ */
final class ThirdItemOptionEventDecoder extends EventDecoder<ThirdItemOptionEvent> { final class ThirdItemOptionEventDecoder extends EventDecoder<ThirdItemOptionEvent> {
+5 -5
View File
@@ -10,16 +10,16 @@ import net.burtleburtle.bob.rand.IsaacRandom;
*/ */
public final class IsaacRandomPair { public final class IsaacRandomPair {
/**
* The random number generator used to encode data.
*/
private final IsaacRandom encodingRandom;
/** /**
* The random number generator used to decode data. * The random number generator used to decode data.
*/ */
private final IsaacRandom decodingRandom; private final IsaacRandom decodingRandom;
/**
* The random number generator used to encode data.
*/
private final IsaacRandom encodingRandom;
/** /**
* Creates the pair of random number generators. * Creates the pair of random number generators.
* *
+10 -10
View File
@@ -9,11 +9,6 @@ import org.apollo.util.NameUtil;
*/ */
public final class PlayerCredentials { public final class PlayerCredentials {
/**
* The player's username.
*/
private final String username;
/** /**
* The player's username encoded as a long. * The player's username encoded as a long.
*/ */
@@ -24,16 +19,21 @@ public final class PlayerCredentials {
*/ */
private final String password; private final String password;
/**
* The hash of the player's username.
*/
private final int usernameHash;
/** /**
* The computer's unique identifier. * The computer's unique identifier.
*/ */
private final int uid; private final int uid;
/**
* The player's username.
*/
private final String username;
/**
* The hash of the player's username.
*/
private final int usernameHash;
/** /**
* Creates a new {@link PlayerCredentials} object with the specified name, password and uid. * Creates a new {@link PlayerCredentials} object with the specified name, password and uid.
* *
+42 -42
View File
@@ -8,33 +8,6 @@ package org.apollo.tools;
*/ */
public final class EquipmentConstants { public final class EquipmentConstants {
/**
* Capes.
*/
public static final String[] CAPES = { "cape", "Cape" };
/**
* Hats.
*/
public static final String[] HATS = { "helm", "hood", "coif", "Coif", "hat", "partyhat", "Hat", "full helm (t)",
"full helm (g)", "hat (t)", "hat (g)", "cav", "boater", "helmet", "mask", "Helm of neitiznot" };
/**
* Boots.
*/
public static final String[] BOOTS = { "boots", "Boots" };
/**
* Gloves.
*/
public static final String[] GLOVES = { "gloves", "gauntlets", "Gloves", "vambraces", "vamb", "bracers" };
/**
* Shields.
*/
public static final String[] SHIELDS = { "kiteshield", "sq shield", "Toktz-ket", "books", "book", "kiteshield (t)",
"kiteshield (g)", "kiteshield(h)", "defender", "shield" };
/** /**
* Amulets. * Amulets.
*/ */
@@ -46,11 +19,6 @@ public final class EquipmentConstants {
public static final String[] ARROWS = { "arrow", "arrows", "arrow(p)", "arrow(+)", "arrow(s)", "bolt", "Bolt rack", public static final String[] ARROWS = { "arrow", "arrows", "arrow(p)", "arrow(+)", "arrow(s)", "bolt", "Bolt rack",
"Opal bolts", "Dragon bolts" }; "Opal bolts", "Dragon bolts" };
/**
* Rings.
*/
public static final String[] RINGS = { "ring", "Ring of" };
/** /**
* Bodies. * Bodies.
*/ */
@@ -59,20 +27,14 @@ public final class EquipmentConstants {
"torso", "shirt" }; "torso", "shirt" };
/** /**
* Legs. * Boots.
*/ */
public static final String[] LEGS = { "platelegs", "plateskirt", "skirt", "bottoms", "chaps", "platelegs (t)", public static final String[] BOOTS = { "boots", "Boots" };
"platelegs (g)", "bottom", "skirt", "skirt (g)", "skirt (t)", "chaps (g)", "chaps (t)", "tassets", "legs",
"Flared trousers" };
/** /**
* Weapons. * Capes.
*/ */
public static final String[] WEAPONS = { "scimitar", "longsword", "sword", "longbow", "shortbow", "dagger", "mace", public static final String[] CAPES = { "cape", "Cape" };
"halberd", "spear", "Abyssal whip", "axe", "flail", "crossbow", "Torags hammers", "dagger(p)", "dagger(+)",
"dagger(s)", "spear(p)", "spear(+)", "spear(s)", "spear(kp)", "maul", "dart", "dart(p)", "javelin",
"javelin(p)", "knife", "knife(p)", "Longbow", "Shortbow", "Crossbow", "Toktz-xil", "Toktz-mej",
"Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" };
/** /**
* Full bodies. * Full bodies.
@@ -92,6 +54,44 @@ public final class EquipmentConstants {
public static final String[] FULL_MASKS = { "full helm", "mask", "Veracs helm", "Guthans helm", "Torags helm", public static final String[] FULL_MASKS = { "full helm", "mask", "Veracs helm", "Guthans helm", "Torags helm",
"Karils coif", "full helm (t)", "full helm (g)", "mask" }; "Karils coif", "full helm (t)", "full helm (g)", "mask" };
/**
* Gloves.
*/
public static final String[] GLOVES = { "gloves", "gauntlets", "Gloves", "vambraces", "vamb", "bracers" };
/**
* Hats.
*/
public static final String[] HATS = { "helm", "hood", "coif", "Coif", "hat", "partyhat", "Hat", "full helm (t)",
"full helm (g)", "hat (t)", "hat (g)", "cav", "boater", "helmet", "mask", "Helm of neitiznot" };
/**
* Legs.
*/
public static final String[] LEGS = { "platelegs", "plateskirt", "skirt", "bottoms", "chaps", "platelegs (t)",
"platelegs (g)", "bottom", "skirt", "skirt (g)", "skirt (t)", "chaps (g)", "chaps (t)", "tassets", "legs",
"Flared trousers" };
/**
* Rings.
*/
public static final String[] RINGS = { "ring", "Ring of" };
/**
* Shields.
*/
public static final String[] SHIELDS = { "kiteshield", "sq shield", "Toktz-ket", "books", "book", "kiteshield (t)",
"kiteshield (g)", "kiteshield(h)", "defender", "shield" };
/**
* Weapons.
*/
public static final String[] WEAPONS = { "scimitar", "longsword", "sword", "longbow", "shortbow", "dagger", "mace",
"halberd", "spear", "Abyssal whip", "axe", "flail", "crossbow", "Torags hammers", "dagger(p)", "dagger(+)",
"dagger(s)", "spear(p)", "spear(+)", "spear(s)", "spear(kp)", "maul", "dart", "dart(p)", "javelin",
"javelin(p)", "knife", "knife(p)", "Longbow", "Shortbow", "Crossbow", "Toktz-xil", "Toktz-mej",
"Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" };
/** /**
* Default private construcotr to prevent instantiation. * Default private construcotr to prevent instantiation.
*/ */
+5 -5
View File
@@ -27,6 +27,11 @@ import org.jboss.netty.handler.codec.http.HttpResponseStatus;
*/ */
public final class HttpRequestWorker extends RequestWorker<HttpRequest, ResourceProvider> { public final class HttpRequestWorker extends RequestWorker<HttpRequest, ResourceProvider> {
/**
* The default character set.
*/
private static final Charset CHARACTER_SET = Charset.forName("ISO-8859-1");
/** /**
* The value of the server header. * The value of the server header.
*/ */
@@ -37,11 +42,6 @@ public final class HttpRequestWorker extends RequestWorker<HttpRequest, Resource
*/ */
private static final File WWW_DIRECTORY = new File("./data/www/"); private static final File WWW_DIRECTORY = new File("./data/www/");
/**
* The default character set.
*/
private static final Charset CHARACTER_SET = Charset.forName("ISO-8859-1");
/** /**
* Creates the HTTP request worker. * Creates the HTTP request worker.
* *
+5 -5
View File
@@ -13,16 +13,16 @@ import org.jboss.netty.channel.Channel;
*/ */
public abstract class RequestWorker<T, P> implements Runnable { public abstract class RequestWorker<T, P> implements Runnable {
/**
* The resource provider.
*/
private final P provider;
/** /**
* The update dispatcher. * The update dispatcher.
*/ */
private final UpdateDispatcher dispatcher; private final UpdateDispatcher dispatcher;
/**
* The resource provider.
*/
private final P provider;
/** /**
* A flag indicating if the worker should be running. * A flag indicating if the worker should be running.
*/ */
+4 -4
View File
@@ -22,9 +22,9 @@ public final class UpdateDispatcher {
private static final int MAXIMUM_QUEUE_SIZE = 1024; private static final int MAXIMUM_QUEUE_SIZE = 1024;
/** /**
* A queue for pending 'on-demand' requests. * A queue for pending HTTP requests.
*/ */
private final BlockingQueue<ChannelRequest<OnDemandRequest>> onDemandQueue = new PriorityBlockingQueue<ChannelRequest<OnDemandRequest>>(); private final BlockingQueue<ChannelRequest<HttpRequest>> httpQueue = new LinkedBlockingQueue<ChannelRequest<HttpRequest>>();
/** /**
* A queue for pending JAGGRAB requests. * A queue for pending JAGGRAB requests.
@@ -32,9 +32,9 @@ public final class UpdateDispatcher {
private final BlockingQueue<ChannelRequest<JagGrabRequest>> jagGrabQueue = new LinkedBlockingQueue<ChannelRequest<JagGrabRequest>>(); private final BlockingQueue<ChannelRequest<JagGrabRequest>> jagGrabQueue = new LinkedBlockingQueue<ChannelRequest<JagGrabRequest>>();
/** /**
* A queue for pending HTTP requests. * A queue for pending 'on-demand' requests.
*/ */
private final BlockingQueue<ChannelRequest<HttpRequest>> httpQueue = new LinkedBlockingQueue<ChannelRequest<HttpRequest>>(); private final BlockingQueue<ChannelRequest<OnDemandRequest>> onDemandQueue = new PriorityBlockingQueue<ChannelRequest<OnDemandRequest>>();
/** /**
* Dispatches a HTTP request. * Dispatches a HTTP request.
+7 -7
View File
@@ -16,15 +16,20 @@ import org.apollo.fs.IndexedFileSystem;
*/ */
public final class UpdateService extends Service { public final class UpdateService extends Service {
/**
* The number of request types.
*/
private static final int REQUEST_TYPES = 3;
/** /**
* The number of threads per request type. * The number of threads per request type.
*/ */
private static final int THREADS_PER_REQUEST_TYPE = Runtime.getRuntime().availableProcessors(); private static final int THREADS_PER_REQUEST_TYPE = Runtime.getRuntime().availableProcessors();
/** /**
* The number of request types. * The update dispatcher.
*/ */
private static final int REQUEST_TYPES = 3; private final UpdateDispatcher dispatcher = new UpdateDispatcher();
/** /**
* The executor service. * The executor service.
@@ -36,11 +41,6 @@ public final class UpdateService extends Service {
*/ */
private final List<RequestWorker<?, ?>> workers = new ArrayList<RequestWorker<?, ?>>(); private final List<RequestWorker<?, ?>> workers = new ArrayList<RequestWorker<?, ?>>();
/**
* The update dispatcher.
*/
private final UpdateDispatcher dispatcher = new UpdateDispatcher();
/** /**
* Creates the update service. * Creates the update service.
*/ */
+10 -10
View File
@@ -20,16 +20,16 @@ public final class CharacterRepository<T extends Character> implements Iterable<
*/ */
private final class CharacterRepositoryIterator implements Iterator<T> { private final class CharacterRepositoryIterator implements Iterator<T> {
/**
* The previous index of this iterator.
*/
private int previousIndex = -1;
/** /**
* The current index of this iterator. * The current index of this iterator.
*/ */
private int index = 0; private int index = 0;
/**
* The previous index of this iterator.
*/
private int previousIndex = -1;
@Override @Override
public boolean hasNext() { public boolean hasNext() {
for (int i = index; i < characters.length; i++) { for (int i = index; i < characters.length; i++) {
@@ -77,16 +77,16 @@ public final class CharacterRepository<T extends Character> implements Iterable<
*/ */
private final Character[] characters; private final Character[] characters;
/**
* The current size of this repository.
*/
private int size = 0;
/** /**
* The position of the next free index. * The position of the next free index.
*/ */
private int pointer = 0; private int pointer = 0;
/**
* The current size of this repository.
*/
private int size = 0;
/** /**
* Creates a new character repository with the specified capacity. * Creates a new character repository with the specified capacity.
* *

Some files were not shown because too many files have changed in this diff Show More