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

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

View File

@@ -955,7 +955,7 @@ public class MapleStatEffect {
if (projectile == null) {
return false;
} 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 {
use.unlockInventory();

View File

@@ -19,19 +19,13 @@
*/
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.inventory.Equip;
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) {
w = (Equip)A.get(i);
A.set(i, A.get(j));
A.set(j, (Item)w);
A.set(j, w);
i++;
j--;
@@ -221,8 +215,8 @@ public class MapleStorageInventory {
}
private void move(short sSlot, short dSlot, short slotMax) {
Item source = (Item) inventory.get(sSlot);
Item target = (Item) inventory.get(dSlot);
Item source = inventory.get(sSlot);
Item target = inventory.get(dSlot);
if (source == null) {
return;
}
@@ -350,7 +344,7 @@ public class MapleStorageInventory {
for (short i = 1; i <= this.getSlotLimit(); i++) {
Item item = this.getItem(i);
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();
List<MapleCharacter> chrList = map.getAllPlayers();
if (!chrList.isEmpty()) {
MapleCharacter chr = (MapleCharacter) chrList.get(0);
MapleCharacter chr = chrList.get(0);
EventInstanceManager eim = map.getEventInstance();
if (eim != null) {

View File

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

View File

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

View File

@@ -597,7 +597,7 @@ public class MapleMap {
*/
public static String getRoundedCoordinate(double angle) {
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) {
@@ -646,9 +646,9 @@ public class MapleMap {
if (Randomizer.nextInt(999999) < dropChance) {
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 {
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
int mesos = Randomizer.nextInt(de.Maximum - de.Minimum) + de.Minimum;
@@ -688,9 +688,9 @@ public class MapleMap {
for (final MonsterGlobalDropEntry de : globalEntry) {
if (Randomizer.nextInt(999999) < de.chance) {
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 {
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 (ItemConstants.getInventoryType(de.itemId) == MapleInventoryType.EQUIP) {
@@ -890,7 +890,7 @@ public class MapleMap {
objectWLock.lock();
try {
registerItemDrop(mdrop);
registeredDrops.add(new WeakReference<>((MapleMapObject) mdrop));
registeredDrops.add(new WeakReference<>(mdrop));
} finally {
objectWLock.unlock();
}
@@ -1606,13 +1606,13 @@ public class MapleMap {
try {
for (MapleMapObject o : mapobjects.values()) {
if (o.getType() == MapleMapObjectType.REACTOR) {
points.add(((MapleReactor) o).getPosition());
points.add(o.getPosition());
}
}
Collections.shuffle(points);
for (MapleMapObject o : mapobjects.values()) {
if (o.getType() == MapleMapObjectType.REACTOR) {
((MapleReactor) o).setPosition(points.remove(points.size() - 1));
o.setPosition(points.remove(points.size() - 1));
}
}
} finally {
@@ -2097,7 +2097,7 @@ public class MapleMap {
if (mist.makeChanceResult()) {
MapleCharacter chr = (MapleCharacter) mo;
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);
}
}
}