Reformat and clean up "client" package
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
package client;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public interface AbstractCharacterListener {
|
||||
|
||||
@@ -40,23 +40,24 @@ public class BuddyList {
|
||||
public enum BuddyAddResult {
|
||||
BUDDYLIST_FULL, ALREADY_ON_LIST, OK
|
||||
}
|
||||
private Map<Integer, BuddylistEntry> buddies = new LinkedHashMap<>();
|
||||
|
||||
private final Map<Integer, BuddylistEntry> buddies = new LinkedHashMap<>();
|
||||
private int capacity;
|
||||
private Deque<CharacterNameAndId> pendingRequests = new LinkedList<>();
|
||||
private final Deque<CharacterNameAndId> pendingRequests = new LinkedList<>();
|
||||
|
||||
public BuddyList(int capacity) {
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public boolean contains(int characterId) {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
return buddies.containsKey(characterId);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean containsVisible(int characterId) {
|
||||
BuddylistEntry ble;
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
ble = buddies.get(characterId);
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ public class BuddyList {
|
||||
}
|
||||
|
||||
public BuddylistEntry get(int characterId) {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
return buddies.get(characterId);
|
||||
}
|
||||
}
|
||||
@@ -93,31 +94,31 @@ public class BuddyList {
|
||||
}
|
||||
|
||||
public void put(BuddylistEntry entry) {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
buddies.put(entry.getCharacterId(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(int characterId) {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
buddies.remove(characterId);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<BuddylistEntry> getBuddies() {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
return Collections.unmodifiableCollection(buddies.values());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
return buddies.size() >= capacity;
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getBuddyIds() {
|
||||
synchronized(buddies) {
|
||||
synchronized (buddies) {
|
||||
int[] buddyIds = new int[buddies.size()];
|
||||
int i = 0;
|
||||
for (BuddylistEntry ble : buddies.values()) {
|
||||
@@ -128,10 +129,10 @@ public class BuddyList {
|
||||
}
|
||||
|
||||
public void broadcast(Packet packet, PlayerStorage pstorage) {
|
||||
for(int bid : getBuddyIds()) {
|
||||
for (int bid : getBuddyIds()) {
|
||||
Character chr = pstorage.getCharacterById(bid);
|
||||
|
||||
if(chr != null && chr.isLoggedinWorld()) {
|
||||
if (chr != null && chr.isLoggedinWorld()) {
|
||||
chr.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,13 @@
|
||||
package client;
|
||||
|
||||
public class BuddylistEntry {
|
||||
private String name;
|
||||
private final String name;
|
||||
private String group;
|
||||
private int cid;
|
||||
private final int cid;
|
||||
private int channel;
|
||||
private boolean visible;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param characterId
|
||||
* @param channel should be -1 if the buddy is offline
|
||||
@@ -102,9 +101,6 @@ public class BuddylistEntry {
|
||||
return false;
|
||||
}
|
||||
final BuddylistEntry other = (BuddylistEntry) obj;
|
||||
if (cid != other.cid) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return cid == other.cid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
package client;
|
||||
|
||||
public class CharacterNameAndId {
|
||||
private int id;
|
||||
private String name;
|
||||
private final int id;
|
||||
private final String name;
|
||||
|
||||
public CharacterNameAndId(int id, String name) {
|
||||
super();
|
||||
|
||||
@@ -153,7 +153,7 @@ public class Client extends ChannelInboundHandlerAdapter {
|
||||
}
|
||||
|
||||
public static Client createMock() {
|
||||
return new Client(null, -1,null, null, -123, -123);
|
||||
return new Client(null, -1, null, null, -123, -123);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -447,7 +447,9 @@ public class FamilyEntry {
|
||||
public synchronized boolean isJunior(FamilyEntry entry) { //require locking since result accuracy is vital
|
||||
if (juniors[0] == entry) {
|
||||
return true;
|
||||
} else return juniors[1] == entry;
|
||||
} else {
|
||||
return juniors[1] == entry;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean removeJunior(FamilyEntry junior) {
|
||||
|
||||
@@ -41,8 +41,8 @@ public final class MonsterBook {
|
||||
private int specialCard = 0;
|
||||
private int normalCard = 0;
|
||||
private int bookLevel = 1;
|
||||
private Map<Integer, Integer> cards = new LinkedHashMap<>();
|
||||
private Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.BOOK);
|
||||
private final Map<Integer, Integer> cards = new LinkedHashMap<>();
|
||||
private final Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.BOOK);
|
||||
|
||||
public Set<Entry<Integer, Integer>> getCardSet() {
|
||||
lock.lock();
|
||||
@@ -61,8 +61,8 @@ public final class MonsterBook {
|
||||
try {
|
||||
qty = cards.get(cardid);
|
||||
|
||||
if(qty != null) {
|
||||
if(qty < 5) {
|
||||
if (qty != null) {
|
||||
if (qty < 5) {
|
||||
cards.put(cardid, qty + 1);
|
||||
}
|
||||
} else {
|
||||
@@ -79,7 +79,7 @@ public final class MonsterBook {
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
if(qty < 5) {
|
||||
if (qty < 5) {
|
||||
if (qty == 0) { // leveling system only accounts unique cards
|
||||
calculateLevel();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public final class MonsterBook {
|
||||
|
||||
private static int saveStringConcat(char[] data, int pos, String s) {
|
||||
int len = s.length();
|
||||
for(int j = 0; j < len; j++) {
|
||||
for (int j = 0; j < len; j++) {
|
||||
data[pos + j] = s.charAt(j);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Skill {
|
||||
private int id;
|
||||
private List<StatEffect> effects = new ArrayList<>();
|
||||
private final int id;
|
||||
private final List<StatEffect> effects = new ArrayList<>();
|
||||
private Element element;
|
||||
private int animationTime;
|
||||
private int job;
|
||||
private final int job;
|
||||
private boolean action;
|
||||
|
||||
public Skill(int id) {
|
||||
|
||||
@@ -339,10 +339,11 @@ public class SkillFactory {
|
||||
}
|
||||
if (data.getChildByPath(skill.toString()) != null) {
|
||||
for (Data skilldata : data.getChildByPath(skill.toString()).getChildren()) {
|
||||
if (skilldata.getName().equals("name"))
|
||||
if (skilldata.getName().equals("name")) {
|
||||
return DataTool.getString(skilldata, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ public class SkillMacro {
|
||||
private int skill1;
|
||||
private int skill2;
|
||||
private int skill3;
|
||||
private String name;
|
||||
private int shout;
|
||||
private int position;
|
||||
private final String name;
|
||||
private final int shout;
|
||||
private final int position;
|
||||
|
||||
public SkillMacro(int skill1, int skill2, int skill3, String name, int shout, int position) {
|
||||
this.skill1 = skill1;
|
||||
|
||||
@@ -30,7 +30,6 @@ import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public enum AutobanFactory {
|
||||
@@ -54,19 +53,19 @@ public enum AutobanFactory {
|
||||
FAST_ATTACK(10, 30000),
|
||||
MPCON(25, 30000);
|
||||
|
||||
private int points;
|
||||
private long expiretime;
|
||||
private final int points;
|
||||
private final long expiretime;
|
||||
|
||||
private AutobanFactory() {
|
||||
AutobanFactory() {
|
||||
this(1, -1);
|
||||
}
|
||||
|
||||
private AutobanFactory(int points) {
|
||||
AutobanFactory(int points) {
|
||||
this.points = points;
|
||||
this.expiretime = -1;
|
||||
}
|
||||
|
||||
private AutobanFactory(int points, long expire) {
|
||||
AutobanFactory(int points, long expire) {
|
||||
this.points = points;
|
||||
this.expiretime = expire;
|
||||
}
|
||||
@@ -84,8 +83,8 @@ public enum AutobanFactory {
|
||||
}
|
||||
|
||||
public void alert(Character chr, String reason) {
|
||||
if(YamlConfig.config.server.USE_AUTOBAN == true) {
|
||||
if (chr != null && MapleLogger.ignored.contains(chr.getId())){
|
||||
if (YamlConfig.config.server.USE_AUTOBAN == true) {
|
||||
if (chr != null && MapleLogger.ignored.contains(chr.getId())) {
|
||||
return;
|
||||
}
|
||||
Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), PacketCreator.sendYellowTip((chr != null ? Character.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason));
|
||||
@@ -96,7 +95,7 @@ public enum AutobanFactory {
|
||||
}
|
||||
|
||||
public void autoban(Character chr, String value) {
|
||||
if(YamlConfig.config.server.USE_AUTOBAN == true) {
|
||||
if (YamlConfig.config.server.USE_AUTOBAN == true) {
|
||||
chr.autoban("Autobanned for (" + this.name() + ": " + value + ")");
|
||||
//chr.sendPolice("You will be disconnected for (" + this.name() + ": " + value + ")");
|
||||
}
|
||||
|
||||
@@ -14,19 +14,18 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public class AutobanManager {
|
||||
private Character chr;
|
||||
private Map<AutobanFactory, Integer> points = new HashMap<>();
|
||||
private Map<AutobanFactory, Long> lastTime = new HashMap<>();
|
||||
private final Character chr;
|
||||
private final Map<AutobanFactory, Integer> points = new HashMap<>();
|
||||
private final Map<AutobanFactory, Long> lastTime = new HashMap<>();
|
||||
private int misses = 0;
|
||||
private int lastmisses = 0;
|
||||
private int samemisscount = 0;
|
||||
private long[] spam = new long[20];
|
||||
private int[] timestamp = new int[20];
|
||||
private byte[] timestampcounter = new byte[20];
|
||||
private final long[] spam = new long[20];
|
||||
private final int[] timestamp = new int[20];
|
||||
private final byte[] timestampcounter = new byte[20];
|
||||
|
||||
|
||||
public AutobanManager(Character chr) {
|
||||
@@ -35,7 +34,7 @@ public class AutobanManager {
|
||||
|
||||
public void addPoint(AutobanFactory fac, String reason) {
|
||||
if (YamlConfig.config.server.USE_AUTOBAN) {
|
||||
if (chr.isGM() || chr.isBanned()){
|
||||
if (chr.isGM() || chr.isBanned()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,13 +43,15 @@ public class AutobanManager {
|
||||
points.put(fac, points.get(fac) / 2); //So the points are not completely gone.
|
||||
}
|
||||
}
|
||||
if (fac.getExpire() != -1)
|
||||
if (fac.getExpire() != -1) {
|
||||
lastTime.put(fac, Server.getInstance().getCurrentTime());
|
||||
}
|
||||
|
||||
if (points.containsKey(fac)) {
|
||||
points.put(fac, points.get(fac) + 1);
|
||||
} else
|
||||
} else {
|
||||
points.put(fac, 1);
|
||||
}
|
||||
|
||||
if (points.get(fac) >= fac.getMaximum()) {
|
||||
chr.autoban(reason);
|
||||
@@ -70,12 +71,13 @@ public class AutobanManager {
|
||||
if (lastmisses == misses && misses > 6) {
|
||||
samemisscount++;
|
||||
}
|
||||
if (samemisscount > 4)
|
||||
if (samemisscount > 4) {
|
||||
chr.sendPolice("You will be disconnected for miss godmode.");
|
||||
}
|
||||
//chr.autoban("Autobanned for : " + misses + " Miss godmode", 1);
|
||||
else if (samemisscount > 0)
|
||||
|
||||
else if (samemisscount > 0) {
|
||||
this.lastmisses = misses;
|
||||
}
|
||||
this.misses = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,19 +48,19 @@ public class CommandsExecutor {
|
||||
private static final char USER_HEADING = '@';
|
||||
private static final char GM_HEADING = '!';
|
||||
|
||||
public static boolean isCommand(Client client, String content){
|
||||
public static boolean isCommand(Client client, String content) {
|
||||
char heading = content.charAt(0);
|
||||
if (client.getPlayer().isGM()){
|
||||
if (client.getPlayer().isGM()) {
|
||||
return heading == USER_HEADING || heading == GM_HEADING;
|
||||
}
|
||||
return heading == USER_HEADING;
|
||||
}
|
||||
|
||||
private HashMap<String, Command> registeredCommands = new HashMap<>();
|
||||
private final HashMap<String, Command> registeredCommands = new HashMap<>();
|
||||
private Pair<List<String>, List<String>> levelCommandsCursor;
|
||||
private List<Pair<List<String>, List<String>>> commandsNameDesc = new ArrayList<>();
|
||||
private final List<Pair<List<String>, List<String>>> commandsNameDesc = new ArrayList<>();
|
||||
|
||||
private CommandsExecutor(){
|
||||
private CommandsExecutor() {
|
||||
registerLv0Commands();
|
||||
registerLv1Commands();
|
||||
registerLv2Commands();
|
||||
@@ -74,7 +74,7 @@ public class CommandsExecutor {
|
||||
return commandsNameDesc;
|
||||
}
|
||||
|
||||
public void handle(Client client, String message){
|
||||
public void handle(Client client, String message) {
|
||||
if (client.tryacquireClient()) {
|
||||
try {
|
||||
handleInternal(client, message);
|
||||
@@ -86,7 +86,7 @@ public class CommandsExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleInternal(Client client, String message){
|
||||
private void handleInternal(Client client, String message) {
|
||||
if (client.getPlayer().getMapId() == 300000012) {
|
||||
client.getPlayer().yellowMessage("You do not have permission to use commands while in jail.");
|
||||
return;
|
||||
@@ -102,11 +102,11 @@ public class CommandsExecutor {
|
||||
final String[] lowercaseParams = splitedMessage[1].toLowerCase().split(splitRegex);
|
||||
|
||||
final Command command = registeredCommands.get(commandName);
|
||||
if (command == null){
|
||||
if (command == null) {
|
||||
client.getPlayer().yellowMessage("Command '" + commandName + "' is not available. See @commands for a list of available commands.");
|
||||
return;
|
||||
}
|
||||
if (client.getPlayer().gmLevel() < command.getRank()){
|
||||
if (client.getPlayer().gmLevel() < command.getRank()) {
|
||||
client.getPlayer().yellowMessage("You do not have permission to use this command.");
|
||||
return;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class CommandsExecutor {
|
||||
writeLog(client, message);
|
||||
}
|
||||
|
||||
private void writeLog(Client client, String command){
|
||||
private void writeLog(Client client, String command) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm");
|
||||
FilePrinter.print(FilePrinter.USED_COMMANDS, client.getPlayer().getName() + " used: " + command + " on "
|
||||
+ sdf.format(Calendar.getInstance().getTime()));
|
||||
@@ -131,30 +131,31 @@ public class CommandsExecutor {
|
||||
try {
|
||||
levelCommandsCursor.getRight().add(commandClass.newInstance().getDescription());
|
||||
levelCommandsCursor.getLeft().add(name);
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void addCommand(String[] syntaxs, Class<? extends Command> commandClass){
|
||||
for (String syntax : syntaxs){
|
||||
private void addCommand(String[] syntaxs, Class<? extends Command> commandClass) {
|
||||
for (String syntax : syntaxs) {
|
||||
addCommand(syntax, 0, commandClass);
|
||||
}
|
||||
}
|
||||
private void addCommand(String syntax, Class<? extends Command> commandClass){
|
||||
|
||||
private void addCommand(String syntax, Class<? extends Command> commandClass) {
|
||||
//for (String syntax : syntaxs){
|
||||
addCommand(syntax, 0, commandClass);
|
||||
//}
|
||||
}
|
||||
|
||||
private void addCommand(String[] surtaxes, int rank, Class<? extends Command> commandClass){
|
||||
for (String syntax : surtaxes){
|
||||
private void addCommand(String[] surtaxes, int rank, Class<? extends Command> commandClass) {
|
||||
for (String syntax : surtaxes) {
|
||||
addCommand(syntax, rank, commandClass);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCommand(String syntax, int rank, Class<? extends Command> commandClass){
|
||||
if (registeredCommands.containsKey(syntax.toLowerCase())){
|
||||
private void addCommand(String syntax, int rank, Class<? extends Command> commandClass) {
|
||||
if (registeredCommands.containsKey(syntax.toLowerCase())) {
|
||||
System.out.println("Error on register command with name: " + syntax + ". Already exists.");
|
||||
return;
|
||||
}
|
||||
@@ -174,7 +175,7 @@ public class CommandsExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private void registerLv0Commands(){
|
||||
private void registerLv0Commands() {
|
||||
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
|
||||
|
||||
addCommand(new String[]{"help", "commands"}, HelpCommand.class);
|
||||
@@ -222,7 +223,7 @@ public class CommandsExecutor {
|
||||
}
|
||||
|
||||
|
||||
private void registerLv2Commands(){
|
||||
private void registerLv2Commands() {
|
||||
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
|
||||
|
||||
addCommand("recharge", 2, RechargeCommand.class);
|
||||
@@ -331,7 +332,7 @@ public class CommandsExecutor {
|
||||
commandsNameDesc.add(levelCommandsCursor);
|
||||
}
|
||||
|
||||
private void registerLv4Commands(){
|
||||
private void registerLv4Commands() {
|
||||
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
|
||||
|
||||
addCommand("servermessage", 4, ServerMessageCommand.class);
|
||||
@@ -362,7 +363,7 @@ public class CommandsExecutor {
|
||||
commandsNameDesc.add(levelCommandsCursor);
|
||||
}
|
||||
|
||||
private void registerLv5Commands(){
|
||||
private void registerLv5Commands() {
|
||||
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
|
||||
|
||||
addCommand("debug", 5, DebugCommand.class);
|
||||
@@ -375,7 +376,7 @@ public class CommandsExecutor {
|
||||
commandsNameDesc.add(levelCommandsCursor);
|
||||
}
|
||||
|
||||
private void registerLv6Commands(){
|
||||
private void registerLv6Commands() {
|
||||
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
|
||||
|
||||
addCommand("setgmlevel", 6, SetGmLevelCommand.class);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DropLimitCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
int dropCount = c.getPlayer().getMap().getDroppedItemCount();
|
||||
if(((float) dropCount) / YamlConfig.config.server.ITEM_LIMIT_ON_MAP < 0.75f) {
|
||||
if (((float) dropCount) / YamlConfig.config.server.ITEM_LIMIT_ON_MAP < 0.75f) {
|
||||
c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300);
|
||||
} else {
|
||||
c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300);
|
||||
|
||||
@@ -38,24 +38,24 @@ public class GachaCommand extends Command {
|
||||
Gachapon.GachaponType gacha = null;
|
||||
String search = c.getPlayer().getLastCommandMessage();
|
||||
String gachaName = "";
|
||||
String [] names = {"Henesys", "Ellinia", "Perion", "Kerning City", "Sleepywood", "Mushroom Shrine", "Showa Spa Male", "Showa Spa Female", "New Leaf City", "Nautilus Harbor"};
|
||||
int [] ids = {9100100, 9100101, 9100102, 9100103, 9100104, 9100105, 9100106, 9100107, 9100109, 9100117};
|
||||
for (int i = 0; i < names.length; i++){
|
||||
if (search.equalsIgnoreCase(names[i])){
|
||||
String[] names = {"Henesys", "Ellinia", "Perion", "Kerning City", "Sleepywood", "Mushroom Shrine", "Showa Spa Male", "Showa Spa Female", "New Leaf City", "Nautilus Harbor"};
|
||||
int[] ids = {9100100, 9100101, 9100102, 9100103, 9100104, 9100105, 9100106, 9100107, 9100109, 9100117};
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (search.equalsIgnoreCase(names[i])) {
|
||||
gachaName = names[i];
|
||||
gacha = Gachapon.GachaponType.getByNpcId(ids[i]);
|
||||
}
|
||||
}
|
||||
if (gacha == null){
|
||||
if (gacha == null) {
|
||||
c.getPlayer().yellowMessage("Please use @gacha <name> where name corresponds to one of the below:");
|
||||
for (String name : names){
|
||||
for (String name : names) {
|
||||
c.getPlayer().yellowMessage(name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
String talkStr = "The #b" + gachaName + "#k Gachapon contains the following items.\r\n\r\n";
|
||||
for (int i = 0; i < 2; i++){
|
||||
for (int id : gacha.getItems(i)){
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int id : gacha.getItems(i)) {
|
||||
talkStr += "-" + ItemInformationProvider.getInstance().getName(id) + "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,15 +37,16 @@ public class JoinEventCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
if(!FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
||||
if (!FieldLimit.CANNOTMIGRATE.check(player.getMap().getFieldLimit())) {
|
||||
Event event = c.getChannelServer().getEvent();
|
||||
if(event != null) {
|
||||
if(event.getMapId() != player.getMapId()) {
|
||||
if(event.getLimit() > 0) {
|
||||
if (event != null) {
|
||||
if (event.getMapId() != player.getMapId()) {
|
||||
if (event.getLimit() > 0) {
|
||||
player.saveLocation("EVENT");
|
||||
|
||||
if(event.getMapId() == 109080000 || event.getMapId() == 109060001)
|
||||
if (event.getMapId() == 109080000 || event.getMapId() == 109060001) {
|
||||
player.setTeam(event.getLimit() % 2);
|
||||
}
|
||||
|
||||
event.minusLimit();
|
||||
|
||||
|
||||
@@ -36,19 +36,19 @@ public class LeaveEventCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
int returnMap = player.getSavedLocation("EVENT");
|
||||
if(returnMap != -1) {
|
||||
if(player.getOla() != null) {
|
||||
if (returnMap != -1) {
|
||||
if (player.getOla() != null) {
|
||||
player.getOla().resetTimes();
|
||||
player.setOla(null);
|
||||
}
|
||||
if(player.getFitness() != null) {
|
||||
if (player.getFitness() != null) {
|
||||
player.getFitness().resetTimes();
|
||||
player.setFitness(null);
|
||||
}
|
||||
|
||||
player.saveLocationOnWarp();
|
||||
player.changeMap(returnMap);
|
||||
if(c.getChannelServer().getEvent() != null) {
|
||||
if (c.getChannelServer().getEvent() != null) {
|
||||
c.getChannelServer().getEvent().addLimit();
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,9 @@ public class RatesCommand extends Command {
|
||||
showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n";
|
||||
showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n";
|
||||
showMsg_ += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n";
|
||||
if(YamlConfig.config.server.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
|
||||
if (YamlConfig.config.server.USE_QUEST_RATE) {
|
||||
showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
|
||||
}
|
||||
|
||||
player.showHint(showMsg_, 300);
|
||||
}
|
||||
|
||||
@@ -39,28 +39,36 @@ public class ShowRatesCommand extends Command {
|
||||
String showMsg = "#eEXP RATE#n" + "\r\n";
|
||||
showMsg += "World EXP Rate: #k" + c.getWorldServer().getExpRate() + "x#k" + "\r\n";
|
||||
showMsg += "Player EXP Rate: #k" + player.getRawExpRate() + "x#k" + "\r\n";
|
||||
if(player.getCouponExpRate() != 1) showMsg += "Coupon EXP Rate: #k" + player.getCouponExpRate() + "x#k" + "\r\n";
|
||||
if (player.getCouponExpRate() != 1) {
|
||||
showMsg += "Coupon EXP Rate: #k" + player.getCouponExpRate() + "x#k" + "\r\n";
|
||||
}
|
||||
showMsg += "EXP Rate: #e#b" + player.getExpRate() + "x#k#n" + (player.hasNoviceExpRate() ? " - novice rate" : "") + "\r\n";
|
||||
|
||||
showMsg += "\r\n" + "#eMESO RATE#n" + "\r\n";
|
||||
showMsg += "World MESO Rate: #k" + c.getWorldServer().getMesoRate() + "x#k" + "\r\n";
|
||||
showMsg += "Player MESO Rate: #k" + player.getRawMesoRate() + "x#k" + "\r\n";
|
||||
if(player.getCouponMesoRate() != 1) showMsg += "Coupon MESO Rate: #k" + player.getCouponMesoRate() + "x#k" + "\r\n";
|
||||
if (player.getCouponMesoRate() != 1) {
|
||||
showMsg += "Coupon MESO Rate: #k" + player.getCouponMesoRate() + "x#k" + "\r\n";
|
||||
}
|
||||
showMsg += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n";
|
||||
|
||||
showMsg += "\r\n" + "#eDROP RATE#n" + "\r\n";
|
||||
showMsg += "World DROP Rate: #k" + c.getWorldServer().getDropRate() + "x#k" + "\r\n";
|
||||
showMsg += "Player DROP Rate: #k" + player.getRawDropRate() + "x#k" + "\r\n";
|
||||
if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
|
||||
if (player.getCouponDropRate() != 1) {
|
||||
showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
|
||||
}
|
||||
showMsg += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n";
|
||||
|
||||
showMsg += "\r\n" + "#eBOSS DROP RATE#n" + "\r\n";
|
||||
showMsg += "World BOSS DROP Rate: #k" + c.getWorldServer().getBossDropRate() + "x#k" + "\r\n";
|
||||
showMsg += "Player DROP Rate: #k" + player.getRawDropRate() + "x#k" + "\r\n";
|
||||
if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
|
||||
if (player.getCouponDropRate() != 1) {
|
||||
showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
|
||||
}
|
||||
showMsg += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n";
|
||||
|
||||
if(YamlConfig.config.server.USE_QUEST_RATE) {
|
||||
if (YamlConfig.config.server.USE_QUEST_RATE) {
|
||||
showMsg += "\r\n" + "#eQUEST RATE#n" + "\r\n";
|
||||
showMsg += "World QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ public class UptimeCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
long milliseconds = System.currentTimeMillis() - Server.uptime;
|
||||
int seconds = (int) (milliseconds / 1000) % 60 ;
|
||||
int minutes = (int) ((milliseconds / (1000*60)) % 60);
|
||||
int hours = (int) ((milliseconds / (1000*60*60)) % 24);
|
||||
int days = (int) ((milliseconds / (1000*60*60*24)));
|
||||
int seconds = (int) (milliseconds / 1000) % 60;
|
||||
int minutes = (int) ((milliseconds / (1000 * 60)) % 60);
|
||||
int hours = (int) ((milliseconds / (1000 * 60 * 60)) % 24);
|
||||
int days = (int) ((milliseconds / (1000 * 60 * 60 * 24)));
|
||||
c.getPlayer().yellowMessage("Server has been online for " + days + " days " + hours + " hours " + minutes + " minutes and " + seconds + " seconds.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ public class BossHpCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
for(Monster monster : player.getMap().getAllMonsters()) {
|
||||
if(monster != null && monster.isBoss() && monster.getHp() > 0) {
|
||||
for (Monster monster : player.getMap().getAllMonsters()) {
|
||||
if (monster != null && monster.isBoss() && monster.getHp() > 0) {
|
||||
long percent = monster.getHp() * 100L / monster.getMaxHp();
|
||||
String bar = "[";
|
||||
for (int i = 0; i < 100; i++){
|
||||
for (int i = 0; i < 100; i++) {
|
||||
bar += i < percent ? "|" : ".";
|
||||
}
|
||||
bar += "]";
|
||||
|
||||
@@ -74,7 +74,7 @@ public class GotoCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
if (params.length < 1){
|
||||
if (params.length < 1) {
|
||||
String sendStr = "Syntax: #b@goto <map name>#k. Available areas:\r\n\r\n#rTowns:#k\r\n" + GOTO_TOWNS_INFO;
|
||||
if (player.isGM()) {
|
||||
sendStr += ("\r\n#rAreas:#k\r\n" + GOTO_AREAS_INFO);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MobHpCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
for(Monster monster : player.getMap().getAllMonsters()) {
|
||||
for (Monster monster : player.getMap().getAllMonsters()) {
|
||||
if (monster != null && monster.getHp() > 0) {
|
||||
player.yellowMessage(monster.getName() + " (" + monster.getId() + ") has " + monster.getHp() + " / " + monster.getMaxHp() + " HP.");
|
||||
|
||||
|
||||
@@ -50,20 +50,20 @@ public class WhatDropsFromCommand extends Command {
|
||||
int limit = 3;
|
||||
Iterator<Pair<Integer, String>> listIterator = MonsterInformationProvider.getMobsIDsFromName(monsterName).iterator();
|
||||
for (int i = 0; i < limit; i++) {
|
||||
if(listIterator.hasNext()) {
|
||||
if (listIterator.hasNext()) {
|
||||
Pair<Integer, String> data = listIterator.next();
|
||||
int mobId = data.getLeft();
|
||||
String mobName = data.getRight();
|
||||
output += mobName + " drops the following items:\r\n\r\n";
|
||||
for (MonsterDropEntry drop : MonsterInformationProvider.getInstance().retrieveDrop(mobId)){
|
||||
for (MonsterDropEntry drop : MonsterInformationProvider.getInstance().retrieveDrop(mobId)) {
|
||||
try {
|
||||
String name = ItemInformationProvider.getInstance().getName(drop.itemId);
|
||||
if (name == null || name.equals("null") || drop.chance == 0){
|
||||
if (name == null || name.equals("null") || drop.chance == 0) {
|
||||
continue;
|
||||
}
|
||||
float chance = Math.max(1000000 / drop.chance / (!MonsterInformationProvider.getInstance().isBoss(mobId) ? player.getDropRate() : player.getBossDropRate()), 1);
|
||||
output += "- " + name + " (1/" + (int) chance + ")\r\n";
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -43,16 +43,22 @@ public class ApCommand extends Command {
|
||||
|
||||
if (params.length < 2) {
|
||||
int newAp = Integer.parseInt(params[0]);
|
||||
if (newAp < 0) newAp = 0;
|
||||
else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP;
|
||||
if (newAp < 0) {
|
||||
newAp = 0;
|
||||
} else if (newAp > YamlConfig.config.server.MAX_AP) {
|
||||
newAp = YamlConfig.config.server.MAX_AP;
|
||||
}
|
||||
|
||||
player.changeRemainingAp(newAp, false);
|
||||
} else {
|
||||
Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
int newAp = Integer.parseInt(params[1]);
|
||||
if (newAp < 0) newAp = 0;
|
||||
else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP;
|
||||
if (newAp < 0) {
|
||||
newAp = 0;
|
||||
} else if (newAp > YamlConfig.config.server.MAX_AP) {
|
||||
newAp = YamlConfig.config.server.MAX_AP;
|
||||
}
|
||||
|
||||
victim.changeRemainingAp(newAp, false);
|
||||
} else {
|
||||
|
||||
@@ -44,6 +44,8 @@ public class BuffCommand extends Command {
|
||||
int skillid = Integer.parseInt(params[0]);
|
||||
|
||||
Skill skill = SkillFactory.getSkill(skillid);
|
||||
if (skill != null) skill.getEffect(skill.getMaxLevel()).applyTo(player);
|
||||
if (skill != null) {
|
||||
skill.getEffect(skill.getMaxLevel()).applyTo(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,32 +47,37 @@ public class ClearSlotCommand extends Command {
|
||||
case "all":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("All Slots Cleared.");
|
||||
@@ -80,8 +85,9 @@ public class ClearSlotCommand extends Command {
|
||||
case "equip":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Equipment Slot Cleared.");
|
||||
@@ -89,8 +95,9 @@ public class ClearSlotCommand extends Command {
|
||||
case "use":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Use Slot Cleared.");
|
||||
@@ -98,8 +105,9 @@ public class ClearSlotCommand extends Command {
|
||||
case "setup":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Set-Up Slot Cleared.");
|
||||
@@ -107,8 +115,9 @@ public class ClearSlotCommand extends Command {
|
||||
case "etc":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("ETC Slot Cleared.");
|
||||
@@ -116,8 +125,9 @@ public class ClearSlotCommand extends Command {
|
||||
case "cash":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
if (tempItem == null) {
|
||||
continue;
|
||||
}
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Cash Slot Cleared.");
|
||||
|
||||
@@ -23,7 +23,6 @@ import client.Client;
|
||||
import client.command.Command;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class GachaListCommand extends Command {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class IdCommand extends Command {
|
||||
|
||||
if (resultList.size() > 0) {
|
||||
int count = 0;
|
||||
for (Map.Entry<String, String> entry: resultList.entrySet()) {
|
||||
for (Map.Entry<String, String> entry : resultList.entrySet()) {
|
||||
sb.append(String.format("Id for %s is: #b%s#k", entry.getKey(), entry.getValue()) + "\r\n");
|
||||
if (++count > 100) {
|
||||
break;
|
||||
@@ -85,16 +85,20 @@ public class IdCommand extends Command {
|
||||
}
|
||||
|
||||
private String joinStringArr(String[] arr, String separator) {
|
||||
if (null == arr || 0 == arr.length) return "";
|
||||
if (null == arr || 0 == arr.length) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(256);
|
||||
sb.append(arr[0]);
|
||||
for (int i = 1; i < arr.length; i++) sb.append(separator).append(arr[i]);
|
||||
for (int i = 1; i < arr.length; i++) {
|
||||
sb.append(separator).append(arr[i]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Map<String, String> fetchResults(Map<String, String> queryMap, String queryItem) {
|
||||
Map<String, String> results = new HashMap<>();
|
||||
for (String item: queryMap.keySet()) {
|
||||
for (String item : queryMap.keySet()) {
|
||||
if (item.indexOf(queryItem) != -1) {
|
||||
results.put(item, queryMap.get(item));
|
||||
}
|
||||
|
||||
@@ -49,13 +49,15 @@ public class ItemCommand extends Command {
|
||||
int itemId = Integer.parseInt(params[0]);
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
|
||||
if(ii.getName(itemId) == null) {
|
||||
if (ii.getName(itemId) == null) {
|
||||
player.yellowMessage("Item id '" + params[0] + "' does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
short quantity = 1;
|
||||
if(params.length >= 2) quantity = Short.parseShort(params[1]);
|
||||
if (params.length >= 2) {
|
||||
quantity = Short.parseShort(params[1]);
|
||||
}
|
||||
|
||||
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
|
||||
player.yellowMessage("You cannot create a cash item with this command.");
|
||||
@@ -63,7 +65,7 @@ public class ItemCommand extends Command {
|
||||
}
|
||||
|
||||
if (ItemConstants.isPet(itemId)) {
|
||||
if (params.length >= 2){ // thanks to istreety & TacoBell
|
||||
if (params.length >= 2) { // thanks to istreety & TacoBell
|
||||
quantity = 1;
|
||||
long days = Math.max(1, Integer.parseInt(params[1]));
|
||||
long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000);
|
||||
@@ -78,7 +80,7 @@ public class ItemCommand extends Command {
|
||||
}
|
||||
|
||||
short flag = 0;
|
||||
if(player.gmLevel() < 3) {
|
||||
if (player.gmLevel() < 3) {
|
||||
flag |= ItemConstants.ACCOUNT_SHARING;
|
||||
flag |= ItemConstants.UNTRADEABLE;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,15 @@ public class ItemDropCommand extends Command {
|
||||
int itemId = Integer.parseInt(params[0]);
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
|
||||
if(ii.getName(itemId) == null) {
|
||||
if (ii.getName(itemId) == null) {
|
||||
player.yellowMessage("Item id '" + params[0] + "' does not exist.");
|
||||
return;
|
||||
}
|
||||
|
||||
short quantity = 1;
|
||||
if(params.length >= 2) quantity = Short.parseShort(params[1]);
|
||||
if (params.length >= 2) {
|
||||
quantity = Short.parseShort(params[1]);
|
||||
}
|
||||
|
||||
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
|
||||
player.yellowMessage("You cannot create a cash item with this command.");
|
||||
@@ -64,7 +66,7 @@ public class ItemDropCommand extends Command {
|
||||
}
|
||||
|
||||
if (ItemConstants.isPet(itemId)) {
|
||||
if (params.length >= 2){ // thanks to istreety & TacoBell
|
||||
if (params.length >= 2) { // thanks to istreety & TacoBell
|
||||
quantity = 1;
|
||||
long days = Math.max(1, Integer.parseInt(params[1]));
|
||||
long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000);
|
||||
@@ -74,7 +76,7 @@ public class ItemDropCommand extends Command {
|
||||
toDrop.setExpiration(expiration);
|
||||
|
||||
toDrop.setOwner("");
|
||||
if(player.gmLevel() < 3) {
|
||||
if (player.gmLevel() < 3) {
|
||||
short f = toDrop.getFlag();
|
||||
f |= ItemConstants.ACCOUNT_SHARING;
|
||||
f |= ItemConstants.UNTRADEABLE;
|
||||
@@ -101,7 +103,7 @@ public class ItemDropCommand extends Command {
|
||||
}
|
||||
|
||||
toDrop.setOwner(player.getName());
|
||||
if(player.gmLevel() < 3) {
|
||||
if (player.gmLevel() < 3) {
|
||||
short f = toDrop.getFlag();
|
||||
f |= ItemConstants.ACCOUNT_SHARING;
|
||||
f |= ItemConstants.UNTRADEABLE;
|
||||
|
||||
@@ -45,7 +45,9 @@ public class LevelCommand extends Command {
|
||||
player.setLevel(Math.min(Integer.parseInt(params[0]), player.getMaxClassLevel()) - 1);
|
||||
|
||||
player.resetPlayerRates();
|
||||
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
|
||||
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) {
|
||||
player.setPlayerRates();
|
||||
}
|
||||
player.setWorldRates();
|
||||
|
||||
player.levelUp(false);
|
||||
|
||||
@@ -45,7 +45,8 @@ public class MaxSkillCommand extends Command {
|
||||
} catch (NumberFormatException nfe) {
|
||||
nfe.printStackTrace();
|
||||
break;
|
||||
} catch (NullPointerException npe) { }
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getJob().isA(Job.ARAN1) || player.getJob().isA(Job.LEGEND)) {
|
||||
|
||||
@@ -40,7 +40,9 @@ public class MaxStatCommand extends Command {
|
||||
player.loseExp(player.getExp(), false, false);
|
||||
player.setLevel(255);
|
||||
player.resetPlayerRates();
|
||||
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
|
||||
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) {
|
||||
player.setPlayerRates();
|
||||
}
|
||||
player.setWorldRates();
|
||||
player.updateStrDexIntLuk(Short.MAX_VALUE);
|
||||
player.setFame(13337);
|
||||
|
||||
@@ -41,16 +41,16 @@ public class RechargeCommand extends Command {
|
||||
Character player = c.getPlayer();
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
for (Item torecharge : c.getPlayer().getInventory(InventoryType.USE).list()) {
|
||||
if (ItemConstants.isThrowingStar(torecharge.getItemId())){
|
||||
if (ItemConstants.isThrowingStar(torecharge.getItemId())) {
|
||||
torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId()));
|
||||
c.getPlayer().forceUpdateItem(torecharge);
|
||||
} else if (ItemConstants.isArrow(torecharge.getItemId())){
|
||||
} else if (ItemConstants.isArrow(torecharge.getItemId())) {
|
||||
torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId()));
|
||||
c.getPlayer().forceUpdateItem(torecharge);
|
||||
} else if (ItemConstants.isBullet(torecharge.getItemId())){
|
||||
} else if (ItemConstants.isBullet(torecharge.getItemId())) {
|
||||
torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId()));
|
||||
c.getPlayer().forceUpdateItem(torecharge);
|
||||
} else if (ItemConstants.isConsumable(torecharge.getItemId())){
|
||||
} else if (ItemConstants.isConsumable(torecharge.getItemId())) {
|
||||
torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId()));
|
||||
c.getPlayer().forceUpdateItem(torecharge);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SearchCommand extends Command {
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
String search = joinStringFrom(params,1);
|
||||
String search = joinStringFrom(params, 1);
|
||||
long start = System.currentTimeMillis();//for the lulz
|
||||
Data data = null;
|
||||
if (!params[0].equalsIgnoreCase("ITEM")) {
|
||||
|
||||
@@ -43,10 +43,14 @@ public class SetStatCommand extends Command {
|
||||
try {
|
||||
int x = Integer.parseInt(params[0]);
|
||||
|
||||
if (x > Short.MAX_VALUE) x = Short.MAX_VALUE;
|
||||
else if (x < 4) x = 4; // thanks Vcoc for pointing the minimal allowed stat value here
|
||||
if (x > Short.MAX_VALUE) {
|
||||
x = Short.MAX_VALUE;
|
||||
} else if (x < 4) {
|
||||
x = 4; // thanks Vcoc for pointing the minimal allowed stat value here
|
||||
}
|
||||
|
||||
player.updateStrDexIntLuk(x);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
} catch (NumberFormatException nfe) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,16 +43,22 @@ public class SpCommand extends Command {
|
||||
|
||||
if (params.length == 1) {
|
||||
int newSp = Integer.parseInt(params[0]);
|
||||
if (newSp < 0) newSp = 0;
|
||||
else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP;
|
||||
if (newSp < 0) {
|
||||
newSp = 0;
|
||||
} else if (newSp > YamlConfig.config.server.MAX_AP) {
|
||||
newSp = YamlConfig.config.server.MAX_AP;
|
||||
}
|
||||
|
||||
player.updateRemainingSp(newSp);
|
||||
} else {
|
||||
Character victim = c.getWorldServer().getPlayerStorage().getCharacterByName(params[0]);
|
||||
if (victim != null) {
|
||||
int newSp = Integer.parseInt(params[1]);
|
||||
if (newSp < 0) newSp = 0;
|
||||
else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP;
|
||||
if (newSp < 0) {
|
||||
newSp = 0;
|
||||
} else if (newSp > YamlConfig.config.server.MAX_AP) {
|
||||
newSp = YamlConfig.config.server.MAX_AP;
|
||||
}
|
||||
|
||||
victim.updateRemainingSp(newSp);
|
||||
|
||||
|
||||
@@ -67,10 +67,13 @@ public class SummonCommand extends Command {
|
||||
|
||||
try {
|
||||
for (int i = 0; i < 7; i++) { // poll for a while until the player reconnects
|
||||
if (victim.isLoggedinWorld()) break;
|
||||
if (victim.isLoggedinWorld()) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1777);
|
||||
}
|
||||
} catch (InterruptedException e) {}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
MapleMap map = player.getMap();
|
||||
victim.saveLocationOnWarp();
|
||||
|
||||
@@ -42,8 +42,12 @@ public class CheckDmgCommand extends Command {
|
||||
Integer watkBuff = victim.getBuffedValue(BuffStat.WATK);
|
||||
Integer matkBuff = victim.getBuffedValue(BuffStat.MATK);
|
||||
int blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12);
|
||||
if (watkBuff == null) watkBuff = 0;
|
||||
if (matkBuff == null) matkBuff = 0;
|
||||
if (watkBuff == null) {
|
||||
watkBuff = 0;
|
||||
}
|
||||
if (matkBuff == null) {
|
||||
matkBuff = 0;
|
||||
}
|
||||
|
||||
player.dropMessage(5, "Cur Str: " + victim.getTotalStr() + " Cur Dex: " + victim.getTotalDex() + " Cur Int: " + victim.getTotalInt() + " Cur Luk: " + victim.getTotalLuk());
|
||||
player.dropMessage(5, "Cur WATK: " + victim.getTotalWatk() + " Cur MATK: " + victim.getTotalMagic());
|
||||
|
||||
@@ -46,12 +46,16 @@ public class FlyCommand extends Command {
|
||||
String sendStr = "";
|
||||
if (params[0].equalsIgnoreCase("on")) {
|
||||
sendStr += "Enabled Fly feature (F1). With fly active, you cannot attack.";
|
||||
if (!srv.canFly(accid)) sendStr += " Re-login to take effect.";
|
||||
if (!srv.canFly(accid)) {
|
||||
sendStr += " Re-login to take effect.";
|
||||
}
|
||||
|
||||
srv.changeFly(c.getAccID(), true);
|
||||
} else {
|
||||
sendStr += "Disabled Fly feature. You can now attack.";
|
||||
if (srv.canFly(accid)) sendStr += " Re-login to take effect.";
|
||||
if (srv.canFly(accid)) {
|
||||
sendStr += " Re-login to take effect.";
|
||||
}
|
||||
|
||||
srv.changeFly(c.getAccID(), false);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class GiveRpCommand extends Command {
|
||||
if (victim != null) {
|
||||
victim.setRewardPoints(victim.getRewardPoints() + Integer.parseInt(params[1]));
|
||||
player.message("RP given. Player " + params[0] + " now has " + victim.getRewardPoints()
|
||||
+ " reward points." );
|
||||
+ " reward points.");
|
||||
} else {
|
||||
player.message("Player '" + params[0] + "' could not be found.");
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class QuestCompleteCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
|
||||
if (params.length < 1){
|
||||
if (params.length < 1) {
|
||||
player.yellowMessage("Syntax: !completequest <questid>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class QuestResetCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
|
||||
if (params.length < 1){
|
||||
if (params.length < 1) {
|
||||
player.yellowMessage("Syntax: !resetquest <questid>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class QuestStartCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
|
||||
if (params.length < 1){
|
||||
if (params.length < 1) {
|
||||
player.yellowMessage("Syntax: !startquest <questid>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,10 @@ public class ReloadMapCommand extends Command {
|
||||
for (Character chr : characters) {
|
||||
chr.saveLocationOnWarp();
|
||||
chr.changeMap(newMap);
|
||||
if (chr.getId() != callerid)
|
||||
if (chr.getId() != callerid) {
|
||||
chr.dropMessage("You have been relocated due to map reloading. Sorry for the inconvenience.");
|
||||
}
|
||||
}
|
||||
newMap.respawn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ public class StartEventCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
int players = 50;
|
||||
if (params.length > 1)
|
||||
if (params.length > 1) {
|
||||
players = Integer.parseInt(params[0]);
|
||||
}
|
||||
c.getChannelServer().setEvent(new Event(player.getMapId(), players));
|
||||
Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.earnTitleMessage(
|
||||
"[Event] An event has started on "
|
||||
|
||||
@@ -25,7 +25,6 @@ import client.command.Command;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class BossDropRateCommand extends Command {
|
||||
|
||||
@@ -50,7 +50,9 @@ public class ForceVacCommand extends Command {
|
||||
|
||||
mapItem.lockItem();
|
||||
try {
|
||||
if (mapItem.isPickedUp()) continue;
|
||||
if (mapItem.isPickedUp()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mapItem.getMeso() > 0) {
|
||||
player.gainMeso(mapItem.getMeso(), true);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class PnpcRemoveCommand extends Command {
|
||||
}
|
||||
|
||||
if (!toRemove.isEmpty()) {
|
||||
for (Channel ch: player.getWorldServer().getChannels()) {
|
||||
for (Channel ch : player.getWorldServer().getChannels()) {
|
||||
MapleMap map = ch.getMapFactory().getMap(mapId);
|
||||
|
||||
for (Pair<Integer, Pair<Integer, Integer>> r : toRemove) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ProItemCommand extends Command {
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
int itemid = Integer.parseInt(params[0]);
|
||||
|
||||
if(ii.getName(itemid) == null) {
|
||||
if (ii.getName(itemid) == null) {
|
||||
player.yellowMessage("Item id '" + params[0] + "' does not exist.");
|
||||
return;
|
||||
}
|
||||
@@ -68,6 +68,7 @@ public class ProItemCommand extends Command {
|
||||
player.dropMessage(6, "Make sure it's an equippable item.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void hardsetItemStats(Equip equip, short stat, short spdjmp) {
|
||||
equip.setStr(stat);
|
||||
equip.setDex(stat);
|
||||
|
||||
@@ -51,7 +51,9 @@ public class SetEqStatCommand extends Command {
|
||||
for (byte i = 1; i <= equip.getSlotLimit(); i++) {
|
||||
try {
|
||||
Equip eq = (Equip) equip.getItem(i);
|
||||
if (eq == null) continue;
|
||||
if (eq == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
eq.setWdef(newStat);
|
||||
eq.setAcc(newStat);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DebugCommand extends Command {
|
||||
case "type":
|
||||
case "help":
|
||||
String msgTypes = "Available #bdebug types#k:\r\n\r\n";
|
||||
for(int i = 0; i < debugTypes.length; i++) {
|
||||
for (int i = 0; i < debugTypes.length; i++) {
|
||||
msgTypes += ("#L" + i + "#" + debugTypes[i] + "#l\r\n");
|
||||
}
|
||||
|
||||
@@ -81,16 +81,20 @@ public class DebugCommand extends Command {
|
||||
|
||||
case "portal":
|
||||
Portal portal = player.getMap().findClosestPortal(player.getPosition());
|
||||
if (portal != null)
|
||||
if (portal != null) {
|
||||
player.dropMessage(6, "Closest portal: " + portal.getId() + " '" + portal.getName() + "' Type: " + portal.getType() + " --> toMap: " + portal.getTargetMapId() + " scriptname: '" + portal.getScriptName() + "' state: " + (portal.getPortalState() ? 1 : 0) + ".");
|
||||
else player.dropMessage(6, "There is no portal on this map.");
|
||||
} else {
|
||||
player.dropMessage(6, "There is no portal on this map.");
|
||||
}
|
||||
break;
|
||||
|
||||
case "spawnpoint":
|
||||
SpawnPoint sp = player.getMap().findClosestSpawnpoint(player.getPosition());
|
||||
if (sp != null)
|
||||
if (sp != null) {
|
||||
player.dropMessage(6, "Closest mob spawn point: " + " Position: x " + sp.getPosition().getX() + " y " + sp.getPosition().getY() + " Spawns mobid: '" + sp.getMonsterId() + "' --> canSpawn: " + !sp.getDenySpawn() + " canSpawnRightNow: " + sp.shouldSpawn() + ".");
|
||||
else player.dropMessage(6, "There is no mob spawn point on this map.");
|
||||
} else {
|
||||
player.dropMessage(6, "There is no mob spawn point on this map.");
|
||||
}
|
||||
break;
|
||||
|
||||
case "pos":
|
||||
@@ -106,8 +110,11 @@ public class DebugCommand extends Command {
|
||||
break;
|
||||
|
||||
case "event":
|
||||
if (player.getEventInstance() == null) player.dropMessage(6, "Player currently not in an event.");
|
||||
else player.dropMessage(6, "Current event name: " + player.getEventInstance().getName() + ".");
|
||||
if (player.getEventInstance() == null) {
|
||||
player.dropMessage(6, "Player currently not in an event.");
|
||||
} else {
|
||||
player.dropMessage(6, "Current event name: " + player.getEventInstance().getName() + ".");
|
||||
}
|
||||
break;
|
||||
|
||||
case "areas":
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.server.world.World;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mist
|
||||
* @author Blood (Tochi)
|
||||
* @author Ronan
|
||||
|
||||
@@ -24,7 +24,6 @@ import client.command.Command;
|
||||
import net.server.coordinator.session.SessionCoordinator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class ShowSessionsCommand extends Command {
|
||||
|
||||
@@ -47,15 +47,15 @@ public class ServerAddChannelCommand extends Command {
|
||||
|
||||
ThreadManager.getInstance().newTask(() -> {
|
||||
int chid = Server.getInstance().addChannel(worldid);
|
||||
if(player.isLoggedinWorld()) {
|
||||
if(chid >= 0) {
|
||||
if (player.isLoggedinWorld()) {
|
||||
if (chid >= 0) {
|
||||
player.dropMessage(5, "NEW Channel " + chid + " successfully deployed on world " + worldid + ".");
|
||||
} else {
|
||||
if(chid == -3) {
|
||||
if (chid == -3) {
|
||||
player.dropMessage(5, "Invalid worldid detected. Channel creation aborted.");
|
||||
} else if(chid == -2) {
|
||||
} else if (chid == -2) {
|
||||
player.dropMessage(5, "Reached channel limit on worldid " + worldid + ". Channel creation aborted.");
|
||||
} else if(chid == -1) {
|
||||
} else if (chid == -1) {
|
||||
player.dropMessage(5, "Error detected when loading the 'world.ini' file. Channel creation aborted.");
|
||||
} else {
|
||||
player.dropMessage(5, "NEW Channel failed to be deployed. Check if the needed port is already in use or other limitations are taking place.");
|
||||
|
||||
@@ -41,11 +41,11 @@ public class ServerAddWorldCommand extends Command {
|
||||
ThreadManager.getInstance().newTask(() -> {
|
||||
int wid = Server.getInstance().addWorld();
|
||||
|
||||
if(player.isLoggedinWorld()) {
|
||||
if(wid >= 0) {
|
||||
if (player.isLoggedinWorld()) {
|
||||
if (wid >= 0) {
|
||||
player.dropMessage(5, "NEW World " + wid + " successfully deployed.");
|
||||
} else {
|
||||
if(wid == -2) {
|
||||
if (wid == -2) {
|
||||
player.dropMessage(5, "Error detected when loading the 'world.ini' file. World creation aborted.");
|
||||
} else {
|
||||
player.dropMessage(5, "NEW World failed to be deployed. Check if needed ports are already in use or maximum world count has been reached.");
|
||||
|
||||
@@ -45,12 +45,12 @@ public class ServerRemoveChannelCommand extends Command {
|
||||
|
||||
final int worldId = Integer.parseInt(params[0]);
|
||||
ThreadManager.getInstance().newTask(() -> {
|
||||
if(Server.getInstance().removeChannel(worldId)) {
|
||||
if(player.isLoggedinWorld()) {
|
||||
if (Server.getInstance().removeChannel(worldId)) {
|
||||
if (player.isLoggedinWorld()) {
|
||||
player.dropMessage(5, "Successfully removed a channel on World " + worldId + ". Current channel count: " + Server.getInstance().getWorld(worldId).getChannelsSize() + ".");
|
||||
}
|
||||
} else {
|
||||
if(player.isLoggedinWorld()) {
|
||||
if (player.isLoggedinWorld()) {
|
||||
player.dropMessage(5, "Failed to remove last Channel on world " + worldId + ". Check if either that world exists or there are people currently playing there.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,19 +39,19 @@ public class ServerRemoveWorldCommand extends Command {
|
||||
final Character player = c.getPlayer();
|
||||
|
||||
final int rwid = Server.getInstance().getWorldsSize() - 1;
|
||||
if(rwid <= 0) {
|
||||
if (rwid <= 0) {
|
||||
player.dropMessage(5, "Unable to remove world 0.");
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadManager.getInstance().newTask(() -> {
|
||||
if(Server.getInstance().removeWorld()) {
|
||||
if(player.isLoggedinWorld()) {
|
||||
if (Server.getInstance().removeWorld()) {
|
||||
if (player.isLoggedinWorld()) {
|
||||
player.dropMessage(5, "Successfully removed a world. Current world count: " + Server.getInstance().getWorldsSize() + ".");
|
||||
}
|
||||
} else {
|
||||
if(player.isLoggedinWorld()) {
|
||||
if(rwid < 0) {
|
||||
if (player.isLoggedinWorld()) {
|
||||
if (rwid < 0) {
|
||||
player.dropMessage(5, "No registered worlds to remove.");
|
||||
} else {
|
||||
player.dropMessage(5, "Failed to remove world " + rwid + ". Check if there are people currently playing there.");
|
||||
|
||||
@@ -38,13 +38,13 @@ public class ShutdownCommand extends Command {
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
Character player = c.getPlayer();
|
||||
if (params.length < 1){
|
||||
if (params.length < 1) {
|
||||
player.yellowMessage("Syntax: !shutdown [<time>|NOW]");
|
||||
return;
|
||||
}
|
||||
|
||||
int time = 60000;
|
||||
if (params[0].equalsIgnoreCase("now")){
|
||||
if (params[0].equalsIgnoreCase("now")) {
|
||||
time = 1;
|
||||
} else {
|
||||
time *= Integer.parseInt(params[0]);
|
||||
@@ -57,8 +57,12 @@ public class ShutdownCommand extends Command {
|
||||
int days = (time / (1000 * 60 * 60 * 24));
|
||||
|
||||
String strTime = "";
|
||||
if (days > 0) strTime += days + " days, ";
|
||||
if (hours > 0) strTime += hours + " hours, ";
|
||||
if (days > 0) {
|
||||
strTime += days + " days, ";
|
||||
}
|
||||
if (hours > 0) {
|
||||
strTime += hours + " hours, ";
|
||||
}
|
||||
strTime += minutes + " minutes, ";
|
||||
strTime += seconds + " seconds";
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public abstract class CharacterFactory {
|
||||
@@ -63,25 +62,25 @@ public abstract class CharacterFactory {
|
||||
|
||||
int top = recipe.getTop(), bottom = recipe.getBottom(), shoes = recipe.getShoes(), weapon = recipe.getWeapon();
|
||||
|
||||
if(top > 0) {
|
||||
if (top > 0) {
|
||||
Item eq_top = ii.getEquipById(top);
|
||||
eq_top.setPosition((byte) -5);
|
||||
equipped.addItemFromDB(eq_top);
|
||||
}
|
||||
|
||||
if(bottom > 0) {
|
||||
if (bottom > 0) {
|
||||
Item eq_bottom = ii.getEquipById(bottom);
|
||||
eq_bottom.setPosition((byte) -6);
|
||||
equipped.addItemFromDB(eq_bottom);
|
||||
}
|
||||
|
||||
if(shoes > 0) {
|
||||
if (shoes > 0) {
|
||||
Item eq_shoes = ii.getEquipById(shoes);
|
||||
eq_shoes.setPosition((byte) -7);
|
||||
equipped.addItemFromDB(eq_shoes);
|
||||
}
|
||||
|
||||
if(weapon > 0) {
|
||||
if (weapon > 0) {
|
||||
Item eq_weapon = ii.getEquipById(weapon);
|
||||
eq_weapon.setPosition((byte) -11);
|
||||
equipped.addItemFromDB(eq_weapon.copy());
|
||||
|
||||
@@ -33,20 +33,24 @@ import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class CharacterFactoryRecipe {
|
||||
private Job job;
|
||||
private int level, map, top, bottom, shoes, weapon;
|
||||
private final Job job;
|
||||
private final int level;
|
||||
private final int map;
|
||||
private final int top;
|
||||
private final int bottom;
|
||||
private final int shoes;
|
||||
private final int weapon;
|
||||
private int str = 4, dex = 4, int_ = 4, luk = 4;
|
||||
private int maxHp = 50, maxMp = 5;
|
||||
private int ap = 0, sp = 0;
|
||||
private int meso = 0;
|
||||
private List<Pair<Skill, Integer>> skills = new LinkedList<>();
|
||||
private final List<Pair<Skill, Integer>> skills = new LinkedList<>();
|
||||
|
||||
private List<Pair<Item, InventoryType>> itemsWithType = new LinkedList<>();
|
||||
private Map<InventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
|
||||
private final List<Pair<Item, InventoryType>> itemsWithType = new LinkedList<>();
|
||||
private final Map<InventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
|
||||
|
||||
public CharacterFactoryRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
this.job = job;
|
||||
@@ -113,7 +117,7 @@ public class CharacterFactoryRecipe {
|
||||
|
||||
public void addStartingItem(int itemid, int quantity, InventoryType itemType) {
|
||||
AtomicInteger p = runningTypePosition.get(itemType);
|
||||
if(p == null) {
|
||||
if (p == null) {
|
||||
p = new AtomicInteger(0);
|
||||
runningTypePosition.put(itemType, p);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class BeginnerCreator extends CharacterFactory {
|
||||
|
||||
@@ -26,7 +26,6 @@ import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class LegendCreator extends CharacterFactory {
|
||||
|
||||
@@ -26,7 +26,6 @@ import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class NoblesseCreator extends CharacterFactory {
|
||||
|
||||
@@ -28,13 +28,12 @@ import client.inventory.Item;
|
||||
import server.ItemInformationProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class BowmanCreator extends CharacterFactory {
|
||||
private static int[] equips = {1040067, 1041054, 1060056, 1061050, 1072081};
|
||||
private static int[] weapons = {1452005, 1462000};
|
||||
private static int[] startingHpMp = {797, 404};
|
||||
private static final int[] equips = {1040067, 1041054, 1060056, 1061050, 1072081};
|
||||
private static final int[] weapons = {1452005, 1462000};
|
||||
private static final int[] startingHpMp = {797, 404};
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
@@ -49,7 +48,7 @@ public class BowmanCreator extends CharacterFactory {
|
||||
|
||||
recipe.setMeso(100000);
|
||||
|
||||
for(int i = 1; i < weapons.length; i++) {
|
||||
for (int i = 1; i < weapons.length; i++) {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,14 +31,13 @@ import constants.skills.Magician;
|
||||
import server.ItemInformationProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class MagicianCreator extends CharacterFactory {
|
||||
private static int[] equips = {0, 1041041, 0, 1061034, 1072075};
|
||||
private static int[] weapons = {1372003, 1382017};
|
||||
private static int[] startingHpMp = {405, 729};
|
||||
private static int[] mpGain = {0, 40, 80, 118, 156, 194, 230, 266, 302, 336, 370};
|
||||
private static final int[] equips = {0, 1041041, 0, 1061034, 1072075};
|
||||
private static final int[] weapons = {1372003, 1382017};
|
||||
private static final int[] startingHpMp = {405, 729};
|
||||
private static final int[] mpGain = {0, 40, 80, 118, 156, 194, 230, 266, 302, 336, 370};
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon, int gender, int improveSp) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
@@ -53,11 +52,11 @@ public class MagicianCreator extends CharacterFactory {
|
||||
|
||||
recipe.setMeso(100000);
|
||||
|
||||
if(gender == 0) {
|
||||
if (gender == 0) {
|
||||
giveEquipment(recipe, ii, 1050003);
|
||||
}
|
||||
|
||||
for(int i = 1; i < weapons.length; i++) {
|
||||
for (int i = 1; i < weapons.length; i++) {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
@@ -65,7 +64,7 @@ public class MagicianCreator extends CharacterFactory {
|
||||
giveItem(recipe, 2000006, 100, InventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
|
||||
|
||||
if(improveSp > 0) {
|
||||
if (improveSp > 0) {
|
||||
improveSp += 5;
|
||||
recipe.setRemainingSp(recipe.getRemainingSp() - improveSp);
|
||||
|
||||
@@ -74,7 +73,7 @@ public class MagicianCreator extends CharacterFactory {
|
||||
recipe.addStartingSkillLevel(improveMpRec, toUseSp);
|
||||
improveSp -= toUseSp;
|
||||
|
||||
if(improveSp > 0) {
|
||||
if (improveSp > 0) {
|
||||
Skill improveMaxMp = SkillFactory.getSkill(Magician.IMPROVED_MAX_MP_INCREASE);
|
||||
recipe.addStartingSkillLevel(improveMaxMp, improveSp);
|
||||
}
|
||||
|
||||
@@ -28,13 +28,12 @@ import client.inventory.Item;
|
||||
import server.ItemInformationProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class PirateCreator extends CharacterFactory {
|
||||
private static int[] equips = {0, 0, 0, 0, 1072294};
|
||||
private static int[] weapons = {1482004, 1492004};
|
||||
private static int[] startingHpMp = {846, 503};
|
||||
private static final int[] equips = {0, 0, 0, 0, 1072294};
|
||||
private static final int[] weapons = {1482004, 1492004};
|
||||
private static final int[] startingHpMp = {846, 503};
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
@@ -51,7 +50,7 @@ public class PirateCreator extends CharacterFactory {
|
||||
|
||||
giveEquipment(recipe, ii, 1052107);
|
||||
|
||||
for(int i = 1; i < weapons.length; i++) {
|
||||
for (int i = 1; i < weapons.length; i++) {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,12 @@ import client.inventory.Item;
|
||||
import server.ItemInformationProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class ThiefCreator extends CharacterFactory {
|
||||
private static int[] equips = {1040057, 1041047, 1060043, 1061043, 1072032};
|
||||
private static int[] weapons = {1472008, 1332012};
|
||||
private static int[] startingHpMp = {794, 407};
|
||||
private static final int[] equips = {1040057, 1041047, 1060043, 1061043, 1072032};
|
||||
private static final int[] weapons = {1472008, 1332012};
|
||||
private static final int[] startingHpMp = {794, 407};
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
@@ -49,7 +48,7 @@ public class ThiefCreator extends CharacterFactory {
|
||||
|
||||
recipe.setMeso(100000);
|
||||
|
||||
for(int i = 1; i < weapons.length; i++) {
|
||||
for (int i = 1; i < weapons.length; i++) {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,14 +31,13 @@ import constants.skills.Warrior;
|
||||
import server.ItemInformationProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class WarriorCreator extends CharacterFactory {
|
||||
private static int[] equips = {1040021, 0, 1060016, 0, 1072039};
|
||||
private static int[] weapons = {1302008, 1442001, 1422001, 1312005};
|
||||
private static int[] startingHpMp = {905, 208};
|
||||
private static int[] hpGain = {0, 72, 144, 212, 280, 348, 412, 476, 540, 600, 660};
|
||||
private static final int[] equips = {1040021, 0, 1060016, 0, 1072039};
|
||||
private static final int[] weapons = {1302008, 1442001, 1422001, 1312005};
|
||||
private static final int[] startingHpMp = {905, 208};
|
||||
private static final int[] hpGain = {0, 72, 144, 212, 280, 348, 412, 476, 540, 600, 660};
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon, int gender, int improveSp) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
@@ -53,15 +52,15 @@ public class WarriorCreator extends CharacterFactory {
|
||||
|
||||
recipe.setMeso(100000);
|
||||
|
||||
if(gender == 1) {
|
||||
if (gender == 1) {
|
||||
giveEquipment(recipe, ii, 1051010);
|
||||
}
|
||||
|
||||
for(int i = 1; i < weapons.length; i++) {
|
||||
for (int i = 1; i < weapons.length; i++) {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
if(improveSp > 0) {
|
||||
if (improveSp > 0) {
|
||||
improveSp += 5;
|
||||
recipe.setRemainingSp(recipe.getRemainingSp() - improveSp);
|
||||
|
||||
@@ -70,7 +69,7 @@ public class WarriorCreator extends CharacterFactory {
|
||||
recipe.addStartingSkillLevel(improveHpRec, toUseSp);
|
||||
improveSp -= toUseSp;
|
||||
|
||||
if(improveSp > 0) {
|
||||
if (improveSp > 0) {
|
||||
Skill improveMaxHp = SkillFactory.getSkill(Warrior.IMPROVED_MAXHP);
|
||||
recipe.addStartingSkillLevel(improveMaxHp, improveSp);
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@ import java.util.Map;
|
||||
|
||||
public class Equip extends Item {
|
||||
|
||||
public static enum ScrollResult {
|
||||
public enum ScrollResult {
|
||||
|
||||
FAIL(0), SUCCESS(1), CURSE(2);
|
||||
private int value = -1;
|
||||
|
||||
private ScrollResult(int value) {
|
||||
ScrollResult(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Equip extends Item {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum StatUpgrade {
|
||||
public enum StatUpgrade {
|
||||
|
||||
incDEX(0), incSTR(1), incINT(2), incLUK(3),
|
||||
incMHP(4), incMMP(5), incPAD(6), incMAD(7),
|
||||
@@ -59,7 +59,7 @@ public class Equip extends Item {
|
||||
incSpeed(12), incJump(13), incVicious(14), incSlot(15);
|
||||
private int value = -1;
|
||||
|
||||
private StatUpgrade(int value) {
|
||||
StatUpgrade(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -280,13 +280,18 @@ public class Equip extends Item {
|
||||
private static int getStatModifier(boolean isAttribute) {
|
||||
// each set of stat points grants a chance for a bonus stat point upgrade at equip level up.
|
||||
|
||||
if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_POWER) {
|
||||
if(isAttribute) return 2;
|
||||
else return 4;
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_POWER) {
|
||||
if (isAttribute) {
|
||||
return 2;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
if (isAttribute) {
|
||||
return 4;
|
||||
} else {
|
||||
return 16;
|
||||
}
|
||||
else {
|
||||
if(isAttribute) return 4;
|
||||
else return 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,9 +302,9 @@ public class Equip extends Item {
|
||||
int rnd = Randomizer.rand(0, poolCount);
|
||||
|
||||
int stat = 0;
|
||||
if(rnd >= limit) {
|
||||
if (rnd >= limit) {
|
||||
rnd -= limit;
|
||||
stat = 1 + (int)Math.floor((-1 + Math.sqrt((8 * rnd) + 1)) / 2); // optimized randomizeStatUpgrade author: David A.
|
||||
stat = 1 + (int) Math.floor((-1 + Math.sqrt((8 * rnd) + 1)) / 2); // optimized randomizeStatUpgrade author: David A.
|
||||
}
|
||||
|
||||
return stat;
|
||||
@@ -315,13 +320,9 @@ public class Equip extends Item {
|
||||
|
||||
if (ItemConstants.isWeapon(this.getItemId())) {
|
||||
if (name.equals(StatUpgrade.incPAD)) {
|
||||
if (!isPhysicalWeapon(this.getItemId())) {
|
||||
return true;
|
||||
}
|
||||
return !isPhysicalWeapon(this.getItemId());
|
||||
} else if (name.equals(StatUpgrade.incMAD)) {
|
||||
if (isPhysicalWeapon(this.getItemId())) {
|
||||
return true;
|
||||
}
|
||||
return isPhysicalWeapon(this.getItemId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,52 +332,110 @@ public class Equip extends Item {
|
||||
private void getUnitStatUpgrade(List<Pair<StatUpgrade, Integer>> stats, StatUpgrade name, int curStat, boolean isAttribute) {
|
||||
isUpgradeable = true;
|
||||
|
||||
int maxUpgrade = randomizeStatUpgrade((int)(1 + (curStat / (getStatModifier(isAttribute) * (isNotWeaponAffinity(name) ? 2.7 : 1)))));
|
||||
if(maxUpgrade == 0) return;
|
||||
int maxUpgrade = randomizeStatUpgrade((int) (1 + (curStat / (getStatModifier(isAttribute) * (isNotWeaponAffinity(name) ? 2.7 : 1)))));
|
||||
if (maxUpgrade == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
stats.add(new Pair<>(name, maxUpgrade));
|
||||
}
|
||||
|
||||
private static void getUnitSlotUpgrade(List<Pair<StatUpgrade, Integer>> stats, StatUpgrade name) {
|
||||
if(Math.random() < 0.1) {
|
||||
if (Math.random() < 0.1) {
|
||||
stats.add(new Pair<>(name, 1)); // 10% success on getting a slot upgrade.
|
||||
}
|
||||
}
|
||||
|
||||
private void improveDefaultStats(List<Pair<StatUpgrade, Integer>> stats) {
|
||||
if(dex > 0) getUnitStatUpgrade(stats, StatUpgrade.incDEX, dex, true);
|
||||
if(str > 0) getUnitStatUpgrade(stats, StatUpgrade.incSTR, str, true);
|
||||
if(_int > 0) getUnitStatUpgrade(stats, StatUpgrade.incINT,_int, true);
|
||||
if(luk > 0) getUnitStatUpgrade(stats, StatUpgrade.incLUK, luk, true);
|
||||
if(hp > 0) getUnitStatUpgrade(stats, StatUpgrade.incMHP, hp, false);
|
||||
if(mp > 0) getUnitStatUpgrade(stats, StatUpgrade.incMMP, mp, false);
|
||||
if(watk > 0) getUnitStatUpgrade(stats, StatUpgrade.incPAD, watk, false);
|
||||
if(matk > 0) getUnitStatUpgrade(stats, StatUpgrade.incMAD, matk, false);
|
||||
if(wdef > 0) getUnitStatUpgrade(stats, StatUpgrade.incPDD, wdef, false);
|
||||
if(mdef > 0) getUnitStatUpgrade(stats, StatUpgrade.incMDD, mdef, false);
|
||||
if(avoid > 0) getUnitStatUpgrade(stats, StatUpgrade.incEVA, avoid, false);
|
||||
if(acc > 0) getUnitStatUpgrade(stats, StatUpgrade.incACC, acc, false);
|
||||
if(speed > 0) getUnitStatUpgrade(stats, StatUpgrade.incSpeed, speed, false);
|
||||
if(jump > 0) getUnitStatUpgrade(stats, StatUpgrade.incJump, jump, false);
|
||||
if (dex > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incDEX, dex, true);
|
||||
}
|
||||
if (str > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incSTR, str, true);
|
||||
}
|
||||
if (_int > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incINT, _int, true);
|
||||
}
|
||||
if (luk > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incLUK, luk, true);
|
||||
}
|
||||
if (hp > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incMHP, hp, false);
|
||||
}
|
||||
if (mp > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incMMP, mp, false);
|
||||
}
|
||||
if (watk > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incPAD, watk, false);
|
||||
}
|
||||
if (matk > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incMAD, matk, false);
|
||||
}
|
||||
if (wdef > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incPDD, wdef, false);
|
||||
}
|
||||
if (mdef > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incMDD, mdef, false);
|
||||
}
|
||||
if (avoid > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incEVA, avoid, false);
|
||||
}
|
||||
if (acc > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incACC, acc, false);
|
||||
}
|
||||
if (speed > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incSpeed, speed, false);
|
||||
}
|
||||
if (jump > 0) {
|
||||
getUnitStatUpgrade(stats, StatUpgrade.incJump, jump, false);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<StatUpgrade, Short> getStats() {
|
||||
Map<StatUpgrade, Short> stats = new HashMap<>(5);
|
||||
|
||||
if(dex > 0) stats.put(StatUpgrade.incDEX, dex);
|
||||
if(str > 0) stats.put(StatUpgrade.incSTR, str);
|
||||
if(_int > 0) stats.put(StatUpgrade.incINT,_int);
|
||||
if(luk > 0) stats.put(StatUpgrade.incLUK, luk);
|
||||
if(hp > 0) stats.put(StatUpgrade.incMHP, hp);
|
||||
if(mp > 0) stats.put(StatUpgrade.incMMP, mp);
|
||||
if(watk > 0) stats.put(StatUpgrade.incPAD, watk);
|
||||
if(matk > 0) stats.put(StatUpgrade.incMAD, matk);
|
||||
if(wdef > 0) stats.put(StatUpgrade.incPDD, wdef);
|
||||
if(mdef > 0) stats.put(StatUpgrade.incMDD, mdef);
|
||||
if(avoid > 0) stats.put(StatUpgrade.incEVA, avoid);
|
||||
if(acc > 0) stats.put(StatUpgrade.incACC, acc);
|
||||
if(speed > 0) stats.put(StatUpgrade.incSpeed, speed);
|
||||
if(jump > 0) stats.put(StatUpgrade.incJump, jump);
|
||||
if (dex > 0) {
|
||||
stats.put(StatUpgrade.incDEX, dex);
|
||||
}
|
||||
if (str > 0) {
|
||||
stats.put(StatUpgrade.incSTR, str);
|
||||
}
|
||||
if (_int > 0) {
|
||||
stats.put(StatUpgrade.incINT, _int);
|
||||
}
|
||||
if (luk > 0) {
|
||||
stats.put(StatUpgrade.incLUK, luk);
|
||||
}
|
||||
if (hp > 0) {
|
||||
stats.put(StatUpgrade.incMHP, hp);
|
||||
}
|
||||
if (mp > 0) {
|
||||
stats.put(StatUpgrade.incMMP, mp);
|
||||
}
|
||||
if (watk > 0) {
|
||||
stats.put(StatUpgrade.incPAD, watk);
|
||||
}
|
||||
if (matk > 0) {
|
||||
stats.put(StatUpgrade.incMAD, matk);
|
||||
}
|
||||
if (wdef > 0) {
|
||||
stats.put(StatUpgrade.incPDD, wdef);
|
||||
}
|
||||
if (mdef > 0) {
|
||||
stats.put(StatUpgrade.incMDD, mdef);
|
||||
}
|
||||
if (avoid > 0) {
|
||||
stats.put(StatUpgrade.incEVA, avoid);
|
||||
}
|
||||
if (acc > 0) {
|
||||
stats.put(StatUpgrade.incACC, acc);
|
||||
}
|
||||
if (speed > 0) {
|
||||
stats.put(StatUpgrade.incSpeed, speed);
|
||||
}
|
||||
if (jump > 0) {
|
||||
stats.put(StatUpgrade.incJump, jump);
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
@@ -475,33 +534,41 @@ public class Equip extends Item {
|
||||
private void gainLevel(Client c) {
|
||||
List<Pair<StatUpgrade, Integer>> stats = new LinkedList<>();
|
||||
|
||||
if(isElemental) {
|
||||
if (isElemental) {
|
||||
List<Pair<String, Integer>> elementalStats = ItemInformationProvider.getInstance().getItemLevelupStats(getItemId(), itemLevel);
|
||||
|
||||
for(Pair<String, Integer> p: elementalStats) {
|
||||
if(p.getRight() > 0) stats.add(new Pair<>(StatUpgrade.valueOf(p.getLeft()), p.getRight()));
|
||||
for (Pair<String, Integer> p : elementalStats) {
|
||||
if (p.getRight() > 0) {
|
||||
stats.add(new Pair<>(StatUpgrade.valueOf(p.getLeft()), p.getRight()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!stats.isEmpty()) {
|
||||
if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
if (!stats.isEmpty()) {
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if (vicious > 0) {
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
}
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incSlot);
|
||||
}
|
||||
} else {
|
||||
isUpgradeable = false;
|
||||
|
||||
improveDefaultStats(stats);
|
||||
if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if (vicious > 0) {
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
}
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incSlot);
|
||||
}
|
||||
|
||||
if(isUpgradeable) {
|
||||
while(stats.isEmpty()) {
|
||||
if (isUpgradeable) {
|
||||
while (stats.isEmpty()) {
|
||||
improveDefaultStats(stats);
|
||||
if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if (vicious > 0) {
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
}
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incSlot);
|
||||
}
|
||||
}
|
||||
@@ -545,14 +612,14 @@ public class Equip extends Item {
|
||||
// Conversion factor between mob exp and equip exp gain. Through many calculations, the expected for equipment levelup
|
||||
// from level 1 to 2 is killing about 100~200 mobs of the same level range, on a 1x EXP rate scenario.
|
||||
|
||||
if(reqLevel < 5) {
|
||||
if (reqLevel < 5) {
|
||||
return 42;
|
||||
} else if(reqLevel >= 78) {
|
||||
} else if (reqLevel >= 78) {
|
||||
return Math.max((10413.648 * Math.exp(reqLevel * 0.03275)), 15);
|
||||
} else if(reqLevel >= 38) {
|
||||
return Math.max(( 4985.818 * Math.exp(reqLevel * 0.02007)), 15);
|
||||
} else if(reqLevel >= 18) {
|
||||
return Math.max(( 248.219 * Math.exp(reqLevel * 0.11093)), 15);
|
||||
} else if (reqLevel >= 38) {
|
||||
return Math.max((4985.818 * Math.exp(reqLevel * 0.02007)), 15);
|
||||
} else if (reqLevel >= 18) {
|
||||
return Math.max((248.219 * Math.exp(reqLevel * 0.11093)), 15);
|
||||
} else {
|
||||
return Math.max(((1334.564 * Math.log(reqLevel)) - 1731.976), 15);
|
||||
}
|
||||
@@ -560,7 +627,7 @@ public class Equip extends Item {
|
||||
|
||||
public synchronized void gainItemExp(Client c, int gain) { // Ronan's Equip Exp gain method
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
if(!ii.isUpgradeable(this.getItemId())) {
|
||||
if (!ii.isUpgradeable(this.getItemId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -571,7 +638,7 @@ public class Equip extends Item {
|
||||
|
||||
int reqLevel = ii.getEquipLevelReq(this.getItemId());
|
||||
|
||||
float masteryModifier = (float)(YamlConfig.config.server.EQUIP_EXP_RATE * ExpTable.getExpNeededForLevel(1)) / (float)normalizedMasteryExp(reqLevel);
|
||||
float masteryModifier = (float) (YamlConfig.config.server.EQUIP_EXP_RATE * ExpTable.getExpNeededForLevel(1)) / (float) normalizedMasteryExp(reqLevel);
|
||||
float elementModifier = (isElemental) ? 0.85f : 0.6f;
|
||||
|
||||
float baseExpGain = gain * elementModifier * masteryModifier;
|
||||
@@ -579,14 +646,16 @@ public class Equip extends Item {
|
||||
itemExp += baseExpGain;
|
||||
int expNeeded = ExpTable.getEquipExpNeededForLevel(itemLevel);
|
||||
|
||||
if(YamlConfig.config.server.USE_DEBUG_SHOW_INFO_EQPEXP) System.out.println("'" + ii.getName(this.getItemId()) + "' -> EXP Gain: " + gain + " Mastery: " + masteryModifier + " Base gain: " + baseExpGain + " exp: " + itemExp + " / " + expNeeded + ", Kills TNL: " + expNeeded / (baseExpGain / c.getPlayer().getExpRate()));
|
||||
if (YamlConfig.config.server.USE_DEBUG_SHOW_INFO_EQPEXP) {
|
||||
System.out.println("'" + ii.getName(this.getItemId()) + "' -> EXP Gain: " + gain + " Mastery: " + masteryModifier + " Base gain: " + baseExpGain + " exp: " + itemExp + " / " + expNeeded + ", Kills TNL: " + expNeeded / (baseExpGain / c.getPlayer().getExpRate()));
|
||||
}
|
||||
|
||||
if (itemExp >= expNeeded) {
|
||||
while(itemExp >= expNeeded) {
|
||||
while (itemExp >= expNeeded) {
|
||||
itemExp -= expNeeded;
|
||||
gainLevel(c);
|
||||
|
||||
if(itemLevel >= equipMaxLevel) {
|
||||
if (itemLevel >= equipMaxLevel) {
|
||||
itemExp = 0.0f;
|
||||
break;
|
||||
}
|
||||
@@ -611,10 +680,12 @@ public class Equip extends Item {
|
||||
|
||||
public String showEquipFeatures(Client c) {
|
||||
ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
if(!ii.isUpgradeable(this.getItemId())) return "";
|
||||
if (!ii.isUpgradeable(this.getItemId())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String eqpName = ii.getName(getItemId());
|
||||
String eqpInfo = reachedMaxLevel() ? " #e#rMAX LEVEL#k#n" : (" EXP: #e#b" + (int)itemExp + "#k#n / " + ExpTable.getEquipExpNeededForLevel(itemLevel));
|
||||
String eqpInfo = reachedMaxLevel() ? " #e#rMAX LEVEL#k#n" : (" EXP: #e#b" + (int) itemExp + "#k#n / " + ExpTable.getEquipExpNeededForLevel(itemLevel));
|
||||
|
||||
return "'" + eqpName + "' -> LV: #e#b" + itemLevel + "#k#n " + eqpInfo + "\r\n";
|
||||
}
|
||||
|
||||
@@ -32,9 +32,11 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class Item implements Comparable<Item> {
|
||||
|
||||
private static AtomicInteger runningCashId = new AtomicInteger(777000000); // pets & rings shares cashid values
|
||||
private static final AtomicInteger runningCashId = new AtomicInteger(777000000); // pets & rings shares cashid values
|
||||
|
||||
private int id, cashId, sn;
|
||||
private final int id;
|
||||
private int cashId;
|
||||
private int sn;
|
||||
private short position;
|
||||
private short quantity;
|
||||
private int petid = -1;
|
||||
@@ -79,7 +81,9 @@ public class Item implements Comparable<Item> {
|
||||
|
||||
public void setPosition(short position) {
|
||||
this.position = position;
|
||||
if (this.pet != null) this.pet.setPosition(position);
|
||||
if (this.pet != null) {
|
||||
this.pet.setPosition(position);
|
||||
}
|
||||
}
|
||||
|
||||
public void setQuantity(short quantity) {
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.List;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Flav
|
||||
*/
|
||||
public enum ItemFactory {
|
||||
@@ -57,7 +56,7 @@ public enum ItemFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private ItemFactory(int value, boolean account) {
|
||||
ItemFactory(int value, boolean account) {
|
||||
this.value = value;
|
||||
this.account = account;
|
||||
}
|
||||
@@ -67,8 +66,11 @@ public enum ItemFactory {
|
||||
}
|
||||
|
||||
public List<Pair<Item, InventoryType>> loadItems(int id, boolean login) throws SQLException {
|
||||
if(value != 6) return loadItemsCommon(id, login);
|
||||
else return loadItemsMerchant(id, login);
|
||||
if (value != 6) {
|
||||
return loadItemsCommon(id, login);
|
||||
} else {
|
||||
return loadItemsMerchant(id, login);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveItems(List<Pair<Item, InventoryType>> items, int id, Connection con) throws SQLException {
|
||||
@@ -78,8 +80,11 @@ public enum ItemFactory {
|
||||
public void saveItems(List<Pair<Item, InventoryType>> items, List<Short> bundlesList, int id, Connection con) throws SQLException {
|
||||
// thanks Arufonsu, MedicOP, BHB for pointing a "synchronized" bottleneck here
|
||||
|
||||
if(value != 6) saveItemsCommon(items, id, con);
|
||||
else saveItemsMerchant(items, bundlesList, id, con);
|
||||
if (value != 6) {
|
||||
saveItemsCommon(items, id, con);
|
||||
} else {
|
||||
saveItemsMerchant(items, bundlesList, id, con);
|
||||
}
|
||||
}
|
||||
|
||||
private static Equip loadEquipFromResultSet(ResultSet rs) throws SQLException {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package client.inventory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevin
|
||||
*/
|
||||
public class ModifyInventory {
|
||||
|
||||
private int mode;
|
||||
private final int mode;
|
||||
private Item item;
|
||||
private short oldPos;
|
||||
|
||||
|
||||
@@ -25,7 +25,10 @@ package client.inventory;
|
||||
* @author Leifde
|
||||
*/
|
||||
public class PetCommand {
|
||||
private int petId, skillId, prob, inc;
|
||||
private final int petId;
|
||||
private final int skillId;
|
||||
private final int prob;
|
||||
private final int inc;
|
||||
|
||||
public PetCommand(int petId, int skillId, int prob, int inc) {
|
||||
this.petId = petId;
|
||||
|
||||
@@ -31,13 +31,12 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Danny (Leifde)
|
||||
*/
|
||||
public class PetDataFactory {
|
||||
private static DataProvider dataRoot = DataProviderFactory.getDataProvider(WZFiles.ITEM);
|
||||
private static Map<String, PetCommand> petCommands = new HashMap<>();
|
||||
private static Map<Integer, Integer> petHunger = new HashMap<>();
|
||||
private static final DataProvider dataRoot = DataProviderFactory.getDataProvider(WZFiles.ITEM);
|
||||
private static final Map<String, PetCommand> petCommands = new HashMap<>();
|
||||
private static final Map<Integer, Integer> petHunger = new HashMap<>();
|
||||
|
||||
public static PetCommand getPetCommand(int petId, int skillId) {
|
||||
PetCommand ret = petCommands.get(petId + "" + skillId);
|
||||
|
||||
@@ -678,10 +678,14 @@ public class InventoryManipulator {
|
||||
} else if (ii.isCash(it.getItemId())) {
|
||||
if (YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_CASH) { // thanks Ari for noticing cash drops not available server-side
|
||||
return true;
|
||||
} else return ItemConstants.isPet(it.getItemId()) && YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_PET;
|
||||
} else {
|
||||
return ItemConstants.isPet(it.getItemId()) && YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_PET;
|
||||
}
|
||||
} else if (isDroppedItemRestricted(it)) {
|
||||
return true;
|
||||
} else return ItemConstants.isWeddingRing(it.getItemId());
|
||||
} else {
|
||||
return ItemConstants.isWeddingRing(it.getItemId());
|
||||
}
|
||||
}
|
||||
|
||||
public static void drop(Client c, InventoryType type, short src, short quantity) {
|
||||
|
||||
@@ -34,22 +34,21 @@ import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan - credits to Eric for showing the New Year opcodes and handler layout
|
||||
*/
|
||||
public class NewYearCardRecord {
|
||||
private int id;
|
||||
|
||||
private int senderId;
|
||||
private String senderName;
|
||||
private final int senderId;
|
||||
private final String senderName;
|
||||
private boolean senderDiscardCard;
|
||||
|
||||
private int receiverId;
|
||||
private String receiverName;
|
||||
private final int receiverId;
|
||||
private final String receiverName;
|
||||
private boolean receiverDiscardCard;
|
||||
private boolean receiverReceivedCard;
|
||||
|
||||
private String stringContent;
|
||||
private final String stringContent;
|
||||
private long dateSent = 0;
|
||||
private long dateReceived = 0;
|
||||
|
||||
@@ -154,7 +153,7 @@ public class NewYearCardRecord {
|
||||
newyear.id = rs.getInt(1);
|
||||
}
|
||||
}
|
||||
} catch(SQLException sqle) {
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -170,14 +169,16 @@ public class NewYearCardRecord {
|
||||
|
||||
ps.executeUpdate();
|
||||
}
|
||||
} catch(SQLException sqle) {
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static NewYearCardRecord loadNewYearCard(int cardid) {
|
||||
NewYearCardRecord nyc = Server.getInstance().getNewYearCard(cardid);
|
||||
if(nyc != null) return nyc;
|
||||
if (nyc != null) {
|
||||
return nyc;
|
||||
}
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection()) {
|
||||
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM newyear WHERE id = ?")) {
|
||||
@@ -192,7 +193,7 @@ public class NewYearCardRecord {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(SQLException sqle) {
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -213,7 +214,7 @@ public class NewYearCardRecord {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(SQLException sqle) {
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -221,7 +222,7 @@ public class NewYearCardRecord {
|
||||
public static void printNewYearRecords(Character chr) {
|
||||
chr.dropMessage(5, "New Years: " + chr.getNewYearRecords().size());
|
||||
|
||||
for(NewYearCardRecord nyc : chr.getNewYearRecords()) {
|
||||
for (NewYearCardRecord nyc : chr.getNewYearRecords()) {
|
||||
chr.dropMessage(5, "-------------------------------");
|
||||
|
||||
chr.dropMessage(5, "Id: " + nyc.id);
|
||||
@@ -242,13 +243,15 @@ public class NewYearCardRecord {
|
||||
}
|
||||
|
||||
public void startNewYearCardTask() {
|
||||
if(sendTask != null) return;
|
||||
if (sendTask != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
sendTask = TimerManager.getInstance().register(() -> {
|
||||
Server server = Server.getInstance();
|
||||
|
||||
int world = server.getCharacterWorld(receiverId);
|
||||
if(world == -1) {
|
||||
if (world == -1) {
|
||||
sendTask.cancel(false);
|
||||
sendTask = null;
|
||||
|
||||
@@ -256,14 +259,14 @@ public class NewYearCardRecord {
|
||||
}
|
||||
|
||||
Character target = server.getWorld(world).getPlayerStorage().getCharacterById(receiverId);
|
||||
if(target != null && target.isLoggedinWorld()) {
|
||||
if (target != null && target.isLoggedinWorld()) {
|
||||
target.sendPacket(PacketCreator.onNewYearCardRes(target, NewYearCardRecord.this, 0xC, 0));
|
||||
}
|
||||
}, 1000 * 60 * 60); //1 Hour
|
||||
}
|
||||
|
||||
public void stopNewYearCardTask() {
|
||||
if(sendTask != null) {
|
||||
if (sendTask != null) {
|
||||
sendTask.cancel(false);
|
||||
sendTask = null;
|
||||
}
|
||||
@@ -277,7 +280,7 @@ public class NewYearCardRecord {
|
||||
ps.setInt(1, id);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
} catch(SQLException sqle) {
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -299,9 +302,9 @@ public class NewYearCardRecord {
|
||||
*/
|
||||
|
||||
Set<NewYearCardRecord> set = new HashSet<>(chr.getNewYearRecords());
|
||||
for(NewYearCardRecord nyc : set) {
|
||||
if(send) {
|
||||
if(nyc.senderId == cid) {
|
||||
for (NewYearCardRecord nyc : set) {
|
||||
if (send) {
|
||||
if (nyc.senderId == cid) {
|
||||
nyc.senderDiscardCard = true;
|
||||
nyc.receiverReceivedCard = false;
|
||||
|
||||
@@ -311,7 +314,7 @@ public class NewYearCardRecord {
|
||||
chr.getMap().broadcastMessage(PacketCreator.onNewYearCardRes(chr, nyc, 0xE, 0));
|
||||
|
||||
Character other = chr.getClient().getWorldServer().getPlayerStorage().getCharacterById(nyc.getReceiverId());
|
||||
if(other != null && other.isLoggedinWorld()) {
|
||||
if (other != null && other.isLoggedinWorld()) {
|
||||
other.removeNewYearRecord(nyc);
|
||||
other.getMap().broadcastMessage(PacketCreator.onNewYearCardRes(other, nyc, 0xE, 0));
|
||||
|
||||
@@ -319,7 +322,7 @@ public class NewYearCardRecord {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(nyc.receiverId == cid) {
|
||||
if (nyc.receiverId == cid) {
|
||||
nyc.receiverDiscardCard = true;
|
||||
nyc.receiverReceivedCard = false;
|
||||
|
||||
@@ -329,7 +332,7 @@ public class NewYearCardRecord {
|
||||
chr.getMap().broadcastMessage(PacketCreator.onNewYearCardRes(chr, nyc, 0xE, 0));
|
||||
|
||||
Character other = chr.getClient().getWorldServer().getPlayerStorage().getCharacterById(nyc.getSenderId());
|
||||
if(other != null && other.isLoggedinWorld()) {
|
||||
if (other != null && other.isLoggedinWorld()) {
|
||||
other.removeNewYearRecord(nyc);
|
||||
other.getMap().broadcastMessage(PacketCreator.onNewYearCardRes(other, nyc, 0xE, 0));
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import server.maps.MapleMap;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class BuybackProcessor {
|
||||
@@ -43,7 +42,7 @@ public class BuybackProcessor {
|
||||
|
||||
if (buyback) {
|
||||
String jobString;
|
||||
switch(chr.getJobStyle()) {
|
||||
switch (chr.getJobStyle()) {
|
||||
case WARRIOR:
|
||||
jobString = "warrior";
|
||||
break;
|
||||
|
||||
@@ -42,12 +42,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public class MakerProcessor {
|
||||
|
||||
private static ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
private static final ItemInformationProvider ii = ItemInformationProvider.getInstance();
|
||||
|
||||
public static void makerAction(InPacket p, Client c) {
|
||||
if (c.tryacquireClient()) {
|
||||
@@ -61,26 +60,26 @@ public class MakerProcessor {
|
||||
Map<Integer, Short> reagentids = new LinkedHashMap<>();
|
||||
int stimulantid = -1;
|
||||
|
||||
if(type == 3) { // building monster crystal
|
||||
if (type == 3) { // building monster crystal
|
||||
int fromLeftover = toCreate;
|
||||
toCreate = ii.getMakerCrystalFromLeftover(toCreate);
|
||||
if(toCreate == -1) {
|
||||
if (toCreate == -1) {
|
||||
c.sendPacket(PacketCreator.serverNotice(1, ii.getName(fromLeftover) + " is unavailable for Monster Crystal conversion."));
|
||||
c.sendPacket(PacketCreator.makerEnableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
recipe = MakerItemFactory.generateLeftoverCrystalEntry(fromLeftover, toCreate);
|
||||
} else if(type == 4) { // disassembling
|
||||
} else if (type == 4) { // disassembling
|
||||
p.readInt(); // 1... probably inventory type
|
||||
pos = p.readInt();
|
||||
|
||||
Item it = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((short) pos);
|
||||
if(it != null && it.getItemId() == toCreate) {
|
||||
if (it != null && it.getItemId() == toCreate) {
|
||||
toDisassemble = toCreate;
|
||||
|
||||
Pair<Integer, List<Pair<Integer, Integer>>> pair = generateDisassemblyInfo(toDisassemble);
|
||||
if(pair != null) {
|
||||
if (pair != null) {
|
||||
recipe = MakerItemFactory.generateDisassemblyCrystalEntry(toDisassemble, pair.getLeft(), pair.getRight());
|
||||
} else {
|
||||
c.sendPacket(PacketCreator.serverNotice(1, ii.getName(toCreate) + " is unavailable for Monster Crystal disassembly."));
|
||||
@@ -93,20 +92,20 @@ public class MakerProcessor {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(ItemConstants.isEquipment(toCreate)) { // only equips uses stimulant and reagents
|
||||
if(p.readByte() != 0) { // stimulant
|
||||
if (ItemConstants.isEquipment(toCreate)) { // only equips uses stimulant and reagents
|
||||
if (p.readByte() != 0) { // stimulant
|
||||
stimulantid = ii.getMakerStimulant(toCreate);
|
||||
if(!c.getAbstractPlayerInteraction().haveItem(stimulantid)) {
|
||||
if (!c.getAbstractPlayerInteraction().haveItem(stimulantid)) {
|
||||
stimulantid = -1;
|
||||
}
|
||||
}
|
||||
|
||||
int reagents = Math.min(p.readInt(), getMakerReagentSlots(toCreate));
|
||||
for(int i = 0; i < reagents; i++) { // crystals
|
||||
for (int i = 0; i < reagents; i++) { // crystals
|
||||
int reagentid = p.readInt();
|
||||
if(ItemConstants.isMakerReagent(reagentid)) {
|
||||
if (ItemConstants.isMakerReagent(reagentid)) {
|
||||
Short rs = reagentids.get(reagentid);
|
||||
if(rs == null) {
|
||||
if (rs == null) {
|
||||
reagentids.put(reagentid, (short) 1);
|
||||
} else {
|
||||
reagentids.put(reagentid, (short) (rs + 1));
|
||||
@@ -115,18 +114,18 @@ public class MakerProcessor {
|
||||
}
|
||||
|
||||
List<Pair<Integer, Short>> toUpdate = new LinkedList<>();
|
||||
for(Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
for (Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
int qty = c.getAbstractPlayerInteraction().getItemQuantity(r.getKey());
|
||||
|
||||
if(qty < r.getValue()) {
|
||||
if (qty < r.getValue()) {
|
||||
toUpdate.add(new Pair<>(r.getKey(), (short) qty));
|
||||
}
|
||||
}
|
||||
|
||||
// remove those not present on player inventory
|
||||
if(!toUpdate.isEmpty()) {
|
||||
for(Pair<Integer, Short> rp : toUpdate) {
|
||||
if(rp.getRight() > 0) {
|
||||
if (!toUpdate.isEmpty()) {
|
||||
for (Pair<Integer, Short> rp : toUpdate) {
|
||||
if (rp.getRight() > 0) {
|
||||
reagentids.put(rp.getLeft(), rp.getRight());
|
||||
} else {
|
||||
reagentids.remove(rp.getLeft());
|
||||
@@ -134,8 +133,8 @@ public class MakerProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
if(!reagentids.isEmpty()) {
|
||||
if(!removeOddMakerReagents(toCreate, reagentids)) {
|
||||
if (!reagentids.isEmpty()) {
|
||||
if (!removeOddMakerReagents(toCreate, reagentids)) {
|
||||
c.sendPacket(PacketCreator.serverNotice(1, "You can only use WATK and MATK Strengthening Gems on weapon items."));
|
||||
c.sendPacket(PacketCreator.makerEnableActions());
|
||||
return;
|
||||
@@ -148,7 +147,7 @@ public class MakerProcessor {
|
||||
|
||||
short createStatus = getCreateStatus(c, recipe);
|
||||
|
||||
switch(createStatus) {
|
||||
switch (createStatus) {
|
||||
case -1:// non-available for Maker itemid has been tried to forge
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS, "Player " + c.getPlayer().getName() + " tried to craft itemid " + toCreate + " using the Maker skill.");
|
||||
c.sendPacket(PacketCreator.serverNotice(1, "The requested item could not be crafted on this operation."));
|
||||
@@ -181,7 +180,7 @@ public class MakerProcessor {
|
||||
break;
|
||||
|
||||
default:
|
||||
if(toDisassemble != -1) {
|
||||
if (toDisassemble != -1) {
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (short) pos, (short) 1, false);
|
||||
} else {
|
||||
for (Pair<Integer, Integer> pair : recipe.getReqItems()) {
|
||||
@@ -190,8 +189,10 @@ public class MakerProcessor {
|
||||
}
|
||||
|
||||
int cost = recipe.getCost();
|
||||
if(stimulantid == -1 && reagentids.isEmpty()) {
|
||||
if(cost > 0) c.getPlayer().gainMeso(-cost, false);
|
||||
if (stimulantid == -1 && reagentids.isEmpty()) {
|
||||
if (cost > 0) {
|
||||
c.getPlayer().gainMeso(-cost, false);
|
||||
}
|
||||
|
||||
for (Pair<Integer, Integer> pair : recipe.getGainItems()) {
|
||||
c.getPlayer().setCS(true);
|
||||
@@ -201,14 +202,18 @@ public class MakerProcessor {
|
||||
} else {
|
||||
toCreate = recipe.getGainItems().get(0).getLeft();
|
||||
|
||||
if(stimulantid != -1) c.getAbstractPlayerInteraction().gainItem(stimulantid, (short) -1, false);
|
||||
if(!reagentids.isEmpty()) {
|
||||
for(Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
if (stimulantid != -1) {
|
||||
c.getAbstractPlayerInteraction().gainItem(stimulantid, (short) -1, false);
|
||||
}
|
||||
if (!reagentids.isEmpty()) {
|
||||
for (Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
c.getAbstractPlayerInteraction().gainItem(r.getKey(), (short) (-1 * r.getValue()), false);
|
||||
}
|
||||
}
|
||||
|
||||
if(cost > 0) c.getPlayer().gainMeso(-cost, false);
|
||||
if (cost > 0) {
|
||||
c.getPlayer().gainMeso(-cost, false);
|
||||
}
|
||||
makerSucceeded = addBoostedMakerItem(c, toCreate, stimulantid, reagentids);
|
||||
}
|
||||
|
||||
@@ -224,7 +229,7 @@ public class MakerProcessor {
|
||||
c.sendPacket(PacketCreator.showMakerEffect(makerSucceeded));
|
||||
c.getPlayer().getMap().broadcastMessage(c.getPlayer(), PacketCreator.showForeignMakerEffect(c.getPlayer().getId(), makerSucceeded), false);
|
||||
|
||||
if(toCreate == 4260003 && type == 3 && c.getPlayer().getQuestStatus(6033) == 1) {
|
||||
if (toCreate == 4260003 && type == 3 && c.getPlayer().getQuestStatus(6033) == 1) {
|
||||
c.getAbstractPlayerInteraction().setQuestProgress(6033, 1);
|
||||
}
|
||||
}
|
||||
@@ -241,17 +246,17 @@ public class MakerProcessor {
|
||||
|
||||
boolean isWeapon = ItemConstants.isWeapon(toCreate) || YamlConfig.config.server.USE_MAKER_PERMISSIVE_ATKUP; // thanks Vcoc for finding a case where a weapon wouldn't be counted as such due to a bounding on isWeapon
|
||||
|
||||
for(Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
for (Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
int curRid = r.getKey();
|
||||
int type = r.getKey() / 100;
|
||||
|
||||
if(type < 42502 && !isWeapon) { // only weapons should gain w.att/m.att from these.
|
||||
if (type < 42502 && !isWeapon) { // only weapons should gain w.att/m.att from these.
|
||||
return false; //toRemove.add(curRid);
|
||||
} else {
|
||||
Integer tableRid = reagentType.get(type);
|
||||
|
||||
if(tableRid != null) {
|
||||
if(tableRid < curRid) {
|
||||
if (tableRid != null) {
|
||||
if (tableRid < curRid) {
|
||||
toRemove.add(tableRid);
|
||||
reagentType.put(type, curRid);
|
||||
} else {
|
||||
@@ -264,12 +269,12 @@ public class MakerProcessor {
|
||||
}
|
||||
|
||||
// removing less effective gems of repeated type
|
||||
for(Integer i : toRemove) {
|
||||
for (Integer i : toRemove) {
|
||||
reagentids.remove(i);
|
||||
}
|
||||
|
||||
// the Maker skill will use only one of each gem
|
||||
for(Integer i : reagentids.keySet()) {
|
||||
for (Integer i : reagentids.keySet()) {
|
||||
reagentids.put(i, (short) 1);
|
||||
}
|
||||
|
||||
@@ -280,23 +285,23 @@ public class MakerProcessor {
|
||||
try {
|
||||
int eqpLevel = ii.getEquipLevelReq(itemId);
|
||||
|
||||
if(eqpLevel < 78) {
|
||||
if (eqpLevel < 78) {
|
||||
return 1;
|
||||
} else if(eqpLevel >= 78 && eqpLevel < 108) {
|
||||
} else if (eqpLevel >= 78 && eqpLevel < 108) {
|
||||
return 2;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
} catch(NullPointerException npe) {
|
||||
} catch (NullPointerException npe) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static Pair<Integer, List<Pair<Integer, Integer>>> generateDisassemblyInfo(int itemId) {
|
||||
int recvFee = ii.getMakerDisassembledFee(itemId);
|
||||
if(recvFee > -1) {
|
||||
if (recvFee > -1) {
|
||||
List<Pair<Integer, Integer>> gains = ii.getMakerDisassembledItems(itemId);
|
||||
if(!gains.isEmpty()) {
|
||||
if (!gains.isEmpty()) {
|
||||
return new Pair<>(recvFee, gains);
|
||||
}
|
||||
}
|
||||
@@ -309,23 +314,23 @@ public class MakerProcessor {
|
||||
}
|
||||
|
||||
private static short getCreateStatus(Client c, MakerItemCreateEntry recipe) {
|
||||
if(recipe.isInvalid()) {
|
||||
if (recipe.isInvalid()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!hasItems(c, recipe)) {
|
||||
if (!hasItems(c, recipe)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(c.getPlayer().getMeso() < recipe.getCost()) {
|
||||
if (c.getPlayer().getMeso() < recipe.getCost()) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if(c.getPlayer().getLevel() < recipe.getReqLevel()) {
|
||||
if (c.getPlayer().getLevel() < recipe.getReqLevel()) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if(getMakerSkillLevel(c.getPlayer()) < recipe.getReqSkillLevel()) {
|
||||
if (getMakerSkillLevel(c.getPlayer()) < recipe.getReqSkillLevel()) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -362,36 +367,40 @@ public class MakerProcessor {
|
||||
}
|
||||
|
||||
private static boolean addBoostedMakerItem(Client c, int itemid, int stimulantid, Map<Integer, Short> reagentids) {
|
||||
if(stimulantid != -1 && !ii.rollSuccessChance(90.0)) {
|
||||
if (stimulantid != -1 && !ItemInformationProvider.rollSuccessChance(90.0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = ii.getEquipById(itemid);
|
||||
if(item == null) return false;
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Equip eqp = (Equip)item;
|
||||
if(ItemConstants.isAccessory(item.getItemId()) && eqp.getUpgradeSlots() <= 0) eqp.setUpgradeSlots(3);
|
||||
Equip eqp = (Equip) item;
|
||||
if (ItemConstants.isAccessory(item.getItemId()) && eqp.getUpgradeSlots() <= 0) {
|
||||
eqp.setUpgradeSlots(3);
|
||||
}
|
||||
|
||||
if(YamlConfig.config.server.USE_ENHANCED_CRAFTING == true) {
|
||||
if(!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) {
|
||||
eqp.setUpgradeSlots((byte)(eqp.getUpgradeSlots() + 1));
|
||||
if (YamlConfig.config.server.USE_ENHANCED_CRAFTING == true) {
|
||||
if (!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) {
|
||||
eqp.setUpgradeSlots((byte) (eqp.getUpgradeSlots() + 1));
|
||||
}
|
||||
item = ItemInformationProvider.getInstance().scrollEquipWithId(eqp, 2049100, true, 2049100, c.getPlayer().isGM());
|
||||
}
|
||||
|
||||
if(!reagentids.isEmpty()) {
|
||||
if (!reagentids.isEmpty()) {
|
||||
Map<String, Integer> stats = new LinkedHashMap<>();
|
||||
List<Short> randOption = new LinkedList<>();
|
||||
List<Short> randStat = new LinkedList<>();
|
||||
|
||||
for(Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
for (Map.Entry<Integer, Short> r : reagentids.entrySet()) {
|
||||
Pair<String, Integer> reagentBuff = ii.getMakerReagentStatUpgrade(r.getKey());
|
||||
|
||||
if(reagentBuff != null) {
|
||||
if (reagentBuff != null) {
|
||||
String s = reagentBuff.getLeft();
|
||||
|
||||
if(s.substring(0, 4).contains("rand")) {
|
||||
if(s.substring(4).equals("Stat")) {
|
||||
if (s.substring(0, 4).contains("rand")) {
|
||||
if (s.substring(4).equals("Stat")) {
|
||||
randStat.add((short) (reagentBuff.getRight() * r.getValue()));
|
||||
} else {
|
||||
randOption.add((short) (reagentBuff.getRight() * r.getValue()));
|
||||
@@ -399,7 +408,7 @@ public class MakerProcessor {
|
||||
} else {
|
||||
String stat = s.substring(3);
|
||||
|
||||
if(!stat.equals("ReqLevel")) { // improve req level... really?
|
||||
if (!stat.equals("ReqLevel")) { // improve req level... really?
|
||||
switch (stat) {
|
||||
case "MaxHP":
|
||||
stat = "MHP";
|
||||
@@ -411,7 +420,7 @@ public class MakerProcessor {
|
||||
}
|
||||
|
||||
Integer d = stats.get(stat);
|
||||
if(d == null) {
|
||||
if (d == null) {
|
||||
stats.put(stat, reagentBuff.getRight() * r.getValue());
|
||||
} else {
|
||||
stats.put(stat, d + (reagentBuff.getRight() * r.getValue()));
|
||||
@@ -421,18 +430,18 @@ public class MakerProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
ii.improveEquipStats(eqp, stats);
|
||||
ItemInformationProvider.improveEquipStats(eqp, stats);
|
||||
|
||||
for(Short sh : randStat) {
|
||||
for (Short sh : randStat) {
|
||||
ii.scrollOptionEquipWithChaos(eqp, sh, false);
|
||||
}
|
||||
|
||||
for(Short sh : randOption) {
|
||||
for (Short sh : randOption) {
|
||||
ii.scrollOptionEquipWithChaos(eqp, sh, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(stimulantid != -1) {
|
||||
if (stimulantid != -1) {
|
||||
eqp = ii.randomizeUpgradeStats(eqp);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,16 +35,15 @@ import tools.PacketCreator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan - multi-pot consumption feature
|
||||
*/
|
||||
public class PetAutopotProcessor {
|
||||
|
||||
private static class AutopotAction {
|
||||
|
||||
private Client c;
|
||||
private final Client c;
|
||||
private short slot;
|
||||
private int itemId;
|
||||
private final int itemId;
|
||||
|
||||
private Item toUse;
|
||||
private List<Item> toUseList;
|
||||
@@ -54,15 +53,15 @@ public class PetAutopotProcessor {
|
||||
private double incHp, incMp;
|
||||
|
||||
private boolean cursorOnNextAvailablePot(Character chr) {
|
||||
if(toUseList == null) {
|
||||
if (toUseList == null) {
|
||||
toUseList = chr.getInventory(InventoryType.USE).linkedListById(itemId);
|
||||
}
|
||||
|
||||
toUse = null;
|
||||
while(!toUseList.isEmpty()) {
|
||||
while (!toUseList.isEmpty()) {
|
||||
Item it = toUseList.remove(0);
|
||||
|
||||
if(it.getQuantity() > 0) {
|
||||
if (it.getQuantity() > 0) {
|
||||
toUse = it;
|
||||
slot = it.getPosition();
|
||||
|
||||
@@ -121,10 +120,14 @@ public class PetAutopotProcessor {
|
||||
hasMpGain = stat.getMp() > 0 || stat.getMpRate() > 0.0;
|
||||
|
||||
incHp = stat.getHp();
|
||||
if(incHp <= 0 && hasHpGain) incHp = Math.ceil(maxHp * stat.getHpRate());
|
||||
if (incHp <= 0 && hasHpGain) {
|
||||
incHp = Math.ceil(maxHp * stat.getHpRate());
|
||||
}
|
||||
|
||||
incMp = stat.getMp();
|
||||
if(incMp <= 0 && hasMpGain) incMp = Math.ceil(maxMp * stat.getMpRate());
|
||||
if (incMp <= 0 && hasMpGain) {
|
||||
incMp = Math.ceil(maxMp * stat.getMpRate());
|
||||
}
|
||||
|
||||
if (YamlConfig.config.server.USE_COMPULSORY_AUTOPOT) {
|
||||
if (hasHpGain) {
|
||||
@@ -158,10 +161,10 @@ public class PetAutopotProcessor {
|
||||
useCount += qtyToUse;
|
||||
qtyCount -= qtyToUse;
|
||||
|
||||
if(toUse.getQuantity() == 0 && qtyCount > 0) {
|
||||
if (toUse.getQuantity() == 0 && qtyCount > 0) {
|
||||
// depleted out the current slot, fetch for more
|
||||
|
||||
if(!cursorOnNextAvailablePot(chr)) {
|
||||
if (!cursorOnNextAvailablePot(chr)) {
|
||||
break; // no more pots available
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -34,7 +34,6 @@ import tools.PacketCreator;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana - just added locking on OdinMS' SpawnPetHandler method body
|
||||
*/
|
||||
public class SpawnPetProcessor {
|
||||
@@ -45,7 +44,9 @@ public class SpawnPetProcessor {
|
||||
try {
|
||||
Character chr = c.getPlayer();
|
||||
Pet pet = chr.getInventory(InventoryType.CASH).getItem(slot).getPet();
|
||||
if (pet == null) return;
|
||||
if (pet == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int petid = pet.getItemId();
|
||||
if (petid == 5000028 || petid == 5000047) //Handles Dragon AND Robos
|
||||
|
||||
@@ -468,7 +468,7 @@ public class DueyProcessor {
|
||||
c.add(Calendar.DATE, -30);
|
||||
final Timestamp ts = new Timestamp(c.getTime().getTime());
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection()){
|
||||
try (Connection con = DatabaseConnection.getConnection()) {
|
||||
List<Integer> toRemove = new LinkedList<>();
|
||||
try (PreparedStatement ps = con.prepareStatement("SELECT `PackageId` FROM dueypackages WHERE `TimeStamp` < ?")) {
|
||||
ps.setTimestamp(1, ts);
|
||||
|
||||
@@ -45,12 +45,11 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana - synchronization of Fredrick modules and operation results
|
||||
*/
|
||||
public class FredrickProcessor {
|
||||
|
||||
private static int[] dailyReminders = new int[]{2, 5, 10, 15, 30, 60, 90, Integer.MAX_VALUE};
|
||||
private static final int[] dailyReminders = new int[]{2, 5, 10, 15, 30, 60, 90, Integer.MAX_VALUE};
|
||||
|
||||
private static byte canRetrieveFromFredrick(Character chr, List<Pair<Item, InventoryType>> items) {
|
||||
if (!Inventory.checkSpotsAndOwnership(chr, items)) {
|
||||
@@ -284,8 +283,9 @@ public class FredrickProcessor {
|
||||
if (deleteFredrickItems(chr.getId())) {
|
||||
HiredMerchant merchant = chr.getHiredMerchant();
|
||||
|
||||
if(merchant != null)
|
||||
if (merchant != null) {
|
||||
merchant.clearItems();
|
||||
}
|
||||
|
||||
for (Pair<Item, InventoryType> it : items) {
|
||||
Item item = it.getLeft();
|
||||
|
||||
@@ -38,7 +38,6 @@ import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Matze
|
||||
* @author Ronan - inventory concurrency protection on storing items
|
||||
*/
|
||||
@@ -50,7 +49,7 @@ public class StorageProcessor {
|
||||
Storage storage = chr.getStorage();
|
||||
byte mode = p.readByte();
|
||||
|
||||
if (chr.getLevel() < 15){
|
||||
if (chr.getLevel() < 15) {
|
||||
chr.dropMessage(1, "You may only use the storage once you have reached level 15.");
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
@@ -167,7 +166,9 @@ public class StorageProcessor {
|
||||
storage.sendStored(c, ItemConstants.getInventoryType(itemId));
|
||||
}
|
||||
} else if (mode == 6) { // arrange items
|
||||
if(YamlConfig.config.server.USE_STORAGE_ITEM_SORT) storage.arrangeItems(c);
|
||||
if (YamlConfig.config.server.USE_STORAGE_ITEM_SORT) {
|
||||
storage.arrangeItems(c);
|
||||
}
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
} else if (mode == 7) { // meso
|
||||
int meso = p.readInt();
|
||||
|
||||
@@ -41,14 +41,15 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana - synchronization of AP transaction modules
|
||||
*/
|
||||
public class AssignAPProcessor {
|
||||
|
||||
public static void APAutoAssignAction(InPacket inPacket, Client c) {
|
||||
Character chr = c.getPlayer();
|
||||
if (chr.getRemainingAp() < 1) return;
|
||||
if (chr.getRemainingAp() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<Item> equippedC = chr.getInventory(InventoryType.EQUIPPED).list();
|
||||
|
||||
@@ -56,12 +57,15 @@ public class AssignAPProcessor {
|
||||
try {
|
||||
int[] statGain = new int[4];
|
||||
int[] statUpdate = new int[4];
|
||||
statGain[0] = 0; statGain[1] = 0; statGain[2] = 0; statGain[3] = 0;
|
||||
statGain[0] = 0;
|
||||
statGain[1] = 0;
|
||||
statGain[2] = 0;
|
||||
statGain[3] = 0;
|
||||
|
||||
int remainingAp = chr.getRemainingAp();
|
||||
inPacket.skip(8);
|
||||
|
||||
if(YamlConfig.config.server.USE_SERVER_AUTOASSIGNER) {
|
||||
if (YamlConfig.config.server.USE_SERVER_AUTOASSIGNER) {
|
||||
// --------- Ronan Lana's AUTOASSIGNER ---------
|
||||
// This method excels for assigning APs in such a way to cover all equipments AP requirements.
|
||||
byte opt = inPacket.readByte(); // useful for pirate autoassigning
|
||||
@@ -74,14 +78,20 @@ public class AssignAPProcessor {
|
||||
Equip nEquip;
|
||||
|
||||
for (Item item : equippedC) { //selecting the biggest AP value of each stat from each equipped item.
|
||||
nEquip = (Equip)item;
|
||||
if(nEquip.getStr() > 0) eqpStrList.add(nEquip.getStr());
|
||||
nEquip = (Equip) item;
|
||||
if (nEquip.getStr() > 0) {
|
||||
eqpStrList.add(nEquip.getStr());
|
||||
}
|
||||
str += nEquip.getStr();
|
||||
|
||||
if(nEquip.getDex() > 0) eqpDexList.add(nEquip.getDex());
|
||||
if (nEquip.getDex() > 0) {
|
||||
eqpDexList.add(nEquip.getDex());
|
||||
}
|
||||
dex += nEquip.getDex();
|
||||
|
||||
if(nEquip.getLuk() > 0) eqpLukList.add(nEquip.getLuk());
|
||||
if (nEquip.getLuk() > 0) {
|
||||
eqpLukList.add(nEquip.getLuk());
|
||||
}
|
||||
luk += nEquip.getLuk();
|
||||
|
||||
//if(nEquip.getInt() > 0) eqpIntList.add(nEquip.getInt()); //not needed...
|
||||
@@ -108,25 +118,33 @@ public class AssignAPProcessor {
|
||||
|
||||
Job stance = c.getPlayer().getJobStyle(opt);
|
||||
int prStat = 0, scStat = 0, trStat = 0, temp, tempAp = remainingAp, CAP;
|
||||
if (tempAp < 1) return;
|
||||
if (tempAp < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
Stat primary, secondary, tertiary = Stat.LUK;
|
||||
switch(stance) {
|
||||
switch (stance) {
|
||||
case MAGICIAN:
|
||||
CAP = 165;
|
||||
scStat = (chr.getLevel() + 3) - (chr.getLuk() + luk - eqpLuk);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
scStat = Math.min(scStat, tempAp);
|
||||
|
||||
if(tempAp > scStat) tempAp -= scStat;
|
||||
else tempAp = 0;
|
||||
if (tempAp > scStat) {
|
||||
tempAp -= scStat;
|
||||
} else {
|
||||
tempAp = 0;
|
||||
}
|
||||
|
||||
prStat = tempAp;
|
||||
int_ = prStat;
|
||||
luk = scStat;
|
||||
str = 0; dex = 0;
|
||||
str = 0;
|
||||
dex = 0;
|
||||
|
||||
if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && luk + chr.getLuk() > CAP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && luk + chr.getLuk() > CAP) {
|
||||
temp = luk + chr.getLuk() - CAP;
|
||||
scStat -= temp;
|
||||
prStat += temp;
|
||||
@@ -141,18 +159,24 @@ public class AssignAPProcessor {
|
||||
case BOWMAN:
|
||||
CAP = 125;
|
||||
scStat = (chr.getLevel() + 5) - (chr.getStr() + str - eqpStr);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
scStat = Math.min(scStat, tempAp);
|
||||
|
||||
if(tempAp > scStat) tempAp -= scStat;
|
||||
else tempAp = 0;
|
||||
if (tempAp > scStat) {
|
||||
tempAp -= scStat;
|
||||
} else {
|
||||
tempAp = 0;
|
||||
}
|
||||
|
||||
prStat = tempAp;
|
||||
dex = prStat;
|
||||
str = scStat;
|
||||
int_ = 0; luk = 0;
|
||||
int_ = 0;
|
||||
luk = 0;
|
||||
|
||||
if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) {
|
||||
temp = str + chr.getStr() - CAP;
|
||||
scStat -= temp;
|
||||
prStat += temp;
|
||||
@@ -167,18 +191,24 @@ public class AssignAPProcessor {
|
||||
case CROSSBOWMAN:
|
||||
CAP = 120;
|
||||
scStat = chr.getLevel() - (chr.getStr() + str - eqpStr);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
scStat = Math.min(scStat, tempAp);
|
||||
|
||||
if(tempAp > scStat) tempAp -= scStat;
|
||||
else tempAp = 0;
|
||||
if (tempAp > scStat) {
|
||||
tempAp -= scStat;
|
||||
} else {
|
||||
tempAp = 0;
|
||||
}
|
||||
|
||||
prStat = tempAp;
|
||||
dex = prStat;
|
||||
str = scStat;
|
||||
int_ = 0; luk = 0;
|
||||
int_ = 0;
|
||||
luk = 0;
|
||||
|
||||
if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) {
|
||||
temp = str + chr.getStr() - CAP;
|
||||
scStat -= temp;
|
||||
prStat += temp;
|
||||
@@ -193,9 +223,11 @@ public class AssignAPProcessor {
|
||||
CAP = 160;
|
||||
|
||||
scStat = 0;
|
||||
if(chr.getDex() < 80) {
|
||||
if (chr.getDex() < 80) {
|
||||
scStat = (2 * chr.getLevel()) - (chr.getDex() + dex - eqpDex);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
|
||||
scStat = Math.min(80 - chr.getDex(), scStat);
|
||||
scStat = Math.min(tempAp, scStat);
|
||||
@@ -203,16 +235,20 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
temp = (chr.getLevel() + 40) - Math.max(80, scStat + chr.getDex() + dex - eqpDex);
|
||||
if(temp < 0) temp = 0;
|
||||
if (temp < 0) {
|
||||
temp = 0;
|
||||
}
|
||||
temp = Math.min(tempAp, temp);
|
||||
scStat += temp;
|
||||
tempAp -= temp;
|
||||
|
||||
// thieves will upgrade STR as well only if a level-based threshold is reached.
|
||||
if(chr.getStr() >= Math.max(13, (int)(0.4 * chr.getLevel()))) {
|
||||
if(chr.getStr() < 50) {
|
||||
if (chr.getStr() >= Math.max(13, (int) (0.4 * chr.getLevel()))) {
|
||||
if (chr.getStr() < 50) {
|
||||
trStat = (chr.getLevel() - 10) - (chr.getStr() + str - eqpStr);
|
||||
if(trStat < 0) trStat = 0;
|
||||
if (trStat < 0) {
|
||||
trStat = 0;
|
||||
}
|
||||
|
||||
trStat = Math.min(50 - chr.getStr(), trStat);
|
||||
trStat = Math.min(tempAp, trStat);
|
||||
@@ -220,7 +256,9 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
temp = (20 + (chr.getLevel() / 2)) - Math.max(50, trStat + chr.getStr() + str - eqpStr);
|
||||
if(temp < 0) temp = 0;
|
||||
if (temp < 0) {
|
||||
temp = 0;
|
||||
}
|
||||
temp = Math.min(tempAp, temp);
|
||||
trStat += temp;
|
||||
tempAp -= temp;
|
||||
@@ -232,12 +270,12 @@ public class AssignAPProcessor {
|
||||
str = trStat;
|
||||
int_ = 0;
|
||||
|
||||
if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) {
|
||||
temp = dex + chr.getDex() - CAP;
|
||||
scStat -= temp;
|
||||
prStat += temp;
|
||||
}
|
||||
if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) {
|
||||
temp = str + chr.getStr() - CAP;
|
||||
trStat -= temp;
|
||||
prStat += temp;
|
||||
@@ -265,11 +303,13 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
// other classes will start favoring more DEX only if a level-based threshold is reached.
|
||||
if(!highDex) {
|
||||
if (!highDex) {
|
||||
scStat = 0;
|
||||
if(chr.getDex() < 80) {
|
||||
if (chr.getDex() < 80) {
|
||||
scStat = (2 * chr.getLevel()) - (chr.getDex() + dex - eqpDex);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
|
||||
scStat = Math.min(80 - chr.getDex(), scStat);
|
||||
scStat = Math.min(tempAp, scStat);
|
||||
@@ -277,23 +317,29 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
temp = (chr.getLevel() + 40) - Math.max(80, scStat + chr.getDex() + dex - eqpDex);
|
||||
if(temp < 0) temp = 0;
|
||||
if (temp < 0) {
|
||||
temp = 0;
|
||||
}
|
||||
temp = Math.min(tempAp, temp);
|
||||
scStat += temp;
|
||||
tempAp -= temp;
|
||||
} else {
|
||||
scStat = 0;
|
||||
if(chr.getDex() < 96) {
|
||||
scStat = (int)(2.4 * chr.getLevel()) - (chr.getDex() + dex - eqpDex);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (chr.getDex() < 96) {
|
||||
scStat = (int) (2.4 * chr.getLevel()) - (chr.getDex() + dex - eqpDex);
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
|
||||
scStat = Math.min(96 - chr.getDex(), scStat);
|
||||
scStat = Math.min(tempAp, scStat);
|
||||
tempAp -= scStat;
|
||||
}
|
||||
|
||||
temp = 96 + (int)(1.2 * (chr.getLevel() - 40)) - Math.max(96, scStat + chr.getDex() + dex - eqpDex);
|
||||
if(temp < 0) temp = 0;
|
||||
temp = 96 + (int) (1.2 * (chr.getLevel() - 40)) - Math.max(96, scStat + chr.getDex() + dex - eqpDex);
|
||||
if (temp < 0) {
|
||||
temp = 0;
|
||||
}
|
||||
temp = Math.min(tempAp, temp);
|
||||
scStat += temp;
|
||||
tempAp -= temp;
|
||||
@@ -302,9 +348,10 @@ public class AssignAPProcessor {
|
||||
prStat = tempAp;
|
||||
str = prStat;
|
||||
dex = scStat;
|
||||
int_ = 0; luk = 0;
|
||||
int_ = 0;
|
||||
luk = 0;
|
||||
|
||||
if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) {
|
||||
if (YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) {
|
||||
temp = dex + chr.getDex() - CAP;
|
||||
scStat -= temp;
|
||||
prStat += temp;
|
||||
@@ -322,7 +369,7 @@ public class AssignAPProcessor {
|
||||
extras = gainStatByType(secondary, statGain, scStat + extras, statUpdate);
|
||||
extras = gainStatByType(tertiary, statGain, trStat + extras, statUpdate);
|
||||
|
||||
if(extras > 0) { //redistribute surplus in priority order
|
||||
if (extras > 0) { //redistribute surplus in priority order
|
||||
extras = gainStatByType(primary, statGain, extras, statUpdate);
|
||||
extras = gainStatByType(secondary, statGain, extras, statUpdate);
|
||||
extras = gainStatByType(tertiary, statGain, extras, statUpdate);
|
||||
@@ -336,7 +383,7 @@ public class AssignAPProcessor {
|
||||
|
||||
c.sendPacket(PacketCreator.serverNotice(1, "Better AP applications detected:\r\nSTR: +" + statGain[0] + "\r\nDEX: +" + statGain[1] + "\r\nINT: +" + statGain[3] + "\r\nLUK: +" + statGain[2]));
|
||||
} else {
|
||||
if(inPacket.available() < 16) {
|
||||
if (inPacket.available() < 16) {
|
||||
AutobanFactory.PACKET_EDIT.alert(chr, "Didn't send full packet for Auto Assign.");
|
||||
|
||||
c.disconnect(true, false);
|
||||
@@ -362,11 +409,13 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
private static int getNthHighestStat(List<Short> statList, short rank) { // ranks from 0
|
||||
return(statList.size() <= rank ? 0 : statList.get(rank));
|
||||
return (statList.size() <= rank ? 0 : statList.get(rank));
|
||||
}
|
||||
|
||||
private static int gainStatByType(Stat type, int[] statGain, int gain, int[] statUpdate) {
|
||||
if(gain <= 0) return 0;
|
||||
if (gain <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int newVal = 0;
|
||||
if (type.equals(Stat.STR)) {
|
||||
@@ -414,7 +463,9 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
private static Stat getQuaternaryStat(Job stance) {
|
||||
if(stance != Job.MAGICIAN) return Stat.INT;
|
||||
if (stance != Job.MAGICIAN) {
|
||||
return Stat.INT;
|
||||
}
|
||||
return Stat.STR;
|
||||
}
|
||||
|
||||
@@ -473,7 +524,7 @@ public class AssignAPProcessor {
|
||||
}
|
||||
break;
|
||||
case 2048: // HP
|
||||
if(YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) {
|
||||
if (YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) {
|
||||
if (APTo != 8192) {
|
||||
player.message("You can only swap HP ability points to MP.");
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
@@ -504,7 +555,7 @@ public class AssignAPProcessor {
|
||||
|
||||
break;
|
||||
case 8192: // MP
|
||||
if(YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) {
|
||||
if (YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) {
|
||||
if (APTo != 2048) {
|
||||
player.message("You can only swap MP ability points to HP.");
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
@@ -623,15 +674,16 @@ public class AssignAPProcessor {
|
||||
int MaxHP = 0;
|
||||
|
||||
if (job.isA(Job.WARRIOR) || job.isA(Job.DAWNWARRIOR1)) {
|
||||
if(!usedAPReset) {
|
||||
if (!usedAPReset) {
|
||||
Skill increaseHP = SkillFactory.getSkill(job.isA(Job.DAWNWARRIOR1) ? DawnWarrior.MAX_HP_INCREASE : Warrior.IMPROVED_MAXHP);
|
||||
int sLvl = player.getSkillLevel(increaseHP);
|
||||
|
||||
if(sLvl > 0)
|
||||
if (sLvl > 0) {
|
||||
MaxHP += increaseHP.getEffect(sLvl).getY();
|
||||
}
|
||||
}
|
||||
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (usedAPReset) {
|
||||
MaxHP += 20;
|
||||
} else {
|
||||
@@ -640,8 +692,8 @@ public class AssignAPProcessor {
|
||||
} else {
|
||||
MaxHP += 20;
|
||||
}
|
||||
} else if(job.isA(Job.ARAN1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
} else if (job.isA(Job.ARAN1)) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (usedAPReset) {
|
||||
MaxHP += 20;
|
||||
} else {
|
||||
@@ -651,7 +703,7 @@ public class AssignAPProcessor {
|
||||
MaxHP += 28;
|
||||
}
|
||||
} else if (job.isA(Job.MAGICIAN) || job.isA(Job.BLAZEWIZARD1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (usedAPReset) {
|
||||
MaxHP += 6;
|
||||
} else {
|
||||
@@ -661,7 +713,7 @@ public class AssignAPProcessor {
|
||||
MaxHP += 6;
|
||||
}
|
||||
} else if (job.isA(Job.THIEF) || job.isA(Job.NIGHTWALKER1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (usedAPReset) {
|
||||
MaxHP += 16;
|
||||
} else {
|
||||
@@ -670,8 +722,8 @@ public class AssignAPProcessor {
|
||||
} else {
|
||||
MaxHP += 16;
|
||||
}
|
||||
} else if(job.isA(Job.BOWMAN) || job.isA(Job.WINDARCHER1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
} else if (job.isA(Job.BOWMAN) || job.isA(Job.WINDARCHER1)) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (usedAPReset) {
|
||||
MaxHP += 16;
|
||||
} else {
|
||||
@@ -681,15 +733,16 @@ public class AssignAPProcessor {
|
||||
MaxHP += 16;
|
||||
}
|
||||
} else if (job.isA(Job.PIRATE) || job.isA(Job.THUNDERBREAKER1)) {
|
||||
if(!usedAPReset) {
|
||||
if (!usedAPReset) {
|
||||
Skill increaseHP = SkillFactory.getSkill(job.isA(Job.PIRATE) ? Brawler.IMPROVE_MAX_HP : ThunderBreaker.IMPROVE_MAX_HP);
|
||||
int sLvl = player.getSkillLevel(increaseHP);
|
||||
|
||||
if(sLvl > 0)
|
||||
if (sLvl > 0) {
|
||||
MaxHP += increaseHP.getEffect(sLvl).getY();
|
||||
}
|
||||
}
|
||||
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (usedAPReset) {
|
||||
MaxHP += 18;
|
||||
} else {
|
||||
@@ -701,7 +754,7 @@ public class AssignAPProcessor {
|
||||
} else if (usedAPReset) {
|
||||
MaxHP += 8;
|
||||
} else {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
MaxHP += Randomizer.rand(8, 12);
|
||||
} else {
|
||||
MaxHP += 10;
|
||||
@@ -716,8 +769,8 @@ public class AssignAPProcessor {
|
||||
int MaxMP = 0;
|
||||
|
||||
if (job.isA(Job.WARRIOR) || job.isA(Job.DAWNWARRIOR1) || job.isA(Job.ARAN1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if(!usedAPReset) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (!usedAPReset) {
|
||||
MaxMP += (Randomizer.rand(2, 4) + (player.getInt() / 10));
|
||||
} else {
|
||||
MaxMP += 2;
|
||||
@@ -726,16 +779,17 @@ public class AssignAPProcessor {
|
||||
MaxMP += 3;
|
||||
}
|
||||
} else if (job.isA(Job.MAGICIAN) || job.isA(Job.BLAZEWIZARD1)) {
|
||||
if(!usedAPReset) {
|
||||
if (!usedAPReset) {
|
||||
Skill increaseMP = SkillFactory.getSkill(job.isA(Job.BLAZEWIZARD1) ? BlazeWizard.INCREASING_MAX_MP : Magician.IMPROVED_MAX_MP_INCREASE);
|
||||
int sLvl = player.getSkillLevel(increaseMP);
|
||||
|
||||
if(sLvl > 0)
|
||||
if (sLvl > 0) {
|
||||
MaxMP += increaseMP.getEffect(sLvl).getY();
|
||||
}
|
||||
}
|
||||
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if(!usedAPReset) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (!usedAPReset) {
|
||||
MaxMP += (Randomizer.rand(12, 16) + (player.getInt() / 20));
|
||||
} else {
|
||||
MaxMP += 18;
|
||||
@@ -744,8 +798,8 @@ public class AssignAPProcessor {
|
||||
MaxMP += 18;
|
||||
}
|
||||
} else if (job.isA(Job.BOWMAN) || job.isA(Job.WINDARCHER1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if(!usedAPReset) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (!usedAPReset) {
|
||||
MaxMP += (Randomizer.rand(6, 8) + (player.getInt() / 10));
|
||||
} else {
|
||||
MaxMP += 10;
|
||||
@@ -753,9 +807,9 @@ public class AssignAPProcessor {
|
||||
} else {
|
||||
MaxMP += 10;
|
||||
}
|
||||
} else if(job.isA(Job.THIEF) || job.isA(Job.NIGHTWALKER1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if(!usedAPReset) {
|
||||
} else if (job.isA(Job.THIEF) || job.isA(Job.NIGHTWALKER1)) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (!usedAPReset) {
|
||||
MaxMP += (Randomizer.rand(6, 8) + (player.getInt() / 10));
|
||||
} else {
|
||||
MaxMP += 10;
|
||||
@@ -764,8 +818,8 @@ public class AssignAPProcessor {
|
||||
MaxMP += 10;
|
||||
}
|
||||
} else if (job.isA(Job.PIRATE) || job.isA(Job.THUNDERBREAKER1)) {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if(!usedAPReset) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (!usedAPReset) {
|
||||
MaxMP += (Randomizer.rand(7, 9) + (player.getInt() / 10));
|
||||
} else {
|
||||
MaxMP += 14;
|
||||
@@ -774,8 +828,8 @@ public class AssignAPProcessor {
|
||||
MaxMP += 14;
|
||||
}
|
||||
} else {
|
||||
if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if(!usedAPReset) {
|
||||
if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) {
|
||||
if (!usedAPReset) {
|
||||
MaxMP += (Randomizer.rand(4, 6) + (player.getInt() / 10));
|
||||
} else {
|
||||
MaxMP += 6;
|
||||
@@ -797,7 +851,7 @@ public class AssignAPProcessor {
|
||||
MaxHP += 10;
|
||||
} else if (job.isA(Job.THIEF) || job.isA(Job.NIGHTWALKER1)) {
|
||||
MaxHP += 20;
|
||||
} else if(job.isA(Job.BOWMAN) || job.isA(Job.WINDARCHER1)) {
|
||||
} else if (job.isA(Job.BOWMAN) || job.isA(Job.WINDARCHER1)) {
|
||||
MaxHP += 20;
|
||||
} else if (job.isA(Job.PIRATE) || job.isA(Job.THUNDERBREAKER1)) {
|
||||
MaxHP += 42;
|
||||
@@ -817,7 +871,7 @@ public class AssignAPProcessor {
|
||||
MaxMP += 31;
|
||||
} else if (job.isA(Job.BOWMAN) || job.isA(Job.WINDARCHER1)) {
|
||||
MaxMP += 12;
|
||||
} else if(job.isA(Job.THIEF) || job.isA(Job.NIGHTWALKER1)) {
|
||||
} else if (job.isA(Job.THIEF) || job.isA(Job.NIGHTWALKER1)) {
|
||||
MaxMP += 12;
|
||||
} else if (job.isA(Job.PIRATE) || job.isA(Job.THUNDERBREAKER1)) {
|
||||
MaxMP += 16;
|
||||
|
||||
@@ -34,7 +34,6 @@ import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana - synchronization of SP transaction modules
|
||||
*/
|
||||
public class AssignSPProcessor {
|
||||
@@ -65,7 +64,7 @@ public class AssignSPProcessor {
|
||||
}
|
||||
|
||||
Character player = c.getPlayer();
|
||||
int remainingSp = player.getRemainingSps()[GameConstants.getSkillBook(skillid/10000)];
|
||||
int remainingSp = player.getRemainingSps()[GameConstants.getSkillBook(skillid / 10000)];
|
||||
boolean isBeginnerSkill = false;
|
||||
|
||||
if (skillid % 10000000 > 999 && skillid % 10000000 < 1003) {
|
||||
@@ -80,7 +79,7 @@ public class AssignSPProcessor {
|
||||
int curLevel = player.getSkillLevel(skill);
|
||||
if ((remainingSp > 0 && curLevel + 1 <= (skill.isFourthJob() ? player.getMasterLevel(skill) : skill.getMaxLevel()))) {
|
||||
if (!isBeginnerSkill) {
|
||||
player.gainSp(-1, GameConstants.getSkillBook(skillid/10000), false);
|
||||
player.gainSp(-1, GameConstants.getSkillBook(skillid / 10000), false);
|
||||
} else {
|
||||
player.sendPacket(PacketCreator.enableActions());
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ public enum MonsterStatus {
|
||||
private final int i;
|
||||
private final boolean first;
|
||||
|
||||
private MonsterStatus(int i) {
|
||||
MonsterStatus(int i) {
|
||||
this.i = i;
|
||||
this.first = false;
|
||||
}
|
||||
|
||||
private MonsterStatus(int i, boolean first) {
|
||||
MonsterStatus(int i, boolean first) {
|
||||
this.i = i;
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class MonsterStatusEffect {
|
||||
|
||||
private Map<MonsterStatus, Integer> stati;
|
||||
private Skill skill;
|
||||
private MobSkill mobskill;
|
||||
private boolean monsterSkill;
|
||||
private final Map<MonsterStatus, Integer> stati;
|
||||
private final Skill skill;
|
||||
private final MobSkill mobskill;
|
||||
private final boolean monsterSkill;
|
||||
|
||||
public MonsterStatusEffect(Map<MonsterStatus, Integer> stati, Skill skillId, MobSkill mobskill, boolean monsterSkill) {
|
||||
this.stati = new ConcurrentHashMap<>(stati);
|
||||
|
||||
Reference in New Issue
Block a user