Package uk.co.thomasc.scrapbanktf.inventory

Examples of uk.co.thomasc.scrapbanktf.inventory.Inventory


    }
  }

  public void run() {
    synchronized (AutoScrap.lck) {
      final Inventory MyInventory = Inventory.fetchInventory(bot.steamClient.getSteamId().convertToLong(), false);
      if (MyInventory == null) {
        Util.printConsole("Could not fetch own inventory via Steam API! (AutoScrap)", bot, ConsoleColor.White, true);
      }
     
      metal.put(0, new ArrayList<Long>());
      metal.put(1, new ArrayList<Long>());
      metal.put(2, new ArrayList<Long>());

      final ResultSet result = Main.sql.selectQuery("SELECT schemaid, classid, (stock - COUNT(reservation.Id) + IF(highvalue=1 and stock - COUNT(reservation.Id) > 1,-2,0)) as stk FROM items LEFT JOIN reservation ON items.schemaid = reservation.itemid WHERE highvalue != 2 GROUP BY items.schemaid HAVING stk > 4");
      final Map<Integer, MutableInt> count = new HashMap<Integer, MutableInt>();
      final Map<Integer, Byte> classid = new HashMap<Integer, Byte>();
      final Map<Integer, MutableInt> scraped = new HashMap<Integer, MutableInt>();
      try {
        while (result.next()) {
          try {
            count.put(result.getInt("schemaid"), new MutableInt(result.getInt("stk")));
            classid.put(result.getInt("schemaid"), result.getByte("classid"));
            scraped.put(result.getInt("schemaid"), new MutableInt(0));
          } catch (final SQLException e) {
            e.printStackTrace();
          }
        }
      } catch (final SQLException e) {
        e.printStackTrace();
      }
      final Map<Byte, Long> otherid = new HashMap<Byte, Long>();

      for (final Long id : MyInventory.getItemIds()) {
        final Item item = MyInventory.getItem(id);

        if (count.containsKey(item.defIndex) && count.get(item.defIndex).get() > 4) {
          count.get(item.defIndex).decrement();
          if (otherid.containsKey(classid.get(item.defIndex))) {
            final Item item2 = MyInventory.getItem(otherid.get(classid.get(item.defIndex)));
            CraftResponseCallback callback = scrap(otherid.get(classid.get(item.defIndex)), id);
            if (callback != null) {
              for (long itemId : callback.getItems()) {
                metal.get(0).add(itemId);
              }
View Full Code Here


          weapons.add(i);
        }
      }
    }

    final Inventory inv = Inventory.fetchInventory(cmdInfo.getSteamid().convertToLong());
    for (final Item item : inv.items) {
      weapons.remove((Integer) item.defIndex);
    }

    String out = "Woah, you sir are a god among gigs\nYou have all essential items :D";
View Full Code Here

TOP

Related Classes of uk.co.thomasc.scrapbanktf.inventory.Inventory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.