@Override
public void onComplete() {
Util.printConsole("OnComplete called", bot, ConsoleColor.White, true);
final Map<Integer, DualMInt> itemTotals = new HashMap<Integer, DualMInt>();
itemTotals.put(5000, new DualMInt(0, 0));
itemTotals.put(5001, new DualMInt(0, 0));
itemTotals.put(5002, new DualMInt(0, 0));
for (final long child : trade.OtherTrade) {
final Item record = trade.OtherInventory.getItem(child);
if (itemTotals.containsKey(record.defIndex)) {
itemTotals.get(record.defIndex).get1().increment();
} else {
itemTotals.put(record.defIndex, new DualMInt(1, 0));
}
}
for (final long child : trade.MyTrade) {
final Item record = trade.MyInventory.getItem(child);
if (record.defIndex < 5000 || record.defIndex > 5002) {
Main.sql.update("DELETE FROM reservation WHERE itemid = '" + record.defIndex + "' && steamid = '" + trade.otherSID.convertToLong() + "' LIMIT 1");
}
if (itemTotals.containsKey(record.defIndex)) {
itemTotals.get(record.defIndex).get2().increment();
} else {
itemTotals.put(record.defIndex, new DualMInt(0, 1));
}
}
final int id = Main.sql.insert("INSERT INTO tradelog (steamid, botid, success) VALUES ('" + trade.otherSID.convertToLong() + "', '" + bot.getBotId() + "', '1')");