Format; clean up magic plugin.

This commit is contained in:
Major-
2013-11-06 23:43:17 +00:00
parent 19e609cd6d
commit 003aa082a2
8 changed files with 53 additions and 59 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class AlchemyAction < ItemSpellAction
end end
def illegal_item? def illegal_item?
return ILLEGAL_ALC_ITEMS.include? @item.id return ILLEGAL_ALC_ITEMS.include? @item.id
end end
def execute_action def execute_action
@@ -14,7 +14,7 @@ import org.apollo.util.plugin.PluginManager;
* @author Graham * @author Graham
*/ */
public final class CreditsCommandListener extends CommandListener { public final class CreditsCommandListener extends CommandListener {
/* /*
* If you are considering removing this command, please bear in mind that Apollo took several people thousands of * If you are considering removing this command, please bear in mind that Apollo took several people thousands of
* hours to create. We released it to the world for free and it isn't much to ask to leave this command in. It isn't * hours to create. We released it to the world for free and it isn't much to ask to leave this command in. It isn't
@@ -29,7 +29,7 @@ public final class CreditsCommandListener extends CommandListener {
PluginManager mgr = World.getWorld().getPluginManager(); PluginManager mgr = World.getWorld().getPluginManager();
final Set<String> authors = mgr.getAuthors(); final Set<String> authors = mgr.getAuthors();
List<String> text = new ArrayList<String>(14 + authors.size()); List<String> text = new ArrayList<String>(12 + authors.size());
text.add("@dre@Apollo"); text.add("@dre@Apollo");
text.add("@dre@Introduction"); text.add("@dre@Introduction");
text.add(""); text.add("");
@@ -38,9 +38,7 @@ public final class CreditsCommandListener extends CommandListener {
text.add("information about Apollo, visit the website at:"); text.add("information about Apollo, visit the website at:");
text.add("@dbl@https://github.com/apollo-rsps/apollo"); text.add("@dbl@https://github.com/apollo-rsps/apollo");
text.add(""); text.add("");
text.add("Apollo is released under the terms of the ISC"); text.add("Apollo is released under the terms of the ISC license.");
text.add("license, details can be found in the root folder of the");
text.add("Apollo distribution.");
text.add(""); text.add("");
text.add("@dre@Credits"); text.add("@dre@Credits");
text.add(""); text.add("");
+1 -1
View File
@@ -200,4 +200,4 @@ public final class Animation {
return id; return id;
} }
} }
@@ -26,7 +26,7 @@ import org.apollo.net.meta.PacketMetaDataGroup;
import org.apollo.net.release.Release; import org.apollo.net.release.Release;
/** /**
* An implementation of {@link Release} for the 317 protocol. * A {@link Release} implementation for the 317 protocol.
* *
* @author Graham * @author Graham
*/ */
@@ -112,8 +112,12 @@ public final class Release317 extends Release {
register(3, new FocusUpdateEventDecoder()); register(3, new FocusUpdateEventDecoder());
register(241, new MouseClickEventDecoder()); register(241, new MouseClickEventDecoder());
register(86, new ArrowKeyEventDecoder()); register(86, new ArrowKeyEventDecoder());
SpamPacketEventDecoder spamEventDecoder = new SpamPacketEventDecoder(); SpamPacketEventDecoder spamEventDecoder = new SpamPacketEventDecoder();
register(77, spamEventDecoder); register(77, spamEventDecoder);
register(165, spamEventDecoder);
register(189, spamEventDecoder);
register(226, spamEventDecoder);
register(72, new FirstNpcActionEventDecoder()); register(72, new FirstNpcActionEventDecoder());
register(155, new SecondNpcActionEventDecoder()); register(155, new SecondNpcActionEventDecoder());
@@ -144,4 +148,4 @@ public final class Release317 extends Release {
register(DisplayTabInterfaceEvent.class, new DisplayTabInterfaceEventEncoder()); register(DisplayTabInterfaceEvent.class, new DisplayTabInterfaceEventEncoder());
} }
} }
@@ -26,7 +26,7 @@ import org.apollo.net.meta.PacketMetaDataGroup;
import org.apollo.net.release.Release; import org.apollo.net.release.Release;
/** /**
* An implementation of {@link Release} for the 377 protocol. * A {@link Release} implementation for the 377 protocol.
* *
* @author Graham * @author Graham
*/ */
+2 -3
View File
@@ -93,10 +93,9 @@ public final class EquipmentConstants {
"Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" }; "Tzhaar-ket", "staff", "Staff", "godsword", "c'bow", "Crystal bow", "Dark bow", "Magic butterfly net" };
/** /**
* Default private construcotr to prevent instantiation. * Default private constructor to prevent instantiation.
*/ */
private EquipmentConstants() { private EquipmentConstants() {
} }
} }
+37 -41
View File
@@ -20,11 +20,11 @@ public final class EquipmentUpdater {
/** /**
* Gets the attack requirement. * Gets the attack requirement.
* *
* @param def The item. * @param definition The item definition.
* @return The required level. * @return The required level.
*/ */
private static int getAttackRequirement(ItemDefinition def) { private static int getAttackRequirement(ItemDefinition definition) {
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -229,12 +229,12 @@ public final class EquipmentUpdater {
/** /**
* Gets the defence requirement. * Gets the defence requirement.
* *
* @param def The item. * @param definition The item definition.
* @return The required level. * @return The required level.
*/ */
private static int getDefenceRequirement(ItemDefinition def) { private static int getDefenceRequirement(ItemDefinition definition) {
int id = def.getId(); int id = definition.getId();
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -679,11 +679,11 @@ public final class EquipmentUpdater {
/** /**
* Gets the magic requirement. * Gets the magic requirement.
* *
* @param def The item. * @param definition The item definition.
* @return The required level. * @return The required level.
*/ */
private static int getMagicRequirement(ItemDefinition def) { private static int getMagicRequirement(ItemDefinition definition) {
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -786,12 +786,12 @@ public final class EquipmentUpdater {
/** /**
* Gets the ranged requirement. * Gets the ranged requirement.
* *
* @param def The item. * @param definition The item.
* @return The required level. * @return The required level.
*/ */
private static int getRangedRequirement(ItemDefinition def) { private static int getRangedRequirement(ItemDefinition definition) {
int id = def.getId(); int id = definition.getId();
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -981,11 +981,11 @@ public final class EquipmentUpdater {
/** /**
* Gets the weapon type. * Gets the weapon type.
* *
* @param def The item. * @param definition The item.
* @return The weapon type, or {@code -1} if it is not a weapon. * @return The weapon type, or {@code -1} if it is not a weapon.
*/ */
private static int getWeaponType(ItemDefinition def) { private static int getWeaponType(ItemDefinition definition) {
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -1050,11 +1050,11 @@ public final class EquipmentUpdater {
/** /**
* Checks if the item is a full body item. * Checks if the item is a full body item.
* *
* @param def The item. * @param definition The item.
* @return {@code true} if so, {@code false} otherwise. * @return {@code true} if so, {@code false} otherwise.
*/ */
private static boolean isFullBody(ItemDefinition def) { private static boolean isFullBody(ItemDefinition definition) {
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -1069,11 +1069,11 @@ public final class EquipmentUpdater {
/** /**
* Checks if the item is a full hat item. * Checks if the item is a full hat item.
* *
* @param def The item. * @param definition The item.
* @return {@code true} if so, {@code false} otherwise. * @return {@code true} if so, {@code false} otherwise.
*/ */
private static boolean isFullHat(ItemDefinition def) { private static boolean isFullHat(ItemDefinition definition) {
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -1088,11 +1088,11 @@ public final class EquipmentUpdater {
/** /**
* Checks if the item is a full mask item. * Checks if the item is a full mask item.
* *
* @param def The item. * @param definition The item.
* @return {@code true} if so, {@code false} otherwise. * @return {@code true} if so, {@code false} otherwise.
*/ */
private static boolean isFullMask(ItemDefinition def) { private static boolean isFullMask(ItemDefinition definition) {
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -1107,12 +1107,12 @@ public final class EquipmentUpdater {
/** /**
* Checks if the item is two handed. * Checks if the item is two handed.
* *
* @param def The item. * @param definition The item.
* @return {@code true} if so, {@code false} otherwise. * @return {@code true} if so, {@code false} otherwise.
*/ */
private static boolean isTwoHanded(ItemDefinition def) { private static boolean isTwoHanded(ItemDefinition definition) {
int id = def.getId(); int id = definition.getId();
String name = def.getName(); String name = definition.getName();
if (name == null) { if (name == null) {
name = "null"; name = "null";
} }
@@ -1154,9 +1154,8 @@ public final class EquipmentUpdater {
return true; return true;
} else if (name.equals("Saradomin sword")) { } else if (name.equals("Saradomin sword")) {
return true; return true;
} else {
return false;
} }
return false;
} }
/** /**
@@ -1167,9 +1166,7 @@ public final class EquipmentUpdater {
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (args.length != 1) { if (args.length != 1) {
System.err.println("Usage:"); throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.EquipmentUpdater [release]");
System.err.println(" java -cp ... org.apollo.tools.EquipmentUpdater [release]");
return;
} }
String release = args[0]; String release = args[0];
@@ -1179,11 +1176,11 @@ public final class EquipmentUpdater {
IndexedFileSystem fs = new IndexedFileSystem(new File("data/fs/" + release), true); IndexedFileSystem fs = new IndexedFileSystem(new File("data/fs/" + release), true);
try { try {
ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs); ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs);
ItemDefinition[] defs = decoder.decode(); ItemDefinition[] definitions = decoder.decode();
ItemDefinition.init(defs); ItemDefinition.init(definitions);
os.writeShort(defs.length); os.writeShort(definitions.length);
for (int id = 0; id < defs.length; id++) { for (int id = 0; id < definitions.length; id++) {
ItemDefinition def = ItemDefinition.lookup(id); ItemDefinition def = ItemDefinition.lookup(id);
int type = getWeaponType(def); int type = getWeaponType(def);
os.writeByte(type); os.writeByte(type);
@@ -1211,7 +1208,6 @@ public final class EquipmentUpdater {
* Default private constructor to prevent instantiation. * Default private constructor to prevent instantiation.
*/ */
private EquipmentUpdater() { private EquipmentUpdater() {
} }
} }
+2 -5
View File
@@ -26,9 +26,7 @@ public final class NoteUpdater {
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (args.length != 1) { if (args.length != 1) {
System.err.println("Usage:"); throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.NoteUpdater [release]");
System.err.println(" java -cp ... org.apollo.tools.NoteUpdater [release]");
return;
} }
String release = args[0]; String release = args[0];
@@ -42,7 +40,6 @@ public final class NoteUpdater {
ItemDefinition.init(defs); ItemDefinition.init(defs);
os.writeShort(defs.length); os.writeShort(defs.length);
Map<Integer, Integer> itemToNote = new HashMap<Integer, Integer>(); Map<Integer, Integer> itemToNote = new HashMap<Integer, Integer>();
for (int id = 0; id < defs.length; id++) { for (int id = 0; id < defs.length; id++) {
@@ -68,4 +65,4 @@ public final class NoteUpdater {
} }
} }
} }