Search in sources :

Example 21 with MapleClient

use of client.MapleClient in project HeavenMS by ronancpl.

the class MapleMap method searchItemReactors.

public void searchItemReactors(final MapleReactor react) {
    if (react.getReactorType() == 100) {
        Pair<Integer, Integer> reactProp = react.getReactItem(react.getEventState());
        int reactItem = reactProp.getLeft(), reactQty = reactProp.getRight();
        Rectangle reactArea = react.getArea();
        List<MapleMapItem> list = new ArrayList<>();
        objectRLock.lock();
        try {
            for (MapleMapItem mmi : droppedItems.keySet()) {
                if (!mmi.isPickedUp()) {
                    list.add(mmi);
                }
            }
        } finally {
            objectRLock.unlock();
        }
        for (final MapleMapItem drop : list) {
            final Item item = drop.getItem();
            if (item != null && reactItem == item.getItemId() && reactQty == item.getQuantity()) {
                if (reactArea.contains(drop.getPosition())) {
                    MapleClient owner = drop.getOwnerClient();
                    if (owner != null) {
                        TimerManager.getInstance().schedule(new ActivateItemReactor(drop, react, owner), 5000);
                    }
                }
            }
        }
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Item(client.inventory.Item) Rectangle(java.awt.Rectangle) ArrayList(java.util.ArrayList) MapleClient(client.MapleClient) Point(java.awt.Point) SpawnPoint(server.life.SpawnPoint)

Aggregations

MapleClient (client.MapleClient)21 Item (client.inventory.Item)4 Point (java.awt.Point)4 LinkedList (java.util.LinkedList)4 SpawnPoint (server.life.SpawnPoint)4 MapleInventoryType (client.inventory.MapleInventoryType)3 ArrayList (java.util.ArrayList)3 MapleAESOFB (tools.MapleAESOFB)3 MapleCharacter (client.MapleCharacter)2 SQLException (java.sql.SQLException)2 LinkedHashMap (java.util.LinkedHashMap)2 Pair (tools.Pair)2 MapleJob (client.MapleJob)1 Skill (client.Skill)1 Equip (client.inventory.Equip)1 ScrollResult (client.inventory.Equip.ScrollResult)1 MaplePet (client.inventory.MaplePet)1 ModifyInventory (client.inventory.ModifyInventory)1 Rectangle (java.awt.Rectangle)1 IOException (java.io.IOException)1