Reformat and clean up "client" package
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
package client;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Ronan
|
||||
*/
|
||||
public interface AbstractCharacterListener {
|
||||
|
||||
@@ -40,9 +40,10 @@ 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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,9 +56,9 @@ public class CommandsExecutor {
|
||||
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() {
|
||||
registerLv0Commands();
|
||||
@@ -141,6 +141,7 @@ public class CommandsExecutor {
|
||||
addCommand(syntax, 0, commandClass);
|
||||
}
|
||||
}
|
||||
|
||||
private void addCommand(String syntax, Class<? extends Command> commandClass) {
|
||||
//for (String syntax : syntaxs){
|
||||
addCommand(syntax, 0, commandClass);
|
||||
|
||||
@@ -44,8 +44,9 @@ public class JoinEventCommand extends Command {
|
||||
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();
|
||||
|
||||
|
||||
@@ -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,25 +39,33 @@ 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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -85,10 +85,14 @@ 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ public class ItemCommand extends Command {
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
@@ -56,7 +56,9 @@ public class ItemDropCommand extends Command {
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -281,12 +281,17 @@ public class Equip extends Item {
|
||||
// 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 (isAttribute) {
|
||||
return 2;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
if (isAttribute) {
|
||||
return 4;
|
||||
} else {
|
||||
return 16;
|
||||
}
|
||||
else {
|
||||
if(isAttribute) return 4;
|
||||
else return 16;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +333,9 @@ public class Equip extends Item {
|
||||
isUpgradeable = true;
|
||||
|
||||
int maxUpgrade = randomizeStatUpgrade((int) (1 + (curStat / (getStatModifier(isAttribute) * (isNotWeaponAffinity(name) ? 2.7 : 1)))));
|
||||
if(maxUpgrade == 0) return;
|
||||
if (maxUpgrade == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
stats.add(new Pair<>(name, maxUpgrade));
|
||||
}
|
||||
@@ -344,39 +347,95 @@ public class Equip extends Item {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -479,13 +538,17 @@ public class Equip extends Item {
|
||||
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()));
|
||||
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 (vicious > 0) {
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
}
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incSlot);
|
||||
}
|
||||
} else {
|
||||
@@ -493,7 +556,9 @@ public class Equip extends Item {
|
||||
|
||||
improveDefaultStats(stats);
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
if (vicious > 0) {
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
}
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incSlot);
|
||||
}
|
||||
|
||||
@@ -501,7 +566,9 @@ public class Equip extends Item {
|
||||
while (stats.isEmpty()) {
|
||||
improveDefaultStats(stats);
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) {
|
||||
if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
if (vicious > 0) {
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incVicious);
|
||||
}
|
||||
getUnitSlotUpgrade(stats, StatUpgrade.incSlot);
|
||||
}
|
||||
}
|
||||
@@ -579,7 +646,9 @@ 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) {
|
||||
@@ -611,7 +680,9 @@ 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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -177,7 +176,9 @@ public class NewYearCardRecord {
|
||||
|
||||
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 = ?")) {
|
||||
@@ -242,7 +243,9 @@ public class NewYearCardRecord {
|
||||
}
|
||||
|
||||
public void startNewYearCardTask() {
|
||||
if(sendTask != null) return;
|
||||
if (sendTask != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
sendTask = TimerManager.getInstance().register(() -> {
|
||||
Server server = Server.getInstance();
|
||||
|
||||
@@ -25,7 +25,6 @@ import server.maps.MapleMap;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana
|
||||
*/
|
||||
public class BuybackProcessor {
|
||||
|
||||
@@ -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()) {
|
||||
@@ -191,7 +190,9 @@ public class MakerProcessor {
|
||||
|
||||
int cost = recipe.getCost();
|
||||
if (stimulantid == -1 && reagentids.isEmpty()) {
|
||||
if(cost > 0) c.getPlayer().gainMeso(-cost, false);
|
||||
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 (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);
|
||||
}
|
||||
|
||||
@@ -362,15 +367,19 @@ 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);
|
||||
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)) {
|
||||
@@ -421,7 +430,7 @@ public class MakerProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
ii.improveEquipStats(eqp, stats);
|
||||
ItemInformationProvider.improveEquipStats(eqp, stats);
|
||||
|
||||
for (Short sh : randStat) {
|
||||
ii.scrollOptionEquipWithChaos(eqp, sh, false);
|
||||
|
||||
@@ -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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -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,7 +57,10 @@ 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);
|
||||
@@ -75,13 +79,19 @@ public class AssignAPProcessor {
|
||||
|
||||
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());
|
||||
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,23 +118,31 @@ 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) {
|
||||
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) {
|
||||
temp = luk + chr.getLuk() - CAP;
|
||||
@@ -141,16 +159,22 @@ 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) {
|
||||
temp = str + chr.getStr() - CAP;
|
||||
@@ -167,16 +191,22 @@ 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) {
|
||||
temp = str + chr.getStr() - CAP;
|
||||
@@ -195,7 +225,9 @@ public class AssignAPProcessor {
|
||||
scStat = 0;
|
||||
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,7 +235,9 @@ 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;
|
||||
@@ -212,7 +246,9 @@ public class AssignAPProcessor {
|
||||
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;
|
||||
@@ -269,7 +307,9 @@ public class AssignAPProcessor {
|
||||
scStat = 0;
|
||||
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,7 +317,9 @@ 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;
|
||||
@@ -285,7 +327,9 @@ public class AssignAPProcessor {
|
||||
scStat = 0;
|
||||
if (chr.getDex() < 96) {
|
||||
scStat = (int) (2.4 * chr.getLevel()) - (chr.getDex() + dex - eqpDex);
|
||||
if(scStat < 0) scStat = 0;
|
||||
if (scStat < 0) {
|
||||
scStat = 0;
|
||||
}
|
||||
|
||||
scStat = Math.min(96 - chr.getDex(), scStat);
|
||||
scStat = Math.min(tempAp, scStat);
|
||||
@@ -293,7 +337,9 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
temp = 96 + (int) (1.2 * (chr.getLevel() - 40)) - Math.max(96, scStat + chr.getDex() + dex - eqpDex);
|
||||
if(temp < 0) temp = 0;
|
||||
if (temp < 0) {
|
||||
temp = 0;
|
||||
}
|
||||
temp = Math.min(tempAp, temp);
|
||||
scStat += temp;
|
||||
tempAp -= temp;
|
||||
@@ -302,7 +348,8 @@ 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) {
|
||||
temp = dex + chr.getDex() - CAP;
|
||||
@@ -366,7 +413,9 @@ public class AssignAPProcessor {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -627,9 +678,10 @@ public class AssignAPProcessor {
|
||||
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 (usedAPReset) {
|
||||
@@ -685,9 +737,10 @@ public class AssignAPProcessor {
|
||||
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 (usedAPReset) {
|
||||
@@ -730,9 +783,10 @@ public class AssignAPProcessor {
|
||||
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) {
|
||||
|
||||
@@ -34,7 +34,6 @@ import tools.FilePrinter;
|
||||
import tools.PacketCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RonanLana - synchronization of SP transaction modules
|
||||
*/
|
||||
public class AssignSPProcessor {
|
||||
|
||||
@@ -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