cleanup: use Java-style array declaration
This commit is contained in:
@@ -21,20 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
package client;
|
package client;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Map;
|
|
||||||
import net.server.PlayerStorage;
|
import net.server.PlayerStorage;
|
||||||
import tools.DatabaseConnection;
|
import tools.DatabaseConnection;
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class BuddyList {
|
public class BuddyList {
|
||||||
public enum BuddyOperation {
|
public enum BuddyOperation {
|
||||||
ADDED, DELETED
|
ADDED, DELETED
|
||||||
@@ -121,7 +117,7 @@ public class BuddyList {
|
|||||||
|
|
||||||
public int[] getBuddyIds() {
|
public int[] getBuddyIds() {
|
||||||
synchronized(buddies) {
|
synchronized(buddies) {
|
||||||
int buddyIds[] = new int[buddies.size()];
|
int[] buddyIds = new int[buddies.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (BuddylistEntry ble : buddies.values()) {
|
for (BuddylistEntry ble : buddies.values()) {
|
||||||
buddyIds[i++] = ble.getCharacterId();
|
buddyIds[i++] = ble.getCharacterId();
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ package client.autoban;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
import tools.FilePrinter;
|
import tools.FilePrinter;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author kevintjuh93
|
* @author kevintjuh93
|
||||||
@@ -23,9 +24,9 @@ public class AutobanManager {
|
|||||||
private int misses = 0;
|
private int misses = 0;
|
||||||
private int lastmisses = 0;
|
private int lastmisses = 0;
|
||||||
private int samemisscount = 0;
|
private int samemisscount = 0;
|
||||||
private long spam[] = new long[20];
|
private long[] spam = new long[20];
|
||||||
private int timestamp[] = new int[20];
|
private int[] timestamp = new int[20];
|
||||||
private byte timestampcounter[] = new byte[20];
|
private byte[] timestampcounter = new byte[20];
|
||||||
|
|
||||||
|
|
||||||
public AutobanManager(MapleCharacter chr) {
|
public AutobanManager(MapleCharacter chr) {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public abstract class Command {
|
|||||||
this.rank = rank;
|
this.rank = rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String joinStringFrom(String arr[], int start) {
|
protected String joinStringFrom(String[] arr, int start) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (int i = start; i < arr.length; i++) {
|
for (int i = start; i < arr.length; i++) {
|
||||||
builder.append(arr[i]);
|
builder.append(arr[i]);
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public class SeedCommand extends Command {
|
|||||||
player.yellowMessage("This command can only be used in HPQ.");
|
player.yellowMessage("This command can only be used in HPQ.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Point pos[] = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)};
|
Point[] pos = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)};
|
||||||
int seed[] = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098};
|
int[] seed = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098};
|
||||||
for (int i = 0; i < pos.length; i++) {
|
for (int i = 0; i < pos.length; i++) {
|
||||||
Item item = new Item(seed[i], (byte) 0, (short) 1);
|
Item item = new Item(seed[i], (byte) 0, (short) 1);
|
||||||
player.getMap().spawnItemDrop(player, player, item, pos[i], false, true);
|
player.getMap().spawnItemDrop(player, player, item, pos[i], false, true);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DebugCommand extends Command {
|
public class DebugCommand extends Command {
|
||||||
private final static String debugTypes[] = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", "buff", ""};
|
private final static String[] debugTypes = {"monster", "packet", "portal", "spawnpoint", "pos", "map", "mobsp", "event", "areas", "reactors", "servercoupons", "playercoupons", "timer", "marriage", "buff", ""};
|
||||||
|
|
||||||
{
|
{
|
||||||
setDescription("Show a debug message.");
|
setDescription("Show a debug message.");
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public enum ItemFactory {
|
|||||||
private final boolean account;
|
private final boolean account;
|
||||||
|
|
||||||
private static final int lockCount = 400;
|
private static final int lockCount = 400;
|
||||||
private static final Lock locks[] = new Lock[lockCount]; // thanks Masterrulax for pointing out a bottleneck issue here
|
private static final Lock[] locks = new Lock[lockCount]; // thanks Masterrulax for pointing out a bottleneck issue here
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (int i = 0; i < lockCount; i++) {
|
for (int i = 0; i < lockCount; i++) {
|
||||||
|
|||||||
@@ -23,31 +23,21 @@
|
|||||||
*/
|
*/
|
||||||
package client.processor.stat;
|
package client.processor.stat;
|
||||||
|
|
||||||
import client.MapleCharacter;
|
import client.*;
|
||||||
import client.MapleClient;
|
|
||||||
import client.MapleJob;
|
|
||||||
import client.MapleStat;
|
|
||||||
import client.Skill;
|
|
||||||
import client.SkillFactory;
|
|
||||||
import client.autoban.AutobanFactory;
|
import client.autoban.AutobanFactory;
|
||||||
import client.inventory.Equip;
|
import client.inventory.Equip;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import constants.skills.BlazeWizard;
|
import constants.skills.*;
|
||||||
import constants.skills.Brawler;
|
import tools.MaplePacketCreator;
|
||||||
import constants.skills.DawnWarrior;
|
import tools.Randomizer;
|
||||||
import constants.skills.Magician;
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
import constants.skills.ThunderBreaker;
|
|
||||||
import constants.skills.Warrior;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import server.ThreadManager;
|
|
||||||
import tools.MaplePacketCreator;
|
|
||||||
import tools.Randomizer;
|
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -374,7 +364,7 @@ public class AssignAPProcessor {
|
|||||||
return(statList.size() <= rank ? 0 : statList.get(rank));
|
return(statList.size() <= rank ? 0 : statList.get(rank));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int gainStatByType(MapleStat type, int[] statGain, int gain, int statUpdate[]) {
|
private static int gainStatByType(MapleStat type, int[] statGain, int gain, int[] statUpdate) {
|
||||||
if(gain <= 0) return 0;
|
if(gain <= 0) return 0;
|
||||||
|
|
||||||
int newVal = 0;
|
int newVal = 0;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class ServerConstants {
|
|||||||
public static final boolean JAVA_8 = getJavaVersion() >= 8; //Max amount of times a party leader is allowed to persist on the Party Search before entry expiration (thus needing to manually restart the Party Search to be able to search for members).
|
public static final boolean JAVA_8 = getJavaVersion() >= 8; //Max amount of times a party leader is allowed to persist on the Party Search before entry expiration (thus needing to manually restart the Party Search to be able to search for members).
|
||||||
|
|
||||||
//Debug Variables
|
//Debug Variables
|
||||||
public static int DEBUG_VALUES[] = new int[10]; // Field designed for packet testing purposes
|
public static int[] DEBUG_VALUES = new int[10]; // Field designed for packet testing purposes
|
||||||
|
|
||||||
// https://github.com/openstreetmap/josm/blob/a3a6e8a6b657cf4c5b4c64ea14d6e87be6280d65/src/org/openstreetmap/josm/tools/Utils.java#L1566-L1585
|
// https://github.com/openstreetmap/josm/blob/a3a6e8a6b657cf4c5b4c64ea14d6e87be6280d65/src/org/openstreetmap/josm/tools/Utils.java#L1566-L1585
|
||||||
// Added by kolakcc (Familiar)
|
// Added by kolakcc (Familiar)
|
||||||
|
|||||||
@@ -25,19 +25,19 @@ public class LanguageConstants {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String CPQBlue[] = new String[3];
|
public static String[] CPQBlue = new String[3];
|
||||||
public static String CPQError[] = new String[3];
|
public static String[] CPQError = new String[3];
|
||||||
public static String CPQEntry[] = new String[3];
|
public static String[] CPQEntry = new String[3];
|
||||||
public static String CPQFindError[] = new String[3];
|
public static String[] CPQFindError = new String[3];
|
||||||
public static String CPQRed[] = new String[3];
|
public static String[] CPQRed = new String[3];
|
||||||
public static String CPQPlayerExit[] = new String[3];
|
public static String[] CPQPlayerExit = new String[3];
|
||||||
public static String CPQEntryLobby[] = new String[3];
|
public static String[] CPQEntryLobby = new String[3];
|
||||||
public static String CPQPickRoom[] = new String[3];
|
public static String[] CPQPickRoom = new String[3];
|
||||||
public static String CPQExtendTime[] = new String[3];
|
public static String[] CPQExtendTime = new String[3];
|
||||||
public static String CPQLeaderNotFound[] = new String[3];
|
public static String[] CPQLeaderNotFound = new String[3];
|
||||||
public static String CPQChallengeRoomAnswer[] = new String[3];
|
public static String[] CPQChallengeRoomAnswer = new String[3];
|
||||||
public static String CPQChallengeRoomSent[] = new String[3];
|
public static String[] CPQChallengeRoomSent = new String[3];
|
||||||
public static String CPQChallengeRoomDenied[] = new String[3];
|
public static String[] CPQChallengeRoomDenied = new String[3];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
int lang;
|
int lang;
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ public class MapleServerHandler extends IoHandlerAdapter {
|
|||||||
FilePrinter.print(FilePrinter.SESSION, "IoSession with " + session.getRemoteAddress() + " opened on " + sdf.format(Calendar.getInstance().getTime()), false);
|
FilePrinter.print(FilePrinter.SESSION, "IoSession with " + session.getRemoteAddress() + " opened on " + sdf.format(Calendar.getInstance().getTime()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte ivRecv[] = {70, 114, 122, 82};
|
byte[] ivRecv = {70, 114, 122, 82};
|
||||||
byte ivSend[] = {82, 48, 120, 115};
|
byte[] ivSend = {82, 48, 120, 115};
|
||||||
ivRecv[3] = (byte) (Math.random() * 255);
|
ivRecv[3] = (byte) (Math.random() * 255);
|
||||||
ivSend[3] = (byte) (Math.random() * 255);
|
ivSend[3] = (byte) (Math.random() * 255);
|
||||||
MapleAESOFB sendCypher = new MapleAESOFB(ivSend, (short) (0xFFFF - ServerConstants.VERSION));
|
MapleAESOFB sendCypher = new MapleAESOFB(ivSend, (short) (0xFFFF - ServerConstants.VERSION));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class MapleCustomEncryption {
|
|||||||
return (byte) ((tmp & 0xFF) | (tmp >>> 8));
|
return (byte) ((tmp & 0xFF) | (tmp >>> 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] encryptData(byte data[]) {
|
public static byte[] encryptData(byte[] data) {
|
||||||
for (int j = 0; j < 6; j++) {
|
for (int j = 0; j < 6; j++) {
|
||||||
byte remember = 0;
|
byte remember = 0;
|
||||||
byte dataLength = (byte) (data.length & 0xFF);
|
byte dataLength = (byte) (data.length & 0xFF);
|
||||||
@@ -69,7 +69,7 @@ public class MapleCustomEncryption {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] decryptData(byte data[]) {
|
public static byte[] decryptData(byte[] data) {
|
||||||
for (int j = 1; j <= 6; j++) {
|
for (int j = 1; j <= 6; j++) {
|
||||||
byte remember = 0;
|
byte remember = 0;
|
||||||
byte dataLength = (byte) (data.length & 0xFF);
|
byte dataLength = (byte) (data.length & 0xFF);
|
||||||
|
|||||||
@@ -21,19 +21,19 @@
|
|||||||
*/
|
*/
|
||||||
package net.mina;
|
package net.mina;
|
||||||
|
|
||||||
import config.YamlConfig;
|
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import config.YamlConfig;
|
||||||
import constants.net.OpcodeConstants;
|
import constants.net.OpcodeConstants;
|
||||||
import net.server.coordinator.session.MapleSessionCoordinator;
|
import net.server.coordinator.session.MapleSessionCoordinator;
|
||||||
import org.apache.mina.core.buffer.IoBuffer;
|
import org.apache.mina.core.buffer.IoBuffer;
|
||||||
import org.apache.mina.core.session.IoSession;
|
import org.apache.mina.core.session.IoSession;
|
||||||
import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
|
import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
|
||||||
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
|
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
|
||||||
|
import tools.FilePrinter;
|
||||||
import tools.HexTool;
|
import tools.HexTool;
|
||||||
import tools.MapleAESOFB;
|
import tools.MapleAESOFB;
|
||||||
import tools.data.input.ByteArrayByteStream;
|
import tools.data.input.ByteArrayByteStream;
|
||||||
import tools.data.input.GenericLittleEndianAccessor;
|
import tools.data.input.GenericLittleEndianAccessor;
|
||||||
import tools.FilePrinter;
|
|
||||||
|
|
||||||
public class MaplePacketDecoder extends CumulativeProtocolDecoder {
|
public class MaplePacketDecoder extends CumulativeProtocolDecoder {
|
||||||
private static final String DECODER_STATE_KEY = MaplePacketDecoder.class.getName() + ".STATE";
|
private static final String DECODER_STATE_KEY = MaplePacketDecoder.class.getName() + ".STATE";
|
||||||
@@ -68,7 +68,7 @@ public class MaplePacketDecoder extends CumulativeProtocolDecoder {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (in.remaining() >= decoderState.packetlength) {
|
if (in.remaining() >= decoderState.packetlength) {
|
||||||
byte decryptedPacket[] = new byte[decoderState.packetlength];
|
byte[] decryptedPacket = new byte[decoderState.packetlength];
|
||||||
in.get(decryptedPacket, 0, decoderState.packetlength);
|
in.get(decryptedPacket, 0, decoderState.packetlength);
|
||||||
decoderState.packetlength = -1;
|
decoderState.packetlength = -1;
|
||||||
rcvdCrypto.crypt(decryptedPacket);
|
rcvdCrypto.crypt(decryptedPacket);
|
||||||
|
|||||||
@@ -948,7 +948,7 @@ public class Server {
|
|||||||
tMan.register(new BossLogTask(), 24 * 60 * 60 * 1000, timeLeft);
|
tMan.register(new BossLogTask(), 24 * 60 * 60 * 1000, timeLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String[] args) {
|
||||||
System.setProperty("wzpath", "wz");
|
System.setProperty("wzpath", "wz");
|
||||||
Security.setProperty("crypto.policy", "unlimited");
|
Security.setProperty("crypto.policy", "unlimited");
|
||||||
AutoJCE.removeCryptographyRestrictions();
|
AutoJCE.removeCryptographyRestrictions();
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public final class Channel {
|
|||||||
private MonitoredReadLock merchRlock = MonitoredReadLockFactory.createLock(merchantLock);
|
private MonitoredReadLock merchRlock = MonitoredReadLockFactory.createLock(merchantLock);
|
||||||
private MonitoredWriteLock merchWlock = MonitoredWriteLockFactory.createLock(merchantLock);
|
private MonitoredWriteLock merchWlock = MonitoredWriteLockFactory.createLock(merchantLock);
|
||||||
|
|
||||||
private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
private MonitoredReentrantLock[] faceLock = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
private MonitoredReentrantLock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL, true);
|
private MonitoredReentrantLock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL, true);
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ import client.MapleClient;
|
|||||||
import net.AbstractMaplePacketHandler;
|
import net.AbstractMaplePacketHandler;
|
||||||
import net.opcodes.SendOpcode;
|
import net.opcodes.SendOpcode;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
|
import net.server.guild.MapleAlliance;
|
||||||
import net.server.guild.MapleGuild;
|
import net.server.guild.MapleGuild;
|
||||||
import net.server.guild.MapleGuildCharacter;
|
import net.server.guild.MapleGuildCharacter;
|
||||||
import net.server.guild.MapleAlliance;
|
|
||||||
import tools.MaplePacketCreator;
|
import tools.MaplePacketCreator;
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
import tools.data.output.MaplePacketLittleEndianWriter;
|
import tools.data.output.MaplePacketLittleEndianWriter;
|
||||||
@@ -170,7 +170,7 @@ public final class AllianceOperationHandler extends AbstractMaplePacketHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x08:
|
case 0x08:
|
||||||
String ranks[] = new String[5];
|
String[] ranks = new String[5];
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
ranks[i] = slea.readMapleAsciiString();
|
ranks[i] = slea.readMapleAsciiString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,22 +21,23 @@
|
|||||||
*/
|
*/
|
||||||
package net.server.channel.handlers;
|
package net.server.channel.handlers;
|
||||||
|
|
||||||
import config.YamlConfig;
|
|
||||||
import net.server.guild.MapleGuildResponse;
|
|
||||||
import net.server.guild.MapleGuild;
|
|
||||||
import constants.game.GameConstants;
|
|
||||||
import client.MapleClient;
|
|
||||||
import net.AbstractMaplePacketHandler;
|
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
|
||||||
import tools.MaplePacketCreator;
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import java.util.HashSet;
|
import client.MapleClient;
|
||||||
import java.util.Set;
|
import config.YamlConfig;
|
||||||
|
import constants.game.GameConstants;
|
||||||
|
import net.AbstractMaplePacketHandler;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
import net.server.coordinator.matchchecker.MatchCheckerListenerFactory.MatchCheckerType;
|
||||||
import net.server.guild.MapleAlliance;
|
import net.server.guild.MapleAlliance;
|
||||||
|
import net.server.guild.MapleGuild;
|
||||||
|
import net.server.guild.MapleGuildResponse;
|
||||||
import net.server.world.MapleParty;
|
import net.server.world.MapleParty;
|
||||||
import net.server.world.World;
|
import net.server.world.World;
|
||||||
|
import tools.MaplePacketCreator;
|
||||||
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
||||||
private boolean isGuildNameAcceptable(String name) {
|
private boolean isGuildNameAcceptable(String name) {
|
||||||
@@ -187,7 +188,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler {
|
|||||||
System.out.println("[Hack] " + mc.getName() + " tried to change guild rank titles when s/he does not have permission.");
|
System.out.println("[Hack] " + mc.getName() + " tried to change guild rank titles when s/he does not have permission.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String ranks[] = new String[5];
|
String[] ranks = new String[5];
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
ranks[i] = slea.readMapleAsciiString();
|
ranks[i] = slea.readMapleAsciiString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public final class MultiChatHandler extends AbstractMaplePacketHandler {
|
|||||||
|
|
||||||
int type = slea.readByte(); // 0 for buddys, 1 for partys
|
int type = slea.readByte(); // 0 for buddys, 1 for partys
|
||||||
int numRecipients = slea.readByte();
|
int numRecipients = slea.readByte();
|
||||||
int recipients[] = new int[numRecipients];
|
int[] recipients = new int[numRecipients];
|
||||||
for (int i = 0; i < numRecipients; i++) {
|
for (int i = 0; i < numRecipients; i++) {
|
||||||
recipients[i] = slea.readInt();
|
recipients[i] = slea.readInt();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
|
|||||||
player.visitMap(player.getMap());
|
player.visitMap(player.getMap());
|
||||||
|
|
||||||
BuddyList bl = player.getBuddylist();
|
BuddyList bl = player.getBuddylist();
|
||||||
int buddyIds[] = bl.getBuddyIds();
|
int[] buddyIds = bl.getBuddyIds();
|
||||||
wserv.loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
|
wserv.loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
|
||||||
for (CharacterIdChannelPair onlineBuddy : wserv.multiBuddyFind(player.getId(), buddyIds)) {
|
for (CharacterIdChannelPair onlineBuddy : wserv.multiBuddyFind(player.getId(), buddyIds)) {
|
||||||
BuddylistEntry ble = bl.get(onlineBuddy.getCharacterId());
|
BuddylistEntry ble = bl.get(onlineBuddy.getCharacterId());
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.server.services.task.channel;
|
package net.server.services.task.channel;
|
||||||
|
|
||||||
import net.server.services.BaseService;
|
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import net.server.audit.locks.MonitoredLockType;
|
import net.server.audit.locks.MonitoredLockType;
|
||||||
import net.server.services.BaseScheduler;
|
import net.server.services.BaseScheduler;
|
||||||
|
import net.server.services.BaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
|||||||
*/
|
*/
|
||||||
public class EventService extends BaseService {
|
public class EventService extends BaseService {
|
||||||
|
|
||||||
private EventScheduler eventSchedulers[] = new EventScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private EventScheduler[] eventSchedulers = new EventScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public EventService() {
|
public EventService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ import java.util.Collections;
|
|||||||
*/
|
*/
|
||||||
public class FaceExpressionService extends BaseService {
|
public class FaceExpressionService extends BaseService {
|
||||||
|
|
||||||
private FaceExpressionScheduler faceExpressionSchedulers[] = new FaceExpressionScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private FaceExpressionScheduler[] faceExpressionSchedulers = new FaceExpressionScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
private MonitoredReentrantLock[] faceLock = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public FaceExpressionService() {
|
public FaceExpressionService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class MobAnimationService extends BaseService {
|
public class MobAnimationService extends BaseService {
|
||||||
|
|
||||||
private MobAnimationScheduler mobAnimationSchedulers[] = new MobAnimationScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private MobAnimationScheduler[] mobAnimationSchedulers = new MobAnimationScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public MobAnimationService() {
|
public MobAnimationService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.server.services.task.channel;
|
package net.server.services.task.channel;
|
||||||
|
|
||||||
import net.server.services.BaseService;
|
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import net.server.audit.locks.MonitoredLockType;
|
import net.server.audit.locks.MonitoredLockType;
|
||||||
import net.server.services.BaseScheduler;
|
import net.server.services.BaseScheduler;
|
||||||
|
import net.server.services.BaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
|||||||
*/
|
*/
|
||||||
public class MobClearSkillService extends BaseService {
|
public class MobClearSkillService extends BaseService {
|
||||||
|
|
||||||
private MobClearSkillScheduler mobClearSkillSchedulers[] = new MobClearSkillScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private MobClearSkillScheduler[] mobClearSkillSchedulers = new MobClearSkillScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public MobClearSkillService() {
|
public MobClearSkillService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.server.services.task.channel;
|
package net.server.services.task.channel;
|
||||||
|
|
||||||
import net.server.services.BaseService;
|
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import net.server.audit.locks.MonitoredLockType;
|
import net.server.audit.locks.MonitoredLockType;
|
||||||
import net.server.services.BaseScheduler;
|
import net.server.services.BaseScheduler;
|
||||||
|
import net.server.services.BaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
|||||||
*/
|
*/
|
||||||
public class MobMistService extends BaseService {
|
public class MobMistService extends BaseService {
|
||||||
|
|
||||||
private MobMistScheduler mobMistSchedulers[] = new MobMistScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private MobMistScheduler[] mobMistSchedulers = new MobMistScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public MobMistService() {
|
public MobMistService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class MobStatusService extends BaseService {
|
public class MobStatusService extends BaseService {
|
||||||
|
|
||||||
private MobStatusScheduler mobStatusSchedulers[] = new MobStatusScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private MobStatusScheduler[] mobStatusSchedulers = new MobStatusScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public MobStatusService() {
|
public MobStatusService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.server.services.task.channel;
|
package net.server.services.task.channel;
|
||||||
|
|
||||||
import net.server.services.BaseService;
|
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import net.server.audit.locks.MonitoredLockType;
|
import net.server.audit.locks.MonitoredLockType;
|
||||||
import net.server.services.BaseScheduler;
|
import net.server.services.BaseScheduler;
|
||||||
|
import net.server.services.BaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -30,7 +30,7 @@ import net.server.services.BaseScheduler;
|
|||||||
*/
|
*/
|
||||||
public class OverallService extends BaseService { // thanks Alex for suggesting a refactor over the several channel schedulers unnecessarily populating the Channel class
|
public class OverallService extends BaseService { // thanks Alex for suggesting a refactor over the several channel schedulers unnecessarily populating the Channel class
|
||||||
|
|
||||||
private OverallScheduler channelSchedulers[] = new OverallScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
private OverallScheduler[] channelSchedulers = new OverallScheduler[YamlConfig.config.server.CHANNEL_LOCKS];
|
||||||
|
|
||||||
public OverallService() {
|
public OverallService() {
|
||||||
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) {
|
||||||
|
|||||||
@@ -1241,7 +1241,7 @@ public class World {
|
|||||||
updateBuddies(characterId, channel, buddies, true);
|
updateBuddies(characterId, channel, buddies, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loggedOn(String name, int characterId, int channel, int buddies[]) {
|
public void loggedOn(String name, int characterId, int channel, int[] buddies) {
|
||||||
updateBuddies(characterId, channel, buddies, false);
|
updateBuddies(characterId, channel, buddies, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,21 +21,13 @@
|
|||||||
*/
|
*/
|
||||||
package provider.wz;
|
package provider.wz;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.RandomAccessFile;
|
|
||||||
import provider.MapleData;
|
import provider.MapleData;
|
||||||
import provider.MapleDataDirectoryEntry;
|
import provider.MapleDataDirectoryEntry;
|
||||||
import provider.MapleDataFileEntry;
|
import provider.MapleDataFileEntry;
|
||||||
import provider.MapleDataProvider;
|
import provider.MapleDataProvider;
|
||||||
import tools.data.input.GenericLittleEndianAccessor;
|
import tools.data.input.*;
|
||||||
import tools.data.input.GenericSeekableLittleEndianAccessor;
|
|
||||||
import tools.data.input.InputStreamByteStream;
|
import java.io.*;
|
||||||
import tools.data.input.LittleEndianAccessor;
|
|
||||||
import tools.data.input.RandomAccessByteStream;
|
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
|
||||||
|
|
||||||
public class WZFile implements MapleDataProvider {
|
public class WZFile implements MapleDataProvider {
|
||||||
static {
|
static {
|
||||||
@@ -116,7 +108,7 @@ public class WZFile implements MapleDataProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WZIMGFile getImgFile(String path) throws IOException {
|
public WZIMGFile getImgFile(String path) throws IOException {
|
||||||
String segments[] = path.split("/");
|
String[] segments = path.split("/");
|
||||||
WZDirectoryEntry dir = root;
|
WZDirectoryEntry dir = root;
|
||||||
for (int x = 0; x < segments.length - 1; x++) {
|
for (int x = 0; x < segments.length - 1; x++) {
|
||||||
dir = (WZDirectoryEntry) dir.getEntry(segments[x]);
|
dir = (WZDirectoryEntry) dir.getEntry(segments[x]);
|
||||||
|
|||||||
@@ -21,12 +21,13 @@
|
|||||||
*/
|
*/
|
||||||
package provider.wz;
|
package provider.wz;
|
||||||
|
|
||||||
|
import provider.MapleData;
|
||||||
|
import provider.MapleDataEntity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
|
|
||||||
public class WZIMGEntry implements MapleData {
|
public class WZIMGEntry implements MapleData {
|
||||||
private String name;
|
private String name;
|
||||||
@@ -56,7 +57,7 @@ public class WZIMGEntry implements MapleData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapleData getChildByPath(String path) {
|
public MapleData getChildByPath(String path) {
|
||||||
String segments[] = path.split("/");
|
String[] segments = path.split("/");
|
||||||
if (segments[0].equals("..")) {
|
if (segments[0].equals("..")) {
|
||||||
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,15 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
package provider.wz;
|
package provider.wz;
|
||||||
|
|
||||||
import java.security.InvalidKeyException;
|
import tools.data.input.LittleEndianAccessor;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import tools.data.input.SeekableLittleEndianAccessor;
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
import javax.crypto.NoSuchPaddingException;
|
import javax.crypto.NoSuchPaddingException;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import tools.data.input.LittleEndianAccessor;
|
import java.security.InvalidKeyException;
|
||||||
import tools.data.input.SeekableLittleEndianAccessor;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ported Code, see WZFile.java for more info
|
* Ported Code, see WZFile.java for more info
|
||||||
@@ -108,7 +109,7 @@ public class WZTool {
|
|||||||
if (strLength < 0) {
|
if (strLength < 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
byte str[] = new byte[strLength * 2];
|
byte[] str = new byte[strLength * 2];
|
||||||
for (int i = 0; i < strLength * 2; i++) {
|
for (int i = 0; i < strLength * 2; i++) {
|
||||||
str[i] = llea.readByte();
|
str[i] = llea.readByte();
|
||||||
}
|
}
|
||||||
@@ -122,7 +123,7 @@ public class WZTool {
|
|||||||
if (strLength < 0) {
|
if (strLength < 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
byte str[] = new byte[strLength];
|
byte[] str = new byte[strLength];
|
||||||
for (int i = 0; i < strLength; i++) {
|
for (int i = 0; i < strLength; i++) {
|
||||||
str[i] = llea.readByte();
|
str[i] = llea.readByte();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,23 +22,24 @@
|
|||||||
package provider.wz;
|
package provider.wz;
|
||||||
|
|
||||||
import constants.game.GameConstants;
|
import constants.game.GameConstants;
|
||||||
import java.awt.Point;
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
import provider.MapleData;
|
||||||
|
import provider.MapleDataEntity;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
import provider.MapleData;
|
|
||||||
import provider.MapleDataEntity;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.NamedNodeMap;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
import org.xml.sax.SAXException;
|
|
||||||
|
|
||||||
public class XMLDomMapleData implements MapleData {
|
public class XMLDomMapleData implements MapleData {
|
||||||
private Node node;
|
private Node node;
|
||||||
@@ -66,7 +67,7 @@ public class XMLDomMapleData implements MapleData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized MapleData getChildByPath(String path) { // the whole XML reading system seems susceptible to give nulls on strenuous read scenarios
|
public synchronized MapleData getChildByPath(String path) { // the whole XML reading system seems susceptible to give nulls on strenuous read scenarios
|
||||||
String segments[] = path.split("/");
|
String[] segments = path.split("/");
|
||||||
if (segments[0].equals("..")) {
|
if (segments[0].equals("..")) {
|
||||||
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
|||||||
getClient().announce(MaplePacketCreator.getNPCTalk(npc, (byte) 4, text, "", speaker));
|
getClient().announce(MaplePacketCreator.getNPCTalk(npc, (byte) 4, text, "", speaker));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendStyle(String text, int styles[]) {
|
public void sendStyle(String text, int[] styles) {
|
||||||
if (styles.length > 0) {
|
if (styles.length > 0) {
|
||||||
getClient().announce(MaplePacketCreator.getNPCTalkStyle(npc, text, styles));
|
getClient().announce(MaplePacketCreator.getNPCTalkStyle(npc, text, styles));
|
||||||
} else { // thanks Conrad for noticing empty styles crashing players
|
} else { // thanks Conrad for noticing empty styles crashing players
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ public class MapleMap {
|
|||||||
* @return correspondent coordinate.
|
* @return correspondent coordinate.
|
||||||
*/
|
*/
|
||||||
public static String getRoundedCoordinate(double angle) {
|
public static String getRoundedCoordinate(double angle) {
|
||||||
String directions[] = {"E", "SE", "S", "SW", "W", "NW", "N", "NE", "E"};
|
String[] directions = {"E", "SE", "S", "SW", "W", "NW", "N", "NE", "E"};
|
||||||
return directions[ (int)Math.round(( ((double)angle % 360) / 45)) ];
|
return directions[ (int)Math.round(( ((double)angle % 360) / 45)) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class MapleMapFactory {
|
|||||||
map.setTimeMob(MapleDataTool.getInt(timeMob.getChildByPath("id")), MapleDataTool.getString(timeMob.getChildByPath("message")));
|
map.setTimeMob(MapleDataTool.getInt(timeMob.getChildByPath("id")), MapleDataTool.getString(timeMob.getChildByPath("message")));
|
||||||
}
|
}
|
||||||
|
|
||||||
int bounds[] = new int[4];
|
int[] bounds = new int[4];
|
||||||
bounds[0] = MapleDataTool.getInt(infoData.getChildByPath("VRTop"));
|
bounds[0] = MapleDataTool.getInt(infoData.getChildByPath("VRTop"));
|
||||||
bounds[1] = MapleDataTool.getInt(infoData.getChildByPath("VRBottom"));
|
bounds[1] = MapleDataTool.getInt(infoData.getChildByPath("VRBottom"));
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class MapleTVEffect {
|
public class MapleTVEffect {
|
||||||
|
|
||||||
private final static boolean ACTIVE[] = new boolean[Server.getInstance().getWorldsSize()];
|
private final static boolean[] ACTIVE = new boolean[Server.getInstance().getWorldsSize()];
|
||||||
|
|
||||||
public static synchronized boolean broadcastMapleTVIfNotActive(MapleCharacter player, MapleCharacter victim, List<String> messages, int tvType){
|
public static synchronized boolean broadcastMapleTVIfNotActive(MapleCharacter player, MapleCharacter victim, List<String> messages, int tvType){
|
||||||
int w = player.getWorld();
|
int w = player.getWorld();
|
||||||
|
|||||||
@@ -14,9 +14,7 @@
|
|||||||
package tools;
|
package tools;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,14 +68,14 @@ public class BCrypt {
|
|||||||
// Blowfish parameters
|
// Blowfish parameters
|
||||||
private static final int BLOWFISH_NUM_ROUNDS = 16;
|
private static final int BLOWFISH_NUM_ROUNDS = 16;
|
||||||
// Initial contents of key schedule
|
// Initial contents of key schedule
|
||||||
private static final int P_orig[] = {
|
private static final int[] P_orig = {
|
||||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
|
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
|
||||||
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
|
||||||
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
||||||
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
|
||||||
0x9216d5d9, 0x8979fb1b
|
0x9216d5d9, 0x8979fb1b
|
||||||
};
|
};
|
||||||
private static final int S_orig[] = {
|
private static final int[] S_orig = {
|
||||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
|
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
|
||||||
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
|
||||||
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
||||||
@@ -338,12 +336,12 @@ public class BCrypt {
|
|||||||
// bcrypt IV: "OrpheanBeholderScryDoubt". The C implementation calls
|
// bcrypt IV: "OrpheanBeholderScryDoubt". The C implementation calls
|
||||||
// this "ciphertext", but it is really plaintext or an IV. We keep
|
// this "ciphertext", but it is really plaintext or an IV. We keep
|
||||||
// the name to make code comparison easier.
|
// the name to make code comparison easier.
|
||||||
static private final int bf_crypt_ciphertext[] = {
|
static private final int[] bf_crypt_ciphertext = {
|
||||||
0x4f727068, 0x65616e42, 0x65686f6c,
|
0x4f727068, 0x65616e42, 0x65686f6c,
|
||||||
0x64657253, 0x63727944, 0x6f756274
|
0x64657253, 0x63727944, 0x6f756274
|
||||||
};
|
};
|
||||||
// Table for Base64 encoding
|
// Table for Base64 encoding
|
||||||
static private final char base64_code[] = {
|
static private final char[] base64_code = {
|
||||||
'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
||||||
'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||||
@@ -352,7 +350,7 @@ public class BCrypt {
|
|||||||
'6', '7', '8', '9'
|
'6', '7', '8', '9'
|
||||||
};
|
};
|
||||||
// Table for Base64 decoding
|
// Table for Base64 decoding
|
||||||
static private final byte index_64[] = {
|
static private final byte[] index_64 = {
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||||
@@ -368,8 +366,8 @@ public class BCrypt {
|
|||||||
51, 52, 53, -1, -1, -1, -1, -1
|
51, 52, 53, -1, -1, -1, -1, -1
|
||||||
};
|
};
|
||||||
// Expanded Blowfish key
|
// Expanded Blowfish key
|
||||||
private int P[];
|
private int[] P;
|
||||||
private int S[];
|
private int[] S;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a byte array using bcrypt's slightly-modified base64
|
* Encode a byte array using bcrypt's slightly-modified base64
|
||||||
@@ -381,7 +379,7 @@ public class BCrypt {
|
|||||||
* @return base64-encoded string
|
* @return base64-encoded string
|
||||||
* @exception IllegalArgumentException if the length is invalid
|
* @exception IllegalArgumentException if the length is invalid
|
||||||
*/
|
*/
|
||||||
private static String encode_base64(byte d[], int len)
|
private static String encode_base64(byte[] d, int len)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
int off = 0;
|
int off = 0;
|
||||||
StringBuilder rs = new StringBuilder();
|
StringBuilder rs = new StringBuilder();
|
||||||
@@ -441,7 +439,7 @@ public class BCrypt {
|
|||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
StringBuilder rs = new StringBuilder();
|
StringBuilder rs = new StringBuilder();
|
||||||
int off = 0, slen = s.length(), olen = 0;
|
int off = 0, slen = s.length(), olen = 0;
|
||||||
byte ret[];
|
byte[] ret;
|
||||||
byte c1, c2, c3, c4, o;
|
byte c1, c2, c3, c4, o;
|
||||||
|
|
||||||
if (maxolen <= 0) {
|
if (maxolen <= 0) {
|
||||||
@@ -490,7 +488,7 @@ public class BCrypt {
|
|||||||
* @param lr an array containing the two 32-bit half blocks
|
* @param lr an array containing the two 32-bit half blocks
|
||||||
* @param off the position in the array of the blocks
|
* @param off the position in the array of the blocks
|
||||||
*/
|
*/
|
||||||
private final void encipher(int lr[], int off) {
|
private final void encipher(int[] lr, int off) {
|
||||||
int i, n, l = lr[off], r = lr[off + 1];
|
int i, n, l = lr[off], r = lr[off + 1];
|
||||||
|
|
||||||
l ^= P[0];
|
l ^= P[0];
|
||||||
@@ -522,9 +520,9 @@ public class BCrypt {
|
|||||||
* cumulative flag for non-benign sign extension
|
* cumulative flag for non-benign sign extension
|
||||||
* @return correct and buggy next word of material from data as int[2]
|
* @return correct and buggy next word of material from data as int[2]
|
||||||
*/
|
*/
|
||||||
private static int[] streamtowords(byte data[], int offp[], int signp[]) {
|
private static int[] streamtowords(byte[] data, int[] offp, int[] signp) {
|
||||||
int i;
|
int i;
|
||||||
int words[] = { 0, 0 };
|
int[] words = { 0, 0 };
|
||||||
int off = offp[0];
|
int off = offp[0];
|
||||||
int sign = signp[0];
|
int sign = signp[0];
|
||||||
|
|
||||||
@@ -547,8 +545,8 @@ public class BCrypt {
|
|||||||
* current offset into data
|
* current offset into data
|
||||||
* @return the next word of material from data
|
* @return the next word of material from data
|
||||||
*/
|
*/
|
||||||
private static int streamtoword(byte data[], int offp[]) {
|
private static int streamtoword(byte[] data, int[] offp) {
|
||||||
int signp[] = { 0 };
|
int[] signp = { 0 };
|
||||||
return streamtowords(data, offp, signp)[0];
|
return streamtowords(data, offp, signp)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,8 +557,8 @@ public class BCrypt {
|
|||||||
* current offset into data
|
* current offset into data
|
||||||
* @return the next word of material from data
|
* @return the next word of material from data
|
||||||
*/
|
*/
|
||||||
private static int streamtoword_bug(byte data[], int offp[]) {
|
private static int streamtoword_bug(byte[] data, int[] offp) {
|
||||||
int signp[] = { 0 };
|
int[] signp = { 0 };
|
||||||
return streamtowords(data, offp, signp)[1];
|
return streamtowords(data, offp, signp)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,10 +575,10 @@ public class BCrypt {
|
|||||||
* @param key an array containing the key
|
* @param key an array containing the key
|
||||||
* @param sign_ext_bug true to implement the 2x bug
|
* @param sign_ext_bug true to implement the 2x bug
|
||||||
*/
|
*/
|
||||||
private void key(byte key[], boolean sign_ext_bug) {
|
private void key(byte[] key, boolean sign_ext_bug) {
|
||||||
int i;
|
int i;
|
||||||
int koffp[] = {0};
|
int[] koffp = {0};
|
||||||
int lr[] = {0, 0};
|
int[] lr = {0, 0};
|
||||||
int plen = P.length, slen = S.length;
|
int plen = P.length, slen = S.length;
|
||||||
|
|
||||||
for (i = 0; i < plen; i++) {
|
for (i = 0; i < plen; i++) {
|
||||||
@@ -612,17 +610,17 @@ public class BCrypt {
|
|||||||
* @param sign_ext_bug true to implement the 2x bug
|
* @param sign_ext_bug true to implement the 2x bug
|
||||||
* @param safety bit 16 is set when the safety measure is requested
|
* @param safety bit 16 is set when the safety measure is requested
|
||||||
*/
|
*/
|
||||||
private void ekskey(byte data[], byte key[],
|
private void ekskey(byte[] data, byte[] key,
|
||||||
boolean sign_ext_bug, int safety) {
|
boolean sign_ext_bug, int safety) {
|
||||||
int i;
|
int i;
|
||||||
int koffp[] = {0}, doffp[] = {0};
|
int[] koffp = {0}, doffp = {0};
|
||||||
int lr[] = {0, 0};
|
int[] lr = {0, 0};
|
||||||
int plen = P.length, slen = S.length;
|
int plen = P.length, slen = S.length;
|
||||||
int signp[] = { 0 }; // non-benign sign-extension flag
|
int[] signp = { 0 }; // non-benign sign-extension flag
|
||||||
int diff = 0; // zero iff correct and buggy are same
|
int diff = 0; // zero iff correct and buggy are same
|
||||||
|
|
||||||
for (i = 0; i < plen; i++) {
|
for (i = 0; i < plen; i++) {
|
||||||
int words[] = streamtowords(key, koffp, signp);
|
int[] words = streamtowords(key, koffp, signp);
|
||||||
diff |= words[0] ^ words[1];
|
diff |= words[0] ^ words[1];
|
||||||
P[i] = P[i] ^ words[sign_ext_bug ? 1 : 0];
|
P[i] = P[i] ^ words[sign_ext_bug ? 1 : 0];
|
||||||
}
|
}
|
||||||
@@ -686,11 +684,11 @@ public class BCrypt {
|
|||||||
* @param cdata the plaintext to encrypt
|
* @param cdata the plaintext to encrypt
|
||||||
* @return an array containing the binary hashed password
|
* @return an array containing the binary hashed password
|
||||||
*/
|
*/
|
||||||
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds,
|
private byte[] crypt_raw(byte[] password, byte[] salt, int log_rounds,
|
||||||
boolean sign_ext_bug, int safety, int cdata[]) {
|
boolean sign_ext_bug, int safety, int[] cdata) {
|
||||||
int rounds, i, j;
|
int rounds, i, j;
|
||||||
int clen = cdata.length;
|
int clen = cdata.length;
|
||||||
byte ret[];
|
byte[] ret;
|
||||||
|
|
||||||
if (log_rounds < 4 || log_rounds > 30) {
|
if (log_rounds < 4 || log_rounds > 30) {
|
||||||
throw new IllegalArgumentException("Bad number of rounds");
|
throw new IllegalArgumentException("Bad number of rounds");
|
||||||
@@ -729,7 +727,7 @@ public class BCrypt {
|
|||||||
* @return Byte representation of given plaintext.
|
* @return Byte representation of given plaintext.
|
||||||
*/
|
*/
|
||||||
private static byte[] stringToBytes(String plaintext) {
|
private static byte[] stringToBytes(String plaintext) {
|
||||||
byte plaintextb[];
|
byte[] plaintextb;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
plaintextb = plaintext.getBytes("UTF-8");
|
plaintextb = plaintext.getBytes("UTF-8");
|
||||||
@@ -748,7 +746,7 @@ public class BCrypt {
|
|||||||
* @return the hashed password
|
* @return the hashed password
|
||||||
*/
|
*/
|
||||||
public static String hashpw(String password, String salt) {
|
public static String hashpw(String password, String salt) {
|
||||||
byte passwordb[] = stringToBytes(password);
|
byte[] passwordb = stringToBytes(password);
|
||||||
|
|
||||||
return hashpw(passwordb, salt);
|
return hashpw(passwordb, salt);
|
||||||
}
|
}
|
||||||
@@ -760,10 +758,10 @@ public class BCrypt {
|
|||||||
* using BCrypt.gensalt)
|
* using BCrypt.gensalt)
|
||||||
* @return the hashed password
|
* @return the hashed password
|
||||||
*/
|
*/
|
||||||
public static String hashpw(byte passwordb[], String salt) {
|
public static String hashpw(byte[] passwordb, String salt) {
|
||||||
BCrypt B;
|
BCrypt B;
|
||||||
String real_salt;
|
String real_salt;
|
||||||
byte saltb[], hashed[];
|
byte[] saltb, hashed;
|
||||||
char minor = (char) 0;
|
char minor = (char) 0;
|
||||||
int rounds, off = 0;
|
int rounds, off = 0;
|
||||||
StringBuilder rs = new StringBuilder();
|
StringBuilder rs = new StringBuilder();
|
||||||
@@ -834,7 +832,7 @@ public class BCrypt {
|
|||||||
public static String gensalt(String prefix, int log_rounds, SecureRandom random)
|
public static String gensalt(String prefix, int log_rounds, SecureRandom random)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
StringBuilder rs = new StringBuilder();
|
StringBuilder rs = new StringBuilder();
|
||||||
byte rnd[] = new byte[BCRYPT_SALT_LEN];
|
byte[] rnd = new byte[BCRYPT_SALT_LEN];
|
||||||
|
|
||||||
if (!prefix.startsWith("$2") ||
|
if (!prefix.startsWith("$2") ||
|
||||||
(prefix.charAt(2) != 'a' && prefix.charAt(2) != 'y') &&
|
(prefix.charAt(2) != 'a' && prefix.charAt(2) != 'y') &&
|
||||||
@@ -924,7 +922,7 @@ public class BCrypt {
|
|||||||
* @return true if the passwords match, false otherwise
|
* @return true if the passwords match, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean checkpw(String plaintext, String hashed) {
|
public static boolean checkpw(String plaintext, String hashed) {
|
||||||
byte plaintextb[] = stringToBytes(plaintext);
|
byte[] plaintextb = stringToBytes(plaintext);
|
||||||
return checkpw(plaintextb, hashed);
|
return checkpw(plaintextb, hashed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,8 +934,8 @@ public class BCrypt {
|
|||||||
* @return true if the passwords match, false otherwise
|
* @return true if the passwords match, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean checkpw(byte[] plaintext, String hashed) {
|
public static boolean checkpw(byte[] plaintext, String hashed) {
|
||||||
byte hashed_bytes[];
|
byte[] hashed_bytes;
|
||||||
byte try_bytes[];
|
byte[] try_bytes;
|
||||||
try {
|
try {
|
||||||
String try_pw = hashpw(plaintext, hashed);
|
String try_pw = hashpw(plaintext, hashed);
|
||||||
hashed_bytes = hashed.getBytes("UTF-8");
|
hashed_bytes = hashed.getBytes("UTF-8");
|
||||||
|
|||||||
@@ -21,16 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
package tools;
|
package tools;
|
||||||
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
import javax.crypto.NoSuchPaddingException;
|
import javax.crypto.NoSuchPaddingException;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
public class MapleAESOFB {
|
public class MapleAESOFB {
|
||||||
private byte iv[];
|
private byte[] iv;
|
||||||
private Cipher cipher;
|
private Cipher cipher;
|
||||||
private short mapleVersion;
|
private short mapleVersion;
|
||||||
private final static SecretKeySpec skey = new SecretKeySpec(
|
private final static SecretKeySpec skey = new SecretKeySpec(
|
||||||
@@ -54,7 +54,7 @@ public class MapleAESOFB {
|
|||||||
(byte) 0xD3, (byte) 0xAB, (byte) 0x91, (byte) 0xB9, (byte) 0x84, (byte) 0x7F, (byte) 0x61, (byte) 0x1E, (byte) 0xCF, (byte) 0xC5, (byte) 0xD1, (byte) 0x56, (byte) 0x3D, (byte) 0xCA, (byte) 0xF4, (byte) 0x05,
|
(byte) 0xD3, (byte) 0xAB, (byte) 0x91, (byte) 0xB9, (byte) 0x84, (byte) 0x7F, (byte) 0x61, (byte) 0x1E, (byte) 0xCF, (byte) 0xC5, (byte) 0xD1, (byte) 0x56, (byte) 0x3D, (byte) 0xCA, (byte) 0xF4, (byte) 0x05,
|
||||||
(byte) 0xC6, (byte) 0xE5, (byte) 0x08, (byte) 0x49};
|
(byte) 0xC6, (byte) 0xE5, (byte) 0x08, (byte) 0x49};
|
||||||
|
|
||||||
public MapleAESOFB(byte iv[], short mapleVersion) {
|
public MapleAESOFB(byte[] iv, short mapleVersion) {
|
||||||
try {
|
try {
|
||||||
cipher = Cipher.getInstance("AES");
|
cipher = Cipher.getInstance("AES");
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, skey);
|
cipher.init(Cipher.ENCRYPT_MODE, skey);
|
||||||
@@ -142,13 +142,13 @@ public class MapleAESOFB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkPacket(int packetHeader) {
|
public boolean checkPacket(int packetHeader) {
|
||||||
byte packetHeaderBuf[] = new byte[2];
|
byte[] packetHeaderBuf = new byte[2];
|
||||||
packetHeaderBuf[0] = (byte) ((packetHeader >> 24) & 0xFF);
|
packetHeaderBuf[0] = (byte) ((packetHeader >> 24) & 0xFF);
|
||||||
packetHeaderBuf[1] = (byte) ((packetHeader >> 16) & 0xFF);
|
packetHeaderBuf[1] = (byte) ((packetHeader >> 16) & 0xFF);
|
||||||
return checkPacket(packetHeaderBuf);
|
return checkPacket(packetHeaderBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getNewIv(byte oldIv[]) {
|
public static byte[] getNewIv(byte[] oldIv) {
|
||||||
byte[] in = {(byte) 0xf2, 0x53, (byte) 0x50, (byte) 0xc6};
|
byte[] in = {(byte) 0xf2, 0x53, (byte) 0x50, (byte) 0xc6};
|
||||||
for (int x = 0; x < 4; x++) {
|
for (int x = 0; x < 4; x++) {
|
||||||
funnyShit(oldIv[x], in);
|
funnyShit(oldIv[x], in);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class MaplePacketCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addRemainingSkillInfo(final MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
|
private static void addRemainingSkillInfo(final MaplePacketLittleEndianWriter mplew, MapleCharacter chr) {
|
||||||
int remainingSp[] = chr.getRemainingSps();
|
int[] remainingSp = chr.getRemainingSps();
|
||||||
int effectiveLength = 0;
|
int effectiveLength = 0;
|
||||||
for (int i = 0; i < remainingSp.length; i++) {
|
for (int i = 0; i < remainingSp.length; i++) {
|
||||||
if (remainingSp[i] > 0) {
|
if (remainingSp[i] > 0) {
|
||||||
@@ -3143,7 +3143,7 @@ public class MaplePacketCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void writeLongEncodeTemporaryMask(final MaplePacketLittleEndianWriter mplew, Collection<MonsterStatus> stati) {
|
private static void writeLongEncodeTemporaryMask(final MaplePacketLittleEndianWriter mplew, Collection<MonsterStatus> stati) {
|
||||||
int masks[] = new int[4];
|
int[] masks = new int[4];
|
||||||
|
|
||||||
for (MonsterStatus statup : stati) {
|
for (MonsterStatus statup : stati) {
|
||||||
int pos = statup.isFirst() ? 0 : 2;
|
int pos = statup.isFirst() ? 0 : 2;
|
||||||
@@ -3370,7 +3370,7 @@ public class MaplePacketCreator {
|
|||||||
addCharLook(mplew, shop.getOwner(), false);
|
addCharLook(mplew, shop.getOwner(), false);
|
||||||
mplew.writeMapleAsciiString(shop.getOwner().getName());
|
mplew.writeMapleAsciiString(shop.getOwner().getName());
|
||||||
|
|
||||||
MapleCharacter visitors[] = shop.getVisitors();
|
MapleCharacter[] visitors = shop.getVisitors();
|
||||||
for(int i = 0; i < 3; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
if(visitors[i] != null) {
|
if(visitors[i] != null) {
|
||||||
mplew.write(i + 1);
|
mplew.write(i + 1);
|
||||||
@@ -3474,7 +3474,7 @@ public class MaplePacketCreator {
|
|||||||
return mplew.getPacket();
|
return mplew.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] getNPCTalkStyle(int npc, String talk, int styles[]) {
|
public static byte[] getNPCTalkStyle(int npc, String talk, int[] styles) {
|
||||||
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
|
||||||
mplew.writeShort(SendOpcode.NPC_TALK.getValue());
|
mplew.writeShort(SendOpcode.NPC_TALK.getValue());
|
||||||
mplew.write(4); // ?
|
mplew.write(4); // ?
|
||||||
@@ -5758,7 +5758,7 @@ public class MaplePacketCreator {
|
|||||||
mplew.writeInt(hm.getItemId());
|
mplew.writeInt(hm.getItemId());
|
||||||
mplew.writeMapleAsciiString("Hired Merchant");
|
mplew.writeMapleAsciiString("Hired Merchant");
|
||||||
|
|
||||||
MapleCharacter visitors[] = hm.getVisitors();
|
MapleCharacter[] visitors = hm.getVisitors();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (visitors[i] != null) {
|
if (visitors[i] != null) {
|
||||||
mplew.write(i + 1);
|
mplew.write(i + 1);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class StringUtil {
|
|||||||
* @param start Starting from which string.
|
* @param start Starting from which string.
|
||||||
* @return The joined strings.
|
* @return The joined strings.
|
||||||
*/
|
*/
|
||||||
public static String joinStringFrom(String arr[], int start) {
|
public static String joinStringFrom(String[] arr, int start) {
|
||||||
return joinStringFrom(arr, start, " ");
|
return joinStringFrom(arr, start, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public class StringUtil {
|
|||||||
* @param start Starting from which string.
|
* @param start Starting from which string.
|
||||||
* @return The joined strings.
|
* @return The joined strings.
|
||||||
*/
|
*/
|
||||||
public static String joinStringFrom(String arr[], int start, String sep) {
|
public static String joinStringFrom(String[] arr, int start, String sep) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (int i = start; i < arr.length; i++) {
|
for (int i = start; i < arr.length; i++) {
|
||||||
builder.append(arr[i]);
|
builder.append(arr[i]);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package tools.data.input;
|
package tools.data.input;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.*;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,7 +129,7 @@ public class GenericLittleEndianAccessor implements LittleEndianAccessor {
|
|||||||
* @return The string read.
|
* @return The string read.
|
||||||
*/
|
*/
|
||||||
public final String readAsciiString(int n) {
|
public final String readAsciiString(int n) {
|
||||||
char ret[] = new char[n];
|
char[] ret = new char[n];
|
||||||
for (int x = 0; x < n; x++) {
|
for (int x = 0; x < n; x++) {
|
||||||
ret[x] = (char) readByte();
|
ret[x] = (char) readByte();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package tools.data.output;
|
package tools.data.output;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an interface to a writer class that writes a little-endian sequence
|
* Provides an interface to a writer class that writes a little-endian sequence
|
||||||
@@ -38,7 +38,7 @@ public interface LittleEndianWriter {
|
|||||||
*
|
*
|
||||||
* @param b The bytes to write.
|
* @param b The bytes to write.
|
||||||
*/
|
*/
|
||||||
public void write(byte b[]);
|
public void write(byte[] b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a byte to the sequence.
|
* Write a byte to the sequence.
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public class Fishing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void debugFishingLikelihood() {
|
private static void debugFishingLikelihood() {
|
||||||
long a[] = new long[365], b[] = new long[365];
|
long[] a = new long[365], b = new long[365];
|
||||||
long hits = 0, hits10 = 0, total = 0;
|
long hits = 0, hits10 = 0, total = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 365; i++) {
|
for (int i = 0; i < 365; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user