mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Merge pull request #234 from WizardJesse1/master
Add prayer level requirements for equipping items
This commit is contained in:
+32
-31
@@ -147,26 +147,6 @@ public final class EquipmentDefinition {
|
||||
return levels[HITPOINTS];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return The id.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum level required to equip this item for a specific skill.
|
||||
*
|
||||
* @param skill The skill id.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel(int skill) {
|
||||
Preconditions.checkArgument(skill >= ATTACK && skill <= MAGIC, "Skill id out of bounds.");
|
||||
return levels[skill];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum magic level required to equip this item.
|
||||
*
|
||||
@@ -194,15 +174,6 @@ public final class EquipmentDefinition {
|
||||
return levels[RANGED];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the target slot.
|
||||
*
|
||||
* @return The target slot.
|
||||
*/
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum strength level required to equip this item.
|
||||
*
|
||||
@@ -212,6 +183,35 @@ public final class EquipmentDefinition {
|
||||
return levels[STRENGTH];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id.
|
||||
*
|
||||
* @return The id.
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum level required to equip this item for a specific skill.
|
||||
*
|
||||
* @param skill The skill id.
|
||||
* @return The level.
|
||||
*/
|
||||
public int getLevel(int skill) {
|
||||
Preconditions.checkArgument(skill >= ATTACK && skill <= MAGIC, "Skill id out of bounds.");
|
||||
return levels[skill];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the target slot.
|
||||
*
|
||||
* @return The target slot.
|
||||
*/
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this equipment is a full body.
|
||||
*
|
||||
@@ -270,10 +270,11 @@ public final class EquipmentDefinition {
|
||||
* @param strength The required strength level.
|
||||
* @param defence The required defence level.
|
||||
* @param ranged The required ranged level.
|
||||
* @param prayer The required prayer level.
|
||||
* @param magic The required magic level.
|
||||
*/
|
||||
public void setLevels(int attack, int strength, int defence, int ranged, int magic) {
|
||||
setLevels(attack, strength, defence, 1, ranged, 1, magic);
|
||||
public void setLevels(int attack, int strength, int defence, int ranged, int prayer, int magic) {
|
||||
setLevels(attack, strength, defence, 1, ranged, prayer, magic);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+31
-1
@@ -31,7 +31,7 @@ public final class EquipmentUpdater {
|
||||
String release = args[0];
|
||||
|
||||
try (DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("data/equipment-" + release + ".dat")));
|
||||
IndexedFileSystem fs = new IndexedFileSystem(Paths.get("data/fs/", release), true)) {
|
||||
IndexedFileSystem fs = new IndexedFileSystem(Paths.get("data/fs/", release), true)) {
|
||||
ItemDefinitionDecoder decoder = new ItemDefinitionDecoder(fs);
|
||||
decoder.run();
|
||||
|
||||
@@ -52,6 +52,7 @@ public final class EquipmentUpdater {
|
||||
os.writeByte(getStrengthRequirement(definition));
|
||||
os.writeByte(getDefenceRequirement(definition));
|
||||
os.writeByte(getRangedRequirement(definition));
|
||||
os.writeByte(getPrayerRequirement(definition));
|
||||
os.writeByte(getMagicRequirement(definition));
|
||||
}
|
||||
}
|
||||
@@ -254,6 +255,12 @@ public final class EquipmentUpdater {
|
||||
return 1;
|
||||
} else if (id == 7456) {
|
||||
return 1;
|
||||
} else if (id == 2661) {
|
||||
return 40;
|
||||
} else if (id == 2667) {
|
||||
return 40;
|
||||
} else if (id == 3479) {
|
||||
return 40;
|
||||
} else if (name.equals("White med helm")) {
|
||||
return 10;
|
||||
} else if (name.equals("White chainbody")) {
|
||||
@@ -587,8 +594,29 @@ public final class EquipmentUpdater {
|
||||
return 30;
|
||||
} else if (name.equals("Fire battlestaff")) {
|
||||
return 30;
|
||||
} else if (name.equals("Toktz-mej-tal")) {
|
||||
return 60;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the prayer requirement.
|
||||
*
|
||||
* @param definition the item.
|
||||
* @return The required level.
|
||||
*/
|
||||
private static int getPrayerRequirement(ItemDefinition definition) {
|
||||
String name = definition.getName();
|
||||
if (name == null) {
|
||||
name = "null";
|
||||
}
|
||||
if (name.contains("Initiate")) {
|
||||
return 10;
|
||||
}
|
||||
if (name.contains("Proselyte")) {
|
||||
return 20;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -886,6 +914,8 @@ public final class EquipmentUpdater {
|
||||
return true;
|
||||
} else if (id == 4214) {
|
||||
return true;
|
||||
} else if (id == 6526) {
|
||||
return true;
|
||||
} else if (name.endsWith("2h sword")) {
|
||||
return true;
|
||||
} else if (name.endsWith("longbow")) {
|
||||
|
||||
Binary file not shown.
@@ -63,10 +63,11 @@ public final class EquipmentDefinitionParser implements Runnable {
|
||||
int strength = in.readByte() & 0xFF;
|
||||
int defence = in.readByte() & 0xFF;
|
||||
int ranged = in.readByte() & 0xFF;
|
||||
int prayer = in.readByte() & 0xFF;
|
||||
int magic = in.readByte() & 0xFF;
|
||||
|
||||
EquipmentDefinition definition = new EquipmentDefinition(id);
|
||||
definition.setLevels(attack, strength, defence, ranged, magic);
|
||||
definition.setLevels(attack, strength, defence, ranged, prayer, magic);
|
||||
definition.setSlot(slot);
|
||||
definition.setFlags(twoHanded, fullBody, fullHat, fullMask);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user