cleanup: use implicit generic type with diamond operator
This commit is contained in:
@@ -21,6 +21,13 @@
|
|||||||
*/
|
*/
|
||||||
package client;
|
package client;
|
||||||
|
|
||||||
|
import net.server.Server;
|
||||||
|
import net.server.world.World;
|
||||||
|
import tools.DatabaseConnection;
|
||||||
|
import tools.FilePrinter;
|
||||||
|
import tools.MaplePacketCreator;
|
||||||
|
import tools.Pair;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -32,13 +39,6 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import net.server.Server;
|
|
||||||
import net.server.world.World;
|
|
||||||
import tools.DatabaseConnection;
|
|
||||||
import tools.FilePrinter;
|
|
||||||
import tools.MaplePacketCreator;
|
|
||||||
import tools.Pair;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Jay Estrella - Mr.Trash :3
|
* @author Jay Estrella - Mr.Trash :3
|
||||||
@@ -49,7 +49,7 @@ public class MapleFamily {
|
|||||||
private static final AtomicInteger familyIDCounter = new AtomicInteger();
|
private static final AtomicInteger familyIDCounter = new AtomicInteger();
|
||||||
|
|
||||||
private final int id, world;
|
private final int id, world;
|
||||||
private final Map<Integer, MapleFamilyEntry> members = new ConcurrentHashMap<Integer, MapleFamilyEntry>();
|
private final Map<Integer, MapleFamilyEntry> members = new ConcurrentHashMap<>();
|
||||||
private MapleFamilyEntry leader;
|
private MapleFamilyEntry leader;
|
||||||
private String name;
|
private String name;
|
||||||
private String preceptsMessage = "";
|
private String preceptsMessage = "";
|
||||||
@@ -184,7 +184,7 @@ public class MapleFamily {
|
|||||||
|
|
||||||
public static void loadAllFamilies() {
|
public static void loadAllFamilies() {
|
||||||
try(Connection con = DatabaseConnection.getConnection()) {
|
try(Connection con = DatabaseConnection.getConnection()) {
|
||||||
List<Pair<Pair<Integer, Integer>, MapleFamilyEntry>> unmatchedJuniors = new ArrayList<Pair<Pair<Integer, Integer>, MapleFamilyEntry>>(200); // <<world, seniorid> familyEntry>
|
List<Pair<Pair<Integer, Integer>, MapleFamilyEntry>> unmatchedJuniors = new ArrayList<>(200); // <<world, seniorid> familyEntry>
|
||||||
try(PreparedStatement psEntries = con.prepareStatement("SELECT * FROM family_character")) {
|
try(PreparedStatement psEntries = con.prepareStatement("SELECT * FROM family_character")) {
|
||||||
ResultSet rsEntries = psEntries.executeQuery();
|
ResultSet rsEntries = psEntries.executeQuery();
|
||||||
while(rsEntries.next()) { // can be optimized
|
while(rsEntries.next()) { // can be optimized
|
||||||
@@ -236,7 +236,7 @@ public class MapleFamily {
|
|||||||
if(senior != null) {
|
if(senior != null) {
|
||||||
familyEntry.setSenior(family.getEntryByID(seniorid), false);
|
familyEntry.setSenior(family.getEntryByID(seniorid), false);
|
||||||
} else {
|
} else {
|
||||||
if(seniorid > 0) unmatchedJuniors.add(new Pair<Pair<Integer, Integer>, MapleFamilyEntry>(new Pair<Integer, Integer>(world, seniorid), familyEntry));
|
if(seniorid > 0) unmatchedJuniors.add(new Pair<>(new Pair<>(world, seniorid), familyEntry));
|
||||||
}
|
}
|
||||||
familyEntry.setReputation(reputation);
|
familyEntry.setReputation(reputation);
|
||||||
familyEntry.setTodaysRep(todaysRep);
|
familyEntry.setTodaysRep(todaysRep);
|
||||||
|
|||||||
@@ -21,14 +21,11 @@
|
|||||||
*/
|
*/
|
||||||
package client;
|
package client;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import server.quest.MapleQuest;
|
import server.quest.MapleQuest;
|
||||||
import tools.StringUtil;
|
import tools.StringUtil;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Matze
|
* @author Matze
|
||||||
@@ -61,8 +58,8 @@ public class MapleQuestStatus {
|
|||||||
private short questID;
|
private short questID;
|
||||||
private Status status;
|
private Status status;
|
||||||
//private boolean updated; //maybe this can be of use for someone?
|
//private boolean updated; //maybe this can be of use for someone?
|
||||||
private final Map<Integer, String> progress = new LinkedHashMap<Integer, String>();
|
private final Map<Integer, String> progress = new LinkedHashMap<>();
|
||||||
private final List<Integer> medalProgress = new LinkedList<Integer>();
|
private final List<Integer> medalProgress = new LinkedList<>();
|
||||||
private int npc;
|
private int npc;
|
||||||
private long completionTime, expirationTime;
|
private long completionTime, expirationTime;
|
||||||
private int forfeited = 0, completed = 0;
|
private int forfeited = 0, completed = 0;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class IdCommand extends Command {
|
|||||||
if (!handbookDirectory.containsKey(type)) {
|
if (!handbookDirectory.containsKey(type)) {
|
||||||
throw new IdTypeNotSupportedException();
|
throw new IdTypeNotSupportedException();
|
||||||
}
|
}
|
||||||
itemMap.put(type, new HashMap<String, String>());
|
itemMap.put(type, new HashMap<>());
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(handbookDirectory.get(type)));
|
BufferedReader reader = new BufferedReader(new FileReader(handbookDirectory.get(type)));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public enum ItemFactory {
|
|||||||
try (ResultSet rs = ps.executeQuery()) {
|
try (ResultSet rs = ps.executeQuery()) {
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
Integer cid = rs.getInt("characterid");
|
Integer cid = rs.getInt("characterid");
|
||||||
items.add(new Pair<Item, Integer>(loadEquipFromResultSet(rs), cid));
|
items.add(new Pair<>(loadEquipFromResultSet(rs), cid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ public enum ItemFactory {
|
|||||||
MapleInventoryType mit = MapleInventoryType.getByType(rs.getByte("inventorytype"));
|
MapleInventoryType mit = MapleInventoryType.getByType(rs.getByte("inventorytype"));
|
||||||
|
|
||||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||||
items.add(new Pair<Item, MapleInventoryType>(loadEquipFromResultSet(rs), mit));
|
items.add(new Pair<>(loadEquipFromResultSet(rs), mit));
|
||||||
} else {
|
} else {
|
||||||
if (bundles > 0) {
|
if (bundles > 0) {
|
||||||
int petid = rs.getInt("petid");
|
int petid = rs.getInt("petid");
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class PetDataFactory {
|
public class PetDataFactory {
|
||||||
private static MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Item.wz"));
|
private static MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Item.wz"));
|
||||||
private static Map<String, PetCommand> petCommands = new HashMap<String, PetCommand>();
|
private static Map<String, PetCommand> petCommands = new HashMap<>();
|
||||||
private static Map<Integer, Integer> petHunger = new HashMap<Integer, Integer>();
|
private static Map<Integer, Integer> petHunger = new HashMap<>();
|
||||||
|
|
||||||
public static PetCommand getPetCommand(int petId, int skillId) {
|
public static PetCommand getPetCommand(int petId, int skillId) {
|
||||||
PetCommand ret = petCommands.get(petId + "" + skillId);
|
PetCommand ret = petCommands.get(petId + "" + skillId);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class DueyProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void deletePackageFromInventoryDB(Connection con, int packageId) throws SQLException {
|
private static void deletePackageFromInventoryDB(Connection con, int packageId) throws SQLException {
|
||||||
ItemFactory.DUEY.saveItems(new LinkedList<Pair<Item, MapleInventoryType>>(), packageId, con);
|
ItemFactory.DUEY.saveItems(new LinkedList<>(), packageId, con);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removePackageFromDB(int packageId) {
|
private static void removePackageFromDB(int packageId) {
|
||||||
|
|||||||
@@ -702,7 +702,7 @@ public class Server {
|
|||||||
try {
|
try {
|
||||||
if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
||||||
for (int i = playerRanking.size(); i <= worldid; i++) {
|
for (int i = playerRanking.size(); i <= worldid; i++) {
|
||||||
playerRanking.add(new ArrayList<Pair<String, Integer>>(0));
|
playerRanking.add(new ArrayList<>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
playerRanking.add(worldid, ranking.get(0).getRight());
|
playerRanking.add(worldid, ranking.get(0).getRight());
|
||||||
@@ -746,7 +746,7 @@ public class Server {
|
|||||||
try {
|
try {
|
||||||
if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
||||||
for (int i = playerRanking.size(); i <= rankUpdates.get(rankUpdates.size() - 1).getLeft(); i++) {
|
for (int i = playerRanking.size(); i <= rankUpdates.get(rankUpdates.size() - 1).getLeft(); i++) {
|
||||||
playerRanking.add(new ArrayList<Pair<String, Integer>>(0));
|
playerRanking.add(new ArrayList<>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Pair<Integer, List<Pair<String, Integer>>> wranks : rankUpdates) {
|
for (Pair<Integer, List<Pair<String, Integer>>> wranks : rankUpdates) {
|
||||||
@@ -763,7 +763,7 @@ public class Server {
|
|||||||
|
|
||||||
private void initWorldPlayerRanking() {
|
private void initWorldPlayerRanking() {
|
||||||
if (YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
if (YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) {
|
||||||
playerRanking.add(new ArrayList<Pair<String, Integer>>(0));
|
playerRanking.add(new ArrayList<>(0));
|
||||||
}
|
}
|
||||||
updateWorldPlayerRanking();
|
updateWorldPlayerRanking();
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1465,7 @@ public class Server {
|
|||||||
if (wchars == null) {
|
if (wchars == null) {
|
||||||
if (!accountChars.containsKey(accountId)) {
|
if (!accountChars.containsKey(accountId)) {
|
||||||
accountCharacterCount.put(accountId, (short) 0);
|
accountCharacterCount.put(accountId, (short) 0);
|
||||||
accountChars.put(accountId, new HashSet<Integer>()); // not advisable at all to write on the map on a read-protected environment
|
accountChars.put(accountId, new HashSet<>()); // not advisable at all to write on the map on a read-protected environment
|
||||||
} // yet it's known there's no problem since no other point in the source does
|
} // yet it's known there's no problem since no other point in the source does
|
||||||
} else if (!wchars.isEmpty()) { // this action.
|
} else if (!wchars.isEmpty()) { // this action.
|
||||||
lastwchars = wchars;
|
lastwchars = wchars;
|
||||||
@@ -1485,7 +1485,7 @@ public class Server {
|
|||||||
short characterCount = 0;
|
short characterCount = 0;
|
||||||
List<List<MapleCharacter>> wchars = new ArrayList<>(wlen);
|
List<List<MapleCharacter>> wchars = new ArrayList<>(wlen);
|
||||||
for (int i = 0; i < wlen; i++) {
|
for (int i = 0; i < wlen; i++) {
|
||||||
wchars.add(i, new LinkedList<MapleCharacter>());
|
wchars.add(i, new LinkedList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MapleCharacter> chars = new LinkedList<>();
|
List<MapleCharacter> chars = new LinkedList<>();
|
||||||
@@ -1567,7 +1567,7 @@ public class Server {
|
|||||||
try (Connection con = DatabaseConnection.getConnection();
|
try (Connection con = DatabaseConnection.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM namechanges WHERE completionTime IS NULL");
|
PreparedStatement ps = con.prepareStatement("SELECT * FROM namechanges WHERE completionTime IS NULL");
|
||||||
ResultSet rs = ps.executeQuery()) {
|
ResultSet rs = ps.executeQuery()) {
|
||||||
List<Pair<String, String>> changedNames = new LinkedList<Pair<String, String>>(); //logging only
|
List<Pair<String, String>> changedNames = new LinkedList<>(); //logging only
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
con.setAutoCommit(false);
|
con.setAutoCommit(false);
|
||||||
int nameChangeId = rs.getInt("id");
|
int nameChangeId = rs.getInt("id");
|
||||||
@@ -1578,7 +1578,7 @@ public class Server {
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
con.rollback(); //discard changes
|
con.rollback(); //discard changes
|
||||||
} else {
|
} else {
|
||||||
changedNames.add(new Pair<String, String>(oldName, newName));
|
changedNames.add(new Pair<>(oldName, newName));
|
||||||
}
|
}
|
||||||
con.setAutoCommit(true);
|
con.setAutoCommit(true);
|
||||||
}
|
}
|
||||||
@@ -1597,7 +1597,7 @@ public class Server {
|
|||||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM worldtransfers WHERE completionTime IS NULL",
|
PreparedStatement ps = con.prepareStatement("SELECT * FROM worldtransfers WHERE completionTime IS NULL",
|
||||||
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
ResultSet rs = ps.executeQuery()) {
|
ResultSet rs = ps.executeQuery()) {
|
||||||
List<Integer> removedTransfers = new LinkedList<Integer>();
|
List<Integer> removedTransfers = new LinkedList<>();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int nameChangeId = rs.getInt("id");
|
int nameChangeId = rs.getInt("id");
|
||||||
int characterId = rs.getInt("characterId");
|
int characterId = rs.getInt("characterId");
|
||||||
@@ -1617,7 +1617,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.beforeFirst();
|
rs.beforeFirst();
|
||||||
List<Pair<Integer, Pair<Integer, Integer>>> worldTransfers = new LinkedList<Pair<Integer, Pair<Integer, Integer>>>(); //logging only <charid, <oldWorld, newWorld>>
|
List<Pair<Integer, Pair<Integer, Integer>>> worldTransfers = new LinkedList<>(); //logging only <charid, <oldWorld, newWorld>>
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
con.setAutoCommit(false);
|
con.setAutoCommit(false);
|
||||||
int nameChangeId = rs.getInt("id");
|
int nameChangeId = rs.getInt("id");
|
||||||
@@ -1631,7 +1631,7 @@ public class Server {
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
con.rollback();
|
con.rollback();
|
||||||
} else {
|
} else {
|
||||||
worldTransfers.add(new Pair<Integer, Pair<Integer, Integer>>(characterId, new Pair<Integer, Integer>(oldWorld, newWorld)));
|
worldTransfers.add(new Pair<>(characterId, new Pair<>(oldWorld, newWorld)));
|
||||||
}
|
}
|
||||||
con.setAutoCommit(true);
|
con.setAutoCommit(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public final class Channel {
|
|||||||
private Map<MapleExpeditionType, MapleExpedition> expeditions = new HashMap<>();
|
private Map<MapleExpeditionType, MapleExpedition> expeditions = new HashMap<>();
|
||||||
private Map<Integer, MapleMiniDungeon> dungeons = new HashMap<>();
|
private Map<Integer, MapleMiniDungeon> dungeons = new HashMap<>();
|
||||||
private List<MapleExpeditionType> expedType = new ArrayList<>();
|
private List<MapleExpeditionType> expedType = new ArrayList<>();
|
||||||
private Set<MapleMap> ownedMaps = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<MapleMap, Boolean>()));
|
private Set<MapleMap> ownedMaps = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<>()));
|
||||||
private MapleEvent event;
|
private MapleEvent event;
|
||||||
private boolean finishedShutdown = false;
|
private boolean finishedShutdown = false;
|
||||||
private Set<Integer> usedMC = new HashSet<>();
|
private Set<Integer> usedMC = new HashSet<>();
|
||||||
@@ -456,7 +456,7 @@ public final class Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String [] getEvents(){
|
private static String [] getEvents(){
|
||||||
List<String> events = new ArrayList<String>();
|
List<String> events = new ArrayList<>();
|
||||||
for (File file : new File("scripts/event").listFiles()){
|
for (File file : new File("scripts/event").listFiles()){
|
||||||
events.add(file.getName().substring(0, file.getName().length() - 3));
|
events.add(file.getName().substring(0, file.getName().length() - 3));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
|
|||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
c.announce(MaplePacketCreator.showCashShopMessage((byte) parseCouponResult(type)));
|
c.announce(MaplePacketCreator.showCashShopMessage((byte) parseCouponResult(type)));
|
||||||
} else {
|
} else {
|
||||||
List<Item> cashItems = new LinkedList<Item>();
|
List<Item> cashItems = new LinkedList<>();
|
||||||
List<Pair<Integer, Integer>> items = new LinkedList<Pair<Integer, Integer>>();
|
List<Pair<Integer, Integer>> items = new LinkedList<>();
|
||||||
int nxCredit = 0;
|
int nxCredit = 0;
|
||||||
int maplePoints = 0;
|
int maplePoints = 0;
|
||||||
int nxPrepaid = 0;
|
int nxPrepaid = 0;
|
||||||
@@ -245,7 +245,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
|
|||||||
cashItems.add(it);
|
cashItems.add(it);
|
||||||
} else {
|
} else {
|
||||||
MapleInventoryManipulator.addById(c, item, qty, "", -1);
|
MapleInventoryManipulator.addById(c, item, qty, "", -1);
|
||||||
items.add(new Pair<Integer, Integer>((int)qty, item));
|
items.add(new Pair<>((int) qty, item));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,14 @@
|
|||||||
package net.server.coordinator.login;
|
package net.server.coordinator.login;
|
||||||
|
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
|
import net.server.Server;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import net.server.Server;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
@@ -39,7 +39,7 @@ public class LoginStorage {
|
|||||||
public boolean registerLogin(int accountId) {
|
public boolean registerLogin(int accountId) {
|
||||||
List<Long> accHist = loginHistory.get(accountId);
|
List<Long> accHist = loginHistory.get(accountId);
|
||||||
if (accHist == null) {
|
if (accHist == null) {
|
||||||
accHist = new LinkedList<Long>();
|
accHist = new LinkedList<>();
|
||||||
loginHistory.put(accountId, accHist);
|
loginHistory.put(accountId, accHist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class MapleGuild {
|
|||||||
if (notifications.keySet().size() != chs.size()) {
|
if (notifications.keySet().size() != chs.size()) {
|
||||||
notifications.clear();
|
notifications.clear();
|
||||||
for (Integer ch : chs) {
|
for (Integer ch : chs) {
|
||||||
notifications.put(ch, new LinkedList<Integer>());
|
notifications.put(ch, new LinkedList<>());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (List<Integer> l : notifications.values()) {
|
for (List<Integer> l : notifications.values()) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
public final class MapleMessenger {
|
public final class MapleMessenger {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private List<MapleMessengerCharacter> members = new ArrayList<MapleMessengerCharacter>(3);
|
private List<MapleMessengerCharacter> members = new ArrayList<>(3);
|
||||||
private boolean[] pos = new boolean[3];
|
private boolean[] pos = new boolean[3];
|
||||||
|
|
||||||
public MapleMessenger(int id, MapleMessengerCharacter chrfor) {
|
public MapleMessenger(int id, MapleMessengerCharacter chrfor) {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class World {
|
|||||||
private ScheduledFuture<?> timedMapObjectsSchedule;
|
private ScheduledFuture<?> timedMapObjectsSchedule;
|
||||||
private MonitoredReentrantLock timedMapObjectLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.WORLD_MAPOBJS, true);
|
private MonitoredReentrantLock timedMapObjectLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.WORLD_MAPOBJS, true);
|
||||||
|
|
||||||
private Map<MapleCharacter, Integer> fishingAttempters = Collections.synchronizedMap(new WeakHashMap<MapleCharacter, Integer>());
|
private Map<MapleCharacter, Integer> fishingAttempters = Collections.synchronizedMap(new WeakHashMap<>());
|
||||||
|
|
||||||
private ScheduledFuture<?> charactersSchedule;
|
private ScheduledFuture<?> charactersSchedule;
|
||||||
private ScheduledFuture<?> marriagesSchedule;
|
private ScheduledFuture<?> marriagesSchedule;
|
||||||
@@ -165,7 +165,7 @@ public class World {
|
|||||||
mountUpdate = petUpdate;
|
mountUpdate = petUpdate;
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
cashItemBought.add(new LinkedHashMap<Integer, Integer>());
|
cashItemBought.add(new LinkedHashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
TimerManager tman = TimerManager.getInstance();
|
TimerManager tman = TimerManager.getInstance();
|
||||||
@@ -501,7 +501,7 @@ public class World {
|
|||||||
if(accChars != null) {
|
if(accChars != null) {
|
||||||
chrList = new LinkedList<>(accChars.values());
|
chrList = new LinkedList<>(accChars.values());
|
||||||
} else {
|
} else {
|
||||||
accountChars.put(accountId, new TreeMap<Integer, MapleCharacter>());
|
accountChars.put(accountId, new TreeMap<>());
|
||||||
chrList = null;
|
chrList = null;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -21,24 +21,21 @@
|
|||||||
*/
|
*/
|
||||||
package provider.wz;
|
package provider.wz;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import provider.MapleDataProviderFactory;
|
import provider.MapleDataProviderFactory;
|
||||||
import tools.data.input.GenericLittleEndianAccessor;
|
import tools.data.input.GenericLittleEndianAccessor;
|
||||||
import tools.data.input.InputStreamByteStream;
|
import tools.data.input.InputStreamByteStream;
|
||||||
import tools.data.input.LittleEndianAccessor;
|
import tools.data.input.LittleEndianAccessor;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class ListWZFile {
|
public class ListWZFile {
|
||||||
private LittleEndianAccessor lea;
|
private LittleEndianAccessor lea;
|
||||||
private List<String> entries = new ArrayList<String>();
|
private List<String> entries = new ArrayList<>();
|
||||||
private static Collection<String> modernImgs = new HashSet<String>();
|
private static Collection<String> modernImgs = new HashSet<>();
|
||||||
|
|
||||||
public static byte[] xorBytes(byte[] a, byte[] b) {
|
public static byte[] xorBytes(byte[] a, byte[] b) {
|
||||||
byte[] wusched = new byte[a.length];
|
byte[] wusched = new byte[a.length];
|
||||||
@@ -73,7 +70,7 @@ public class ListWZFile {
|
|||||||
ListWZFile listwz;
|
ListWZFile listwz;
|
||||||
try {
|
try {
|
||||||
listwz = new ListWZFile(MapleDataProviderFactory.fileInWZPath("List.wz"));
|
listwz = new ListWZFile(MapleDataProviderFactory.fileInWZPath("List.wz"));
|
||||||
modernImgs = new HashSet<String>(listwz.getEntries());
|
modernImgs = new HashSet<>(listwz.getEntries());
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,20 +21,17 @@
|
|||||||
*/
|
*/
|
||||||
package provider.wz;
|
package provider.wz;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import provider.MapleDataDirectoryEntry;
|
import provider.MapleDataDirectoryEntry;
|
||||||
import provider.MapleDataEntity;
|
import provider.MapleDataEntity;
|
||||||
import provider.MapleDataEntry;
|
import provider.MapleDataEntry;
|
||||||
import provider.MapleDataFileEntry;
|
import provider.MapleDataFileEntry;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class WZDirectoryEntry extends WZEntry implements MapleDataDirectoryEntry {
|
public class WZDirectoryEntry extends WZEntry implements MapleDataDirectoryEntry {
|
||||||
private List<MapleDataDirectoryEntry> subdirs = new ArrayList<MapleDataDirectoryEntry>();
|
private List<MapleDataDirectoryEntry> subdirs = new ArrayList<>();
|
||||||
private List<MapleDataFileEntry> files = new ArrayList<MapleDataFileEntry>();
|
private List<MapleDataFileEntry> files = new ArrayList<>();
|
||||||
private Map<String, MapleDataEntry> entries = new HashMap<String, MapleDataEntry>();
|
private Map<String, MapleDataEntry> entries = new HashMap<>();
|
||||||
|
|
||||||
public WZDirectoryEntry(String name, int size, int checksum, MapleDataEntity parent) {
|
public WZDirectoryEntry(String name, int size, int checksum, MapleDataEntity parent) {
|
||||||
super(name, size, checksum, parent);
|
super(name, size, checksum, parent);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.List;
|
|||||||
public class WZIMGEntry implements MapleData {
|
public class WZIMGEntry implements MapleData {
|
||||||
private String name;
|
private String name;
|
||||||
private MapleDataType type;
|
private MapleDataType type;
|
||||||
private List<MapleData> children = new ArrayList<MapleData>(10);
|
private List<MapleData> children = new ArrayList<>(10);
|
||||||
private Object data;
|
private Object data;
|
||||||
private MapleDataEntity parent;
|
private MapleDataEntity parent;
|
||||||
|
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
List<List<Pair<Integer, Integer>>> invList = new ArrayList<>(6);
|
List<List<Pair<Integer, Integer>>> invList = new ArrayList<>(6);
|
||||||
for(int i = MapleInventoryType.UNDEFINED.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
for(int i = MapleInventoryType.UNDEFINED.getType(); i < MapleInventoryType.CASH.getType(); i++) {
|
||||||
invList.add(new LinkedList<Pair<Integer, Integer>>());
|
invList.add(new LinkedList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ public class EventManager {
|
|||||||
private World wserv;
|
private World wserv;
|
||||||
private Server server;
|
private Server server;
|
||||||
private EventScriptScheduler ess = new EventScriptScheduler();
|
private EventScriptScheduler ess = new EventScriptScheduler();
|
||||||
private Map<String, EventInstanceManager> instances = new HashMap<String, EventInstanceManager>();
|
private Map<String, EventInstanceManager> instances = new HashMap<>();
|
||||||
private Map<String, Integer> instanceLocks = new HashMap<String, Integer>();
|
private Map<String, Integer> instanceLocks = new HashMap<>();
|
||||||
private final Queue<Integer> queuedGuilds = new LinkedList<>();
|
private final Queue<Integer> queuedGuilds = new LinkedList<>();
|
||||||
private final Map<Integer, Integer> queuedGuildLeaders = new HashMap<>();
|
private final Map<Integer, Integer> queuedGuildLeaders = new HashMap<>();
|
||||||
private List<Boolean> openedLobbys;
|
private List<Boolean> openedLobbys;
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public class MapleShopFactory {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Integer, MapleShop> shops = new HashMap<Integer, MapleShop>();
|
private Map<Integer, MapleShop> shops = new HashMap<>();
|
||||||
private Map<Integer, MapleShop> npcShops = new HashMap<Integer, MapleShop>();
|
private Map<Integer, MapleShop> npcShops = new HashMap<>();
|
||||||
|
|
||||||
private MapleShop loadShop(int id, boolean isShopId) {
|
private MapleShop loadShop(int id, boolean isShopId) {
|
||||||
MapleShop ret = MapleShop.createFromDB(id, isShopId);
|
MapleShop ret = MapleShop.createFromDB(id, isShopId);
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class MapleStatEffect {
|
|||||||
ret.prop = iprop / 100.0;
|
ret.prop = iprop / 100.0;
|
||||||
|
|
||||||
ret.cp = MapleDataTool.getInt("cp", source, 0);
|
ret.cp = MapleDataTool.getInt("cp", source, 0);
|
||||||
List<MapleDisease> cure = new ArrayList<MapleDisease>(5);
|
List<MapleDisease> cure = new ArrayList<>(5);
|
||||||
if (MapleDataTool.getInt("poison", source, 0) > 0) {
|
if (MapleDataTool.getInt("poison", source, 0) > 0) {
|
||||||
cure.add(MapleDisease.POISON);
|
cure.add(MapleDisease.POISON);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package server;
|
package server;
|
||||||
|
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.RejectedExecutionHandler;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -59,7 +54,7 @@ public class ThreadManager {
|
|||||||
RejectedExecutionHandler reh = new RejectedExecutionHandlerImpl();
|
RejectedExecutionHandler reh = new RejectedExecutionHandlerImpl();
|
||||||
ThreadFactory tf = Executors.defaultThreadFactory();
|
ThreadFactory tf = Executors.defaultThreadFactory();
|
||||||
|
|
||||||
tpe = new ThreadPoolExecutor(20, 1000, 77, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50), tf, reh);
|
tpe = new ThreadPoolExecutor(20, 1000, 77, TimeUnit.SECONDS, new ArrayBlockingQueue<>(50), tf, reh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class MapleCoconut extends MapleEvent {
|
|||||||
private int countBombing = 80;
|
private int countBombing = 80;
|
||||||
private int countFalling = 401;
|
private int countFalling = 401;
|
||||||
private int countStopped = 20;
|
private int countStopped = 20;
|
||||||
private List<MapleCoconuts> coconuts = new LinkedList<MapleCoconuts>();
|
private List<MapleCoconuts> coconuts = new LinkedList<>();
|
||||||
|
|
||||||
public MapleCoconut(MapleMap map) {
|
public MapleCoconut(MapleMap map) {
|
||||||
super(1, 50);
|
super(1, 50);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class MapleSnowball {
|
|||||||
private boolean hittable = false;
|
private boolean hittable = false;
|
||||||
private int team;
|
private int team;
|
||||||
private boolean winner = false;
|
private boolean winner = false;
|
||||||
List<MapleCharacter> characters = new LinkedList<MapleCharacter>();
|
List<MapleCharacter> characters = new LinkedList<>();
|
||||||
|
|
||||||
public MapleSnowball(int team, MapleMap map) {
|
public MapleSnowball(int team, MapleMap map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
public void addSummonedMob(MapleMonster mob) {
|
public void addSummonedMob(MapleMonster mob) {
|
||||||
Set<Integer> calledOids = this.calledMobOids;
|
Set<Integer> calledOids = this.calledMobOids;
|
||||||
if (calledOids == null) {
|
if (calledOids == null) {
|
||||||
calledOids = Collections.synchronizedSet(new HashSet<Integer>());
|
calledOids = Collections.synchronizedSet(new HashSet<>());
|
||||||
this.calledMobOids = calledOids;
|
this.calledMobOids = calledOids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1269,7 +1269,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void dispelSkill(final MobSkill skillId) {
|
public final void dispelSkill(final MobSkill skillId) {
|
||||||
List<MonsterStatus> toCancel = new ArrayList<MonsterStatus>();
|
List<MonsterStatus> toCancel = new ArrayList<>();
|
||||||
for (Entry<MonsterStatus, MonsterStatusEffect> effects : stati.entrySet()) {
|
for (Entry<MonsterStatus, MonsterStatusEffect> effects : stati.entrySet()) {
|
||||||
MonsterStatusEffect mse = effects.getValue();
|
MonsterStatusEffect mse = effects.getValue();
|
||||||
if (mse.getMobSkill() != null && mse.getMobSkill().getSkillId() == skillId.getSkillId()) { //not checking for level.
|
if (mse.getMobSkill() != null && mse.getMobSkill().getSkillId() == skillId.getSkillId()) { //not checking for level.
|
||||||
|
|||||||
@@ -228,13 +228,13 @@ public class MapleMonsterInformationProvider {
|
|||||||
|
|
||||||
public static ArrayList<Pair<Integer, String>> getMobsIDsFromName(String search) {
|
public static ArrayList<Pair<Integer, String>> getMobsIDsFromName(String search) {
|
||||||
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz"));
|
MapleDataProvider dataProvider = MapleDataProviderFactory.getDataProvider(new File("wz/String.wz"));
|
||||||
ArrayList<Pair<Integer, String>> retMobs = new ArrayList<Pair<Integer, String>>();
|
ArrayList<Pair<Integer, String>> retMobs = new ArrayList<>();
|
||||||
MapleData data = dataProvider.getData("Mob.img");
|
MapleData data = dataProvider.getData("Mob.img");
|
||||||
List<Pair<Integer, String>> mobPairList = new LinkedList<Pair<Integer, String>>();
|
List<Pair<Integer, String>> mobPairList = new LinkedList<>();
|
||||||
for (MapleData mobIdData : data.getChildren()) {
|
for (MapleData mobIdData : data.getChildren()) {
|
||||||
int mobIdFromData = Integer.parseInt(mobIdData.getName());
|
int mobIdFromData = Integer.parseInt(mobIdData.getName());
|
||||||
String mobNameFromData = MapleDataTool.getString(mobIdData.getChildByPath("name"), "NO-NAME");
|
String mobNameFromData = MapleDataTool.getString(mobIdData.getChildByPath("name"), "NO-NAME");
|
||||||
mobPairList.add(new Pair<Integer, String>(mobIdFromData, mobNameFromData));
|
mobPairList.add(new Pair<>(mobIdFromData, mobNameFromData));
|
||||||
}
|
}
|
||||||
for (Pair<Integer, String> mobPair : mobPairList) {
|
for (Pair<Integer, String> mobPair : mobPairList) {
|
||||||
if (mobPair.getRight().toLowerCase().contains(search.toLowerCase())) {
|
if (mobPair.getRight().toLowerCase().contains(search.toLowerCase())) {
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ public class MapleMonsterStats {
|
|||||||
public int exp, hp, mp, level, PADamage, PDDamage, MADamage, MDDamage, dropPeriod, cp, buffToGive = -1, removeAfter;
|
public int exp, hp, mp, level, PADamage, PDDamage, MADamage, MDDamage, dropPeriod, cp, buffToGive = -1, removeAfter;
|
||||||
public boolean boss, undead, ffaLoot, isExplosiveReward, firstAttack, removeOnMiss;
|
public boolean boss, undead, ffaLoot, isExplosiveReward, firstAttack, removeOnMiss;
|
||||||
public String name;
|
public String name;
|
||||||
public Map<String, Integer> animationTimes = new HashMap<String, Integer>();
|
public Map<String, Integer> animationTimes = new HashMap<>();
|
||||||
public Map<Element, ElementalEffectiveness> resistance = new HashMap<Element, ElementalEffectiveness>();
|
public Map<Element, ElementalEffectiveness> resistance = new HashMap<>();
|
||||||
public List<Integer> revives = Collections.emptyList();
|
public List<Integer> revives = Collections.emptyList();
|
||||||
public byte tagColor, tagBgColor;
|
public byte tagColor, tagBgColor;
|
||||||
public List<Pair<Integer, Integer>> skills = new ArrayList<Pair<Integer, Integer>>();
|
public List<Pair<Integer, Integer>> skills = new ArrayList<>();
|
||||||
public Pair<Integer, Integer> cool = null;
|
public Pair<Integer, Integer> cool = null;
|
||||||
public BanishInfo banish = null;
|
public BanishInfo banish = null;
|
||||||
public List<loseItem> loseItem = null;
|
public List<loseItem> loseItem = null;
|
||||||
@@ -267,7 +267,7 @@ public class MapleMonsterStats {
|
|||||||
|
|
||||||
public void addLoseItem(loseItem li) {
|
public void addLoseItem(loseItem li) {
|
||||||
if (loseItem == null) {
|
if (loseItem == null) {
|
||||||
loseItem = new LinkedList<loseItem>();
|
loseItem = new LinkedList<>();
|
||||||
}
|
}
|
||||||
loseItem.add(li);
|
loseItem.add(li);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import java.util.Map;
|
|||||||
* @author Danny (Leifde)
|
* @author Danny (Leifde)
|
||||||
*/
|
*/
|
||||||
public class MobAttackInfoFactory {
|
public class MobAttackInfoFactory {
|
||||||
private static Map<String, MobAttackInfo> mobAttacks = new HashMap<String, MobAttackInfo>();
|
private static Map<String, MobAttackInfo> mobAttacks = new HashMap<>();
|
||||||
private static MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Mob.wz"));
|
private static MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Mob.wz"));
|
||||||
|
|
||||||
public static MobAttackInfo getMobAttackInfo(MapleMonster mob, int attack) {
|
public static MobAttackInfo getMobAttackInfo(MapleMonster mob, int attack) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import java.util.*;
|
|||||||
public class MobSkill {
|
public class MobSkill {
|
||||||
|
|
||||||
private int skillId, skillLevel, mpCon;
|
private int skillId, skillLevel, mpCon;
|
||||||
private List<Integer> toSummon = new ArrayList<Integer>();
|
private List<Integer> toSummon = new ArrayList<>();
|
||||||
private int spawnEffect, hp, x, y;
|
private int spawnEffect, hp, x, y;
|
||||||
private long duration, cooltime;
|
private long duration, cooltime;
|
||||||
private float prop;
|
private float prop;
|
||||||
@@ -117,8 +117,8 @@ public class MobSkill {
|
|||||||
|
|
||||||
public void applyEffect(MapleCharacter player, MapleMonster monster, boolean skill, List<MapleCharacter> banishPlayers) {
|
public void applyEffect(MapleCharacter player, MapleMonster monster, boolean skill, List<MapleCharacter> banishPlayers) {
|
||||||
MapleDisease disease = null;
|
MapleDisease disease = null;
|
||||||
Map<MonsterStatus, Integer> stats = new ArrayMap<MonsterStatus, Integer>();
|
Map<MonsterStatus, Integer> stats = new ArrayMap<>();
|
||||||
List<Integer> reflection = new LinkedList<Integer>();
|
List<Integer> reflection = new LinkedList<>();
|
||||||
switch (skillId) {
|
switch (skillId) {
|
||||||
case 100:
|
case 100:
|
||||||
case 110:
|
case 110:
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class MobSkillFactory {
|
public class MobSkillFactory {
|
||||||
|
|
||||||
private static Map<String, MobSkill> mobSkills = new HashMap<String, MobSkill>();
|
private static Map<String, MobSkill> mobSkills = new HashMap<>();
|
||||||
private final static MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
private final static MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
||||||
private static MapleData skillRoot = dataSource.getData("MobSkill.img");
|
private static MapleData skillRoot = dataSource.getData("MobSkill.img");
|
||||||
private final static MonitoredReentrantReadWriteLock dataLock = new MonitoredReentrantReadWriteLock(MonitoredLockType.MOBSKILL_FACTORY);
|
private final static MonitoredReentrantReadWriteLock dataLock = new MonitoredReentrantReadWriteLock(MonitoredLockType.MOBSKILL_FACTORY);
|
||||||
@@ -71,7 +71,7 @@ public class MobSkillFactory {
|
|||||||
MapleData skillData = skillRoot.getChildByPath(skillId + "/level/" + level);
|
MapleData skillData = skillRoot.getChildByPath(skillId + "/level/" + level);
|
||||||
if (skillData != null) {
|
if (skillData != null) {
|
||||||
int mpCon = MapleDataTool.getInt(skillData.getChildByPath("mpCon"), 0);
|
int mpCon = MapleDataTool.getInt(skillData.getChildByPath("mpCon"), 0);
|
||||||
List<Integer> toSummon = new ArrayList<Integer>();
|
List<Integer> toSummon = new ArrayList<>();
|
||||||
for (int i = 0; i > -1; i++) {
|
for (int i = 0; i > -1; i++) {
|
||||||
if (skillData.getChildByPath(String.valueOf(i)) == null) {
|
if (skillData.getChildByPath(String.valueOf(i)) == null) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package server.maps;
|
package server.maps;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.*;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,7 +35,7 @@ public class MapleFootholdTree {
|
|||||||
private MapleFootholdTree ne = null;
|
private MapleFootholdTree ne = null;
|
||||||
private MapleFootholdTree sw = null;
|
private MapleFootholdTree sw = null;
|
||||||
private MapleFootholdTree se = null;
|
private MapleFootholdTree se = null;
|
||||||
private List<MapleFoothold> footholds = new LinkedList<MapleFoothold>();
|
private List<MapleFoothold> footholds = new LinkedList<>();
|
||||||
private Point p1;
|
private Point p1;
|
||||||
private Point p2;
|
private Point p2;
|
||||||
private Point center;
|
private Point center;
|
||||||
@@ -96,7 +96,7 @@ public class MapleFootholdTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<MapleFoothold> getRelevants(Point p) {
|
private List<MapleFoothold> getRelevants(Point p) {
|
||||||
return getRelevants(p, new LinkedList<MapleFoothold>());
|
return getRelevants(p, new LinkedList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<MapleFoothold> getRelevants(Point p, List<MapleFoothold> list) {
|
private List<MapleFoothold> getRelevants(Point p, List<MapleFoothold> list) {
|
||||||
@@ -161,7 +161,7 @@ public class MapleFootholdTree {
|
|||||||
|
|
||||||
public MapleFoothold findBelow(Point p) {
|
public MapleFoothold findBelow(Point p) {
|
||||||
List<MapleFoothold> relevants = getRelevants(p);
|
List<MapleFoothold> relevants = getRelevants(p);
|
||||||
List<MapleFoothold> xMatches = new LinkedList<MapleFoothold>();
|
List<MapleFoothold> xMatches = new LinkedList<>();
|
||||||
for (MapleFoothold fh : relevants) {
|
for (MapleFoothold fh : relevants) {
|
||||||
if (fh.getX1() <= p.x && fh.getX2() >= p.x) {
|
if (fh.getX1() <= p.x && fh.getX2() >= p.x) {
|
||||||
xMatches.add(fh);
|
xMatches.add(fh);
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public class MapleMap {
|
|||||||
|
|
||||||
private Map<Integer, MapleMapObject> mapobjects = new LinkedHashMap<>();
|
private Map<Integer, MapleMapObject> mapobjects = new LinkedHashMap<>();
|
||||||
private Set<Integer> selfDestructives = new LinkedHashSet<>();
|
private Set<Integer> selfDestructives = new LinkedHashSet<>();
|
||||||
private Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<SpawnPoint>());
|
private Collection<SpawnPoint> monsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||||
private Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<SpawnPoint>());
|
private Collection<SpawnPoint> allMonsterSpawn = Collections.synchronizedList(new LinkedList<>());
|
||||||
private AtomicInteger spawnedMonstersOnMap = new AtomicInteger(0);
|
private AtomicInteger spawnedMonstersOnMap = new AtomicInteger(0);
|
||||||
private AtomicInteger droppedItemCount = new AtomicInteger(0);
|
private AtomicInteger droppedItemCount = new AtomicInteger(0);
|
||||||
private Collection<MapleCharacter> characters = new LinkedHashSet<>();
|
private Collection<MapleCharacter> characters = new LinkedHashSet<>();
|
||||||
@@ -2500,7 +2500,7 @@ public class MapleMap {
|
|||||||
broadcastGMSpawnPlayerMapObjectMessage(chr, chr, true);
|
broadcastGMSpawnPlayerMapObjectMessage(chr, chr, true);
|
||||||
chr.announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
|
chr.announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
|
||||||
|
|
||||||
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
|
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<>(MapleBuffStat.DARKSIGHT, 0));
|
||||||
broadcastGMMessage(chr, MaplePacketCreator.giveForeignBuff(chr.getId(), dsstat), false);
|
broadcastGMMessage(chr, MaplePacketCreator.giveForeignBuff(chr.getId(), dsstat), false);
|
||||||
} else {
|
} else {
|
||||||
broadcastSpawnPlayerMapObjectMessage(chr, chr, true);
|
broadcastSpawnPlayerMapObjectMessage(chr, chr, true);
|
||||||
@@ -4346,7 +4346,7 @@ public class MapleMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void addMobSpawn(int mobId, int spendCP) {
|
public final void addMobSpawn(int mobId, int spendCP) {
|
||||||
this.mobsToSpawn.add(new Pair<Integer, Integer>(mobId, spendCP));
|
this.mobsToSpawn.add(new Pair<>(mobId, spendCP));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final List<Pair<Integer, Integer>> getMobsToSpawn() {
|
public final List<Pair<Integer, Integer>> getMobsToSpawn() {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class MapleReactorFactory {
|
public class MapleReactorFactory {
|
||||||
private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Reactor.wz"));
|
private static MapleDataProvider data = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Reactor.wz"));
|
||||||
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<Integer, MapleReactorStats>();
|
private static Map<Integer, MapleReactorStats> reactorStats = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public static final MapleReactorStats getReactorS(int rid) {
|
public static final MapleReactorStats getReactorS(int rid) {
|
||||||
@@ -70,7 +70,7 @@ public class MapleReactorFactory {
|
|||||||
Pair<Integer, Integer> reactItem = null;
|
Pair<Integer, Integer> reactItem = null;
|
||||||
int type = MapleDataTool.getIntConvert("type", reactorInfoData);
|
int type = MapleDataTool.getIntConvert("type", reactorInfoData);
|
||||||
if (type == 100) { //reactor waits for item
|
if (type == 100) { //reactor waits for item
|
||||||
reactItem = new Pair<Integer, Integer>(MapleDataTool.getIntConvert("0", reactorInfoData), MapleDataTool.getIntConvert("1", reactorInfoData, 1));
|
reactItem = new Pair<>(MapleDataTool.getIntConvert("0", reactorInfoData), MapleDataTool.getIntConvert("1", reactorInfoData, 1));
|
||||||
if (!areaSet) { //only set area of effect for item-triggered reactors once
|
if (!areaSet) { //only set area of effect for item-triggered reactors once
|
||||||
stats.setTL(MapleDataTool.getPoint("lt", reactorInfoData));
|
stats.setTL(MapleDataTool.getPoint("lt", reactorInfoData));
|
||||||
stats.setBR(MapleDataTool.getPoint("rb", reactorInfoData));
|
stats.setBR(MapleDataTool.getPoint("rb", reactorInfoData));
|
||||||
@@ -129,7 +129,7 @@ public class MapleReactorFactory {
|
|||||||
Pair<Integer, Integer> reactItem = null;
|
Pair<Integer, Integer> reactItem = null;
|
||||||
int type = MapleDataTool.getIntConvert("type", fknexon);
|
int type = MapleDataTool.getIntConvert("type", fknexon);
|
||||||
if (type == 100) { //reactor waits for item
|
if (type == 100) { //reactor waits for item
|
||||||
reactItem = new Pair<Integer, Integer>(MapleDataTool.getIntConvert("0", fknexon), MapleDataTool.getIntConvert("1", fknexon));
|
reactItem = new Pair<>(MapleDataTool.getIntConvert("0", fknexon), MapleDataTool.getIntConvert("1", fknexon));
|
||||||
if (!areaSet || loadArea) { //only set area of effect for item-triggered reactors once
|
if (!areaSet || loadArea) { //only set area of effect for item-triggered reactors once
|
||||||
stats.setTL(MapleDataTool.getPoint("lt", fknexon));
|
stats.setTL(MapleDataTool.getPoint("lt", fknexon));
|
||||||
stats.setBR(MapleDataTool.getPoint("rb", fknexon));
|
stats.setBR(MapleDataTool.getPoint("rb", fknexon));
|
||||||
@@ -139,7 +139,7 @@ public class MapleReactorFactory {
|
|||||||
MapleData activeSkillID = fknexon.getChildByPath("activeSkillID");
|
MapleData activeSkillID = fknexon.getChildByPath("activeSkillID");
|
||||||
List<Integer> skillids = null;
|
List<Integer> skillids = null;
|
||||||
if (activeSkillID != null) {
|
if (activeSkillID != null) {
|
||||||
skillids = new ArrayList<Integer>();
|
skillids = new ArrayList<>();
|
||||||
for (MapleData skill : activeSkillID.getChildren()) {
|
for (MapleData skill : activeSkillID.getChildren()) {
|
||||||
skillids.add(MapleDataTool.getInt(skill));
|
skillids.add(MapleDataTool.getInt(skill));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
package server.partyquest;
|
package server.partyquest;
|
||||||
|
|
||||||
import client.MapleDisease;
|
import client.MapleDisease;
|
||||||
|
import provider.MapleData;
|
||||||
|
import provider.MapleDataProvider;
|
||||||
|
import provider.MapleDataProviderFactory;
|
||||||
|
import provider.MapleDataTool;
|
||||||
|
import server.life.MobSkill;
|
||||||
|
import server.life.MobSkillFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import server.life.MobSkillFactory;
|
|
||||||
import provider.MapleDataProvider;
|
|
||||||
import provider.MapleDataProviderFactory;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataTool;
|
|
||||||
import server.life.MobSkill;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@author Drago (Dragohe4rt)
|
*@author Drago (Dragohe4rt)
|
||||||
@@ -19,8 +20,8 @@ import server.life.MobSkill;
|
|||||||
public class MapleCarnivalFactory {
|
public class MapleCarnivalFactory {
|
||||||
|
|
||||||
private final static MapleCarnivalFactory instance = new MapleCarnivalFactory();
|
private final static MapleCarnivalFactory instance = new MapleCarnivalFactory();
|
||||||
private final Map<Integer, MCSkill> skills = new HashMap<Integer, MCSkill>();
|
private final Map<Integer, MCSkill> skills = new HashMap<>();
|
||||||
private final Map<Integer, MCSkill> guardians = new HashMap<Integer, MCSkill>();
|
private final Map<Integer, MCSkill> guardians = new HashMap<>();
|
||||||
private final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
private final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
|
||||||
|
|
||||||
private final List<Integer> singleTargetedSkills = new ArrayList<>();
|
private final List<Integer> singleTargetedSkills = new ArrayList<>();
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import provider.MapleData;
|
|||||||
import server.quest.MapleQuest;
|
import server.quest.MapleQuest;
|
||||||
import server.quest.MapleQuestActionType;
|
import server.quest.MapleQuestActionType;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -51,7 +51,7 @@ public abstract class MapleQuestAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> getJobBy5ByteEncoding(int encoded) {
|
public static List<Integer> getJobBy5ByteEncoding(int encoded) {
|
||||||
List<Integer> ret = new ArrayList<Integer>();
|
List<Integer> ret = new ArrayList<>();
|
||||||
if ((encoded & 0x1) != 0) {
|
if ((encoded & 0x1) != 0) {
|
||||||
ret.add(0);
|
ret.add(0);
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ public abstract class MapleQuestAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> getJobBySimpleEncoding(int encoded) {
|
public static List<Integer> getJobBySimpleEncoding(int encoded) {
|
||||||
List<Integer> ret = new ArrayList<Integer>();
|
List<Integer> ret = new ArrayList<>();
|
||||||
if ((encoded & 0x1) != 0) {
|
if ((encoded & 0x1) != 0) {
|
||||||
ret.add(200);
|
ret.add(200);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6540,7 +6540,7 @@ public class MaplePacketCreator {
|
|||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.FAMILY_CHART_RESULT.getValue());
|
mplew.writeShort(SendOpcode.FAMILY_CHART_RESULT.getValue());
|
||||||
mplew.writeInt(entry.getChrId()); //ID of viewed player's pedigree, can't be leader?
|
mplew.writeInt(entry.getChrId()); //ID of viewed player's pedigree, can't be leader?
|
||||||
List<MapleFamilyEntry> superJuniors = new ArrayList<MapleFamilyEntry>(4);
|
List<MapleFamilyEntry> superJuniors = new ArrayList<>(4);
|
||||||
boolean hasOtherJunior = false;
|
boolean hasOtherJunior = false;
|
||||||
int entryCount = 2; //2 guaranteed, leader and self
|
int entryCount = 2; //2 guaranteed, leader and self
|
||||||
entryCount += Math.min(2, entry.getTotalSeniors());
|
entryCount += Math.min(2, entry.getTotalSeniors());
|
||||||
|
|||||||
Reference in New Issue
Block a user