diff --git a/src/org/apollo/ServerContext.java b/src/org/apollo/ServerContext.java
index 6e9a7c41..46352ff7 100644
--- a/src/org/apollo/ServerContext.java
+++ b/src/org/apollo/ServerContext.java
@@ -80,4 +80,4 @@ public final class ServerContext {
return serviceManager;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/fs/FileDescriptor.java b/src/org/apollo/fs/FileDescriptor.java
index 814ac12b..902bfb99 100644
--- a/src/org/apollo/fs/FileDescriptor.java
+++ b/src/org/apollo/fs/FileDescriptor.java
@@ -46,4 +46,4 @@ public final class FileDescriptor {
return type;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/fs/Index.java b/src/org/apollo/fs/Index.java
index 6ab78587..3716ef0b 100644
--- a/src/org/apollo/fs/Index.java
+++ b/src/org/apollo/fs/Index.java
@@ -64,4 +64,4 @@ public final class Index {
return size;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/fs/IndexedFileSystem.java b/src/org/apollo/fs/IndexedFileSystem.java
index 1d26ac4c..cbb70dc5 100644
--- a/src/org/apollo/fs/IndexedFileSystem.java
+++ b/src/org/apollo/fs/IndexedFileSystem.java
@@ -91,7 +91,7 @@ public final class IndexedFileSystem implements Closeable {
} else if (newEngineData.exists() && !oldEngineData.isDirectory()) {
data = new RandomAccessFile(newEngineData, readOnly ? "r" : "rw");
} else {
- throw new FileNotFoundException("No data file present");
+ throw new FileNotFoundException("no data file present");
}
}
@@ -123,27 +123,27 @@ public final class IndexedFileSystem implements Closeable {
for (int i = 1; i < crcs.length; i++) {
crc32.reset();
- ByteBuffer bb = getFile(0, i);
- byte[] bytes = new byte[bb.remaining()];
- bb.get(bytes, 0, bytes.length);
+ ByteBuffer buffer = getFile(0, i);
+ byte[] bytes = new byte[buffer.remaining()];
+ buffer.get(bytes, 0, bytes.length);
crc32.update(bytes, 0, bytes.length);
crcs[i] = (int) crc32.getValue();
}
// hash the CRCs and place them in the buffer
- ByteBuffer buf = ByteBuffer.allocate(crcs.length * 4 + 4);
+ ByteBuffer buffer = ByteBuffer.allocate(crcs.length * 4 + 4);
for (int crc : crcs) {
hash = (hash << 1) + crc;
- buf.putInt(crc);
+ buffer.putInt(crc);
}
// place the hash into the buffer
- buf.putInt(hash);
- buf.flip();
+ buffer.putInt(hash);
+ buffer.flip();
synchronized (this) {
- crcTable = buf.asReadOnlyBuffer();
+ crcTable = buffer.asReadOnlyBuffer();
return crcTable.duplicate();
}
}
@@ -153,16 +153,16 @@ public final class IndexedFileSystem implements Closeable {
/**
* Gets a file.
*
- * @param fd The {@link FileDescriptor} which points to the file.
+ * @param descriptor The {@link FileDescriptor} which points to the file.
* @return A {@link ByteBuffer} which contains the contents of the file.
* @throws IOException If an I/O error occurs.
*/
- public ByteBuffer getFile(FileDescriptor fd) throws IOException {
- Index index = getIndex(fd);
+ public ByteBuffer getFile(FileDescriptor descriptor) throws IOException {
+ Index index = getIndex(descriptor);
ByteBuffer buffer = ByteBuffer.allocate(index.getSize());
// calculate some initial values
- long ptr = (long) index.getBlock() * (long) FileSystemConstants.BLOCK_SIZE;
+ long ptr = index.getBlock() * FileSystemConstants.BLOCK_SIZE;
int read = 0;
int size = index.getSize();
int blocks = size / FileSystemConstants.CHUNK_SIZE;
@@ -171,7 +171,6 @@ public final class IndexedFileSystem implements Closeable {
}
for (int i = 0; i < blocks; i++) {
-
// read header
byte[] header = new byte[FileSystemConstants.HEADER_SIZE];
synchronized (data) {
@@ -211,15 +210,14 @@ public final class IndexedFileSystem implements Closeable {
read += chunkSize;
ptr = (long) nextBlock * (long) FileSystemConstants.BLOCK_SIZE;
- // if we still have more data to read, check the validity of the
- // header
+ // if we still have more data to read, check the validity of the header
if (size > read) {
- if (nextType != fd.getType() + 1) {
- throw new IOException("File type mismatch.");
+ if (nextType != descriptor.getType() + 1) {
+ throw new IOException("file type mismatch.");
}
- if (nextFile != fd.getFile()) {
- throw new IOException("File id mismatch.");
+ if (nextFile != descriptor.getFile()) {
+ throw new IOException("file id mismatch.");
}
}
}
@@ -261,12 +259,12 @@ public final class IndexedFileSystem implements Closeable {
/**
* Gets the index of a file.
*
- * @param fd The {@link FileDescriptor} which points to the file.
+ * @param descriptor The {@link FileDescriptor} which points to the file.
* @return The {@link Index}.
* @throws IOException If an I/O error occurs.
*/
- private Index getIndex(FileDescriptor fd) throws IOException {
- int index = fd.getType();
+ private Index getIndex(FileDescriptor descriptor) throws IOException {
+ int index = descriptor.getType();
if (index < 0 || index >= indices.length) {
throw new IndexOutOfBoundsException("file descriptor type out of bounds");
}
@@ -274,7 +272,7 @@ public final class IndexedFileSystem implements Closeable {
byte[] buffer = new byte[FileSystemConstants.INDEX_SIZE];
RandomAccessFile indexFile = indices[index];
synchronized (indexFile) {
- long ptr = (long) fd.getFile() * (long) FileSystemConstants.INDEX_SIZE;
+ long ptr = descriptor.getFile() * FileSystemConstants.INDEX_SIZE;
if (ptr >= 0 && indexFile.length() >= ptr + FileSystemConstants.INDEX_SIZE) {
indexFile.seek(ptr);
indexFile.readFully(buffer);
diff --git a/src/org/apollo/fs/archive/ArchiveEntry.java b/src/org/apollo/fs/archive/ArchiveEntry.java
index 56c51875..a8a9ffbf 100644
--- a/src/org/apollo/fs/archive/ArchiveEntry.java
+++ b/src/org/apollo/fs/archive/ArchiveEntry.java
@@ -48,4 +48,4 @@ public final class ArchiveEntry {
return identifier;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/fs/archive/package-info.java b/src/org/apollo/fs/archive/package-info.java
index edf1f79a..f126a4dd 100644
--- a/src/org/apollo/fs/archive/package-info.java
+++ b/src/org/apollo/fs/archive/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which deal with archives.
*/
-package org.apollo.fs.archive;
-
+package org.apollo.fs.archive;
\ No newline at end of file
diff --git a/src/org/apollo/fs/decoder/package-info.java b/src/org/apollo/fs/decoder/package-info.java
index fb9c07ce..244b2313 100644
--- a/src/org/apollo/fs/decoder/package-info.java
+++ b/src/org/apollo/fs/decoder/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which parse files within the game's cache.
*/
-package org.apollo.fs.decoder;
-
+package org.apollo.fs.decoder;
\ No newline at end of file
diff --git a/src/org/apollo/fs/package-info.java b/src/org/apollo/fs/package-info.java
index 60330723..1ddba019 100644
--- a/src/org/apollo/fs/package-info.java
+++ b/src/org/apollo/fs/package-info.java
@@ -2,5 +2,4 @@
* Contains classes which deal with the file system that the client uses to
* store game data files.
*/
-package org.apollo.fs;
-
+package org.apollo.fs;
\ No newline at end of file
diff --git a/src/org/apollo/game/GameConstants.java b/src/org/apollo/game/GameConstants.java
index fdb16010..38d186c7 100644
--- a/src/org/apollo/game/GameConstants.java
+++ b/src/org/apollo/game/GameConstants.java
@@ -24,4 +24,4 @@ public final class GameConstants {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/GamePulseHandler.java b/src/org/apollo/game/GamePulseHandler.java
index 037d9908..1ec13290 100644
--- a/src/org/apollo/game/GamePulseHandler.java
+++ b/src/org/apollo/game/GamePulseHandler.java
@@ -38,4 +38,4 @@ public final class GamePulseHandler implements Runnable {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/action/Action.java b/src/org/apollo/game/action/Action.java
index ab5577f5..5a970e68 100644
--- a/src/org/apollo/game/action/Action.java
+++ b/src/org/apollo/game/action/Action.java
@@ -4,7 +4,7 @@ import org.apollo.game.model.Mob;
import org.apollo.game.scheduling.ScheduledTask;
/**
- * An action is a specialised {@link ScheduledTask} which is specific to a character.
+ * An action is a specialised {@link ScheduledTask} which is specific to a mob.
*
* ALL actions MUST implement the {@link #equals(Object)} method. This is to check if
* two actions are identical: if they are, then the new action does not replace the old one (so spam/accidental clicking
@@ -15,9 +15,9 @@ import org.apollo.game.scheduling.ScheduledTask;
public abstract class Action extends ScheduledTask {
/**
- * The character performing the action.
+ * The mob performing the action.
*/
- private final T character;
+ protected final T mob;
/**
* A flag indicating if this action is stopping.
@@ -29,20 +29,20 @@ public abstract class Action extends ScheduledTask {
*
* @param delay The delay in pulses.
* @param immediate A flag indicating if the action should happen immediately.
- * @param character The character performing the action.
+ * @param mob The mob performing the action.
*/
- public Action(int delay, boolean immediate, T character) {
+ public Action(int delay, boolean immediate, T mob) {
super(delay, immediate);
- this.character = character;
+ this.mob = mob;
}
/**
- * Gets the character which performed the action.
+ * Gets the mob which performed the action.
*
- * @return The character.
+ * @return The mob.
*/
- public T getCharacter() {
- return character;
+ public T getMob() {
+ return mob;
}
@Override
@@ -50,8 +50,8 @@ public abstract class Action extends ScheduledTask {
super.stop();
if (!stopping) {
stopping = true;
- character.stopAction();
+ mob.stopAction();
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/action/DistancedAction.java b/src/org/apollo/game/action/DistancedAction.java
index a8acd625..fcdc7aa4 100644
--- a/src/org/apollo/game/action/DistancedAction.java
+++ b/src/org/apollo/game/action/DistancedAction.java
@@ -41,12 +41,12 @@ public abstract class DistancedAction extends Action {
*
* @param delay The delay between executions once the distance threshold is reached.
* @param immediate Whether or not this action fires immediately after the distance threshold is reached.
- * @param character The character.
+ * @param mob The mob.
* @param position The position.
* @param distance The distance.
*/
- public DistancedAction(int delay, boolean immediate, T character, Position position, int distance) {
- super(0, true, character);
+ public DistancedAction(int delay, boolean immediate, T mob, Position position, int distance) {
+ super(0, true, mob);
this.position = position;
this.distance = distance;
this.delay = delay;
@@ -59,7 +59,7 @@ public abstract class DistancedAction extends Action {
// some actions (e.g. agility) will cause the player to move away again
// so we don't check once the player got close enough once
executeAction();
- } else if (getCharacter().getPosition().getDistance(position) <= distance) {
+ } else if (mob.getPosition().getDistance(position) <= distance) {
reached = true;
setDelay(delay);
if (immediate) { // TODO: required?
@@ -73,4 +73,4 @@ public abstract class DistancedAction extends Action {
*/
public abstract void executeAction();
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/action/package-info.java b/src/org/apollo/game/action/package-info.java
index f90b955b..ab52281b 100644
--- a/src/org/apollo/game/action/package-info.java
+++ b/src/org/apollo/game/action/package-info.java
@@ -1,6 +1,5 @@
/**
* Contains classes related to actions, specialised scheduled tasks which
- * characters perform.
+ * mobs perform.
*/
-package org.apollo.game.action;
-
+package org.apollo.game.action;
\ No newline at end of file
diff --git a/src/org/apollo/game/command/package-info.java b/src/org/apollo/game/command/package-info.java
index 84f11f0b..a09f6e35 100644
--- a/src/org/apollo/game/command/package-info.java
+++ b/src/org/apollo/game/command/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to in-game commands.
*/
-package org.apollo.game.command;
-
+package org.apollo.game.command;
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/EventHandler.java b/src/org/apollo/game/event/handler/EventHandler.java
index e245375d..2fb02867 100644
--- a/src/org/apollo/game/event/handler/EventHandler.java
+++ b/src/org/apollo/game/event/handler/EventHandler.java
@@ -20,4 +20,4 @@ public abstract class EventHandler {
*/
public abstract void handle(EventHandlerContext ctx, Player player, E event);
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/EventHandlerContext.java b/src/org/apollo/game/event/handler/EventHandlerContext.java
index 6730d5c7..3720fe27 100644
--- a/src/org/apollo/game/event/handler/EventHandlerContext.java
+++ b/src/org/apollo/game/event/handler/EventHandlerContext.java
@@ -14,4 +14,4 @@ public abstract class EventHandlerContext {
*/
public abstract void breakHandlerChain();
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/chain/EventHandlerChainGroup.java b/src/org/apollo/game/event/handler/chain/EventHandlerChainGroup.java
index 4d31ecd7..90a734b7 100644
--- a/src/org/apollo/game/event/handler/chain/EventHandlerChainGroup.java
+++ b/src/org/apollo/game/event/handler/chain/EventHandlerChainGroup.java
@@ -37,4 +37,4 @@ public final class EventHandlerChainGroup {
return (EventHandlerChain) chains.get(clazz);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/chain/package-info.java b/src/org/apollo/game/event/handler/chain/package-info.java
index 4e03fa83..73aa7f14 100644
--- a/src/org/apollo/game/event/handler/chain/package-info.java
+++ b/src/org/apollo/game/event/handler/chain/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to the chaining of event handlers.
*/
-package org.apollo.game.event.handler.chain;
-
+package org.apollo.game.event.handler.chain;
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/BankButtonEventHandler.java b/src/org/apollo/game/event/handler/impl/BankButtonEventHandler.java
index d9e85695..7af52b30 100644
--- a/src/org/apollo/game/event/handler/impl/BankButtonEventHandler.java
+++ b/src/org/apollo/game/event/handler/impl/BankButtonEventHandler.java
@@ -31,4 +31,4 @@ public final class BankButtonEventHandler extends EventHandler {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/ChatEventHandler.java b/src/org/apollo/game/event/handler/impl/ChatEventHandler.java
index bf380c10..6cff17af 100644
--- a/src/org/apollo/game/event/handler/impl/ChatEventHandler.java
+++ b/src/org/apollo/game/event/handler/impl/ChatEventHandler.java
@@ -18,4 +18,4 @@ public final class ChatEventHandler extends EventHandler {
player.getBlockSet().add(SynchronizationBlock.createChatBlock(player, event));
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/ChatVerificationHandler.java b/src/org/apollo/game/event/handler/impl/ChatVerificationHandler.java
index 7c5a0b7e..6c80d047 100644
--- a/src/org/apollo/game/event/handler/impl/ChatVerificationHandler.java
+++ b/src/org/apollo/game/event/handler/impl/ChatVerificationHandler.java
@@ -21,4 +21,4 @@ public final class ChatVerificationHandler extends EventHandler {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/ClosedInterfaceEventHandler.java b/src/org/apollo/game/event/handler/impl/ClosedInterfaceEventHandler.java
index ab3acbb7..e1833ed5 100644
--- a/src/org/apollo/game/event/handler/impl/ClosedInterfaceEventHandler.java
+++ b/src/org/apollo/game/event/handler/impl/ClosedInterfaceEventHandler.java
@@ -17,4 +17,4 @@ public final class ClosedInterfaceEventHandler extends EventHandler {
String[] arguments = new String[components.length - 1];
System.arraycopy(components, 1, arguments, 0, arguments.length);
-
Command command = new Command(name, arguments);
World.getWorld().getCommandDispatcher().dispatch(player, command);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/EnteredAmountEventHandler.java b/src/org/apollo/game/event/handler/impl/EnteredAmountEventHandler.java
index b98b09e1..115f75b5 100644
--- a/src/org/apollo/game/event/handler/impl/EnteredAmountEventHandler.java
+++ b/src/org/apollo/game/event/handler/impl/EnteredAmountEventHandler.java
@@ -17,4 +17,4 @@ public final class EnteredAmountEventHandler extends EventHandler {
+public final class PlayerDesignEventHandler extends EventHandler {
@Override
- public void handle(EventHandlerContext ctx, Player player, CharacterDesignEvent event) {
+ public void handle(EventHandlerContext ctx, Player player, PlayerDesignEvent event) {
player.setAppearance(event.getAppearance());
- player.setDesignedCharacter(true);
+ player.setDesigned(true);
player.send(new CloseInterfaceEvent());
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/CharacterDesignVerificationHandler.java b/src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java
similarity index 82%
rename from src/org/apollo/game/event/handler/impl/CharacterDesignVerificationHandler.java
rename to src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java
index ff17aaaf..25b70f00 100644
--- a/src/org/apollo/game/event/handler/impl/CharacterDesignVerificationHandler.java
+++ b/src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java
@@ -2,21 +2,21 @@ package org.apollo.game.event.handler.impl;
import org.apollo.game.event.handler.EventHandler;
import org.apollo.game.event.handler.EventHandlerContext;
-import org.apollo.game.event.impl.CharacterDesignEvent;
+import org.apollo.game.event.impl.PlayerDesignEvent;
import org.apollo.game.model.Appearance;
import org.apollo.game.model.Gender;
import org.apollo.game.model.Player;
/**
- * A handler which verifies {@link CharacterDesignEvent}s.
+ * A handler which verifies {@link PlayerDesignEvent}s.
*
* @author Graham
*/
-public final class CharacterDesignVerificationHandler extends EventHandler {
+public final class PlayerDesignVerificationHandler extends EventHandler {
@Override
- public void handle(EventHandlerContext ctx, Player player, CharacterDesignEvent event) {
- if (!valid(event.getAppearance()) || player.hasDesignedCharacter()) {
+ public void handle(EventHandlerContext ctx, Player player, PlayerDesignEvent event) {
+ if (!valid(event.getAppearance()) || player.hasDesignedAvatar()) {
ctx.breakHandlerChain();
}
}
@@ -42,7 +42,7 @@ public final class CharacterDesignVerificationHandler extends EventHandler
Inventory inventory;
boolean insertPermitted = false;
- // TODO is there a better way of doing this??
switch (event.getInterfaceId()) {
case SynchronizationInventoryListener.INVENTORY_ID:
case BankConstants.SIDEBAR_INVENTORY_ID:
@@ -45,4 +44,4 @@ public final class SwitchItemEventHandler extends EventHandler
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/impl/WalkEventHandler.java b/src/org/apollo/game/event/handler/impl/WalkEventHandler.java
index 59b92538..a2d8ca01 100644
--- a/src/org/apollo/game/event/handler/impl/WalkEventHandler.java
+++ b/src/org/apollo/game/event/handler/impl/WalkEventHandler.java
@@ -23,7 +23,7 @@ public final class WalkEventHandler extends EventHandler {
Position step = steps[i];
if (i == 0) {
if (!queue.addFirstStep(step)) {
- return; /* ignore packet */
+ return; // ignore packet
}
} else {
queue.addStep(step);
diff --git a/src/org/apollo/game/event/handler/impl/package-info.java b/src/org/apollo/game/event/handler/impl/package-info.java
index 9fcecd6a..cd21c817 100644
--- a/src/org/apollo/game/event/handler/impl/package-info.java
+++ b/src/org/apollo/game/event/handler/impl/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains event handler implementations.
*/
-package org.apollo.game.event.handler.impl;
-
+package org.apollo.game.event.handler.impl;
\ No newline at end of file
diff --git a/src/org/apollo/game/event/handler/package-info.java b/src/org/apollo/game/event/handler/package-info.java
index e434b8c3..e930252a 100644
--- a/src/org/apollo/game/event/handler/package-info.java
+++ b/src/org/apollo/game/event/handler/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which define abstract event handlers.
*/
-package org.apollo.game.event.handler;
-
+package org.apollo.game.event.handler;
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/CharacterAnimationResetEvent.java b/src/org/apollo/game/event/impl/CharacterAnimationResetEvent.java
deleted file mode 100644
index 698d8375..00000000
--- a/src/org/apollo/game/event/impl/CharacterAnimationResetEvent.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.apollo.game.event.impl;
-
-import org.apollo.game.event.Event;
-
-/**
- * An outgoing event sent to reset the animations of every character.
- *
- * @author Major
- */
-public class CharacterAnimationResetEvent extends Event {
-
-}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ChatEvent.java b/src/org/apollo/game/event/impl/ChatEvent.java
index d7be2ee7..8aa87fc6 100644
--- a/src/org/apollo/game/event/impl/ChatEvent.java
+++ b/src/org/apollo/game/event/impl/ChatEvent.java
@@ -80,4 +80,4 @@ public final class ChatEvent extends Event {
return effects;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/CloseInterfaceEvent.java b/src/org/apollo/game/event/impl/CloseInterfaceEvent.java
index ee755504..c248af40 100644
--- a/src/org/apollo/game/event/impl/CloseInterfaceEvent.java
+++ b/src/org/apollo/game/event/impl/CloseInterfaceEvent.java
@@ -9,4 +9,4 @@ import org.apollo.game.event.Event;
*/
public final class CloseInterfaceEvent extends Event {
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ClosedInterfaceEvent.java b/src/org/apollo/game/event/impl/ClosedInterfaceEvent.java
index 6c9278cd..ab1002fd 100644
--- a/src/org/apollo/game/event/impl/ClosedInterfaceEvent.java
+++ b/src/org/apollo/game/event/impl/ClosedInterfaceEvent.java
@@ -9,4 +9,4 @@ import org.apollo.game.event.Event;
*/
public final class ClosedInterfaceEvent extends Event {
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/CommandEvent.java b/src/org/apollo/game/event/impl/CommandEvent.java
index 0cceac6d..e046056f 100644
--- a/src/org/apollo/game/event/impl/CommandEvent.java
+++ b/src/org/apollo/game/event/impl/CommandEvent.java
@@ -32,4 +32,4 @@ public final class CommandEvent extends Event {
return command;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/EnterAmountEvent.java b/src/org/apollo/game/event/impl/EnterAmountEvent.java
index 6345fd33..07726101 100644
--- a/src/org/apollo/game/event/impl/EnterAmountEvent.java
+++ b/src/org/apollo/game/event/impl/EnterAmountEvent.java
@@ -9,4 +9,4 @@ import org.apollo.game.event.Event;
*/
public final class EnterAmountEvent extends Event {
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/EnteredAmountEvent.java b/src/org/apollo/game/event/impl/EnteredAmountEvent.java
index 3024762d..654aed24 100644
--- a/src/org/apollo/game/event/impl/EnteredAmountEvent.java
+++ b/src/org/apollo/game/event/impl/EnteredAmountEvent.java
@@ -32,4 +32,4 @@ public final class EnteredAmountEvent extends Event {
return amount;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FifthItemActionEvent.java b/src/org/apollo/game/event/impl/FifthItemActionEvent.java
index 92177404..7895979d 100644
--- a/src/org/apollo/game/event/impl/FifthItemActionEvent.java
+++ b/src/org/apollo/game/event/impl/FifthItemActionEvent.java
@@ -18,4 +18,4 @@ public final class FifthItemActionEvent extends ItemActionEvent {
super(5, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FifthItemOptionEvent.java b/src/org/apollo/game/event/impl/FifthItemOptionEvent.java
index 981b3f67..86f5c1ce 100644
--- a/src/org/apollo/game/event/impl/FifthItemOptionEvent.java
+++ b/src/org/apollo/game/event/impl/FifthItemOptionEvent.java
@@ -18,4 +18,4 @@ public final class FifthItemOptionEvent extends ItemOptionEvent {
super(5, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FirstItemActionEvent.java b/src/org/apollo/game/event/impl/FirstItemActionEvent.java
index 58096c91..c1cd0123 100644
--- a/src/org/apollo/game/event/impl/FirstItemActionEvent.java
+++ b/src/org/apollo/game/event/impl/FirstItemActionEvent.java
@@ -18,4 +18,4 @@ public final class FirstItemActionEvent extends ItemActionEvent {
super(1, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FirstItemOptionEvent.java b/src/org/apollo/game/event/impl/FirstItemOptionEvent.java
index e80e301c..218994cf 100644
--- a/src/org/apollo/game/event/impl/FirstItemOptionEvent.java
+++ b/src/org/apollo/game/event/impl/FirstItemOptionEvent.java
@@ -18,4 +18,4 @@ public final class FirstItemOptionEvent extends ItemOptionEvent {
super(1, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FirstObjectActionEvent.java b/src/org/apollo/game/event/impl/FirstObjectActionEvent.java
index b0d28c3a..e1bbe284 100644
--- a/src/org/apollo/game/event/impl/FirstObjectActionEvent.java
+++ b/src/org/apollo/game/event/impl/FirstObjectActionEvent.java
@@ -19,4 +19,4 @@ public final class FirstObjectActionEvent extends ObjectActionEvent {
super(1, id, position);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FourthItemActionEvent.java b/src/org/apollo/game/event/impl/FourthItemActionEvent.java
index 4532d29b..21298adc 100644
--- a/src/org/apollo/game/event/impl/FourthItemActionEvent.java
+++ b/src/org/apollo/game/event/impl/FourthItemActionEvent.java
@@ -18,4 +18,4 @@ public final class FourthItemActionEvent extends ItemActionEvent {
super(4, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/FourthItemOptionEvent.java b/src/org/apollo/game/event/impl/FourthItemOptionEvent.java
index fbc1fd87..5d9fa6e5 100644
--- a/src/org/apollo/game/event/impl/FourthItemOptionEvent.java
+++ b/src/org/apollo/game/event/impl/FourthItemOptionEvent.java
@@ -18,4 +18,4 @@ public final class FourthItemOptionEvent extends ItemOptionEvent {
super(4, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/IdAssignmentEvent.java b/src/org/apollo/game/event/impl/IdAssignmentEvent.java
index 029a5e11..ea2be256 100644
--- a/src/org/apollo/game/event/impl/IdAssignmentEvent.java
+++ b/src/org/apollo/game/event/impl/IdAssignmentEvent.java
@@ -48,4 +48,4 @@ public final class IdAssignmentEvent extends Event {
return members;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/KeepAliveEvent.java b/src/org/apollo/game/event/impl/KeepAliveEvent.java
index 25ce1ad2..c01370c8 100644
--- a/src/org/apollo/game/event/impl/KeepAliveEvent.java
+++ b/src/org/apollo/game/event/impl/KeepAliveEvent.java
@@ -30,4 +30,4 @@ public final class KeepAliveEvent extends Event {
return createdAt;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/LogoutEvent.java b/src/org/apollo/game/event/impl/LogoutEvent.java
index 406cd415..26e90dd0 100644
--- a/src/org/apollo/game/event/impl/LogoutEvent.java
+++ b/src/org/apollo/game/event/impl/LogoutEvent.java
@@ -9,4 +9,4 @@ import org.apollo.game.event.Event;
*/
public final class LogoutEvent extends Event {
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/MobAnimationResetEvent.java b/src/org/apollo/game/event/impl/MobAnimationResetEvent.java
new file mode 100644
index 00000000..76575e38
--- /dev/null
+++ b/src/org/apollo/game/event/impl/MobAnimationResetEvent.java
@@ -0,0 +1,12 @@
+package org.apollo.game.event.impl;
+
+import org.apollo.game.event.Event;
+
+/**
+ * An outgoing event sent to reset the animations of every mob.
+ *
+ * @author Major
+ */
+public class MobAnimationResetEvent extends Event {
+
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ObjectActionEvent.java b/src/org/apollo/game/event/impl/ObjectActionEvent.java
index eb9cfa97..3c2e9ba7 100644
--- a/src/org/apollo/game/event/impl/ObjectActionEvent.java
+++ b/src/org/apollo/game/event/impl/ObjectActionEvent.java
@@ -65,4 +65,4 @@ public abstract class ObjectActionEvent extends Event {
return position;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/OpenInterfaceEvent.java b/src/org/apollo/game/event/impl/OpenInterfaceEvent.java
index 5c478b70..4f93b9c3 100644
--- a/src/org/apollo/game/event/impl/OpenInterfaceEvent.java
+++ b/src/org/apollo/game/event/impl/OpenInterfaceEvent.java
@@ -32,4 +32,4 @@ public final class OpenInterfaceEvent extends Event {
return id;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/OpenInterfaceSidebarEvent.java b/src/org/apollo/game/event/impl/OpenInterfaceSidebarEvent.java
index 3ef9f21d..2c62263d 100644
--- a/src/org/apollo/game/event/impl/OpenInterfaceSidebarEvent.java
+++ b/src/org/apollo/game/event/impl/OpenInterfaceSidebarEvent.java
@@ -48,4 +48,4 @@ public final class OpenInterfaceSidebarEvent extends Event {
return sidebarId;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/CharacterDesignEvent.java b/src/org/apollo/game/event/impl/PlayerDesignEvent.java
similarity index 64%
rename from src/org/apollo/game/event/impl/CharacterDesignEvent.java
rename to src/org/apollo/game/event/impl/PlayerDesignEvent.java
index a44827ef..29126ebd 100644
--- a/src/org/apollo/game/event/impl/CharacterDesignEvent.java
+++ b/src/org/apollo/game/event/impl/PlayerDesignEvent.java
@@ -4,11 +4,11 @@ import org.apollo.game.event.Event;
import org.apollo.game.model.Appearance;
/**
- * An event sent by the client when the player modifies their character's design.
+ * An event sent by the client when the player modifies their design.
*
* @author Graham
*/
-public final class CharacterDesignEvent extends Event {
+public final class PlayerDesignEvent extends Event {
/**
* The appearance.
@@ -16,11 +16,11 @@ public final class CharacterDesignEvent extends Event {
private final Appearance appearance;
/**
- * Creates the character design event.
+ * Creates the player design event.
*
* @param appearance The appearance.
*/
- public CharacterDesignEvent(Appearance appearance) {
+ public PlayerDesignEvent(Appearance appearance) {
this.appearance = appearance;
}
@@ -33,4 +33,4 @@ public final class CharacterDesignEvent extends Event {
return appearance;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/PlayerSynchronizationEvent.java b/src/org/apollo/game/event/impl/PlayerSynchronizationEvent.java
index 406ee9ca..a4e54827 100644
--- a/src/org/apollo/game/event/impl/PlayerSynchronizationEvent.java
+++ b/src/org/apollo/game/event/impl/PlayerSynchronizationEvent.java
@@ -117,4 +117,4 @@ public final class PlayerSynchronizationEvent extends Event {
return regionChanged;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SecondItemActionEvent.java b/src/org/apollo/game/event/impl/SecondItemActionEvent.java
index 5a4d8ddc..dee318fc 100644
--- a/src/org/apollo/game/event/impl/SecondItemActionEvent.java
+++ b/src/org/apollo/game/event/impl/SecondItemActionEvent.java
@@ -18,4 +18,4 @@ public final class SecondItemActionEvent extends ItemActionEvent {
super(2, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SecondItemOptionEvent.java b/src/org/apollo/game/event/impl/SecondItemOptionEvent.java
index c9d16ae3..c713e093 100644
--- a/src/org/apollo/game/event/impl/SecondItemOptionEvent.java
+++ b/src/org/apollo/game/event/impl/SecondItemOptionEvent.java
@@ -18,4 +18,4 @@ public final class SecondItemOptionEvent extends ItemOptionEvent {
super(2, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SecondObjectActionEvent.java b/src/org/apollo/game/event/impl/SecondObjectActionEvent.java
index 7200b37b..1c46ba53 100644
--- a/src/org/apollo/game/event/impl/SecondObjectActionEvent.java
+++ b/src/org/apollo/game/event/impl/SecondObjectActionEvent.java
@@ -19,4 +19,4 @@ public final class SecondObjectActionEvent extends ObjectActionEvent {
super(2, id, position);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ServerMessageEvent.java b/src/org/apollo/game/event/impl/ServerMessageEvent.java
index fc37cfe8..6628cdc4 100644
--- a/src/org/apollo/game/event/impl/ServerMessageEvent.java
+++ b/src/org/apollo/game/event/impl/ServerMessageEvent.java
@@ -32,4 +32,4 @@ public final class ServerMessageEvent extends Event {
return message;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SetWidgetItemModelEvent.java b/src/org/apollo/game/event/impl/SetWidgetItemModelEvent.java
index e05d5386..b3f4f619 100644
--- a/src/org/apollo/game/event/impl/SetWidgetItemModelEvent.java
+++ b/src/org/apollo/game/event/impl/SetWidgetItemModelEvent.java
@@ -64,4 +64,4 @@ public final class SetWidgetItemModelEvent extends Event {
return zoom;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SetWidgetModelAnimationEvent.java b/src/org/apollo/game/event/impl/SetWidgetModelAnimationEvent.java
index 166e5048..35b9e2ba 100644
--- a/src/org/apollo/game/event/impl/SetWidgetModelAnimationEvent.java
+++ b/src/org/apollo/game/event/impl/SetWidgetModelAnimationEvent.java
@@ -3,14 +3,14 @@ package org.apollo.game.event.impl;
import org.apollo.game.event.Event;
/**
- * An event which is sent to the client to make a character model on an interface play a certain animation.
+ * An event which is sent to the client to make a mob model on an interface play a certain animation.
*
* @author Chris Fletcher
*/
public final class SetWidgetModelAnimationEvent extends Event {
/**
- * The model's mood id.
+ * The model's animation id.
*/
private final int animation;
diff --git a/src/org/apollo/game/event/impl/SetWidgetNpcModelEvent.java b/src/org/apollo/game/event/impl/SetWidgetNpcModelEvent.java
index 24f43fcd..f485a55f 100644
--- a/src/org/apollo/game/event/impl/SetWidgetNpcModelEvent.java
+++ b/src/org/apollo/game/event/impl/SetWidgetNpcModelEvent.java
@@ -48,4 +48,4 @@ public final class SetWidgetNpcModelEvent extends Event {
return modelId;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SetWidgetPlayerModelEvent.java b/src/org/apollo/game/event/impl/SetWidgetPlayerModelEvent.java
index 620c1f64..7fc86871 100644
--- a/src/org/apollo/game/event/impl/SetWidgetPlayerModelEvent.java
+++ b/src/org/apollo/game/event/impl/SetWidgetPlayerModelEvent.java
@@ -32,4 +32,4 @@ public final class SetWidgetPlayerModelEvent extends Event {
return interfaceId;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SetWidgetTextEvent.java b/src/org/apollo/game/event/impl/SetWidgetTextEvent.java
index 3064ffb8..8f7d13e6 100644
--- a/src/org/apollo/game/event/impl/SetWidgetTextEvent.java
+++ b/src/org/apollo/game/event/impl/SetWidgetTextEvent.java
@@ -48,4 +48,4 @@ public final class SetWidgetTextEvent extends Event {
return text;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SetWidgetVisibilityEvent.java b/src/org/apollo/game/event/impl/SetWidgetVisibilityEvent.java
index fd90058a..f1589c63 100644
--- a/src/org/apollo/game/event/impl/SetWidgetVisibilityEvent.java
+++ b/src/org/apollo/game/event/impl/SetWidgetVisibilityEvent.java
@@ -49,4 +49,4 @@ public final class SetWidgetVisibilityEvent extends Event {
return visible;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SpamPacketEvent.java b/src/org/apollo/game/event/impl/SpamPacketEvent.java
index e4c85b8a..402be7d9 100644
--- a/src/org/apollo/game/event/impl/SpamPacketEvent.java
+++ b/src/org/apollo/game/event/impl/SpamPacketEvent.java
@@ -31,17 +31,5 @@ public class SpamPacketEvent extends Event {
public byte[] getData() {
return data;
}
- // 0
- // random * 256
- // 101
- // 233
- // 45092 (short)
- // 35784 if random * 2= 0
- // random * 256
- // 64
- // 38
- // Math.random() * 65536
- // Math.random() * 65536
- // offset - start offset (exc. the first 0 sent) - size byte.
}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SwitchItemEvent.java b/src/org/apollo/game/event/impl/SwitchItemEvent.java
index 46120137..46cb9db6 100644
--- a/src/org/apollo/game/event/impl/SwitchItemEvent.java
+++ b/src/org/apollo/game/event/impl/SwitchItemEvent.java
@@ -89,4 +89,4 @@ public final class SwitchItemEvent extends Event {
return !inserting;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/SwitchTabInterfaceEvent.java b/src/org/apollo/game/event/impl/SwitchTabInterfaceEvent.java
index bd765100..5e8cf871 100644
--- a/src/org/apollo/game/event/impl/SwitchTabInterfaceEvent.java
+++ b/src/org/apollo/game/event/impl/SwitchTabInterfaceEvent.java
@@ -48,4 +48,4 @@ public final class SwitchTabInterfaceEvent extends Event {
return tab;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ThirdItemActionEvent.java b/src/org/apollo/game/event/impl/ThirdItemActionEvent.java
index 0b069c94..f04e6138 100644
--- a/src/org/apollo/game/event/impl/ThirdItemActionEvent.java
+++ b/src/org/apollo/game/event/impl/ThirdItemActionEvent.java
@@ -18,4 +18,4 @@ public final class ThirdItemActionEvent extends ItemActionEvent {
super(3, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ThirdItemOptionEvent.java b/src/org/apollo/game/event/impl/ThirdItemOptionEvent.java
index 28b110d8..f474ca27 100644
--- a/src/org/apollo/game/event/impl/ThirdItemOptionEvent.java
+++ b/src/org/apollo/game/event/impl/ThirdItemOptionEvent.java
@@ -18,4 +18,4 @@ public final class ThirdItemOptionEvent extends ItemOptionEvent {
super(3, interfaceId, id, slot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/ThirdObjectActionEvent.java b/src/org/apollo/game/event/impl/ThirdObjectActionEvent.java
index 9d335e77..91a01177 100644
--- a/src/org/apollo/game/event/impl/ThirdObjectActionEvent.java
+++ b/src/org/apollo/game/event/impl/ThirdObjectActionEvent.java
@@ -19,4 +19,4 @@ public final class ThirdObjectActionEvent extends ObjectActionEvent {
super(3, id, position);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/UpdateItemsEvent.java b/src/org/apollo/game/event/impl/UpdateItemsEvent.java
index 47c01439..5124bfe2 100644
--- a/src/org/apollo/game/event/impl/UpdateItemsEvent.java
+++ b/src/org/apollo/game/event/impl/UpdateItemsEvent.java
@@ -49,4 +49,4 @@ public final class UpdateItemsEvent extends Event {
return items;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/UpdateSkillEvent.java b/src/org/apollo/game/event/impl/UpdateSkillEvent.java
index 5fc45367..be0d808d 100644
--- a/src/org/apollo/game/event/impl/UpdateSkillEvent.java
+++ b/src/org/apollo/game/event/impl/UpdateSkillEvent.java
@@ -49,4 +49,4 @@ public final class UpdateSkillEvent extends Event {
return skill;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/UpdateSlottedItemsEvent.java b/src/org/apollo/game/event/impl/UpdateSlottedItemsEvent.java
index 01c96d35..917ac348 100644
--- a/src/org/apollo/game/event/impl/UpdateSlottedItemsEvent.java
+++ b/src/org/apollo/game/event/impl/UpdateSlottedItemsEvent.java
@@ -49,4 +49,4 @@ public final class UpdateSlottedItemsEvent extends Event {
return items;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/WalkEvent.java b/src/org/apollo/game/event/impl/WalkEvent.java
index 9a772a7d..43bce7e2 100644
--- a/src/org/apollo/game/event/impl/WalkEvent.java
+++ b/src/org/apollo/game/event/impl/WalkEvent.java
@@ -52,4 +52,4 @@ public final class WalkEvent extends Event {
return run;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/event/impl/package-info.java b/src/org/apollo/game/event/impl/package-info.java
index c3abafb0..a0078584 100644
--- a/src/org/apollo/game/event/impl/package-info.java
+++ b/src/org/apollo/game/event/impl/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains event implementations.
*/
-package org.apollo.game.event.impl;
-
+package org.apollo.game.event.impl;
\ No newline at end of file
diff --git a/src/org/apollo/game/event/package-info.java b/src/org/apollo/game/event/package-info.java
index 202dbe6f..87a9193d 100644
--- a/src/org/apollo/game/event/package-info.java
+++ b/src/org/apollo/game/event/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to the event management in the game.
*/
-package org.apollo.game.event;
-
+package org.apollo.game.event;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/Direction.java b/src/org/apollo/game/model/Direction.java
index 6bdd62b0..4468c2ad 100644
--- a/src/org/apollo/game/model/Direction.java
+++ b/src/org/apollo/game/model/Direction.java
@@ -7,16 +7,16 @@ package org.apollo.game.model;
*/
public enum Direction {
- /**
- * East movement.
- */
- EAST(4),
-
/**
* No movement.
*/
NONE(-1),
+ /**
+ * North west movement.
+ */
+ NORTH_WEST(0),
+
/**
* North movement.
*/
@@ -28,9 +28,19 @@ public enum Direction {
NORTH_EAST(2),
/**
- * North west movement.
+ * West movement.
*/
- NORTH_WEST(0),
+ WEST(3),
+
+ /**
+ * East movement.
+ */
+ EAST(4),
+
+ /**
+ * South west movement.
+ */
+ SOUTH_WEST(5),
/**
* South movement.
@@ -40,17 +50,7 @@ public enum Direction {
/**
* South east movement.
*/
- SOUTH_EAST(7),
-
- /**
- * South west movement.
- */
- SOUTH_WEST(5),
-
- /**
- * West movement.
- */
- WEST(3);
+ SOUTH_EAST(7);
/**
* An empty direction array.
@@ -126,4 +126,4 @@ public enum Direction {
return intValue;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/Entity.java b/src/org/apollo/game/model/Entity.java
index 392f6ebe..25fa3eb2 100644
--- a/src/org/apollo/game/model/Entity.java
+++ b/src/org/apollo/game/model/Entity.java
@@ -1,14 +1,14 @@
package org.apollo.game.model;
/**
- * Represents an in-game entity, such as a character, object, projectile etc.
+ * Represents an in-game entity, such as a mob, object, projectile etc.
*
* @author Major
*/
public abstract class Entity {
/**
- * The position of the entity.
+ * The position of this entity.
*/
protected Position position;
@@ -20,7 +20,7 @@ public abstract class Entity {
public abstract EntityType getEntityType();
/**
- * Gets the position of this entity.
+ * Gets the {@link Position} of this entity.
*
* @return The position.
*/
diff --git a/src/org/apollo/game/model/EntityType.java b/src/org/apollo/game/model/EntityType.java
index f20c6ba6..6586d79d 100644
--- a/src/org/apollo/game/model/EntityType.java
+++ b/src/org/apollo/game/model/EntityType.java
@@ -33,7 +33,7 @@ public enum EntityType {
PROJECTILE,
/**
- * A permanent object appearing on the map.
+ * A permanent object appearing on the map, loaded from the cache.
*/
STATIC_OBJECT;
diff --git a/src/org/apollo/game/model/EquipmentConstants.java b/src/org/apollo/game/model/EquipmentConstants.java
index 36024234..4dd0e217 100644
--- a/src/org/apollo/game/model/EquipmentConstants.java
+++ b/src/org/apollo/game/model/EquipmentConstants.java
@@ -8,59 +8,59 @@ package org.apollo.game.model;
public final class EquipmentConstants {
/**
- * The amulet slot.
+ * The hat slot.
*/
- public static final int AMULET = 2;
-
- /**
- * The arrows slot.
- */
- public static final int ARROWS = 13;
+ public static final int HAT = 0;
/**
* The cape slot.
*/
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.
*/
public static final int CHEST = 4;
- /**
- * The feet slot.
- */
- 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.
- */
- public static final int RING = 12;
-
/**
* The shield slot.
*/
public static final int SHIELD = 5;
/**
- * The weapon slot.
+ * The legs slot.
*/
- public static final int WEAPON = 3;
+ public static final int LEGS = 7;
+
+ /**
+ * The hands slot.
+ */
+ public static final int HANDS = 9;
+
+ /**
+ * The feet slot.
+ */
+ public static final int FEET = 10;
+
+ /**
+ * The ring slot.
+ */
+ public static final int RING = 12;
+
+ /**
+ * The arrows slot.
+ */
+ public static final int ARROWS = 13;
/**
* Default private constructor to prevent instantiation;
diff --git a/src/org/apollo/game/model/Gender.java b/src/org/apollo/game/model/Gender.java
index bee56fc8..a22c650e 100644
--- a/src/org/apollo/game/model/Gender.java
+++ b/src/org/apollo/game/model/Gender.java
@@ -7,15 +7,15 @@ package org.apollo.game.model;
*/
public enum Gender {
- /**
- * The female gender.
- */
- FEMALE(1),
-
/**
* The male gender.
*/
- MALE(0);
+ MALE(0),
+
+ /**
+ * The female gender.
+ */
+ FEMALE(1);
/**
* An integer representation used by the client.
diff --git a/src/org/apollo/game/model/Inventory.java b/src/org/apollo/game/model/Inventory.java
index 21d0663b..126b19e0 100644
--- a/src/org/apollo/game/model/Inventory.java
+++ b/src/org/apollo/game/model/Inventory.java
@@ -73,7 +73,6 @@ public final class Inventory implements Cloneable {
* Creates an inventory.
*
* @param capacity The capacity.
- * @throws IllegalArgumentException If the capacity is negative.
*/
public Inventory(int capacity) {
this(capacity, StackMode.STACK_STACKABLE_ITEMS);
@@ -83,7 +82,7 @@ public final class Inventory implements Cloneable {
* Creates an inventory.
*
* @param capacity The capacity.
- * @param mode The stacking mode.
+ * @param mode The {@link StackMode}.
* @throws IllegalArgumentException If the capacity is negative.
* @throws NullPointerException If the mode is {@code null}.
*/
@@ -92,7 +91,7 @@ public final class Inventory implements Cloneable {
throw new IllegalArgumentException("capacity cannot be negative");
}
if (mode == null) {
- throw new NullPointerException("mode");
+ throw new NullPointerException("stacking mode cannot be null");
}
this.capacity = capacity;
items = new Item[capacity];
@@ -195,9 +194,9 @@ public final class Inventory implements Cloneable {
}
/**
- * Adds a listener.
+ * Adds an {@link InventoryListener}.
*
- * @param listener The listener to add.
+ * @param listener The listener.
*/
public void addListener(InventoryListener listener) {
listeners.add(listener);
@@ -298,7 +297,6 @@ public final class Inventory implements Cloneable {
*
* @param slot The slot.
* @return The item, or {@code null} if the slot is empty.
- * @throws IndexOutOfBoundsException If the slot is out of bounds.
*/
public Item get(int slot) {
checkBounds(slot);
@@ -447,7 +445,6 @@ public final class Inventory implements Cloneable {
*
* @param slot
* @return The item that was in the slot.
- * @throws IndexOutOfBoundsException If the slot is out of bounds.
*/
public Item reset(int slot) {
checkBounds(slot);
@@ -467,7 +464,6 @@ public final class Inventory implements Cloneable {
* @param slot The slot.
* @param item The item, or {@code null} to remove the item that is in the slot.
* @return The item that was in the slot.
- * @throws IndexOutOfBoundsException If the slot is out of bounds.
*/
public Item set(int slot, Item item) {
if (item == null) {
@@ -529,7 +525,6 @@ public final class Inventory implements Cloneable {
* @param insert If the swap should be done in insertion mode.
* @param oldSlot The old slot.
* @param newSlot The new slot.
- * @throws IndexOutOfBoundsException If the slot is out of bounds.
*/
public void swap(boolean insert, int oldSlot, int newSlot) {
checkBounds(oldSlot);
@@ -543,13 +538,14 @@ public final class Inventory implements Cloneable {
for (int slot = oldSlot; slot > newSlot; slot--) {
swap(slot, slot - 1);
}
- } // else no change is required - aren't we lucky?
+ }
forceRefresh();
} else {
- Item temp = items[oldSlot];
+ Item tmp = items[oldSlot];
items[oldSlot] = items[newSlot];
- items[newSlot] = temp;
- notifyItemsUpdated(); // TODO can we just fire for the two slots?
+ items[newSlot] = tmp;
+ notifyItemUpdated(oldSlot);
+ notifyItemUpdated(newSlot);
}
}
@@ -558,10 +554,9 @@ public final class Inventory implements Cloneable {
*
* @param oldSlot The old slot.
* @param newSlot The new slot.
- * @throws IndexOutOufBoundsException If the slot is out of bounds.
*/
public void swap(int oldSlot, int newSlot) {
swap(false, oldSlot, newSlot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/Item.java b/src/org/apollo/game/model/Item.java
index 3274bfd3..639ff5db 100644
--- a/src/org/apollo/game/model/Item.java
+++ b/src/org/apollo/game/model/Item.java
@@ -75,4 +75,4 @@ public final class Item {
return Item.class.getName() + " [id=" + id + ", amount=" + amount + "]";
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/Mob.java b/src/org/apollo/game/model/Mob.java
index 7dfa5319..c99f4d94 100644
--- a/src/org/apollo/game/model/Mob.java
+++ b/src/org/apollo/game/model/Mob.java
@@ -4,13 +4,12 @@ import java.util.ArrayList;
import java.util.List;
import org.apollo.game.action.Action;
-import org.apollo.game.event.Event;
import org.apollo.game.model.Inventory.StackMode;
import org.apollo.game.model.def.NpcDefinition;
import org.apollo.game.scheduling.impl.SkillNormalizationTask;
import org.apollo.game.sync.block.SynchronizationBlock;
import org.apollo.game.sync.block.SynchronizationBlockSet;
-import org.apollo.util.CharacterRepository;
+import org.apollo.util.MobRepository;
/**
* A {@link Mob} is a living entity in the world, such as a player or NPC.
@@ -20,95 +19,80 @@ import org.apollo.util.CharacterRepository;
public abstract class Mob extends Entity {
/**
- * The character's current action.
+ * This mob's current action.
*/
private Action> action;
/**
- * The character's bank.
+ * This mob's set of {@link SynchronizationBlock}s.
*/
- private final Inventory bank = new Inventory(InventoryConstants.BANK_CAPACITY, StackMode.STACK_ALWAYS);
+ protected SynchronizationBlockSet blockSet = new SynchronizationBlockSet();
/**
- * A set of {@link SynchronizationBlock}s.
+ * This mob's {@link NpcDefinition). A {@link Player} only uses this if they are appearing as an npc in-game.
*/
- private SynchronizationBlockSet blockSet = new SynchronizationBlockSet();
+ protected NpcDefinition definition;
/**
- * The character's {@link NpcDefinition). This is only used by an instance of the {@link Player} class if they are
- * appearing as an npc in-game.
- */
- private NpcDefinition definition;
-
- /**
- * The character's equipment.
+ * This mob's equipment.
*/
private final Inventory equipment = new Inventory(InventoryConstants.EQUIPMENT_CAPACITY, StackMode.STACK_ALWAYS);
/**
- * The first direction.
+ * This mob's first movement {@link Direction}.
*/
private Direction firstDirection = Direction.NONE;
/**
- * The index of this character in the {@link CharacterRepository} it belongs to.
+ * The index of this mob in the {@link MobRepository} it belongs to.
*/
private int index = -1;
/**
- * The character's inventory.
+ * This mob's inventory.
*/
private final Inventory inventory = new Inventory(InventoryConstants.INVENTORY_CAPACITY);
/**
- * The list of local npcs.
+ * This mob's {@link List} of local npcs.
*/
private final List localNpcs = new ArrayList();
/**
- * A list of local players.
+ * This mob's {@link List} of local players.
*/
private final List localPlayers = new ArrayList();
/**
- * The second direction.
+ * This mob's second movement direction.
*/
private Direction secondDirection = Direction.NONE;
/**
- * The character's skill set.
+ * This mob's skill set.
*/
private final SkillSet skillSet = new SkillSet();
/**
- * Teleportation flag.
+ * Indicates whether this mob is currently teleporting or not.
*/
private boolean teleporting = false;
/**
- * The walking queue.
+ * This mob's walking queue.
*/
private final WalkingQueue walkingQueue = new WalkingQueue(this);
/**
- * Creates a new character with the specified initial position.
+ * Creates a new mob with the specified initial {@link Position}.
*
- * @param position The initial position of this character.
+ * @param position The initial position.
*/
public Mob(Position position) {
this.position = position;
init();
}
- /**
- * Gets the character's bank.
- *
- * @return The character's bank.
- */
- public Inventory getBank() {
- return bank;
- }
-
/**
* Gets the {@link SynchronizationBlockSet}.
*
@@ -118,6 +102,19 @@ public abstract class Mob extends Entity {
return blockSet;
}
+ /**
+ * Deals damage to this mob.
+ *
+ * @param damage The damage dealt.
+ * @param type The type of damage.
+ * @param secondary Whether this should be dealt as a secondary hit or not.
+ */
+ public void damage(int damage, int type, boolean secondary) {
+ Skill hitpoints = skillSet.getSkill(Skill.HITPOINTS);
+ blockSet.add(SynchronizationBlock.createHitUpdateBlock(damage, type, hitpoints.getCurrentLevel(),
+ hitpoints.getMaximumLevel(), secondary));
+ }
+
/**
* Gets the directions as an array.
*
@@ -132,27 +129,27 @@ public abstract class Mob extends Entity {
}
/**
- * Gets the character's equipment.
+ * Gets the mob's equipment.
*
- * @return The character's equipment.
+ * @return The mob's equipment.
*/
public Inventory getEquipment() {
return equipment;
}
/**
- * Gets the first direction.
+ * Gets the first {@link Direction}.
*
- * @return The first direction.
+ * @return The direction.
*/
public Direction getFirstDirection() {
return firstDirection;
}
/**
- * Gets the index of this character.
+ * Gets the index of this mob.
*
- * @return The index of this character.
+ * @return The index.
*/
public int getIndex() {
synchronized (this) {
@@ -161,34 +158,34 @@ public abstract class Mob extends Entity {
}
/**
- * Gets the character's inventory.
+ * Gets the mob's inventory.
*
- * @return The character's inventory.
+ * @return The inventory.
*/
public Inventory getInventory() {
return inventory;
}
/**
- * Gets the local npc list.
+ * Gets the local npc {@link List}.
*
- * @return The local npc list.
+ * @return The list.
*/
public List getLocalNpcList() {
return localNpcs;
}
/**
- * Gets the local player list.
+ * Gets the local player {@link List}.
*
- * @return The local player list.
+ * @return The list.
*/
public List getLocalPlayerList() {
return localPlayers;
}
/**
- * Gets this character's {@link NpcDefinition}.
+ * Gets this mob's {@link NpcDefinition}.
*
* @param definition The definition.
*/
@@ -196,31 +193,26 @@ public abstract class Mob extends Entity {
return definition;
}
- @Override
- public Position getPosition() {
- return position;
- }
-
/**
- * Gets the second direction.
+ * Gets the second {@link Direction}.
*
- * @return The second direction.
+ * @return The direction.
*/
public Direction getSecondDirection() {
return secondDirection;
}
/**
- * Gets the character's skill set.
+ * Gets this mob's {@link SkillSet}.
*
- * @return The character's skill set.
+ * @return The skill set.
*/
public SkillSet getSkillSet() {
return skillSet;
}
/**
- * Gets the walking queue.
+ * Gets the {@link WalkingQueue}.
*
* @return The walking queue.
*/
@@ -229,14 +221,14 @@ public abstract class Mob extends Entity {
}
/**
- * Initialises this character.
+ * Initialises this mob.
*/
private void init() {
World.getWorld().schedule(new SkillNormalizationTask(this));
}
/**
- * Checks if this character is active.
+ * Checks if this mob is active.
*
* @return {@code true} if so, {@code false} if not.
*/
@@ -245,7 +237,7 @@ public abstract class Mob extends Entity {
}
/**
- * Checks if this player is currently teleporting.
+ * Checks if this mob is currently teleporting.
*
* @return {@code true} if so, {@code false} if not.
*/
@@ -254,7 +246,7 @@ public abstract class Mob extends Entity {
}
/**
- * Plays the specified animation.
+ * Plays the specified {@link Animation}.
*
* @param animation The animation.
*/
@@ -263,7 +255,7 @@ public abstract class Mob extends Entity {
}
/**
- * Plays the specified graphic.
+ * Plays the specified {@link Graphic}.
*
* @param graphic The graphic.
*/
@@ -279,18 +271,7 @@ public abstract class Mob extends Entity {
}
/**
- * Sends an {@link Event} to either:
- *
- * - The client if this {@link Mob} is a {@link Player}.
- * - The AI routines if this {@link Mob} is an NPC
- *
- *
- * @param event The event.
- */
- public abstract void send(Event event);
-
- /**
- * Sets this character's {@link NpcDefinition}.
+ * Sets this mob's {@link NpcDefinition}.
*
* @param definition The definition.
*/
@@ -299,7 +280,7 @@ public abstract class Mob extends Entity {
}
/**
- * Sets the next directions for this character.
+ * Sets the next directions for this mob.
*
* @param first The first direction.
* @param second The second direction.
@@ -310,9 +291,9 @@ public abstract class Mob extends Entity {
}
/**
- * Sets the index of this character.
+ * Sets the index of this mob.
*
- * @param index The index of this character.
+ * @param index The index.
*/
public void setIndex(int index) {
synchronized (this) {
@@ -321,18 +302,29 @@ public abstract class Mob extends Entity {
}
/**
- * Sets the position of this character.
+ * Sets the position of this mob.
*
- * @param position The position of this character.
+ * @param position The position.
*/
public void setPosition(Position position) {
this.position = position;
}
/**
- * Sets the teleporting flag.
+ * Forces this mob to shout a message. Note that messages can only be shown in the chat box if they are said by a
+ * player.
*
- * @param teleporting {@code true} if the player is teleporting, {@code false} if not.
+ * @param message The message.
+ * @param chatBox If the message should be shown in the player's chat box.
+ */
+ public void shout(String message, boolean chatBox) {
+ blockSet.add(SynchronizationBlock.createForceChatBlock(message));
+ }
+
+ /**
+ * Sets whether this mob is teleporting or not.
+ *
+ * @param teleporting {@code true} if the mob is teleporting, {@code false} if not.
*/
public void setTeleporting(boolean teleporting) {
this.teleporting = teleporting;
@@ -366,21 +358,22 @@ public abstract class Mob extends Entity {
}
/**
- * Stops the current animation.
+ * Stops the current {@link Animation}.
*/
public void stopAnimation() {
playAnimation(Animation.STOP_ANIMATION);
}
/**
- * Stops the current graphic.
+ * Stops the current {@link Graphic}.
*/
public void stopGraphic() {
playGraphic(Graphic.STOP_GRAPHIC);
}
/**
- * Teleports this character to the specified position, setting the appropriate flags and clearing the walking queue.
+ * Teleports this mob to the specified {@link Position}, setting the appropriate flags and clearing the walking
+ * queue.
*
* @param position The position.
*/
@@ -388,11 +381,11 @@ public abstract class Mob extends Entity {
teleporting = true;
this.position = position;
walkingQueue.clear();
- stopAction(); // TODO do it on any movement is a must.. walking queue perhaps?
+ stopAction(); // TODO do it on any movement is a must... walking queue perhaps?
}
/**
- * Turns the character to face the specified position.
+ * Turns the mob to face the specified {@link Position}.
*
* @param position The position to face.
*/
@@ -401,12 +394,12 @@ public abstract class Mob extends Entity {
}
/**
- * Updates the character's interacting character.
+ * Updates this mob's interacting mob.
*
- * @param index The index of the interacting character.
+ * @param index The index of the interacting mob.
*/
- public void updateInteractingCharacter(int index) {
- blockSet.add(SynchronizationBlock.createInteractingCharacterBlock(index));
+ public void updateInteractingMob(int index) {
+ blockSet.add(SynchronizationBlock.createInteractingMobBlock(index));
}
}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/Npc.java b/src/org/apollo/game/model/Npc.java
index 7aaeedde..6cd54223 100644
--- a/src/org/apollo/game/model/Npc.java
+++ b/src/org/apollo/game/model/Npc.java
@@ -1,19 +1,14 @@
package org.apollo.game.model;
-import org.apollo.game.event.Event;
import org.apollo.game.model.def.NpcDefinition;
+import org.apollo.game.sync.block.SynchronizationBlock;
/**
* An {@link Npc} is a {@link Mob} that is not being controlled by a player.
*
* @author Major
*/
-public class Npc extends Mob {
-
- /**
- * This npc's definition.
- */
- private final NpcDefinition definition;
+public final class Npc extends Mob {
/**
* Creates a new npc with the specified id and {@link Position}.
@@ -36,23 +31,31 @@ public class Npc extends Mob {
this.definition = definition;
}
+ /**
+ * Gets the id of this npc. Shorthand for {@link #getDefinition().getId()}.
+ *
+ * @return The id.
+ */
+ public int getId() {
+ return definition.getId();
+ }
+
+ /**
+ * Transforms this npc into the npc with the specified id.
+ *
+ * @param id The id.
+ */
+ public void transform(int id) {
+ if (id < 0 || id > NpcDefinition.count()) {
+ throw new IllegalArgumentException("id to transform to is out of bounds");
+ }
+ definition = NpcDefinition.lookup(id);
+ blockSet.add(SynchronizationBlock.createTransformBlock(id));
+ }
+
@Override
public EntityType getEntityType() {
return EntityType.NPC;
}
- /**
- * Gets this npc's {@link NpcDefinition}
- *
- * @return The definition.
- */
- @Override
- public NpcDefinition getNpcDefinition() {
- return definition;
- }
-
- @Override
- public void send(Event event) {
- }
-
}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/Player.java b/src/org/apollo/game/model/Player.java
index c0178167..5c8bf896 100644
--- a/src/org/apollo/game/model/Player.java
+++ b/src/org/apollo/game/model/Player.java
@@ -12,6 +12,7 @@ import org.apollo.game.event.impl.ServerMessageEvent;
import org.apollo.game.event.impl.SetWidgetTextEvent;
import org.apollo.game.event.impl.SwitchTabInterfaceEvent;
import org.apollo.game.event.impl.UpdateRunEnergyEvent;
+import org.apollo.game.model.Inventory.StackMode;
import org.apollo.game.model.inter.InterfaceConstants;
import org.apollo.game.model.inter.InterfaceSet;
import org.apollo.game.model.inter.bank.BankConstants;
@@ -102,20 +103,25 @@ public final class Player extends Mob {
*/
private Appearance appearance = Appearance.DEFAULT_APPEARANCE;
+ /**
+ * This player's bank.
+ */
+ private final Inventory bank = new Inventory(InventoryConstants.BANK_CAPACITY, StackMode.STACK_ALWAYS);
+
/**
* A {@link List} of this player's mouse clicks.
*/
private Deque clicks = new ArrayDeque();
/**
- * The player's credentials.
+ * This player's credentials.
*/
private PlayerCredentials credentials;
/**
- * A flag indicating if the player has designed their character.
+ * A flag indicating if the player has designed their avatar.
*/
- private boolean designedCharacter = false;
+ private boolean designedAvatar = false;
/**
* A flag which indicates there are npcs that couldn't be added.
@@ -150,7 +156,7 @@ public final class Player extends Mob {
/**
* This player's prayer icon.
*/
- private int prayerIcon = -1;
+ private int prayerIcon = 0;
/**
* The privilege level.
@@ -246,6 +252,15 @@ public final class Player extends Mob {
return appearance;
}
+ /**
+ * Gets the mob's bank.
+ *
+ * @return The bank.
+ */
+ public Inventory getBank() {
+ return bank;
+ }
+
/**
* Gets the {@link Deque} of clicks.
*
@@ -369,12 +384,12 @@ public final class Player extends Mob {
}
/**
- * Checks if the player has designed their character.
+ * Checks if the player has designed their avatar.
*
- * @return A flag indicating if the player has designed their character.
+ * @return A flag indicating if the player has designed their avatar.
*/
- public boolean hasDesignedCharacter() {
- return designedCharacter;
+ public boolean hasDesignedAvatar() {
+ return designedAvatar;
}
/**
@@ -424,8 +439,6 @@ public final class Player extends Mob {
InventoryListener fullInventoryListener = new FullInventoryListener(this,
FullInventoryListener.FULL_INVENTORY_MESSAGE);
InventoryListener fullBankListener = new FullInventoryListener(this, FullInventoryListener.FULL_BANK_MESSAGE);
- InventoryListener fullEquipmentListener = new FullInventoryListener(this,
- FullInventoryListener.FULL_EQUIPMENT_MESSAGE);
// equipment appearance listener
InventoryListener appearanceListener = new AppearanceInventoryListener(this);
@@ -444,7 +457,6 @@ public final class Player extends Mob {
bank.addListener(fullBankListener);
equipment.addListener(syncEquipmentListener);
equipment.addListener(appearanceListener);
- equipment.addListener(fullEquipmentListener);
}
/**
@@ -530,7 +542,11 @@ public final class Player extends Mob {
viewingDistance = 1;
}
- @Override
+ /**
+ * Sends an {@link Event} to this player.
+ *
+ * @param event The event.
+ */
public void send(Event event) {
if (isActive()) {
if (!queuedEvents.isEmpty()) {
@@ -552,8 +568,8 @@ public final class Player extends Mob {
send(new IdAssignmentEvent(getIndex(), members)); // TODO should this be sent when we reconnect?
sendMessage("Welcome to RuneScape.");
- if (!designedCharacter) {
- interfaceSet.openWindow(InterfaceConstants.CHARACTER_DESIGN);
+ if (!designedAvatar) {
+ interfaceSet.openWindow(InterfaceConstants.AVATAR_DESIGN);
}
int[] tabs = InterfaceConstants.DEFAULT_INVENTORY_TABS;
@@ -569,7 +585,7 @@ public final class Player extends Mob {
}
/**
- * Sends a message to the character.
+ * Sends a message to the player.
*
* @param message The message.
*/
@@ -605,12 +621,12 @@ public final class Player extends Mob {
}
/**
- * Sets the character design flag.
+ * Sets the design flag.
*
- * @param designedCharacter A flag indicating if the character has been designed.
+ * @param designed A flag indicating if the player has been designed.
*/
- public void setDesignedCharacter(boolean designedCharacter) {
- this.designedCharacter = designedCharacter;
+ public void setDesigned(boolean designed) {
+ this.designedAvatar = designed;
}
/**
@@ -700,9 +716,14 @@ public final class Player extends Mob {
this.withdrawingNotes = withdrawingNotes;
}
+ @Override
+ public void shout(String message, boolean chatBox) {
+ blockSet.add(SynchronizationBlock.createForceChatBlock(chatBox ? '~' + message : message));
+ }
+
@Override
public void teleport(Position position) {
- super.teleport(position); // TODO put this in the same place as Character#teleport and WalkEventHandler!!
+ super.teleport(position);
if (interfaceSet.size() > 0) {
interfaceSet.close();
}
diff --git a/src/org/apollo/game/model/SkillSet.java b/src/org/apollo/game/model/SkillSet.java
index 962dca47..206605b8 100644
--- a/src/org/apollo/game/model/SkillSet.java
+++ b/src/org/apollo/game/model/SkillSet.java
@@ -48,8 +48,8 @@ public final class SkillSet {
* @return The minimum level.
*/
public static int getLevelForExperience(double experience) {
- int points = 0;
- int output = 0;
+ int points = 0, output = 0;
+
for (int lvl = 1; lvl <= 99; lvl++) {
points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
output = (int) Math.floor(points / 4);
@@ -110,22 +110,21 @@ public final class SkillSet {
setSkill(id, new Skill(newExperience, newCurrentLevel, newMaximumLevel));
if (delta > 0) {
- // here so it notifies using the updated skill
- notifyLevelledUp(id);
+ notifyLevelledUp(id); // here so it notifies using the updated skill
}
}
/**
- * Adds a listener.
+ * Adds a {@link SkillListener} to this set.
*
- * @param listener The listener to add.
+ * @param listener The listener.
*/
public boolean addListener(SkillListener listener) {
return listeners.add(listener);
}
/**
- * Gets the combat level for this skill set.
+ * Calculates the combat level for this skill set.
*
* @return The combat level.
*/
@@ -138,15 +137,12 @@ public final class SkillSet {
int ranged = skills[Skill.RANGED].getMaximumLevel();
int magic = skills[Skill.MAGIC].getMaximumLevel();
- double combatLevel = (defence + hitpoints + Math.floor(prayer / 2)) * 0.25;
-
+ double base = (defence + hitpoints + Math.floor(prayer / 2)) * 0.25;
double melee = (attack + strength) * 0.325;
-
double range = ranged * 0.4875;
-
double mage = magic * 0.4875;
- this.combatLevel = (int) (combatLevel + Math.max(melee, Math.max(range, mage)));
+ this.combatLevel = (int) (base + Math.max(melee, Math.max(range, mage)));
}
/**
@@ -169,7 +165,7 @@ public final class SkillSet {
}
/**
- * Gets the combat level for this skill set.
+ * Gets the combat level of this skill set.
*
* @return The combat level.
*/
@@ -218,13 +214,10 @@ public final class SkillSet {
int cur = skills[id].getCurrentLevel();
int max = skills[id].getMaximumLevel();
- if (cur > max) {
- cur--;
- } else if (max > cur) {
- cur++;
- } else {
+ if (cur == max) {
continue;
}
+ cur += cur < max ? 1 : -1;
setSkill(id, new Skill(skills[id].getExperience(), cur, max));
}
@@ -270,14 +263,14 @@ public final class SkillSet {
}
/**
- * Removes all the listeners.
+ * Removes all the {@link SkillListener}s.
*/
public void removeAllListeners() {
listeners.clear();
}
/**
- * Removes a listener.
+ * Removes a {@link SkillListener}.
*
* @param listener The listener to remove.
*/
@@ -286,7 +279,7 @@ public final class SkillSet {
}
/**
- * Sets a skill.
+ * Sets a {@link Skill}.
*
* @param id The id.
* @param skill The skill.
@@ -298,7 +291,7 @@ public final class SkillSet {
}
/**
- * Gets the number of skills.
+ * Gets the number of {@link Skill}s in this set.
*
* @return The number of skills.
*/
@@ -307,7 +300,7 @@ public final class SkillSet {
}
/**
- * Re-enables the firing of events.
+ * Starts the firing of events.
*/
public void startFiringEvents() {
firingEvents = true;
diff --git a/src/org/apollo/game/model/WalkingQueue.java b/src/org/apollo/game/model/WalkingQueue.java
index caf618f4..7934abad 100644
--- a/src/org/apollo/game/model/WalkingQueue.java
+++ b/src/org/apollo/game/model/WalkingQueue.java
@@ -51,9 +51,9 @@ public final class WalkingQueue {
private static final int MAXIMUM_SIZE = 128;
/**
- * The character whose walking queue this is.
+ * The mob whose walking queue this is.
*/
- private final Mob character;
+ private final Mob mob;
/**
* The old queue of directions.
@@ -71,32 +71,32 @@ public final class WalkingQueue {
private boolean runningQueue;
/**
- * Creates a walking queue for the specified character.
+ * Creates a walking queue for the specified mob.
*
- * @param character The character.
+ * @param mob The mob.
*/
- public WalkingQueue(Mob character) {
- this.character = character;
+ public WalkingQueue(Mob mob) {
+ this.mob = mob;
}
/**
* Adds the first step to the queue, attempting to connect the server and client position by looking at the previous
* queue.
*
- * @param clientConnectionPosition The first step.
+ * @param clientPosition The first step.
* @return {@code true} if the queues could be connected correctly, {@code false} if not.
*/
- public boolean addFirstStep(Position clientConnectionPosition) {
- Position serverPosition = character.getPosition();
+ public boolean addFirstStep(Position clientPosition) {
+ Position serverPosition = mob.getPosition();
- int deltaX = clientConnectionPosition.getX() - serverPosition.getX();
- int deltaY = clientConnectionPosition.getY() - serverPosition.getY();
+ int deltaX = clientPosition.getX() - serverPosition.getX();
+ int deltaY = clientPosition.getY() - serverPosition.getY();
if (Direction.isConnectable(deltaX, deltaY)) {
points.clear();
oldPoints.clear();
- addStep(clientConnectionPosition);
+ addStep(clientPosition);
return true;
}
@@ -119,7 +119,7 @@ public final class WalkingQueue {
addStep(travelBackPosition);
}
- addStep(clientConnectionPosition);
+ addStep(clientPosition);
return true;
}
}
@@ -147,7 +147,7 @@ public final class WalkingQueue {
Direction direction = Direction.fromDeltas(deltaX, deltaY);
if (direction != Direction.NONE) {
- Point p = new Point(new Position(x, y, character.getPosition().getHeight()), direction);
+ Point p = new Point(new Position(x, y, mob.getPosition().getHeight()), direction);
points.add(p);
oldPoints.add(p);
}
@@ -202,7 +202,7 @@ public final class WalkingQueue {
private Point getLast() {
Point last = points.peekLast();
if (last == null) {
- return new Point(character.getPosition(), Direction.NONE);
+ return new Point(mob.getPosition(), Direction.NONE);
}
return last;
}
@@ -211,17 +211,18 @@ public final class WalkingQueue {
* Called every pulse, updates the queue.
*/
public void pulse() {
- Position position = character.getPosition();
+ Position position = mob.getPosition();
Direction first = Direction.NONE;
Direction second = Direction.NONE;
Point next = points.poll();
if (next != null) {
+ mob.stopAction();
first = next.direction;
position = next.position;
- if (runningQueue /* or run toggled AND enough energy */) {
+ if (runningQueue /* and enough energy */) {
next = points.poll();
if (next != null) {
second = next.direction;
@@ -230,8 +231,8 @@ public final class WalkingQueue {
}
}
- character.setDirections(first, second);
- character.setPosition(position);
+ mob.setDirections(first, second);
+ mob.setPosition(position);
}
/**
diff --git a/src/org/apollo/game/model/World.java b/src/org/apollo/game/model/World.java
index 0fcafb00..708e6387 100644
--- a/src/org/apollo/game/model/World.java
+++ b/src/org/apollo/game/model/World.java
@@ -26,13 +26,13 @@ import org.apollo.game.model.sector.SectorRepository;
import org.apollo.game.scheduling.ScheduledTask;
import org.apollo.game.scheduling.Scheduler;
import org.apollo.io.EquipmentDefinitionParser;
-import org.apollo.util.CharacterRepository;
+import org.apollo.util.MobRepository;
import org.apollo.util.plugin.PluginManager;
/**
- * The world class is a singleton which contains objects like the {@link CharacterRepository} for players and NPCs. It
- * should only contain things relevant to the in-game world and not classes which deal with I/O and such (these may be
- * better off inside some custom {@link Service} or other code, however, the circumstances are rare).
+ * The world class is a singleton which contains objects like the {@link MobRepository} for players and NPCs. It should
+ * only contain things relevant to the in-game world and not classes which deal with I/O and such (these may be better
+ * off inside some custom {@link Service} or other code, however, the circumstances are rare).
*
* @author Graham
*/
@@ -86,20 +86,14 @@ public final class World {
private final CommandDispatcher dispatcher = new CommandDispatcher();
/**
- * The {@link CharacterRepository} of {@link Npc}s.
+ * The {@link MobRepository} of {@link Npc}s.
*/
- private final CharacterRepository npcRepository = new CharacterRepository(WorldConstants.MAXIMUM_NPCS);
+ private final MobRepository npcRepository = new MobRepository(WorldConstants.MAXIMUM_NPCS);
/**
- * The {@link CharacterRepository} of {@link Player}s.
+ * The {@link MobRepository} of {@link Player}s.
*/
- private final CharacterRepository playerRepository = new CharacterRepository(
- WorldConstants.MAXIMUM_PLAYERS);
-
- /**
- * The release number (i.e. version) of this world.
- */
- private int releaseNumber;
+ private final MobRepository playerRepository = new MobRepository(WorldConstants.MAXIMUM_PLAYERS);
/**
* A {@link Map} of player usernames and the player objects.
@@ -111,6 +105,11 @@ public final class World {
*/
private PluginManager pluginManager;
+ /**
+ * The release number (i.e. version) of this world.
+ */
+ private int releaseNumber;
+
/**
* This world's {@link SectorRepository}.
*/
@@ -128,7 +127,7 @@ public final class World {
}
/**
- * Gets the command dispatcher. TODO should this be here?
+ * Gets the command dispatcher.
*
* @return The command dispatcher.
*/
@@ -141,7 +140,7 @@ public final class World {
*
* @return The npc repository.
*/
- public CharacterRepository getNpcRepository() {
+ public MobRepository getNpcRepository() {
return npcRepository;
}
@@ -156,14 +155,14 @@ public final class World {
}
/**
- * Gets the character repository.
+ * Gets the player repository.
*
* Note: players should be registered and unregistered using {@link World#register(Player)} and
* {@link World#unregister(Player)} respectively, not by adding to or removing from this repository directly.
*
- * @return The character repository.
+ * @return The player repository.
*/
- public CharacterRepository getPlayerRepository() {
+ public MobRepository getPlayerRepository() {
return playerRepository;
}
@@ -176,6 +175,15 @@ public final class World {
return pluginManager;
}
+ /**
+ * Gets the release number of this world.
+ *
+ * @return The release number.
+ */
+ public int getReleaseNumber() {
+ return releaseNumber;
+ }
+
/**
* Initialises the world by loading definitions from the specified file system.
*
@@ -288,15 +296,6 @@ public final class World {
return RegistrationStatus.WORLD_FULL;
}
- /**
- * Gets the release number of this world.
- *
- * @return The release number.
- */
- public int getReleaseNumber() {
- return releaseNumber;
- }
-
/**
* Schedules a new task.
*
diff --git a/src/org/apollo/game/model/def/package-info.java b/src/org/apollo/game/model/def/package-info.java
index 25517904..c214a056 100644
--- a/src/org/apollo/game/model/def/package-info.java
+++ b/src/org/apollo/game/model/def/package-info.java
@@ -2,5 +2,4 @@
* Contains definition classes which contain information about types of items,
* NPCs, etc.
*/
-package org.apollo.game.model.def;
-
+package org.apollo.game.model.def;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/EnterAmountListener.java b/src/org/apollo/game/model/inter/EnterAmountListener.java
index 003bb1e8..f954062f 100644
--- a/src/org/apollo/game/model/inter/EnterAmountListener.java
+++ b/src/org/apollo/game/model/inter/EnterAmountListener.java
@@ -14,4 +14,4 @@ public interface EnterAmountListener {
*/
public void amountEntered(int amount);
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/InterfaceConstants.java b/src/org/apollo/game/model/inter/InterfaceConstants.java
index 5088069d..e3dec1ca 100644
--- a/src/org/apollo/game/model/inter/InterfaceConstants.java
+++ b/src/org/apollo/game/model/inter/InterfaceConstants.java
@@ -8,9 +8,9 @@ package org.apollo.game.model.inter;
public class InterfaceConstants {
/**
- * The character design interface id.
+ * The avatar design interface id.
*/
- public static final int CHARACTER_DESIGN = 3559;
+ public static final int AVATAR_DESIGN = 3559;
/**
* The default inventory tab ids.
diff --git a/src/org/apollo/game/model/inter/InterfaceListener.java b/src/org/apollo/game/model/inter/InterfaceListener.java
index 665f86bc..57342348 100644
--- a/src/org/apollo/game/model/inter/InterfaceListener.java
+++ b/src/org/apollo/game/model/inter/InterfaceListener.java
@@ -12,4 +12,4 @@ public interface InterfaceListener {
*/
public void interfaceClosed();
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/InterfaceSet.java b/src/org/apollo/game/model/inter/InterfaceSet.java
index b14a8d1a..be6f6520 100644
--- a/src/org/apollo/game/model/inter/InterfaceSet.java
+++ b/src/org/apollo/game/model/inter/InterfaceSet.java
@@ -63,7 +63,6 @@ public final class InterfaceSet {
*/
public void close() {
closeAndNotify();
-
player.send(new CloseInterfaceEvent());
}
diff --git a/src/org/apollo/game/model/inter/bank/BankConstants.java b/src/org/apollo/game/model/inter/bank/BankConstants.java
index 443c51c5..f5715911 100644
--- a/src/org/apollo/game/model/inter/bank/BankConstants.java
+++ b/src/org/apollo/game/model/inter/bank/BankConstants.java
@@ -34,4 +34,4 @@ public final class BankConstants {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/bank/BankDepositEnterAmountListener.java b/src/org/apollo/game/model/inter/bank/BankDepositEnterAmountListener.java
index 6f79b44a..5f23a9d0 100644
--- a/src/org/apollo/game/model/inter/bank/BankDepositEnterAmountListener.java
+++ b/src/org/apollo/game/model/inter/bank/BankDepositEnterAmountListener.java
@@ -45,4 +45,4 @@ public final class BankDepositEnterAmountListener implements EnterAmountListener
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/bank/BankInterfaceListener.java b/src/org/apollo/game/model/inter/bank/BankInterfaceListener.java
index 6bcaf737..5c3befb5 100644
--- a/src/org/apollo/game/model/inter/bank/BankInterfaceListener.java
+++ b/src/org/apollo/game/model/inter/bank/BankInterfaceListener.java
@@ -45,4 +45,4 @@ public final class BankInterfaceListener implements InterfaceListener {
player.getBank().removeListener(bankListener);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/bank/BankUtils.java b/src/org/apollo/game/model/inter/bank/BankUtils.java
index 66630547..647411ba 100644
--- a/src/org/apollo/game/model/inter/bank/BankUtils.java
+++ b/src/org/apollo/game/model/inter/bank/BankUtils.java
@@ -33,7 +33,6 @@ public final class BankUtils {
Inventory bank = player.getBank();
Item item = inventory.get(slot);
-
int newId = ItemDefinition.noteToItem(item.getId());
if (bank.freeSlots() == 0 && !bank.contains(item.getId())) {
@@ -126,10 +125,10 @@ public final class BankUtils {
}
/**
- * Default private constructor to prevent insantiation.
+ * Default private constructor to prevent instantiation.
*/
private BankUtils() {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/bank/BankWithdrawEnterAmountListener.java b/src/org/apollo/game/model/inter/bank/BankWithdrawEnterAmountListener.java
index 5365567d..3f6c6f2c 100644
--- a/src/org/apollo/game/model/inter/bank/BankWithdrawEnterAmountListener.java
+++ b/src/org/apollo/game/model/inter/bank/BankWithdrawEnterAmountListener.java
@@ -45,4 +45,4 @@ public final class BankWithdrawEnterAmountListener implements EnterAmountListene
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/bank/package-info.java b/src/org/apollo/game/model/inter/bank/package-info.java
index c3da0078..6a1cb43f 100644
--- a/src/org/apollo/game/model/inter/bank/package-info.java
+++ b/src/org/apollo/game/model/inter/bank/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains bank-related classes.
*/
-package org.apollo.game.model.inter.bank;
-
+package org.apollo.game.model.inter.bank;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inter/package-info.java b/src/org/apollo/game/model/inter/package-info.java
index 51b7f1bd..9ddf7a85 100644
--- a/src/org/apollo/game/model/inter/package-info.java
+++ b/src/org/apollo/game/model/inter/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains interface-related classes.
*/
-package org.apollo.game.model.inter;
-
+package org.apollo.game.model.inter;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inv/AppearanceInventoryListener.java b/src/org/apollo/game/model/inv/AppearanceInventoryListener.java
index 8109987e..1b42eea8 100644
--- a/src/org/apollo/game/model/inv/AppearanceInventoryListener.java
+++ b/src/org/apollo/game/model/inv/AppearanceInventoryListener.java
@@ -43,4 +43,4 @@ public final class AppearanceInventoryListener extends InventoryAdapter {
player.getBlockSet().add(SynchronizationBlock.createAppearanceBlock(player));
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inv/FullInventoryListener.java b/src/org/apollo/game/model/inv/FullInventoryListener.java
index 08961d98..46a50228 100644
--- a/src/org/apollo/game/model/inv/FullInventoryListener.java
+++ b/src/org/apollo/game/model/inv/FullInventoryListener.java
@@ -17,11 +17,6 @@ public final class FullInventoryListener extends InventoryAdapter {
*/
public static final String FULL_BANK_MESSAGE = "Not enough bank space.";
- /**
- * The equipment full message.
- */
- public static final String FULL_EQUIPMENT_MESSAGE = "Not enough equipment space."; // TODO confirm if possible
-
/**
* The inventory full message.
*/
@@ -53,4 +48,4 @@ public final class FullInventoryListener extends InventoryAdapter {
player.send(event);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inv/InventoryAdapter.java b/src/org/apollo/game/model/inv/InventoryAdapter.java
index 7e6f72f5..8c7c7634 100644
--- a/src/org/apollo/game/model/inv/InventoryAdapter.java
+++ b/src/org/apollo/game/model/inv/InventoryAdapter.java
@@ -12,17 +12,17 @@ public abstract class InventoryAdapter implements InventoryListener {
@Override
public void capacityExceeded(Inventory inventory) {
- /* empty */
+
}
@Override
public void itemsUpdated(Inventory inventory) {
- /* empty */
+
}
@Override
public void itemUpdated(Inventory inventory, int slot, Item item) {
- /* empty */
+
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inv/InventoryListener.java b/src/org/apollo/game/model/inv/InventoryListener.java
index 5d47f429..848a04a3 100644
--- a/src/org/apollo/game/model/inv/InventoryListener.java
+++ b/src/org/apollo/game/model/inv/InventoryListener.java
@@ -33,4 +33,4 @@ public interface InventoryListener {
*/
public void itemUpdated(Inventory inventory, int slot, Item item);
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inv/SynchronizationInventoryListener.java b/src/org/apollo/game/model/inv/SynchronizationInventoryListener.java
index cb648b86..0c974726 100644
--- a/src/org/apollo/game/model/inv/SynchronizationInventoryListener.java
+++ b/src/org/apollo/game/model/inv/SynchronizationInventoryListener.java
@@ -55,4 +55,4 @@ public final class SynchronizationInventoryListener extends InventoryAdapter {
player.send(new UpdateSlottedItemsEvent(interfaceId, new SlottedItem(slot, item)));
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/inv/package-info.java b/src/org/apollo/game/model/inv/package-info.java
index 61061cba..e0fcda15 100644
--- a/src/org/apollo/game/model/inv/package-info.java
+++ b/src/org/apollo/game/model/inv/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains inventory listeners.
*/
-package org.apollo.game.model.inv;
-
+package org.apollo.game.model.inv;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/obj/package-info.java b/src/org/apollo/game/model/obj/package-info.java
index b5a38dd4..f758d422 100644
--- a/src/org/apollo/game/model/obj/package-info.java
+++ b/src/org/apollo/game/model/obj/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains models related to in-game objects.
*/
-package org.apollo.game.model.obj;
-
+package org.apollo.game.model.obj;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/package-info.java b/src/org/apollo/game/model/package-info.java
index 9756ce4c..109e9321 100644
--- a/src/org/apollo/game/model/package-info.java
+++ b/src/org/apollo/game/model/package-info.java
@@ -2,5 +2,4 @@
* Contains classes which represent things in the in-game world such as items,
* players and NPCs.
*/
-package org.apollo.game.model;
-
+package org.apollo.game.model;
\ No newline at end of file
diff --git a/src/org/apollo/game/model/skill/SkillAdapter.java b/src/org/apollo/game/model/skill/SkillAdapter.java
index 73df8e4a..cb30ba55 100644
--- a/src/org/apollo/game/model/skill/SkillAdapter.java
+++ b/src/org/apollo/game/model/skill/SkillAdapter.java
@@ -12,17 +12,17 @@ public abstract class SkillAdapter implements SkillListener {
@Override
public void levelledUp(SkillSet set, int id, Skill skill) {
- /* empty */
+
}
@Override
public void skillsUpdated(SkillSet set) {
- /* empty */
+
}
@Override
public void skillUpdated(SkillSet set, int id, Skill skill) {
- /* empty */
+
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/skill/SkillListener.java b/src/org/apollo/game/model/skill/SkillListener.java
index e8b94550..9ef30779 100644
--- a/src/org/apollo/game/model/skill/SkillListener.java
+++ b/src/org/apollo/game/model/skill/SkillListener.java
@@ -11,28 +11,28 @@ import org.apollo.game.model.SkillSet;
public interface SkillListener {
/**
- * Called when a skill is levelled up.
+ * Called when a {@link Skill} is levelled up.
*
- * @param set The skill set.
+ * @param set The {@link SkillSet}.
* @param id The skill's id.
* @param skill The skill.
*/
public void levelledUp(SkillSet set, int id, Skill skill);
/**
- * Called when all the skills are updated.
+ * Called when all {@link Skill}s are updated.
*
- * @param set The skill set.
+ * @param set The {@link SkillSet}.
*/
public void skillsUpdated(SkillSet set);
/**
- * Called when a single skill is updated.
+ * Called when a single {@link Skill} is updated.
*
- * @param set The skill set.
+ * @param set The {@link SkillSet}.
* @param id The skill's id.
* @param skill The skill.
*/
public void skillUpdated(SkillSet set, int id, Skill skill);
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/skill/SynchronizationSkillListener.java b/src/org/apollo/game/model/skill/SynchronizationSkillListener.java
index 7ceacf68..3c1c23c5 100644
--- a/src/org/apollo/game/model/skill/SynchronizationSkillListener.java
+++ b/src/org/apollo/game/model/skill/SynchronizationSkillListener.java
@@ -44,4 +44,4 @@ public final class SynchronizationSkillListener extends SkillAdapter {
player.send(new UpdateSkillEvent(id, skill));
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/model/skill/package-info.java b/src/org/apollo/game/model/skill/package-info.java
index 6a08b997..b2e40ef1 100644
--- a/src/org/apollo/game/model/skill/package-info.java
+++ b/src/org/apollo/game/model/skill/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains skill listeners.
*/
-package org.apollo.game.model.skill;
-
+package org.apollo.game.model.skill;
\ No newline at end of file
diff --git a/src/org/apollo/game/package-info.java b/src/org/apollo/game/package-info.java
index f72c44ca..9c09a593 100644
--- a/src/org/apollo/game/package-info.java
+++ b/src/org/apollo/game/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to the game server.
*/
-package org.apollo.game;
-
+package org.apollo.game;
\ No newline at end of file
diff --git a/src/org/apollo/game/scheduling/ScheduledTask.java b/src/org/apollo/game/scheduling/ScheduledTask.java
index 93ecabd1..776f70af 100644
--- a/src/org/apollo/game/scheduling/ScheduledTask.java
+++ b/src/org/apollo/game/scheduling/ScheduledTask.java
@@ -79,4 +79,4 @@ public abstract class ScheduledTask {
running = false;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/scheduling/impl/SkillNormalizationTask.java b/src/org/apollo/game/scheduling/impl/SkillNormalizationTask.java
index c5838229..5881c0ee 100644
--- a/src/org/apollo/game/scheduling/impl/SkillNormalizationTask.java
+++ b/src/org/apollo/game/scheduling/impl/SkillNormalizationTask.java
@@ -12,27 +12,27 @@ import org.apollo.game.scheduling.ScheduledTask;
public final class SkillNormalizationTask extends ScheduledTask {
/**
- * The character.
+ * The mob.
*/
- private final Mob character;
+ private final Mob mob;
/**
* Creates the skill normalization task.
*
- * @param character The character.
+ * @param mob The mob.
*/
- public SkillNormalizationTask(Mob character) {
+ public SkillNormalizationTask(Mob mob) {
super(100, false);
- this.character = character;
+ this.mob = mob;
}
@Override
public void execute() {
- if (!character.isActive()) { // TODO is this check okay for this? an NPC could be temporarily removed from list
+ if (!mob.isActive()) {
stop();
} else {
- character.getSkillSet().normalize();
+ mob.getSkillSet().normalize();
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/scheduling/impl/package-info.java b/src/org/apollo/game/scheduling/impl/package-info.java
index cc41bb35..0eff5981 100644
--- a/src/org/apollo/game/scheduling/impl/package-info.java
+++ b/src/org/apollo/game/scheduling/impl/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains scheduled task implementations.
*/
-package org.apollo.game.scheduling.impl;
-
+package org.apollo.game.scheduling.impl;
\ No newline at end of file
diff --git a/src/org/apollo/game/scheduling/package-info.java b/src/org/apollo/game/scheduling/package-info.java
index 5b08e429..6fe54d13 100644
--- a/src/org/apollo/game/scheduling/package-info.java
+++ b/src/org/apollo/game/scheduling/package-info.java
@@ -2,5 +2,4 @@
* Contains classes related to scheduling which allow tasks to be executed in
* future pulses periodically.
*/
-package org.apollo.game.scheduling;
-
+package org.apollo.game.scheduling;
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/ClientSynchronizer.java b/src/org/apollo/game/sync/ClientSynchronizer.java
index 6e3f6dff..eb96fc98 100644
--- a/src/org/apollo/game/sync/ClientSynchronizer.java
+++ b/src/org/apollo/game/sync/ClientSynchronizer.java
@@ -19,4 +19,4 @@ public abstract class ClientSynchronizer {
*/
public abstract void synchronize();
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/ParallelClientSynchronizer.java b/src/org/apollo/game/sync/ParallelClientSynchronizer.java
index 650594f6..7fec7686 100644
--- a/src/org/apollo/game/sync/ParallelClientSynchronizer.java
+++ b/src/org/apollo/game/sync/ParallelClientSynchronizer.java
@@ -17,7 +17,7 @@ import org.apollo.game.sync.task.PostPlayerSynchronizationTask;
import org.apollo.game.sync.task.PreNpcSynchronizationTask;
import org.apollo.game.sync.task.PrePlayerSynchronizationTask;
import org.apollo.game.sync.task.SynchronizationTask;
-import org.apollo.util.CharacterRepository;
+import org.apollo.util.MobRepository;
import org.apollo.util.NamedThreadFactory;
/**
@@ -54,8 +54,8 @@ public final class ParallelClientSynchronizer extends ClientSynchronizer {
@Override
public void synchronize() {
- CharacterRepository players = World.getWorld().getPlayerRepository();
- CharacterRepository npcs = World.getWorld().getNpcRepository();
+ MobRepository players = World.getWorld().getPlayerRepository();
+ MobRepository npcs = World.getWorld().getNpcRepository();
int playerCount = players.size();
int npcCount = npcs.size();
diff --git a/src/org/apollo/game/sync/SequentialClientSynchronizer.java b/src/org/apollo/game/sync/SequentialClientSynchronizer.java
index 60bac648..843291b8 100644
--- a/src/org/apollo/game/sync/SequentialClientSynchronizer.java
+++ b/src/org/apollo/game/sync/SequentialClientSynchronizer.java
@@ -11,7 +11,7 @@ import org.apollo.game.sync.task.PostPlayerSynchronizationTask;
import org.apollo.game.sync.task.PreNpcSynchronizationTask;
import org.apollo.game.sync.task.PrePlayerSynchronizationTask;
import org.apollo.game.sync.task.SynchronizationTask;
-import org.apollo.util.CharacterRepository;
+import org.apollo.util.MobRepository;
/**
* An implementation of {@link ClientSynchronizer} which runs in a single thread (the {@link GameService} thread from
@@ -26,8 +26,8 @@ public final class SequentialClientSynchronizer extends ClientSynchronizer {
@Override
public void synchronize() {
- CharacterRepository players = World.getWorld().getPlayerRepository();
- CharacterRepository npcs = World.getWorld().getNpcRepository();
+ MobRepository players = World.getWorld().getPlayerRepository();
+ MobRepository npcs = World.getWorld().getNpcRepository();
for (Player player : players) {
SynchronizationTask task = new PrePlayerSynchronizationTask(player);
diff --git a/src/org/apollo/game/sync/block/AnimationBlock.java b/src/org/apollo/game/sync/block/AnimationBlock.java
index 7cb723bb..a4740b90 100644
--- a/src/org/apollo/game/sync/block/AnimationBlock.java
+++ b/src/org/apollo/game/sync/block/AnimationBlock.java
@@ -10,7 +10,7 @@ import org.apollo.game.model.Animation;
public final class AnimationBlock extends SynchronizationBlock {
/**
- * The animation.
+ * The {@link Animation}.
*/
private final Animation animation;
@@ -24,7 +24,7 @@ public final class AnimationBlock extends SynchronizationBlock {
}
/**
- * Gets the animation.
+ * Gets the {@link Animation}.
*
* @return The animation.
*/
@@ -32,4 +32,4 @@ public final class AnimationBlock extends SynchronizationBlock {
return animation;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/block/AppearanceBlock.java b/src/org/apollo/game/sync/block/AppearanceBlock.java
index 042d8229..cba7405d 100644
--- a/src/org/apollo/game/sync/block/AppearanceBlock.java
+++ b/src/org/apollo/game/sync/block/AppearanceBlock.java
@@ -53,11 +53,12 @@ public final class AppearanceBlock extends SynchronizationBlock {
/**
* Creates the appearance block.
*
- * @param name The player's name.
+ * @param name The player's username.
* @param appearance The appearance.
* @param combat The player's combat.
* @param skill The player's skill, or 0 if showing the combat level.
* @param equipment The player's equipment.
+ * @param npcId The npc id of the player, if they are appearing as an npc (otherwise {@code -1}).
*/
AppearanceBlock(long name, Appearance appearance, int combat, int skill, Inventory equipment, int prayerIcon,
int headIcon, int npcId) {
diff --git a/src/org/apollo/game/sync/block/ChatBlock.java b/src/org/apollo/game/sync/block/ChatBlock.java
index 9247c088..aeb8d428 100644
--- a/src/org/apollo/game/sync/block/ChatBlock.java
+++ b/src/org/apollo/game/sync/block/ChatBlock.java
@@ -11,12 +11,12 @@ import org.apollo.game.model.Player.PrivilegeLevel;
public final class ChatBlock extends SynchronizationBlock {
/**
- * The chat event.
+ * The {@link ChatEvent}.
*/
private final ChatEvent chatEvent;
/**
- * The privilege level.
+ * The {@link PrivilegeLevel}.
*/
private final PrivilegeLevel privilegeLevel;
diff --git a/src/org/apollo/game/sync/block/ForceChatBlock.java b/src/org/apollo/game/sync/block/ForceChatBlock.java
index b365d412..8382e64a 100644
--- a/src/org/apollo/game/sync/block/ForceChatBlock.java
+++ b/src/org/apollo/game/sync/block/ForceChatBlock.java
@@ -2,8 +2,8 @@ package org.apollo.game.sync.block;
/**
* The Force Chat {@link SynchronizationBlock}. This is a block that can be implemented in both player and npc
- * synchronization tasks, and will cause the character to shout the specified text. It is not possible to add colour or
- * effect (e.g. wave or scroll) to this block.
+ * synchronization tasks, and will cause the mob to shout the specified text. It is not possible to add colour or effect
+ * (e.g. wave or scroll) to this block.
*
* @author Major
*/
@@ -17,7 +17,7 @@ public class ForceChatBlock extends SynchronizationBlock {
/**
* Creates a new force chat [@link SynchronizationBlock}.
*
- * @param message The message the character will say.
+ * @param message The message the mob will say.
*/
public ForceChatBlock(String message) {
this.message = message;
diff --git a/src/org/apollo/game/sync/block/ForceMovementBlock.java b/src/org/apollo/game/sync/block/ForceMovementBlock.java
index 693c54db..7adf42f5 100644
--- a/src/org/apollo/game/sync/block/ForceMovementBlock.java
+++ b/src/org/apollo/game/sync/block/ForceMovementBlock.java
@@ -48,8 +48,8 @@ public class ForceMovementBlock extends SynchronizationBlock {
* @param travelDurationY The length of time (in game pulses) the player's movement along the Y axis will last.
* @param direction The direction the player should move.
*/
- public ForceMovementBlock(Position initialPosition, Position finalPosition, int travelDurationX,
- int travelDurationY, Direction direction) {
+ ForceMovementBlock(Position initialPosition, Position finalPosition, int travelDurationX, int travelDurationY,
+ Direction direction) {
this.initialPosition = initialPosition;
this.finalPosition = finalPosition;
this.travelDurationX = travelDurationX;
diff --git a/src/org/apollo/game/sync/block/GraphicBlock.java b/src/org/apollo/game/sync/block/GraphicBlock.java
index 2f62c595..5f643142 100644
--- a/src/org/apollo/game/sync/block/GraphicBlock.java
+++ b/src/org/apollo/game/sync/block/GraphicBlock.java
@@ -32,4 +32,4 @@ public final class GraphicBlock extends SynchronizationBlock {
return graphic;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/block/HitUpdateBlock.java b/src/org/apollo/game/sync/block/HitUpdateBlock.java
index fd998b40..cf0aae47 100644
--- a/src/org/apollo/game/sync/block/HitUpdateBlock.java
+++ b/src/org/apollo/game/sync/block/HitUpdateBlock.java
@@ -1,15 +1,14 @@
package org.apollo.game.sync.block;
/**
- * The Hit Update {@link SynchronizationBlock}. This is a simple implementation designed so that you can integrate it
- * easily with your combat system. Both npcs and players can implement this block.
+ * The hit update {@link SynchronizationBlock}. Both npcs and players can implement this block.
*
* @author Major
*/
public class HitUpdateBlock extends SynchronizationBlock {
/**
- * The {@link org.apollo.game.model.Mob}'s current health.
+ * The mob's current health.
*/
private final int currentHealth;
@@ -19,7 +18,7 @@ public class HitUpdateBlock extends SynchronizationBlock {
private final int damage;
/**
- * The {@link org.apollo.game.model.Mob}'s maximum health.
+ * The mob's maximum health.
*/
private final int maximumHealth;
@@ -31,20 +30,20 @@ public class HitUpdateBlock extends SynchronizationBlock {
/**
* Creates a new Hit Update block.
*
- * @param hitDamage The damage dealt by the hit.
- * @param hitType The type of hit.
- * @param currentHealth The current health of the {@link org.apollo.game.model.Mob}.
- * @param maximumHealth The maximum health of the {@link org.apollo.game.model.Mob}.
+ * @param damage The damage dealt by the hit.
+ * @param type The type of hit.
+ * @param currentHealth The current health of the mob.
+ * @param maximumHealth The maximum health of the mob.
*/
- public HitUpdateBlock(int hitDamage, int hitType, int currentHealth, int maximumHealth) {
- damage = hitDamage;
- type = hitType;
+ HitUpdateBlock(int damage, int type, int currentHealth, int maximumHealth) {
+ this.damage = damage;
+ this.type = type;
this.currentHealth = currentHealth;
this.maximumHealth = maximumHealth;
}
/**
- * Gets the current health of the {@link org.apollo.game.model.Mob}.
+ * Gets the current health of the mob.
*
* @return The current health;
*/
@@ -62,7 +61,7 @@ public class HitUpdateBlock extends SynchronizationBlock {
}
/**
- * Gets the maximum health of the {@link org.apollo.game.model.Mob}.
+ * Gets the maximum health of the mob.
*
* @return The maximum health.
*/
diff --git a/src/org/apollo/game/sync/block/InteractingCharacterBlock.java b/src/org/apollo/game/sync/block/InteractingCharacterBlock.java
deleted file mode 100644
index 49d0d72c..00000000
--- a/src/org/apollo/game/sync/block/InteractingCharacterBlock.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.apollo.game.sync.block;
-
-/**
- * The InteractingCharacterBlock {@link SynchronizationBlock}.
- *
- * @note As all Apollo events should be immutable to avoid concurency issues, this uses the index of the character
- * rather than the actual character. This should not be changed.
- *
- * @author Major
- */
-public class InteractingCharacterBlock extends SynchronizationBlock {
-
- /**
- * The index of the character.
- */
- private final int characterIndex;
-
- /**
- * Creates the interacting character block.
- *
- * @param characterIndex The index of the current interacting character.
- */
- public InteractingCharacterBlock(int characterIndex) {
- this.characterIndex = characterIndex;
- }
-
- /**
- * Gets the interacting character's current index.
- *
- * @return The index of the character.
- */
- public int getInteractingCharacterIndex() {
- return characterIndex;
- }
-
-}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/block/InteractingMobBlock.java b/src/org/apollo/game/sync/block/InteractingMobBlock.java
new file mode 100644
index 00000000..cee09b75
--- /dev/null
+++ b/src/org/apollo/game/sync/block/InteractingMobBlock.java
@@ -0,0 +1,36 @@
+package org.apollo.game.sync.block;
+
+/**
+ * The interacting mob {@link SynchronizationBlock}.
+ *
+ * Note: As all Apollo events should be immutable to avoid concurrency issues, this uses the index of the mob rather
+ * than the actual mob. This should not be changed.
+ *
+ * @author Major
+ */
+public class InteractingMobBlock extends SynchronizationBlock {
+
+ /**
+ * The index of the mob.
+ */
+ private final int mobIndex;
+
+ /**
+ * Creates the interacting mob block.
+ *
+ * @param mobIndex The index of the current interacting mob.
+ */
+ public InteractingMobBlock(int mobIndex) {
+ this.mobIndex = mobIndex;
+ }
+
+ /**
+ * Gets the interacting mob's index.
+ *
+ * @return The index.
+ */
+ public int getInteractingMobIndex() {
+ return mobIndex;
+ }
+
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/block/SecondHitUpdateBlock.java b/src/org/apollo/game/sync/block/SecondaryHitUpdateBlock.java
similarity index 50%
rename from src/org/apollo/game/sync/block/SecondHitUpdateBlock.java
rename to src/org/apollo/game/sync/block/SecondaryHitUpdateBlock.java
index 931b2e59..5038ec75 100644
--- a/src/org/apollo/game/sync/block/SecondHitUpdateBlock.java
+++ b/src/org/apollo/game/sync/block/SecondaryHitUpdateBlock.java
@@ -1,16 +1,16 @@
package org.apollo.game.sync.block;
/**
- * The Second Hit Update {@link SynchronizationBlock}. This is believed to be used for when multiple attacks happen at
- * once (for example, the dragon-dagger special attack). This block can be implemented by both players and npcs.
+ * The secondary hit update {@link SynchronizationBlock}. This is used for when multiple attacks happen at once (for
+ * example, the dragon-dagger special attack). This block can be implemented by both players and npcs.
*
*
* @author Major
*/
-public class SecondHitUpdateBlock extends SynchronizationBlock {
+public class SecondaryHitUpdateBlock extends SynchronizationBlock {
/**
- * The character's current health.
+ * The mob's current health.
*/
private final int currentHealth;
@@ -20,7 +20,7 @@ public class SecondHitUpdateBlock extends SynchronizationBlock {
private final int damage;
/**
- * The character's maximum health.
+ * The mob's maximum health.
*/
private final int maximumHealth;
@@ -30,22 +30,22 @@ public class SecondHitUpdateBlock extends SynchronizationBlock {
private final int type;
/**
- * Creates a new Second Hit Update block.
+ * Creates a new secondary hit update block.
*
- * @param hitDamage The damage dealt by the hit.
- * @param hitType The type of hit.
- * @param currentHealth The current health of the character.
- * @param maximumHealth The maximum health of the character.
+ * @param damage The damage dealt by the hit.
+ * @param type The type of hit.
+ * @param currentHealth The current health of the mob.
+ * @param maximumHealth The maximum health of the mob.
*/
- public SecondHitUpdateBlock(int hitDamage, int hitType, int currentHealth, int maximumHealth) {
- damage = hitDamage;
- type = hitType;
+ SecondaryHitUpdateBlock(int damage, int type, int currentHealth, int maximumHealth) {
+ this.damage = damage;
+ this.type = type;
this.currentHealth = currentHealth;
this.maximumHealth = maximumHealth;
}
/**
- * Gets the current health of the character.
+ * Gets the current health of the mob.
*
* @return The current health;
*/
@@ -63,7 +63,7 @@ public class SecondHitUpdateBlock extends SynchronizationBlock {
}
/**
- * Gets the maximum health of the character.
+ * Gets the maximum health of the mob.
*
* @return The maximum health.
*/
diff --git a/src/org/apollo/game/sync/block/SynchronizationBlock.java b/src/org/apollo/game/sync/block/SynchronizationBlock.java
index 6a7859bf..7314c9c0 100644
--- a/src/org/apollo/game/sync/block/SynchronizationBlock.java
+++ b/src/org/apollo/game/sync/block/SynchronizationBlock.java
@@ -63,11 +63,11 @@ public abstract class SynchronizationBlock {
/**
* Creates a new force movement block with the specified parameters.
*
- * @param initialPosition The initial position of the player.
- * @param finalPosition The final position of the player.
- * @param travelDurationX The duration motion along the X axis will occur.
- * @param travelDurationY The duration motion along the Y axis will occur.
- * @param direction The direction the player will face.
+ * @param initialPosition The initial {@link Position} of the player.
+ * @param finalPosition The final {@link Position} of the player
+ * @param travelDurationX The length of time (in game pulses) the player's movement along the X axis will last.
+ * @param travelDurationY The length of time (in game pulses) the player's movement along the Y axis will last.
+ * @param direction The direction the player should move.
* @return The force movement block.
*/
public static SynchronizationBlock createForceMovementBlock(Position initialPosition, Position finalPosition,
@@ -86,13 +86,39 @@ public abstract class SynchronizationBlock {
}
/**
- * Creates an interacting character block with the specified character index.
+ * Creates a new hit or secondary hit update block
*
- * @param index The index of the interacting character.
- * @return The interacting character block.
+ * @param damage The damage dealt by the hit.
+ * @param type The type of hit.
+ * @param currentHealth The current health of the mob.
+ * @param maximumHealth The maximum health of the mob.
+ * @param secondary If the block is a secondary hit or not.
+ * @return The hit update block.
*/
- public static SynchronizationBlock createInteractingCharacterBlock(int index) {
- return new InteractingCharacterBlock(index);
+ public static SynchronizationBlock createHitUpdateBlock(int damage, int type, int currentHealth, int maximumHealth,
+ boolean secondary) {
+ return secondary ? new SecondaryHitUpdateBlock(damage, type, currentHealth, maximumHealth)
+ : new HitUpdateBlock(damage, type, currentHealth, maximumHealth);
+ }
+
+ /**
+ * Creates an interacting mob block with the specified index.
+ *
+ * @param index The index of the mob being interacted with.
+ * @return The interacting mob block.
+ */
+ public static SynchronizationBlock createInteractingMobBlock(int index) {
+ return new InteractingMobBlock(index);
+ }
+
+ /**
+ * Creates a transform block with the specified id.
+ *
+ * @param id The id.
+ * @return The transform block.
+ */
+ public static SynchronizationBlock createTransformBlock(int id) {
+ return new TransformBlock(id);
}
/**
diff --git a/src/org/apollo/game/sync/block/SynchronizationBlockSet.java b/src/org/apollo/game/sync/block/SynchronizationBlockSet.java
index abf5c474..3ac4aa60 100644
--- a/src/org/apollo/game/sync/block/SynchronizationBlockSet.java
+++ b/src/org/apollo/game/sync/block/SynchronizationBlockSet.java
@@ -11,9 +11,9 @@ import java.util.Map;
public final class SynchronizationBlockSet implements Cloneable {
/**
- * The blocks.
+ * A {@link Map} of {@link SynchronizationBlock}s.
*/
- private final Map, SynchronizationBlock> blocks = new HashMap, SynchronizationBlock>();
+ private final Map, SynchronizationBlock> blocks = new HashMap<>();
/**
* Adds a {@link SynchronizationBlock}.
@@ -80,4 +80,4 @@ public final class SynchronizationBlockSet implements Cloneable {
return blocks.size();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/block/TransformBlock.java b/src/org/apollo/game/sync/block/TransformBlock.java
index c0552315..22ca3454 100644
--- a/src/org/apollo/game/sync/block/TransformBlock.java
+++ b/src/org/apollo/game/sync/block/TransformBlock.java
@@ -18,7 +18,7 @@ public final class TransformBlock extends SynchronizationBlock {
*
* @param id The id.
*/
- public TransformBlock(int id) {
+ TransformBlock(int id) {
this.id = id;
}
diff --git a/src/org/apollo/game/sync/block/TurnToPositionBlock.java b/src/org/apollo/game/sync/block/TurnToPositionBlock.java
index 5f504ef9..ed1cec40 100644
--- a/src/org/apollo/game/sync/block/TurnToPositionBlock.java
+++ b/src/org/apollo/game/sync/block/TurnToPositionBlock.java
@@ -32,4 +32,4 @@ public final class TurnToPositionBlock extends SynchronizationBlock {
return position;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/block/package-info.java b/src/org/apollo/game/sync/block/package-info.java
index bce56141..9177eef5 100644
--- a/src/org/apollo/game/sync/block/package-info.java
+++ b/src/org/apollo/game/sync/block/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to synchronization 'blocks'.
*/
-package org.apollo.game.sync.block;
-
+package org.apollo.game.sync.block;
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/package-info.java b/src/org/apollo/game/sync/package-info.java
index a929edd6..d2a5a620 100644
--- a/src/org/apollo/game/sync/package-info.java
+++ b/src/org/apollo/game/sync/package-info.java
@@ -2,5 +2,4 @@
* Contains classes related to client synchronization - the process where the
* client's state is updated by the server so it matches the server's state.
*/
-package org.apollo.game.sync;
-
+package org.apollo.game.sync;
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/AddNpcSegment.java b/src/org/apollo/game/sync/seg/AddNpcSegment.java
index 6a792579..18527207 100644
--- a/src/org/apollo/game/sync/seg/AddNpcSegment.java
+++ b/src/org/apollo/game/sync/seg/AddNpcSegment.java
@@ -29,7 +29,7 @@ public final class AddNpcSegment extends SynchronizationSegment {
* Creates the add npc segment.
*
* @param blockSet The block set.
- * @param index The characters's index.
+ * @param index The npcs's index.
* @param position The position.
* @param npcId The id of the npc.
*/
@@ -41,7 +41,7 @@ public final class AddNpcSegment extends SynchronizationSegment {
}
/**
- * Gets the character's index.
+ * Gets the npc's index.
*
* @return The index.
*/
@@ -69,7 +69,7 @@ public final class AddNpcSegment extends SynchronizationSegment {
@Override
public SegmentType getType() {
- return SegmentType.ADD_CHARACTER;
+ return SegmentType.ADD_MOB;
}
}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/AddPlayerSegment.java b/src/org/apollo/game/sync/seg/AddPlayerSegment.java
index 91bf1159..69f7d4f9 100644
--- a/src/org/apollo/game/sync/seg/AddPlayerSegment.java
+++ b/src/org/apollo/game/sync/seg/AddPlayerSegment.java
@@ -4,7 +4,7 @@ import org.apollo.game.model.Position;
import org.apollo.game.sync.block.SynchronizationBlockSet;
/**
- * A {@link SynchronizationSegment} which adds a character.
+ * A {@link SynchronizationSegment} which adds a player.
*
* @author Graham
*/
@@ -21,10 +21,10 @@ public final class AddPlayerSegment extends SynchronizationSegment {
private final Position position;
/**
- * Creates the add character segment.
+ * Creates the add player segment.
*
* @param blockSet The block set.
- * @param index The characters's index.
+ * @param index The player's index.
* @param position The position.
*/
public AddPlayerSegment(SynchronizationBlockSet blockSet, int index, Position position) {
@@ -34,7 +34,7 @@ public final class AddPlayerSegment extends SynchronizationSegment {
}
/**
- * Gets the character's index.
+ * Gets the player's index.
*
* @return The index.
*/
@@ -53,7 +53,7 @@ public final class AddPlayerSegment extends SynchronizationSegment {
@Override
public SegmentType getType() {
- return SegmentType.ADD_CHARACTER;
+ return SegmentType.ADD_MOB;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/MovementSegment.java b/src/org/apollo/game/sync/seg/MovementSegment.java
index 3c6baf0d..549845c3 100644
--- a/src/org/apollo/game/sync/seg/MovementSegment.java
+++ b/src/org/apollo/game/sync/seg/MovementSegment.java
@@ -4,7 +4,7 @@ import org.apollo.game.model.Direction;
import org.apollo.game.sync.block.SynchronizationBlockSet;
/**
- * A {@link SynchronizationSegment} where the character is moved (or doesn't move!).
+ * A {@link SynchronizationSegment} where the mob is moved (or doesn't move!).
*
* @author Graham
*/
diff --git a/src/org/apollo/game/sync/seg/RemoveCharacterSegment.java b/src/org/apollo/game/sync/seg/RemoveMobSegment.java
similarity index 58%
rename from src/org/apollo/game/sync/seg/RemoveCharacterSegment.java
rename to src/org/apollo/game/sync/seg/RemoveMobSegment.java
index 6a1f1f18..10b6fd08 100644
--- a/src/org/apollo/game/sync/seg/RemoveCharacterSegment.java
+++ b/src/org/apollo/game/sync/seg/RemoveMobSegment.java
@@ -3,11 +3,11 @@ package org.apollo.game.sync.seg;
import org.apollo.game.sync.block.SynchronizationBlockSet;
/**
- * A {@link SynchronizationSegment} which removes a character.
+ * A {@link SynchronizationSegment} which removes a mob.
*
* @author Graham
*/
-public final class RemoveCharacterSegment extends SynchronizationSegment {
+public final class RemoveMobSegment extends SynchronizationSegment {
/**
* An empty {@link SynchronizationBlockSet}.
@@ -15,15 +15,15 @@ public final class RemoveCharacterSegment extends SynchronizationSegment {
private static final SynchronizationBlockSet EMPTY_BLOCK_SET = new SynchronizationBlockSet();
/**
- * Creates the remove character segment.
+ * Creates the remove mob segment.
*/
- public RemoveCharacterSegment() {
+ public RemoveMobSegment() {
super(EMPTY_BLOCK_SET);
}
@Override
public SegmentType getType() {
- return SegmentType.REMOVE_CHARACTER;
+ return SegmentType.REMOVE_MOB;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/SegmentType.java b/src/org/apollo/game/sync/seg/SegmentType.java
index 3db29293..6e460092 100644
--- a/src/org/apollo/game/sync/seg/SegmentType.java
+++ b/src/org/apollo/game/sync/seg/SegmentType.java
@@ -8,9 +8,9 @@ package org.apollo.game.sync.seg;
public enum SegmentType {
/**
- * A segment where the character is added.
+ * A segment where the mob is added.
*/
- ADD_CHARACTER,
+ ADD_MOB,
/**
* A segment without any movement.
@@ -18,9 +18,9 @@ public enum SegmentType {
NO_MOVEMENT,
/**
- * A segment where the character is removed.
+ * A segment where the mob is removed.
*/
- REMOVE_CHARACTER,
+ REMOVE_MOB,
/**
* A segment with movement in two directions.
@@ -28,7 +28,7 @@ public enum SegmentType {
RUN,
/**
- * A segment where the character is teleported.
+ * A segment where the mob is teleported.
*/
TELEPORT,
@@ -37,4 +37,4 @@ public enum SegmentType {
*/
WALK;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/SynchronizationSegment.java b/src/org/apollo/game/sync/seg/SynchronizationSegment.java
index 83d4b8bc..afc60efd 100644
--- a/src/org/apollo/game/sync/seg/SynchronizationSegment.java
+++ b/src/org/apollo/game/sync/seg/SynchronizationSegment.java
@@ -43,4 +43,4 @@ public abstract class SynchronizationSegment {
*/
public abstract SegmentType getType();
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/TeleportSegment.java b/src/org/apollo/game/sync/seg/TeleportSegment.java
index b00c0487..f607d2e6 100644
--- a/src/org/apollo/game/sync/seg/TeleportSegment.java
+++ b/src/org/apollo/game/sync/seg/TeleportSegment.java
@@ -4,7 +4,7 @@ import org.apollo.game.model.Position;
import org.apollo.game.sync.block.SynchronizationBlockSet;
/**
- * A {@link SynchronizationSegment} where the character is teleported to a new location.
+ * A {@link SynchronizationSegment} where the mob is teleported to a new location.
*
* @author Graham
*/
@@ -40,4 +40,4 @@ public final class TeleportSegment extends SynchronizationSegment {
return SegmentType.TELEPORT;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/seg/package-info.java b/src/org/apollo/game/sync/seg/package-info.java
index 4b1bd83a..41052407 100644
--- a/src/org/apollo/game/sync/seg/package-info.java
+++ b/src/org/apollo/game/sync/seg/package-info.java
@@ -1,7 +1,6 @@
/**
* Contains classes related to synchronization segments. Each segment contains
* multiple blocks and can be used to add, remove, teleport or move a
- * character.
+ * mob.
*/
-package org.apollo.game.sync.seg;
-
+package org.apollo.game.sync.seg;
\ No newline at end of file
diff --git a/src/org/apollo/game/sync/task/NpcSynchronizationTask.java b/src/org/apollo/game/sync/task/NpcSynchronizationTask.java
index 69e09e84..bcdd3374 100644
--- a/src/org/apollo/game/sync/task/NpcSynchronizationTask.java
+++ b/src/org/apollo/game/sync/task/NpcSynchronizationTask.java
@@ -11,9 +11,9 @@ import org.apollo.game.model.World;
import org.apollo.game.sync.block.SynchronizationBlockSet;
import org.apollo.game.sync.seg.AddNpcSegment;
import org.apollo.game.sync.seg.MovementSegment;
-import org.apollo.game.sync.seg.RemoveCharacterSegment;
+import org.apollo.game.sync.seg.RemoveMobSegment;
import org.apollo.game.sync.seg.SynchronizationSegment;
-import org.apollo.util.CharacterRepository;
+import org.apollo.util.MobRepository;
/**
* A {@link SynchronizationTask} which synchronizes npcs with the specified {@link Player}.
@@ -46,15 +46,14 @@ public final class NpcSynchronizationTask extends SynchronizationTask {
public void run() {
SynchronizationBlockSet blockSet = player.getBlockSet();
List localNpcs = player.getLocalNpcList();
- int oldLocalNpcs = localNpcs.size();
List segments = new ArrayList();
+ Iterator it = localNpcs.iterator();
- for (Iterator it = localNpcs.iterator(); it.hasNext();) {
- Npc npc = it.next();
+ for (Npc npc = null; it.hasNext(); npc = it.next()) {
if (!npc.isActive() || npc.isTeleporting()
|| npc.getPosition().getLongestDelta(player.getPosition()) > player.getViewingDistance()) {
it.remove();
- segments.add(new RemoveCharacterSegment());
+ segments.add(new RemoveMobSegment());
} else {
segments.add(new MovementSegment(npc.getBlockSet(), npc.getDirections()));
}
@@ -62,26 +61,24 @@ public final class NpcSynchronizationTask extends SynchronizationTask {
int added = 0;
- CharacterRepository repository = World.getWorld().getNpcRepository();
+ MobRepository repository = World.getWorld().getNpcRepository();
for (Npc npc : repository) {
if (localNpcs.size() >= 255) {
player.flagExcessiveNpcs();
- break;
- } else if (added >= NEW_NPCS_PER_CYCLE) {
- break;
- }
-
- if (npc.getPosition().isWithinDistance(player.getPosition(), player.getViewingDistance())
- && !localNpcs.contains(npc)) {
- localNpcs.add(npc);
- added++;
- blockSet = npc.getBlockSet();
- segments.add(new AddNpcSegment(blockSet, npc.getIndex(), npc.getPosition(), npc.getNpcDefinition()
- .getId()));
+ } else if (added < NEW_NPCS_PER_CYCLE) {
+ if (!localNpcs.contains(npc)
+ && npc.getPosition().isWithinDistance(player.getPosition(), player.getViewingDistance())) {
+ localNpcs.add(npc);
+ added++;
+ blockSet = npc.getBlockSet();
+ segments.add(new AddNpcSegment(blockSet, npc.getIndex(), npc.getPosition(), npc.getId()));
+ }
+ continue;
}
+ break;
}
- NpcSynchronizationEvent event = new NpcSynchronizationEvent(player.getPosition(), segments, oldLocalNpcs);
+ NpcSynchronizationEvent event = new NpcSynchronizationEvent(player.getPosition(), segments, localNpcs.size());
player.send(event);
}
diff --git a/src/org/apollo/game/sync/task/PlayerSynchronizationTask.java b/src/org/apollo/game/sync/task/PlayerSynchronizationTask.java
index b0c982f6..9110f369 100644
--- a/src/org/apollo/game/sync/task/PlayerSynchronizationTask.java
+++ b/src/org/apollo/game/sync/task/PlayerSynchronizationTask.java
@@ -14,10 +14,10 @@ import org.apollo.game.sync.block.SynchronizationBlock;
import org.apollo.game.sync.block.SynchronizationBlockSet;
import org.apollo.game.sync.seg.AddPlayerSegment;
import org.apollo.game.sync.seg.MovementSegment;
-import org.apollo.game.sync.seg.RemoveCharacterSegment;
+import org.apollo.game.sync.seg.RemoveMobSegment;
import org.apollo.game.sync.seg.SynchronizationSegment;
import org.apollo.game.sync.seg.TeleportSegment;
-import org.apollo.util.CharacterRepository;
+import org.apollo.util.MobRepository;
/**
* A {@link SynchronizationTask} which synchronizes the specified {@link Player} .
@@ -67,44 +67,45 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
List localPlayers = player.getLocalPlayerList();
int oldLocalPlayers = localPlayers.size();
List segments = new ArrayList();
+ Iterator it = localPlayers.iterator();
- for (Iterator it = localPlayers.iterator(); it.hasNext();) {
- Player p = it.next();
- if (!p.isActive() || p.isTeleporting()
- || p.getPosition().getLongestDelta(player.getPosition()) > player.getViewingDistance()) {
+ for (Player local = null; it.hasNext(); local = it.next()) {
+ if (!local.isActive() || local.isTeleporting()
+ || local.getPosition().getLongestDelta(player.getPosition()) > player.getViewingDistance()) {
it.remove();
- segments.add(new RemoveCharacterSegment());
+ segments.add(new RemoveMobSegment());
} else {
- segments.add(new MovementSegment(p.getBlockSet(), p.getDirections()));
+ segments.add(new MovementSegment(local.getBlockSet(), local.getDirections()));
}
}
int added = 0;
- CharacterRepository repository = World.getWorld().getPlayerRepository();
- for (Player p : repository) {
+ MobRepository repository = World.getWorld().getPlayerRepository();
+ for (Player global : repository) {
if (localPlayers.size() >= 255) {
player.flagExcessivePlayers();
- break;
- } else if (added >= NEW_PLAYERS_PER_CYCLE) {
- break;
- }
- // we do not check p.isActive() here, since if they are active they
- // must be in the repository
- if (p != player && p.getPosition().isWithinDistance(player.getPosition(), player.getViewingDistance())
- && !localPlayers.contains(p)) {
- localPlayers.add(p);
- added++;
+ } else if (added < NEW_PLAYERS_PER_CYCLE) {
+ // we do not check p.isActive() here, since if they are active they
+ // must be in the repository
+ if (global != player
+ && global.getPosition().isWithinDistance(player.getPosition(), player.getViewingDistance())
+ && !localPlayers.contains(global)) {
+ localPlayers.add(global);
+ added++;
- blockSet = p.getBlockSet();
- if (!blockSet.contains(AppearanceBlock.class)) {
- // TODO check if client has cached appearance
- blockSet = blockSet.clone();
- blockSet.add(SynchronizationBlock.createAppearanceBlock(p));
+ blockSet = global.getBlockSet();
+ if (!blockSet.contains(AppearanceBlock.class)) {
+ // TODO check if client has cached appearance
+ blockSet = blockSet.clone();
+ blockSet.add(SynchronizationBlock.createAppearanceBlock(global));
+ }
+
+ segments.add(new AddPlayerSegment(blockSet, global.getIndex(), global.getPosition()));
}
-
- segments.add(new AddPlayerSegment(blockSet, p.getIndex(), p.getPosition()));
+ continue;
}
+ break;
}
PlayerSynchronizationEvent event = new PlayerSynchronizationEvent(lastKnownRegion, player.getPosition(),
@@ -112,4 +113,4 @@ public final class PlayerSynchronizationTask extends SynchronizationTask {
player.send(event);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/EquipmentDefinitionParser.java b/src/org/apollo/io/EquipmentDefinitionParser.java
index 5724f0d3..2e738fb3 100644
--- a/src/org/apollo/io/EquipmentDefinitionParser.java
+++ b/src/org/apollo/io/EquipmentDefinitionParser.java
@@ -38,7 +38,7 @@ public final class EquipmentDefinitionParser {
DataInputStream dis = new DataInputStream(is);
int count = dis.readShort() & 0xFFFF;
- EquipmentDefinition[] defs = new EquipmentDefinition[count];
+ EquipmentDefinition[] definitions = new EquipmentDefinition[count];
for (int id = 0; id < count; id++) {
int slot = dis.readByte() & 0xFF;
@@ -53,16 +53,16 @@ public final class EquipmentDefinitionParser {
int ranged = dis.readByte() & 0xFF;
int magic = dis.readByte() & 0xFF;
- EquipmentDefinition def = new EquipmentDefinition(id);
- def.setLevels(attack, strength, defence, ranged, magic);
- def.setSlot(slot);
- def.setFlags(twoHanded, fullBody, fullHat, fullMask);
+ EquipmentDefinition definition = new EquipmentDefinition(id);
+ definition.setLevels(attack, strength, defence, ranged, magic);
+ definition.setSlot(slot);
+ definition.setFlags(twoHanded, fullBody, fullHat, fullMask);
- defs[id] = def;
+ definitions[id] = definition;
}
}
- return defs;
+ return definitions;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/PluginMetaDataParser.java b/src/org/apollo/io/PluginMetaDataParser.java
index b4e59fe6..46059168 100644
--- a/src/org/apollo/io/PluginMetaDataParser.java
+++ b/src/org/apollo/io/PluginMetaDataParser.java
@@ -119,4 +119,4 @@ public final class PluginMetaDataParser {
return new PluginMetaData(id, name, description, authors, scripts, dependencies, version);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/package-info.java b/src/org/apollo/io/package-info.java
index b8106308..73c3e2d9 100644
--- a/src/org/apollo/io/package-info.java
+++ b/src/org/apollo/io/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which deal with input/output.
*/
-package org.apollo.io;
-
+package org.apollo.io;
\ No newline at end of file
diff --git a/src/org/apollo/io/player/PlayerLoaderResponse.java b/src/org/apollo/io/player/PlayerLoaderResponse.java
index 2006c24b..3b4e66d8 100644
--- a/src/org/apollo/io/player/PlayerLoaderResponse.java
+++ b/src/org/apollo/io/player/PlayerLoaderResponse.java
@@ -67,4 +67,4 @@ public final class PlayerLoaderResponse {
return status;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/player/PlayerSaver.java b/src/org/apollo/io/player/PlayerSaver.java
index b3942cab..c45b3ca8 100644
--- a/src/org/apollo/io/player/PlayerSaver.java
+++ b/src/org/apollo/io/player/PlayerSaver.java
@@ -18,4 +18,4 @@ public interface PlayerSaver {
*/
public void savePlayer(Player player) throws Exception;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/player/impl/BinaryPlayerLoader.java b/src/org/apollo/io/player/impl/BinaryPlayerLoader.java
index d498ad5e..8fdd4a9d 100644
--- a/src/org/apollo/io/player/impl/BinaryPlayerLoader.java
+++ b/src/org/apollo/io/player/impl/BinaryPlayerLoader.java
@@ -59,7 +59,7 @@ public final class BinaryPlayerLoader implements PlayerLoader {
int height = in.readUnsignedByte();
// read appearance
- boolean designedCharacter = in.readBoolean();
+ boolean designed = in.readBoolean();
int genderIntValue = in.readUnsignedByte();
Gender gender = genderIntValue == Gender.MALE.toInteger() ? Gender.MALE : Gender.FEMALE;
@@ -72,20 +72,20 @@ public final class BinaryPlayerLoader implements PlayerLoader {
colors[i] = in.readUnsignedByte();
}
- Player p = new Player(credentials, new Position(x, y, height));
- p.setPrivilegeLevel(privilegeLevel);
- p.setMembers(members);
- p.setDesignedCharacter(designedCharacter);
- p.setAppearance(new Appearance(gender, style, colors));
+ Player player = new Player(credentials, new Position(x, y, height));
+ player.setPrivilegeLevel(privilegeLevel);
+ player.setMembers(members);
+ player.setDesigned(designed);
+ player.setAppearance(new Appearance(gender, style, colors));
// read inventories
- readInventory(in, p.getInventory());
- readInventory(in, p.getEquipment());
- readInventory(in, p.getBank());
+ readInventory(in, player.getInventory());
+ readInventory(in, player.getEquipment());
+ readInventory(in, player.getBank());
// read skills
int size = in.readUnsignedByte();
- SkillSet skills = p.getSkillSet();
+ SkillSet skills = player.getSkillSet();
skills.stopFiringEvents();
try {
for (int i = 0; i < size; i++) {
@@ -94,10 +94,11 @@ public final class BinaryPlayerLoader implements PlayerLoader {
skills.setSkill(i, new Skill(experience, level, SkillSet.getLevelForExperience(experience)));
}
} finally {
+ skills.calculateCombatLevel();
skills.startFiringEvents();
}
- return new PlayerLoaderResponse(LoginConstants.STATUS_OK, p);
+ return new PlayerLoaderResponse(LoginConstants.STATUS_OK, player);
} finally {
in.close();
}
diff --git a/src/org/apollo/io/player/impl/BinaryPlayerSaver.java b/src/org/apollo/io/player/impl/BinaryPlayerSaver.java
index 429900a4..05420ca6 100644
--- a/src/org/apollo/io/player/impl/BinaryPlayerSaver.java
+++ b/src/org/apollo/io/player/impl/BinaryPlayerSaver.java
@@ -40,7 +40,7 @@ public final class BinaryPlayerSaver implements PlayerSaver {
out.writeByte(position.getHeight());
// write appearance
- out.writeBoolean(player.hasDesignedCharacter());
+ out.writeBoolean(player.hasDesignedAvatar());
Appearance appearance = player.getAppearance();
out.writeByte(appearance.getGender().toInteger());
int[] style = appearance.getStyle();
@@ -94,4 +94,4 @@ public final class BinaryPlayerSaver implements PlayerSaver {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/player/impl/BinaryPlayerUtil.java b/src/org/apollo/io/player/impl/BinaryPlayerUtil.java
index 720f7233..b0ca7722 100644
--- a/src/org/apollo/io/player/impl/BinaryPlayerUtil.java
+++ b/src/org/apollo/io/player/impl/BinaryPlayerUtil.java
@@ -26,21 +26,20 @@ public final class BinaryPlayerUtil {
}
/**
- * Gets the file for the specified player.
+ * Gets the save {@link File} for the specified player.
*
- * @param name The name of the player.
+ * @param username The username of the player.
* @return The file.
*/
- public static File getFile(String name) {
- name = NameUtil.decodeBase37(NameUtil.encodeBase37(name));
- return new File(SAVED_GAMES_DIRECTORY, name + ".dat");
+ public static File getFile(String username) {
+ username = NameUtil.decodeBase37(NameUtil.encodeBase37(username));
+ return new File(SAVED_GAMES_DIRECTORY, username + ".dat");
}
/**
* Default private constructor to prevent instantiation.
*/
private BinaryPlayerUtil() {
-
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/player/impl/JdbcPlayerSaver.java b/src/org/apollo/io/player/impl/JdbcPlayerSaver.java
index e4382f25..c83e6855 100644
--- a/src/org/apollo/io/player/impl/JdbcPlayerSaver.java
+++ b/src/org/apollo/io/player/impl/JdbcPlayerSaver.java
@@ -10,4 +10,4 @@ public final class JdbcPlayerSaver implements PlayerSaver {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/io/player/impl/package-info.java b/src/org/apollo/io/player/impl/package-info.java
index f4b8c099..a56ca9ca 100644
--- a/src/org/apollo/io/player/impl/package-info.java
+++ b/src/org/apollo/io/player/impl/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains various player loader/saver implementations.
*/
-package org.apollo.io.player.impl;
-
+package org.apollo.io.player.impl;
\ No newline at end of file
diff --git a/src/org/apollo/io/player/package-info.java b/src/org/apollo/io/player/package-info.java
index ce4f331f..95975550 100644
--- a/src/org/apollo/io/player/package-info.java
+++ b/src/org/apollo/io/player/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which deal with loading and saving player files.
*/
-package org.apollo.io.player;
-
+package org.apollo.io.player;
\ No newline at end of file
diff --git a/src/org/apollo/login/LoginService.java b/src/org/apollo/login/LoginService.java
index 3c872214..f0d1d684 100644
--- a/src/org/apollo/login/LoginService.java
+++ b/src/org/apollo/login/LoginService.java
@@ -128,4 +128,4 @@ public final class LoginService extends Service {
executor.submit(new PlayerSaverWorker(saver, session, player));
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/login/PlayerLoaderWorker.java b/src/org/apollo/login/PlayerLoaderWorker.java
index 1dc4e706..92fd66cb 100644
--- a/src/org/apollo/login/PlayerLoaderWorker.java
+++ b/src/org/apollo/login/PlayerLoaderWorker.java
@@ -61,4 +61,4 @@ public final class PlayerLoaderWorker implements Runnable {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/login/PlayerSaverWorker.java b/src/org/apollo/login/PlayerSaverWorker.java
index c4c1069d..febea7c7 100644
--- a/src/org/apollo/login/PlayerSaverWorker.java
+++ b/src/org/apollo/login/PlayerSaverWorker.java
@@ -58,4 +58,4 @@ public final class PlayerSaverWorker implements Runnable {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/login/package-info.java b/src/org/apollo/login/package-info.java
index 2825a57e..abab81c9 100644
--- a/src/org/apollo/login/package-info.java
+++ b/src/org/apollo/login/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to the login service.
*/
-package org.apollo.login;
-
+package org.apollo.login;
\ No newline at end of file
diff --git a/src/org/apollo/net/ApolloHandler.java b/src/org/apollo/net/ApolloHandler.java
index b1c43221..158ee510 100644
--- a/src/org/apollo/net/ApolloHandler.java
+++ b/src/org/apollo/net/ApolloHandler.java
@@ -102,4 +102,4 @@ public final class ApolloHandler extends IdleStateAwareChannelUpstreamHandler {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/AccessMode.java b/src/org/apollo/net/codec/game/AccessMode.java
index f0979143..b98be20f 100644
--- a/src/org/apollo/net/codec/game/AccessMode.java
+++ b/src/org/apollo/net/codec/game/AccessMode.java
@@ -17,4 +17,4 @@ public enum AccessMode {
*/
BYTE_ACCESS;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/DataConstants.java b/src/org/apollo/net/codec/game/DataConstants.java
index 104573f6..a1ec9c61 100644
--- a/src/org/apollo/net/codec/game/DataConstants.java
+++ b/src/org/apollo/net/codec/game/DataConstants.java
@@ -28,4 +28,4 @@ public final class DataConstants {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/DataOrder.java b/src/org/apollo/net/codec/game/DataOrder.java
index d5ad95b2..186333f4 100644
--- a/src/org/apollo/net/codec/game/DataOrder.java
+++ b/src/org/apollo/net/codec/game/DataOrder.java
@@ -27,4 +27,4 @@ public enum DataOrder {
*/
MIDDLE;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/DataTransformation.java b/src/org/apollo/net/codec/game/DataTransformation.java
index 18ab1230..6b62e208 100644
--- a/src/org/apollo/net/codec/game/DataTransformation.java
+++ b/src/org/apollo/net/codec/game/DataTransformation.java
@@ -27,4 +27,4 @@ public enum DataTransformation {
*/
SUBTRACT;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/DataType.java b/src/org/apollo/net/codec/game/DataType.java
index c5132fd8..d78c823f 100644
--- a/src/org/apollo/net/codec/game/DataType.java
+++ b/src/org/apollo/net/codec/game/DataType.java
@@ -55,4 +55,4 @@ public enum DataType {
return bytes;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/GameDecoderState.java b/src/org/apollo/net/codec/game/GameDecoderState.java
index d4144c80..b69a2ec5 100644
--- a/src/org/apollo/net/codec/game/GameDecoderState.java
+++ b/src/org/apollo/net/codec/game/GameDecoderState.java
@@ -25,4 +25,4 @@ public enum GameDecoderState {
*/
GAME_PAYLOAD;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/GameEventEncoder.java b/src/org/apollo/net/codec/game/GameEventEncoder.java
index a363f19f..fc8aecc1 100644
--- a/src/org/apollo/net/codec/game/GameEventEncoder.java
+++ b/src/org/apollo/net/codec/game/GameEventEncoder.java
@@ -42,4 +42,4 @@ public final class GameEventEncoder extends OneToOneEncoder {
return msg;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/GamePacket.java b/src/org/apollo/net/codec/game/GamePacket.java
index 5d3b5ed6..ca1c5251 100644
--- a/src/org/apollo/net/codec/game/GamePacket.java
+++ b/src/org/apollo/net/codec/game/GamePacket.java
@@ -80,4 +80,4 @@ public final class GamePacket {
return type;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/GamePacketReader.java b/src/org/apollo/net/codec/game/GamePacketReader.java
index ac7f8f22..c85a9224 100644
--- a/src/org/apollo/net/codec/game/GamePacketReader.java
+++ b/src/org/apollo/net/codec/game/GamePacketReader.java
@@ -424,4 +424,4 @@ public final class GamePacketReader {
buffer.readerIndex((bitIndex + 7) / 8);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/game/package-info.java b/src/org/apollo/net/codec/game/package-info.java
index 430c229e..09bc9b37 100644
--- a/src/org/apollo/net/codec/game/package-info.java
+++ b/src/org/apollo/net/codec/game/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains codecs for the game protocol.
*/
-package org.apollo.net.codec.game;
-
+package org.apollo.net.codec.game;
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/handshake/HandshakeConstants.java b/src/org/apollo/net/codec/handshake/HandshakeConstants.java
index ea25c394..e3cdffc4 100644
--- a/src/org/apollo/net/codec/handshake/HandshakeConstants.java
+++ b/src/org/apollo/net/codec/handshake/HandshakeConstants.java
@@ -24,4 +24,4 @@ public final class HandshakeConstants {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/handshake/HandshakeDecoder.java b/src/org/apollo/net/codec/handshake/HandshakeDecoder.java
index a0727089..38c242c5 100644
--- a/src/org/apollo/net/codec/handshake/HandshakeDecoder.java
+++ b/src/org/apollo/net/codec/handshake/HandshakeDecoder.java
@@ -58,4 +58,4 @@ public final class HandshakeDecoder extends FrameDecoder {
return null;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/handshake/HandshakeMessage.java b/src/org/apollo/net/codec/handshake/HandshakeMessage.java
index 32990818..bc82a468 100644
--- a/src/org/apollo/net/codec/handshake/HandshakeMessage.java
+++ b/src/org/apollo/net/codec/handshake/HandshakeMessage.java
@@ -30,4 +30,4 @@ public final class HandshakeMessage {
return serviceId;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/handshake/package-info.java b/src/org/apollo/net/codec/handshake/package-info.java
index 439018f9..2575b407 100644
--- a/src/org/apollo/net/codec/handshake/package-info.java
+++ b/src/org/apollo/net/codec/handshake/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains codecs for the handshake protocol.
*/
-package org.apollo.net.codec.handshake;
-
+package org.apollo.net.codec.handshake;
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/jaggrab/JagGrabRequest.java b/src/org/apollo/net/codec/jaggrab/JagGrabRequest.java
index 354b1cca..a3f65d2c 100644
--- a/src/org/apollo/net/codec/jaggrab/JagGrabRequest.java
+++ b/src/org/apollo/net/codec/jaggrab/JagGrabRequest.java
@@ -30,4 +30,4 @@ public final class JagGrabRequest {
return filePath;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/jaggrab/JagGrabResponse.java b/src/org/apollo/net/codec/jaggrab/JagGrabResponse.java
index c1bdda43..472eb1b8 100644
--- a/src/org/apollo/net/codec/jaggrab/JagGrabResponse.java
+++ b/src/org/apollo/net/codec/jaggrab/JagGrabResponse.java
@@ -3,7 +3,7 @@ package org.apollo.net.codec.jaggrab;
import org.jboss.netty.buffer.ChannelBuffer;
/**
- * Represents a single JAGGRAB reponse.
+ * Represents a single JAGGRAB response.
*
* @author Graham
*/
@@ -32,4 +32,4 @@ public final class JagGrabResponse {
return fileData;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/jaggrab/package-info.java b/src/org/apollo/net/codec/jaggrab/package-info.java
index 54b34246..5ec5c65d 100644
--- a/src/org/apollo/net/codec/jaggrab/package-info.java
+++ b/src/org/apollo/net/codec/jaggrab/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains codecs for the JAGGRAB protocol.
*/
-package org.apollo.net.codec.jaggrab;
-
+package org.apollo.net.codec.jaggrab;
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/login/LoginConstants.java b/src/org/apollo/net/codec/login/LoginConstants.java
index 8bc7dcf8..59437491 100644
--- a/src/org/apollo/net/codec/login/LoginConstants.java
+++ b/src/org/apollo/net/codec/login/LoginConstants.java
@@ -124,4 +124,4 @@ public final class LoginConstants {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/login/LoginDecoderState.java b/src/org/apollo/net/codec/login/LoginDecoderState.java
index 83d70108..ff833557 100644
--- a/src/org/apollo/net/codec/login/LoginDecoderState.java
+++ b/src/org/apollo/net/codec/login/LoginDecoderState.java
@@ -25,4 +25,4 @@ public enum LoginDecoderState {
*/
LOGIN_PAYLOAD;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/login/LoginRequest.java b/src/org/apollo/net/codec/login/LoginRequest.java
index 0aa300ca..98320f7c 100644
--- a/src/org/apollo/net/codec/login/LoginRequest.java
+++ b/src/org/apollo/net/codec/login/LoginRequest.java
@@ -114,4 +114,4 @@ public final class LoginRequest {
return reconnecting;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/login/LoginResponse.java b/src/org/apollo/net/codec/login/LoginResponse.java
index 5fe7577f..426c78c6 100644
--- a/src/org/apollo/net/codec/login/LoginResponse.java
+++ b/src/org/apollo/net/codec/login/LoginResponse.java
@@ -62,4 +62,4 @@ public final class LoginResponse {
return flagged;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/login/package-info.java b/src/org/apollo/net/codec/login/package-info.java
index 06638c04..3fbda626 100644
--- a/src/org/apollo/net/codec/login/package-info.java
+++ b/src/org/apollo/net/codec/login/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains codecs for the login protocol.
*/
-package org.apollo.net.codec.login;
-
+package org.apollo.net.codec.login;
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/update/OnDemandRequest.java b/src/org/apollo/net/codec/update/OnDemandRequest.java
index 50f3de6d..c5e019e9 100644
--- a/src/org/apollo/net/codec/update/OnDemandRequest.java
+++ b/src/org/apollo/net/codec/update/OnDemandRequest.java
@@ -107,9 +107,8 @@ public final class OnDemandRequest implements Comparable {
return 1;
} else if (thisPriority == otherPriority) {
return 0;
- } else {
- return -1;
}
+ return -1;
}
/**
@@ -130,4 +129,4 @@ public final class OnDemandRequest implements Comparable {
return priority;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/update/OnDemandResponse.java b/src/org/apollo/net/codec/update/OnDemandResponse.java
index b05caf92..c0653dce 100644
--- a/src/org/apollo/net/codec/update/OnDemandResponse.java
+++ b/src/org/apollo/net/codec/update/OnDemandResponse.java
@@ -81,4 +81,4 @@ public final class OnDemandResponse {
return fileSize;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/codec/update/UpdateEncoder.java b/src/org/apollo/net/codec/update/UpdateEncoder.java
index e87237d3..9f6d6279 100644
--- a/src/org/apollo/net/codec/update/UpdateEncoder.java
+++ b/src/org/apollo/net/codec/update/UpdateEncoder.java
@@ -17,21 +17,21 @@ public final class UpdateEncoder extends OneToOneEncoder {
@Override
protected Object encode(ChannelHandlerContext ctx, Channel c, Object msg) {
if (msg instanceof OnDemandResponse) {
- OnDemandResponse resp = (OnDemandResponse) msg;
+ OnDemandResponse response = (OnDemandResponse) msg;
- FileDescriptor fileDescriptor = resp.getFileDescriptor();
- int fileSize = resp.getFileSize();
- int chunkId = resp.getChunkId();
- ChannelBuffer chunkData = resp.getChunkData();
+ FileDescriptor descriptor = response.getFileDescriptor();
+ int fileSize = response.getFileSize();
+ int chunkId = response.getChunkId();
+ ChannelBuffer chunkData = response.getChunkData();
- ChannelBuffer buf = ChannelBuffers.buffer(6 + chunkData.readableBytes());
- buf.writeByte(fileDescriptor.getType() - 1);
- buf.writeShort(fileDescriptor.getFile());
- buf.writeShort(fileSize);
- buf.writeByte(chunkId);
- buf.writeBytes(chunkData);
+ ChannelBuffer buffer = ChannelBuffers.buffer(6 + chunkData.readableBytes());
+ buffer.writeByte(descriptor.getType() - 1);
+ buffer.writeShort(descriptor.getFile());
+ buffer.writeShort(fileSize);
+ buffer.writeByte(chunkId);
+ buffer.writeBytes(chunkData);
- return buf;
+ return buffer;
}
return msg;
}
diff --git a/src/org/apollo/net/codec/update/package-info.java b/src/org/apollo/net/codec/update/package-info.java
index f352ecdd..32b04530 100644
--- a/src/org/apollo/net/codec/update/package-info.java
+++ b/src/org/apollo/net/codec/update/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains codecs for the ondemand (update) protocol.
*/
-package org.apollo.net.codec.update;
-
+package org.apollo.net.codec.update;
\ No newline at end of file
diff --git a/src/org/apollo/net/meta/PacketMetaData.java b/src/org/apollo/net/meta/PacketMetaData.java
index 8d2ae123..279e9cef 100644
--- a/src/org/apollo/net/meta/PacketMetaData.java
+++ b/src/org/apollo/net/meta/PacketMetaData.java
@@ -83,4 +83,4 @@ public final class PacketMetaData {
return type;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/meta/package-info.java b/src/org/apollo/net/meta/package-info.java
index 22ba04eb..b5ccc2a2 100644
--- a/src/org/apollo/net/meta/package-info.java
+++ b/src/org/apollo/net/meta/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which contain meta data about the protocol/various packets.
*/
-package org.apollo.net.meta;
-
+package org.apollo.net.meta;
\ No newline at end of file
diff --git a/src/org/apollo/net/package-info.java b/src/org/apollo/net/package-info.java
index 27a4463f..26b88ffe 100644
--- a/src/org/apollo/net/package-info.java
+++ b/src/org/apollo/net/package-info.java
@@ -2,5 +2,4 @@
* Contains classes related to networking. Many of these extend Netty's set of
* classes - such as the pipeline factory, handler and codecs.
*/
-package org.apollo.net;
-
+package org.apollo.net;
\ No newline at end of file
diff --git a/src/org/apollo/net/release/EventDecoder.java b/src/org/apollo/net/release/EventDecoder.java
index bf4bacb0..5ceee0a8 100644
--- a/src/org/apollo/net/release/EventDecoder.java
+++ b/src/org/apollo/net/release/EventDecoder.java
@@ -20,4 +20,4 @@ public abstract class EventDecoder {
*/
public abstract E decode(GamePacket packet);
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/EventEncoder.java b/src/org/apollo/net/release/EventEncoder.java
index 23e3a402..91bb632c 100644
--- a/src/org/apollo/net/release/EventEncoder.java
+++ b/src/org/apollo/net/release/EventEncoder.java
@@ -19,4 +19,4 @@ public abstract class EventEncoder {
*/
public abstract GamePacket encode(E event);
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/package-info.java b/src/org/apollo/net/release/package-info.java
index 2b7d85f0..362c1d2b 100644
--- a/src/org/apollo/net/release/package-info.java
+++ b/src/org/apollo/net/release/package-info.java
@@ -2,5 +2,4 @@
* Contains abstract classes which should be extended by a particular release,
* allowing for portability between various protocol and client releases.
*/
-package org.apollo.net.release;
-
+package org.apollo.net.release;
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/ButtonEventDecoder.java b/src/org/apollo/net/release/r317/ButtonEventDecoder.java
index 6001917b..14e56120 100644
--- a/src/org/apollo/net/release/r317/ButtonEventDecoder.java
+++ b/src/org/apollo/net/release/r317/ButtonEventDecoder.java
@@ -20,4 +20,4 @@ public final class ButtonEventDecoder extends EventDecoder {
return new ButtonEvent(interfaceId);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/CharacterAnimationResetEventEncoder.java b/src/org/apollo/net/release/r317/CharacterAnimationResetEventEncoder.java
deleted file mode 100644
index c4dc8fe9..00000000
--- a/src/org/apollo/net/release/r317/CharacterAnimationResetEventEncoder.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.apollo.net.release.r317;
-
-import org.apollo.game.event.impl.CharacterAnimationResetEvent;
-import org.apollo.net.codec.game.GamePacket;
-import org.apollo.net.codec.game.GamePacketBuilder;
-import org.apollo.net.release.EventEncoder;
-
-/**
- * An {@link EventEncoder} for the {@link CharacterAnimationResetEvent}.
- *
- * @author Major
- */
-public class CharacterAnimationResetEventEncoder extends EventEncoder {
-
- @Override
- public GamePacket encode(CharacterAnimationResetEvent event) {
- return new GamePacketBuilder(1).toGamePacket();
- }
-
-}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/CloseInterfaceEventEncoder.java b/src/org/apollo/net/release/r317/CloseInterfaceEventEncoder.java
index a7855f3e..df1c404c 100644
--- a/src/org/apollo/net/release/r317/CloseInterfaceEventEncoder.java
+++ b/src/org/apollo/net/release/r317/CloseInterfaceEventEncoder.java
@@ -18,4 +18,4 @@ public final class CloseInterfaceEventEncoder extends EventEncoder {
return new CommandEvent(reader.getString());
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/EnterAmountEventEncoder.java b/src/org/apollo/net/release/r317/EnterAmountEventEncoder.java
index 8ec09f1d..3a2bf227 100644
--- a/src/org/apollo/net/release/r317/EnterAmountEventEncoder.java
+++ b/src/org/apollo/net/release/r317/EnterAmountEventEncoder.java
@@ -18,4 +18,4 @@ public final class EnterAmountEventEncoder extends EventEncoder {
return new KeepAliveEvent();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/LogoutEventEncoder.java b/src/org/apollo/net/release/r317/LogoutEventEncoder.java
index 23874648..19844bfc 100644
--- a/src/org/apollo/net/release/r317/LogoutEventEncoder.java
+++ b/src/org/apollo/net/release/r317/LogoutEventEncoder.java
@@ -18,4 +18,4 @@ public final class LogoutEventEncoder extends EventEncoder {
return builder.toGamePacket();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/MobAnimationResetEventEncoder.java b/src/org/apollo/net/release/r317/MobAnimationResetEventEncoder.java
new file mode 100644
index 00000000..45b18fbd
--- /dev/null
+++ b/src/org/apollo/net/release/r317/MobAnimationResetEventEncoder.java
@@ -0,0 +1,20 @@
+package org.apollo.net.release.r317;
+
+import org.apollo.game.event.impl.MobAnimationResetEvent;
+import org.apollo.net.codec.game.GamePacket;
+import org.apollo.net.codec.game.GamePacketBuilder;
+import org.apollo.net.release.EventEncoder;
+
+/**
+ * An {@link EventEncoder} for the {@link MobAnimationResetEvent}.
+ *
+ * @author Major
+ */
+public class MobAnimationResetEventEncoder extends EventEncoder {
+
+ @Override
+ public GamePacket encode(MobAnimationResetEvent event) {
+ return new GamePacketBuilder(1).toGamePacket();
+ }
+
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/NpcSynchronizationEventEncoder.java b/src/org/apollo/net/release/r317/NpcSynchronizationEventEncoder.java
index d0d84c4c..d098b112 100644
--- a/src/org/apollo/net/release/r317/NpcSynchronizationEventEncoder.java
+++ b/src/org/apollo/net/release/r317/NpcSynchronizationEventEncoder.java
@@ -9,8 +9,8 @@ import org.apollo.game.sync.block.AnimationBlock;
import org.apollo.game.sync.block.ForceChatBlock;
import org.apollo.game.sync.block.GraphicBlock;
import org.apollo.game.sync.block.HitUpdateBlock;
-import org.apollo.game.sync.block.InteractingCharacterBlock;
-import org.apollo.game.sync.block.SecondHitUpdateBlock;
+import org.apollo.game.sync.block.InteractingMobBlock;
+import org.apollo.game.sync.block.SecondaryHitUpdateBlock;
import org.apollo.game.sync.block.SynchronizationBlockSet;
import org.apollo.game.sync.block.TransformBlock;
import org.apollo.game.sync.block.TurnToPositionBlock;
@@ -39,14 +39,13 @@ public class NpcSynchronizationEventEncoder extends EventEncoder {
+public final class PlayerDesignEventDecoder extends EventDecoder {
@Override
- public CharacterDesignEvent decode(GamePacket packet) {
+ public PlayerDesignEvent decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int genderIntValue = (int) reader.getUnsigned(DataType.BYTE);
@@ -33,7 +33,7 @@ public final class CharacterDesignEventDecoder extends EventDecoder 0;
Position player = event.getPosition();
Position other = seg.getPosition();
@@ -98,7 +98,7 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder 0;
- if (seg.getType() == SegmentType.TELEPORT) { // teleported
- Position pos = ((TeleportSegment) seg).getDestination();
+ if (seg.getType() == SegmentType.TELEPORT) {
+ Position position = ((TeleportSegment) seg).getDestination();
builder.putBits(1, 1);
builder.putBits(2, 3);
- builder.putBits(2, pos.getHeight());
+ builder.putBits(2, position.getHeight());
builder.putBits(1, event.hasRegionChanged() ? 0 : 1);
builder.putBits(1, updateRequired ? 1 : 0);
- builder.putBits(7, pos.getLocalY(event.getLastKnownRegion()));
- builder.putBits(7, pos.getLocalX(event.getLastKnownRegion()));
- } else if (seg.getType() == SegmentType.RUN) { // running movement
+ builder.putBits(7, position.getLocalY(event.getLastKnownRegion()));
+ builder.putBits(7, position.getLocalX(event.getLastKnownRegion()));
+ } else if (seg.getType() == SegmentType.RUN) {
Direction[] directions = ((MovementSegment) seg).getDirections();
builder.putBits(1, 1);
builder.putBits(2, 2);
builder.putBits(3, directions[0].toInteger());
builder.putBits(3, directions[1].toInteger());
builder.putBits(1, updateRequired ? 1 : 0);
- } else if (seg.getType() == SegmentType.WALK) { // walking movement
+ } else if (seg.getType() == SegmentType.WALK) {
Direction[] directions = ((MovementSegment) seg).getDirections();
builder.putBits(1, 1);
builder.putBits(2, 1);
builder.putBits(3, directions[0].toInteger());
builder.putBits(1, updateRequired ? 1 : 0);
} else {
- if (updateRequired) { // no movement
+ if (updateRequired) {
builder.putBits(1, 1);
builder.putBits(2, 0);
} else {
- builder.putBits(1, 0); // no sync required
+ builder.putBits(1, 0);
}
}
}
/**
- * Puts a remove character update.
+ * Puts a remove player update.
*
* @param builder The builder.
*/
- private void putRemoveCharacterUpdate(GamePacketBuilder builder) {
+ private void putRemovePlayerUpdate(GamePacketBuilder builder) {
builder.putBits(1, 1);
builder.putBits(2, 3);
}
@@ -439,7 +439,7 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder
return new SwitchItemEvent(interfaceId, inserting, oldSlot, newSlot);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r317/SwitchTabInterfaceEventEncoder.java b/src/org/apollo/net/release/r317/SwitchTabInterfaceEventEncoder.java
index 4c20ad43..5651fb80 100644
--- a/src/org/apollo/net/release/r317/SwitchTabInterfaceEventEncoder.java
+++ b/src/org/apollo/net/release/r317/SwitchTabInterfaceEventEncoder.java
@@ -22,4 +22,4 @@ public final class SwitchTabInterfaceEventEncoder extends EventEncoder {
return new WalkEvent(positions, run);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/ArrowKeyEventDecoder.java b/src/org/apollo/net/release/r377/ArrowKeyEventDecoder.java
index fa7fabed..1673b65a 100644
--- a/src/org/apollo/net/release/r377/ArrowKeyEventDecoder.java
+++ b/src/org/apollo/net/release/r377/ArrowKeyEventDecoder.java
@@ -21,4 +21,5 @@ public class ArrowKeyEventDecoder extends EventDecoder {
int yaw = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
return new ArrowKeyEvent(roll, yaw);
}
+
}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/ButtonEventDecoder.java b/src/org/apollo/net/release/r377/ButtonEventDecoder.java
index b9c70a75..bc126118 100644
--- a/src/org/apollo/net/release/r377/ButtonEventDecoder.java
+++ b/src/org/apollo/net/release/r377/ButtonEventDecoder.java
@@ -20,4 +20,4 @@ public final class ButtonEventDecoder extends EventDecoder {
return new ButtonEvent(interfaceId);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/CharacterAnimationResetEventEncoder.java b/src/org/apollo/net/release/r377/CharacterAnimationResetEventEncoder.java
deleted file mode 100644
index 851de1d4..00000000
--- a/src/org/apollo/net/release/r377/CharacterAnimationResetEventEncoder.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.apollo.net.release.r377;
-
-import org.apollo.game.event.impl.CharacterAnimationResetEvent;
-import org.apollo.net.codec.game.GamePacket;
-import org.apollo.net.codec.game.GamePacketBuilder;
-import org.apollo.net.release.EventEncoder;
-
-/**
- * An {@link EventEncoder} for the {@link CharacterAnimationResetEvent}.
- *
- * @author Major
- */
-public class CharacterAnimationResetEventEncoder extends EventEncoder {
-
- @Override
- public GamePacket encode(CharacterAnimationResetEvent event) {
- return new GamePacketBuilder(13).toGamePacket();
- }
-
-}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/ChatEventDecoder.java b/src/org/apollo/net/release/r377/ChatEventDecoder.java
index e6b09818..8b63d088 100644
--- a/src/org/apollo/net/release/r377/ChatEventDecoder.java
+++ b/src/org/apollo/net/release/r377/ChatEventDecoder.java
@@ -37,4 +37,4 @@ public final class ChatEventDecoder extends EventDecoder {
return new ChatEvent(uncompressed, recompressed, color, effects);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/CloseInterfaceEventEncoder.java b/src/org/apollo/net/release/r377/CloseInterfaceEventEncoder.java
index 89245df3..0a74ae24 100644
--- a/src/org/apollo/net/release/r377/CloseInterfaceEventEncoder.java
+++ b/src/org/apollo/net/release/r377/CloseInterfaceEventEncoder.java
@@ -18,4 +18,4 @@ public final class CloseInterfaceEventEncoder extends EventEncoder {
return new CommandEvent(reader.getString());
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/EnterAmountEventEncoder.java b/src/org/apollo/net/release/r377/EnterAmountEventEncoder.java
index 796871f8..96505933 100644
--- a/src/org/apollo/net/release/r377/EnterAmountEventEncoder.java
+++ b/src/org/apollo/net/release/r377/EnterAmountEventEncoder.java
@@ -18,4 +18,4 @@ public final class EnterAmountEventEncoder extends EventEncoder {
return new KeepAliveEvent();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/LogoutEventEncoder.java b/src/org/apollo/net/release/r377/LogoutEventEncoder.java
index a3d5f8f4..579c55f7 100644
--- a/src/org/apollo/net/release/r377/LogoutEventEncoder.java
+++ b/src/org/apollo/net/release/r377/LogoutEventEncoder.java
@@ -18,4 +18,4 @@ public final class LogoutEventEncoder extends EventEncoder {
return builder.toGamePacket();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/MobAnimationResetEventEncoder.java b/src/org/apollo/net/release/r377/MobAnimationResetEventEncoder.java
new file mode 100644
index 00000000..e0843cd7
--- /dev/null
+++ b/src/org/apollo/net/release/r377/MobAnimationResetEventEncoder.java
@@ -0,0 +1,20 @@
+package org.apollo.net.release.r377;
+
+import org.apollo.game.event.impl.MobAnimationResetEvent;
+import org.apollo.net.codec.game.GamePacket;
+import org.apollo.net.codec.game.GamePacketBuilder;
+import org.apollo.net.release.EventEncoder;
+
+/**
+ * An {@link EventEncoder} for the {@link MobAnimationResetEvent}.
+ *
+ * @author Major
+ */
+public class MobAnimationResetEventEncoder extends EventEncoder {
+
+ @Override
+ public GamePacket encode(MobAnimationResetEvent event) {
+ return new GamePacketBuilder(13).toGamePacket();
+ }
+
+}
\ No newline at end of file
diff --git a/src/org/apollo/net/release/r377/MouseClickEventDecoder.java b/src/org/apollo/net/release/r377/MouseClickEventDecoder.java
index 8ac43222..3f356569 100644
--- a/src/org/apollo/net/release/r377/MouseClickEventDecoder.java
+++ b/src/org/apollo/net/release/r377/MouseClickEventDecoder.java
@@ -16,21 +16,22 @@ public class MouseClickEventDecoder extends EventDecoder {
@Override
public MouseClickEvent decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
- int read;
+ int read, clickCount, x, y;
+
if (reader.getLength() == 2) {
read = (int) reader.getUnsigned(DataType.SHORT);
- int clickCount = (read >> 12);
- int dX = (read >> 6) & 0x3f;
- int dY = read & 0x3f;
- return new MouseClickEvent(clickCount, dX, dY, true);
+ clickCount = (read >> 12);
+ x = (read >> 6) & 0x3f;
+ y = read & 0x3f;
+ return new MouseClickEvent(clickCount, x, y, true);
} else if (reader.getLength() == 3) {
read = (int) reader.getUnsigned(DataType.TRI_BYTE) & ~0x800000;
} else {
read = (int) reader.getUnsigned(DataType.INT) & ~0xc0000000;
}
- int clickCount = (read >> 19);
- int x = (read & 0x7f) % 765;
- int y = (read & 0x7f) / 765;
+ clickCount = (read >> 19);
+ x = (read & 0x7f) % 765;
+ y = (read & 0x7f) / 765;
return new MouseClickEvent(clickCount, x, y, false);
}
diff --git a/src/org/apollo/net/release/r377/NpcSynchronizationEventEncoder.java b/src/org/apollo/net/release/r377/NpcSynchronizationEventEncoder.java
index 0c32ddda..0708760f 100644
--- a/src/org/apollo/net/release/r377/NpcSynchronizationEventEncoder.java
+++ b/src/org/apollo/net/release/r377/NpcSynchronizationEventEncoder.java
@@ -9,8 +9,8 @@ import org.apollo.game.sync.block.AnimationBlock;
import org.apollo.game.sync.block.ForceChatBlock;
import org.apollo.game.sync.block.GraphicBlock;
import org.apollo.game.sync.block.HitUpdateBlock;
-import org.apollo.game.sync.block.InteractingCharacterBlock;
-import org.apollo.game.sync.block.SecondHitUpdateBlock;
+import org.apollo.game.sync.block.InteractingMobBlock;
+import org.apollo.game.sync.block.SecondaryHitUpdateBlock;
import org.apollo.game.sync.block.SynchronizationBlockSet;
import org.apollo.game.sync.block.TransformBlock;
import org.apollo.game.sync.block.TurnToPositionBlock;
@@ -39,14 +39,13 @@ public class NpcSynchronizationEventEncoder extends EventEncoder {
+public final class PlayerDesignEventDecoder extends EventDecoder {
@Override
- public CharacterDesignEvent decode(GamePacket packet) {
+ public PlayerDesignEvent decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
int genderIntValue = (int) reader.getUnsigned(DataType.BYTE);
@@ -33,7 +33,7 @@ public final class CharacterDesignEventDecoder extends EventDecoder 0;
Position player = event.getPosition();
Position other = seg.getPosition();
@@ -120,8 +120,8 @@ public final class PlayerSynchronizationEventEncoder extends EventEncoder implements Comparable> {
return request;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/HttpRequestWorker.java b/src/org/apollo/update/HttpRequestWorker.java
index 50815e0f..845b7312 100644
--- a/src/org/apollo/update/HttpRequestWorker.java
+++ b/src/org/apollo/update/HttpRequestWorker.java
@@ -63,19 +63,19 @@ public final class HttpRequestWorker extends RequestWorker");
- bldr.append(title);
- bldr.append("");
- bldr.append(title);
- bldr.append("
");
- bldr.append(description);
- bldr.append("
");
- bldr.append(SERVER_IDENTIFIER);
- bldr.append(" Server");
+ builder.append("");
+ builder.append(title);
+ builder.append("");
+ builder.append(title);
+ builder.append("
");
+ builder.append(description);
+ builder.append("
");
+ builder.append(SERVER_IDENTIFIER);
+ builder.append(" Server");
- return ChannelBuffers.copiedBuffer(bldr.toString(), Charset.defaultCharset());
+ return ChannelBuffers.copiedBuffer(builder.toString(), Charset.defaultCharset());
}
/**
@@ -116,33 +116,33 @@ public final class HttpRequestWorker extends RequestWorker 0; chunk++) {
- int chunkSize = buf.remaining();
+ for (int chunk = 0; buffer.remaining() > 0; chunk++) {
+ int chunkSize = buffer.remaining();
if (chunkSize > CHUNK_LENGTH) {
chunkSize = CHUNK_LENGTH;
}
byte[] tmp = new byte[chunkSize];
- buf.get(tmp, 0, tmp.length);
+ buffer.get(tmp, 0, tmp.length);
ChannelBuffer chunkData = ChannelBuffers.wrappedBuffer(tmp, 0, chunkSize);
OnDemandResponse response = new OnDemandResponse(desc, length, chunk, chunkData);
@@ -60,4 +60,4 @@ public final class OnDemandRequestWorker extends RequestWorker implements Runnable {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/UpdateConstants.java b/src/org/apollo/update/UpdateConstants.java
index 84d86de2..b8b4c37f 100644
--- a/src/org/apollo/update/UpdateConstants.java
+++ b/src/org/apollo/update/UpdateConstants.java
@@ -14,4 +14,4 @@ public final class UpdateConstants {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/UpdateDispatcher.java b/src/org/apollo/update/UpdateDispatcher.java
index 4a2b0ebd..09a5ac72 100644
--- a/src/org/apollo/update/UpdateDispatcher.java
+++ b/src/org/apollo/update/UpdateDispatcher.java
@@ -105,4 +105,4 @@ public final class UpdateDispatcher {
return onDemandQueue.take();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/UpdateService.java b/src/org/apollo/update/UpdateService.java
index 38403d6f..8fdb438a 100644
--- a/src/org/apollo/update/UpdateService.java
+++ b/src/org/apollo/update/UpdateService.java
@@ -76,7 +76,7 @@ public final class UpdateService extends Service {
service.submit(worker);
}
} catch (Exception ex) {
- throw new RuntimeException(ex); // TODO neater/more elegant way
+ System.err.println("Error adding request workers - " + ex.getMessage());
}
}
@@ -91,4 +91,4 @@ public final class UpdateService extends Service {
service.shutdownNow();
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/package-info.java b/src/org/apollo/update/package-info.java
index 9a4c73c4..430c0ae8 100644
--- a/src/org/apollo/update/package-info.java
+++ b/src/org/apollo/update/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to the update server.
*/
-package org.apollo.update;
-
+package org.apollo.update;
\ No newline at end of file
diff --git a/src/org/apollo/update/resource/CombinedResourceProvider.java b/src/org/apollo/update/resource/CombinedResourceProvider.java
index d1da593d..b2487565 100644
--- a/src/org/apollo/update/resource/CombinedResourceProvider.java
+++ b/src/org/apollo/update/resource/CombinedResourceProvider.java
@@ -39,4 +39,4 @@ public final class CombinedResourceProvider extends ResourceProvider {
return null;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/resource/HypertextResourceProvider.java b/src/org/apollo/update/resource/HypertextResourceProvider.java
index cc36b34c..ea6a5913 100644
--- a/src/org/apollo/update/resource/HypertextResourceProvider.java
+++ b/src/org/apollo/update/resource/HypertextResourceProvider.java
@@ -62,4 +62,4 @@ public final class HypertextResourceProvider extends ResourceProvider {
return buf;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/resource/ResourceProvider.java b/src/org/apollo/update/resource/ResourceProvider.java
index ffed9834..f250b90f 100644
--- a/src/org/apollo/update/resource/ResourceProvider.java
+++ b/src/org/apollo/update/resource/ResourceProvider.java
@@ -28,4 +28,4 @@ public abstract class ResourceProvider {
*/
public abstract ByteBuffer get(String path) throws IOException;
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/resource/VirtualResourceProvider.java b/src/org/apollo/update/resource/VirtualResourceProvider.java
index ebe6fd36..e7babd27 100644
--- a/src/org/apollo/update/resource/VirtualResourceProvider.java
+++ b/src/org/apollo/update/resource/VirtualResourceProvider.java
@@ -67,4 +67,4 @@ public final class VirtualResourceProvider extends ResourceProvider {
return null;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/update/resource/package-info.java b/src/org/apollo/update/resource/package-info.java
index 7b78cf73..461a76ac 100644
--- a/src/org/apollo/update/resource/package-info.java
+++ b/src/org/apollo/update/resource/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains resource providers for the update server.
*/
-package org.apollo.update.resource;
-
+package org.apollo.update.resource;
\ No newline at end of file
diff --git a/src/org/apollo/util/ByteBufferUtil.java b/src/org/apollo/util/ByteBufferUtil.java
index e4f4ce02..fa65e621 100644
--- a/src/org/apollo/util/ByteBufferUtil.java
+++ b/src/org/apollo/util/ByteBufferUtil.java
@@ -57,4 +57,4 @@ public final class ByteBufferUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/ChannelBufferUtil.java b/src/org/apollo/util/ChannelBufferUtil.java
index 1a95ec2a..d8f5e663 100644
--- a/src/org/apollo/util/ChannelBufferUtil.java
+++ b/src/org/apollo/util/ChannelBufferUtil.java
@@ -33,4 +33,4 @@ public final class ChannelBufferUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/CharacterRepository.java b/src/org/apollo/util/CharacterRepository.java
deleted file mode 100644
index da32c765..00000000
--- a/src/org/apollo/util/CharacterRepository.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.apollo.util;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.apollo.game.model.Mob;
-
-/**
- * A {@link CharacterRepository} is a repository of {@link Mob}s that are currently active in the game world.
- *
- * @author Graham
- * @param The type of character.
- */
-public final class CharacterRepository implements Iterable {
-
- /**
- * The {@link Iterator} implementation for the {@link CharacterRepository} class.
- *
- * @author Graham
- */
- private final class CharacterRepositoryIterator implements Iterator {
-
- /**
- * The current index of this iterator.
- */
- private int index = 0;
-
- /**
- * The previous index of this iterator.
- */
- private int previousIndex = -1;
-
- @Override
- public boolean hasNext() {
- for (int i = index; i < characters.length; i++) {
- if (characters[i] != null) {
- index = i;
- return true;
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public T next() {
- T character = null;
- for (int i = index; i < characters.length; i++) {
- if (characters[i] != null) {
- character = (T) characters[i];
- index = i;
- break;
- }
- }
- if (character == null) {
- throw new NoSuchElementException("character does not exist");
- }
- previousIndex = index;
- index++;
- return character;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void remove() {
- if (previousIndex == -1) {
- throw new IllegalStateException("cannot remove as the repository is empty");
- }
- CharacterRepository.this.remove((T) characters[previousIndex]);
- previousIndex = -1;
- }
-
- }
-
- /**
- * The array of characters in this repository.
- */
- private final Mob[] characters;
-
- /**
- * The position of the next free index.
- */
- private int pointer = 0;
-
- /**
- * The current size of this repository.
- */
- private int size = 0;
-
- /**
- * Creates a new character repository with the specified capacity.
- *
- * @param capacity The maximum number of characters that can be present in the repository.
- */
- public CharacterRepository(int capacity) {
- this.characters = new Mob[capacity];
- }
-
- /**
- * Adds a character to the repository.
- *
- * @param character The character to add.
- * @return {@code true} if the character was added, {@code false} if the size has reached the capacity of this
- * repository.
- */
- public boolean add(T character) {
- if (size == characters.length) {
- return false;
- }
- int index = -1;
- for (int i = pointer; i < characters.length; i++) {
- if (characters[i] == null) {
- index = i;
- break;
- }
- }
- if (index == -1) {
- for (int i = 0; i < pointer; i++) {
- if (characters[i] == null) {
- index = i;
- break;
- }
- }
- }
- if (index == -1) {
- return false; // shouldn't happen, but just in case
- }
- characters[index] = character;
- character.setIndex(index + 1);
- if (index == characters.length - 1) {
- pointer = 0;
- } else {
- pointer = index;
- }
- size++;
- return true;
- }
-
- /**
- * Gets the capacity of this repository.
- *
- * @return The maximum size of this repository.
- */
- public int capacity() {
- return characters.length;
- }
-
- @Override
- public Iterator iterator() {
- return new CharacterRepositoryIterator();
- }
-
- /**
- * Removes a character from the repository.
- *
- * @param character The character to remove.
- * @return {@code true} if the character was removed, {@code false} if it was not (e.g. if it was never added or has
- * been removed already).
- */
- public boolean remove(T character) {
- int index = character.getIndex() - 1;
- if (index < 0 || index >= characters.length) {
- return false;
- }
- if (characters[index] == character) {
- characters[index] = null;
- character.setIndex(-1);
- size--;
- return true;
- }
- return false;
- }
-
- /**
- * Gets the size of this repository.
- *
- * @return The number of characters in this repository.
- */
- public int size() {
- return size;
- }
-
-}
\ No newline at end of file
diff --git a/src/org/apollo/util/CompressionUtil.java b/src/org/apollo/util/CompressionUtil.java
index 3e187343..2cc07a81 100644
--- a/src/org/apollo/util/CompressionUtil.java
+++ b/src/org/apollo/util/CompressionUtil.java
@@ -141,4 +141,4 @@ public final class CompressionUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/LanguageUtil.java b/src/org/apollo/util/LanguageUtil.java
index 35f4b3b8..50a42372 100644
--- a/src/org/apollo/util/LanguageUtil.java
+++ b/src/org/apollo/util/LanguageUtil.java
@@ -26,4 +26,4 @@ public final class LanguageUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/MobRepository.java b/src/org/apollo/util/MobRepository.java
new file mode 100644
index 00000000..b693663b
--- /dev/null
+++ b/src/org/apollo/util/MobRepository.java
@@ -0,0 +1,182 @@
+package org.apollo.util;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apollo.game.model.Mob;
+
+/**
+ * A {@link MobRepository} is a repository of {@link Mob}s that are currently active in the game world.
+ *
+ * @author Graham
+ * @param The type of mob..
+ */
+public final class MobRepository implements Iterable {
+
+ /**
+ * The {@link Iterator} implementation for the {@link MobRepository} class.
+ *
+ * @author Graham
+ */
+ private final class MobRepositoryIterator implements Iterator {
+
+ /**
+ * The current index of this iterator.
+ */
+ private int index = 0;
+
+ /**
+ * The previous index of this iterator.
+ */
+ private int previousIndex = -1;
+
+ @Override
+ public boolean hasNext() {
+ for (int i = index; i < mobs.length; i++) {
+ if (mobs[i] != null) {
+ index = i;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public T next() {
+ T mob = null;
+ for (int i = index; i < mobs.length; i++) {
+ if (mobs[i] != null) {
+ mob = (T) mobs[i];
+ index = i;
+ break;
+ }
+ }
+ if (mob == null) {
+ throw new NoSuchElementException("mob does not exist");
+ }
+ previousIndex = index;
+ index++;
+ return mob;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void remove() {
+ if (previousIndex == -1) {
+ throw new IllegalStateException("cannot remove as the repository is empty");
+ }
+ MobRepository.this.remove((T) mobs[previousIndex]);
+ previousIndex = -1;
+ }
+
+ }
+
+ /**
+ * The array of mobs in this repository.
+ */
+ private final Mob[] mobs;
+
+ /**
+ * The position of the next free index.
+ */
+ private int pointer = 0;
+
+ /**
+ * The current size of this repository.
+ */
+ private int size = 0;
+
+ /**
+ * Creates a new mob repository with the specified capacity.
+ *
+ * @param capacity The maximum number of mobs that can be present in the repository.
+ */
+ public MobRepository(int capacity) {
+ this.mobs = new Mob[capacity];
+ }
+
+ /**
+ * Adds a mob to the repository.
+ *
+ * @param mob The mob to add.
+ * @return {@code true} if the mob was added, {@code false} if the size has reached the capacity of this repository.
+ */
+ public boolean add(T mob) {
+ if (size == mobs.length) {
+ return false;
+ }
+ int index = -1;
+ for (int i = pointer; i < mobs.length; i++) {
+ if (mobs[i] == null) {
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) {
+ for (int i = 0; i < pointer; i++) {
+ if (mobs[i] == null) {
+ index = i;
+ break;
+ }
+ }
+ }
+ if (index == -1) {
+ return false; // shouldn't happen, but just in case
+ }
+ mobs[index] = mob;
+ mob.setIndex(index + 1);
+ if (index == mobs.length - 1) {
+ pointer = 0;
+ } else {
+ pointer = index;
+ }
+ size++;
+ return true;
+ }
+
+ /**
+ * Gets the capacity of this repository.
+ *
+ * @return The maximum size of this repository.
+ */
+ public int capacity() {
+ return mobs.length;
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new MobRepositoryIterator();
+ }
+
+ /**
+ * Removes a mob from the repository.
+ *
+ * @param mob The mob to remove.
+ * @return {@code true} if the mob was removed, {@code false} if it was not (e.g. if it was never added or has been
+ * removed already).
+ */
+ public boolean remove(T mob) {
+ int index = mob.getIndex() - 1;
+ if (index < 0 || index >= mobs.length) {
+ return false;
+ }
+ if (mobs[index] == mob) {
+ mobs[index] = null;
+ mob.setIndex(-1);
+ size--;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Gets the size of this repository.
+ *
+ * @return The number of mobs in this repository.
+ */
+ public int size() {
+ return size;
+ }
+
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/NameUtil.java b/src/org/apollo/util/NameUtil.java
index 1df7520e..5d5d8741 100644
--- a/src/org/apollo/util/NameUtil.java
+++ b/src/org/apollo/util/NameUtil.java
@@ -67,4 +67,4 @@ public final class NameUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/NamedThreadFactory.java b/src/org/apollo/util/NamedThreadFactory.java
index f83bb259..78181380 100644
--- a/src/org/apollo/util/NamedThreadFactory.java
+++ b/src/org/apollo/util/NamedThreadFactory.java
@@ -39,4 +39,4 @@ public final class NamedThreadFactory implements ThreadFactory {
return new Thread(runnable, name + " [id=" + currentId + "]");
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/StreamUtil.java b/src/org/apollo/util/StreamUtil.java
index 6621d162..d32bff43 100644
--- a/src/org/apollo/util/StreamUtil.java
+++ b/src/org/apollo/util/StreamUtil.java
@@ -20,9 +20,9 @@ public final class StreamUtil {
*/
public static String readString(InputStream is) throws IOException {
StringBuilder builder = new StringBuilder();
- int character;
- while ((character = is.read()) != -1 && character != '\0') {
- builder.append((char) character);
+ char character;
+ while ((character = (char) is.read()) != -1 && character != '\0') {
+ builder.append(character);
}
return builder.toString();
}
@@ -48,4 +48,4 @@ public final class StreamUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/TextUtil.java b/src/org/apollo/util/TextUtil.java
index fb2364aa..fa9a5ee8 100644
--- a/src/org/apollo/util/TextUtil.java
+++ b/src/org/apollo/util/TextUtil.java
@@ -148,4 +148,4 @@ public final class TextUtil {
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/package-info.java b/src/org/apollo/util/package-info.java
index 84028720..6209ca8f 100644
--- a/src/org/apollo/util/package-info.java
+++ b/src/org/apollo/util/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains utility classes.
*/
-package org.apollo.util;
-
+package org.apollo.util;
\ No newline at end of file
diff --git a/src/org/apollo/util/plugin/DependencyException.java b/src/org/apollo/util/plugin/DependencyException.java
index 38fcb31e..11d5e65d 100644
--- a/src/org/apollo/util/plugin/DependencyException.java
+++ b/src/org/apollo/util/plugin/DependencyException.java
@@ -11,10 +11,10 @@ public final class DependencyException extends Exception {
/**
* Creates the dependency exception.
*
- * @param s The message describing what happened.
+ * @param message The message describing what happened.
*/
- public DependencyException(String s) {
- super(s);
+ public DependencyException(String message) {
+ super(message);
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/plugin/PluginManager.java b/src/org/apollo/util/plugin/PluginManager.java
index e19c7b2f..2fe3c87b 100644
--- a/src/org/apollo/util/plugin/PluginManager.java
+++ b/src/org/apollo/util/plugin/PluginManager.java
@@ -167,9 +167,9 @@ public final class PluginManager {
String[] scripts = plugin.getScripts();
for (String script : scripts) {
- File f = new File("./data/plugins/" + plugin.getId() + "/" + script);
- InputStream is = new FileInputStream(f);
- env.parse(is, f.getAbsolutePath());
+ File scriptFile = new File("./data/plugins/" + plugin.getId() + "/" + script);
+ InputStream is = new FileInputStream(scriptFile);
+ env.parse(is, scriptFile.getAbsolutePath());
}
}
diff --git a/src/org/apollo/util/plugin/PluginMetaData.java b/src/org/apollo/util/plugin/PluginMetaData.java
index f60e7a2f..d93b3c81 100644
--- a/src/org/apollo/util/plugin/PluginMetaData.java
+++ b/src/org/apollo/util/plugin/PluginMetaData.java
@@ -127,4 +127,4 @@ public final class PluginMetaData {
return version;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/plugin/package-info.java b/src/org/apollo/util/plugin/package-info.java
index 49fb70b1..3b1b4875 100644
--- a/src/org/apollo/util/plugin/package-info.java
+++ b/src/org/apollo/util/plugin/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes related to plugins.
*/
-package org.apollo.util.plugin;
-
+package org.apollo.util.plugin;
\ No newline at end of file
diff --git a/src/org/apollo/util/xml/XmlNode.java b/src/org/apollo/util/xml/XmlNode.java
index 47c01935..fdf2b2fd 100644
--- a/src/org/apollo/util/xml/XmlNode.java
+++ b/src/org/apollo/util/xml/XmlNode.java
@@ -234,4 +234,4 @@ public final class XmlNode implements Iterable {
this.value = value;
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/xml/XmlParser.java b/src/org/apollo/util/xml/XmlParser.java
index 05f109c5..21ac43ae 100644
--- a/src/org/apollo/util/xml/XmlParser.java
+++ b/src/org/apollo/util/xml/XmlParser.java
@@ -152,4 +152,4 @@ public final class XmlParser {
}
}
-}
+}
\ No newline at end of file
diff --git a/src/org/apollo/util/xml/package-info.java b/src/org/apollo/util/xml/package-info.java
index 5d00c109..dd4f8677 100644
--- a/src/org/apollo/util/xml/package-info.java
+++ b/src/org/apollo/util/xml/package-info.java
@@ -1,5 +1,4 @@
/**
* Contains classes which parse XML data into an object tree.
*/
-package org.apollo.util.xml;
-
+package org.apollo.util.xml;
\ No newline at end of file