ge plugin: include if trade is synced on login
This commit is contained in:
@@ -32,6 +32,7 @@ public class GrandExchangeTrade
|
|||||||
{
|
{
|
||||||
private boolean buy;
|
private boolean buy;
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
|
private boolean login;
|
||||||
private int itemId;
|
private int itemId;
|
||||||
private int quantity;
|
private int quantity;
|
||||||
private int total;
|
private int total;
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public class GrandExchangeController
|
|||||||
Trade trade = new Trade();
|
Trade trade = new Trade();
|
||||||
trade.setBuy(grandExchangeTrade.isBuy());
|
trade.setBuy(grandExchangeTrade.isBuy());
|
||||||
trade.setCancel(grandExchangeTrade.isCancel());
|
trade.setCancel(grandExchangeTrade.isCancel());
|
||||||
|
trade.setLogin(grandExchangeTrade.isLogin());
|
||||||
trade.setItemId(grandExchangeTrade.getItemId());
|
trade.setItemId(grandExchangeTrade.getItemId());
|
||||||
trade.setQuantity(grandExchangeTrade.getQuantity());
|
trade.setQuantity(grandExchangeTrade.getQuantity());
|
||||||
trade.setTotal(grandExchangeTrade.getTotal());
|
trade.setTotal(grandExchangeTrade.getTotal());
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class Trade
|
|||||||
{
|
{
|
||||||
private boolean buy;
|
private boolean buy;
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
|
private boolean login;
|
||||||
private int itemId;
|
private int itemId;
|
||||||
private int quantity;
|
private int quantity;
|
||||||
private int total;
|
private int total;
|
||||||
|
|||||||
+14
@@ -116,6 +116,7 @@ import org.apache.commons.text.similarity.FuzzyScore;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class GrandExchangePlugin extends Plugin
|
public class GrandExchangePlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
private static final int GE_SLOTS = 8;
|
||||||
private static final int OFFER_CONTAINER_ITEM = 21;
|
private static final int OFFER_CONTAINER_ITEM = 21;
|
||||||
private static final int OFFER_DEFAULT_ITEM_ID = 6512;
|
private static final int OFFER_DEFAULT_ITEM_ID = 6512;
|
||||||
private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
|
private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
|
||||||
@@ -185,6 +186,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private GrandExchangeClient grandExchangeClient;
|
private GrandExchangeClient grandExchangeClient;
|
||||||
|
private boolean loginBurstGeUpdates;
|
||||||
private static String machineUuid;
|
private static String machineUuid;
|
||||||
|
|
||||||
private boolean wasFuzzySearch;
|
private boolean wasFuzzySearch;
|
||||||
@@ -375,6 +377,9 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
final int slot = offerEvent.getSlot();
|
final int slot = offerEvent.getSlot();
|
||||||
final GrandExchangeOffer offer = offerEvent.getOffer();
|
final GrandExchangeOffer offer = offerEvent.getOffer();
|
||||||
|
|
||||||
|
log.debug("GE offer updated: state: {}, slot: {}, item: {}, qty: {}, login: {}",
|
||||||
|
offer.getState(), slot, offer.getItemId(), offer.getQuantitySold(), loginBurstGeUpdates);
|
||||||
|
|
||||||
ItemComposition offerItem = itemManager.getItemComposition(offer.getItemId());
|
ItemComposition offerItem = itemManager.getItemComposition(offer.getItemId());
|
||||||
boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1;
|
boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1;
|
||||||
BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack);
|
BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack);
|
||||||
@@ -383,6 +388,11 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
submitTrade(slot, offer);
|
submitTrade(slot, offer);
|
||||||
|
|
||||||
updateConfig(slot, offer);
|
updateConfig(slot, offer);
|
||||||
|
|
||||||
|
if (loginBurstGeUpdates && slot == GE_SLOTS - 1) // slots are sent sequentially on login; this is the last one
|
||||||
|
{
|
||||||
|
loginBurstGeUpdates = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -407,6 +417,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
grandExchangeTrade.setSpent(0);
|
grandExchangeTrade.setSpent(0);
|
||||||
grandExchangeTrade.setOffer(offer.getPrice());
|
grandExchangeTrade.setOffer(offer.getPrice());
|
||||||
grandExchangeTrade.setWorldType(getGeWorldType());
|
grandExchangeTrade.setWorldType(getGeWorldType());
|
||||||
|
grandExchangeTrade.setLogin(loginBurstGeUpdates);
|
||||||
|
|
||||||
log.debug("Submitting new trade: {}", grandExchangeTrade);
|
log.debug("Submitting new trade: {}", grandExchangeTrade);
|
||||||
grandExchangeClient.submit(grandExchangeTrade);
|
grandExchangeClient.submit(grandExchangeTrade);
|
||||||
@@ -436,6 +447,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
grandExchangeTrade.setSpent(offer.getSpent());
|
grandExchangeTrade.setSpent(offer.getSpent());
|
||||||
grandExchangeTrade.setOffer(offer.getPrice());
|
grandExchangeTrade.setOffer(offer.getPrice());
|
||||||
grandExchangeTrade.setWorldType(getGeWorldType());
|
grandExchangeTrade.setWorldType(getGeWorldType());
|
||||||
|
grandExchangeTrade.setLogin(loginBurstGeUpdates);
|
||||||
|
|
||||||
log.debug("Submitting cancelled: {}", grandExchangeTrade);
|
log.debug("Submitting cancelled: {}", grandExchangeTrade);
|
||||||
grandExchangeClient.submit(grandExchangeTrade);
|
grandExchangeClient.submit(grandExchangeTrade);
|
||||||
@@ -457,6 +469,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
grandExchangeTrade.setSpent(dspent);
|
grandExchangeTrade.setSpent(dspent);
|
||||||
grandExchangeTrade.setOffer(offer.getPrice());
|
grandExchangeTrade.setOffer(offer.getPrice());
|
||||||
grandExchangeTrade.setWorldType(getGeWorldType());
|
grandExchangeTrade.setWorldType(getGeWorldType());
|
||||||
|
grandExchangeTrade.setLogin(loginBurstGeUpdates);
|
||||||
|
|
||||||
log.debug("Submitting trade: {}", grandExchangeTrade);
|
log.debug("Submitting trade: {}", grandExchangeTrade);
|
||||||
grandExchangeClient.submit(grandExchangeTrade);
|
grandExchangeClient.submit(grandExchangeTrade);
|
||||||
@@ -522,6 +535,7 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
|
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
|
||||||
{
|
{
|
||||||
panel.getOffersPanel().resetOffers();
|
panel.getOffersPanel().resetOffers();
|
||||||
|
loginBurstGeUpdates = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user