cleanup: remove redundant cast

This commit is contained in:
P0nk
2021-04-08 17:23:45 +02:00
parent ebb3aa7ba3
commit 3434c7334b
48 changed files with 243 additions and 359 deletions

View File

@@ -21,10 +21,6 @@ package client;
import config.YamlConfig; import config.YamlConfig;
import constants.game.GameConstants; import constants.game.GameConstants;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.MonitoredReadLock; import net.server.audit.locks.MonitoredReadLock;
import net.server.audit.locks.MonitoredReentrantReadWriteLock; import net.server.audit.locks.MonitoredReentrantReadWriteLock;
@@ -35,6 +31,11 @@ import net.server.audit.locks.factory.MonitoredWriteLockFactory;
import server.maps.AbstractAnimatedMapleMapObject; import server.maps.AbstractAnimatedMapleMapObject;
import server.maps.MapleMap; import server.maps.MapleMap;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
/** /**
* *
* @author RonanLana * @author RonanLana
@@ -315,7 +316,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple
short newHp = (short) (hpMpPool >> 48); short newHp = (short) (hpMpPool >> 48);
short newMp = (short) (hpMpPool >> 32); short newMp = (short) (hpMpPool >> 32);
short newMaxHp = (short) (hpMpPool >> 16); short newMaxHp = (short) (hpMpPool >> 16);
short newMaxMp = (short) (hpMpPool.shortValue()); short newMaxMp = hpMpPool.shortValue();
if (newMaxHp != Short.MIN_VALUE) { if (newMaxHp != Short.MIN_VALUE) {
if (newMaxHp < 50) { if (newMaxHp < 50) {
@@ -354,7 +355,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple
short newStr = (short) (strDexIntLuk >> 48); short newStr = (short) (strDexIntLuk >> 48);
short newDex = (short) (strDexIntLuk >> 32); short newDex = (short) (strDexIntLuk >> 32);
short newInt = (short) (strDexIntLuk >> 16); short newInt = (short) (strDexIntLuk >> 16);
short newLuk = (short) (strDexIntLuk.shortValue()); short newLuk = strDexIntLuk.shortValue();
if (newStr >= 4) { if (newStr >= 4) {
setStr(newStr); setStr(newStr);
@@ -386,7 +387,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple
if (newSp != null) { if (newSp != null) {
short sp = (short) (newSp >> 16); short sp = (short) (newSp >> 16);
short skillbook = (short) (newSp.shortValue()); short skillbook = newSp.shortValue();
setRemainingSp(sp, skillbook); setRemainingSp(sp, skillbook);
statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]); statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]);

View File

@@ -602,7 +602,7 @@ public class MapleClient {
long ipAddress = 0; long ipAddress = 0;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
int quad = Integer.parseInt(quads[i]); int quad = Integer.parseInt(quads[i]);
ipAddress += (long) (quad % 256) * (long) Math.pow(256, (double) (4 - i)); ipAddress += (long) (quad % 256) * (long) Math.pow(256, 4 - i);
} }
return ipAddress; return ipAddress;
} }

View File

@@ -23,6 +23,7 @@
*/ */
package client.command; package client.command;
import client.MapleClient;
import client.command.commands.gm0.*; import client.command.commands.gm0.*;
import client.command.commands.gm1.*; import client.command.commands.gm1.*;
import client.command.commands.gm2.*; import client.command.commands.gm2.*;
@@ -30,18 +31,11 @@ import client.command.commands.gm3.*;
import client.command.commands.gm4.*; import client.command.commands.gm4.*;
import client.command.commands.gm5.*; import client.command.commands.gm5.*;
import client.command.commands.gm6.*; import client.command.commands.gm6.*;
import client.MapleClient;
import tools.FilePrinter; import tools.FilePrinter;
import tools.Pair; import tools.Pair;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
public class CommandsExecutor { public class CommandsExecutor {
@@ -181,7 +175,7 @@ public class CommandsExecutor {
} }
private void registerLv0Commands(){ private void registerLv0Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand(new String[]{"help", "commands"}, HelpCommand.class); addCommand(new String[]{"help", "commands"}, HelpCommand.class);
addCommand("droplimit", DropLimitCommand.class); addCommand("droplimit", DropLimitCommand.class);
@@ -217,7 +211,7 @@ public class CommandsExecutor {
private void registerLv1Commands() { private void registerLv1Commands() {
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("whatdropsfrom", 1, WhatDropsFromCommand.class); addCommand("whatdropsfrom", 1, WhatDropsFromCommand.class);
addCommand("whodrops", 1, WhoDropsCommand.class); addCommand("whodrops", 1, WhoDropsCommand.class);
@@ -229,7 +223,7 @@ public class CommandsExecutor {
private void registerLv2Commands(){ private void registerLv2Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("recharge", 2, RechargeCommand.class); addCommand("recharge", 2, RechargeCommand.class);
addCommand("whereami", 2, WhereaMiCommand.class); addCommand("whereami", 2, WhereaMiCommand.class);
@@ -272,7 +266,7 @@ public class CommandsExecutor {
} }
private void registerLv3Commands() { private void registerLv3Commands() {
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("debuff", 3, DebuffCommand.class); addCommand("debuff", 3, DebuffCommand.class);
addCommand("fly", 3, FlyCommand.class); addCommand("fly", 3, FlyCommand.class);
@@ -338,7 +332,7 @@ public class CommandsExecutor {
} }
private void registerLv4Commands(){ private void registerLv4Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("servermessage", 4, ServerMessageCommand.class); addCommand("servermessage", 4, ServerMessageCommand.class);
addCommand("proitem", 4, ProItemCommand.class); addCommand("proitem", 4, ProItemCommand.class);
@@ -369,7 +363,7 @@ public class CommandsExecutor {
} }
private void registerLv5Commands(){ private void registerLv5Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("debug", 5, DebugCommand.class); addCommand("debug", 5, DebugCommand.class);
addCommand("set", 5, SetCommand.class); addCommand("set", 5, SetCommand.class);
@@ -382,7 +376,7 @@ public class CommandsExecutor {
} }
private void registerLv6Commands(){ private void registerLv6Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>()); levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("setgmlevel", 6, SetGmLevelCommand.class); addCommand("setgmlevel", 6, SetGmLevelCommand.class);
addCommand("warpworld", 6, WarpWorldCommand.class); addCommand("warpworld", 6, WarpWorldCommand.class);

View File

@@ -51,10 +51,10 @@ public class ShutdownCommand extends Command {
} }
if (time > 1) { if (time > 1) {
int seconds = (int) (time / 1000) % 60; int seconds = (time / 1000) % 60;
int minutes = (int) ((time / (1000 * 60)) % 60); int minutes = (time / (1000 * 60)) % 60;
int hours = (int) ((time / (1000 * 60 * 60)) % 24); int hours = (time / (1000 * 60 * 60)) % 24;
int days = (int) ((time / (1000 * 60 * 60 * 24))); int days = (time / (1000 * 60 * 60 * 24));
String strTime = ""; String strTime = "";
if (days > 0) strTime += days + " days, "; if (days > 0) strTime += days + " days, ";

View File

@@ -104,7 +104,7 @@ public enum ItemFactory {
equip.setWatk((short) rs.getInt("watk")); equip.setWatk((short) rs.getInt("watk"));
equip.setWdef((short) rs.getInt("wdef")); equip.setWdef((short) rs.getInt("wdef"));
equip.setUpgradeSlots((byte) rs.getInt("upgradeslots")); equip.setUpgradeSlots((byte) rs.getInt("upgradeslots"));
equip.setLevel((byte) rs.getByte("level")); equip.setLevel(rs.getByte("level"));
equip.setItemExp(rs.getInt("itemexp")); equip.setItemExp(rs.getInt("itemexp"));
equip.setItemLevel(rs.getByte("itemlevel")); equip.setItemLevel(rs.getByte("itemlevel"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));

View File

@@ -232,8 +232,8 @@ public class MapleInventory implements Iterable<Item> {
public void move(short sSlot, short dSlot, short slotMax) { public void move(short sSlot, short dSlot, short slotMax) {
lock.lock(); lock.lock();
try { try {
Item source = (Item) inventory.get(sSlot); Item source = inventory.get(sSlot);
Item target = (Item) inventory.get(dSlot); Item target = inventory.get(dSlot);
if (source == null) { if (source == null) {
return; return;
} }

View File

@@ -306,7 +306,7 @@ public class MaplePet extends Item {
for (LifeMovementFragment move : movement) { for (LifeMovementFragment move : movement) {
if (move instanceof LifeMovement) { if (move instanceof LifeMovement) {
if (move instanceof AbsoluteLifeMovement) { if (move instanceof AbsoluteLifeMovement) {
this.setPos(((LifeMovement) move).getPosition()); this.setPos(move.getPosition());
} }
this.setStance(((LifeMovement) move).getNewstate()); this.setStance(((LifeMovement) move).getNewstate());
} }

View File

@@ -24,26 +24,20 @@ package client.inventory.manipulator;
import client.MapleBuffStat; import client.MapleBuffStat;
import client.MapleCharacter; import client.MapleCharacter;
import client.MapleClient; import client.MapleClient;
import client.inventory.Equip; import client.inventory.*;
import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import client.inventory.ModifyInventory;
import client.newyear.NewYearCardRecord; import client.newyear.NewYearCardRecord;
import config.YamlConfig; import config.YamlConfig;
import constants.inventory.ItemConstants; import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
import server.maps.MapleMap;
import tools.FilePrinter;
import tools.MaplePacketCreator;
import java.awt.Point; import java.awt.*;
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 server.MapleItemInformationProvider;
import server.maps.MapleMap;
import tools.FilePrinter;
import tools.MaplePacketCreator;
/** /**
* *
@@ -91,7 +85,7 @@ public class MapleInventoryManipulator {
Iterator<Item> i = existing.iterator(); Iterator<Item> i = existing.iterator();
while (quantity > 0) { while (quantity > 0) {
if (i.hasNext()) { if (i.hasNext()) {
Item eItem = (Item) i.next(); Item eItem = i.next();
short oldQ = eItem.getQuantity(); short oldQ = eItem.getQuantity();
if (oldQ < slotMax && ((eItem.getOwner().equals(owner) || owner == null) && eItem.getFlag() == flag)) { if (oldQ < slotMax && ((eItem.getOwner().equals(owner) || owner == null) && eItem.getFlag() == flag)) {
short newQ = (short) Math.min(oldQ + quantity, slotMax); short newQ = (short) Math.min(oldQ + quantity, slotMax);
@@ -202,7 +196,7 @@ public class MapleInventoryManipulator {
Iterator<Item> i = existing.iterator(); Iterator<Item> i = existing.iterator();
while (quantity > 0) { while (quantity > 0) {
if (i.hasNext()) { if (i.hasNext()) {
Item eItem = (Item) i.next(); Item eItem = i.next();
short oldQ = eItem.getQuantity(); short oldQ = eItem.getQuantity();
if (oldQ < slotMax && item.getFlag() == eItem.getFlag() && item.getOwner().equals(eItem.getOwner())) { if (oldQ < slotMax && item.getFlag() == eItem.getFlag() && item.getOwner().equals(eItem.getOwner())) {
short newQ = (short) Math.min(oldQ + quantity, slotMax); short newQ = (short) Math.min(oldQ + quantity, slotMax);

View File

@@ -30,7 +30,6 @@ import client.SkillFactory;
import client.autoban.AutobanFactory; import client.autoban.AutobanFactory;
import constants.game.GameConstants; import constants.game.GameConstants;
import constants.skills.Aran; import constants.skills.Aran;
import server.ThreadManager;
import tools.FilePrinter; import tools.FilePrinter;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
@@ -87,12 +86,12 @@ public class AssignSPProcessor {
} }
if (skill.getId() == Aran.FULL_SWING) { if (skill.getId() == Aran.FULL_SWING) {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_DOUBLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_DOUBLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_TRIPLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_TRIPLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
} else if (skill.getId() == Aran.OVER_SWING) { } else if (skill.getId() == Aran.OVER_SWING) {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_DOUBLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_DOUBLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_TRIPLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_TRIPLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
} else { } else {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill)); player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));
} }

View File

@@ -1,26 +1,18 @@
package constants.game; package constants.game;
import client.MapleDisease; import client.MapleDisease;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import client.MapleJob; import client.MapleJob;
import config.YamlConfig; import config.YamlConfig;
import constants.skills.Aran; import constants.skills.Aran;
import provider.*;
import server.maps.FieldLimit;
import server.maps.MapleMap;
import server.quest.MapleQuest;
import java.io.File; import java.io.File;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.Locale; import java.util.*;
import provider.MapleData;
import provider.MapleDataDirectoryEntry;
import provider.MapleDataFileEntry;
import provider.MapleDataProvider;
import provider.MapleDataProviderFactory;
import provider.MapleDataTool;
import server.maps.MapleMap;
import server.maps.FieldLimit;
import server.quest.MapleQuest;
/* /*
* @author kevintjuh93 * @author kevintjuh93
@@ -518,8 +510,8 @@ public class GameConstants {
private static boolean isInBranchJobTree(int skillJobId, int jobId, int branchType) { private static boolean isInBranchJobTree(int skillJobId, int jobId, int branchType) {
int branch = (int)(Math.pow(10, branchType)); int branch = (int)(Math.pow(10, branchType));
int skillBranch = (int)(skillJobId / branch) * branch; int skillBranch = (skillJobId / branch) * branch;
int jobBranch = (int)(jobId / branch) * branch; int jobBranch = (jobId / branch) * branch;
return skillBranch == jobBranch; return skillBranch == jobBranch;
} }
@@ -527,8 +519,8 @@ public class GameConstants {
private static boolean hasDivergedBranchJobTree(int skillJobId, int jobId, int branchType) { private static boolean hasDivergedBranchJobTree(int skillJobId, int jobId, int branchType) {
int branch = (int)(Math.pow(10, branchType)); int branch = (int)(Math.pow(10, branchType));
int skillBranch = (int)(skillJobId / branch); int skillBranch = skillJobId / branch;
int jobBranch = (int)(jobId / branch); int jobBranch = jobId / branch;
return skillBranch != jobBranch && skillBranch % 10 != 0; return skillBranch != jobBranch && skillBranch % 10 != 0;
} }

View File

@@ -133,7 +133,7 @@ public class MapleServerHandler extends IoHandlerAdapter {
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));
MapleAESOFB recvCypher = new MapleAESOFB(ivRecv, (short) ServerConstants.VERSION); MapleAESOFB recvCypher = new MapleAESOFB(ivRecv, ServerConstants.VERSION);
MapleClient client = new MapleClient(sendCypher, recvCypher, session); MapleClient client = new MapleClient(sendCypher, recvCypher, session);
client.setWorld(world); client.setWorld(world);
client.setChannel(channel); client.setChannel(channel);

View File

@@ -54,7 +54,6 @@ import net.server.task.*;
import net.server.world.World; import net.server.world.World;
import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.buffer.SimpleBufferAllocator; import org.apache.mina.core.buffer.SimpleBufferAllocator;
import org.apache.mina.core.filterchain.IoFilter;
import org.apache.mina.core.service.IoAcceptor; import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.codec.ProtocolCodecFilter;
@@ -901,7 +900,7 @@ public class Server {
IoBuffer.setUseDirectBuffer(false); // join IO operations performed by lxconan IoBuffer.setUseDirectBuffer(false); // join IO operations performed by lxconan
IoBuffer.setAllocator(new SimpleBufferAllocator()); IoBuffer.setAllocator(new SimpleBufferAllocator());
acceptor = new NioSocketAcceptor(); acceptor = new NioSocketAcceptor();
acceptor.getFilterChain().addLast("codec", (IoFilter) new ProtocolCodecFilter(new MapleCodecFactory())); acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30); acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30);
acceptor.setHandler(new MapleServerHandler()); acceptor.setHandler(new MapleServerHandler());
try { try {

View File

@@ -41,7 +41,6 @@ import net.server.world.MaplePartyCharacter;
import net.server.world.World; import net.server.world.World;
import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.buffer.SimpleBufferAllocator; import org.apache.mina.core.buffer.SimpleBufferAllocator;
import org.apache.mina.core.filterchain.IoFilter;
import org.apache.mina.core.service.IoAcceptor; import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.codec.ProtocolCodecFilter;
@@ -128,7 +127,7 @@ public final class Channel {
acceptor = new NioSocketAcceptor(); acceptor = new NioSocketAcceptor();
acceptor.setHandler(new MapleServerHandler(world, channel)); acceptor.setHandler(new MapleServerHandler(world, channel));
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30); acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30);
acceptor.getFilterChain().addLast("codec", (IoFilter) new ProtocolCodecFilter(new MapleCodecFactory())); acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
acceptor.bind(new InetSocketAddress(port)); acceptor.bind(new InetSocketAddress(port));
((SocketSessionConfig) acceptor.getSessionConfig()).setTcpNoDelay(true); ((SocketSessionConfig) acceptor.getSessionConfig()).setTcpNoDelay(true);
for (MapleExpeditionType exped : MapleExpeditionType.values()) { for (MapleExpeditionType exped : MapleExpeditionType.values()) {

View File

@@ -264,7 +264,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
else else
eachdf = eachd; eachdf = eachd;
TimerManager.getInstance().schedule(() -> map.spawnMesoDrop(Math.min((int) Math.max(((double) eachdf / (double) 20000) * (double) maxmeso, (double) 1), maxmeso), new Point((int) (monster.getPosition().getX() + Randomizer.nextInt(100) - 50), (int) (monster.getPosition().getY())), monster, player, true, (byte) 2), delay); TimerManager.getInstance().schedule(() -> map.spawnMesoDrop(Math.min((int) Math.max(((double) eachdf / (double) 20000) * (double) maxmeso, 1), maxmeso), new Point((int) (monster.getPosition().getX() + Randomizer.nextInt(100) - 50), (int) (monster.getPosition().getY())), monster, player, true, (byte) 2), delay);
delay += 100; delay += 100;
} }
} }

View File

@@ -157,7 +157,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price") + 100 + (int) (rs.getInt("price") * 0.1), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price") + 100 + (int) (rs.getInt("price") * 0.1), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
} }
@@ -188,7 +188,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
if (rs.getInt("type") != 1) { if (rs.getInt("type") != 1) {
Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity"));
i.setOwner(rs.getString("owner")); i.setOwner(rs.getString("owner"));
items.add(new MTSItemInfo((Item) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
equip.setOwner(rs.getString("owner")); equip.setOwner(rs.getString("owner"));
@@ -217,7 +217,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
equip.setFlag((short) rs.getInt("flag")); equip.setFlag((short) rs.getInt("flag"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
} }
@@ -238,7 +238,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
if (rs.getInt("type") != 1) { if (rs.getInt("type") != 1) {
Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity"));
i.setOwner(rs.getString("owner")); i.setOwner(rs.getString("owner"));
items.add(new MTSItemInfo((Item) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
equip.setOwner(rs.getString("owner")); equip.setOwner(rs.getString("owner"));
@@ -267,7 +267,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
equip.setFlag((short) rs.getInt("flag")); equip.setFlag((short) rs.getInt("flag"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
} }

View File

@@ -21,22 +21,18 @@
*/ */
package net.server.channel.handlers; package net.server.channel.handlers;
import java.util.ArrayList;
import java.util.List;
import config.YamlConfig;
import net.AbstractMaplePacketHandler;
import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor;
import client.MapleCharacter; import client.MapleCharacter;
import client.MapleClient; import client.MapleClient;
import client.inventory.Item; import client.inventory.*;
import client.inventory.Equip; import config.YamlConfig;
import client.inventory.MapleInventory; import net.AbstractMaplePacketHandler;
import client.inventory.MapleInventoryType;
import client.inventory.ModifyInventory;
import server.MapleItemInformationProvider;
import net.server.Server; import net.server.Server;
import server.MapleItemInformationProvider;
import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor;
import java.util.ArrayList;
import java.util.List;
/** /**
* *
@@ -159,7 +155,7 @@ class PairedQuicksort {
if (i <= j) { if (i <= j) {
w = (Equip)A.get(i); w = (Equip)A.get(i);
A.set(i, A.get(j)); A.set(i, A.get(j));
A.set(j, (Item)w); A.set(j, w);
i++; i++;
j--; j--;
@@ -290,7 +286,7 @@ public final class InventorySortHandler extends AbstractMaplePacketHandler {
for (short i = 1; i <= inventory.getSlotLimit(); i++) { for (short i = 1; i <= inventory.getSlotLimit(); i++) {
Item item = inventory.getItem(i); Item item = inventory.getItem(i);
if (item != null) { if (item != null) {
itemarray.add((Item) item.copy()); itemarray.add(item.copy());
} }
} }

View File

@@ -21,6 +21,23 @@
*/ */
package net.server.channel.handlers; package net.server.channel.handlers;
import client.MapleCharacter;
import client.MapleClient;
import client.inventory.Equip;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import constants.inventory.ItemConstants;
import net.AbstractMaplePacketHandler;
import net.server.Server;
import net.server.channel.Channel;
import server.MTSItemInfo;
import server.MapleItemInformationProvider;
import tools.DatabaseConnection;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.data.input.SeekableLittleEndianAccessor;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -29,23 +46,6 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import net.AbstractMaplePacketHandler;
import net.server.Server;
import net.server.channel.Channel;
import server.MTSItemInfo;
import client.inventory.manipulator.MapleInventoryManipulator;
import server.MapleItemInformationProvider;
import tools.DatabaseConnection;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.data.input.SeekableLittleEndianAccessor;
import client.MapleCharacter;
import client.MapleClient;
import client.inventory.Equip;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import constants.inventory.ItemConstants;
public final class MTSHandler extends AbstractMaplePacketHandler { public final class MTSHandler extends AbstractMaplePacketHandler {
@Override @Override
@@ -159,10 +159,10 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
date += day + ""; date += day + "";
} }
if (!i.getInventoryType().equals(MapleInventoryType.EQUIP)) { if (!i.getInventoryType().equals(MapleInventoryType.EQUIP)) {
Item item = (Item) i; Item item = i;
ps = con.prepareStatement("INSERT INTO mts_items (tab, type, itemid, quantity, expiration, giftFrom, seller, price, owner, sellername, sell_ends) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); ps = con.prepareStatement("INSERT INTO mts_items (tab, type, itemid, quantity, expiration, giftFrom, seller, price, owner, sellername, sell_ends) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setInt(1, 1); ps.setInt(1, 1);
ps.setInt(2, (int) invType.getType()); ps.setInt(2, invType.getType());
ps.setInt(3, item.getItemId()); ps.setInt(3, item.getItemId());
ps.setInt(4, quantity); ps.setInt(4, quantity);
ps.setLong(5, item.getExpiration()); ps.setLong(5, item.getExpiration());
@@ -176,7 +176,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
Equip equip = (Equip) i; Equip equip = (Equip) i;
ps = con.prepareStatement("INSERT INTO mts_items (tab, type, itemid, quantity, expiration, giftFrom, seller, price, upgradeslots, level, str, dex, `int`, luk, hp, mp, watk, matk, wdef, mdef, acc, avoid, hands, speed, jump, locked, owner, sellername, sell_ends, vicious, flag, itemexp, itemlevel, ringid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); ps = con.prepareStatement("INSERT INTO mts_items (tab, type, itemid, quantity, expiration, giftFrom, seller, price, upgradeslots, level, str, dex, `int`, luk, hp, mp, watk, matk, wdef, mdef, acc, avoid, hands, speed, jump, locked, owner, sellername, sell_ends, vicious, flag, itemexp, itemlevel, ringid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
ps.setInt(1, 1); ps.setInt(1, 1);
ps.setInt(2, (int) invType.getType()); ps.setInt(2, invType.getType());
ps.setInt(3, equip.getItemId()); ps.setInt(3, equip.getItemId());
ps.setInt(4, quantity); ps.setInt(4, quantity);
ps.setLong(5, equip.getExpiration()); ps.setLong(5, equip.getExpiration());
@@ -557,7 +557,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
if (rs.getInt("type") != 1) { if (rs.getInt("type") != 1) {
Item i = new Item(rs.getInt("itemid"), (byte) 0, (short) rs.getInt("quantity")); Item i = new Item(rs.getInt("itemid"), (byte) 0, (short) rs.getInt("quantity"));
i.setOwner(rs.getString("owner")); i.setOwner(rs.getString("owner"));
items.add(new MTSItemInfo((Item) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
equip.setOwner(rs.getString("owner")); equip.setOwner(rs.getString("owner"));
@@ -586,7 +586,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
equip.setRingId(rs.getInt("ringid")); equip.setRingId(rs.getInt("ringid"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
rs.close(); rs.close();
@@ -617,7 +617,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
if (rse.getInt("type") != 1) { if (rse.getInt("type") != 1) {
Item i = new Item(rse.getInt("itemid"), (short) 0, (short) rse.getInt("quantity")); Item i = new Item(rse.getInt("itemid"), (short) 0, (short) rse.getInt("quantity"));
i.setOwner(rse.getString("owner")); i.setOwner(rse.getString("owner"));
items.add(new MTSItemInfo((Item) i, rse.getInt("price"), rse.getInt("id"), rse.getInt("seller"), rse.getString("sellername"), rse.getString("sell_ends"))); items.add(new MTSItemInfo(i, rse.getInt("price"), rse.getInt("id"), rse.getInt("seller"), rse.getString("sellername"), rse.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rse.getInt("itemid"), (byte) rse.getInt("position"), -1); Equip equip = new Equip(rse.getInt("itemid"), (byte) rse.getInt("position"), -1);
equip.setOwner(rse.getString("owner")); equip.setOwner(rse.getString("owner"));
@@ -646,7 +646,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
equip.setFlag((short) rs.getInt("flag")); equip.setFlag((short) rs.getInt("flag"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rse.getInt("price"), rse.getInt("id"), rse.getInt("seller"), rse.getString("sellername"), rse.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rse.getInt("price"), rse.getInt("id"), rse.getInt("seller"), rse.getString("sellername"), rse.getString("sell_ends")));
} }
} }
} }
@@ -685,7 +685,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
if (rs.getInt("type") != 1) { if (rs.getInt("type") != 1) {
Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity"));
i.setOwner(rs.getString("owner")); i.setOwner(rs.getString("owner"));
items.add(new MTSItemInfo((Item) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
equip.setOwner(rs.getString("owner")); equip.setOwner(rs.getString("owner"));
@@ -714,7 +714,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
equip.setFlag((short) rs.getInt("flag")); equip.setFlag((short) rs.getInt("flag"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
rs.close(); rs.close();
@@ -751,7 +751,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
if (rs.getInt("type") != 1) { if (rs.getInt("type") != 1) {
Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity"));
i.setOwner(rs.getString("owner")); i.setOwner(rs.getString("owner"));
items.add(new MTSItemInfo((Item) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
equip.setOwner(rs.getString("owner")); equip.setOwner(rs.getString("owner"));
@@ -780,7 +780,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
equip.setFlag((short) rs.getInt("flag")); equip.setFlag((short) rs.getInt("flag"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
rs.close(); rs.close();
@@ -850,7 +850,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
if (rs.getInt("type") != 1) { if (rs.getInt("type") != 1) {
Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity")); Item i = new Item(rs.getInt("itemid"), (short) 0, (short) rs.getInt("quantity"));
i.setOwner(rs.getString("owner")); i.setOwner(rs.getString("owner"));
items.add(new MTSItemInfo((Item) i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(i, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} else { } else {
Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1); Equip equip = new Equip(rs.getInt("itemid"), (byte) rs.getInt("position"), -1);
equip.setOwner(rs.getString("owner")); equip.setOwner(rs.getString("owner"));
@@ -879,7 +879,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
equip.setFlag((short) rs.getInt("flag")); equip.setFlag((short) rs.getInt("flag"));
equip.setExpiration(rs.getLong("expiration")); equip.setExpiration(rs.getLong("expiration"));
equip.setGiftFrom(rs.getString("giftFrom")); equip.setGiftFrom(rs.getString("giftFrom"));
items.add(new MTSItemInfo((Item) equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends"))); items.add(new MTSItemInfo(equip, rs.getInt("price"), rs.getInt("id"), rs.getInt("seller"), rs.getString("sellername"), rs.getString("sell_ends")));
} }
} }
rs.close(); rs.close();

View File

@@ -23,9 +23,9 @@ package net.server.channel.handlers;
import client.MapleCharacter; import client.MapleCharacter;
import client.MapleClient; import client.MapleClient;
import client.inventory.MaplePet;
import client.inventory.PetCommand; import client.inventory.PetCommand;
import client.inventory.PetDataFactory; import client.inventory.PetDataFactory;
import client.inventory.MaplePet;
import net.AbstractMaplePacketHandler; import net.AbstractMaplePacketHandler;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
import tools.Randomizer; import tools.Randomizer;
@@ -47,7 +47,7 @@ public final class PetCommandHandler extends AbstractMaplePacketHandler {
slea.readInt(); slea.readInt();
slea.readByte(); slea.readByte();
byte command = slea.readByte(); byte command = slea.readByte();
PetCommand petCommand = PetDataFactory.getPetCommand(pet.getItemId(), (int) command); PetCommand petCommand = PetDataFactory.getPetCommand(pet.getItemId(), command);
if (petCommand == null) { if (petCommand == null) {
return; return;
} }

View File

@@ -1,20 +1,20 @@
package net.server.channel.handlers; package net.server.channel.handlers;
import java.util.Map;
import client.MapleCharacter; import client.MapleCharacter;
import client.MapleClient; import client.MapleClient;
import client.MapleQuestStatus; import client.MapleQuestStatus;
import client.inventory.MapleInventory; import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType; import client.inventory.MapleInventoryType;
import net.AbstractMaplePacketHandler;
import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleInventoryManipulator;
import net.AbstractMaplePacketHandler;
import server.MapleItemInformationProvider; import server.MapleItemInformationProvider;
import server.MapleItemInformationProvider.QuestConsItem; import server.MapleItemInformationProvider.QuestConsItem;
import server.quest.MapleQuest; import server.quest.MapleQuest;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor; import tools.data.input.SeekableLittleEndianAccessor;
import java.util.Map;
/** /**
* *
* @author Xari * @author Xari
@@ -55,7 +55,7 @@ public class RaiseIncExpHandler extends AbstractMaplePacketHandler {
return; return;
} }
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.getByType(inventorytype), (short) slot, (short) 1, false, true); MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.getByType(inventorytype), slot, (short) 1, false, true);
} finally { } finally {
inv.unlockInventory(); inv.unlockInventory();
} }

View File

@@ -21,26 +21,23 @@
*/ */
package net.server.channel.handlers; package net.server.channel.handlers;
import client.MapleClient;
import client.MapleCharacter; import client.MapleCharacter;
import client.MapleClient;
import client.Skill; import client.Skill;
import client.SkillFactory; import client.SkillFactory;
import client.inventory.Equip; import client.inventory.*;
import client.inventory.Equip.ScrollResult; import client.inventory.Equip.ScrollResult;
import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.ModifyInventory;
import constants.inventory.ItemConstants;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.AbstractMaplePacketHandler;
import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleInventoryManipulator;
import constants.inventory.ItemConstants;
import net.AbstractMaplePacketHandler;
import server.MapleItemInformationProvider; import server.MapleItemInformationProvider;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor; import tools.data.input.SeekableLittleEndianAccessor;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* @author Matze * @author Matze
* @author Frz * @author Frz
@@ -81,7 +78,7 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
announceCannotScroll(c, legendarySpirit); announceCannotScroll(c, legendarySpirit);
return; return;
} }
} else if (!ItemConstants.isModifierScroll(scroll.getItemId()) && ((Equip) toScroll).getUpgradeSlots() < 1) { } else if (!ItemConstants.isModifierScroll(scroll.getItemId()) && toScroll.getUpgradeSlots() < 1) {
announceCannotScroll(c, legendarySpirit); // thanks onechord for noticing zero upgrade slots freezing Legendary Scroll UI announceCannotScroll(c, legendarySpirit); // thanks onechord for noticing zero upgrade slots freezing Legendary Scroll UI
return; return;
} }

View File

@@ -28,13 +28,14 @@ import client.SkillFactory;
import client.inventory.Item; import client.inventory.Item;
import client.inventory.MapleInventory; import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType; import client.inventory.MapleInventoryType;
import java.util.Map;
import net.AbstractMaplePacketHandler;
import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleInventoryManipulator;
import net.AbstractMaplePacketHandler;
import server.MapleItemInformationProvider; import server.MapleItemInformationProvider;
import tools.MaplePacketCreator; import tools.MaplePacketCreator;
import tools.data.input.SeekableLittleEndianAccessor; import tools.data.input.SeekableLittleEndianAccessor;
import java.util.Map;
public final class SkillBookHandler extends AbstractMaplePacketHandler { public final class SkillBookHandler extends AbstractMaplePacketHandler {
@Override @Override
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
@@ -44,7 +45,7 @@ public final class SkillBookHandler extends AbstractMaplePacketHandler {
} }
slea.readInt(); slea.readInt();
short slot = (short) slea.readShort(); short slot = slea.readShort();
int itemId = slea.readInt(); int itemId = slea.readInt();
boolean canuse; boolean canuse;

View File

@@ -21,35 +21,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.server.channel.handlers; package net.server.channel.handlers;
import client.MapleBuffStat; import client.*;
import client.MapleCharacter;
import client.MapleClient;
import client.Skill;
import client.SkillFactory;
import client.inventory.Item; import client.inventory.Item;
import client.inventory.MapleInventory; import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType; import client.inventory.MapleInventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.status.MonsterStatus; import client.status.MonsterStatus;
import client.status.MonsterStatusEffect; import client.status.MonsterStatusEffect;
import config.YamlConfig; import config.YamlConfig;
import constants.game.GameConstants; import constants.game.GameConstants;
import constants.inventory.ItemConstants; import constants.inventory.ItemConstants;
import constants.skills.Aran; import constants.skills.Aran;
import java.awt.Point;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import net.AbstractMaplePacketHandler; import net.AbstractMaplePacketHandler;
import client.inventory.manipulator.MapleInventoryManipulator;
import server.MapleStatEffect; import server.MapleStatEffect;
import server.life.MapleLifeFactory.loseItem; import server.life.MapleLifeFactory.loseItem;
import server.life.MapleMonster; import server.life.*;
import server.life.MobAttackInfo;
import server.life.MobAttackInfoFactory;
import server.life.MobSkill;
import server.life.MobSkillFactory;
import server.maps.MapleMap; import server.maps.MapleMap;
import server.maps.MapleMapObject; import server.maps.MapleMapObject;
import tools.FilePrinter; import tools.FilePrinter;
@@ -57,6 +43,11 @@ import tools.MaplePacketCreator;
import tools.Randomizer; import tools.Randomizer;
import tools.data.input.SeekableLittleEndianAccessor; import tools.data.input.SeekableLittleEndianAccessor;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public final class TakeDamageHandler extends AbstractMaplePacketHandler { public final class TakeDamageHandler extends AbstractMaplePacketHandler {
@Override @Override
@@ -128,7 +119,7 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
} }
for (byte b = 0; b < qty; b++) { for (byte b = 0; b < qty; b++) {
pos.x = (int) (playerpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2)))); pos.x = playerpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2)));
map.spawnItemDrop(chr, chr, new Item(loseItem.getId(), (short) 0, (short) 1), map.calcDropPos(pos, chr.getPosition()), true, true); map.spawnItemDrop(chr, chr, new Item(loseItem.getId(), (short) 0, (short) 1), map.calcDropPos(pos, chr.getPosition()), true, true);
d++; d++;
} }

View File

@@ -31,7 +31,7 @@ public class Service <T extends BaseService> {
public Service(Class<T> s) { public Service(Class<T> s) {
try { try {
cls = s; cls = s;
service = (BaseService) cls.getConstructor().newInstance(); service = cls.getConstructor().newInstance();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -574,7 +574,7 @@ public class World {
public Collection<MapleFamily> getFamilies() { public Collection<MapleFamily> getFamilies() {
synchronized(families) { synchronized(families) {
return Collections.unmodifiableCollection((Collection<MapleFamily>) families.values()); return Collections.unmodifiableCollection(families.values());
} }
} }
@@ -1832,7 +1832,7 @@ public class World {
List<MaplePlayerShopItem> itemBundles = hm.sendAvailableBundles(itemid); List<MaplePlayerShopItem> itemBundles = hm.sendAvailableBundles(itemid);
for(MaplePlayerShopItem mpsi : itemBundles) { for(MaplePlayerShopItem mpsi : itemBundles) {
hmsAvailable.add(new Pair<>(mpsi, (AbstractMapleMapObject) hm)); hmsAvailable.add(new Pair<>(mpsi, hm));
} }
} }
@@ -1840,7 +1840,7 @@ public class World {
List<MaplePlayerShopItem> itemBundles = ps.sendAvailableBundles(itemid); List<MaplePlayerShopItem> itemBundles = ps.sendAvailableBundles(itemid);
for(MaplePlayerShopItem mpsi : itemBundles) { for(MaplePlayerShopItem mpsi : itemBundles) {
hmsAvailable.add(new Pair<>(mpsi, (AbstractMapleMapObject) ps)); hmsAvailable.add(new Pair<>(mpsi, ps));
} }
} }

View File

@@ -104,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -173,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -642,7 +642,7 @@ public class AbstractPlayerInteraction {
if (randomStats) { if (randomStats) {
MapleInventoryManipulator.addFromDrop(c, ii.randomizeStats((Equip) item), false, petId); MapleInventoryManipulator.addFromDrop(c, ii.randomizeStats((Equip) item), false, petId);
} else { } else {
MapleInventoryManipulator.addFromDrop(c, (Equip) item, false, petId); MapleInventoryManipulator.addFromDrop(c, item, false, petId);
} }
} else { } else {
MapleInventoryManipulator.addFromDrop(c, item, false, petId); MapleInventoryManipulator.addFromDrop(c, item, false, petId);

View File

@@ -169,7 +169,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
byte p = 1; byte p = 1;
for (ReactorDropEntry d : items) { for (ReactorDropEntry d : items) {
dropPos.x = (int) (posX + ((p % 2 == 0) ? (25 * ((p + 1) / 2)) : -(25 * (p / 2)))); dropPos.x = posX + ((p % 2 == 0) ? (25 * ((p + 1) / 2)) : -(25 * (p / 2)));
p++; p++;
if (d.itemId == 0) { if (d.itemId == 0) {

View File

@@ -193,7 +193,7 @@ public class MapleShop {
return; return;
} }
Item item = c.getPlayer().getInventory(type).getItem((short) slot); Item item = c.getPlayer().getInventory(type).getItem(slot);
if(canSell(item, quantity)) { if(canSell(item, quantity)) {
quantity = getSellingQuantity(item, quantity); quantity = getSellingQuantity(item, quantity);
MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false); MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);

View File

@@ -955,7 +955,7 @@ public class MapleStatEffect {
if (projectile == null) { if (projectile == null) {
return false; return false;
} else { } else {
MapleInventoryManipulator.removeFromSlot(applyto.getClient(), MapleInventoryType.USE, projectile.getPosition(), (short) projectileConsume, false, true); MapleInventoryManipulator.removeFromSlot(applyto.getClient(), MapleInventoryType.USE, projectile.getPosition(), projectileConsume, false, true);
} }
} finally { } finally {
use.unlockInventory(); use.unlockInventory();

View File

@@ -19,19 +19,13 @@
*/ */
package server; package server;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import config.YamlConfig;
import constants.inventory.ItemConstants;
import client.MapleClient; import client.MapleClient;
import client.inventory.Equip; import client.inventory.Equip;
import client.inventory.Item; import client.inventory.Item;
import java.util.ArrayList; import config.YamlConfig;
import constants.inventory.ItemConstants;
import java.util.*;
/** /**
* *
@@ -128,7 +122,7 @@ class PairedQuicksort {
if (i <= j) { if (i <= j) {
w = (Equip)A.get(i); w = (Equip)A.get(i);
A.set(i, A.get(j)); A.set(i, A.get(j));
A.set(j, (Item)w); A.set(j, w);
i++; i++;
j--; j--;
@@ -221,8 +215,8 @@ public class MapleStorageInventory {
} }
private void move(short sSlot, short dSlot, short slotMax) { private void move(short sSlot, short dSlot, short slotMax) {
Item source = (Item) inventory.get(sSlot); Item source = inventory.get(sSlot);
Item target = (Item) inventory.get(dSlot); Item target = inventory.get(dSlot);
if (source == null) { if (source == null) {
return; return;
} }
@@ -350,7 +344,7 @@ public class MapleStorageInventory {
for (short i = 1; i <= this.getSlotLimit(); i++) { for (short i = 1; i <= this.getSlotLimit(); i++) {
Item item = this.getItem(i); Item item = this.getItem(i);
if (item != null) { if (item != null) {
itemarray.add((Item) item.copy()); itemarray.add(item.copy());
} }
} }

View File

@@ -839,7 +839,7 @@ public class MapleMonster extends AbstractLoadedMapleLife {
MapleMap map = m.getMap(); MapleMap map = m.getMap();
List<MapleCharacter> chrList = map.getAllPlayers(); List<MapleCharacter> chrList = map.getAllPlayers();
if (!chrList.isEmpty()) { if (!chrList.isEmpty()) {
MapleCharacter chr = (MapleCharacter) chrList.get(0); MapleCharacter chr = chrList.get(0);
EventInstanceManager eim = map.getEventInstance(); EventInstanceManager eim = map.getEventInstance();
if (eim != null) { if (eim != null) {

View File

@@ -277,7 +277,7 @@ public class MobSkill {
case 8510100: //Pianus bomb case 8510100: //Pianus bomb
if (Math.ceil(Math.random() * 5) == 1) { if (Math.ceil(Math.random() * 5) == 1) {
ypos = 78; ypos = 78;
xpos = (int) Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0); xpos = Randomizer.nextInt(5) + (Randomizer.nextInt(2) == 1 ? 180 : 0);
} else { } else {
xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500); xpos = (int) (monster.getPosition().getX() + Randomizer.nextInt(1000) - 500);
} }

View File

@@ -629,9 +629,9 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
short newBundle = pItems.getBundles(); short newBundle = pItems.getBundles();
if (shutdown) { //is "shutdown" really necessary? if (shutdown) { //is "shutdown" really necessary?
newItem.setQuantity((short) (pItems.getItem().getQuantity())); newItem.setQuantity(pItems.getItem().getQuantity());
} else { } else {
newItem.setQuantity((short) (pItems.getItem().getQuantity())); newItem.setQuantity(pItems.getItem().getQuantity());
} }
if (newBundle > 0) { if (newBundle > 0) {
itemsWithType.add(new Pair<>(newItem, newItem.getInventoryType())); itemsWithType.add(new Pair<>(newItem, newItem.getInventoryType()));

View File

@@ -597,7 +597,7 @@ public class MapleMap {
*/ */
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(( (angle % 360) / 45)) ];
} }
public Pair<String, Integer> getDoorPositionStatus(Point pos) { public Pair<String, Integer> getDoorPositionStatus(Point pos) {
@@ -646,9 +646,9 @@ public class MapleMap {
if (Randomizer.nextInt(999999) < dropChance) { if (Randomizer.nextInt(999999) < dropChance) {
if (droptype == 3) { if (droptype == 3) {
pos.x = (int) (mobpos + ((d % 2 == 0) ? (40 * ((d + 1) / 2)) : -(40 * (d / 2)))); pos.x = mobpos + ((d % 2 == 0) ? (40 * ((d + 1) / 2)) : -(40 * (d / 2)));
} else { } else {
pos.x = (int) (mobpos + ((d % 2 == 0) ? (25 * ((d + 1) / 2)) : -(25 * (d / 2)))); pos.x = mobpos + ((d % 2 == 0) ? (25 * ((d + 1) / 2)) : -(25 * (d / 2)));
} }
if (de.itemId == 0) { // meso if (de.itemId == 0) { // meso
int mesos = Randomizer.nextInt(de.Maximum - de.Minimum) + de.Minimum; int mesos = Randomizer.nextInt(de.Maximum - de.Minimum) + de.Minimum;
@@ -688,9 +688,9 @@ public class MapleMap {
for (final MonsterGlobalDropEntry de : globalEntry) { for (final MonsterGlobalDropEntry de : globalEntry) {
if (Randomizer.nextInt(999999) < de.chance) { if (Randomizer.nextInt(999999) < de.chance) {
if (droptype == 3) { if (droptype == 3) {
pos.x = (int) (mobpos + (d % 2 == 0 ? (40 * (d + 1) / 2) : -(40 * (d / 2)))); pos.x = mobpos + (d % 2 == 0 ? (40 * (d + 1) / 2) : -(40 * (d / 2)));
} else { } else {
pos.x = (int) (mobpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2)))); pos.x = mobpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2)));
} }
if (de.itemId != 0) { if (de.itemId != 0) {
if (ItemConstants.getInventoryType(de.itemId) == MapleInventoryType.EQUIP) { if (ItemConstants.getInventoryType(de.itemId) == MapleInventoryType.EQUIP) {
@@ -890,7 +890,7 @@ public class MapleMap {
objectWLock.lock(); objectWLock.lock();
try { try {
registerItemDrop(mdrop); registerItemDrop(mdrop);
registeredDrops.add(new WeakReference<>((MapleMapObject) mdrop)); registeredDrops.add(new WeakReference<>(mdrop));
} finally { } finally {
objectWLock.unlock(); objectWLock.unlock();
} }
@@ -1606,13 +1606,13 @@ public class MapleMap {
try { try {
for (MapleMapObject o : mapobjects.values()) { for (MapleMapObject o : mapobjects.values()) {
if (o.getType() == MapleMapObjectType.REACTOR) { if (o.getType() == MapleMapObjectType.REACTOR) {
points.add(((MapleReactor) o).getPosition()); points.add(o.getPosition());
} }
} }
Collections.shuffle(points); Collections.shuffle(points);
for (MapleMapObject o : mapobjects.values()) { for (MapleMapObject o : mapobjects.values()) {
if (o.getType() == MapleMapObjectType.REACTOR) { if (o.getType() == MapleMapObjectType.REACTOR) {
((MapleReactor) o).setPosition(points.remove(points.size() - 1)); o.setPosition(points.remove(points.size() - 1));
} }
} }
} finally { } finally {
@@ -2097,7 +2097,7 @@ public class MapleMap {
if (mist.makeChanceResult()) { if (mist.makeChanceResult()) {
MapleCharacter chr = (MapleCharacter) mo; MapleCharacter chr = (MapleCharacter) mo;
if (mist.getOwner().getId() == chr.getId() || mist.getOwner().getParty() != null && mist.getOwner().getParty().containsMembers(chr.getMPC())) { if (mist.getOwner().getId() == chr.getId() || mist.getOwner().getParty() != null && mist.getOwner().getParty().containsMembers(chr.getMPC())) {
chr.addMP((int) mist.getSourceSkill().getEffect(chr.getSkillLevel(mist.getSourceSkill().getId())).getX() * chr.getMp() / 100); chr.addMP(mist.getSourceSkill().getEffect(chr.getSkillLevel(mist.getSourceSkill().getId())).getX() * chr.getMp() / 100);
} }
} }
} }

View File

@@ -423,7 +423,7 @@ public class BCrypt {
if ((int) x < 0 || (int) x > index_64.length) { if ((int) x < 0 || (int) x > index_64.length) {
return -1; return -1;
} }
return index_64[(int) x]; return index_64[x];
} }
/** /**
@@ -566,8 +566,8 @@ public class BCrypt {
* Initialise the Blowfish key schedule * Initialise the Blowfish key schedule
*/ */
private void init_key() { private void init_key() {
P = (int[]) P_orig.clone(); P = P_orig.clone();
S = (int[]) S_orig.clone(); S = S_orig.clone();
} }
/** /**
@@ -797,7 +797,7 @@ public class BCrypt {
hashed = B.crypt_raw(passwordb, saltb, rounds, hashed = B.crypt_raw(passwordb, saltb, rounds,
minor == 'x', // true for sign extension bug ('2x') minor == 'x', // true for sign extension bug ('2x')
minor == 'a' ? 0x10000 : 0, // safety factor for '2a' minor == 'a' ? 0x10000 : 0, // safety factor for '2a'
(int[])bf_crypt_ciphertext.clone()); bf_crypt_ciphertext.clone());
rs.append("$2"); rs.append("$2");
if (minor >= 'a') { if (minor >= 'a') {

View File

@@ -19,9 +19,6 @@
*/ */
package tools; package tools;
import java.awt.geom.Line2D;
import java.util.ArrayList;
import java.util.List;
import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.MonitoredReadLock; import net.server.audit.locks.MonitoredReadLock;
import net.server.audit.locks.MonitoredReentrantReadWriteLock; import net.server.audit.locks.MonitoredReentrantReadWriteLock;
@@ -29,6 +26,10 @@ import net.server.audit.locks.MonitoredWriteLock;
import net.server.audit.locks.factory.MonitoredReadLockFactory; import net.server.audit.locks.factory.MonitoredReadLockFactory;
import net.server.audit.locks.factory.MonitoredWriteLockFactory; import net.server.audit.locks.factory.MonitoredWriteLockFactory;
import java.awt.geom.Line2D;
import java.util.ArrayList;
import java.util.List;
/** /**
* *
* @author Ronan * @author Ronan
@@ -65,7 +66,7 @@ public class IntervalBuilder {
newLimitX2 = newTo; newLimitX2 = newTo;
} }
intervalLimits.add(st, new Line2D.Float((float) newLimitX1, 0, (float) newLimitX2, 0)); intervalLimits.add(st, new Line2D.Float(newLimitX1, 0, newLimitX2, 0));
} }
private int bsearchInterval(int point) { private int bsearchInterval(int point) {

View File

@@ -450,9 +450,9 @@ public class MaplePacketCreator {
List<Item> equippedCash = new ArrayList<>(equippedC.size()); List<Item> equippedCash = new ArrayList<>(equippedC.size());
for (Item item : equippedC) { for (Item item : equippedC) {
if (item.getPosition() <= -100) { if (item.getPosition() <= -100) {
equippedCash.add((Item) item); equippedCash.add(item);
} else { } else {
equipped.add((Item) item); equipped.add(item);
} }
} }
for (Item item : equipped) { // equipped doesn't actually need sorting, thanks Pllsz for (Item item : equipped) { // equipped doesn't actually need sorting, thanks Pllsz

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -21,45 +21,10 @@
*/ */
package tools; package tools;
import java.io.File; import provider.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
//import net.server.Server; import java.io.File;
import provider.MapleData; import java.util.*;
import provider.MapleDataDirectoryEntry;
import provider.MapleDataFileEntry;
import provider.MapleDataProvider;
import provider.MapleDataProviderFactory;
import provider.MapleDataTool;
import tools.DatabaseConnection;
//import tools.MaplePacketCreator;
import tools.Pair;
//import client.MapleCharacter;
//import client.MapleClient;
//import client.MapleJob;
//import client.Skill;
//import client.SkillFactory;
//import client.autoban.AutobanFactory;
//import client.inventory.Equip;
//import client.inventory.Item;
//import client.inventory.MapleInventory;
//import client.inventory.MapleInventoryType;
//import client.inventory.MapleWeaponType;
//import constants.ServerConstants;
//import constants.EquipSlot;
//import constants.ItemConstants;
//import constants.skills.Assassin;
//import constants.skills.Gunslinger;
//import constants.skills.NightWalker;
import java.sql.Connection;
//import server.life.MapleMonsterInformationProvider; //import server.life.MapleMonsterInformationProvider;
/** /**
@@ -311,7 +276,7 @@ public class MapleItemInformationProvider {
public short getSlotMax(int itemId) { public short getSlotMax(int itemId) {
Short slotMax = slotMaxCache.get(itemId); Short slotMax = slotMaxCache.get(itemId);
if (slotMax != null) { if (slotMax != null) {
return (short)(slotMax); return slotMax;
} }
short ret = 0; short ret = 0;
MapleData item = getItemData(itemId); MapleData item = getItemData(itemId);
@@ -325,7 +290,7 @@ public class MapleItemInformationProvider {
} }
slotMaxCache.put(itemId, ret); slotMaxCache.put(itemId, ret);
return (short)(ret); return ret;
} }
public int getMeso(int itemId) { public int getMeso(int itemId) {
@@ -378,7 +343,7 @@ public class MapleItemInformationProvider {
try { try {
pEntry = MapleDataTool.getDouble(pData); pEntry = MapleDataTool.getDouble(pData);
} catch (Exception e) { } catch (Exception e) {
pEntry = (double) MapleDataTool.getInt(pData); pEntry = MapleDataTool.getInt(pData);
} }
} else { } else {
pData = item.getChildByPath("info/price"); pData = item.getChildByPath("info/price");
@@ -386,7 +351,7 @@ public class MapleItemInformationProvider {
return -1; return -1;
} }
try { try {
pEntry = (double) MapleDataTool.getInt(pData); pEntry = MapleDataTool.getInt(pData);
} catch(Exception e) { } catch(Exception e) {
priceCache.put(itemId, 0.0); priceCache.put(itemId, 0.0);
return 0; return 0;

View File

@@ -19,25 +19,9 @@
*/ */
package maplegachaponitemidretriever; package maplegachaponitemidretriever;
import java.util.ArrayList; import java.io.*;
import java.util.List; import java.sql.*;
import java.util.LinkedList; import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -168,7 +152,7 @@ public class MapleGachaponItemidRetriever {
@Override @Override
public int hashCode() { public int hashCode() {
int result = (int) (prop ^ (prop >>> 32)); int result = prop ^ (prop >>> 32);
result = 31 * result + (header != null ? header.hashCode() : 0); result = 31 * result + (header != null ? header.hashCode() : 0);
result = 31 * result + (target != null ? target.hashCode() : 0); result = 31 * result + (target != null ? target.hashCode() : 0);
result = 31 * result + (buff != null ? buff.hashCode() : 0); result = 31 * result + (buff != null ? buff.hashCode() : 0);

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -21,45 +21,14 @@
*/ */
package tools; package tools;
import provider.*;
import java.io.File; import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
//import net.server.Server;
import provider.MapleData;
import provider.MapleDataDirectoryEntry;
import provider.MapleDataFileEntry;
import provider.MapleDataProvider;
import provider.MapleDataProviderFactory;
import provider.MapleDataTool;
import tools.DatabaseConnection;
//import tools.MaplePacketCreator;
import tools.Pair;
//import client.MapleCharacter;
//import client.MapleClient;
//import client.MapleJob;
//import client.Skill;
//import client.SkillFactory;
//import client.autoban.AutobanFactory;
//import client.inventory.Equip;
//import client.inventory.Item;
//import client.inventory.MapleInventory;
//import client.inventory.MapleInventoryType;
//import client.inventory.MapleWeaponType;
//import constants.ServerConstants;
//import constants.EquipSlot;
//import constants.ItemConstants;
//import constants.skills.Assassin;
//import constants.skills.Gunslinger;
//import constants.skills.NightWalker;
import java.sql.Connection;
//import server.life.MapleMonsterInformationProvider; //import server.life.MapleMonsterInformationProvider;
/** /**
@@ -313,7 +282,7 @@ public class MapleItemInformationProvider {
public short getSlotMax(int itemId) { public short getSlotMax(int itemId) {
Short slotMax = slotMaxCache.get(itemId); Short slotMax = slotMaxCache.get(itemId);
if (slotMax != null) { if (slotMax != null) {
return (short)(slotMax); return slotMax;
} }
short ret = 0; short ret = 0;
MapleData item = getItemData(itemId); MapleData item = getItemData(itemId);
@@ -327,7 +296,7 @@ public class MapleItemInformationProvider {
} }
slotMaxCache.put(itemId, ret); slotMaxCache.put(itemId, ret);
return (short)(ret); return ret;
} }
public int getMeso(int itemId) { public int getMeso(int itemId) {
@@ -380,7 +349,7 @@ public class MapleItemInformationProvider {
try { try {
pEntry = MapleDataTool.getDouble(pData); pEntry = MapleDataTool.getDouble(pData);
} catch (Exception e) { } catch (Exception e) {
pEntry = (double) MapleDataTool.getInt(pData); pEntry = MapleDataTool.getInt(pData);
} }
} else { } else {
pData = item.getChildByPath("info/price"); pData = item.getChildByPath("info/price");
@@ -388,7 +357,7 @@ public class MapleItemInformationProvider {
return -1; return -1;
} }
try { try {
pEntry = (double) MapleDataTool.getInt(pData); pEntry = MapleDataTool.getInt(pData);
} catch(Exception e) { } catch(Exception e) {
priceCache.put(itemId, 0.0); priceCache.put(itemId, 0.0);
return 0; return 0;

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }

View File

@@ -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
@@ -103,7 +104,7 @@ public class WZTool {
if (b == 0x7F) { if (b == 0x7F) {
strLength = llea.readInt(); strLength = llea.readInt();
} else { } else {
strLength = (int) b; strLength = b;
} }
if (strLength < 0) { if (strLength < 0) {
return ""; return "";
@@ -172,7 +173,7 @@ public class WZTool {
if (b == -128) { if (b == -128) {
return lea.readInt(); return lea.readInt();
} else { } else {
return ((int) b); return b;
} }
} }