Reformat and clean up "constants" package

This commit is contained in:
P0nk
2021-09-09 23:23:32 +02:00
parent 250d49e85d
commit 69f4580637
61 changed files with 307 additions and 356 deletions

View File

@@ -41,15 +41,15 @@ public class GameConstants {
public static final int MAX_FIELD_MOB_DAMAGE = getMaxObstacleMobDamageFromWz() * 2;
public static int getPlayerBonusDropRate(int slot) {
return(DROP_RATE_GAIN[slot]);
return (DROP_RATE_GAIN[slot]);
}
public static int getPlayerBonusMesoRate(int slot) {
return(MESO_RATE_GAIN[slot]);
return (MESO_RATE_GAIN[slot]);
}
public static int getPlayerBonusExpRate(int slot) {
return(EXP_RATE_GAIN[slot]);
return (EXP_RATE_GAIN[slot]);
}
// "goto" command for players
@@ -281,15 +281,15 @@ public class GameConstants {
private static final int[] CUSTOM_ACTION = {1, 0, 3, 2, 53, 54, 100, 52, 51, 19, 5, 9, 50, 7, 22, 101, 102, 103, 104, 105, 106, 8, 17, 26, 20, 4};
public static int[] getCustomKey(boolean customKeyset) {
return(customKeyset ? CUSTOM_KEY : DEFAULT_KEY);
return (customKeyset ? CUSTOM_KEY : DEFAULT_KEY);
}
public static int[] getCustomType(boolean customKeyset) {
return(customKeyset ? CUSTOM_TYPE : DEFAULT_TYPE);
return (customKeyset ? CUSTOM_TYPE : DEFAULT_TYPE);
}
public static int[] getCustomAction(boolean customKeyset) {
return(customKeyset ? CUSTOM_ACTION : DEFAULT_ACTION);
return (customKeyset ? CUSTOM_ACTION : DEFAULT_ACTION);
}
private static final int[] mobHpVal = {0, 15, 20, 25, 35, 50, 65, 80, 95, 110, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350,
@@ -306,10 +306,10 @@ public class GameConstants {
public static String getJobName(int jobid) {
String name = jobNames.get(jobid);
if(name == null) {
if (name == null) {
Job job = Job.getById(jobid);
if(job != null) {
if (job != null) {
name = job.name().toLowerCase();
name = name.replaceAll("[*0-9]", "");
name = name.substring(0, 1).toUpperCase() + name.substring(1);
@@ -332,7 +332,7 @@ public class GameConstants {
}
public static boolean isHallOfFameMap(int mapid) {
switch(mapid) {
switch (mapid) {
case 102000004: // warrior
case 101000004: // magician
case 100000204: // bowman
@@ -351,7 +351,7 @@ public class GameConstants {
}
public static boolean isPodiumHallOfFameMap(int mapid) {
switch(mapid) {
switch (mapid) {
case 102000004: // warrior
case 101000004: // magician
case 100000204: // bowman
@@ -365,39 +365,39 @@ public class GameConstants {
}
public static byte getHallOfFameBranch(Job job, int mapid) {
if(!isHallOfFameMap(mapid)) {
if (!isHallOfFameMap(mapid)) {
return (byte) (26 + 4 * (mapid / 100000000)); // custom, 400 pnpcs available per continent
}
if(job.isA(Job.WARRIOR)) {
if (job.isA(Job.WARRIOR)) {
return 10;
} else if(job.isA(Job.MAGICIAN)) {
} else if (job.isA(Job.MAGICIAN)) {
return 11;
} else if(job.isA(Job.BOWMAN)) {
} else if (job.isA(Job.BOWMAN)) {
return 12;
} else if(job.isA(Job.THIEF)) {
} else if (job.isA(Job.THIEF)) {
return 13;
} else if(job.isA(Job.PIRATE)) {
} else if (job.isA(Job.PIRATE)) {
return 14;
} else if(job.isA(Job.DAWNWARRIOR1)) {
} else if (job.isA(Job.DAWNWARRIOR1)) {
return 15;
} else if(job.isA(Job.BLAZEWIZARD1)) {
} else if (job.isA(Job.BLAZEWIZARD1)) {
return 16;
} else if(job.isA(Job.WINDARCHER1)) {
} else if (job.isA(Job.WINDARCHER1)) {
return 17;
} else if(job.isA(Job.NIGHTWALKER1)) {
} else if (job.isA(Job.NIGHTWALKER1)) {
return 18;
} else if(job.isA(Job.THUNDERBREAKER1)) {
} else if (job.isA(Job.THUNDERBREAKER1)) {
return 19;
} else if(job.isA(Job.ARAN1)) {
} else if (job.isA(Job.ARAN1)) {
return 20;
} else if(job.isA(Job.EVAN1)) {
} else if (job.isA(Job.EVAN1)) {
return 21;
} else if(job.isA(Job.BEGINNER)) {
} else if (job.isA(Job.BEGINNER)) {
return 22;
} else if(job.isA(Job.NOBLESSE)) {
} else if (job.isA(Job.NOBLESSE)) {
return 23;
} else if(job.isA(Job.LEGEND)) {
} else if (job.isA(Job.LEGEND)) {
return 24;
} else {
return 25;
@@ -407,7 +407,7 @@ public class GameConstants {
public static int getOverallJobRankByScriptId(int scriptId) {
int branch = (scriptId / 100) % 100;
if(branch < 26) {
if (branch < 26) {
return (scriptId % 100) + 1;
} else {
return ((scriptId - 2600) % 400) + 1;
@@ -418,7 +418,7 @@ public class GameConstants {
scriptId /= 100;
scriptId %= 100;
if(branch < 26) {
if (branch < 26) {
return branch == scriptId;
} else {
return scriptId >= branch && scriptId < branch + 4;
@@ -428,20 +428,20 @@ public class GameConstants {
public static int getHallOfFameMapid(Job job) {
int jobid = job.getId();
if(isCygnus(jobid)) {
if (isCygnus(jobid)) {
return 130000100;
} else if(isAran(jobid)) {
} else if (isAran(jobid)) {
return 140010110;
} else {
if(job.isA(Job.WARRIOR)) {
if (job.isA(Job.WARRIOR)) {
return 102000004;
} else if(job.isA(Job.MAGICIAN)) {
} else if (job.isA(Job.MAGICIAN)) {
return 101000004;
} else if(job.isA(Job.BOWMAN)) {
} else if (job.isA(Job.BOWMAN)) {
return 100000204;
} else if(job.isA(Job.THIEF)) {
} else if (job.isA(Job.THIEF)) {
return 103000008;
} else if(job.isA(Job.PIRATE)) {
} else if (job.isA(Job.PIRATE)) {
return 120000105;
} else {
return 130000110; // beginner explorers are allotted with the Cygnus, available map lul
@@ -452,9 +452,9 @@ public class GameConstants {
public static int getJobBranch(Job job) {
int jobid = job.getId();
if(jobid % 1000 == 0) {
if (jobid % 1000 == 0) {
return 0;
} else if(jobid % 100 == 0) {
} else if (jobid % 100 == 0) {
return 1;
} else {
return 2 + (jobid % 10);
@@ -464,7 +464,7 @@ public class GameConstants {
public static int getJobMaxLevel(Job job) {
int jobBranch = getJobBranch(job);
switch(jobBranch) {
switch (jobBranch) {
case 0:
return 10; // beginner
@@ -508,7 +508,7 @@ public class GameConstants {
}
private static boolean isInBranchJobTree(int skillJobId, int jobId, int branchType) {
int branch = (int)(Math.pow(10, branchType));
int branch = (int) (Math.pow(10, branchType));
int skillBranch = (skillJobId / branch) * branch;
int jobBranch = (jobId / branch) * branch;
@@ -517,7 +517,7 @@ public class GameConstants {
}
private static boolean hasDivergedBranchJobTree(int skillJobId, int jobId, int branchType) {
int branch = (int)(Math.pow(10, branchType));
int branch = (int) (Math.pow(10, branchType));
int skillBranch = skillJobId / branch;
int jobBranch = jobId / branch;
@@ -528,10 +528,14 @@ public class GameConstants {
public static boolean isInJobTree(int skillId, int jobId) {
int skillJob = skillId / 10000;
if(!isInBranchJobTree(skillJob, jobId, 0)) {
for(int i = 1; i <= 3; i++) {
if(hasDivergedBranchJobTree(skillJob, jobId, i)) return false;
if(isInBranchJobTree(skillJob, jobId, i)) return (skillJob <= jobId);
if (!isInBranchJobTree(skillJob, jobId, 0)) {
for (int i = 1; i <= 3; i++) {
if (hasDivergedBranchJobTree(skillJob, jobId, i)) {
return false;
}
if (isInBranchJobTree(skillJob, jobId, i)) {
return (skillJob <= jobId);
}
}
} else {
return (skillJob <= jobId);
@@ -557,11 +561,11 @@ public class GameConstants {
}
public static boolean isMerchantLocked(MapleMap map) {
if(FieldLimit.CANNOTMIGRATE.check(map.getFieldLimit())) { // maps that cannot access cash shop cannot access merchants too (except FM rooms).
if (FieldLimit.CANNOTMIGRATE.check(map.getFieldLimit())) { // maps that cannot access cash shop cannot access merchants too (except FM rooms).
return true;
}
switch(map.getId()) {
switch (map.getId()) {
case 910000000:
return true;
}
@@ -646,7 +650,7 @@ public class GameConstants {
}
public static String ordinal(int i) {
String[] sufixes = new String[] { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
String[] sufixes = new String[]{"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"};
switch (i % 100) {
case 11:
case 12:
@@ -659,7 +663,7 @@ public class GameConstants {
}
public synchronized static String numberWithCommas(int i) {
if(!YamlConfig.config.server.USE_DISPLAY_NUMBERS_WITH_COMMA) {
if (!YamlConfig.config.server.USE_DISPLAY_NUMBERS_WITH_COMMA) {
return nfFormatter.format(i); // will display number on whatever locale is currently assigned on NumberFormat
} else {
return NumberFormat.getNumberInstance(Locale.UK).format(i);
@@ -669,7 +673,7 @@ public class GameConstants {
public synchronized static Number parseNumber(String value) {
try {
return nfParser.parse(value);
} catch(Exception e) {
} catch (Exception e) {
e.printStackTrace();
return 0.0f;
}

View File

@@ -1,7 +1,6 @@
package constants.inventory;
/**
*
* @author The Spookster (The Real Spookster)
*/
public enum EquipSlot {
@@ -33,10 +32,10 @@ public enum EquipSlot {
private String name;
private int[] allowed;
private EquipSlot() {
EquipSlot() {
}
private EquipSlot(String wz, int... in) {
EquipSlot(String wz, int... in) {
name = wz;
allowed = in;
}

View File

@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.Map;
/**
*
* @author RonanLana
*/
public enum EquipType {
@@ -66,7 +65,7 @@ public enum EquipType {
private final int i;
private static final Map<Integer, EquipType> map = new HashMap(34);
private EquipType(int val) {
EquipType(int val) {
this.i = val;
}
@@ -84,7 +83,7 @@ public enum EquipType {
EquipType ret;
int val = itemid / 100000;
if(val == 13 || val == 14) {
if (val == 13 || val == 14) {
ret = map.get(itemid / 1000);
} else {
ret = map.get(itemid / 10000);

View File

@@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Set;
/**
*
* @author Jay Estrella
* @author Ronan
*/
@@ -53,7 +52,7 @@ public final class ItemConstants {
static {
int[] pi = {5000060, 5000100, 5000101, 5000102}; // i ain't going to open one gigantic itemid cache just for 4 perma itemids, no way!
for(int i : pi) {
for (int i : pi) {
permanentItemids.add(i);
}
}
@@ -150,9 +149,10 @@ public final class ItemConstants {
}
public static boolean isFlagModifier(int scrollId, short flag) {
if(scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) return true;
if(scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES)) return true;
return false;
if (scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) {
return true;
}
return scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES);
}
public static boolean isChaosScroll(int scrollId) {

View File

@@ -19,13 +19,13 @@
*/
package constants.net;
import java.util.Map;
import java.util.HashMap;
import net.opcodes.RecvOpcode;
import net.opcodes.SendOpcode;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author Ronan
*/
public class OpcodeConstants {

View File

@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Aran {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Archer {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Assassin {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Bandit {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Beginner {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Bishop {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class BlazeWizard {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Bowmaster {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Brawler {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Buccaneer {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class ChiefBandit {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Corsair {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Crossbowman {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Crusader {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class DarkKnight {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class DawnWarrior {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author David
*/
public class DragonKnight {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class FPArchMage {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class FPMage {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class FPWizard {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Fighter {

View File

@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package constants.skills;
/**
*
* @author BubblesDev
*/
public class GM {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Gunslinger {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Hermit {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Hero {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Hunter {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class ILArchMage {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class ILMage {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class ILWizard {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author kevintjuh93
*/
public class Legend {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Magician {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Marauder {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Marksman {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class NightLord {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class NightWalker {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Noblesse {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Outlaw {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Page {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Paladin {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Pirate {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Priest {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Ranger {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Rogue {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Shadower {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Sniper {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class Spearman {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class SuperGM {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class ThunderBreaker {

View File

@@ -5,7 +5,6 @@
package constants.skills;
/**
*
* @author Tyler
*/
public class Warrior {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class WhiteKnight {

View File

@@ -22,7 +22,6 @@
package constants.skills;
/**
*
* @author BubblesDev
*/
public class WindArcher {

View File

@@ -3,7 +3,6 @@ package constants.string;
import client.Character;
/**
*
* @author Drago (Dragohe4rt)
*/
public class LanguageConstants {
@@ -15,7 +14,7 @@ public class LanguageConstants {
int lang;
private Language(int lang) {
Language(int lang) {
this.lang = lang;
}