Rename and clean up MapleMapItem
This commit is contained in:
@@ -1501,14 +1501,14 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
|
||||
MapleMap map = this.getMap();
|
||||
List<MapleMapItem> partyItems = null;
|
||||
List<MapItem> partyItems = null;
|
||||
|
||||
int partyId = exPartyMembers != null ? -1 : this.getPartyId();
|
||||
for (WeakReference<MapleMap> mapRef : mapids) {
|
||||
MapleMap mapObj = mapRef.get();
|
||||
|
||||
if (mapObj != null) {
|
||||
List<MapleMapItem> partyMapItems = mapObj.updatePlayerItemDropsToParty(partyId, id, partyMembers, partyLeaver);
|
||||
List<MapItem> partyMapItems = mapObj.updatePlayerItemDropsToParty(partyId, id, partyMembers, partyLeaver);
|
||||
if (map.hashCode() == mapObj.hashCode()) {
|
||||
partyItems = partyMapItems;
|
||||
}
|
||||
@@ -1911,13 +1911,13 @@ public class Character extends AbstractCharacterObject {
|
||||
pickupItem(ob, -1);
|
||||
}
|
||||
|
||||
public final void pickupItem(MapleMapObject ob, int petIndex) { // yes, one picks the MapleMapObject, not the MapleMapItem
|
||||
public final void pickupItem(MapleMapObject ob, int petIndex) { // yes, one picks the MapleMapObject, not the MapItem
|
||||
if (ob == null) { // pet index refers to the one picking up the item
|
||||
return;
|
||||
}
|
||||
|
||||
if (ob instanceof MapleMapItem) {
|
||||
MapleMapItem mapitem = (MapleMapItem) ob;
|
||||
if (ob instanceof MapItem) {
|
||||
MapItem mapitem = (MapItem) ob;
|
||||
if (System.currentTimeMillis() - mapitem.getDropTime() < 400 || !mapitem.canBePickedBy(this)) {
|
||||
sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,7 @@ package client.command.commands.gm2;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.maps.MapleMapItem;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class LootCommand extends Command {
|
||||
public void execute(Client c, String[] params) {
|
||||
List<MapleMapObject> items = c.getPlayer().getMap().getMapObjectsInRange(c.getPlayer().getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapleMapObject item : items) {
|
||||
MapleMapItem mapItem = (MapleMapItem) item;
|
||||
MapItem mapItem = (MapItem) item;
|
||||
if (mapItem.getOwnerId() == c.getPlayer().getId() || mapItem.getOwnerId() == c.getPlayer().getPartyId()) {
|
||||
c.getPlayer().pickupItem(mapItem);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import client.Client;
|
||||
import client.command.Command;
|
||||
import client.inventory.Pet;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import server.maps.MapleMapItem;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
@@ -46,7 +46,7 @@ public class ForceVacCommand extends Command {
|
||||
Character player = c.getPlayer();
|
||||
List<MapleMapObject> items = player.getMap().getMapObjectsInRange(player.getPosition(), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.ITEM));
|
||||
for (MapleMapObject item : items) {
|
||||
MapleMapItem mapItem = (MapleMapItem) item;
|
||||
MapItem mapItem = (MapItem) item;
|
||||
|
||||
mapItem.lockItem();
|
||||
try {
|
||||
|
||||
@@ -36,8 +36,8 @@ import scripting.AbstractPlayerInteraction;
|
||||
import server.MapleStatEffect;
|
||||
import server.TimerManager;
|
||||
import server.life.*;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.MapleMapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import tools.PacketCreator;
|
||||
@@ -153,7 +153,7 @@ public abstract class AbstractDealDamageHandler extends AbstractPacketHandler {
|
||||
for (Integer oned : attack.allDamage.keySet()) {
|
||||
MapleMapObject mapobject = map.getMapObject(oned);
|
||||
if (mapobject != null && mapobject.getType() == MapleMapObjectType.ITEM) {
|
||||
final MapleMapItem mapitem = (MapleMapItem) mapobject;
|
||||
final MapItem mapitem = (MapItem) mapobject;
|
||||
if (mapitem.getMeso() == 0) { //Maybe it is possible some how?
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import client.Client;
|
||||
import client.inventory.Pet;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.maps.MapleMapItem;
|
||||
import server.maps.MapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import tools.PacketCreator;
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class PetLootHandler extends AbstractPacketHandler {
|
||||
int oid = p.readInt();
|
||||
MapleMapObject ob = chr.getMap().getMapObject(oid);
|
||||
try {
|
||||
MapleMapItem mapitem = (MapleMapItem) ob;
|
||||
MapItem mapitem = (MapItem) ob;
|
||||
if (mapitem.getMeso() > 0) {
|
||||
if (!chr.isEquippedMesoMagnet()) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
|
||||
@@ -30,7 +30,7 @@ import tools.PacketCreator;
|
||||
import java.awt.*;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
public class MapleMapItem extends AbstractMapObject {
|
||||
public class MapItem extends AbstractMapObject {
|
||||
protected Client ownerClient;
|
||||
protected Item item;
|
||||
protected MapleMapObject dropper;
|
||||
@@ -38,9 +38,9 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
protected byte type;
|
||||
protected boolean pickedUp = false, playerDrop, partyDrop;
|
||||
protected long dropTime;
|
||||
private Lock itemLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_ITEM);
|
||||
private final Lock itemLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.MAP_ITEM);
|
||||
|
||||
public MapleMapItem(Item item, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
public MapItem(Item item, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
setPosition(position);
|
||||
this.item = item;
|
||||
this.dropper = dropper;
|
||||
@@ -53,7 +53,7 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
this.playerDrop = playerDrop;
|
||||
}
|
||||
|
||||
public MapleMapItem(Item item, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop, int questid) {
|
||||
public MapItem(Item item, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop, int questid) {
|
||||
setPosition(position);
|
||||
this.item = item;
|
||||
this.dropper = dropper;
|
||||
@@ -67,7 +67,7 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
this.questid = questid;
|
||||
}
|
||||
|
||||
public MapleMapItem(int meso, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
public MapItem(int meso, Point position, MapleMapObject dropper, Character owner, Client ownerClient, byte type, boolean playerDrop) {
|
||||
setPosition(position);
|
||||
this.item = null;
|
||||
this.dropper = dropper;
|
||||
@@ -96,21 +96,21 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
}
|
||||
|
||||
public final MapleMapObject getDropper() {
|
||||
return dropper;
|
||||
return dropper;
|
||||
}
|
||||
|
||||
public final int getOwnerId() {
|
||||
return character_ownerid;
|
||||
return character_ownerid;
|
||||
}
|
||||
|
||||
|
||||
public final int getPartyOwnerId() {
|
||||
return party_ownerid;
|
||||
}
|
||||
|
||||
|
||||
public final void setPartyOwnerId(int partyid) {
|
||||
party_ownerid = partyid;
|
||||
}
|
||||
|
||||
|
||||
public final int getClientsideOwnerId() { // thanks nozphex (RedHat) for noting an issue with collecting party items
|
||||
if (this.party_ownerid == -1) {
|
||||
return this.character_ownerid;
|
||||
@@ -118,22 +118,24 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
return this.party_ownerid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public final boolean hasClientsideOwnership(Character player) {
|
||||
return this.character_ownerid == player.getId() || this.party_ownerid == player.getPartyId() || hasExpiredOwnershipTime();
|
||||
}
|
||||
|
||||
|
||||
public final boolean isFFADrop() {
|
||||
return type == 2 || type == 3 || hasExpiredOwnershipTime();
|
||||
}
|
||||
|
||||
|
||||
public final boolean hasExpiredOwnershipTime() {
|
||||
return System.currentTimeMillis() - dropTime >= 15 * 1000;
|
||||
}
|
||||
|
||||
|
||||
public final boolean canBePickedBy(Character chr) {
|
||||
if (character_ownerid <= 0 || isFFADrop()) return true;
|
||||
|
||||
if (character_ownerid <= 0 || isFFADrop()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (party_ownerid == -1) {
|
||||
if (chr.getId() == character_ownerid) {
|
||||
return true;
|
||||
@@ -149,30 +151,30 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return hasExpiredOwnershipTime();
|
||||
}
|
||||
|
||||
|
||||
public final Client getOwnerClient() {
|
||||
return (ownerClient.isLoggedIn() && !ownerClient.getPlayer().isAwayFromWorld()) ? ownerClient : null;
|
||||
return (ownerClient.isLoggedIn() && !ownerClient.getPlayer().isAwayFromWorld()) ? ownerClient : null;
|
||||
}
|
||||
|
||||
public final int getMeso() {
|
||||
return meso;
|
||||
return meso;
|
||||
}
|
||||
|
||||
public final boolean isPlayerDrop() {
|
||||
return playerDrop;
|
||||
return playerDrop;
|
||||
}
|
||||
|
||||
public final boolean isPickedUp() {
|
||||
return pickedUp;
|
||||
return pickedUp;
|
||||
}
|
||||
|
||||
public void setPickedUp(final boolean pickedUp) {
|
||||
this.pickedUp = pickedUp;
|
||||
this.pickedUp = pickedUp;
|
||||
}
|
||||
|
||||
|
||||
public long getDropTime() {
|
||||
return dropTime;
|
||||
}
|
||||
@@ -182,34 +184,34 @@ public class MapleMapItem extends AbstractMapObject {
|
||||
}
|
||||
|
||||
public byte getDropType() {
|
||||
return type;
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void lockItem() {
|
||||
itemLock.lock();
|
||||
}
|
||||
|
||||
|
||||
public void unlockItem() {
|
||||
itemLock.unlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.ITEM;
|
||||
return MapleMapObjectType.ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSpawnData(final Client client) {
|
||||
Character chr = client.getPlayer();
|
||||
|
||||
if (chr.needQuestItem(questid, getItemId())) {
|
||||
this.lockItem();
|
||||
|
||||
if (chr.needQuestItem(questid, getItemId())) {
|
||||
this.lockItem();
|
||||
try {
|
||||
client.sendPacket(PacketCreator.dropItemFromMapObject(chr, this, null, getPosition(), (byte) 2));
|
||||
} finally {
|
||||
this.unlockItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +93,7 @@ public class MapleMap {
|
||||
private final Map<Integer, MaplePortal> portals = new HashMap<>();
|
||||
private final Map<Integer, Integer> backgroundTypes = new HashMap<>();
|
||||
private final Map<String, Integer> environment = new LinkedHashMap<>();
|
||||
private final Map<MapleMapItem, Long> droppedItems = new LinkedHashMap<>();
|
||||
private final Map<MapItem, Long> droppedItems = new LinkedHashMap<>();
|
||||
private final LinkedList<WeakReference<MapleMapObject>> registeredDrops = new LinkedList<>();
|
||||
private final Map<MobLootEntry, Long> mobLootEntries = new HashMap(20);
|
||||
private final List<Runnable> statUpdateRunnables = new ArrayList(50);
|
||||
@@ -861,7 +861,7 @@ public class MapleMap {
|
||||
return droppedItemCount.get();
|
||||
}
|
||||
|
||||
private void instantiateItemDrop(MapleMapItem mdrop) {
|
||||
private void instantiateItemDrop(MapItem mdrop) {
|
||||
if (droppedItemCount.get() >= YamlConfig.config.server.ITEM_LIMIT_ON_MAP) {
|
||||
MapleMapObject mapobj;
|
||||
|
||||
@@ -893,11 +893,11 @@ public class MapleMap {
|
||||
droppedItemCount.incrementAndGet();
|
||||
}
|
||||
|
||||
private void registerItemDrop(MapleMapItem mdrop) {
|
||||
private void registerItemDrop(MapItem mdrop) {
|
||||
droppedItems.put(mdrop, !everlast ? Server.getInstance().getCurrentTime() + YamlConfig.config.server.ITEM_EXPIRE_TIME : Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
private void unregisterItemDrop(MapleMapItem mdrop) {
|
||||
private void unregisterItemDrop(MapItem mdrop) {
|
||||
objectWLock.lock();
|
||||
try {
|
||||
droppedItems.remove(mdrop);
|
||||
@@ -907,13 +907,13 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
private void makeDisappearExpiredItemDrops() {
|
||||
List<MapleMapItem> toDisappear = new LinkedList<>();
|
||||
List<MapItem> toDisappear = new LinkedList<>();
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
long timeNow = Server.getInstance().getCurrentTime();
|
||||
|
||||
for (Entry<MapleMapItem, Long> it : droppedItems.entrySet()) {
|
||||
for (Entry<MapItem, Long> it : droppedItems.entrySet()) {
|
||||
if (it.getValue() < timeNow) {
|
||||
toDisappear.add(it.getKey());
|
||||
}
|
||||
@@ -922,13 +922,13 @@ public class MapleMap {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
|
||||
for (MapleMapItem mmi : toDisappear) {
|
||||
for (MapItem mmi : toDisappear) {
|
||||
makeDisappearItemFromMap(mmi);
|
||||
}
|
||||
|
||||
objectWLock.lock();
|
||||
try {
|
||||
for (MapleMapItem mmi : toDisappear) {
|
||||
for (MapItem mmi : toDisappear) {
|
||||
droppedItems.remove(mmi);
|
||||
}
|
||||
} finally {
|
||||
@@ -993,7 +993,7 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
private List<MapleMapItem> getDroppedItems() {
|
||||
private List<MapItem> getDroppedItems() {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
return new LinkedList<>(droppedItems.keySet());
|
||||
@@ -1004,7 +1004,7 @@ public class MapleMap {
|
||||
|
||||
public int getDroppedItemsCountById(int itemid) {
|
||||
int count = 0;
|
||||
for (MapleMapItem mmi : getDroppedItems()) {
|
||||
for (MapItem mmi : getDroppedItems()) {
|
||||
if (mmi.getItemId() == itemid) {
|
||||
count++;
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ public class MapleMap {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void pickItemDrop(Packet pickupPacket, MapleMapItem mdrop) { // mdrop must be already locked and not-pickedup checked at this point
|
||||
public void pickItemDrop(Packet pickupPacket, MapItem mdrop) { // mdrop must be already locked and not-pickedup checked at this point
|
||||
broadcastMessage(pickupPacket, mdrop.getPosition());
|
||||
|
||||
droppedItemCount.decrementAndGet();
|
||||
@@ -1022,10 +1022,10 @@ public class MapleMap {
|
||||
unregisterItemDrop(mdrop);
|
||||
}
|
||||
|
||||
public List<MapleMapItem> updatePlayerItemDropsToParty(int partyid, int charid, List<Character> partyMembers, Character partyLeaver) {
|
||||
List<MapleMapItem> partyDrops = new LinkedList<>();
|
||||
public List<MapItem> updatePlayerItemDropsToParty(int partyid, int charid, List<Character> partyMembers, Character partyLeaver) {
|
||||
List<MapItem> partyDrops = new LinkedList<>();
|
||||
|
||||
for (MapleMapItem mdrop : getDroppedItems()) {
|
||||
for (MapItem mdrop : getDroppedItems()) {
|
||||
if (mdrop.getOwnerId() == charid) {
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
@@ -1068,8 +1068,8 @@ public class MapleMap {
|
||||
return partyDrops;
|
||||
}
|
||||
|
||||
public void updatePartyItemDropsToNewcomer(Character newcomer, List<MapleMapItem> partyItems) {
|
||||
for (MapleMapItem mdrop : partyItems) {
|
||||
public void updatePartyItemDropsToNewcomer(Character newcomer, List<MapItem> partyItems) {
|
||||
for (MapItem mdrop : partyItems) {
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
if (mdrop.isPickedUp()) {
|
||||
@@ -1095,7 +1095,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
private void spawnDrop(final Item idrop, final Point dropPos, final MapleMapObject dropper, final Character chr, final byte droptype, final short questid) {
|
||||
final MapleMapItem mdrop = new MapleMapItem(idrop, dropPos, dropper, chr, chr.getClient(), droptype, false, questid);
|
||||
final MapItem mdrop = new MapItem(idrop, dropPos, dropper, chr, chr.getClient(), droptype, false, questid);
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
spawnAndAddRangedMapObject(mdrop, c -> {
|
||||
Character chr1 = c.getPlayer();
|
||||
@@ -1116,7 +1116,7 @@ public class MapleMap {
|
||||
|
||||
public final void spawnMesoDrop(final int meso, final Point position, final MapleMapObject dropper, final Character owner, final boolean playerDrop, final byte droptype) {
|
||||
final Point droppos = calcDropPos(position, position);
|
||||
final MapleMapItem mdrop = new MapleMapItem(meso, droppos, dropper, owner, owner.getClient(), droptype, playerDrop);
|
||||
final MapItem mdrop = new MapItem(meso, droppos, dropper, owner, owner.getClient(), droptype, playerDrop);
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
|
||||
spawnAndAddRangedMapObject(mdrop, c -> {
|
||||
@@ -1133,7 +1133,7 @@ public class MapleMap {
|
||||
|
||||
public final void disappearingItemDrop(final MapleMapObject dropper, final Character owner, final Item item, final Point pos) {
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapleMapItem mdrop = new MapleMapItem(item, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
final MapItem mdrop = new MapItem(item, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
@@ -1145,7 +1145,7 @@ public class MapleMap {
|
||||
|
||||
public final void disappearingMesoDrop(final int meso, final MapleMapObject dropper, final Character owner, final Point pos) {
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapleMapItem mdrop = new MapleMapItem(meso, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
final MapItem mdrop = new MapItem(meso, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
@@ -2137,7 +2137,7 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapleMapItem mdrop = new MapleMapItem(item, droppos, dropper, owner, owner.getClient(), dropType, playerDrop);
|
||||
final MapItem mdrop = new MapItem(item, droppos, dropper, owner, owner.getClient(), dropType, playerDrop);
|
||||
mdrop.setDropTime(Server.getInstance().getCurrentTime());
|
||||
|
||||
spawnAndAddRangedMapObject(mdrop, c -> {
|
||||
@@ -2208,7 +2208,7 @@ public class MapleMap {
|
||||
service.registerOverallAction(mapid, r, delay);
|
||||
}
|
||||
|
||||
private void activateItemReactors(final MapleMapItem drop, final Client c) {
|
||||
private void activateItemReactors(final MapItem drop, final Client c) {
|
||||
final Item item = drop.getItem();
|
||||
|
||||
for (final MapleMapObject o : getReactors()) {
|
||||
@@ -2232,7 +2232,7 @@ public class MapleMap {
|
||||
int reactItem = reactProp.getLeft(), reactQty = reactProp.getRight();
|
||||
Rectangle reactArea = react.getArea();
|
||||
|
||||
List<MapleMapItem> list;
|
||||
List<MapItem> list;
|
||||
objectRLock.lock();
|
||||
try {
|
||||
list = new ArrayList<>(droppedItems.keySet());
|
||||
@@ -2240,7 +2240,7 @@ public class MapleMap {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
|
||||
for (final MapleMapItem drop : list) {
|
||||
for (final MapItem drop : list) {
|
||||
drop.lockItem();
|
||||
try {
|
||||
if (!drop.isPickedUp()) {
|
||||
@@ -2830,15 +2830,15 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
private void broadcastItemDropMessage(MapleMapItem mdrop, Point dropperPos, Point dropPos, byte mod, Point rangedFrom) {
|
||||
private void broadcastItemDropMessage(MapItem mdrop, Point dropperPos, Point dropPos, byte mod, Point rangedFrom) {
|
||||
broadcastItemDropMessage(mdrop, dropperPos, dropPos, mod, getRangedDistance(), rangedFrom);
|
||||
}
|
||||
|
||||
private void broadcastItemDropMessage(MapleMapItem mdrop, Point dropperPos, Point dropPos, byte mod) {
|
||||
private void broadcastItemDropMessage(MapItem mdrop, Point dropperPos, Point dropPos, byte mod) {
|
||||
broadcastItemDropMessage(mdrop, dropperPos, dropPos, mod, Double.POSITIVE_INFINITY, null);
|
||||
}
|
||||
|
||||
private void broadcastItemDropMessage(MapleMapItem mdrop, Point dropperPos, Point dropPos, byte mod, double rangeSq, Point rangedFrom) {
|
||||
private void broadcastItemDropMessage(MapItem mdrop, Point dropperPos, Point dropPos, byte mod, double rangeSq, Point rangedFrom) {
|
||||
chrRLock.lock();
|
||||
try {
|
||||
for (Character chr : characters) {
|
||||
@@ -3343,14 +3343,14 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
public boolean makeDisappearItemFromMap(MapleMapObject mapobj) {
|
||||
if (mapobj instanceof MapleMapItem) {
|
||||
return makeDisappearItemFromMap((MapleMapItem) mapobj);
|
||||
if (mapobj instanceof MapItem) {
|
||||
return makeDisappearItemFromMap((MapItem) mapobj);
|
||||
} else {
|
||||
return mapobj == null; // no drop to make disappear...
|
||||
}
|
||||
}
|
||||
|
||||
public boolean makeDisappearItemFromMap(MapleMapItem mapitem) {
|
||||
public boolean makeDisappearItemFromMap(MapItem mapitem) {
|
||||
if (mapitem != null && mapitem == getMapObject(mapitem.getObjectId())) {
|
||||
mapitem.lockItem();
|
||||
try {
|
||||
@@ -3412,11 +3412,11 @@ public class MapleMap {
|
||||
|
||||
private class ActivateItemReactor implements Runnable {
|
||||
|
||||
private final MapleMapItem mapitem;
|
||||
private final MapItem mapitem;
|
||||
private final MapleReactor reactor;
|
||||
private final Client c;
|
||||
|
||||
public ActivateItemReactor(MapleMapItem mapitem, MapleReactor reactor, Client c) {
|
||||
public ActivateItemReactor(MapItem mapitem, MapleReactor reactor, Client c) {
|
||||
this.mapitem = mapitem;
|
||||
this.reactor = reactor;
|
||||
this.c = c;
|
||||
|
||||
@@ -1748,7 +1748,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet updateMapItemObject(MapleMapItem drop, boolean giveOwnership) {
|
||||
public static Packet updateMapItemObject(MapItem drop, boolean giveOwnership) {
|
||||
OutPacket p = OutPacket.create(SendOpcode.DROP_ITEM_FROM_MAPOBJECT);
|
||||
p.writeByte(2);
|
||||
p.writeInt(drop.getObjectId());
|
||||
@@ -1766,7 +1766,7 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet dropItemFromMapObject(Character player, MapleMapItem drop, Point dropfrom, Point dropto, byte mod) {
|
||||
public static Packet dropItemFromMapObject(Character player, MapItem drop, Point dropfrom, Point dropto, byte mod) {
|
||||
int dropType = drop.getDropType();
|
||||
if (drop.hasClientsideOwnership(player) && dropType < 3) {
|
||||
dropType = 2;
|
||||
|
||||
Reference in New Issue
Block a user