ge plugin: include if trade is synced on login
This commit is contained in:
@@ -116,6 +116,7 @@ import org.apache.commons.text.similarity.FuzzyScore;
|
||||
@Slf4j
|
||||
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_DEFAULT_ITEM_ID = 6512;
|
||||
private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
|
||||
@@ -185,6 +186,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
|
||||
@Inject
|
||||
private GrandExchangeClient grandExchangeClient;
|
||||
private boolean loginBurstGeUpdates;
|
||||
private static String machineUuid;
|
||||
|
||||
private boolean wasFuzzySearch;
|
||||
@@ -375,6 +377,9 @@ public class GrandExchangePlugin extends Plugin
|
||||
final int slot = offerEvent.getSlot();
|
||||
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());
|
||||
boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1;
|
||||
BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack);
|
||||
@@ -383,6 +388,11 @@ public class GrandExchangePlugin extends Plugin
|
||||
submitTrade(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
|
||||
@@ -407,6 +417,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
grandExchangeTrade.setSpent(0);
|
||||
grandExchangeTrade.setOffer(offer.getPrice());
|
||||
grandExchangeTrade.setWorldType(getGeWorldType());
|
||||
grandExchangeTrade.setLogin(loginBurstGeUpdates);
|
||||
|
||||
log.debug("Submitting new trade: {}", grandExchangeTrade);
|
||||
grandExchangeClient.submit(grandExchangeTrade);
|
||||
@@ -436,6 +447,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
grandExchangeTrade.setSpent(offer.getSpent());
|
||||
grandExchangeTrade.setOffer(offer.getPrice());
|
||||
grandExchangeTrade.setWorldType(getGeWorldType());
|
||||
grandExchangeTrade.setLogin(loginBurstGeUpdates);
|
||||
|
||||
log.debug("Submitting cancelled: {}", grandExchangeTrade);
|
||||
grandExchangeClient.submit(grandExchangeTrade);
|
||||
@@ -457,6 +469,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
grandExchangeTrade.setSpent(dspent);
|
||||
grandExchangeTrade.setOffer(offer.getPrice());
|
||||
grandExchangeTrade.setWorldType(getGeWorldType());
|
||||
grandExchangeTrade.setLogin(loginBurstGeUpdates);
|
||||
|
||||
log.debug("Submitting trade: {}", grandExchangeTrade);
|
||||
grandExchangeClient.submit(grandExchangeTrade);
|
||||
@@ -522,6 +535,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
panel.getOffersPanel().resetOffers();
|
||||
loginBurstGeUpdates = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user